From ebdcc11c8015680f5c560f0de90e9e348d23124f Mon Sep 17 00:00:00 2001 From: mezz Date: Mon, 12 Oct 2015 21:35:15 -0700 Subject: [PATCH 001/133] Allow server to access Potion isBadEffect() --- .../minecraft/net/minecraft/potion/Potion.java.patch | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/potion/Potion.java.patch b/patches/minecraft/net/minecraft/potion/Potion.java.patch index 5892ca8c8..dfbcdf5fb 100644 --- a/patches/minecraft/net/minecraft/potion/Potion.java.patch +++ b/patches/minecraft/net/minecraft/potion/Potion.java.patch @@ -1,6 +1,14 @@ --- ../src-base/minecraft/net/minecraft/potion/Potion.java +++ ../src-work/minecraft/net/minecraft/potion/Potion.java -@@ -330,4 +330,27 @@ +@@ -244,7 +244,6 @@ + return this.field_76417_J; + } + +- @SideOnly(Side.CLIENT) + public boolean func_76398_f() + { + return this.field_76418_K; +@@ -330,4 +329,27 @@ { return p_111183_2_.func_111164_d() * (double)(p_111183_1_ + 1); } From ff19efe146e4ac5a73d0a86fd869456d54a2b32b Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 8 Nov 2015 12:52:32 -0500 Subject: [PATCH 002/133] 1.8.8 initial work --- build.gradle | 22 ++- jsons/1.8.8-dev.json | 323 +++++++++++++++++++++++++++++++++++++++++++ jsons/1.8.8-rel.json | 129 +++++++++++++++++ jsons/1.8.8.json | 244 ++++++++++++++++++++++++++++++++ 4 files changed, 706 insertions(+), 12 deletions(-) create mode 100644 jsons/1.8.8-dev.json create mode 100644 jsons/1.8.8-rel.json create mode 100644 jsons/1.8.8.json diff --git a/build.gradle b/build.gradle index 1777bd41a..2973a331d 100644 --- a/build.gradle +++ b/build.gradle @@ -15,16 +15,22 @@ buildscript { } } +repositories { + maven { + name = "local" + url = "file:///home/cpw/projects/repo" + } +} apply plugin: "maven" apply plugin: "net.minecraftforge.gradle.patcher" apply plugin: "net.minecraftforge.gradle.launch4j" minecraft { - version = "1.8" + version = "1.8.8" //mappings = 'stable_16' mappings = "snapshot_nodoc_20141130" workspaceDir = "projects" - versionJson = "jsons/1.8-dev.json" + versionJson = "jsons/1.8.8-dev.json" buildUserdev = true buildInstaller = true installerVersion = "1.4" @@ -39,20 +45,12 @@ minecraft { } projects { -// fml { -// rootDir 'fml' -// patchDir "fml/patches/minecraft" -// patchAfter "clean" -// genPatchesFrom "clean" -// -// with common -// } forge { rootDir "." patchDir "patches/minecraft" patchAfter "clean" genPatchesFrom "clean" - + genMcpPatches = true with common } } @@ -66,7 +64,7 @@ extractForgeSources { exclude "**/SideOnly.java", "**/Side.java" } genGradleProjects { addTestCompileDep "junit:junit:4.12" } processJson { - releaseJson = "jsons/1.8-rel.json" + releaseJson = "jsons/1.8.8-rel.json" addReplacements([ "@minecraft_version@": project.minecraft.version, "@version@": project.version, diff --git a/jsons/1.8.8-dev.json b/jsons/1.8.8-dev.json new file mode 100644 index 000000000..72552fdb6 --- /dev/null +++ b/jsons/1.8.8-dev.json @@ -0,0 +1,323 @@ +{ + "id": "@minecraft_version@-@project@@version@", + "time": "@timestamp@", + "releaseTime": "1960-01-01T00:00:00-0700", + "type": "release", + "minecraftArguments": "--version FML_DEV --tweakClass net.minecraftforge.fml.common.launcher.FMLTweaker", + "libraries": [ + { + "name": "net.minecraft:launchwrapper:1.12" + }, + { + "name": "com.google.code.findbugs:jsr305:1.3.9", + "children": ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "org.ow2.asm:asm-debug-all:5.0.3", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "com.typesafe.akka:akka-actor_2.11:2.3.3", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "com.typesafe:config:1.2.1", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "org.scala-lang:scala-actors-migration_2.11:1.1.0", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "org.scala-lang:scala-compiler:2.11.1", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "org.scala-lang.plugins:scala-continuations-library_2.11:1.0.2", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "org.scala-lang.plugins:scala-continuations-plugin_2.11.1:1.0.2", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "org.scala-lang:scala-library:2.11.1", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "org.scala-lang.modules:scala-parser-combinators_2.11:1.0.1", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "org.scala-lang:scala-reflect:2.11.1", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "org.scala-lang.modules:scala-swing_2.11:1.0.1", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "org.scala-lang.modules:scala-xml_2.11:1.0.2", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "lzma:lzma:0.0.1" + }, + { + "name": "java3d:vecmath:1.5.2" + }, + { + "name": "net.sf.trove4j:trove4j:3.0.3" + }, + { + "name": "oshi-project:oshi-core:1.1" + }, + { + "name": "net.java.dev.jna:jna:3.4.0" + }, + { + "name": "net.java.dev.jna:platform:3.4.0" + }, + { + "name": "com.ibm.icu:icu4j-core-mojang:51.2" + }, + { + "name": "net.sf.jopt-simple:jopt-simple:4.6", + "children" : ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "name": "com.paulscode:codecjorbis:20101023" + }, + { + "name": "com.paulscode:codecwav:20101023" + }, + { + "name": "com.paulscode:libraryjavasound:20101123" + }, + { + "name": "com.paulscode:librarylwjglopenal:20100824" + }, + { + "name": "com.paulscode:soundsystem:20120107" + }, + { + "name": "io.netty:netty-all:4.0.23.Final" + }, + { + "name": "com.google.guava:guava:17.0" + }, + { + "name": "org.apache.commons:commons-lang3:3.3.2" + }, + { + "name": "commons-io:commons-io:2.4" + }, + { + "name": "commons-codec:commons-codec:1.9" + }, + { + "name": "net.java.jinput:jinput:2.0.5" + }, + { + "name": "net.java.jutils:jutils:1.0.0" + }, + { + "name": "com.google.code.gson:gson:2.2.4" + }, + { + "name": "com.mojang:authlib:1.5.21" + }, + { + "name": "com.mojang:realms:1.7.39" + }, + { + "name": "org.apache.commons:commons-compress:1.8.1" + }, + { + "name": "org.apache.httpcomponents:httpclient:4.3.3" + }, + { + "name": "commons-logging:commons-logging:1.1.3" + }, + { + "name": "org.apache.httpcomponents:httpcore:4.3.2" + }, + { + "name": "org.apache.logging.log4j:log4j-api:2.0-beta9" + }, + { + "name": "org.apache.logging.log4j:log4j-core:2.0-beta9" + }, + { + "name": "org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209", + "rules": [ + { + "action": "allow" + }, + { + "action": "disallow", + "os": { + "name": "osx" + } + } + ] + }, + { + "name": "org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209", + "rules": [ + { + "action": "allow" + }, + { + "action": "disallow", + "os": { + "name": "osx" + } + } + ] + }, + { + "name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209", + "rules": [ + { + "action": "allow" + }, + { + "action": "disallow", + "os": { + "name": "osx" + } + } + ], + "natives": { + "linux": "natives-linux", + "windows": "natives-windows", + "osx": "natives-osx" + }, + "extract": { + "exclude": [ + "META-INF/" + ] + } + }, + { + "name": "org.lwjgl.lwjgl:lwjgl:2.9.2-nightly-20140822", + "rules": [ + { + "action": "allow", + "os": { + "name": "osx" + } + } + ] + }, + { + "name": "org.lwjgl.lwjgl:lwjgl_util:2.9.2-nightly-20140822", + "rules": [ + { + "action": "allow", + "os": { + "name": "osx" + } + } + ] + }, + { + "name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.2-nightly-20140822", + "rules": [ + { + "action": "allow", + "os": { + "name": "osx" + } + } + ], + "natives": { + "linux": "natives-linux", + "windows": "natives-windows", + "osx": "natives-osx" + }, + "extract": { + "exclude": [ + "META-INF/" + ] + } + }, + { + "name": "net.java.jinput:jinput-platform:2.0.5", + "natives": { + "linux": "natives-linux", + "windows": "natives-windows", + "osx": "natives-osx" + }, + "extract": { + "exclude": [ + "META-INF/" + ] + } + }, + { + "name": "tv.twitch:twitch:6.5" + }, + { + "name": "tv.twitch:twitch-platform:6.5", + "rules": [ + { + "action": "allow" + }, + { + "action": "disallow", + "os": { + "name": "linux" + } + } + ], + "natives": { + "linux": "natives-linux", + "windows": "natives-windows-${arch}", + "osx": "natives-osx" + }, + "extract": { + "exclude": [ + "META-INF/" + ] + } + }, + { + "name": "tv.twitch:twitch-external-platform:4.5", + "rules": [ + { + "action": "allow", + "os": { + "name": "windows" + } + } + ], + "natives": { + "windows": "natives-windows-${arch}" + }, + "extract": { + "exclude": [ + "META-INF/" + ] + } + } + ], + "mainClass": "net.minecraft.launchwrapper.Launch", + "minimumLauncherVersion": 14, + "assets": "1.8" +} diff --git a/jsons/1.8.8-rel.json b/jsons/1.8.8-rel.json new file mode 100644 index 000000000..4a5a0de11 --- /dev/null +++ b/jsons/1.8.8-rel.json @@ -0,0 +1,129 @@ +{ +"install": { + "profileName": "@project@", + "target":"@minecraft_version@-@project@@version@", + "path":"@artifact@", + "version":"@project@ @version@", + "filePath":"@universal_jar@", + "welcome":"Welcome to the simple @project@ installer.", + "minecraft":"@minecraft_version@", + "mirrorList" : "http://files.minecraftforge.net/mirror-brand.list", + "logo":"/big_logo.png" +}, +"versionInfo": { + "id": "@minecraft_version@-@project@@version@", + "time": "@timestamp@", + "releaseTime": "1960-01-01T00:00:00-0700", + "type": "release", + "minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userProperties ${user_properties} --userType ${user_type} --tweakClass net.minecraftforge.fml.common.launcher.FMLTweaker", + "mainClass": "net.minecraft.launchwrapper.Launch", + "minimumLauncherVersion": 14, + "assets": "1.8", + "inheritsFrom": "1.8.8", + "jar": "1.8", + "libraries": [ + { + "name": "@artifact@", + "url": "http://files.minecraftforge.net/maven/" + }, + { + "comment": "Force the downgrade on dedicated server to match client. Netty bug: https://github.com/MinecraftForge/MinecraftForge/issues/1848", + "name": "io.netty:netty-all:4.0.23.Final", + "serverreq":true + }, + { + "name": "net.minecraft:launchwrapper:1.12", + "serverreq":true + }, + { + "name": "org.ow2.asm:asm-all:5.0.3", + "serverreq":true + }, + { + "name": "com.typesafe.akka:akka-actor_2.11:2.3.3", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "ed62e9fc709ca0f2ff1a3220daa8b70a2870078e", "25a86ccfdb6f6dfe08971f4825d0a01be83a6f2e" ], + "serverreq":true, + "clientreq":true + }, + { + "name": "com.typesafe:config:1.2.1", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "f771f71fdae3df231bcd54d5ca2d57f0bf93f467", "7d7bc36df0989d72f2d5d057309675777acc528b" ], + "serverreq":true, + "clientreq":true + }, + { + "name": "org.scala-lang:scala-actors-migration_2.11:1.1.0", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "dfa8bc42b181d5b9f1a5dd147f8ae308b893eb6f", "8c9aaeeb68487ca519411a14068e1b4d69739207" ], + "serverreq":true, + "clientreq":true + }, + { + "name": "org.scala-lang:scala-compiler:2.11.1", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "56ea2e6c025e0821f28d73ca271218b8dd04926a", "1444992390544ba3780867a13ff696a89d7d1639" ], + "serverreq":true, + "clientreq":true + }, + { + "name": "org.scala-lang.plugins:scala-continuations-library_2.11:1.0.2", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "87213338cd5a153a7712cb574c0ddd2edfee0386", "0b4c1bf8d48993f138d6e10c0c144e50acfff581" ], + "serverreq":true, + "clientreq":true + }, + { + "name": "org.scala-lang.plugins:scala-continuations-plugin_2.11.1:1.0.2", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "1f7371605d4ba42aa26d3443440c0083c587b4e9", "1ea655dda4504ae0a367327e2340cd3beaee6c73" ], + "serverreq":true, + "clientreq":true + }, + { + "name": "org.scala-lang:scala-library:2.11.1", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "0e11da23da3eabab9f4777b9220e60d44c1aab6a", "1e4df76e835201c6eabd43adca89ab11f225f134" ], + "serverreq":true, + "clientreq":true + }, + { + "name": "org.scala-lang:scala-parser-combinators_2.11:1.0.1", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "f05d7345bf5a58924f2837c6c1f4d73a938e1ff0", "a1cbbcbde1dcc614f4253ed1aa0b320bc78d8f1d" ], + "serverreq":true, + "clientreq":true + }, + { + "name": "org.scala-lang:scala-reflect:2.11.1", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "6580347e61cc7f8e802941e7fde40fa83b8badeb", "91ce0f0be20f4a536321724b4b3bbc6530ddcd88" ], + "serverreq":true, + "clientreq":true + }, + { + "name": "org.scala-lang:scala-swing_2.11:1.0.1", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "b1cdd92bd47b1e1837139c1c53020e86bb9112ae", "d77152691dcf5bbdb00529af37aa7d3d887b3e63" ], + "serverreq":true, + "clientreq":true + }, + { + "name": "org.scala-lang:scala-xml_2.11:1.0.2", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "7a80ec00aec122fba7cd4e0d4cdd87ff7e4cb6d0", "62736b01689d56b6d09a0164b7ef9da2b0b9633d" ], + "serverreq":true, + "clientreq":true + }, + { + "name": "lzma:lzma:0.0.1", + "serverreq":true + }, + { + "name": "net.sf.jopt-simple:jopt-simple:4.6", + "serverreq":true + } + ] +} +} \ No newline at end of file diff --git a/jsons/1.8.8.json b/jsons/1.8.8.json new file mode 100644 index 000000000..339411424 --- /dev/null +++ b/jsons/1.8.8.json @@ -0,0 +1,244 @@ +{ + "id": "1.8.8", + "time": "2015-07-27T06:31:28-04:00", + "releaseTime": "2015-07-27T06:31:28-04:00", + "type": "release", + "minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userProperties ${user_properties} --userType ${user_type}", + "libraries": [ + { + "name": "oshi-project:oshi-core:1.1" + }, + { + "name": "net.java.dev.jna:jna:3.4.0" + }, + { + "name": "net.java.dev.jna:platform:3.4.0" + }, + { + "name": "com.ibm.icu:icu4j-core-mojang:51.2" + }, + { + "name": "net.sf.jopt-simple:jopt-simple:4.6" + }, + { + "name": "com.paulscode:codecjorbis:20101023" + }, + { + "name": "com.paulscode:codecwav:20101023" + }, + { + "name": "com.paulscode:libraryjavasound:20101123" + }, + { + "name": "com.paulscode:librarylwjglopenal:20100824" + }, + { + "name": "com.paulscode:soundsystem:20120107" + }, + { + "name": "io.netty:netty-all:4.0.23.Final" + }, + { + "name": "com.google.guava:guava:17.0" + }, + { + "name": "org.apache.commons:commons-lang3:3.3.2" + }, + { + "name": "commons-io:commons-io:2.4" + }, + { + "name": "commons-codec:commons-codec:1.9" + }, + { + "name": "net.java.jinput:jinput:2.0.5" + }, + { + "name": "net.java.jutils:jutils:1.0.0" + }, + { + "name": "com.google.code.gson:gson:2.2.4" + }, + { + "name": "com.mojang:authlib:1.5.21" + }, + { + "name": "com.mojang:realms:1.7.39" + }, + { + "name": "org.apache.commons:commons-compress:1.8.1" + }, + { + "name": "org.apache.httpcomponents:httpclient:4.3.3" + }, + { + "name": "commons-logging:commons-logging:1.1.3" + }, + { + "name": "org.apache.httpcomponents:httpcore:4.3.2" + }, + { + "name": "org.apache.logging.log4j:log4j-api:2.0-beta9" + }, + { + "name": "org.apache.logging.log4j:log4j-core:2.0-beta9" + }, + { + "name": "org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209", + "rules": [ + { + "action": "allow" + }, + { + "action": "disallow", + "os": { + "name": "osx" + } + } + ] + }, + { + "name": "org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209", + "rules": [ + { + "action": "allow" + }, + { + "action": "disallow", + "os": { + "name": "osx" + } + } + ] + }, + { + "name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209", + "rules": [ + { + "action": "allow" + }, + { + "action": "disallow", + "os": { + "name": "osx" + } + } + ], + "natives": { + "linux": "natives-linux", + "windows": "natives-windows", + "osx": "natives-osx" + }, + "extract": { + "exclude": [ + "META-INF/" + ] + } + }, + { + "name": "org.lwjgl.lwjgl:lwjgl:2.9.2-nightly-20140822", + "rules": [ + { + "action": "allow", + "os": { + "name": "osx" + } + } + ] + }, + { + "name": "org.lwjgl.lwjgl:lwjgl_util:2.9.2-nightly-20140822", + "rules": [ + { + "action": "allow", + "os": { + "name": "osx" + } + } + ] + }, + { + "name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.2-nightly-20140822", + "rules": [ + { + "action": "allow", + "os": { + "name": "osx" + } + } + ], + "natives": { + "linux": "natives-linux", + "windows": "natives-windows", + "osx": "natives-osx" + }, + "extract": { + "exclude": [ + "META-INF/" + ] + } + }, + { + "name": "net.java.jinput:jinput-platform:2.0.5", + "natives": { + "linux": "natives-linux", + "windows": "natives-windows", + "osx": "natives-osx" + }, + "extract": { + "exclude": [ + "META-INF/" + ] + } + }, + { + "name": "tv.twitch:twitch:6.5" + }, + { + "name": "tv.twitch:twitch-platform:6.5", + "rules": [ + { + "action": "allow" + }, + { + "action": "disallow", + "os": { + "name": "linux" + } + } + ], + "natives": { + "linux": "natives-linux", + "windows": "natives-windows-${arch}", + "osx": "natives-osx" + }, + "extract": { + "exclude": [ + "META-INF/" + ] + } + }, + { + "name": "tv.twitch:twitch-external-platform:4.5", + "rules": [ + { + "action": "allow", + "os": { + "name": "windows" + } + } + ], + "natives": { + "windows": "natives-windows-${arch}" + }, + "extract": { + "exclude": [ + "META-INF/" + ] + } + } + ], + "mainClass": "net.minecraft.client.main.Main", + "minimumLauncherVersion": 14, + "assets": "1.8" +} \ No newline at end of file From b1aa31215f0817244c8823d9232d404482039411 Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 8 Nov 2015 15:50:52 -0500 Subject: [PATCH 003/133] regenerate reference patchset at patches.mcp. These will be used to generate a new patchtree under patches. --- .../net/minecraft/block/Block.java.patch | 348 +++---- .../net/minecraft/block/BlockAir.java.patch | 9 + .../net/minecraft/block/BlockBush.java.patch | 66 ++ .../minecraft/block/BlockButton.java.patch | 46 + .../minecraft/block/BlockCactus.java.patch | 14 +- .../net/minecraft/block/BlockChest.java.patch | 11 + .../net/minecraft/block/BlockCocoa.java.patch | 27 + .../net/minecraft/block/BlockCrops.java.patch | 77 ++ .../minecraft/block/BlockDeadBush.java.patch | 12 +- .../net/minecraft/block/BlockDoor.java.patch | 20 + .../block/BlockDoublePlant.java.patch | 89 ++ .../minecraft/block/BlockFalling.java.patch | 10 + .../minecraft/block/BlockFarmland.java.patch | 11 + .../net/minecraft/block/BlockFire.java.patch | 211 ++++ .../minecraft/block/BlockFlowerPot.java.patch | 22 +- .../net/minecraft/block/BlockGrass.java.patch | 41 + .../block/BlockHugeMushroom.java.patch | 10 +- .../net/minecraft/block/BlockIce.java.patch | 35 + .../minecraft/block/BlockLadder.java.patch | 32 + .../minecraft/block/BlockLeaves.java.patch | 130 +++ .../net/minecraft/block/BlockLever.java.patch | 67 ++ .../net/minecraft/block/BlockLog.java.patch | 24 + .../block/BlockMobSpawner.java.patch | 19 + .../minecraft/block/BlockMushroom.java.patch | 11 + .../minecraft/block/BlockMycelium.java.patch | 20 + .../block/BlockNetherWart.java.patch | 49 + .../minecraft/block/BlockNewLeaf.java.patch | 24 + .../net/minecraft/block/BlockNote.java.patch | 23 + .../minecraft/block/BlockOldLeaf.java.patch | 21 + .../net/minecraft/block/BlockOre.java.patch | 59 ++ .../net/minecraft/block/BlockPane.java.patch | 41 + .../block/BlockPistonBase.java.patch | 31 + .../block/BlockPistonMoving.java.patch | 37 + .../minecraft/block/BlockPotato.java.patch | 25 + .../minecraft/block/BlockPumpkin.java.patch | 11 + .../minecraft/block/BlockQuartz.java.patch | 12 +- .../minecraft/block/BlockRailBase.java.patch | 44 +- .../block/BlockRedstoneComparator.java.patch | 6 +- .../block/BlockRedstoneDiode.java.patch | 11 + .../block/BlockRedstoneOre.java.patch | 22 + .../block/BlockRedstoneWire.java.patch | 59 ++ .../net/minecraft/block/BlockReed.java.patch | 12 +- .../block/BlockRotatedPillar.java.patch | 10 +- .../minecraft/block/BlockSapling.java.patch | 10 + .../net/minecraft/block/BlockSkull.java.patch | 55 ++ .../net/minecraft/block/BlockSnow.java.patch | 53 + .../net/minecraft/block/BlockStem.java.patch | 42 + .../minecraft/block/BlockTallGrass.java.patch | 66 ++ .../net/minecraft/block/BlockTorch.java.patch | 38 + .../minecraft/block/BlockTrapDoor.java.patch | 43 + .../block/BlockTripWireHook.java.patch | 29 + .../net/minecraft/block/BlockVine.java.patch | 16 +- .../BlockPistonStructureHelper.java.patch | 29 + .../block/state/BlockState.java.patch | 30 +- .../block/state/BlockStateBase.java.patch | 0 .../client/ClientBrandRetriever.java.patch | 0 .../client/LoadingScreenRenderer.java.patch | 26 + .../net/minecraft/client/Minecraft.java.patch | 476 +++++++++ .../client/audio/SoundManager.java.patch | 24 +- .../entity/AbstractClientPlayer.java.patch | 0 .../client/entity/EntityPlayerSP.java.patch | 80 ++ .../client/gui/FontRenderer.java.patch | 155 +++ .../minecraft/client/gui/GuiButton.java.patch | 14 +- .../minecraft/client/gui/GuiChat.java.patch | 10 +- .../client/gui/GuiCreateWorld.java.patch | 36 + .../client/gui/GuiIngameMenu.java.patch | 33 + .../client/gui/GuiMainMenu.java.patch | 44 + .../client/gui/GuiMultiplayer.java.patch | 19 + .../client/gui/GuiOverlayDebug.java.patch | 12 + .../minecraft/client/gui/GuiScreen.java.patch | 113 +++ .../client/gui/GuiSelectWorld.java.patch | 4 +- .../client/gui/GuiSleepMP.java.patch | 11 + .../minecraft/client/gui/GuiSlot.java.patch | 40 + .../gui/ServerListEntryNormal.java.patch | 23 + .../achievement/GuiAchievements.java.patch | 127 +++ .../gui/achievement/GuiStats.java.patch | 19 + .../gui/inventory/GuiContainer.java.patch | 65 ++ .../inventory/GuiContainerCreative.java.patch | 267 +++++ .../client/model/ModelBase.java.patch | 2 +- .../client/model/ModelBox.java.patch | 6 +- .../client/model/ModelRenderer.java.patch | 20 +- .../model/PositionTextureVertex.java.patch | 2 +- .../client/model/TexturedQuad.java.patch | 2 +- .../ChunkProviderClient.java.patch | 8 +- .../multiplayer/GuiConnecting.java.patch | 11 + .../multiplayer/PlayerControllerMP.java.patch | 69 ++ .../client/multiplayer/WorldClient.java.patch | 17 + .../NetHandlerHandshakeMemory.java.patch | 10 + .../network/NetHandlerLoginClient.java.patch | 14 + .../network/NetHandlerPlayClient.java.patch | 72 ++ .../client/network/OldServerPinger.java.patch | 8 +- .../client/particle/EffectRenderer.java.patch | 16 +- .../renderer/BlockModelRenderer.java.patch | 0 .../renderer/BlockModelShapes.java.patch | 0 .../BlockRendererDispatcher.java.patch | 26 +- .../client/renderer/EntityRenderer.java.patch | 176 ++++ .../InventoryEffectRenderer.java.patch | 8 +- .../renderer/ItemModelMesher.java.patch | 4 +- .../client/renderer/ItemRenderer.java.patch | 65 ++ .../client/renderer/OpenGlHelper.java.patch | 8 +- .../client/renderer/RenderGlobal.java.patch | 134 +++ .../client/renderer/WorldRenderer.java.patch | 4 +- .../WorldVertexBufferUploader.java.patch | 44 +- .../renderer/block/model/BakedQuad.java.patch | 6 +- .../block/model/FaceBakery.java.patch | 68 ++ .../model/ItemCameraTransforms.java.patch | 2 +- .../block/model/ItemTransformVec3f.java.patch | 6 +- .../model/ModelBlockDefinition.java.patch | 18 +- .../block/statemap/StateMap.java.patch | 11 + .../renderer/chunk/RenderChunk.java.patch | 18 +- .../entity/RenderEntityItem.java.patch | 16 +- .../renderer/entity/RenderItem.java.patch | 128 +++ .../renderer/entity/RenderManager.java.patch | 25 + .../renderer/entity/RenderPlayer.java.patch | 4 +- .../renderer/entity/RenderVillager.java.patch | 6 +- .../entity/RendererLivingEntity.java.patch | 28 +- .../entity/layers/LayerArmorBase.java.patch | 42 +- .../renderer/texture/Stitcher.java.patch | 20 +- .../texture/TextureAtlasSprite.java.patch | 2 +- .../texture/TextureManager.java.patch | 8 +- .../renderer/texture/TextureMap.java.patch | 95 +- .../renderer/texture/TextureUtil.java.patch | 6 +- .../tileentity/RenderItemFrame.java.patch | 20 +- .../TileEntityItemStackRenderer.java.patch | 10 + .../vertex/VertexFormatElement.java.patch | 8 +- .../resources/AbstractResourcePack.java.patch | 11 + .../FallbackResourceManager.java.patch | 4 +- .../resources/LanguageManager.java.patch | 6 +- .../client/resources/Locale.java.patch | 4 +- ...SimpleReloadableResourceManager.java.patch | 26 +- .../client/resources/SkinManager.java.patch | 8 +- .../resources/model/IBakedModel.java.patch | 6 +- .../resources/model/ModelBakery.java.patch | 98 ++ .../resources/model/ModelManager.java.patch | 14 + .../resources/model/ModelRotation.java.patch | 6 +- .../client/settings/GameSettings.java.patch | 4 +- .../client/shader/Framebuffer.java.patch | 24 +- .../command/CommandEnchant.java.patch | 11 + .../minecraft/command/CommandFill.java.patch | 28 + .../command/CommandHandler.java.patch | 6 +- .../command/server/CommandSetBlock.java.patch | 20 + .../server/CommandTestForBlock.java.patch | 6 +- .../minecraft/crash/CrashReport.java.patch | 8 +- .../crash/CrashReportCategory.java.patch | 16 + .../creativetab/CreativeTabs.java.patch | 50 +- .../enchantment/Enchantment.java.patch | 18 +- .../enchantment/EnchantmentHelper.java.patch | 26 +- .../net/minecraft/entity/Entity.java.patch | 118 +-- .../minecraft/entity/EntityHanging.java.patch | 12 + .../minecraft/entity/EntityList.java.patch | 38 +- .../minecraft/entity/EntityLiving.java.patch | 41 + .../entity/EntityLivingBase.java.patch | 212 ++++ .../EntityMinecartCommandBlock.java.patch | 6 +- .../EntitySpawnPlacementRegistry.java.patch | 0 .../minecraft/entity/EntityTracker.java.patch | 8 +- .../entity/EntityTrackerEntry.java.patch | 42 + .../ai/EntityAIAttackOnCollide.java.patch | 24 +- .../entity/boss/EntityDragon.java.patch | 14 + .../entity/boss/EntityWither.java.patch | 11 + .../entity/boss/IBossDisplayData.java.patch | 2 +- .../effect/EntityLightningBolt.java.patch | 4 +- .../entity/item/EntityEnderPearl.java.patch | 25 + .../entity/item/EntityItem.java.patch | 94 ++ .../entity/item/EntityItemFrame.java.patch | 11 + .../entity/item/EntityMinecart.java.patch | 216 ++-- .../item/EntityMinecartContainer.java.patch | 8 +- .../item/EntityMinecartEmpty.java.patch | 6 +- .../item/EntityMinecartFurnace.java.patch | 8 +- .../item/EntityMinecartHopper.java.patch | 8 +- .../entity/item/EntityXPOrb.java.patch | 10 + .../entity/monster/EntityEnderman.java.patch | 28 +- .../entity/monster/EntityMagmaCube.java.patch | 4 +- .../entity/monster/EntitySlime.java.patch | 11 + .../entity/monster/EntityZombie.java.patch | 60 ++ .../entity/passive/EntityHorse.java.patch | 4 +- .../entity/passive/EntityMooshroom.java.patch | 62 ++ .../entity/passive/EntityOcelot.java.patch | 11 + .../entity/passive/EntitySheep.java.patch | 22 +- .../entity/passive/EntityVillager.java.patch | 44 + .../entity/player/EntityPlayer.java.patch | 637 ++++++++++++ .../entity/player/EntityPlayerMP.java.patch | 92 ++ .../entity/player/InventoryPlayer.java.patch | 17 + .../projectile/EntityFishHook.java.patch | 14 +- .../net/minecraft/init/Bootstrap.java.patch | 35 + .../minecraft/inventory/Container.java.patch | 11 + .../inventory/ContainerBeacon.java.patch | 11 + .../ContainerBrewingStand.java.patch | 29 + .../inventory/ContainerEnchantment.java.patch | 40 +- .../inventory/ContainerPlayer.java.patch | 12 + .../inventory/ContainerRepair.java.patch | 47 + .../net/minecraft/inventory/Slot.java.patch | 14 +- .../inventory/SlotCrafting.java.patch | 10 +- .../inventory/SlotFurnaceOutput.java.patch | 6 +- .../net/minecraft/item/Item.java.patch | 130 +-- .../net/minecraft/item/ItemArmor.java.patch | 47 + .../net/minecraft/item/ItemBlock.java.patch | 72 ++ .../net/minecraft/item/ItemBow.java.patch | 29 + .../net/minecraft/item/ItemBucket.java.patch | 6 +- .../minecraft/item/ItemBucketMilk.java.patch | 11 + .../net/minecraft/item/ItemDye.java.patch | 56 ++ .../minecraft/item/ItemEmptyMap.java.patch | 11 + .../item/ItemFlintAndSteel.java.patch | 11 + .../net/minecraft/item/ItemHoe.java.patch | 17 + .../net/minecraft/item/ItemLilyPad.java.patch | 12 +- .../net/minecraft/item/ItemMap.java.patch | 11 + .../item/ItemMonsterPlacer.java.patch | 107 ++ .../net/minecraft/item/ItemRecord.java.patch | 2 +- .../net/minecraft/item/ItemReed.java.patch | 11 + .../minecraft/item/ItemSeedFood.java.patch | 14 +- .../net/minecraft/item/ItemSeeds.java.patch | 37 + .../net/minecraft/item/ItemShears.java.patch | 89 ++ .../net/minecraft/item/ItemSign.java.patch | 11 + .../net/minecraft/item/ItemSkull.java.patch | 31 + .../net/minecraft/item/ItemSnow.java.patch | 13 + .../net/minecraft/item/ItemStack.java.patch | 149 +++ .../net/minecraft/item/ItemSword.java.patch | 13 + .../net/minecraft/item/ItemTool.java.patch | 28 +- .../item/crafting/FurnaceRecipes.java.patch | 20 + .../item/crafting/RecipeFireworks.java.patch | 18 +- .../item/crafting/RecipeRepairItem.java.patch | 42 + .../item/crafting/RecipesArmorDyes.java.patch | 6 +- .../item/crafting/RecipesBanners.java.patch | 14 +- .../crafting/RecipesMapCloning.java.patch | 6 +- .../item/crafting/ShapedRecipes.java.patch | 6 +- .../item/crafting/ShapelessRecipes.java.patch | 6 +- .../nbt/CompressedStreamTools.java.patch | 12 +- .../minecraft/nbt/NBTSizeTracker.java.patch | 6 +- .../minecraft/nbt/NBTTagByteArray.java.patch | 10 + .../minecraft/nbt/NBTTagCompound.java.patch | 27 + .../minecraft/nbt/NBTTagIntArray.java.patch | 10 + .../net/minecraft/nbt/NBTTagList.java.patch | 16 + .../net/minecraft/nbt/NBTTagString.java.patch | 11 + .../network/NetHandlerPlayServer.java.patch | 166 ++++ .../network/NetworkManager.java.patch | 28 +- .../network/NetworkSystem.java.patch | 2 +- .../network/ServerStatusResponse.java.patch | 28 +- .../handshake/client/C00Handshake.java.patch | 48 + .../client/C12PacketUpdateSign.java.patch | 4 +- .../client/C17PacketCustomPayload.java.patch | 14 + .../server/S3FPacketCustomPayload.java.patch | 14 + .../server/S00PacketServerInfo.java.patch | 11 + .../net/minecraft/potion/Potion.java.patch | 2 +- .../minecraft/potion/PotionEffect.java.patch | 40 +- .../minecraft/realms/RealmsConnect.java.patch | 4 +- .../server/MinecraftServer.java.patch | 306 ++++++ .../dedicated/DedicatedServer.java.patch | 28 +- .../server/gui/MinecraftServerGui.java.patch | 2 +- .../integrated/IntegratedServer.java.patch | 97 ++ .../management/ItemInWorldManager.java.patch | 257 +++++ .../management/PlayerManager.java.patch | 224 +++++ .../management/PlayerProfileCache.java.patch | 4 +- .../ServerConfigurationManager.java.patch | 223 +++++ .../network/NetHandlerHandshakeTCP.java.patch | 6 +- .../network/NetHandlerLoginServer.java.patch | 20 + .../net/minecraft/stats/StatList.java.patch | 24 +- .../tileentity/TileEntity.java.patch | 52 +- .../tileentity/TileEntityBeacon.java.patch | 20 + .../TileEntityBrewingStand.java.patch | 78 ++ .../tileentity/TileEntityFurnace.java.patch | 51 + .../tileentity/TileEntityHopper.java.patch | 40 + .../tileentity/TileEntityNote.java.patch | 8 +- .../tileentity/TileEntityPiston.java.patch | 22 + .../tileentity/TileEntitySign.java.patch | 11 + .../util/EnumChatFormatting.java.patch | 6 +- .../net/minecraft/util/EnumFacing.java.patch | 36 +- .../util/EnumWorldBlockLayer.java.patch | 0 .../util/MessageSerializer.java.patch | 2 +- .../net/minecraft/util/MouseHelper.java.patch | 6 +- .../util/MovingObjectPosition.java.patch | 2 +- .../util/ResourceLocation.java.patch | 6 +- .../net/minecraft/util/Session.java.patch | 30 +- .../minecraft/util/StringTranslate.java.patch | 28 +- .../net/minecraft/util/Vec3.java.patch | 27 + .../WeightedRandomChestContent.java.patch | 42 +- .../net/minecraft/world/ChunkCache.java.patch | 61 ++ .../net/minecraft/world/Explosion.java.patch | 52 + .../minecraft/world/IBlockAccess.java.patch | 2 +- .../minecraft/world/SpawnerAnimals.java.patch | 30 +- .../net/minecraft/world/World.java.patch | 902 +++++++++++++++++ .../minecraft/world/WorldProvider.java.patch | 122 +-- .../minecraft/world/WorldServer.java.patch | 257 +++++ .../world/WorldServerMulti.java.patch | 62 ++ .../net/minecraft/world/WorldType.java.patch | 58 +- .../world/biome/BiomeColorHelper.java.patch | 4 +- .../world/biome/BiomeDecorator.java.patch | 267 +++++ .../world/biome/BiomeGenBase.java.patch | 64 +- .../world/biome/BiomeGenForest.java.patch | 4 +- .../world/biome/BiomeGenHills.java.patch | 11 + .../world/biome/BiomeGenJungle.java.patch | 13 + .../world/biome/BiomeGenPlains.java.patch | 22 + .../world/biome/BiomeGenSwamp.java.patch | 2 +- .../world/biome/WorldChunkManager.java.patch | 36 +- .../world/border/WorldBorder.java.patch | 4 +- .../minecraft/world/chunk/Chunk.java.patch | 264 +++++ .../chunk/storage/AnvilChunkLoader.java.patch | 98 +- .../chunk/storage/AnvilSaveHandler.java.patch | 10 +- .../storage/ExtendedBlockStorage.java.patch | 11 + .../world/chunk/storage/RegionFile.java.patch | 16 +- .../world/gen/ChunkProviderEnd.java.patch | 44 +- .../gen/ChunkProviderGenerate.java.patch | 121 +++ .../world/gen/ChunkProviderHell.java.patch | 145 +++ .../world/gen/ChunkProviderServer.java.patch | 138 +++ .../world/gen/MapGenCaves.java.patch | 56 +- .../world/gen/MapGenRavine.java.patch | 54 +- .../feature/WorldGenAbstractTree.java.patch | 13 + .../feature/WorldGenBigMushroom.java.patch | 37 + .../gen/feature/WorldGenBigTree.java.patch | 52 + .../gen/feature/WorldGenCanopyTree.java.patch | 67 ++ .../gen/feature/WorldGenDeadBush.java.patch | 17 + .../gen/feature/WorldGenDungeons.java.patch | 18 +- .../gen/feature/WorldGenForest.java.patch | 50 + .../gen/feature/WorldGenHugeTrees.java.patch | 66 ++ .../gen/feature/WorldGenMegaJungle.java.patch | 62 ++ .../feature/WorldGenMegaPineTree.java.patch | 65 ++ .../gen/feature/WorldGenMinable.java.patch | 6 +- .../feature/WorldGenSavannaTree.java.patch | 64 ++ .../gen/feature/WorldGenShrub.java.patch | 31 + .../gen/feature/WorldGenSwamp.java.patch | 98 ++ .../gen/feature/WorldGenTaiga1.java.patch | 50 + .../gen/feature/WorldGenTaiga2.java.patch | 54 + .../gen/feature/WorldGenTallGrass.java.patch | 17 + .../gen/feature/WorldGenTrees.java.patch | 94 ++ .../WorldGeneratorBonusChest.java.patch | 17 + .../world/gen/layer/GenLayer.java.patch | 26 +- .../world/gen/layer/GenLayerBiome.java.patch | 56 +- ...ComponentScatteredFeaturePieces.java.patch | 42 +- .../gen/structure/MapGenStronghold.java.patch | 4 +- .../gen/structure/MapGenStructure.java.patch | 17 + .../structure/StructureComponent.java.patch | 4 +- .../StructureMineshaftPieces.java.patch | 42 + .../StructureNetherBridgePieces.java.patch | 28 + .../gen/structure/StructureStart.java.patch | 12 +- .../StructureStrongholdPieces.java.patch | 84 ++ .../StructureVillagePieces.java.patch | 28 +- .../world/storage/MapData.java.patch | 48 + .../world/storage/SaveHandler.java.patch | 36 +- .../world/storage/WorldInfo.java.patch | 4 +- .../net/minecraft/block/BlockAir.java.patch | 9 - .../net/minecraft/block/BlockBush.java.patch | 66 -- .../minecraft/block/BlockButton.java.patch | 46 - .../net/minecraft/block/BlockChest.java.patch | 11 - .../net/minecraft/block/BlockCocoa.java.patch | 29 - .../net/minecraft/block/BlockCrops.java.patch | 77 -- .../net/minecraft/block/BlockDoor.java.patch | 20 - .../block/BlockDoublePlant.java.patch | 89 -- .../minecraft/block/BlockFalling.java.patch | 10 - .../minecraft/block/BlockFarmland.java.patch | 11 - .../net/minecraft/block/BlockFire.java.patch | 211 ---- .../net/minecraft/block/BlockGrass.java.patch | 41 - .../net/minecraft/block/BlockIce.java.patch | 35 - .../minecraft/block/BlockLadder.java.patch | 32 - .../minecraft/block/BlockLeaves.java.patch | 130 --- .../net/minecraft/block/BlockLever.java.patch | 67 -- .../net/minecraft/block/BlockLog.java.patch | 24 - .../block/BlockMobSpawner.java.patch | 19 - .../minecraft/block/BlockMushroom.java.patch | 11 - .../minecraft/block/BlockMycelium.java.patch | 20 - .../block/BlockNetherWart.java.patch | 49 - .../minecraft/block/BlockNewLeaf.java.patch | 24 - .../net/minecraft/block/BlockNote.java.patch | 23 - .../minecraft/block/BlockOldLeaf.java.patch | 21 - .../net/minecraft/block/BlockOre.java.patch | 59 -- .../net/minecraft/block/BlockPane.java.patch | 41 - .../block/BlockPistonBase.java.patch | 31 - .../block/BlockPistonMoving.java.patch | 37 - .../minecraft/block/BlockPotato.java.patch | 25 - .../minecraft/block/BlockPumpkin.java.patch | 11 - .../block/BlockRedstoneDiode.java.patch | 11 - .../block/BlockRedstoneOre.java.patch | 22 - .../block/BlockRedstoneWire.java.patch | 59 -- .../minecraft/block/BlockSapling.java.patch | 10 - .../net/minecraft/block/BlockSkull.java.patch | 55 -- .../net/minecraft/block/BlockSnow.java.patch | 53 - .../net/minecraft/block/BlockStem.java.patch | 45 - .../minecraft/block/BlockTallGrass.java.patch | 66 -- .../net/minecraft/block/BlockTorch.java.patch | 38 - .../minecraft/block/BlockTrapDoor.java.patch | 43 - .../block/BlockTripWireHook.java.patch | 29 - .../BlockPistonStructureHelper.java.patch | 29 - .../client/LoadingScreenRenderer.java.patch | 26 - .../net/minecraft/client/Minecraft.java.patch | 476 --------- .../client/entity/EntityPlayerSP.java.patch | 80 -- .../client/gui/FontRenderer.java.patch | 155 --- .../client/gui/GuiCreateWorld.java.patch | 36 - .../client/gui/GuiIngameMenu.java.patch | 33 - .../client/gui/GuiMainMenu.java.patch | 44 - .../client/gui/GuiMultiplayer.java.patch | 19 - .../client/gui/GuiOverlayDebug.java.patch | 12 - .../minecraft/client/gui/GuiScreen.java.patch | 113 --- .../client/gui/GuiSleepMP.java.patch | 11 - .../minecraft/client/gui/GuiSlot.java.patch | 40 - .../gui/ServerListEntryNormal.java.patch | 23 - .../achievement/GuiAchievements.java.patch | 127 --- .../gui/achievement/GuiStats.java.patch | 19 - .../gui/inventory/GuiContainer.java.patch | 65 -- .../inventory/GuiContainerCreative.java.patch | 267 ----- .../multiplayer/GuiConnecting.java.patch | 11 - .../multiplayer/PlayerControllerMP.java.patch | 69 -- .../client/multiplayer/WorldClient.java.patch | 17 - .../NetHandlerHandshakeMemory.java.patch | 10 - .../network/NetHandlerLoginClient.java.patch | 14 - .../network/NetHandlerPlayClient.java.patch | 72 -- .../client/renderer/EntityRenderer.java.patch | 176 ---- .../client/renderer/ItemRenderer.java.patch | 65 -- .../client/renderer/RenderGlobal.java.patch | 134 --- .../block/model/FaceBakery.java.patch | 82 -- .../block/statemap/StateMap.java.patch | 11 - .../renderer/entity/RenderItem.java.patch | 128 --- .../renderer/entity/RenderManager.java.patch | 25 - .../TileEntityItemStackRenderer.java.patch | 10 - .../resources/AbstractResourcePack.java.patch | 11 - .../resources/model/ModelBakery.java.patch | 103 -- .../resources/model/ModelManager.java.patch | 14 - .../command/CommandEnchant.java.patch | 11 - .../minecraft/command/CommandFill.java.patch | 28 - .../command/server/CommandSetBlock.java.patch | 20 - .../crash/CrashReportCategory.java.patch | 16 - .../minecraft/entity/EntityHanging.java.patch | 12 - .../minecraft/entity/EntityLiving.java.patch | 41 - .../entity/EntityLivingBase.java.patch | 212 ---- .../entity/EntityTrackerEntry.java.patch | 42 - .../entity/boss/EntityDragon.java.patch | 14 - .../entity/boss/EntityWither.java.patch | 11 - .../entity/item/EntityEnderPearl.java.patch | 25 - .../entity/item/EntityItem.java.patch | 94 -- .../entity/item/EntityItemFrame.java.patch | 11 - .../entity/item/EntityXPOrb.java.patch | 10 - .../entity/monster/EntitySlime.java.patch | 11 - .../entity/monster/EntityZombie.java.patch | 60 -- .../entity/passive/EntityMooshroom.java.patch | 62 -- .../entity/passive/EntityOcelot.java.patch | 11 - .../entity/passive/EntityVillager.java.patch | 44 - .../entity/player/EntityPlayer.java.patch | 637 ------------ .../entity/player/EntityPlayerMP.java.patch | 92 -- .../entity/player/InventoryPlayer.java.patch | 17 - .../net/minecraft/init/Bootstrap.java.patch | 35 - .../minecraft/inventory/Container.java.patch | 11 - .../inventory/ContainerBeacon.java.patch | 11 - .../ContainerBrewingStand.java.patch | 29 - .../inventory/ContainerPlayer.java.patch | 12 - .../inventory/ContainerRepair.java.patch | 47 - .../net/minecraft/item/ItemArmor.java.patch | 47 - .../net/minecraft/item/ItemBlock.java.patch | 72 -- .../net/minecraft/item/ItemBow.java.patch | 29 - .../minecraft/item/ItemBucketMilk.java.patch | 11 - .../net/minecraft/item/ItemDye.java.patch | 56 -- .../minecraft/item/ItemEmptyMap.java.patch | 11 - .../item/ItemFlintAndSteel.java.patch | 11 - .../net/minecraft/item/ItemHoe.java.patch | 17 - .../net/minecraft/item/ItemMap.java.patch | 11 - .../item/ItemMonsterPlacer.java.patch | 107 -- .../net/minecraft/item/ItemReed.java.patch | 11 - .../net/minecraft/item/ItemSeeds.java.patch | 37 - .../net/minecraft/item/ItemShears.java.patch | 89 -- .../net/minecraft/item/ItemSign.java.patch | 11 - .../net/minecraft/item/ItemSkull.java.patch | 31 - .../net/minecraft/item/ItemSnow.java.patch | 13 - .../net/minecraft/item/ItemStack.java.patch | 149 --- .../net/minecraft/item/ItemSword.java.patch | 13 - .../item/crafting/FurnaceRecipes.java.patch | 20 - .../item/crafting/RecipeRepairItem.java.patch | 42 - .../minecraft/nbt/NBTTagByteArray.java.patch | 10 - .../minecraft/nbt/NBTTagCompound.java.patch | 27 - .../minecraft/nbt/NBTTagIntArray.java.patch | 10 - .../net/minecraft/nbt/NBTTagList.java.patch | 16 - .../net/minecraft/nbt/NBTTagString.java.patch | 11 - .../network/NetHandlerPlayServer.java.patch | 166 ---- .../handshake/client/C00Handshake.java.patch | 48 - .../client/C17PacketCustomPayload.java.patch | 14 - .../server/S3FPacketCustomPayload.java.patch | 14 - .../server/S00PacketServerInfo.java.patch | 11 - .../server/MinecraftServer.java.patch | 306 ------ .../integrated/IntegratedServer.java.patch | 97 -- .../management/ItemInWorldManager.java.patch | 257 ----- .../management/PlayerManager.java.patch | 224 ----- .../ServerConfigurationManager.java.patch | 223 ----- .../network/NetHandlerLoginServer.java.patch | 20 - .../tileentity/TileEntityBeacon.java.patch | 20 - .../TileEntityBrewingStand.java.patch | 78 -- .../tileentity/TileEntityFurnace.java.patch | 51 - .../tileentity/TileEntityHopper.java.patch | 40 - .../tileentity/TileEntityPiston.java.patch | 22 - .../tileentity/TileEntitySign.java.patch | 11 - .../net/minecraft/util/Vec3.java.patch | 27 - .../net/minecraft/world/ChunkCache.java.patch | 61 -- .../net/minecraft/world/Explosion.java.patch | 52 - .../net/minecraft/world/World.java.patch | 930 ------------------ .../minecraft/world/WorldServer.java.patch | 257 ----- .../world/WorldServerMulti.java.patch | 62 -- .../world/biome/BiomeDecorator.java.patch | 267 ----- .../world/biome/BiomeGenHills.java.patch | 11 - .../world/biome/BiomeGenJungle.java.patch | 13 - .../world/biome/BiomeGenPlains.java.patch | 22 - .../minecraft/world/chunk/Chunk.java.patch | 264 ----- .../storage/ExtendedBlockStorage.java.patch | 11 - .../gen/ChunkProviderGenerate.java.patch | 121 --- .../world/gen/ChunkProviderHell.java.patch | 145 --- .../world/gen/ChunkProviderServer.java.patch | 138 --- .../feature/WorldGenAbstractTree.java.patch | 13 - .../feature/WorldGenBigMushroom.java.patch | 37 - .../gen/feature/WorldGenBigTree.java.patch | 52 - .../gen/feature/WorldGenCanopyTree.java.patch | 67 -- .../gen/feature/WorldGenDeadBush.java.patch | 17 - .../gen/feature/WorldGenForest.java.patch | 50 - .../gen/feature/WorldGenHugeTrees.java.patch | 66 -- .../gen/feature/WorldGenMegaJungle.java.patch | 62 -- .../feature/WorldGenMegaPineTree.java.patch | 65 -- .../feature/WorldGenSavannaTree.java.patch | 64 -- .../gen/feature/WorldGenShrub.java.patch | 31 - .../gen/feature/WorldGenSwamp.java.patch | 98 -- .../gen/feature/WorldGenTaiga1.java.patch | 50 - .../gen/feature/WorldGenTaiga2.java.patch | 54 - .../gen/feature/WorldGenTallGrass.java.patch | 17 - .../gen/feature/WorldGenTrees.java.patch | 94 -- .../WorldGeneratorBonusChest.java.patch | 17 - .../gen/structure/MapGenStructure.java.patch | 17 - .../StructureMineshaftPieces.java.patch | 42 - .../StructureNetherBridgePieces.java.patch | 28 - .../StructureStrongholdPieces.java.patch | 84 -- .../world/storage/MapData.java.patch | 48 - 520 files changed, 13397 insertions(+), 13450 deletions(-) rename {patches => patches.mcp}/minecraft/net/minecraft/block/Block.java.patch (70%) create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockAir.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/block/BlockCactus.java.patch (58%) create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockCocoa.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/block/BlockDeadBush.java.patch (57%) create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/block/BlockFlowerPot.java.patch (56%) create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch (58%) create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockLever.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockNote.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/block/BlockQuartz.java.patch (63%) rename {patches => patches.mcp}/minecraft/net/minecraft/block/BlockRailBase.java.patch (72%) rename {patches => patches.mcp}/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch (54%) create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/block/BlockReed.java.patch (62%) rename {patches => patches.mcp}/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch (72%) create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockSapling.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/block/BlockVine.java.patch (57%) create mode 100644 patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/block/state/BlockState.java.patch (56%) rename {patches => patches.mcp}/minecraft/net/minecraft/block/state/BlockStateBase.java.patch (100%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch (100%) create mode 100644 patches.mcp/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/client/audio/SoundManager.java.patch (52%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch (100%) create mode 100644 patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/client/gui/GuiButton.java.patch (56%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/gui/GuiChat.java.patch (59%) create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiScreen.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch (68%) create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/client/model/ModelBase.java.patch (90%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/model/ModelBox.java.patch (66%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/model/ModelRenderer.java.patch (57%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch (92%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/model/TexturedQuad.java.patch (89%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch (56%) create mode 100644 patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/client/network/OldServerPinger.java.patch (52%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch (51%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch (100%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch (100%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch (57%) create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch (57%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch (77%) create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch (75%) create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch (70%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch (65%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch (81%) create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch (67%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch (77%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch (53%) create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch (75%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch (63%) create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch (81%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch (65%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch (52%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch (62%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch (58%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch (76%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch (63%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch (60%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch (69%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch (56%) create mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch (92%) create mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch (61%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/resources/LanguageManager.java.patch (54%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/resources/Locale.java.patch (74%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch (66%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/resources/SkinManager.java.patch (52%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch (79%) create mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch (81%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/settings/GameSettings.java.patch (85%) rename {patches => patches.mcp}/minecraft/net/minecraft/client/shader/Framebuffer.java.patch (55%) create mode 100644 patches.mcp/minecraft/net/minecraft/command/CommandEnchant.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/command/CommandFill.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/command/CommandHandler.java.patch (73%) create mode 100644 patches.mcp/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch (55%) rename {patches => patches.mcp}/minecraft/net/minecraft/crash/CrashReport.java.patch (77%) create mode 100644 patches.mcp/minecraft/net/minecraft/crash/CrashReportCategory.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch (57%) rename {patches => patches.mcp}/minecraft/net/minecraft/enchantment/Enchantment.java.patch (68%) rename {patches => patches.mcp}/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch (50%) rename {patches => patches.mcp}/minecraft/net/minecraft/entity/Entity.java.patch (69%) create mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/entity/EntityList.java.patch (62%) create mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityLiving.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch (68%) rename {patches => patches.mcp}/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch (100%) rename {patches => patches.mcp}/minecraft/net/minecraft/entity/EntityTracker.java.patch (84%) create mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch (61%) create mode 100644 patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch (91%) rename {patches => patches.mcp}/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch (80%) create mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch (53%) rename {patches => patches.mcp}/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch (62%) rename {patches => patches.mcp}/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch (60%) rename {patches => patches.mcp}/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch (55%) rename {patches => patches.mcp}/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch (62%) create mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch (54%) rename {patches => patches.mcp}/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch (70%) create mode 100644 patches.mcp/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch (76%) create mode 100644 patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch (53%) create mode 100644 patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch (50%) create mode 100644 patches.mcp/minecraft/net/minecraft/init/Bootstrap.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/inventory/Container.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch (51%) create mode 100644 patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/inventory/Slot.java.patch (86%) rename {patches => patches.mcp}/minecraft/net/minecraft/inventory/SlotCrafting.java.patch (57%) rename {patches => patches.mcp}/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch (58%) rename {patches => patches.mcp}/minecraft/net/minecraft/item/Item.java.patch (83%) create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/item/ItemBucket.java.patch (54%) create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemBucketMilk.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemDye.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/item/ItemLilyPad.java.patch (50%) create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/item/ItemRecord.java.patch (89%) create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemReed.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/item/ItemSeedFood.java.patch (58%) create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemSign.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemSnow.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemSword.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/item/ItemTool.java.patch (60%) create mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch (53%) create mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch (63%) rename {patches => patches.mcp}/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch (63%) rename {patches => patches.mcp}/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch (63%) rename {patches => patches.mcp}/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch (63%) rename {patches => patches.mcp}/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch (63%) rename {patches => patches.mcp}/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch (72%) rename {patches => patches.mcp}/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch (85%) create mode 100644 patches.mcp/minecraft/net/minecraft/nbt/NBTTagByteArray.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/nbt/NBTTagIntArray.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/nbt/NBTTagList.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/nbt/NBTTagString.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/network/NetworkManager.java.patch (58%) rename {patches => patches.mcp}/minecraft/net/minecraft/network/NetworkSystem.java.patch (94%) rename {patches => patches.mcp}/minecraft/net/minecraft/network/ServerStatusResponse.java.patch (74%) create mode 100644 patches.mcp/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch (59%) create mode 100644 patches.mcp/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/potion/Potion.java.patch (93%) rename {patches => patches.mcp}/minecraft/net/minecraft/potion/PotionEffect.java.patch (70%) rename {patches => patches.mcp}/minecraft/net/minecraft/realms/RealmsConnect.java.patch (67%) create mode 100644 patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch (50%) rename {patches => patches.mcp}/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch (93%) create mode 100644 patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/server/management/PlayerManager.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch (87%) create mode 100644 patches.mcp/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch (65%) create mode 100644 patches.mcp/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/stats/StatList.java.patch (53%) rename {patches => patches.mcp}/minecraft/net/minecraft/tileentity/TileEntity.java.patch (73%) create mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch (60%) create mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/util/EnumChatFormatting.java.patch (50%) rename {patches => patches.mcp}/minecraft/net/minecraft/util/EnumFacing.java.patch (50%) rename {patches => patches.mcp}/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch (100%) rename {patches => patches.mcp}/minecraft/net/minecraft/util/MessageSerializer.java.patch (86%) rename {patches => patches.mcp}/minecraft/net/minecraft/util/MouseHelper.java.patch (73%) rename {patches => patches.mcp}/minecraft/net/minecraft/util/MovingObjectPosition.java.patch (94%) rename {patches => patches.mcp}/minecraft/net/minecraft/util/ResourceLocation.java.patch (85%) rename {patches => patches.mcp}/minecraft/net/minecraft/util/Session.java.patch (68%) rename {patches => patches.mcp}/minecraft/net/minecraft/util/StringTranslate.java.patch (65%) create mode 100644 patches.mcp/minecraft/net/minecraft/util/Vec3.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch (54%) create mode 100644 patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/world/IBlockAccess.java.patch (93%) rename {patches => patches.mcp}/minecraft/net/minecraft/world/SpawnerAnimals.java.patch (65%) create mode 100644 patches.mcp/minecraft/net/minecraft/world/World.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/world/WorldProvider.java.patch (61%) create mode 100644 patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/WorldServerMulti.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/world/WorldType.java.patch (67%) rename {patches => patches.mcp}/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch (73%) create mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch (57%) rename {patches => patches.mcp}/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch (70%) create mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch (63%) rename {patches => patches.mcp}/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch (53%) rename {patches => patches.mcp}/minecraft/net/minecraft/world/border/WorldBorder.java.patch (68%) create mode 100644 patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch (52%) rename {patches => patches.mcp}/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch (68%) create mode 100644 patches.mcp/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch (60%) rename {patches => patches.mcp}/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch (50%) create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch (59%) rename {patches => patches.mcp}/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch (56%) create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch (57%) create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch (59%) create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch (68%) rename {patches => patches.mcp}/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch (51%) rename {patches => patches.mcp}/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch (50%) rename {patches => patches.mcp}/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch (72%) create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch (78%) create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch (60%) create mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch (70%) create mode 100644 patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch rename {patches => patches.mcp}/minecraft/net/minecraft/world/storage/SaveHandler.java.patch (66%) rename {patches => patches.mcp}/minecraft/net/minecraft/world/storage/WorldInfo.java.patch (94%) delete mode 100644 patches/minecraft/net/minecraft/block/BlockAir.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockBush.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockButton.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockChest.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockCocoa.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockCrops.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockDoor.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockFalling.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockFarmland.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockFire.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockGrass.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockIce.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockLadder.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockLeaves.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockLever.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockLog.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockMushroom.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockMycelium.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockNote.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockOre.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockPane.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockPotato.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockSapling.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockSkull.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockSnow.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockStem.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockTorch.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch delete mode 100644 patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/Minecraft.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch delete mode 100644 patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch delete mode 100644 patches/minecraft/net/minecraft/command/CommandEnchant.java.patch delete mode 100644 patches/minecraft/net/minecraft/command/CommandFill.java.patch delete mode 100644 patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch delete mode 100644 patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/EntityHanging.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/EntityLiving.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch delete mode 100644 patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch delete mode 100644 patches/minecraft/net/minecraft/init/Bootstrap.java.patch delete mode 100644 patches/minecraft/net/minecraft/inventory/Container.java.patch delete mode 100644 patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch delete mode 100644 patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch delete mode 100644 patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch delete mode 100644 patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch delete mode 100644 patches/minecraft/net/minecraft/item/ItemArmor.java.patch delete mode 100644 patches/minecraft/net/minecraft/item/ItemBlock.java.patch delete mode 100644 patches/minecraft/net/minecraft/item/ItemBow.java.patch delete mode 100644 patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch delete mode 100644 patches/minecraft/net/minecraft/item/ItemDye.java.patch delete mode 100644 patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch delete mode 100644 patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch delete mode 100644 patches/minecraft/net/minecraft/item/ItemHoe.java.patch delete mode 100644 patches/minecraft/net/minecraft/item/ItemMap.java.patch delete mode 100644 patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch delete mode 100644 patches/minecraft/net/minecraft/item/ItemReed.java.patch delete mode 100644 patches/minecraft/net/minecraft/item/ItemSeeds.java.patch delete mode 100644 patches/minecraft/net/minecraft/item/ItemShears.java.patch delete mode 100644 patches/minecraft/net/minecraft/item/ItemSign.java.patch delete mode 100644 patches/minecraft/net/minecraft/item/ItemSkull.java.patch delete mode 100644 patches/minecraft/net/minecraft/item/ItemSnow.java.patch delete mode 100644 patches/minecraft/net/minecraft/item/ItemStack.java.patch delete mode 100644 patches/minecraft/net/minecraft/item/ItemSword.java.patch delete mode 100644 patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch delete mode 100644 patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch delete mode 100644 patches/minecraft/net/minecraft/nbt/NBTTagByteArray.java.patch delete mode 100644 patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch delete mode 100644 patches/minecraft/net/minecraft/nbt/NBTTagIntArray.java.patch delete mode 100644 patches/minecraft/net/minecraft/nbt/NBTTagList.java.patch delete mode 100644 patches/minecraft/net/minecraft/nbt/NBTTagString.java.patch delete mode 100644 patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch delete mode 100644 patches/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch delete mode 100644 patches/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch delete mode 100644 patches/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch delete mode 100644 patches/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch delete mode 100644 patches/minecraft/net/minecraft/server/MinecraftServer.java.patch delete mode 100644 patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch delete mode 100644 patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch delete mode 100644 patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch delete mode 100644 patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch delete mode 100644 patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch delete mode 100644 patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch delete mode 100644 patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch delete mode 100644 patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch delete mode 100644 patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch delete mode 100644 patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch delete mode 100644 patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch delete mode 100644 patches/minecraft/net/minecraft/util/Vec3.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/ChunkCache.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/Explosion.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/World.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/WorldServer.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/storage/MapData.java.patch diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch similarity index 70% rename from patches/minecraft/net/minecraft/block/Block.java.patch rename to patches.mcp/minecraft/net/minecraft/block/Block.java.patch index 87d785eae..b3a3dfca1 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch @@ -3,186 +3,186 @@ @@ -39,8 +39,9 @@ public class Block { - private static final ResourceLocation field_176230_a = new ResourceLocation("air"); -- public static final RegistryNamespacedDefaultedByKey field_149771_c = new RegistryNamespacedDefaultedByKey(field_176230_a); -- public static final ObjectIntIdentityMap field_176229_d = new ObjectIntIdentityMap(); -+ public static final RegistryNamespacedDefaultedByKey field_149771_c = net.minecraftforge.fml.common.registry.GameData.getBlockRegistry(); + private static final ResourceLocation AIR_ID = new ResourceLocation("air"); +- public static final RegistryNamespacedDefaultedByKey blockRegistry = new RegistryNamespacedDefaultedByKey(AIR_ID); +- public static final ObjectIntIdentityMap BLOCK_STATE_IDS = new ObjectIntIdentityMap(); ++ public static final RegistryNamespacedDefaultedByKey blockRegistry = net.minecraftforge.fml.common.registry.GameData.getBlockRegistry(); + @Deprecated //Modders: DO NOT use this! Use GameRegistry -+ public static final ObjectIntIdentityMap field_176229_d = net.minecraftforge.fml.common.registry.GameData.getBlockStateIDMap(); - private CreativeTabs field_149772_a; - public static final Block.SoundType field_149769_e = new Block.SoundType("stone", 1.0F, 1.0F); - public static final Block.SoundType field_149766_f = new Block.SoundType("wood", 1.0F, 1.0F); ++ public static final ObjectIntIdentityMap BLOCK_STATE_IDS = net.minecraftforge.fml.common.registry.GameData.getBlockStateIDMap(); + private CreativeTabs displayOnCreativeTab; + public static final Block.SoundType soundTypeStone = new Block.SoundType("stone", 1.0F, 1.0F); + public static final Block.SoundType soundTypeWood = new Block.SoundType("wood", 1.0F, 1.0F); @@ -124,6 +125,9 @@ - private String field_149770_b; + private String unlocalizedName; private static final String __OBFID = "CL_00000199"; + public final net.minecraftforge.fml.common.registry.RegistryDelegate delegate = -+ ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)field_149771_c).getDelegate(this, Block.class); ++ ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)blockRegistry).getDelegate(this, Block.class); + - public static int func_149682_b(Block p_149682_0_) + public static int getIdFromBlock(Block blockIn) { - return field_149771_c.func_148757_b(p_149682_0_); + return blockRegistry.getIDForObject(blockIn); @@ -136,7 +140,8 @@ - public static Block func_149729_e(int p_149729_0_) + public static Block getBlockById(int id) { -- return (Block)field_149771_c.func_148754_a(p_149729_0_); -+ Block ret = (Block)field_149771_c.func_148754_a(p_149729_0_); -+ return ret == null ? net.minecraft.init.Blocks.field_150350_a : ret; +- return (Block)blockRegistry.getObjectById(id); ++ Block ret = (Block)blockRegistry.getObjectById(id); ++ return ret == null ? net.minecraft.init.Blocks.air : ret; } - public static IBlockState func_176220_d(int p_176220_0_) + public static IBlockState getStateById(int id) @@ -300,7 +305,7 @@ - public boolean func_176200_f(World p_176200_1_, BlockPos p_176200_2_) + public boolean isReplaceable(World worldIn, BlockPos pos) { - return false; -+ return func_149688_o().func_76222_j(); ++ return getMaterial().isReplaceable(); } - public Block func_149711_c(float p_149711_1_) + public Block setHardness(float hardness) @@ -337,9 +342,10 @@ - return this.field_149789_z; + return this.needsRandomTick; } + @Deprecated //Forge: New State sensitive version. - public boolean func_149716_u() + public boolean hasTileEntity() { -- return this.field_149758_A; -+ return hasTileEntity(func_176223_P()); +- return this.isBlockContainer; ++ return hasTileEntity(getDefaultState()); } - public final void func_149676_a(float p_149676_1_, float p_149676_2_, float p_149676_3_, float p_149676_4_, float p_149676_5_, float p_149676_6_) + public final void setBlockBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ) @@ -356,13 +362,13 @@ - public int func_176207_c(IBlockAccess p_176207_1_, BlockPos p_176207_2_) + public int getMixedBrightnessForBlock(IBlockAccess worldIn, BlockPos pos) { - Block block = p_176207_1_.func_180495_p(p_176207_2_).func_177230_c(); -- int i = p_176207_1_.func_175626_b(p_176207_2_, block.func_149750_m()); -+ int i = p_176207_1_.func_175626_b(p_176207_2_, block.getLightValue(p_176207_1_, p_176207_2_)); + Block block = worldIn.getBlockState(pos).getBlock(); +- int i = worldIn.getCombinedLight(pos, block.getLightValue()); ++ int i = worldIn.getCombinedLight(pos, block.getLightValue(worldIn, pos)); if (i == 0 && block instanceof BlockSlab) { - p_176207_2_ = p_176207_2_.func_177977_b(); - block = p_176207_1_.func_180495_p(p_176207_2_).func_177230_c(); -- return p_176207_1_.func_175626_b(p_176207_2_, block.func_149750_m()); -+ return p_176207_1_.func_175626_b(p_176207_2_, block.getLightValue(p_176207_1_, p_176207_2_)); + pos = pos.down(); + block = worldIn.getBlockState(pos).getBlock(); +- return worldIn.getCombinedLight(pos, block.getLightValue()); ++ return worldIn.getCombinedLight(pos, block.getLightValue(worldIn, pos)); } else { @@ -438,7 +444,13 @@ - public void func_176213_c(World p_176213_1_, BlockPos p_176213_2_, IBlockState p_176213_3_) {} + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {} -- public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_) {} -+ public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_) +- public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {} ++ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { -+ if (hasTileEntity(p_180663_3_) && !(this instanceof BlockContainer)) ++ if (hasTileEntity(state) && !(this instanceof BlockContainer)) + { -+ p_180663_1_.func_175713_t(p_180663_2_); ++ worldIn.removeTileEntity(pos); + } + } - public int func_149745_a(Random p_149745_1_) + public int quantityDropped(Random random) { @@ -452,8 +464,7 @@ - public float func_180647_a(EntityPlayer p_180647_1_, World p_180647_2_, BlockPos p_180647_3_) + public float getPlayerRelativeBlockHardness(EntityPlayer playerIn, World worldIn, BlockPos pos) { -- float f = this.func_176195_g(p_180647_2_, p_180647_3_); -- return f < 0.0F ? 0.0F : (!p_180647_1_.func_146099_a(this) ? p_180647_1_.func_180471_a(this) / f / 100.0F : p_180647_1_.func_180471_a(this) / f / 30.0F); -+ return net.minecraftforge.common.ForgeHooks.blockStrength(p_180647_2_.func_180495_p(p_180647_3_), p_180647_1_, p_180647_2_, p_180647_3_); +- float f = this.getBlockHardness(worldIn, pos); +- return f < 0.0F ? 0.0F : (!playerIn.canHarvestBlock(this) ? playerIn.getToolDigEfficiency(this) / f / 100.0F : playerIn.getToolDigEfficiency(this) / f / 30.0F); ++ return net.minecraftforge.common.ForgeHooks.blockStrength(worldIn.getBlockState(pos), playerIn, worldIn, pos); } - public final void func_176226_b(World p_176226_1_, BlockPos p_176226_2_, IBlockState p_176226_3_, int p_176226_4_) + public final void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int forture) @@ -463,20 +474,16 @@ - public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { -- if (!p_180653_1_.field_72995_K) -+ if (!p_180653_1_.field_72995_K && !p_180653_1_.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe +- if (!worldIn.isRemote) ++ if (!worldIn.isRemote && !worldIn.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe { -- int j = this.func_149679_a(p_180653_5_, p_180653_1_.field_73012_v); -+ java.util.List items = getDrops(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_5_); -+ p_180653_4_ = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180653_1_, p_180653_2_, p_180653_3_, p_180653_5_, p_180653_4_, false, harvesters.get()); +- int j = this.quantityDroppedWithBonus(fortune, worldIn.rand); ++ java.util.List items = getDrops(worldIn, pos, state, fortune); ++ chance = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, fortune, chance, false, harvesters.get()); - for (int k = 0; k < j; ++k) + for (ItemStack item : items) { - if (p_180653_1_.field_73012_v.nextFloat() <= p_180653_4_) + if (worldIn.rand.nextFloat() <= chance) { -- Item item = this.func_180660_a(p_180653_3_, p_180653_1_.field_73012_v, p_180653_5_); +- Item item = this.getItemDropped(state, worldIn.rand, fortune); - - if (item != null) - { -- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(item, 1, this.func_180651_a(p_180653_3_))); +- spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); - } -+ func_180635_a(p_180653_1_, p_180653_2_, item); ++ spawnAsEntity(worldIn, pos, item); } } } @@ -484,8 +491,13 @@ - public static void func_180635_a(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_) + public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack) { -- if (!p_180635_0_.field_72995_K && p_180635_0_.func_82736_K().func_82766_b("doTileDrops")) -+ if (!p_180635_0_.field_72995_K && p_180635_0_.func_82736_K().func_82766_b("doTileDrops") && !p_180635_0_.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe +- if (!worldIn.isRemote && worldIn.getGameRules().getGameRuleBooleanValue("doTileDrops")) ++ if (!worldIn.isRemote && worldIn.getGameRules().getGameRuleBooleanValue("doTileDrops") && !worldIn.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe { + if (captureDrops.get()) + { -+ capturedDrops.get().add(p_180635_2_); ++ capturedDrops.get().add(stack); + return; + } float f = 0.5F; - double d0 = (double)(p_180635_0_.field_73012_v.nextFloat() * f) + (double)(1.0F - f) * 0.5D; - double d1 = (double)(p_180635_0_.field_73012_v.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; @@ -670,7 +682,7 @@ - public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { -- return p_176196_1_.func_180495_p(p_176196_2_).func_177230_c().field_149764_J.func_76222_j(); -+ return p_176196_1_.func_180495_p(p_176196_2_).func_177230_c().func_176200_f(p_176196_1_, p_176196_2_); +- return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable(); ++ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos); } - public boolean func_180639_a(World p_180639_1_, BlockPos p_180639_2_, IBlockState p_180639_3_, EntityPlayer p_180639_4_, EnumFacing p_180639_5_, float p_180639_6_, float p_180639_7_, float p_180639_8_) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) @@ -772,25 +784,35 @@ - p_180657_2_.func_71029_a(StatList.field_75934_C[func_149682_b(this)]); - p_180657_2_.func_71020_j(0.025F); + player.triggerAchievement(StatList.mineBlockStatArray[getIdFromBlock(this)]); + player.addExhaustion(0.025F); -- if (this.func_149700_E() && EnchantmentHelper.func_77502_d(p_180657_2_)) -+ if (this.canSilkHarvest(p_180657_1_, p_180657_3_, p_180657_1_.func_180495_p(p_180657_3_), p_180657_2_) && EnchantmentHelper.func_77502_d(p_180657_2_)) +- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) ++ if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player)) { + java.util.ArrayList items = new java.util.ArrayList(); - ItemStack itemstack = this.func_180643_i(p_180657_4_); + ItemStack itemstack = this.createStackedBlock(state); if (itemstack != null) { -- func_180635_a(p_180657_1_, p_180657_3_, itemstack); +- spawnAsEntity(worldIn, pos, itemstack); + items.add(itemstack); } + -+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_1_.func_180495_p(p_180657_3_), 0, 1.0f, true, p_180657_2_); ++ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, worldIn.getBlockState(pos), 0, 1.0f, true, player); + for (ItemStack stack : items) + { -+ func_180635_a(p_180657_1_, p_180657_3_, stack); ++ spawnAsEntity(worldIn, pos, stack); + } } else { -+ harvesters.set(p_180657_2_); - int i = EnchantmentHelper.func_77517_e(p_180657_2_); - this.func_176226_b(p_180657_1_, p_180657_3_, p_180657_4_, i); ++ harvesters.set(player); + int i = EnchantmentHelper.getFortuneModifier(player); + this.dropBlockAsItem(worldIn, pos, state, i); + harvesters.set(null); } } + @Deprecated //Forge: State sensitive version - protected boolean func_149700_E() + protected boolean canSilkHarvest() { -- return this.func_149686_d() && !this.field_149758_A; -+ return this.func_149686_d() && !this.hasTileEntity(silk_check_state.get()); +- return this.isFullCube() && !this.isBlockContainer; ++ return this.isFullCube() && !this.hasTileEntity(silk_check_state.get()); } - protected ItemStack func_180643_i(IBlockState p_180643_1_) + protected ItemStack createStackedBlock(IBlockState state) @@ -967,6 +989,1033 @@ return Block.EnumOffsetType.NONE; } @@ -201,12 +201,12 @@ + */ + public int getLightValue(IBlockAccess world, BlockPos pos) + { -+ Block block = world.func_180495_p(pos).func_177230_c(); ++ Block block = world.getBlockState(pos).getBlock(); + if (block != this) + { + return block.getLightValue(world, pos); + } -+ return func_149750_m(); ++ return getLightValue(); + } + + /** @@ -230,7 +230,7 @@ + */ + public boolean isNormalCube(IBlockAccess world, BlockPos pos) + { -+ return func_149688_o().func_76218_k() && func_149686_d() && !func_149744_f(); ++ return getMaterial().isOpaque() && isFullCube() && !canProvidePower(); + } + + /** @@ -243,11 +243,11 @@ + */ + public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side) + { -+ IBlockState state = this.func_176221_a(world.func_180495_p(pos), world, pos); ++ IBlockState state = this.getActualState(world.getBlockState(pos), world, pos); + + if (this instanceof BlockSlab) + { -+ return func_149730_j() || (state.func_177229_b(BlockSlab.field_176554_a) == BlockSlab.EnumBlockHalf.TOP && side == EnumFacing.UP); ++ return isFullBlock() || (state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP && side == EnumFacing.UP); + } + else if (this instanceof BlockFarmland) + { @@ -255,26 +255,26 @@ + } + else if (this instanceof BlockStairs) + { -+ boolean flipped = state.func_177229_b(BlockStairs.field_176308_b) == BlockStairs.EnumHalf.TOP; -+ BlockStairs.EnumShape shape = (BlockStairs.EnumShape)state.func_177229_b(BlockStairs.field_176310_M); -+ EnumFacing facing = (EnumFacing)state.func_177229_b(BlockStairs.field_176309_a); ++ boolean flipped = state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP; ++ BlockStairs.EnumShape shape = (BlockStairs.EnumShape)state.getValue(BlockStairs.SHAPE); ++ EnumFacing facing = (EnumFacing)state.getValue(BlockStairs.FACING); + if (side == EnumFacing.UP) return flipped; + if (facing == side) return true; + if (flipped) + { -+ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.func_176735_f(); -+ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.func_176746_e(); ++ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.rotateYCCW(); ++ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.rotateY(); + } + else + { -+ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.func_176746_e(); -+ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.func_176735_f(); ++ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.rotateY(); ++ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.rotateYCCW(); + } + return false; + } + else if (this instanceof BlockSnow) + { -+ return ((Integer)state.func_177229_b(BlockSnow.field_176315_a)) >= 8; ++ return ((Integer)state.getValue(BlockSnow.LAYERS)) >= 8; + } + else if (this instanceof BlockHopper && side == EnumFacing.UP) + { @@ -312,7 +312,7 @@ + */ + public boolean isAir(IBlockAccess world, BlockPos pos) + { -+ return func_149688_o() == Material.field_151579_a; ++ return getMaterial() == Material.air; + } + + /** @@ -347,7 +347,7 @@ + */ + public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) + { -+ return world.func_175698_g(pos); ++ return world.setBlockToAir(pos); + } + + /** @@ -361,7 +361,7 @@ + */ + public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) + { -+ return net.minecraft.init.Blocks.field_150480_ab.func_176532_c(this); ++ return net.minecraft.init.Blocks.fire.getFlammability(this); + } + + /** @@ -389,7 +389,7 @@ + */ + public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) + { -+ return net.minecraft.init.Blocks.field_150480_ab.func_176534_d(this); ++ return net.minecraft.init.Blocks.fire.getEncouragement(this); + } + + /** @@ -405,11 +405,11 @@ + */ + public boolean isFireSource(World world, BlockPos pos, EnumFacing side) + { -+ if (this == net.minecraft.init.Blocks.field_150424_aL && side == EnumFacing.UP) ++ if (this == net.minecraft.init.Blocks.netherrack && side == EnumFacing.UP) + { + return true; + } -+ if ((world.field_73011_w instanceof net.minecraft.world.WorldProviderEnd) && this == net.minecraft.init.Blocks.field_150357_h && side == EnumFacing.UP) ++ if ((world.provider instanceof net.minecraft.world.WorldProviderEnd) && this == net.minecraft.init.Blocks.bedrock && side == EnumFacing.UP) + { + return true; + } @@ -444,7 +444,7 @@ + { + if (isTileProvider) + { -+ return ((ITileEntityProvider)this).func_149915_a(world, func_176201_c(state)); ++ return ((ITileEntityProvider)this).createNewTileEntity(world, getMetaFromState(state)); + } + return null; + } @@ -460,7 +460,7 @@ + */ + public int quantityDropped(IBlockState state, int fortune, Random random) + { -+ return func_149679_a(fortune, random); ++ return quantityDroppedWithBonus(fortune, random); + } + + /** @@ -476,15 +476,15 @@ + { + List ret = new java.util.ArrayList(); + -+ Random rand = world instanceof World ? ((World)world).field_73012_v : RANDOM; ++ Random rand = world instanceof World ? ((World)world).rand : RANDOM; + + int count = quantityDropped(state, fortune, rand); + for(int i = 0; i < count; i++) + { -+ Item item = this.func_180660_a(state, rand, fortune); ++ Item item = this.getItemDropped(state, rand, fortune); + if (item != null) + { -+ ret.add(new ItemStack(item, 1, this.func_180651_a(state))); ++ ret.add(new ItemStack(item, 1, this.damageDropped(state))); + } + } + return ret; @@ -502,7 +502,7 @@ + public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) + { + silk_check_state.set(state);; -+ boolean ret = this.func_149700_E(); ++ boolean ret = this.canSilkHarvest(); + silk_check_state.set(null); + return ret; + } @@ -518,14 +518,14 @@ + */ + public boolean canCreatureSpawn(IBlockAccess world, BlockPos pos, net.minecraft.entity.EntityLiving.SpawnPlacementType type) + { -+ IBlockState state = world.func_180495_p(pos); ++ IBlockState state = world.getBlockState(pos); + if (this instanceof BlockSlab) + { -+ return (func_149730_j() || state.func_177229_b(BlockSlab.field_176554_a) == BlockSlab.EnumBlockHalf.TOP); ++ return (isFullBlock() || state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP); + } + else if (this instanceof BlockStairs) + { -+ return state.func_177229_b(BlockStairs.field_176308_b) == BlockStairs.EnumHalf.TOP; ++ return state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP; + } + return isSideSolid(world, pos, EnumFacing.UP); + } @@ -542,7 +542,7 @@ + */ + public boolean isBed(IBlockAccess world, BlockPos pos, Entity player) + { -+ return this == net.minecraft.init.Blocks.field_150324_C; ++ return this == net.minecraft.init.Blocks.bed; + } + + /** @@ -557,7 +557,7 @@ + public BlockPos getBedSpawnPosition(IBlockAccess world, BlockPos pos, EntityPlayer player) + { + if (world instanceof World) -+ return BlockBed.func_176468_a((World)world, pos, 0); ++ return BlockBed.getSafeExitLocation((World)world, pos, 0); + return null; + } + @@ -573,10 +573,10 @@ + { + if (world instanceof World) + { -+ IBlockState state = world.func_180495_p(pos); -+ state = state.func_177230_c().func_176221_a(state, world, pos); -+ state = state.func_177226_a(BlockBed.field_176471_b, true); -+ ((World)world).func_180501_a(pos, state, 4); ++ IBlockState state = world.getBlockState(pos); ++ state = state.getBlock().getActualState(state, world, pos); ++ state = state.withProperty(BlockBed.OCCUPIED, true); ++ ((World)world).setBlockState(pos, state, 4); + } + } + @@ -590,7 +590,7 @@ + */ + public EnumFacing getBedDirection(IBlockAccess world, BlockPos pos) + { -+ return (EnumFacing)func_176221_a(world.func_180495_p(pos), world, pos).func_177229_b(BlockDirectional.field_176387_N); ++ return (EnumFacing)getActualState(world.getBlockState(pos), world, pos).getValue(BlockDirectional.FACING); + } + + /** @@ -602,7 +602,7 @@ + */ + public boolean isBedFoot(IBlockAccess world, BlockPos pos) + { -+ return func_176221_a(world.func_180495_p(pos), world, pos).func_177229_b(BlockBed.field_176472_a) == BlockBed.EnumPartType.FOOT; ++ return getActualState(world.getBlockState(pos), world, pos).getValue(BlockBed.PART) == BlockBed.EnumPartType.FOOT; + } + + /** @@ -634,7 +634,7 @@ + */ + public boolean isLeaves(IBlockAccess world, BlockPos pos) + { -+ return func_149688_o() == Material.field_151584_j; ++ return getMaterial() == Material.leaves; + } + + /** @@ -646,7 +646,7 @@ + */ + public boolean canBeReplacedByLeaves(IBlockAccess world, BlockPos pos) + { -+ return !func_149730_j(); ++ return !isFullBlock(); + } + + /** @@ -671,7 +671,7 @@ + */ + public boolean isReplaceableOreGen(World world, BlockPos pos, com.google.common.base.Predicate target) + { -+ return target.apply(world.func_180495_p(pos)); ++ return target.apply(world.getBlockState(pos)); + } + + /** @@ -685,7 +685,7 @@ + */ + public float getExplosionResistance(World world, BlockPos pos, Entity exploder, Explosion explosion) + { -+ return func_149638_a(exploder); ++ return getExplosionResistance(exploder); + } + + /** @@ -699,8 +699,8 @@ + */ + public void onBlockExploded(World world, BlockPos pos, Explosion explosion) + { -+ world.func_175698_g(pos); -+ func_180652_a(world, pos, explosion); ++ world.setBlockToAir(pos); ++ onBlockDestroyedByExplosion(world, pos, explosion); + } + + /** @@ -714,7 +714,7 @@ + */ + public boolean canConnectRedstone(IBlockAccess world, BlockPos pos, EnumFacing side) + { -+ return func_149744_f() && side != null; ++ return canProvidePower() && side != null; + } + + /** @@ -733,7 +733,7 @@ + } + else + { -+ return this instanceof BlockFence || this == net.minecraft.init.Blocks.field_150359_w || this == net.minecraft.init.Blocks.field_150463_bK || this == net.minecraft.init.Blocks.field_150399_cn; ++ return this instanceof BlockFence || this == net.minecraft.init.Blocks.glass || this == net.minecraft.init.Blocks.cobblestone_wall || this == net.minecraft.init.Blocks.stained_glass; + } + } + @@ -763,15 +763,15 @@ + @Deprecated + public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos) + { -+ Item item = func_180665_b(world, pos); ++ Item item = getItem(world, pos); + + if (item == null) + { + return null; + } + -+ Block block = item instanceof ItemBlock && !func_149648_K() ? Block.func_149634_a(item) : this; -+ return new ItemStack(item, 1, block.func_176222_j(world, pos)); ++ Block block = item instanceof ItemBlock && !isFlowerPot() ? Block.getBlockFromItem(item) : this; ++ return new ItemStack(item, 1, block.getDamageValue(world, pos)); + } + + /** @@ -838,39 +838,39 @@ + */ + public boolean canSustainPlant(IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable) + { -+ IBlockState state = world.func_180495_p(pos); -+ IBlockState plant = plantable.getPlant(world, pos.func_177972_a(direction)); -+ net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.func_177972_a(direction)); ++ IBlockState state = world.getBlockState(pos); ++ IBlockState plant = plantable.getPlant(world, pos.offset(direction)); ++ net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction)); + -+ if (plant.func_177230_c() == net.minecraft.init.Blocks.field_150434_aF && this == net.minecraft.init.Blocks.field_150434_aF) ++ if (plant.getBlock() == net.minecraft.init.Blocks.cactus && this == net.minecraft.init.Blocks.cactus) + { + return true; + } + -+ if (plant.func_177230_c() == net.minecraft.init.Blocks.field_150436_aH && this == net.minecraft.init.Blocks.field_150436_aH) ++ if (plant.getBlock() == net.minecraft.init.Blocks.reeds && this == net.minecraft.init.Blocks.reeds) + { + return true; + } + -+ if (plantable instanceof BlockBush && ((BlockBush)plantable).func_149854_a(this)) ++ if (plantable instanceof BlockBush && ((BlockBush)plantable).canPlaceBlockOn(this)) + { + return true; + } + + switch (plantType) + { -+ case Desert: return this == net.minecraft.init.Blocks.field_150354_m || this == net.minecraft.init.Blocks.field_150405_ch || this == net.minecraft.init.Blocks.field_150406_ce || this == net.minecraft.init.Blocks.field_150346_d; -+ case Nether: return this == net.minecraft.init.Blocks.field_150425_aM; -+ case Crop: return this == net.minecraft.init.Blocks.field_150458_ak; ++ case Desert: return this == net.minecraft.init.Blocks.sand || this == net.minecraft.init.Blocks.hardened_clay || this == net.minecraft.init.Blocks.stained_hardened_clay || this == net.minecraft.init.Blocks.dirt; ++ case Nether: return this == net.minecraft.init.Blocks.soul_sand; ++ case Crop: return this == net.minecraft.init.Blocks.farmland; + case Cave: return isSideSolid(world, pos, EnumFacing.UP); -+ case Plains: return this == net.minecraft.init.Blocks.field_150349_c || this == net.minecraft.init.Blocks.field_150346_d || this == net.minecraft.init.Blocks.field_150458_ak; -+ case Water: return func_149688_o() == Material.field_151586_h && ((Integer)state.func_177229_b(BlockLiquid.field_176367_b)) == 0; ++ case Plains: return this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.dirt || this == net.minecraft.init.Blocks.farmland; ++ case Water: return getMaterial() == Material.water && ((Integer)state.getValue(BlockLiquid.LEVEL)) == 0; + case Beach: -+ boolean isBeach = this == net.minecraft.init.Blocks.field_150349_c || this == net.minecraft.init.Blocks.field_150346_d || this == net.minecraft.init.Blocks.field_150354_m; -+ boolean hasWater = (world.func_180495_p(pos.func_177974_f()).func_177230_c().func_149688_o() == Material.field_151586_h || -+ world.func_180495_p(pos.func_177976_e()).func_177230_c().func_149688_o() == Material.field_151586_h || -+ world.func_180495_p(pos.func_177978_c()).func_177230_c().func_149688_o() == Material.field_151586_h || -+ world.func_180495_p(pos.func_177968_d()).func_177230_c().func_149688_o() == Material.field_151586_h); ++ boolean isBeach = this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.dirt || this == net.minecraft.init.Blocks.sand; ++ boolean hasWater = (world.getBlockState(pos.east()).getBlock().getMaterial() == Material.water || ++ world.getBlockState(pos.west()).getBlock().getMaterial() == Material.water || ++ world.getBlockState(pos.north()).getBlock().getMaterial() == Material.water || ++ world.getBlockState(pos.south()).getBlock().getMaterial() == Material.water); + return isBeach && hasWater; + } + @@ -892,9 +892,9 @@ + */ + public void onPlantGrow(World world, BlockPos pos, BlockPos source) + { -+ if (this == net.minecraft.init.Blocks.field_150349_c || this == net.minecraft.init.Blocks.field_150458_ak) ++ if (this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.farmland) + { -+ world.func_180501_a(pos, net.minecraft.init.Blocks.field_150346_d.func_176223_P(), 2); ++ world.setBlockState(pos, net.minecraft.init.Blocks.dirt.getDefaultState(), 2); + } + } + @@ -909,9 +909,9 @@ + */ + public boolean isFertile(World world, BlockPos pos) + { -+ if (this == net.minecraft.init.Blocks.field_150458_ak) ++ if (this == net.minecraft.init.Blocks.farmland) + { -+ return ((Integer)world.func_180495_p(pos).func_177229_b(BlockFarmland.field_176531_a)) > 0; ++ return ((Integer)world.getBlockState(pos).getValue(BlockFarmland.MOISTURE)) > 0; + } + + return false; @@ -931,7 +931,7 @@ + */ + public int getLightOpacity(IBlockAccess world, BlockPos pos) + { -+ return func_149717_k(); ++ return getLightOpacity(); + } + + /** @@ -945,11 +945,11 @@ + { + if (entity instanceof net.minecraft.entity.boss.EntityWither) + { -+ return this != net.minecraft.init.Blocks.field_180401_cv && this != net.minecraft.init.Blocks.field_150357_h && this != net.minecraft.init.Blocks.field_150384_bq && this != net.minecraft.init.Blocks.field_150378_br && this != net.minecraft.init.Blocks.field_150483_bI; ++ return this != net.minecraft.init.Blocks.barrier && this != net.minecraft.init.Blocks.bedrock && this != net.minecraft.init.Blocks.end_portal && this != net.minecraft.init.Blocks.end_portal_frame && this != net.minecraft.init.Blocks.command_block; + } + else if (entity instanceof net.minecraft.entity.boss.EntityDragon) + { -+ return this != net.minecraft.init.Blocks.field_180401_cv && this != net.minecraft.init.Blocks.field_150343_Z && this != net.minecraft.init.Blocks.field_150377_bs && this != net.minecraft.init.Blocks.field_150357_h && this != net.minecraft.init.Blocks.field_150483_bI; ++ return this != net.minecraft.init.Blocks.barrier && this != net.minecraft.init.Blocks.obsidian && this != net.minecraft.init.Blocks.end_stone && this != net.minecraft.init.Blocks.bedrock && this != net.minecraft.init.Blocks.command_block; + } + + return true; @@ -965,7 +965,7 @@ + */ + public boolean isBeaconBase(IBlockAccess worldObj, BlockPos pos, BlockPos beacon) + { -+ return this == net.minecraft.init.Blocks.field_150475_bE || this == net.minecraft.init.Blocks.field_150340_R || this == net.minecraft.init.Blocks.field_150484_ah || this == net.minecraft.init.Blocks.field_150339_S; ++ return this == net.minecraft.init.Blocks.emerald_block || this == net.minecraft.init.Blocks.gold_block || this == net.minecraft.init.Blocks.diamond_block || this == net.minecraft.init.Blocks.iron_block; + } + + /** @@ -981,12 +981,12 @@ + */ + public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) + { -+ IBlockState state = world.func_180495_p(pos); -+ for (IProperty prop : (java.util.Set)state.func_177228_b().keySet()) ++ IBlockState state = world.getBlockState(pos); ++ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) + { -+ if (prop.func_177701_a().equals("facing") || prop.func_177701_a().equals("rotation")) ++ if (prop.getName().equals("facing") || prop.getName().equals("rotation")) + { -+ world.func_175656_a(pos, state.func_177231_a(prop)); ++ world.setBlockState(pos, state.cycleProperty(prop)); + return true; + } + } @@ -1002,12 +1002,12 @@ + */ + public EnumFacing[] getValidRotations(World world, BlockPos pos) + { -+ IBlockState state = world.func_180495_p(pos); -+ for (IProperty prop : (java.util.Set)state.func_177228_b().keySet()) ++ IBlockState state = world.getBlockState(pos); ++ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) + { -+ if (prop.func_177701_a().equals("facing") && prop.func_177699_b() == EnumFacing.class) ++ if (prop.getName().equals("facing") && prop.getValueClass() == EnumFacing.class) + { -+ java.util.Collection values = ((java.util.Collection)prop.func_177700_c()); ++ java.util.Collection values = ((java.util.Collection)prop.getAllowedValues()); + return values.toArray(new EnumFacing[values.size()]); + } + } @@ -1022,7 +1022,7 @@ + */ + public float getEnchantPowerBonus(World world, BlockPos pos) + { -+ return this == net.minecraft.init.Blocks.field_150342_X ? 1 : 0; ++ return this == net.minecraft.init.Blocks.bookshelf ? 1 : 0; + } + + /** @@ -1035,15 +1035,15 @@ + */ + public boolean recolorBlock(World world, BlockPos pos, EnumFacing side, net.minecraft.item.EnumDyeColor color) + { -+ IBlockState state = world.func_180495_p(pos); -+ for (IProperty prop : (java.util.Set)state.func_177228_b().keySet()) ++ IBlockState state = world.getBlockState(pos); ++ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) + { -+ if (prop.func_177701_a().equals("color") && prop.func_177699_b() == net.minecraft.item.EnumDyeColor.class) ++ if (prop.getName().equals("color") && prop.getValueClass() == net.minecraft.item.EnumDyeColor.class) + { -+ net.minecraft.item.EnumDyeColor current = (net.minecraft.item.EnumDyeColor)state.func_177229_b(prop); ++ net.minecraft.item.EnumDyeColor current = (net.minecraft.item.EnumDyeColor)state.getValue(prop); + if (current != color) + { -+ world.func_175656_a(pos, state.func_177226_a(prop, color)); ++ world.setBlockState(pos, state.withProperty(prop, color)); + return true; + } + } @@ -1081,7 +1081,7 @@ + */ + public boolean shouldCheckWeakPower(IBlockAccess world, BlockPos pos, EnumFacing side) + { -+ return func_149721_r(); ++ return isNormalCube(); + } + + /** @@ -1114,7 +1114,7 @@ + */ + public void setHarvestLevel(String toolClass, int level) + { -+ Iterator itr = func_176194_O().func_177619_a().iterator(); ++ Iterator itr = getBlockState().getValidStates().iterator(); + while (itr.hasNext()) + { + setHarvestLevel(toolClass, level, itr.next()); @@ -1135,7 +1135,7 @@ + */ + public void setHarvestLevel(String toolClass, int level, IBlockState state) + { -+ int idx = this.func_176201_c(state); ++ int idx = this.getMetaFromState(state); + this.harvestTool[idx] = toolClass; + this.harvestLevel[idx] = level; + } @@ -1146,7 +1146,7 @@ + */ + public String getHarvestTool(IBlockState state) + { -+ return harvestTool[func_176201_c(state)]; ++ return harvestTool[getMetaFromState(state)]; + } + + /** @@ -1158,7 +1158,7 @@ + */ + public int getHarvestLevel(IBlockState state) + { -+ return harvestLevel[func_176201_c(state)]; ++ return harvestLevel[getMetaFromState(state)]; + } + + /** @@ -1167,7 +1167,7 @@ + */ + public boolean isToolEffective(String type, IBlockState state) + { -+ if ("pickaxe".equals(type) && (this == net.minecraft.init.Blocks.field_150450_ax || this == net.minecraft.init.Blocks.field_150439_ay || this == net.minecraft.init.Blocks.field_150343_Z)) ++ if ("pickaxe".equals(type) && (this == net.minecraft.init.Blocks.redstone_ore || this == net.minecraft.init.Blocks.lit_redstone_ore || this == net.minecraft.init.Blocks.obsidian)) + return false; + return type != null && type.equals(getHarvestTool(state)); + } @@ -1177,7 +1177,7 @@ + */ + public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) + { -+ return func_176221_a(state, world, pos); ++ return getActualState(state, world, pos); + } + + /** @@ -1186,7 +1186,7 @@ + */ + public boolean canRenderInLayer(EnumWorldBlockLayer layer) + { -+ return func_180664_k() == layer; ++ return getBlockLayer() == layer; + } + + // For Internal use only to capture droped items inside getDrops @@ -1214,6 +1214,6 @@ + } + /* ========================================= FORGE END ======================================*/ + - public static void func_149671_p() + public static void registerBlocks() { - func_176215_a(0, field_176230_a, (new BlockAir()).func_149663_c("air")); + registerBlock(0, AIR_ID, (new BlockAir()).setUnlocalizedName("air")); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockAir.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockAir.java.patch new file mode 100644 index 000000000..a85287bef --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockAir.java.patch @@ -0,0 +1,9 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockAir.java ++++ ../src-work/minecraft/net/minecraft/block/BlockAir.java +@@ -36,4 +36,6 @@ + } + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) {} ++ ++ public boolean isReplaceable(World worldIn, BlockPos pos){ return true; } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch new file mode 100644 index 000000000..107960c2a --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch @@ -0,0 +1,66 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockBush.java ++++ ../src-work/minecraft/net/minecraft/block/BlockBush.java +@@ -12,7 +12,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public class BlockBush extends Block ++public class BlockBush extends Block implements net.minecraftforge.common.IPlantable + { + private static final String __OBFID = "CL_00000208"; + +@@ -32,7 +32,7 @@ + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return super.canPlaceBlockAt(worldIn, pos) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ return super.canPlaceBlockAt(worldIn, pos) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); + } + + protected boolean canPlaceBlockOn(Block ground) +@@ -62,7 +62,10 @@ + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { +- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ BlockPos down = pos.down(); ++ Block soil = worldIn.getBlockState(down).getBlock(); ++ if (state.getBlock() != this) return this.canPlaceBlockOn(soil); //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 soil.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, this); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) +@@ -85,4 +88,33 @@ + { + return EnumWorldBlockLayer.CUTOUT; + } ++ ++ @Override ++ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) ++ { ++ if (this == Blocks.wheat) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.carrots) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.potatoes) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.melon_stem) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.pumpkin_stem) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.deadbush) return net.minecraftforge.common.EnumPlantType.Desert; ++ if (this == Blocks.waterlily) return net.minecraftforge.common.EnumPlantType.Water; ++ if (this == Blocks.red_mushroom) return net.minecraftforge.common.EnumPlantType.Cave; ++ if (this == Blocks.brown_mushroom) return net.minecraftforge.common.EnumPlantType.Cave; ++ if (this == Blocks.nether_wart) return net.minecraftforge.common.EnumPlantType.Nether; ++ if (this == Blocks.sapling) return net.minecraftforge.common.EnumPlantType.Plains; ++ if (this == Blocks.tallgrass) return net.minecraftforge.common.EnumPlantType.Plains; ++ if (this == Blocks.double_plant) return net.minecraftforge.common.EnumPlantType.Plains; ++ if (this == Blocks.red_flower) return net.minecraftforge.common.EnumPlantType.Plains; ++ if (this == Blocks.yellow_flower) return net.minecraftforge.common.EnumPlantType.Plains; ++ return net.minecraftforge.common.EnumPlantType.Plains; ++ } ++ ++ @Override ++ public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) ++ { ++ IBlockState state = world.getBlockState(pos); ++ if (state.getBlock() != this) return getDefaultState(); ++ return state; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch new file mode 100644 index 000000000..e91728561 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch @@ -0,0 +1,46 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockButton.java ++++ ../src-work/minecraft/net/minecraft/block/BlockButton.java +@@ -18,6 +18,7 @@ + import net.minecraft.util.EnumFacing; + import net.minecraft.world.IBlockAccess; + import net.minecraft.world.World; ++import static net.minecraft.util.EnumFacing.*; + + public abstract class BlockButton extends Block + { +@@ -57,7 +58,7 @@ + + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + { +- return worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock().isNormalCube(); ++ return worldIn.isSideSolid(pos.offset(side.getOpposite()), side, true); + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) +@@ -69,7 +70,7 @@ + { + EnumFacing enumfacing = aenumfacing[j]; + +- if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock().isNormalCube()) ++ if (worldIn.isSideSolid(pos.offset(enumfacing), enumfacing.getOpposite(), true)) + { + return true; + } +@@ -80,7 +81,7 @@ + + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { +- return worldIn.getBlockState(pos.offset(facing.getOpposite())).getBlock().isNormalCube() ? this.getDefaultState().withProperty(FACING, facing).withProperty(POWERED, Boolean.valueOf(false)) : this.getDefaultState().withProperty(FACING, EnumFacing.DOWN).withProperty(POWERED, Boolean.valueOf(false)); ++ return worldIn.isSideSolid(pos.offset(facing.getOpposite()), facing, true) ? this.getDefaultState().withProperty(FACING, facing).withProperty(POWERED, Boolean.valueOf(false)) : this.getDefaultState().withProperty(FACING, EnumFacing.DOWN).withProperty(POWERED, Boolean.valueOf(false)); + } + + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) +@@ -89,7 +90,7 @@ + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + +- if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).getBlock().isNormalCube()) ++ if (!worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); diff --git a/patches/minecraft/net/minecraft/block/BlockCactus.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch similarity index 58% rename from patches/minecraft/net/minecraft/block/BlockCactus.java.patch rename to patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch index af39372ed..25c9d4cb0 100644 --- a/patches/minecraft/net/minecraft/block/BlockCactus.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch @@ -7,20 +7,20 @@ -public class BlockCactus extends Block +public class BlockCactus extends Block implements net.minecraftforge.common.IPlantable { - public static final PropertyInteger field_176587_a = PropertyInteger.func_177719_a("age", 0, 15); + public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15); private static final String __OBFID = "CL_00000210"; @@ -115,7 +115,7 @@ } - Block block = p_176586_1_.func_180495_p(p_176586_2_.func_177977_b()).func_177230_c(); -- return block == Blocks.field_150434_aF || block == Blocks.field_150354_m; -+ return block.canSustainPlant(p_176586_1_, p_176586_2_.func_177977_b(), EnumFacing.UP, this); + Block block = worldIn.getBlockState(pos.down()).getBlock(); +- return block == Blocks.cactus || block == Blocks.sand; ++ return block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this); } - public void func_180634_a(World p_180634_1_, BlockPos p_180634_2_, IBlockState p_180634_3_, Entity p_180634_4_) + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) @@ -143,4 +143,16 @@ { - return new BlockState(this, new IProperty[] {field_176587_a}); + return new BlockState(this, new IProperty[] {AGE}); } + + @Override @@ -32,6 +32,6 @@ + @Override + public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) + { -+ return func_176223_P(); ++ return getDefaultState(); + } } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch new file mode 100644 index 000000000..66e55dc38 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockChest.java ++++ ../src-work/minecraft/net/minecraft/block/BlockChest.java +@@ -531,7 +531,7 @@ + + private boolean isBelowSolidBlock(World worldIn, BlockPos pos) + { +- return worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); ++ return worldIn.isSideSolid(pos.up(), EnumFacing.DOWN, false); + } + + private boolean isOcelotSittingOnChest(World worldIn, BlockPos pos) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockCocoa.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockCocoa.java.patch new file mode 100644 index 000000000..d99b486cf --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockCocoa.java.patch @@ -0,0 +1,27 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java ++++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java +@@ -137,6 +137,13 @@ + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { ++ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); ++ } ++ ++ @Override ++ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List dropped = super.getDrops(world, pos, state, fortune); + int j = ((Integer)state.getValue(AGE)).intValue(); + byte b0 = 1; + +@@ -147,8 +154,9 @@ + + for (int k = 0; k < b0; ++k) + { +- spawnAsEntity(worldIn, pos, new ItemStack(Items.dye, 1, EnumDyeColor.BROWN.getDyeDamage())); ++ dropped.add(new ItemStack(Items.dye, 1, EnumDyeColor.BROWN.getDyeDamage())); + } ++ return dropped; + } + + @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch new file mode 100644 index 000000000..e7efd49a1 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch @@ -0,0 +1,77 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockCrops.java ++++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java +@@ -82,11 +82,11 @@ + float f1 = 0.0F; + IBlockState iblockstate = worldIn.getBlockState(blockpos1.add(i, 0, j)); + +- if (iblockstate.getBlock() == Blocks.farmland) ++ if (iblockstate.getBlock().canSustainPlant(worldIn, blockpos1.add(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)blockIn)) + { + f1 = 1.0F; + +- if (((Integer)iblockstate.getValue(BlockFarmland.MOISTURE)).intValue() > 0) ++ if (iblockstate.getBlock().isFertile(worldIn, blockpos1.add(i, 0, j))) + { + f1 = 3.0F; + } +@@ -127,7 +127,7 @@ + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { +- return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); + } + + protected Item getSeed() +@@ -143,24 +143,6 @@ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); +- +- if (!worldIn.isRemote) +- { +- int j = ((Integer)state.getValue(AGE)).intValue(); +- +- if (j >= 7) +- { +- int k = 3 + fortune; +- +- for (int l = 0; l < k; ++l) +- { +- if (worldIn.rand.nextInt(15) <= j) +- { +- spawnAsEntity(worldIn, pos, new ItemStack(this.getSeed(), 1, 0)); +- } +- } +- } +- } + } + + public Item getItemDropped(IBlockState state, Random rand, int fortune) +@@ -203,4 +185,26 @@ + { + return new BlockState(this, new IProperty[] {AGE}); + } ++ ++ @Override ++ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List ret = super.getDrops(world, pos, state, fortune); ++ int age = ((Integer)state.getValue(AGE)).intValue(); ++ Random rand = world instanceof World ? ((World)world).rand : new Random(); ++ ++ if (age >= 7) ++ { ++ int k = 3 + fortune; ++ ++ for (int i = 0; i < 3 + fortune; ++i) ++ { ++ if (rand.nextInt(15) <= age) ++ { ++ ret.add(new ItemStack(this.getSeed(), 1, 0)); ++ } ++ } ++ } ++ return ret; ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch similarity index 57% rename from patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch rename to patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch index daeef6fe3..5a36603ea 100644 --- a/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch @@ -11,16 +11,16 @@ @@ -41,14 +41,15 @@ - public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) { -- if (!p_180657_1_.field_72995_K && p_180657_2_.func_71045_bC() != null && p_180657_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ) +- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) { -- p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); -- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Blocks.field_150330_I, 1, 0)); +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0)); - } - else - { - super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); + super.harvestBlock(worldIn, player, pos, state, te); } } + @@ -28,6 +28,6 @@ + @Override + public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { -+ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(Blocks.field_150330_I))); ++ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(Blocks.deadbush))); + } } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch new file mode 100644 index 000000000..e44689205 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockDoor.java ++++ ../src-work/minecraft/net/minecraft/block/BlockDoor.java +@@ -149,7 +149,7 @@ + { + if (this.blockMaterial == Material.iron) + { +- return true; ++ return false; //Allow items to interact with the door + } + else + { +@@ -267,7 +267,7 @@ + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return pos.getY() >= 255 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); ++ return pos.getY() >= worldIn.getHeight() - 1 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); + } + + public int getMobilityFlag() diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch new file mode 100644 index 000000000..e617af020 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch @@ -0,0 +1,89 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockDoublePlant.java ++++ ../src-work/minecraft/net/minecraft/block/BlockDoublePlant.java +@@ -24,7 +24,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public class BlockDoublePlant extends BlockBush implements IGrowable ++public class BlockDoublePlant extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable + { + public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockDoublePlant.EnumPlantType.class); + public static final PropertyEnum HALF = PropertyEnum.create("half", BlockDoublePlant.EnumBlockHalf.class); +@@ -89,6 +89,8 @@ + Object object = flag ? this : worldIn.getBlockState(blockpos1).getBlock(); + Object object1 = flag ? worldIn.getBlockState(blockpos2).getBlock() : this; + ++ if (!flag) this.dropBlockAsItem(worldIn, pos, state, 0); //Forge move above the setting to air. ++ + if (object == this) + { + worldIn.setBlockState(blockpos1, Blocks.air.getDefaultState(), 3); +@@ -97,17 +99,13 @@ + if (object1 == this) + { + worldIn.setBlockState(blockpos2, Blocks.air.getDefaultState(), 3); +- +- if (!flag) +- { +- this.dropBlockAsItem(worldIn, blockpos2, state, 0); +- } + } + } + } + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { ++ if (state.getBlock() != this) return super.canBlockStay(worldIn, pos, state); //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. + if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) + { + return worldIn.getBlockState(pos.down()).getBlock() == this; +@@ -157,7 +155,6 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- if (worldIn.isRemote || player.getCurrentEquippedItem() == null || player.getCurrentEquippedItem().getItem() != Items.shears || state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.onHarvest(worldIn, pos, state, player)) + { + super.harvestBlock(worldIn, player, pos, state, te); + } +@@ -220,8 +217,6 @@ + else + { + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- int i = (enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).getMeta(); +- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 2, i)); + return true; + } + } +@@ -296,6 +291,32 @@ + return Block.EnumOffsetType.XZ; + } + ++ @Override ++ public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos) ++ { ++ IBlockState state = world.getBlockState(pos); ++ EnumPlantType type = (EnumPlantType)state.getValue(VARIANT); ++ return state.getValue(HALF) == EnumBlockHalf.LOWER && (type == EnumPlantType.FERN || type == EnumPlantType.GRASS); ++ } ++ @Override ++ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ java.util.List ret = new java.util.ArrayList(); ++ EnumPlantType type = (EnumPlantType)world.getBlockState(pos).getValue(VARIANT); ++ if (type == EnumPlantType.FERN) ret.add(new ItemStack(Blocks.tallgrass, 2, BlockTallGrass.EnumType.FERN.getMeta())); ++ if (type == EnumPlantType.GRASS) ret.add(new ItemStack(Blocks.tallgrass, 2, BlockTallGrass.EnumType.GRASS.getMeta())); ++ return ret; ++ } ++ @Override ++ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) ++ { ++ //Forge: Break both parts on the client to prevent the top part flickering as default type for a few frames. ++ IBlockState state = world.getBlockState(pos); ++ if (state.getBlock() == this && state.getValue(HALF) == EnumBlockHalf.LOWER && world.getBlockState(pos.up()).getBlock() == this) ++ world.setBlockToAir(pos.up()); ++ return world.setBlockToAir(pos); ++ } ++ + static enum EnumBlockHalf implements IStringSerializable + { + UPPER, diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch new file mode 100644 index 000000000..f303f1b29 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockFalling.java ++++ ../src-work/minecraft/net/minecraft/block/BlockFalling.java +@@ -85,6 +85,7 @@ + + public static boolean canFallInto(World worldIn, BlockPos pos) + { ++ if (worldIn.isAirBlock(pos)) return true; + Block block = worldIn.getBlockState(pos).getBlock(); + Material material = block.blockMaterial; + return block == Blocks.fire || material == Material.air || material == Material.water || material == Material.lava; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch new file mode 100644 index 000000000..b94b5429e --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockFarmland.java ++++ ../src-work/minecraft/net/minecraft/block/BlockFarmland.java +@@ -89,7 +89,7 @@ + private boolean hasCrops(World worldIn, BlockPos pos) + { + Block block = worldIn.getBlockState(pos.up()).getBlock(); +- return block instanceof BlockCrops || block instanceof BlockStem; ++ return block instanceof net.minecraftforge.common.IPlantable && canSustainPlant(worldIn, pos, net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)block); + } + + private boolean hasWater(World worldIn, BlockPos pos) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch new file mode 100644 index 000000000..ebd791a84 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch @@ -0,0 +1,211 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockFire.java ++++ ../src-work/minecraft/net/minecraft/block/BlockFire.java +@@ -42,18 +42,24 @@ + int j = pos.getY(); + int k = pos.getZ(); + +- if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down())) ++ if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP)) + { + boolean flag = (i + j + k & 1) == 1; + boolean flag1 = (i / 2 + j / 2 + k / 2 & 1) == 1; + int l = 0; + +- if (this.canCatchFire(worldIn, pos.up())) ++ if (this.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN)) + { + l = flag ? 1 : 2; + } + +- return state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west()))).withProperty(UPPER, Integer.valueOf(l)).withProperty(FLIP, Boolean.valueOf(flag1)).withProperty(ALT, Boolean.valueOf(flag)); ++ return state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH))) ++ .withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east(), EnumFacing.EAST ))) ++ .withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH))) ++ .withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west(), EnumFacing.EAST ))) ++ .withProperty(UPPER, Integer.valueOf(l)) ++ .withProperty(FLIP, Boolean.valueOf(flag1)) ++ .withProperty(ALT, Boolean.valueOf(flag)); + } + else + { +@@ -109,6 +115,7 @@ + + public void setFireInfo(Block blockIn, int encouragement, int flammability) + { ++ if (blockIn == Blocks.air) throw new IllegalArgumentException("Tried to set air on fire... This is bad."); + this.encouragements.put(blockIn, Integer.valueOf(encouragement)); + this.flammabilities.put(blockIn, Integer.valueOf(flammability)); + } +@@ -148,13 +155,8 @@ + } + + Block block = worldIn.getBlockState(pos.down()).getBlock(); +- boolean flag = block == Blocks.netherrack; ++ boolean flag = block.isFireSource(worldIn, pos.down(), EnumFacing.UP); + +- if (worldIn.provider instanceof WorldProviderEnd && block == Blocks.bedrock) +- { +- flag = true; +- } +- + if (!flag && worldIn.isRaining() && this.canDie(worldIn, pos)) + { + worldIn.setBlockToAir(pos); +@@ -183,7 +185,7 @@ + return; + } + +- if (!this.canCatchFire(worldIn, pos.down()) && i == 15 && rand.nextInt(4) == 0) ++ if (!this.canCatchFire(worldIn, pos.down(), EnumFacing.UP) && i == 15 && rand.nextInt(4) == 0) + { + worldIn.setBlockToAir(pos); + return; +@@ -198,12 +200,12 @@ + b0 = -50; + } + +- this.catchOnFire(worldIn, pos.east(), 300 + b0, rand, i); +- this.catchOnFire(worldIn, pos.west(), 300 + b0, rand, i); +- this.catchOnFire(worldIn, pos.down(), 250 + b0, rand, i); +- this.catchOnFire(worldIn, pos.up(), 250 + b0, rand, i); +- this.catchOnFire(worldIn, pos.north(), 300 + b0, rand, i); +- this.catchOnFire(worldIn, pos.south(), 300 + b0, rand, i); ++ this.tryCatchFire(worldIn, pos.east(), 300 + b0, rand, i, EnumFacing.WEST); ++ this.tryCatchFire(worldIn, pos.west(), 300 + b0, rand, i, EnumFacing.EAST); ++ this.tryCatchFire(worldIn, pos.down(), 250 + b0, rand, i, EnumFacing.UP); ++ this.tryCatchFire(worldIn, pos.up(), 250 + b0, rand, i, EnumFacing.DOWN); ++ this.tryCatchFire(worldIn, pos.north(), 300 + b0, rand, i, EnumFacing.SOUTH); ++ this.tryCatchFire(worldIn, pos.south(), 300 + b0, rand, i, EnumFacing.NORTH); + + for (int j = -1; j <= 1; ++j) + { +@@ -262,22 +264,30 @@ + return false; + } + ++ @Deprecated // Use Block.getFlammability + public int getFlammability(Block blockIn) + { + Integer integer = (Integer)this.flammabilities.get(blockIn); + return integer == null ? 0 : integer.intValue(); + } + ++ @Deprecated // Use Block.getFlammability + public int getEncouragement(Block blockIn) + { + Integer integer = (Integer)this.encouragements.get(blockIn); + return integer == null ? 0 : integer.intValue(); + } + ++ @Deprecated // Use tryCatchFire with face below + private void catchOnFire(World worldIn, BlockPos pos, int chance, Random random, int age) + { +- int k = this.getFlammability(worldIn.getBlockState(pos).getBlock()); ++ this.tryCatchFire(worldIn, pos, chance, random, age, EnumFacing.UP); ++ } + ++ private void tryCatchFire(World worldIn, BlockPos pos, int chance, Random random, int age, EnumFacing face) ++ { ++ int k = worldIn.getBlockState(pos).getBlock().getFlammability(worldIn, pos, face); ++ + if (random.nextInt(chance) < k) + { + IBlockState iblockstate = worldIn.getBlockState(pos); +@@ -314,7 +324,7 @@ + { + EnumFacing enumfacing = aenumfacing[j]; + +- if (this.canCatchFire(worldIn, pos.offset(enumfacing))) ++ if (this.canCatchFire(worldIn, pos.offset(enumfacing), enumfacing.getOpposite())) + { + return true; + } +@@ -338,7 +348,7 @@ + for (int k = 0; k < j; ++k) + { + EnumFacing enumfacing = aenumfacing[k]; +- i = Math.max(this.getEncouragement(worldIn.getBlockState(pos.offset(enumfacing)).getBlock()), i); ++ i = Math.max(worldIn.getBlockState(pos.offset(enumfacing)).getBlock().getFlammability(worldIn, pos.offset(enumfacing), enumfacing.getOpposite()), i); + } + + return i; +@@ -350,9 +360,10 @@ + return false; + } + ++ @Deprecated // Use canCatchFire with face sensitive version below + public boolean canCatchFire(IBlockAccess worldIn, BlockPos pos) + { +- return this.getEncouragement(worldIn.getBlockState(pos).getBlock()) > 0; ++ return canCatchFire(worldIn, pos, EnumFacing.UP); + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) +@@ -396,9 +407,9 @@ + double d1; + double d2; + +- if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down())) ++ if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP)) + { +- if (Blocks.fire.canCatchFire(worldIn, pos.west())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.west(), EnumFacing.EAST)) + { + for (i = 0; i < 2; ++i) + { +@@ -409,7 +420,7 @@ + } + } + +- if (Blocks.fire.canCatchFire(worldIn, pos.east())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.east(), EnumFacing.WEST)) + { + for (i = 0; i < 2; ++i) + { +@@ -420,7 +431,7 @@ + } + } + +- if (Blocks.fire.canCatchFire(worldIn, pos.north())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH)) + { + for (i = 0; i < 2; ++i) + { +@@ -431,7 +442,7 @@ + } + } + +- if (Blocks.fire.canCatchFire(worldIn, pos.south())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH)) + { + for (i = 0; i < 2; ++i) + { +@@ -442,7 +453,7 @@ + } + } + +- if (Blocks.fire.canCatchFire(worldIn, pos.up())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN)) + { + for (i = 0; i < 2; ++i) + { +@@ -490,4 +501,19 @@ + { + return new BlockState(this, new IProperty[] {AGE, NORTH, EAST, SOUTH, WEST, UPPER, FLIP, ALT}); + } ++ ++ /*================================= Forge Start ======================================*/ ++ /** ++ * Side sensitive version that calls the block function. ++ * ++ * @param world The current world ++ * @param pos Block position ++ * @param face The side the fire is coming from ++ * @return True if the face can catch fire. ++ */ ++ public boolean canCatchFire(IBlockAccess world, BlockPos pos, EnumFacing face) ++ { ++ return world.getBlockState(pos).getBlock().isFlammable(world, pos, face); ++ } ++ /*================================= Forge Start ======================================*/ + } diff --git a/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch similarity index 56% rename from patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch rename to patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch index fc892d51e..cc2eda3c8 100644 --- a/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch @@ -2,16 +2,16 @@ +++ ../src-work/minecraft/net/minecraft/block/BlockFlowerPot.java @@ -162,13 +162,6 @@ - public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_) + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { -- TileEntityFlowerPot tileentityflowerpot = this.func_176442_d(p_180663_1_, p_180663_2_); +- TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos); - -- if (tileentityflowerpot != null && tileentityflowerpot.func_145965_a() != null) +- if (tileentityflowerpot != null && tileentityflowerpot.getFlowerPotItem() != null) - { -- func_180635_a(p_180663_1_, p_180663_2_, new ItemStack(tileentityflowerpot.func_145965_a(), 1, tileentityflowerpot.func_145966_b())); +- spawnAsEntity(worldIn, pos, new ItemStack(tileentityflowerpot.getFlowerPotItem(), 1, tileentityflowerpot.getFlowerPotData())); - } - - super.func_180663_b(p_180663_1_, p_180663_2_, p_180663_3_); + super.breakBlock(worldIn, pos, state); } @@ -388,6 +381,31 @@ @@ -24,9 +24,9 @@ + public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { + java.util.List ret = super.getDrops(world, pos, state, fortune); -+ TileEntityFlowerPot te = world.func_175625_s(pos) instanceof TileEntityFlowerPot ? (TileEntityFlowerPot)world.func_175625_s(pos) : null; -+ if (te != null && te.func_145965_a() != null) -+ ret.add(new ItemStack(te.func_145965_a(), 1, te.func_145966_b())); ++ TileEntityFlowerPot te = world.getTileEntity(pos) instanceof TileEntityFlowerPot ? (TileEntityFlowerPot)world.getTileEntity(pos) : null; ++ if (te != null && te.getFlowerPotItem() != null) ++ ret.add(new ItemStack(te.getFlowerPotItem(), 1, te.getFlowerPotData())); + return ret; + } + @Override @@ -36,10 +36,10 @@ + return super.removedByPlayer(world, pos, player, willHarvest); + } + @Override -+ public void func_180657_a(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) ++ public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { -+ super.func_180657_a(world, player, pos, state, te); -+ world.func_175698_g(pos); ++ super.harvestBlock(world, player, pos, state, te); ++ world.setBlockToAir(pos); + } + /*===========================FORGE END==========================================*/ + diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch new file mode 100644 index 000000000..dcf8c192c --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch @@ -0,0 +1,41 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockGrass.java ++++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java +@@ -59,7 +59,7 @@ + { + if (!worldIn.isRemote) + { +- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2) ++ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity(worldIn, pos.up()) > 2) + { + worldIn.setBlockState(pos, Blocks.dirt.getDefaultState()); + } +@@ -73,7 +73,7 @@ + Block block = worldIn.getBlockState(blockpos1.up()).getBlock(); + IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); + +- if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity() <= 2) ++ if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity(worldIn, blockpos1.up()) <= 2) + { + worldIn.setBlockState(blockpos1, Blocks.grass.getDefaultState()); + } +@@ -120,18 +120,11 @@ + continue; + } + } +- else if (worldIn.getBlockState(blockpos2).getBlock().blockMaterial == Material.air) ++ else if (worldIn.isAirBlock(blockpos2)) + { + if (rand.nextInt(8) == 0) + { +- BlockFlower.EnumFlowerType enumflowertype = worldIn.getBiomeGenForCoords(blockpos2).pickRandomFlower(rand, blockpos2); +- BlockFlower blockflower = enumflowertype.getBlockType().getBlock(); +- IBlockState iblockstate1 = blockflower.getDefaultState().withProperty(blockflower.getTypeProperty(), enumflowertype); +- +- if (blockflower.canBlockStay(worldIn, blockpos2, iblockstate1)) +- { +- worldIn.setBlockState(blockpos2, iblockstate1, 3); +- } ++ worldIn.getBiomeGenForCoords(blockpos2).plantFlower(worldIn, rand, blockpos2); + } + else + { diff --git a/patches/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch similarity index 58% rename from patches/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch rename to patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch index 6f2f73437..a46fe79eb 100644 --- a/patches/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch @@ -1,17 +1,17 @@ --- ../src-base/minecraft/net/minecraft/block/BlockHugeMushroom.java +++ ../src-work/minecraft/net/minecraft/block/BlockHugeMushroom.java @@ -64,6 +64,20 @@ - return new BlockState(this, new IProperty[] {field_176380_a}); + return new BlockState(this, new IProperty[] {VARIANT}); } + public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) + { -+ IBlockState state = world.func_180495_p(pos); -+ for (IProperty prop : (java.util.Set)state.func_177228_b().keySet()) ++ IBlockState state = world.getBlockState(pos); ++ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) + { -+ if (prop.func_177701_a().equals("variant")) ++ if (prop.getName().equals("variant")) + { -+ world.func_175656_a(pos, state.func_177231_a(prop)); ++ world.setBlockState(pos, state.cycleProperty(prop)); + return true; + } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch new file mode 100644 index 000000000..ebd4a9f12 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch @@ -0,0 +1,35 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockIce.java ++++ ../src-work/minecraft/net/minecraft/block/BlockIce.java +@@ -40,14 +40,17 @@ + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); + player.addExhaustion(0.025F); + +- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) ++ if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player)) + { ++ java.util.List items = new java.util.ArrayList(); + ItemStack itemstack = this.createStackedBlock(state); + +- if (itemstack != null) +- { +- spawnAsEntity(worldIn, pos, itemstack); +- } ++ if (itemstack != null) items.add(itemstack); ++ ++ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, worldIn.getBlockState(pos), 0, 1.0f, true, player); ++ ++ for (ItemStack is : items) ++ spawnAsEntity(worldIn, pos, is); + } + else + { +@@ -58,7 +61,9 @@ + } + + int i = EnchantmentHelper.getFortuneModifier(player); ++ harvesters.set(player); + this.dropBlockAsItem(worldIn, pos, state, i); ++ harvesters.set(null); + Material material = worldIn.getBlockState(pos.down()).getBlock().getMaterial(); + + if (material.blocksMovement() || material.isLiquid()) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch new file mode 100644 index 000000000..9c4b2704e --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch @@ -0,0 +1,32 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockLadder.java ++++ ../src-work/minecraft/net/minecraft/block/BlockLadder.java +@@ -80,7 +80,10 @@ + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return worldIn.getBlockState(pos.west()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.east()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.north()).getBlock().isNormalCube() ? true : worldIn.getBlockState(pos.south()).getBlock().isNormalCube())); ++ return worldIn.isSideSolid(pos.west(), EnumFacing.EAST, true) || ++ worldIn.isSideSolid(pos.east(), EnumFacing.WEST, true) || ++ worldIn.isSideSolid(pos.north(), EnumFacing.SOUTH, true) || ++ worldIn.isSideSolid(pos.south(), EnumFacing.NORTH, true); + } + + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) +@@ -124,7 +127,7 @@ + + protected boolean canBlockStay(World worldIn, BlockPos pos, EnumFacing facing) + { +- return worldIn.getBlockState(pos.offset(facing.getOpposite())).getBlock().isNormalCube(); ++ return worldIn.isSideSolid(pos.offset(facing.getOpposite()), facing, true); + } + + @SideOnly(Side.CLIENT) +@@ -155,6 +158,8 @@ + return new BlockState(this, new IProperty[] {FACING}); + } + ++ @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; } ++ + static final class SwitchEnumFacing + { + static final int[] FACING_LOOKUP = new int[EnumFacing.values().length]; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch new file mode 100644 index 000000000..662e1f74d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch @@ -0,0 +1,130 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java ++++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java +@@ -18,7 +18,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public abstract class BlockLeaves extends BlockLeavesBase ++public abstract class BlockLeaves extends BlockLeavesBase implements net.minecraftforge.common.IShearable + { + public static final PropertyBool DECAYABLE = PropertyBool.create("decayable"); + public static final PropertyBool CHECK_DECAY = PropertyBool.create("check_decay"); +@@ -76,9 +76,9 @@ + BlockPos blockpos1 = pos.add(i1, j1, k1); + IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); + +- if (iblockstate1.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate1.getValue(CHECK_DECAY)).booleanValue()) ++ if (iblockstate1.getBlock().isLeaves(worldIn, blockpos1)) + { +- worldIn.setBlockState(blockpos1, iblockstate1.withProperty(CHECK_DECAY, Boolean.valueOf(true)), 4); ++ iblockstate1.getBlock().beginLeavesDecay(worldIn, blockpos1); + } + } + } +@@ -119,11 +119,12 @@ + { + for (i2 = -b0; i2 <= b0; ++i2) + { +- Block block = worldIn.getBlockState(new BlockPos(j + k1, k + l1, l + i2)).getBlock(); ++ BlockPos tmp = new BlockPos(j + k1, k + l1, l + i2); ++ Block block = worldIn.getBlockState(tmp).getBlock(); + +- if (block != Blocks.log && block != Blocks.log2) ++ if (!block.canSustainLeaves(worldIn, tmp)) + { +- if (block.getMaterial() == Material.leaves) ++ if (block.isLeaves(worldIn, tmp)) + { + this.surroundings[(k1 + j1) * i1 + (l1 + j1) * b1 + i2 + j1] = -2; + } +@@ -230,40 +231,7 @@ + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { +- if (!worldIn.isRemote) +- { +- int j = this.getSaplingDropChance(state); +- +- if (fortune > 0) +- { +- j -= 2 << fortune; +- +- if (j < 10) +- { +- j = 10; +- } +- } +- +- if (worldIn.rand.nextInt(j) == 0) +- { +- Item item = this.getItemDropped(state, worldIn.rand, fortune); +- spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); +- } +- +- j = 200; +- +- if (fortune > 0) +- { +- j -= 10 << fortune; +- +- if (j < 40) +- { +- j = 40; +- } +- } +- +- this.dropApple(worldIn, pos, state, j); +- } ++ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + } + + protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance) {} +@@ -298,4 +266,48 @@ + } + + public abstract BlockPlanks.EnumType getWoodType(int meta); ++ ++ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } ++ @Override public boolean isLeaves(IBlockAccess world, BlockPos pos){ return true; } ++ ++ @Override ++ public void beginLeavesDecay(World world, BlockPos pos) ++ { ++ IBlockState state = world.getBlockState(pos); ++ if (!(Boolean)state.getValue(CHECK_DECAY)) ++ { ++ world.setBlockState(pos, state.withProperty(CHECK_DECAY, true), 4); ++ } ++ } ++ ++ @Override ++ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List ret = new java.util.ArrayList(); ++ Random rand = world instanceof World ? ((World)world).rand : new Random(); ++ int chance = this.getSaplingDropChance(state); ++ ++ if (fortune > 0) ++ { ++ chance -= 2 << fortune; ++ if (chance < 10) chance = 10; ++ } ++ ++ if (rand.nextInt(chance) == 0) ++ ret.add(new ItemStack(getItemDropped(state, rand, fortune), 1, damageDropped(state))); ++ ++ chance = 200; ++ if (fortune > 0) ++ { ++ chance -= 10 << fortune; ++ if (chance < 40) chance = 40; ++ } ++ ++ this.captureDrops(true); ++ if (world instanceof World) ++ this.dropApple((World)world, pos, state, chance); // Dammet mojang ++ ret.addAll(this.captureDrops(false)); ++ return ret; ++ } ++ + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLever.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLever.java.patch new file mode 100644 index 000000000..3742cca4c --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockLever.java.patch @@ -0,0 +1,67 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockLever.java ++++ ../src-work/minecraft/net/minecraft/block/BlockLever.java +@@ -47,24 +47,24 @@ + + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + { +- return side == EnumFacing.UP && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) ? true : this.canSustainLever(worldIn, pos.offset(side.getOpposite())); ++ return side == EnumFacing.UP && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) ? true : worldIn.isSideSolid(pos.offset(side.getOpposite()), side); + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return this.canSustainLever(worldIn, pos.west()) ? true : (this.canSustainLever(worldIn, pos.east()) ? true : (this.canSustainLever(worldIn, pos.north()) ? true : (this.canSustainLever(worldIn, pos.south()) ? true : (World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) ? true : this.canSustainLever(worldIn, pos.up()))))); ++ return worldIn.isSideSolid(pos.west(), EnumFacing.EAST ) || ++ worldIn.isSideSolid(pos.east(), EnumFacing.WEST ) || ++ worldIn.isSideSolid(pos.north(), EnumFacing.SOUTH) || ++ worldIn.isSideSolid(pos.south(), EnumFacing.NORTH) || ++ worldIn.isSideSolid(pos.down(), EnumFacing.UP ) || ++ worldIn.isSideSolid(pos.up(), EnumFacing.DOWN ); + } + +- protected boolean canSustainLever(World worldIn, BlockPos pos) +- { +- return worldIn.getBlockState(pos).getBlock().isNormalCube(); +- } +- + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + IBlockState iblockstate = this.getDefaultState().withProperty(POWERED, Boolean.valueOf(false)); + +- if (this.canSustainLever(worldIn, pos.offset(facing.getOpposite()))) ++ if (worldIn.isSideSolid(pos.offset(facing.getOpposite()), facing)) + { + return iblockstate.withProperty(FACING, BlockLever.EnumOrientation.forFacings(facing, placer.getHorizontalFacing())); + } +@@ -87,7 +87,7 @@ + + enumfacing1 = (EnumFacing)iterator.next(); + } +- while (enumfacing1 == facing || !this.canSustainLever(worldIn, pos.offset(enumfacing1.getOpposite()))); ++ while (enumfacing1 == facing || !worldIn.isSideSolid(pos.offset(enumfacing1.getOpposite()), enumfacing1)); + + return iblockstate.withProperty(FACING, BlockLever.EnumOrientation.forFacings(enumfacing1, placer.getHorizontalFacing())); + } +@@ -116,7 +116,8 @@ + + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { +- if (this.checkForDrop(worldIn, pos) && !this.canSustainLever(worldIn, pos.offset(((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing().getOpposite()))) ++ EnumFacing dir = ((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing(); ++ if (this.checkForDrop(worldIn, pos) && !worldIn.isSideSolid(pos.offset(dir.getOpposite()), dir)) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); +@@ -235,6 +236,12 @@ + return new BlockState(this, new IProperty[] {FACING, POWERED}); + } + ++ ++ private boolean canAttach(World world, BlockPos pos, EnumFacing side) ++ { ++ return world.isSideSolid(pos, side); ++ } ++ + public static enum EnumOrientation implements IStringSerializable + { + DOWN_X(0, "down_x", EnumFacing.DOWN), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch new file mode 100644 index 000000000..2690041c2 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch @@ -0,0 +1,24 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockLog.java ++++ ../src-work/minecraft/net/minecraft/block/BlockLog.java +@@ -38,9 +38,9 @@ + BlockPos blockpos1 = (BlockPos)iterator.next(); + IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); + +- if (iblockstate1.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate1.getValue(BlockLeaves.CHECK_DECAY)).booleanValue()) ++ if (iblockstate1.getBlock().isLeaves(worldIn, blockpos1)) + { +- worldIn.setBlockState(blockpos1, iblockstate1.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(true)), 4); ++ iblockstate1.getBlock().beginLeavesDecay(worldIn, blockpos1); + } + } + } +@@ -51,6 +51,9 @@ + return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(LOG_AXIS, BlockLog.EnumAxis.fromFacingAxis(facing.getAxis())); + } + ++ @Override public boolean canSustainLeaves(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } ++ @Override public boolean isWood(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } ++ + public static enum EnumAxis implements IStringSerializable + { + X("x"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch new file mode 100644 index 000000000..29a5e234a --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockMobSpawner.java ++++ ../src-work/minecraft/net/minecraft/block/BlockMobSpawner.java +@@ -39,10 +39,14 @@ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); +- int j = 15 + worldIn.rand.nextInt(15) + worldIn.rand.nextInt(15); +- this.dropXpOnBlockBreak(worldIn, pos, j); + } + ++ @Override ++ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15); ++ } ++ + public boolean isOpaqueCube() + { + return false; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch new file mode 100644 index 000000000..be26c64c3 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java ++++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java +@@ -76,7 +76,7 @@ + if (pos.getY() >= 0 && pos.getY() < 256) + { + IBlockState iblockstate1 = worldIn.getBlockState(pos.down()); +- return iblockstate1.getBlock() == Blocks.mycelium ? true : (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.canPlaceBlockOn(iblockstate1.getBlock())); ++ return iblockstate1.getBlock() == Blocks.mycelium ? true : (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && iblockstate1.getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this)); + } + else + { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch new file mode 100644 index 000000000..554a24123 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockMycelium.java ++++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java +@@ -39,7 +39,7 @@ + { + if (!worldIn.isRemote) + { +- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2) ++ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity(worldIn, pos.up()) > 2) + { + worldIn.setBlockState(pos, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); + } +@@ -53,7 +53,7 @@ + IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); + Block block = worldIn.getBlockState(blockpos1.up()).getBlock(); + +- if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity() <= 2) ++ if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity(worldIn, blockpos1.up()) <= 2) + { + worldIn.setBlockState(blockpos1, this.getDefaultState()); + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch new file mode 100644 index 000000000..e46eedd1b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch @@ -0,0 +1,49 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java ++++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java +@@ -36,7 +36,7 @@ + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { +- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ return super.canBlockStay(worldIn, pos, state); + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) +@@ -52,9 +52,11 @@ + super.updateTick(worldIn, pos, state, rand); + } + ++ @SuppressWarnings("unused") + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { +- if (!worldIn.isRemote) ++ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); ++ if (false && !worldIn.isRemote) + { + int j = 1; + +@@ -105,4 +107,24 @@ + { + return new BlockState(this, new IProperty[] {AGE}); + } ++ ++ @Override ++ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List ret = new java.util.ArrayList(); ++ Random rand = world instanceof World ? ((World)world).rand : new Random(); ++ int count = 1; ++ ++ if (((Integer)state.getValue(AGE)) >= 3) ++ { ++ count = 2 + rand.nextInt(3) + (fortune > 0 ? rand.nextInt(fortune + 1) : 0); ++ } ++ ++ for (int i = 0; i < count; i++) ++ { ++ ret.add(new ItemStack(Items.nether_wart)); ++ } ++ ++ return ret; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch new file mode 100644 index 000000000..906f299da --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch @@ -0,0 +1,24 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockNewLeaf.java ++++ ../src-work/minecraft/net/minecraft/block/BlockNewLeaf.java +@@ -105,14 +105,15 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4)); +- } +- else +- { + super.harvestBlock(worldIn, player, pos, state, te); + } + } ++ ++ @Override ++ public List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ IBlockState state = world.getBlockState(pos); ++ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4))); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockNote.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockNote.java.patch new file mode 100644 index 000000000..2ce222a73 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockNote.java.patch @@ -0,0 +1,23 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockNote.java ++++ ../src-work/minecraft/net/minecraft/block/BlockNote.java +@@ -58,7 +58,9 @@ + if (tileentity instanceof TileEntityNote) + { + TileEntityNote tileentitynote = (TileEntityNote)tileentity; ++ int old = tileentitynote.note; + tileentitynote.changePitch(); ++ if (old == tileentitynote.note) return false; + tileentitynote.triggerNote(worldIn, pos); + } + +@@ -96,6 +98,10 @@ + + public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam) + { ++ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(worldIn, pos, state, eventParam, eventID); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e)) return false; ++ eventID = e.instrument.ordinal(); ++ eventParam = e.getVanillaNoteId(); + float f = (float)Math.pow(2.0D, (double)(eventParam - 12) / 12.0D); + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "note." + this.getInstrument(eventID), 3.0F, f); + worldIn.spawnParticle(EnumParticleTypes.NOTE, (double)pos.getX() + 0.5D, (double)pos.getY() + 1.2D, (double)pos.getZ() + 0.5D, (double)eventParam / 24.0D, 0.0D, 0.0D, new int[0]); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch new file mode 100644 index 000000000..15acd8235 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch @@ -0,0 +1,21 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockOldLeaf.java ++++ ../src-work/minecraft/net/minecraft/block/BlockOldLeaf.java +@@ -148,11 +148,17 @@ + if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata())); + } + else + { + super.harvestBlock(worldIn, player, pos, state, te); + } + } ++ ++ @Override ++ public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) ++ { ++ IBlockState state = world.getBlockState(pos); ++ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata()))); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch new file mode 100644 index 000000000..178e59206 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch @@ -0,0 +1,59 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockOre.java ++++ ../src-work/minecraft/net/minecraft/block/BlockOre.java +@@ -10,6 +10,7 @@ + import net.minecraft.item.Item; + import net.minecraft.util.BlockPos; + import net.minecraft.util.MathHelper; ++import net.minecraft.world.IBlockAccess; + import net.minecraft.world.World; + + public class BlockOre extends Block +@@ -54,34 +55,40 @@ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); +- +- if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this)) ++ } ++ @Override ++ public int getExpDrop(IBlockAccess world, BlockPos pos, int fortune) ++ { ++ IBlockState state = world.getBlockState(pos); ++ Random rand = world instanceof World ? ((World)world).rand : new Random(); ++ if (this.getItemDropped(state, rand, fortune) != Item.getItemFromBlock(this)) + { + int j = 0; + + if (this == Blocks.coal_ore) + { +- j = MathHelper.getRandomIntegerInRange(worldIn.rand, 0, 2); ++ j = MathHelper.getRandomIntegerInRange(rand, 0, 2); + } + else if (this == Blocks.diamond_ore) + { +- j = MathHelper.getRandomIntegerInRange(worldIn.rand, 3, 7); ++ j = MathHelper.getRandomIntegerInRange(rand, 3, 7); + } + else if (this == Blocks.emerald_ore) + { +- j = MathHelper.getRandomIntegerInRange(worldIn.rand, 3, 7); ++ j = MathHelper.getRandomIntegerInRange(rand, 3, 7); + } + else if (this == Blocks.lapis_ore) + { +- j = MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); ++ j = MathHelper.getRandomIntegerInRange(rand, 2, 5); + } + else if (this == Blocks.quartz_ore) + { +- j = MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); ++ j = MathHelper.getRandomIntegerInRange(rand, 2, 5); + } + +- this.dropXpOnBlockBreak(worldIn, pos, j); ++ return j; + } ++ return 0; + } + + public int getDamageValue(World worldIn, BlockPos pos) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch new file mode 100644 index 000000000..bb91fe6ca --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch @@ -0,0 +1,41 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockPane.java ++++ ../src-work/minecraft/net/minecraft/block/BlockPane.java +@@ -39,7 +39,10 @@ + + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { +- return state.withProperty(NORTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.north()).getBlock()))).withProperty(SOUTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.south()).getBlock()))).withProperty(WEST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.west()).getBlock()))).withProperty(EAST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.east()).getBlock()))); ++ return state.withProperty(NORTH, canPaneConnectTo(worldIn, pos, EnumFacing.NORTH)) ++ .withProperty(SOUTH, canPaneConnectTo(worldIn, pos, EnumFacing.SOUTH)) ++ .withProperty(WEST, canPaneConnectTo(worldIn, pos, EnumFacing.WEST)) ++ .withProperty(EAST, canPaneConnectTo(worldIn, pos, EnumFacing.EAST)); + } + + public Item getItemDropped(IBlockState state, Random rand, int fortune) +@@ -65,10 +68,10 @@ + + public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) + { +- boolean flag = this.canPaneConnectToBlock(worldIn.getBlockState(pos.north()).getBlock()); +- boolean flag1 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.south()).getBlock()); +- boolean flag2 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.west()).getBlock()); +- boolean flag3 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.east()).getBlock()); ++ boolean flag = this.canPaneConnectTo(worldIn, pos, EnumFacing.NORTH); ++ boolean flag1 = this.canPaneConnectTo(worldIn, pos, EnumFacing.SOUTH); ++ boolean flag2 = this.canPaneConnectTo(worldIn, pos, EnumFacing.WEST); ++ boolean flag3 = this.canPaneConnectTo(worldIn, pos, EnumFacing.EAST); + + if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) + { +@@ -187,4 +190,11 @@ + { + return new BlockState(this, new IProperty[] {NORTH, EAST, WEST, SOUTH}); + } ++ ++ public boolean canPaneConnectTo(IBlockAccess world, BlockPos pos, EnumFacing dir) ++ { ++ BlockPos off = pos.offset(dir); ++ Block block = world.getBlockState(off).getBlock(); ++ return canPaneConnectToBlock(block) || block.isSideSolid(world, off, dir.getOpposite()); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch new file mode 100644 index 000000000..669fa4fd5 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java ++++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java +@@ -200,7 +200,7 @@ + } + } + +- if (!flag1 && block.getMaterial() != Material.air && canPush(block, worldIn, blockpos1, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) ++ if (!flag1 && !block.isAir(worldIn, blockpos1) && canPush(block, worldIn, blockpos1, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) + { + this.doMove(worldIn, pos, enumfacing, false); + } +@@ -344,7 +344,7 @@ + return false; + } + +- return !(blockIn instanceof ITileEntityProvider); ++ return !(blockIn.hasTileEntity(worldIn.getBlockState(pos))); + } + else + { +@@ -384,7 +384,9 @@ + { + blockpos1 = (BlockPos)list1.get(j); + Block block = worldIn.getBlockState(blockpos1).getBlock(); +- block.dropBlockAsItem(worldIn, blockpos1, worldIn.getBlockState(blockpos1), 0); ++ //With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. ++ float chance = block instanceof BlockSnow ? -1.0f : 1.0f; ++ block.dropBlockAsItemWithChance(worldIn, blockpos1, worldIn.getBlockState(blockpos1), chance, 0); + worldIn.setBlockToAir(blockpos1); + --i; + ablock[i] = block; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch new file mode 100644 index 000000000..0121d2a6e --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch @@ -0,0 +1,37 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockPistonMoving.java ++++ ../src-work/minecraft/net/minecraft/block/BlockPistonMoving.java +@@ -110,16 +110,7 @@ + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { +- if (!worldIn.isRemote) +- { +- TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos); +- +- if (tileentitypiston != null) +- { +- IBlockState iblockstate1 = tileentitypiston.getPistonState(); +- iblockstate1.getBlock().dropBlockAsItem(worldIn, pos, iblockstate1, 0); +- } +- } ++ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + } + + public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) +@@ -283,4 +274,16 @@ + { + return new BlockState(this, new IProperty[] {FACING, TYPE}); + } ++ ++ @Override ++ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ TileEntityPiston tileentitypiston = this.getTileEntity(world, pos); ++ if (tileentitypiston != null) ++ { ++ IBlockState pushed = tileentitypiston.getPistonState(); ++ return pushed.getBlock().getDrops(world, pos, pushed, fortune); ++ } ++ return new java.util.ArrayList(); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch new file mode 100644 index 000000000..afe064e2b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch @@ -0,0 +1,25 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockPotato.java ++++ ../src-work/minecraft/net/minecraft/block/BlockPotato.java +@@ -24,13 +24,14 @@ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); +- +- if (!worldIn.isRemote) +- { +- if (((Integer)state.getValue(AGE)).intValue() >= 7 && worldIn.rand.nextInt(50) == 0) +- { +- spawnAsEntity(worldIn, pos, new ItemStack(Items.poisonous_potato)); +- } +- } + } ++ @Override ++ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List ret = super.getDrops(world, pos, state, fortune); ++ java.util.Random rand = world instanceof World ? ((World)world).rand : new java.util.Random(); ++ if (((Integer)state.getValue(AGE)) >= 7 && rand.nextInt(50) == 0) ++ ret.add(new ItemStack(Items.poisonous_potato)); ++ return ret; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch new file mode 100644 index 000000000..898ac8e07 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockPumpkin.java ++++ ../src-work/minecraft/net/minecraft/block/BlockPumpkin.java +@@ -109,7 +109,7 @@ + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable() && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); ++ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); + } + + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) diff --git a/patches/minecraft/net/minecraft/block/BlockQuartz.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch similarity index 63% rename from patches/minecraft/net/minecraft/block/BlockQuartz.java.patch rename to patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch index 6a6a75d2a..7c75b6cdc 100644 --- a/patches/minecraft/net/minecraft/block/BlockQuartz.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch @@ -1,23 +1,23 @@ --- ../src-base/minecraft/net/minecraft/block/BlockQuartz.java +++ ../src-work/minecraft/net/minecraft/block/BlockQuartz.java @@ -91,6 +91,26 @@ - return new BlockState(this, new IProperty[] {field_176335_a}); + return new BlockState(this, new IProperty[] {VARIANT}); } + public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) + { -+ IBlockState state = world.func_180495_p(pos); -+ for (IProperty prop : (java.util.Set)state.func_177228_b().keySet()) ++ IBlockState state = world.getBlockState(pos); ++ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) + { -+ if (prop.func_177701_a().equals("variant") && prop.func_177699_b() == EnumType.class) ++ if (prop.getName().equals("variant") && prop.getValueClass() == EnumType.class) + { -+ EnumType current = (EnumType)state.func_177229_b(prop); ++ EnumType current = (EnumType)state.getValue(prop); + EnumType next = current == EnumType.LINES_X ? EnumType.LINES_Y : + current == EnumType.LINES_Y ? EnumType.LINES_Z : + current == EnumType.LINES_Z ? EnumType.LINES_X : current; + if (next == current) + return false; -+ world.func_175656_a(pos, state.func_177226_a(prop, next)); ++ world.setBlockState(pos, state.withProperty(prop, next)); + return true; + } + } diff --git a/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch similarity index 72% rename from patches/minecraft/net/minecraft/block/BlockRailBase.java.patch rename to patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch index 8c3b15468..46e1f211c 100644 --- a/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch @@ -1,18 +1,18 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRailBase.java +++ ../src-work/minecraft/net/minecraft/block/BlockRailBase.java @@ -33,7 +33,7 @@ - public static boolean func_176563_d(IBlockState p_176563_0_) + public static boolean isRailBlock(IBlockState state) { - Block block = p_176563_0_.func_177230_c(); -- return block == Blocks.field_150448_aq || block == Blocks.field_150318_D || block == Blocks.field_150319_E || block == Blocks.field_150408_cc; + Block block = state.getBlock(); +- return block == Blocks.rail || block == Blocks.golden_rail || block == Blocks.detector_rail || block == Blocks.activator_rail; + return block instanceof BlockRailBase; } - protected BlockRailBase(boolean p_i45389_1_) + protected BlockRailBase(boolean isPowered) @@ -174,7 +174,81 @@ } - public abstract IProperty func_176560_l(); + public abstract IProperty getShapeProperty(); + /* ======================================== FORGE START =====================================*/ + /** + * Return true if the rail can make corners. @@ -23,7 +23,7 @@ + */ + public boolean isFlexibleRail(IBlockAccess world, BlockPos pos) + { -+ return !this.field_150053_a; ++ return !this.isPowered; + } + /** @@ -74,12 +74,12 @@ + */ + public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) + { -+ IBlockState state = world.func_180495_p(pos); -+ for (IProperty prop : (java.util.Set)state.func_177228_b().keySet()) ++ IBlockState state = world.getBlockState(pos); ++ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) + { -+ if (prop.func_177701_a().equals("shape")) ++ if (prop.getName().equals("shape")) + { -+ world.func_175656_a(pos, state.func_177231_a(prop)); ++ world.setBlockState(pos, state.cycleProperty(prop)); + return true; + } + } @@ -92,20 +92,20 @@ { NORTH_SOUTH(0, "north_south"), @@ -251,6 +325,7 @@ - private final boolean field_150656_f; + private final boolean isPowered; private final List field_150657_g = Lists.newArrayList(); private static final String __OBFID = "CL_00000196"; + private final boolean canMakeSlopes; - public Rail(World p_i45739_2_, BlockPos p_i45739_3_, IBlockState p_i45739_4_) + public Rail(World worldIn, BlockPos pos, IBlockState state) { @@ -259,7 +334,8 @@ - this.field_180366_e = p_i45739_4_; - this.field_180365_d = (BlockRailBase)p_i45739_4_.func_177230_c(); - BlockRailBase.EnumRailDirection enumraildirection = (BlockRailBase.EnumRailDirection)p_i45739_4_.func_177229_b(BlockRailBase.this.func_176560_l()); -- this.field_150656_f = this.field_180365_d.field_150053_a; -+ this.field_150656_f = !this.field_180365_d.isFlexibleRail(p_i45739_2_, p_i45739_3_); -+ canMakeSlopes = this.field_180365_d.canMakeSlopes(p_i45739_2_, p_i45739_3_); + this.state = state; + this.block = (BlockRailBase)state.getBlock(); + BlockRailBase.EnumRailDirection enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(BlockRailBase.this.getShapeProperty()); +- this.isPowered = this.block.isPowered; ++ this.isPowered = !this.block.isFlexibleRail(worldIn, pos); ++ canMakeSlopes = this.block.canMakeSlopes(worldIn, pos); this.func_180360_a(enumraildirection); } @@ -116,7 +116,7 @@ - if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) + if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) { - if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos.func_177984_a())) + if (BlockRailBase.isRailBlock(this.world, blockpos.up())) { @@ -461,7 +537,7 @@ } @@ -125,7 +125,7 @@ - if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) + if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) { - if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos3.func_177984_a())) + if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) { @@ -604,7 +680,7 @@ } @@ -134,7 +134,7 @@ - if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) + if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) { - if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos.func_177984_a())) + if (BlockRailBase.isRailBlock(this.world, blockpos.up())) { @@ -617,7 +693,7 @@ } @@ -143,5 +143,5 @@ - if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) + if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) { - if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos3.func_177984_a())) + if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) { diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch similarity index 54% rename from patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch rename to patches.mcp/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch index 1ad9b4abf..6799d4271 100644 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRedstoneComparator.java +++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneComparator.java @@ -295,6 +295,21 @@ - return this.func_176223_P().func_177226_a(field_176387_N, p_180642_8_.func_174811_aO().func_176734_d()).func_177226_a(field_176464_a, Boolean.valueOf(false)).func_177226_a(field_176463_b, BlockRedstoneComparator.Mode.COMPARE); + return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(POWERED, Boolean.valueOf(false)).withProperty(MODE, BlockRedstoneComparator.Mode.COMPARE); } + @Override + public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) + { -+ if (pos.func_177956_o() == neighbor.func_177956_o() && world instanceof World) ++ if (pos.getY() == neighbor.getY() && world instanceof World) + { -+ func_176204_a((World)world, pos, world.func_180495_p(pos), world.func_180495_p(neighbor).func_177230_c()); ++ onNeighborBlockChange((World)world, pos, world.getBlockState(pos), world.getBlockState(neighbor).getBlock()); + } + } + diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch new file mode 100644 index 000000000..e98007889 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneDiode.java ++++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneDiode.java +@@ -200,6 +200,8 @@ + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + BlockPos blockpos1 = pos.offset(enumfacing.getOpposite()); ++ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldIn, pos, worldIn.getBlockState(pos), java.util.EnumSet.of(enumfacing.getOpposite())).isCanceled()) ++ return; + worldIn.notifyBlockOfStateChange(blockpos1, this); + worldIn.notifyNeighborsOfStateExcept(blockpos1, this, enumfacing); + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch new file mode 100644 index 000000000..df5eb2d3f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneOre.java ++++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneOre.java +@@ -92,12 +92,16 @@ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); ++ } + +- if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this)) ++ @Override ++ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ if (this.getItemDropped(world.getBlockState(pos), RANDOM, fortune) != Item.getItemFromBlock(this)) + { +- int j = 1 + worldIn.rand.nextInt(5); +- this.dropXpOnBlockBreak(worldIn, pos, j); ++ return 1 + RANDOM.nextInt(5); + } ++ return 0; + } + + @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch new file mode 100644 index 000000000..520e8486e --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch @@ -0,0 +1,59 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java ++++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java +@@ -60,10 +60,10 @@ + BlockPos blockpos1 = pos.offset(direction); + Block block = worldIn.getBlockState(pos.offset(direction)).getBlock(); + +- if (!canConnectTo(worldIn.getBlockState(blockpos1), direction) && (block.isSolidFullCube() || !canConnectUpwardsTo(worldIn.getBlockState(blockpos1.down())))) ++ if (!canRestoneConnect(worldIn, blockpos1, direction) && (block.isSolidFullCube() || !canRestoneConnect(worldIn, blockpos1.down(), null))) + { + Block block1 = worldIn.getBlockState(pos.up()).getBlock(); +- return !block1.isSolidFullCube() && block.isSolidFullCube() && canConnectUpwardsTo(worldIn.getBlockState(blockpos1.up())) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; ++ return !block1.isSolidFullCube() && block.isSolidFullCube() && canRestoneConnect(worldIn, blockpos1.up(), null) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; + } + else + { +@@ -393,35 +393,25 @@ + Block block = iblockstate.getBlock(); + boolean flag = block.isNormalCube(); + boolean flag1 = worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); +- return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos1.up()) ? true : (canConnectTo(iblockstate, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos1.down()))); ++ return !flag1 && flag && canRestoneConnect(worldIn, blockpos1.up(), null) ? true : (canRestoneConnect(worldIn, blockpos1, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canRestoneConnect(worldIn, blockpos1.down(), null))); + } + +- protected static boolean canConnectUpwardsTo(IBlockAccess worldIn, BlockPos pos) ++ protected static boolean canRestoneConnect(IBlockAccess world, BlockPos pos, EnumFacing side) + { +- return canConnectUpwardsTo(worldIn.getBlockState(pos)); +- } ++ IBlockState state = world.getBlockState(pos); + +- protected static boolean canConnectUpwardsTo(IBlockState state) +- { +- return canConnectTo(state, (EnumFacing)null); +- } +- +- protected static boolean canConnectTo(IBlockState blockState, EnumFacing side) +- { +- Block block = blockState.getBlock(); +- +- if (block == Blocks.redstone_wire) ++ if (state.getBlock() == Blocks.redstone_wire) + { + return true; + } +- else if (Blocks.unpowered_repeater.isAssociated(block)) ++ else if (Blocks.unpowered_repeater.isAssociated(state.getBlock())) + { +- EnumFacing enumfacing1 = (EnumFacing)blockState.getValue(BlockRedstoneRepeater.FACING); +- return enumfacing1 == side || enumfacing1.getOpposite() == side; ++ EnumFacing direction = (EnumFacing)state.getValue(BlockRedstoneRepeater.FACING); ++ return direction == side || direction.getOpposite() == side; + } + else + { +- return block.canProvidePower() && side != null; ++ return state.getBlock().canConnectRedstone(world, pos, side); + } + } + diff --git a/patches/minecraft/net/minecraft/block/BlockReed.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch similarity index 62% rename from patches/minecraft/net/minecraft/block/BlockReed.java.patch rename to patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch index ed23377c2..a117b9404 100644 --- a/patches/minecraft/net/minecraft/block/BlockReed.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch @@ -7,19 +7,19 @@ -public class BlockReed extends Block +public class BlockReed extends Block implements net.minecraftforge.common.IPlantable { - public static final PropertyInteger field_176355_a = PropertyInteger.func_177719_a("age", 0, 15); + public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15); private static final String __OBFID = "CL_00000300"; @@ -67,6 +67,7 @@ - public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { - Block block = p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_177230_c(); -+ if (block.canSustainPlant(p_176196_1_, p_176196_2_.func_177977_b(), EnumFacing.UP, this)) return true; + Block block = worldIn.getBlockState(pos.down()).getBlock(); ++ if (block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this)) return true; if (block == this) { @@ -172,4 +173,15 @@ { - return new BlockState(this, new IProperty[] {field_176355_a}); + return new BlockState(this, new IProperty[] {AGE}); } + + @Override @@ -30,6 +30,6 @@ + @Override + public IBlockState getPlant(IBlockAccess world, BlockPos pos) + { -+ return this.func_176223_P(); ++ return this.getDefaultState(); + } } diff --git a/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch similarity index 72% rename from patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch rename to patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch index dd9715ed0..2fdba40cd 100644 --- a/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch @@ -10,17 +10,17 @@ public abstract class BlockRotatedPillar extends Block @@ -13,4 +14,18 @@ { - super(p_i45425_1_); + super(materialIn); } + + public boolean rotateBlock(net.minecraft.world.World world, net.minecraft.util.BlockPos pos, EnumFacing axis) + { -+ IBlockState state = world.func_180495_p(pos); -+ for (net.minecraft.block.properties.IProperty prop : (java.util.Set)state.func_177228_b().keySet()) ++ IBlockState state = world.getBlockState(pos); ++ for (net.minecraft.block.properties.IProperty prop : (java.util.Set)state.getProperties().keySet()) + { -+ if (prop.func_177701_a().equals("axis")) ++ if (prop.getName().equals("axis")) + { -+ world.func_175656_a(pos, state.func_177231_a(prop)); ++ world.setBlockState(pos, state.cycleProperty(prop)); + return true; + } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSapling.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSapling.java.patch new file mode 100644 index 000000000..e061b2ac1 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockSapling.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockSapling.java ++++ ../src-work/minecraft/net/minecraft/block/BlockSapling.java +@@ -66,6 +66,7 @@ + + public void generateTree(World worldIn, BlockPos pos, IBlockState state, Random rand) + { ++ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(worldIn, rand, pos)) return; + Object object = rand.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true); + int i = 0; + int j = 0; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch new file mode 100644 index 000000000..5841ef52d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch @@ -0,0 +1,55 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockSkull.java ++++ ../src-work/minecraft/net/minecraft/block/BlockSkull.java +@@ -122,8 +122,6 @@ + return tileentity instanceof TileEntitySkull ? ((TileEntitySkull)tileentity).getSkullType() : super.getDamageValue(worldIn, pos); + } + +- public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) {} +- + public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) + { + if (player.capabilities.isCreativeMode) +@@ -131,13 +129,18 @@ + state = state.withProperty(NODROP, Boolean.valueOf(true)); + worldIn.setBlockState(pos, state, 4); + } ++ this.dropBlockAsItem(worldIn, pos, state, 0); + + super.onBlockHarvested(worldIn, pos, state, player); + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { +- if (!worldIn.isRemote) ++ super.breakBlock(worldIn, pos, state); ++ } ++ public java.util.List getDrops(IBlockAccess worldIn, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List ret = new java.util.ArrayList(); + { + if (!((Boolean)state.getValue(NODROP)).booleanValue()) + { +@@ -146,7 +149,7 @@ + if (tileentity instanceof TileEntitySkull) + { + TileEntitySkull tileentityskull = (TileEntitySkull)tileentity; +- ItemStack itemstack = new ItemStack(Items.skull, 1, this.getDamageValue(worldIn, pos)); ++ ItemStack itemstack = new ItemStack(Items.skull, 1, tileentityskull.getSkullType()); + + if (tileentityskull.getSkullType() == 3 && tileentityskull.getPlayerProfile() != null) + { +@@ -156,12 +159,11 @@ + itemstack.getTagCompound().setTag("SkullOwner", nbttagcompound); + } + +- spawnAsEntity(worldIn, pos, itemstack); ++ ret.add(itemstack); + } + } +- +- super.breakBlock(worldIn, pos, state); + } ++ return ret; + } + + public Item getItemDropped(IBlockState state, Random rand, int fortune) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch new file mode 100644 index 000000000..1ca183c63 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch @@ -0,0 +1,53 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockSnow.java ++++ ../src-work/minecraft/net/minecraft/block/BlockSnow.java +@@ -80,7 +80,7 @@ + { + IBlockState iblockstate = worldIn.getBlockState(pos.down()); + Block block = iblockstate.getBlock(); +- return block != Blocks.ice && block != Blocks.packed_ice ? (block.getMaterial() == Material.leaves ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() == 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; ++ return block != Blocks.ice && block != Blocks.packed_ice ? (block.isLeaves(worldIn, pos.down()) ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() == 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; + } + + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) +@@ -92,7 +92,6 @@ + { + if (!this.canPlaceBlockAt(worldIn, p_176314_2_)) + { +- this.dropBlockAsItem(worldIn, p_176314_2_, p_176314_3_, 0); + worldIn.setBlockToAir(p_176314_2_); + return false; + } +@@ -104,9 +103,8 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- spawnAsEntity(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1, 0)); ++ super.harvestBlock(worldIn, player, pos, state, te); + worldIn.setBlockToAir(pos); +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); + } + + public Item getItemDropped(IBlockState state, Random rand, int fortune) +@@ -116,14 +114,13 @@ + + public int quantityDropped(Random random) + { +- return 0; ++ return 1; + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (worldIn.getLightFor(EnumSkyBlock.BLOCK, pos) > 11) + { +- this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0); + worldIn.setBlockToAir(pos); + } + } +@@ -153,4 +150,6 @@ + { + return new BlockState(this, new IProperty[] {LAYERS}); + } ++ ++ @Override public int quantityDropped(IBlockState state, int fortune, Random random){ return ((Integer)state.getValue(LAYERS)) + 1; } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch new file mode 100644 index 000000000..f00f753b8 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch @@ -0,0 +1,42 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockStem.java ++++ ../src-work/minecraft/net/minecraft/block/BlockStem.java +@@ -108,7 +108,7 @@ + pos = pos.offset(EnumFacing.Plane.HORIZONTAL.random(rand)); + Block block = worldIn.getBlockState(pos.down()).getBlock(); + +- if (worldIn.getBlockState(pos).getBlock().blockMaterial == Material.air && (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass)) ++ if (worldIn.isAirBlock(pos) && (block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this) || block == Blocks.dirt || block == Blocks.grass)) + { + worldIn.setBlockState(pos, this.crop.getDefaultState()); + } +@@ -162,8 +162,12 @@ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); ++ } + +- if (!worldIn.isRemote) ++ @Override ++ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List ret = new java.util.ArrayList(); + { + Item item = this.getSeedItem(); + +@@ -173,13 +177,14 @@ + + for (int k = 0; k < 3; ++k) + { +- if (worldIn.rand.nextInt(15) <= j) ++ if (RANDOM.nextInt(15) <= j) + { +- spawnAsEntity(worldIn, pos, new ItemStack(item)); ++ ret.add(new ItemStack(item)); + } + } + } + } ++ return ret; + } + + protected Item getSeedItem() diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch new file mode 100644 index 000000000..cba499e8f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch @@ -0,0 +1,66 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockTallGrass.java ++++ ../src-work/minecraft/net/minecraft/block/BlockTallGrass.java +@@ -23,7 +23,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public class BlockTallGrass extends BlockBush implements IGrowable ++public class BlockTallGrass extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable + { + public static final PropertyEnum TYPE = PropertyEnum.create("type", BlockTallGrass.EnumType.class); + private static final String __OBFID = "CL_00000321"; +@@ -44,7 +44,7 @@ + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { +- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ return super.canBlockStay(worldIn, pos, state); + } + + public boolean isReplaceable(World worldIn, BlockPos pos) +@@ -74,7 +74,7 @@ + + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { +- return rand.nextInt(8) == 0 ? Items.wheat_seeds : null; ++ return null; + } + + public int quantityDroppedWithBonus(int fortune, Random random) +@@ -84,13 +84,7 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)state.getValue(TYPE)).getMeta())); +- } +- else +- { + super.harvestBlock(worldIn, player, pos, state, te); + } + } +@@ -210,4 +204,22 @@ + } + } + } ++ ++ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } ++ @Override ++ public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) ++ { ++ List ret = new java.util.ArrayList(); ++ ret.add(new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)world.getBlockState(pos).getValue(TYPE)).getMeta())); ++ return ret; ++ } ++ @Override ++ public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ List ret = new java.util.ArrayList(); ++ if (RANDOM.nextInt(8) != 0) return ret; ++ ItemStack seed = net.minecraftforge.common.ForgeHooks.getGrassSeed(RANDOM); ++ if (seed != null) ret.add(seed); ++ return ret; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch new file mode 100644 index 000000000..059911a36 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch @@ -0,0 +1,38 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockTorch.java ++++ ../src-work/minecraft/net/minecraft/block/BlockTorch.java +@@ -70,7 +70,7 @@ + else + { + Block block = worldIn.getBlockState(pos).getBlock(); +- return block instanceof BlockFence || block == Blocks.glass || block == Blocks.cobblestone_wall || block == Blocks.stained_glass; ++ return block.canPlaceTorchOnTop(worldIn, pos); + } + } + +@@ -97,7 +97,7 @@ + { + BlockPos blockpos1 = pos.offset(facing.getOpposite()); + boolean flag = facing.getAxis().isHorizontal(); +- return flag && worldIn.isBlockNormalCube(blockpos1, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos1); ++ return flag && worldIn.isSideSolid(blockpos1, facing, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos1); + } + + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) +@@ -120,7 +120,7 @@ + + enumfacing1 = (EnumFacing)iterator.next(); + } +- while (!worldIn.isBlockNormalCube(pos.offset(enumfacing1.getOpposite()), true)); ++ while (!worldIn.isSideSolid(pos.offset(enumfacing1.getOpposite()), enumfacing1, true)); + + return this.getDefaultState().withProperty(FACING, enumfacing1); + } +@@ -149,7 +149,7 @@ + EnumFacing enumfacing1 = enumfacing.getOpposite(); + boolean flag = false; + +- if (axis.isHorizontal() && !worldIn.isBlockNormalCube(pos.offset(enumfacing1), true)) ++ if (axis.isHorizontal() && !worldIn.isSideSolid(pos.offset(enumfacing1), enumfacing1, true)) + { + flag = true; + } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch new file mode 100644 index 000000000..d73a8a1e7 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch @@ -0,0 +1,43 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockTrapDoor.java ++++ ../src-work/minecraft/net/minecraft/block/BlockTrapDoor.java +@@ -25,6 +25,8 @@ + + public class BlockTrapDoor extends Block + { ++ /** Set this to allow trapdoors to remain free-floating */ ++ public static boolean disableValidation = false; + public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); + public static final PropertyBool OPEN = PropertyBool.create("open"); + public static final PropertyEnum HALF = PropertyEnum.create("half", BlockTrapDoor.DoorHalf.class); +@@ -141,9 +143,10 @@ + { + if (!worldIn.isRemote) + { ++ EnumFacing direction = (EnumFacing)state.getValue(FACING); + BlockPos blockpos1 = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite()); + +- if (!isValidSupportBlock(worldIn.getBlockState(blockpos1).getBlock())) ++ if (!(isValidSupportBlock(worldIn.getBlockState(blockpos1).getBlock()) || worldIn.isSideSolid(blockpos1, direction, true))) + { + worldIn.setBlockToAir(pos); + this.dropBlockAsItem(worldIn, pos, state, 0); +@@ -187,7 +190,10 @@ + + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + { +- return !side.getAxis().isVertical() && isValidSupportBlock(worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock()); ++ if (disableValidation) return true; ++ EnumFacing dir = side.getOpposite(); ++ pos = pos.offset(dir); ++ return !side.getAxis().isVertical() && (isValidSupportBlock(worldIn.getBlockState(pos).getBlock()) || worldIn.isSideSolid(pos, side, true)); + } + + protected static EnumFacing getFacing(int meta) +@@ -224,6 +230,7 @@ + + private static boolean isValidSupportBlock(Block blockIn) + { ++ if (disableValidation) return true; + return blockIn.blockMaterial.isOpaque() && blockIn.isFullCube() || blockIn == Blocks.glowstone || blockIn instanceof BlockSlab || blockIn instanceof BlockStairs; + } + diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch new file mode 100644 index 000000000..e5f0df6c5 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockTripWireHook.java ++++ ../src-work/minecraft/net/minecraft/block/BlockTripWireHook.java +@@ -60,7 +60,7 @@ + + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + { +- return side.getAxis().isHorizontal() && worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock().isNormalCube(); ++ return side.getAxis().isHorizontal() && worldIn.isSideSolid(pos.offset(side.getOpposite()), side, true); + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) +@@ -77,7 +77,7 @@ + + enumfacing = (EnumFacing)iterator.next(); + } +- while (!worldIn.getBlockState(pos.offset(enumfacing)).getBlock().isNormalCube()); ++ while (!worldIn.isSideSolid(pos.offset(enumfacing), enumfacing.getOpposite(), true)); + + return true; + } +@@ -107,7 +107,7 @@ + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + +- if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).getBlock().isNormalCube()) ++ if (!worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); diff --git a/patches/minecraft/net/minecraft/block/BlockVine.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch similarity index 57% rename from patches/minecraft/net/minecraft/block/BlockVine.java.patch rename to patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch index 5436620a3..911d961f2 100644 --- a/patches/minecraft/net/minecraft/block/BlockVine.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch @@ -7,20 +7,20 @@ -public class BlockVine extends Block +public class BlockVine extends Block implements net.minecraftforge.common.IShearable { - public static final PropertyBool field_176277_a = PropertyBool.func_177716_a("up"); - public static final PropertyBool field_176273_b = PropertyBool.func_177716_a("north"); + public static final PropertyBool UP = PropertyBool.create("up"); + public static final PropertyBool NORTH = PropertyBool.create("north"); @@ -416,13 +416,7 @@ - public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) { -- if (!p_180657_1_.field_72995_K && p_180657_2_.func_71045_bC() != null && p_180657_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ) +- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) { -- p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); -- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Blocks.field_150395_bd, 1, 0)); +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.vine, 1, 0)); - } - else - { - super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); + super.harvestBlock(worldIn, player, pos, state, te); } } @@ -508,6 +502,16 @@ @@ -39,4 +39,4 @@ + static final class SwitchEnumFacing { - static final int[] field_177057_a = new int[EnumFacing.values().length]; + static final int[] FACING_LOOKUP = new int[EnumFacing.values().length]; diff --git a/patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch new file mode 100644 index 000000000..3a0c759c1 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java ++++ ../src-work/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java +@@ -80,7 +80,7 @@ + { + Block block = this.world.getBlockState(origin).getBlock(); + +- if (block.getMaterial() == Material.air) ++ if (block.isAir(world, origin)) + { + return true; + } +@@ -111,7 +111,7 @@ + BlockPos blockpos1 = origin.offset(this.moveDirection.getOpposite(), i); + block = this.world.getBlockState(blockpos1).getBlock(); + +- if (block.getMaterial() == Material.air || !BlockPistonBase.canPush(block, this.world, blockpos1, this.moveDirection, false) || blockpos1.equals(this.pistonPos)) ++ if (block.isAir(world, blockpos1)|| !BlockPistonBase.canPush(block, this.world, blockpos1, this.moveDirection, false) || blockpos1.equals(this.pistonPos)) + { + break; + } +@@ -159,7 +159,7 @@ + + block = this.world.getBlockState(blockpos2).getBlock(); + +- if (block.getMaterial() == Material.air) ++ if (block.isAir(world, blockpos2)) + { + return true; + } diff --git a/patches/minecraft/net/minecraft/block/state/BlockState.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/BlockState.java.patch similarity index 56% rename from patches/minecraft/net/minecraft/block/state/BlockState.java.patch rename to patches.mcp/minecraft/net/minecraft/block/state/BlockState.java.patch index 7168f0548..18159f17b 100644 --- a/patches/minecraft/net/minecraft/block/state/BlockState.java.patch +++ b/patches.mcp/minecraft/net/minecraft/block/state/BlockState.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/block/state/BlockState.java @@ -47,6 +47,16 @@ - public BlockState(Block p_i45663_1_, IProperty ... p_i45663_2_) + public BlockState(Block blockIn, IProperty ... properties) { -+ this(p_i45663_1_, p_i45663_2_, null); ++ this(blockIn, properties, null); + } + + protected StateImplementation createState(Block block, ImmutableMap properties, ImmutableMap unlistedProperties) @@ -12,33 +12,33 @@ + return new StateImplementation(block, properties); + } + -+ protected BlockState(Block p_i45663_1_, IProperty[] p_i45663_2_, ImmutableMap unlistedProperties) ++ protected BlockState(Block blockIn, IProperty[] properties, ImmutableMap unlistedProperties) + { - this.field_177627_c = p_i45663_1_; - Arrays.sort(p_i45663_2_, new Comparator() + this.block = blockIn; + Arrays.sort(properties, new Comparator() { @@ -70,7 +80,7 @@ { List list = (List)iterator.next(); - Map map = MapPopulator.func_179400_b(this.field_177624_d, list); -- BlockState.StateImplementation stateimplementation = new BlockState.StateImplementation(p_i45663_1_, ImmutableMap.copyOf(map), null); -+ BlockState.StateImplementation stateimplementation = createState(p_i45663_1_, ImmutableMap.copyOf(map), unlistedProperties); + Map map = MapPopulator.createMap(this.properties, list); +- BlockState.StateImplementation stateimplementation = new BlockState.StateImplementation(blockIn, ImmutableMap.copyOf(map), null); ++ BlockState.StateImplementation stateimplementation = createState(blockIn, ImmutableMap.copyOf(map), unlistedProperties); linkedhashmap.put(map, stateimplementation); arraylist.add(stateimplementation); } @@ -135,6 +145,13 @@ - this.field_177239_a = p_i45660_1_; - this.field_177237_b = p_i45660_2_; + this.block = blockIn; + this.properties = propertiesIn; } + + protected StateImplementation(Block blockIn, ImmutableMap propertiesIn, ImmutableTable propertyValueTable) + { -+ this.field_177239_a = blockIn; -+ this.field_177237_b = propertiesIn; -+ this.field_177238_c = propertyValueTable; ++ this.block = blockIn; ++ this.properties = propertiesIn; ++ this.propertyValueTable = propertyValueTable; + } - public Collection func_177227_a() + public Collection getPropertyNames() { @@ -231,5 +248,10 @@ { @@ -47,7 +47,7 @@ + + public ImmutableTable getPropertyValueTable() + { -+ return field_177238_c; ++ return propertyValueTable; + } } } diff --git a/patches/minecraft/net/minecraft/block/state/BlockStateBase.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/block/state/BlockStateBase.java.patch rename to patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch diff --git a/patches/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch b/patches.mcp/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch rename to patches.mcp/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch diff --git a/patches.mcp/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch new file mode 100644 index 000000000..5a04f69b6 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch @@ -0,0 +1,26 @@ +--- ../src-base/minecraft/net/minecraft/client/LoadingScreenRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/LoadingScreenRenderer.java +@@ -139,6 +139,10 @@ + GlStateManager.clear(16640); + } + ++ try ++ { ++ if (!net.minecraftforge.fml.client.FMLClientHandler.instance().handleLoadingScreen(scaledresolution)) //FML Don't render while FML's pre-screen is rendering ++ { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + this.mc.getTextureManager().bindTexture(Gui.optionsBackground); +@@ -177,6 +181,12 @@ + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + this.mc.fontRendererObj.drawStringWithShadow(this.currentlyDisplayedText, (float)((l - this.mc.fontRendererObj.getStringWidth(this.currentlyDisplayedText)) / 2), (float)(i1 / 2 - 4 - 16), 16777215); + this.mc.fontRendererObj.drawStringWithShadow(this.message, (float)((l - this.mc.fontRendererObj.getStringWidth(this.message)) / 2), (float)(i1 / 2 - 4 + 8), 16777215); ++ } ++ } ++ catch (java.io.IOException e) ++ { ++ com.google.common.base.Throwables.propagate(e); ++ } //FML End + this.framebuffer.unbindFramebuffer(); + + if (OpenGlHelper.isFramebufferEnabled()) diff --git a/patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch b/patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch new file mode 100644 index 000000000..883fbf527 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch @@ -0,0 +1,476 @@ +--- ../src-base/minecraft/net/minecraft/client/Minecraft.java ++++ ../src-work/minecraft/net/minecraft/client/Minecraft.java +@@ -296,7 +296,6 @@ + this.sessionService = (new YggdrasilAuthenticationService(gameConfig.userInfo.proxy, UUID.randomUUID().toString())).createMinecraftSessionService(); + this.session = gameConfig.userInfo.session; + logger.info("Setting user: " + this.session.getUsername()); +- logger.info("(Session ID is " + this.session.getSessionID() + ")"); + this.isDemo = gameConfig.gameInfo.isDemo; + this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1; + this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1; +@@ -410,10 +409,10 @@ + this.mcResourceManager = new SimpleReloadableResourceManager(this.metadataSerializer_); + this.mcLanguageManager = new LanguageManager(this.metadataSerializer_, this.gameSettings.language); + this.mcResourceManager.registerReloadListener(this.mcLanguageManager); +- this.refreshResources(); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().beginMinecraftLoading(this, this.defaultResourcePacks, this.mcResourceManager); + this.renderEngine = new TextureManager(this.mcResourceManager); + this.mcResourceManager.registerReloadListener(this.renderEngine); +- this.drawSplashScreen(this.renderEngine); ++ net.minecraftforge.fml.client.SplashProgress.drawVanillaScreen(this.renderEngine); + this.initStream(); + this.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService); + this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves")); +@@ -449,6 +448,8 @@ + } + }); + this.mouseHelper = new MouseHelper(); ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar= net.minecraftforge.fml.common.ProgressManager.push("Rendering Setup", 5, true); ++ bar.step("GL Setup"); + this.checkGLError("Pre startup"); + GlStateManager.enableTexture2D(); + GlStateManager.shadeModel(7425); +@@ -462,17 +463,21 @@ + GlStateManager.loadIdentity(); + GlStateManager.matrixMode(5888); + this.checkGLError("Startup"); +- this.textureMapBlocks = new TextureMap("textures"); ++ bar.step("Loading Texture Map"); ++ this.textureMapBlocks = new TextureMap("textures",true); + this.textureMapBlocks.setMipmapLevels(this.gameSettings.mipmapLevels); + this.renderEngine.loadTickableTexture(TextureMap.locationBlocksTexture, this.textureMapBlocks); + this.renderEngine.bindTexture(TextureMap.locationBlocksTexture); + this.textureMapBlocks.setBlurMipmapDirect(false, this.gameSettings.mipmapLevels > 0); ++ bar.step("Loading Model Manager"); + this.modelManager = new ModelManager(this.textureMapBlocks); + this.mcResourceManager.registerReloadListener(this.modelManager); ++ bar.step("Loading Item Renderer"); + this.renderItem = new RenderItem(this.renderEngine, this.modelManager); + this.renderManager = new RenderManager(this.renderEngine, this.renderItem); + this.itemRenderer = new ItemRenderer(this); + this.mcResourceManager.registerReloadListener(this.renderItem); ++ bar.step("Loading Entity Renderer"); + this.entityRenderer = new EntityRenderer(this, this.mcResourceManager); + this.mcResourceManager.registerReloadListener(this.entityRenderer); + this.blockRenderDispatcher = new BlockRendererDispatcher(this.modelManager.getBlockModelShapes(), this.gameSettings); +@@ -482,22 +487,25 @@ + this.guiAchievement = new GuiAchievement(this); + GlStateManager.viewport(0, 0, this.displayWidth, this.displayHeight); + this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine); ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().finishMinecraftLoading(); + this.checkGLError("Post startup"); +- this.ingameGUI = new GuiIngame(this); ++ this.ingameGUI = new net.minecraftforge.client.GuiIngameForge(this); + + if (this.serverName != null) + { +- this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort)); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServerAtStartup(this.serverName, this.serverPort); + } + else + { + this.displayGuiScreen(new GuiMainMenu()); + } + +- this.renderEngine.deleteTexture(this.mojangLogo); ++ net.minecraftforge.fml.client.SplashProgress.clearVanillaResources(renderEngine, mojangLogo); + this.mojangLogo = null; + this.loadingScreen = new LoadingScreenRenderer(this); + ++ net.minecraftforge.fml.client.FMLClientHandler.instance().onInitializationComplete(); + if (this.gameSettings.fullScreen && !this.fullscreen) + { + this.toggleFullscreen(); +@@ -681,21 +689,23 @@ + File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt"); + Bootstrap.printToSYSOUT(crashReportIn.getCompleteReport()); + ++ int retVal; + if (crashReportIn.getFile() != null) + { + Bootstrap.printToSYSOUT("#@!@# Game crashed! Crash report saved to: #@!@# " + crashReportIn.getFile()); +- System.exit(-1); ++ retVal = -1; + } + else if (crashReportIn.saveToFile(file2)) + { + Bootstrap.printToSYSOUT("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath()); +- System.exit(-1); ++ retVal = -1; + } + else + { + Bootstrap.printToSYSOUT("#@?@# Game crashed! Crash report could not be saved. #@?@#"); +- System.exit(-2); ++ retVal = -2; + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleExit(retVal); + } + + public boolean isUnicode() +@@ -887,11 +897,6 @@ + + public void displayGuiScreen(GuiScreen guiScreenIn) + { +- if (this.currentScreen != null) +- { +- this.currentScreen.onGuiClosed(); +- } +- + if (guiScreenIn == null && this.theWorld == null) + { + guiScreenIn = new GuiMainMenu(); +@@ -901,6 +906,17 @@ + guiScreenIn = new GuiGameOver(); + } + ++ GuiScreen old = this.currentScreen; ++ net.minecraftforge.client.event.GuiOpenEvent event = new net.minecraftforge.client.event.GuiOpenEvent(guiScreenIn); ++ ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; ++ ++ guiScreenIn = event.gui; ++ if (old != null && guiScreenIn != old) ++ { ++ old.onGuiClosed(); ++ } ++ + if (guiScreenIn instanceof GuiMainMenu) + { + this.gameSettings.showDebugInfo = false; +@@ -999,7 +1015,7 @@ + { + while (!this.scheduledTasks.isEmpty()) + { +- ((FutureTask)this.scheduledTasks.poll()).run(); ++ net.minecraftforge.fml.common.FMLCommonHandler.callFuture(((FutureTask)this.scheduledTasks.poll())); + } + } + +@@ -1034,9 +1050,11 @@ + + if (!this.skipRenderWorld) + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickStart(this.timer.renderPartialTicks); + this.mcProfiler.endStartSection("gameRenderer"); + this.entityRenderer.updateCameraAndRender(this.timer.renderPartialTicks); + this.mcProfiler.endSection(); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickEnd(this.timer.renderPartialTicks); + } + + this.mcProfiler.endSection(); +@@ -1382,7 +1400,7 @@ + + if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air && this.playerController.func_180512_c(blockpos, this.objectMouseOver.sideHit)) + { +- this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver.sideHit); ++ this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver); + this.thePlayer.swingItem(); + } + } +@@ -1462,15 +1480,19 @@ + case 2: + BlockPos blockpos = this.objectMouseOver.getBlockPos(); + +- if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air) ++ if (!this.theWorld.isAirBlock(blockpos)) + { + int i = itemstack != null ? itemstack.stackSize : 0; + ++ ++ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, this.theWorld, blockpos, this.objectMouseOver.sideHit).isCanceled(); ++ if (result) { //Forge: Kept separate to simplify patch + if (this.playerController.func_178890_a(this.thePlayer, this.theWorld, itemstack, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec)) + { + flag = false; + this.thePlayer.swingItem(); + } ++ } + + if (itemstack == null) + { +@@ -1493,7 +1515,8 @@ + { + ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem(); + +- if (itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) ++ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, theWorld, null, null).isCanceled(); ++ if (result && itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) + { + this.entityRenderer.itemRenderer.resetEquippedProgress2(); + } +@@ -1591,6 +1614,8 @@ + --this.rightClickDelayTimer; + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreClientTick(); ++ + this.mcProfiler.startSection("gui"); + + if (!this.isGamePaused) +@@ -1689,6 +1714,8 @@ + + while (Mouse.next()) + { ++ if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue; ++ + i = Mouse.getEventButton(); + KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState()); + +@@ -1744,6 +1771,7 @@ + this.currentScreen.handleMouseInput(); + } + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireMouseInput(); + } + + if (this.leftClickCounter > 0) +@@ -1920,6 +1948,7 @@ + } + } + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireKeyInput(); + } + + for (i = 0; i < 9; ++i) +@@ -2120,12 +2149,15 @@ + this.myNetworkManager.processReceivedPackets(); + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostClientTick(); ++ + this.mcProfiler.endSection(); + this.systemTime = getSystemTime(); + } + + public void launchIntegratedServer(String folderName, String worldName, WorldSettings worldSettingsIn) + { ++ net.minecraftforge.fml.client.FMLClientHandler.instance().startIntegratedServer(folderName, worldName, worldSettingsIn); + this.loadWorld((WorldClient)null); + System.gc(); + ISaveHandler isavehandler = this.saveLoader.getSaveLoader(folderName, false); +@@ -2161,6 +2193,12 @@ + + while (!this.theIntegratedServer.serverIsInRunLoop()) + { ++ if (!net.minecraftforge.fml.common.StartupQuery.check()) ++ { ++ loadWorld(null); ++ displayGuiScreen(null); ++ return; ++ } + String s2 = this.theIntegratedServer.getUserMessage(); + + if (s2 != null) +@@ -2186,8 +2224,14 @@ + SocketAddress socketaddress = this.theIntegratedServer.getNetworkSystem().addLocalEndpoint(); + NetworkManager networkmanager = NetworkManager.provideLocalClient(socketaddress); + networkmanager.setNetHandler(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null)); +- networkmanager.sendPacket(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN)); +- networkmanager.sendPacket(new C00PacketLoginStart(this.getSession().getProfile())); ++ networkmanager.sendPacket(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN, true)); ++ com.mojang.authlib.GameProfile gameProfile = this.getSession().getProfile(); ++ if (!this.getSession().hasCachedProperties()) ++ { ++ gameProfile = sessionService.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974. ++ this.getSession().setProperties(gameProfile.getProperties()); ++ } ++ networkmanager.sendPacket(new C00PacketLoginStart(gameProfile)); + this.myNetworkManager = networkmanager; + } + +@@ -2198,6 +2242,8 @@ + + public void loadWorld(WorldClient worldClientIn, String loadingMessage) + { ++ if (theWorld != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(theWorld)); ++ + if (worldClientIn == null) + { + NetHandlerPlayClient nethandlerplayclient = this.getNetHandler(); +@@ -2211,6 +2257,18 @@ + { + this.theIntegratedServer.initiateShutdown(); + this.theIntegratedServer.setStaticInstance(); ++ if (loadingScreen != null) ++ { ++ this.loadingScreen.displayLoadingString(I18n.format("forge.client.shutdown.internal")); ++ } ++ while (!theIntegratedServer.isServerStopped()) ++ { ++ try ++ { ++ Thread.sleep(10); ++ } ++ catch (InterruptedException ie) {} ++ } + } + + this.theIntegratedServer = null; +@@ -2237,6 +2295,7 @@ + + this.setServerData((ServerData)null); + this.integratedServerIsRunning = false; ++ net.minecraftforge.fml.client.FMLClientHandler.instance().handleClientWorldClosing(this.theWorld); + } + + this.mcSoundHandler.stopSounds(); +@@ -2341,134 +2400,11 @@ + if (this.objectMouseOver != null) + { + boolean flag = this.thePlayer.capabilities.isCreativeMode; +- int i = 0; +- boolean flag1 = false; +- TileEntity tileentity = null; +- Object object; + +- if (this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) +- { +- BlockPos blockpos = this.objectMouseOver.getBlockPos(); +- Block block = this.theWorld.getBlockState(blockpos).getBlock(); +- +- if (block.getMaterial() == Material.air) +- { +- return; +- } +- +- object = block.getItem(this.theWorld, blockpos); +- +- if (object == null) +- { +- return; +- } +- +- if (flag && GuiScreen.isCtrlKeyDown()) +- { +- tileentity = this.theWorld.getTileEntity(blockpos); +- } +- +- Block block1 = object instanceof ItemBlock && !block.isFlowerPot() ? Block.getBlockFromItem((Item)object) : block; +- i = block1.getDamageValue(this.theWorld, blockpos); +- flag1 = ((Item)object).getHasSubtypes(); +- } +- else +- { +- if (this.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !flag) +- { +- return; +- } +- +- if (this.objectMouseOver.entityHit instanceof EntityPainting) +- { +- object = Items.painting; +- } +- else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot) +- { +- object = Items.lead; +- } +- else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) +- { +- EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit; +- ItemStack itemstack = entityitemframe.getDisplayedItem(); +- +- if (itemstack == null) +- { +- object = Items.item_frame; +- } +- else +- { +- object = itemstack.getItem(); +- i = itemstack.getMetadata(); +- flag1 = true; +- } +- } +- else if (this.objectMouseOver.entityHit instanceof EntityMinecart) +- { +- EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit; +- +- switch (Minecraft.SwitchEnumMinecartType.field_178901_b[entityminecart.getMinecartType().ordinal()]) +- { +- case 1: +- object = Items.furnace_minecart; +- break; +- case 2: +- object = Items.chest_minecart; +- break; +- case 3: +- object = Items.tnt_minecart; +- break; +- case 4: +- object = Items.hopper_minecart; +- break; +- case 5: +- object = Items.command_block_minecart; +- break; +- default: +- object = Items.minecart; +- } +- } +- else if (this.objectMouseOver.entityHit instanceof EntityBoat) +- { +- object = Items.boat; +- } +- else if (this.objectMouseOver.entityHit instanceof EntityArmorStand) +- { +- object = Items.armor_stand; +- } +- else +- { +- object = Items.spawn_egg; +- i = EntityList.getEntityID(this.objectMouseOver.entityHit); +- flag1 = true; +- +- if (!EntityList.entityEggs.containsKey(Integer.valueOf(i))) +- { +- return; +- } +- } +- } +- + InventoryPlayer inventoryplayer = this.thePlayer.inventory; + +- if (tileentity == null) +- { +- inventoryplayer.setCurrentItem((Item)object, i, flag1, flag); +- } +- else +- { +- NBTTagCompound nbttagcompound1 = new NBTTagCompound(); +- tileentity.writeToNBT(nbttagcompound1); +- ItemStack itemstack1 = new ItemStack((Item)object, 1, i); +- itemstack1.setTagInfo("BlockEntityTag", nbttagcompound1); +- NBTTagCompound nbttagcompound = new NBTTagCompound(); +- NBTTagList nbttaglist = new NBTTagList(); +- nbttaglist.appendTag(new NBTTagString("(+NBT)")); +- nbttagcompound.setTag("Lore", nbttaglist); +- itemstack1.setTagInfo("display", nbttagcompound); +- inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, itemstack1); +- } +- ++ if (!net.minecraftforge.common.ForgeHooks.onPickBlock(this.objectMouseOver, this.thePlayer, this.theWorld)) return; ++ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions + if (flag) + { + int j = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + inventoryplayer.currentItem; +@@ -2726,18 +2662,8 @@ + + public static int getGLMaximumTextureSize() + { +- for (int i = 16384; i > 0; i >>= 1) +- { +- GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null); +- int j = GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); +- +- if (j != 0) +- { +- return i; +- } +- } +- +- return -1; ++ //Forge we redirect this to our code which caches the value before any splash screen stuff is done. ++ return net.minecraftforge.fml.client.SplashProgress.getMaxTextureSize(); + } + + public boolean isSnooperEnabled() diff --git a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch similarity index 52% rename from patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch rename to patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch index 0aaeff108..e58577e04 100644 --- a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch @@ -21,32 +21,32 @@ { @@ -81,6 +86,7 @@ { - this.func_148613_b(); - this.func_148608_i(); + this.unloadSoundSystem(); + this.loadSoundSystem(); + MinecraftForge.EVENT_BUS.post(new SoundLoadEvent(this)); } - private synchronized void func_148608_i() + private synchronized void loadSoundSystem() @@ -329,6 +335,9 @@ } else { -+ p_148611_1_ = ForgeHooksClient.playSound(this, p_148611_1_); -+ if (p_148611_1_ == null) return; ++ sound = ForgeHooksClient.playSound(this, sound); ++ if (sound == null) return; + - SoundEventAccessorComposite soundeventaccessorcomposite = this.field_148622_c.func_147680_a(p_148611_1_.func_147650_b()); + SoundEventAccessorComposite soundeventaccessorcomposite = this.sndHandler.getSound(sound.getSoundLocation()); if (soundeventaccessorcomposite == null) @@ -370,10 +379,12 @@ - if (soundpoolentry.func_148648_d()) + if (soundpoolentry.isStreamingSound()) { - this.field_148620_e.newStreamingSource(false, s, func_148612_a(resourcelocation), resourcelocation.toString(), flag, p_148611_1_.func_147649_g(), p_148611_1_.func_147654_h(), p_148611_1_.func_147651_i(), p_148611_1_.func_147656_j().func_148586_a(), f1); -+ MinecraftForge.EVENT_BUS.post(new PlayStreamingSourceEvent(this, p_148611_1_, s)); + this.sndSystem.newStreamingSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1); ++ MinecraftForge.EVENT_BUS.post(new PlayStreamingSourceEvent(this, sound, s)); } else { - this.field_148620_e.newSource(false, s, func_148612_a(resourcelocation), resourcelocation.toString(), flag, p_148611_1_.func_147649_g(), p_148611_1_.func_147654_h(), p_148611_1_.func_147651_i(), p_148611_1_.func_147656_j().func_148586_a(), f1); -+ MinecraftForge.EVENT_BUS.post(new PlaySoundSourceEvent(this, p_148611_1_, s)); + this.sndSystem.newSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1); ++ MinecraftForge.EVENT_BUS.post(new PlaySoundSourceEvent(this, sound, s)); } - field_148621_b.debug(field_148623_a, "Playing sound {} for event {} as channel {}", new Object[] {soundpoolentry.func_148652_a(), soundeventaccessorcomposite.func_148729_c(), s}); + logger.debug(LOG_MARKER, "Playing sound {} for event {} as channel {}", new Object[] {soundpoolentry.getSoundPoolEntryLocation(), soundeventaccessorcomposite.getSoundEventLocation(), s}); diff --git a/patches/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch rename to patches.mcp/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch diff --git a/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch new file mode 100644 index 000000000..8b3b22b9e --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch @@ -0,0 +1,80 @@ +--- ../src-base/minecraft/net/minecraft/client/entity/EntityPlayerSP.java ++++ ../src-work/minecraft/net/minecraft/client/entity/EntityPlayerSP.java +@@ -53,6 +53,9 @@ + import net.minecraft.world.World; + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; ++import net.minecraftforge.client.ForgeHooksClient; ++import net.minecraftforge.common.MinecraftForge; ++import net.minecraftforge.event.entity.PlaySoundAtEntityEvent; + + @SideOnly(Side.CLIENT) + public class EntityPlayerSP extends AbstractClientPlayer +@@ -342,6 +345,15 @@ + this.mc.ingameGUI.getChatGUI().printChatMessage(chatComponent); + } + ++ private boolean isHeadspaceFree(BlockPos pos, int height) ++ { ++ for (int y = 0; y < height; y++) ++ { ++ if (isOpenBlockSpace(pos.add(0, y, 0))) return false; ++ } ++ return true; ++ } ++ + protected boolean pushOutOfBlocks(double x, double y, double z) + { + if (this.noClip) +@@ -354,30 +366,34 @@ + double d3 = x - (double)blockpos.getX(); + double d4 = z - (double)blockpos.getZ(); + +- if (!this.isOpenBlockSpace(blockpos)) ++ int entHeight = Math.max(Math.round(this.height), 1); ++ ++ boolean inTranslucentBlock = this.isHeadspaceFree(blockpos, entHeight); ++ ++ if (inTranslucentBlock) + { + byte b0 = -1; + double d5 = 9999.0D; + +- if (this.isOpenBlockSpace(blockpos.west()) && d3 < d5) ++ if (!this.isHeadspaceFree(blockpos.west(), entHeight) && d3 < d5) + { + d5 = d3; + b0 = 0; + } + +- if (this.isOpenBlockSpace(blockpos.east()) && 1.0D - d3 < d5) ++ if (!this.isHeadspaceFree(blockpos.east(), entHeight) && 1.0D - d3 < d5) + { + d5 = 1.0D - d3; + b0 = 1; + } + +- if (this.isOpenBlockSpace(blockpos.north()) && d4 < d5) ++ if (!this.isHeadspaceFree(blockpos.north(), entHeight) && d4 < d5) + { + d5 = d4; + b0 = 4; + } + +- if (this.isOpenBlockSpace(blockpos.south()) && 1.0D - d4 < d5) ++ if (!this.isHeadspaceFree(blockpos.south(), entHeight) && 1.0D - d4 < d5) + { + d5 = 1.0D - d4; + b0 = 5; +@@ -445,6 +461,11 @@ + + public void playSound(String name, float volume, float pitch) + { ++ PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, name, volume, pitch); ++ if (event.isCanceled() || event.name == null) return; ++ name = event.name; ++ volume = event.newVolume; ++ pitch = event.newPitch; + this.worldObj.playSound(this.posX, this.posY, this.posZ, name, volume, pitch, false); + } + diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch new file mode 100644 index 000000000..08bb966fe --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch @@ -0,0 +1,155 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/FontRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/gui/FontRenderer.java +@@ -57,7 +57,7 @@ + this.locationFontTexture = p_i1035_2_; + this.renderEngine = p_i1035_3_; + this.unicodeFlag = p_i1035_4_; +- p_i1035_3_.bindTexture(this.locationFontTexture); ++ bindTexture(this.locationFontTexture); + + for (int i = 0; i < 32; ++i) + { +@@ -97,6 +97,7 @@ + public void onResourceManagerReload(IResourceManager resourceManager) + { + this.readFontTexture(); ++ this.readGlyphSizes(); + } + + private void readFontTexture() +@@ -105,7 +106,7 @@ + + try + { +- bufferedimage = TextureUtil.readBufferedImage(Minecraft.getMinecraft().getResourceManager().getResource(this.locationFontTexture).getInputStream()); ++ bufferedimage = TextureUtil.readBufferedImage(getResourceInputStream(this.locationFontTexture)); + } + catch (IOException ioexception) + { +@@ -172,7 +173,7 @@ + + try + { +- inputstream = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("font/glyph_sizes.bin")).getInputStream(); ++ inputstream = getResourceInputStream(new ResourceLocation("font/glyph_sizes.bin")); + inputstream.read(this.glyphWidth); + } + catch (IOException ioexception) +@@ -195,7 +196,7 @@ + float f = (float)(p_78266_1_ % 16 * 8); + float f1 = (float)(p_78266_1_ / 16 * 8); + float f2 = p_78266_2_ ? 1.0F : 0.0F; +- this.renderEngine.bindTexture(this.locationFontTexture); ++ bindTexture(this.locationFontTexture); + float f3 = (float)this.charWidth[p_78266_1_] - 0.01F; + GL11.glBegin(GL11.GL_TRIANGLE_STRIP); + GL11.glTexCoord2f(f / 128.0F, f1 / 128.0F); +@@ -222,7 +223,7 @@ + + private void loadGlyphTexture(int p_78257_1_) + { +- this.renderEngine.bindTexture(this.getUnicodePageLocation(p_78257_1_)); ++ bindTexture(this.getUnicodePageLocation(p_78257_1_)); + } + + protected float renderUnicodeChar(char p_78277_1_, boolean p_78277_2_) +@@ -269,7 +270,7 @@ + + public int drawString(String p_175065_1_, float p_175065_2_, float p_175065_3_, int p_175065_4_, boolean p_175065_5_) + { +- GlStateManager.enableAlpha(); ++ enableAlpha(); + this.resetStyles(); + int j; + +@@ -341,7 +342,7 @@ + + k = this.colorCode[j]; + this.textColor = k; +- GlStateManager.color((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.alpha); ++ setColor((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.alpha); + } + else if (j == 16) + { +@@ -370,7 +371,7 @@ + this.strikethroughStyle = false; + this.underlineStyle = false; + this.italicStyle = false; +- GlStateManager.color(this.red, this.blue, this.green, this.alpha); ++ setColor(this.red, this.blue, this.green, this.alpha); + } + + ++i; +@@ -390,7 +391,7 @@ + j = k; + } + +- float f1 = this.unicodeFlag ? 0.5F : 1.0F; ++ float f1 = getCharWidth(c0) / 32f; + boolean flag1 = (c0 == 0 || j == -1 || this.unicodeFlag) && p_78255_2_; + + if (flag1) +@@ -429,6 +430,15 @@ + ++f; + } + ++ doDraw(f); ++ } ++ } ++ } ++ ++ protected void doDraw(float f) ++ { ++ { ++ { + Tessellator tessellator; + WorldRenderer worldrenderer; + +@@ -504,7 +514,7 @@ + this.blue = (float)(p_180455_4_ >> 8 & 255) / 255.0F; + this.green = (float)(p_180455_4_ & 255) / 255.0F; + this.alpha = (float)(p_180455_4_ >> 24 & 255) / 255.0F; +- GlStateManager.color(this.red, this.blue, this.green, this.alpha); ++ setColor(this.red, this.blue, this.green, this.alpha); + this.posX = p_180455_2_; + this.posY = p_180455_3_; + this.renderStringAtPos(p_180455_1_, p_180455_5_); +@@ -583,11 +593,6 @@ + int j = this.glyphWidth[p_78263_1_] >>> 4; + int k = this.glyphWidth[p_78263_1_] & 15; + +- if (k > 7) +- { +- k = 15; +- j = 0; +- } + + ++k; + return (k - j) / 2 + 1; +@@ -842,6 +847,26 @@ + return this.bidiFlag; + } + ++ protected void setColor(float r, float g, float b, float a) ++ { ++ GlStateManager.color(r,g,b,a); ++ } ++ ++ protected void enableAlpha() ++ { ++ GlStateManager.enableAlpha(); ++ } ++ ++ protected void bindTexture(ResourceLocation location) ++ { ++ renderEngine.bindTexture(location); ++ } ++ ++ protected InputStream getResourceInputStream(ResourceLocation location) throws IOException ++ { ++ return Minecraft.getMinecraft().getResourceManager().getResource(location).getInputStream(); ++ } ++ + public int getColorCode(char p_175064_1_) + { + return this.colorCode["0123456789abcdef".indexOf(p_175064_1_)]; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiButton.java.patch similarity index 56% rename from patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch rename to patches.mcp/minecraft/net/minecraft/client/gui/GuiButton.java.patch index 1366ae5b5..0ccb62296 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiButton.java.patch @@ -1,24 +1,24 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiButton.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiButton.java @@ -22,6 +22,7 @@ - public boolean field_146125_m; - protected boolean field_146123_n; + public boolean visible; + protected boolean hovered; private static final String __OBFID = "CL_00000668"; + public int packedFGColour; //FML - public GuiButton(int p_i1020_1_, int p_i1020_2_, int p_i1020_3_, String p_i1020_4_) + public GuiButton(int buttonId, int x, int y, String buttonText) { @@ -75,8 +76,12 @@ - this.func_146119_b(p_146112_1_, p_146112_2_, p_146112_3_); + this.mouseDragged(mc, mouseX, mouseY); int l = 14737632; -- if (!this.field_146124_l) +- if (!this.enabled) + if (packedFGColour != 0) { + l = packedFGColour; + } -+ else if (!this.field_146124_l) ++ else if (!this.enabled) + { l = 10526880; } - else if (this.field_146123_n) + else if (this.hovered) diff --git a/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch similarity index 59% rename from patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch rename to patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch index e6f87a374..f336b38d2 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch @@ -1,21 +1,21 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiChat.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiChat.java @@ -217,13 +217,14 @@ - this.field_146297_k.field_71456_v.func_146158_b().func_146234_a(new ChatComponentText(stringbuilder.toString()), 1); + this.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(stringbuilder.toString()), 1); } -- this.field_146415_a.func_146191_b((String)this.field_146412_t.get(this.field_146413_s++)); -+ this.field_146415_a.func_146191_b(net.minecraft.util.EnumChatFormatting.func_110646_a((String)this.field_146412_t.get(this.field_146413_s++))); +- this.inputField.writeText((String)this.foundPlayerNames.get(this.autocompleteIndex++)); ++ this.inputField.writeText(net.minecraft.util.EnumChatFormatting.getTextWithoutFormattingCodes((String)this.foundPlayerNames.get(this.autocompleteIndex++))); } - private void func_146405_a(String p_146405_1_, String p_146405_2_) + private void sendAutocompleteRequest(String p_146405_1_, String p_146405_2_) { if (p_146405_1_.length() >= 1) { + net.minecraftforge.client.ClientCommandHandler.instance.autoComplete(p_146405_1_, p_146405_2_); BlockPos blockpos = null; - if (this.field_146297_k.field_71476_x != null && this.field_146297_k.field_71476_x.field_72313_a == MovingObjectPosition.MovingObjectType.BLOCK) + if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) @@ -285,6 +286,13 @@ String[] astring1 = p_146406_1_; int i = p_146406_1_.length; diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch new file mode 100644 index 000000000..bf1617dab --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch @@ -0,0 +1,36 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java +@@ -213,6 +213,8 @@ + } + } + ++ WorldType.worldTypes[this.selectedIndex].onGUICreateWorldPress(); ++ + WorldSettings.GameType gametype = WorldSettings.GameType.getByName(this.field_146342_r); + WorldSettings worldsettings = new WorldSettings(i, gametype, this.field_146341_s, this.field_146337_w, WorldType.worldTypes[this.selectedIndex]); + worldsettings.setWorldName(this.chunkProviderSettingsJson); +@@ -320,14 +322,7 @@ + } + else if (button.id == 8) + { +- if (WorldType.worldTypes[this.selectedIndex] == WorldType.FLAT) +- { +- this.mc.displayGuiScreen(new GuiCreateFlatWorld(this, this.chunkProviderSettingsJson)); +- } +- else +- { +- this.mc.displayGuiScreen(new GuiCustomizeWorldScreen(this, this.chunkProviderSettingsJson)); +- } ++ WorldType.worldTypes[this.selectedIndex].onCustomizeButton(mc, this); + } + } + } +@@ -379,7 +374,7 @@ + this.btnBonusItems.visible = this.field_146344_y; + this.btnMapType.visible = this.field_146344_y; + this.btnAllowCommands.visible = this.field_146344_y; +- this.btnCustomizeType.visible = this.field_146344_y && (WorldType.worldTypes[this.selectedIndex] == WorldType.FLAT || WorldType.worldTypes[this.selectedIndex] == WorldType.CUSTOMIZED); ++ this.btnCustomizeType.visible = this.field_146344_y && WorldType.worldTypes[this.selectedIndex].isCustomizable(); + } + + this.func_146319_h(); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch new file mode 100644 index 000000000..dc621b142 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch @@ -0,0 +1,33 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiIngameMenu.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngameMenu.java +@@ -30,8 +30,9 @@ + + this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 24 + b0, I18n.format("menu.returnToGame", new Object[0]))); + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + b0, 98, 20, I18n.format("menu.options", new Object[0]))); ++ this.buttonList.add(new GuiButton(12, this.width / 2 + 2, this.height / 4 + 96 + b0, 98, 20, I18n.format("fml.menu.modoptions"))); + GuiButton guibutton; +- this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 + 2, this.height / 4 + 96 + b0, 98, 20, I18n.format("menu.shareToLan", new Object[0]))); ++ this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 - 100, this.height / 4 + 72 + b0, 200, 20, I18n.format("menu.shareToLan", new Object[0]))); + this.buttonList.add(new GuiButton(5, this.width / 2 - 100, this.height / 4 + 48 + b0, 98, 20, I18n.format("gui.achievements", new Object[0]))); + this.buttonList.add(new GuiButton(6, this.width / 2 + 2, this.height / 4 + 48 + b0, 98, 20, I18n.format("gui.stats", new Object[0]))); + guibutton.enabled = this.mc.isSingleplayer() && !this.mc.getIntegratedServer().getPublic(); +@@ -58,13 +59,19 @@ + this.mc.setIngameFocus(); + break; + case 5: ++ if (this.mc.thePlayer != null) + this.mc.displayGuiScreen(new GuiAchievements(this, this.mc.thePlayer.getStatFileWriter())); + break; + case 6: ++ if (this.mc.thePlayer != null) + this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter())); + break; + case 7: + this.mc.displayGuiScreen(new GuiShareToLan(this)); ++ break; ++ case 12: ++ net.minecraftforge.fml.client.FMLClientHandler.instance().showInGameModOptions(this); ++ break; + } + } + diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch new file mode 100644 index 000000000..62e8f7c30 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch @@ -0,0 +1,44 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiMainMenu.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiMainMenu.java +@@ -198,6 +198,11 @@ + this.buttonList.add(new GuiButton(1, this.width / 2 - 100, p_73969_1_, I18n.format("menu.singleplayer", new Object[0]))); + this.buttonList.add(new GuiButton(2, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.format("menu.multiplayer", new Object[0]))); + this.buttonList.add(this.realmsButton = new GuiButton(14, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.format("menu.online", new Object[0]))); ++ GuiButton fmlModButton = new GuiButton(6, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.format("fml.menu.mods")); ++ fmlModButton.xPosition = this.width / 2 + 2; ++ realmsButton.width = 98; ++ fmlModButton.width = 98; ++ this.buttonList.add(fmlModButton); + } + + private void addDemoButtons(int p_73972_1_, int p_73972_2_) +@@ -245,6 +250,11 @@ + this.mc.shutdown(); + } + ++ if (button.id == 6) ++ { ++ this.mc.displayGuiScreen(new net.minecraftforge.fml.client.GuiModList(this)); ++ } ++ + if (button.id == 11) + { + this.mc.launchIntegratedServer("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings); +@@ -492,7 +502,16 @@ + s = s + " Demo"; + } + +- this.drawString(this.fontRendererObj, s, 2, this.height - 10, -1); ++ java.util.List brandings = com.google.common.collect.Lists.reverse(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(true)); ++ for (int i = 0; i < brandings.size(); i++) ++ { ++ String brd = brandings.get(i); ++ if (!com.google.common.base.Strings.isNullOrEmpty(brd)) ++ { ++ this.drawString(this.fontRendererObj, brd, 2, this.height - ( 10 + i * (this.fontRendererObj.FONT_HEIGHT + 1)), 16777215); ++ } ++ } ++ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, this.fontRendererObj, this.width, this.height); + String s1 = "Copyright Mojang AB. Do not distribute!"; + this.drawString(this.fontRendererObj, s1, this.width - this.fontRendererObj.getStringWidth(s1) - 2, this.height - 10, -1); + diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch new file mode 100644 index 000000000..b4563e39b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiMultiplayer.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiMultiplayer.java +@@ -41,6 +41,7 @@ + public GuiMultiplayer(GuiScreen parentScreen) + { + this.parentScreen = parentScreen; ++ net.minecraftforge.fml.client.FMLClientHandler.instance().setupServerList(); + } + + public void initGui() +@@ -373,7 +374,7 @@ + + private void connectToServer(ServerData server) + { +- this.mc.displayGuiScreen(new GuiConnecting(this, this.mc, server)); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServer(this, server); + } + + public void selectServer(int index) diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch new file mode 100644 index 000000000..909dc5dbc --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java +@@ -170,6 +170,9 @@ + long l = j - k; + ArrayList arraylist = Lists.newArrayList(new String[] {String.format("Java: %s %dbit", new Object[]{System.getProperty("java.version"), Integer.valueOf(this.mc.isJava64bit() ? 64 : 32)}), String.format("Mem: % 2d%% %03d/%03dMB", new Object[]{Long.valueOf(l * 100L / i), Long.valueOf(bytesToMb(l)), Long.valueOf(bytesToMb(i))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(j * 100L / i), Long.valueOf(bytesToMb(j))}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GL11.glGetString(GL11.GL_VENDOR)}), GL11.glGetString(GL11.GL_RENDERER), GL11.glGetString(GL11.GL_VERSION)}); + ++ arraylist.add(""); ++ arraylist.addAll(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(false)); ++ + if (this.isReducedDebug()) + { + return arraylist; diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiScreen.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiScreen.java.patch new file mode 100644 index 000000000..c6e3b5403 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiScreen.java.patch @@ -0,0 +1,113 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiScreen.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiScreen.java +@@ -37,6 +37,9 @@ + import net.minecraft.util.ChatComponentTranslation; + import net.minecraft.util.EnumChatFormatting; + import net.minecraft.util.IChatComponent; ++import net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent; ++import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; ++import net.minecraftforge.common.MinecraftForge; + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.lang3.StringUtils; +@@ -146,7 +149,8 @@ + } + } + +- this.drawHoveringText(list, x, y); ++ FontRenderer font = stack.getItem().getFontRenderer(stack); ++ this.drawHoveringText(list, x, y, (font == null ? fontRendererObj : font)); + } + + protected void drawCreativeTabHoveringText(String tabName, int mouseX, int mouseY) +@@ -156,6 +160,11 @@ + + protected void drawHoveringText(List textLines, int x, int y) + { ++ drawHoveringText(textLines, x, y, fontRendererObj); ++ } ++ ++ protected void drawHoveringText(List textLines, int x, int y, FontRenderer font) ++ { + if (!textLines.isEmpty()) + { + GlStateManager.disableRescaleNormal(); +@@ -168,7 +177,7 @@ + while (iterator.hasNext()) + { + String s = (String)iterator.next(); +- int l = this.fontRendererObj.getStringWidth(s); ++ int l = font.getStringWidth(s); + + if (l > k) + { +@@ -213,7 +222,7 @@ + for (int i2 = 0; i2 < textLines.size(); ++i2) + { + String s1 = (String)textLines.get(i2); +- this.fontRendererObj.drawStringWithShadow(s1, (float)j2, (float)k2, -1); ++ font.drawStringWithShadow(s1, j2, k2, -1); + + if (i2 == 0) + { +@@ -441,6 +450,7 @@ + this.mc.ingameGUI.getChatGUI().addToSentMessages(msg); + } + ++ if (net.minecraftforge.client.ClientCommandHandler.instance.executeCommand(mc.thePlayer, msg) != 0) return; + this.mc.thePlayer.sendChatMessage(msg); + } + +@@ -454,9 +464,14 @@ + + if (guibutton.mousePressed(this.mc, mouseX, mouseY)) + { +- this.selectedButton = guibutton; +- guibutton.playPressSound(this.mc.getSoundHandler()); +- this.actionPerformed(guibutton); ++ ActionPerformedEvent.Pre event = new ActionPerformedEvent.Pre(this, guibutton, this.buttonList); ++ if (MinecraftForge.EVENT_BUS.post(event)) ++ break; ++ this.selectedButton = event.button; ++ event.button.playPressSound(this.mc.getSoundHandler()); ++ this.actionPerformed(event.button); ++ if (this.equals(this.mc.currentScreen)) ++ MinecraftForge.EVENT_BUS.post(new ActionPerformedEvent.Post(this, event.button, this.buttonList)); + } + } + } +@@ -482,8 +497,12 @@ + this.fontRendererObj = mc.fontRendererObj; + this.width = width; + this.height = height; +- this.buttonList.clear(); +- this.initGui(); ++ if (!MinecraftForge.EVENT_BUS.post(new InitGuiEvent.Pre(this, this.buttonList))) ++ { ++ this.buttonList.clear(); ++ this.initGui(); ++ } ++ MinecraftForge.EVENT_BUS.post(new InitGuiEvent.Post(this, this.buttonList)); + } + + public void initGui() {} +@@ -494,7 +513,9 @@ + { + while (Mouse.next()) + { ++ if (MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Pre(this))) continue; + this.handleMouseInput(); ++ if (this.equals(this.mc.currentScreen)) MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Post(this)); + } + } + +@@ -502,7 +523,9 @@ + { + while (Keyboard.next()) + { ++ if (MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Pre(this))) continue; + this.handleKeyboardInput(); ++ if (this.equals(this.mc.currentScreen)) MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Post(this)); + } + } + } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch similarity index 68% rename from patches/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch rename to patches.mcp/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch index d4be0db7a..83c8e4e05 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/client/gui/GuiSelectWorld.java @@ -187,7 +187,7 @@ - if (this.field_146297_k.func_71359_d().func_90033_f(s)) + if (this.mc.getSaveLoader().canLoadWorld(s)) { -- this.field_146297_k.func_71371_a(s, s1, (WorldSettings)null); +- this.mc.launchIntegratedServer(s, s1, (WorldSettings)null); + net.minecraftforge.fml.client.FMLClientHandler.instance().tryLoadExistingWorld(this, s, s1); } } diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch new file mode 100644 index 000000000..5df4b471b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiSleepMP.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiSleepMP.java +@@ -34,7 +34,7 @@ + + if (!s.isEmpty()) + { +- this.mc.thePlayer.sendChatMessage(s); ++ this.sendChatMessage(s); // Forge: fix vanilla not adding messages to the sent list while sleeping + } + + this.inputField.setText(""); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch new file mode 100644 index 000000000..0ae54f80c --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch @@ -0,0 +1,40 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiSlot.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiSlot.java +@@ -185,16 +185,7 @@ + GlStateManager.disableFog(); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); +- this.mc.getTextureManager().bindTexture(Gui.optionsBackground); +- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +- float f1 = 32.0F; +- worldrenderer.startDrawingQuads(); +- worldrenderer.setColorOpaque_I(2105376); +- worldrenderer.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); +- worldrenderer.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); +- worldrenderer.addVertexWithUV((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); +- worldrenderer.addVertexWithUV((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); +- tessellator.draw(); ++ this.drawContainerBackground(tessellator); + int i1 = this.left + this.width / 2 - this.getListWidth() / 2 + 2; + int j1 = this.top + 4 - (int)this.amountScrolled; + +@@ -456,4 +447,19 @@ + { + return this.slotHeight; + } ++ ++ protected void drawContainerBackground(Tessellator tessellator) ++ { ++ WorldRenderer worldrenderer = tessellator.getWorldRenderer(); ++ this.mc.getTextureManager().bindTexture(Gui.optionsBackground); ++ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); ++ float f1 = 32.0F; ++ worldrenderer.startDrawingQuads(); ++ worldrenderer.setColorOpaque_I(2105376); ++ worldrenderer.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); ++ worldrenderer.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); ++ worldrenderer.addVertexWithUV((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); ++ worldrenderer.addVertexWithUV((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); ++ tessellator.draw(); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch new file mode 100644 index 000000000..a5e77286b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch @@ -0,0 +1,23 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java ++++ ../src-work/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java +@@ -84,7 +84,7 @@ + boolean flag2 = this.field_148301_e.version < 47; + boolean flag3 = flag1 || flag2; + this.field_148300_d.fontRendererObj.drawString(this.field_148301_e.serverName, x + 32 + 3, y + 1, 16777215); +- List list = this.field_148300_d.fontRendererObj.listFormattedStringToWidth(this.field_148301_e.serverMOTD, listWidth - 32 - 2); ++ List list = this.field_148300_d.fontRendererObj.listFormattedStringToWidth(net.minecraftforge.fml.client.FMLClientHandler.instance().fixDescription(this.field_148301_e.serverMOTD), listWidth - 48 - 2); + + for (int l1 = 0; l1 < Math.min(list.size(), 2); ++l1) + { +@@ -178,6 +178,11 @@ + int k2 = mouseX - x; + int l2 = mouseY - y; + ++ String tooltip = net.minecraftforge.fml.client.FMLClientHandler.instance().enhanceServerListEntry(this, this.field_148301_e, x, listWidth, y, k2, l2); ++ if (tooltip != null) ++ { ++ this.field_148303_c.func_146793_a(tooltip); ++ } else + if (k2 >= listWidth - 15 && k2 <= listWidth - 5 && l2 >= 0 && l2 <= 8) + { + this.field_148303_c.func_146793_a(s1); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch new file mode 100644 index 000000000..fa2823869 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch @@ -0,0 +1,127 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java ++++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java +@@ -24,6 +24,9 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.input.Mouse; ++import java.util.LinkedList; ++import java.util.List; ++import net.minecraftforge.common.AchievementPage; + + @SideOnly(Side.CLIENT) + public class GuiAchievements extends GuiScreen implements IProgressMeter +@@ -50,6 +53,10 @@ + private boolean loadingAchievements = true; + private static final String __OBFID = "CL_00000722"; + ++ private int currentPage = -1; ++ private GuiButton button; ++ private LinkedList minecraftAchievements = new LinkedList(); ++ + public GuiAchievements(GuiScreen p_i45026_1_, StatFileWriter p_i45026_2_) + { + this.parentScreen = p_i45026_1_; +@@ -58,6 +65,14 @@ + short short2 = 141; + this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.openInventory.displayColumn * 24 - short1 / 2 - 12); + this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.openInventory.displayRow * 24 - short2 / 2); ++ minecraftAchievements.clear(); ++ for (Object achievement : AchievementList.achievementList) ++ { ++ if (!AchievementPage.isAchievementInPages((Achievement)achievement)) ++ { ++ minecraftAchievements.add((Achievement)achievement); ++ } ++ } + } + + public void initGui() +@@ -65,6 +80,7 @@ + this.mc.getNetHandler().addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.REQUEST_STATS)); + this.buttonList.clear(); + this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, I18n.format("gui.done", new Object[0]))); ++ this.buttonList.add(button = new GuiButton(2, (width - field_146555_f) / 2 + 24, height / 2 + 74, 125, 20, AchievementPage.getTitle(currentPage))); + } + + protected void actionPerformed(GuiButton button) throws IOException +@@ -75,6 +91,16 @@ + { + this.mc.displayGuiScreen(this.parentScreen); + } ++ ++ if (button.id == 2) ++ { ++ currentPage++; ++ if (currentPage >= AchievementPage.getAchievementPages().size()) ++ { ++ currentPage = -1; ++ } ++ this.button.displayString = AchievementPage.getTitle(currentPage); ++ } + } + } + +@@ -260,7 +286,9 @@ + GlStateManager.depthFunc(518); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)k1, (float)l1, -200.0F); +- GlStateManager.scale(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 0.0F); ++ // FIXES models rendering weirdly in the acheivements pane ++ // see https://github.com/MinecraftForge/MinecraftForge/commit/1b7ce7592caafb760ec93066184182ae0711e793#commitcomment-10512284 ++ GlStateManager.scale(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 1.0F); + GlStateManager.enableTexture2D(); + GlStateManager.disableLighting(); + GlStateManager.enableRescaleNormal(); +@@ -341,11 +369,12 @@ + int i4; + int l4; + +- for (i3 = 0; i3 < AchievementList.achievementList.size(); ++i3) ++ List achievementList = (currentPage == -1 ? minecraftAchievements : AchievementPage.getAchievementPage(currentPage).getAchievements()); ++ for (i3 = 0; i3 < achievementList.size(); ++i3) + { +- Achievement achievement1 = (Achievement)AchievementList.achievementList.get(i3); ++ Achievement achievement1 = achievementList.get(i3); + +- if (achievement1.parentAchievement != null) ++ if (achievement1.parentAchievement != null && achievementList.contains(achievement1.parentAchievement)) + { + j3 = achievement1.displayColumn * 24 - k + 11; + k3 = achievement1.displayRow * 24 - l + 11; +@@ -401,9 +430,9 @@ + int i5; + int j5; + +- for (k3 = 0; k3 < AchievementList.achievementList.size(); ++k3) ++ for (k3 = 0; k3 < achievementList.size(); ++k3) + { +- Achievement achievement2 = (Achievement)AchievementList.achievementList.get(k3); ++ Achievement achievement2 = (Achievement)achievementList.get(k3); + l4 = achievement2.displayColumn * 24 - k; + i5 = achievement2.displayRow * 24 - l; + +@@ -445,6 +474,7 @@ + + this.mc.getTextureManager().bindTexture(field_146561_C); + ++ GlStateManager.enableBlend(); // Forge: Specifically enable blend because it is needed here. And we fix Generic RenderItem's leakage of it. + if (achievement2.getSpecial()) + { + this.drawTexturedModalRect(l4 - 2, i5 - 2, 26, 202, 26, 26); +@@ -453,6 +483,7 @@ + { + this.drawTexturedModalRect(l4 - 2, i5 - 2, 0, 202, 26, 26); + } ++ GlStateManager.disableBlend(); //Forge: Cleanup states we set. + + if (!this.statFileWriter.canUnlockAchievement(achievement2)) + { +@@ -461,7 +492,7 @@ + this.itemRender.func_175039_a(false); + } + +- GlStateManager.enableLighting(); ++ GlStateManager.disableLighting(); //Forge: Make sure Lighting is disabled. Fixes MC-33065 + GlStateManager.enableCull(); + this.itemRender.renderItemAndEffectIntoGUI(achievement2.theItemStack, l4 + 3, i5 + 3); + GlStateManager.blendFunc(770, 771); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch new file mode 100644 index 000000000..2b81ff699 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiStats.java ++++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiStats.java +@@ -769,6 +769,7 @@ + super(mcIn, GuiStats.this.width, GuiStats.this.height, 32, GuiStats.this.height - 64, GuiStats.this.fontRendererObj.FONT_HEIGHT * 4); + this.setShowSelectionBox(false); + Iterator iterator = EntityList.entityEggs.values().iterator(); ++ iterator = com.google.common.collect.Iterators.concat(iterator, net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().values().iterator()); + + while (iterator.hasNext()) + { +@@ -806,7 +807,7 @@ + protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int p_180791_5_, int p_180791_6_) + { + EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)this.field_148222_l.get(entryID); +- String s = I18n.format("entity." + EntityList.getStringFromID(entityegginfo.spawnedID) + ".name", new Object[0]); ++ String s = I18n.format("entity." + entityegginfo.name + ".name", new Object[0]); + int k1 = GuiStats.this.field_146546_t.readStat(entityegginfo.field_151512_d); + int l1 = GuiStats.this.field_146546_t.readStat(entityegginfo.field_151513_e); + String s1 = I18n.format("stat.entityKills", new Object[] {Integer.valueOf(k1), s}); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch new file mode 100644 index 000000000..c72e0db72 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch @@ -0,0 +1,65 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java ++++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java +@@ -5,6 +5,7 @@ + import java.util.Iterator; + import java.util.Set; + import net.minecraft.client.Minecraft; ++import net.minecraft.client.gui.FontRenderer; + import net.minecraft.client.gui.GuiScreen; + import net.minecraft.client.renderer.GlStateManager; + import net.minecraft.client.renderer.OpenGlHelper; +@@ -178,8 +179,11 @@ + GlStateManager.translate(0.0F, 0.0F, 32.0F); + this.zLevel = 200.0F; + this.itemRender.zLevel = 200.0F; ++ FontRenderer font = null; ++ if (stack != null) font = stack.getItem().getFontRenderer(stack); ++ if (font == null) font = fontRendererObj; + this.itemRender.renderItemAndEffectIntoGUI(stack, x, y); +- this.itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, stack, x, y - (this.draggedStack == null ? 0 : 8), altText); ++ this.itemRender.renderItemOverlayIntoGUI(font, stack, x, y - (this.draggedStack == null ? 0 : 8), altText); + this.zLevel = 0.0F; + this.itemRender.zLevel = 0.0F; + } +@@ -240,13 +244,12 @@ + + if (itemstack == null) + { +- String s1 = slotIn.getSlotTexture(); ++ TextureAtlasSprite textureatlassprite = slotIn.getBackgroundSprite(); + +- if (s1 != null) ++ if (textureatlassprite != null) + { +- TextureAtlasSprite textureatlassprite = this.mc.getTextureMapBlocks().getAtlasSprite(s1); + GlStateManager.disableLighting(); +- this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); ++ this.mc.getTextureManager().bindTexture(slotIn.getBackgroundLocation()); + this.drawTexturedModalRect(i, j, textureatlassprite, 16, 16); + GlStateManager.enableLighting(); + flag1 = true; +@@ -465,6 +468,7 @@ + + protected void mouseReleased(int mouseX, int mouseY, int state) + { ++ super.mouseReleased(mouseX, mouseY, state); //Forge, Call parent to release buttons + Slot slot = this.getSlotAtPosition(mouseX, mouseY); + int l = this.guiLeft; + int i1 = this.guiTop; +@@ -698,4 +702,16 @@ + this.mc.thePlayer.closeScreen(); + } + } ++ ++ /* ======================================== FORGE START =====================================*/ ++ ++ /** ++ * Returns the slot that is currently displayed under the mouse. ++ */ ++ public Slot getSlotUnderMouse() ++ { ++ return this.theSlot; ++ } ++ ++ /* ======================================== FORGE END =====================================*/ + } diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch new file mode 100644 index 000000000..736edfcb9 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch @@ -0,0 +1,267 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java ++++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java +@@ -49,6 +49,8 @@ + private boolean field_147057_D; + private CreativeCrafting field_147059_E; + private static final String __OBFID = "CL_00000752"; ++ private static int tabPage = 0; ++ private int maxPages = 0; + + public GuiContainerCreative(EntityPlayer p_i1088_1_) + { +@@ -187,7 +189,7 @@ + return; + } + +- if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2)) ++ if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2) && ItemStack.areItemStackTagsEqual(itemstack1, itemstack2)) //Forge: Bugfix, Compare NBT data, allow for deletion of enchanted books, MC-12770 + { + if (clickedButton == 0) + { +@@ -262,6 +264,13 @@ + this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[i]); + this.field_147059_E = new CreativeCrafting(this.mc); + this.mc.thePlayer.inventoryContainer.addCraftingToCrafters(this.field_147059_E); ++ int tabCount = CreativeTabs.creativeTabArray.length; ++ if (tabCount > 12) ++ { ++ buttonList.add(new GuiButton(101, guiLeft, guiTop - 50, 20, 20, "<")); ++ buttonList.add(new GuiButton(102, guiLeft + xSize - 20, guiTop - 50, 20, 20, ">")); ++ maxPages = ((tabCount - 12) / 10) + 1; ++ } + } + else + { +@@ -283,7 +292,7 @@ + + protected void keyTyped(char typedChar, int keyCode) throws IOException + { +- if (selectedTabIndex != CreativeTabs.tabAllSearch.getTabIndex()) ++ if (!CreativeTabs.creativeTabArray[selectedTabIndex].hasSearchBar()) + { + if (GameSettings.isKeyDown(this.mc.gameSettings.keyBindChat)) + { +@@ -320,6 +329,15 @@ + { + GuiContainerCreative.ContainerCreative containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; + containercreative.itemList.clear(); ++ ++ CreativeTabs tab = CreativeTabs.creativeTabArray[selectedTabIndex]; ++ if (tab.hasSearchBar() && tab != CreativeTabs.tabAllSearch) ++ { ++ tab.displayAllReleventItems(containercreative.itemList); ++ updateFilteredItems(containercreative); ++ return; ++ } ++ + Iterator iterator = Item.itemRegistry.iterator(); + + while (iterator.hasNext()) +@@ -331,10 +349,17 @@ + item.getSubItems(item, (CreativeTabs)null, containercreative.itemList); + } + } ++ updateFilteredItems(containercreative); ++ } + ++ //split from above for custom search tabs ++ private void updateFilteredItems(GuiContainerCreative.ContainerCreative containercreative) ++ { ++ Iterator iterator; + Enchantment[] aenchantment = Enchantment.enchantmentsBookList; + int j = aenchantment.length; + ++ if (CreativeTabs.creativeTabArray[selectedTabIndex] != CreativeTabs.tabAllSearch) j = 0; //Forge: Don't add enchants to custom tabs. + for (int i = 0; i < j; ++i) + { + Enchantment enchantment = aenchantment[i]; +@@ -385,7 +410,7 @@ + { + CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; + +- if (creativetabs.drawInForegroundOfTab()) ++ if (creativetabs != null && creativetabs.drawInForegroundOfTab()) + { + GlStateManager.disableBlend(); + this.fontRendererObj.drawString(I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]), 8, 6, 4210752); +@@ -428,7 +453,7 @@ + { + CreativeTabs creativetabs = acreativetabs[k1]; + +- if (this.func_147049_a(creativetabs, l, i1)) ++ if (creativetabs != null && this.func_147049_a(creativetabs, l, i1)) + { + this.setCurrentCreativeTab(creativetabs); + return; +@@ -441,11 +466,13 @@ + + private boolean needsScrollBars() + { ++ if (CreativeTabs.creativeTabArray[selectedTabIndex] == null) return false; + return selectedTabIndex != CreativeTabs.tabInventory.getTabIndex() && CreativeTabs.creativeTabArray[selectedTabIndex].shouldHidePlayerInventory() && ((GuiContainerCreative.ContainerCreative)this.inventorySlots).func_148328_e(); + } + + private void setCurrentCreativeTab(CreativeTabs p_147050_1_) + { ++ if (p_147050_1_ == null) return; + int i = selectedTabIndex; + selectedTabIndex = p_147050_1_.getTabIndex(); + GuiContainerCreative.ContainerCreative containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; +@@ -514,12 +541,14 @@ + + if (this.searchField != null) + { +- if (p_147050_1_ == CreativeTabs.tabAllSearch) ++ if (p_147050_1_.hasSearchBar()) + { + this.searchField.setVisible(true); + this.searchField.setCanLoseFocus(false); + this.searchField.setFocused(true); + this.searchField.setText(""); ++ this.searchField.width = p_147050_1_.getSearchbarWidth(); ++ this.searchField.xPosition = this.guiLeft + (82 /*default left*/ + 89 /*default width*/) - this.searchField.width; + this.updateCreativeSearch(); + } + else +@@ -590,23 +619,45 @@ + + super.drawScreen(mouseX, mouseY, partialTicks); + CreativeTabs[] acreativetabs = CreativeTabs.creativeTabArray; +- int i2 = acreativetabs.length; ++ int start = tabPage * 10; ++ int i2 = Math.min(acreativetabs.length, ((tabPage + 1) * 10) + 2); ++ if (tabPage != 0) start += 2; ++ boolean rendered = false; + +- for (int j2 = 0; j2 < i2; ++j2) ++ for (int j2 = start; j2 < i2; ++j2) + { + CreativeTabs creativetabs = acreativetabs[j2]; + ++ if (creativetabs == null) continue; + if (this.renderCreativeInventoryHoveringText(creativetabs, mouseX, mouseY)) + { ++ rendered = true; + break; + } + } + ++ if (!rendered && renderCreativeInventoryHoveringText(CreativeTabs.tabAllSearch, mouseX, mouseY)) ++ { ++ renderCreativeInventoryHoveringText(CreativeTabs.tabInventory, mouseX, mouseY); ++ } ++ + if (this.field_147064_C != null && selectedTabIndex == CreativeTabs.tabInventory.getTabIndex() && this.isPointInRegion(this.field_147064_C.xDisplayPosition, this.field_147064_C.yDisplayPosition, 16, 16, mouseX, mouseY)) + { + this.drawCreativeTabHoveringText(I18n.format("inventory.binSlot", new Object[0]), mouseX, mouseY); + } + ++ if (maxPages != 0) ++ { ++ String page = String.format("%d / %d", tabPage + 1, maxPages + 1); ++ int width = fontRendererObj.getStringWidth(page); ++ GlStateManager.disableLighting(); ++ this.zLevel = 300.0F; ++ itemRender.zLevel = 300.0F; ++ fontRendererObj.drawString(page, guiLeft + (xSize / 2) - (width / 2), guiTop - 44, -1); ++ this.zLevel = 0.0F; ++ itemRender.zLevel = 0.0F; ++ } ++ + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableLighting(); + } +@@ -675,17 +726,36 @@ + int k = acreativetabs.length; + int l; + +- for (l = 0; l < k; ++l) ++ int start = tabPage * 10; ++ k = Math.min(acreativetabs.length, ((tabPage + 1) * 10 + 2)); ++ if (tabPage != 0) start += 2; ++ ++ for (l = start; l < k; ++l) + { + CreativeTabs creativetabs1 = acreativetabs[l]; + this.mc.getTextureManager().bindTexture(creativeInventoryTabs); + ++ if (creativetabs1 == null) continue; + if (creativetabs1.getTabIndex() != selectedTabIndex) + { + this.func_147051_a(creativetabs1); + } + } + ++ if (tabPage != 0) ++ { ++ if (creativetabs != CreativeTabs.tabAllSearch) ++ { ++ this.mc.getTextureManager().bindTexture(creativeInventoryTabs); ++ func_147051_a(CreativeTabs.tabAllSearch); ++ } ++ if (creativetabs != CreativeTabs.tabInventory) ++ { ++ this.mc.getTextureManager().bindTexture(creativeInventoryTabs); ++ func_147051_a(CreativeTabs.tabInventory); ++ } ++ } ++ + this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.getBackgroundImageName())); + this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); + this.searchField.drawTextBox(); +@@ -700,6 +770,14 @@ + this.drawTexturedModalRect(i1, k + (int)((float)(l - k - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15); + } + ++ if (creativetabs == null || creativetabs.getTabPage() != tabPage) ++ { ++ if (creativetabs != CreativeTabs.tabAllSearch && creativetabs != CreativeTabs.tabInventory) ++ { ++ return; ++ } ++ } ++ + this.func_147051_a(creativetabs); + + if (creativetabs == CreativeTabs.tabInventory) +@@ -710,6 +788,15 @@ + + protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_) + { ++ if (p_147049_1_.getTabPage() != tabPage) ++ { ++ if (p_147049_1_ != CreativeTabs.tabAllSearch && ++ p_147049_1_ != CreativeTabs.tabInventory) ++ { ++ return false; ++ } ++ } ++ + int k = p_147049_1_.getTabColumn(); + int l = 28 * k; + byte b0 = 0; +@@ -810,6 +897,8 @@ + } + + GlStateManager.disableLighting(); ++ GlStateManager.color(1F, 1F, 1F); //Forge: Reset color in case Items change it. ++ GlStateManager.enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border. + this.drawTexturedModalRect(l, i1, j, k, 28, b0); + this.zLevel = 100.0F; + this.itemRender.zLevel = 100.0F; +@@ -836,6 +925,15 @@ + { + this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter())); + } ++ ++ if (button.id == 101) ++ { ++ tabPage = Math.max(tabPage - 1, 0); ++ } ++ else if (button.id == 102) ++ { ++ tabPage = Math.min(tabPage + 1, maxPages); ++ } + } + + public int getSelectedTabIndex() diff --git a/patches/minecraft/net/minecraft/client/model/ModelBase.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/ModelBase.java.patch similarity index 90% rename from patches/minecraft/net/minecraft/client/model/ModelBase.java.patch rename to patches.mcp/minecraft/net/minecraft/client/model/ModelBase.java.patch index 04667710a..4f3c8aede 100644 --- a/patches/minecraft/net/minecraft/client/model/ModelBase.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/model/ModelBase.java.patch @@ -7,4 +7,4 @@ -@SideOnly(Side.CLIENT) public abstract class ModelBase { - public float field_78095_p; + public float swingProgress; diff --git a/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch similarity index 66% rename from patches/minecraft/net/minecraft/client/model/ModelBox.java.patch rename to patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch index 36bd887e5..ed3cab955 100644 --- a/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch @@ -7,12 +7,12 @@ -@SideOnly(Side.CLIENT) public class ModelBox { - private PositionTextureVertex[] field_78253_h; + private PositionTextureVertex[] vertexPositions; @@ -82,6 +81,7 @@ } } + @SideOnly(Side.CLIENT) - public void func_178780_a(WorldRenderer p_178780_1_, float p_178780_2_) + public void render(WorldRenderer p_178780_1_, float p_178780_2_) { - for (int i = 0; i < this.field_78254_i.length; ++i) + for (int i = 0; i < this.quadList.length; ++i) diff --git a/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/ModelRenderer.java.patch similarity index 57% rename from patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch rename to patches.mcp/minecraft/net/minecraft/client/model/ModelRenderer.java.patch index daaf765f9..737fdac2f 100644 --- a/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/model/ModelRenderer.java.patch @@ -7,36 +7,36 @@ -@SideOnly(Side.CLIENT) public class ModelRenderer { - public float field_78801_a; + public float textureWidth; @@ -110,6 +109,7 @@ - this.field_78798_e = p_78793_3_; + this.rotationPointZ = p_78793_3_; } + @SideOnly(Side.CLIENT) - public void func_78785_a(float p_78785_1_) + public void render(float p_78785_1_) { - if (!this.field_78807_k) + if (!this.isHidden) @@ -192,6 +192,7 @@ } } + @SideOnly(Side.CLIENT) - public void func_78791_b(float p_78791_1_) + public void renderWithRotation(float p_78791_1_) { - if (!this.field_78807_k) + if (!this.isHidden) @@ -227,6 +228,7 @@ } } + @SideOnly(Side.CLIENT) - public void func_78794_c(float p_78794_1_) + public void postRender(float p_78794_1_) { - if (!this.field_78807_k) + if (!this.isHidden) @@ -268,6 +270,7 @@ } } + @SideOnly(Side.CLIENT) - private void func_78788_d(float p_78788_1_) + private void compileDisplayList(float p_78788_1_) { - this.field_78811_r = GLAllocation.func_74526_a(1); + this.displayList = GLAllocation.generateDisplayLists(1); diff --git a/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch similarity index 92% rename from patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch rename to patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch index dbe66e303..c3d2571d6 100644 --- a/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch @@ -10,4 +10,4 @@ -@SideOnly(Side.CLIENT) public class PositionTextureVertex { - public Vec3 field_78243_a; + public Vec3 vector3D; diff --git a/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch similarity index 89% rename from patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch rename to patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch index 25d766877..54dcb21f4 100644 --- a/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch @@ -10,4 +10,4 @@ -@SideOnly(Side.CLIENT) public class TexturedQuad { - public PositionTextureVertex[] field_78239_a; + public PositionTextureVertex[] vertexPositions; diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch similarity index 56% rename from patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch rename to patches.mcp/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch index 0b34576b0..faf4f9779 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch @@ -1,10 +1,10 @@ --- ../src-base/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java +++ ../src-work/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java @@ -56,6 +56,7 @@ - Chunk chunk = new Chunk(this.field_73235_d, p_73158_1_, p_73158_2_); - this.field_73236_b.func_76163_a(ChunkCoordIntPair.func_77272_a(p_73158_1_, p_73158_2_), chunk); - this.field_73237_c.add(chunk); + Chunk chunk = new Chunk(this.worldObj, p_73158_1_, p_73158_2_); + this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_), chunk); + this.chunkListing.add(chunk); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk)); - chunk.func_177417_c(true); + chunk.setChunkLoaded(true); return chunk; } diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch new file mode 100644 index 000000000..74de972f3 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java ++++ ../src-work/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java +@@ -69,7 +69,7 @@ + inetaddress = InetAddress.getByName(ip); + GuiConnecting.this.networkManager = NetworkManager.provideLanClient(inetaddress, port); + GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen)); +- GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN)); ++ GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN, true)); + GuiConnecting.this.networkManager.sendPacket(new C00PacketLoginStart(GuiConnecting.this.mc.getSession().getProfile())); + } + catch (UnknownHostException unknownhostexception) diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch new file mode 100644 index 000000000..14f4f3c9b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch @@ -0,0 +1,69 @@ +--- ../src-base/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java ++++ ../src-work/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java +@@ -113,6 +113,12 @@ + } + } + ++ ItemStack stack = mc.thePlayer.getCurrentEquippedItem(); ++ if (stack != null && stack.getItem() != null && stack.getItem().onBlockStartBreak(stack, pos, mc.thePlayer)) ++ { ++ return false; ++ } ++ + if (this.currentGameType.isCreative() && this.mc.thePlayer.getHeldItem() != null && this.mc.thePlayer.getHeldItem().getItem() instanceof ItemSword) + { + return false; +@@ -130,7 +136,7 @@ + else + { + worldclient.playAuxSFX(2001, pos, Block.getStateId(iblockstate)); +- boolean flag = worldclient.setBlockToAir(pos); ++ boolean flag = block1.removedByPlayer(worldclient, pos, mc.thePlayer, false); + + if (flag) + { +@@ -360,11 +366,19 @@ + { + if (this.currentGameType != WorldSettings.GameType.SPECTATOR) + { ++ ++ if (p_178890_3_ != null && ++ p_178890_3_.getItem() != null && ++ p_178890_3_.getItem().onItemUseFirst(p_178890_3_, p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2)) ++ { ++ return true; ++ } ++ + IBlockState iblockstate = p_178890_2_.getBlockState(p_178890_4_); + +- if ((!p_178890_1_.isSneaking() || p_178890_1_.getHeldItem() == null) && iblockstate.getBlock().onBlockActivated(p_178890_2_, p_178890_4_, iblockstate, p_178890_1_, p_178890_5_, f, f1, f2)) ++ if ((!p_178890_1_.isSneaking() || p_178890_1_.getHeldItem() == null || p_178890_1_.getHeldItem().getItem().doesSneakBypassUse(p_178890_2_, p_178890_4_, p_178890_1_))) + { +- flag = true; ++ flag = iblockstate.getBlock().onBlockActivated(p_178890_2_, p_178890_4_, iblockstate, p_178890_1_, p_178890_5_, f, f1, f2); + } + + if (!flag && p_178890_3_ != null && p_178890_3_.getItem() instanceof ItemBlock) +@@ -397,7 +411,9 @@ + } + else + { +- return p_178890_3_.onItemUse(p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2); ++ if (!p_178890_3_.onItemUse(p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2)) return false; ++ if (p_178890_3_.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_178890_1_, p_178890_3_); ++ return true; + } + } + else +@@ -428,9 +444,10 @@ + { + playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = itemstack1; + +- if (itemstack1.stackSize == 0) ++ if (itemstack1.stackSize <= 0) + { + playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = null; ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(playerIn, itemstack1); + } + + return true; diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch new file mode 100644 index 000000000..bd5159cf2 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/client/multiplayer/WorldClient.java ++++ ../src-work/minecraft/net/minecraft/client/multiplayer/WorldClient.java +@@ -54,12 +54,13 @@ + super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), WorldProvider.getProviderForDimension(p_i45063_3_), p_i45063_5_, true); + this.sendQueue = p_i45063_1_; + this.getWorldInfo().setDifficulty(p_i45063_4_); +- this.setSpawnPoint(new BlockPos(8, 64, 8)); + this.provider.registerWorld(this); ++ this.setSpawnPoint(new BlockPos(8, 64, 8)); //Forge: Moved below registerWorld to prevent NPE in our redirect. + this.chunkProvider = this.createChunkProvider(); + this.mapStorage = new SaveDataMemoryStorage(); + this.calculateInitialSkylight(); + this.calculateInitialWeather(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(this)); + } + + public void tick() diff --git a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch new file mode 100644 index 000000000..c84d9a2d2 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java ++++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java +@@ -24,6 +24,7 @@ + + public void processHandshake(C00Handshake packetIn) + { ++ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return; + this.networkManager.setConnectionState(packetIn.getRequestedState()); + this.networkManager.setNetHandler(new NetHandlerLoginServer(this.mcServer, this.networkManager)); + } diff --git a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch new file mode 100644 index 000000000..e2dc0d668 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java ++++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java +@@ -92,7 +92,10 @@ + { + this.gameProfile = packetIn.getProfile(); + this.networkManager.setConnectionState(EnumConnectionState.PLAY); +- this.networkManager.setNetHandler(new NetHandlerPlayClient(this.mc, this.previousGuiScreen, this.networkManager, this.gameProfile)); ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlClientHandshake(this.networkManager); ++ NetHandlerPlayClient nhpc = new NetHandlerPlayClient(this.mc, this.previousGuiScreen, this.networkManager, this.gameProfile); ++ this.networkManager.setNetHandler(nhpc); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().setPlayClient(nhpc); + } + + public void onDisconnect(IChatComponent reason) diff --git a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch new file mode 100644 index 000000000..14bdf5825 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch @@ -0,0 +1,72 @@ +--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java ++++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java +@@ -247,7 +247,7 @@ + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + this.gameController.playerController = new PlayerControllerMP(this.gameController, this); +- this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler); ++ this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.get(getNetworkManager()).getOverrideDimension(packetIn), packetIn.getDifficulty(), this.gameController.mcProfiler); + this.gameController.gameSettings.difficulty = packetIn.getDifficulty(); + this.gameController.loadWorld(this.clientWorldController); + this.gameController.thePlayer.dimension = packetIn.getDimension(); +@@ -410,7 +410,8 @@ + public void handleSpawnExperienceOrb(S11PacketSpawnExperienceOrb packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); +- EntityXPOrb entityxporb = new EntityXPOrb(this.clientWorldController, (double)packetIn.func_148984_d(), (double)packetIn.func_148983_e(), (double)packetIn.func_148982_f(), packetIn.func_148986_g()); ++ EntityXPOrb entityxporb = new EntityXPOrb(this.clientWorldController, (double)packetIn.func_148984_d() / 32.0D, (double)packetIn.func_148983_e() / 32.0D, (double)packetIn.func_148982_f() / 32.0D, packetIn.func_148986_g()); ++ // FORGE: BugFix MC-12013 Wrong XP orb clientside spawn position + entityxporb.serverPosX = packetIn.func_148984_d(); + entityxporb.serverPosY = packetIn.func_148983_e(); + entityxporb.serverPosZ = packetIn.func_148982_f(); +@@ -754,14 +755,16 @@ + public void handleChat(S02PacketChat packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); ++ net.minecraft.util.IChatComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(packetIn.func_179841_c(), packetIn.func_148915_c()); ++ if (message == null) return; + + if (packetIn.func_179841_c() == 2) + { +- this.gameController.ingameGUI.func_175188_a(packetIn.func_148915_c(), false); ++ this.gameController.ingameGUI.func_175188_a(message, false); + } + else + { +- this.gameController.ingameGUI.getChatGUI().printChatMessage(packetIn.func_148915_c()); ++ this.gameController.ingameGUI.getChatGUI().printChatMessage(message); + } + } + +@@ -812,6 +815,11 @@ + float f = (float)(packetIn.func_149028_l() * 360) / 256.0F; + float f1 = (float)(packetIn.func_149030_m() * 360) / 256.0F; + EntityLivingBase entitylivingbase = (EntityLivingBase)EntityList.createEntityByID(packetIn.func_149025_e(), this.gameController.theWorld); ++ if (entitylivingbase == null) ++ { ++ net.minecraftforge.fml.common.FMLLog.info("Server attempted to spawn an unknown entity using ID: {0} at ({1}, {2}, {3}) Skipping!", packetIn.func_149025_e(), d0, d1, d2); ++ return; ++ } + entitylivingbase.serverPosX = packetIn.func_149023_f(); + entitylivingbase.serverPosY = packetIn.func_149034_g(); + entitylivingbase.serverPosZ = packetIn.func_149029_h(); +@@ -1137,6 +1145,10 @@ + { + tileentity.readFromNBT(packetIn.getNbtCompound()); + } ++ else ++ { ++ tileentity.onDataPacket(netManager, packetIn); ++ } + } + } + +@@ -1346,7 +1358,7 @@ + + if (entity instanceof EntityLivingBase) + { +- PotionEffect potioneffect = new PotionEffect(packetIn.func_149427_e(), packetIn.func_180755_e(), packetIn.func_149428_f(), false, packetIn.func_179707_f()); ++ PotionEffect potioneffect = new PotionEffect(packetIn.func_149427_e() & 0xff, packetIn.func_180755_e(), packetIn.func_149428_f(), false, packetIn.func_179707_f()); + potioneffect.setPotionDurationMax(packetIn.func_149429_c()); + ((EntityLivingBase)entity).addPotionEffect(potioneffect); + } diff --git a/patches/minecraft/net/minecraft/client/network/OldServerPinger.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/OldServerPinger.java.patch similarity index 52% rename from patches/minecraft/net/minecraft/client/network/OldServerPinger.java.patch rename to patches.mcp/minecraft/net/minecraft/client/network/OldServerPinger.java.patch index f85c95d04..5072ca555 100644 --- a/patches/minecraft/net/minecraft/client/network/OldServerPinger.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/network/OldServerPinger.java.patch @@ -1,10 +1,10 @@ --- ../src-base/minecraft/net/minecraft/client/network/OldServerPinger.java +++ ../src-work/minecraft/net/minecraft/client/network/OldServerPinger.java @@ -148,6 +148,7 @@ - p_147224_1_.func_147407_a((String)null); + server.setBase64EncodedIconData((String)null); } -+ net.minecraftforge.fml.client.FMLClientHandler.instance().bindServerListData(p_147224_1_, serverstatusresponse); - this.field_175092_e = Minecraft.func_71386_F(); - networkmanager.func_179290_a(new C01PacketPing(this.field_175092_e)); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().bindServerListData(server, serverstatusresponse); + this.field_175092_e = Minecraft.getSystemTime(); + networkmanager.sendPacket(new C01PacketPing(this.field_175092_e)); this.field_147403_d = true; diff --git a/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch similarity index 51% rename from patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch rename to patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch index e8fb36209..5d8ab91b2 100644 --- a/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch @@ -2,20 +2,20 @@ +++ ../src-work/minecraft/net/minecraft/client/particle/EffectRenderer.java @@ -135,6 +135,7 @@ - public void func_78873_a(EntityFX p_78873_1_) + public void addEffect(EntityFX p_78873_1_) { + if (p_78873_1_ == null) return; //Forge: Prevent modders from being bad and adding nulls causing untraceable NPEs. - int i = p_78873_1_.func_70537_b(); + int i = p_78873_1_.getFXLayer(); int j = p_78873_1_.func_174838_j() != 1.0F ? 0 : 1; @@ -361,7 +362,7 @@ public void func_180533_a(BlockPos p_180533_1_, IBlockState p_180533_2_) { -- if (p_180533_2_.func_177230_c().func_149688_o() != Material.field_151579_a) -+ if (!p_180533_2_.func_177230_c().isAir(field_78878_a, p_180533_1_) && !p_180533_2_.func_177230_c().addDestroyEffects(field_78878_a, p_180533_1_, this)) +- if (p_180533_2_.getBlock().getMaterial() != Material.air) ++ if (!p_180533_2_.getBlock().isAir(worldObj, p_180533_1_) && !p_180533_2_.getBlock().addDestroyEffects(worldObj, p_180533_1_, this)) { - p_180533_2_ = p_180533_2_.func_177230_c().func_176221_a(p_180533_2_, this.field_78878_a, p_180533_1_); + p_180533_2_ = p_180533_2_.getBlock().getActualState(p_180533_2_, this.worldObj, p_180533_1_); byte b0 = 4; @@ -467,4 +468,13 @@ @@ -24,10 +24,10 @@ + + public void addBlockHitEffects(BlockPos pos, net.minecraft.util.MovingObjectPosition target) + { -+ Block block = field_78878_a.func_180495_p(pos).func_177230_c(); -+ if (block != null && !block.addHitEffects(field_78878_a, target, this)) ++ Block block = worldObj.getBlockState(pos).getBlock(); ++ if (block != null && !block.addHitEffects(worldObj, target, this)) + { -+ func_180532_a(pos, target.field_178784_b); ++ addBlockHitEffects(pos, target.sideHit); + } + } } diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch similarity index 57% rename from patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch index e52101bb6..5890b09e3 100644 --- a/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch @@ -2,17 +2,17 @@ +++ ../src-work/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java @@ -24,7 +24,7 @@ { - private BlockModelShapes field_175028_a; - private final GameSettings field_175026_b; -- private final BlockModelRenderer field_175027_c = new BlockModelRenderer(); -+ private final BlockModelRenderer field_175027_c = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(); - private final ChestRenderer field_175024_d = new ChestRenderer(); - private final BlockFluidRenderer field_175025_e = new BlockFluidRenderer(); + private BlockModelShapes blockModelShapes; + private final GameSettings gameSettings; +- private final BlockModelRenderer blockModelRenderer = new BlockModelRenderer(); ++ private final BlockModelRenderer blockModelRenderer = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(); + private final ChestRenderer chestRenderer = new ChestRenderer(); + private final BlockFluidRenderer fluidRenderer = new BlockFluidRenderer(); private static final String __OBFID = "CL_00002520"; @@ -49,6 +49,24 @@ { - p_175020_1_ = block.func_176221_a(p_175020_1_, p_175020_4_, p_175020_2_); - IBakedModel ibakedmodel = this.field_175028_a.func_178125_b(p_175020_1_); + p_175020_1_ = block.getActualState(p_175020_1_, p_175020_4_, p_175020_2_); + IBakedModel ibakedmodel = this.blockModelShapes.getModelForState(p_175020_1_); + + if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartBlockModel) + { @@ -24,18 +24,18 @@ + net.minecraftforge.client.ForgeHooksClient.setRenderLayer(layer); + + IBakedModel targetLayer = ((net.minecraftforge.client.model.ISmartBlockModel)ibakedmodel).handleBlockState(extendedState); -+ IBakedModel damageModel = (new SimpleBakedModel.Builder(targetLayer, p_175020_3_)).func_177645_b(); -+ this.field_175027_c.func_178259_a(p_175020_4_, damageModel, p_175020_1_, p_175020_2_, Tessellator.func_178181_a().func_178180_c()); ++ IBakedModel damageModel = (new SimpleBakedModel.Builder(targetLayer, p_175020_3_)).makeBakedModel(); ++ this.blockModelRenderer.renderModel(p_175020_4_, damageModel, p_175020_1_, p_175020_2_, Tessellator.getInstance().getWorldRenderer()); + } + } + return; + } + - IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(ibakedmodel, p_175020_3_)).func_177645_b(); - this.field_175027_c.func_178259_a(p_175020_4_, ibakedmodel1, p_175020_1_, p_175020_2_, Tessellator.func_178181_a().func_178180_c()); + IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(ibakedmodel, p_175020_3_)).makeBakedModel(); + this.blockModelRenderer.renderModel(p_175020_4_, ibakedmodel1, p_175020_1_, p_175020_2_, Tessellator.getInstance().getWorldRenderer()); } @@ -129,6 +147,12 @@ - ibakedmodel = ((WeightedBakedModel)ibakedmodel).func_177564_a(MathHelper.func_180186_a(p_175022_3_)); + ibakedmodel = ((WeightedBakedModel)ibakedmodel).getAlternativeModel(MathHelper.getPositionRandom(p_175022_3_)); } + if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartBlockModel) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch new file mode 100644 index 000000000..24ac4e8e1 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -0,0 +1,176 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/EntityRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/EntityRenderer.java +@@ -403,7 +403,7 @@ + + if (d3 < d2 || d2 == 0.0D) + { +- if (entity1 == entity.ridingEntity) ++ if (entity1 == entity.ridingEntity && !entity.canRiderInteract()) + { + if (d2 == 0.0D) + { +@@ -556,14 +556,8 @@ + { + BlockPos blockpos = new BlockPos(entity); + IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); +- Block block = iblockstate.getBlock(); ++ net.minecraftforge.client.ForgeHooksClient.orientBedCamera(this.mc.theWorld, blockpos, iblockstate, entity); + +- if (block == Blocks.bed) +- { +- int j = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex(); +- GlStateManager.rotate((float)(j * 90), 0.0F, 1.0F, 0.0F); +- } +- + GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_78467_1_ + 180.0F, 0.0F, -1.0F, 0.0F); + GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_78467_1_, -1.0F, 0.0F, 0.0F); + } +@@ -630,17 +624,20 @@ + + if (!this.mc.gameSettings.debugCamEnable) + { +- GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_78467_1_, 1.0F, 0.0F, 0.0F); +- ++ float yaw = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_78467_1_ + 180.0F; ++ float pitch = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_78467_1_; ++ float roll = 0.0F; + if (entity instanceof EntityAnimal) + { + EntityAnimal entityanimal = (EntityAnimal)entity; +- GlStateManager.rotate(entityanimal.prevRotationYawHead + (entityanimal.rotationYawHead - entityanimal.prevRotationYawHead) * p_78467_1_ + 180.0F, 0.0F, 1.0F, 0.0F); ++ yaw = entityanimal.prevRotationYawHead + (entityanimal.rotationYawHead - entityanimal.prevRotationYawHead) * p_78467_1_ + 180.0F; + } +- else +- { +- GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_78467_1_ + 180.0F, 0.0F, 1.0F, 0.0F); +- } ++ Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, p_78467_1_); ++ net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup event = new net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup(this, entity, block, p_78467_1_, yaw, pitch, roll); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ GlStateManager.rotate(event.roll, 0.0F, 0.0F, 1.0F); ++ GlStateManager.rotate(event.pitch, 1.0F, 0.0F, 0.0F); ++ GlStateManager.rotate(event.yaw, 0.0F, 1.0F, 0.0F); + } + + GlStateManager.translate(0.0F, -f1, 0.0F); +@@ -1081,7 +1078,7 @@ + + try + { +- this.mc.currentScreen.drawScreen(l, i1, partialTicks); ++ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.mc.currentScreen, l, i1, partialTicks); + } + catch (Throwable throwable) + { +@@ -1145,7 +1142,7 @@ + + if (this.mc.playerController.getCurrentGameType() == WorldSettings.GameType.SPECTATOR) + { +- flag = block.hasTileEntity() && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory; ++ flag = block.hasTileEntity(this.mc.theWorld.getBlockState(blockpos)) && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory; + } + else + { +@@ -1296,7 +1293,9 @@ + GlStateManager.pushMatrix(); + RenderHelper.enableStandardItemLighting(); + this.mc.mcProfiler.endStartSection("entities"); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); + renderglobal.renderEntities(entity, frustum, partialTicks); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); + RenderHelper.disableStandardItemLighting(); + this.disableLightmap(); + GlStateManager.matrixMode(5888); +@@ -1308,6 +1307,7 @@ + entityplayer = (EntityPlayer)entity; + GlStateManager.disableAlpha(); + this.mc.mcProfiler.endStartSection("outline"); ++ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, entityplayer.getHeldItem(), partialTicks)) + renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); + GlStateManager.enableAlpha(); + } +@@ -1321,6 +1321,7 @@ + entityplayer = (EntityPlayer)entity; + GlStateManager.disableAlpha(); + this.mc.mcProfiler.endStartSection("outline"); ++ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, entityplayer.getHeldItem(), partialTicks)) + renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); + GlStateManager.enableAlpha(); + } +@@ -1373,6 +1374,16 @@ + renderglobal.renderBlockLayer(EnumWorldBlockLayer.TRANSLUCENT, (double)partialTicks, pass, entity); + } + ++ if (!this.debugView) //Only render if render pass 0 happens as well. ++ { ++ RenderHelper.enableStandardItemLighting(); ++ this.mc.mcProfiler.endStartSection("entities"); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(1); ++ renderglobal.renderEntities(entity, frustum, partialTicks); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(-1); ++ RenderHelper.disableStandardItemLighting(); ++ } ++ + GlStateManager.shadeModel(7424); + GlStateManager.depthMask(true); + GlStateManager.enableCull(); +@@ -1385,8 +1396,12 @@ + this.renderCloudsCheck(renderglobal, partialTicks, pass); + } + ++ this.mc.mcProfiler.endStartSection("forge_render_last"); ++ net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(renderglobal, partialTicks); ++ + this.mc.mcProfiler.endStartSection("hand"); + ++ if (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(renderglobal, partialTicks, pass)) + if (this.renderHand) + { + GlStateManager.clear(256); +@@ -1498,6 +1513,13 @@ + + protected void renderRainSnow(float partialTicks) + { ++ net.minecraftforge.client.IRenderHandler renderer = this.mc.theWorld.provider.getWeatherRenderer(); ++ if (renderer != null) ++ { ++ renderer.render(partialTicks, this.mc.theWorld, mc); ++ return; ++ } ++ + float f1 = this.mc.theWorld.getRainStrength(partialTicks); + + if (f1 > 0.0F) +@@ -1835,6 +1857,13 @@ + this.fogColorBlue = f8; + } + ++ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, entity, block, partialTicks, this.fogColorRed, this.fogColorGreen, this.fogColorBlue); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ ++ this.fogColorRed = event.red; ++ this.fogColorGreen = event.green; ++ this.fogColorBlue = event.blue; ++ + GlStateManager.clearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F); + } + +@@ -1854,6 +1883,10 @@ + Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); + float f1; + ++ float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, entity, block, partialTicks, 0.1F); ++ if (hook >= 0) ++ GlStateManager.setFogDensity(hook); ++ else + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.blindness)) + { + f1 = 5.0F; +@@ -1931,6 +1964,7 @@ + GlStateManager.setFogStart(f1 * 0.05F); + GlStateManager.setFogEnd(Math.min(f1, 192.0F) * 0.5F); + } ++ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, entity, block, partialTicks, p_78468_1_, f1); + } + + GlStateManager.enableColorMaterial(); diff --git a/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch similarity index 57% rename from patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch index 63e6a2672..c9a499ab0 100644 --- a/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java @@ -83,6 +83,8 @@ - this.func_73729_b(i + 6, j + 7, 0 + l % 8 * 18, 198 + l / 8 * 18, 18, 18); + this.drawTexturedModalRect(i + 6, j + 7, 0 + l % 8 * 18, 198 + l / 8 * 18, 18, 18); } -+ potion.renderInventoryEffect(i, j, potioneffect, field_146297_k); ++ potion.renderInventoryEffect(i, j, potioneffect, mc); + if (!potion.shouldRenderInvText(potioneffect)) continue; - String s1 = I18n.func_135052_a(potion.func_76393_a(), new Object[0]); + String s1 = I18n.format(potion.getName(), new Object[0]); - if (potioneffect.func_76458_c() == 1) + if (potioneffect.getAmplifier() == 1) diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch similarity index 77% rename from patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch index dbe123b28..a71a73e5c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch @@ -6,9 +6,9 @@ + if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartItemModel) + { -+ ibakedmodel = ((net.minecraftforge.client.model.ISmartItemModel)ibakedmodel).handleItemState(p_178089_1_); ++ ibakedmodel = ((net.minecraftforge.client.model.ISmartItemModel)ibakedmodel).handleItemState(stack); + } + if (ibakedmodel == null) { - ibakedmodel = this.field_178090_d.func_174951_a(); + ibakedmodel = this.modelManager.getMissingModel(); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch new file mode 100644 index 000000000..cee99ddff --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -0,0 +1,65 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/ItemRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/ItemRenderer.java +@@ -308,7 +308,7 @@ + + if (this.itemToRender != null) + { +- if (this.itemToRender.getItem() == Items.filled_map) ++ if (this.itemToRender.getItem() instanceof net.minecraft.item.ItemMap) + { + this.func_178097_a(entityplayersp, f3, f1, f2); + } +@@ -359,7 +359,8 @@ + + if (this.mc.thePlayer.isEntityInsideOpaqueBlock()) + { +- IBlockState iblockstate = this.mc.theWorld.getBlockState(new BlockPos(this.mc.thePlayer)); ++ BlockPos blockpos = new BlockPos(this.mc.thePlayer); ++ IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); + EntityPlayerSP entityplayersp = this.mc.thePlayer; + + for (int i = 0; i < 8; ++i) +@@ -367,7 +368,7 @@ + double d0 = entityplayersp.posX + (double)(((float)((i >> 0) % 2) - 0.5F) * entityplayersp.width * 0.8F); + double d1 = entityplayersp.posY + (double)(((float)((i >> 1) % 2) - 0.5F) * 0.1F); + double d2 = entityplayersp.posZ + (double)(((float)((i >> 2) % 2) - 0.5F) * entityplayersp.width * 0.8F); +- BlockPos blockpos = new BlockPos(d0, d1 + (double)entityplayersp.getEyeHeight(), d2); ++ blockpos = new BlockPos(d0, d1 + (double)entityplayersp.getEyeHeight(), d2); + IBlockState iblockstate1 = this.mc.theWorld.getBlockState(blockpos); + + if (iblockstate1.getBlock().isVisuallyOpaque()) +@@ -378,6 +379,7 @@ + + if (iblockstate.getBlock().getRenderType() != -1) + { ++ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(mc.thePlayer, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, blockpos)) + this.func_178108_a(p_78447_1_, this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate)); + } + } +@@ -386,11 +388,13 @@ + { + if (this.mc.thePlayer.isInsideOfMaterial(Material.water)) + { ++ if (!net.minecraftforge.event.ForgeEventFactory.renderWaterOverlay(mc.thePlayer, p_78447_1_)) + this.renderWaterOverlayTexture(p_78447_1_); + } + + if (this.mc.thePlayer.isBurning()) + { ++ if (!net.minecraftforge.event.ForgeEventFactory.renderFireOverlay(mc.thePlayer, p_78447_1_)) + this.renderFireInFirstPerson(p_78447_1_); + } + } +@@ -507,6 +511,12 @@ + { + if (!this.itemToRender.getIsItemStackEqual(itemstack)) + { ++ if (!this.itemToRender.getItem().shouldCauseReequipAnimation(this.itemToRender, itemstack, equippedItemSlot != entityplayersp.inventory.currentItem)) ++ { ++ this.itemToRender = itemstack; ++ this.equippedItemSlot = entityplayersp.inventory.currentItem; ++ return; ++ } + flag = true; + } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch similarity index 75% rename from patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch index c10aed1e5..22beb0e0f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch @@ -1,14 +1,14 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/OpenGlHelper.java +++ ../src-work/minecraft/net/minecraft/client/renderer/OpenGlHelper.java @@ -78,6 +78,10 @@ - public static int field_148826_e; + public static int GL_STATIC_DRAW; private static final String __OBFID = "CL_00001179"; + /* Stores the last values sent into setLightmapTextureCoords */ + public static float lastBrightnessX = 0.0f; + public static float lastBrightnessY = 0.0f; + - public static void func_77474_a() + public static void initializeTextures() { ContextCapabilities contextcapabilities = GLContext.getCapabilities(); @@ -813,6 +817,12 @@ @@ -16,11 +16,11 @@ GL13.glMultiTexCoord2f(p_77475_0_, p_77475_1_, p_77475_2_); } + -+ if (p_77475_0_ == field_77476_b) ++ if (p_77475_0_ == lightmapTexUnit) + { + lastBrightnessX = p_77475_1_; + lastBrightnessY = p_77475_2_; + } } - public static void func_148821_a(int p_148821_0_, int p_148821_1_, int p_148821_2_, int p_148821_3_) + public static void glBlendFunc(int p_148821_0_, int p_148821_1_, int p_148821_2_, int p_148821_3_) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch new file mode 100644 index 000000000..15582220b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch @@ -0,0 +1,134 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/RenderGlobal.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/RenderGlobal.java +@@ -517,8 +517,10 @@ + + public void renderEntities(Entity p_180446_1_, ICamera p_180446_2_, float partialTicks) + { ++ int pass = net.minecraftforge.client.MinecraftForgeClient.getRenderPass(); + if (this.renderEntitiesStartupCounter > 0) + { ++ if (pass > 0) return; + --this.renderEntitiesStartupCounter; + } + else +@@ -529,9 +531,12 @@ + this.theWorld.theProfiler.startSection("prepare"); + TileEntityRendererDispatcher.instance.cacheActiveRenderInfo(this.theWorld, this.mc.getTextureManager(), this.mc.fontRendererObj, this.mc.getRenderViewEntity(), partialTicks); + this.renderManager.cacheActiveRenderInfo(this.theWorld, this.mc.fontRendererObj, this.mc.getRenderViewEntity(), this.mc.pointedEntity, this.mc.gameSettings, partialTicks); ++ if (pass == 0) // no indentation to shrink patch ++ { + this.countEntitiesTotal = 0; + this.countEntitiesRendered = 0; + this.countEntitiesHidden = 0; ++ } + Entity entity1 = this.mc.getRenderViewEntity(); + double d3 = entity1.lastTickPosX + (entity1.posX - entity1.lastTickPosX) * (double)partialTicks; + double d4 = entity1.lastTickPosY + (entity1.posY - entity1.lastTickPosY) * (double)partialTicks; +@@ -543,13 +548,17 @@ + this.mc.entityRenderer.enableLightmap(); + this.theWorld.theProfiler.endStartSection("global"); + List list = this.theWorld.getLoadedEntityList(); ++ if (pass == 0) // no indentation to shrink patch ++ { + this.countEntitiesTotal = list.size(); ++ } + int i; + Entity entity2; + + for (i = 0; i < this.theWorld.weatherEffects.size(); ++i) + { + entity2 = (Entity)this.theWorld.weatherEffects.get(i); ++ if (!entity2.shouldRenderInPass(pass)) continue; + ++this.countEntitiesRendered; + + if (entity2.isInRangeToRender3d(d0, d1, d2)) +@@ -571,6 +580,7 @@ + for (i = 0; i < list.size(); ++i) + { + entity2 = (Entity)list.get(i); ++ if (!entity2.shouldRenderInPass(pass)) continue; + boolean flag = this.mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping(); + boolean flag1 = entity2.isInRangeToRender3d(d0, d1, d2) && (entity2.ignoreFrustumCheck || p_180446_2_.isBoundingBoxInFrustum(entity2.getEntityBoundingBox()) || entity2.riddenByEntity == this.mc.thePlayer) && entity2 instanceof EntityPlayer; + +@@ -605,6 +615,7 @@ + while (iterator2.hasNext()) + { + Entity entity3 = (Entity)iterator2.next(); ++ if (!entity3.shouldRenderInPass(pass)) continue; + boolean flag2 = this.renderManager.shouldRender(entity3, p_180446_2_, d0, d1, d2) || entity3.riddenByEntity == this.mc.thePlayer; + + if (flag2) +@@ -640,6 +651,7 @@ + while (iterator1.hasNext()) + { + tileentity = (TileEntity)iterator1.next(); ++ if (!tileentity.shouldRenderInPass(pass) || !p_180446_2_.isBoundingBoxInFrustum(tileentity.getRenderBoundingBox())) continue; + TileEntityRendererDispatcher.instance.renderTileEntity(tileentity, partialTicks, -1); + } + } +@@ -671,7 +683,7 @@ + + Block block = this.theWorld.getBlockState(blockpos).getBlock(); + +- if (tileentity != null && (block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull)) ++ if (tileentity != null && tileentity.shouldRenderInPass(pass) && tileentity.canRenderBreaking() && p_180446_2_.isBoundingBoxInFrustum(tileentity.getRenderBoundingBox())) + { + TileEntityRendererDispatcher.instance.renderTileEntity(tileentity, partialTicks, destroyblockprogress.getPartialBlockDamage()); + } +@@ -1151,6 +1163,12 @@ + + public void renderSky(float partialTicks, int pass) + { ++ net.minecraftforge.client.IRenderHandler renderer = this.theWorld.provider.getSkyRenderer(); ++ if (renderer != null) ++ { ++ renderer.render(partialTicks, theWorld, mc); ++ return; ++ } + if (this.mc.theWorld.provider.getDimensionId() == 1) + { + this.renderSkyEnd(); +@@ -1381,6 +1399,12 @@ + + public void renderClouds(float p_180447_1_, int p_180447_2_) + { ++ net.minecraftforge.client.IRenderHandler renderer = this.mc.theWorld.provider.getCloudRenderer(); ++ if (renderer != null) ++ { ++ renderer.render(p_180447_1_, this.mc.theWorld, mc); ++ return; ++ } + if (this.mc.theWorld.provider.isSurfaceWorld()) + { + if (this.mc.gameSettings.fancyGraphics) +@@ -1805,8 +1829,11 @@ + double d4 = (double)blockpos.getY() - d1; + double d5 = (double)blockpos.getZ() - d2; + Block block = this.theWorld.getBlockState(blockpos).getBlock(); ++ TileEntity te = this.theWorld.getTileEntity(blockpos); ++ boolean hasBreak = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull; ++ if (!hasBreak) hasBreak = te != null && te.canRenderBreaking(); + +- if (!(block instanceof BlockChest) && !(block instanceof BlockEnderChest) && !(block instanceof BlockSign) && !(block instanceof BlockSkull)) ++ if (!hasBreak) + { + if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) + { +@@ -1949,13 +1976,16 @@ + if (recordName != null) + { + ItemRecord itemrecord = ItemRecord.getRecord(recordName); ++ ResourceLocation resource = null; + + if (itemrecord != null) + { + this.mc.ingameGUI.setRecordPlayingMessage(itemrecord.getRecordNameLocal()); ++ resource = itemrecord.getRecordResource(recordName); + } + +- PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(new ResourceLocation(recordName), (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ()); ++ if (resource == null) resource = new ResourceLocation(recordName); ++ PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(resource, (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ()); + this.mapSoundPositions.put(blockPosIn, positionedsoundrecord); + this.mc.getSoundHandler().playSound(positionedsoundrecord); + } diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch similarity index 70% rename from patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch index 6d9a3666c..2f3b084ad 100644 --- a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch @@ -6,9 +6,9 @@ + public void checkAndGrow() + { -+ if (this.field_179008_i >= this.field_179009_s - this.field_179011_q.func_177338_f()) ++ if (this.rawBufferIndex >= this.bufferSize - this.vertexFormat.getNextOffset()) + { -+ this.func_178983_e(2097152); ++ this.growBuffer(2097152); + } + } + diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch similarity index 65% rename from patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch index bf398cbd5..548fa5d6d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch @@ -6,65 +6,65 @@ { + // moved to VertexFormatElement.preDraw vertexformatelement = (VertexFormatElement)iterator.next(); -- enumusage = vertexformatelement.func_177375_c(); -- k = vertexformatelement.func_177367_b().func_177397_c(); -- int l = vertexformatelement.func_177369_e(); +- enumusage = vertexformatelement.getUsage(); +- k = vertexformatelement.getType().getGlConstant(); +- int l = vertexformatelement.getIndex(); - -- switch (WorldVertexBufferUploader.SwitchEnumUsage.field_178958_a[enumusage.ordinal()]) +- switch (WorldVertexBufferUploader.SwitchEnumUsage.VALUES[enumusage.ordinal()]) - { - case 1: -- bytebuffer.position(vertexformatelement.func_177373_a()); -- GL11.glVertexPointer(vertexformatelement.func_177370_d(), k, j, bytebuffer); +- bytebuffer.position(vertexformatelement.getOffset()); +- GL11.glVertexPointer(vertexformatelement.getElementCount(), k, j, bytebuffer); - GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); - break; - case 2: -- bytebuffer.position(vertexformatelement.func_177373_a()); -- OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a + l); -- GL11.glTexCoordPointer(vertexformatelement.func_177370_d(), k, j, bytebuffer); +- bytebuffer.position(vertexformatelement.getOffset()); +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + l); +- GL11.glTexCoordPointer(vertexformatelement.getElementCount(), k, j, bytebuffer); - GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); -- OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a); +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); - break; - case 3: -- bytebuffer.position(vertexformatelement.func_177373_a()); -- GL11.glColorPointer(vertexformatelement.func_177370_d(), k, j, bytebuffer); +- bytebuffer.position(vertexformatelement.getOffset()); +- GL11.glColorPointer(vertexformatelement.getElementCount(), k, j, bytebuffer); - GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); - break; - case 4: -- bytebuffer.position(vertexformatelement.func_177373_a()); +- bytebuffer.position(vertexformatelement.getOffset()); - GL11.glNormalPointer(k, j, bytebuffer); - GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY); - } -+ vertexformatelement.func_177375_c().preDraw(vertexformatelement, j, bytebuffer); ++ vertexformatelement.getUsage().preDraw(vertexformatelement, j, bytebuffer); } - GL11.glDrawArrays(p_178177_1_.func_178979_i(), 0, p_178177_1_.func_178989_h()); + GL11.glDrawArrays(p_178177_1_.getDrawMode(), 0, p_178177_1_.getVertexCount()); @@ -65,27 +39,9 @@ while (iterator.hasNext()) { + // moved to VertexFormatElement.postDraw vertexformatelement = (VertexFormatElement)iterator.next(); -- enumusage = vertexformatelement.func_177375_c(); -- k = vertexformatelement.func_177369_e(); +- enumusage = vertexformatelement.getUsage(); +- k = vertexformatelement.getIndex(); - -- switch (WorldVertexBufferUploader.SwitchEnumUsage.field_178958_a[enumusage.ordinal()]) +- switch (WorldVertexBufferUploader.SwitchEnumUsage.VALUES[enumusage.ordinal()]) - { - case 1: - GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); - break; - case 2: -- OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a + k); +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + k); - GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); -- OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a); +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); - break; - case 3: - GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); -- GlStateManager.func_179117_G(); +- GlStateManager.resetColor(); - break; - case 4: - GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); - } -+ vertexformatelement.func_177375_c().postDraw(vertexformatelement, j, bytebuffer); ++ vertexformatelement.getUsage().postDraw(vertexformatelement, j, bytebuffer); } } diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch similarity index 81% rename from patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch index 656fce0df..97dc4cd38 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch @@ -8,6 +8,6 @@ +public class BakedQuad implements net.minecraftforge.client.model.pipeline.IVertexProducer { + @Override public void pipe(net.minecraftforge.client.model.pipeline.IVertexConsumer consumer) { net.minecraftforge.client.model.pipeline.LightUtil.putBakedQuad(consumer, this); } - protected final int[] field_178215_a; - protected final int field_178213_b; - protected final EnumFacing field_178214_c; + protected final int[] vertexData; + protected final int tintIndex; + protected final EnumFacing face; diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch new file mode 100644 index 000000000..530af67af --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch @@ -0,0 +1,68 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java +@@ -22,6 +22,11 @@ + + public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) + { ++ return makeBakedQuad(posFrom, posTo, face, sprite, facing, (net.minecraftforge.client.model.ITransformation)modelRotationIn, partRotation, uvLocked, shade); ++ } ++ ++ public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) ++ { + int[] aint = this.makeQuadVertexData(face, sprite, facing, this.getPositionsDiv16(posFrom, posTo), modelRotationIn, partRotation, uvLocked, shade); + EnumFacing enumfacing1 = getFacingFromVertexData(aint); + +@@ -35,11 +40,17 @@ + this.func_178408_a(aint, enumfacing1); + } + ++ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing1); + return new BakedQuad(aint, face.tintIndex, enumfacing1); + } + + private int[] makeQuadVertexData(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, ModelRotation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean shade) + { ++ return makeQuadVertexData(p_178405_1_, p_178405_2_, p_178405_3_, p_178405_4_, (net.minecraftforge.client.model.ITransformation)p_178405_5_, p_178405_6_, p_178405_7_, shade); ++ } ++ ++ private int[] makeQuadVertexData(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, net.minecraftforge.client.model.ITransformation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean shade) ++ { + int[] aint = new int[28]; + + for (int i = 0; i < 4; ++i) +@@ -90,7 +101,12 @@ + + private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) + { +- EnumFacing enumfacing1 = modelRotationIn.rotateFace(facing); ++ fillVertexData(faceData, vertexIndex, facing, partFace, p_178402_5_, sprite, (net.minecraftforge.client.model.ITransformation)modelRotationIn, partRotation, uvLocked, shade); ++ } ++ ++ private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) ++ { ++ EnumFacing enumfacing1 = modelRotationIn.rotate(facing); + int j = shade ? this.getFaceShadeColor(enumfacing1) : -1; + EnumFaceDirection.VertexInformation vertexinformation = EnumFaceDirection.getFacing(facing).func_179025_a(vertexIndex); + Vector3d vector3d = new Vector3d((double)p_178402_5_[vertexinformation.field_179184_a], (double)p_178402_5_[vertexinformation.field_179182_b], (double)p_178402_5_[vertexinformation.field_179183_c]); +@@ -156,14 +172,19 @@ + + public int rotateVertex(Vector3d position, EnumFacing facing, int vertexIndex, ModelRotation modelRotationIn, boolean uvLocked) + { ++ return rotateVertex(position, facing, vertexIndex, (net.minecraftforge.client.model.ITransformation)modelRotationIn, uvLocked); ++ } ++ ++ public int rotateVertex(Vector3d position, EnumFacing facing, int vertexIndex, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) ++ { + if (modelRotationIn == ModelRotation.X0_Y0) + { + return vertexIndex; + } + else + { +- this.rotateScale(position, new Vector3d(0.5D, 0.5D, 0.5D), modelRotationIn.getMatrix4d(), new Vector3d(1.0D, 1.0D, 1.0D)); +- return modelRotationIn.rotateVertex(facing, vertexIndex); ++ net.minecraftforge.client.ForgeHooksClient.transform(position, modelRotationIn.getMatrix()); ++ return modelRotationIn.rotate(facing, vertexIndex); + } + } + diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch similarity index 67% rename from patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch index 48a2d8d09..5641c8a60 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch @@ -11,4 +11,4 @@ +@Deprecated public class ItemCameraTransforms { - public static final ItemCameraTransforms field_178357_a = new ItemCameraTransforms(ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a); + public static final ItemCameraTransforms DEFAULT = new ItemCameraTransforms(ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT); diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch similarity index 77% rename from patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch index ef42bfbc9..81410fc8c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch @@ -13,6 +13,6 @@ +public class ItemTransformVec3f implements net.minecraftforge.client.model.IModelState { + public net.minecraftforge.client.model.TRSRTransformation apply(net.minecraftforge.client.model.IModelPart part) { return new net.minecraftforge.client.model.TRSRTransformation(this); } - 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 final Vector3f field_178365_c; + public static final ItemTransformVec3f DEFAULT = new ItemTransformVec3f(new Vector3f(), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F)); + public final Vector3f rotation; + public final Vector3f translation; diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch similarity index 53% rename from patches/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch index 3e878fba9..63ac31ca9 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch @@ -2,28 +2,28 @@ +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java @@ -32,7 +32,7 @@ - public static ModelBlockDefinition func_178331_a(Reader p_178331_0_) + public static ModelBlockDefinition parseFromReader(Reader p_178331_0_) { -- return (ModelBlockDefinition)field_178333_a.fromJson(p_178331_0_, ModelBlockDefinition.class); -+ return net.minecraftforge.client.model.BlockStateLoader.load(p_178331_0_, field_178333_a); +- return (ModelBlockDefinition)GSON.fromJson(p_178331_0_, ModelBlockDefinition.class); ++ return net.minecraftforge.client.model.BlockStateLoader.load(p_178331_0_, GSON); } public ModelBlockDefinition(Collection p_i46221_1_) @@ -178,11 +178,17 @@ - return this.field_178437_a; + return this.modelLocation; } + @Deprecated - public ModelRotation func_178432_b() + public ModelRotation getRotation() { - return this.field_178435_b; + return this.modelRotation; } + public net.minecraftforge.client.model.IModelState getState() + { -+ return this.field_178435_b; ++ return this.modelRotation; + } + - public boolean func_178433_c() + public boolean isUvLocked() { - return this.field_178436_c; + return this.uvLock; diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch new file mode 100644 index 000000000..543153388 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java +@@ -40,7 +40,7 @@ + } + else + { +- s = this.property.getName((Comparable)linkedhashmap.remove(this.property)); ++ s = String.format("%s:%s", ((ResourceLocation)Block.blockRegistry.getNameForObject(p_178132_1_.getBlock())).getResourceDomain(), this.property.getName((Comparable)linkedhashmap.remove(this.property))); + } + + if (this.suffix != null) diff --git a/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch similarity index 75% rename from patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch index 4de9b1458..b176e3567 100644 --- a/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch @@ -4,33 +4,33 @@ return; } -- regionrendercache = new RegionRenderCache(this.field_178588_d, blockpos.func_177982_a(-1, -1, -1), blockpos1.func_177982_a(1, 1, 1), 1); -+ regionrendercache = createRegionRenderCache(this.field_178588_d, blockpos.func_177982_a(-1, -1, -1), blockpos1.func_177982_a(1, 1, 1), 1); - p_178581_4_.func_178543_a(compiledchunk); +- regionrendercache = new RegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1); ++ regionrendercache = createRegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1); + p_178581_4_.setCompiledChunk(compiledchunk); } finally @@ -150,7 +150,7 @@ visgraph.func_178606_a(mutableblockpos); } -- if (block.func_149716_u()) +- if (block.hasTileEntity()) + if (block.hasTileEntity(iblockstate)) { - TileEntity tileentity = regionrendercache.func_175625_s(new BlockPos(mutableblockpos)); + TileEntity tileentity = regionrendercache.getTileEntity(new BlockPos(mutableblockpos)); @@ -160,7 +160,9 @@ } } -- EnumWorldBlockLayer enumworldblocklayer1 = block.func_180664_k(); +- EnumWorldBlockLayer enumworldblocklayer1 = block.getBlockLayer(); + for(EnumWorldBlockLayer enumworldblocklayer1 : EnumWorldBlockLayer.values()) { + if(!block.canRenderInLayer(enumworldblocklayer1)) continue; + net.minecraftforge.client.ForgeHooksClient.setRenderLayer(enumworldblocklayer1); int i = enumworldblocklayer1.ordinal(); - if (block.func_149645_b() != -1) + if (block.getRenderType() != -1) @@ -178,6 +180,7 @@ - compiledchunk.func_178486_a(enumworldblocklayer1); + compiledchunk.setLayerUsed(enumworldblocklayer1); } } + } @@ -39,7 +39,7 @@ EnumWorldBlockLayer[] aenumworldblocklayer = EnumWorldBlockLayer.values(); @@ -374,4 +377,24 @@ { - return this.field_178593_n; + return this.needsUpdate; } + + /* ======================================== FORGE START =====================================*/ diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch similarity index 63% rename from patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch index ce3002981..35faeffcb 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch @@ -1,12 +1,12 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java @@ -42,7 +42,7 @@ - boolean flag = p_177077_9_.func_177556_c(); + boolean flag = p_177077_9_.isGui3d(); int i = this.func_177078_a(itemstack); float f1 = 0.25F; -- float f2 = MathHelper.func_76126_a(((float)p_177077_1_.func_174872_o() + p_177077_8_) / 10.0F + p_177077_1_.field_70290_d) * 0.1F + 0.1F; -+ float f2 = shouldBob() ? MathHelper.func_76126_a(((float)p_177077_1_.func_174872_o() + p_177077_8_) / 10.0F + p_177077_1_.field_70290_d) * 0.1F + 0.1F : 0.0F; - GlStateManager.func_179109_b((float)p_177077_2_, (float)p_177077_4_ + f2 + 0.25F, (float)p_177077_6_); +- float f2 = MathHelper.sin(((float)p_177077_1_.getAge() + p_177077_8_) / 10.0F + p_177077_1_.hoverStart) * 0.1F + 0.1F; ++ float f2 = shouldBob() ? MathHelper.sin(((float)p_177077_1_.getAge() + p_177077_8_) / 10.0F + p_177077_1_.hoverStart) * 0.1F + 0.1F : 0.0F; + GlStateManager.translate((float)p_177077_2_, (float)p_177077_4_ + f2 + 0.25F, (float)p_177077_6_); float f3; @@ -129,6 +129,14 @@ @@ -19,14 +19,14 @@ + float f2 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; + float f3 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; + float f4 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; -+ GlStateManager.func_179109_b(f2, f3, 0); ++ GlStateManager.translate(f2, f3, 0); + } - this.field_177080_a.func_180454_a(itemstack, ibakedmodel); - GlStateManager.func_179109_b(0.0F, 0.0F, 0.046875F); + this.field_177080_a.renderItem(itemstack, ibakedmodel); + GlStateManager.translate(0.0F, 0.0F, 0.046875F); } @@ -161,4 +169,25 @@ { - this.func_177075_a((EntityItem)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); + this.func_177075_a((EntityItem)entity, x, y, z, p_76986_8_, partialTicks); } + + /*==================================== FORGE START ===========================================*/ diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch new file mode 100644 index 000000000..715166828 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch @@ -0,0 +1,128 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderItem.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderItem.java +@@ -83,7 +83,7 @@ + public RenderItem(TextureManager textureManager, ModelManager modelManager) + { + this.textureManager = textureManager; +- this.itemModelMesher = new ItemModelMesher(modelManager); ++ this.itemModelMesher = new net.minecraftforge.client.ItemModelMesherForge(modelManager); + this.registerItems(); + } + +@@ -222,7 +222,7 @@ + BakedQuad bakedquad; + int j; + +- for (Iterator iterator = quads.iterator(); iterator.hasNext(); this.renderQuad(renderer, bakedquad, j)) ++ for (Iterator iterator = quads.iterator(); iterator.hasNext(); net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(renderer, bakedquad, j)) + { + bakedquad = (BakedQuad)iterator.next(); + j = color; +@@ -302,6 +302,10 @@ + modelresourcelocation = new ModelResourceLocation("bow_pulling_0", "inventory"); + } + } ++ else ++ { ++ modelresourcelocation = item.getModel(stack, entityplayer, entityplayer.getItemInUseCount()); ++ } + + if (modelresourcelocation != null) + { +@@ -314,6 +318,11 @@ + + protected void applyTransform(ItemTransformVec3f transform) + { ++ applyVanillaTransform(transform); ++ } ++ ++ public static void applyVanillaTransform(ItemTransformVec3f transform) ++ { + if (transform != ItemTransformVec3f.DEFAULT) + { + GlStateManager.translate(transform.translation.x + debugItemOffsetX, transform.translation.y + debugItemOffsetY, transform.translation.z + debugItemOffsetZ); +@@ -335,23 +344,7 @@ + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.pushMatrix(); + +- switch (RenderItem.SwitchTransformType.TRANSFORM_LOOKUP[cameraTransformType.ordinal()]) +- { +- case 1: +- default: +- break; +- case 2: +- this.applyTransform(model.getItemCameraTransforms().thirdPerson); +- break; +- case 3: +- this.applyTransform(model.getItemCameraTransforms().firstPerson); +- break; +- case 4: +- this.applyTransform(model.getItemCameraTransforms().head); +- break; +- case 5: +- this.applyTransform(model.getItemCameraTransforms().gui); +- } ++ model = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(model, cameraTransformType); + + this.renderItem(stack, model); + GlStateManager.popMatrix(); +@@ -374,7 +367,7 @@ + GlStateManager.blendFunc(770, 771); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.setupGuiTransform(x, y, ibakedmodel.isGui3d()); +- this.applyTransform(ibakedmodel.getItemCameraTransforms().gui); ++ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GUI); + this.renderItem(stack, ibakedmodel); + GlStateManager.disableAlpha(); + GlStateManager.disableRescaleNormal(); +@@ -485,10 +478,11 @@ + GlStateManager.enableDepth(); + } + +- if (stack.isItemDamaged()) ++ if (stack.getItem().showDurabilityBar(stack)) + { +- int j1 = (int)Math.round(13.0D - (double)stack.getItemDamage() * 13.0D / (double)stack.getMaxDamage()); +- int k = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage()); ++ double health = stack.getItem().getDurabilityForDisplay(stack); ++ int j1 = (int)Math.round(13.0D - health * 13.0D); ++ int k = (int)Math.round(255.0D - health * 255.0D); + GlStateManager.disableLighting(); + GlStateManager.disableDepth(); + GlStateManager.disableTexture2D(); +@@ -501,7 +495,7 @@ + this.drawRect(worldrenderer, xPosition + 2, yPosition + 13, 13, 2, 0); + this.drawRect(worldrenderer, xPosition + 2, yPosition + 13, 12, 1, i1); + this.drawRect(worldrenderer, xPosition + 2, yPosition + 13, j1, 1, l); +- GlStateManager.enableBlend(); ++ //GlStateManager.enableBlend(); // Forge: Disable Bled because it screws with a lot of things down the line. + GlStateManager.enableAlpha(); + GlStateManager.enableTexture2D(); + GlStateManager.enableLighting(); +@@ -1072,12 +1066,26 @@ + this.registerBlock(Blocks.brown_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "brown_mushroom_block"); + this.registerBlock(Blocks.red_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "red_mushroom_block"); + this.registerBlock(Blocks.dragon_egg, "dragon_egg"); ++ net.minecraftforge.client.model.ModelLoader.onRegisterItems(this.itemModelMesher); + } + + public void onResourceManagerReload(IResourceManager resourceManager) + { + this.itemModelMesher.rebuildCache(); + } ++ /*==================================== FORGE START ===========================================* / ++ private static RenderItem instance; ++ /** ++ * Returns a single lazy loaded instance of RenderItem, for use in mods who ++ * don't care about the interaction of other objects on the current state of the RenderItem they are using. ++ * @return A global instance of RenderItem ++ * / ++ public static RenderItem getInstance() ++ { ++ if (instance == null) instance = new RenderItem(); ++ return instance; ++ } ++ /*==================================== FORGE END =============================================*/ + + @SideOnly(Side.CLIENT) + diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch new file mode 100644 index 000000000..7513d3e08 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch @@ -0,0 +1,25 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java +@@ -193,6 +193,10 @@ + this.skinMap.put("default", this.field_178637_m); + this.skinMap.put("slim", new RenderPlayer(this, true)); + } ++ ++ public Map getSkinMap() { ++ return (Map) java.util.Collections.unmodifiableMap(skinMap); ++ } + + public void setRenderPosition(double p_178628_1_, double p_178628_3_, double p_178628_5_) + { +@@ -241,9 +245,9 @@ + IBlockState iblockstate = worldIn.getBlockState(new BlockPos(p_180597_3_)); + Block block = iblockstate.getBlock(); + +- if (block == Blocks.bed) ++ if (block.isBed(worldIn, new BlockPos(p_180597_3_), (EntityLivingBase)p_180597_3_)) + { +- int i = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex(); ++ int i = block.getBedDirection(worldIn, new BlockPos(p_180597_3_)).getHorizontalIndex(); + this.playerViewY = (float)(i * 90 + 180); + this.playerViewX = 0.0F; + } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch similarity index 81% rename from patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch index 73c21a8cb..5d1296a17 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch @@ -5,12 +5,12 @@ public void func_180596_a(AbstractClientPlayer p_180596_1_, double p_180596_2_, double p_180596_4_, double p_180596_6_, float p_180596_8_, float p_180596_9_) { + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(p_180596_1_, this, p_180596_9_, p_180596_2_, p_180596_4_, p_180596_6_))) return; - if (!p_180596_1_.func_175144_cb() || this.field_76990_c.field_78734_h == p_180596_1_) + if (!p_180596_1_.isUser() || this.renderManager.livingPlayer == p_180596_1_) { double d3 = p_180596_4_; @@ -65,6 +66,7 @@ this.func_177137_d(p_180596_1_); - super.func_76986_a((EntityLivingBase)p_180596_1_, p_180596_2_, d3, p_180596_6_, p_180596_8_, p_180596_9_); + super.doRender((EntityLivingBase)p_180596_1_, p_180596_2_, d3, p_180596_6_, p_180596_8_, p_180596_9_); } + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(p_180596_1_, this, p_180596_9_, p_180596_2_, p_180596_4_, p_180596_6_)); } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch similarity index 65% rename from patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch index 899e6b69b..3b71964a4 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch @@ -2,10 +2,10 @@ +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java @@ -48,7 +48,7 @@ case 4: - return field_110906_m; + return butcherVillagerTextures; default: -- return field_110903_f; -+ return net.minecraftforge.fml.common.registry.VillagerRegistry.getVillagerSkin(p_110775_1_.func_70946_n(), field_110903_f); +- return villagerTextures; ++ return net.minecraftforge.fml.common.registry.VillagerRegistry.getVillagerSkin(entity.getProfession(), villagerTextures); } } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch similarity index 52% rename from patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch index 8ec1b5cbc..f151beeef 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java @@ -40,6 +40,9 @@ - protected boolean field_177098_i = false; + protected boolean renderOutlines = false; private static final String __OBFID = "CL_00001012"; + public static float NAME_TAG_RANGE = 64.0f; @@ -12,30 +12,30 @@ super(p_i46156_1_); @@ -83,6 +86,7 @@ - public void func_76986_a(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) + public void doRender(EntityLivingBase entity, double x, double y, double z, float p_76986_8_, float partialTicks) { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(p_76986_1_, this, p_76986_2_, p_76986_4_, p_76986_6_))) return; - GlStateManager.func_179094_E(); - GlStateManager.func_179129_p(); - this.field_77045_g.field_78095_p = this.func_77040_d(p_76986_1_, p_76986_9_); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(entity, this, x, y, z))) return; + GlStateManager.pushMatrix(); + GlStateManager.disableCull(); + this.mainModel.swingProgress = this.getSwingProgress(entity, partialTicks); @@ -193,6 +197,7 @@ { - super.func_76986_a(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); + super.doRender(entity, x, y, z, p_76986_8_, partialTicks); } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post(p_76986_1_, this, p_76986_2_, p_76986_4_, p_76986_6_)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post(entity, this, x, y, z)); } protected boolean func_177088_c(EntityLivingBase p_177088_1_) @@ -472,10 +477,11 @@ - public void func_77033_b(EntityLivingBase p_77033_1_, double p_77033_2_, double p_77033_4_, double p_77033_6_) + public void passSpecialRender(EntityLivingBase p_77033_1_, double p_77033_2_, double p_77033_4_, double p_77033_6_) { + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre(p_77033_1_, this, p_77033_2_, p_77033_4_, p_77033_6_))) return; - if (this.func_110813_b(p_77033_1_)) + if (this.canRenderName(p_77033_1_)) { - double d3 = p_77033_1_.func_70068_e(this.field_76990_c.field_78734_h); -- float f = p_77033_1_.func_70093_af() ? 32.0F : 64.0F; -+ float f = p_77033_1_.func_70093_af() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE; + double d3 = p_77033_1_.getDistanceSqToEntity(this.renderManager.livingPlayer); +- float f = p_77033_1_.isSneaking() ? 32.0F : 64.0F; ++ float f = p_77033_1_.isSneaking() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE; if (d3 < (double)(f * f)) { @@ -46,4 +46,4 @@ + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Post(p_77033_1_, this, p_77033_2_, p_77033_4_, p_77033_6_)); } - protected boolean func_110813_b(EntityLivingBase p_110813_1_) + protected boolean canRenderName(EntityLivingBase targetEntity) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch similarity index 62% rename from patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch index 18df6de02..bfa7ac052 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch @@ -2,40 +2,40 @@ +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java @@ -56,31 +56,32 @@ ModelBase modelbase = this.func_177175_a(p_177182_9_); - modelbase.func_178686_a(this.field_177190_a.func_177087_b()); - modelbase.func_78086_a(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_4_); + modelbase.setModelAttributes(this.field_177190_a.getMainModel()); + modelbase.setLivingAnimations(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_4_); + modelbase = net.minecraftforge.client.ForgeHooksClient.getArmorModel(p_177182_1_, itemstack, p_177182_9_, modelbase); this.func_177179_a(modelbase, p_177182_9_); boolean flag = this.func_177180_b(p_177182_9_); -- this.field_177190_a.func_110776_a(this.func_177181_a(itemarmor, flag)); -+ this.field_177190_a.func_110776_a(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, null)); +- this.field_177190_a.bindTexture(this.getArmorResource(itemarmor, flag)); ++ this.field_177190_a.bindTexture(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, null)); -- switch (LayerArmorBase.SwitchArmorMaterial.field_178747_a[itemarmor.func_82812_d().ordinal()]) +- switch (LayerArmorBase.SwitchArmorMaterial.field_178747_a[itemarmor.getArmorMaterial().ordinal()]) { - case 1: -- int j = itemarmor.func_82814_b(itemstack); -+ int j = itemarmor.func_82814_b(itemstack); +- int j = itemarmor.getColor(itemstack); ++ int j = itemarmor.getColor(itemstack); + if (j != -1) //Allow this for anything, not only cloth. + { float f7 = (float)(j >> 16 & 255) / 255.0F; float f8 = (float)(j >> 8 & 255) / 255.0F; float f9 = (float)(j & 255) / 255.0F; - GlStateManager.func_179131_c(this.field_177184_f * f7, this.field_177185_g * f8, this.field_177192_h * f9, this.field_177187_e); - modelbase.func_78088_a(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); -- this.field_177190_a.func_110776_a(this.func_177178_a(itemarmor, flag, "overlay")); + GlStateManager.color(this.field_177184_f * f7, this.field_177185_g * f8, this.field_177192_h * f9, this.field_177187_e); + modelbase.render(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); +- this.field_177190_a.bindTexture(this.getArmorResource(itemarmor, flag, "overlay")); - case 2: - case 3: - case 4: - case 5: -+ this.field_177190_a.func_110776_a(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, "overlay")); ++ this.field_177190_a.bindTexture(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, "overlay")); + } + { // Non-cloth - GlStateManager.func_179131_c(this.field_177184_f, this.field_177185_g, this.field_177192_h, this.field_177187_e); - modelbase.func_78088_a(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); + GlStateManager.color(this.field_177184_f, this.field_177185_g, this.field_177192_h, this.field_177187_e); + modelbase.render(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); - default: + } + { // Default, Why is this a switch? there were no breaks. - if (!this.field_177193_i && itemstack.func_77948_v()) + if (!this.field_177193_i && itemstack.isItemEnchanted()) { this.func_177183_a(p_177182_1_, modelbase, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); } @@ -44,19 +44,19 @@ } } @@ -135,11 +136,13 @@ - GlStateManager.func_179084_k(); + GlStateManager.disableBlend(); } + @Deprecated //Use the more sensitive version getArmorResource below - private ResourceLocation func_177181_a(ItemArmor p_177181_1_, boolean p_177181_2_) + private ResourceLocation getArmorResource(ItemArmor p_177181_1_, boolean p_177181_2_) { - return this.func_177178_a(p_177181_1_, p_177181_2_, (String)null); + return this.getArmorResource(p_177181_1_, p_177181_2_, (String)null); } + @Deprecated //Use the more sensitive version getArmorResource below - private ResourceLocation func_177178_a(ItemArmor p_177178_1_, boolean p_177178_2_, String p_177178_3_) + private ResourceLocation getArmorResource(ItemArmor p_177178_1_, boolean p_177178_2_, String p_177178_3_) { - String s1 = String.format("textures/models/armor/%s_layer_%d%s.png", new Object[] {p_177178_1_.func_82812_d().func_179242_c(), Integer.valueOf(p_177178_2_ ? 2 : 1), p_177178_3_ == null ? "" : String.format("_%s", new Object[]{p_177178_3_})}); + String s1 = String.format("textures/models/armor/%s_layer_%d%s.png", new Object[] {p_177178_1_.getArmorMaterial().getName(), Integer.valueOf(p_177178_2_ ? 2 : 1), p_177178_3_ == null ? "" : String.format("_%s", new Object[]{p_177178_3_})}); @@ -158,6 +161,42 @@ protected abstract void func_177179_a(ModelBase p_177179_1_, int p_177179_2_); @@ -73,8 +73,8 @@ + */ + public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, int slot, String type) + { -+ ItemArmor item = (ItemArmor)stack.func_77973_b(); -+ String texture = ((ItemArmor)stack.func_77973_b()).func_82812_d().func_179242_c(); ++ ItemArmor item = (ItemArmor)stack.getItem(); ++ String texture = ((ItemArmor)stack.getItem()).getArmorMaterial().getName(); + String domain = "minecraft"; + int idx = texture.indexOf(':'); + if (idx != -1) diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch similarity index 58% rename from patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch index 564cdfb40..fe1185a58 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch @@ -1,9 +1,9 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/texture/Stitcher.java +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/Stitcher.java @@ -60,6 +60,7 @@ - public void func_94305_f() + public void doStitch() { - Stitcher.Holder[] aholder = (Stitcher.Holder[])this.field_94319_a.toArray(new Stitcher.Holder[this.field_94319_a.size()]); + Stitcher.Holder[] aholder = (Stitcher.Holder[])this.setStitchHolders.toArray(new Stitcher.Holder[this.setStitchHolders.size()]); + net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", aholder.length); Arrays.sort(aholder); Stitcher.Holder[] aholder1 = aholder; @@ -12,11 +12,11 @@ for (int j = 0; j < i; ++j) { Stitcher.Holder holder = aholder1[j]; -+ bar.step(holder.func_98150_a().func_94215_i()); ++ bar.step(holder.getAtlasSprite().getIconName()); - if (!this.func_94310_b(holder)) + if (!this.allocateSlot(holder)) { - String s = String.format("Unable to fit: %s - size: %dx%d - Maybe try a lowerresolution resourcepack?", new Object[] {holder.func_98150_a().func_94215_i(), Integer.valueOf(holder.func_98150_a().func_94211_a()), Integer.valueOf(holder.func_98150_a().func_94216_b())}); + String s = String.format("Unable to fit: %s - size: %dx%d - Maybe try a lowerresolution resourcepack?", new Object[] {holder.getAtlasSprite().getIconName(), Integer.valueOf(holder.getAtlasSprite().getIconWidth()), Integer.valueOf(holder.getAtlasSprite().getIconHeight())}); + net.minecraftforge.fml.common.FMLLog.info(s); + for (Stitcher.Holder h : aholder) + net.minecraftforge.fml.common.FMLLog.info(" %s", h); @@ -24,19 +24,19 @@ } } @@ -80,6 +85,7 @@ - this.field_94318_c = MathHelper.func_151236_b(this.field_94318_c); - this.field_94315_d = MathHelper.func_151236_b(this.field_94315_d); + this.currentWidth = MathHelper.roundUpToPowerOfTwo(this.currentWidth); + this.currentHeight = MathHelper.roundUpToPowerOfTwo(this.currentHeight); } + net.minecraftforge.fml.common.ProgressManager.pop(bar); } - public List func_94309_g() + public List getStichSlots() @@ -273,7 +279,7 @@ 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_98151_a.func_94215_i() + '}'; +- return "Holder{width=" + this.width + ", height=" + this.height + '}'; ++ return "Holder{width=" + this.width + ", height=" + this.height + ", name=" + this.theTexture.getIconName() + '}'; } public int compareTo(Stitcher.Holder p_compareTo_1_) diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch similarity index 76% rename from patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch index 8b755ed75..88f5b1c6f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch @@ -2,7 +2,7 @@ +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java @@ -410,4 +410,30 @@ { - return "TextureAtlasSprite{name=\'" + this.field_110984_i + '\'' + ", frameCount=" + this.field_110976_a.size() + ", rotated=" + this.field_130222_e + ", x=" + this.field_110975_c + ", y=" + this.field_110974_d + ", height=" + this.field_130224_d + ", width=" + this.field_130223_c + ", u0=" + this.field_110979_l + ", u1=" + this.field_110980_m + ", v0=" + this.field_110977_n + ", v1=" + this.field_110978_o + '}'; + return "TextureAtlasSprite{name=\'" + this.iconName + '\'' + ", frameCount=" + this.framesTextureData.size() + ", rotated=" + this.rotated + ", x=" + this.originX + ", y=" + this.originY + ", height=" + this.height + ", width=" + this.width + ", u0=" + this.minU + ", u1=" + this.maxU + ", v0=" + this.minV + ", v1=" + this.maxV + '}'; } + + /*===================================== FORGE START =====================================*/ diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch similarity index 63% rename from patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch index 727f57e75..d51da4fc9 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch @@ -2,16 +2,16 @@ +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureManager.java @@ -143,12 +143,15 @@ - public void func_110549_a(IResourceManager p_110549_1_) + public void onResourceManagerReload(IResourceManager resourceManager) { -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Reloading Texture Manager", this.field_110585_a.keySet().size(), true); - Iterator iterator = this.field_110585_a.entrySet().iterator(); ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Reloading Texture Manager", this.mapTextureObjects.keySet().size(), true); + Iterator iterator = this.mapTextureObjects.entrySet().iterator(); while (iterator.hasNext()) { Entry entry = (Entry)iterator.next(); + bar.step(entry.getKey().toString()); - this.func_110579_a((ResourceLocation)entry.getKey(), (ITextureObject)entry.getValue()); + this.loadTexture((ResourceLocation)entry.getKey(), (ITextureObject)entry.getValue()); } + net.minecraftforge.fml.common.ProgressManager.pop(bar); } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch similarity index 60% rename from patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index 1aec43664..93a0cefb4 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -5,12 +5,12 @@ public class TextureMap extends AbstractTexture implements ITickableTextureObject { + private static final boolean ENABLE_SKIP = Boolean.parseBoolean(System.getProperty("fml.skipFirstTextureLoad", "true")); - private static final Logger field_147635_d = LogManager.getLogger(); - public static final ResourceLocation field_174945_f = new ResourceLocation("missingno"); - public static final ResourceLocation field_110575_b = new ResourceLocation("textures/atlas/blocks.png"); + private static final Logger logger = LogManager.getLogger(); + public static final ResourceLocation LOCATION_MISSING_TEXTURE = new ResourceLocation("missingno"); + public static final ResourceLocation locationBlocksTexture = new ResourceLocation("textures/atlas/blocks.png"); @@ -40,6 +41,7 @@ - private int field_147636_j; - private final TextureAtlasSprite field_94249_f; + private int mipmapLevels; + private final TextureAtlasSprite missingImage; private static final String __OBFID = "CL_00001058"; + private boolean skipFirst = false; @@ -18,9 +18,9 @@ { @@ -48,12 +50,23 @@ - public TextureMap(String p_i46100_1_, IIconCreator p_i46100_2_) + public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn) { -+ this(p_i46100_1_, p_i46100_2_, false); ++ this(p_i46100_1_, iconCreatorIn, false); + } + + public TextureMap(String p_i46100_1_, boolean skipFirst) @@ -30,91 +30,90 @@ + + public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn, boolean skipFirst) + { - this.field_94258_i = Lists.newArrayList(); - this.field_110574_e = Maps.newHashMap(); - this.field_94252_e = Maps.newHashMap(); - this.field_94249_f = new TextureAtlasSprite("missingno"); - this.field_94254_c = p_i46100_1_; -- this.field_174946_m = p_i46100_2_; -+ this.field_174946_m = iconCreatorIn; + this.listAnimatedSprites = Lists.newArrayList(); + this.mapRegisteredSprites = Maps.newHashMap(); + this.mapUploadedSprites = Maps.newHashMap(); + this.missingImage = new TextureAtlasSprite("missingno"); + this.basePath = p_i46100_1_; + this.iconCreator = iconCreatorIn; + this.skipFirst = skipFirst && ENABLE_SKIP; } - private void func_110569_e() + private void initMissingImage() @@ -91,15 +104,29 @@ - this.field_94258_i.clear(); + this.listAnimatedSprites.clear(); int j = Integer.MAX_VALUE; - int k = 1 << this.field_147636_j; + int k = 1 << this.mipmapLevels; + net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(this); + net.minecraftforge.fml.common.FMLLog.info("Max texture size: %d", i); -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", skipFirst ? 0 : this.field_110574_e.size()); - Iterator iterator = this.field_110574_e.entrySet().iterator(); ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", skipFirst ? 0 : this.mapRegisteredSprites.size()); + Iterator iterator = this.mapRegisteredSprites.entrySet().iterator(); - while (iterator.hasNext()) + while (!skipFirst && iterator.hasNext()) { Entry entry = (Entry)iterator.next(); TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue(); - ResourceLocation resourcelocation = new ResourceLocation(textureatlassprite.func_94215_i()); - ResourceLocation resourcelocation1 = this.func_147634_a(resourcelocation, 0); -+ bar.step(resourcelocation1.func_110623_a()); + ResourceLocation resourcelocation = new ResourceLocation(textureatlassprite.getIconName()); + ResourceLocation resourcelocation1 = this.completeResourceLocation(resourcelocation, 0); ++ bar.step(resourcelocation1.getResourcePath()); -+ if (textureatlassprite.hasCustomLoader(p_110571_1_, resourcelocation)) ++ if (textureatlassprite.hasCustomLoader(resourceManager, resourcelocation)) + { -+ if (!textureatlassprite.load(p_110571_1_, resourcelocation)) ++ if (!textureatlassprite.load(resourceManager, resourcelocation)) + { -+ j = Math.min(j, Math.min(textureatlassprite.func_94211_a(), textureatlassprite.func_94216_b())); -+ stitcher.func_110934_a(textureatlassprite); ++ j = Math.min(j, Math.min(textureatlassprite.getIconWidth(), textureatlassprite.getIconHeight())); ++ stitcher.addSprite(textureatlassprite); + } + continue; + } + try { - IResource iresource = p_110571_1_.func_110536_a(resourcelocation1); + IResource iresource = resourceManager.getResource(resourcelocation1); @@ -150,12 +177,14 @@ } catch (RuntimeException runtimeexception) { -- field_147635_d.error("Unable to parse metadata from " + resourcelocation1, runtimeexception); +- logger.error("Unable to parse metadata from " + resourcelocation1, runtimeexception); + //logger.error("Unable to parse metadata from " + resourcelocation1, runtimeexception); + net.minecraftforge.fml.client.FMLClientHandler.instance().trackBrokenTexture(resourcelocation1, runtimeexception.getMessage()); continue; } catch (IOException ioexception1) { -- field_147635_d.error("Using missing texture, unable to load " + resourcelocation1, ioexception1); +- logger.error("Using missing texture, unable to load " + resourcelocation1, ioexception1); + //logger.error("Using missing texture, unable to load " + resourcelocation1, ioexception1); + net.minecraftforge.fml.client.FMLClientHandler.instance().trackMissingTexture(resourcelocation1); continue; } @@ -171,6 +200,7 @@ - stitcher.func_110934_a(textureatlassprite); + stitcher.addSprite(textureatlassprite); } + net.minecraftforge.fml.common.ProgressManager.pop(bar); int j1 = Math.min(j, k); - int k1 = MathHelper.func_151239_c(j1); + int k1 = MathHelper.calculateLogBaseTwo(j1); @@ -181,10 +211,12 @@ } - Iterator iterator1 = this.field_110574_e.values().iterator(); -+ bar = net.minecraftforge.fml.common.ProgressManager.push("Mipmap generation", skipFirst ? 0 : this.field_110574_e.size()); + Iterator iterator1 = this.mapRegisteredSprites.values().iterator(); ++ bar = net.minecraftforge.fml.common.ProgressManager.push("Mipmap generation", skipFirst ? 0 : this.mapRegisteredSprites.size()); - while (iterator1.hasNext()) + while (!skipFirst && iterator1.hasNext()) { final TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)iterator1.next(); -+ bar.step(textureatlassprite1.func_94215_i()); ++ bar.step(textureatlassprite1.getIconName()); try { @@ -225,9 +257,13 @@ - this.field_94249_f.func_147963_d(this.field_147636_j); - stitcher.func_110934_a(this.field_94249_f); + this.missingImage.generateMipmaps(this.mipmapLevels); + stitcher.addSprite(this.missingImage); + net.minecraftforge.fml.common.ProgressManager.pop(bar); + skipFirst = false; + bar = net.minecraftforge.fml.common.ProgressManager.push("Texture creation", 3); @@ -122,17 +121,17 @@ try { + bar.step("Stitching"); - stitcher.func_94305_f(); + stitcher.doStitch(); } catch (StitcherException stitcherexception) @@ -236,11 +272,13 @@ } - field_147635_d.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.func_110935_a()), Integer.valueOf(stitcher.func_110936_b()), this.field_94254_c}); + logger.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.getCurrentWidth()), Integer.valueOf(stitcher.getCurrentHeight()), this.basePath}); + bar.step("Allocating GL texture"); - TextureUtil.func_180600_a(this.func_110552_b(), this.field_147636_j, stitcher.func_110935_a(), stitcher.func_110936_b()); - HashMap hashmap = Maps.newHashMap(this.field_110574_e); - Iterator iterator2 = stitcher.func_94309_g().iterator(); + TextureUtil.allocateTextureImpl(this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); + HashMap hashmap = Maps.newHashMap(this.mapRegisteredSprites); + Iterator iterator2 = stitcher.getStichSlots().iterator(); TextureAtlasSprite textureatlassprite2; + bar.step("Uploading GL texture"); @@ -140,20 +139,20 @@ { textureatlassprite2 = (TextureAtlasSprite)iterator2.next(); @@ -275,7 +313,11 @@ - textureatlassprite2.func_94217_a(this.field_94249_f); + textureatlassprite2.copyFrom(this.missingImage); } + net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this); + + if (!net.minecraftforge.common.ForgeModContainer.disableStitchedFileSaving) - TextureUtil.func_177055_a(this.field_94254_c.replaceAll("/", "_"), this.func_110552_b(), this.field_147636_j, stitcher.func_110935_a(), stitcher.func_110936_b()); + TextureUtil.saveGlTexture(this.basePath.replaceAll("/", "_"), this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); + net.minecraftforge.fml.common.ProgressManager.pop(bar); } - private ResourceLocation func_147634_a(ResourceLocation p_147634_1_, int p_147634_2_) + private ResourceLocation completeResourceLocation(ResourceLocation location, int p_147634_2_) @@ -341,4 +383,37 @@ { - return this.field_94249_f; + return this.missingImage; } + + //=================================================================================================== @@ -168,7 +167,7 @@ + */ + public TextureAtlasSprite getTextureExtry(String name) + { -+ return (TextureAtlasSprite)field_110574_e.get(name); ++ return (TextureAtlasSprite)mapRegisteredSprites.get(name); + } + + /** @@ -181,9 +180,9 @@ + */ + public boolean setTextureEntry(String name, TextureAtlasSprite entry) + { -+ if (!field_110574_e.containsKey(name)) ++ if (!mapRegisteredSprites.containsKey(name)) + { -+ field_110574_e.put(name, entry); ++ mapRegisteredSprites.put(name, entry); + return true; + } + return false; diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch similarity index 69% rename from patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch index 4e5c66c9f..bd098bb10 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch @@ -2,12 +2,12 @@ +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java @@ -202,9 +202,11 @@ - public static void func_180600_a(int p_180600_0_, int p_180600_1_, int p_180600_2_, int p_180600_3_) + public static void allocateTextureImpl(int p_180600_0_, int p_180600_1_, int p_180600_2_, int p_180600_3_) { + synchronized (net.minecraftforge.fml.client.SplashProgress.class) + { - func_147942_a(p_180600_0_); - func_94277_a(p_180600_0_); + deleteTexture(p_180600_0_); + bindTexture(p_180600_0_); - + } if (p_180600_1_ >= 0) diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch similarity index 56% rename from patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch index d0ec3a7d9..d05ff8ac8 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch @@ -1,31 +1,31 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java +++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java @@ -99,15 +99,18 @@ - GlStateManager.func_179140_f(); - int i = p_82402_1_.func_82333_j(); + GlStateManager.disableLighting(); + int i = p_82402_1_.getRotation(); -- if (item == Items.field_151098_aY) +- if (item == Items.filled_map) + if (item instanceof net.minecraft.item.ItemMap) { i = i % 4 * 2; } - GlStateManager.func_179114_b((float)i * 360.0F / 8.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate((float)i * 360.0F / 8.0F, 0.0F, 0.0F, 1.0F); -- if (item == Items.field_151098_aY) +- if (item == Items.filled_map) + net.minecraftforge.client.event.RenderItemInFrameEvent event = new net.minecraftforge.client.event.RenderItemInFrameEvent(p_82402_1_, this); + if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) { + if (item instanceof net.minecraft.item.ItemMap) + { - this.field_76990_c.field_78724_e.func_110577_a(field_110789_a); - GlStateManager.func_179114_b(180.0F, 0.0F, 0.0F, 1.0F); + this.renderManager.renderEngine.bindTexture(mapBackgroundTextures); + GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); float f = 0.0078125F; @@ -165,6 +168,7 @@ - textureatlassprite.func_94219_l(); + textureatlassprite.updateAnimation(); } } + } - GlStateManager.func_179145_e(); - GlStateManager.func_179121_F(); + GlStateManager.enableLighting(); + GlStateManager.popMatrix(); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch new file mode 100644 index 000000000..9137aa309 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java +@@ -79,6 +79,7 @@ + { + TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147718_c, 0.0D, 0.0D, 0.0D, 0.0F); + } ++ else if (block != Blocks.chest) net.minecraftforge.client.ForgeHooksClient.renderTileItem(p_179022_1_.getItem(), p_179022_1_.getMetadata()); + else + { + TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147717_b, 0.0D, 0.0D, 0.0D, 0.0F); diff --git a/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch similarity index 92% rename from patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch rename to patches.mcp/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch index 5c3f9e29e..31665ebe0 100644 --- a/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch @@ -25,9 +25,9 @@ + //UINT_2_10_10_10_REV(4, "Unsigned Int 2-10-10-10 reversed", org.lwjgl.opengl.GL12.GL_UNSIGNED_INT_2_10_10_10_REV), + //UINT_10F_11F_11F_REV(4, "Unsigned Int 10F 11F 11F reversed", GL_UNSIGNED_INT_10F_11F_11F_REV); + - private final int field_177407_h; - private final String field_177408_i; - private final int field_177405_j; + private final int size; + private final String displayName; + private final int glConstant; @@ -157,9 +164,17 @@ NORMAL("Normal"), COLOR("Vertex Color"), @@ -44,6 +44,6 @@ + public void preDraw(VertexFormatElement element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.preDraw(this, element, stride, buffer); } + public void postDraw(VertexFormatElement element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.postDraw(this, element, stride, buffer); } + - private final String field_177392_h; + private final String displayName; private static final String __OBFID = "CL_00002397"; diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch new file mode 100644 index 000000000..b55e36165 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/AbstractResourcePack.java ++++ ../src-work/minecraft/net/minecraft/client/resources/AbstractResourcePack.java +@@ -58,7 +58,7 @@ + + protected void logNameNotLowercase(String p_110594_1_) + { +- resourceLog.warn("ResourcePack: ignored non-lowercase namespace: %s in %s", new Object[] {p_110594_1_, this.resourcePackFile}); ++ resourceLog.warn("ResourcePack: ignored non-lowercase namespace: {} in {}", new Object[] {p_110594_1_, this.resourcePackFile}); + } + + public IMetadataSection getPackMetadata(IMetadataSerializer p_135058_1_, String p_135058_2_) throws IOException diff --git a/patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch similarity index 61% rename from patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch rename to patches.mcp/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch index c002dd01f..9d8482917 100644 --- a/patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch @@ -5,6 +5,6 @@ } + @SuppressWarnings("resource") - protected InputStream func_177245_a(ResourceLocation p_177245_1_, IResourcePack p_177245_2_) throws IOException + protected InputStream getInputStream(ResourceLocation p_177245_1_, IResourcePack p_177245_2_) throws IOException { - InputStream inputstream = p_177245_2_.func_110590_a(p_177245_1_); + InputStream inputstream = p_177245_2_.getInputStream(p_177245_1_); diff --git a/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch similarity index 54% rename from patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch rename to patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch index de7ea2b62..3a799d2e9 100644 --- a/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch @@ -3,8 +3,8 @@ @@ -83,6 +83,7 @@ } - field_135049_a.func_135022_a(p_110549_1_, arraylist); -+ net.minecraftforge.fml.common.registry.LanguageRegistry.instance().mergeLanguageTable(field_135049_a.field_135032_a, this.field_135048_c); - StringTranslate.func_135063_a(field_135049_a.field_135032_a); + currentLocale.loadLocaleDataFiles(resourceManager, arraylist); ++ net.minecraftforge.fml.common.registry.LanguageRegistry.instance().mergeLanguageTable(currentLocale.properties, this.currentLanguage); + StringTranslate.replaceWith(currentLocale.properties); } diff --git a/patches/minecraft/net/minecraft/client/resources/Locale.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/Locale.java.patch similarity index 74% rename from patches/minecraft/net/minecraft/client/resources/Locale.java.patch rename to patches.mcp/minecraft/net/minecraft/client/resources/Locale.java.patch index fc84931f7..9d053f76d 100644 --- a/patches/minecraft/net/minecraft/client/resources/Locale.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/resources/Locale.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/client/resources/Locale.java @@ -107,6 +107,8 @@ - private void func_135021_a(InputStream p_135021_1_) throws IOException + private void loadLocaleData(InputStream p_135021_1_) throws IOException { -+ p_135021_1_ = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(field_135032_a, p_135021_1_); ++ p_135021_1_ = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(properties, p_135021_1_); + if (p_135021_1_ == null) return; Iterator iterator = IOUtils.readLines(p_135021_1_, Charsets.UTF_8).iterator(); diff --git a/patches/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch similarity index 66% rename from patches/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch rename to patches.mcp/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch index 8d8b19f58..839265f93 100644 --- a/patches/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch @@ -1,45 +1,45 @@ --- ../src-base/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java +++ ../src-work/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java @@ -95,6 +95,7 @@ - public void func_110541_a(List p_110541_1_) + public void reloadResources(List p_110541_1_) { - this.func_110543_a(); + this.clearResources(); + net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Loading Resources", p_110541_1_.size()+1, true); - field_147967_a.info("Reloading ResourceManager: " + field_130074_a.join(Iterables.transform(p_110541_1_, new Function() + logger.info("Reloading ResourceManager: " + joinerResourcePacks.join(Iterables.transform(p_110541_1_, new Function() { private static final String __OBFID = "CL_00001092"; @@ -112,26 +113,35 @@ while (iterator.hasNext()) { IResourcePack iresourcepack = (IResourcePack)iterator.next(); -+ resReload.step(iresourcepack.func_130077_b()); - this.func_110545_a(iresourcepack); ++ resReload.step(iresourcepack.getPackName()); + this.reloadResourcePack(iresourcepack); } + resReload.step("Reloading listeners"); - this.func_110544_b(); + this.notifyReloadListeners(); + net.minecraftforge.fml.common.ProgressManager.pop(resReload); } - public void func_110542_a(IResourceManagerReloadListener p_110542_1_) + public void registerReloadListener(IResourceManagerReloadListener p_110542_1_) { - this.field_110546_b.add(p_110542_1_); + this.reloadListeners.add(p_110542_1_); + net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Loading Resource", 1); + resReload.step(p_110542_1_.getClass()); - p_110542_1_.func_110549_a(this); + p_110542_1_.onResourceManagerReload(this); + net.minecraftforge.fml.common.ProgressManager.pop(resReload); } - private void func_110544_b() + private void notifyReloadListeners() { - Iterator iterator = this.field_110546_b.iterator(); + Iterator iterator = this.reloadListeners.iterator(); -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Reloading", this.field_110546_b.size()); ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Reloading", this.reloadListeners.size()); while (iterator.hasNext()) { IResourceManagerReloadListener iresourcemanagerreloadlistener = (IResourceManagerReloadListener)iterator.next(); + resReload.step(iresourcemanagerreloadlistener.getClass()); - iresourcemanagerreloadlistener.func_110549_a(this); + iresourcemanagerreloadlistener.onResourceManagerReload(this); } + net.minecraftforge.fml.common.ProgressManager.pop(resReload); } diff --git a/patches/minecraft/net/minecraft/client/resources/SkinManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/SkinManager.java.patch similarity index 52% rename from patches/minecraft/net/minecraft/client/resources/SkinManager.java.patch rename to patches.mcp/minecraft/net/minecraft/client/resources/SkinManager.java.patch index 9784b8e90..48764cbfc 100644 --- a/patches/minecraft/net/minecraft/client/resources/SkinManager.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/resources/SkinManager.java.patch @@ -2,12 +2,12 @@ +++ ../src-work/minecraft/net/minecraft/client/resources/SkinManager.java @@ -129,7 +129,9 @@ - if (hashmap.isEmpty() && p_152790_1_.getId().equals(Minecraft.func_71410_x().func_110432_I().func_148256_e().getId())) + if (hashmap.isEmpty() && p_152790_1_.getId().equals(Minecraft.getMinecraft().getSession().getProfile().getId())) { -- hashmap.putAll(SkinManager.this.field_152797_e.getTextures(SkinManager.this.field_152797_e.fillProfileProperties(p_152790_1_, false), false)); +- hashmap.putAll(SkinManager.this.sessionService.getTextures(SkinManager.this.sessionService.fillProfileProperties(p_152790_1_, false), false)); + // FORGE: Use already filled profile from session rather + // than getting rate limited by filling the input profile -+ hashmap.putAll(SkinManager.this.field_152797_e.getTextures(Minecraft.func_71410_x().func_110432_I().func_148256_e(), false)); ++ hashmap.putAll(SkinManager.this.sessionService.getTextures(Minecraft.getMinecraft().getSession().getProfile(), false)); } - Minecraft.func_71410_x().func_152344_a(new Runnable() + Minecraft.getMinecraft().addScheduledTask(new Runnable() diff --git a/patches/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch similarity index 79% rename from patches/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch rename to patches.mcp/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch index 92a87972d..1b59a084d 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch @@ -11,11 +11,11 @@ +@Deprecated public interface IBakedModel { - List func_177551_a(EnumFacing p_177551_1_); + List getFaceQuads(EnumFacing p_177551_1_); @@ -22,5 +26,6 @@ - TextureAtlasSprite func_177554_e(); + TextureAtlasSprite getTexture(); + @Deprecated - ItemCameraTransforms func_177552_f(); + ItemCameraTransforms getItemCameraTransforms(); } diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch new file mode 100644 index 000000000..e6b109684 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch @@ -0,0 +1,98 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/model/ModelBakery.java ++++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelBakery.java +@@ -123,7 +123,7 @@ + } + catch (Exception exception) + { +- LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation); ++ LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation, exception); + } + } + catch (Exception exception1) +@@ -172,6 +172,7 @@ + } + } + } ++ catch (FileNotFoundException e) {} + catch (IOException ioexception) + { + throw new RuntimeException("Encountered an exception when loading model definition of model " + resourcelocation1.toString(), ioexception); +@@ -318,6 +319,7 @@ + + protected void registerVariantNames() + { ++ this.variantNames.clear(); //FML clear this to prevent double ups. + this.variantNames.put(Item.getItemFromBlock(Blocks.stone), Lists.newArrayList(new String[] {"stone", "granite", "granite_smooth", "diorite", "diorite_smooth", "andesite", "andesite_smooth"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.dirt), Lists.newArrayList(new String[] {"dirt", "coarse_dirt", "podzol"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.planks), Lists.newArrayList(new String[] {"oak_planks", "spruce_planks", "birch_planks", "jungle_planks", "acacia_planks", "dark_oak_planks"})); +@@ -360,6 +362,10 @@ + this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence_gate), Lists.newArrayList(new String[] {"oak_fence_gate"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence), Lists.newArrayList(new String[] {"oak_fence"})); + this.variantNames.put(Items.oak_door, Lists.newArrayList(new String[] {"oak_door"})); ++ for (Entry, Set> e : customVariantNames.entrySet()) ++ { ++ this.variantNames.put(e.getKey().get(), Lists.newArrayList(e.getValue().iterator())); ++ } + } + + protected List getVariantNames(Item p_177596_1_) +@@ -494,6 +500,11 @@ + + private IBakedModel bakeModel(ModelBlock modelBlockIn, ModelRotation modelRotationIn, boolean uvLocked) + { ++ return bakeModel(modelBlockIn, (net.minecraftforge.client.model.ITransformation)modelRotationIn, uvLocked); ++ } ++ ++ protected IBakedModel bakeModel(ModelBlock modelBlockIn, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) ++ { + TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName("particle"))); + SimpleBakedModel.Builder builder = (new SimpleBakedModel.Builder(modelBlockIn)).setTexture(textureatlassprite); + Iterator iterator = modelBlockIn.getElements().iterator(); +@@ -509,13 +520,13 @@ + BlockPartFace blockpartface = (BlockPartFace)blockpart.mapFaces.get(enumfacing); + TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName(blockpartface.texture))); + +- if (blockpartface.cullFace == null) ++ if (blockpartface.cullFace == null || !net.minecraftforge.client.model.TRSRTransformation.isInteger(modelRotationIn.getMatrix())) + { + builder.addGeneralQuad(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); + } + else + { +- builder.addFaceQuad(modelRotationIn.rotateFace(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); ++ builder.addFaceQuad(modelRotationIn.rotate(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); + } + } + } +@@ -525,6 +536,11 @@ + + private BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_) + { ++ return makeBakedQuad(p_177589_1_, p_177589_2_, p_177589_3_, p_177589_4_, (net.minecraftforge.client.model.ITransformation)p_177589_5_, p_177589_6_); ++ } ++ ++ protected BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, net.minecraftforge.client.model.ITransformation p_177589_5_, boolean p_177589_6_) ++ { + return this.faceBakery.makeBakedQuad(p_177589_1_.positionFrom, p_177589_1_.positionTo, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.partRotation, p_177589_6_, p_177589_1_.shade); + } + +@@ -809,4 +825,19 @@ + MODEL_CLOCK.name = "class generation marker"; + MODEL_ENTITY.name = "block entity marker"; + } ++ ++ /*********************************************************** ++ * FML Start ++ ***********************************************************/ ++ private static Map, Set> customVariantNames = Maps.newHashMap(); ++ public static void addVariantName(Item item, String... names) ++ { ++ if (customVariantNames.containsKey(item.delegate)) ++ customVariantNames.get(item.delegate).addAll(Lists.newArrayList(names)); ++ else ++ customVariantNames.put(item.delegate, Sets.newHashSet(names)); ++ } ++ /*********************************************************** ++ * FML End ++ ***********************************************************/ + } diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch new file mode 100644 index 000000000..cdc1701f2 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/model/ModelManager.java ++++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelManager.java +@@ -25,9 +25,10 @@ + + public void onResourceManagerReload(IResourceManager resourceManager) + { +- ModelBakery modelbakery = new ModelBakery(resourceManager, this.texMap, this.modelProvider); ++ ModelBakery modelbakery = new net.minecraftforge.client.model.ModelLoader(resourceManager, this.texMap, this.modelProvider); + this.modelRegistry = modelbakery.setupModelRegistry(); + this.defaultModel = (IBakedModel)this.modelRegistry.getObject(ModelBakery.MODEL_MISSING); ++ net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.modelRegistry, modelbakery); + this.modelProvider.reloadModels(); + } + diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch similarity index 81% rename from patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch rename to patches.mcp/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch index fc6faa7d5..a97ecb1a3 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch @@ -10,12 +10,12 @@ X0_Y0(0, 0), X0_Y90(0, 90), @@ -122,4 +122,9 @@ - field_177546_q.put(Integer.valueOf(var3.field_177545_r), var3); + mapRotations.put(Integer.valueOf(var3.combinedXY), var3); } } + + public net.minecraftforge.client.model.TRSRTransformation apply(net.minecraftforge.client.model.IModelPart part) { return new net.minecraftforge.client.model.TRSRTransformation(getMatrix()); } + public javax.vecmath.Matrix4f getMatrix() { return net.minecraftforge.client.ForgeHooksClient.getMatrix(this); } -+ public EnumFacing rotate(EnumFacing facing) { return func_177523_a(facing); } -+ public int rotate(EnumFacing facing, int vertexIndex) { return func_177520_a(facing, vertexIndex); } ++ public EnumFacing rotate(EnumFacing facing) { return rotateFace(facing); } ++ public int rotate(EnumFacing facing, int vertexIndex) { return rotateVertex(facing, vertexIndex); } } diff --git a/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch b/patches.mcp/minecraft/net/minecraft/client/settings/GameSettings.java.patch similarity index 85% rename from patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch rename to patches.mcp/minecraft/net/minecraft/client/settings/GameSettings.java.patch index 74702821a..fe8f10615 100644 --- a/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/settings/GameSettings.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/client/settings/GameSettings.java @@ -1067,6 +1067,7 @@ - public void func_74303_b() + public void saveOptions() { + if (net.minecraftforge.fml.client.FMLClientHandler.instance().isLoading()) return; try { - PrintWriter printwriter = new PrintWriter(new FileWriter(this.field_74354_ai)); + PrintWriter printwriter = new PrintWriter(new FileWriter(this.optionsFile)); diff --git a/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch b/patches.mcp/minecraft/net/minecraft/client/shader/Framebuffer.java.patch similarity index 55% rename from patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch rename to patches.mcp/minecraft/net/minecraft/client/shader/Framebuffer.java.patch index b552a439c..c3b400a6b 100644 --- a/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/shader/Framebuffer.java.patch @@ -1,26 +1,26 @@ --- ../src-base/minecraft/net/minecraft/client/shader/Framebuffer.java +++ ../src-work/minecraft/net/minecraft/client/shader/Framebuffer.java @@ -119,8 +119,17 @@ - if (this.field_147619_e) + if (this.useDepth) { - OpenGlHelper.func_153176_h(OpenGlHelper.field_153199_f, this.field_147624_h); + OpenGlHelper.glBindRenderbuffer(OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); + if (!this.stencilEnabled) + { - OpenGlHelper.func_153186_a(OpenGlHelper.field_153199_f, 33190, this.field_147622_a, this.field_147620_b); - OpenGlHelper.func_153190_b(OpenGlHelper.field_153198_e, OpenGlHelper.field_153201_h, OpenGlHelper.field_153199_f, this.field_147624_h); + OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, 33190, this.framebufferTextureWidth, this.framebufferTextureHeight); + OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_DEPTH_ATTACHMENT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); + } + else + { -+ OpenGlHelper.func_153186_a(OpenGlHelper.field_153199_f, org.lwjgl.opengl.EXTPackedDepthStencil.GL_DEPTH24_STENCIL8_EXT, this.field_147622_a, this.field_147620_b); -+ OpenGlHelper.func_153190_b(OpenGlHelper.field_153198_e, org.lwjgl.opengl.EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, OpenGlHelper.field_153199_f, this.field_147624_h); -+ OpenGlHelper.func_153190_b(OpenGlHelper.field_153198_e, org.lwjgl.opengl.EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, OpenGlHelper.field_153199_f, this.field_147624_h); ++ OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, org.lwjgl.opengl.EXTPackedDepthStencil.GL_DEPTH24_STENCIL8_EXT, this.framebufferTextureWidth, this.framebufferTextureHeight); ++ OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, org.lwjgl.opengl.EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); ++ OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, org.lwjgl.opengl.EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); + } } - this.func_147614_f(); + this.framebufferClear(); @@ -281,4 +290,36 @@ - GlStateManager.func_179086_m(i); - this.func_147609_e(); + GlStateManager.clear(i); + this.unbindFramebuffer(); } + + /*================================ FORGE START ================================================*/ @@ -39,9 +39,9 @@ + */ + public boolean enableStencil() + { -+ if (!OpenGlHelper.func_148822_b()) return false; ++ if (!OpenGlHelper.isFramebufferEnabled()) return false; + stencilEnabled = true; -+ this.func_147613_a(field_147621_c, field_147618_d); ++ this.createBindFramebuffer(framebufferWidth, framebufferHeight); + return true; //TODO: Find a way to detect if this failed? + } + diff --git a/patches.mcp/minecraft/net/minecraft/command/CommandEnchant.java.patch b/patches.mcp/minecraft/net/minecraft/command/CommandEnchant.java.patch new file mode 100644 index 000000000..c6ea2fffb --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/command/CommandEnchant.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/command/CommandEnchant.java ++++ ../src-work/minecraft/net/minecraft/command/CommandEnchant.java +@@ -95,7 +95,7 @@ + { + Enchantment enchantment2 = Enchantment.getEnchantmentById(short1); + +- if (!enchantment2.canApplyTogether(enchantment1)) ++ if (!enchantment2.canApplyTogether(enchantment1) || !enchantment1.canApplyTogether(enchantment2)) //Forge BugFix: Let Both enchantments veto being together + { + throw new CommandException("commands.enchant.cantCombine", new Object[] {enchantment1.getTranslatedName(j), enchantment2.getTranslatedName(nbttaglist.getCompoundTagAt(k).getShort("lvl"))}); + } diff --git a/patches.mcp/minecraft/net/minecraft/command/CommandFill.java.patch b/patches.mcp/minecraft/net/minecraft/command/CommandFill.java.patch new file mode 100644 index 000000000..205a36382 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/command/CommandFill.java.patch @@ -0,0 +1,28 @@ +--- ../src-base/minecraft/net/minecraft/command/CommandFill.java ++++ ../src-work/minecraft/net/minecraft/command/CommandFill.java +@@ -52,6 +52,7 @@ + { + i = parseInt(args[7], 0, 15); + } ++ IBlockState state = block.getStateFromMeta(i); + + BlockPos blockpos2 = new BlockPos(Math.min(blockpos.getX(), blockpos1.getX()), Math.min(blockpos.getY(), blockpos1.getY()), Math.min(blockpos.getZ(), blockpos1.getZ())); + BlockPos blockpos3 = new BlockPos(Math.max(blockpos.getX(), blockpos1.getX()), Math.max(blockpos.getY(), blockpos1.getY()), Math.max(blockpos.getZ(), blockpos1.getZ())); +@@ -79,7 +80,7 @@ + NBTTagCompound nbttagcompound = new NBTTagCompound(); + boolean flag = false; + +- if (args.length >= 10 && block.hasTileEntity()) ++ if (args.length >= 10 && block.hasTileEntity(state)) + { + String s = getChatComponentFromNthArg(sender, args, 9).getUnformattedText(); + +@@ -121,7 +122,7 @@ + continue; + } + } +- else if (args[8].equals("replace") && !block.hasTileEntity()) ++ else if (args[8].equals("replace") && !block.hasTileEntity(state)) + { + if (args.length > 9) + { diff --git a/patches/minecraft/net/minecraft/command/CommandHandler.java.patch b/patches.mcp/minecraft/net/minecraft/command/CommandHandler.java.patch similarity index 73% rename from patches/minecraft/net/minecraft/command/CommandHandler.java.patch rename to patches.mcp/minecraft/net/minecraft/command/CommandHandler.java.patch index 0d3e80726..08c37a03d 100644 --- a/patches/minecraft/net/minecraft/command/CommandHandler.java.patch +++ b/patches.mcp/minecraft/net/minecraft/command/CommandHandler.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/command/CommandHandler.java @@ -48,6 +48,16 @@ } - else if (icommand.func_71519_b(p_71556_1_)) + else if (icommand.canCommandSenderUse(sender)) { -+ net.minecraftforge.event.CommandEvent event = new net.minecraftforge.event.CommandEvent(icommand, p_71556_1_, astring); ++ net.minecraftforge.event.CommandEvent event = new net.minecraftforge.event.CommandEvent(icommand, sender, astring); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) + { + if (event.exception != null) @@ -16,4 +16,4 @@ + if (i > -1) { - List list = PlayerSelector.func_179656_b(p_71556_1_, astring[i], Entity.class); + List list = PlayerSelector.matchEntities(sender, astring[i], Entity.class); diff --git a/patches.mcp/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch b/patches.mcp/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch new file mode 100644 index 000000000..44ccb6290 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/command/server/CommandSetBlock.java ++++ ../src-work/minecraft/net/minecraft/command/server/CommandSetBlock.java +@@ -54,6 +54,8 @@ + i = parseInt(args[4], 0, 15); + } + ++ IBlockState state = block.getStateFromMeta(i); ++ + World world = sender.getEntityWorld(); + + if (!world.isBlockLoaded(blockpos)) +@@ -65,7 +67,7 @@ + NBTTagCompound nbttagcompound = new NBTTagCompound(); + boolean flag = false; + +- if (args.length >= 7 && block.hasTileEntity()) ++ if (args.length >= 7 && block.hasTileEntity(state)) + { + String s = getChatComponentFromNthArg(sender, args, 6).getUnformattedText(); + diff --git a/patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch b/patches.mcp/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch similarity index 55% rename from patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch rename to patches.mcp/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch index 0542a21e8..c37587222 100644 --- a/patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch +++ b/patches.mcp/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch @@ -4,8 +4,8 @@ NBTTagCompound nbttagcompound = new NBTTagCompound(); boolean flag = false; -- if (p_71515_2_.length >= 6 && block.func_149716_u()) -+ if (p_71515_2_.length >= 6 && block.hasTileEntity(block.func_176203_a(i))) +- if (args.length >= 6 && block.hasTileEntity()) ++ if (args.length >= 6 && block.hasTileEntity(block.getStateFromMeta(i))) { - String s = func_147178_a(p_71515_1_, p_71515_2_, 5).func_150260_c(); + String s = getChatComponentFromNthArg(sender, args, 5).getUnformattedText(); diff --git a/patches/minecraft/net/minecraft/crash/CrashReport.java.patch b/patches.mcp/minecraft/net/minecraft/crash/CrashReport.java.patch similarity index 77% rename from patches/minecraft/net/minecraft/crash/CrashReport.java.patch rename to patches.mcp/minecraft/net/minecraft/crash/CrashReport.java.patch index 224cdfd43..1ff0379f3 100644 --- a/patches/minecraft/net/minecraft/crash/CrashReport.java.patch +++ b/patches.mcp/minecraft/net/minecraft/crash/CrashReport.java.patch @@ -1,13 +1,13 @@ --- ../src-base/minecraft/net/minecraft/crash/CrashReport.java +++ ../src-work/minecraft/net/minecraft/crash/CrashReport.java @@ -126,6 +126,7 @@ - return IntCache.func_85144_b(); + return IntCache.getCacheSizes(); } }); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().enhanceCrashReport(this, this.field_85061_c); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().enhanceCrashReport(this, this.theReportCategory); } - public String func_71501_a() + public String getDescription() @@ -220,6 +221,8 @@ { StringBuilder stringbuilder = new StringBuilder(); @@ -15,5 +15,5 @@ + net.minecraftforge.fml.common.asm.transformers.BlamingTransformer.onCrash(stringbuilder); + net.minecraftforge.fml.relauncher.CoreModManager.onCrash(stringbuilder); stringbuilder.append("// "); - stringbuilder.append(func_71503_h()); + stringbuilder.append(getWittyComment()); stringbuilder.append("\n\n"); diff --git a/patches.mcp/minecraft/net/minecraft/crash/CrashReportCategory.java.patch b/patches.mcp/minecraft/net/minecraft/crash/CrashReportCategory.java.patch new file mode 100644 index 000000000..775be4459 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/crash/CrashReportCategory.java.patch @@ -0,0 +1,16 @@ +--- ../src-base/minecraft/net/minecraft/crash/CrashReportCategory.java ++++ ../src-work/minecraft/net/minecraft/crash/CrashReportCategory.java +@@ -128,8 +128,11 @@ + } + else + { +- this.stackTrace = new StackTraceElement[astacktraceelement.length - 3 - size]; +- System.arraycopy(astacktraceelement, 3 + size, this.stackTrace, 0, this.stackTrace.length); ++ int len = astacktraceelement.length - 3 - size; ++ // Really Mojang, Still, god damn... ++ if (len <= 0) len = astacktraceelement.length; ++ this.stackTrace = new StackTraceElement[len]; ++ System.arraycopy(astacktraceelement, astacktraceelement.length - len, this.stackTrace, 0, this.stackTrace.length); + return this.stackTrace.length; + } + } diff --git a/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch b/patches.mcp/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch similarity index 57% rename from patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch rename to patches.mcp/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch index 5e24561f7..c2f5798b4 100644 --- a/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch +++ b/patches.mcp/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/creativetab/CreativeTabs.java +++ ../src-work/minecraft/net/minecraft/creativetab/CreativeTabs.java @@ -139,8 +139,22 @@ - private ItemStack field_151245_t; + private ItemStack iconItemStack; private static final String __OBFID = "CL_00000005"; + public CreativeTabs(String label) @@ -9,39 +9,39 @@ + this(getNextID(), label); + } + - public CreativeTabs(int p_i1853_1_, String p_i1853_2_) + public CreativeTabs(int index, String label) { -+ if (p_i1853_1_ >= field_78032_a.length) ++ if (index >= creativeTabArray.length) + { -+ CreativeTabs[] tmp = new CreativeTabs[p_i1853_1_ + 1]; -+ for (int x = 0; x < field_78032_a.length; x++) ++ CreativeTabs[] tmp = new CreativeTabs[index + 1]; ++ for (int x = 0; x < creativeTabArray.length; x++) + { -+ tmp[x] = field_78032_a[x]; ++ tmp[x] = creativeTabArray[x]; + } -+ field_78032_a = tmp; ++ creativeTabArray = tmp; + } - this.field_78033_n = p_i1853_1_; - this.field_78034_o = p_i1853_2_; - field_78032_a[p_i1853_1_] = this; + this.tabIndex = index; + this.tabLabel = label; + creativeTabArray[index] = this; @@ -223,12 +237,20 @@ @SideOnly(Side.CLIENT) - public int func_78020_k() + public int getTabColumn() { -+ if (field_78033_n > 11) ++ if (tabIndex > 11) + { -+ return ((field_78033_n - 12) % 10) % 5; ++ return ((tabIndex - 12) % 10) % 5; + } - return this.field_78033_n % 6; + return this.tabIndex % 6; } @SideOnly(Side.CLIENT) - public boolean func_78023_l() + public boolean isTabInFirstRow() { -+ if (field_78033_n > 11) ++ if (tabIndex > 11) + { -+ return ((field_78033_n - 12) % 10) < 5; ++ return ((tabIndex - 12) % 10) < 5; + } - return this.field_78033_n < 6; + return this.tabIndex < 6; } @@ -278,10 +300,17 @@ @@ -53,13 +53,13 @@ + continue; + } -- if (item != null && item.func_77640_w() == this) +- if (item != null && item.getCreativeTab() == this) + for (CreativeTabs tab : item.getCreativeTabs()) { -- item.func_150895_a(item, this, p_78018_1_); +- item.getSubItems(item, this, p_78018_1_); + if (tab == this) + { -+ item.func_150895_a(item, this, p_78018_1_); ++ item.getSubItems(item, this, p_78018_1_); + } } } @@ -71,16 +71,16 @@ + + public int getTabPage() + { -+ if (field_78033_n > 11) ++ if (tabIndex > 11) + { -+ return ((field_78033_n - 12) / 10) + 1; ++ return ((tabIndex - 12) / 10) + 1; + } + return 0; + } + + public static int getNextID() + { -+ return field_78032_a.length; ++ return creativeTabArray.length; + } + + /** @@ -90,7 +90,7 @@ + */ + public boolean hasSearchBar() + { -+ return field_78033_n == CreativeTabs.field_78027_g.field_78033_n; ++ return tabIndex == CreativeTabs.tabAllSearch.tabIndex; + } + + /** diff --git a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch similarity index 68% rename from patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch rename to patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch index 604488bc9..4173a9d40 100644 --- a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch +++ b/patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch @@ -2,24 +2,24 @@ +++ ../src-work/minecraft/net/minecraft/enchantment/Enchantment.java @@ -62,7 +62,7 @@ - if (field_180311_a[p_i45771_1_] != null) + if (enchantmentsList[enchID] != null) { - throw new IllegalArgumentException("Duplicate enchantment id!"); -+ throw new IllegalArgumentException("Duplicate enchantment id! " + this.getClass() + " and " + field_180311_a[p_i45771_1_].getClass() + " Enchantment ID:" + p_i45771_1_); ++ throw new IllegalArgumentException("Duplicate enchantment id! " + this.getClass() + " and " + enchantmentsList[enchID].getClass() + " Enchantment ID:" + enchID); } else { @@ -149,13 +149,52 @@ - public boolean func_92089_a(ItemStack p_92089_1_) + public boolean canApply(ItemStack stack) { -- return this.field_77351_y.func_77557_a(p_92089_1_.func_77973_b()); -+ return canApplyAtEnchantingTable(p_92089_1_); +- return this.type.canEnchantItem(stack.getItem()); ++ return canApplyAtEnchantingTable(stack); } - public void func_151368_a(EntityLivingBase p_151368_1_, Entity p_151368_2_, int p_151368_3_) {} + public void onEntityDamaged(EntityLivingBase user, Entity target, int level) {} - public void func_151367_b(EntityLivingBase p_151367_1_, Entity p_151367_2_, int p_151367_3_) {} + public void onUserHurt(EntityLivingBase user, Entity attacker, int level) {} + /** + * This applies specifically to applying at the enchanting table. The other method {@link #canApply(ItemStack)} @@ -29,7 +29,7 @@ + */ + public boolean canApplyAtEnchantingTable(ItemStack stack) + { -+ return this.field_77351_y.func_77557_a(stack.func_77973_b()); ++ return this.type.canEnchantItem(stack.getItem()); + } + + private static final java.lang.reflect.Field bookSetter = Enchantment.class.getDeclaredFields()[1]; @@ -43,7 +43,7 @@ + try + { + net.minecraftforge.common.util.EnumHelper.setFailsafeFieldValue(bookSetter, null, -+ com.google.common.collect.ObjectArrays.concat(field_77331_b, enchantment)); ++ com.google.common.collect.ObjectArrays.concat(enchantmentsBookList, enchantment)); + } + catch (Exception e) + { diff --git a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch b/patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch similarity index 50% rename from patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch rename to patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch index 1f684188d..fa0235c3a 100644 --- a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch +++ b/patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch @@ -1,19 +1,19 @@ --- ../src-base/minecraft/net/minecraft/enchantment/EnchantmentHelper.java +++ ../src-work/minecraft/net/minecraft/enchantment/EnchantmentHelper.java @@ -308,7 +308,7 @@ - public static int func_77514_a(Random p_77514_0_, int p_77514_1_, int p_77514_2_, ItemStack p_77514_3_) + public static int calcItemStackEnchantability(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 k = item.func_77619_b(); + Item item = p_77514_3_.getItem(); +- int k = item.getItemEnchantability(); + int k = item.getItemEnchantability(p_77514_3_); if (k <= 0) { @@ -361,7 +361,7 @@ - public static List func_77513_b(Random p_77513_0_, ItemStack p_77513_1_, int p_77513_2_) + public static List buildEnchantmentList(Random p_77513_0_, ItemStack p_77513_1_, int p_77513_2_) { - Item item = p_77513_1_.func_77973_b(); -- int j = item.func_77619_b(); + Item item = p_77513_1_.getItem(); +- int j = item.getItemEnchantability(); + int j = item.getItemEnchantability(p_77513_1_); if (j <= 0) @@ -22,10 +22,10 @@ { EnchantmentData enchantmentdata1 = (EnchantmentData)iterator1.next(); -- if (enchantmentdata1.field_76302_b.func_77326_a(Enchantment.func_180306_c(integer.intValue()))) -+ Enchantment e1 = enchantmentdata1.field_76302_b; -+ Enchantment e2 = Enchantment.func_180306_c(integer.intValue()); -+ if (e1.func_77326_a(e2) && e2.func_77326_a(e1)) //Forge BugFix: Let Both enchantments veto being together +- if (enchantmentdata1.enchantmentobj.canApplyTogether(Enchantment.getEnchantmentById(integer.intValue()))) ++ Enchantment e1 = enchantmentdata1.enchantmentobj; ++ Enchantment e2 = Enchantment.getEnchantmentById(integer.intValue()); ++ if (e1.canApplyTogether(e2) && e2.canApplyTogether(e1)) //Forge BugFix: Let Both enchantments veto being together { continue; } @@ -33,9 +33,9 @@ { Enchantment enchantment = aenchantment[k]; -- if (enchantment != null && (enchantment.field_77351_y.func_77557_a(item) || flag)) +- if (enchantment != null && (enchantment.type.canEnchantItem(item) || flag)) + if (enchantment == null) continue; -+ if (enchantment.canApplyAtEnchantingTable(p_77505_1_) || ((item == Items.field_151122_aG) && enchantment.isAllowedOnBooks())) ++ if (enchantment.canApplyAtEnchantingTable(p_77505_1_) || ((item == Items.book) && enchantment.isAllowedOnBooks())) { - for (int l = enchantment.func_77319_d(); l <= enchantment.func_77325_b(); ++l) + for (int l = enchantment.getMinLevel(); l <= enchantment.getMaxLevel(); ++l) { diff --git a/patches/minecraft/net/minecraft/entity/Entity.java.patch b/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch similarity index 69% rename from patches/minecraft/net/minecraft/entity/Entity.java.patch rename to patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch index c120a7df7..6631d32c3 100644 --- a/patches/minecraft/net/minecraft/entity/Entity.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/entity/Entity.java +++ ../src-work/minecraft/net/minecraft/entity/Entity.java @@ -128,6 +128,14 @@ - private final CommandResultStats field_174837_as; + private final CommandResultStats cmdResultStats; private static final String __OBFID = "CL_00001533"; + /** Forge: Used to store custom data for each entity. */ @@ -12,41 +12,41 @@ + + protected java.util.HashMap extendedProperties = new java.util.HashMap(); + - public int func_145782_y() + public int getEntityId() { - return this.field_145783_c; + return this.entityId; @@ -171,6 +179,8 @@ - this.field_70180_af.func_75682_a(2, ""); - this.field_70180_af.func_75682_a(4, Byte.valueOf((byte)0)); - this.func_70088_a(); + this.dataWatcher.addObject(2, ""); + this.dataWatcher.addObject(4, Byte.valueOf((byte)0)); + this.entityInit(); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this)); -+ for (net.minecraftforge.common.IExtendedEntityProperties props : extendedProperties.values()) props.init(this, p_i1582_1_); ++ for (net.minecraftforge.common.IExtendedEntityProperties props : extendedProperties.values()) props.init(this, worldIn); } - protected abstract void func_70088_a(); + protected abstract void entityInit(); @@ -1010,10 +1020,7 @@ - if (block.func_149688_o() == p_70055_1_) + if (block.getMaterial() == materialIn) { -- float f = BlockLiquid.func_149801_b(iblockstate.func_177230_c().func_176201_c(iblockstate)) - 0.11111111F; -- float f1 = (float)(blockpos.func_177956_o() + 1) - f; +- float f = BlockLiquid.getLiquidHeightPercent(iblockstate.getBlock().getMetaFromState(iblockstate)) - 0.11111111F; +- float f1 = (float)(blockpos.getY() + 1) - f; - boolean flag = d0 < (double)f1; - return !flag && this instanceof EntityPlayer ? false : flag; -+ return net.minecraftforge.common.ForgeHooks.isInsideOfMaterial(p_70055_1_, this, blockpos); ++ return net.minecraftforge.common.ForgeHooks.isInsideOfMaterial(materialIn, this, blockpos); } else { @@ -1378,6 +1385,21 @@ - p_70109_1_.func_74757_a("Silent", this.func_174814_R()); + tagCompund.setBoolean("Silent", this.isSilent()); } -+ if (customEntityData != null) p_70109_1_.func_74782_a("ForgeData", customEntityData); ++ if (customEntityData != null) tagCompund.setTag("ForgeData", customEntityData); + for (String identifier : this.extendedProperties.keySet()) + { + try + { + net.minecraftforge.common.IExtendedEntityProperties props = this.extendedProperties.get(identifier); -+ props.saveNBTData(p_70109_1_); ++ props.saveNBTData(tagCompund); + } + catch (Throwable t) + { @@ -55,21 +55,21 @@ + } + } + - this.func_70014_b(p_70109_1_); + this.writeEntityToNBT(tagCompund); - if (this.field_70154_o != null) + if (this.ridingEntity != null) @@ -1458,6 +1480,28 @@ - this.func_174805_g(p_70020_1_.func_74767_n("CustomNameVisible")); - this.field_174837_as.func_179668_a(p_70020_1_); - this.func_174810_b(p_70020_1_.func_74767_n("Silent")); + this.setAlwaysRenderNameTag(tagCompund.getBoolean("CustomNameVisible")); + this.cmdResultStats.func_179668_a(tagCompund); + this.setSilent(tagCompund.getBoolean("Silent")); + -+ if (p_70020_1_.func_74764_b("ForgeData")) customEntityData = p_70020_1_.func_74775_l("ForgeData"); ++ if (tagCompund.hasKey("ForgeData")) customEntityData = tagCompund.getCompoundTag("ForgeData"); + for (String identifier : this.extendedProperties.keySet()) + { + try + { + net.minecraftforge.common.IExtendedEntityProperties props = this.extendedProperties.get(identifier); -+ props.loadNBTData(p_70020_1_); ++ props.loadNBTData(tagCompund); + } + catch (Throwable t) + { @@ -79,52 +79,52 @@ + } + + //Rawr, legacy code, Vanilla added a UUID, keep this so older maps will convert properly -+ if (p_70020_1_.func_74764_b("PersistentIDMSB") && p_70020_1_.func_74764_b("PersistentIDLSB")) ++ if (tagCompund.hasKey("PersistentIDMSB") && tagCompund.hasKey("PersistentIDLSB")) + { -+ this.field_96093_i = new UUID(p_70020_1_.func_74763_f("PersistentIDMSB"), p_70020_1_.func_74763_f("PersistentIDLSB")); ++ this.entityUniqueID = new UUID(tagCompund.getLong("PersistentIDMSB"), tagCompund.getLong("PersistentIDLSB")); + } + - this.func_70037_a(p_70020_1_); + this.readEntityFromNBT(tagCompund); - if (this.func_142008_O()) + if (this.shouldSetPosAfterLoading()) @@ -1536,7 +1580,10 @@ { - EntityItem entityitem = new EntityItem(this.field_70170_p, this.field_70165_t, this.field_70163_u + (double)p_70099_2_, this.field_70161_v, p_70099_1_); - entityitem.func_174869_p(); -- this.field_70170_p.func_72838_d(entityitem); + EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)offsetY, this.posZ, itemStackIn); + entityitem.setDefaultPickupDelay(); +- this.worldObj.spawnEntityInWorld(entityitem); + if (captureDrops) + this.capturedDrops.add(entityitem); + else -+ this.field_70170_p.func_72838_d(entityitem); ++ this.worldObj.spawnEntityInWorld(entityitem); return entityitem; } else @@ -1672,6 +1719,7 @@ - public void func_70078_a(Entity p_70078_1_) + public void mountEntity(Entity entityIn) { -+ if(!(this instanceof EntityLivingBase) && !net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_70078_1_, true)){ return; } - this.field_70149_e = 0.0D; - this.field_70147_f = 0.0D; ++ if(!(this instanceof EntityLivingBase) && !net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entityIn, true)){ return; } + this.entityRiderPitchDelta = 0.0D; + this.entityRiderYawDelta = 0.0D; @@ -1810,7 +1858,7 @@ - public boolean func_70115_ae() + public boolean isRiding() { -- return this.field_70154_o != null; -+ return this.field_70154_o != null && field_70154_o.shouldRiderSit(); +- return this.ridingEntity != null; ++ return this.ridingEntity != null && ridingEntity.shouldRiderSit(); } - public boolean func_70093_af() + public boolean isSneaking() @@ -2103,7 +2151,7 @@ - public float func_180428_a(Explosion p_180428_1_, World p_180428_2_, BlockPos p_180428_3_, IBlockState p_180428_4_) + public float getExplosionResistance(Explosion p_180428_1_, World worldIn, BlockPos p_180428_3_, IBlockState p_180428_4_) { -- return p_180428_4_.func_177230_c().func_149638_a(this); -+ return p_180428_4_.func_177230_c().getExplosionResistance(p_180428_2_, p_180428_3_.func_177963_a(0, func_70047_e(), 0), this, p_180428_1_); +- return p_180428_4_.getBlock().getExplosionResistance(this); ++ return p_180428_4_.getBlock().getExplosionResistance(worldIn, p_180428_3_.add(0, getEyeHeight(), 0), this, p_180428_1_); } - public boolean func_174816_a(Explosion p_174816_1_, World p_174816_2_, BlockPos p_174816_3_, IBlockState p_174816_4_, float p_174816_5_) + public boolean func_174816_a(Explosion p_174816_1_, World worldIn, BlockPos p_174816_3_, IBlockState p_174816_4_, float p_174816_5_) @@ -2357,4 +2405,184 @@ EnchantmentHelper.func_151385_b(p_174815_1_, p_174815_2_); @@ -164,22 +164,22 @@ + { + if (this instanceof net.minecraft.entity.item.EntityPainting) + { -+ return new ItemStack(net.minecraft.init.Items.field_151159_an); ++ return new ItemStack(net.minecraft.init.Items.painting); + } + else if (this instanceof EntityLeashKnot) + { -+ return new ItemStack(net.minecraft.init.Items.field_151058_ca); ++ return new ItemStack(net.minecraft.init.Items.lead); + } + else if (this instanceof net.minecraft.entity.item.EntityItemFrame) + { -+ ItemStack held = ((net.minecraft.entity.item.EntityItemFrame)this).func_82335_i(); ++ ItemStack held = ((net.minecraft.entity.item.EntityItemFrame)this).getDisplayedItem(); + if (held == null) + { -+ return new ItemStack(net.minecraft.init.Items.field_151160_bD); ++ return new ItemStack(net.minecraft.init.Items.item_frame); + } + else + { -+ return held.func_77946_l(); ++ return held.copy(); + } + } + else if (this instanceof net.minecraft.entity.item.EntityMinecart) @@ -188,24 +188,24 @@ + } + else if (this instanceof net.minecraft.entity.item.EntityBoat) + { -+ return new ItemStack(net.minecraft.init.Items.field_151124_az); ++ return new ItemStack(net.minecraft.init.Items.boat); + } + else if (this instanceof net.minecraft.entity.item.EntityArmorStand) + { -+ return new ItemStack(net.minecraft.init.Items.field_179565_cj); ++ return new ItemStack(net.minecraft.init.Items.armor_stand); + } + else + { -+ int id = EntityList.func_75619_a(this); -+ if (id > 0 && EntityList.field_75627_a.containsKey(id)) ++ int id = EntityList.getEntityID(this); ++ if (id > 0 && EntityList.entityEggs.containsKey(id)) + { -+ return new ItemStack(net.minecraft.init.Items.field_151063_bx, 1, id); ++ return new ItemStack(net.minecraft.init.Items.spawn_egg, 1, id); + } -+ String name = EntityList.func_75621_b(this); ++ String name = EntityList.getEntityString(this); + if (name != null && net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().containsKey(name)) + { -+ ItemStack stack = new ItemStack(net.minecraft.init.Items.field_151063_bx); -+ stack.func_77983_a("entity_name", new net.minecraft.nbt.NBTTagString(name)); ++ ItemStack stack = new ItemStack(net.minecraft.init.Items.spawn_egg); ++ stack.setTagInfo("entity_name", new net.minecraft.nbt.NBTTagString(name)); + return stack; + } + } @@ -214,7 +214,7 @@ + + public UUID getPersistentID() + { -+ return field_96093_i; ++ return entityUniqueID; + } + + /** @@ -222,7 +222,7 @@ + */ + public final void resetEntityId() + { -+ this.field_145783_c = field_70152_a++; ++ this.entityId = nextEntityID++; + } + + public boolean shouldRenderInPass(int pass) @@ -238,8 +238,8 @@ + */ + public boolean isCreatureType(EnumCreatureType type, boolean forSpawnCount) + { -+ if (forSpawnCount && (this instanceof EntityLiving) && ((EntityLiving)this).func_104002_bU()) return false; -+ return type.func_75598_a().isAssignableFrom(this.getClass()); ++ if (forSpawnCount && (this instanceof EntityLiving) && ((EntityLiving)this).isNoDespawnRequired()) return false; ++ return type.getCreatureClass().isAssignableFrom(this.getClass()); + } + + /** diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch new file mode 100644 index 000000000..a9cab8a70 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityHanging.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityHanging.java +@@ -124,6 +124,9 @@ + { + BlockPos blockpos1 = blockpos.offset(enumfacing, k).up(l); + Block block = this.worldObj.getBlockState(blockpos1).getBlock(); ++ ++ if ( block.isSideSolid( this.worldObj, blockpos1, this.field_174860_b )) ++ continue; + + if (!block.getMaterial().isSolid() && !BlockRedstoneDiode.isRedstoneRepeaterBlockID(block)) + { diff --git a/patches/minecraft/net/minecraft/entity/EntityList.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch similarity index 62% rename from patches/minecraft/net/minecraft/entity/EntityList.java.patch rename to patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch index 800d27c1b..2c4220234 100644 --- a/patches/minecraft/net/minecraft/entity/EntityList.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch @@ -2,21 +2,21 @@ +++ ../src-work/minecraft/net/minecraft/entity/EntityList.java @@ -90,6 +90,7 @@ - public static void func_75618_a(Class p_75618_0_, String p_75618_1_, int p_75618_2_) + public static void addMapping(Class p_75618_0_, String p_75618_1_, int p_75618_2_) { + if (p_75618_2_ < 0 || p_75618_2_ > 255) throw new IllegalArgumentException("Attempted to register a entity with invalid ID: " + p_75618_2_ + " Name: " + p_75618_1_ + " Class: " + p_75618_0_); - if (field_75625_b.containsKey(p_75618_1_)) + if (stringToClassMapping.containsKey(p_75618_1_)) { throw new IllegalArgumentException("ID is already registered: " + p_75618_1_); @@ -153,9 +154,10 @@ - p_75615_0_.func_82580_o("Type"); + p_75615_0_.removeTag("Type"); } + Class oclass = null; try { -- Class oclass = (Class)field_75625_b.get(p_75615_0_.func_74779_i("id")); -+ oclass = (Class)field_75625_b.get(p_75615_0_.func_74779_i("id")); +- Class oclass = (Class)stringToClassMapping.get(p_75615_0_.getString("id")); ++ oclass = (Class)stringToClassMapping.get(p_75615_0_.getString("id")); if (oclass != null) { @@ -26,13 +26,13 @@ { + try + { - entity.func_70020_e(p_75615_0_); + entity.readFromNBT(p_75615_0_); + } + catch (Exception e) + { + net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, + "An Entity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", -+ p_75615_0_.func_74779_i("id"), oclass.getName()); ++ p_75615_0_.getString("id"), oclass.getName()); + entity = null; + } } @@ -43,26 +43,26 @@ public static class EntityEggInfo { + @Deprecated // This is not always a valid number in the global ID list. - public final int field_75613_a; + public final int spawnedID; + public final String name; - public final int field_75611_b; - public final int field_75612_c; + public final int primaryColor; + public final int secondaryColor; public final StatBase field_151512_d; @@ -358,6 +372,17 @@ - this.field_75612_c = p_i1583_3_; - this.field_151512_d = StatList.func_151182_a(this); - this.field_151513_e = StatList.func_151176_b(this); -+ this.name = EntityList.func_75617_a(p_i1583_1_); + this.secondaryColor = p_i1583_3_; + this.field_151512_d = StatList.getStatKillEntity(this); + this.field_151513_e = StatList.getStatEntityKilledBy(this); ++ this.name = EntityList.getStringFromID(p_i1583_1_); } + + public EntityEggInfo(String name, int primaryColor, int secondaryColor) + { -+ this.field_75613_a = -1; ++ this.spawnedID = -1; + this.name = name; -+ this.field_75611_b = primaryColor; -+ this.field_75612_c = secondaryColor; -+ this.field_151512_d = (new StatBase("stat.killEntity." + name, new net.minecraft.util.ChatComponentTranslation("stat.entityKill", new net.minecraft.util.ChatComponentTranslation("entity." + name + ".name")))).func_75971_g(); -+ this.field_151513_e = (new StatBase("stat.entityKilledBy." + name, new net.minecraft.util.ChatComponentTranslation("stat.entityKilledBy", new net.minecraft.util.ChatComponentTranslation("entity." + name + ".name")))).func_75971_g(); ++ this.primaryColor = primaryColor; ++ this.secondaryColor = secondaryColor; ++ this.field_151512_d = (new StatBase("stat.killEntity." + name, new net.minecraft.util.ChatComponentTranslation("stat.entityKill", new net.minecraft.util.ChatComponentTranslation("entity." + name + ".name")))).registerStat(); ++ this.field_151513_e = (new StatBase("stat.entityKilledBy." + name, new net.minecraft.util.ChatComponentTranslation("stat.entityKilledBy", new net.minecraft.util.ChatComponentTranslation("entity." + name + ".name")))).registerStat(); + } } } diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityLiving.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityLiving.java.patch new file mode 100644 index 000000000..876ec7925 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityLiving.java.patch @@ -0,0 +1,41 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityLiving.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityLiving.java +@@ -124,6 +124,7 @@ + public void setAttackTarget(EntityLivingBase p_70624_1_) + { + this.attackTarget = p_70624_1_; ++ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, p_70624_1_); + } + + public boolean canAttackClass(Class p_70686_1_) +@@ -507,10 +508,22 @@ + + protected void despawnEntity() + { ++ net.minecraftforge.fml.common.eventhandler.Event.Result result = null; + if (this.persistenceRequired) + { + this.entityAge = 0; + } ++ else if ((this.entityAge & 0x1F) == 0x1F && (result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this)) != net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT) ++ { ++ if (result == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ { ++ this.entityAge = 0; ++ } ++ else ++ { ++ this.setDead(); ++ } ++ } + else + { + EntityPlayer entityplayer = this.worldObj.getClosestPlayerToEntity(this, -1.0D); +@@ -628,7 +641,6 @@ + return this.worldObj.checkNoEntityCollision(this.getEntityBoundingBox(), this) && this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(this.getEntityBoundingBox()); + } + +- @SideOnly(Side.CLIENT) + public float getRenderSizeModifier() + { + return 1.0F; diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch new file mode 100644 index 000000000..42dd1f820 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -0,0 +1,212 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java +@@ -233,7 +233,7 @@ + } + } + +- if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity instanceof EntityLivingBase) ++ if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity != null && ridingEntity.shouldDismountInWater(this)) + { + this.mountEntity((Entity)null); + } +@@ -316,7 +316,7 @@ + if (!this.worldObj.isRemote && (this.recentlyHit > 0 || this.isPlayer()) && this.func_146066_aG() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) + { + i = this.getExperiencePoints(this.attackingPlayer); +- ++ i = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.attackingPlayer, i); + while (i > 0) + { + int j = EntityXPOrb.getXPSplit(i); +@@ -377,6 +377,7 @@ + { + this.entityLivingToAttack = livingBase; + this.revengeTimer = this.ticksExisted; ++ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, livingBase); + } + + public EntityLivingBase getLastAttacker() +@@ -672,7 +673,6 @@ + return this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD; + } + +- @SideOnly(Side.CLIENT) + public void removePotionEffectClient(int p_70618_1_) + { + this.activePotionsMap.remove(Integer.valueOf(p_70618_1_)); +@@ -721,6 +721,8 @@ + + public void heal(float healAmount) + { ++ healAmount = net.minecraftforge.event.ForgeEventFactory.onLivingHeal(this, healAmount); ++ if (healAmount <= 0) return; + float f1 = this.getHealth(); + + if (f1 > 0.0F) +@@ -741,6 +743,7 @@ + + public boolean attackEntityFrom(DamageSource source, float amount) + { ++ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, source, amount)) return false; + if (this.isEntityInvulnerable(source)) + { + return false; +@@ -806,9 +809,9 @@ + this.recentlyHit = 100; + this.attackingPlayer = (EntityPlayer)entity; + } +- else if (entity instanceof EntityWolf) ++ else if (entity instanceof net.minecraft.entity.passive.EntityTameable) + { +- EntityWolf entitywolf = (EntityWolf)entity; ++ net.minecraft.entity.passive.EntityTameable entitywolf = (net.minecraft.entity.passive.EntityTameable)entity; + + if (entitywolf.isTamed()) + { +@@ -894,6 +897,7 @@ + + public void onDeath(DamageSource cause) + { ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; + Entity entity = cause.getEntity(); + EntityLivingBase entitylivingbase = this.func_94060_bK(); + +@@ -919,6 +923,9 @@ + i = EnchantmentHelper.getLootingModifier((EntityLivingBase)entity); + } + ++ captureDrops = true; ++ capturedDrops.clear(); ++ + if (this.func_146066_aG() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) + { + this.dropFewItems(this.recentlyHit > 0, i); +@@ -929,6 +936,16 @@ + this.addRandomArmor(); + } + } ++ ++ captureDrops = false; ++ ++ if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, cause, capturedDrops, i, recentlyHit > 0)) ++ { ++ for (EntityItem item : capturedDrops) ++ { ++ worldObj.spawnEntityInWorld(item); ++ } ++ } + } + + this.worldObj.setEntityState(this, (byte)3); +@@ -977,7 +994,7 @@ + int j = MathHelper.floor_double(this.getEntityBoundingBox().minY); + int k = MathHelper.floor_double(this.posZ); + Block block = this.worldObj.getBlockState(new BlockPos(i, j, k)).getBlock(); +- return (block == Blocks.ladder || block == Blocks.vine) && (!(this instanceof EntityPlayer) || !((EntityPlayer)this).isSpectator()); ++ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(block, worldObj, new BlockPos(i, j, k), this); + } + + public boolean isEntityAlive() +@@ -987,6 +1004,9 @@ + + public void fall(float distance, float damageMultiplier) + { ++ float[] ret = net.minecraftforge.common.ForgeHooks.onLivingFall(this, distance, damageMultiplier); ++ if (ret == null) return; ++ distance = ret[0]; damageMultiplier = ret[1]; + super.fall(distance, damageMultiplier); + PotionEffect potioneffect = this.getActivePotionEffect(Potion.jump); + float f2 = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F; +@@ -1105,6 +1125,8 @@ + { + if (!this.isEntityInvulnerable(damageSrc)) + { ++ damageAmount = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, damageSrc, damageAmount); ++ if (damageAmount <= 0) return; + damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); + damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); + float f1 = damageAmount; +@@ -1153,6 +1175,11 @@ + + public void swingItem() + { ++ ItemStack stack = this.getHeldItem(); ++ if (stack != null && stack.getItem() != null) ++ { ++ if (stack.getItem().onEntitySwing(this, stack)) return; ++ } + if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0) + { + this.swingProgressInt = -1; +@@ -1294,6 +1321,7 @@ + + public void dismountEntity(Entity p_110145_1_) + { ++ if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_110145_1_, false)){ return; } + double d0 = p_110145_1_.posX; + double d1 = p_110145_1_.getEntityBoundingBox().minY + (double)p_110145_1_.height; + double d2 = p_110145_1_.posZ; +@@ -1359,6 +1387,7 @@ + } + + this.isAirBorne = true; ++ net.minecraftforge.common.ForgeHooks.onLivingJump(this); + } + + protected void updateAITick() +@@ -1545,6 +1574,7 @@ + + public void onUpdate() + { ++ if (net.minecraftforge.common.ForgeHooks.onLivingUpdate(this)) return; + super.onUpdate(); + + if (!this.worldObj.isRemote) +@@ -1828,6 +1858,7 @@ + + public void mountEntity(Entity entityIn) + { ++ if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entityIn, true)){ return; } + if (this.ridingEntity != null && entityIn == null) + { + if (!this.worldObj.isRemote) +@@ -2000,4 +2031,39 @@ + { + this.potionsNeedUpdate = true; + } ++ ++ /*** ++ * Removes all potion effects that have curativeItem as a curative item for its effect ++ * @param curativeItem The itemstack we are using to cure potion effects ++ */ ++ public void curePotionEffects(ItemStack curativeItem) ++ { ++ Iterator potionKey = activePotionsMap.keySet().iterator(); ++ if (worldObj.isRemote) return; ++ ++ while (potionKey.hasNext()) ++ { ++ Integer key = potionKey.next(); ++ PotionEffect effect = (PotionEffect)activePotionsMap.get(key); ++ ++ if (effect.isCurativeItem(curativeItem)) ++ { ++ potionKey.remove(); ++ onFinishedPotionEffect(effect); ++ this.potionsNeedUpdate = true; ++ } ++ } ++ } ++ ++ /** ++ * Returns true if the entity's rider (EntityPlayer) should face forward when mounted. ++ * currently only used in vanilla code by pigs. ++ * ++ * @param player The player who is riding the entity. ++ * @return If the player should orient the same direction as this entity. ++ */ ++ public boolean shouldRiderFaceForward(EntityPlayer player) ++ { ++ return this instanceof net.minecraft.entity.passive.EntityPig; ++ } + } diff --git a/patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch similarity index 68% rename from patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch rename to patches.mcp/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch index db7a4fe19..ad187ed62 100644 --- a/patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java @@ -111,6 +111,7 @@ - public boolean func_130002_c(EntityPlayer p_130002_1_) + public boolean interactFirst(EntityPlayer playerIn) { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_130002_1_))) return true; - this.field_145824_a.func_175574_a(p_130002_1_); ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; + this.commandBlockLogic.func_175574_a(playerIn); return false; } diff --git a/patches/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch rename to patches.mcp/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch diff --git a/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityTracker.java.patch similarity index 84% rename from patches/minecraft/net/minecraft/entity/EntityTracker.java.patch rename to patches.mcp/minecraft/net/minecraft/entity/EntityTracker.java.patch index 74d6449d4..7b2ba0345 100644 --- a/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityTracker.java.patch @@ -2,13 +2,13 @@ +++ ../src-work/minecraft/net/minecraft/entity/EntityTracker.java @@ -58,6 +58,8 @@ - public void func_72786_a(Entity p_72786_1_) + public void trackEntity(Entity p_72786_1_) { + if (net.minecraftforge.fml.common.registry.EntityRegistry.instance().tryTrackingEntity(this, p_72786_1_)) return; + if (p_72786_1_ instanceof EntityPlayerMP) { - this.func_72791_a(p_72786_1_, 512, 2); + this.trackEntity(p_72786_1_, 512, 2); @@ -355,4 +357,23 @@ } } @@ -24,11 +24,11 @@ + */ + public Set getTrackingPlayers(Entity entity) + { -+ EntityTrackerEntry entry = (EntityTrackerEntry) field_72794_c.func_76041_a(entity.func_145782_y()); ++ EntityTrackerEntry entry = (EntityTrackerEntry) trackedEntityHashTable.lookup(entity.getEntityId()); + if (entry == null) + return java.util.Collections.emptySet(); + else -+ return java.util.Collections.unmodifiableSet(entry.field_73134_o); ++ return java.util.Collections.unmodifiableSet(entry.trackingPlayers); + } + + /* ======================================== FORGE END =====================================*/ diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch new file mode 100644 index 000000000..047889a3d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch @@ -0,0 +1,42 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityTrackerEntry.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityTrackerEntry.java +@@ -388,6 +388,14 @@ + this.lastTrackedEntityMotionY = this.trackedEntity.motionY; + this.motionZ = this.trackedEntity.motionZ; + ++ int posX = MathHelper.floor_double(this.trackedEntity.posX * 32.0D); ++ int posY = MathHelper.floor_double(this.trackedEntity.posY * 32.0D); ++ int posZ = MathHelper.floor_double(this.trackedEntity.posZ * 32.0D); ++ if (posX != this.encodedPosX || posY != this.encodedPosY || posZ != this.encodedPosZ) ++ { ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.makeEntitySpawnAdjustment(this.trackedEntity, p_73117_1_, this.encodedPosX, this.encodedPosY, this.encodedPosZ); ++ } ++ + if (this.sendVelocityUpdates && !(packet instanceof S0FPacketSpawnMob)) + { + p_73117_1_.playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(this.trackedEntity.getEntityId(), this.trackedEntity.motionX, this.trackedEntity.motionY, this.trackedEntity.motionZ)); +@@ -437,12 +445,14 @@ + p_73117_1_.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(this.trackedEntity.getEntityId(), potioneffect)); + } + } ++ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(trackedEntity, p_73117_1_); + } + } + else if (this.trackingPlayers.contains(p_73117_1_)) + { + this.trackingPlayers.remove(p_73117_1_); + p_73117_1_.func_152339_d(this.trackedEntity); ++ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(trackedEntity, p_73117_1_); + } + } + } +@@ -474,6 +484,9 @@ + logger.warn("Fetching addPacket for removed entity"); + } + ++ Packet pkt = net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.getEntitySpawningPacket(this.trackedEntity); ++ if (pkt != null) return pkt; ++ + if (this.trackedEntity instanceof EntityItem) + { + return new S0EPacketSpawnObject(this.trackedEntity, 2, 1); diff --git a/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch b/patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch similarity index 61% rename from patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch rename to patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch index 453f8aaea..edc78f44e 100644 --- a/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch @@ -10,8 +10,8 @@ public EntityAIAttackOnCollide(EntityCreature p_i1635_1_, Class p_i1635_2_, double p_i1635_3_, boolean p_i1635_5_) { this(p_i1635_1_, p_i1635_3_, p_i1635_5_); - this.field_75444_h = p_i1635_2_; -+ canPenalize = field_75444_h == null || !net.minecraft.entity.player.EntityPlayer.class.isAssignableFrom(field_75444_h); //Only enable delaying when not targeting players. + this.classTarget = p_i1635_2_; ++ canPenalize = classTarget == null || !net.minecraft.entity.player.EntityPlayer.class.isAssignableFrom(classTarget); //Only enable delaying when not targeting players. } public EntityAIAttackOnCollide(EntityCreature p_i1636_1_, double p_i1636_2_, boolean p_i1636_4_) @@ -23,29 +23,29 @@ + { + if (--this.field_75445_i <= 0) + { -+ this.field_75438_g = this.field_75441_b.func_70661_as().func_75494_a(entitylivingbase); -+ this.field_151497_i = 4 + this.field_75441_b.func_70681_au().nextInt(7); -+ return this.field_75438_g != null; ++ this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); ++ this.field_151497_i = 4 + this.attacker.getRNG().nextInt(7); ++ return this.entityPathEntity != null; + } + else + { + return true; + } + } - this.field_75438_g = this.field_75441_b.func_70661_as().func_75494_a(entitylivingbase); - return this.field_75438_g != null; + this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); + return this.entityPathEntity != null; } @@ -91,6 +107,23 @@ - this.field_151496_k = entitylivingbase.field_70161_v; - this.field_75445_i = 4 + this.field_75441_b.func_70681_au().nextInt(7); + this.field_151496_k = entitylivingbase.posZ; + this.field_75445_i = 4 + this.attacker.getRNG().nextInt(7); + if (this.canPenalize) + { + this.field_151497_i += failedPathFindingPenalty; -+ if (this.field_75441_b.func_70661_as().func_75505_d() != null) ++ if (this.attacker.getNavigator().getPath() != null) + { -+ net.minecraft.pathfinding.PathPoint finalPathPoint = this.field_75441_b.func_70661_as().func_75505_d().func_75870_c(); -+ if (finalPathPoint != null && entitylivingbase.func_70092_e(finalPathPoint.field_75839_a, finalPathPoint.field_75837_b, finalPathPoint.field_75838_c) < 1) ++ net.minecraft.pathfinding.PathPoint finalPathPoint = this.attacker.getNavigator().getPath().getFinalPathPoint(); ++ if (finalPathPoint != null && entitylivingbase.getDistanceSq(finalPathPoint.xCoord, finalPathPoint.yCoord, finalPathPoint.zCoord) < 1) + failedPathFindingPenalty = 0; + else + failedPathFindingPenalty += 10; diff --git a/patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch b/patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch new file mode 100644 index 000000000..a1da34e91 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/entity/boss/EntityDragon.java ++++ ../src-work/minecraft/net/minecraft/entity/boss/EntityDragon.java +@@ -486,9 +486,9 @@ + { + Block block = this.worldObj.getBlockState(new BlockPos(k1, l1, i2)).getBlock(); + +- if (block.getMaterial() != Material.air) ++ if (!block.isAir(worldObj, new BlockPos(k1, l1, i2))) + { +- if (block != Blocks.barrier && block != Blocks.obsidian && block != Blocks.end_stone && block != Blocks.bedrock && block != Blocks.command_block && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) ++ if (block.canEntityDestroy(worldObj, new BlockPos(k1, l1, i2), this) && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) + { + flag1 = this.worldObj.setBlockToAir(new BlockPos(k1, l1, i2)) || flag1; + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch b/patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch new file mode 100644 index 000000000..f4a070815 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/entity/boss/EntityWither.java ++++ ../src-work/minecraft/net/minecraft/entity/boss/EntityWither.java +@@ -351,7 +351,7 @@ + int l = j1 + i2; + Block block = this.worldObj.getBlockState(new BlockPos(j2, k, l)).getBlock(); + +- if (block.getMaterial() != Material.air && block != Blocks.bedrock && block != Blocks.end_portal && block != Blocks.end_portal_frame && block != Blocks.command_block && block != Blocks.barrier) ++ if (!block.isAir(worldObj, new BlockPos(j2, k, l)) && block.canEntityDestroy(worldObj, new BlockPos(j2, k, l), this)) + { + flag = this.worldObj.destroyBlock(new BlockPos(j2, k, l), true) || flag; + } diff --git a/patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch b/patches.mcp/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch similarity index 91% rename from patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch rename to patches.mcp/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch index ee9c56e4c..98bf84269 100644 --- a/patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch @@ -7,4 +7,4 @@ -@SideOnly(Side.CLIENT) public interface IBossDisplayData { - float func_110138_aP(); + float getMaxHealth(); diff --git a/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch b/patches.mcp/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch similarity index 80% rename from patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch rename to patches.mcp/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch index 6a8a40087..61146d333 100644 --- a/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch @@ -4,9 +4,9 @@ for (int i = 0; i < list.size(); ++i) { Entity entity = (Entity)list.get(i); -- entity.func_70077_a(this); +- entity.onStruckByLightning(this); + if (!net.minecraftforge.event.ForgeEventFactory.onEntityStruckByLightning(entity, this)) -+ entity.func_70077_a(this); ++ entity.onStruckByLightning(this); } } } diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch new file mode 100644 index 000000000..9086df4b3 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch @@ -0,0 +1,25 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityEnderPearl.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityEnderPearl.java +@@ -50,6 +50,9 @@ + + if (entityplayermp.playerNetServerHandler.getNetworkManager().isChannelOpen() && entityplayermp.worldObj == this.worldObj && !entityplayermp.isPlayerSleeping()) + { ++ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ, 5.0F); ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) ++ { // Don't indent to lower patch size + if (this.rand.nextFloat() < 0.05F && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobSpawning")) + { + EntityEndermite entityendermite = new EntityEndermite(this.worldObj); +@@ -63,9 +66,10 @@ + entitylivingbase.mountEntity((Entity)null); + } + +- entitylivingbase.setPositionAndUpdate(this.posX, this.posY, this.posZ); ++ entitylivingbase.setPositionAndUpdate(event.targetX, event.targetY, event.targetZ); + entitylivingbase.fallDistance = 0.0F; +- entitylivingbase.attackEntityFrom(DamageSource.fall, 5.0F); ++ entitylivingbase.attackEntityFrom(DamageSource.fall, event.attackDamage); ++ } + } + } + diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch new file mode 100644 index 000000000..be95fe9e9 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch @@ -0,0 +1,94 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityItem.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityItem.java +@@ -31,6 +31,11 @@ + public float hoverStart; + private static final String __OBFID = "CL_00001669"; + ++ /** ++ * The maximum age of this EntityItem. The item is expired once this is reached. ++ */ ++ public int lifespan = 6000; ++ + public EntityItem(World worldIn, double x, double y, double z) + { + super(worldIn); +@@ -48,6 +53,7 @@ + { + this(worldIn, x, y, z); + this.setEntityItemStack(stack); ++ this.lifespan = (stack.getItem() == null ? 6000 : stack.getItem().getEntityLifespan(stack, worldIn)); + } + + protected boolean canTriggerWalking() +@@ -71,6 +77,8 @@ + + public void onUpdate() + { ++ ItemStack stack = this.getDataWatcher().getWatchableObjectItemStack(10); ++ if (stack != null && stack.getItem() != null && stack.getItem().onEntityItemUpdate(this)) return; + if (this.getEntityItem() == null) + { + this.setDead(); +@@ -131,8 +139,16 @@ + + this.handleWaterMovement(); + +- if (!this.worldObj.isRemote && this.age >= 6000) ++ ItemStack item = getDataWatcher().getWatchableObjectItemStack(10); ++ ++ if (!this.worldObj.isRemote && this.age >= lifespan) + { ++ int hook = net.minecraftforge.event.ForgeEventFactory.onItemExpire(this, item); ++ if (hook < 0) this.setDead(); ++ else this.lifespan += hook; ++ } ++ if (item != null && item.stackSize <= 0) ++ { + this.setDead(); + } + } +@@ -276,6 +292,7 @@ + tagCompound.setShort("Health", (short)((byte)this.health)); + tagCompound.setShort("Age", (short)this.age); + tagCompound.setShort("PickupDelay", (short)this.delayBeforeCanPickup); ++ tagCompound.setInteger("Lifespan", lifespan); + + if (this.getThrower() != null) + { +@@ -316,20 +333,23 @@ + NBTTagCompound nbttagcompound1 = tagCompund.getCompoundTag("Item"); + this.setEntityItemStack(ItemStack.loadItemStackFromNBT(nbttagcompound1)); + +- if (this.getEntityItem() == null) +- { +- this.setDead(); +- } ++ ItemStack item = getDataWatcher().getWatchableObjectItemStack(10); ++ if (item == null || item.stackSize <= 0) this.setDead(); ++ if (tagCompund.hasKey("Lifespan")) lifespan = tagCompund.getInteger("Lifespan"); + } + + public void onCollideWithPlayer(EntityPlayer entityIn) + { + if (!this.worldObj.isRemote) + { ++ if (this.delayBeforeCanPickup > 0) return; + ItemStack itemstack = this.getEntityItem(); + int i = itemstack.stackSize; + +- if (this.delayBeforeCanPickup == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack)) ++ int hook = net.minecraftforge.event.ForgeEventFactory.onItemPickup(this, entityIn, itemstack); ++ if (hook < 0) return; ++ ++ if (this.delayBeforeCanPickup <= 0 && (this.owner == null || lifespan - this.age <= 200 || this.owner.equals(entityIn.getName())) && (hook == 1 || i <= 0 || entityIn.inventory.addItemStackToInventory(itemstack))) + { + if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log)) + { +@@ -366,6 +386,7 @@ + } + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerItemPickupEvent(entityIn, this); + if (!this.isSilent()) + { + this.worldObj.playSoundAtEntity(entityIn, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch new file mode 100644 index 000000000..3b105563f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityItemFrame.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityItemFrame.java +@@ -123,7 +123,7 @@ + { + if (p_110131_1_ != null) + { +- if (p_110131_1_.getItem() == Items.filled_map) ++ if (p_110131_1_.getItem() instanceof net.minecraft.item.ItemMap) + { + MapData mapdata = ((ItemMap)p_110131_1_.getItem()).getMapData(p_110131_1_, this.worldObj); + mapdata.playersVisibleOnMap.remove("frame-" + this.getEntityId()); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch similarity index 53% rename from patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch rename to patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch index b0dcddbec..e75910a28 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecart.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecart.java @@ -52,6 +52,20 @@ - private double field_70506_as; + private double velocityZ; private static final String __OBFID = "CL_00001670"; + /* Forge: Minecart Compatibility Layer Integration. */ @@ -18,97 +18,97 @@ + protected float maxSpeedAirVertical = defaultMaxSpeedAirVertical; + protected double dragAir = defaultDragAir; + - public EntityMinecart(World p_i1712_1_) + public EntityMinecart(World worldIn) { - super(p_i1712_1_); + super(worldIn); @@ -97,17 +111,19 @@ - public AxisAlignedBB func_70114_g(Entity p_70114_1_) + public AxisAlignedBB getCollisionBox(Entity entityIn) { -+ if (getCollisionHandler() != null) return getCollisionHandler().getCollisionBox(this, p_70114_1_); - return p_70114_1_.func_70104_M() ? p_70114_1_.func_174813_aQ() : null; ++ if (getCollisionHandler() != null) return getCollisionHandler().getCollisionBox(this, entityIn); + return entityIn.canBePushed() ? entityIn.getEntityBoundingBox() : null; } - public AxisAlignedBB func_70046_E() + public AxisAlignedBB getBoundingBox() { + if (getCollisionHandler() != null) return getCollisionHandler().getBoundingBox(this); return null; } - public boolean func_70104_M() + public boolean canBePushed() { - return true; + return canBePushed; } - public EntityMinecart(World p_i1713_1_, double p_i1713_2_, double p_i1713_4_, double p_i1713_6_) + public EntityMinecart(World worldIn, double p_i1713_2_, double p_i1713_4_, double p_i1713_6_) @@ -309,7 +325,7 @@ BlockPos blockpos = new BlockPos(j, i, k); - IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); + IBlockState iblockstate = this.worldObj.getBlockState(blockpos); -- if (BlockRailBase.func_176563_d(iblockstate)) -+ if (canUseRail() && BlockRailBase.func_176563_d(iblockstate)) +- if (BlockRailBase.isRailBlock(iblockstate)) ++ if (canUseRail() && BlockRailBase.isRailBlock(iblockstate)) { this.func_180460_a(blockpos, iblockstate); @@ -347,7 +363,10 @@ } - this.func_70101_b(this.field_70177_z, this.field_70125_A); -- Iterator iterator = this.field_70170_p.func_72839_b(this, this.func_174813_aQ().func_72314_b(0.20000000298023224D, 0.0D, 0.20000000298023224D)).iterator(); + this.setRotation(this.rotationYaw, this.rotationPitch); +- Iterator iterator = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D)).iterator(); + AxisAlignedBB box; + if (getCollisionHandler() != null) box = this.getCollisionHandler().getMinecartCollisionBox(this); -+ else box = this.func_174813_aQ().func_72314_b(0.20000000298023224D, 0.0D, 0.20000000298023224D); -+ Iterator iterator = this.field_70170_p.func_72839_b(this, box).iterator(); ++ else box = this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D); ++ Iterator iterator = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, box).iterator(); while (iterator.hasNext()) { @@ -370,6 +389,7 @@ } - this.func_70072_I(); + this.handleWaterMovement(); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartUpdateEvent(this, this.getCurrentRailPosition())); } } @@ -382,10 +402,21 @@ - protected void func_180459_n() + protected void moveDerailedMinecart() { - double d0 = this.func_174898_m(); -+ double d0 = field_70122_E ? this.func_174898_m() : getMaxSpeedAirLateral(); - this.field_70159_w = MathHelper.func_151237_a(this.field_70159_w, -d0, d0); - this.field_70179_y = MathHelper.func_151237_a(this.field_70179_y, -d0, d0); ++ double d0 = onGround ? this.func_174898_m() : getMaxSpeedAirLateral(); + this.motionX = MathHelper.clamp_double(this.motionX, -d0, d0); + this.motionZ = MathHelper.clamp_double(this.motionZ, -d0, d0); -+ double moveY = field_70181_x; -+ if(getMaxSpeedAirVertical() > 0 && field_70181_x > getMaxSpeedAirVertical()) ++ double moveY = motionY; ++ if(getMaxSpeedAirVertical() > 0 && motionY > getMaxSpeedAirVertical()) + { + moveY = getMaxSpeedAirVertical(); -+ if(Math.abs(field_70159_w) < 0.3f && Math.abs(field_70179_y) < 0.3f) ++ if(Math.abs(motionX) < 0.3f && Math.abs(motionZ) < 0.3f) + { + moveY = 0.15f; -+ field_70181_x = moveY; ++ motionY = moveY; + } + } + - if (this.field_70122_E) + if (this.onGround) { - this.field_70159_w *= 0.5D; + this.motionX *= 0.5D; @@ -393,13 +424,13 @@ - this.field_70179_y *= 0.5D; + this.motionZ *= 0.5D; } -- this.func_70091_d(this.field_70159_w, this.field_70181_x, this.field_70179_y); -+ this.func_70091_d(this.field_70159_w, moveY, this.field_70179_y); +- this.moveEntity(this.motionX, this.motionY, this.motionZ); ++ this.moveEntity(this.motionX, moveY, this.motionZ); - if (!this.field_70122_E) + if (!this.onGround) { -- this.field_70159_w *= 0.949999988079071D; -- this.field_70181_x *= 0.949999988079071D; -- this.field_70179_y *= 0.949999988079071D; -+ this.field_70159_w *= getDragAir(); -+ this.field_70181_x *= getDragAir(); -+ this.field_70179_y *= getDragAir(); +- this.motionX *= 0.949999988079071D; +- this.motionY *= 0.949999988079071D; +- this.motionZ *= 0.949999988079071D; ++ this.motionX *= getDragAir(); ++ this.motionY *= getDragAir(); ++ this.motionZ *= getDragAir(); } } @@ -118,29 +118,29 @@ - double d0 = 0.0078125D; + double slopeAdjustment = getSlopeAdjustment(); - BlockRailBase.EnumRailDirection enumraildirection = (BlockRailBase.EnumRailDirection)p_180460_2_.func_177229_b(blockrailbase.func_176560_l()); + BlockRailBase.EnumRailDirection enumraildirection = (BlockRailBase.EnumRailDirection)p_180460_2_.getValue(blockrailbase.getShapeProperty()); - switch (EntityMinecart.SwitchEnumMinecartType.field_180036_b[enumraildirection.ordinal()]) + switch (EntityMinecart.SwitchEnumMinecartType.RAIL_SHAPE_LOOKUP[enumraildirection.ordinal()]) { case 1: -- this.field_70159_w -= 0.0078125D; -+ this.field_70159_w -= slopeAdjustment; - ++this.field_70163_u; +- this.motionX -= 0.0078125D; ++ this.motionX -= slopeAdjustment; + ++this.posY; break; case 2: -- this.field_70159_w += 0.0078125D; -+ this.field_70159_w += slopeAdjustment; - ++this.field_70163_u; +- this.motionX += 0.0078125D; ++ this.motionX += slopeAdjustment; + ++this.posY; break; case 3: -- this.field_70179_y += 0.0078125D; -+ this.field_70179_y += slopeAdjustment; - ++this.field_70163_u; +- this.motionZ += 0.0078125D; ++ this.motionZ += slopeAdjustment; + ++this.posY; break; case 4: -- this.field_70179_y -= 0.0078125D; -+ this.field_70179_y -= slopeAdjustment; - ++this.field_70163_u; +- this.motionZ -= 0.0078125D; ++ this.motionZ -= slopeAdjustment; + ++this.posY; } @@ -485,7 +516,7 @@ @@ -150,86 +150,86 @@ - if (flag1) + if (flag1 && shouldDoRailFunctions()) { - d6 = Math.sqrt(this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y); + d6 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); @@ -533,20 +564,8 @@ - this.field_70165_t = d7 + d1 * d6; - this.field_70161_v = d8 + d2 * d6; - this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v); -- d11 = this.field_70159_w; -- d12 = this.field_70179_y; + this.posX = d7 + d1 * d6; + this.posZ = d8 + d2 * d6; + this.setPosition(this.posX, this.posY, this.posZ); +- d11 = this.motionX; +- d12 = this.motionZ; + this.moveMinecartOnRail(p_180460_1_); -- if (this.field_70153_n != null) +- if (this.riddenByEntity != null) - { - d11 *= 0.75D; - d12 *= 0.75D; - } - - double d13 = this.func_174898_m(); -- d11 = MathHelper.func_151237_a(d11, -d13, d13); -- d12 = MathHelper.func_151237_a(d12, -d13, d13); -- this.func_70091_d(d11, 0.0D, d12); +- d11 = MathHelper.clamp_double(d11, -d13, d13); +- d12 = MathHelper.clamp_double(d12, -d13, d13); +- this.moveEntity(d11, 0.0D, d12); - - if (aint[0][1] != 0 && MathHelper.func_76128_c(this.field_70165_t) - p_180460_1_.func_177958_n() == aint[0][0] && MathHelper.func_76128_c(this.field_70161_v) - p_180460_1_.func_177952_p() == aint[0][2]) + if (aint[0][1] != 0 && MathHelper.floor_double(this.posX) - p_180460_1_.getX() == aint[0][0] && MathHelper.floor_double(this.posZ) - p_180460_1_.getZ() == aint[0][2]) { - this.func_70107_b(this.field_70165_t, this.field_70163_u + (double)aint[0][1], this.field_70161_v); + this.setPosition(this.posX, this.posY + (double)aint[0][1], this.posZ); @@ -583,8 +602,14 @@ - this.field_70179_y = d5 * (double)(i - p_180460_1_.func_177952_p()); + this.motionZ = d5 * (double)(i - p_180460_1_.getZ()); } - if (flag) + + if(shouldDoRailFunctions()) { -+ ((BlockRailBase)p_180460_2_.func_177230_c()).onMinecartPass(field_70170_p, this, p_180460_1_); ++ ((BlockRailBase)p_180460_2_.getBlock()).onMinecartPass(worldObj, this, p_180460_1_); + } + + if (flag && shouldDoRailFunctions()) + { - double d15 = Math.sqrt(this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y); + double d15 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); if (d15 > 0.01D) @@ -824,13 +849,20 @@ - public void func_70108_f(Entity p_70108_1_) + public void applyEntityCollision(Entity entityIn) { + -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartCollisionEvent(this, 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_); ++ getCollisionHandler().onEntityCollision(this, entityIn); + return; + } - if (!this.field_70170_p.field_72995_K) + if (!this.worldObj.isRemote) { - if (!p_70108_1_.field_70145_X && !this.field_70145_X) + if (!entityIn.noClip && !this.noClip) { - if (p_70108_1_ != this.field_70153_n) + if (entityIn != this.riddenByEntity) { -- if (p_70108_1_ instanceof EntityLivingBase && !(p_70108_1_ instanceof EntityPlayer) && !(p_70108_1_ instanceof EntityIronGolem) && this.func_180456_s() == EntityMinecart.EnumMinecartType.RIDEABLE && this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y > 0.01D && this.field_70153_n == null && p_70108_1_.field_70154_o == null) -+ if (p_70108_1_ instanceof EntityLivingBase && !(p_70108_1_ instanceof EntityPlayer) && !(p_70108_1_ instanceof EntityIronGolem) && canBeRidden() && this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y > 0.01D && this.field_70153_n == null && p_70108_1_.field_70154_o == null) +- if (entityIn instanceof EntityLivingBase && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && this.getMinecartType() == EntityMinecart.EnumMinecartType.RIDEABLE && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && entityIn.ridingEntity == null) ++ if (entityIn instanceof EntityLivingBase && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && canBeRidden() && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && entityIn.ridingEntity == null) { - p_70108_1_.func_70078_a(this); + entityIn.mountEntity(this); } @@ -876,7 +908,7 @@ - double d7 = p_70108_1_.field_70159_w + this.field_70159_w; - double d8 = p_70108_1_.field_70179_y + this.field_70179_y; + double d7 = entityIn.motionX + this.motionX; + double d8 = entityIn.motionZ + this.motionZ; -- if (((EntityMinecart)p_70108_1_).func_180456_s() == EntityMinecart.EnumMinecartType.FURNACE && this.func_180456_s() != EntityMinecart.EnumMinecartType.FURNACE) -+ if (((EntityMinecart)p_70108_1_).isPoweredCart() && !isPoweredCart()) +- if (((EntityMinecart)entityIn).getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE && this.getMinecartType() != EntityMinecart.EnumMinecartType.FURNACE) ++ if (((EntityMinecart)entityIn).isPoweredCart() && !isPoweredCart()) { - this.field_70159_w *= 0.20000000298023224D; - this.field_70179_y *= 0.20000000298023224D; + this.motionX *= 0.20000000298023224D; + this.motionZ *= 0.20000000298023224D; @@ -884,7 +916,7 @@ - p_70108_1_.field_70159_w *= 0.949999988079071D; - p_70108_1_.field_70179_y *= 0.949999988079071D; + entityIn.motionX *= 0.949999988079071D; + entityIn.motionZ *= 0.949999988079071D; } -- else if (((EntityMinecart)p_70108_1_).func_180456_s() != EntityMinecart.EnumMinecartType.FURNACE && this.func_180456_s() == EntityMinecart.EnumMinecartType.FURNACE) -+ else if (((EntityMinecart)p_70108_1_).isPoweredCart() && isPoweredCart()) +- else if (((EntityMinecart)entityIn).getMinecartType() != EntityMinecart.EnumMinecartType.FURNACE && this.getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE) ++ else if (((EntityMinecart)entityIn).isPoweredCart() && isPoweredCart()) { - p_70108_1_.field_70159_w *= 0.20000000298023224D; - p_70108_1_.field_70179_y *= 0.20000000298023224D; + entityIn.motionX *= 0.20000000298023224D; + entityIn.motionZ *= 0.20000000298023224D; @@ -1049,6 +1081,221 @@ } } @@ -237,11 +237,11 @@ + /* =================================== FORGE START ===========================================*/ + private BlockPos getCurrentRailPosition() + { -+ int x = MathHelper.func_76128_c(this.field_70165_t); -+ int y = MathHelper.func_76128_c(this.field_70163_u); -+ int z = MathHelper.func_76128_c(this.field_70161_v); ++ int x = MathHelper.floor_double(this.posX); ++ int y = MathHelper.floor_double(this.posY); ++ int z = MathHelper.floor_double(this.posZ); + -+ if (BlockRailBase.func_176562_d(this.field_70170_p, new BlockPos(x, y - 1, z))) y--; ++ if (BlockRailBase.isRailBlock(this.worldObj, new BlockPos(x, y - 1, z))) y--; + return new BlockPos(x, y, z); + } + @@ -249,10 +249,10 @@ + { + if (!canUseRail()) return func_174898_m(); + BlockPos pos = this.getCurrentRailPosition(); -+ IBlockState state = this.field_70170_p.func_180495_p(pos); -+ if (!BlockRailBase.func_176563_d(state)) return func_174898_m(); ++ IBlockState state = this.worldObj.getBlockState(pos); ++ if (!BlockRailBase.isRailBlock(state)) return func_174898_m(); + -+ float railMaxSpeed = ((BlockRailBase)state.func_177230_c()).getRailMaxSpeed(field_70170_p, this, pos); ++ float railMaxSpeed = ((BlockRailBase)state.getBlock()).getRailMaxSpeed(worldObj, this, pos); + return Math.min(railMaxSpeed, getCurrentCartSpeedCapOnRail()); + } + @@ -262,19 +262,19 @@ + */ + public void moveMinecartOnRail(BlockPos pos) + { -+ double mX = this.field_70159_w; -+ double mZ = this.field_70179_y; ++ double mX = this.motionX; ++ double mZ = this.motionZ; + -+ if (this.field_70153_n != null) ++ if (this.riddenByEntity != null) + { + mX *= 0.75D; + mZ *= 0.75D; + } + + double max = this.getMaxSpeed(); -+ mX = MathHelper.func_151237_a(mX, -max, max); -+ mZ = MathHelper.func_151237_a(mZ, -max, max); -+ this.func_70091_d(mX, 0.0D, mZ); ++ mX = MathHelper.clamp_double(mX, -max, max); ++ mZ = MathHelper.clamp_double(mZ, -max, max); ++ this.moveEntity(mX, 0.0D, mZ); + } + + /** @@ -307,25 +307,25 @@ + { + if (this instanceof EntityMinecartFurnace) + { -+ return new ItemStack(Items.field_151109_aJ); ++ return new ItemStack(Items.furnace_minecart); + } + else if (this instanceof EntityMinecartChest) + { -+ return new ItemStack(Items.field_151108_aI); ++ return new ItemStack(Items.chest_minecart); + } + else if (this instanceof EntityMinecartTNT) + { -+ return new ItemStack(Items.field_151142_bV); ++ return new ItemStack(Items.tnt_minecart); + } + else if (this instanceof EntityMinecartHopper) + { -+ return new ItemStack(Items.field_151140_bW); ++ return new ItemStack(Items.hopper_minecart); + } + else if (this instanceof EntityMinecartCommandBlock) + { -+ return new ItemStack(Items.field_151095_cc); ++ return new ItemStack(Items.command_block_minecart); + } -+ return new ItemStack(Items.field_151143_au); ++ return new ItemStack(Items.minecart); + } + + /** @@ -363,7 +363,7 @@ + */ + public boolean isPoweredCart() + { -+ return func_180456_s() == EntityMinecart.EnumMinecartType.FURNACE; ++ return getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE; + } + + /** @@ -372,7 +372,7 @@ + */ + public boolean canBeRidden() + { -+ return this.func_180456_s() == EntityMinecart.EnumMinecartType.RIDEABLE; ++ return this.getMinecartType() == EntityMinecart.EnumMinecartType.RIDEABLE; + } + + /** diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch similarity index 62% rename from patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch rename to patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch index 86de5e86a..cdca16d4d 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java @@ -173,6 +173,7 @@ - public boolean func_130002_c(EntityPlayer p_130002_1_) + public boolean interactFirst(EntityPlayer playerIn) { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_130002_1_))) return true; - if (!this.field_70170_p.field_72995_K) ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; + if (!this.worldObj.isRemote) { - p_130002_1_.func_71007_a(this); + playerIn.displayGUIChest(this); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch similarity index 60% rename from patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch rename to patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch index 3db54ba04..729dcfd0a 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java @@ -20,6 +20,7 @@ - public boolean func_130002_c(EntityPlayer p_130002_1_) + public boolean interactFirst(EntityPlayer playerIn) { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_130002_1_))) return true; - if (this.field_70153_n != null && this.field_70153_n instanceof EntityPlayer && this.field_70153_n != p_130002_1_) ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; + if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn) { return true; diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch similarity index 55% rename from patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch rename to patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch index 0b8841524..46cb9f930 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java @@ -132,6 +132,7 @@ - public boolean func_130002_c(EntityPlayer p_130002_1_) + public boolean interactFirst(EntityPlayer playerIn) { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_130002_1_))) return true; - ItemStack itemstack = p_130002_1_.field_71071_by.func_70448_g(); ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; + ItemStack itemstack = playerIn.inventory.getCurrentItem(); - if (itemstack != null && itemstack.func_77973_b() == Items.field_151044_h) + if (itemstack != null && itemstack.getItem() == Items.coal) diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch similarity index 62% rename from patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch rename to patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch index cf2c9b8c1..54d8cad44 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java @@ -57,6 +57,7 @@ - public boolean func_130002_c(EntityPlayer p_130002_1_) + public boolean interactFirst(EntityPlayer playerIn) { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_130002_1_))) return true; - if (!this.field_70170_p.field_72995_K) ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; + if (!this.worldObj.isRemote) { - p_130002_1_.func_71007_a(this); + playerIn.displayGUIChest(this); diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch new file mode 100644 index 000000000..296ca8a03 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityXPOrb.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityXPOrb.java +@@ -198,6 +198,7 @@ + { + if (this.field_70532_c == 0 && entityIn.xpCooldown == 0) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerPickupXpEvent(entityIn, this))) return; + entityIn.xpCooldown = 2; + this.worldObj.playSoundAtEntity(entityIn, "random.orb", 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F)); + entityIn.onItemPickup(this, 1); diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch similarity index 54% rename from patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch rename to patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch index f3ec30644..f986ab50c 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch @@ -2,21 +2,21 @@ +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityEnderman.java @@ -204,12 +204,14 @@ - protected boolean func_70825_j(double p_70825_1_, double p_70825_3_, double p_70825_5_) + protected boolean teleportTo(double p_70825_1_, double p_70825_3_, double p_70825_5_) { + net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, p_70825_1_, p_70825_3_, p_70825_5_, 0); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false; - double d3 = this.field_70165_t; - double d4 = this.field_70163_u; - double d5 = this.field_70161_v; -- this.field_70165_t = p_70825_1_; -- this.field_70163_u = p_70825_3_; -- this.field_70161_v = p_70825_5_; -+ this.field_70165_t = event.targetX; -+ this.field_70163_u = event.targetY; -+ this.field_70161_v = event.targetZ; + double d3 = this.posX; + double d4 = this.posY; + double d5 = this.posZ; +- this.posX = p_70825_1_; +- this.posY = p_70825_3_; +- this.posZ = p_70825_5_; ++ this.posX = event.targetX; ++ this.posY = event.targetY; ++ this.posZ = event.targetZ; boolean flag = false; - BlockPos blockpos = new BlockPos(this.field_70165_t, this.field_70163_u, this.field_70161_v); + BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ); @@ -565,4 +567,16 @@ } @@ -26,12 +26,12 @@ + /*===================================== Forge Start ==============================*/ + public static void setCarriable(Block block, boolean canCarry) + { -+ if (canCarry) field_70827_d.add(block); -+ else field_70827_d.remove(block); ++ if (canCarry) carriableBlocks.add(block); ++ else carriableBlocks.remove(block); + } + public static boolean getCarriable(Block block) + { -+ return field_70827_d.contains(block); ++ return carriableBlocks.contains(block); + } + /*===================================== Forge End ==============================*/ } diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch similarity index 70% rename from patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch rename to patches.mcp/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch index ec3e09971..b68b510e8 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch @@ -2,8 +2,8 @@ +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java @@ -105,6 +105,7 @@ { - this.field_70181_x = (double)(0.42F + (float)this.func_70809_q() * 0.1F); - this.field_70160_al = true; + this.motionY = (double)(0.42F + (float)this.getSlimeSize() * 0.1F); + this.isAirBorne = true; + net.minecraftforge.common.ForgeHooks.onLivingJump(this); } diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch new file mode 100644 index 000000000..96ce050c1 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/entity/monster/EntitySlime.java ++++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySlime.java +@@ -271,7 +271,7 @@ + { + Chunk chunk = this.worldObj.getChunkFromBlockCoords(new BlockPos(MathHelper.floor_double(this.posX), 0, MathHelper.floor_double(this.posZ))); + +- if (this.worldObj.getWorldInfo().getTerrainType() == WorldType.FLAT && this.rand.nextInt(4) != 1) ++ if (this.worldObj.getWorldInfo().getTerrainType().handleSlimeSpawnReduction(rand, worldObj)) + { + return false; + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch new file mode 100644 index 000000000..5468901ba --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch @@ -0,0 +1,60 @@ +--- ../src-base/minecraft/net/minecraft/entity/monster/EntityZombie.java ++++ ../src-work/minecraft/net/minecraft/entity/monster/EntityZombie.java +@@ -89,7 +89,7 @@ + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(35.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); +- this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * 0.10000000149011612D); ++ this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * net.minecraftforge.common.ForgeModContainer.zombieSummonBaseChance); + } + + protected void entityInit() +@@ -231,12 +231,25 @@ + entitylivingbase = (EntityLivingBase)source.getEntity(); + } + +- if (entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue()) ++ int i = MathHelper.floor_double(this.posX); ++ int j = MathHelper.floor_double(this.posY); ++ int k = MathHelper.floor_double(this.posZ); ++ ++ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent summonAid = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, worldObj, i, j, k, entitylivingbase, this.getEntityAttribute(reinforcementChance).getAttributeValue()); ++ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return true; ++ ++ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || ++ entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue()) + { +- int i = MathHelper.floor_double(this.posX); +- int j = MathHelper.floor_double(this.posY); +- int k = MathHelper.floor_double(this.posZ); +- EntityZombie entityzombie = new EntityZombie(this.worldObj); ++ EntityZombie entityzombie; ++ if (summonAid.customSummonedAid != null && summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW) ++ { ++ entityzombie = summonAid.customSummonedAid; ++ } ++ else ++ { ++ entityzombie = new EntityZombie(this.worldObj); ++ } + + for (int l = 0; l < 50; ++l) + { +@@ -251,7 +264,7 @@ + if (!this.worldObj.func_175636_b((double)i1, (double)j1, (double)k1, 7.0D) && this.worldObj.checkNoEntityCollision(entityzombie.getEntityBoundingBox(), entityzombie) && this.worldObj.getCollidingBoundingBoxes(entityzombie, entityzombie.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(entityzombie.getEntityBoundingBox())) + { + this.worldObj.spawnEntityInWorld(entityzombie); +- entityzombie.setAttackTarget(entitylivingbase); ++ if (entitylivingbase != null) entityzombie.setAttackTarget(entitylivingbase); + entityzombie.func_180482_a(this.worldObj.getDifficultyForLocation(new BlockPos(entityzombie)), (IEntityLivingData)null); + this.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0)); + entityzombie.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0)); +@@ -458,7 +471,7 @@ + + if (p_180482_2_1 == null) + { +- p_180482_2_1 = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < 0.05F, this.worldObj.rand.nextFloat() < 0.05F, null); ++ p_180482_2_1 = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < net.minecraftforge.common.ForgeModContainer.zombieBabyChance, this.worldObj.rand.nextFloat() < 0.05F, null); + } + + if (p_180482_2_1 instanceof EntityZombie.GroupData) diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch similarity index 76% rename from patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch rename to patches.mcp/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch index 54fe1eaff..97788b993 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch @@ -3,8 +3,8 @@ @@ -1260,6 +1260,7 @@ } - this.field_110277_bt = 0.0F; + this.jumpPower = 0.0F; + net.minecraftforge.common.ForgeHooks.onLivingJump(this); } - this.field_70138_W = 1.0F; + this.stepHeight = 1.0F; diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch new file mode 100644 index 000000000..f6bdbce10 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch @@ -0,0 +1,62 @@ +--- ../src-base/minecraft/net/minecraft/entity/passive/EntityMooshroom.java ++++ ../src-work/minecraft/net/minecraft/entity/passive/EntityMooshroom.java +@@ -9,7 +9,7 @@ + import net.minecraft.util.EnumParticleTypes; + import net.minecraft.world.World; + +-public class EntityMooshroom extends EntityCow ++public class EntityMooshroom extends EntityCow implements net.minecraftforge.common.IShearable + { + private static final String __OBFID = "CL_00001645"; + +@@ -20,6 +20,7 @@ + this.field_175506_bl = Blocks.mycelium; + } + ++ @SuppressWarnings("unused") + public boolean interact(EntityPlayer player) + { + ItemStack itemstack = player.inventory.getCurrentItem(); +@@ -39,7 +40,7 @@ + } + } + +- if (itemstack != null && itemstack.getItem() == Items.shears && this.getGrowingAge() >= 0) ++ if (false && itemstack != null && itemstack.getItem() == Items.shears && this.getGrowingAge() >= 0) //Forge Disable, Moved to onSheared + { + this.setDead(); + this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); +@@ -79,4 +80,33 @@ + { + return new EntityMooshroom(this.worldObj); + } ++ ++ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos){ return getGrowingAge() >= 0; } ++ @Override ++ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos, int fortune) ++ { ++ this.setDead(); ++ this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); ++ ++ EntityCow entitycow = new EntityCow(this.worldObj); ++ entitycow.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); ++ entitycow.setHealth(this.getHealth()); ++ entitycow.renderYawOffset = this.renderYawOffset; ++ ++ if (this.hasCustomName()) ++ { ++ entitycow.setCustomNameTag(this.getCustomNameTag()); ++ } ++ ++ this.worldObj.spawnEntityInWorld(entitycow); ++ ++ java.util.List ret = new java.util.ArrayList(); ++ for (int i = 0; i < 5; ++i) ++ { ++ ret.add(new ItemStack(Blocks.red_mushroom)); ++ } ++ ++ this.playSound("mob.sheep.shear", 1.0F, 1.0F); ++ return ret; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch new file mode 100644 index 000000000..c2c76667c --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/entity/passive/EntityOcelot.java ++++ ../src-work/minecraft/net/minecraft/entity/passive/EntityOcelot.java +@@ -276,7 +276,7 @@ + + Block block = this.worldObj.getBlockState(blockpos.down()).getBlock(); + +- if (block == Blocks.grass || block.getMaterial() == Material.leaves) ++ if (block == Blocks.grass || block.isLeaves(worldObj, blockpos.down())) + { + return true; + } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch similarity index 53% rename from patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch rename to patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch index 6faf82c50..88e34a852 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch @@ -7,39 +7,39 @@ -public class EntitySheep extends EntityAnimal +public class EntitySheep extends EntityAnimal implements net.minecraftforge.common.IShearable { - private final InventoryCrafting field_90016_e = new InventoryCrafting(new Container() + private final InventoryCrafting inventoryCrafting = new InventoryCrafting(new Container() { @@ -142,11 +142,12 @@ } } + @SuppressWarnings("unused") - public boolean func_70085_c(EntityPlayer p_70085_1_) + public boolean interact(EntityPlayer player) { - ItemStack itemstack = p_70085_1_.field_71071_by.func_70448_g(); + ItemStack itemstack = player.inventory.getCurrentItem(); -- if (itemstack != null && itemstack.func_77973_b() == Items.field_151097_aZ && !this.func_70892_o() && !this.func_70631_g_()) -+ if (false && itemstack != null && itemstack.func_77973_b() == Items.field_151097_aZ && !this.func_70892_o() && !this.func_70631_g_()) //Forge: Moved to onSheared +- if (itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared() && !this.isChild()) ++ if (false && itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared() && !this.isChild()) //Forge: Moved to onSheared { - if (!this.field_70170_p.field_72995_K) + if (!this.worldObj.isRemote) { @@ -334,4 +335,19 @@ field_175514_bm.put(EnumDyeColor.RED, new float[] {0.6F, 0.2F, 0.2F}); field_175514_bm.put(EnumDyeColor.BLACK, new float[] {0.1F, 0.1F, 0.1F}); } + -+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return !this.func_70892_o() && !this.func_70631_g_(); } ++ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return !this.getSheared() && !this.isChild(); } + @Override + public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { -+ this.func_70893_e(true); -+ int i = 1 + this.field_70146_Z.nextInt(3); ++ this.setSheared(true); ++ int i = 1 + this.rand.nextInt(3); + + java.util.List ret = new java.util.ArrayList(); + for (int j = 0; j < i; ++j) -+ ret.add(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, this.func_175509_cj().func_176765_a())); ++ ret.add(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, this.getFleeceColor().getMetadata())); + -+ this.func_85030_a("mob.sheep.shear", 1.0F, 1.0F); ++ this.playSound("mob.sheep.shear", 1.0F, 1.0F); + return ret; + } } diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch new file mode 100644 index 000000000..2b7169882 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch @@ -0,0 +1,44 @@ +--- ../src-base/minecraft/net/minecraft/entity/passive/EntityVillager.java ++++ ../src-work/minecraft/net/minecraft/entity/passive/EntityVillager.java +@@ -83,6 +83,7 @@ + private boolean isLookingForHome; + private boolean field_175564_by; + private InventoryBasic villagerInventory; ++ @Deprecated //Use VillagerRegistry + private static final EntityVillager.ITradeList[][][][] DEFAULT_TRADE_LIST_MAP = new EntityVillager.ITradeList[][][][] {{{{new EntityVillager.EmeraldForItems(Items.wheat, new EntityVillager.PriceInfo(18, 22)), new EntityVillager.EmeraldForItems(Items.potato, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.EmeraldForItems(Items.carrot, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.ListItemForEmeralds(Items.bread, new EntityVillager.PriceInfo(-4, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.pumpkin), new EntityVillager.PriceInfo(8, 13)), new EntityVillager.ListItemForEmeralds(Items.pumpkin_pie, new EntityVillager.PriceInfo(-3, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.melon_block), new EntityVillager.PriceInfo(7, 12)), new EntityVillager.ListItemForEmeralds(Items.apple, new EntityVillager.PriceInfo(-5, -7))}, {new EntityVillager.ListItemForEmeralds(Items.cookie, new EntityVillager.PriceInfo(-6, -10)), new EntityVillager.ListItemForEmeralds(Items.cake, new EntityVillager.PriceInfo(1, 1))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ItemAndEmeraldToItem(Items.fish, new EntityVillager.PriceInfo(6, 6), Items.cooked_fish, new EntityVillager.PriceInfo(6, 6))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.fishing_rod, new EntityVillager.PriceInfo(7, 8))}}, {{new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.wool), new EntityVillager.PriceInfo(16, 22)), new EntityVillager.ListItemForEmeralds(Items.shears, new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 0), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 1), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 2), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 3), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 4), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 5), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 6), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 7), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 8), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 9), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 10), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 11), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 12), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 13), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 14), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 15), new EntityVillager.PriceInfo(1, 2))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.ListItemForEmeralds(Items.arrow, new EntityVillager.PriceInfo(-12, -8))}, {new EntityVillager.ListItemForEmeralds(Items.bow, new EntityVillager.PriceInfo(2, 3)), new EntityVillager.ItemAndEmeraldToItem(Item.getItemFromBlock(Blocks.gravel), new EntityVillager.PriceInfo(10, 10), Items.flint, new EntityVillager.PriceInfo(6, 10))}}}, {{{new EntityVillager.EmeraldForItems(Items.paper, new EntityVillager.PriceInfo(24, 36)), new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.EmeraldForItems(Items.book, new EntityVillager.PriceInfo(8, 10)), new EntityVillager.ListItemForEmeralds(Items.compass, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.bookshelf), new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.EmeraldForItems(Items.written_book, new EntityVillager.PriceInfo(2, 2)), new EntityVillager.ListItemForEmeralds(Items.clock, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glass), new EntityVillager.PriceInfo(-5, -3))}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListItemForEmeralds(Items.name_tag, new EntityVillager.PriceInfo(20, 22))}}}, {{{new EntityVillager.EmeraldForItems(Items.rotten_flesh, new EntityVillager.PriceInfo(36, 40)), new EntityVillager.EmeraldForItems(Items.gold_ingot, new EntityVillager.PriceInfo(8, 10))}, {new EntityVillager.ListItemForEmeralds(Items.redstone, new EntityVillager.PriceInfo(-4, -1)), new EntityVillager.ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new EntityVillager.PriceInfo(-2, -1))}, {new EntityVillager.ListItemForEmeralds(Items.ender_eye, new EntityVillager.PriceInfo(7, 11)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glowstone), new EntityVillager.PriceInfo(-3, -1))}, {new EntityVillager.ListItemForEmeralds(Items.experience_bottle, new EntityVillager.PriceInfo(3, 11))}}}, {{{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_helmet, new EntityVillager.PriceInfo(4, 6))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListItemForEmeralds(Items.iron_chestplate, new EntityVillager.PriceInfo(10, 14))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_chestplate, new EntityVillager.PriceInfo(16, 19))}, {new EntityVillager.ListItemForEmeralds(Items.chainmail_boots, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_leggings, new EntityVillager.PriceInfo(9, 11)), new EntityVillager.ListItemForEmeralds(Items.chainmail_helmet, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_chestplate, new EntityVillager.PriceInfo(11, 15))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_axe, new EntityVillager.PriceInfo(6, 8))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_sword, new EntityVillager.PriceInfo(9, 10))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_sword, new EntityVillager.PriceInfo(12, 15)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_axe, new EntityVillager.PriceInfo(9, 12))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_shovel, new EntityVillager.PriceInfo(5, 7))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_pickaxe, new EntityVillager.PriceInfo(9, 11))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_pickaxe, new EntityVillager.PriceInfo(12, 15))}}}, {{{new EntityVillager.EmeraldForItems(Items.porkchop, new EntityVillager.PriceInfo(14, 18)), new EntityVillager.EmeraldForItems(Items.chicken, new EntityVillager.PriceInfo(14, 18))}, {new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.cooked_porkchop, new EntityVillager.PriceInfo(-7, -5)), new EntityVillager.ListItemForEmeralds(Items.cooked_chicken, new EntityVillager.PriceInfo(-8, -6))}}, {{new EntityVillager.EmeraldForItems(Items.leather, new EntityVillager.PriceInfo(9, 12)), new EntityVillager.ListItemForEmeralds(Items.leather_leggings, new EntityVillager.PriceInfo(2, 4))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.leather_chestplate, new EntityVillager.PriceInfo(7, 12))}, {new EntityVillager.ListItemForEmeralds(Items.saddle, new EntityVillager.PriceInfo(8, 10))}}}}; + private static final String __OBFID = "CL_00001707"; + +@@ -228,7 +229,7 @@ + ItemStack itemstack = player.inventory.getCurrentItem(); + boolean flag = itemstack != null && itemstack.getItem() == Items.spawn_egg; + +- if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild()) ++ if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild() && !player.isSneaking()) + { + if (!this.worldObj.isRemote && (this.buyingList == null || this.buyingList.size() > 0)) + { +@@ -540,6 +541,7 @@ + + private void populateBuyingList() + { ++ //TODO: Hook into VillagerRegistry + EntityVillager.ITradeList[][][] aitradelist = DEFAULT_TRADE_LIST_MAP[this.getProfession()]; + + if (this.careerId != 0 && this.careerLevel != 0) +@@ -648,6 +650,7 @@ + } + } + ++ //TODO: Hook into VillagerRegistry to get name + if (s1 != null) + { + ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("entity.Villager." + s1, new Object[0]); +@@ -710,7 +713,7 @@ + public IEntityLivingData func_180482_a(DifficultyInstance p_180482_1_, IEntityLivingData p_180482_2_) + { + p_180482_2_ = super.func_180482_a(p_180482_1_, p_180482_2_); +- this.setProfession(this.worldObj.rand.nextInt(5)); ++ net.minecraftforge.fml.common.registry.VillagerRegistry.setRandomProfession(this, this.worldObj.rand); + this.func_175552_ct(); + return p_180482_2_; + } diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch new file mode 100644 index 000000000..b65fb2c57 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -0,0 +1,637 @@ +--- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayer.java ++++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayer.java +@@ -77,9 +77,23 @@ + import net.minecraft.world.WorldSettings; + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; ++import net.minecraftforge.common.ISpecialArmor.ArmorProperties; ++import net.minecraftforge.common.MinecraftForge; ++import net.minecraftforge.event.ForgeEventFactory; ++import net.minecraftforge.event.entity.living.LivingHurtEvent; ++import net.minecraftforge.event.entity.player.AttackEntityEvent; ++import net.minecraftforge.event.entity.player.EntityInteractEvent; ++import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; ++import net.minecraftforge.event.entity.player.PlayerDropsEvent; ++import net.minecraftforge.event.entity.player.PlayerFlyableFallEvent; ++import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent; + + public abstract class EntityPlayer extends EntityLivingBase + { ++ public static final String PERSISTED_NBT_TAG = "PlayerPersisted"; ++ private java.util.HashMap spawnChunkMap = new java.util.HashMap(); ++ private java.util.HashMap spawnForcedMap = new java.util.HashMap(); ++ + public InventoryPlayer inventory = new InventoryPlayer(this); + private InventoryEnderChest theInventoryEnderChest = new InventoryEnderChest(); + public Container inventoryContainer; +@@ -118,6 +132,7 @@ + private final GameProfile gameProfile; + private boolean hasReducedDebug = false; + public EntityFishHook fishEntity; ++ public float eyeHeight = this.getDefaultEyeHeight(); + private static final String __OBFID = "CL_00001711"; + + public EntityPlayer(World worldIn, GameProfile p_i45324_2_) +@@ -176,7 +191,8 @@ + { + if (this.itemInUse != null) + { +- this.itemInUse.onPlayerStoppedUsing(this.worldObj, this, this.itemInUseCount); ++ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, itemInUse, this.itemInUseCount)) ++ this.itemInUse.onPlayerStoppedUsing(this.worldObj, this, this.itemInUseCount); + } + + this.clearItemInUse(); +@@ -200,6 +216,7 @@ + + public void onUpdate() + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPreTick(this); + this.noClip = this.isSpectator(); + + if (this.isSpectator()) +@@ -213,6 +230,14 @@ + + if (itemstack == this.itemInUse) + { ++ itemInUseCount = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, itemInUse, itemInUseCount); ++ if (itemInUseCount <= 0) ++ { ++ this.onItemUseFinish(); ++ } ++ else ++ { // Forge Keep unindented to lower patch ++ itemInUse.getItem().onUsingTick(itemInUse, this, itemInUseCount); //Forge Added + if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0) + { + this.updateItemUse(itemstack, 5); +@@ -222,6 +247,7 @@ + { + this.onItemUseFinish(); + } ++ } + } + else + { +@@ -267,7 +293,7 @@ + + super.onUpdate(); + +- if (!this.worldObj.isRemote && this.openContainer != null && !this.openContainer.canInteractWith(this)) ++ if (!this.worldObj.isRemote && this.openContainer != null && !net.minecraftforge.common.ForgeHooks.canInteractWith(this, this.openContainer)) + { + this.closeScreen(); + this.openContainer = this.inventoryContainer; +@@ -344,6 +370,7 @@ + { + this.setPosition(d3, this.posY, d4); + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPostTick(this); + } + + public int getMaxInPortalTime() +@@ -413,11 +440,13 @@ + int i = this.itemInUse.stackSize; + ItemStack itemstack = this.itemInUse.onItemUseFinish(this.worldObj, this); + ++ itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, itemInUse, itemInUseCount, itemstack); ++ + if (itemstack != this.itemInUse || itemstack != null && itemstack.stackSize != i) + { + this.inventory.mainInventory[this.inventory.currentItem] = itemstack; + +- if (itemstack.stackSize == 0) ++ if (itemstack != null && itemstack.stackSize == 0) + { + this.inventory.mainInventory[this.inventory.currentItem] = null; + } +@@ -477,11 +506,11 @@ + this.cameraYaw = 0.0F; + this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2); + +- if (this.ridingEntity instanceof EntityPig) ++ if (this.ridingEntity instanceof EntityLivingBase && ((EntityLivingBase)ridingEntity).shouldRiderFaceForward(this)) + { + this.rotationPitch = f1; + this.rotationYaw = f; +- this.renderYawOffset = ((EntityPig)this.ridingEntity).renderYawOffset; ++ this.renderYawOffset = ((EntityLivingBase)this.ridingEntity).renderYawOffset; + } + } + } +@@ -611,11 +640,15 @@ + + public void onDeath(DamageSource cause) + { ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; + super.onDeath(cause); + this.setSize(0.2F, 0.2F); + this.setPosition(this.posX, this.posY, this.posZ); + this.motionY = 0.10000000149011612D; + ++ captureDrops = true; ++ capturedDrops.clear(); ++ + if (this.getName().equals("Notch")) + { + this.dropItem(new ItemStack(Items.apple, 1), true, false); +@@ -626,6 +659,9 @@ + this.inventory.dropAllItems(); + } + ++ captureDrops = false; ++ if (!worldObj.isRemote) net.minecraftforge.event.ForgeEventFactory.onPlayerDrops(this, cause, capturedDrops, recentlyHit > 0); ++ + if (cause != null) + { + this.motionX = (double)(-MathHelper.cos((this.attackedAtYaw + this.rotationYaw) * (float)Math.PI / 180.0F) * 0.1F); +@@ -714,12 +750,25 @@ + + public EntityItem dropOneItem(boolean p_71040_1_) + { +- return this.dropItem(this.inventory.decrStackSize(this.inventory.currentItem, p_71040_1_ && this.inventory.getCurrentItem() != null ? this.inventory.getCurrentItem().stackSize : 1), false, true); ++ ItemStack stack = inventory.getCurrentItem(); ++ ++ if (stack == null) ++ { ++ return null; ++ } ++ ++ if (stack.getItem().onDroppedByPlayer(stack, this)) ++ { ++ int count = p_71040_1_ && this.inventory.getCurrentItem() != null ? this.inventory.getCurrentItem().stackSize : 1; ++ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, inventory.decrStackSize(inventory.currentItem, count), true); ++ } ++ ++ return null; + } + + public EntityItem dropPlayerItemWithRandomChoice(ItemStack itemStackIn, boolean unused) + { +- return this.dropItem(itemStackIn, false, false); ++ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, itemStackIn, false); + } + + public EntityItem dropItem(ItemStack droppedItem, boolean dropAround, boolean traceItem) +@@ -780,13 +829,25 @@ + + public void joinEntityItemWithWorld(EntityItem p_71012_1_) + { ++ if (captureDrops) ++ { ++ capturedDrops.add(p_71012_1_); ++ return; ++ } + this.worldObj.spawnEntityInWorld(p_71012_1_); + } + ++ @Deprecated //Use location sensitive version below + public float getToolDigEfficiency(Block p_180471_1_) + { +- float f = this.inventory.getStrVsBlock(p_180471_1_); ++ return getBreakSpeed(p_180471_1_.getDefaultState(), new BlockPos(0, -1, 0)); ++ } + ++ public float getBreakSpeed(IBlockState state, BlockPos pos) ++ { ++ ItemStack stack = inventory.getCurrentItem(); ++ float f = (stack == null ? 1.0F : stack.getItem().getDigSpeed(stack, state)); ++ + if (f > 1.0F) + { + int i = EnchantmentHelper.getEfficiencyModifier(this); +@@ -836,12 +897,13 @@ + f /= 5.0F; + } + +- return f; ++ f = net.minecraftforge.event.ForgeEventFactory.getBreakSpeed(this, state, f, pos); ++ return (f < 0 ? 0 : f); + } + + public boolean canHarvestBlock(Block p_146099_1_) + { +- return this.inventory.func_146025_b(p_146099_1_); ++ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, p_146099_1_, this.inventory.func_146025_b(p_146099_1_)); + } + + public void readEntityFromNBT(NBTTagCompound tagCompund) +@@ -877,6 +939,16 @@ + this.spawnForced = tagCompund.getBoolean("SpawnForced"); + } + ++ NBTTagList spawnlist = null; ++ spawnlist = tagCompund.getTagList("Spawns", 10); ++ for (int i = 0; i < spawnlist.tagCount(); i++) ++ { ++ NBTTagCompound spawndata = (NBTTagCompound)spawnlist.getCompoundTagAt(i); ++ int spawndim = spawndata.getInteger("Dim"); ++ this.spawnChunkMap.put(spawndim, new BlockPos(spawndata.getInteger("SpawnX"), spawndata.getInteger("SpawnY"), spawndata.getInteger("SpawnZ"))); ++ this.spawnForcedMap.put(spawndim, spawndata.getBoolean("SpawnForced")); ++ } ++ + this.foodStats.readNBT(tagCompund); + this.capabilities.readCapabilitiesFromNBT(tagCompund); + +@@ -908,6 +980,23 @@ + tagCompound.setBoolean("SpawnForced", this.spawnForced); + } + ++ NBTTagList spawnlist = new NBTTagList(); ++ for (java.util.Map.Entry entry : this.spawnChunkMap.entrySet()) ++ { ++ BlockPos spawn = entry.getValue(); ++ if (spawn == null) continue; ++ Boolean forced = spawnForcedMap.get(entry.getKey()); ++ if (forced == null) forced = false; ++ NBTTagCompound spawndata = new NBTTagCompound(); ++ spawndata.setInteger("Dim", entry.getKey()); ++ spawndata.setInteger("SpawnX", spawn.getX()); ++ spawndata.setInteger("SpawnY", spawn.getY()); ++ spawndata.setInteger("SpawnZ", spawn.getZ()); ++ spawndata.setBoolean("SpawnForced", forced); ++ spawnlist.appendTag(spawndata); ++ } ++ tagCompound.setTag("Spawns", spawnlist); ++ + this.foodStats.writeNBT(tagCompound); + this.capabilities.writeCapabilitiesToNBT(tagCompound); + tagCompound.setTag("EnderItems", this.theInventoryEnderChest.saveInventoryToNBT()); +@@ -921,6 +1010,7 @@ + + public boolean attackEntityFrom(DamageSource source, float amount) + { ++ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, source, amount)) return false; + if (this.isEntityInvulnerable(source)) + { + return false; +@@ -1021,12 +1111,15 @@ + { + if (!this.isEntityInvulnerable(damageSrc)) + { ++ damageAmount = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, damageSrc, damageAmount); ++ if (damageAmount <= 0) return; + if (!damageSrc.isUnblockable() && this.isBlocking() && damageAmount > 0.0F) + { + damageAmount = (1.0F + damageAmount) * 0.5F; + } + +- damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); ++ damageAmount = net.minecraftforge.common.ISpecialArmor.ArmorProperties.applyArmor(this, inventory.armorInventory, damageSrc, damageAmount); ++ if (damageAmount <= 0) return; + damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); + float f1 = damageAmount; + damageAmount = Math.max(damageAmount - this.getAbsorptionAmount(), 0.0F); +@@ -1074,6 +1167,7 @@ + } + else + { ++ if (!net.minecraftforge.event.ForgeEventFactory.canInteractWith(this, p_70998_1_)) return false; + ItemStack itemstack = this.getCurrentEquippedItem(); + ItemStack itemstack1 = itemstack != null ? itemstack.copy() : null; + +@@ -1125,7 +1219,9 @@ + + public void destroyCurrentEquippedItem() + { ++ ItemStack orig = getCurrentEquippedItem(); + this.inventory.setInventorySlotContents(this.inventory.currentItem, (ItemStack)null); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, orig); + } + + public double getYOffset() +@@ -1135,6 +1231,7 @@ + + public void attackTargetEntityWithCurrentItem(Entity targetEntity) + { ++ if (!net.minecraftforge.common.ForgeHooks.onPlayerAttackTarget(this, targetEntity)) return; + if (targetEntity.canAttackWithItem()) + { + if (!targetEntity.hitByEntity(this)) +@@ -1305,6 +1402,8 @@ + + public EntityPlayer.EnumStatus trySleep(BlockPos bedLocation) + { ++ EntityPlayer.EnumStatus ret = net.minecraftforge.event.ForgeEventFactory.onPlayerSleepInBed(this, bedLocation); ++ if (ret != null) return ret; + if (!this.worldObj.isRemote) + { + if (this.isPlayerSleeping() || !this.isEntityAlive()) +@@ -1346,7 +1445,7 @@ + + if (this.worldObj.isBlockLoaded(bedLocation)) + { +- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(bedLocation).getValue(BlockDirectional.FACING); ++ EnumFacing enumfacing = this.worldObj.getBlockState(bedLocation).getBlock().getBedDirection(worldObj, bedLocation); + float f = 0.5F; + float f1 = 0.5F; + +@@ -1409,13 +1508,14 @@ + + public void wakeUpPlayer(boolean p_70999_1_, boolean updateWorldFlag, boolean setSpawn) + { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this, p_70999_1_, updateWorldFlag, setSpawn); + this.setSize(0.6F, 1.8F); + IBlockState iblockstate = this.worldObj.getBlockState(this.playerLocation); + +- if (this.playerLocation != null && iblockstate.getBlock() == Blocks.bed) ++ if (this.playerLocation != null && iblockstate.getBlock().isBed(worldObj, playerLocation, this)) + { +- this.worldObj.setBlockState(this.playerLocation, iblockstate.withProperty(BlockBed.OCCUPIED, Boolean.valueOf(false)), 4); +- BlockPos blockpos = BlockBed.getSafeExitLocation(this.worldObj, this.playerLocation, 0); ++ iblockstate.getBlock().setBedOccupied(worldObj, playerLocation, this, false); ++ BlockPos blockpos = iblockstate.getBlock().getBedSpawnPosition(worldObj, playerLocation, this); + + if (blockpos == null) + { +@@ -1442,12 +1542,12 @@ + + private boolean isInBed() + { +- return this.worldObj.getBlockState(this.playerLocation).getBlock() == Blocks.bed; ++ return this.worldObj.getBlockState(this.playerLocation).getBlock().isBed(worldObj, playerLocation, this); + } + + public static BlockPos getBedSpawnLocation(World worldIn, BlockPos bedLocation, boolean forceSpawn) + { +- if (worldIn.getBlockState(bedLocation).getBlock() != Blocks.bed) ++ if (!worldIn.getBlockState(bedLocation).getBlock().isBed(worldIn, bedLocation, null)) + { + if (!forceSpawn) + { +@@ -1464,7 +1564,7 @@ + } + else + { +- return BlockBed.getSafeExitLocation(worldIn, bedLocation, 0); ++ return worldIn.getBlockState(bedLocation).getBlock().getBedSpawnPosition(worldIn, bedLocation, null); + } + } + +@@ -1473,7 +1573,7 @@ + { + if (this.playerLocation != null) + { +- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(this.playerLocation).getValue(BlockDirectional.FACING); ++ EnumFacing enumfacing = this.worldObj.getBlockState(this.playerLocation).getBlock().getBedDirection(worldObj, playerLocation); + + switch (EntityPlayer.SwitchEnumFacing.FACING_LOOKUP[enumfacing.ordinal()]) + { +@@ -1511,16 +1611,23 @@ + + public BlockPos getBedLocation() + { +- return this.spawnChunk; ++ return getBedLocation(this.dimension); + } + ++ @Deprecated + public boolean isSpawnForced() + { +- return this.spawnForced; ++ return isSpawnForced(this.dimension); + } + + public void setSpawnPoint(BlockPos pos, boolean forced) + { ++ if(net.minecraftforge.event.ForgeEventFactory.onPlayerSpawnSet(this, pos, forced)) return; ++ if (this.dimension != 0) ++ { ++ setSpawnChunk(pos, forced, this.dimension); ++ return; ++ } + if (pos != null) + { + this.spawnChunk = pos; +@@ -1702,6 +1809,10 @@ + + super.fall(distance, damageMultiplier); + } ++ else ++ { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerFall(this, distance, damageMultiplier); ++ } + } + + protected void resetHeight() +@@ -1725,6 +1836,7 @@ + } + + EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entityLivingIn))); ++ if (entityegginfo == null) entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.getEntityString(entityLivingIn)); + + if (entityegginfo != null) + { +@@ -1837,6 +1949,8 @@ + { + if (stack != this.itemInUse) + { ++ duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, stack, duration); ++ if (duration <= 0) return; + this.itemInUse = stack; + this.itemInUseCount = duration; + +@@ -1906,6 +2020,10 @@ + this.experience = oldPlayer.experience; + this.setScore(oldPlayer.getScore()); + this.teleportDirection = oldPlayer.teleportDirection; ++ //Copy and re-init ExtendedProperties when switching dimensions. ++ this.extendedProperties = oldPlayer.extendedProperties; ++ for (net.minecraftforge.common.IExtendedEntityProperties p : this.extendedProperties.values()) ++ p.init(this, this.worldObj); + } + else if (this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) + { +@@ -1918,6 +2036,18 @@ + + this.theInventoryEnderChest = oldPlayer.theInventoryEnderChest; + this.getDataWatcher().updateObject(10, Byte.valueOf(oldPlayer.getDataWatcher().getWatchableObjectByte(10))); ++ ++ this.spawnChunkMap = oldPlayer.spawnChunkMap; ++ this.spawnForcedMap = oldPlayer.spawnForcedMap; ++ ++ //Copy over a section of the Entity Data from the old player. ++ //Allows mods to specify data that persists after players respawn. ++ NBTTagCompound old = oldPlayer.getEntityData(); ++ if (old.hasKey(PERSISTED_NBT_TAG)) ++ { ++ getEntityData().setTag(PERSISTED_NBT_TAG, old.getCompoundTag(PERSISTED_NBT_TAG)); ++ } ++ net.minecraftforge.event.ForgeEventFactory.onPlayerClone(this, oldPlayer, !respawnFromEnd); + } + + protected boolean canTriggerWalking() +@@ -1951,7 +2081,14 @@ + + public void setCurrentItemOrArmor(int slotIn, ItemStack stack) + { +- this.inventory.armorInventory[slotIn] = stack; ++ if (slotIn == 0) //Forge: Fix issue in Player where it doen't take into account selected item ++ { ++ this.inventory.mainInventory[this.inventory.currentItem] = stack; ++ } ++ else ++ { ++ this.inventory.armorInventory[slotIn - 1] = stack; ++ } + } + + @SideOnly(Side.CLIENT) +@@ -1996,7 +2133,10 @@ + + public IChatComponent getDisplayName() + { +- ChatComponentText chatcomponenttext = new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getName())); ++ ChatComponentText chatcomponenttext = new ChatComponentText(""); ++ if (!prefixes.isEmpty()) for (net.minecraft.util.IChatComponent prefix : prefixes) chatcomponenttext.appendSibling(prefix); ++ chatcomponenttext.appendSibling(new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getDisplayNameString()))); ++ if (!suffixes.isEmpty()) for (net.minecraft.util.IChatComponent suffix : suffixes) chatcomponenttext.appendSibling(suffix); + chatcomponenttext.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.getName() + " ")); + chatcomponenttext.getChatStyle().setChatHoverEvent(this.func_174823_aP()); + chatcomponenttext.getChatStyle().setInsertion(this.getName()); +@@ -2005,7 +2145,7 @@ + + public float getEyeHeight() + { +- float f = 1.62F; ++ float f = eyeHeight; + + if (this.isPlayerSleeping()) + { +@@ -2139,6 +2279,136 @@ + this.hasReducedDebug = reducedDebug; + } + ++ /** ++ * Opens a GUI with this player, uses FML's IGuiHandler system. ++ * Allows for extension by modders. ++ * ++ * @param mod The mod trying to open a GUI ++ * @param modGuiId GUI ID ++ * @param world Current World ++ * @param x Passed directly to IGuiHandler, data meaningless Typically world X position ++ * @param y Passed directly to IGuiHandler, data meaningless Typically world Y position ++ * @param z Passed directly to IGuiHandler, data meaningless Typically world Z position ++ */ ++ public void openGui(Object mod, int modGuiId, World world, int x, int y, int z) ++ { ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(this, mod, modGuiId, world, x, y, z); ++ } ++ ++ ++ /* ======================================== FORGE START =====================================*/ ++ /** ++ * A dimension aware version of getBedLocation. ++ * @param dimension The dimension to get the bed spawn for ++ * @return The player specific spawn location for the dimension. May be null. ++ */ ++ public BlockPos getBedLocation(int dimension) ++ { ++ return dimension == 0 ? spawnChunk : spawnChunkMap.get(dimension); ++ } ++ ++ /** ++ * A dimension aware version of isSpawnForced. ++ * Noramally isSpawnForced is used to determine if the respawn system should check for a bed or not. ++ * This just extends that to be dimension aware. ++ * @param dimension The dimension to get whether to check for a bed before spawning for ++ * @return The player specific spawn location for the dimension. May be null. ++ */ ++ public boolean isSpawnForced(int dimension) ++ { ++ if (dimension == 0) return this.spawnForced; ++ Boolean forced = this.spawnForcedMap.get(dimension); ++ return forced == null ? false : forced; ++ } ++ ++ /** ++ * A dimension aware version of setSpawnChunk. ++ * This functions identically, but allows you to specify which dimension to affect, rather than affecting the player's current dimension. ++ * @param pos The spawn point to set as the player-specific spawn point for the dimension ++ * @param forced Whether or not the respawn code should check for a bed at this location (true means it won't check for a bed) ++ * @param dimension Which dimension to apply the player-specific respawn point to ++ */ ++ public void setSpawnChunk(BlockPos pos, boolean forced, int dimension) ++ { ++ if (dimension == 0) ++ { ++ if (pos != null) ++ { ++ spawnChunk = pos; ++ spawnForced = forced; ++ } ++ else ++ { ++ spawnChunk = null; ++ spawnForced = false; ++ } ++ return; ++ } ++ ++ if (pos != null) ++ { ++ spawnChunkMap.put(dimension, pos); ++ spawnForcedMap.put(dimension, forced); ++ } ++ else ++ { ++ spawnChunkMap.remove(dimension); ++ spawnForcedMap.remove(dimension); ++ } ++ } ++ ++ private String displayname; ++ ++ /** ++ * Returns the default eye height of the player ++ * @return player default eye height ++ */ ++ public float getDefaultEyeHeight() ++ { ++ return 1.62F; ++ } ++ ++ /** ++ * Get the currently computed display name, cached for efficiency. ++ * @return the current display name ++ */ ++ public String getDisplayNameString() ++ { ++ if(this.displayname == null) ++ { ++ this.displayname = ForgeEventFactory.getPlayerDisplayName(this, this.getName()); ++ } ++ return this.displayname; ++ } ++ ++ /** ++ * Force the displayed name to refresh ++ */ ++ public void refreshDisplayName() ++ { ++ this.displayname = ForgeEventFactory.getPlayerDisplayName(this, this.getName()); ++ } ++ ++ private final java.util.Collection prefixes = new java.util.LinkedList(); ++ private final java.util.Collection suffixes = new java.util.LinkedList(); ++ ++ /** ++ * Add a prefix to the player's username in chat ++ * @param prefix The prefix ++ */ ++ public void addPrefix(net.minecraft.util.IChatComponent prefix) { prefixes.add(prefix); } ++ ++ /** ++ * Add a suffix to the player's username in chat ++ * @param suffix The suffix ++ */ ++ public void addSuffix(net.minecraft.util.IChatComponent suffix) { suffixes.add(suffix); } ++ ++ public java.util.Collection getPrefixes() { return this.prefixes; } ++ public java.util.Collection getSuffixes() { return this.suffixes; } ++ ++ /* ======================================== FORGE END =====================================*/ ++ + public static enum EnumChatVisibility + { + FULL(0, "options.chat.visibility.full"), diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch new file mode 100644 index 000000000..7db228e41 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch @@ -0,0 +1,92 @@ +--- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayerMP.java ++++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayerMP.java +@@ -127,14 +127,15 @@ + public boolean playerConqueredTheEnd; + private static final String __OBFID = "CL_00001440"; + ++ @SuppressWarnings("unused") + public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, ItemInWorldManager interactionManager) + { + super(worldIn, profile); + interactionManager.thisPlayerMP = this; + this.theItemInWorldManager = interactionManager; +- BlockPos blockpos = worldIn.getSpawnPoint(); ++ BlockPos blockpos = worldIn.provider.getRandomizedSpawnPoint(); + +- if (!worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) ++ if (false && !worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) + { + int i = Math.max(5, server.getSpawnProtectionSize() - 6); + int j = MathHelper.floor_double(worldIn.getWorldBorder().getClosestDistance((double)blockpos.getX(), (double)blockpos.getZ())); +@@ -227,7 +228,7 @@ + + this.openContainer.detectAndSendChanges(); + +- if (!this.worldObj.isRemote && !this.openContainer.canInteractWith(this)) ++ if (!this.worldObj.isRemote && !net.minecraftforge.common.ForgeHooks.canInteractWith(this, this.openContainer)) + { + this.closeScreen(); + this.openContainer = this.inventoryContainer; +@@ -269,7 +270,8 @@ + if (chunk.isPopulated()) + { + arraylist.add(chunk); +- arraylist1.addAll(((WorldServer)this.worldObj).func_147486_a(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 16, 256, chunkcoordintpair.chunkZPos * 16 + 16)); ++ arraylist1.addAll(((WorldServer)this.worldObj).func_147486_a(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 15, 256, chunkcoordintpair.chunkZPos * 16 + 15)); ++ //BugFix: 16 makes it load an extra chunk, which isn't associated with a player, which makes it not unload unless a player walks near it. + iterator1.remove(); + } + } +@@ -305,6 +307,7 @@ + { + chunk = (Chunk)iterator2.next(); + this.getServerForPlayer().getEntityTracker().func_85172_a(this, chunk); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(chunk.getChunkCoordIntPair(), this)); + } + } + } +@@ -440,6 +443,7 @@ + + public void onDeath(DamageSource cause) + { ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; + if (this.worldObj.getGameRules().getGameRuleBooleanValue("showDeathMessages")) + { + Team team = this.getTeam(); +@@ -463,7 +467,20 @@ + + if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) + { ++ captureDrops = true; ++ capturedDrops.clear(); ++ + this.inventory.dropAllItems(); ++ ++ captureDrops = false; ++ net.minecraftforge.event.entity.player.PlayerDropsEvent event = new net.minecraftforge.event.entity.player.PlayerDropsEvent(this, cause, capturedDrops, recentlyHit > 0); ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) ++ { ++ for (net.minecraft.entity.item.EntityItem item : capturedDrops) ++ { ++ joinEntityItemWithWorld(item); ++ } ++ } + } + + Collection collection = this.worldObj.getScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.deathCount); +@@ -481,6 +498,7 @@ + if (entitylivingbase != null) + { + EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entitylivingbase))); ++ if (entityegginfo == null) entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.getEntityString(entitylivingbase)); + + if (entityegginfo != null) + { +@@ -849,6 +867,7 @@ + { + if (stat != null) + { ++ if (stat.isAchievement() && net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.AchievementEvent(this, (net.minecraft.stats.Achievement) stat))) return; + this.statsFile.func_150871_b(this, stat, amount); + Iterator iterator = this.getWorldScoreboard().getObjectivesFromCriteria(stat.func_150952_k()).iterator(); + diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch new file mode 100644 index 000000000..7a1769164 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/entity/player/InventoryPlayer.java ++++ ../src-work/minecraft/net/minecraft/entity/player/InventoryPlayer.java +@@ -319,6 +319,14 @@ + this.mainInventory[i].updateAnimation(this.player.worldObj, this.player, i, this.currentItem == i); + } + } ++ ++ for (int i = 0; i < armorInventory.length; i++) ++ { ++ if (armorInventory[i] != null) ++ { ++ armorInventory[i].getItem().onArmorTick(player.worldObj, player, armorInventory[i]); ++ } ++ } + } + + public boolean consumeInventoryItem(Item p_146026_1_) diff --git a/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch b/patches.mcp/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch similarity index 50% rename from patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch rename to patches.mcp/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch index 14c20d778..4b1e039f3 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch +++ b/patches.mcp/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch @@ -5,18 +5,18 @@ } + @SuppressWarnings("unused") - private ItemStack func_146033_f() + private ItemStack getFishingResult() { - float f = this.field_70170_p.field_73012_v.nextFloat(); - int i = EnchantmentHelper.func_151386_g(this.field_146042_b); - int j = EnchantmentHelper.func_151387_h(this.field_146042_b); + float f = this.worldObj.rand.nextFloat(); + int i = EnchantmentHelper.getLuckOfSeaModifier(this.angler); + int j = EnchantmentHelper.getLureModifier(this.angler); + + if (true) + { -+ this.field_146042_b.func_71064_a(net.minecraftforge.common.FishingHooks.getFishableCategory(f, i, j).stat, 1); -+ return net.minecraftforge.common.FishingHooks.getRandomFishable(this.field_70146_Z, f, i, j); ++ this.angler.addStat(net.minecraftforge.common.FishingHooks.getFishableCategory(f, i, j).stat, 1); ++ return net.minecraftforge.common.FishingHooks.getRandomFishable(this.rand, f, i, j); + } + float f1 = 0.1F - (float)i * 0.025F - (float)j * 0.01F; float f2 = 0.05F + (float)i * 0.01F - (float)j * 0.01F; - f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); diff --git a/patches.mcp/minecraft/net/minecraft/init/Bootstrap.java.patch b/patches.mcp/minecraft/net/minecraft/init/Bootstrap.java.patch new file mode 100644 index 000000000..3566d51cb --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/init/Bootstrap.java.patch @@ -0,0 +1,35 @@ +--- ../src-base/minecraft/net/minecraft/init/Bootstrap.java ++++ ../src-work/minecraft/net/minecraft/init/Bootstrap.java +@@ -67,6 +67,7 @@ + return alreadyRegistered; + } + ++ @SuppressWarnings("unused") + static void registerDispenserBehaviors() + { + BlockDispenser.dispenseBehaviorRegistry.putObject(Items.arrow, new BehaviorProjectileDispense() +@@ -144,7 +145,7 @@ + double d0 = source.getX() + (double)enumfacing.getFrontOffsetX(); + double d1 = (double)((float)source.getBlockPos().getY() + 0.2F); + double d2 = source.getZ() + (double)enumfacing.getFrontOffsetZ(); +- Entity entity = ItemMonsterPlacer.spawnCreature(source.getWorld(), stack.getMetadata(), d0, d1, d2); ++ Entity entity = ItemMonsterPlacer.spawnCreature(source.getWorld(), ItemMonsterPlacer.getEntityName(stack), d0, d1, d2); + + if (entity instanceof EntityLivingBase && stack.hasDisplayName()) + { +@@ -509,6 +510,7 @@ + } + } + }); ++ if (false){ //Forge: Removed, Fixes MC-75630 - Exploit with signs and command blocks + BlockDispenser.dispenseBehaviorRegistry.putObject(Item.getItemFromBlock(Blocks.command_block), new BehaviorDefaultDispenseItem() + { + private static final String __OBFID = "CL_00002276"; +@@ -535,6 +537,7 @@ + protected void playDispenseSound(IBlockSource source) {} + protected void spawnDispenseParticles(IBlockSource source, EnumFacing facingIn) {} + }); ++ } + } + + public static void register() diff --git a/patches.mcp/minecraft/net/minecraft/inventory/Container.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/Container.java.patch new file mode 100644 index 000000000..35180e976 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/inventory/Container.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/inventory/Container.java ++++ ../src-work/minecraft/net/minecraft/inventory/Container.java +@@ -624,7 +624,7 @@ + slot = (Slot)this.inventorySlots.get(k); + itemstack1 = slot.getStack(); + +- if (itemstack1 == null) ++ if (itemstack1 == null && slot.isItemValid(stack)) // Forge: Make sure to respect isItemValid in the slot. + { + slot.putStack(stack.copy()); + slot.onSlotChanged(); diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch new file mode 100644 index 000000000..7ef5ed191 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/inventory/ContainerBeacon.java ++++ ../src-work/minecraft/net/minecraft/inventory/ContainerBeacon.java +@@ -132,7 +132,7 @@ + + public boolean isItemValid(ItemStack stack) + { +- return stack == null ? false : stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot; ++ return stack == null ? false : stack.getItem().isBeaconPayment(stack); + } + + public int getSlotStackLimit() diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch new file mode 100644 index 000000000..305f94fad --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/inventory/ContainerBrewingStand.java ++++ ../src-work/minecraft/net/minecraft/inventory/ContainerBrewingStand.java +@@ -158,7 +158,7 @@ + + public boolean isItemValid(ItemStack stack) + { +- return stack != null ? stack.getItem().isPotionIngredient(stack) : false; ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack); + } + + public int getSlotStackLimit() +@@ -190,7 +190,7 @@ + + public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) + { +- if (stack.getItem() == Items.potionitem && stack.getMetadata() > 0) ++ if (stack.getItem() instanceof net.minecraft.item.ItemPotion && stack.getMetadata() > 0) + { + this.player.triggerAchievement(AchievementList.potion); + } +@@ -200,7 +200,7 @@ + + public static boolean canHoldPotion(ItemStack p_75243_0_) + { +- return p_75243_0_ != null && (p_75243_0_.getItem() == Items.potionitem || p_75243_0_.getItem() == Items.glass_bottle); ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_75243_0_); + } + } + } diff --git a/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch similarity index 51% rename from patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch rename to patches.mcp/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch index 01c2537e4..12196925d 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch +++ b/patches.mcp/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch @@ -9,15 +9,15 @@ public class ContainerEnchantment extends Container { @@ -68,9 +69,12 @@ - this.func_75146_a(new Slot(this.field_75168_e, 1, 35, 47) + this.addSlotToContainer(new Slot(this.tableInventory, 1, 35, 47) { private static final String __OBFID = "CL_00002185"; + java.util.List ores = net.minecraftforge.oredict.OreDictionary.getOres("gemLapis"); - public boolean func_75214_a(ItemStack p_75214_1_) + public boolean isItemValid(ItemStack stack) { -- return p_75214_1_.func_77973_b() == Items.field_151100_aR && EnumDyeColor.func_176766_a(p_75214_1_.func_77960_j()) == EnumDyeColor.BLUE; +- return stack.getItem() == Items.dye && EnumDyeColor.byDyeDamage(stack.getMetadata()) == EnumDyeColor.BLUE; + for (ItemStack ore : ores) -+ if (net.minecraftforge.oredict.OreDictionary.itemMatches(ore, p_75214_1_, false)) return true; ++ if (net.minecraftforge.oredict.OreDictionary.itemMatches(ore, stack, false)) return true; + return false; } }); @@ -32,45 +32,45 @@ { @@ -159,37 +164,15 @@ { - if ((j != 0 || k != 0) && this.field_75172_h.func_175623_d(this.field_178150_j.func_177982_a(k, 0, j)) && this.field_75172_h.func_175623_d(this.field_178150_j.func_177982_a(k, 1, j))) + if ((j != 0 || k != 0) && this.worldPointer.isAirBlock(this.position.add(k, 0, j)) && this.worldPointer.isAirBlock(this.position.add(k, 1, j))) { -- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 0, j * 2)).func_177230_c() == Blocks.field_150342_X) +- if (this.worldPointer.getBlockState(this.position.add(k * 2, 0, j * 2)).getBlock() == Blocks.bookshelf) - { - ++i; - } -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k * 2, 0, j * 2)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k * 2, 1, j * 2)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 0, j * 2)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 1, j * 2)); -- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 1, j * 2)).func_177230_c() == Blocks.field_150342_X) +- if (this.worldPointer.getBlockState(this.position.add(k * 2, 1, j * 2)).getBlock() == Blocks.bookshelf) - { - ++i; - } - if (k != 0 && j != 0) { -- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 0, j)).func_177230_c() == Blocks.field_150342_X) +- if (this.worldPointer.getBlockState(this.position.add(k * 2, 0, j)).getBlock() == Blocks.bookshelf) - { - ++i; - } - -- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 1, j)).func_177230_c() == Blocks.field_150342_X) +- if (this.worldPointer.getBlockState(this.position.add(k * 2, 1, j)).getBlock() == Blocks.bookshelf) - { - ++i; - } - -- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k, 0, j * 2)).func_177230_c() == Blocks.field_150342_X) +- if (this.worldPointer.getBlockState(this.position.add(k, 0, j * 2)).getBlock() == Blocks.bookshelf) - { - ++i; - } - -- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k, 1, j * 2)).func_177230_c() == Blocks.field_150342_X) +- if (this.worldPointer.getBlockState(this.position.add(k, 1, j * 2)).getBlock() == Blocks.bookshelf) - { - ++i; - } -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k * 2, 0, j)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k * 2, 1, j)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k, 0, j * 2)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k, 1, j * 2)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 0, j)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 1, j)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k, 0, j * 2)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k, 1, j * 2)); } } } @@ -78,8 +78,8 @@ for (j = 0; j < 3; ++j) { -- this.field_75167_g[j] = EnchantmentHelper.func_77514_a(this.field_75169_l, j, i, itemstack); -+ this.field_75167_g[j] = EnchantmentHelper.func_77514_a(this.field_75169_l, j, (int)power, itemstack); +- this.enchantLevels[j] = EnchantmentHelper.calcItemStackEnchantability(this.rand, j, i, itemstack); ++ this.enchantLevels[j] = EnchantmentHelper.calcItemStackEnchantability(this.rand, j, (int)power, itemstack); this.field_178151_h[j] = -1; - if (this.field_75167_g[j] < j + 1) + if (this.enchantLevels[j] < j + 1) diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch new file mode 100644 index 000000000..b2ff5dd66 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/inventory/ContainerPlayer.java ++++ ../src-work/minecraft/net/minecraft/inventory/ContainerPlayer.java +@@ -47,7 +47,8 @@ + } + public boolean isItemValid(ItemStack stack) + { +- return stack == null ? false : (stack.getItem() instanceof ItemArmor ? ((ItemArmor)stack.getItem()).armorType == k : (stack.getItem() != Item.getItemFromBlock(Blocks.pumpkin) && stack.getItem() != Items.skull ? false : k == 0)); ++ if (stack == null) return false; ++ return stack.getItem().isValidArmor(stack, k, thePlayer); + } + @SideOnly(Side.CLIENT) + public String getSlotTexture() diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch new file mode 100644 index 000000000..6dd53ae6c --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch @@ -0,0 +1,47 @@ +--- ../src-base/minecraft/net/minecraft/inventory/ContainerRepair.java ++++ ../src-work/minecraft/net/minecraft/inventory/ContainerRepair.java +@@ -73,6 +73,8 @@ + playerIn.addExperienceLevel(-ContainerRepair.this.maximumCost); + } + ++ float breakChance = net.minecraftforge.common.ForgeHooks.onAnvilRepair(playerIn, stack, ContainerRepair.this.inputSlots.getStackInSlot(0), ContainerRepair.this.inputSlots.getStackInSlot(1)); ++ + ContainerRepair.this.inputSlots.setInventorySlotContents(0, (ItemStack)null); + + if (ContainerRepair.this.materialCost > 0) +@@ -97,7 +99,7 @@ + ContainerRepair.this.maximumCost = 0; + IBlockState iblockstate = worldIn.getBlockState(blockPosIn); + +- if (!playerIn.capabilities.isCreativeMode && !worldIn.isRemote && iblockstate.getBlock() == Blocks.anvil && playerIn.getRNG().nextFloat() < 0.12F) ++ if (!playerIn.capabilities.isCreativeMode && !worldIn.isRemote && iblockstate.getBlock() == Blocks.anvil && playerIn.getRNG().nextFloat() < breakChance) + { + int k = ((Integer)iblockstate.getValue(BlockAnvil.DAMAGE)).intValue(); + ++k; +@@ -177,6 +179,7 @@ + + if (itemstack2 != null) + { ++ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, outputSlot, repairedItemName, i2)) return; + flag7 = itemstack2.getItem() == Items.enchanted_book && Items.enchanted_book.getEnchantments(itemstack2).tagCount() > 0; + int k; + int l; +@@ -271,7 +274,8 @@ + { + int l1 = ((Integer)iterator.next()).intValue(); + +- if (l1 != l && !enchantment.canApplyTogether(Enchantment.getEnchantmentById(l1))) ++ Enchantment e2 = Enchantment.getEnchantmentById(l1); ++ if (l1 != l && !(enchantment.canApplyTogether(e2) && e2.canApplyTogether(enchantment))) //Forge BugFix: Let Both enchantments veto being together + { + flag8 = false; + ++i; +@@ -322,6 +326,8 @@ + } + } + ++ if (flag7 && !itemstack1.getItem().isBookEnchantable(itemstack1, itemstack2)) itemstack1 = null; ++ + if (StringUtils.isBlank(this.repairedItemName)) + { + if (itemstack.hasDisplayName()) diff --git a/patches/minecraft/net/minecraft/inventory/Slot.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/Slot.java.patch similarity index 86% rename from patches/minecraft/net/minecraft/inventory/Slot.java.patch rename to patches.mcp/minecraft/net/minecraft/inventory/Slot.java.patch index 0eb96c519..5617898aa 100644 --- a/patches/minecraft/net/minecraft/inventory/Slot.java.patch +++ b/patches.mcp/minecraft/net/minecraft/inventory/Slot.java.patch @@ -9,13 +9,13 @@ import net.minecraftforge.fml.relauncher.Side; @@ -86,7 +87,7 @@ @SideOnly(Side.CLIENT) - public String func_178171_c() + public String getSlotTexture() { - return null; + return backgroundName; } - public ItemStack func_75209_a(int p_75209_1_) + public ItemStack decrStackSize(int amount) @@ -109,4 +110,64 @@ { return true; @@ -32,7 +32,7 @@ + @SideOnly(Side.CLIENT) + public net.minecraft.util.ResourceLocation getBackgroundLocation() + { -+ return (backgroundLocation == null ? net.minecraft.client.renderer.texture.TextureMap.field_110575_b : backgroundLocation); ++ return (backgroundLocation == null ? net.minecraft.client.renderer.texture.TextureMap.locationBlocksTexture : backgroundLocation); + } + + /** @@ -58,14 +58,14 @@ + @SideOnly(Side.CLIENT) + public net.minecraft.client.renderer.texture.TextureAtlasSprite getBackgroundSprite() + { -+ String name = func_178171_c(); -+ return name == null ? null : getBackgroundMap().func_110572_b(name); ++ String name = getSlotTexture(); ++ return name == null ? null : getBackgroundMap().getAtlasSprite(name); + } + + @SideOnly(Side.CLIENT) + protected net.minecraft.client.renderer.texture.TextureMap getBackgroundMap() + { -+ if (backgroundMap == null) backgroundMap = Minecraft.func_71410_x().func_147117_R(); ++ if (backgroundMap == null) backgroundMap = Minecraft.getMinecraft().getTextureMapBlocks(); + return (net.minecraft.client.renderer.texture.TextureMap)backgroundMap; + } + @@ -77,7 +77,7 @@ + */ + public int getSlotIndex() + { -+ return field_75225_a; ++ return slotIndex; + } + /*========================================= FORGE END =====================================*/ } diff --git a/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/SlotCrafting.java.patch similarity index 57% rename from patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch rename to patches.mcp/minecraft/net/minecraft/inventory/SlotCrafting.java.patch index 0dd6c1066..61021f825 100644 --- a/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch +++ b/patches.mcp/minecraft/net/minecraft/inventory/SlotCrafting.java.patch @@ -2,12 +2,12 @@ +++ ../src-work/minecraft/net/minecraft/inventory/SlotCrafting.java @@ -113,8 +113,11 @@ - public void func_82870_a(EntityPlayer p_82870_1_, ItemStack p_82870_2_) + public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(p_82870_1_, p_82870_2_, field_75239_a); - this.func_75208_c(p_82870_2_); -+ net.minecraftforge.common.ForgeHooks.setCraftingPlayer(p_82870_1_); - ItemStack[] aitemstack = CraftingManager.func_77594_a().func_180303_b(this.field_75239_a, p_82870_1_.field_70170_p); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, craftMatrix); + this.onCrafting(stack); ++ net.minecraftforge.common.ForgeHooks.setCraftingPlayer(playerIn); + ItemStack[] aitemstack = CraftingManager.getInstance().func_180303_b(this.craftMatrix, playerIn.worldObj); + net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null); for (int i = 0; i < aitemstack.length; ++i) diff --git a/patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch similarity index 58% rename from patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch rename to patches.mcp/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch index e0dda7760..f33e8758c 100644 --- a/patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch +++ b/patches.mcp/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch @@ -4,8 +4,8 @@ this.field_75228_b = 0; -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerSmeltedEvent(field_75229_a, p_75208_1_); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerSmeltedEvent(thePlayer, stack); + - if (p_75208_1_.func_77973_b() == Items.field_151042_j) + if (stack.getItem() == Items.iron_ingot) { - this.field_75229_a.func_71029_a(AchievementList.field_76016_k); + this.thePlayer.triggerAchievement(AchievementList.acquireIron); diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch similarity index 83% rename from patches/minecraft/net/minecraft/item/Item.java.patch rename to patches.mcp/minecraft/net/minecraft/item/Item.java.patch index af3b601e9..57972967b 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch @@ -4,65 +4,65 @@ public class Item { -- public static final RegistryNamespaced field_150901_e = new RegistryNamespaced(); -- private static final Map field_179220_a = Maps.newHashMap(); -+ public static final RegistryNamespaced field_150901_e = net.minecraftforge.fml.common.registry.GameData.getItemRegistry(); -+ private static final Map field_179220_a = net.minecraftforge.fml.common.registry.GameData.getBlockItemMap(); - protected static final UUID field_111210_e = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); - private CreativeTabs field_77701_a; - protected static Random field_77697_d = new Random(); +- public static final RegistryNamespaced itemRegistry = new RegistryNamespaced(); +- private static final Map BLOCK_TO_ITEM = Maps.newHashMap(); ++ public static final RegistryNamespaced itemRegistry = net.minecraftforge.fml.common.registry.GameData.getItemRegistry(); ++ private static final Map BLOCK_TO_ITEM = net.minecraftforge.fml.common.registry.GameData.getBlockItemMap(); + protected static final UUID itemModifierUUID = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); + private CreativeTabs tabToDisplayOn; + protected static Random itemRand = new Random(); @@ -61,6 +61,9 @@ - private String field_77774_bZ; + private String unlocalizedName; private static final String __OBFID = "CL_00000041"; + public final net.minecraftforge.fml.common.registry.RegistryDelegate delegate = -+ ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)field_150901_e).getDelegate(this, Item.class); ++ ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)itemRegistry).getDelegate(this, Item.class); + - public static int func_150891_b(Item p_150891_0_) + public static int getIdFromItem(Item itemIn) { - return p_150891_0_ == null ? 0 : field_150901_e.func_148757_b(p_150891_0_); + return itemIn == null ? 0 : itemRegistry.getIDForObject(itemIn); @@ -126,6 +129,7 @@ - return p_77654_1_; + return stack; } + @Deprecated // Use ItemStack sensitive version below. - public int func_77639_j() + public int getItemStackLimit() { - return this.field_77777_bU; + return this.maxStackSize; @@ -239,6 +243,7 @@ - return this.field_77700_c; + return this.containerItem; } + @Deprecated // Use ItemStack sensitive version below. - public boolean func_77634_r() + public boolean hasContainerItem() { - return this.field_77700_c != null; + return this.containerItem != null; @@ -308,7 +313,7 @@ - public boolean func_77616_k(ItemStack p_77616_1_) + public boolean isItemTool(ItemStack stack) { -- return this.func_77639_j() == 1 && this.func_77645_m(); -+ return this.getItemStackLimit(p_77616_1_) == 1 && this.func_77645_m(); +- return this.getItemStackLimit() == 1 && this.isDamageable(); ++ return this.getItemStackLimit(stack) == 1 && this.isDamageable(); } - protected MovingObjectPosition func_77621_a(World p_77621_1_, EntityPlayer p_77621_2_, boolean p_77621_3_) + protected MovingObjectPosition getMovingObjectPositionFromPlayer(World worldIn, EntityPlayer playerIn, boolean useLiquids) @@ -326,6 +331,10 @@ float f6 = f3 * f4; float f7 = f2 * f4; double d3 = 5.0D; -+ if (p_77621_2_ instanceof net.minecraft.entity.player.EntityPlayerMP) ++ if (playerIn instanceof net.minecraft.entity.player.EntityPlayerMP) + { -+ d3 = ((net.minecraft.entity.player.EntityPlayerMP)p_77621_2_).field_71134_c.getBlockReachDistance(); ++ d3 = ((net.minecraft.entity.player.EntityPlayerMP)playerIn).theItemInWorldManager.getBlockReachDistance(); + } - Vec3 vec31 = vec3.func_72441_c((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); - return p_77621_1_.func_147447_a(vec3, vec31, p_77621_3_, !p_77621_3_, false); + Vec3 vec31 = vec3.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); + return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false); } @@ -363,11 +372,579 @@ return false; } + @Deprecated // Use ItemStack sensitive version below. - public Multimap func_111205_h() + public Multimap getItemAttributeModifiers() { return HashMultimap.create(); } @@ -73,7 +73,7 @@ + */ + public Multimap getAttributeModifiers(ItemStack stack) + { -+ return this.func_111205_h(); ++ return this.getItemAttributeModifiers(); + } + + /** @@ -112,7 +112,7 @@ + */ + public float getDigSpeed(ItemStack itemstack, net.minecraft.block.state.IBlockState state) + { -+ return func_150893_a(itemstack, state.func_177230_c()); ++ return getStrVsBlock(itemstack, state.getBlock()); + } + + @@ -123,7 +123,7 @@ + */ + public boolean isRepairable() + { -+ return canRepair && func_77645_m(); ++ return canRepair && isDamageable(); + } + + /** @@ -203,7 +203,7 @@ + { + return null; + } -+ return new ItemStack(func_77668_q()); ++ return new ItemStack(getContainerItem()); + } + + /** @@ -213,7 +213,7 @@ + */ + public boolean hasContainerItem(ItemStack stack) + { -+ return func_77634_r(); ++ return hasContainerItem(); + } + + /** @@ -278,7 +278,7 @@ + */ + public CreativeTabs[] getCreativeTabs() + { -+ return new CreativeTabs[]{ func_77640_w() }; ++ return new CreativeTabs[]{ getCreativeTab() }; + } + + /** @@ -321,9 +321,9 @@ + { + if (this instanceof ItemEnchantedBook) + { -+ return ((ItemEnchantedBook)this).func_92112_a(rnd, -+ original.field_76295_d, -+ original.field_76296_e, original.field_76292_a); ++ return ((ItemEnchantedBook)this).getRandom(rnd, ++ original.theMinimumChanceToGenerateItem, ++ original.theMaximumChanceToGenerateItem, original.itemWeight); + } + return original; + } @@ -359,12 +359,12 @@ + { + if (this instanceof ItemArmor) + { -+ return ((ItemArmor)this).field_77881_a == armorType; ++ return ((ItemArmor)this).armorType == armorType; + } + + if (armorType == 0) + { -+ return this == Item.func_150898_a(Blocks.field_150423_aK) || this == Items.field_151144_bL; ++ return this == Item.getItemFromBlock(Blocks.pumpkin) || this == Items.skull; + } + + return false; @@ -460,7 +460,7 @@ + */ + public int getDamage(ItemStack stack) + { -+ return stack.field_77991_e; ++ return stack.itemDamage; + } + + /** @@ -470,7 +470,7 @@ + */ + public int getMetadata(ItemStack stack) + { -+ return stack.field_77991_e; ++ return stack.itemDamage; + } + + /** @@ -483,7 +483,7 @@ + */ + public boolean showDurabilityBar(ItemStack stack) + { -+ return stack.func_77951_h(); ++ return stack.isItemDamaged(); + } + + /** @@ -494,7 +494,7 @@ + */ + public double getDurabilityForDisplay(ItemStack stack) + { -+ return (double)stack.func_77952_i() / (double)stack.func_77958_k(); ++ return (double)stack.getItemDamage() / (double)stack.getMaxDamage(); + } + + /** @@ -506,7 +506,7 @@ + */ + public int getMaxDamage(ItemStack stack) + { -+ return func_77612_l(); ++ return getMaxDamage(); + } + + /** @@ -516,7 +516,7 @@ + */ + public boolean isDamaged(ItemStack stack) + { -+ return stack.field_77991_e > 0; ++ return stack.itemDamage > 0; + } + + /** @@ -526,11 +526,11 @@ + */ + public void setDamage(ItemStack stack, int damage) + { -+ stack.field_77991_e = damage; ++ stack.itemDamage = damage; + -+ if (stack.field_77991_e < 0) ++ if (stack.itemDamage < 0) + { -+ stack.field_77991_e = 0; ++ stack.itemDamage = 0; + } + } + @@ -542,7 +542,7 @@ + */ + public boolean canHarvestBlock(Block par1Block, ItemStack itemStack) + { -+ return func_150897_b(par1Block); ++ return canHarvestBlock(par1Block); + } + + /** @@ -554,7 +554,7 @@ + */ + public int getItemStackLimit(ItemStack stack) + { -+ return this.func_77639_j(); ++ return this.getItemStackLimit(); + } + + private java.util.Map toolClasses = new java.util.HashMap(); @@ -604,7 +604,7 @@ + */ + public int getItemEnchantability(ItemStack stack) + { -+ return func_77619_b(); ++ return getItemEnchantability(); + } + + /** @@ -614,7 +614,7 @@ + */ + public boolean isBeaconPayment(ItemStack stack) + { -+ return this == Items.field_151166_bC || this == Items.field_151045_i || this == Items.field_151043_k || this == Items.field_151042_j; ++ return this == Items.emerald || this == Items.diamond || this == Items.gold_ingot || this == Items.iron_ingot; + } + + @@ -629,14 +629,14 @@ + */ + public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) + { -+ return !ItemStack.func_77989_b(oldStack, newStack); ++ return !ItemStack.areItemStacksEqual(oldStack, newStack); + } + /* ======================================== FORGE END =====================================*/ + + - public static void func_150900_l() + public static void registerItems() { - func_179214_a(Blocks.field_150348_b, (new ItemMultiTexture(Blocks.field_150348_b, Blocks.field_150348_b, new Function() + registerItemBlock(Blocks.stone, (new ItemMultiTexture(Blocks.stone, Blocks.stone, new Function() @@ -933,6 +1510,10 @@ private static final String __OBFID = "CL_00000042"; @@ -645,24 +645,24 @@ + @Deprecated public Item customCraftingMaterial = null; // Remote in 1.8.1 + private ItemStack repairMaterial = null; + - private ToolMaterial(int p_i1874_3_, int p_i1874_4_, float p_i1874_5_, float p_i1874_6_, int p_i1874_7_) + private ToolMaterial(int harvestLevel, int maxUses, float efficiency, float damageVsEntity, int enchantability) { - this.field_78001_f = p_i1874_3_; + this.harvestLevel = harvestLevel; @@ -967,9 +1548,36 @@ - return this.field_78008_j; + return this.enchantability; } + @Deprecated // Use getRepairItemStack below - public Item func_150995_f() + public Item getRepairItem() { -- return this == WOOD ? Item.func_150898_a(Blocks.field_150344_f) : (this == STONE ? Item.func_150898_a(Blocks.field_150347_e) : (this == GOLD ? Items.field_151043_k : (this == IRON ? Items.field_151042_j : (this == EMERALD ? Items.field_151045_i : null)))); +- return this == WOOD ? Item.getItemFromBlock(Blocks.planks) : (this == STONE ? Item.getItemFromBlock(Blocks.cobblestone) : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == EMERALD ? Items.diamond : null)))); + switch (this) + { -+ case WOOD: return Item.func_150898_a(Blocks.field_150344_f); -+ case STONE: return Item.func_150898_a(Blocks.field_150347_e); -+ case GOLD: return Items.field_151043_k; -+ case IRON: return Items.field_151042_j; -+ case EMERALD: return Items.field_151045_i; ++ case WOOD: return Item.getItemFromBlock(Blocks.planks); ++ case STONE: return Item.getItemFromBlock(Blocks.cobblestone); ++ case GOLD: return Items.gold_ingot; ++ case IRON: return Items.iron_ingot; ++ case EMERALD: return Items.diamond; + default: return customCraftingMaterial; + } } @@ -672,14 +672,14 @@ + if (this.repairMaterial != null || customCraftingMaterial != null) throw new RuntimeException("Can not change already set repair material"); + if (this == WOOD || this == STONE || this == GOLD || this == IRON || this == EMERALD) throw new RuntimeException("Can not change vanilla tool repair materials"); + this.repairMaterial = stack; -+ this.customCraftingMaterial = stack.func_77973_b(); ++ this.customCraftingMaterial = stack.getItem(); + return this; + } + + public ItemStack getRepairItemStack() + { + if (repairMaterial != null) return repairMaterial; -+ Item ret = this.func_150995_f(); ++ Item ret = this.getRepairItem(); + if (ret == null) return null; + repairMaterial = new ItemStack(ret, 1, net.minecraftforge.oredict.OreDictionary.WILDCARD_VALUE); + return repairMaterial; diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch new file mode 100644 index 000000000..7113ee312 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch @@ -0,0 +1,47 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemArmor.java ++++ ../src-work/minecraft/net/minecraft/item/ItemArmor.java +@@ -38,7 +38,7 @@ + if (list.size() > 0) + { + EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0); +- int l = entitylivingbase instanceof EntityPlayer ? 1 : 0; ++ int l = 0;// Forge: We fix the indexes. Mojang Stop hard coding this! + int i1 = EntityLiving.getArmorPosition(stack); + ItemStack itemstack1 = stack.copy(); + itemstack1.stackSize = 1; +@@ -192,7 +192,7 @@ + + if (itemstack1 == null) + { +- playerIn.setCurrentItemOrArmor(i, itemStackIn.copy()); ++ playerIn.setCurrentItemOrArmor(i + 1, itemStackIn.copy()); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. + itemStackIn.stackSize = 0; + } + +@@ -213,6 +213,9 @@ + + private static final String __OBFID = "CL_00001768"; + ++ //Added by forge for custom Armor materials. ++ public Item customCraftingMaterial = null; ++ + private ArmorMaterial(String name, int p_i45789_4_, int[] reductionAmounts, int enchantability) + { + this.name = name; +@@ -238,7 +241,15 @@ + + public Item getRepairItem() + { +- return this == LEATHER ? Items.leather : (this == CHAIN ? Items.iron_ingot : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == DIAMOND ? Items.diamond : null)))); ++ switch (this) ++ { ++ case LEATHER: return Items.leather; ++ case CHAIN: return Items.iron_ingot; ++ case GOLD: return Items.gold_ingot; ++ case IRON: return Items.iron_ingot; ++ case DIAMOND: return Items.diamond; ++ default: return customCraftingMaterial; ++ } + } + + @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch new file mode 100644 index 000000000..38a636725 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch @@ -0,0 +1,72 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemBlock.java ++++ ../src-work/minecraft/net/minecraft/item/ItemBlock.java +@@ -63,16 +63,8 @@ + int i = this.getMetadata(stack.getMetadata()); + IBlockState iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, i, playerIn); + +- if (worldIn.setBlockState(pos, iblockstate1, 3)) ++ if (placeBlockAt(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ, iblockstate1)) + { +- iblockstate1 = worldIn.getBlockState(pos); +- +- if (iblockstate1.getBlock() == this.block) +- { +- setTileEntityNBT(worldIn, pos, stack); +- this.block.onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack); +- } +- + worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), this.block.stepSound.getPlaceSound(), (this.block.stepSound.getVolume() + 1.0F) / 2.0F, this.block.stepSound.getFrequency() * 0.8F); + --stack.stackSize; + } +@@ -85,14 +77,24 @@ + } + } + ++ @Deprecated //Use player sensitive version + public static boolean setTileEntityNBT(World worldIn, BlockPos pos, ItemStack stack) + { ++ return setTileEntityNBT(worldIn, pos, stack, null); ++ } ++ public static boolean setTileEntityNBT(World worldIn, BlockPos pos, ItemStack stack, EntityPlayer player) ++ { + if (stack.hasTagCompound() && stack.getTagCompound().hasKey("BlockEntityTag", 10)) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity != null) + { ++ //Forge: Fixes MC-75630 - Exploit with signs and command blocks ++ final net.minecraft.server.MinecraftServer server = net.minecraft.server.MinecraftServer.getServer(); ++ if (!worldIn.isRemote && tileentity.restrictNBTCopy() && ++ (server == null || !server.getConfigurationManager().canSendCommands(player.getGameProfile()))) ++ return false; + NBTTagCompound nbttagcompound = new NBTTagCompound(); + NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttagcompound.copy(); + tileentity.writeToNBT(nbttagcompound); +@@ -157,4 +159,26 @@ + { + return this.block; + } ++ ++ /** ++ * Called to actually place the block, after the location is determined ++ * and all permission checks have been made. ++ * ++ * @param stack The item stack that was used to place the block. This can be changed inside the method. ++ * @param player The player who is placing the block. Can be null if the block is not being placed by a player. ++ * @param side The side the player (or machine) right-clicked on. ++ */ ++ public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) ++ { ++ if (!world.setBlockState(pos, newState, 3)) return false; ++ ++ IBlockState state = world.getBlockState(pos); ++ if (state.getBlock() == this.block) ++ { ++ setTileEntityNBT(world, pos, stack, player); ++ this.block.onBlockPlacedBy(world, pos, state, player, stack); ++ } ++ ++ return true; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch new file mode 100644 index 000000000..9a6b0c0ba --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemBow.java ++++ ../src-work/minecraft/net/minecraft/item/ItemBow.java +@@ -23,11 +23,15 @@ + + public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityPlayer playerIn, int timeLeft) + { ++ int j = this.getMaxItemUseDuration(stack) - timeLeft; ++ net.minecraftforge.event.entity.player.ArrowLooseEvent event = new net.minecraftforge.event.entity.player.ArrowLooseEvent(playerIn, stack, j); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; ++ j = event.charge; ++ + boolean flag = playerIn.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0; + + if (flag || playerIn.inventory.hasItem(Items.arrow)) + { +- int j = this.getMaxItemUseDuration(stack) - timeLeft; + float f = (float)j / 20.0F; + f = (f * f + f * 2.0F) / 3.0F; + +@@ -105,6 +109,9 @@ + + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { ++ net.minecraftforge.event.entity.player.ArrowNockEvent event = new net.minecraftforge.event.entity.player.ArrowNockEvent(playerIn, itemStackIn); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return event.result; ++ + if (playerIn.capabilities.isCreativeMode || playerIn.inventory.hasItem(Items.arrow)) + { + playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn)); diff --git a/patches/minecraft/net/minecraft/item/ItemBucket.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch similarity index 54% rename from patches/minecraft/net/minecraft/item/ItemBucket.java.patch rename to patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch index e8ae79af8..23bf6daf0 100644 --- a/patches/minecraft/net/minecraft/item/ItemBucket.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch @@ -4,9 +4,9 @@ } else { -+ ItemStack ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(p_77659_3_, p_77659_2_, p_77659_1_, movingobjectposition); ++ ItemStack ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(playerIn, worldIn, itemStackIn, movingobjectposition); + if (ret != null) return ret; + - if (movingobjectposition.field_72313_a == MovingObjectPosition.MovingObjectType.BLOCK) + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - BlockPos blockpos = movingobjectposition.func_178782_a(); + BlockPos blockpos = movingobjectposition.getBlockPos(); diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBucketMilk.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBucketMilk.java.patch new file mode 100644 index 000000000..0e6f3935e --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemBucketMilk.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemBucketMilk.java ++++ ../src-work/minecraft/net/minecraft/item/ItemBucketMilk.java +@@ -25,7 +25,7 @@ + + if (!worldIn.isRemote) + { +- playerIn.clearActivePotions(); ++ playerIn.curePotionEffects(stack); + } + + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemDye.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemDye.java.patch new file mode 100644 index 000000000..4ae5b8110 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemDye.java.patch @@ -0,0 +1,56 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemDye.java ++++ ../src-work/minecraft/net/minecraft/item/ItemDye.java +@@ -48,7 +48,7 @@ + + if (enumdyecolor == EnumDyeColor.WHITE) + { +- if (applyBonemeal(stack, worldIn, pos)) ++ if (applyBonemeal(stack, worldIn, pos, playerIn)) + { + if (!worldIn.isRemote) + { +@@ -98,8 +98,18 @@ + + public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target) + { ++ if (worldIn instanceof net.minecraft.world.WorldServer) ++ return applyBonemeal(stack, worldIn, target, net.minecraftforge.common.util.FakePlayerFactory.getMinecraft((net.minecraft.world.WorldServer)worldIn)); ++ return false; ++ } ++ ++ public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target, EntityPlayer player) ++ { + IBlockState iblockstate = worldIn.getBlockState(target); + ++ int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, worldIn, target, iblockstate, stack); ++ if (hook != 0) return hook > 0; ++ + if (iblockstate.getBlock() instanceof IGrowable) + { + IGrowable igrowable = (IGrowable)iblockstate.getBlock(); +@@ -133,7 +143,7 @@ + + Block block = worldIn.getBlockState(pos).getBlock(); + +- if (block.getMaterial() != Material.air) ++ if (block.isAir(worldIn, pos)) + { + block.setBlockBoundsBasedOnState(worldIn, pos); + +@@ -145,6 +155,16 @@ + worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)pos.getX() + itemRand.nextFloat()), (double)pos.getY() + (double)itemRand.nextFloat() * block.getBlockBoundsMaxY(), (double)((float)pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]); + } + } ++ else ++ { ++ for (int i1 = 0; i1 < amount; ++i1) ++ { ++ double d0 = itemRand.nextGaussian() * 0.02D; ++ double d1 = itemRand.nextGaussian() * 0.02D; ++ double d2 = itemRand.nextGaussian() * 0.02D; ++ worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)pos.getX() + itemRand.nextFloat()), (double)pos.getY() + (double)itemRand.nextFloat() * 1.0f, (double)((float)pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]); ++ } ++ } + } + + public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target) diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch new file mode 100644 index 000000000..2e0696c64 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemEmptyMap.java ++++ ../src-work/minecraft/net/minecraft/item/ItemEmptyMap.java +@@ -24,7 +24,7 @@ + worldIn.setItemData(s, mapdata); + mapdata.scale = 0; + mapdata.func_176054_a(playerIn.posX, playerIn.posZ, mapdata.scale); +- mapdata.dimension = (byte)worldIn.provider.getDimensionId(); ++ mapdata.dimension = worldIn.provider.getDimensionId(); + mapdata.markDirty(); + --itemStackIn.stackSize; + diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch new file mode 100644 index 000000000..92d47f90b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemFlintAndSteel.java ++++ ../src-work/minecraft/net/minecraft/item/ItemFlintAndSteel.java +@@ -29,7 +29,7 @@ + } + else + { +- if (worldIn.getBlockState(pos).getBlock().getMaterial() == Material.air) ++ if (worldIn.isAirBlock(pos)) + { + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); + worldIn.setBlockState(pos, Blocks.fire.getDefaultState()); diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch new file mode 100644 index 000000000..28920005f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemHoe.java ++++ ../src-work/minecraft/net/minecraft/item/ItemHoe.java +@@ -34,10 +34,13 @@ + } + else + { ++ int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(stack, playerIn, worldIn, pos); ++ if (hook != 0) return hook > 0; ++ + IBlockState iblockstate = worldIn.getBlockState(pos); + Block block = iblockstate.getBlock(); + +- if (side != EnumFacing.DOWN && worldIn.getBlockState(pos.up()).getBlock().getMaterial() == Material.air) ++ if (side != EnumFacing.DOWN && worldIn.isAirBlock(pos.up())) + { + if (block == Blocks.grass) + { diff --git a/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch similarity index 50% rename from patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch rename to patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch index efc47a1a0..6251c9d0f 100644 --- a/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch @@ -2,16 +2,16 @@ +++ ../src-work/minecraft/net/minecraft/item/ItemLilyPad.java @@ -51,7 +51,14 @@ - if (iblockstate.func_177230_c().func_149688_o() == Material.field_151586_h && ((Integer)iblockstate.func_177229_b(BlockLiquid.field_176367_b)).intValue() == 0 && p_77659_2_.func_175623_d(blockpos1)) + if (iblockstate.getBlock().getMaterial() == Material.water && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.isAirBlock(blockpos1)) { + // special case for handling block placement with water lilies -+ net.minecraftforge.common.util.BlockSnapshot blocksnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(p_77659_2_, blockpos1); - p_77659_2_.func_175656_a(blockpos1, Blocks.field_150392_bi.func_176223_P()); -+ if (net.minecraftforge.event.ForgeEventFactory.onPlayerBlockPlace(p_77659_3_, blocksnapshot, net.minecraft.util.EnumFacing.UP).isCanceled()) ++ net.minecraftforge.common.util.BlockSnapshot blocksnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(worldIn, blockpos1); + worldIn.setBlockState(blockpos1, Blocks.waterlily.getDefaultState()); ++ if (net.minecraftforge.event.ForgeEventFactory.onPlayerBlockPlace(playerIn, blocksnapshot, net.minecraft.util.EnumFacing.UP).isCanceled()) + { + blocksnapshot.restore(true, false); -+ return p_77659_1_; ++ return itemStackIn; + } - if (!p_77659_3_.field_71075_bZ.field_75098_d) + if (!playerIn.capabilities.isCreativeMode) { diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch new file mode 100644 index 000000000..0281e3d97 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemMap.java ++++ ../src-work/minecraft/net/minecraft/item/ItemMap.java +@@ -58,7 +58,7 @@ + mapdata = new MapData(s); + mapdata.scale = 3; + mapdata.func_176054_a((double)worldIn.getWorldInfo().getSpawnX(), (double)worldIn.getWorldInfo().getSpawnZ(), mapdata.scale); +- mapdata.dimension = (byte)worldIn.provider.getDimensionId(); ++ mapdata.dimension = worldIn.provider.getDimensionId(); + mapdata.markDirty(); + worldIn.setItemData(s, mapdata); + } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch new file mode 100644 index 000000000..40b28e9c6 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch @@ -0,0 +1,107 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemMonsterPlacer.java ++++ ../src-work/minecraft/net/minecraft/item/ItemMonsterPlacer.java +@@ -39,7 +39,7 @@ + public String getItemStackDisplayName(ItemStack stack) + { + String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim(); +- String s1 = EntityList.getStringFromID(stack.getMetadata()); ++ String s1 = ItemMonsterPlacer.getEntityName(stack); + + if (s1 != null) + { +@@ -52,7 +52,7 @@ + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack stack, int renderPass) + { +- EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(stack.getMetadata())); ++ EntityList.EntityEggInfo entityegginfo = ItemMonsterPlacer.getEggInfo(stack); + return entityegginfo != null ? (renderPass == 0 ? entityegginfo.primaryColor : entityegginfo.secondaryColor) : 16777215; + } + +@@ -77,7 +77,7 @@ + if (tileentity instanceof TileEntityMobSpawner) + { + MobSpawnerBaseLogic mobspawnerbaselogic = ((TileEntityMobSpawner)tileentity).getSpawnerBaseLogic(); +- mobspawnerbaselogic.setEntityName(EntityList.getStringFromID(stack.getMetadata())); ++ mobspawnerbaselogic.setEntityName(ItemMonsterPlacer.getEntityName(stack)); + tileentity.markDirty(); + worldIn.markBlockForUpdate(pos); + +@@ -98,7 +98,7 @@ + d0 = 0.5D; + } + +- Entity entity = spawnCreature(worldIn, stack.getMetadata(), (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D); ++ Entity entity = spawnCreature(worldIn, ItemMonsterPlacer.getEntityName(stack), (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D); + + if (entity != null) + { +@@ -149,7 +149,7 @@ + + if (worldIn.getBlockState(blockpos).getBlock() instanceof BlockLiquid) + { +- Entity entity = spawnCreature(worldIn, itemStackIn.getMetadata(), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D); ++ Entity entity = spawnCreature(worldIn, ItemMonsterPlacer.getEntityName(itemStackIn), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D); + + if (entity != null) + { +@@ -173,19 +173,29 @@ + } + } + ++ @Deprecated // Use string version below. + public static Entity spawnCreature(World worldIn, int entityID, double x, double y, double z) + { + if (!EntityList.entityEggs.containsKey(Integer.valueOf(entityID))) + { + return null; + } ++ return spawnCreature(worldIn, EntityList.getStringFromID(entityID), x, y, z); ++ } ++ ++ public static Entity spawnCreature(World worldIn, String name, double x, double y, double z) ++ { ++ if (!EntityList.stringToClassMapping.containsKey(name)) ++ { ++ return null; ++ } + else + { + Entity entity = null; + + for (int j = 0; j < 1; ++j) + { +- entity = EntityList.createEntityByID(entityID, worldIn); ++ entity = EntityList.createEntityByName(name, worldIn); + + if (entity instanceof EntityLivingBase) + { +@@ -213,5 +223,28 @@ + EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)iterator.next(); + subItems.add(new ItemStack(itemIn, 1, entityegginfo.spawnedID)); + } ++ ++ for (String name : net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().keySet()) ++ { ++ ItemStack stack = new ItemStack(itemIn); ++ net.minecraft.nbt.NBTTagCompound nbt = new net.minecraft.nbt.NBTTagCompound(); ++ nbt.setString("entity_name", name); ++ stack.setTagCompound(nbt); ++ subItems.add(stack); ++ } + } ++ ++ public static String getEntityName(ItemStack stack) ++ { ++ if (stack.hasTagCompound() && stack.getTagCompound().hasKey("entity_name", 8)) ++ return stack.getTagCompound().getString("entity_name"); ++ return EntityList.getStringFromID(stack.getMetadata()); ++ } ++ ++ private static EntityList.EntityEggInfo getEggInfo(ItemStack stack) ++ { ++ if (stack.hasTagCompound() && stack.getTagCompound().hasKey("entity_name", 8)) ++ return net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(stack.getTagCompound().getString("entity_name")); ++ return (EntityList.EntityEggInfo)EntityList.entityEggs.get(stack.getMetadata()); ++ } + } diff --git a/patches/minecraft/net/minecraft/item/ItemRecord.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemRecord.java.patch similarity index 89% rename from patches/minecraft/net/minecraft/item/ItemRecord.java.patch rename to patches.mcp/minecraft/net/minecraft/item/ItemRecord.java.patch index e36f4fca6..0fce10880 100644 --- a/patches/minecraft/net/minecraft/item/ItemRecord.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemRecord.java.patch @@ -2,7 +2,7 @@ +++ ../src-work/minecraft/net/minecraft/item/ItemRecord.java @@ -75,4 +75,15 @@ { - return (ItemRecord)field_150928_b.get(p_150926_0_); + return (ItemRecord)RECORDS.get(name); } + + /** diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemReed.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemReed.java.patch new file mode 100644 index 000000000..1dfe0385e --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemReed.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemReed.java ++++ ../src-work/minecraft/net/minecraft/item/ItemReed.java +@@ -54,7 +54,7 @@ + + if (iblockstate1.getBlock() == this.block) + { +- ItemBlock.setTileEntityNBT(worldIn, pos, stack); ++ ItemBlock.setTileEntityNBT(worldIn, pos, stack, playerIn); + iblockstate1.getBlock().onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack); + } + diff --git a/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch similarity index 58% rename from patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch rename to patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch index ff7b8fae9..a80f9b920 100644 --- a/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch @@ -7,17 +7,17 @@ -public class ItemSeedFood extends ItemFood +public class ItemSeedFood extends ItemFood implements net.minecraftforge.common.IPlantable { - private Block field_150908_b; - private Block field_82809_c; + private Block crops; + private Block soilId; @@ -29,7 +29,7 @@ { return false; } -- else if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c() == this.field_82809_c && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) -+ else if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().canSustainPlant(p_180614_3_, p_180614_4_, EnumFacing.UP, this) && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) +- else if (worldIn.getBlockState(pos).getBlock() == this.soilId && worldIn.isAirBlock(pos.up())) ++ else if (worldIn.getBlockState(pos).getBlock().canSustainPlant(worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) { - p_180614_3_.func_175656_a(p_180614_4_.func_177984_a(), this.field_150908_b.func_176223_P()); - --p_180614_1_.field_77994_a; + worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); + --stack.stackSize; @@ -40,4 +40,16 @@ return false; } @@ -32,6 +32,6 @@ + @Override + public net.minecraft.block.state.IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) + { -+ return this.field_150908_b.func_176223_P(); ++ return this.crops.getDefaultState(); + } } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch new file mode 100644 index 000000000..ebdd88861 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch @@ -0,0 +1,37 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemSeeds.java ++++ ../src-work/minecraft/net/minecraft/item/ItemSeeds.java +@@ -7,7 +7,7 @@ + import net.minecraft.util.EnumFacing; + import net.minecraft.world.World; + +-public class ItemSeeds extends Item ++public class ItemSeeds extends Item implements net.minecraftforge.common.IPlantable + { + private Block crops; + private Block soilBlockID; +@@ -30,7 +30,7 @@ + { + return false; + } +- else if (worldIn.getBlockState(pos).getBlock() == this.soilBlockID && worldIn.isAirBlock(pos.up())) ++ else if (worldIn.getBlockState(pos).getBlock().canSustainPlant(worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) + { + worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); + --stack.stackSize; +@@ -41,4 +41,16 @@ + return false; + } + } ++ ++ @Override ++ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) ++ { ++ return this.crops == net.minecraft.init.Blocks.nether_wart ? net.minecraftforge.common.EnumPlantType.Nether : net.minecraftforge.common.EnumPlantType.Crop; ++ } ++ ++ @Override ++ public net.minecraft.block.state.IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) ++ { ++ return this.crops.getDefaultState(); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch new file mode 100644 index 000000000..921a20435 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch @@ -0,0 +1,89 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemShears.java ++++ ../src-work/minecraft/net/minecraft/item/ItemShears.java +@@ -21,13 +21,12 @@ + + public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) + { +- if (blockIn.getMaterial() != Material.leaves && blockIn != Blocks.web && blockIn != Blocks.tallgrass && blockIn != Blocks.vine && blockIn != Blocks.tripwire && blockIn != Blocks.wool) ++ if (blockIn.getMaterial() != Material.leaves && blockIn != Blocks.web && blockIn != Blocks.tallgrass && blockIn != Blocks.vine && blockIn != Blocks.tripwire && blockIn != Blocks.wool && !(blockIn instanceof net.minecraftforge.common.IShearable)) + { + return super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn); + } + else + { +- stack.damageItem(1, playerIn); + return true; + } + } +@@ -41,4 +40,71 @@ + { + return block != Blocks.web && block.getMaterial() != Material.leaves ? (block == Blocks.wool ? 5.0F : super.getStrVsBlock(stack, block)) : 15.0F; + } ++ ++ ++ @Override ++ public boolean itemInteractionForEntity(ItemStack itemstack, net.minecraft.entity.player.EntityPlayer player, EntityLivingBase entity) ++ { ++ if (entity.worldObj.isRemote) ++ { ++ return false; ++ } ++ if (entity instanceof net.minecraftforge.common.IShearable) ++ { ++ net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)entity; ++ BlockPos pos = new BlockPos(entity.posX, entity.posY, entity.posZ); ++ if (target.isShearable(itemstack, entity.worldObj, pos)) ++ { ++ java.util.List drops = target.onSheared(itemstack, entity.worldObj, pos, ++ net.minecraft.enchantment.EnchantmentHelper.getEnchantmentLevel(net.minecraft.enchantment.Enchantment.fortune.effectId, itemstack)); ++ ++ java.util.Random rand = new java.util.Random(); ++ for(ItemStack stack : drops) ++ { ++ net.minecraft.entity.item.EntityItem ent = entity.entityDropItem(stack, 1.0F); ++ ent.motionY += rand.nextFloat() * 0.05F; ++ ent.motionX += (rand.nextFloat() - rand.nextFloat()) * 0.1F; ++ ent.motionZ += (rand.nextFloat() - rand.nextFloat()) * 0.1F; ++ } ++ itemstack.damageItem(1, entity); ++ } ++ return true; ++ } ++ return false; ++ } ++ ++ @Override ++ public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, net.minecraft.entity.player.EntityPlayer player) ++ { ++ if (player.worldObj.isRemote || player.capabilities.isCreativeMode) ++ { ++ return false; ++ } ++ Block block = player.worldObj.getBlockState(pos).getBlock(); ++ if (block instanceof net.minecraftforge.common.IShearable) ++ { ++ net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)block; ++ if (target.isShearable(itemstack, player.worldObj, pos)) ++ { ++ java.util.List drops = target.onSheared(itemstack, player.worldObj, pos, ++ net.minecraft.enchantment.EnchantmentHelper.getEnchantmentLevel(net.minecraft.enchantment.Enchantment.fortune.effectId, itemstack)); ++ java.util.Random rand = new java.util.Random(); ++ ++ for(ItemStack stack : drops) ++ { ++ float f = 0.7F; ++ double d = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; ++ double d1 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; ++ double d2 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; ++ net.minecraft.entity.item.EntityItem entityitem = new net.minecraft.entity.item.EntityItem(player.worldObj, (double)pos.getX() + d, (double)pos.getY() + d1, (double)pos.getZ() + d2, stack); ++ entityitem.setDefaultPickupDelay(); ++ player.worldObj.spawnEntityInWorld(entityitem); ++ } ++ ++ itemstack.damageItem(1, player); ++ player.addStat(net.minecraft.stats.StatList.mineBlockStatArray[Block.getIdFromBlock(block)], 1); ++ } ++ } ++ return false; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSign.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSign.java.patch new file mode 100644 index 000000000..592003138 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemSign.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemSign.java ++++ ../src-work/minecraft/net/minecraft/item/ItemSign.java +@@ -63,7 +63,7 @@ + --stack.stackSize; + TileEntity tileentity = worldIn.getTileEntity(pos); + +- if (tileentity instanceof TileEntitySign && !ItemBlock.setTileEntityNBT(worldIn, pos, stack)) ++ if (tileentity instanceof TileEntitySign && !ItemBlock.setTileEntityNBT(worldIn, pos, stack, playerIn)) + { + playerIn.openEditSign((TileEntitySign)tileentity); + } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch new file mode 100644 index 000000000..9c1921c95 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemSkull.java ++++ ../src-work/minecraft/net/minecraft/item/ItemSkull.java +@@ -35,6 +35,11 @@ + + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { ++ if (worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && side != EnumFacing.DOWN) ++ { ++ side = EnumFacing.UP; ++ pos = pos.down(); ++ } + if (side == EnumFacing.DOWN) + { + return false; +@@ -47,7 +52,7 @@ + + if (!flag) + { +- if (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid()) ++ if (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid() && !worldIn.isSideSolid(pos, side, true)) + { + return false; + } +@@ -67,6 +72,7 @@ + { + if (!worldIn.isRemote) + { ++ if (!Blocks.skull.canPlaceBlockOnSide(worldIn, pos, side)) return false; + worldIn.setBlockState(pos, Blocks.skull.getDefaultState().withProperty(BlockSkull.FACING, side), 3); + int i = 0; + diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSnow.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSnow.java.patch new file mode 100644 index 000000000..b7bb49b2e --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemSnow.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemSnow.java ++++ ../src-work/minecraft/net/minecraft/item/ItemSnow.java +@@ -66,4 +66,10 @@ + { + return damage; + } ++ ++ public boolean canPlaceBlockOnSide(World world, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) ++ { ++ IBlockState state = world.getBlockState(pos); ++ return (state.getBlock() != net.minecraft.init.Blocks.snow_layer || ((Integer)state.getValue(BlockSnow.LAYERS)) > 7) ? super.canPlaceBlockOnSide(world, pos, side, player, stack) : true; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch new file mode 100644 index 000000000..0909d6238 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch @@ -0,0 +1,149 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemStack.java ++++ ../src-work/minecraft/net/minecraft/item/ItemStack.java +@@ -52,6 +52,7 @@ + private boolean canPlaceOnCacheResult; + private static final String __OBFID = "CL_00000043"; + ++ private net.minecraftforge.fml.common.registry.RegistryDelegate delegate; + public ItemStack(Block blockIn) + { + this(blockIn, 1); +@@ -83,7 +84,7 @@ + this.canDestroyCacheResult = false; + this.canPlaceOnCacheBlock = null; + this.canPlaceOnCacheResult = false; +- this.item = itemIn; ++ this.setItem(itemIn); + this.stackSize = amount; + this.itemDamage = meta; + +@@ -123,11 +124,12 @@ + + public Item getItem() + { +- return this.item; ++ return this.delegate != null ? this.delegate.get() : null; + } + + public boolean onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { ++ if (!worldIn.isRemote) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ); + boolean flag = this.getItem().onItemUse(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ); + + if (flag) +@@ -172,11 +174,11 @@ + { + if (nbt.hasKey("id", 8)) + { +- this.item = Item.getByNameOrId(nbt.getString("id")); ++ this.setItem(Item.getByNameOrId(nbt.getString("id"))); + } + else + { +- this.item = Item.getItemById(nbt.getShort("id")); ++ this.setItem(Item.getItemById(nbt.getShort("id"))); + } + + this.stackSize = nbt.getByte("Count"); +@@ -200,7 +202,7 @@ + + public int getMaxStackSize() + { +- return this.getItem().getItemStackLimit(); ++ return this.getItem().getItemStackLimit(this); + } + + public boolean isStackable() +@@ -210,7 +212,7 @@ + + public boolean isItemStackDamageable() + { +- return this.item == null ? false : (this.item.getMaxDamage() <= 0 ? false : !this.hasTagCompound() || !this.getTagCompound().getBoolean("Unbreakable")); ++ return this.item == null ? false : (this.item.getMaxDamage(this) <= 0 ? false : !this.hasTagCompound() || !this.getTagCompound().getBoolean("Unbreakable")); + } + + public boolean getHasSubtypes() +@@ -220,32 +222,27 @@ + + public boolean isItemDamaged() + { +- return this.isItemStackDamageable() && this.itemDamage > 0; ++ return this.isItemStackDamageable() && getItem().isDamaged(this); + } + + public int getItemDamage() + { +- return this.itemDamage; ++ return getItem().getDamage(this); + } + + public int getMetadata() + { +- return this.itemDamage; ++ return getItem().getMetadata(this); + } + + public void setItemDamage(int meta) + { +- this.itemDamage = meta; +- +- if (this.itemDamage < 0) +- { +- this.itemDamage = 0; +- } ++ getItem().setDamage(this, meta); + } + + public int getMaxDamage() + { +- return this.item.getMaxDamage(); ++ return this.item.getMaxDamage(this); + } + + public boolean attemptDamageItem(int amount, Random rand) +@@ -277,8 +274,8 @@ + } + } + +- this.itemDamage += amount; +- return this.itemDamage > this.getMaxDamage(); ++ setItemDamage(getItemDamage() + amount); //Redirect through Item's callback if applicable. ++ return getItemDamage() > getMaxDamage(); + } + } + +@@ -337,7 +334,7 @@ + + public boolean canHarvestBlock(Block blockIn) + { +- return this.item.canHarvestBlock(blockIn); ++ return getItem().canHarvestBlock(blockIn, this); + } + + public boolean interactWithEntity(EntityPlayer playerIn, EntityLivingBase entityIn) +@@ -752,6 +749,8 @@ + } + } + ++ net.minecraftforge.event.ForgeEventFactory.onItemTooltip(this, playerIn, arraylist, advanced); ++ + return arraylist; + } + +@@ -862,7 +861,7 @@ + } + else + { +- object = this.getItem().getItemAttributeModifiers(); ++ object = this.getItem().getAttributeModifiers(this); + } + + return (Multimap)object; +@@ -870,6 +869,7 @@ + + public void setItem(Item newItem) + { ++ this.delegate = newItem != null ? newItem.delegate : null; + this.item = newItem; + } + diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSword.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSword.java.patch new file mode 100644 index 000000000..2305fb8d6 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/ItemSword.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemSword.java ++++ ../src-work/minecraft/net/minecraft/item/ItemSword.java +@@ -102,7 +102,9 @@ + + public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) + { +- return this.material.getRepairItem() == repair.getItem() ? true : super.getIsRepairable(toRepair, repair); ++ ItemStack mat = this.material.getRepairItemStack(); ++ if (mat != null && net.minecraftforge.oredict.OreDictionary.itemMatches(mat, repair, false)) return true; ++ return super.getIsRepairable(toRepair, repair); + } + + public Multimap getItemAttributeModifiers() diff --git a/patches/minecraft/net/minecraft/item/ItemTool.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch similarity index 60% rename from patches/minecraft/net/minecraft/item/ItemTool.java.patch rename to patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch index 802da522a..366612546 100644 --- a/patches/minecraft/net/minecraft/item/ItemTool.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch @@ -1,9 +1,9 @@ --- ../src-base/minecraft/net/minecraft/item/ItemTool.java +++ ../src-work/minecraft/net/minecraft/item/ItemTool.java @@ -29,6 +29,18 @@ - this.field_77864_a = p_i45333_2_.func_77998_b(); - this.field_77865_bY = p_i45333_1_ + p_i45333_2_.func_78000_c(); - this.func_77637_a(CreativeTabs.field_78040_i); + this.efficiencyOnProperMaterial = material.getEfficiencyOnProperMaterial(); + this.damageVsEntity = attackDamage + material.getDamageVsEntity(); + this.setCreativeTab(CreativeTabs.tabTools); + if (this instanceof ItemPickaxe) + { + toolClass = "pickaxe"; @@ -18,20 +18,20 @@ + } } - public float func_150893_a(ItemStack p_150893_1_, Block p_150893_2_) + public float getStrVsBlock(ItemStack stack, Block block) @@ -75,7 +87,9 @@ - public boolean func_82789_a(ItemStack p_82789_1_, ItemStack p_82789_2_) + public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { -- return this.field_77862_b.func_150995_f() == p_82789_2_.func_77973_b() ? true : super.func_82789_a(p_82789_1_, p_82789_2_); -+ ItemStack mat = this.field_77862_b.getRepairItemStack(); -+ if (mat != null && net.minecraftforge.oredict.OreDictionary.itemMatches(mat, p_82789_2_, false)) return true; -+ return super.func_82789_a(p_82789_1_, p_82789_2_); +- return this.toolMaterial.getRepairItem() == repair.getItem() ? true : super.getIsRepairable(toRepair, repair); ++ ItemStack mat = this.toolMaterial.getRepairItemStack(); ++ if (mat != null && net.minecraftforge.oredict.OreDictionary.itemMatches(mat, repair, false)) return true; ++ return super.getIsRepairable(toRepair, repair); } - public Multimap func_111205_h() + public Multimap getItemAttributeModifiers() @@ -84,4 +98,38 @@ - multimap.put(SharedMonsterAttributes.field_111264_e.func_111108_a(), new AttributeModifier(field_111210_e, "Tool modifier", (double)this.field_77865_bY, 0)); + multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(itemModifierUUID, "Tool modifier", (double)this.damageVsEntity, 0)); return multimap; } + @@ -43,7 +43,7 @@ + int level = super.getHarvestLevel(stack, toolClass); + if (level == -1 && toolClass != null && toolClass.equals(this.toolClass)) + { -+ return this.field_77862_b.func_77996_d(); ++ return this.toolMaterial.getHarvestLevel(); + } + else + { @@ -62,8 +62,8 @@ + { + for (String type : getToolClasses(stack)) + { -+ if (state.func_177230_c().isToolEffective(type, state)) -+ return field_77864_a; ++ if (state.getBlock().isToolEffective(type, state)) ++ return efficiencyOnProperMaterial; + } + return super.getDigSpeed(stack, state); + } diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch new file mode 100644 index 000000000..935002f5f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java +@@ -78,6 +78,7 @@ + + public void addSmeltingRecipe(ItemStack input, ItemStack stack, float experience) + { ++ if (getSmeltingResult(input) != null) { net.minecraftforge.fml.common.FMLLog.info("Ignored smelting recipe with conflicting input: " + input + " = " + stack); return; } + this.smeltingList.put(input, stack); + this.experienceList.put(stack, Float.valueOf(experience)); + } +@@ -113,6 +114,9 @@ + + public float getSmeltingExperience(ItemStack stack) + { ++ float ret = stack.getItem().getSmeltingExperience(stack); ++ if (ret != -1) return ret; ++ + Iterator iterator = this.experienceList.entrySet().iterator(); + Entry entry; + diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch similarity index 53% rename from patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch rename to patches.mcp/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch index aa829dcaf..f87e64fd1 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch @@ -2,7 +2,7 @@ +++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeFireworks.java @@ -90,9 +90,9 @@ { - this.field_92102_a = new ItemStack(Items.field_151152_bP); + this.field_92102_a = new ItemStack(Items.fireworks); + nbttagcompound = new NBTTagCompound(); if (l > 0) @@ -12,23 +12,23 @@ NBTTagList nbttaglist = new NBTTagList(); @@ -109,8 +109,8 @@ - nbttagcompound1.func_74782_a("Explosions", nbttaglist); - nbttagcompound1.func_74774_a("Flight", (byte)j); - nbttagcompound.func_74782_a("Fireworks", nbttagcompound1); -- this.field_92102_a.func_77982_d(nbttagcompound); + nbttagcompound1.setTag("Explosions", nbttaglist); + nbttagcompound1.setByte("Flight", (byte)j); + nbttagcompound.setTag("Fireworks", nbttagcompound1); +- this.field_92102_a.setTagCompound(nbttagcompound); } -+ this.field_92102_a.func_77982_d(nbttagcompound); //Forge BugFix: NPE Protection ++ this.field_92102_a.setTagCompound(nbttagcompound); //Forge BugFix: NPE Protection return true; } @@ -253,11 +253,7 @@ for (int i = 0; i < aitemstack.length; ++i) { - ItemStack itemstack = p_179532_1_.func_70301_a(i); + ItemStack itemstack = p_179532_1_.getStackInSlot(i); - -- if (itemstack != null && itemstack.func_77973_b().func_77634_r()) +- if (itemstack != null && itemstack.getItem().hasContainerItem()) - { -- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); - } + aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); } diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch new file mode 100644 index 000000000..0eb9dbffe --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch @@ -0,0 +1,42 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java +@@ -27,7 +27,7 @@ + { + ItemStack itemstack1 = (ItemStack)arraylist.get(0); + +- if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isDamageable()) ++ if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isRepairable()) + { + return false; + } +@@ -55,7 +55,7 @@ + { + ItemStack itemstack1 = (ItemStack)arraylist.get(0); + +- if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isDamageable()) ++ if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isRepairable()) + { + return null; + } +@@ -68,7 +68,7 @@ + ItemStack itemstack2 = (ItemStack)arraylist.get(0); + itemstack = (ItemStack)arraylist.get(1); + +- if (itemstack2.getItem() == itemstack.getItem() && itemstack2.stackSize == 1 && itemstack.stackSize == 1 && itemstack2.getItem().isDamageable()) ++ if (itemstack2.getItem() == itemstack.getItem() && itemstack2.stackSize == 1 && itemstack.stackSize == 1 && itemstack2.getItem().isRepairable()) + { + Item item = itemstack2.getItem(); + int j = item.getMaxDamage() - itemstack2.getItemDamage(); +@@ -105,11 +105,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = p_179532_1_.getStackInSlot(i); +- +- if (itemstack != null && itemstack.getItem().hasContainerItem()) +- { +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); +- } ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + + return aitemstack; diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch similarity index 63% rename from patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch rename to patches.mcp/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch index 4a45ed51b..261c45a79 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch @@ -3,11 +3,11 @@ @@ -153,11 +153,7 @@ for (int i = 0; i < aitemstack.length; ++i) { - ItemStack itemstack = p_179532_1_.func_70301_a(i); + ItemStack itemstack = p_179532_1_.getStackInSlot(i); - -- if (itemstack != null && itemstack.func_77973_b().func_77634_r()) +- if (itemstack != null && itemstack.getItem().hasContainerItem()) - { -- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); - } + aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); } diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch similarity index 63% rename from patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch rename to patches.mcp/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch index 55cf592f5..04640835d 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch @@ -3,11 +3,11 @@ @@ -143,11 +143,7 @@ for (int i = 0; i < aitemstack.length; ++i) { - ItemStack itemstack = p_179532_1_.func_70301_a(i); + ItemStack itemstack = p_179532_1_.getStackInSlot(i); - -- if (itemstack != null && itemstack.func_77973_b().func_77634_r()) +- if (itemstack != null && itemstack.getItem().hasContainerItem()) - { -- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); - } + aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); } @@ -17,11 +17,11 @@ if (itemstack != null) { -- if (itemstack.func_77973_b().func_77634_r()) -+ if (itemstack.func_77973_b().hasContainerItem(itemstack)) +- if (itemstack.getItem().hasContainerItem()) ++ if (itemstack.getItem().hasContainerItem(itemstack)) { -- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); + aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); } - else if (itemstack.func_77942_o() && TileEntityBanner.func_175113_c(itemstack) > 0) + else if (itemstack.hasTagCompound() && TileEntityBanner.getPatterns(itemstack) > 0) { diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch similarity index 63% rename from patches/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch rename to patches.mcp/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch index 7a60d54d0..5ad702f77 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch @@ -3,11 +3,11 @@ @@ -110,11 +110,7 @@ for (int i = 0; i < aitemstack.length; ++i) { - ItemStack itemstack = p_179532_1_.func_70301_a(i); + ItemStack itemstack = p_179532_1_.getStackInSlot(i); - -- if (itemstack != null && itemstack.func_77973_b().func_77634_r()) +- if (itemstack != null && itemstack.getItem().hasContainerItem()) - { -- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); - } + aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); } diff --git a/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch similarity index 63% rename from patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch rename to patches.mcp/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch index 719da837b..02c3e7f16 100644 --- a/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch @@ -3,11 +3,11 @@ @@ -34,11 +34,7 @@ for (int i = 0; i < aitemstack.length; ++i) { - ItemStack itemstack = p_179532_1_.func_70301_a(i); + ItemStack itemstack = p_179532_1_.getStackInSlot(i); - -- if (itemstack != null && itemstack.func_77973_b().func_77634_r()) +- if (itemstack != null && itemstack.getItem().hasContainerItem()) - { -- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); - } + aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); } diff --git a/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch similarity index 63% rename from patches/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch rename to patches.mcp/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch index 50228d863..f0670bb96 100644 --- a/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch +++ b/patches.mcp/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch @@ -3,11 +3,11 @@ @@ -32,11 +32,7 @@ for (int i = 0; i < aitemstack.length; ++i) { - ItemStack itemstack = p_179532_1_.func_70301_a(i); + ItemStack itemstack = p_179532_1_.getStackInSlot(i); - -- if (itemstack != null && itemstack.func_77973_b().func_77634_r()) +- if (itemstack != null && itemstack.getItem().hasContainerItem()) - { -- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); - } + aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); } diff --git a/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch similarity index 72% rename from patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch rename to patches.mcp/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch index 3c635043e..6abd19298 100644 --- a/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch +++ b/patches.mcp/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch @@ -14,14 +14,14 @@ } - @SideOnly(Side.CLIENT) - public static void func_74793_a(NBTTagCompound p_74793_0_, File p_74793_1_) throws IOException + public static void safeWrite(NBTTagCompound p_74793_0_, File p_74793_1_) throws IOException { File file2 = new File(p_74793_1_.getAbsolutePath() + "_tmp"); @@ -120,6 +117,7 @@ private static NBTBase func_152455_a(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_.read(8); // Forge: Count everything! if (b0 == 0) { @@ -31,8 +31,8 @@ { - p_152455_0_.readUTF(); + NBTSizeTracker.readUTF(p_152455_2_, p_152455_0_.readUTF()); //Forge: Count this string. -+ p_152455_2_.func_152450_a(32); //Forge: 4 extra bytes for the object allocation. - NBTBase nbtbase = NBTBase.func_150284_a(b0); ++ p_152455_2_.read(32); //Forge: 4 extra bytes for the object allocation. + NBTBase nbtbase = NBTBase.createNewByType(b0); try @@ -146,7 +145,6 @@ @@ -40,7 +40,7 @@ } - @SideOnly(Side.CLIENT) - public static void func_74795_b(NBTTagCompound p_74795_0_, File p_74795_1_) throws IOException + public static void write(NBTTagCompound p_74795_0_, File p_74795_1_) throws IOException { DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(p_74795_1_)); @@ -161,7 +159,6 @@ @@ -48,6 +48,6 @@ } - @SideOnly(Side.CLIENT) - public static NBTTagCompound func_74797_a(File p_74797_0_) throws IOException + public static NBTTagCompound read(File p_74797_0_) throws IOException { if (!p_74797_0_.exists()) diff --git a/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch similarity index 85% rename from patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch rename to patches.mcp/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch index c7720b745..078cb5b16 100644 --- a/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch +++ b/patches.mcp/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/nbt/NBTSizeTracker.java +++ ../src-work/minecraft/net/minecraft/nbt/NBTSizeTracker.java @@ -25,4 +25,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.read + "bytes where max allowed: " + this.max); } } + @@ -18,7 +18,7 @@ + */ + public static void readUTF(NBTSizeTracker tracker, String data) + { -+ tracker.func_152450_a(16); //Header length ++ tracker.read(16); //Header length + if (data == null) + return; + @@ -32,6 +32,6 @@ + else if (c > 0x07FF) utflen += 3; + else utflen += 2; + } -+ tracker.func_152450_a(8 * utflen); ++ tracker.read(8 * utflen); + } } diff --git a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagByteArray.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagByteArray.java.patch new file mode 100644 index 000000000..924246163 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagByteArray.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/nbt/NBTTagByteArray.java ++++ ../src-work/minecraft/net/minecraft/nbt/NBTTagByteArray.java +@@ -25,6 +25,7 @@ + + void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException + { ++ sizeTracker.read(32); //Forge: Count the length as well + int j = input.readInt(); + sizeTracker.read((long)(8 * j)); + this.data = new byte[j]; diff --git a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch new file mode 100644 index 000000000..e4bc0da41 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch @@ -0,0 +1,27 @@ +--- ../src-base/minecraft/net/minecraft/nbt/NBTTagCompound.java ++++ ../src-work/minecraft/net/minecraft/nbt/NBTTagCompound.java +@@ -48,7 +48,7 @@ + while ((b0 = readType(input, sizeTracker)) != 0) + { + String s = readKey(input, sizeTracker); +- sizeTracker.read((long)(16 * s.length())); ++ NBTSizeTracker.readUTF(sizeTracker, s); // Forge: Correctly read String length including header. + NBTBase nbtbase = readNBT(b0, s, input, depth + 1, sizeTracker); + this.tagMap.put(s, nbtbase); + } +@@ -396,6 +396,7 @@ + + private static byte readType(DataInput input, NBTSizeTracker sizeTracker) throws IOException + { ++ sizeTracker.read(8); + return input.readByte(); + } + +@@ -406,6 +407,7 @@ + + static NBTBase readNBT(byte id, String key, DataInput input, int depth, NBTSizeTracker sizeTracker) + { ++ sizeTracker.read(32); //Forge: 4 extra bytes for the object allocation. + NBTBase nbtbase = NBTBase.createNewByType(id); + + try diff --git a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagIntArray.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagIntArray.java.patch new file mode 100644 index 000000000..4248de8b0 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagIntArray.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/nbt/NBTTagIntArray.java ++++ ../src-work/minecraft/net/minecraft/nbt/NBTTagIntArray.java +@@ -29,6 +29,7 @@ + + void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException + { ++ sizeTracker.read(32); //Forge: Count the length as well + int j = input.readInt(); + sizeTracker.read((long)(32 * j)); + this.intArray = new int[j]; diff --git a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagList.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagList.java.patch new file mode 100644 index 000000000..b3272419a --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagList.java.patch @@ -0,0 +1,16 @@ +--- ../src-base/minecraft/net/minecraft/nbt/NBTTagList.java ++++ ../src-work/minecraft/net/minecraft/nbt/NBTTagList.java +@@ -46,11 +46,13 @@ + { + sizeTracker.read(8L); + this.tagType = input.readByte(); ++ sizeTracker.read(32); //Forge: Count the length as well + int j = input.readInt(); + this.tagList = Lists.newArrayList(); + + for (int k = 0; k < j; ++k) + { ++ sizeTracker.read(32); //Forge: 4 extra bytes for the object allocation. + NBTBase nbtbase = NBTBase.createNewByType(this.tagType); + nbtbase.read(input, depth + 1, sizeTracker); + this.tagList.add(nbtbase); diff --git a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagString.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagString.java.patch new file mode 100644 index 000000000..491b667f2 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagString.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/nbt/NBTTagString.java ++++ ../src-work/minecraft/net/minecraft/nbt/NBTTagString.java +@@ -32,7 +32,7 @@ + void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException + { + this.data = input.readUTF(); +- sizeTracker.read((long)(16 * this.data.length())); ++ NBTSizeTracker.readUTF(sizeTracker, data); // Forge: Correctly read String length including header. + } + + public byte getId() diff --git a/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch b/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch new file mode 100644 index 000000000..744329a52 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch @@ -0,0 +1,166 @@ +--- ../src-base/minecraft/net/minecraft/network/NetHandlerPlayServer.java ++++ ../src-work/minecraft/net/minecraft/network/NetHandlerPlayServer.java +@@ -93,6 +93,14 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + ++import net.minecraftforge.common.ForgeHooks; ++import net.minecraftforge.common.MinecraftForge; ++import net.minecraftforge.fml.common.eventhandler.Event; ++import net.minecraftforge.event.ForgeEventFactory; ++import net.minecraftforge.event.ServerChatEvent; ++import net.minecraftforge.event.entity.player.PlayerInteractEvent; ++import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; ++ + public class NetHandlerPlayServer implements INetHandlerPlayServer, IUpdatePlayerListBox + { + private static final Logger logger = LogManager.getLogger(); +@@ -246,6 +254,8 @@ + this.playerEntity.ridingEntity.updateRiderPosition(); + } + ++ if (!this.hasMoved) return; //Fixes teleportation kick while riding entities ++ + this.serverController.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); + + if (this.playerEntity.ridingEntity != null) +@@ -324,9 +334,10 @@ + double d11 = d8 - this.playerEntity.posX; + double d12 = d9 - this.playerEntity.posY; + double d13 = d10 - this.playerEntity.posZ; +- double d14 = Math.min(Math.abs(d11), Math.abs(this.playerEntity.motionX)); +- double d15 = Math.min(Math.abs(d12), Math.abs(this.playerEntity.motionY)); +- double d16 = Math.min(Math.abs(d13), Math.abs(this.playerEntity.motionZ)); ++ //BUGFIX: min -> max, grabs the highest distance ++ double d14 = Math.max(Math.abs(d11), Math.abs(this.playerEntity.motionX)); ++ double d15 = Math.max(Math.abs(d12), Math.abs(this.playerEntity.motionY)); ++ double d16 = Math.max(Math.abs(d13), Math.abs(this.playerEntity.motionZ)); + double d17 = d14 * d14 + d15 * d15 + d16 * d16; + + if (d17 > 100.0D && (!this.serverController.isSinglePlayer() || !this.serverController.getServerOwner().equals(this.playerEntity.getName()))) +@@ -344,6 +355,8 @@ + this.playerEntity.jump(); + } + ++ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving ++ + this.playerEntity.moveEntity(d11, d12, d13); + this.playerEntity.onGround = packetIn.isOnGround(); + double d18 = d12; +@@ -365,6 +378,8 @@ + logger.warn(this.playerEntity.getName() + " moved wrongly!"); + } + ++ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving ++ + this.playerEntity.setPositionAndRotation(d8, d9, d10, f1, f2); + this.playerEntity.addMovementStat(this.playerEntity.posX - d0, this.playerEntity.posY - d1, this.playerEntity.posZ - d2); + +@@ -372,7 +387,7 @@ + { + boolean flag2 = worldserver.getCollidingBoundingBoxes(this.playerEntity, this.playerEntity.getEntityBoundingBox().contract((double)f3, (double)f3, (double)f3)).isEmpty(); + +- if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping()) ++ if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping() && !this.playerEntity.noClip) + { + this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, f1, f2); + return; +@@ -400,6 +415,8 @@ + this.floatingTickCount = 0; + } + ++ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving ++ + this.playerEntity.onGround = packetIn.isOnGround(); + this.serverController.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); + this.playerEntity.handleFalling(this.playerEntity.posY - d7, packetIn.isOnGround()); +@@ -489,7 +506,10 @@ + double d2 = this.playerEntity.posZ - ((double)blockpos.getZ() + 0.5D); + double d3 = d0 * d0 + d1 * d1 + d2 * d2; + +- if (d3 > 36.0D) ++ double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 1; ++ dist *= dist; ++ ++ if (d3 > dist) + { + return; + } +@@ -540,6 +560,7 @@ + WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); + ItemStack itemstack = this.playerEntity.inventory.getCurrentItem(); + boolean flag = false; ++ boolean placeResult = true; + BlockPos blockpos = packetIn.getPosition(); + EnumFacing enumfacing = EnumFacing.getFront(packetIn.getPlacedBlockDirection()); + this.playerEntity.markPlayerActive(); +@@ -551,7 +572,11 @@ + return; + } + ++ PlayerInteractEvent event = ForgeEventFactory.onPlayerInteract(playerEntity, PlayerInteractEvent.Action.RIGHT_CLICK_AIR, worldserver, new BlockPos(0, 0, 0), null); ++ if (event.useItem != Event.Result.DENY) ++ { + this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, worldserver, itemstack); ++ } + } + else if (blockpos.getY() >= this.serverController.getBuildLimit() - 1 && (enumfacing == EnumFacing.UP || blockpos.getY() >= this.serverController.getBuildLimit())) + { +@@ -562,9 +587,12 @@ + } + else + { +- if (this.hasMoved && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < 64.0D && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) ++ double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 1; ++ dist *= dist; ++ if (this.hasMoved && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < dist && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) + { +- this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, blockpos, enumfacing, packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ()); ++ // record block place result so we can update client itemstack size if place event was cancelled. ++ placeResult = this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, blockpos, enumfacing, packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ()); + } + + flag = true; +@@ -592,7 +620,7 @@ + this.playerEntity.openContainer.detectAndSendChanges(); + this.playerEntity.isChangingQuantityOnly = false; + +- if (!ItemStack.areItemStacksEqual(this.playerEntity.inventory.getCurrentItem(), packetIn.getStack())) ++ if (!ItemStack.areItemStacksEqual(this.playerEntity.inventory.getCurrentItem(), packetIn.getStack()) || !placeResult) // force client itemstack update if place event was cancelled + { + this.sendPacket(new S2FPacketSetSlot(this.playerEntity.openContainer.windowId, slot.slotNumber, this.playerEntity.inventory.getCurrentItem())); + } +@@ -764,8 +792,10 @@ + } + else + { +- ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("chat.type.text", new Object[] {this.playerEntity.getDisplayName(), s}); +- this.serverController.getConfigurationManager().sendChatMsgImpl(chatcomponenttranslation1, false); ++ ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("chat.type.text", this.playerEntity.getDisplayName(), ForgeHooks.newChatWithLinks(s)); ++ IChatComponent chat = ForgeHooks.onServerChatEvent(this, s, chatcomponenttranslation1); ++ if (chat == null) return; ++ this.serverController.getConfigurationManager().sendChatMsgImpl(chat, false); + } + + this.chatSpamThresholdCount += 20; +@@ -907,7 +937,7 @@ + return; + } + +- this.playerEntity = this.serverController.getConfigurationManager().recreatePlayerEntity(this.playerEntity, 0, false); ++ this.playerEntity = this.serverController.getConfigurationManager().recreatePlayerEntity(this.playerEntity, playerEntity.dimension, false); + } + + break; +@@ -1080,7 +1110,10 @@ + return; + } + +- System.arraycopy(packetIn.getLines(), 0, tileentitysign.signText, 0, 4); ++ IChatComponent[] lines = packetIn.getLines(); //Forge: Prevent client from directly sending commands ++ for (int x = 0; x < tileentitysign.signText.length && x < lines.length; x++) ++ tileentitysign.signText[x] = new ChatComponentText(net.minecraft.util.EnumChatFormatting.getTextWithoutFormattingCodes(lines[x].getUnformattedText())); ++ + tileentitysign.markDirty(); + worldserver.markBlockForUpdate(blockpos); + } diff --git a/patches/minecraft/net/minecraft/network/NetworkManager.java.patch b/patches.mcp/minecraft/net/minecraft/network/NetworkManager.java.patch similarity index 58% rename from patches/minecraft/net/minecraft/network/NetworkManager.java.patch rename to patches.mcp/minecraft/net/minecraft/network/NetworkManager.java.patch index b37433cda..d59871ee0 100644 --- a/patches/minecraft/net/minecraft/network/NetworkManager.java.patch +++ b/patches.mcp/minecraft/net/minecraft/network/NetworkManager.java.patch @@ -1,43 +1,43 @@ --- ../src-base/minecraft/net/minecraft/network/NetworkManager.java +++ ../src-work/minecraft/net/minecraft/network/NetworkManager.java @@ -88,6 +88,11 @@ - this.field_179294_g = p_i46004_1_; + this.direction = packetDirection; } + public EnumPacketDirection getDirection() + { -+ return this.field_179294_g; ++ return this.direction; + } + public void channelActive(ChannelHandlerContext p_channelActive_1_) throws Exception { super.channelActive(p_channelActive_1_); @@ -175,7 +180,7 @@ - final EnumConnectionState enumconnectionstate = EnumConnectionState.func_150752_a(p_150732_1_); - final EnumConnectionState enumconnectionstate1 = (EnumConnectionState)this.field_150746_k.attr(field_150739_c).get(); + final EnumConnectionState enumconnectionstate = EnumConnectionState.getFromPacket(inPacket); + final EnumConnectionState enumconnectionstate1 = (EnumConnectionState)this.channel.attr(attrKeyConnectionState).get(); - if (enumconnectionstate1 != enumconnectionstate) -+ if (enumconnectionstate1 != enumconnectionstate && !( p_150732_1_ instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) ++ if (enumconnectionstate1 != enumconnectionstate && !( inPacket instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) { - field_150735_g.debug("Disabled auto read"); - this.field_150746_k.config().setAutoRead(false); + logger.debug("Disabled auto read"); + this.channel.config().setAutoRead(false); @@ -183,7 +188,7 @@ - if (this.field_150746_k.eventLoop().inEventLoop()) + if (this.channel.eventLoop().inEventLoop()) { - if (enumconnectionstate != enumconnectionstate1) -+ if (enumconnectionstate != enumconnectionstate1 && !( p_150732_1_ instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) ++ if (enumconnectionstate != enumconnectionstate1 && !( inPacket instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) { - this.func_150723_a(enumconnectionstate); + this.setConnectionState(enumconnectionstate); } @@ -204,7 +209,7 @@ private static final String __OBFID = "CL_00001243"; public void run() { - if (enumconnectionstate != enumconnectionstate1) -+ if (enumconnectionstate != enumconnectionstate1 && !( p_150732_1_ instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) ++ if (enumconnectionstate != enumconnectionstate1 && !( inPacket instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) { - NetworkManager.this.func_150723_a(enumconnectionstate); + NetworkManager.this.setConnectionState(enumconnectionstate); } @@ -409,6 +414,11 @@ this.channelRead0(p_channelRead0_1_, (Packet)p_channelRead0_2_); @@ -45,9 +45,9 @@ + public Channel channel() + { -+ return field_150746_k; ++ return channel; + } + static class InboundHandlerTuplePacketListener { - private final Packet field_150774_a; + private final Packet packet; diff --git a/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch b/patches.mcp/minecraft/net/minecraft/network/NetworkSystem.java.patch similarity index 94% rename from patches/minecraft/net/minecraft/network/NetworkSystem.java.patch rename to patches.mcp/minecraft/net/minecraft/network/NetworkSystem.java.patch index 9452bc6bc..71fdc4309 100644 --- a/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch +++ b/patches.mcp/minecraft/net/minecraft/network/NetworkSystem.java.patch @@ -7,5 +7,5 @@ - p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new PingResponseHandler(NetworkSystem.this)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer(EnumPacketDirection.SERVERBOUND)).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer(EnumPacketDirection.CLIENTBOUND)); + p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.READ_TIMEOUT)).addLast("legacy_query", new PingResponseHandler(NetworkSystem.this)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer(EnumPacketDirection.SERVERBOUND)).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer(EnumPacketDirection.CLIENTBOUND)); NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND); - NetworkSystem.this.field_151272_f.add(networkmanager); + NetworkSystem.this.networkManagers.add(networkmanager); p_initChannel_1_.pipeline().addLast("packet_handler", networkmanager); diff --git a/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch b/patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch similarity index 74% rename from patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch rename to patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch index 2407b09f5..b7c9b8cab 100644 --- a/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch +++ b/patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch @@ -1,37 +1,37 @@ --- ../src-base/minecraft/net/minecraft/network/ServerStatusResponse.java +++ ../src-work/minecraft/net/minecraft/network/ServerStatusResponse.java @@ -29,6 +29,7 @@ - public void func_151315_a(IChatComponent p_151315_1_) + public void setServerDescription(IChatComponent motd) { - this.field_151326_a = p_151315_1_; + this.serverMotd = motd; + invalidateJson(); } - public ServerStatusResponse.PlayerCountData func_151318_b() + public ServerStatusResponse.PlayerCountData getPlayerCountData() @@ -39,6 +40,7 @@ - public void func_151319_a(ServerStatusResponse.PlayerCountData p_151319_1_) + public void setPlayerCountData(ServerStatusResponse.PlayerCountData countData) { - this.field_151324_b = p_151319_1_; + this.playerCount = countData; + invalidateJson(); } - public ServerStatusResponse.MinecraftProtocolVersionIdentifier func_151322_c() + public ServerStatusResponse.MinecraftProtocolVersionIdentifier getProtocolVersionInfo() @@ -49,11 +51,13 @@ - public void func_151321_a(ServerStatusResponse.MinecraftProtocolVersionIdentifier p_151321_1_) + public void setProtocolVersionInfo(ServerStatusResponse.MinecraftProtocolVersionIdentifier protocolVersionData) { - this.field_151325_c = p_151321_1_; + this.protocolVersion = protocolVersionData; + invalidateJson(); } - public void func_151320_a(String p_151320_1_) + public void setFavicon(String faviconBlob) { - this.field_151323_d = p_151320_1_; + this.favicon = faviconBlob; + invalidateJson(); } - public String func_151316_d() + public String getFavicon() @@ -233,6 +237,7 @@ - serverstatusresponse.func_151320_a(JsonUtils.func_151200_h(jsonobject, "favicon")); + serverstatusresponse.setFavicon(JsonUtils.getJsonObjectStringFieldValue(jsonobject, "favicon")); } + net.minecraftforge.fml.client.FMLClientHandler.instance().captureAdditionalData(serverstatusresponse, jsonobject); @@ -39,7 +39,7 @@ } @@ -260,6 +265,7 @@ - jsonobject.addProperty("favicon", p_serialize_1_.func_151316_d()); + jsonobject.addProperty("favicon", p_serialize_1_.getFavicon()); } + net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.enhanceStatusQuery(jsonobject); @@ -73,7 +73,7 @@ + ret = this.json; + if (ret == null) + { -+ ret = net.minecraft.network.status.server.S00PacketServerInfo.field_149297_a.toJson(this); ++ ret = net.minecraft.network.status.server.S00PacketServerInfo.GSON.toJson(this); + this.json = ret; + } + mutex.release(); diff --git a/patches.mcp/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch b/patches.mcp/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch new file mode 100644 index 000000000..d52c5fb63 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch @@ -0,0 +1,48 @@ +--- ../src-base/minecraft/net/minecraft/network/handshake/client/C00Handshake.java ++++ ../src-work/minecraft/net/minecraft/network/handshake/client/C00Handshake.java +@@ -16,6 +16,7 @@ + private int port; + private EnumConnectionState requestedState; + private static final String __OBFID = "CL_00001372"; ++ private boolean hasFMLMarker = false; + + public C00Handshake() {} + +@@ -28,18 +29,26 @@ + this.requestedState = requestedState; + } + ++ public C00Handshake(int protocol, String address, int port, EnumConnectionState state, boolean addFMLMarker) ++ { ++ this(protocol, address, port, state); ++ this.hasFMLMarker = addFMLMarker; ++ } ++ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.protocolVersion = buf.readVarIntFromBuffer(); + this.ip = buf.readStringFromBuffer(255); + this.port = buf.readUnsignedShort(); + this.requestedState = EnumConnectionState.getById(buf.readVarIntFromBuffer()); ++ this.hasFMLMarker = this.ip.contains("\0FML\0"); ++ this.ip = this.ip.split("\0")[0]; + } + + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.protocolVersion); +- buf.writeString(this.ip); ++ buf.writeString(this.ip + "\0FML\0"); + buf.writeShort(this.port); + buf.writeVarIntToBuffer(this.requestedState.getId()); + } +@@ -63,4 +72,9 @@ + { + this.handle((INetHandlerHandshakeServer)handler); + } ++ ++ public boolean hasFMLMarker() ++ { ++ return this.hasFMLMarker; ++ } + } diff --git a/patches/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch b/patches.mcp/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch similarity index 59% rename from patches/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch rename to patches.mcp/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch index a10efa861..a0a015760 100644 --- a/patches/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch +++ b/patches.mcp/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch @@ -4,8 +4,8 @@ for (int i = 0; i < 4; ++i) { -- this.field_149590_d[i] = p_148837_1_.func_179258_d(); -+ this.field_149590_d[i] = IChatComponent.Serializer.func_150699_a(p_148837_1_.func_150789_c(384)); +- this.lines[i] = buf.readChatComponent(); ++ this.lines[i] = IChatComponent.Serializer.jsonToComponent(buf.readStringFromBuffer(384)); } } diff --git a/patches.mcp/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch b/patches.mcp/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch new file mode 100644 index 000000000..331306c78 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java ++++ ../src-work/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java +@@ -47,7 +47,11 @@ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeString(this.channel); ++ synchronized(this.data) { //This may be access multiple times, from multiple threads, lets be safe. ++ this.data.markReaderIndex(); + buf.writeBytes((ByteBuf)this.data); ++ this.data.resetReaderIndex(); ++ } + } + + public void processPacket(INetHandlerPlayServer handler) diff --git a/patches.mcp/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch b/patches.mcp/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch new file mode 100644 index 000000000..af5d3f67d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java ++++ ../src-work/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java +@@ -46,7 +46,11 @@ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeString(this.channel); ++ synchronized(this.data) { //This may be access multiple times, from multiple threads, lets be safe. ++ this.data.markReaderIndex(); + buf.writeBytes((ByteBuf)this.data); ++ this.data.resetReaderIndex(); ++ } + } + + public void process(INetHandlerPlayClient p_180734_1_) diff --git a/patches.mcp/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch b/patches.mcp/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch new file mode 100644 index 000000000..dcb18e144 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java ++++ ../src-work/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java +@@ -34,7 +34,7 @@ + + public void writePacketData(PacketBuffer buf) throws IOException + { +- buf.writeString(GSON.toJson(this.response)); ++ buf.writeString(this.response.getJson()); + } + + public void processPacket(INetHandlerStatusClient handler) diff --git a/patches/minecraft/net/minecraft/potion/Potion.java.patch b/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch similarity index 93% rename from patches/minecraft/net/minecraft/potion/Potion.java.patch rename to patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch index 5892ca8c8..915b67091 100644 --- a/patches/minecraft/net/minecraft/potion/Potion.java.patch +++ b/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch @@ -2,7 +2,7 @@ +++ ../src-work/minecraft/net/minecraft/potion/Potion.java @@ -330,4 +330,27 @@ { - return p_111183_2_.func_111164_d() * (double)(p_111183_1_ + 1); + return p_111183_2_.getAmount() * (double)(p_111183_1_ + 1); } + + /* ======================================== FORGE START =====================================*/ diff --git a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch b/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch similarity index 70% rename from patches/minecraft/net/minecraft/potion/PotionEffect.java.patch rename to patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch index e23ad06dc..ea0070e75 100644 --- a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch +++ b/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch @@ -1,43 +1,43 @@ --- ../src-base/minecraft/net/minecraft/potion/PotionEffect.java +++ ../src-work/minecraft/net/minecraft/potion/PotionEffect.java @@ -19,6 +19,8 @@ - private boolean field_100013_f; - private boolean field_180156_h; + private boolean isPotionDurationMax; + private boolean showParticles; private static final String __OBFID = "CL_00001529"; + /** List of ItemStack that can cure the potion effect **/ + private java.util.List curativeItems; - public PotionEffect(int p_i1574_1_, int p_i1574_2_) + public PotionEffect(int id, int effectDuration) { @@ -37,6 +39,8 @@ - this.field_76461_c = p_i45896_3_; - this.field_82724_e = p_i45896_4_; - this.field_180156_h = p_i45896_5_; + this.amplifier = effectAmplifier; + this.isAmbient = ambient; + this.showParticles = showParticles; + this.curativeItems = new java.util.ArrayList(); -+ this.curativeItems.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.field_151117_aB)); ++ this.curativeItems.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.milk_bucket)); } - public PotionEffect(PotionEffect p_i1577_1_) + public PotionEffect(PotionEffect other) @@ -46,6 +50,7 @@ - this.field_76461_c = p_i1577_1_.field_76461_c; - this.field_82724_e = p_i1577_1_.field_82724_e; - this.field_180156_h = p_i1577_1_.field_180156_h; -+ this.curativeItems = p_i1577_1_.curativeItems; + this.amplifier = other.amplifier; + this.isAmbient = other.isAmbient; + this.showParticles = other.showParticles; ++ this.curativeItems = other.curativeItems; } - public void func_76452_a(PotionEffect p_76452_1_) + public void combine(PotionEffect other) @@ -191,7 +196,7 @@ - public static PotionEffect func_82722_b(NBTTagCompound p_82722_0_) + public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt) { -- byte b0 = p_82722_0_.func_74771_c("Id"); -+ int b0 = p_82722_0_.func_74771_c("Id") & 0xff; +- byte b0 = nbt.getByte("Id"); ++ int b0 = nbt.getByte("Id") & 0xff; - if (b0 >= 0 && b0 < Potion.field_76425_a.length && Potion.field_76425_a[b0] != null) + if (b0 >= 0 && b0 < Potion.potionTypes.length && Potion.potionTypes[b0] != null) { @@ -224,4 +229,62 @@ { - return this.field_100013_f; + return this.isPotionDurationMax; } + + /* ======================================== FORGE START =====================================*/ @@ -60,7 +60,7 @@ + boolean found = false; + for (net.minecraft.item.ItemStack curativeItem : this.curativeItems) + { -+ if (curativeItem.func_77969_a(stack)) ++ if (curativeItem.isItemEqual(stack)) + { + found = true; + } @@ -87,7 +87,7 @@ + boolean found = false; + for (net.minecraft.item.ItemStack curativeItem : this.curativeItems) + { -+ if (curativeItem.func_77969_a(stack)) ++ if (curativeItem.isItemEqual(stack)) + { + found = true; + } diff --git a/patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch b/patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch similarity index 67% rename from patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch rename to patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch index 0e3324da7..e6eb9ca74 100644 --- a/patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch +++ b/patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch @@ -12,8 +12,8 @@ return; } -- RealmsConnect.this.connection.func_179290_a(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN)); -+ RealmsConnect.this.connection.func_179290_a(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN, true)); +- RealmsConnect.this.connection.sendPacket(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN)); ++ RealmsConnect.this.connection.sendPacket(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN, true)); if (RealmsConnect.this.aborted) { diff --git a/patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch new file mode 100644 index 000000000..c9905ed3a --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -0,0 +1,306 @@ +--- ../src-base/minecraft/net/minecraft/server/MinecraftServer.java ++++ ../src-work/minecraft/net/minecraft/server/MinecraftServer.java +@@ -99,7 +99,7 @@ + @SideOnly(Side.SERVER) + private String hostname; + private int serverPort = -1; +- public WorldServer[] worldServers; ++ public WorldServer[] worldServers = new WorldServer[0]; + private ServerConfigurationManager serverConfigManager; + private boolean serverRunning = true; + private boolean serverStopped; +@@ -116,7 +116,8 @@ + private int buildLimit; + private int maxPlayerIdleMinutes = 0; + public final long[] tickTimeArray = new long[100]; +- public long[][] timeOfLastDimensionTick; ++ //public long[][] timeOfLastDimensionTick; ++ public java.util.Hashtable worldTickTimes = new java.util.Hashtable(); + private KeyPair serverKeyPair; + private String serverOwner; + private String folderName; +@@ -222,8 +223,6 @@ + { + this.convertMapIfNeeded(p_71247_1_); + this.setUserMessage("menu.loadingLevel"); +- this.worldServers = new WorldServer[3]; +- this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; + ISaveHandler isavehandler = this.anvilConverterForAnvilFile.getSaveLoader(p_71247_1_, true); + this.setResourcePackFromWorld(this.getFolderName(), isavehandler); + WorldInfo worldinfo = isavehandler.loadWorldInfo(); +@@ -254,47 +253,21 @@ + worldsettings = new WorldSettings(worldinfo); + } + +- for (int j = 0; j < this.worldServers.length; ++j) ++ WorldServer overWorld = (WorldServer)(isDemo() ? new DemoWorldServer(this, isavehandler, worldinfo, 0, theProfiler).init() : new WorldServer(this, isavehandler, worldinfo, 0, theProfiler).init()); ++ overWorld.initialize(worldsettings); ++ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) + { +- byte b0 = 0; ++ WorldServer world = (dim == 0 ? overWorld : (WorldServer)new WorldServerMulti(this, isavehandler, dim, overWorld, theProfiler).init()); ++ world.addWorldAccess(new WorldManager(this, world)); + +- if (j == 1) +- { +- b0 = -1; +- } +- +- if (j == 2) +- { +- b0 = 1; +- } +- +- if (j == 0) +- { +- if (this.isDemo()) +- { +- this.worldServers[j] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, b0, this.theProfiler)).init(); +- } +- else +- { +- this.worldServers[j] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, b0, this.theProfiler)).init(); +- } +- +- this.worldServers[j].initialize(worldsettings); +- } +- else +- { +- this.worldServers[j] = (WorldServer)(new WorldServerMulti(this, isavehandler, b0, this.worldServers[0], this.theProfiler)).init(); +- } +- +- this.worldServers[j].addWorldAccess(new WorldManager(this, this.worldServers[j])); +- + if (!this.isSinglePlayer()) + { +- this.worldServers[j].getWorldInfo().setGameType(this.getGameType()); ++ world.getWorldInfo().setGameType(this.getGameType()); + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); + } + +- this.serverConfigManager.setPlayerManager(this.worldServers); ++ this.serverConfigManager.setPlayerManager(new WorldServer[]{ overWorld }); + this.setDifficultyForAllWorlds(this.getDifficulty()); + this.initialWorldChunkLoad(); + } +@@ -309,7 +282,7 @@ + this.setUserMessage("menu.generatingTerrain"); + byte b0 = 0; + logger.info("Preparing start region for level " + b0); +- WorldServer worldserver = this.worldServers[b0]; ++ WorldServer worldserver = net.minecraftforge.common.DimensionManager.getWorld(b0); + BlockPos blockpos = worldserver.getSpawnPoint(); + long j = getCurrentTimeMillis(); + +@@ -371,6 +344,7 @@ + if (!this.worldIsBeingDeleted) + { + WorldServer[] aworldserver = this.worldServers; ++ if (aworldserver == null) return; //Forge: Just in case, NPE protection as it has been encountered. + int i = aworldserver.length; + + for (int j = 0; j < i; ++j) +@@ -399,7 +373,7 @@ + + public void stopServer() + { +- if (!this.worldIsBeingDeleted) ++ if (!this.worldIsBeingDeleted && net.minecraftforge.fml.common.Loader.instance().hasReachedState(net.minecraftforge.fml.common.LoaderState.SERVER_STARTED) && !serverStopped) // make sure the save is valid and we don't save twice + { + logger.info("Stopping server"); + +@@ -423,8 +397,15 @@ + for (int i = 0; i < this.worldServers.length; ++i) + { + WorldServer worldserver = this.worldServers[i]; ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); + worldserver.flush(); + } ++ ++ WorldServer[] tmp = worldServers; ++ for (WorldServer world : tmp) ++ { ++ net.minecraftforge.common.DimensionManager.setWorld(world.provider.getDimensionId(), null); ++ } + } + + if (this.usageSnooper.isSnooperRunning()) +@@ -456,6 +437,7 @@ + { + if (this.startServer()) + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarted(); + this.currentTime = getCurrentTimeMillis(); + long i = 0L; + this.statusResponse.setServerDescription(new ChatComponentText(this.motd)); +@@ -500,12 +482,20 @@ + Thread.sleep(Math.max(1L, 50L - i)); + this.serverIsRunning = true; + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStopping(); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions + } + else + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions + this.finalTick((CrashReport)null); + } + } ++ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) ++ { ++ // ignore silently ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions ++ } + catch (Throwable throwable1) + { + logger.error("Encountered an unexpected exception", throwable1); +@@ -531,6 +521,7 @@ + logger.error("We were unable to save this crash report to disk."); + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions + this.finalTick(crashreport); + } + finally +@@ -546,6 +537,8 @@ + } + finally + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStopped(); ++ this.serverStopped = true; + this.systemExitNow(); + } + } +@@ -591,6 +584,7 @@ + public void tick() + { + long i = System.nanoTime(); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreServerTick(); + ++this.tickCounter; + + if (this.startProfiling) +@@ -617,6 +611,7 @@ + + Collections.shuffle(Arrays.asList(agameprofile)); + this.statusResponse.getPlayerCountData().setPlayers(agameprofile); ++ this.statusResponse.invalidateJson(); + } + + if (this.tickCounter % 900 == 0) +@@ -644,6 +639,7 @@ + + this.theProfiler.endSection(); + this.theProfiler.endSection(); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostServerTick(); + } + + public void updateTimeLightAndEntities() +@@ -657,7 +653,7 @@ + { + try + { +- ((FutureTask)this.futureTaskQueue.poll()).run(); ++ net.minecraftforge.fml.common.FMLCommonHandler.callFuture(((FutureTask)this.futureTaskQueue.poll())); + } + catch (Throwable throwable2) + { +@@ -667,15 +663,18 @@ + } + + this.theProfiler.endStartSection("levels"); ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.tick(); + int j; + +- for (j = 0; j < this.worldServers.length; ++j) ++ Integer[] ids = net.minecraftforge.common.DimensionManager.getIDs(this.tickCounter % 200 == 0); ++ for (int x = 0; x < ids.length; x++) + { ++ int id = ids[x]; + long i = System.nanoTime(); + +- if (j == 0 || this.getAllowNether()) ++ if (id == 0 || this.getAllowNether()) + { +- WorldServer worldserver = this.worldServers[j]; ++ WorldServer worldserver = net.minecraftforge.common.DimensionManager.getWorld(id); + this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName()); + + if (this.tickCounter % 20 == 0) +@@ -686,6 +685,7 @@ + } + + this.theProfiler.startSection("tick"); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreWorldTick(worldserver); + CrashReport crashreport; + + try +@@ -710,6 +710,7 @@ + throw new ReportedException(crashreport); + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostWorldTick(worldserver); + this.theProfiler.endSection(); + this.theProfiler.startSection("tracker"); + worldserver.getEntityTracker().updateTrackedEntities(); +@@ -717,9 +718,11 @@ + this.theProfiler.endSection(); + } + +- this.timeOfLastDimensionTick[j][this.tickCounter % 100] = System.nanoTime() - i; ++ worldTickTimes.get(id)[this.tickCounter % 100] = System.nanoTime() - i; + } + ++ this.theProfiler.endStartSection("dim_unloading"); ++ net.minecraftforge.common.DimensionManager.unloadWorlds(worldTickTimes); + this.theProfiler.endStartSection("connection"); + this.getNetworkSystem().networkTick(); + this.theProfiler.endStartSection("players"); +@@ -741,6 +744,7 @@ + + public void startServerThread() + { ++ net.minecraftforge.fml.common.StartupQuery.reset(); + this.serverThread = new Thread(this, "Server thread"); + this.serverThread.start(); + } +@@ -757,7 +761,13 @@ + + public WorldServer worldServerForDimension(int dimension) + { +- return dimension == -1 ? this.worldServers[1] : (dimension == 1 ? this.worldServers[2] : this.worldServers[0]); ++ WorldServer ret = net.minecraftforge.common.DimensionManager.getWorld(dimension); ++ if (ret == null) ++ { ++ net.minecraftforge.common.DimensionManager.initDimension(dimension); ++ ret = net.minecraftforge.common.DimensionManager.getWorld(dimension); ++ } ++ return ret; + } + + public String getMinecraftVersion() +@@ -787,7 +797,7 @@ + + public String getServerModName() + { +- return "vanilla"; ++ return net.minecraftforge.fml.common.FMLCommonHandler.instance().getModName(); + } + + public CrashReport addServerInfoToCrashReport(CrashReport report) +@@ -1008,6 +1018,7 @@ + + if (worldserver != null) + { ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); + worldserver.flush(); + } + } +@@ -1590,7 +1601,6 @@ + this.serverPort = port; + } + +- @SideOnly(Side.SERVER) + public boolean isServerStopped() + { + return this.serverStopped; diff --git a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch similarity index 50% rename from patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch rename to patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch index 1af800c17..ea7edb2a8 100644 --- a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -1,37 +1,37 @@ --- ../src-base/minecraft/net/minecraft/server/dedicated/DedicatedServer.java +++ ../src-work/minecraft/net/minecraft/server/dedicated/DedicatedServer.java @@ -49,6 +49,7 @@ - private boolean field_71338_p; - private WorldSettings.GameType field_71337_q; - private boolean field_71335_s; + private boolean canSpawnStructures; + private WorldSettings.GameType gameType; + private boolean guiIsEnabled; + public static boolean allowPlayerLogins = false; private static final String __OBFID = "CL_00001784"; - public DedicatedServer(File p_i1508_1_) + public DedicatedServer(File workDir) @@ -113,6 +114,8 @@ - field_155771_h.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); + logger.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); } + net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStart(this); + - field_155771_h.info("Loading properties"); - this.field_71340_o = new PropertyManager(new File("server.properties")); - this.field_154332_n = new ServerEula(new File("eula.txt")); + logger.info("Loading properties"); + this.settings = new PropertyManager(new File("server.properties")); + this.eula = new ServerEula(new File("eula.txt")); @@ -204,6 +207,7 @@ } else { + net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStarted(); - this.func_152361_a(new DedicatedPlayerList(this)); + this.setConfigManager(new DedicatedPlayerList(this)); long j = System.nanoTime(); @@ -250,6 +254,7 @@ - this.func_71191_d((this.func_71207_Z() + 8) / 16 * 16); - this.func_71191_d(MathHelper.func_76125_a(this.func_71207_Z(), 64, 256)); - this.field_71340_o.func_73667_a("max-build-height", Integer.valueOf(this.func_71207_Z())); + this.setBuildLimit((this.getBuildLimit() + 8) / 16 * 16); + this.setBuildLimit(MathHelper.clamp_int(this.getBuildLimit(), 64, 256)); + this.settings.setProperty("max-build-height", Integer.valueOf(this.getBuildLimit())); + if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; - field_155771_h.info("Preparing level \"" + this.func_71270_I() + "\""); - this.func_71247_a(this.func_71270_I(), this.func_71270_I(), k, worldtype, s2); + logger.info("Preparing level \"" + this.getFolderName() + "\""); + this.loadAllWorlds(this.getFolderName(), this.getFolderName(), k, worldtype, s2); long i1 = System.nanoTime() - j; @@ -278,7 +283,7 @@ thread1.start(); diff --git a/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch b/patches.mcp/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch similarity index 93% rename from patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch rename to patches.mcp/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch index 1caa6d7a0..c01217c8d 100644 --- a/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch +++ b/patches.mcp/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch @@ -7,7 +7,7 @@ + minecraftservergui.latch.countDown(); } - public MinecraftServerGui(DedicatedServer p_i2362_1_) + public MinecraftServerGui(DedicatedServer serverIn) @@ -164,8 +165,13 @@ return jpanel; } diff --git a/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch new file mode 100644 index 000000000..113c5ef2c --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch @@ -0,0 +1,97 @@ +--- ../src-base/minecraft/net/minecraft/server/integrated/IntegratedServer.java ++++ ../src-work/minecraft/net/minecraft/server/integrated/IntegratedServer.java +@@ -74,8 +74,6 @@ + protected void loadAllWorlds(String p_71247_1_, String p_71247_2_, long seed, WorldType type, String p_71247_6_) + { + this.convertMapIfNeeded(p_71247_1_); +- this.worldServers = new WorldServer[3]; +- this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; + ISaveHandler isavehandler = this.getActiveAnvilConverter().getSaveLoader(p_71247_1_, true); + this.setResourcePackFromWorld(this.getFolderName(), isavehandler); + WorldInfo worldinfo = isavehandler.loadWorldInfo(); +@@ -88,45 +86,25 @@ + { + worldinfo.setWorldName(p_71247_2_); + } ++ WorldServer overWorld = (isDemo() ? (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init() : ++ (WorldServer)(new WorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init()); ++ overWorld.initialize(this.theWorldSettings); + +- for (int j = 0; j < this.worldServers.length; ++j) ++ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) + { +- byte b0 = 0; + +- if (j == 1) ++ WorldServer world = (dim == 0 ? overWorld : (WorldServer)(new WorldServerMulti(this, isavehandler, dim, overWorld, this.theProfiler)).init()); ++ world.addWorldAccess(new WorldManager(this, world)); ++ if (!this.isSinglePlayer()) + { +- b0 = -1; ++ world.getWorldInfo().setGameType(getGameType()); + } +- +- if (j == 2) +- { +- b0 = 1; +- } +- +- if (j == 0) +- { +- if (this.isDemo()) +- { +- this.worldServers[j] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, b0, this.theProfiler)).init(); +- } +- else +- { +- this.worldServers[j] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, b0, this.theProfiler)).init(); +- } +- +- this.worldServers[j].initialize(this.theWorldSettings); +- } +- else +- { +- this.worldServers[j] = (WorldServer)(new WorldServerMulti(this, isavehandler, b0, this.worldServers[0], this.theProfiler)).init(); +- } +- +- this.worldServers[j].addWorldAccess(new WorldManager(this, this.worldServers[j])); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); + } + +- this.getConfigurationManager().setPlayerManager(this.worldServers); ++ this.getConfigurationManager().setPlayerManager(new WorldServer[]{ overWorld }); + +- if (this.worldServers[0].getWorldInfo().getDifficulty() == null) ++ if (overWorld.getWorldInfo().getDifficulty() == null) + { + this.setDifficultyForAllWorlds(this.mc.gameSettings.difficulty); + } +@@ -144,9 +122,10 @@ + this.setAllowFlight(true); + logger.info("Generating keypair"); + this.setKeyPair(CryptManager.generateKeyPair()); ++ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; + this.loadAllWorlds(this.getFolderName(), this.getWorldName(), this.theWorldSettings.getSeed(), this.theWorldSettings.getTerrainType(), this.theWorldSettings.getWorldName()); + this.setMOTD(this.getServerOwner() + " - " + this.worldServers[0].getWorldInfo().getWorldName()); +- return true; ++ return net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarting(this); + } + + public void tick() +@@ -171,7 +150,7 @@ + { + try + { +- ((FutureTask)this.futureTaskQueue.poll()).run(); ++ net.minecraftforge.fml.common.FMLCommonHandler.callFuture(((FutureTask)this.futureTaskQueue.poll())); + } + catch (Throwable throwable) + { +@@ -232,6 +211,7 @@ + + public EnumDifficulty getDifficulty() + { ++ if (this.mc.theWorld == null) return this.mc.gameSettings.difficulty; // Fix NPE just in case. + return this.mc.theWorld.getWorldInfo().getDifficulty(); + } + diff --git a/patches.mcp/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch b/patches.mcp/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch new file mode 100644 index 000000000..603ffad4c --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch @@ -0,0 +1,257 @@ +--- ../src-base/minecraft/net/minecraft/server/management/ItemInWorldManager.java ++++ ../src-work/minecraft/net/minecraft/server/management/ItemInWorldManager.java +@@ -22,6 +22,8 @@ + + public class ItemInWorldManager + { ++ /** Forge reach distance */ ++ private double blockReachDistance = 5.0d; + public World theWorld; + public EntityPlayerMP thisPlayerMP; + private WorldSettings.GameType gameType; +@@ -137,6 +139,14 @@ + + public void onBlockClicked(BlockPos pos, EnumFacing side) + { ++ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thisPlayerMP, ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, theWorld, pos, side); ++ if (event.isCanceled()) ++ { ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ return; ++ } ++ + if (this.isCreative()) + { + if (!this.theWorld.extinguishFire((EntityPlayer)null, pos, side)) +@@ -171,18 +181,35 @@ + } + } + +- this.theWorld.extinguishFire((EntityPlayer)null, pos, side); ++ // + this.initialDamage = this.curblockDamage; + float f = 1.0F; + +- if (block.getMaterial() != Material.air) ++ if (!block.isAir(theWorld, pos)) + { +- block.onBlockClicked(this.theWorld, pos, this.thisPlayerMP); ++ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ { ++ block.onBlockClicked(this.theWorld, pos, this.thisPlayerMP); ++ this.theWorld.extinguishFire((EntityPlayer)null, pos, side); ++ } ++ else ++ { ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ } + f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos); + } + +- if (block.getMaterial() != Material.air && f >= 1.0F) ++ if (event.useItem == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) + { ++ if (f >= 1.0F) ++ { ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ } ++ return; ++ } ++ ++ if (!block.isAir(theWorld, pos) && f >= 1.0F) ++ { + this.tryHarvestBlock(pos); + } + else +@@ -203,7 +230,7 @@ + int i = this.curblockDamage - this.initialDamage; + Block block = this.theWorld.getBlockState(pos).getBlock(); + +- if (block.getMaterial() != Material.air) ++ if (!block.isAir(theWorld, pos)) + { + float f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos) * (float)(i + 1); + +@@ -232,9 +259,13 @@ + + private boolean removeBlock(BlockPos pos) + { ++ return removeBlock(pos, false); ++ } ++ private boolean removeBlock(BlockPos pos, boolean canHarvest) ++ { + IBlockState iblockstate = this.theWorld.getBlockState(pos); + iblockstate.getBlock().onBlockHarvested(this.theWorld, pos, iblockstate, this.thisPlayerMP); +- boolean flag = this.theWorld.setBlockToAir(pos); ++ boolean flag = iblockstate.getBlock().removedByPlayer(theWorld, pos, thisPlayerMP, canHarvest); + + if (flag) + { +@@ -246,7 +277,8 @@ + + public boolean tryHarvestBlock(BlockPos pos) + { +- if (this.gameType.isCreative() && this.thisPlayerMP.getHeldItem() != null && this.thisPlayerMP.getHeldItem().getItem() instanceof ItemSword) ++ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(theWorld, gameType, thisPlayerMP, pos); ++ if (exp == -1) + { + return false; + } +@@ -255,40 +287,21 @@ + IBlockState iblockstate = this.theWorld.getBlockState(pos); + TileEntity tileentity = this.theWorld.getTileEntity(pos); + +- if (this.gameType.isAdventure()) +- { +- if (this.gameType == WorldSettings.GameType.SPECTATOR) +- { +- return false; +- } ++ ItemStack stack = thisPlayerMP.getCurrentEquippedItem(); ++ if (stack != null && stack.getItem().onBlockStartBreak(stack, pos, thisPlayerMP)) return false; + +- if (!this.thisPlayerMP.isAllowEdit()) +- { +- ItemStack itemstack = this.thisPlayerMP.getCurrentEquippedItem(); +- +- if (itemstack == null) +- { +- return false; +- } +- +- if (!itemstack.canDestroy(iblockstate.getBlock())) +- { +- return false; +- } +- } +- } +- + this.theWorld.playAuxSFXAtEntity(this.thisPlayerMP, 2001, pos, Block.getStateId(iblockstate)); +- boolean flag1 = this.removeBlock(pos); ++ boolean flag1 = false; + + if (this.isCreative()) + { ++ flag1 = this.removeBlock(pos); + this.thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(this.theWorld, pos)); + } + else + { + ItemStack itemstack1 = this.thisPlayerMP.getCurrentEquippedItem(); +- boolean flag = this.thisPlayerMP.canHarvestBlock(iblockstate.getBlock()); ++ boolean flag = iblockstate.getBlock().canHarvestBlock(theWorld, pos, thisPlayerMP); + + if (itemstack1 != null) + { +@@ -300,12 +313,18 @@ + } + } + ++ flag1 = this.removeBlock(pos, flag); + if (flag1 && flag) + { + iblockstate.getBlock().harvestBlock(this.theWorld, this.thisPlayerMP, pos, iblockstate, tileentity); + } + } + ++ // Drop experiance ++ if (!this.isCreative() && flag1 && exp > 0) ++ { ++ iblockstate.getBlock().dropXpOnBlockBreak(theWorld, pos, exp); ++ } + return flag1; + } + } +@@ -343,6 +362,7 @@ + if (itemstack1.stackSize == 0) + { + player.inventory.mainInventory[player.inventory.currentItem] = null; ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, itemstack1); + } + + if (!player.isUsingItem()) +@@ -387,33 +407,51 @@ + } + else + { +- if (!player.isSneaking() || player.getHeldItem() == null) ++ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(player, ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, worldIn, pos, side); ++ if (event.isCanceled()) + { +- IBlockState iblockstate = worldIn.getBlockState(pos); +- +- if (iblockstate.getBlock().onBlockActivated(worldIn, pos, iblockstate, player, side, p_180236_6_, p_180236_7_, p_180236_8_)) +- { +- return true; +- } ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ return false; + } + +- if (stack == null) ++ if (stack != null && stack.getItem().onItemUseFirst(stack, player, worldIn, pos, side, p_180236_6_, p_180236_7_, p_180236_8_)) + { +- return false; ++ if (stack.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(thisPlayerMP, stack); ++ return true; + } +- else if (this.isCreative()) ++ ++ IBlockState iblockstate = worldIn.getBlockState(pos); ++ boolean isAir = worldIn.isAirBlock(pos); ++ boolean useBlock = !player.isSneaking() || player.getHeldItem() == null; ++ if (!useBlock) useBlock = player.getHeldItem().getItem().doesSneakBypassUse(worldIn, pos, player); ++ boolean result = false; ++ ++ if (useBlock) + { +- int j = stack.getMetadata(); +- int i = stack.stackSize; +- boolean flag = stack.onItemUse(player, worldIn, pos, side, p_180236_6_, p_180236_7_, p_180236_8_); +- stack.setItemDamage(j); +- stack.stackSize = i; +- return flag; ++ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ { ++ result = iblockstate.getBlock().onBlockActivated(worldIn, pos, iblockstate, player, side, p_180236_6_, p_180236_7_, p_180236_8_); ++ } ++ else ++ { ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ result = event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW; ++ } + } +- else ++ if (stack != null && !result && event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) + { +- return stack.onItemUse(player, worldIn, pos, side, p_180236_6_, p_180236_7_, p_180236_8_); ++ int meta = stack.getMetadata(); ++ int size = stack.stackSize; ++ result = stack.onItemUse(player, worldIn, pos, side, p_180236_6_, p_180236_7_, p_180236_8_); ++ if (isCreative()) ++ { ++ stack.setItemDamage(meta); ++ stack.stackSize = size; ++ } ++ if (stack.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(thisPlayerMP, stack); + } ++ return result; + } + } + +@@ -421,4 +459,13 @@ + { + this.theWorld = serverWorld; + } ++ ++ public double getBlockReachDistance() ++ { ++ return blockReachDistance; ++ } ++ public void setBlockReachDistance(double distance) ++ { ++ blockReachDistance = distance; ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/server/management/PlayerManager.java.patch b/patches.mcp/minecraft/net/minecraft/server/management/PlayerManager.java.patch new file mode 100644 index 000000000..3c08033a0 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/server/management/PlayerManager.java.patch @@ -0,0 +1,224 @@ +--- ../src-base/minecraft/net/minecraft/server/management/PlayerManager.java ++++ ../src-work/minecraft/net/minecraft/server/management/PlayerManager.java +@@ -122,15 +122,24 @@ + int j = (int)p_72683_1_.posZ >> 4; + p_72683_1_.managedPosX = p_72683_1_.posX; + p_72683_1_.managedPosZ = p_72683_1_.posZ; ++ // Load nearby chunks first ++ List chunkList = new ArrayList(); + + for (int k = i - this.playerViewRadius; k <= i + this.playerViewRadius; ++k) + { + for (int l = j - this.playerViewRadius; l <= j + this.playerViewRadius; ++l) + { +- this.getPlayerInstance(k, l, true).addPlayer(p_72683_1_); ++ chunkList.add(new ChunkCoordIntPair(k, l)); + } + } + ++ java.util.Collections.sort(chunkList, new net.minecraftforge.common.util.ChunkCoordComparator(p_72683_1_)); ++ ++ for (ChunkCoordIntPair pair : chunkList) ++ { ++ this.getPlayerInstance(pair.chunkXPos, pair.chunkZPos, true).addPlayer(p_72683_1_); ++ } ++ + this.players.add(p_72683_1_); + this.filterChunkLoadQueue(p_72683_1_); + } +@@ -232,6 +241,7 @@ + int i1 = this.playerViewRadius; + int j1 = i - k; + int k1 = j - l; ++ List chunksToLoad = new ArrayList(); + + if (j1 != 0 || k1 != 0) + { +@@ -241,7 +251,7 @@ + { + if (!this.overlaps(l1, i2, k, l, i1)) + { +- this.getPlayerInstance(l1, i2, true).addPlayer(p_72685_1_); ++ chunksToLoad.add(new ChunkCoordIntPair(l1, i2)); + } + + if (!this.overlaps(l1 - j1, i2 - k1, i, j, i1)) +@@ -259,6 +269,18 @@ + this.filterChunkLoadQueue(p_72685_1_); + p_72685_1_.managedPosX = p_72685_1_.posX; + p_72685_1_.managedPosZ = p_72685_1_.posZ; ++ // send nearest chunks first ++ java.util.Collections.sort(chunksToLoad, new net.minecraftforge.common.util.ChunkCoordComparator(p_72685_1_)); ++ ++ for (ChunkCoordIntPair pair : chunksToLoad) ++ { ++ this.getPlayerInstance(pair.chunkXPos, pair.chunkZPos, true).addPlayer(p_72685_1_); ++ } ++ ++ if (i1 > 1 || i1 < -1 || j1 > 1 || j1 < -1) ++ { ++ java.util.Collections.sort(p_72685_1_.loadedChunks, new net.minecraftforge.common.util.ChunkCoordComparator(p_72685_1_)); ++ } + } + } + } +@@ -334,12 +356,21 @@ + private int numBlocksToUpdate; + private int flagsYAreasToUpdate; + private long previousWorldTime; ++ private final java.util.HashMap players = new java.util.HashMap(); ++ private boolean loaded = false; ++ private Runnable loadedRunnable = new Runnable() ++ { ++ public void run() ++ { ++ PlayerInstance.this.loaded = true; ++ } ++ }; + private static final String __OBFID = "CL_00001435"; + + public PlayerInstance(int p_i1518_2_, int p_i1518_3_) + { + this.chunkCoords = new ChunkCoordIntPair(p_i1518_2_, p_i1518_3_); +- PlayerManager.this.getMinecraftServer().theChunkProviderServer.loadChunk(p_i1518_2_, p_i1518_3_); ++ PlayerManager.this.getMinecraftServer().theChunkProviderServer.loadChunk(p_i1518_2_, p_i1518_3_, this.loadedRunnable); + } + + public void addPlayer(EntityPlayerMP p_73255_1_) +@@ -356,7 +387,24 @@ + } + + this.playersWatchingChunk.add(p_73255_1_); ++ Runnable playerRunnable = null; ++ if (this.loaded) ++ { + p_73255_1_.loadedChunks.add(this.chunkCoords); ++ } ++ else ++ { ++ final EntityPlayerMP tmp = p_73255_1_; ++ playerRunnable = new Runnable() ++ { ++ public void run() ++ { ++ tmp.loadedChunks.add(PlayerInstance.this.chunkCoords); ++ } ++ }; ++ PlayerManager.this.getMinecraftServer().theChunkProviderServer.loadChunk(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, playerRunnable); ++ } ++ this.players.put(p_73255_1_, playerRunnable); + } + } + +@@ -364,6 +412,24 @@ + { + if (this.playersWatchingChunk.contains(p_73252_1_)) + { ++ // If we haven't loaded yet don't load the chunk just so we can clean it up ++ if (!this.loaded) ++ { ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.getMinecraftServer(), this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, this.players.get(p_73252_1_)); ++ this.playersWatchingChunk.remove(p_73252_1_); ++ this.players.remove(p_73252_1_); ++ ++ if (this.playersWatchingChunk.isEmpty()) ++ { ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.getMinecraftServer(), this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, this.loadedRunnable); ++ long i = (long) this.chunkCoords.chunkXPos + 2147483647L | (long) this.chunkCoords.chunkZPos + 2147483647L << 32; ++ PlayerManager.this.playerInstances.remove(i); ++ PlayerManager.this.playerInstanceList.remove(this); ++ } ++ ++ return; ++ } ++ + Chunk chunk = PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos); + + if (chunk.isPopulated()) +@@ -371,9 +437,12 @@ + p_73252_1_.playerNetServerHandler.sendPacket(new S21PacketChunkData(chunk, true, 0)); + } + ++ this.players.remove(p_73252_1_); + this.playersWatchingChunk.remove(p_73252_1_); + p_73252_1_.loadedChunks.remove(this.chunkCoords); + ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.UnWatch(chunkCoords, p_73252_1_)); ++ + if (this.playersWatchingChunk.isEmpty()) + { + long i = (long)this.chunkCoords.chunkXPos + 2147483647L | (long)this.chunkCoords.chunkZPos + 2147483647L << 32; +@@ -411,7 +480,7 @@ + + this.flagsYAreasToUpdate |= 1 << (p_151253_2_ >> 4); + +- if (this.numBlocksToUpdate < 64) ++ //Forge; Cache everything, so always run + { + short short1 = (short)(p_151253_1_ << 12 | p_151253_3_ << 8 | p_151253_2_); + +@@ -423,6 +492,10 @@ + } + } + ++ if (numBlocksToUpdate == locationOfBlockChange.length) ++ { ++ locationOfBlockChange = java.util.Arrays.copyOf(locationOfBlockChange, locationOfBlockChange.length << 1); ++ } + this.locationOfBlockChange[this.numBlocksToUpdate++] = short1; + } + } +@@ -440,6 +513,7 @@ + } + } + ++ @SuppressWarnings("unused") + public void onUpdate() + { + if (this.numBlocksToUpdate != 0) +@@ -456,7 +530,7 @@ + BlockPos blockpos = new BlockPos(i, j, k); + this.sendToAllPlayersWatchingChunk(new S23PacketBlockChange(PlayerManager.this.theWorldServer, blockpos)); + +- if (PlayerManager.this.theWorldServer.getBlockState(blockpos).getBlock().hasTileEntity()) ++ if (PlayerManager.this.theWorldServer.getBlockState(blockpos).getBlock().hasTileEntity(PlayerManager.this.theWorldServer.getBlockState(blockpos))) + { + this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos)); + } +@@ -465,13 +539,14 @@ + { + int i1; + +- if (this.numBlocksToUpdate == 64) ++ if (this.numBlocksToUpdate >= net.minecraftforge.common.ForgeModContainer.clumpingThreshold) + { + i = this.chunkCoords.chunkXPos * 16; + j = this.chunkCoords.chunkZPos * 16; + this.sendToAllPlayersWatchingChunk(new S21PacketChunkData(PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos), false, this.flagsYAreasToUpdate)); + +- for (k = 0; k < 16; ++k) ++ // Forge: Grabs ALL tile entities is costly on a modded server, only send needed ones ++ for (k = 0; false && k < 16; ++k) + { + if ((this.flagsYAreasToUpdate & 1 << k) != 0) + { +@@ -488,7 +563,10 @@ + else + { + this.sendToAllPlayersWatchingChunk(new S22PacketMultiBlockChange(this.numBlocksToUpdate, this.locationOfBlockChange, PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos))); ++ } + ++ { //Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small ++ WorldServer world = PlayerManager.this.theWorldServer; + for (i = 0; i < this.numBlocksToUpdate; ++i) + { + j = (this.locationOfBlockChange[i] >> 12 & 15) + this.chunkCoords.chunkXPos * 16; +@@ -496,7 +574,7 @@ + i1 = (this.locationOfBlockChange[i] >> 8 & 15) + this.chunkCoords.chunkZPos * 16; + BlockPos blockpos1 = new BlockPos(j, k, i1); + +- if (PlayerManager.this.theWorldServer.getBlockState(blockpos1).getBlock().hasTileEntity()) ++ if (world.getBlockState(blockpos1).getBlock().hasTileEntity(world.getBlockState(blockpos1))) + { + this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos1)); + } diff --git a/patches/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch b/patches.mcp/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch similarity index 87% rename from patches/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch rename to patches.mcp/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch index 93c276883..678f9b276 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch +++ b/patches.mcp/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch @@ -8,8 +8,8 @@ { try { - bufferedreader = Files.newReader(this.field_152665_g, Charsets.UTF_8); - list = (List)this.field_152660_b.fromJson(bufferedreader, field_152666_h); + bufferedreader = Files.newReader(this.usercacheFile, Charsets.UTF_8); + list = (List)this.gson.fromJson(bufferedreader, field_152666_h); - break label64; - } - catch (FileNotFoundException filenotfoundexception) diff --git a/patches.mcp/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch b/patches.mcp/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch new file mode 100644 index 000000000..5eacc8196 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch @@ -0,0 +1,223 @@ +--- ../src-base/minecraft/net/minecraft/server/management/ServerConfigurationManager.java ++++ ../src-work/minecraft/net/minecraft/server/management/ServerConfigurationManager.java +@@ -103,7 +103,7 @@ + this.maxPlayers = 8; + } + +- public void initializeConnectionToPlayer(NetworkManager netManager, EntityPlayerMP playerIn) ++ public void initializeConnectionToPlayer(NetworkManager netManager, EntityPlayerMP playerIn, NetHandlerPlayServer nethandlerplayserver) + { + GameProfile gameprofile = playerIn.getGameProfile(); + PlayerProfileCache playerprofilecache = this.mcServer.getPlayerProfileCache(); +@@ -112,6 +112,17 @@ + playerprofilecache.func_152649_a(gameprofile); + NBTTagCompound nbttagcompound = this.readPlayerDataFromFile(playerIn); + playerIn.setWorld(this.mcServer.worldServerForDimension(playerIn.dimension)); ++ ++ World playerWorld = this.mcServer.worldServerForDimension(playerIn.dimension); ++ if (playerWorld == null) ++ { ++ playerIn.dimension=0; ++ playerWorld=this.mcServer.worldServerForDimension(0); ++ BlockPos spawnPoint = playerWorld.provider.getRandomizedSpawnPoint(); ++ playerIn.setPosition(spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ()); ++ } ++ ++ playerIn.setWorld(playerWorld); + playerIn.theItemInWorldManager.setWorld((WorldServer)playerIn.worldObj); + String s1 = "local"; + +@@ -125,7 +136,7 @@ + WorldInfo worldinfo = worldserver.getWorldInfo(); + BlockPos blockpos = worldserver.getSpawnPoint(); + this.func_72381_a(playerIn, (EntityPlayerMP)null, worldserver); +- NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.mcServer, netManager, playerIn); ++ playerIn.playerNetServerHandler = nethandlerplayserver; + nethandlerplayserver.sendPacket(new S01PacketJoinGame(playerIn.getEntityId(), playerIn.theItemInWorldManager.getGameType(), worldinfo.isHardcoreModeEnabled(), worldserver.provider.getDimensionId(), worldserver.getDifficulty(), this.getMaxPlayers(), worldinfo.getTerrainType(), worldserver.getGameRules().getGameRuleBooleanValue("reducedDebugInfo"))); + nethandlerplayserver.sendPacket(new S3FPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(this.getServerInstance().getServerModName()))); + nethandlerplayserver.sendPacket(new S41PacketServerDifficulty(worldinfo.getDifficulty(), worldinfo.isDifficultyLocked())); +@@ -168,6 +179,7 @@ + + playerIn.addSelfToInternalCraftingInventory(); + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedIn(playerIn); + if (nbttagcompound != null && nbttagcompound.hasKey("Riding", 10)) + { + Entity entity = EntityList.createEntityFromNBT(nbttagcompound.getCompoundTag("Riding"), worldserver); +@@ -272,6 +284,7 @@ + playerIn.readFromNBT(nbttagcompound); + nbttagcompound1 = nbttagcompound; + logger.debug("loading single player"); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(playerIn, this.playerNBTManagerObj, playerIn.getUniqueID().toString()); + } + else + { +@@ -281,8 +294,23 @@ + return nbttagcompound1; + } + ++ public NBTTagCompound getPlayerNBT(EntityPlayerMP player) ++ { ++ // Hacky method to allow loading the NBT for a player prior to login ++ NBTTagCompound nbttagcompound = this.mcServer.worldServers[0].getWorldInfo().getPlayerNBTTagCompound(); ++ if (player.getName().equals(this.mcServer.getServerOwner()) && nbttagcompound != null) ++ { ++ return nbttagcompound; ++ } ++ else ++ { ++ return ((net.minecraft.world.storage.SaveHandler)this.playerNBTManagerObj).getPlayerNBT(player); ++ } ++ } + protected void writePlayerData(EntityPlayerMP playerIn) + { ++ if (playerIn.playerNetServerHandler == null) return; ++ + this.playerNBTManagerObj.writePlayerData(playerIn); + StatisticsFile statisticsfile = (StatisticsFile)this.playerStatFiles.get(playerIn.getUniqueID()); + +@@ -298,6 +326,7 @@ + this.uuidToPlayerMap.put(playerIn.getUniqueID(), playerIn); + this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {playerIn})); + WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); + worldserver.spawnEntityInWorld(playerIn); + this.func_72375_a(playerIn, (WorldServer)null); + +@@ -315,6 +344,7 @@ + + public void playerLoggedOut(EntityPlayerMP playerIn) + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedOut(playerIn); + playerIn.triggerAchievement(StatList.leaveGameStat); + this.writePlayerData(playerIn); + WorldServer worldserver = playerIn.getServerForPlayer(); +@@ -330,6 +360,7 @@ + this.playerEntityList.remove(playerIn); + this.uuidToPlayerMap.remove(playerIn.getUniqueID()); + this.playerStatFiles.remove(playerIn.getUniqueID()); ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); + this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn})); + } + +@@ -411,13 +442,23 @@ + + public EntityPlayerMP recreatePlayerEntity(EntityPlayerMP playerIn, int dimension, boolean conqueredEnd) + { ++ World world = mcServer.worldServerForDimension(dimension); ++ if (world == null) ++ { ++ dimension = 0; ++ } ++ else if (!world.provider.canRespawnHere()) ++ { ++ dimension = world.provider.getRespawnDimension(playerIn); ++ } ++ + playerIn.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(playerIn); + playerIn.getServerForPlayer().getEntityTracker().untrackEntity(playerIn); + playerIn.getServerForPlayer().getPlayerManager().removePlayer(playerIn); + this.playerEntityList.remove(playerIn); + this.mcServer.worldServerForDimension(playerIn.dimension).removePlayerEntityDangerously(playerIn); +- BlockPos blockpos = playerIn.getBedLocation(); +- boolean flag1 = playerIn.isSpawnForced(); ++ BlockPos blockpos = playerIn.getBedLocation(dimension); ++ boolean flag1 = playerIn.isSpawnForced(dimension); + playerIn.dimension = dimension; + Object object; + +@@ -433,6 +474,7 @@ + EntityPlayerMP entityplayermp1 = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(playerIn.dimension), playerIn.getGameProfile(), (ItemInWorldManager)object); + entityplayermp1.playerNetServerHandler = playerIn.playerNetServerHandler; + entityplayermp1.clonePlayer(playerIn, conqueredEnd); ++ entityplayermp1.dimension = dimension; + entityplayermp1.setEntityId(playerIn.getEntityId()); + entityplayermp1.func_174817_o(playerIn); + WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); +@@ -473,19 +515,25 @@ + this.uuidToPlayerMap.put(entityplayermp1.getUniqueID(), entityplayermp1); + entityplayermp1.addSelfToInternalCraftingInventory(); + entityplayermp1.setHealth(entityplayermp1.getHealth()); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp1); + return entityplayermp1; + } + + public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension) + { ++ transferPlayerToDimension(playerIn, dimension, mcServer.worldServerForDimension(dimension).getDefaultTeleporter()); ++ } ++ ++ public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension, net.minecraft.world.Teleporter teleporter) ++ { + int j = playerIn.dimension; + WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); + playerIn.dimension = dimension; + WorldServer worldserver1 = this.mcServer.worldServerForDimension(playerIn.dimension); +- playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, playerIn.worldObj.getDifficulty(), playerIn.worldObj.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); ++ playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); // Forge: Use new dimensions information + worldserver.removePlayerEntityDangerously(playerIn); + playerIn.isDead = false; +- this.transferEntityToWorld(playerIn, j, worldserver, worldserver1); ++ this.transferEntityToWorld(playerIn, j, worldserver, worldserver1, teleporter); + this.func_72375_a(playerIn, worldserver); + playerIn.playerNetServerHandler.setPlayerLocation(playerIn.posX, playerIn.posY, playerIn.posZ, playerIn.rotationYaw, playerIn.rotationPitch); + playerIn.theItemInWorldManager.setWorld(worldserver1); +@@ -498,17 +546,27 @@ + PotionEffect potioneffect = (PotionEffect)iterator.next(); + playerIn.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(playerIn.getEntityId(), potioneffect)); + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(playerIn, j, dimension); + } + + public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_) + { +- double d0 = entityIn.posX; +- double d1 = entityIn.posZ; ++ transferEntityToWorld(entityIn, p_82448_2_, p_82448_3_, p_82448_4_, p_82448_4_.getDefaultTeleporter()); ++ } ++ ++ @SuppressWarnings("unused") ++ public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, net.minecraft.world.Teleporter teleporter) ++ { ++ net.minecraft.world.WorldProvider pOld = p_82448_3_.provider; ++ net.minecraft.world.WorldProvider pNew = p_82448_4_.provider; ++ double moveFactor = pOld.getMovementFactor() / pNew.getMovementFactor(); ++ double d0 = entityIn.posX * moveFactor; ++ double d1 = entityIn.posZ * moveFactor; + double d2 = 8.0D; + float f = entityIn.rotationYaw; + p_82448_3_.theProfiler.startSection("moving"); + +- if (entityIn.dimension == -1) ++ if (false && entityIn.dimension == -1) //Forge Kill it but dont comment out so we can rename it. + { + d0 = MathHelper.clamp_double(d0 / d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); + d1 = MathHelper.clamp_double(d1 / d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); +@@ -519,7 +577,7 @@ + p_82448_3_.updateEntityWithOptionalForce(entityIn, false); + } + } +- else if (entityIn.dimension == 0) ++ else if (false && entityIn.dimension == 0) //Forge Kill it but dont comment out so we can rename it. + { + d0 = MathHelper.clamp_double(d0 * d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); + d1 = MathHelper.clamp_double(d1 * d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); +@@ -530,7 +588,8 @@ + p_82448_3_.updateEntityWithOptionalForce(entityIn, false); + } + } +- else ++ ++ if (entityIn.dimension == 1) + { + BlockPos blockpos; + +@@ -565,7 +624,7 @@ + if (entityIn.isEntityAlive()) + { + entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch); +- p_82448_4_.getDefaultTeleporter().placeInPortal(entityIn, f); ++ teleporter.placeInPortal(entityIn, f); + p_82448_4_.spawnEntityInWorld(entityIn); + p_82448_4_.updateEntityWithOptionalForce(entityIn, false); + } diff --git a/patches/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch b/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch similarity index 65% rename from patches/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch rename to patches.mcp/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch index 855a224f4..9a0c6b233 100644 --- a/patches/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch +++ b/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch @@ -2,10 +2,10 @@ +++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java @@ -23,6 +23,8 @@ - public void func_147383_a(C00Handshake p_147383_1_) + public void processHandshake(C00Handshake packetIn) { -+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(p_147383_1_, this.field_147386_b)) return; ++ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return; + - switch (NetHandlerHandshakeTCP.SwitchEnumConnectionState.field_151291_a[p_147383_1_.func_149594_c().ordinal()]) + switch (NetHandlerHandshakeTCP.SwitchEnumConnectionState.VALUES[packetIn.getRequestedState().ordinal()]) { case 1: diff --git a/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch new file mode 100644 index 000000000..c6a8ad1f0 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java ++++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java +@@ -62,7 +62,7 @@ + this.tryAcceptPlayer(); + } + +- if (this.connectionTimer++ == 600) ++ if (this.connectionTimer++ == net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.LOGIN_TIMEOUT) + { + this.closeConnection("Took too long to log in"); + } +@@ -113,7 +113,7 @@ + } + + this.networkManager.sendPacket(new S02PacketLoginSuccess(this.loginGameProfile)); +- this.server.getConfigurationManager().initializeConnectionToPlayer(this.networkManager, this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile)); ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.getConfigurationManager(), this.networkManager, this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile)); + } + } + diff --git a/patches/minecraft/net/minecraft/stats/StatList.java.patch b/patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch similarity index 53% rename from patches/minecraft/net/minecraft/stats/StatList.java.patch rename to patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch index cadaf3998..07cee7f68 100644 --- a/patches/minecraft/net/minecraft/stats/StatList.java.patch +++ b/patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch @@ -4,8 +4,8 @@ if (item != null) { -- int i = Item.func_150891_b(item); -+ int i = Item.func_150891_b(item); //TODO: Hook FML's stat change event and re-assign these +- int i = Item.getIdFromItem(item); ++ int i = Item.getIdFromItem(item); //TODO: Hook FML's stat change event and re-assign these String s = func_180204_a(item); if (s != null) @@ -13,22 +13,22 @@ while (iterator.hasNext()) { Block block = (Block)iterator.next(); -- Item item = Item.func_150898_a(block); -+ Item item = Item.func_150898_a(block); //TODO: Hook FML's stat change event and re-assign these +- Item item = Item.getItemFromBlock(block); ++ Item item = Item.getItemFromBlock(block); //TODO: Hook FML's stat change event and re-assign these if (item != null) { -- int i = Block.func_149682_b(block); -+ int i = Block.func_149682_b(block); //TODO: Hook FML's stat change event and re-assign these +- int i = Block.getIdFromBlock(block); ++ int i = Block.getIdFromBlock(block); //TODO: Hook FML's stat change event and re-assign these String s = func_180204_a(item); - if (s != null && block.func_149652_G()) + if (s != null && block.getEnableStats()) @@ -149,7 +149,7 @@ if (item != null) { -- int i = Item.func_150891_b(item); -+ int i = Item.func_150891_b(item); //TODO: Hook FML's stat change event and re-assign these +- int i = Item.getIdFromItem(item); ++ int i = Item.getIdFromItem(item); //TODO: Hook FML's stat change event and re-assign these String s = func_180204_a(item); if (s != null) @@ -36,8 +36,8 @@ if (item != null) { -- int i = Item.func_150891_b(item); -+ int i = Item.func_150891_b(item); //TODO: Hook FML's stat change event and re-assign these +- int i = Item.getIdFromItem(item); ++ int i = Item.getIdFromItem(item); //TODO: Hook FML's stat change event and re-assign these String s = func_180204_a(item); - if (s != null && item.func_77645_m()) + if (s != null && item.isDamageable()) diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch similarity index 73% rename from patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch rename to patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch index ec01c7662..f125971bf 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -1,18 +1,18 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java @@ -66,6 +66,7 @@ - public void func_145839_a(NBTTagCompound p_145839_1_) + public void readFromNBT(NBTTagCompound compound) { - this.field_174879_c = new BlockPos(p_145839_1_.func_74762_e("x"), p_145839_1_.func_74762_e("y"), p_145839_1_.func_74762_e("z")); -+ if (p_145839_1_.func_74764_b("ForgeData")) this.customTileData = p_145839_1_.func_74775_l("ForgeData"); + this.pos = new BlockPos(compound.getInteger("x"), compound.getInteger("y"), compound.getInteger("z")); ++ if (compound.hasKey("ForgeData")) this.customTileData = compound.getCompoundTag("ForgeData"); } - public void func_145841_b(NBTTagCompound p_145841_1_) + public void writeToNBT(NBTTagCompound compound) @@ -82,6 +83,7 @@ - p_145841_1_.func_74768_a("x", this.field_174879_c.func_177958_n()); - p_145841_1_.func_74768_a("y", this.field_174879_c.func_177956_o()); - p_145841_1_.func_74768_a("z", this.field_174879_c.func_177952_p()); -+ if (this.customTileData != null) p_145841_1_.func_74782_a("ForgeData", this.customTileData); + compound.setInteger("x", this.pos.getX()); + compound.setInteger("y", this.pos.getY()); + compound.setInteger("z", this.pos.getZ()); ++ if (this.customTileData != null) compound.setTag("ForgeData", this.customTileData); } } @@ -23,8 +23,8 @@ + Class oclass = null; try { -- Class oclass = (Class)field_145855_i.get(p_145827_0_.func_74779_i("id")); -+ oclass = (Class)field_145855_i.get(p_145827_0_.func_74779_i("id")); +- Class oclass = (Class)nameToClassMap.get(nbt.getString("id")); ++ oclass = (Class)nameToClassMap.get(nbt.getString("id")); if (oclass != null) { @@ -34,13 +34,13 @@ { + try + { - field_145852_a.warn("Skipping BlockEntity with id " + p_145827_0_.func_74779_i("id")); + logger.warn("Skipping BlockEntity with id " + nbt.getString("id")); + } + catch (Exception ex) + { + net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, ex, + "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", -+ p_145827_0_.func_74779_i("id"), oclass.getName()); ++ nbt.getString("id"), oclass.getName()); + tileentity = null; + } } @@ -51,12 +51,12 @@ } - @SideOnly(Side.CLIENT) - public double func_145835_a(double p_145835_1_, double p_145835_3_, double p_145835_5_) + public double getDistanceSq(double x, double y, double z) { - double d3 = (double)this.field_174879_c.func_177958_n() + 0.5D - p_145835_1_; + double d3 = (double)this.pos.getX() + 0.5D - x; @@ -284,4 +296,135 @@ - func_145826_a(TileEntityFlowerPot.class, "FlowerPot"); - func_145826_a(TileEntityBanner.class, "Banner"); + addMapping(TileEntityFlowerPot.class, "FlowerPot"); + addMapping(TileEntityBanner.class, "Banner"); } + + // -- BEGIN FORGE PATCHES -- @@ -93,7 +93,7 @@ + */ + public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate) + { -+ return !isVanilla || (oldState.func_177230_c() != newSate.func_177230_c()); ++ return !isVanilla || (oldState.getBlock() != newSate.getBlock()); + } + + public boolean shouldRenderInPass(int pass) @@ -116,21 +116,21 @@ + public net.minecraft.util.AxisAlignedBB getRenderBoundingBox() + { + net.minecraft.util.AxisAlignedBB bb = INFINITE_EXTENT_AABB; -+ Block type = func_145838_q(); -+ if (type == Blocks.field_150381_bn) ++ Block type = getBlockType(); ++ if (type == Blocks.enchanting_table) + { -+ bb = new net.minecraft.util.AxisAlignedBB(func_174877_v(), func_174877_v().func_177982_a(1, 1, 1)); ++ bb = new net.minecraft.util.AxisAlignedBB(getPos(), getPos().add(1, 1, 1)); + } -+ else if (type == Blocks.field_150486_ae || type == Blocks.field_150447_bR) ++ else if (type == Blocks.chest || type == Blocks.trapped_chest) + { -+ bb = new net.minecraft.util.AxisAlignedBB(func_174877_v().func_177982_a(-1, 0, -1), func_174877_v().func_177982_a(2, 2, 2)); ++ bb = new net.minecraft.util.AxisAlignedBB(getPos().add(-1, 0, -1), getPos().add(2, 2, 2)); + } -+ else if (type != null && type != Blocks.field_150461_bJ) ++ else if (type != null && type != Blocks.beacon) + { + net.minecraft.util.AxisAlignedBB cbb = null; + try + { -+ cbb = type.func_180640_a(field_145850_b, func_174877_v(), field_145850_b.func_180495_p(func_174877_v())); ++ cbb = type.getCollisionBoundingBox(worldObj, getPos(), worldObj.getBlockState(getPos())); + } + catch (Exception e) + { @@ -140,7 +140,7 @@ + // So, once again in the long line of US having to accommodate BUKKIT breaking things, + // here it is, assume that the TE is only 1 cubic block. Problem with this is that it may + // cause the TileEntity renderer to error further down the line! But alas, nothing we can do. -+ cbb = new net.minecraft.util.AxisAlignedBB(func_174877_v().func_177982_a(-1, 0, -1), func_174877_v().func_177982_a(1, 1, 1)); ++ cbb = new net.minecraft.util.AxisAlignedBB(getPos().add(-1, 0, -1), getPos().add(1, 1, 1)); + } + if (cbb != null) bb = cbb; + } @@ -154,7 +154,7 @@ + */ + public boolean canRenderBreaking() + { -+ Block block = this.func_145838_q(); ++ Block block = this.getBlockType(); + return (block instanceof net.minecraft.block.BlockChest || + block instanceof net.minecraft.block.BlockEnderChest || + block instanceof net.minecraft.block.BlockSign || diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch new file mode 100644 index 000000000..882045eb6 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBeacon.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBeacon.java +@@ -178,7 +178,7 @@ + { + Block block = this.worldObj.getBlockState(new BlockPos(l1, k1, j1)).getBlock(); + +- if (block != Blocks.emerald_block && block != Blocks.gold_block && block != Blocks.diamond_block && block != Blocks.iron_block) ++ if (!block.isBeaconBase(this.worldObj, new BlockPos(l1, k1, j1), getPos())) + { + flag1 = false; + break; +@@ -363,7 +363,7 @@ + + public boolean isItemValidForSlot(int index, ItemStack stack) + { +- return stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot; ++ return stack.getItem() != null && stack.getItem().isBeaconPayment(stack); + } + + public String getGuiID() diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch new file mode 100644 index 000000000..8724a5526 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch @@ -0,0 +1,78 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java +@@ -104,7 +104,7 @@ + + private boolean canBrew() + { +- if (this.brewingItemStacks[3] != null && this.brewingItemStacks[3].stackSize > 0) ++ if (this.brewingItemStacks[3] != null && this.brewingItemStacks[3].stackSize > 0 && false) // Code moved to net.minecraftforge.common.brewing.VanillaBrewingRecipe + { + ItemStack itemstack = this.brewingItemStacks[3]; + +@@ -118,7 +118,7 @@ + + for (int i = 0; i < 3; ++i) + { +- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem) ++ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion) + { + int j = this.brewingItemStacks[i].getMetadata(); + int k = this.func_145936_c(j, itemstack); +@@ -145,19 +145,22 @@ + } + else + { +- return false; ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.canBrew(brewingItemStacks, brewingItemStacks[3], outputSlots); + } + } + + private void brewPotions() + { ++ if (net.minecraftforge.event.ForgeEventFactory.onPotionAttemptBreaw(brewingItemStacks)) return; + if (this.canBrew()) + { ++ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(brewingItemStacks, brewingItemStacks[3], outputSlots); + ItemStack itemstack = this.brewingItemStacks[3]; + ++ if (false) { // Code moved to net.minecraftforge.common.brewing.VanillaBrewingRecipe + for (int i = 0; i < 3; ++i) + { +- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem) ++ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion) + { + int j = this.brewingItemStacks[i].getMetadata(); + int k = this.func_145936_c(j, itemstack); +@@ -177,10 +180,11 @@ + } + } + } ++ } + +- if (itemstack.getItem().hasContainerItem()) ++ if (itemstack.getItem().hasContainerItem(itemstack)) + { +- this.brewingItemStacks[3] = new ItemStack(itemstack.getItem().getContainerItem()); ++ this.brewingItemStacks[3] = itemstack.getItem().getContainerItem(itemstack); + } + else + { +@@ -191,6 +195,7 @@ + this.brewingItemStacks[3] = null; + } + } ++ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(brewingItemStacks); + } + } + +@@ -306,7 +311,9 @@ + + public boolean isItemValidForSlot(int index, ItemStack stack) + { +- return index == 3 ? stack.getItem().isPotionIngredient(stack) : stack.getItem() == Items.potionitem || stack.getItem() == Items.glass_bottle; ++ if (index == 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack)) return true; ++ else if (index != 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(stack)) return true; ++ return false; + } + + public boolean[] func_174902_m() diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch new file mode 100644 index 000000000..3c9b75c96 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch @@ -0,0 +1,51 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityFurnace.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityFurnace.java +@@ -233,8 +233,7 @@ + + if (this.furnaceItemStacks[1].stackSize == 0) + { +- Item item = this.furnaceItemStacks[1].getItem().getContainerItem(); +- this.furnaceItemStacks[1] = item != null ? new ItemStack(item) : null; ++ this.furnaceItemStacks[1] = furnaceItemStacks[1].getItem().getContainerItem(furnaceItemStacks[1]); + } + } + } +@@ -285,7 +284,11 @@ + else + { + ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.furnaceItemStacks[0]); +- return itemstack == null ? false : (this.furnaceItemStacks[2] == null ? true : (!this.furnaceItemStacks[2].isItemEqual(itemstack) ? false : (this.furnaceItemStacks[2].stackSize < this.getInventoryStackLimit() && this.furnaceItemStacks[2].stackSize < this.furnaceItemStacks[2].getMaxStackSize() ? true : this.furnaceItemStacks[2].stackSize < itemstack.getMaxStackSize()))); ++ if (itemstack == null) return false; ++ if (this.furnaceItemStacks[2] == null) return true; ++ if (!this.furnaceItemStacks[2].isItemEqual(itemstack)) return false; ++ int result = furnaceItemStacks[2].stackSize + itemstack.stackSize; ++ return result <= getInventoryStackLimit() && result <= this.furnaceItemStacks[2].getMaxStackSize(); //Forge BugFix: Make it respect stack sizes properly. + } + } + +@@ -301,7 +304,7 @@ + } + else if (this.furnaceItemStacks[2].getItem() == itemstack.getItem()) + { +- ++this.furnaceItemStacks[2].stackSize; ++ this.furnaceItemStacks[2].stackSize += itemstack.stackSize; // Forge BugFix: Results may have multiple items + } + + if (this.furnaceItemStacks[0].getItem() == Item.getItemFromBlock(Blocks.sponge) && this.furnaceItemStacks[0].getMetadata() == 1 && this.furnaceItemStacks[1] != null && this.furnaceItemStacks[1].getItem() == Items.bucket) +@@ -348,7 +351,15 @@ + } + } + +- return item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD") ? 200 : (item == Items.stick ? 100 : (item == Items.coal ? 1600 : (item == Items.lava_bucket ? 20000 : (item == Item.getItemFromBlock(Blocks.sapling) ? 100 : (item == Items.blaze_rod ? 2400 : 0))))))); ++ if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200; ++ if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200; ++ if (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD")) return 200; ++ if (item == Items.stick) return 100; ++ if (item == Items.coal) return 1600; ++ if (item == Items.lava_bucket) return 20000; ++ if (item == Item.getItemFromBlock(Blocks.sapling)) return 100; ++ if (item == Items.blaze_rod) return 2400; ++ return net.minecraftforge.fml.common.registry.GameRegistry.getFuelValue(p_145952_0_); + } + } + diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch new file mode 100644 index 000000000..018e6784d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch @@ -0,0 +1,40 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityHopper.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityHopper.java +@@ -523,17 +523,30 @@ + + if (itemstack1 == null) + { +- p_174916_0_.setInventorySlotContents(p_174916_2_, p_174916_1_); +- p_174916_1_ = null; ++ //Forge: BUGFIX: Again, make things respect max stack sizes. ++ int max = Math.min(p_174916_1_.getMaxStackSize(), p_174916_0_.getInventoryStackLimit()); ++ if (max >= p_174916_1_.stackSize) ++ { ++ p_174916_0_.setInventorySlotContents(p_174916_2_, p_174916_1_); ++ p_174916_1_ = null; ++ } ++ else ++ { ++ p_174916_0_.setInventorySlotContents(p_174916_2_, p_174916_1_.splitStack(max)); ++ } + flag = true; + } + else if (canCombine(itemstack1, p_174916_1_)) + { +- int j = p_174916_1_.getMaxStackSize() - itemstack1.stackSize; +- int k = Math.min(p_174916_1_.stackSize, j); +- p_174916_1_.stackSize -= k; +- itemstack1.stackSize += k; +- flag = k > 0; ++ //Forge: BUGFIX: Again, make things respect max stack sizes. ++ int max = Math.min(p_174916_1_.getMaxStackSize(), p_174916_0_.getInventoryStackLimit()); ++ if (max > itemstack1.stackSize) ++ { ++ int size = Math.min(p_174916_1_.stackSize, max - itemstack1.stackSize); ++ p_174916_1_.stackSize -= size; ++ itemstack1.stackSize += size; ++ flag = size > 0; ++ } + } + + if (flag) diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch similarity index 60% rename from patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch rename to patches.mcp/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch index 0bf432e05..51de36d50 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch @@ -2,11 +2,11 @@ +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityNote.java @@ -28,7 +28,9 @@ - public void func_145877_a() + public void changePitch() { -+ byte old = field_145879_a; - this.field_145879_a = (byte)((this.field_145879_a + 1) % 25); ++ byte old = note; + this.note = (byte)((this.note + 1) % 25); + if (!net.minecraftforge.common.ForgeHooks.onNoteChange(this, old)) return; - this.func_70296_d(); + this.markDirty(); } diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch new file mode 100644 index 000000000..009c0ba03 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityPiston.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityPiston.java +@@ -151,7 +151,8 @@ + if (this.worldObj.getBlockState(this.pos).getBlock() == Blocks.piston_extension) + { + this.worldObj.setBlockState(this.pos, this.pistonState, 3); +- this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); ++ if(!net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldObj, pos, worldObj.getBlockState(pos), java.util.EnumSet.noneOf(EnumFacing.class)).isCanceled()) ++ this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); + } + } + } +@@ -169,7 +170,8 @@ + if (this.worldObj.getBlockState(this.pos).getBlock() == Blocks.piston_extension) + { + this.worldObj.setBlockState(this.pos, this.pistonState, 3); +- this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); ++ if(!net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldObj, pos, worldObj.getBlockState(pos), java.util.EnumSet.noneOf(EnumFacing.class)).isCanceled()) ++ this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); + } + } + else diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch new file mode 100644 index 000000000..5b1152090 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntitySign.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntitySign.java +@@ -161,7 +161,7 @@ + public void addChatMessage(IChatComponent message) {} + public boolean canUseCommand(int permLevel, String commandName) + { +- return true; ++ return permLevel <= 2; //Forge: Fixes MC-75630 - Exploit with signs and command blocks + } + public BlockPos getPosition() + { diff --git a/patches/minecraft/net/minecraft/util/EnumChatFormatting.java.patch b/patches.mcp/minecraft/net/minecraft/util/EnumChatFormatting.java.patch similarity index 50% rename from patches/minecraft/net/minecraft/util/EnumChatFormatting.java.patch rename to patches.mcp/minecraft/net/minecraft/util/EnumChatFormatting.java.patch index 45fc3d1da..5531b6eb0 100644 --- a/patches/minecraft/net/minecraft/util/EnumChatFormatting.java.patch +++ b/patches.mcp/minecraft/net/minecraft/util/EnumChatFormatting.java.patch @@ -1,10 +1,10 @@ --- ../src-base/minecraft/net/minecraft/util/EnumChatFormatting.java +++ ../src-work/minecraft/net/minecraft/util/EnumChatFormatting.java @@ -92,7 +92,6 @@ - return this.field_96304_B; + return this.controlString; } - @SideOnly(Side.CLIENT) - public static String func_110646_a(String p_110646_0_) + public static String getTextWithoutFormattingCodes(String text) { - return p_110646_0_ == null ? null : field_96330_y.matcher(p_110646_0_).replaceAll(""); + return text == null ? null : formattingCodePattern.matcher(text).replaceAll(""); diff --git a/patches/minecraft/net/minecraft/util/EnumFacing.java.patch b/patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch similarity index 50% rename from patches/minecraft/net/minecraft/util/EnumFacing.java.patch rename to patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch index f2a758f48..3375b0ccf 100644 --- a/patches/minecraft/net/minecraft/util/EnumFacing.java.patch +++ b/patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch @@ -10,61 +10,61 @@ public enum EnumFacing implements IStringSerializable { @@ -61,7 +59,6 @@ - return func_82600_a(this.field_176759_h); + return getFront(this.opposite); } - @SideOnly(Side.CLIENT) - public EnumFacing func_176732_a(EnumFacing.Axis p_176732_1_) + public EnumFacing rotateAround(EnumFacing.Axis axis) { - switch (EnumFacing.SwitchPlane.field_179515_a[p_176732_1_.ordinal()]) + switch (EnumFacing.SwitchPlane.AXIS_LOOKUP[axis.ordinal()]) @@ -109,7 +106,6 @@ } } - @SideOnly(Side.CLIENT) - private EnumFacing func_176744_n() + private EnumFacing rotateX() { - switch (EnumFacing.SwitchPlane.field_179513_b[this.ordinal()]) + switch (EnumFacing.SwitchPlane.FACING_LOOKUP[this.ordinal()]) @@ -129,7 +125,6 @@ } } - @SideOnly(Side.CLIENT) - private EnumFacing func_176738_p() + private EnumFacing rotateZ() { - switch (EnumFacing.SwitchPlane.field_179513_b[this.ordinal()]) + switch (EnumFacing.SwitchPlane.FACING_LOOKUP[this.ordinal()]) @@ -190,7 +185,6 @@ - return this.field_176758_k; + return this.axis; } - @SideOnly(Side.CLIENT) - public static EnumFacing func_176739_a(String p_176739_0_) + public static EnumFacing byName(String name) { - return p_176739_0_ == null ? null : (EnumFacing)field_176761_p.get(p_176739_0_.toLowerCase()); + return name == null ? null : (EnumFacing)NAME_LOOKUP.get(name.toLowerCase()); @@ -216,7 +210,6 @@ - return values()[p_176741_0_.nextInt(values().length)]; + return values()[rand.nextInt(values().length)]; } - @SideOnly(Side.CLIENT) - public static EnumFacing func_176737_a(float p_176737_0_, float p_176737_1_, float p_176737_2_) + public static EnumFacing getFacingFromVector(float p_176737_0_, float p_176737_1_, float p_176737_2_) { EnumFacing enumfacing = NORTH; @@ -249,7 +242,6 @@ - return this.field_176757_j; + return this.name; } - @SideOnly(Side.CLIENT) - public Vec3i func_176730_m() + public Vec3i getDirectionVec() { - return this.field_176756_m; + return this.directionVec; @@ -291,7 +283,6 @@ - this.field_176723_f = p_i46015_4_; + this.plane = plane; } - @SideOnly(Side.CLIENT) - public static EnumFacing.Axis func_176717_a(String p_176717_0_) + public static EnumFacing.Axis byName(String name) { - return p_176717_0_ == null ? null : (EnumFacing.Axis)field_176725_d.get(p_176717_0_.toLowerCase()); + return name == null ? null : (EnumFacing.Axis)NAME_LOOKUP.get(name.toLowerCase()); @@ -376,7 +367,7 @@ } } diff --git a/patches/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch b/patches.mcp/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch similarity index 100% rename from patches/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch rename to patches.mcp/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch diff --git a/patches/minecraft/net/minecraft/util/MessageSerializer.java.patch b/patches.mcp/minecraft/net/minecraft/util/MessageSerializer.java.patch similarity index 86% rename from patches/minecraft/net/minecraft/util/MessageSerializer.java.patch rename to patches.mcp/minecraft/net/minecraft/util/MessageSerializer.java.patch index 7724ff4c7..ea204cead 100644 --- a/patches/minecraft/net/minecraft/util/MessageSerializer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/util/MessageSerializer.java.patch @@ -8,4 +8,4 @@ + //p_encode_2_ = p_encode_2_; FML: Kill warning } - p_encode_2_.func_148840_b(packetbuffer); + p_encode_2_.writePacketData(packetbuffer); diff --git a/patches/minecraft/net/minecraft/util/MouseHelper.java.patch b/patches.mcp/minecraft/net/minecraft/util/MouseHelper.java.patch similarity index 73% rename from patches/minecraft/net/minecraft/util/MouseHelper.java.patch rename to patches.mcp/minecraft/net/minecraft/util/MouseHelper.java.patch index 55d49a58d..a027a060e 100644 --- a/patches/minecraft/net/minecraft/util/MouseHelper.java.patch +++ b/patches.mcp/minecraft/net/minecraft/util/MouseHelper.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/util/MouseHelper.java @@ -14,6 +14,7 @@ - public void func_74372_a() + public void grabMouseCursor() { + if (Boolean.parseBoolean(System.getProperty("fml.noGrab","false"))) return; Mouse.setGrabbed(true); - this.field_74377_a = 0; - this.field_74375_b = 0; + this.deltaX = 0; + this.deltaY = 0; diff --git a/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch b/patches.mcp/minecraft/net/minecraft/util/MovingObjectPosition.java.patch similarity index 94% rename from patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch rename to patches.mcp/minecraft/net/minecraft/util/MovingObjectPosition.java.patch index 80499add4..4dce21e9b 100644 --- a/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch +++ b/patches.mcp/minecraft/net/minecraft/util/MovingObjectPosition.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/util/MovingObjectPosition.java +++ ../src-work/minecraft/net/minecraft/util/MovingObjectPosition.java @@ -11,6 +11,12 @@ - public Entity field_72308_g; + public Entity entityHit; private static final String __OBFID = "CL_00000610"; + /** Used to determine what sub-segment is hit */ diff --git a/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch b/patches.mcp/minecraft/net/minecraft/util/ResourceLocation.java.patch similarity index 85% rename from patches/minecraft/net/minecraft/util/ResourceLocation.java.patch rename to patches.mcp/minecraft/net/minecraft/util/ResourceLocation.java.patch index ba2981731..6cb2dd79b 100644 --- a/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch +++ b/patches.mcp/minecraft/net/minecraft/util/ResourceLocation.java.patch @@ -17,10 +17,10 @@ { this(0, new String[] {p_i1292_1_, p_i1292_2_}); @@ -51,7 +48,6 @@ - return this.field_110625_b; + return this.resourcePath; } - @SideOnly(Side.CLIENT) - public String func_110624_b() + public String getResourceDomain() { - return this.field_110626_a; + return this.resourceDomain; diff --git a/patches/minecraft/net/minecraft/util/Session.java.patch b/patches.mcp/minecraft/net/minecraft/util/Session.java.patch similarity index 68% rename from patches/minecraft/net/minecraft/util/Session.java.patch rename to patches.mcp/minecraft/net/minecraft/util/Session.java.patch index 75fdc5212..8156742c0 100644 --- a/patches/minecraft/net/minecraft/util/Session.java.patch +++ b/patches.mcp/minecraft/net/minecraft/util/Session.java.patch @@ -1,18 +1,18 @@ --- ../src-base/minecraft/net/minecraft/util/Session.java +++ ../src-work/minecraft/net/minecraft/util/Session.java @@ -16,9 +16,24 @@ - private final String field_148258_c; - private final Session.Type field_152429_d; + private final String token; + private final Session.Type sessionType; private static final String __OBFID = "CL_00000659"; + /** Forge: Cache of the local session's GameProfile properties. */ + private com.mojang.authlib.properties.PropertyMap properties; - public Session(String p_i1098_1_, String p_i1098_2_, String p_i1098_3_, String p_i1098_4_) + public Session(String usernameIn, String playerIDIn, String tokenIn, String sessionTypeIn) { -+ if (p_i1098_1_ == null || p_i1098_1_.isEmpty()) ++ if (usernameIn == null || usernameIn.isEmpty()) + { -+ p_i1098_1_ = "MissingName"; -+ p_i1098_2_ = p_i1098_3_ = "NotValid"; ++ usernameIn = "MissingName"; ++ playerIDIn = tokenIn = "NotValid"; + System.out.println("========================================================="); + System.out.println("Warning the username was not set for this session, typically"); + System.out.println("this means you installed Forge incorrectly. We have set your"); @@ -22,27 +22,27 @@ + System.out.println("========================================================="); + } + - this.field_74286_b = p_i1098_1_; - this.field_148257_b = p_i1098_2_; - this.field_148258_c = p_i1098_3_; + this.username = usernameIn; + this.playerID = playerIDIn; + this.token = tokenIn; @@ -50,11 +65,13 @@ 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.getPlayerID()); +- return new GameProfile(uuid, this.getUsername()); ++ GameProfile ret = new GameProfile(uuid, this.getUsername()); //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(net.minecraft.entity.player.EntityPlayer.func_146094_a(new GameProfile((UUID)null, this.func_111285_a())), this.func_111285_a()); +- return new GameProfile((UUID)null, this.getUsername()); ++ return new GameProfile(net.minecraft.entity.player.EntityPlayer.getUUID(new GameProfile((UUID)null, this.getUsername())), this.getUsername()); } } @@ -63,6 +80,19 @@ - return this.field_152429_d; + return this.sessionType; } + /* ======================================== FORGE START ===================================== */ diff --git a/patches/minecraft/net/minecraft/util/StringTranslate.java.patch b/patches.mcp/minecraft/net/minecraft/util/StringTranslate.java.patch similarity index 65% rename from patches/minecraft/net/minecraft/util/StringTranslate.java.patch rename to patches.mcp/minecraft/net/minecraft/util/StringTranslate.java.patch index cbdfc628a..369f31b38 100644 --- a/patches/minecraft/net/minecraft/util/StringTranslate.java.patch +++ b/patches.mcp/minecraft/net/minecraft/util/StringTranslate.java.patch @@ -2,31 +2,31 @@ +++ ../src-work/minecraft/net/minecraft/util/StringTranslate.java @@ -18,16 +18,38 @@ { - private static final Pattern field_111053_a = Pattern.compile("%(\\d+\\$)?[\\d\\.]*[df]"); - private static final Splitter field_135065_b = Splitter.on('=').limit(2); -+ private final Map field_74816_c; - private static StringTranslate field_74817_a = new StringTranslate(); -- private final Map field_74816_c = Maps.newHashMap(); - private long field_150511_e; + private static final Pattern numericVariablePattern = Pattern.compile("%(\\d+\\$)?[\\d\\.]*[df]"); + private static final Splitter equalSignSplitter = Splitter.on('=').limit(2); ++ private final Map languageList; + private static StringTranslate instance = new StringTranslate(); +- private final Map languageList = Maps.newHashMap(); + private long lastUpdateTimeInMilliseconds; private static final String __OBFID = "CL_00001212"; public StringTranslate() { + InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); -+ field_74816_c = Maps.newHashMap(); ++ languageList = Maps.newHashMap(); + inject(this, inputstream); + } + + public static void inject(InputStream inputstream) + { -+ inject(field_74817_a, inputstream); ++ inject(instance, inputstream); + } + + private static void inject(StringTranslate inst, InputStream inputstream) + { + java.util.HashMap map = parseLangFile(inputstream); -+ inst.field_74816_c.putAll(map); -+ inst.field_150511_e = System.currentTimeMillis(); ++ inst.languageList.putAll(map); ++ inst.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); + } + + public static java.util.HashMap parseLangFile(InputStream inputstream) @@ -44,14 +44,14 @@ @@ -42,17 +64,17 @@ { String s1 = astring[0]; - String s2 = field_111053_a.matcher(astring[1]).replaceAll("%$1s"); -- this.field_74816_c.put(s1, s2); + String s2 = numericVariablePattern.matcher(astring[1]).replaceAll("%$1s"); +- this.languageList.put(s1, s2); + table.put(s1, s2); } } } -- this.field_150511_e = System.currentTimeMillis(); +- this.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); } - catch (IOException ioexception) + catch (Exception ioexception) @@ -61,4 +61,4 @@ + return table; } - static StringTranslate func_74808_a() + static StringTranslate getInstance() diff --git a/patches.mcp/minecraft/net/minecraft/util/Vec3.java.patch b/patches.mcp/minecraft/net/minecraft/util/Vec3.java.patch new file mode 100644 index 000000000..8712a1f7b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/util/Vec3.java.patch @@ -0,0 +1,27 @@ +--- ../src-base/minecraft/net/minecraft/util/Vec3.java ++++ ../src-work/minecraft/net/minecraft/util/Vec3.java +@@ -1,8 +1,5 @@ + package net.minecraft.util; + +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; +- + public class Vec3 + { + public final double xCoord; +@@ -32,7 +29,6 @@ + this.zCoord = z; + } + +- @SideOnly(Side.CLIENT) + public Vec3 subtractReverse(Vec3 vec) + { + return new Vec3(vec.xCoord - this.xCoord, vec.yCoord - this.yCoord, vec.zCoord - this.zCoord); +@@ -49,7 +45,6 @@ + return this.xCoord * vec.xCoord + this.yCoord * vec.yCoord + this.zCoord * vec.zCoord; + } + +- @SideOnly(Side.CLIENT) + public Vec3 crossProduct(Vec3 vec) + { + return new Vec3(this.yCoord * vec.zCoord - this.zCoord * vec.yCoord, this.zCoord * vec.xCoord - this.xCoord * vec.zCoord, this.xCoord * vec.yCoord - this.yCoord * vec.xCoord); diff --git a/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch b/patches.mcp/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch similarity index 54% rename from patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch rename to patches.mcp/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch index 12827e52b..86dfe202c 100644 --- a/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch +++ b/patches.mcp/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch @@ -3,24 +3,24 @@ @@ -38,23 +38,12 @@ for (int j = 0; j < p_177630_3_; ++j) { - WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.func_76271_a(p_177630_0_, p_177630_1_); -- int k = weightedrandomchestcontent.field_76295_d + p_177630_0_.nextInt(weightedrandomchestcontent.field_76296_e - weightedrandomchestcontent.field_76295_d + 1); -+ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(p_177630_0_, p_177630_2_); + WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, p_177630_1_); +- int k = weightedrandomchestcontent.theMinimumChanceToGenerateItem + random.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1); ++ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, p_177630_2_); -- if (weightedrandomchestcontent.field_76297_b.func_77976_d() >= k) +- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= k) + for (ItemStack itemstack : stacks) { -- ItemStack itemstack = weightedrandomchestcontent.field_76297_b.func_77946_l(); -- itemstack.field_77994_a = k; - p_177630_2_.func_70299_a(p_177630_0_.nextInt(p_177630_2_.func_70302_i_()), itemstack); +- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); +- itemstack.stackSize = k; + p_177630_2_.setInventorySlotContents(random.nextInt(p_177630_2_.getSizeInventory()), itemstack); } - else - { - for (int l = 0; l < k; ++l) - { -- ItemStack itemstack1 = weightedrandomchestcontent.field_76297_b.func_77946_l(); -- itemstack1.field_77994_a = 1; -- p_177630_2_.func_70299_a(p_177630_0_.nextInt(p_177630_2_.func_70302_i_()), itemstack1); +- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); +- itemstack1.stackSize = 1; +- p_177630_2_.setInventorySlotContents(random.nextInt(p_177630_2_.getSizeInventory()), itemstack1); - } - } } @@ -29,24 +29,24 @@ @@ -63,23 +52,12 @@ for (int j = 0; j < p_177631_3_; ++j) { - WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.func_76271_a(p_177631_0_, p_177631_1_); -- int k = weightedrandomchestcontent.field_76295_d + p_177631_0_.nextInt(weightedrandomchestcontent.field_76296_e - weightedrandomchestcontent.field_76295_d + 1); -+ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(p_177631_0_, p_177631_2_); + WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, p_177631_1_); +- int k = weightedrandomchestcontent.theMinimumChanceToGenerateItem + random.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1); ++ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, dispenser); -- if (weightedrandomchestcontent.field_76297_b.func_77976_d() >= k) +- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= k) + for (ItemStack itemstack : stacks) { -- ItemStack itemstack = weightedrandomchestcontent.field_76297_b.func_77946_l(); -- itemstack.field_77994_a = k; - p_177631_2_.func_70299_a(p_177631_0_.nextInt(p_177631_2_.func_70302_i_()), itemstack); +- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); +- itemstack.stackSize = k; + dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack); } - else - { - for (int l = 0; l < k; ++l) - { -- ItemStack itemstack1 = weightedrandomchestcontent.field_76297_b.func_77946_l(); -- itemstack1.field_77994_a = 1; -- p_177631_2_.func_70299_a(p_177631_0_.nextInt(p_177631_2_.func_70302_i_()), itemstack1); +- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); +- itemstack1.stackSize = 1; +- dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack1); - } - } } @@ -67,6 +67,6 @@ + */ + protected ItemStack[] generateChestContent(Random random, IInventory newInventory) + { -+ return net.minecraftforge.common.ChestGenHooks.generateStacks(random, field_76297_b, field_76295_d, field_76296_e); ++ return net.minecraftforge.common.ChestGenHooks.generateStacks(random, theItemId, theMinimumChanceToGenerateItem, theMaximumChanceToGenerateItem); + } } diff --git a/patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch b/patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch new file mode 100644 index 000000000..4f50d372d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch @@ -0,0 +1,61 @@ +--- ../src-base/minecraft/net/minecraft/world/ChunkCache.java ++++ ../src-work/minecraft/net/minecraft/world/ChunkCache.java +@@ -64,6 +64,8 @@ + { + int i = (pos.getX() >> 4) - this.chunkX; + int j = (pos.getZ() >> 4) - this.chunkZ; ++ if (i < 0 || i >= chunkArray.length || j < 0 || j >= chunkArray[i].length) return null; ++ if (chunkArray[i][j] == null) return null; + return this.chunkArray[i][j].getTileEntity(pos, Chunk.EnumCreateEntityType.IMMEDIATE); + } + +@@ -87,6 +89,7 @@ + { + int i = (pos.getX() >> 4) - this.chunkX; + int j = (pos.getZ() >> 4) - this.chunkZ; ++ if (i < 0 || i >= chunkArray.length || j < 0 || i >= chunkArray[i].length) return Blocks.air.getDefaultState(); + + if (i >= 0 && i < this.chunkArray.length && j >= 0 && j < this.chunkArray[i].length) + { +@@ -147,6 +150,8 @@ + { + i = (pos.getX() >> 4) - this.chunkX; + int j = (pos.getZ() >> 4) - this.chunkZ; ++ if (i < 0 || i >= chunkArray.length || j < 0 || j >= chunkArray[i].length) return p_175629_1_.defaultLightValue; ++ if (chunkArray[i][j] == null) return p_175629_1_.defaultLightValue; + return this.chunkArray[i][j].getLightFor(p_175629_1_, pos); + } + } +@@ -158,7 +163,7 @@ + + public boolean isAirBlock(BlockPos pos) + { +- return this.getBlockState(pos).getBlock().getMaterial() == Material.air; ++ return this.getBlockState(pos).getBlock().isAir(this, pos); + } + + @SideOnly(Side.CLIENT) +@@ -168,6 +173,7 @@ + { + int i = (pos.getX() >> 4) - this.chunkX; + int j = (pos.getZ() >> 4) - this.chunkZ; ++ if (i < 0 || i >= chunkArray.length || j < 0 || i >= chunkArray[i].length) return p_175628_1_.defaultLightValue; + return this.chunkArray[i][j].getLightFor(p_175628_1_, pos); + } + else +@@ -187,4 +193,15 @@ + { + return this.worldObj.getWorldType(); + } ++ ++ @Override ++ public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) ++ { ++ int x = (pos.getX() >> 4) - this.chunkX; ++ int z = (pos.getZ() >> 4) - this.chunkZ; ++ if (pos.getY() >= 0 && pos.getY() < 256) return _default; ++ if (x < 0 || x >= chunkArray.length || z < 0 || x >= chunkArray[x].length) return _default; ++ ++ return getBlockState(pos).getBlock().isSideSolid(this, pos, side); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch b/patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch new file mode 100644 index 000000000..36ea6a9b2 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch @@ -0,0 +1,52 @@ +--- ../src-base/minecraft/net/minecraft/world/Explosion.java ++++ ../src-work/minecraft/net/minecraft/world/Explosion.java +@@ -40,6 +40,7 @@ + private final List affectedBlockPositions; + private final Map field_77288_k; + private static final String __OBFID = "CL_00000134"; ++ private final Vec3 position; + + @SideOnly(Side.CLIENT) + public Explosion(World worldIn, Entity p_i45752_2_, double p_i45752_3_, double p_i45752_5_, double p_i45752_7_, float p_i45752_9_, List p_i45752_10_) +@@ -67,6 +68,7 @@ + this.explosionZ = p_i45754_7_; + this.isFlaming = p_i45754_10_; + this.isSmoking = p_i45754_11_; ++ this.position = new Vec3(explosionX, explosionY, explosionZ); + } + + public void doExplosionA() +@@ -103,7 +105,7 @@ + + if (iblockstate.getBlock().getMaterial() != Material.air) + { +- float f2 = this.exploder != null ? this.exploder.getExplosionResistance(this, this.worldObj, blockpos, iblockstate) : iblockstate.getBlock().getExplosionResistance((Entity)null); ++ float f2 = this.exploder != null ? this.exploder.getExplosionResistance(this, this.worldObj, blockpos, iblockstate) : iblockstate.getBlock().getExplosionResistance(worldObj, blockpos, (Entity)null, this); + f -= (f2 + 0.3F) * 0.3F; + } + +@@ -130,6 +132,7 @@ + int k1 = MathHelper.floor_double(this.explosionZ - (double)f3 - 1.0D); + int i1 = MathHelper.floor_double(this.explosionZ + (double)f3 + 1.0D); + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, new AxisAlignedBB((double)j, (double)j1, (double)k1, (double)k, (double)l, (double)i1)); ++ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.worldObj, this, list, f3); + Vec3 vec3 = new Vec3(this.explosionX, this.explosionY, this.explosionZ); + + for (int l1 = 0; l1 < list.size(); ++l1) +@@ -223,8 +226,7 @@ + block.dropBlockAsItemWithChance(this.worldObj, blockpos, this.worldObj.getBlockState(blockpos), 1.0F / this.explosionSize, 0); + } + +- this.worldObj.setBlockState(blockpos, Blocks.air.getDefaultState(), 3); +- block.onBlockDestroyedByExplosion(this.worldObj, blockpos, this); ++ block.onBlockExploded(this.worldObj, blockpos, this); + } + } + } +@@ -264,4 +266,6 @@ + { + return this.affectedBlockPositions; + } ++ ++ public Vec3 getPosition(){ return this.position; } + } diff --git a/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch b/patches.mcp/minecraft/net/minecraft/world/IBlockAccess.java.patch similarity index 93% rename from patches/minecraft/net/minecraft/world/IBlockAccess.java.patch rename to patches.mcp/minecraft/net/minecraft/world/IBlockAccess.java.patch index e6b7d331d..7fb64f305 100644 --- a/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/IBlockAccess.java.patch @@ -3,7 +3,7 @@ @@ -29,4 +29,14 @@ @SideOnly(Side.CLIENT) - WorldType func_175624_G(); + WorldType getWorldType(); + + /** + * FORGE: isSideSolid, pulled up from {@link World} diff --git a/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch b/patches.mcp/minecraft/net/minecraft/world/SpawnerAnimals.java.patch similarity index 65% rename from patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch rename to patches.mcp/minecraft/net/minecraft/world/SpawnerAnimals.java.patch index d7dd9a4d2..8bc35b522 100644 --- a/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/SpawnerAnimals.java.patch @@ -13,16 +13,16 @@ { @@ -80,12 +84,15 @@ - if ((!enumcreaturetype.func_75599_d() || p_77192_3_) && (enumcreaturetype.func_75599_d() || p_77192_2_) && (!enumcreaturetype.func_82705_e() || p_77192_4_)) + if ((!enumcreaturetype.getPeacefulCreature() || p_77192_3_) && (enumcreaturetype.getPeacefulCreature() || p_77192_2_) && (!enumcreaturetype.getAnimal() || p_77192_4_)) { -- i1 = p_77192_1_.func_72907_a(enumcreaturetype.func_75598_a()); +- i1 = p_77192_1_.countEntities(enumcreaturetype.getCreatureClass()); + i1 = p_77192_1_.countEntities(enumcreaturetype, true); - int i4 = enumcreaturetype.func_75601_b() * i / field_180268_a; + int i4 = enumcreaturetype.getMaxNumberOfCreature() * i / MOB_COUNT_DIV; if (i1 <= i4) { - Iterator iterator1 = this.field_77193_b.iterator(); -+ ArrayList tmp = new ArrayList(field_77193_b); + Iterator iterator1 = this.eligibleChunksForSpawning.iterator(); ++ ArrayList tmp = new ArrayList(eligibleChunksForSpawning); + Collections.shuffle(tmp); + iterator1 = tmp.iterator(); label115: @@ -30,31 +30,31 @@ while (iterator1.hasNext()) @@ -153,8 +160,10 @@ - entityliving.func_70012_b((double)f, (double)l2, (double)f1, p_77192_1_.field_73012_v.nextFloat() * 360.0F, 0.0F); + entityliving.setLocationAndAngles((double)f, (double)l2, (double)f1, p_77192_1_.rand.nextFloat() * 360.0F, 0.0F); -- if (entityliving.func_70601_bi() && entityliving.func_70058_J()) +- if (entityliving.getCanSpawnHere() && entityliving.handleLavaMovement()) + Result canSpawn = ForgeEventFactory.canEntitySpawn(entityliving, p_77192_1_, f, l2, f1); -+ if (canSpawn == Result.ALLOW || (canSpawn == Result.DEFAULT && (entityliving.func_70601_bi() && entityliving.func_70058_J()))) ++ if (canSpawn == Result.ALLOW || (canSpawn == Result.DEFAULT && (entityliving.getCanSpawnHere() && entityliving.handleLavaMovement()))) { + if (!ForgeEventFactory.doSpecialSpawn(entityliving, p_77192_1_, f1, l2, f1)) - ientitylivingdata = entityliving.func_180482_a(p_77192_1_.func_175649_E(new BlockPos(entityliving)), ientitylivingdata); + ientitylivingdata = entityliving.func_180482_a(p_77192_1_.getDifficultyForLocation(new BlockPos(entityliving)), ientitylivingdata); - if (entityliving.func_70058_J()) + if (entityliving.handleLavaMovement()) @@ -163,7 +172,7 @@ - p_77192_1_.func_72838_d(entityliving); + p_77192_1_.spawnEntityInWorld(entityliving); } -- if (i2 >= entityliving.func_70641_bl()) +- if (i2 >= entityliving.getMaxSpawnedInChunk()) + if (i2 >= ForgeEventFactory.getMaxSpawnPackSize(entityliving)) { continue label115; } @@ -220,7 +229,7 @@ { - BlockPos blockpos1 = p_180267_2_.func_177977_b(); + BlockPos blockpos1 = pos.down(); -- if (!World.func_175683_a(p_180267_1_, blockpos1)) -+ if (!p_180267_1_.func_180495_p(blockpos1).func_177230_c().canCreatureSpawn(p_180267_1_, blockpos1, p_180267_0_)) +- if (!World.doesBlockHaveSolidTopSurface(worldIn, blockpos1)) ++ if (!worldIn.getBlockState(blockpos1).getBlock().canCreatureSpawn(worldIn, blockpos1, p_180267_0_)) { return false; } diff --git a/patches.mcp/minecraft/net/minecraft/world/World.java.patch b/patches.mcp/minecraft/net/minecraft/world/World.java.patch new file mode 100644 index 000000000..1d9f76d6d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/World.java.patch @@ -0,0 +1,902 @@ +--- ../src-base/minecraft/net/minecraft/world/World.java ++++ ../src-work/minecraft/net/minecraft/world/World.java +@@ -56,8 +56,30 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + ++import net.minecraftforge.fml.common.FMLLog; ++import com.google.common.collect.ImmutableSetMultimap; ++import net.minecraftforge.client.ForgeHooksClient; ++import net.minecraftforge.common.ForgeChunkManager; ++import net.minecraftforge.common.ForgeChunkManager.Ticket; ++import net.minecraftforge.common.ForgeModContainer; ++import net.minecraftforge.common.ForgeHooks; ++import net.minecraftforge.common.MinecraftForge; ++import net.minecraftforge.common.WorldSpecificSaveHandler; ++import net.minecraftforge.event.entity.EntityEvent; ++import net.minecraftforge.event.entity.EntityJoinWorldEvent; ++import net.minecraftforge.event.world.WorldEvent; ++import net.minecraftforge.event.entity.PlaySoundAtEntityEvent; ++import net.minecraft.entity.EnumCreatureType; ++ + public abstract class World implements IBlockAccess + { ++ /** ++ * Used in the getEntitiesWithinAABB functions to expand the search area for entities. ++ * Modders should change this variable to a higher value if it is less then the radius ++ * of one of there entities. ++ */ ++ public static double MAX_ENTITY_RADIUS = 2.0D; ++ + protected boolean scheduledUpdatesAreImmediate; + public final List loadedEntityList = Lists.newArrayList(); + protected final List unloadedEntityList = Lists.newArrayList(); +@@ -99,6 +121,10 @@ + int[] lightUpdateBlockList; + private static final String __OBFID = "CL_00000140"; + ++ public boolean restoringBlockSnapshots = false; ++ public boolean captureBlockSnapshots = false; ++ public ArrayList capturedBlockSnapshots = new ArrayList(); ++ + protected World(ISaveHandler saveHandlerIn, WorldInfo info, WorldProvider providerIn, Profiler profilerIn, boolean client) + { + this.ambientTickCountdown = this.rand.nextInt(12000); +@@ -111,6 +137,7 @@ + this.provider = providerIn; + this.isRemote = client; + this.worldBorder = providerIn.getWorldBorder(); ++ perWorldStorage = new MapStorage((ISaveHandler)null); + } + + public World init() +@@ -120,6 +147,11 @@ + + public BiomeGenBase getBiomeGenForCoords(final BlockPos pos) + { ++ return this.provider.getBiomeGenForCoords(pos); ++ } ++ ++ public BiomeGenBase getBiomeGenForCoordsBody(final BlockPos pos) ++ { + if (this.isBlockLoaded(pos)) + { + Chunk chunk = this.getChunkFromBlockCoords(pos); +@@ -186,7 +218,7 @@ + + public boolean isAirBlock(BlockPos pos) + { +- return this.getBlockState(pos).getBlock().getMaterial() == Material.air; ++ return this.getBlockState(pos).getBlock().isAir(this, pos); + } + + public boolean isBlockLoaded(BlockPos pos) +@@ -286,39 +318,58 @@ + { + Chunk chunk = this.getChunkFromBlockCoords(pos); + Block block = newState.getBlock(); ++ ++ net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null; ++ if (this.captureBlockSnapshots && !this.isRemote) ++ { ++ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, pos, flags); ++ this.capturedBlockSnapshots.add(blockSnapshot); ++ } ++ int oldLight = getBlockState(pos).getBlock().getLightValue(this, pos); ++ + IBlockState iblockstate1 = chunk.setBlockState(pos, newState); + + if (iblockstate1 == null) + { ++ if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot); + return false; + } + else + { + Block block1 = iblockstate1.getBlock(); + +- if (block.getLightOpacity() != block1.getLightOpacity() || block.getLightValue() != block1.getLightValue()) ++ if (block.getLightOpacity() != block1.getLightOpacity() || block.getLightValue(this, pos) != oldLight) + { + this.theProfiler.startSection("checkLight"); + this.checkLight(pos); + this.theProfiler.endSection(); + } + +- if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && chunk.isPopulated()) ++ if (blockSnapshot == null) // Don't notify clients or update physics while capturing blockstates + { +- this.markBlockForUpdate(pos); ++ this.markAndNotifyBlock(pos, chunk, iblockstate1, newState, flags); // Modularize client and physic updates + } + +- if (!this.isRemote && (flags & 1) != 0) +- { +- this.notifyNeighborsRespectDebug(pos, iblockstate1.getBlock()); ++ return true; ++ } ++ } ++ } + +- if (block.hasComparatorInputOverride()) +- { +- this.updateComparatorOutputLevel(pos, block); +- } +- } ++ // Split off from original setBlockState(BlockPos, IBlockState Block p_147465_4_, int) method in order to directly send client and physic updates ++ public void markAndNotifyBlock(BlockPos pos, Chunk chunk, IBlockState old, IBlockState new_, int flags) ++ { ++ if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && (chunk == null || chunk.isPopulated())) ++ { ++ this.markBlockForUpdate(pos); ++ } + +- return true; ++ if (!this.isRemote && (flags & 1) != 0) ++ { ++ this.notifyNeighborsRespectDebug(pos, old.getBlock()); ++ ++ if (new_.getBlock().hasComparatorInputOverride()) ++ { ++ this.updateComparatorOutputLevel(pos, new_.getBlock()); + } + } + } +@@ -408,6 +459,9 @@ + + public void notifyNeighborsOfStateChange(BlockPos pos, Block blockType) + { ++ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, pos, this.getBlockState(pos), java.util.EnumSet.allOf(EnumFacing.class)).isCanceled()) ++ return; ++ + this.notifyBlockOfStateChange(pos.west(), blockType); + this.notifyBlockOfStateChange(pos.east(), blockType); + this.notifyBlockOfStateChange(pos.down(), blockType); +@@ -418,6 +472,11 @@ + + public void notifyNeighborsOfStateExcept(BlockPos pos, Block blockType, EnumFacing skipSide) + { ++ java.util.EnumSet directions = java.util.EnumSet.allOf(EnumFacing.class); ++ directions.remove(skipSide); ++ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, pos, this.getBlockState(pos), directions).isCanceled()) ++ return; ++ + if (skipSide != EnumFacing.WEST) + { + this.notifyBlockOfStateChange(pos.west(), blockType); +@@ -782,7 +841,7 @@ + + public boolean isDaytime() + { +- return this.skylightSubtracted < 4; ++ return this.provider.isDaytime(); + } + + public MovingObjectPosition rayTraceBlocks(Vec3 p_72933_1_, Vec3 p_72933_2_) +@@ -978,6 +1037,11 @@ + + public void playSoundAtEntity(Entity p_72956_1_, String p_72956_2_, float p_72956_3_, float p_72956_4_) + { ++ PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_72956_1_, p_72956_2_, p_72956_3_, p_72956_4_); ++ if (event.isCanceled() || event.name == null) return; ++ p_72956_2_ = event.name; ++ p_72956_3_ = event.newVolume; ++ p_72956_4_ = event.newPitch; + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).playSound(p_72956_2_, p_72956_1_.posX, p_72956_1_.posY, p_72956_1_.posZ, p_72956_3_, p_72956_4_); +@@ -986,6 +1050,11 @@ + + public void playSoundToNearExcept(EntityPlayer p_85173_1_, String p_85173_2_, float p_85173_3_, float p_85173_4_) + { ++ PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_85173_1_, p_85173_2_, p_85173_3_, p_85173_4_); ++ if (event.isCanceled() || event.name == null) return; ++ p_85173_2_ = event.name; ++ p_85173_3_ = event.newVolume; ++ p_85173_4_ = event.newPitch; + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).playSoundToNearExcept(p_85173_1_, p_85173_2_, p_85173_1_.posX, p_85173_1_.posY, p_85173_1_.posZ, p_85173_3_, p_85173_4_); +@@ -1037,6 +1106,9 @@ + + public boolean spawnEntityInWorld(Entity p_72838_1_) + { ++ // do not drop any items while restoring blocksnapshots. Prevents dupes ++ if (!this.isRemote && (p_72838_1_ == null || (p_72838_1_ instanceof net.minecraft.entity.item.EntityItem && this.restoringBlockSnapshots))) return false; ++ + int i = MathHelper.floor_double(p_72838_1_.posX / 16.0D); + int j = MathHelper.floor_double(p_72838_1_.posZ / 16.0D); + boolean flag = p_72838_1_.forceSpawn; +@@ -1059,6 +1131,8 @@ + this.updateAllPlayersSleepingFlag(); + } + ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_72838_1_, this)) && !flag) return false; ++ + this.getChunkFromChunkCoords(i, j).addEntity(p_72838_1_); + this.loadedEntityList.add(p_72838_1_); + this.onEntityAdded(p_72838_1_); +@@ -1271,17 +1345,29 @@ + + public int calculateSkylightSubtracted(float p_72967_1_) + { ++ float f2 = provider.getSunBrightnessFactor(p_72967_1_); ++ f2 = 1.0F - f2; ++ return (int)(f2 * 11.0F); ++ } ++ ++ /** ++ * The current sun brightness factor for this dimension. ++ * 0.0f means no light at all, and 1.0f means maximum sunlight. ++ * Highly recommended for sunlight detection like solar panel. ++ * ++ * @return The current brightness factor ++ * */ ++ public float getSunBrightnessFactor(float p_72967_1_) ++ { + float f1 = this.getCelestialAngle(p_72967_1_); + float f2 = 1.0F - (MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F); + f2 = MathHelper.clamp_float(f2, 0.0F, 1.0F); + f2 = 1.0F - f2; + f2 = (float)((double)f2 * (1.0D - (double)(this.getRainStrength(p_72967_1_) * 5.0F) / 16.0D)); + f2 = (float)((double)f2 * (1.0D - (double)(this.getThunderStrength(p_72967_1_) * 5.0F) / 16.0D)); +- f2 = 1.0F - f2; +- return (int)(f2 * 11.0F); ++ return f2; + } + +- @SideOnly(Side.CLIENT) + public void removeWorldAccess(IWorldAccess p_72848_1_) + { + this.worldAccesses.remove(p_72848_1_); +@@ -1290,6 +1376,12 @@ + @SideOnly(Side.CLIENT) + public float getSunBrightness(float p_72971_1_) + { ++ return this.provider.getSunBrightness(p_72971_1_); ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public float getSunBrightnessBody(float p_72971_1_) ++ { + float f1 = this.getCelestialAngle(p_72971_1_); + float f2 = 1.0F - (MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.2F); + f2 = MathHelper.clamp_float(f2, 0.0F, 1.0F); +@@ -1302,6 +1394,12 @@ + @SideOnly(Side.CLIENT) + public Vec3 getSkyColor(Entity p_72833_1_, float p_72833_2_) + { ++ return this.provider.getSkyColor(p_72833_1_, p_72833_2_); ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public Vec3 getSkyColorBody(Entity p_72833_1_, float p_72833_2_) ++ { + float f1 = this.getCelestialAngle(p_72833_2_); + float f2 = MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; + f2 = MathHelper.clamp_float(f2, 0.0F, 1.0F); +@@ -1309,9 +1407,7 @@ + int j = MathHelper.floor_double(p_72833_1_.posY); + int k = MathHelper.floor_double(p_72833_1_.posZ); + BlockPos blockpos = new BlockPos(i, j, k); +- BiomeGenBase biomegenbase = this.getBiomeGenForCoords(blockpos); +- float f3 = biomegenbase.getFloatTemperature(blockpos); +- int l = biomegenbase.getSkyColorByTemp(f3); ++ int l = net.minecraftforge.client.ForgeHooksClient.getSkyBlendColour(this, blockpos); + float f4 = (float)(l >> 16 & 255) / 255.0F; + float f5 = (float)(l >> 8 & 255) / 255.0F; + float f6 = (float)(l & 255) / 255.0F; +@@ -1373,6 +1469,11 @@ + + public float getCurrentMoonPhaseFactor() + { ++ return provider.getCurrentMoonPhaseFactor(); ++ } ++ ++ public float getCurrentMoonPhaseFactorBody() ++ { + return WorldProvider.moonPhaseFactors[this.provider.getMoonPhase(this.worldInfo.getWorldTime())]; + } + +@@ -1385,6 +1486,12 @@ + @SideOnly(Side.CLIENT) + public Vec3 getCloudColour(float p_72824_1_) + { ++ return this.provider.drawClouds(p_72824_1_); ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public Vec3 drawCloudsBody(float p_72824_1_) ++ { + float f1 = this.getCelestialAngle(p_72824_1_); + float f2 = MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; + f2 = MathHelper.clamp_float(f2, 0.0F, 1.0F); +@@ -1442,9 +1549,9 @@ + for (blockpos1 = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos1.getY() >= 0; blockpos1 = blockpos2) + { + blockpos2 = blockpos1.down(); +- Material material = chunk.getBlock(blockpos2).getMaterial(); ++ Block block = chunk.getBlock(blockpos2); + +- if (material.blocksMovement() && material != Material.leaves) ++ if (block.getMaterial().blocksMovement() && !block.isLeaves(this, blockpos2) && !block.isFoliage(this, blockpos2)) + { + break; + } +@@ -1456,6 +1563,12 @@ + @SideOnly(Side.CLIENT) + public float getStarBrightness(float p_72880_1_) + { ++ return this.provider.getStarBrightness(p_72880_1_); ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public float getStarBrightnessBody(float p_72880_1_) ++ { + float f1 = this.getCelestialAngle(p_72880_1_); + float f2 = 1.0F - (MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.25F); + f2 = MathHelper.clamp_float(f2, 0.0F, 1.0F); +@@ -1500,7 +1613,15 @@ + entity.addEntityCrashInfo(crashreportcategory); + } + +- throw new ReportedException(crashreport); ++ if (ForgeModContainer.removeErroringEntities) ++ { ++ FMLLog.severe(crashreport.getCompleteReport()); ++ removeEntity(entity); ++ } ++ else ++ { ++ throw new ReportedException(crashreport); ++ } + } + + if (entity.isDead) +@@ -1562,7 +1683,16 @@ + crashreport = CrashReport.makeCrashReport(throwable1, "Ticking entity"); + crashreportcategory = crashreport.makeCategory("Entity being ticked"); + entity.addEntityCrashInfo(crashreportcategory); +- throw new ReportedException(crashreport); ++ if (ForgeModContainer.removeErroringEntities) ++ { ++ FMLLog.severe(crashreport.getCompleteReport()); ++ removeEntity(entity); ++ } ++ else ++ { ++ throw new ReportedException(crashreport); ++ } ++ + } + } + +@@ -1609,7 +1739,16 @@ + CrashReport crashreport1 = CrashReport.makeCrashReport(throwable, "Ticking block entity"); + CrashReportCategory crashreportcategory1 = crashreport1.makeCategory("Block entity being ticked"); + tileentity.addInfoToCrashReport(crashreportcategory1); +- throw new ReportedException(crashreport1); ++ if (ForgeModContainer.removeErroringTileEntities) ++ { ++ FMLLog.severe(crashreport1.getCompleteReport()); ++ tileentity.invalidate(); ++ this.removeTileEntity(tileentity.getPos()); ++ } ++ else ++ { ++ throw new ReportedException(crashreport1); ++ } + } + } + } +@@ -1626,15 +1765,19 @@ + } + } + +- this.processingLoadedTiles = false; +- + if (!this.tileEntitiesToBeRemoved.isEmpty()) + { ++ for (Object tile : tileEntitiesToBeRemoved) ++ { ++ ((TileEntity)tile).onChunkUnload(); ++ } + this.tickableTileEntities.removeAll(this.tileEntitiesToBeRemoved); + this.loadedTileEntityList.removeAll(this.tileEntitiesToBeRemoved); + this.tileEntitiesToBeRemoved.clear(); + } + ++ this.processingLoadedTiles = false; //FML Move below remove to prevent CMEs ++ + this.theProfiler.endStartSection("pendingBlockEntities"); + + if (!this.addedTileEntityList.isEmpty()) +@@ -1668,7 +1811,8 @@ + + public boolean addTileEntity(TileEntity tile) + { +- boolean flag = this.loadedTileEntityList.add(tile); ++ List dest = processingLoadedTiles ? addedTileEntityList : loadedTileEntityList; ++ boolean flag = dest.add(tile); + + if (flag && tile instanceof IUpdatePlayerListBox) + { +@@ -1710,9 +1854,12 @@ + { + int i = MathHelper.floor_double(p_72866_1_.posX); + int j = MathHelper.floor_double(p_72866_1_.posZ); +- byte b0 = 32; ++ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(i >> 4, j >> 4)); ++ byte b0 = isForced ? (byte)0 : 32; ++ boolean canUpdate = !p_72866_2_ || this.isAreaLoaded(i - b0, 0, j - b0, i + b0, 0, j + b0, true); ++ if (!canUpdate) canUpdate = net.minecraftforge.event.ForgeEventFactory.canEntityUpdate(p_72866_1_); + +- if (!p_72866_2_ || this.isAreaLoaded(i - b0, 0, j - b0, i + b0, 0, j + b0, true)) ++ if (canUpdate) + { + p_72866_1_.lastTickPosX = p_72866_1_.posX; + p_72866_1_.lastTickPosY = p_72866_1_.posY; +@@ -1839,7 +1986,7 @@ + { + Block block = this.getBlockState(new BlockPos(k1, l1, i2)).getBlock(); + +- if (block.getMaterial() != Material.air) ++ if (!block.isAir(this, new BlockPos(k1, l1, i2))) + { + return true; + } +@@ -1901,6 +2048,10 @@ + { + return true; + } ++ else if (block.isBurning(this, new BlockPos(k1, l1, i2))) ++ { ++ return true; ++ } + } + } + } +@@ -2039,6 +2190,7 @@ + public Explosion newExplosion(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) + { + Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_); ++ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; + explosion.doExplosionA(); + explosion.doExplosionB(true); + return explosion; +@@ -2185,19 +2337,28 @@ + else + { + this.addTileEntity(tileEntityIn); +- this.getChunkFromBlockCoords(pos).addTileEntity(pos, tileEntityIn); ++ Chunk chunk = this.getChunkFromBlockCoords(pos); //Forge add NPE protection ++ if (chunk != null) chunk.addTileEntity(pos, tileEntityIn); + } ++ this.updateComparatorOutputLevel(pos, getBlockState(pos).getBlock()); //Notify neighbors of changes + } + } + + public void removeTileEntity(BlockPos pos) + { ++ //Chunk chunk = this.getChunkFromBlockCoords(pos); ++ //if (chunk != null) chunk.removeTileEntity(pos); ++ //Forge ToDO: Are these patches needed anymore? ++ + TileEntity tileentity = this.getTileEntity(pos); + + if (tileentity != null && this.processingLoadedTiles) + { + tileentity.invalidate(); + this.addedTileEntityList.remove(tileentity); ++ if (!(tileentity instanceof IUpdatePlayerListBox)) //Forge: If they are not tickable they wont be removed in the update loop. ++ this.loadedTileEntityList.remove(tileentity); ++ + } + else + { +@@ -2210,6 +2371,7 @@ + + this.getChunkFromBlockCoords(pos).removeTileEntity(pos); + } ++ this.updateComparatorOutputLevel(pos, getBlockState(pos).getBlock()); //Notify neighbors of changes + } + + public void markTileEntityForRemoval(TileEntity tileEntityIn) +@@ -2228,7 +2390,7 @@ + { + IBlockState iblockstate = p_175683_0_.getBlockState(p_175683_1_); + Block block = iblockstate.getBlock(); +- return block.getMaterial().isOpaque() && block.isFullCube() ? true : (block instanceof BlockStairs ? iblockstate.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP : (block instanceof BlockSlab ? iblockstate.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? ((Integer)iblockstate.getValue(BlockSnow.LAYERS)).intValue() == 7 : false)))); ++ return block.isSideSolid(p_175683_0_, p_175683_1_, EnumFacing.UP); + } + + public boolean isBlockNormalCube(BlockPos p_175677_1_, boolean p_175677_2_) +@@ -2248,7 +2410,7 @@ + else + { + Block block = this.getBlockState(p_175677_1_).getBlock(); +- return block.getMaterial().isOpaque() && block.isFullCube(); ++ return block.isNormalCube(this, p_175677_1_); + } + } + } +@@ -2265,8 +2427,7 @@ + + public void setAllowedSpawnTypes(boolean hostile, boolean peaceful) + { +- this.spawnHostileMobs = hostile; +- this.spawnPeacefulMobs = peaceful; ++ this.provider.setAllowedSpawnTypes(hostile, peaceful); + } + + public void tick() +@@ -2276,6 +2437,11 @@ + + protected void calculateInitialWeather() + { ++ this.provider.calculateInitialWeather(); ++ } ++ ++ public void calculateInitialWeatherBody() ++ { + if (this.worldInfo.isRaining()) + { + this.rainingStrength = 1.0F; +@@ -2289,6 +2455,11 @@ + + protected void updateWeather() + { ++ this.provider.updateWeather(); ++ } ++ ++ public void updateWeatherBody() ++ { + if (!this.provider.getHasNoSky()) + { + if (!this.isRemote) +@@ -2383,6 +2554,7 @@ + { + this.activeChunkSet.clear(); + this.theProfiler.startSection("buildList"); ++ this.activeChunkSet.addAll(getPersistentChunks().keySet()); + int i; + EntityPlayer entityplayer; + int j; +@@ -2445,7 +2617,7 @@ + l += p_147467_1_; + i1 += p_147467_2_; + +- if (block.getMaterial() == Material.air && this.getLight(blockpos) <= this.rand.nextInt(8) && this.getLightFor(EnumSkyBlock.SKY, blockpos) <= 0) ++ if (block.isAir(this, blockpos) && this.getLight(blockpos) <= this.rand.nextInt(8) && this.getLightFor(EnumSkyBlock.SKY, blockpos) <= 0) + { + EntityPlayer entityplayer = this.getClosestPlayer((double)l + 0.5D, (double)j1 + 0.5D, (double)i1 + 0.5D, 8.0D); + +@@ -2485,6 +2657,11 @@ + + public boolean canBlockFreeze(BlockPos pos, boolean noWaterAdj) + { ++ return this.provider.canBlockFreeze(pos, noWaterAdj); ++ } ++ ++ public boolean canBlockFreezeBody(BlockPos pos, boolean noWaterAdj) ++ { + BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); + float f = biomegenbase.getFloatTemperature(pos); + +@@ -2526,6 +2703,11 @@ + + public boolean canSnowAt(BlockPos pos, boolean checkLight) + { ++ return this.provider.canSnowAt(pos, checkLight); ++ } ++ ++ public boolean canSnowAtBody(BlockPos pos, boolean checkLight) ++ { + BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); + float f = biomegenbase.getFloatTemperature(pos); + +@@ -2543,7 +2725,7 @@ + { + Block block = this.getBlockState(pos).getBlock(); + +- if (block.getMaterial() == Material.air && Blocks.snow_layer.canPlaceBlockAt(this, pos)) ++ if (block.isAir(this, pos) && Blocks.snow_layer.canPlaceBlockAt(this, pos)) + { + return true; + } +@@ -2575,10 +2757,11 @@ + else + { + Block block = this.getBlockState(pos).getBlock(); +- int i = lightType == EnumSkyBlock.SKY ? 0 : block.getLightValue(); +- int j = block.getLightOpacity(); ++ int blockLight = block.getLightValue(this, pos); ++ int i = lightType == EnumSkyBlock.SKY ? 0 : blockLight; ++ int j = block.getLightOpacity(this, pos); + +- if (j >= 15 && block.getLightValue() > 0) ++ if (j >= 15 && blockLight > 0) + { + j = 1; + } +@@ -2792,10 +2975,10 @@ + public List func_175674_a(Entity entityIn, AxisAlignedBB p_175674_2_, Predicate p_175674_3_) + { + ArrayList arraylist = Lists.newArrayList(); +- int i = MathHelper.floor_double((p_175674_2_.minX - 2.0D) / 16.0D); +- int j = MathHelper.floor_double((p_175674_2_.maxX + 2.0D) / 16.0D); +- int k = MathHelper.floor_double((p_175674_2_.minZ - 2.0D) / 16.0D); +- int l = MathHelper.floor_double((p_175674_2_.maxZ + 2.0D) / 16.0D); ++ int i = MathHelper.floor_double((p_175674_2_.minX - MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.floor_double((p_175674_2_.maxX + MAX_ENTITY_RADIUS) / 16.0D); ++ int k = MathHelper.floor_double((p_175674_2_.minZ - MAX_ENTITY_RADIUS) / 16.0D); ++ int l = MathHelper.floor_double((p_175674_2_.maxZ + MAX_ENTITY_RADIUS) / 16.0D); + + for (int i1 = i; i1 <= j; ++i1) + { +@@ -2854,10 +3037,10 @@ + + public List getEntitiesWithinAABB(Class clazz, AxisAlignedBB aabb, Predicate filter) + { +- int i = MathHelper.floor_double((aabb.minX - 2.0D) / 16.0D); +- int j = MathHelper.floor_double((aabb.maxX + 2.0D) / 16.0D); +- int k = MathHelper.floor_double((aabb.minZ - 2.0D) / 16.0D); +- int l = MathHelper.floor_double((aabb.maxZ + 2.0D) / 16.0D); ++ int i = MathHelper.floor_double((aabb.minX - MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.floor_double((aabb.maxX + MAX_ENTITY_RADIUS) / 16.0D); ++ int k = MathHelper.floor_double((aabb.minZ - MAX_ENTITY_RADIUS) / 16.0D); ++ int l = MathHelper.floor_double((aabb.maxZ + MAX_ENTITY_RADIUS) / 16.0D); + ArrayList arraylist = Lists.newArrayList(); + + for (int i1 = i; i1 <= j; ++i1) +@@ -2938,13 +3121,16 @@ + + public void loadEntities(Collection entityCollection) + { +- this.loadedEntityList.addAll(entityCollection); + Iterator iterator = entityCollection.iterator(); + + while (iterator.hasNext()) + { + Entity entity = (Entity)iterator.next(); +- this.onEntityAdded(entity); ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entity, this))) ++ { ++ loadedEntityList.add(entity); ++ this.onEntityAdded(entity); ++ } + } + } + +@@ -2957,7 +3143,9 @@ + { + Block block1 = this.getBlockState(p_175716_2_).getBlock(); + AxisAlignedBB axisalignedbb = p_175716_3_ ? null : p_175716_1_.getCollisionBoundingBox(this, p_175716_2_, p_175716_1_.getDefaultState()); +- return axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, p_175716_5_) ? false : (block1.getMaterial() == Material.circuits && p_175716_1_ == Blocks.anvil ? true : block1.getMaterial().isReplaceable() && p_175716_1_.canReplace(this, p_175716_2_, p_175716_4_, p_175716_6_)); ++ if (axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, p_175716_5_)) return false; ++ if (block1.getMaterial() == Material.circuits && p_175716_1_ == Blocks.anvil) return true; ++ return block1.isReplaceable(this, p_175716_2_) && p_175716_1_.canReplace(this, p_175716_2_, p_175716_4_, p_175716_6_); + } + + public int getStrongPower(BlockPos pos, EnumFacing direction) +@@ -3032,7 +3220,7 @@ + { + IBlockState iblockstate = this.getBlockState(pos); + Block block = iblockstate.getBlock(); +- return block.isNormalCube() ? this.getStrongPower(pos) : block.isProvidingWeakPower(this, pos, iblockstate, facing); ++ return block.shouldCheckWeakPower(this, pos, facing) ? this.getStrongPower(pos) : block.isProvidingWeakPower(this, pos, iblockstate, facing); + } + + public boolean isBlockPowered(BlockPos pos) +@@ -3160,7 +3348,7 @@ + + public long getSeed() + { +- return this.worldInfo.getSeed(); ++ return this.provider.getSeed(); + } + + public long getTotalWorldTime() +@@ -3170,17 +3358,17 @@ + + public long getWorldTime() + { +- return this.worldInfo.getWorldTime(); ++ return this.provider.getWorldTime(); + } + + public void setWorldTime(long time) + { +- this.worldInfo.setWorldTime(time); ++ this.provider.setWorldTime(time); + } + + public BlockPos getSpawnPoint() + { +- BlockPos blockpos = new BlockPos(this.worldInfo.getSpawnX(), this.worldInfo.getSpawnY(), this.worldInfo.getSpawnZ()); ++ BlockPos blockpos = this.provider.getSpawnPoint(); + + if (!this.getWorldBorder().contains(blockpos)) + { +@@ -3192,7 +3380,7 @@ + + public void setSpawnPoint(BlockPos pos) + { +- this.worldInfo.setSpawn(pos); ++ this.provider.setSpawnPoint(pos); + } + + @SideOnly(Side.CLIENT) +@@ -3212,12 +3400,18 @@ + + if (!this.loadedEntityList.contains(entityIn)) + { ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entityIn, this))) + this.loadedEntityList.add(entityIn); + } + } + + public boolean isBlockModifiable(EntityPlayer player, BlockPos pos) + { ++ return this.provider.canMineBlock(player, pos); ++ } ++ ++ public boolean canMineBlockBody(EntityPlayer player, BlockPos pos) ++ { + return true; + } + +@@ -3307,8 +3501,7 @@ + + public boolean isBlockinHighHumidity(BlockPos pos) + { +- BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); +- return biomegenbase.isHighHumidity(); ++ return this.provider.isBlockHighHumidity(pos); + } + + public MapStorage getMapStorage() +@@ -3367,12 +3560,12 @@ + + public int getHeight() + { +- return 256; ++ return this.provider.getHeight(); + } + + public int getActualHeight() + { +- return this.provider.getHasNoSky() ? 128 : 256; ++ return this.provider.getActualHeight(); + } + + public Random setRandomSeed(int p_72843_1_, int p_72843_2_, int p_72843_3_) +@@ -3429,7 +3622,7 @@ + @SideOnly(Side.CLIENT) + public double getHorizon() + { +- return this.worldInfo.getTerrainType() == WorldType.FLAT ? 0.0D : 63.0D; ++ return provider.getHorizon(); + } + + public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress) +@@ -3461,29 +3654,21 @@ + + public void updateComparatorOutputLevel(BlockPos pos, Block blockIn) + { +- Iterator iterator = EnumFacing.Plane.HORIZONTAL.iterator(); +- +- while (iterator.hasNext()) ++ for (EnumFacing enumfacing : EnumFacing.values()) + { +- EnumFacing enumfacing = (EnumFacing)iterator.next(); + BlockPos blockpos1 = pos.offset(enumfacing); + + if (this.isBlockLoaded(blockpos1)) + { + IBlockState iblockstate = this.getBlockState(blockpos1); +- +- if (Blocks.unpowered_comparator.isAssociated(iblockstate.getBlock())) ++ iblockstate.getBlock().onNeighborChange(this, blockpos1, pos); ++ if (iblockstate.getBlock().isNormalCube(this, blockpos1)) + { +- iblockstate.getBlock().onNeighborBlockChange(this, blockpos1, iblockstate, blockIn); +- } +- else if (iblockstate.getBlock().isNormalCube()) +- { +- blockpos1 = blockpos1.offset(enumfacing); +- iblockstate = this.getBlockState(blockpos1); +- +- if (Blocks.unpowered_comparator.isAssociated(iblockstate.getBlock())) ++ BlockPos posOther = blockpos1.offset(enumfacing); ++ Block other = getBlockState(posOther).getBlock(); ++ if (other.getWeakChanges(this, posOther)) + { +- iblockstate.getBlock().onNeighborBlockChange(this, blockpos1, iblockstate, blockIn); ++ other.onNeighborChange(this, posOther, pos); + } + } + } +@@ -3553,4 +3738,82 @@ + short short1 = 128; + return k >= -short1 && k <= short1 && l >= -short1 && l <= short1; + } ++ ++ ++ /* ======================================== FORGE START =====================================*/ ++ /** ++ * Determine if the given block is considered solid on the ++ * specified side. Used by placement logic. ++ * ++ * @param pos Block Position ++ * @param side The Side in question ++ * @return True if the side is solid ++ */ ++ public boolean isSideSolid(BlockPos pos, EnumFacing side) ++ { ++ return isSideSolid(pos, side, false); ++ } ++ ++ /** ++ * Determine if the given block is considered solid on the ++ * specified side. Used by placement logic. ++ * ++ * @param pos Block Position ++ * @param side The Side in question ++ * @param _default The default to return if the block doesn't exist. ++ * @return True if the side is solid ++ */ ++ @Override ++ public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) ++ { ++ if (!this.isValid(pos)) return _default; ++ ++ Chunk chunk = getChunkFromBlockCoords(pos); ++ if (chunk == null || chunk.isEmpty()) return _default; ++ return getBlockState(pos).getBlock().isSideSolid(this, pos, side); ++ } ++ ++ /** ++ * Get the persistent chunks for this world ++ * ++ * @return ++ */ ++ public ImmutableSetMultimap getPersistentChunks() ++ { ++ return ForgeChunkManager.getPersistentChunksFor(this); ++ } ++ ++ /** ++ * Readded as it was removed, very useful helper function ++ * ++ * @param pos Block position ++ * @return The blocks light opacity ++ */ ++ public int getBlockLightOpacity(BlockPos pos) ++ { ++ if (!this.isValid(pos)) return 0; ++ return getChunkFromBlockCoords(pos).getBlockLightOpacity(pos); ++ } ++ ++ /** ++ * Returns a count of entities that classify themselves as the specified creature type. ++ */ ++ public int countEntities(EnumCreatureType type, boolean forSpawnCount) ++ { ++ int count = 0; ++ for (int x = 0; x < loadedEntityList.size(); x++) ++ { ++ if (((Entity)loadedEntityList.get(x)).isCreatureType(type, forSpawnCount)) ++ { ++ count++; ++ } ++ } ++ return count; ++ } ++ ++ protected MapStorage perWorldStorage; //Moved to a getter to simulate final without being final so we can load in subclasses. ++ public MapStorage getPerWorldStorage() ++ { ++ return perWorldStorage; ++ } + } diff --git a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch similarity index 61% rename from patches/minecraft/net/minecraft/world/WorldProvider.java.patch rename to patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch index 1a809089e..992abea45 100644 --- a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch @@ -2,62 +2,62 @@ +++ ../src-work/minecraft/net/minecraft/world/WorldProvider.java @@ -52,26 +52,12 @@ - protected void func_76572_b() + protected void registerWorldChunkManager() { -- WorldType worldtype = this.field_76579_a.func_72912_H().func_76067_t(); +- WorldType worldtype = this.worldObj.getWorldInfo().getTerrainType(); - -- if (worldtype == WorldType.field_77138_c) +- if (worldtype == WorldType.FLAT) - { -- FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.func_82651_a(this.field_76579_a.func_72912_H().func_82571_y()); -- this.field_76578_c = new WorldChunkManagerHell(BiomeGenBase.func_180276_a(flatgeneratorinfo.func_82648_a(), BiomeGenBase.field_180279_ad), 0.5F); +- FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.createFlatGeneratorFromString(this.worldObj.getWorldInfo().getGeneratorOptions()); +- this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), BiomeGenBase.field_180279_ad), 0.5F); - } -- else if (worldtype == WorldType.field_180272_g) +- else if (worldtype == WorldType.DEBUG_WORLD) - { -- this.field_76578_c = new WorldChunkManagerHell(BiomeGenBase.field_76772_c, 0.0F); +- this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.plains, 0.0F); - } - else - { -- this.field_76578_c = new WorldChunkManager(this.field_76579_a); +- this.worldChunkMgr = new WorldChunkManager(this.worldObj); - } -+ this.field_76578_c = field_76577_b.getChunkManager(field_76579_a); ++ this.worldChunkMgr = terrainType.getChunkManager(worldObj); } - public IChunkProvider func_76555_c() + public IChunkProvider createChunkGenerator() { -- return (IChunkProvider)(this.field_76577_b == WorldType.field_77138_c ? new ChunkProviderFlat(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c) : (this.field_76577_b == WorldType.field_180272_g ? new ChunkProviderDebug(this.field_76579_a) : (this.field_76577_b == WorldType.field_180271_f ? new ChunkProviderGenerate(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c) : new ChunkProviderGenerate(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c)))); -+ return field_76577_b.getChunkGenerator(field_76579_a, field_82913_c); +- return (IChunkProvider)(this.terrainType == WorldType.FLAT ? new ChunkProviderFlat(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : (this.terrainType == WorldType.DEBUG_WORLD ? new ChunkProviderDebug(this.worldObj) : (this.terrainType == WorldType.CUSTOMIZED ? new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings)))); ++ return terrainType.getChunkGenerator(worldObj, generatorSettings); } - public boolean func_76566_a(int p_76566_1_, int p_76566_2_) + public boolean canCoordinateBeSpawn(int x, int z) @@ -155,13 +141,13 @@ - public static WorldProvider func_76570_a(int p_76570_0_) + public static WorldProvider getProviderForDimension(int dimension) { -- return (WorldProvider)(p_76570_0_ == -1 ? new WorldProviderHell() : (p_76570_0_ == 0 ? new WorldProviderSurface() : (p_76570_0_ == 1 ? new WorldProviderEnd() : null))); -+ return net.minecraftforge.common.DimensionManager.createProviderFor(p_76570_0_); +- return (WorldProvider)(dimension == -1 ? new WorldProviderHell() : (dimension == 0 ? new WorldProviderSurface() : (dimension == 1 ? new WorldProviderEnd() : null))); ++ return net.minecraftforge.common.DimensionManager.createProviderFor(dimension); } @SideOnly(Side.CLIENT) - public float func_76571_f() + public float getCloudHeight() { - return 128.0F; -+ return this.field_76577_b.getCloudHeight(); ++ return this.terrainType.getCloudHeight(); } @SideOnly(Side.CLIENT) @@ -177,13 +163,13 @@ - public int func_76557_i() + public int getAverageGroundLevel() { -- return this.field_76577_b == WorldType.field_77138_c ? 4 : 64; -+ return this.field_76577_b.getMinimumSpawnHeight(this.field_76579_a); +- return this.terrainType == WorldType.FLAT ? 4 : 64; ++ return this.terrainType.getMinimumSpawnHeight(this.worldObj); } @SideOnly(Side.CLIENT) - public double func_76565_k() + public double getVoidFogYFactor() { -- return this.field_76577_b == WorldType.field_77138_c ? 1.0D : 0.03125D; -+ return this.field_76577_b.voidFadeMagnitude(); +- return this.terrainType == WorldType.FLAT ? 1.0D : 0.03125D; ++ return this.terrainType.voidFadeMagnitude(); } @SideOnly(Side.CLIENT) @@ -79,7 +79,7 @@ + */ + public void setDimension(int dim) + { -+ this.field_76574_g = dim; ++ this.dimensionId = dim; + } + + /** @@ -89,7 +89,7 @@ + */ + public String getSaveFolder() + { -+ return (field_76574_g == 0 ? null : "DIM" + field_76574_g); ++ return (dimensionId == 0 ? null : "DIM" + dimensionId); + } + + /** @@ -181,18 +181,18 @@ + + public BlockPos getRandomizedSpawnPoint() + { -+ BlockPos ret = this.field_76579_a.func_175694_M(); ++ BlockPos ret = this.worldObj.getSpawnPoint(); + -+ boolean isAdventure = field_76579_a.func_72912_H().func_76077_q() == WorldSettings.GameType.ADVENTURE; -+ int spawnFuzz = field_76577_b.getSpawnFuzz(); -+ int border = MathHelper.func_76128_c(field_76579_a.func_175723_af().func_177729_b(ret.func_177958_n(), ret.func_177952_p())); ++ boolean isAdventure = worldObj.getWorldInfo().getGameType() == WorldSettings.GameType.ADVENTURE; ++ int spawnFuzz = terrainType.getSpawnFuzz(); ++ int border = MathHelper.floor_double(worldObj.getWorldBorder().getClosestDistance(ret.getX(), ret.getZ())); + if (border < spawnFuzz) spawnFuzz = border; + if (spawnFuzz < 1) spawnFuzz = 1; + int spawnFuzzHalf = spawnFuzz / 2; + -+ if (!func_177495_o() && !isAdventure) ++ if (!getHasNoSky() && !isAdventure) + { -+ ret = field_76579_a.func_175672_r(ret.func_177982_a(field_76579_a.field_73012_v.nextInt(spawnFuzzHalf) - spawnFuzz, 0, field_76579_a.field_73012_v.nextInt(spawnFuzzHalf) - spawnFuzz)); ++ ret = worldObj.getTopSolidOrLiquidBlock(ret.add(worldObj.rand.nextInt(spawnFuzzHalf) - spawnFuzz, 0, worldObj.rand.nextInt(spawnFuzzHalf) - spawnFuzz)); + } + + return ret; @@ -208,7 +208,7 @@ + */ + public boolean shouldMapSpin(String entity, double x, double y, double z) + { -+ return field_76574_g < 0; ++ return dimensionId < 0; + } + + /** @@ -226,12 +226,12 @@ + + public BiomeGenBase getBiomeGenForCoords(BlockPos pos) + { -+ return field_76579_a.getBiomeGenForCoordsBody(pos); ++ return worldObj.getBiomeGenForCoordsBody(pos); + } + + public boolean isDaytime() + { -+ return field_76579_a.func_175657_ab() < 4; ++ return worldObj.getSkylightSubtracted() < 4; + } + + /** @@ -244,7 +244,7 @@ + * */ + public float getSunBrightnessFactor(float par1) + { -+ return field_76579_a.getSunBrightnessFactor(par1); ++ return worldObj.getSunBrightnessFactor(par1); + } + + /** @@ -254,19 +254,19 @@ + * */ + public float getCurrentMoonPhaseFactor() + { -+ return field_76579_a.getCurrentMoonPhaseFactorBody(); ++ return worldObj.getCurrentMoonPhaseFactorBody(); + } + + @SideOnly(Side.CLIENT) + public Vec3 getSkyColor(net.minecraft.entity.Entity cameraEntity, float partialTicks) + { -+ return field_76579_a.getSkyColorBody(cameraEntity, partialTicks); ++ return worldObj.getSkyColorBody(cameraEntity, partialTicks); + } + + @SideOnly(Side.CLIENT) + public Vec3 drawClouds(float partialTicks) + { -+ return field_76579_a.drawCloudsBody(partialTicks); ++ return worldObj.drawCloudsBody(partialTicks); + } + + /** @@ -275,7 +275,7 @@ + @SideOnly(Side.CLIENT) + public float getSunBrightness(float par1) + { -+ return field_76579_a.getSunBrightnessBody(par1); ++ return worldObj.getSunBrightnessBody(par1); + } + + /** @@ -284,68 +284,68 @@ + @SideOnly(Side.CLIENT) + public float getStarBrightness(float par1) + { -+ return field_76579_a.getStarBrightnessBody(par1); ++ return worldObj.getStarBrightnessBody(par1); + } + + public void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful) + { -+ field_76579_a.field_72985_G = allowHostile; -+ field_76579_a.field_72992_H = allowPeaceful; ++ worldObj.spawnHostileMobs = allowHostile; ++ worldObj.spawnPeacefulMobs = allowPeaceful; + } + + public void calculateInitialWeather() + { -+ field_76579_a.calculateInitialWeatherBody(); ++ worldObj.calculateInitialWeatherBody(); + } + + public void updateWeather() + { -+ field_76579_a.updateWeatherBody(); ++ worldObj.updateWeatherBody(); + } + + public boolean canBlockFreeze(BlockPos pos, boolean byWater) + { -+ return field_76579_a.canBlockFreezeBody(pos, byWater); ++ return worldObj.canBlockFreezeBody(pos, byWater); + } + + public boolean canSnowAt(BlockPos pos, boolean checkLight) + { -+ return field_76579_a.canSnowAtBody(pos, checkLight); ++ return worldObj.canSnowAtBody(pos, checkLight); + } + public void setWorldTime(long time) + { -+ field_76579_a.field_72986_A.func_76068_b(time); ++ worldObj.worldInfo.setWorldTime(time); + } + + public long getSeed() + { -+ return field_76579_a.field_72986_A.func_76063_b(); ++ return worldObj.worldInfo.getSeed(); + } + + public long getWorldTime() + { -+ return field_76579_a.field_72986_A.func_76073_f(); ++ return worldObj.worldInfo.getWorldTime(); + } + + public BlockPos getSpawnPoint() + { -+ net.minecraft.world.storage.WorldInfo info = field_76579_a.field_72986_A; -+ return new BlockPos(info.func_76079_c(), info.func_76075_d(), info.func_76074_e()); ++ net.minecraft.world.storage.WorldInfo info = worldObj.worldInfo; ++ return new BlockPos(info.getSpawnX(), info.getSpawnY(), info.getSpawnZ()); + } + + public void setSpawnPoint(BlockPos pos) + { -+ field_76579_a.field_72986_A.func_176143_a(pos); ++ worldObj.worldInfo.setSpawn(pos); + } + + public boolean canMineBlock(net.minecraft.entity.player.EntityPlayer player, BlockPos pos) + { -+ return field_76579_a.canMineBlockBody(player, pos); ++ return worldObj.canMineBlockBody(player, pos); + } + + public boolean isBlockHighHumidity(BlockPos pos) + { -+ return field_76579_a.func_180494_b(pos).func_76736_e(); ++ return worldObj.getBiomeGenForCoords(pos).isHighHumidity(); + } + + public int getHeight() @@ -355,20 +355,20 @@ + + public int getActualHeight() + { -+ return field_76576_e ? 128 : 256; ++ return hasNoSky ? 128 : 256; + } + + public double getHorizon() + { -+ return field_76579_a.field_72986_A.func_76067_t().getHorizon(field_76579_a); ++ return worldObj.worldInfo.getTerrainType().getHorizon(worldObj); + } + + public void resetRainAndThunder() + { -+ field_76579_a.field_72986_A.func_76080_g(0); -+ field_76579_a.field_72986_A.func_76084_b(false); -+ field_76579_a.field_72986_A.func_76090_f(0); -+ field_76579_a.field_72986_A.func_76069_a(false); ++ worldObj.worldInfo.setRainTime(0); ++ worldObj.worldInfo.setRaining(false); ++ worldObj.worldInfo.setThunderTime(0); ++ worldObj.worldInfo.setThundering(false); + } + + public boolean canDoLightning(net.minecraft.world.chunk.Chunk chunk) diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch new file mode 100644 index 000000000..f403791da --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch @@ -0,0 +1,257 @@ +--- ../src-base/minecraft/net/minecraft/world/WorldServer.java ++++ ../src-work/minecraft/net/minecraft/world/WorldServer.java +@@ -94,30 +94,46 @@ + private List pendingTickListEntriesThisTick = Lists.newArrayList(); + private static final String __OBFID = "CL_00001437"; + ++ /** Stores the recently processed (lighting) chunks */ ++ protected Set doneChunks = new java.util.HashSet(); ++ public List customTeleporters = new ArrayList(); ++ private static boolean initChest = false; ++ public static void fillChestHook() ++ { ++ if (!initChest) ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.BONUS_CHEST, bonusChestContent, 10, 10); ++ initChest = true; ++ } ++ + public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn) + { + super(saveHandlerIn, info, WorldProvider.getProviderForDimension(dimensionId), profilerIn, false); + this.mcServer = server; + this.theEntityTracker = new EntityTracker(this); + this.thePlayerManager = new PlayerManager(this); ++ // Guarantee the dimension ID was not reset by the provider ++ int providerDim = this.provider.dimensionId; + this.provider.registerWorld(this); ++ this.provider.dimensionId = providerDim; + this.chunkProvider = this.createChunkProvider(); ++ perWorldStorage = new MapStorage(new net.minecraftforge.common.WorldSpecificSaveHandler((WorldServer)this, saveHandlerIn)); + this.worldTeleporter = new Teleporter(this); + this.calculateInitialSkylight(); + this.calculateInitialWeather(); + this.getWorldBorder().setSize(server.getMaxWorldSize()); ++ net.minecraftforge.common.DimensionManager.setWorld(dimensionId, this); + } + + public World init() + { + this.mapStorage = new MapStorage(this.saveHandler); + String s = VillageCollection.fileNameForProvider(this.provider); +- VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s); ++ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.loadData(VillageCollection.class, s); + + if (villagecollection == null) + { + this.villageCollectionObj = new VillageCollection(this); +- this.mapStorage.setData(s, this.villageCollectionObj); ++ this.perWorldStorage.setData(s, this.villageCollectionObj); + } + else + { +@@ -210,6 +226,10 @@ + this.villageSiege.tick(); + this.theProfiler.endStartSection("portalForcer"); + this.worldTeleporter.removeStalePortalLocations(this.getTotalWorldTime()); ++ for (Teleporter tele : customTeleporters) ++ { ++ tele.removeStalePortalLocations(getTotalWorldTime()); ++ } + this.theProfiler.endSection(); + this.sendQueuedBlockEvents(); + } +@@ -217,6 +237,7 @@ + public BiomeGenBase.SpawnListEntry func_175734_a(EnumCreatureType p_175734_1_, BlockPos p_175734_2_) + { + List list = this.getChunkProvider().func_177458_a(p_175734_1_, p_175734_2_); ++ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(this, p_175734_1_, p_175734_2_, list); + return list != null && !list.isEmpty() ? (BiomeGenBase.SpawnListEntry)WeightedRandom.getRandomItem(this.rand, list) : null; + } + +@@ -274,10 +295,7 @@ + + private void resetRainAndThunder() + { +- this.worldInfo.setRainTime(0); +- this.worldInfo.setRaining(false); +- this.worldInfo.setThunderTime(0); +- this.worldInfo.setThundering(false); ++ this.provider.resetRainAndThunder(); + } + + public boolean areAllPlayersAsleep() +@@ -367,7 +385,7 @@ + int i1; + BlockPos blockpos; + +- if (this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) ++ if (this.provider.canDoLightning(chunk) && this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) + { + this.updateLCG = this.updateLCG * 3 + 1013904223; + i1 = this.updateLCG >> 2; +@@ -381,7 +399,7 @@ + + this.theProfiler.endStartSection("iceandsnow"); + +- if (this.rand.nextInt(16) == 0) ++ if (this.provider.canDoRainSnowIce(chunk) && this.rand.nextInt(16) == 0) + { + this.updateLCG = this.updateLCG * 3 + 1013904223; + i1 = this.updateLCG >> 2; +@@ -483,6 +501,9 @@ + if (p_175654_2_.requiresUpdates()) + { + b0 = 8; ++ //Keeping here as a note for future when it may be restored. ++ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.position.getX() >> 4, nextticklistentry.position.getZ() >> 4)); ++ b0 = (byte)(isForced ? 0 : 8); + + if (this.isAreaLoaded(nextticklistentry.position.add(-b0, -b0, -b0), nextticklistentry.position.add(b0, b0, b0))) + { +@@ -535,7 +556,7 @@ + + public void updateEntities() + { +- if (this.playerEntities.isEmpty()) ++ if (this.playerEntities.isEmpty() && getPersistentChunks().isEmpty()) + { + if (this.updateEntityTick++ >= 1200) + { +@@ -601,6 +622,9 @@ + { + nextticklistentry = (NextTickListEntry)iterator.next(); + iterator.remove(); ++ //Keeping here as a note for future when it may be restored. ++ //boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.xCoord >> 4, nextticklistentry.zCoord >> 4)); ++ //byte b0 = isForced ? 0 : 8; + byte b0 = 0; + + if (this.isAreaLoaded(nextticklistentry.position.add(-b0, -b0, -b0), nextticklistentry.position.add(b0, b0, b0))) +@@ -729,14 +753,29 @@ + { + ArrayList arraylist = Lists.newArrayList(); + +- for (int k1 = 0; k1 < this.loadedTileEntityList.size(); ++k1) ++ //Forge: Optomize this loop to only grab from the chunks it needs ++ for (int x = (p_147486_1_ >> 4); x <= (p_147486_4_ >> 4); x++) + { +- TileEntity tileentity = (TileEntity)this.loadedTileEntityList.get(k1); +- BlockPos blockpos = tileentity.getPos(); +- +- if (blockpos.getX() >= p_147486_1_ && blockpos.getY() >= p_147486_2_ && blockpos.getZ() >= p_147486_3_ && blockpos.getX() < p_147486_4_ && blockpos.getY() < p_147486_5_ && blockpos.getZ() < p_147486_6_) ++ for (int z = (p_147486_3_ >> 4); z <= (p_147486_6_ >> 4); z++) + { +- arraylist.add(tileentity); ++ Chunk chunk = this.getChunkFromChunkCoords(x, z); ++ if (chunk != null) ++ { ++ for (Object obj : chunk.getTileEntityMap().values()) ++ { ++ TileEntity entity = (TileEntity)obj; ++ if (!entity.isInvalid()) ++ { ++ BlockPos pos = entity.getPos(); ++ if (pos.getX() >= p_147486_1_ && pos.getY() >= p_147486_2_ && pos.getZ() >= p_147486_3_ && ++ pos.getX() <= p_147486_4_ && pos.getY() <= p_147486_5_ && pos.getZ() <= p_147486_6_) ++ { ++ arraylist.add(entity); ++ } ++ ++ } ++ } ++ } + } + } + +@@ -745,6 +784,10 @@ + + public boolean isBlockModifiable(EntityPlayer player, BlockPos pos) + { ++ return super.isBlockModifiable(player, pos); ++ } ++ public boolean canMineBlockBody(EntityPlayer player, BlockPos pos) ++ { + return !this.mcServer.isBlockProtected(this, pos, player) && this.getWorldBorder().contains(pos); + } + +@@ -810,6 +853,7 @@ + } + else + { ++ if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(this, p_73052_1_)) return; + this.findingSpawnPoint = true; + WorldChunkManager worldchunkmanager = this.provider.getWorldChunkManager(); + List list = worldchunkmanager.getBiomesToSpawnIn(); +@@ -855,7 +899,7 @@ + + protected void createBonusChest() + { +- WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(bonusChestContent, 10); ++ WorldGeneratorBonusChest worldgeneratorbonuschest = net.minecraftforge.common.ForgeHooks.getBonusChest(rand); + + for (int i = 0; i < 10; ++i) + { +@@ -892,6 +936,7 @@ + } + + this.chunkProvider.saveChunks(p_73044_1_, p_73044_2_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this)); + List list = this.theChunkProviderServer.func_152380_a(); + Iterator iterator = list.iterator(); + +@@ -929,6 +974,7 @@ + this.worldInfo.setBorderLerpTime(this.getWorldBorder().getTimeUntilTarget()); + this.saveHandler.saveWorldInfoWithPlayer(this.worldInfo, this.mcServer.getConfigurationManager().getHostPlayerData()); + this.mapStorage.saveAllData(); ++ this.perWorldStorage.saveAllData(); + } + + public void onEntityAdded(Entity p_72923_1_) +@@ -984,6 +1030,7 @@ + public Explosion newExplosion(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) + { + Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_); ++ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; + explosion.doExplosionA(); + explosion.doExplosionB(false); + +@@ -1074,19 +1121,23 @@ + this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.getDimensionId()); + } + ++ /* 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.isRaining()) + { + if (flag) + { +- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(2, 0.0F)); ++ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(2, 0.0F), this.provider.dimensionId); + } + else + { +- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(1, 0.0F)); ++ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(1, 0.0F), this.provider.dimensionId); + } + +- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(7, this.rainingStrength)); +- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(8, this.thunderingStrength)); ++ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId); ++ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId); + } + } + +@@ -1152,6 +1203,11 @@ + return this.mcServer.isCallingFromMinecraftThread(); + } + ++ public java.io.File getChunkSaveLocation() ++ { ++ return ((net.minecraft.world.chunk.storage.AnvilChunkLoader)theChunkProviderServer.chunkLoader).chunkSaveLocation; ++ } ++ + static class ServerBlockEventList extends ArrayList + { + private static final String __OBFID = "CL_00001439"; diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldServerMulti.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldServerMulti.java.patch new file mode 100644 index 000000000..f1d3cd163 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/WorldServerMulti.java.patch @@ -0,0 +1,62 @@ +--- ../src-base/minecraft/net/minecraft/world/WorldServerMulti.java ++++ ../src-work/minecraft/net/minecraft/world/WorldServerMulti.java +@@ -11,13 +11,14 @@ + public class WorldServerMulti extends WorldServer + { + private WorldServer delegate; ++ private IBorderListener borderListener; + private static final String __OBFID = "CL_00001430"; + + public WorldServerMulti(MinecraftServer server, ISaveHandler saveHandlerIn, int dimensionId, WorldServer delegate, Profiler profilerIn) + { + super(server, saveHandlerIn, new DerivedWorldInfo(delegate.getWorldInfo()), dimensionId, profilerIn); + this.delegate = delegate; +- delegate.getWorldBorder().addListener(new IBorderListener() ++ this.borderListener = new IBorderListener() + { + private static final String __OBFID = "CL_00002273"; + public void onSizeChanged(WorldBorder border, double newSize) +@@ -48,22 +49,26 @@ + { + WorldServerMulti.this.getWorldBorder().setDamageBuffer(newSize); + } +- }); ++ }; ++ this.delegate.getWorldBorder().addListener(this.borderListener); + } + +- protected void saveLevel() throws MinecraftException {} ++ protected void saveLevel() throws MinecraftException ++ { ++ this.perWorldStorage.saveAllData(); ++ } + + public World init() + { + this.mapStorage = this.delegate.getMapStorage(); + this.worldScoreboard = this.delegate.getScoreboard(); + String s = VillageCollection.fileNameForProvider(this.provider); +- VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s); ++ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.loadData(VillageCollection.class, s); + + if (villagecollection == null) + { + this.villageCollectionObj = new VillageCollection(this); +- this.mapStorage.setData(s, this.villageCollectionObj); ++ this.perWorldStorage.setData(s, this.villageCollectionObj); + } + else + { +@@ -73,4 +78,12 @@ + + return this; + } ++ ++ ++ @Override ++ public void flush() ++ { ++ super.flush(); ++ this.delegate.getWorldBorder().removeListener(this.borderListener); // Unlink ourselves, to prevent world leak. ++ } + } diff --git a/patches/minecraft/net/minecraft/world/WorldType.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch similarity index 67% rename from patches/minecraft/net/minecraft/world/WorldType.java.patch rename to patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch index 26290a812..e5e993721 100644 --- a/patches/minecraft/net/minecraft/world/WorldType.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch @@ -17,27 +17,27 @@ @@ -28,6 +37,7 @@ - private WorldType(int p_i1960_1_, String p_i1960_2_, int p_i1960_3_) + private WorldType(int id, String name, int version) { -+ if (p_i1960_2_.length() > 16 && field_180272_g != null) throw new IllegalArgumentException("World type names must not be longer then 16: " + p_i1960_2_); - this.field_77133_f = p_i1960_2_; - this.field_77134_g = p_i1960_3_; - this.field_77140_h = true; ++ if (name.length() > 16 && DEBUG_WORLD != null) throw new IllegalArgumentException("World type names must not be longer then 16: " + name); + this.worldType = name; + this.generatorVersion = version; + this.canBeCreated = true; @@ -114,4 +124,144 @@ - this.field_151361_l = true; + this.hasNotificationData = true; return this; } + + public net.minecraft.world.biome.WorldChunkManager getChunkManager(World world) + { -+ if (this == field_77138_c) ++ if (this == FLAT) + { -+ net.minecraft.world.gen.FlatGeneratorInfo flatgeneratorinfo = net.minecraft.world.gen.FlatGeneratorInfo.func_82651_a(world.func_72912_H().func_82571_y()); -+ return new net.minecraft.world.biome.WorldChunkManagerHell(net.minecraft.world.biome.BiomeGenBase.func_180276_a(flatgeneratorinfo.func_82648_a(), net.minecraft.world.biome.BiomeGenBase.field_180279_ad), 0.5F); ++ net.minecraft.world.gen.FlatGeneratorInfo flatgeneratorinfo = net.minecraft.world.gen.FlatGeneratorInfo.createFlatGeneratorFromString(world.getWorldInfo().getGeneratorOptions()); ++ return new net.minecraft.world.biome.WorldChunkManagerHell(net.minecraft.world.biome.BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), net.minecraft.world.biome.BiomeGenBase.field_180279_ad), 0.5F); + } -+ else if (this == field_180272_g) ++ else if (this == DEBUG_WORLD) + { -+ return new net.minecraft.world.biome.WorldChunkManagerHell(net.minecraft.world.biome.BiomeGenBase.field_76772_c, 0.0F); ++ return new net.minecraft.world.biome.WorldChunkManagerHell(net.minecraft.world.biome.BiomeGenBase.plains, 0.0F); + } + else + { @@ -47,44 +47,44 @@ + + public net.minecraft.world.chunk.IChunkProvider getChunkGenerator(World world, String generatorOptions) + { -+ if (this == field_77138_c) return new net.minecraft.world.gen.ChunkProviderFlat(world, world.func_72905_C(), world.func_72912_H().func_76089_r(), generatorOptions); -+ if (this == field_180272_g) return new net.minecraft.world.gen.ChunkProviderDebug(world); -+ return new net.minecraft.world.gen.ChunkProviderGenerate(world, world.func_72905_C(), world.func_72912_H().func_76089_r(), generatorOptions); ++ if (this == FLAT) return new net.minecraft.world.gen.ChunkProviderFlat(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions); ++ if (this == DEBUG_WORLD) return new net.minecraft.world.gen.ChunkProviderDebug(world); ++ return new net.minecraft.world.gen.ChunkProviderGenerate(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions); + } + + public int getMinimumSpawnHeight(World world) + { -+ return this == field_77138_c ? 4 : 64; ++ return this == FLAT ? 4 : 64; + } + + public double getHorizon(World world) + { -+ return this == field_77138_c ? 0.0D : 63.0D; ++ return this == FLAT ? 0.0D : 63.0D; + } + + public double voidFadeMagnitude() + { -+ return this == field_77138_c ? 1.0D : 0.03125D; ++ return this == FLAT ? 1.0D : 0.03125D; + } + + public boolean handleSlimeSpawnReduction(java.util.Random random, World world) + { -+ return this == field_77138_c ? random.nextInt(4) != 1 : false; ++ return this == FLAT ? random.nextInt(4) != 1 : false; + } + + /*=================================================== FORGE START ======================================*/ + private static int getNextID() + { -+ for (int x = 0; x < field_77139_a.length; x++) ++ for (int x = 0; x < worldTypes.length; x++) + { -+ if (field_77139_a[x] == null) ++ if (worldTypes[x] == null) + { + return x; + } + } + -+ int oldLen = field_77139_a.length; -+ field_77139_a = Arrays.copyOf(field_77139_a, oldLen + 16); ++ int oldLen = worldTypes.length; ++ worldTypes = Arrays.copyOf(worldTypes, oldLen + 16); + return oldLen; + } + @@ -110,7 +110,7 @@ + */ + public int getSpawnFuzz() + { -+ return Math.max(5, net.minecraft.server.MinecraftServer.func_71276_C().func_82357_ak() - 6); ++ return Math.max(5, net.minecraft.server.MinecraftServer.getServer().getSpawnProtectionSize() - 6); + } + + /** @@ -121,13 +121,13 @@ + @SideOnly(Side.CLIENT) + public void onCustomizeButton(Minecraft mc, GuiCreateWorld guiCreateWorld) + { -+ if (this == WorldType.field_77138_c) ++ if (this == WorldType.FLAT) + { -+ mc.func_147108_a(new GuiCreateFlatWorld(guiCreateWorld, guiCreateWorld.field_146334_a)); ++ mc.displayGuiScreen(new GuiCreateFlatWorld(guiCreateWorld, guiCreateWorld.chunkProviderSettingsJson)); + } -+ else if (this == WorldType.field_180271_f) ++ else if (this == WorldType.CUSTOMIZED) + { -+ mc.func_147108_a(new GuiCustomizeWorldScreen(guiCreateWorld, guiCreateWorld.field_146334_a)); ++ mc.displayGuiScreen(new GuiCustomizeWorldScreen(guiCreateWorld, guiCreateWorld.chunkProviderSettingsJson)); + } + } + @@ -137,7 +137,7 @@ + */ + public boolean isCustomizable() + { -+ return this == field_77138_c || this == WorldType.field_180271_f; ++ return this == FLAT || this == WorldType.CUSTOMIZED; + } + + @@ -163,7 +163,7 @@ + public GenLayer getBiomeLayer(long worldSeed, GenLayer parentLayer, String chunkProviderSettingsJson) + { + GenLayer ret = new GenLayerBiome(200L, parentLayer, this, chunkProviderSettingsJson); -+ ret = GenLayerZoom.func_75915_a(1000L, ret, 2); ++ ret = GenLayerZoom.magnify(1000L, ret, 2); + ret = new GenLayerBiomeEdge(1000L, ret); + return ret; + } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch similarity index 73% rename from patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch rename to patches.mcp/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch index bcd054cb7..2006f5b38 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeColorHelper.java @@ -30,7 +30,7 @@ private static final String __OBFID = "CL_00002146"; - public int func_180283_a(BiomeGenBase p_180283_1_, BlockPos p_180283_2_) + public int getColorAtPos(BiomeGenBase p_180283_1_, BlockPos blockPosition) { -- return p_180283_1_.field_76759_H; +- return p_180283_1_.waterColorMultiplier; + return p_180283_1_.getWaterColorMultiplier(); } }; diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch new file mode 100644 index 000000000..2ce959e0f --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch @@ -0,0 +1,267 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeDecorator.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeDecorator.java +@@ -23,6 +23,11 @@ + import net.minecraft.world.gen.feature.WorldGenWaterlily; + import net.minecraft.world.gen.feature.WorldGenerator; + ++import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.*; ++import static net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.*; ++import net.minecraftforge.common.*; ++import net.minecraftforge.event.terraingen.*; ++ + public class BiomeDecorator + { + public World currentWorld; +@@ -125,26 +130,30 @@ + + protected void genDecorations(BiomeGenBase p_150513_1_) + { ++ MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(currentWorld, randomGenerator, field_180294_c)); + this.generateOres(); + int i; + int j; + int k; + +- for (i = 0; i < this.sandPerChunk2; ++i) ++ boolean doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, SAND); ++ for (i = 0; doGen && i < this.sandPerChunk2; ++i) + { + j = this.randomGenerator.nextInt(16) + 8; + k = this.randomGenerator.nextInt(16) + 8; + this.sandGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getTopSolidOrLiquidBlock(this.field_180294_c.add(j, 0, k))); + } + +- for (i = 0; i < this.clayPerChunk; ++i) ++ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, CLAY); ++ for (i = 0; doGen && i < this.clayPerChunk; ++i) + { + j = this.randomGenerator.nextInt(16) + 8; + k = this.randomGenerator.nextInt(16) + 8; + this.clayGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getTopSolidOrLiquidBlock(this.field_180294_c.add(j, 0, k))); + } + +- for (i = 0; i < this.sandPerChunk; ++i) ++ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, SAND_PASS2); ++ for (i = 0; doGen && i < this.sandPerChunk; ++i) + { + j = this.randomGenerator.nextInt(16) + 8; + k = this.randomGenerator.nextInt(16) + 8; +@@ -161,7 +170,8 @@ + int l; + BlockPos blockpos; + +- for (j = 0; j < i; ++j) ++ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, TREE); ++ for (j = 0; doGen && j < i; ++j) + { + k = this.randomGenerator.nextInt(16) + 8; + l = this.randomGenerator.nextInt(16) + 8; +@@ -175,7 +185,8 @@ + } + } + +- for (j = 0; j < this.bigMushroomsPerChunk; ++j) ++ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, BIG_SHROOM); ++ for (j = 0; doGen && j < this.bigMushroomsPerChunk; ++j) + { + k = this.randomGenerator.nextInt(16) + 8; + l = this.randomGenerator.nextInt(16) + 8; +@@ -184,11 +195,12 @@ + + int i1; + +- for (j = 0; j < this.flowersPerChunk; ++j) ++ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, FLOWERS); ++ for (j = 0; doGen && j < this.flowersPerChunk; ++j) + { + k = this.randomGenerator.nextInt(16) + 8; + l = this.randomGenerator.nextInt(16) + 8; +- i1 = this.randomGenerator.nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() + 32); ++ i1 = nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() + 32); + blockpos = this.field_180294_c.add(k, i1, l); + BlockFlower.EnumFlowerType enumflowertype = p_150513_1_.pickRandomFlower(this.randomGenerator, blockpos); + BlockFlower blockflower = enumflowertype.getBlockType().getBlock(); +@@ -200,29 +212,32 @@ + } + } + +- for (j = 0; j < this.grassPerChunk; ++j) ++ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, GRASS); ++ for (j = 0; doGen && j < this.grassPerChunk; ++j) + { + k = this.randomGenerator.nextInt(16) + 8; + l = this.randomGenerator.nextInt(16) + 8; +- i1 = this.randomGenerator.nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); ++ i1 = nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); + p_150513_1_.getRandomWorldGenForGrass(this.randomGenerator).generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(k, i1, l)); + } + +- for (j = 0; j < this.deadBushPerChunk; ++j) ++ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, DEAD_BUSH); ++ for (j = 0; doGen && j < this.deadBushPerChunk; ++j) + { + k = this.randomGenerator.nextInt(16) + 8; + l = this.randomGenerator.nextInt(16) + 8; +- i1 = this.randomGenerator.nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); ++ i1 = nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); + (new WorldGenDeadBush()).generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(k, i1, l)); + } + + j = 0; + +- while (j < this.waterlilyPerChunk) ++ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, LILYPAD); ++ while (doGen && j < this.waterlilyPerChunk) + { + k = this.randomGenerator.nextInt(16) + 8; + l = this.randomGenerator.nextInt(16) + 8; +- i1 = this.randomGenerator.nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); ++ i1 = nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); + blockpos = this.field_180294_c.add(k, i1, l); + + while (true) +@@ -244,7 +259,8 @@ + } + } + +- for (j = 0; j < this.mushroomsPerChunk; ++j) ++ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, SHROOM); ++ for (j = 0; doGen && j < this.mushroomsPerChunk; ++j) + { + if (this.randomGenerator.nextInt(4) == 0) + { +@@ -258,57 +274,60 @@ + { + k = this.randomGenerator.nextInt(16) + 8; + l = this.randomGenerator.nextInt(16) + 8; +- i1 = this.randomGenerator.nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); ++ i1 = nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); + blockpos = this.field_180294_c.add(k, i1, l); + this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, blockpos); + } + } + +- if (this.randomGenerator.nextInt(4) == 0) ++ if (doGen && this.randomGenerator.nextInt(4) == 0) + { + j = this.randomGenerator.nextInt(16) + 8; + k = this.randomGenerator.nextInt(16) + 8; +- l = this.randomGenerator.nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(j, 0, k)).getY() * 2); ++ l = nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(j, 0, k)).getY() * 2); + this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(j, l, k)); + } + +- if (this.randomGenerator.nextInt(8) == 0) ++ if (doGen && this.randomGenerator.nextInt(8) == 0) + { + j = this.randomGenerator.nextInt(16) + 8; + k = this.randomGenerator.nextInt(16) + 8; +- l = this.randomGenerator.nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(j, 0, k)).getY() * 2); ++ l = nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(j, 0, k)).getY() * 2); + this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(j, l, k)); + } + +- for (j = 0; j < this.reedsPerChunk; ++j) ++ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, REED); ++ for (j = 0; doGen && j < this.reedsPerChunk; ++j) + { + k = this.randomGenerator.nextInt(16) + 8; + l = this.randomGenerator.nextInt(16) + 8; +- i1 = this.randomGenerator.nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); ++ i1 = nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); + this.reedGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(k, i1, l)); + } + +- for (j = 0; j < 10; ++j) ++ for (j = 0; doGen && j < 10; ++j) + { + k = this.randomGenerator.nextInt(16) + 8; + l = this.randomGenerator.nextInt(16) + 8; +- i1 = this.randomGenerator.nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); ++ i1 = nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); + this.reedGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(k, i1, l)); + } + +- if (this.randomGenerator.nextInt(32) == 0) ++ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, PUMPKIN); ++ if (doGen && this.randomGenerator.nextInt(32) == 0) + { + j = this.randomGenerator.nextInt(16) + 8; + k = this.randomGenerator.nextInt(16) + 8; +- l = this.randomGenerator.nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(j, 0, k)).getY() * 2); ++ l = nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(j, 0, k)).getY() * 2); + (new WorldGenPumpkin()).generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(j, l, k)); + } + +- for (j = 0; j < this.cactiPerChunk; ++j) ++ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, CACTUS); ++ for (j = 0; doGen && j < this.cactiPerChunk; ++j) + { + k = this.randomGenerator.nextInt(16) + 8; + l = this.randomGenerator.nextInt(16) + 8; +- i1 = this.randomGenerator.nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); ++ i1 = nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); + this.cactusGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(k, i1, l)); + } + +@@ -316,18 +335,22 @@ + { + BlockPos blockpos1; + +- for (j = 0; j < 50; ++j) ++ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, LAKE_WATER); ++ for (j = 0; doGen && j < 50; ++j) + { + blockpos1 = this.field_180294_c.add(this.randomGenerator.nextInt(16) + 8, this.randomGenerator.nextInt(this.randomGenerator.nextInt(248) + 8), this.randomGenerator.nextInt(16) + 8); + (new WorldGenLiquids(Blocks.flowing_water)).generate(this.currentWorld, this.randomGenerator, blockpos1); + } + +- for (j = 0; j < 20; ++j) ++ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, LAKE_LAVA); ++ for (j = 0; doGen && j < 20; ++j) + { + blockpos1 = this.field_180294_c.add(this.randomGenerator.nextInt(16) + 8, this.randomGenerator.nextInt(this.randomGenerator.nextInt(this.randomGenerator.nextInt(240) + 8) + 8), this.randomGenerator.nextInt(16) + 8); + (new WorldGenLiquids(Blocks.flowing_lava)).generate(this.currentWorld, this.randomGenerator, blockpos1); + } + } ++ ++ MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(currentWorld, randomGenerator, field_180294_c)); + } + + protected void genStandardOre1(int p_76795_1_, WorldGenerator p_76795_2_, int p_76795_3_, int p_76795_4_) +@@ -370,16 +393,35 @@ + + protected void generateOres() + { ++ MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Pre(currentWorld, randomGenerator, field_180294_c)); ++ if (TerrainGen.generateOre(currentWorld, randomGenerator, dirtGen, field_180294_c, DIRT)) + this.genStandardOre1(this.chunkProviderSettings.dirtCount, this.dirtGen, this.chunkProviderSettings.dirtMinHeight, this.chunkProviderSettings.dirtMaxHeight); ++ if (TerrainGen.generateOre(currentWorld, randomGenerator, gravelGen, field_180294_c, GRAVEL)) + this.genStandardOre1(this.chunkProviderSettings.gravelCount, this.gravelGen, this.chunkProviderSettings.gravelMinHeight, this.chunkProviderSettings.gravelMaxHeight); ++ if (TerrainGen.generateOre(currentWorld, randomGenerator, dioriteGen, field_180294_c, DIORITE)) + this.genStandardOre1(this.chunkProviderSettings.dioriteCount, this.dioriteGen, this.chunkProviderSettings.dioriteMinHeight, this.chunkProviderSettings.dioriteMaxHeight); ++ if (TerrainGen.generateOre(currentWorld, randomGenerator, graniteGen, field_180294_c, GRANITE)) + this.genStandardOre1(this.chunkProviderSettings.graniteCount, this.graniteGen, this.chunkProviderSettings.graniteMinHeight, this.chunkProviderSettings.graniteMaxHeight); ++ if (TerrainGen.generateOre(currentWorld, randomGenerator, andesiteGen, field_180294_c, ANDESITE)) + this.genStandardOre1(this.chunkProviderSettings.andesiteCount, this.andesiteGen, this.chunkProviderSettings.andesiteMinHeight, this.chunkProviderSettings.andesiteMaxHeight); ++ if (TerrainGen.generateOre(currentWorld, randomGenerator, coalGen, field_180294_c, COAL)) + this.genStandardOre1(this.chunkProviderSettings.coalCount, this.coalGen, this.chunkProviderSettings.coalMinHeight, this.chunkProviderSettings.coalMaxHeight); ++ if (TerrainGen.generateOre(currentWorld, randomGenerator, ironGen, field_180294_c, IRON)) + this.genStandardOre1(this.chunkProviderSettings.ironCount, this.ironGen, this.chunkProviderSettings.ironMinHeight, this.chunkProviderSettings.ironMaxHeight); ++ if (TerrainGen.generateOre(currentWorld, randomGenerator, goldGen, field_180294_c, GOLD)) + this.genStandardOre1(this.chunkProviderSettings.goldCount, this.goldGen, this.chunkProviderSettings.goldMinHeight, this.chunkProviderSettings.goldMaxHeight); ++ if (TerrainGen.generateOre(currentWorld, randomGenerator, redstoneGen, field_180294_c, REDSTONE)) + this.genStandardOre1(this.chunkProviderSettings.redstoneCount, this.redstoneGen, this.chunkProviderSettings.redstoneMinHeight, this.chunkProviderSettings.redstoneMaxHeight); ++ if (TerrainGen.generateOre(currentWorld, randomGenerator, diamondGen, field_180294_c, DIAMOND)) + this.genStandardOre1(this.chunkProviderSettings.diamondCount, this.diamondGen, this.chunkProviderSettings.diamondMinHeight, this.chunkProviderSettings.diamondMaxHeight); ++ if (TerrainGen.generateOre(currentWorld, randomGenerator, lapisGen, field_180294_c, LAPIS)) + this.genStandardOre2(this.chunkProviderSettings.lapisCount, this.lapisGen, this.chunkProviderSettings.lapisCenterHeight, this.chunkProviderSettings.lapisSpread); ++ MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Post(currentWorld, randomGenerator, field_180294_c)); + } ++ ++ private int nextInt(int i) { //Safety wrapper to prevent exceptions. ++ if (i <= 1) ++ return 0; ++ return this.randomGenerator.nextInt(i); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch similarity index 57% rename from patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch rename to patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch index ab745af60..7b45e807f 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch @@ -9,7 +9,7 @@ + public abstract class BiomeGenBase { - private static final Logger field_150586_aC = LogManager.getLogger(); + private static final Logger logger = LogManager.getLogger(); @@ -139,6 +142,10 @@ public BiomeGenBase(int p_i1971_1_) @@ -18,49 +18,49 @@ + } + public BiomeGenBase(int p_i1971_1_, boolean register) + { - this.field_76752_A = Blocks.field_150349_c.func_176223_P(); - this.field_76753_B = Blocks.field_150346_d.func_176223_P(); - this.field_76754_C = 5169201; + this.topBlock = Blocks.grass.getDefaultState(); + this.fillerBlock = Blocks.dirt.getDefaultState(); + this.fillerBlockMetadata = 5169201; @@ -156,6 +163,7 @@ - this.field_76758_O = new WorldGenBigTree(false); - this.field_76763_Q = new WorldGenSwamp(); - this.field_76756_M = p_i1971_1_; + this.worldGeneratorBigTree = new WorldGenBigTree(false); + this.worldGeneratorSwamp = new WorldGenSwamp(); + this.biomeID = p_i1971_1_; + if (register) - field_76773_a[p_i1971_1_] = this; - this.field_76760_I = this.func_76729_a(); - this.field_76762_K.add(new BiomeGenBase.SpawnListEntry(EntitySheep.class, 12, 4, 4)); + biomeList[p_i1971_1_] = this; + this.theBiomeDecorator = this.createBiomeDecorator(); + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySheep.class, 12, 4, 4)); @@ -172,11 +180,12 @@ - this.field_76761_J.add(new BiomeGenBase.SpawnListEntry(EntityWitch.class, 5, 1, 1)); - this.field_76755_L.add(new BiomeGenBase.SpawnListEntry(EntitySquid.class, 10, 4, 4)); - this.field_82914_M.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 10, 8, 8)); + this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityWitch.class, 5, 1, 1)); + this.spawnableWaterCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySquid.class, 10, 4, 4)); + this.spawnableCaveCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 10, 8, 8)); + this.addDefaultFlowers(); } - public BiomeDecorator func_76729_a() + public BiomeDecorator createBiomeDecorator() { - return new BiomeDecorator(); + return getModdedBiomeDecorator(new BiomeDecorator()); } - public BiomeGenBase func_76732_a(float p_76732_1_, float p_76732_2_) + public BiomeGenBase setTemperatureRainfall(float p_76732_1_, float p_76732_2_) @@ -346,7 +355,7 @@ { - double d0 = (double)MathHelper.func_76131_a(this.func_180626_a(p_180627_1_), 0.0F, 1.0F); - double d1 = (double)MathHelper.func_76131_a(this.func_76727_i(), 0.0F, 1.0F); -- return ColorizerGrass.func_77480_a(d0, d1); -+ return getModdedBiomeGrassColor(ColorizerGrass.func_77480_a(d0, d1)); + double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(p_180627_1_), 0.0F, 1.0F); + double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); +- return ColorizerGrass.getGrassColor(d0, d1); ++ return getModdedBiomeGrassColor(ColorizerGrass.getGrassColor(d0, d1)); } @SideOnly(Side.CLIENT) @@ -354,7 +363,7 @@ { - double d0 = (double)MathHelper.func_76131_a(this.func_180626_a(p_180625_1_), 0.0F, 1.0F); - double d1 = (double)MathHelper.func_76131_a(this.func_76727_i(), 0.0F, 1.0F); -- return ColorizerFoliage.func_77470_a(d0, d1); -+ return getModdedBiomeFoliageColor(ColorizerFoliage.func_77470_a(d0, d1)); + double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(p_180625_1_), 0.0F, 1.0F); + double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); +- return ColorizerFoliage.getFoliageColor(d0, d1); ++ return getModdedBiomeFoliageColor(ColorizerFoliage.getFoliageColor(d0, d1)); } - public boolean func_150559_j() + public boolean isSnowyBiome() @@ -500,6 +509,84 @@ } } @@ -75,7 +75,7 @@ + + public int getWaterColorMultiplier() + { -+ BiomeEvent.GetWaterColor event = new BiomeEvent.GetWaterColor(this, field_76759_H); ++ BiomeEvent.GetWaterColor event = new BiomeEvent.GetWaterColor(this, waterColorMultiplier); + MinecraftForge.EVENT_BUS.post(event); + return event.newColor; + } @@ -113,8 +113,8 @@ + */ + public void addDefaultFlowers() + { -+ addFlower(Blocks.field_150327_N.func_176223_P().func_177226_a(Blocks.field_150327_N.func_176494_l(), BlockFlower.EnumFlowerType.DANDELION), 20); -+ addFlower(Blocks.field_150328_O.func_176223_P().func_177226_a(Blocks.field_150328_O.func_176494_l(), BlockFlower.EnumFlowerType.POPPY), 20); ++ addFlower(Blocks.yellow_flower.getDefaultState().withProperty(Blocks.yellow_flower.getTypeProperty(), BlockFlower.EnumFlowerType.DANDELION), 20); ++ addFlower(Blocks.red_flower.getDefaultState().withProperty(Blocks.red_flower.getTypeProperty(), BlockFlower.EnumFlowerType.POPPY), 20); + } + + /** Register a new plant to be planted when bonemeal is used on grass. @@ -129,15 +129,15 @@ + + public void plantFlower(World world, Random rand, BlockPos pos) + { -+ FlowerEntry flower = (FlowerEntry)WeightedRandom.func_76271_a(rand, flowers); ++ FlowerEntry flower = (FlowerEntry)WeightedRandom.getRandomItem(rand, flowers); + if (flower == null || flower.state == null || -+ (flower.state.func_177230_c() instanceof net.minecraft.block.BlockBush && -+ !((net.minecraft.block.BlockBush)flower.state.func_177230_c()).func_180671_f(world, pos, flower.state))) ++ (flower.state.getBlock() instanceof net.minecraft.block.BlockBush && ++ !((net.minecraft.block.BlockBush)flower.state.getBlock()).canBlockStay(world, pos, flower.state))) + { + return; + } + -+ world.func_180501_a(pos, flower.state, 3); ++ world.setBlockState(pos, flower.state, 3); + } + + @@ -145,4 +145,4 @@ + static { - field_76772_c.func_150566_k(); + plains.createMutation(); diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch similarity index 70% rename from patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch rename to patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch index baadaaa76..5d628a6e1 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch @@ -15,9 +15,9 @@ + } + for (BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) + { -+ if (type.func_176964_a() == BlockFlower.EnumFlowerColor.YELLOW) continue; ++ if (type.getBlockType() == BlockFlower.EnumFlowerColor.YELLOW) continue; + if (type == BlockFlower.EnumFlowerType.BLUE_ORCHID) type = BlockFlower.EnumFlowerType.POPPY; -+ addFlower(net.minecraft.init.Blocks.field_150328_O.func_176223_P().func_177226_a(net.minecraft.init.Blocks.field_150328_O.func_176494_l(), type), 10); ++ addFlower(net.minecraft.init.Blocks.red_flower.getDefaultState().withProperty(net.minecraft.init.Blocks.red_flower.getTypeProperty(), type), 10); + } + } } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch new file mode 100644 index 000000000..34bce4338 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenHills.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenHills.java +@@ -58,7 +58,7 @@ + int i1 = p_180624_2_.nextInt(16); + BlockPos blockpos1 = p_180624_3_.add(k, l, i1); + +- if (worldIn.getBlockState(blockpos1).getBlock() == Blocks.stone) ++ if (worldIn.getBlockState(blockpos1).getBlock().isReplaceableOreGen(worldIn, blockpos1, net.minecraft.block.state.pattern.BlockHelper.forBlock(Blocks.stone))) + { + worldIn.setBlockState(blockpos1, Blocks.emerald_ore.getDefaultState(), 2); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch new file mode 100644 index 000000000..80a4c94ec --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenJungle.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenJungle.java +@@ -61,7 +61,9 @@ + super.decorate(worldIn, p_180624_2_, p_180624_3_); + int i = p_180624_2_.nextInt(16) + 8; + int j = p_180624_2_.nextInt(16) + 8; +- int k = p_180624_2_.nextInt(worldIn.getHorizon(p_180624_3_.add(i, 0, j)).getY() * 2); ++ int height = worldIn.getHorizon(p_180624_3_.add(i, 0, j)).getY() * 2; // could == 0, which crashes nextInt ++ if (height < 1) height = 1; ++ int k = p_180624_2_.nextInt(height); + (new WorldGenMelon()).generate(worldIn, p_180624_2_, p_180624_3_.add(i, k, j)); + WorldGenVines worldgenvines = new WorldGenVines(); + diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch new file mode 100644 index 000000000..ba1884cfb --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenPlains.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenPlains.java +@@ -109,4 +109,19 @@ + biomegenplains.field_150609_ah = 14273354; + return biomegenplains; + } ++ ++ @Override ++ public void addDefaultFlowers() ++ { ++ BlockFlower red = net.minecraft.init.Blocks.red_flower; ++ BlockFlower yel = net.minecraft.init.Blocks.yellow_flower; ++ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.ORANGE_TULIP), 3); ++ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.RED_TULIP), 3); ++ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.PINK_TULIP), 3); ++ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.WHITE_TULIP), 3); ++ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.POPPY), 20); ++ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.HOUSTONIA), 20); ++ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.OXEYE_DAISY), 20); ++ addFlower(yel.getDefaultState().withProperty(yel.getTypeProperty(), BlockFlower.EnumFlowerType.DANDELION), 30); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch similarity index 63% rename from patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch rename to patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch index d3c19e270..c4cea2dc1 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch @@ -8,6 +8,6 @@ + @Override + public void addDefaultFlowers() + { -+ addFlower(Blocks.field_150328_O.func_176223_P().func_177226_a(Blocks.field_150328_O.func_176494_l(), BlockFlower.EnumFlowerType.BLUE_ORCHID), 10); ++ addFlower(Blocks.red_flower.getDefaultState().withProperty(Blocks.red_flower.getTypeProperty(), BlockFlower.EnumFlowerType.BLUE_ORCHID), 10); + } } diff --git a/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch similarity index 53% rename from patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch rename to patches.mcp/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch index c23cb8256..4b2493b2f 100644 --- a/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch @@ -10,36 +10,36 @@ + public class WorldChunkManager { -+ public static List allowedBiomes = Lists.newArrayList(field_76767_f, field_76772_c, field_76768_g, field_76784_u, field_76785_t, field_76782_w, field_76792_x); - private GenLayer field_76944_d; - private GenLayer field_76945_e; - private BiomeCache field_76942_f; ++ public static List allowedBiomes = Lists.newArrayList(forest, plains, taiga, taigaHills, forestHills, jungle, jungleHills); + private GenLayer genBiomes; + private GenLayer biomeIndexLayer; + private BiomeCache biomeCache; @@ -28,13 +33,7 @@ - this.field_76942_f = new BiomeCache(this); + this.biomeCache = new BiomeCache(this); this.field_180301_f = ""; - this.field_76943_g = Lists.newArrayList(); -- this.field_76943_g.add(BiomeGenBase.field_76767_f); -- this.field_76943_g.add(BiomeGenBase.field_76772_c); -- this.field_76943_g.add(BiomeGenBase.field_76768_g); -- this.field_76943_g.add(BiomeGenBase.field_76784_u); -- this.field_76943_g.add(BiomeGenBase.field_76785_t); -- this.field_76943_g.add(BiomeGenBase.field_76782_w); -- this.field_76943_g.add(BiomeGenBase.field_76792_x); -+ this.field_76943_g.addAll(allowedBiomes); + this.biomesToSpawnIn = Lists.newArrayList(); +- this.biomesToSpawnIn.add(BiomeGenBase.forest); +- this.biomesToSpawnIn.add(BiomeGenBase.plains); +- this.biomesToSpawnIn.add(BiomeGenBase.taiga); +- this.biomesToSpawnIn.add(BiomeGenBase.taigaHills); +- this.biomesToSpawnIn.add(BiomeGenBase.forestHills); +- this.biomesToSpawnIn.add(BiomeGenBase.jungle); +- this.biomesToSpawnIn.add(BiomeGenBase.jungleHills); ++ this.biomesToSpawnIn.addAll(allowedBiomes); } public WorldChunkManager(long p_i45744_1_, WorldType p_i45744_3_, String p_i45744_4_) @@ -42,6 +41,7 @@ this(); this.field_180301_f = p_i45744_4_; - GenLayer[] agenlayer = GenLayer.func_180781_a(p_i45744_1_, p_i45744_3_, p_i45744_4_); + GenLayer[] agenlayer = GenLayer.initializeAllBiomeGenerators(p_i45744_1_, p_i45744_3_, p_i45744_4_); + agenlayer = getModdedBiomeGenerators(p_i45744_3_, p_i45744_1_, agenlayer); - this.field_76944_d = agenlayer[0]; - this.field_76945_e = agenlayer[1]; + this.genBiomes = agenlayer[0]; + this.biomeIndexLayer = agenlayer[1]; } @@ -250,4 +250,11 @@ { - this.field_76942_f.func_76838_a(); + this.biomeCache.cleanupCache(); } + + public GenLayer[] getModdedBiomeGenerators(WorldType worldType, long seed, GenLayer[] original) diff --git a/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch b/patches.mcp/minecraft/net/minecraft/world/border/WorldBorder.java.patch similarity index 68% rename from patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch rename to patches.mcp/minecraft/net/minecraft/world/border/WorldBorder.java.patch index c7f2cf0b9..ed0813c8b 100644 --- a/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/border/WorldBorder.java.patch @@ -1,12 +1,12 @@ --- ../src-base/minecraft/net/minecraft/world/border/WorldBorder.java +++ ../src-work/minecraft/net/minecraft/world/border/WorldBorder.java @@ -293,4 +293,9 @@ - iborderlistener.func_177690_b(this, p_177747_1_); + iborderlistener.onWarningDistanceChanged(this, warningDistance); } } + + public void removeListener(IBorderListener listener) + { -+ this.field_177758_a.remove(listener); ++ this.listeners.remove(listener); + } } diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch new file mode 100644 index 000000000..93c7472d8 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -0,0 +1,264 @@ +--- ../src-base/minecraft/net/minecraft/world/chunk/Chunk.java ++++ ../src-work/minecraft/net/minecraft/world/chunk/Chunk.java +@@ -35,6 +35,9 @@ + import net.minecraft.world.gen.ChunkProviderDebug; + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; ++import net.minecraftforge.common.MinecraftForge; ++import net.minecraftforge.event.entity.EntityEvent; ++import net.minecraftforge.event.world.ChunkEvent; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + +@@ -174,7 +177,7 @@ + { + Block block = this.getBlock0(j, l - 1, k); + +- if (block.getLightOpacity() == 0) ++ if (getBlockLightOpacity(j, l - 1, k) == 0) + { + --l; + continue; +@@ -469,12 +472,12 @@ + + public int getBlockLightOpacity(BlockPos pos) + { +- return this.getBlock(pos).getLightOpacity(); ++ return this.getBlock(pos).getLightOpacity(worldObj, pos); + } + + private int getBlockLightOpacity(int x, int y, int z) + { +- return this.getBlock0(x, y, z).getLightOpacity(); ++ return getBlockLightOpacity(new BlockPos((xPosition << 4) + x, y, (zPosition << 4) + z)); + } + + private Block getBlock0(int x, int y, int z) +@@ -653,16 +656,23 @@ + flag = j >= i1; + } + ++ int j1 = block.getLightOpacity(this.worldObj, pos); ++ + extendedblockstorage.set(i, j & 15, k, state); + +- if (block1 != block) ++ //if (block1 != block) + { + if (!this.worldObj.isRemote) + { ++ if (iblockstate1.getBlock() != state.getBlock()) //Only fire block breaks when the block changes. + block1.breakBlock(this.worldObj, pos, iblockstate1); ++ TileEntity te = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); ++ if (te != null && te.shouldRefresh(this.worldObj, pos, iblockstate1, state)) this.worldObj.removeTileEntity(pos); + } +- else if (block1 instanceof ITileEntityProvider) ++ else if (block1.hasTileEntity(iblockstate1)) + { ++ TileEntity te = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); ++ if (te != null && te.shouldRefresh(this.worldObj, pos, iblockstate1, state)) + this.worldObj.removeTileEntity(pos); + } + } +@@ -679,8 +689,7 @@ + } + else + { +- int j1 = block.getLightOpacity(); +- int k1 = block1.getLightOpacity(); ++ int k1 = block.getLightOpacity(this.worldObj, pos); + + if (j1 > 0) + { +@@ -702,28 +711,18 @@ + + TileEntity tileentity; + +- if (block1 instanceof ITileEntityProvider) +- { +- tileentity = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); +- +- if (tileentity != null) +- { +- tileentity.updateContainingBlockInfo(); +- } +- } +- + if (!this.worldObj.isRemote && block1 != block) + { + block.onBlockAdded(this.worldObj, pos, state); + } + +- if (block instanceof ITileEntityProvider) ++ if (block.hasTileEntity(state)) + { + tileentity = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); + + if (tileentity == null) + { +- tileentity = ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, block.getMetaFromState(state)); ++ tileentity = block.createTileEntity(this.worldObj, state); + this.worldObj.setTileEntity(pos, tileentity); + } + +@@ -826,6 +825,7 @@ + k = this.entityLists.length - 1; + } + ++ MinecraftForge.EVENT_BUS.post(new EntityEvent.EnteringChunk(entityIn, this.xPosition, this.zPosition, entityIn.chunkCoordX, entityIn.chunkCoordZ)); + entityIn.addedToChunk = true; + entityIn.chunkCoordX = this.xPosition; + entityIn.chunkCoordY = k; +@@ -864,13 +864,20 @@ + private TileEntity createNewTileEntity(BlockPos pos) + { + Block block = this.getBlock(pos); +- return !block.hasTileEntity() ? null : ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, this.getBlockMetadata(pos)); ++ IBlockState state = block.getStateFromMeta(this.getBlockMetadata(pos)); ++ return !block.hasTileEntity(state) ? null : block.createTileEntity(this.worldObj, state); + } + + public TileEntity getTileEntity(BlockPos pos, Chunk.EnumCreateEntityType p_177424_2_) + { + TileEntity tileentity = (TileEntity)this.chunkTileEntityMap.get(pos); + ++ if (tileentity != null && tileentity.isInvalid()) ++ { ++ chunkTileEntityMap.remove(pos); ++ tileentity = null; ++ } ++ + if (tileentity == null) + { + if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE) +@@ -883,11 +890,6 @@ + this.field_177447_w.add(pos); + } + } +- else if (tileentity.isInvalid()) +- { +- this.chunkTileEntityMap.remove(pos); +- return null; +- } + + return tileentity; + } +@@ -907,7 +909,7 @@ + tileEntityIn.setWorldObj(this.worldObj); + tileEntityIn.setPos(pos); + +- if (this.getBlock(pos) instanceof ITileEntityProvider) ++ if (this.getBlock(pos).hasTileEntity(getBlock(pos).getStateFromMeta(this.getBlockMetadata(pos)))) + { + if (this.chunkTileEntityMap.containsKey(pos)) + { +@@ -947,8 +949,9 @@ + entity.onChunkLoad(); + } + +- this.worldObj.loadEntities(this.entityLists[i]); ++ this.worldObj.loadEntities(com.google.common.collect.ImmutableList.copyOf(this.entityLists[i])); + } ++ MinecraftForge.EVENT_BUS.post(new ChunkEvent.Load(this)); + } + + public void onChunkUnload() +@@ -966,6 +969,7 @@ + { + this.worldObj.unloadEntities(this.entityLists[i]); + } ++ MinecraftForge.EVENT_BUS.post(new ChunkEvent.Unload(this)); + } + + public void setChunkModified() +@@ -975,8 +979,8 @@ + + public void getEntitiesWithinAABBForEntity(Entity entityIn, AxisAlignedBB aabb, List listToFill, Predicate p_177414_4_) + { +- int i = MathHelper.floor_double((aabb.minY - 2.0D) / 16.0D); +- int j = MathHelper.floor_double((aabb.maxY + 2.0D) / 16.0D); ++ int i = MathHelper.floor_double((aabb.minY - World.MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.floor_double((aabb.maxY + World.MAX_ENTITY_RADIUS) / 16.0D); + i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); + j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); + +@@ -1012,8 +1016,8 @@ + + public void getEntitiesOfTypeWithinAAAB(Class entityClass, AxisAlignedBB aabb, List listToFill, Predicate p_177430_4_) + { +- int i = MathHelper.floor_double((aabb.minY - 2.0D) / 16.0D); +- int j = MathHelper.floor_double((aabb.maxY + 2.0D) / 16.0D); ++ int i = MathHelper.floor_double((aabb.minY - World.MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.floor_double((aabb.maxY + World.MAX_ENTITY_RADIUS) / 16.0D); + i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); + j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); + +@@ -1179,8 +1183,10 @@ + while (!this.field_177447_w.isEmpty()) + { + BlockPos blockpos = (BlockPos)this.field_177447_w.poll(); ++ Block block = this.getBlock(blockpos); ++ IBlockState state = block.getStateFromMeta(this.getBlockMetadata(blockpos)); + +- if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.getBlock(blockpos).hasTileEntity()) ++ if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && block.hasTileEntity(state)) + { + TileEntity tileentity = this.createNewTileEntity(blockpos); + this.worldObj.setTileEntity(blockpos, tileentity); +@@ -1242,6 +1248,15 @@ + @SideOnly(Side.CLIENT) + public void fillChunk(byte[] p_177439_1_, int p_177439_2_, boolean p_177439_3_) + { ++ Iterator iterator = chunkTileEntityMap.values().iterator(); ++ while(iterator.hasNext()) ++ { ++ TileEntity tileEntity = (TileEntity)iterator.next(); ++ tileEntity.updateContainingBlockInfo(); ++ tileEntity.getBlockMetadata(); ++ tileEntity.getBlockType(); ++ } ++ + int j = 0; + boolean flag1 = !this.worldObj.provider.getHasNoSky(); + int k; +@@ -1311,13 +1326,18 @@ + this.isLightPopulated = true; + this.isTerrainPopulated = true; + this.generateHeightMap(); +- Iterator iterator = this.chunkTileEntityMap.values().iterator(); ++ List invalidList = new java.util.ArrayList(); ++ iterator = this.chunkTileEntityMap.values().iterator(); + + while (iterator.hasNext()) + { + TileEntity tileentity = (TileEntity)iterator.next(); ++ if (tileentity.shouldRefresh(this.worldObj, tileentity.getPos(), tileentity.getBlockType().getStateFromMeta(tileentity.getBlockMetadata()), getBlockState(tileentity.getPos()))) ++ invalidList.add(tileentity); + tileentity.updateContainingBlockInfo(); + } ++ ++ for (TileEntity te : invalidList) te.invalidate(); + } + + public BiomeGenBase getBiome(BlockPos pos, WorldChunkManager chunkManager) +@@ -1644,4 +1664,20 @@ + + private static final String __OBFID = "CL_00002009"; + } ++ ++ /** ++ * Removes the tile entity at the specified position, only if it's ++ * marked as invalid. ++ */ ++ public void removeInvalidTileEntity(BlockPos pos) ++ { ++ if (isChunkLoaded) ++ { ++ TileEntity entity = (TileEntity)chunkTileEntityMap.get(pos); ++ if (entity != null && entity.isInvalid()) ++ { ++ chunkTileEntityMap.remove(pos); ++ } ++ } ++ } + } diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch similarity index 52% rename from patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch rename to patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch index b19f7eb70..08e154bdb 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch @@ -10,22 +10,22 @@ import org.apache.logging.log4j.Logger; @@ -43,8 +45,45 @@ - this.field_75825_d = p_i2003_1_; + this.chunkSaveLocation = chunkSaveLocationIn; } + public boolean chunkExists(World world, int x, int z) + { + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(x, z); + -+ synchronized (this.field_75827_c) ++ synchronized (this.syncLockObject) + { -+ if (this.field_75826_b.contains(chunkcoordintpair)) ++ if (this.pendingAnvilChunksCoordinates.contains(chunkcoordintpair)) + { -+ Iterator iter = this.field_75828_a.iterator(); ++ Iterator iter = this.chunksToRemove.iterator(); + while (iter.hasNext()) + { + PendingChunk pendingChunk = (PendingChunk)iter.next(); -+ if (pendingChunk.field_76548_a.equals(chunkcoordintpair)) ++ if (pendingChunk.chunkCoordinate.equals(chunkcoordintpair)) + { + return true; + } @@ -33,82 +33,82 @@ + } + } + -+ return RegionFileCache.func_76550_a(this.field_75825_d, x, z).chunkExists(x & 31, z & 31); ++ return RegionFileCache.createOrLoadRegionFile(this.chunkSaveLocation, x, z).chunkExists(x & 31, z & 31); + } - public Chunk func_75815_a(World p_75815_1_, int p_75815_2_, int p_75815_3_) throws IOException + public Chunk loadChunk(World worldIn, int x, int z) throws IOException { -+ Object[] data = this.loadChunk__Async(p_75815_1_, p_75815_2_, p_75815_3_); ++ Object[] data = this.loadChunk__Async(worldIn, x, z); + + if (data != null) + { + Chunk chunk = (Chunk) data[0]; + NBTTagCompound nbttagcompound = (NBTTagCompound) data[1]; -+ this.loadEntities(p_75815_1_, nbttagcompound.func_74775_l("Level"), chunk); ++ this.loadEntities(worldIn, nbttagcompound.getCompoundTag("Level"), chunk); + return chunk; + } + + return null; + } + -+ public Object[] loadChunk__Async(World p_75815_1_, int p_75815_2_, int p_75815_3_) throws IOException ++ public Object[] loadChunk__Async(World worldIn, int x, int z) throws IOException + { NBTTagCompound nbttagcompound = null; - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_75815_2_, p_75815_3_); - Object object = this.field_75827_c; + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(x, z); + Object object = this.syncLockObject; @@ -53,11 +92,13 @@ { - if (this.field_75826_b.contains(chunkcoordintpair)) + if (this.pendingAnvilChunksCoordinates.contains(chunkcoordintpair)) { -- for (int k = 0; k < this.field_75828_a.size(); ++k) -+ Iterator iter = this.field_75828_a.iterator(); +- for (int k = 0; k < this.chunksToRemove.size(); ++k) ++ Iterator iter = this.chunksToRemove.iterator(); + while (iter.hasNext()) { -- if (((AnvilChunkLoader.PendingChunk)this.field_75828_a.get(k)).field_76548_a.equals(chunkcoordintpair)) +- if (((AnvilChunkLoader.PendingChunk)this.chunksToRemove.get(k)).chunkCoordinate.equals(chunkcoordintpair)) + PendingChunk pendingChunk = (PendingChunk)iter.next(); -+ if (pendingChunk.field_76548_a.equals(chunkcoordintpair)) ++ if (pendingChunk.chunkCoordinate.equals(chunkcoordintpair)) { -- nbttagcompound = ((AnvilChunkLoader.PendingChunk)this.field_75828_a.get(k)).field_76547_b; -+ nbttagcompound = pendingChunk.field_76547_b; +- nbttagcompound = ((AnvilChunkLoader.PendingChunk)this.chunksToRemove.get(k)).nbtTags; ++ nbttagcompound = pendingChunk.nbtTags; break; } } @@ -76,11 +117,17 @@ - nbttagcompound = CompressedStreamTools.func_74794_a(datainputstream); + nbttagcompound = CompressedStreamTools.read(datainputstream); } -- return this.func_75822_a(p_75815_1_, p_75815_2_, p_75815_3_, nbttagcompound); -+ return this.checkedReadChunkFromNBT__Async(p_75815_1_, p_75815_2_, p_75815_3_, nbttagcompound); +- return this.checkedReadChunkFromNBT(worldIn, x, z, nbttagcompound); ++ return this.checkedReadChunkFromNBT__Async(worldIn, x, z, nbttagcompound); } - protected Chunk func_75822_a(World p_75822_1_, int p_75822_2_, int p_75822_3_, NBTTagCompound p_75822_4_) + protected Chunk checkedReadChunkFromNBT(World worldIn, int x, int z, NBTTagCompound p_75822_4_) { -+ Object[] data = this.checkedReadChunkFromNBT__Async(p_75822_1_, p_75822_2_, p_75822_3_, p_75822_4_); ++ Object[] data = this.checkedReadChunkFromNBT__Async(worldIn, x, z, p_75822_4_); + return data != null ? (Chunk)data[0] : null; + } + -+ protected Object[] checkedReadChunkFromNBT__Async(World p_75822_1_, int p_75822_2_, int p_75822_3_, NBTTagCompound p_75822_4_) ++ protected Object[] checkedReadChunkFromNBT__Async(World worldIn, int x, int z, NBTTagCompound p_75822_4_) + { - if (!p_75822_4_.func_150297_b("Level", 10)) + if (!p_75822_4_.hasKey("Level", 10)) { - field_151505_a.error("Chunk file at " + p_75822_2_ + "," + p_75822_3_ + " is missing level data, skipping"); + logger.error("Chunk file at " + x + "," + z + " is missing level data, skipping"); @@ -100,10 +147,27 @@ - field_151505_a.error("Chunk file at " + p_75822_2_ + "," + p_75822_3_ + " is in the wrong location; relocating. (Expected " + p_75822_2_ + ", " + p_75822_3_ + ", got " + chunk.field_76635_g + ", " + chunk.field_76647_h + ")"); - p_75822_4_.func_74768_a("xPos", p_75822_2_); - p_75822_4_.func_74768_a("zPos", p_75822_3_); + logger.error("Chunk file at " + x + "," + z + " is in the wrong location; relocating. (Expected " + x + ", " + z + ", got " + chunk.xPosition + ", " + chunk.zPosition + ")"); + p_75822_4_.setInteger("xPos", x); + p_75822_4_.setInteger("zPos", z); + + // Have to move tile entities since we don't load them at this stage -+ NBTTagList _tileEntities = p_75822_4_.func_74775_l("Level").func_150295_c("TileEntities", 10); ++ NBTTagList _tileEntities = p_75822_4_.getCompoundTag("Level").getTagList("TileEntities", 10); + + if (_tileEntities != null) + { -+ for (int te = 0; te < _tileEntities.func_74745_c(); te++) ++ for (int te = 0; te < _tileEntities.tagCount(); te++) + { -+ NBTTagCompound _nbt = (NBTTagCompound) _tileEntities.func_150305_b(te); -+ _nbt.func_74768_a("x", p_75822_2_ * 16 + (_nbt.func_74762_e("x") - chunk.field_76635_g * 16)); -+ _nbt.func_74768_a("z", p_75822_3_ * 16 + (_nbt.func_74762_e("z") - chunk.field_76647_h * 16)); ++ NBTTagCompound _nbt = (NBTTagCompound) _tileEntities.getCompoundTagAt(te); ++ _nbt.setInteger("x", x * 16 + (_nbt.getInteger("x") - chunk.xPosition * 16)); ++ _nbt.setInteger("z", z * 16 + (_nbt.getInteger("z") - chunk.zPosition * 16)); + } + } - chunk = this.func_75823_a(p_75822_1_, p_75822_4_.func_74775_l("Level")); + chunk = this.readChunkFromNBT(worldIn, p_75822_4_.getCompoundTag("Level")); } - - return chunk; @@ -123,10 +123,10 @@ @@ -117,6 +181,7 @@ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound.func_74782_a("Level", nbttagcompound1); - this.func_75820_a(p_75816_2_, p_75816_1_, nbttagcompound1); -+ MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Save(p_75816_2_, nbttagcompound)); - this.func_75824_a(p_75816_2_.func_76632_l(), nbttagcompound); + nbttagcompound.setTag("Level", nbttagcompound1); + this.writeChunkToNBT(chunkIn, worldIn, nbttagcompound1); ++ MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Save(chunkIn, nbttagcompound)); + this.addChunkToPending(chunkIn.getChunkCoordIntPair(), nbttagcompound); } catch (Exception exception) @@ -287,11 +352,20 @@ @@ -135,10 +135,10 @@ + try + { - if (entity.func_70039_c(nbttagcompound1)) + if (entity.writeToNBTOptional(nbttagcompound1)) { - p_75820_1_.func_177409_g(true); - nbttaglist1.func_74742_a(nbttagcompound1); + chunkIn.setHasEntities(true); + nbttaglist1.appendTag(nbttagcompound1); } + } + catch (Exception e) @@ -156,8 +156,8 @@ nbttagcompound1 = new NBTTagCompound(); + try + { - tileentity.func_145841_b(nbttagcompound1); - nbttaglist2.func_74742_a(nbttagcompound1); + tileentity.writeToNBT(nbttagcompound1); + nbttaglist2.appendTag(nbttagcompound1); + } + catch (Exception e) + { @@ -167,18 +167,18 @@ + } } - p_75820_3_.func_74782_a("TileEntities", nbttaglist2); + p_75820_3_.setTag("TileEntities", nbttaglist2); @@ -386,6 +469,12 @@ - chunk.func_76616_a(p_75823_2_.func_74770_j("Biomes")); + chunk.setBiomeArray(p_75823_2_.getByteArray("Biomes")); } + // End this method here and split off entity loading to another method + return chunk; + } + -+ public void loadEntities(World p_75823_1_, NBTTagCompound p_75823_2_, Chunk chunk) ++ public void loadEntities(World worldIn, NBTTagCompound p_75823_2_, Chunk chunk) + { - NBTTagList nbttaglist1 = p_75823_2_.func_150295_c("Entities", 10); + NBTTagList nbttaglist1 = p_75823_2_.getTagList("Entities", 10); if (nbttaglist1 != null) @@ -457,8 +546,6 @@ diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch similarity index 68% rename from patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch rename to patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch index dc0036916..216e06a41 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch @@ -1,18 +1,18 @@ --- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java +++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java @@ -23,18 +23,12 @@ - File file1 = this.func_75765_b(); + File file1 = this.getWorldDirectory(); File file2; -- if (p_75763_1_ instanceof WorldProviderHell) -+ if (p_75763_1_.getSaveFolder() != null) +- if (provider instanceof WorldProviderHell) ++ if (provider.getSaveFolder() != null) { - file2 = new File(file1, "DIM-1"); -+ file2 = new File(file1, p_75763_1_.getSaveFolder()); ++ file2 = new File(file1, provider.getSaveFolder()); file2.mkdirs(); return new AnvilChunkLoader(file2); } -- else if (p_75763_1_ instanceof WorldProviderEnd) +- else if (provider instanceof WorldProviderEnd) - { - file2 = new File(file1, "DIM1"); - file2.mkdirs(); diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch new file mode 100644 index 000000000..0473edcfc --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java ++++ ../src-work/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java +@@ -35,6 +35,8 @@ + + public void set(int x, int y, int z, IBlockState state) + { ++ if (state instanceof net.minecraftforge.common.property.IExtendedBlockState) ++ state = ((net.minecraftforge.common.property.IExtendedBlockState) state).getClean(); + IBlockState iblockstate1 = this.get(x, y, z); + Block block = iblockstate1.getBlock(); + Block block1 = state.getBlock(); diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch similarity index 60% rename from patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch rename to patches.mcp/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch index af121db7f..134243601 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch @@ -7,25 +7,25 @@ + // This is a copy (sort of) of the method below it, make sure they stay in sync + public synchronized boolean chunkExists(int x, int z) + { -+ if (this.func_76705_d(x, z)) return false; ++ if (this.outOfBounds(x, z)) return false; + + try + { -+ int offset = this.func_76707_e(x, z); ++ int offset = this.getOffset(x, z); + + if (offset == 0) return false; + + int sectorNumber = offset >> 8; + int numSectors = offset & 255; + -+ if (sectorNumber + numSectors > this.field_76714_f.size()) return false; ++ if (sectorNumber + numSectors > this.sectorFree.size()) return false; + -+ this.field_76719_c.seek((long)(sectorNumber * 4096)); -+ int length = this.field_76719_c.readInt(); ++ this.dataFile.seek((long)(sectorNumber * 4096)); ++ int length = this.dataFile.readInt(); + + if (length > 4096 * numSectors || length <= 0) return false; + -+ byte version = this.field_76719_c.readByte(); ++ byte version = this.dataFile.readByte(); + + if (version == 1 || version == 2) return true; + } @@ -37,6 +37,6 @@ + return false; + } + - public synchronized DataInputStream func_76704_a(int p_76704_1_, int p_76704_2_) + public synchronized DataInputStream getChunkDataInputStream(int x, int z) { - if (this.func_76705_d(p_76704_1_, p_76704_2_)) + if (this.outOfBounds(x, z)) diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch similarity index 50% rename from patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch rename to patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch index c3e3d7a75..968222076 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch @@ -11,17 +11,17 @@ public class ChunkProviderEnd implements IChunkProvider { @@ -43,6 +46,14 @@ - this.field_73199_l = new NoiseGeneratorOctaves(this.field_73204_i, 8); - this.field_73196_a = new NoiseGeneratorOctaves(this.field_73204_i, 10); - this.field_73194_b = new NoiseGeneratorOctaves(this.field_73204_i, 16); + this.noiseGen3 = new NoiseGeneratorOctaves(this.endRNG, 8); + this.noiseGen4 = new NoiseGeneratorOctaves(this.endRNG, 10); + this.noiseGen5 = new NoiseGeneratorOctaves(this.endRNG, 16); + -+ NoiseGenerator[] noiseGens = {field_73201_j, field_73202_k, field_73199_l, field_73196_a, field_73194_b}; -+ noiseGens = TerrainGen.getModdedNoiseGenerators(p_i2007_1_, this.field_73204_i, noiseGens); -+ this.field_73201_j = (NoiseGeneratorOctaves)noiseGens[0]; -+ this.field_73202_k = (NoiseGeneratorOctaves)noiseGens[1]; -+ this.field_73199_l = (NoiseGeneratorOctaves)noiseGens[2]; -+ this.field_73196_a = (NoiseGeneratorOctaves)noiseGens[3]; -+ this.field_73194_b = (NoiseGeneratorOctaves)noiseGens[4]; ++ NoiseGenerator[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5}; ++ noiseGens = TerrainGen.getModdedNoiseGenerators(worldIn, this.endRNG, noiseGens); ++ this.noiseGen1 = (NoiseGeneratorOctaves)noiseGens[0]; ++ this.noiseGen2 = (NoiseGeneratorOctaves)noiseGens[1]; ++ this.noiseGen3 = (NoiseGeneratorOctaves)noiseGens[2]; ++ this.noiseGen4 = (NoiseGeneratorOctaves)noiseGens[3]; ++ this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4]; } public void func_180520_a(int p_180520_1_, int p_180520_2_, ChunkPrimer p_180520_3_) @@ -29,7 +29,7 @@ public void func_180519_a(ChunkPrimer p_180519_1_) { -+ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, chunkX, chunkZ, p_180519_1_, this.field_73200_m); ++ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, chunkX, chunkZ, p_180519_1_, this.endWorld); + MinecraftForge.EVENT_BUS.post(event); + if (event.getResult() == Result.DENY) return; for (int i = 0; i < 16; ++i) @@ -40,15 +40,15 @@ } + private int chunkX=0, chunkZ=0; - public Chunk func_73154_d(int p_73154_1_, int p_73154_2_) + public Chunk provideChunk(int x, int z) { -+ chunkX = p_73154_1_; chunkZ = p_73154_2_; - this.field_73204_i.setSeed((long)p_73154_1_ * 341873128712L + (long)p_73154_2_ * 132897987541L); ++ chunkX = x; chunkZ = z; + this.endRNG.setSeed((long)x * 341873128712L + (long)z * 132897987541L); ChunkPrimer chunkprimer = new ChunkPrimer(); - this.field_73198_o = this.field_73200_m.func_72959_q().func_76933_b(this.field_73198_o, p_73154_1_ * 16, p_73154_2_ * 16, 16, 16); + this.biomesForGeneration = this.endWorld.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16); @@ -185,6 +201,10 @@ - private double[] func_73187_a(double[] p_73187_1_, int p_73187_2_, int p_73187_3_, int p_73187_4_, int p_73187_5_, int p_73187_6_, int p_73187_7_) + private double[] initializeNoiseField(double[] p_73187_1_, int p_73187_2_, int p_73187_3_, int p_73187_4_, int p_73187_5_, int p_73187_6_, int p_73187_7_) { + ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, p_73187_1_, p_73187_2_, p_73187_3_, p_73187_4_, p_73187_5_, p_73187_6_, p_73187_7_); + MinecraftForge.EVENT_BUS.post(event); @@ -58,17 +58,17 @@ { p_73187_1_ = new double[p_73187_5_ * p_73187_6_ * p_73187_7_]; @@ -275,8 +295,14 @@ - public void func_73153_a(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) + public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) { - BlockFalling.field_149832_M = true; + BlockFalling.fallInstantly = true; + -+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, field_73200_m, field_73200_m.field_73012_v, p_73153_2_, p_73153_3_, false)); ++ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, endWorld, endWorld.rand, p_73153_2_, p_73153_3_, false)); + BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); - this.field_73200_m.func_180494_b(blockpos.func_177982_a(16, 0, 16)).func_180624_a(this.field_73200_m, this.field_73200_m.field_73012_v, blockpos); + this.endWorld.getBiomeGenForCoords(blockpos.add(16, 0, 16)).decorate(this.endWorld, this.endWorld.rand, blockpos); + -+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, field_73200_m, field_73200_m.field_73012_v, p_73153_2_, p_73153_3_, false)); ++ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, endWorld, endWorld.rand, p_73153_2_, p_73153_3_, false)); + - BlockFalling.field_149832_M = false; + BlockFalling.fallInstantly = false; } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch new file mode 100644 index 000000000..dc67e29f2 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch @@ -0,0 +1,121 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java ++++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java +@@ -24,6 +24,11 @@ + import net.minecraft.world.gen.structure.MapGenStronghold; + import net.minecraft.world.gen.structure.MapGenVillage; + import net.minecraft.world.gen.structure.StructureOceanMonument; ++import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.*; ++import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.*; ++import net.minecraftforge.common.*; ++import net.minecraftforge.fml.common.eventhandler.Event.*; ++import net.minecraftforge.event.terraingen.*; + + public class ChunkProviderGenerate implements IChunkProvider + { +@@ -68,6 +73,15 @@ + this.scatteredFeatureGenerator = new MapGenScatteredFeature(); + this.ravineGenerator = new MapGenRavine(); + this.oceanMonumentGenerator = new StructureOceanMonument(); ++ { ++ caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE); ++ strongholdGenerator = (MapGenStronghold)TerrainGen.getModdedMapGen(strongholdGenerator, STRONGHOLD); ++ villageGenerator = (MapGenVillage)TerrainGen.getModdedMapGen(villageGenerator, VILLAGE); ++ mineshaftGenerator = (MapGenMineshaft)TerrainGen.getModdedMapGen(mineshaftGenerator, MINESHAFT); ++ scatteredFeatureGenerator = (MapGenScatteredFeature)TerrainGen.getModdedMapGen(scatteredFeatureGenerator, SCATTERED_FEATURE); ++ ravineGenerator = TerrainGen.getModdedMapGen(ravineGenerator, RAVINE); ++ oceanMonumentGenerator = (StructureOceanMonument)TerrainGen.getModdedMapGen(oceanMonumentGenerator, OCEAN_MONUMENT); ++ } + this.worldObj = worldIn; + this.mapFeaturesEnabled = p_i45636_4_; + this.field_177475_o = worldIn.getWorldInfo().getTerrainType(); +@@ -96,6 +110,16 @@ + this.settings = ChunkProviderSettings.Factory.func_177865_a(p_i45636_5_).func_177864_b(); + this.field_177476_s = this.settings.useLavaOceans ? Blocks.lava : Blocks.water; + } ++ ++ NoiseGenerator[] noiseGens = {field_147431_j, field_147432_k, field_147429_l, field_147430_m, noiseGen5, noiseGen6, mobSpawnerNoise}; ++ noiseGens = TerrainGen.getModdedNoiseGenerators(worldIn, this.rand, noiseGens); ++ this.field_147431_j = (NoiseGeneratorOctaves)noiseGens[0]; ++ this.field_147432_k = (NoiseGeneratorOctaves)noiseGens[1]; ++ this.field_147429_l = (NoiseGeneratorOctaves)noiseGens[2]; ++ this.field_147430_m = (NoiseGeneratorPerlin)noiseGens[3]; ++ this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4]; ++ this.noiseGen6 = (NoiseGeneratorOctaves)noiseGens[5]; ++ this.mobSpawnerNoise = (NoiseGeneratorOctaves)noiseGens[6]; + } + + public void setBlocksInChunk(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_) +@@ -169,6 +193,10 @@ + + public void func_180517_a(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_) + { ++ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180517_1_, p_180517_2_, p_180517_3_, this.worldObj); ++ MinecraftForge.EVENT_BUS.post(event); ++ if (event.getResult() == Result.DENY) return; ++ + double d0 = 0.03125D; + this.stoneNoise = this.field_147430_m.func_151599_a(this.stoneNoise, (double)(p_180517_1_ * 16), (double)(p_180517_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); + +@@ -375,6 +403,8 @@ + boolean flag = false; + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); + ++ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag)); ++ + if (this.settings.useMineShafts && this.mapFeaturesEnabled) + { + this.mineshaftGenerator.func_175794_a(this.worldObj, this.rand, chunkcoordintpair); +@@ -404,7 +434,8 @@ + int l1; + int i2; + +- if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && this.settings.useWaterLakes && !flag && this.rand.nextInt(this.settings.waterLakeChance) == 0) ++ if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && this.settings.useWaterLakes && !flag && this.rand.nextInt(this.settings.waterLakeChance) == 0 ++ && TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, LAKE)) + { + k1 = this.rand.nextInt(16) + 8; + l1 = this.rand.nextInt(256); +@@ -412,7 +443,7 @@ + (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, blockpos.add(k1, l1, i2)); + } + +- if (!flag && this.rand.nextInt(this.settings.lavaLakeChance / 10) == 0 && this.settings.useLavaLakes) ++ if (TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, LAVA) && !flag && this.rand.nextInt(this.settings.lavaLakeChance / 10) == 0 && this.settings.useLavaLakes) + { + k1 = this.rand.nextInt(16) + 8; + l1 = this.rand.nextInt(this.rand.nextInt(248) + 8); +@@ -426,7 +457,8 @@ + + if (this.settings.useDungeons) + { +- for (k1 = 0; k1 < this.settings.dungeonChance; ++k1) ++ boolean doGen = TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, DUNGEON); ++ for (k1 = 0; doGen && k1 < this.settings.dungeonChance; ++k1) + { + l1 = this.rand.nextInt(16) + 8; + i2 = this.rand.nextInt(256); +@@ -436,10 +468,14 @@ + } + + biomegenbase.decorate(this.worldObj, this.rand, new BlockPos(k, 0, l)); ++ if (TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, ANIMALS)) ++ { + SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand); ++ } + blockpos = blockpos.add(8, 0, 8); + +- for (k1 = 0; k1 < 16; ++k1) ++ boolean doGen = TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, ICE); ++ for (k1 = 0; doGen && k1 < 16; ++k1) + { + for (l1 = 0; l1 < 16; ++l1) + { +@@ -458,6 +494,8 @@ + } + } + ++ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag)); ++ + BlockFalling.fallInstantly = false; + } + diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch new file mode 100644 index 000000000..ac0ed930c --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch @@ -0,0 +1,145 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderHell.java ++++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderHell.java +@@ -24,6 +24,13 @@ + import net.minecraft.world.gen.feature.WorldGenMinable; + import net.minecraft.world.gen.feature.WorldGenerator; + import net.minecraft.world.gen.structure.MapGenNetherBridge; ++import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.*; ++import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.*; ++import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.*; ++import static net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.*; ++import net.minecraftforge.common.*; ++import net.minecraftforge.fml.common.eventhandler.Event.*; ++import net.minecraftforge.event.terraingen.*; + + public class ChunkProviderHell implements IChunkProvider + { +@@ -65,18 +72,30 @@ + this.field_177472_y = new WorldGenHellLava(Blocks.flowing_lava, false); + this.field_177471_z = new GeneratorBushFeature(Blocks.brown_mushroom); + this.field_177465_A = new GeneratorBushFeature(Blocks.red_mushroom); +- this.genNetherBridge = new MapGenNetherBridge(); +- this.netherCaveGenerator = new MapGenCavesHell(); ++ this.genNetherBridge = (MapGenNetherBridge) TerrainGen.getModdedMapGen(new MapGenNetherBridge(), NETHER_BRIDGE); ++ this.netherCaveGenerator = TerrainGen.getModdedMapGen(new MapGenCavesHell(), NETHER_CAVE); + this.worldObj = worldIn; + this.field_177466_i = p_i45637_2_; + this.hellRNG = new Random(p_i45637_3_); +- this.netherNoiseGen1 = new NoiseGeneratorOctaves(this.hellRNG, 16); +- this.netherNoiseGen2 = new NoiseGeneratorOctaves(this.hellRNG, 16); +- this.netherNoiseGen3 = new NoiseGeneratorOctaves(this.hellRNG, 8); +- this.slowsandGravelNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); +- this.netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); +- this.netherNoiseGen6 = new NoiseGeneratorOctaves(this.hellRNG, 10); +- this.netherNoiseGen7 = new NoiseGeneratorOctaves(this.hellRNG, 16); ++ ++ NoiseGenerator[] noiseGens = ++ { ++ new NoiseGeneratorOctaves(this.hellRNG, 16), ++ new NoiseGeneratorOctaves(this.hellRNG, 16), ++ new NoiseGeneratorOctaves(this.hellRNG, 8), ++ new NoiseGeneratorOctaves(this.hellRNG, 4), ++ new NoiseGeneratorOctaves(this.hellRNG, 4), ++ new NoiseGeneratorOctaves(this.hellRNG, 10), ++ new NoiseGeneratorOctaves(this.hellRNG, 16) ++ }; ++ noiseGens = TerrainGen.getModdedNoiseGenerators(worldIn, this.hellRNG, noiseGens); ++ this.netherNoiseGen1 = (NoiseGeneratorOctaves)noiseGens[0]; ++ this.netherNoiseGen2 = (NoiseGeneratorOctaves)noiseGens[1]; ++ this.netherNoiseGen3 = (NoiseGeneratorOctaves)noiseGens[2]; ++ this.slowsandGravelNoiseGen = (NoiseGeneratorOctaves)noiseGens[3]; ++ this.netherrackExculsivityNoiseGen = (NoiseGeneratorOctaves)noiseGens[4]; ++ this.netherNoiseGen6 = (NoiseGeneratorOctaves)noiseGens[5]; ++ this.netherNoiseGen7 = (NoiseGeneratorOctaves)noiseGens[6]; + } + + public void func_180515_a(int p_180515_1_, int p_180515_2_, ChunkPrimer p_180515_3_) +@@ -155,6 +174,10 @@ + + public void func_180516_b(int p_180516_1_, int p_180516_2_, ChunkPrimer p_180516_3_) + { ++ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180516_1_, p_180516_2_, p_180516_3_, this.worldObj); ++ MinecraftForge.EVENT_BUS.post(event); ++ if (event.getResult() == Result.DENY) return; ++ + byte b0 = 64; + double d0 = 0.03125D; + this.slowsandNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.slowsandNoise, p_180516_1_ * 16, p_180516_2_ * 16, 0, 16, 16, 1, d0, d0, 1.0D); +@@ -272,6 +295,10 @@ + + private double[] initializeNoiseField(double[] p_73164_1_, int p_73164_2_, int p_73164_3_, int p_73164_4_, int p_73164_5_, int p_73164_6_, int p_73164_7_) + { ++ ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, p_73164_1_, p_73164_2_, p_73164_3_, p_73164_4_, p_73164_5_, p_73164_6_, p_73164_7_); ++ MinecraftForge.EVENT_BUS.post(event); ++ if (event.getResult() == Result.DENY) return event.noisefield; ++ + if (p_73164_1_ == null) + { + p_73164_1_ = new double[p_73164_5_ * p_73164_6_ * p_73164_7_]; +@@ -365,47 +392,58 @@ + public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) + { + BlockFalling.fallInstantly = true; ++ ++ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false)); ++ + BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); + this.genNetherBridge.func_175794_a(this.worldObj, this.hellRNG, chunkcoordintpair); + int k; + +- for (k = 0; k < 8; ++k) ++ boolean doGen = TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, NETHER_LAVA); ++ for (k = 0; doGen && k < 8; ++k) + { + this.field_177472_y.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); + } + +- for (k = 0; k < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1; ++k) ++ doGen = TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, FIRE); ++ for (k = 0; doGen && k < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1; ++k) + { + this.field_177470_t.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); + } + +- for (k = 0; k < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1); ++k) ++ doGen = TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, GLOWSTONE); ++ for (k = 0; doGen && k < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1); ++k) + { + this.field_177469_u.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); + } + +- for (k = 0; k < 10; ++k) ++ for (k = 0; doGen && k < 10; ++k) + { + this.field_177468_v.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); + } + +- if (this.hellRNG.nextBoolean()) ++ MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(worldObj, hellRNG, blockpos)); ++ ++ doGen = TerrainGen.decorate(worldObj, hellRNG, blockpos, SHROOM); ++ if (doGen && this.hellRNG.nextBoolean()) + { + this.field_177471_z.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); + } + +- if (this.hellRNG.nextBoolean()) ++ if (doGen && this.hellRNG.nextBoolean()) + { + this.field_177465_A.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); + } + +- for (k = 0; k < 16; ++k) ++ doGen = TerrainGen.generateOre(worldObj, hellRNG, field_177467_w, blockpos, QUARTZ); ++ for (k = 0; doGen && k < 16; ++k) + { + this.field_177467_w.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16), this.hellRNG.nextInt(108) + 10, this.hellRNG.nextInt(16))); + } + +- for (k = 0; k < 16; ++k) ++ doGen = TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, NETHER_LAVA2); ++ for (k = 0; doGen && k < 16; ++k) + { + this.field_177473_x.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16), this.hellRNG.nextInt(108) + 10, this.hellRNG.nextInt(16))); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch new file mode 100644 index 000000000..2c367ab51 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch @@ -0,0 +1,138 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderServer.java ++++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderServer.java +@@ -24,6 +24,10 @@ + import net.minecraft.world.chunk.storage.IChunkLoader; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; ++import net.minecraft.world.chunk.storage.AnvilChunkLoader; ++import net.minecraftforge.common.DimensionManager; ++import net.minecraftforge.common.ForgeChunkManager; ++import net.minecraftforge.common.chunkio.ChunkIOExecutor; + + public class ChunkProviderServer implements IChunkProvider + { +@@ -36,6 +40,7 @@ + public LongHashMap id2ChunkMap = new LongHashMap(); + public List loadedChunks = Lists.newArrayList(); + public WorldServer worldObj; ++ private Set loadingChunks = com.google.common.collect.Sets.newHashSet(); + private static final String __OBFID = "CL_00001436"; + + public ChunkProviderServer(WorldServer p_i1520_1_, IChunkLoader p_i1520_2_, IChunkProvider p_i1520_3_) +@@ -58,7 +63,7 @@ + + public void dropChunk(int p_73241_1_, int p_73241_2_) + { +- if (this.worldObj.provider.canRespawnHere()) ++ if (this.worldObj.provider.canRespawnHere() && DimensionManager.shouldLoadSpawn(this.worldObj.provider.getDimensionId())) + { + if (!this.worldObj.isSpawnChunk(p_73241_1_, p_73241_2_)) + { +@@ -84,12 +89,64 @@ + + public Chunk loadChunk(int p_73158_1_, int p_73158_2_) + { ++ return loadChunk(p_73158_1_, p_73158_2_, null); ++ } ++ ++ public Chunk loadChunk(int par1, int par2, Runnable runnable) ++ { ++ long k = ChunkCoordIntPair.chunkXZ2Int(par1, par2); ++ this.droppedChunksSet.remove(Long.valueOf(k)); ++ Chunk chunk = (Chunk)this.id2ChunkMap.getValueByKey(k); ++ AnvilChunkLoader loader = null; ++ ++ if (this.chunkLoader instanceof AnvilChunkLoader) ++ { ++ loader = (AnvilChunkLoader) this.chunkLoader; ++ } ++ ++ // We can only use the queue for already generated chunks ++ if (chunk == null && loader != null && loader.chunkExists(this.worldObj, par1, par2)) ++ { ++ if (runnable != null) ++ { ++ ChunkIOExecutor.queueChunkLoad(this.worldObj, loader, this, par1, par2, runnable); ++ return null; ++ } ++ else ++ { ++ chunk = ChunkIOExecutor.syncChunkLoad(this.worldObj, loader, this, par1, par2); ++ } ++ } ++ else if (chunk == null) ++ { ++ chunk = this.originalLoadChunk(par1, par2); ++ } ++ ++ // If we didn't load the chunk async and have a callback run it now ++ if (runnable != null) ++ { ++ runnable.run(); ++ } ++ ++ return chunk; ++ } ++ ++ public Chunk originalLoadChunk(int p_73158_1_, int p_73158_2_) ++ { + long k = ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_); + this.droppedChunksSet.remove(Long.valueOf(k)); + Chunk chunk = (Chunk)this.id2ChunkMap.getValueByKey(k); + + if (chunk == null) + { ++ boolean added = loadingChunks.add(k); ++ if (!added) ++ { ++ net.minecraftforge.fml.common.FMLLog.bigWarning("There is an attempt to load a chunk (%d,%d) in dimension %d that is already being loaded. This will cause weird chunk breakages.", p_73158_1_, p_73158_2_, worldObj.provider.getDimensionId()); ++ } ++ chunk = ForgeChunkManager.fetchDormantChunk(k, this.worldObj); ++ ++ if (chunk == null) + chunk = this.loadChunkFromFile(p_73158_1_, p_73158_2_); + + if (chunk == null) +@@ -118,6 +175,7 @@ + + this.id2ChunkMap.add(k, chunk); + this.loadedChunks.add(chunk); ++ loadingChunks.remove(k); + chunk.onChunkLoad(); + chunk.populateChunk(this, this, p_73158_1_, p_73158_2_); + } +@@ -209,6 +267,7 @@ + if (this.serverChunkGenerator != null) + { + this.serverChunkGenerator.populate(p_73153_1_, p_73153_2_, p_73153_3_); ++ net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(p_73153_2_, p_73153_3_, worldObj, serverChunkGenerator, p_73153_1_); + chunk.setChunkModified(); + } + } +@@ -269,8 +328,13 @@ + { + if (!this.worldObj.disableLevelSaving) + { +- for (int i = 0; i < 100; ++i) ++ for (ChunkCoordIntPair forced : this.worldObj.getPersistentChunks().keySet()) + { ++ this.droppedChunksSet.remove(ChunkCoordIntPair.chunkXZ2Int(forced.chunkXPos, forced.chunkZPos)); ++ } ++ ++ for (int i = 0; i < 100; ++i) ++ { + if (!this.droppedChunksSet.isEmpty()) + { + Long olong = (Long)this.droppedChunksSet.iterator().next(); +@@ -283,6 +347,11 @@ + this.saveChunkExtraData(chunk); + this.id2ChunkMap.remove(olong.longValue()); + this.loadedChunks.remove(chunk); ++ ForgeChunkManager.putDormantChunk(ChunkCoordIntPair.chunkXZ2Int(chunk.xPosition, chunk.zPosition), chunk); ++ if(loadedChunks.size() == 0 && ForgeChunkManager.getPersistentChunksFor(this.worldObj).size() == 0 && !DimensionManager.shouldLoadSpawn(this.worldObj.provider.getDimensionId())){ ++ DimensionManager.unloadWorld(this.worldObj.provider.getDimensionId()); ++ return serverChunkGenerator.unloadQueuedChunks(); ++ } + } + + this.droppedChunksSet.remove(olong); diff --git a/patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch similarity index 59% rename from patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch rename to patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch index 741188f61..27c43977a 100644 --- a/patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch @@ -10,18 +10,18 @@ import net.minecraft.block.state.IBlockState; @@ -141,7 +142,7 @@ { - IBlockState iblockstate = p_180702_5_.func_177856_a(k2, i3, l2); + IBlockState iblockstate = p_180702_5_.getBlockState(k2, i3, l2); -- if (iblockstate.func_177230_c() == Blocks.field_150358_i || iblockstate.func_177230_c() == Blocks.field_150355_j) +- if (iblockstate.getBlock() == Blocks.flowing_water || iblockstate.getBlock() == Blocks.water) + if (isOceanBlock(p_180702_5_, k2, i3, l2, p_180702_3_, p_180702_4_)) { flag3 = true; } @@ -177,32 +178,11 @@ - IBlockState iblockstate1 = p_180702_5_.func_177856_a(k2, j3, j4); - IBlockState iblockstate2 = (IBlockState)Objects.firstNonNull(p_180702_5_.func_177856_a(k2, j3 + 1, j4), Blocks.field_150350_a.func_176223_P()); + IBlockState iblockstate1 = p_180702_5_.getBlockState(k2, j3, j4); + IBlockState iblockstate2 = (IBlockState)Objects.firstNonNull(p_180702_5_.getBlockState(k2, j3 + 1, j4), Blocks.air.getDefaultState()); -- if (iblockstate1.func_177230_c() == Blocks.field_150349_c || iblockstate1.func_177230_c() == Blocks.field_150391_bh) +- if (iblockstate1.getBlock() == Blocks.grass || iblockstate1.getBlock() == Blocks.mycelium) + if (isTopBlock(p_180702_5_, k2, j3, j4, p_180702_3_, p_180702_4_)) { flag1 = true; @@ -31,20 +31,20 @@ - { - if (j3 - 1 < 10) - { -- p_180702_5_.func_177855_a(k2, j3, j4, Blocks.field_150353_l.func_176223_P()); +- p_180702_5_.setBlockState(k2, j3, j4, Blocks.lava.getDefaultState()); - } - else - { -- p_180702_5_.func_177855_a(k2, j3, j4, Blocks.field_150350_a.func_176223_P()); +- p_180702_5_.setBlockState(k2, j3, j4, Blocks.air.getDefaultState()); - -- if (iblockstate2.func_177230_c() == Blocks.field_150354_m) +- if (iblockstate2.getBlock() == Blocks.sand) - { -- p_180702_5_.func_177855_a(k2, j3 + 1, j4, iblockstate2.func_177229_b(BlockSand.field_176504_a) == BlockSand.EnumType.RED_SAND ? Blocks.field_180395_cM.func_176223_P() : Blocks.field_150322_A.func_176223_P()); +- p_180702_5_.setBlockState(k2, j3 + 1, j4, iblockstate2.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? Blocks.red_sandstone.getDefaultState() : Blocks.sandstone.getDefaultState()); - } - -- if (flag1 && p_180702_5_.func_177856_a(k2, j3 - 1, j4).func_177230_c() == Blocks.field_150346_d) +- if (flag1 && p_180702_5_.getBlockState(k2, j3 - 1, j4).getBlock() == Blocks.dirt) - { -- p_180702_5_.func_177855_a(k2, j3 - 1, j4, this.field_75039_c.func_180494_b(new BlockPos(k2 + p_180702_3_ * 16, 0, j4 + p_180702_4_ * 16)).field_76752_A.func_177230_c().func_176223_P()); +- p_180702_5_.setBlockState(k2, j3 - 1, j4, this.worldObj.getBiomeGenForCoords(new BlockPos(k2 + p_180702_3_ * 16, 0, j4 + p_180702_4_ * 16)).topBlock.getBlock().getDefaultState()); - } - } - } @@ -59,15 +59,15 @@ + + protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) + { -+ net.minecraft.block.Block block = data.func_177856_a(x, y, z).func_177230_c(); -+ return block== Blocks.field_150358_i || block == Blocks.field_150355_j; ++ net.minecraft.block.Block block = data.getBlockState(x, y, z).getBlock(); ++ return block== Blocks.flowing_water || block == Blocks.water; + } + + //Exception biomes to make sure we generate like vanilla + private boolean isExceptionBiome(net.minecraft.world.biome.BiomeGenBase biome) + { -+ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76787_r) return true; -+ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76769_d) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.beach) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.desert) return true; + return false; + } + @@ -75,9 +75,9 @@ + //Vanilla bugs to make sure that we generate the map the same way vanilla does. + private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) + { -+ net.minecraft.world.biome.BiomeGenBase biome = field_75039_c.func_180494_b(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); -+ IBlockState state = data.func_177856_a(x, y, z); -+ return (isExceptionBiome(biome) ? state.func_177230_c() == Blocks.field_150349_c : state.func_177230_c() == biome.field_76752_A); ++ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); ++ IBlockState state = data.getBlockState(x, y, z); ++ return (isExceptionBiome(biome) ? state.getBlock() == Blocks.grass : state.getBlock() == biome.topBlock); + } + + /** @@ -97,28 +97,28 @@ + */ + protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop, IBlockState state, IBlockState up) + { -+ net.minecraft.world.biome.BiomeGenBase biome = field_75039_c.func_180494_b(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); -+ IBlockState top = biome.field_76752_A; -+ IBlockState filler = biome.field_76753_B; ++ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); ++ IBlockState top = biome.topBlock; ++ IBlockState filler = biome.fillerBlock; + -+ if (this.func_175793_a(state, up) || state.func_177230_c() == top.func_177230_c() || state.func_177230_c() == filler.func_177230_c()) ++ if (this.func_175793_a(state, up) || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock()) + { + if (y < 10) + { -+ data.func_177855_a(x, y, z, Blocks.field_150353_l.func_176223_P()); ++ data.setBlockState(x, y, z, Blocks.lava.getDefaultState()); + } + else + { -+ data.func_177855_a(x, y, z, Blocks.field_150350_a.func_176223_P()); ++ data.setBlockState(x, y, z, Blocks.air.getDefaultState()); + -+ if (up.func_177230_c() == Blocks.field_150354_m) ++ if (up.getBlock() == Blocks.sand) + { -+ data.func_177855_a(x, y + 1, z, up.func_177229_b(BlockSand.field_176504_a) == BlockSand.EnumType.RED_SAND ? Blocks.field_180395_cM.func_176223_P() : Blocks.field_150322_A.func_176223_P()); ++ data.setBlockState(x, y + 1, z, up.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? Blocks.red_sandstone.getDefaultState() : Blocks.sandstone.getDefaultState()); + } + -+ if (foundTop && data.func_177856_a(x, y - 1, z).func_177230_c() == filler.func_177230_c()) ++ if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock()) + { -+ data.func_177855_a(x, y - 1, z, top.func_177230_c().func_176223_P()); ++ data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState()); + } + } + } diff --git a/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch similarity index 56% rename from patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch rename to patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch index 3e88554e1..da96d56c0 100644 --- a/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch @@ -2,36 +2,36 @@ +++ ../src-work/minecraft/net/minecraft/world/gen/MapGenRavine.java @@ -130,7 +130,7 @@ { - IBlockState iblockstate = p_180707_5_.func_177856_a(k2, i3, l2); + IBlockState iblockstate = p_180707_5_.getBlockState(k2, i3, l2); -- if (iblockstate.func_177230_c() == Blocks.field_150358_i || iblockstate.func_177230_c() == Blocks.field_150355_j) +- if (iblockstate.getBlock() == Blocks.flowing_water || iblockstate.getBlock() == Blocks.water) + if (isOceanBlock(p_180707_5_, k2, i2, l2, p_180707_3_, p_180707_4_)) { flag2 = true; } @@ -165,27 +165,12 @@ { - IBlockState iblockstate1 = p_180707_5_.func_177856_a(k2, j3, j4); + IBlockState iblockstate1 = p_180707_5_.getBlockState(k2, j3, j4); -- if (iblockstate1.func_177230_c() == Blocks.field_150349_c) +- if (iblockstate1.getBlock() == Blocks.grass) + if (isTopBlock(p_180707_5_, k2, j3, j4, p_180707_3_, p_180707_4_)) { flag = true; } -- if (iblockstate1.func_177230_c() == Blocks.field_150348_b || iblockstate1.func_177230_c() == Blocks.field_150346_d || iblockstate1.func_177230_c() == Blocks.field_150349_c) +- if (iblockstate1.getBlock() == Blocks.stone || iblockstate1.getBlock() == Blocks.dirt || iblockstate1.getBlock() == Blocks.grass) - { - if (j3 - 1 < 10) - { -- p_180707_5_.func_177855_a(k2, j3, j4, Blocks.field_150356_k.func_176223_P()); +- p_180707_5_.setBlockState(k2, j3, j4, Blocks.flowing_lava.getDefaultState()); - } - else - { -- p_180707_5_.func_177855_a(k2, j3, j4, Blocks.field_150350_a.func_176223_P()); +- p_180707_5_.setBlockState(k2, j3, j4, Blocks.air.getDefaultState()); - -- if (flag && p_180707_5_.func_177856_a(k2, j3 - 1, j4).func_177230_c() == Blocks.field_150346_d) +- if (flag && p_180707_5_.getBlockState(k2, j3 - 1, j4).getBlock() == Blocks.dirt) - { -- p_180707_5_.func_177855_a(k2, j3 - 1, j4, this.field_75039_c.func_180494_b(new BlockPos(k2 + p_180707_3_ * 16, 0, j4 + p_180707_4_ * 16)).field_76752_A); +- p_180707_5_.setBlockState(k2, j3 - 1, j4, this.worldObj.getBiomeGenForCoords(new BlockPos(k2 + p_180707_3_ * 16, 0, j4 + p_180707_4_ * 16)).topBlock); - } - } - } @@ -45,17 +45,17 @@ } + protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) + { -+ net.minecraft.block.Block block = data.func_177856_a(x, y, z).func_177230_c(); -+ return block== Blocks.field_150358_i || block == Blocks.field_150355_j; ++ net.minecraft.block.Block block = data.getBlockState(x, y, z).getBlock(); ++ return block== Blocks.flowing_water || block == Blocks.water; + } + + //Exception biomes to make sure we generate like vanilla + private boolean isExceptionBiome(net.minecraft.world.biome.BiomeGenBase biome) + { -+ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76787_r) return true; -+ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76769_d) return true; -+ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76789_p) return true; -+ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76788_q) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.beach) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.desert) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.mushroomIsland) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.mushroomIslandShore) return true; + return false; + } + @@ -63,9 +63,9 @@ + //Vanilla bugs to make sure that we generate the map the same way vanilla does. + private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) + { -+ net.minecraft.world.biome.BiomeGenBase biome = field_75039_c.func_180494_b(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); -+ IBlockState state = data.func_177856_a(x, y, z); -+ return (isExceptionBiome(biome) ? state.func_177230_c() == Blocks.field_150349_c : state.func_177230_c() == biome.field_76752_A); ++ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); ++ IBlockState state = data.getBlockState(x, y, z); ++ return (isExceptionBiome(biome) ? state.getBlock() == Blocks.grass : state.getBlock() == biome.topBlock); + } + + /** @@ -85,24 +85,24 @@ + */ + protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop) + { -+ net.minecraft.world.biome.BiomeGenBase biome = field_75039_c.func_180494_b(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); -+ IBlockState state = data.func_177856_a(x, y, z); -+ IBlockState top = isExceptionBiome(biome) ? Blocks.field_150349_c.func_176223_P() : biome.field_76752_A; -+ IBlockState filler = isExceptionBiome(biome) ? Blocks.field_150346_d.func_176223_P() : biome.field_76753_B; ++ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); ++ IBlockState state = data.getBlockState(x, y, z); ++ IBlockState top = isExceptionBiome(biome) ? Blocks.grass.getDefaultState() : biome.topBlock; ++ IBlockState filler = isExceptionBiome(biome) ? Blocks.dirt.getDefaultState() : biome.fillerBlock; + -+ if (state.func_177230_c() == Blocks.field_150348_b || state.func_177230_c() == top.func_177230_c() || state.func_177230_c() == filler.func_177230_c()) ++ if (state.getBlock() == Blocks.stone || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock()) + { + if (y < 10) + { -+ data.func_177855_a(x, y, z, Blocks.field_150353_l.func_176223_P()); ++ data.setBlockState(x, y, z, Blocks.lava.getDefaultState()); + } + else + { -+ data.func_177855_a(x, y, z, Blocks.field_150350_a.func_176223_P()); ++ data.setBlockState(x, y, z, Blocks.air.getDefaultState()); + -+ if (foundTop && data.func_177856_a(x, y - 1, z).func_177230_c() == filler.func_177230_c()) ++ if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock()) + { -+ data.func_177855_a(x, y - 1, z, top.func_177230_c().func_176223_P()); ++ data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState()); + } + } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch new file mode 100644 index 000000000..48879ccc0 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java +@@ -30,4 +30,10 @@ + this.func_175903_a(worldIn, p_175921_2_, Blocks.dirt.getDefaultState()); + } + } ++ ++ public boolean isReplaceable(World world, BlockPos pos) ++ { ++ net.minecraft.block.state.IBlockState state = world.getBlockState(pos); ++ return state.getBlock().isAir(world, pos) || state.getBlock().isLeaves(world, pos) || state.getBlock().isWood(world, pos) || func_150523_a(state.getBlock()); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch new file mode 100644 index 000000000..be61529d5 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch @@ -0,0 +1,37 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java +@@ -55,9 +55,10 @@ + { + if (k >= 0 && k < 256) + { +- Block block = worldIn.getBlockState(new BlockPos(l, k, i1)).getBlock(); ++ BlockPos pos = new BlockPos(l, k, i1); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(pos); + +- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) ++ if (!state.getBlock().isAir(worldIn, pos) && !state.getBlock().isLeaves(worldIn, pos)) + { + flag = false; + } +@@ -188,7 +189,7 @@ + { + BlockPos blockpos1 = new BlockPos(i2, l, j1); + +- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Block.getBlockById(Block.getIdFromBlock(Blocks.brown_mushroom_block) + i), k1); + } +@@ -199,9 +200,10 @@ + + for (l = 0; l < j; ++l) + { +- Block block2 = worldIn.getBlockState(p_180709_3_.up(l)).getBlock(); ++ BlockPos upN = p_180709_3_.up(l); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(upN); + +- if (!block2.isFullBlock()) ++ if (state.getBlock().canBeReplacedByLeaves(worldIn, upN)) + { + this.func_175905_a(worldIn, p_180709_3_.up(l), Block.getBlockById(Block.getIdFromBlock(Blocks.brown_mushroom_block) + i), 10); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch new file mode 100644 index 000000000..770a0d932 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch @@ -0,0 +1,52 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java +@@ -107,9 +107,9 @@ + if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_180712_2_ * p_180712_2_)) + { + BlockPos blockpos1 = p_180712_1_.add(j, 0, k); +- Material material = this.world.getBlockState(blockpos1).getBlock().getMaterial(); ++ net.minecraft.block.state.IBlockState state = this.world.getBlockState(blockpos1); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(this.world, blockpos1) || state.getBlock().isLeaves(this.world, blockpos1)) + { + this.func_175905_a(this.world, blockpos1, p_180712_3_, 0); + } +@@ -268,7 +268,7 @@ + { + BlockPos blockpos3 = p_175936_1_.add((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2)); + +- if (!this.func_150523_a(this.world.getBlockState(blockpos3).getBlock())) ++ if (!this.isReplaceable(world, blockpos3)) + { + return j; + } +@@ -296,6 +296,7 @@ + + if (!this.validTreeLocation()) + { ++ this.world = null; //Fix vanilla Mem leak, holds latest world + return false; + } + else +@@ -304,15 +305,18 @@ + this.func_175941_b(); + this.func_175942_c(); + this.func_175939_d(); ++ this.world = null; //Fix vanilla Mem leak, holds latest world + return true; + } + } + + private boolean validTreeLocation() + { +- Block block = this.world.getBlockState(this.field_175947_m.down()).getBlock(); ++ BlockPos down = this.field_175947_m.down(); ++ net.minecraft.block.state.IBlockState state = this.world.getBlockState(down); ++ boolean isSoil = state.getBlock().canSustainPlant(this.world, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + +- if (block != Blocks.dirt && block != Blocks.grass && block != Blocks.farmland) ++ if (!isSoil) + { + return false; + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch new file mode 100644 index 000000000..20776886b --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch @@ -0,0 +1,67 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java +@@ -48,7 +48,7 @@ + { + if (j >= 0 && j < 256) + { +- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(k, j, l)).getBlock())) ++ if (!this.isReplaceable(worldIn, new BlockPos(k, j, l))) + { + flag = false; + } +@@ -67,14 +67,16 @@ + } + else + { +- Block block = worldIn.getBlockState(p_180709_3_.down()).getBlock(); ++ BlockPos down = p_180709_3_.down(); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(down); ++ boolean isSoil = state.getBlock().canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + +- if ((block == Blocks.grass || block == Blocks.dirt) && p_180709_3_.getY() < 256 - i - 1) ++ if (isSoil && p_180709_3_.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, p_180709_3_.down()); +- this.func_175921_a(worldIn, p_180709_3_.add(1, -1, 0)); +- this.func_175921_a(worldIn, p_180709_3_.add(1, -1, 1)); +- this.func_175921_a(worldIn, p_180709_3_.add(0, -1, 1)); ++ this.onPlantGrow(worldIn, p_180709_3_.down(), p_180709_3_); ++ this.onPlantGrow(worldIn, p_180709_3_.add(1, -1, 0), p_180709_3_); ++ this.onPlantGrow(worldIn, p_180709_3_.add(1, -1, 1), p_180709_3_); ++ this.onPlantGrow(worldIn, p_180709_3_.add(0, -1, 1), p_180709_3_); + EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(p_180709_2_); + k = i - p_180709_2_.nextInt(4); + l = 2 - p_180709_2_.nextInt(3); +@@ -96,9 +98,9 @@ + } + + BlockPos blockpos1 = new BlockPos(i1, i2, j1); +- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); ++ state = worldIn.getBlockState(blockpos1); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(worldIn, blockpos1) || state.getBlock().isLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.log2, BlockPlanks.EnumType.DARK_OAK.getMetadata() - 4); + this.func_175905_a(worldIn, blockpos1.east(), Blocks.log2, BlockPlanks.EnumType.DARK_OAK.getMetadata() - 4); +@@ -202,11 +204,18 @@ + + private void func_150526_a(World worldIn, int p_150526_2_, int p_150526_3_, int p_150526_4_) + { +- Block block = worldIn.getBlockState(new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_)).getBlock(); ++ BlockPos pos = new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(pos); + +- if (block.getMaterial() == Material.air) ++ if (state.getBlock().isAir(worldIn, pos)) + { + this.func_175905_a(worldIn, new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_), Blocks.leaves2, 1); + } + } ++ ++ //Just a helper macro ++ private void onPlantGrow(World world, BlockPos pos, BlockPos source) ++ { ++ world.getBlockState(pos).getBlock().onPlantGrow(world, pos, source); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch new file mode 100644 index 000000000..f831c5456 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java +@@ -15,10 +15,12 @@ + { + Block block; + +- while (((block = worldIn.getBlockState(p_180709_3_).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && p_180709_3_.getY() > 0) ++ do + { ++ block = worldIn.getBlockState(p_180709_3_).getBlock(); ++ if (!block.isLeaves(worldIn, p_180709_3_) && !block.isLeaves(worldIn, p_180709_3_)) break; + p_180709_3_ = p_180709_3_.down(); +- } ++ } while (p_180709_3_.getY() > 0); + + for (int i = 0; i < 4; ++i) + { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch similarity index 57% rename from patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch rename to patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch index ab64b259f..0e03624a9 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch @@ -13,28 +13,28 @@ @@ -140,12 +143,11 @@ if (k2 == 1) { - p_180709_1_.func_180501_a(blockpos2, Blocks.field_150486_ae.func_176458_f(p_180709_1_, blockpos2, Blocks.field_150486_ae.func_176223_P()), 2); -- List list = WeightedRandomChestContent.func_177629_a(field_175917_c, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_180709_2_)}); - TileEntity tileentity1 = p_180709_1_.func_175625_s(blockpos2); + worldIn.setBlockState(blockpos2, Blocks.chest.correctFacing(worldIn, blockpos2, Blocks.chest.getDefaultState()), 2); +- List list = WeightedRandomChestContent.func_177629_a(CHESTCONTENT, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_180709_2_)}); + TileEntity tileentity1 = worldIn.getTileEntity(blockpos2); if (tileentity1 instanceof TileEntityChest) { -- WeightedRandomChestContent.func_177630_a(p_180709_2_, list, (TileEntityChest)tileentity1, 8); -+ WeightedRandomChestContent.func_177630_a(p_180709_2_, ChestGenHooks.getItems(DUNGEON_CHEST, p_180709_2_), (TileEntityChest)tileentity1, ChestGenHooks.getCount(DUNGEON_CHEST, p_180709_2_)); +- WeightedRandomChestContent.generateChestContents(p_180709_2_, list, (TileEntityChest)tileentity1, 8); ++ WeightedRandomChestContent.generateChestContents(p_180709_2_, ChestGenHooks.getItems(DUNGEON_CHEST, p_180709_2_), (TileEntityChest)tileentity1, ChestGenHooks.getCount(DUNGEON_CHEST, p_180709_2_)); } break label197; @@ -184,6 +186,12 @@ - private String func_76543_b(Random p_76543_1_) + private String pickMobSpawner(Random p_76543_1_) { -- return field_175916_b[p_76543_1_.nextInt(field_175916_b.length)]; +- return SPAWNERTYPES[p_76543_1_.nextInt(SPAWNERTYPES.length)]; + return DungeonHooks.getRandomDungeonMob(p_76543_1_); } + + static + { -+ ChestGenHooks.init(DUNGEON_CHEST, field_175917_c, 8, 8); -+ ChestGenHooks.addItem(DUNGEON_CHEST, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); ++ ChestGenHooks.init(DUNGEON_CHEST, CHESTCONTENT, 8, 8); ++ ChestGenHooks.addItem(DUNGEON_CHEST, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); + } } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch new file mode 100644 index 000000000..2d2f4adf8 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch @@ -0,0 +1,50 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java +@@ -55,7 +55,7 @@ + { + if (j >= 0 && j < 256) + { +- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(k, j, l)).getBlock())) ++ if (!this.isReplaceable(worldIn, new BlockPos(k, j, l))) + { + flag = false; + } +@@ -74,11 +74,13 @@ + } + else + { +- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); ++ BlockPos down = p_180709_3_.down(); ++ Block block1 = worldIn.getBlockState(down).getBlock(); ++ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + +- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && p_180709_3_.getY() < 256 - i - 1) ++ if (isSoil && p_180709_3_.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, p_180709_3_.down()); ++ block1.onPlantGrow(worldIn, down, p_180709_3_); + int i2; + + for (i2 = p_180709_3_.getY() - 3 + i; i2 <= p_180709_3_.getY() + i; ++i2) +@@ -99,7 +101,7 @@ + BlockPos blockpos1 = new BlockPos(i1, i2, k1); + Block block = worldIn.getBlockState(blockpos1).getBlock(); + +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (block.isAir(worldIn, blockpos1) || block.isLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.leaves, BlockPlanks.EnumType.BIRCH.getMetadata()); + } +@@ -110,9 +112,10 @@ + + for (i2 = 0; i2 < i; ++i2) + { +- Block block2 = worldIn.getBlockState(p_180709_3_.up(i2)).getBlock(); ++ BlockPos upN = p_180709_3_.up(i2); ++ Block block2 = worldIn.getBlockState(upN).getBlock(); + +- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves) ++ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN)) + { + this.func_175905_a(worldIn, p_180709_3_.up(i2), Blocks.log, BlockPlanks.EnumType.BIRCH.getMetadata()); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch new file mode 100644 index 000000000..ba7c2ce39 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch @@ -0,0 +1,66 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java +@@ -59,7 +59,7 @@ + { + for (int l = -b0; l <= b0 && flag; ++l) + { +- if (p_175926_2_.getY() + j < 0 || p_175926_2_.getY() + j >= 256 || !this.func_150523_a(worldIn.getBlockState(p_175926_2_.add(k, j, l)).getBlock())) ++ if (p_175926_2_.getY() + j < 0 || p_175926_2_.getY() + j >= 256 || !this.isReplaceable(worldIn, p_175926_2_.add(k, j, l))) + { + flag = false; + } +@@ -79,13 +79,14 @@ + { + BlockPos blockpos1 = p_175927_1_.down(); + Block block = worldIn.getBlockState(blockpos1).getBlock(); ++ boolean isSoil = block.canSustainPlant(worldIn, blockpos1, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + +- if ((block == Blocks.grass || block == Blocks.dirt) && p_175927_1_.getY() >= 2) ++ if (isSoil && p_175927_1_.getY() >= 2) + { +- this.func_175921_a(worldIn, blockpos1); +- this.func_175921_a(worldIn, blockpos1.east()); +- this.func_175921_a(worldIn, blockpos1.south()); +- this.func_175921_a(worldIn, blockpos1.south().east()); ++ this.onPlantGrow(worldIn, blockpos1, p_175927_1_); ++ this.onPlantGrow(worldIn, blockpos1.east(), p_175927_1_); ++ this.onPlantGrow(worldIn, blockpos1.south(), p_175927_1_); ++ this.onPlantGrow(worldIn, blockpos1.south().east(), p_175927_1_); + return true; + } + else +@@ -113,9 +114,9 @@ + if (k * k + l * l <= j || i1 * i1 + j1 * j1 <= j || k * k + j1 * j1 <= j || i1 * i1 + l * l <= j) + { + BlockPos blockpos1 = p_175925_2_.add(k, 0, l); +- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos1); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(worldIn, blockpos1) || state.getBlock().isLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.leaves, this.leavesMetadata); + } +@@ -135,9 +136,9 @@ + if (k * k + l * l <= j) + { + BlockPos blockpos1 = p_175928_2_.add(k, 0, l); +- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); ++ Block block = worldIn.getBlockState(blockpos1).getBlock(); + +- if (material == Material.air || material == Material.leaves) ++ if (block.isAir(worldIn, blockpos1) || block.isLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.leaves, this.leavesMetadata); + } +@@ -145,4 +146,10 @@ + } + } + } ++ ++ //Just a helper macro ++ private void onPlantGrow(World world, BlockPos pos, BlockPos source) ++ { ++ world.getBlockState(pos).getBlock().onPlantGrow(world, pos, source); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch new file mode 100644 index 000000000..e68e9e598 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch @@ -0,0 +1,62 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java +@@ -57,7 +57,7 @@ + { + BlockPos blockpos1 = p_180709_3_.up(i2); + +- if (this.func_175931_a(worldIn.getBlockState(blockpos1).getBlock().getMaterial())) ++ if (this.isAirLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.log, this.woodMetadata); + +@@ -72,7 +72,7 @@ + { + BlockPos blockpos2 = blockpos1.east(); + +- if (this.func_175931_a(worldIn.getBlockState(blockpos2).getBlock().getMaterial())) ++ if (this.isAirLeaves(worldIn, blockpos2)) + { + this.func_175905_a(worldIn, blockpos2, Blocks.log, this.woodMetadata); + +@@ -85,7 +85,7 @@ + + BlockPos blockpos3 = blockpos1.south().east(); + +- if (this.func_175931_a(worldIn.getBlockState(blockpos3).getBlock().getMaterial())) ++ if (this.isAirLeaves(worldIn, blockpos3)) + { + this.func_175905_a(worldIn, blockpos3, Blocks.log, this.woodMetadata); + +@@ -98,7 +98,7 @@ + + BlockPos blockpos4 = blockpos1.south(); + +- if (this.func_175931_a(worldIn.getBlockState(blockpos4).getBlock().getMaterial())) ++ if (this.isAirLeaves(worldIn, blockpos4)) + { + this.func_175905_a(worldIn, blockpos4, Blocks.log, this.woodMetadata); + +@@ -115,11 +115,6 @@ + } + } + +- private boolean func_175931_a(Material p_175931_1_) +- { +- return p_175931_1_ == Material.air || p_175931_1_ == Material.leaves; +- } +- + private void func_175932_b(World worldIn, Random p_175932_2_, BlockPos p_175932_3_, int p_175932_4_) + { + if (p_175932_2_.nextInt(3) > 0 && worldIn.isAirBlock(p_175932_3_)) +@@ -137,4 +132,11 @@ + this.func_175925_a(worldIn, p_175930_2_.up(j), p_175930_3_ + 1 - j); + } + } ++ ++ //Helper macro ++ private boolean isAirLeaves(World world, BlockPos pos) ++ { ++ net.minecraft.block.Block block = world.getBlockState(pos).getBlock(); ++ return block.isAir(world, pos) || block.isLeaves(world, pos); ++ } + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch new file mode 100644 index 000000000..977698bfd --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch @@ -0,0 +1,65 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java +@@ -35,32 +35,24 @@ + + for (int j = 0; j < i; ++j) + { +- Block block = worldIn.getBlockState(p_180709_3_.up(j)).getBlock(); +- +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (this.isAirLeaves(worldIn, p_180709_3_.up(j))) + { + this.func_175905_a(worldIn, p_180709_3_.up(j), Blocks.log, this.woodMetadata); + } + + if (j < i - 1) + { +- block = worldIn.getBlockState(p_180709_3_.add(1, j, 0)).getBlock(); +- +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (this.isAirLeaves(worldIn, p_180709_3_.add(1, j, 0))) + { + this.func_175905_a(worldIn, p_180709_3_.add(1, j, 0), Blocks.log, this.woodMetadata); + } + +- block = worldIn.getBlockState(p_180709_3_.add(1, j, 1)).getBlock(); +- +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (this.isAirLeaves(worldIn, p_180709_3_.add(1, j, 1))) + { + this.func_175905_a(worldIn, p_180709_3_.add(1, j, 1), Blocks.log, this.woodMetadata); + } + +- block = worldIn.getBlockState(p_180709_3_.add(0, j, 1)).getBlock(); +- +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (this.isAirLeaves(worldIn, p_180709_3_.add(0, j, 1))) + { + this.func_175905_a(worldIn, p_180709_3_.add(0, j, 1), Blocks.log, this.woodMetadata); + } +@@ -126,16 +118,23 @@ + BlockPos blockpos1 = p_175934_2_.up(i); + Block block = worldIn.getBlockState(blockpos1).getBlock(); + +- if (block == Blocks.grass || block == Blocks.dirt) ++ if (block.canSustainPlant(worldIn, blockpos1, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) + { + this.func_175905_a(worldIn, blockpos1, Blocks.dirt, BlockDirt.DirtType.PODZOL.getMetadata()); + break; + } + +- if (block.getMaterial() != Material.air && i < 0) ++ if (!block.isAir(worldIn, blockpos1) && i < 0) + { + break; + } + } + } ++ ++ //Helper macro ++ private boolean isAirLeaves(World world, BlockPos pos) ++ { ++ net.minecraft.block.Block block = world.getBlockState(pos).getBlock(); ++ return block.isAir(world, pos) || block.isLeaves(world, pos); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch similarity index 59% rename from patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch rename to patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch index b8dbd5446..481106e17 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch @@ -4,8 +4,8 @@ { BlockPos blockpos1 = new BlockPos(l1, i2, j2); -- if (this.field_175919_c.apply(p_180709_1_.func_180495_p(blockpos1))) -+ if (p_180709_1_.func_180495_p(blockpos1).func_177230_c().isReplaceableOreGen(p_180709_1_, blockpos1, this.field_175919_c)) +- if (this.field_175919_c.apply(worldIn.getBlockState(blockpos1))) ++ if (worldIn.getBlockState(blockpos1).getBlock().isReplaceableOreGen(worldIn, blockpos1, this.field_175919_c)) { - p_180709_1_.func_180501_a(blockpos1, this.field_175920_a, 2); + worldIn.setBlockState(blockpos1, this.oreBlock, 2); } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch new file mode 100644 index 000000000..c7fe1a680 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch @@ -0,0 +1,64 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java +@@ -48,7 +48,7 @@ + { + if (j >= 0 && j < 256) + { +- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(k, j, l)).getBlock())) ++ if (!this.isReplaceable(worldIn, new BlockPos(k, j, l))) + { + flag = false; + } +@@ -67,11 +67,13 @@ + } + else + { +- Block block = worldIn.getBlockState(p_180709_3_.down()).getBlock(); ++ BlockPos down = p_180709_3_.down(); ++ Block block = worldIn.getBlockState(down).getBlock(); ++ boolean isSoil = block.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + +- if ((block == Blocks.grass || block == Blocks.dirt) && p_180709_3_.getY() < 256 - i - 1) ++ if (isSoil && p_180709_3_.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, p_180709_3_.down()); ++ block.onPlantGrow(worldIn, down, p_180709_3_); + EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(p_180709_2_); + k = i - p_180709_2_.nextInt(4) - 1; + l = 3 - p_180709_2_.nextInt(3); +@@ -92,9 +94,9 @@ + } + + BlockPos blockpos1 = new BlockPos(i1, i2, j1); +- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); ++ block = worldIn.getBlockState(blockpos1).getBlock(); + +- if (material == Material.air || material == Material.leaves) ++ if (block.isAir(worldIn, blockpos1) || block.isLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.log2, BlockPlanks.EnumType.ACACIA.getMetadata() - 4); + k1 = i2; +@@ -148,9 +150,9 @@ + i1 += enumfacing1.getFrontOffsetX(); + j1 += enumfacing1.getFrontOffsetZ(); + BlockPos blockpos2 = new BlockPos(i1, j2, j1); +- Material material1 = worldIn.getBlockState(blockpos2).getBlock().getMaterial(); ++ block = worldIn.getBlockState(blockpos2).getBlock(); + +- if (material1 == Material.air || material1 == Material.leaves) ++ if (block.isAir(worldIn, blockpos2) || block.isLeaves(worldIn, blockpos2)) + { + this.func_175905_a(worldIn, blockpos2, Blocks.log2, BlockPlanks.EnumType.ACACIA.getMetadata() - 4); + k1 = j2; +@@ -204,9 +206,9 @@ + + private void func_175924_b(World worldIn, BlockPos p_175924_2_) + { +- Material material = worldIn.getBlockState(p_175924_2_).getBlock().getMaterial(); ++ Block block = worldIn.getBlockState(p_175924_2_).getBlock(); + +- if (material == Material.air || material == Material.leaves) ++ if (block.isAir(worldIn, p_175924_2_) || block.isLeaves(worldIn, p_175924_2_)) + { + this.func_175905_a(worldIn, p_175924_2_, Blocks.leaves2, 0); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch new file mode 100644 index 000000000..8e0457eb7 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java +@@ -24,14 +24,16 @@ + { + Block block; + +- while (((block = worldIn.getBlockState(p_180709_3_).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && p_180709_3_.getY() > 0) ++ do + { ++ block = worldIn.getBlockState(p_180709_3_).getBlock(); ++ if (!block.isAir(worldIn, p_180709_3_) && !block.isLeaves(worldIn, p_180709_3_)) break; + p_180709_3_ = p_180709_3_.down(); +- } ++ } while (p_180709_3_.getY() > 0); + + Block block1 = worldIn.getBlockState(p_180709_3_).getBlock(); + +- if (block1 == Blocks.dirt || block1 == Blocks.grass) ++ if (block1.canSustainPlant(worldIn, p_180709_3_, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) + { + p_180709_3_ = p_180709_3_.up(); + this.func_175905_a(worldIn, p_180709_3_, Blocks.log, this.field_150527_b); +@@ -53,7 +55,7 @@ + { + BlockPos blockpos1 = new BlockPos(l, i, j1); + +- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.leaves, this.field_150528_a); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch new file mode 100644 index 000000000..9f494c4d2 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch @@ -0,0 +1,98 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java +@@ -53,9 +53,10 @@ + { + if (j >= 0 && j < 256) + { +- Block block = worldIn.getBlockState(new BlockPos(k, j, l)).getBlock(); ++ BlockPos pos = new BlockPos(k, j, l); ++ Block block = worldIn.getBlockState(pos).getBlock(); + +- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) ++ if (!block.isAir(worldIn, pos) && !block.isLeaves(worldIn, pos)) + { + if (block != Blocks.water && block != Blocks.flowing_water) + { +@@ -81,11 +82,13 @@ + } + else + { +- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); ++ BlockPos down = p_180709_3_.down(); ++ Block block1 = worldIn.getBlockState(down).getBlock(); ++ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + +- if ((block1 == Blocks.grass || block1 == Blocks.dirt) && p_180709_3_.getY() < 256 - i - 1) ++ if (isSoil && p_180709_3_.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, p_180709_3_.down()); ++ block1.onPlantGrow(worldIn, down, p_180709_3_); + int i1; + BlockPos blockpos1; + int l1; +@@ -108,7 +111,7 @@ + { + blockpos1 = new BlockPos(i2, l1, j1); + +- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) + { + this.func_175906_a(worldIn, blockpos1, Blocks.leaves); + } +@@ -119,9 +122,10 @@ + + for (l1 = 0; l1 < i; ++l1) + { +- Block block2 = worldIn.getBlockState(p_180709_3_.up(l1)).getBlock(); ++ BlockPos upN = p_180709_3_.up(l1); ++ Block block2 = worldIn.getBlockState(upN).getBlock(); + +- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves || block2 == Blocks.flowing_water || block2 == Blocks.water) ++ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN) || block2 == Blocks.flowing_water || block2 == Blocks.water) + { + this.func_175906_a(worldIn, p_180709_3_.up(l1), Blocks.log); + } +@@ -138,29 +142,29 @@ + { + BlockPos blockpos4 = new BlockPos(i2, l1, i1); + +- if (worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.leaves) ++ if (worldIn.getBlockState(blockpos4).getBlock().isLeaves(worldIn, blockpos4)) + { + BlockPos blockpos5 = blockpos4.west(); + blockpos1 = blockpos4.east(); + BlockPos blockpos2 = blockpos4.north(); + BlockPos blockpos3 = blockpos4.south(); + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos5).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos5).getBlock().isAir(worldIn, blockpos5)) + { + this.func_175922_a(worldIn, blockpos5, BlockVine.EAST_FLAG); + } + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().isAir(worldIn, blockpos1)) + { + this.func_175922_a(worldIn, blockpos1, BlockVine.WEST_FLAG); + } + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().isAir(worldIn, blockpos2)) + { + this.func_175922_a(worldIn, blockpos2, BlockVine.SOUTH_FLAG); + } + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().isAir(worldIn, blockpos3)) + { + this.func_175922_a(worldIn, blockpos3, BlockVine.NORTH_FLAG); + } +@@ -188,7 +192,7 @@ + this.func_175905_a(worldIn, p_175922_2_, Blocks.vine, p_175922_3_); + int j = 4; + +- for (p_175922_2_ = p_175922_2_.down(); worldIn.getBlockState(p_175922_2_).getBlock().getMaterial() == Material.air && j > 0; --j) ++ for (p_175922_2_ = p_175922_2_.down(); worldIn.getBlockState(p_175922_2_).getBlock().isAir(worldIn, p_175922_2_) && j > 0; --j) + { + this.func_175905_a(worldIn, p_175922_2_, Blocks.vine, p_175922_3_); + p_175922_2_ = p_175922_2_.down(); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch new file mode 100644 index 000000000..61623fed2 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch @@ -0,0 +1,50 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java +@@ -50,7 +50,7 @@ + { + if (i1 >= 0 && i1 < 256) + { +- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(j1, i1, k1)).getBlock())) ++ if (!this.isReplaceable(worldIn, new BlockPos(j1, i1, k1))) + { + flag = false; + } +@@ -69,11 +69,13 @@ + } + else + { +- Block block = worldIn.getBlockState(p_180709_3_.down()).getBlock(); ++ BlockPos down = p_180709_3_.down(); ++ Block block = worldIn.getBlockState(down).getBlock(); ++ boolean isSoil = block.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); + +- if ((block == Blocks.grass || block == Blocks.dirt) && p_180709_3_.getY() < 256 - i - 1) ++ if (isSoil && p_180709_3_.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, p_180709_3_.down()); ++ block.onPlantGrow(worldIn, down, p_180709_3_); + k2 = 0; + + for (j1 = p_180709_3_.getY() + i; j1 >= p_180709_3_.getY() + j; --j1) +@@ -90,7 +92,7 @@ + { + BlockPos blockpos1 = new BlockPos(k1, j1, i2); + +- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.leaves, BlockPlanks.EnumType.SPRUCE.getMetadata()); + } +@@ -110,9 +112,10 @@ + + for (j1 = 0; j1 < i - 1; ++j1) + { +- Block block1 = worldIn.getBlockState(p_180709_3_.up(j1)).getBlock(); ++ BlockPos upN = p_180709_3_.up(j1); ++ Block block1 = worldIn.getBlockState(upN).getBlock(); + +- if (block1.getMaterial() == Material.air || block1.getMaterial() == Material.leaves) ++ if (block1.isAir(worldIn, upN) || block1.isLeaves(worldIn, upN)) + { + this.func_175905_a(worldIn, p_180709_3_.up(j1), Blocks.log, BlockPlanks.EnumType.SPRUCE.getMetadata()); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch new file mode 100644 index 000000000..ba4253cd2 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch @@ -0,0 +1,54 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java +@@ -49,9 +49,10 @@ + { + if (i1 >= 0 && i1 < 256) + { +- Block block = worldIn.getBlockState(new BlockPos(j1, i1, k1)).getBlock(); ++ BlockPos off = new BlockPos(j1, i1, k1); ++ Block block = worldIn.getBlockState(off).getBlock(); + +- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) ++ if (!block.isAir(worldIn, off) && !block.isLeaves(worldIn, off)) + { + flag = false; + } +@@ -70,11 +71,13 @@ + } + else + { +- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); ++ BlockPos down = p_180709_3_.down(); ++ Block block1 = worldIn.getBlockState(down).getBlock(); ++ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); + +- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && p_180709_3_.getY() < 256 - i - 1) ++ if (isSoil && p_180709_3_.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, p_180709_3_.down()); ++ block1.onPlantGrow(worldIn, down, p_180709_3_); + i3 = p_180709_2_.nextInt(2); + j1 = 1; + byte b0 = 0; +@@ -97,7 +100,7 @@ + { + BlockPos blockpos1 = new BlockPos(i2, l1, k2); + +- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.leaves, BlockPlanks.EnumType.SPRUCE.getMetadata()); + } +@@ -126,9 +129,10 @@ + + for (l1 = 0; l1 < i - j3; ++l1) + { +- Block block2 = worldIn.getBlockState(p_180709_3_.up(l1)).getBlock(); ++ BlockPos upN = p_180709_3_.up(l1); ++ Block block2 = worldIn.getBlockState(upN).getBlock(); + +- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves) ++ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN)) + { + this.func_175905_a(worldIn, p_180709_3_.up(l1), Blocks.log, BlockPlanks.EnumType.SPRUCE.getMetadata()); + } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch new file mode 100644 index 000000000..b4a3e7320 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java +@@ -23,10 +23,12 @@ + { + Block block; + +- while (((block = worldIn.getBlockState(p_180709_3_).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && p_180709_3_.getY() > 0) ++ do + { ++ block = worldIn.getBlockState(p_180709_3_).getBlock(); ++ if (!block.isAir(worldIn, p_180709_3_) && !block.isLeaves(worldIn, p_180709_3_)) break; + p_180709_3_ = p_180709_3_.down(); +- } ++ } while (p_180709_3_.getY() > 0); + + for (int i = 0; i < 128; ++i) + { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch new file mode 100644 index 000000000..83d55d981 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch @@ -0,0 +1,94 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java +@@ -61,7 +61,7 @@ + { + if (j >= 0 && j < 256) + { +- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(k, j, l)).getBlock())) ++ if (!this.isReplaceable(worldIn, new BlockPos(k, j, l))) + { + flag = false; + } +@@ -80,11 +80,13 @@ + } + else + { +- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); ++ BlockPos down = p_180709_3_.down(); ++ Block block1 = worldIn.getBlockState(down).getBlock(); ++ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); + +- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && p_180709_3_.getY() < 256 - i - 1) ++ if (isSoil && p_180709_3_.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, p_180709_3_.down()); ++ block1.onPlantGrow(worldIn, down, p_180709_3_); + b0 = 3; + byte b1 = 0; + int i1; +@@ -111,7 +113,7 @@ + blockpos1 = new BlockPos(k1, l, i2); + Block block = worldIn.getBlockState(blockpos1).getBlock(); + +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves || block.getMaterial() == Material.vine) ++ if (block.isAir(worldIn, blockpos1) || block.isLeaves(worldIn, blockpos1) || block.getMaterial() == Material.vine) + { + this.func_175905_a(worldIn, blockpos1, Blocks.leaves, this.metaLeaves); + } +@@ -122,9 +124,10 @@ + + for (l = 0; l < i; ++l) + { +- Block block2 = worldIn.getBlockState(p_180709_3_.up(l)).getBlock(); ++ BlockPos upN = p_180709_3_.up(l); ++ Block block2 = worldIn.getBlockState(upN).getBlock(); + +- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves || block2.getMaterial() == Material.vine) ++ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN) || block2.getMaterial() == Material.vine) + { + this.func_175905_a(worldIn, p_180709_3_.up(l), Blocks.log, this.metaWood); + +@@ -166,29 +169,29 @@ + { + BlockPos blockpos3 = new BlockPos(k1, l, l1); + +- if (worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.leaves) ++ if (worldIn.getBlockState(blockpos3).getBlock().isLeaves(worldIn, blockpos3)) + { + BlockPos blockpos4 = blockpos3.west(); + blockpos1 = blockpos3.east(); + BlockPos blockpos5 = blockpos3.north(); + BlockPos blockpos2 = blockpos3.south(); + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().isAir(worldIn, blockpos4)) + { + this.func_175923_a(worldIn, blockpos4, BlockVine.EAST_FLAG); + } + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().isAir(worldIn, blockpos1)) + { + this.func_175923_a(worldIn, blockpos1, BlockVine.WEST_FLAG); + } + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos5).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos5).getBlock().isAir(worldIn, blockpos5)) + { + this.func_175923_a(worldIn, blockpos5, BlockVine.SOUTH_FLAG); + } + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().isAir(worldIn, blockpos2)) + { + this.func_175923_a(worldIn, blockpos2, BlockVine.NORTH_FLAG); + } +@@ -233,7 +236,7 @@ + this.func_175905_a(worldIn, p_175923_2_, Blocks.vine, p_175923_3_); + int j = 4; + +- for (p_175923_2_ = p_175923_2_.down(); worldIn.getBlockState(p_175923_2_).getBlock().getMaterial() == Material.air && j > 0; --j) ++ for (p_175923_2_ = p_175923_2_.down(); worldIn.getBlockState(p_175923_2_).getBlock().isAir(worldIn, p_175923_2_) && j > 0; --j) + { + this.func_175905_a(worldIn, p_175923_2_, Blocks.vine, p_175923_3_); + p_175923_2_ = p_175923_2_.down(); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch new file mode 100644 index 000000000..e46096942 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java +@@ -27,10 +27,12 @@ + { + Block block; + +- while (((block = worldIn.getBlockState(p_180709_3_).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && p_180709_3_.getY() > 1) ++ do + { ++ block = worldIn.getBlockState(p_180709_3_).getBlock(); ++ if (!block.isAir(worldIn, p_180709_3_) && !block.isLeaves(worldIn, p_180709_3_)) break; + p_180709_3_ = p_180709_3_.down(); +- } ++ } while (p_180709_3_.getY() > 0); + + if (p_180709_3_.getY() < 1) + { diff --git a/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch similarity index 68% rename from patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch rename to patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch index 1fe3bb9aa..a6a1784f0 100644 --- a/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch @@ -9,48 +9,48 @@ + public abstract class GenLayer { - private long field_75907_b; + private long worldGenSeed; @@ -53,11 +56,11 @@ j = 6; } + j = getModdedBiomeSize(p_180781_2_, j); + - GenLayer genlayer = GenLayerZoom.func_75915_a(1000L, genlayer2, 0); + GenLayer genlayer = GenLayerZoom.magnify(1000L, genlayer2, 0); GenLayerRiverInit genlayerriverinit = new GenLayerRiverInit(100L, genlayer); - GenLayerBiome genlayerbiome = new GenLayerBiome(200L, genlayer2, p_180781_2_, p_180781_3_); -- GenLayer genlayer3 = GenLayerZoom.func_75915_a(1000L, genlayerbiome, 2); +- GenLayer genlayer3 = GenLayerZoom.magnify(1000L, genlayerbiome, 2); - GenLayerBiomeEdge genlayerbiomeedge = new GenLayerBiomeEdge(1000L, genlayer3); + GenLayer genlayerbiomeedge = p_180781_2_.getBiomeLayer(p_180781_0_, genlayer2, p_180781_3_); - GenLayer genlayer1 = GenLayerZoom.func_75915_a(1000L, genlayerriverinit, 2); + GenLayer genlayer1 = GenLayerZoom.magnify(1000L, genlayerriverinit, 2); GenLayerHills genlayerhills = new GenLayerHills(1000L, genlayerbiomeedge, genlayer1); - genlayer = GenLayerZoom.func_75915_a(1000L, genlayerriverinit, 2); + genlayer = GenLayerZoom.magnify(1000L, genlayerriverinit, 2); @@ -194,7 +197,7 @@ - protected static boolean func_151618_b(int p_151618_0_) + protected static boolean isBiomeOceanic(int p_151618_0_) { -- return p_151618_0_ == BiomeGenBase.field_76771_b.field_76756_M || p_151618_0_ == BiomeGenBase.field_150575_M.field_76756_M || p_151618_0_ == BiomeGenBase.field_76776_l.field_76756_M; -+ return BiomeManager.oceanBiomes.contains(BiomeGenBase.func_150568_d(p_151618_0_)); +- return p_151618_0_ == BiomeGenBase.ocean.biomeID || p_151618_0_ == BiomeGenBase.deepOcean.biomeID || p_151618_0_ == BiomeGenBase.frozenOcean.biomeID; ++ return BiomeManager.oceanBiomes.contains(BiomeGenBase.getBiome(p_151618_0_)); } - protected int func_151619_a(int ... p_151619_1_) + protected int selectRandom(int ... p_151619_1_) @@ -206,4 +209,27 @@ { - return p_151617_2_ == p_151617_3_ && p_151617_3_ == p_151617_4_ ? p_151617_2_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_3_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_3_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_2_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_4_ && p_151617_2_ != p_151617_3_ ? p_151617_1_ : (p_151617_2_ == p_151617_3_ && p_151617_1_ != p_151617_4_ ? p_151617_2_ : (p_151617_2_ == p_151617_4_ && p_151617_1_ != p_151617_3_ ? p_151617_2_ : (p_151617_3_ == p_151617_4_ && p_151617_1_ != p_151617_2_ ? p_151617_3_ : this.func_151619_a(new int[] {p_151617_1_, p_151617_2_, p_151617_3_, p_151617_4_})))))))))); + return p_151617_2_ == p_151617_3_ && p_151617_3_ == p_151617_4_ ? p_151617_2_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_3_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_3_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_2_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_4_ && p_151617_2_ != p_151617_3_ ? p_151617_1_ : (p_151617_2_ == p_151617_3_ && p_151617_1_ != p_151617_4_ ? p_151617_2_ : (p_151617_2_ == p_151617_4_ && p_151617_1_ != p_151617_3_ ? p_151617_2_ : (p_151617_3_ == p_151617_4_ && p_151617_1_ != p_151617_2_ ? p_151617_3_ : this.selectRandom(new int[] {p_151617_1_, p_151617_2_, p_151617_3_, p_151617_4_})))))))))); } + + /* ======================================== FORGE START =====================================*/ + protected long nextLong(long par1) + { -+ long j = (this.field_75908_c >> 24) % par1; ++ long j = (this.chunkSeed >> 24) % par1; + + if (j < 0) + { + j += par1; + } + -+ this.field_75908_c *= this.field_75908_c * 6364136223846793005L + 1442695040888963407L; -+ this.field_75908_c += this.field_75907_b; ++ this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; ++ this.chunkSeed += this.worldGenSeed; + return j; + } + diff --git a/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch similarity index 51% rename from patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch rename to patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch index e8a8a6350..ecfb39760 100644 --- a/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch @@ -25,11 +25,11 @@ public GenLayerBiome(long p_i45560_1_, GenLayer p_i45560_3_, WorldType p_i45560_4_, String p_i45560_5_) { super(p_i45560_1_); -- this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.field_76769_d, BiomeGenBase.field_76769_d, BiomeGenBase.field_76769_d, BiomeGenBase.field_150588_X, BiomeGenBase.field_150588_X, BiomeGenBase.field_76772_c}; -- this.field_151621_d = new BiomeGenBase[] {BiomeGenBase.field_76767_f, BiomeGenBase.field_150585_R, BiomeGenBase.field_76770_e, BiomeGenBase.field_76772_c, BiomeGenBase.field_150583_P, BiomeGenBase.field_76780_h}; -- this.field_151622_e = new BiomeGenBase[] {BiomeGenBase.field_76767_f, BiomeGenBase.field_76770_e, BiomeGenBase.field_76768_g, BiomeGenBase.field_76772_c}; -- this.field_151620_f = new BiomeGenBase[] {BiomeGenBase.field_76774_n, BiomeGenBase.field_76774_n, BiomeGenBase.field_76774_n, BiomeGenBase.field_150584_S}; - this.field_75909_a = p_i45560_3_; +- this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.desert, BiomeGenBase.desert, BiomeGenBase.savanna, BiomeGenBase.savanna, BiomeGenBase.plains}; +- this.field_151621_d = new BiomeGenBase[] {BiomeGenBase.forest, BiomeGenBase.roofedForest, BiomeGenBase.extremeHills, BiomeGenBase.plains, BiomeGenBase.birchForest, BiomeGenBase.swampland}; +- this.field_151622_e = new BiomeGenBase[] {BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.taiga, BiomeGenBase.plains}; +- this.field_151620_f = new BiomeGenBase[] {BiomeGenBase.icePlains, BiomeGenBase.icePlains, BiomeGenBase.icePlains, BiomeGenBase.coldTaiga}; + this.parent = p_i45560_3_; + for (BiomeManager.BiomeType type : BiomeManager.BiomeType.values()) + { @@ -42,29 +42,29 @@ + + int desertIdx = DESERT.ordinal(); + -+ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.field_76769_d, 30)); -+ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.field_150588_X, 20)); -+ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.field_76772_c, 10)); ++ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.desert, 30)); ++ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.savanna, 20)); ++ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.plains, 10)); + - if (p_i45560_4_ == WorldType.field_77136_e) + if (p_i45560_4_ == WorldType.DEFAULT_1_1) { -- this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.field_76769_d, BiomeGenBase.field_76767_f, BiomeGenBase.field_76770_e, BiomeGenBase.field_76780_h, BiomeGenBase.field_76772_c, BiomeGenBase.field_76768_g}; +- this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.swampland, BiomeGenBase.plains, BiomeGenBase.taiga}; + biomes[desertIdx].clear(); -+ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.field_76769_d, 10)); -+ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.field_76767_f, 10)); -+ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.field_76770_e, 10)); -+ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.field_76780_h, 10)); -+ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.field_76772_c, 10)); -+ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.field_76768_g, 10)); ++ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.desert, 10)); ++ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.forest, 10)); ++ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.extremeHills, 10)); ++ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.swampland, 10)); ++ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.plains, 10)); ++ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.taiga, 10)); this.field_175973_g = null; } - else if (p_i45560_4_ == WorldType.field_180271_f) + else if (p_i45560_4_ == WorldType.CUSTOMIZED) @@ -78,7 +99,7 @@ } else { -- aint1[j1 + i1 * p_75904_3_] = this.field_151623_c[this.func_75902_a(this.field_151623_c.length)].field_76756_M; -+ aint1[j1 + i1 * p_75904_3_] = getWeightedBiomeEntry(DESERT).biome.field_76756_M; +- aint1[j1 + i1 * areaWidth] = this.field_151623_c[this.nextInt(this.field_151623_c.length)].biomeID; ++ aint1[j1 + i1 * areaWidth] = getWeightedBiomeEntry(DESERT).biome.biomeID; } } else if (k1 == 2) @@ -72,8 +72,8 @@ } else { -- aint1[j1 + i1 * p_75904_3_] = this.field_151621_d[this.func_75902_a(this.field_151621_d.length)].field_76756_M; -+ aint1[j1 + i1 * p_75904_3_] = getWeightedBiomeEntry(WARM).biome.field_76756_M; +- aint1[j1 + i1 * areaWidth] = this.field_151621_d[this.nextInt(this.field_151621_d.length)].biomeID; ++ aint1[j1 + i1 * areaWidth] = getWeightedBiomeEntry(WARM).biome.biomeID; } } else if (k1 == 3) @@ -81,14 +81,14 @@ } else { -- aint1[j1 + i1 * p_75904_3_] = this.field_151622_e[this.func_75902_a(this.field_151622_e.length)].field_76756_M; -+ aint1[j1 + i1 * p_75904_3_] = getWeightedBiomeEntry(COOL).biome.field_76756_M; +- aint1[j1 + i1 * areaWidth] = this.field_151622_e[this.nextInt(this.field_151622_e.length)].biomeID; ++ aint1[j1 + i1 * areaWidth] = getWeightedBiomeEntry(COOL).biome.biomeID; } } else if (k1 == 4) { -- aint1[j1 + i1 * p_75904_3_] = this.field_151620_f[this.func_75902_a(this.field_151620_f.length)].field_76756_M; -+ aint1[j1 + i1 * p_75904_3_] = getWeightedBiomeEntry(ICY).biome.field_76756_M; +- aint1[j1 + i1 * areaWidth] = this.field_151620_f[this.nextInt(this.field_151620_f.length)].biomeID; ++ aint1[j1 + i1 * areaWidth] = getWeightedBiomeEntry(ICY).biome.biomeID; } else { @@ -100,8 +100,8 @@ + protected BiomeEntry getWeightedBiomeEntry(BiomeManager.BiomeType type) + { + List biomeList = biomes[type.ordinal()]; -+ int totalWeight = WeightedRandom.func_76272_a(biomeList); -+ int weight = BiomeManager.isTypeListModded(type)?func_75902_a(totalWeight):func_75902_a(totalWeight / 10) * 10; -+ return (BiomeEntry)WeightedRandom.func_180166_a(biomeList, weight); ++ int totalWeight = WeightedRandom.getTotalWeight(biomeList); ++ int weight = BiomeManager.isTypeListModded(type)?nextInt(totalWeight):nextInt(totalWeight / 10) * 10; ++ return (BiomeEntry)WeightedRandom.getRandomItem(biomeList, weight); + } } diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch similarity index 50% rename from patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch rename to patches.mcp/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch index f300249a0..ee65e0a22 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch @@ -21,8 +21,8 @@ + static + { -+ ChestGenHooks.init(PYRAMID_DESERT_CHEST, field_74941_i, 2, 7); -+ ChestGenHooks.addItem(PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(new ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); ++ ChestGenHooks.init(PYRAMID_DESERT_CHEST, itemsToGenerateInTemple, 2, 7); ++ ChestGenHooks.addItem(PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(new ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); + } + public DesertPyramid(Random p_i2062_1_, int p_i2062_2_, int p_i2062_3_) @@ -30,65 +30,65 @@ super(p_i2062_1_, p_i2062_2_, 64, p_i2062_3_, 21, 15, 21); @@ -267,7 +276,7 @@ { - int k1 = enumfacing.func_82601_c() * 2; - int l1 = enumfacing.func_82599_e() * 2; -- this.field_74940_h[enumfacing.func_176736_b()] = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 10 + k1, -11, 10 + l1, WeightedRandomChestContent.func_177629_a(field_74941_i, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); -+ this.field_74940_h[enumfacing.func_176736_b()] = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 10 + k1, -11, 10 + l1, ChestGenHooks.getItems(PYRAMID_DESERT_CHEST, p_74875_2_), ChestGenHooks.getCount(PYRAMID_DESERT_CHEST, p_74875_2_)); + int k1 = enumfacing.getFrontOffsetX() * 2; + int l1 = enumfacing.getFrontOffsetZ() * 2; +- this.field_74940_h[enumfacing.getHorizontalIndex()] = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 10 + k1, -11, 10 + l1, WeightedRandomChestContent.func_177629_a(itemsToGenerateInTemple, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); ++ this.field_74940_h[enumfacing.getHorizontalIndex()] = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 10 + k1, -11, 10 + l1, ChestGenHooks.getItems(PYRAMID_DESERT_CHEST, p_74875_2_), ChestGenHooks.getCount(PYRAMID_DESERT_CHEST, p_74875_2_)); } } @@ -370,6 +379,13 @@ - private static ComponentScatteredFeaturePieces.JunglePyramid.Stones field_74942_n = new ComponentScatteredFeaturePieces.JunglePyramid.Stones((ComponentScatteredFeaturePieces.SwitchEnumFacing)null); + private static ComponentScatteredFeaturePieces.JunglePyramid.Stones junglePyramidsRandomScatteredStones = new ComponentScatteredFeaturePieces.JunglePyramid.Stones((ComponentScatteredFeaturePieces.SwitchEnumFacing)null); private static final String __OBFID = "CL_00000477"; + static + { + ChestGenHooks.init(PYRAMID_JUNGLE_DISPENSER, field_175815_j, 2, 2); + ChestGenHooks.init(PYRAMID_JUNGLE_CHEST, field_175816_i, 2, 7); -+ ChestGenHooks.addItem(PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(new ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); ++ ChestGenHooks.addItem(PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(new ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); + } + public JunglePyramid() {} public JunglePyramid(Random p_i2064_1_, int p_i2064_2_, int p_i2064_3_) @@ -525,9 +541,12 @@ - this.func_175811_a(p_74875_1_, Blocks.field_150488_af.func_176223_P(), 4, -3, 1, p_74875_3_); - this.func_175811_a(p_74875_1_, Blocks.field_150341_Y.func_176223_P(), 3, -3, 1, p_74875_3_); + this.func_175811_a(worldIn, Blocks.redstone_wire.getDefaultState(), 4, -3, 1, p_74875_3_); + this.func_175811_a(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 3, -3, 1, p_74875_3_); + ChestGenHooks dispenser = ChestGenHooks.getInfo(PYRAMID_JUNGLE_DISPENSER); + ChestGenHooks chest = ChestGenHooks.getInfo(PYRAMID_JUNGLE_CHEST); + if (!this.field_74945_j) { -- this.field_74945_j = this.func_175806_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, -2, 1, EnumFacing.NORTH.func_176745_a(), field_175815_j, 2); -+ this.field_74945_j = this.func_175806_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, -2, 1, EnumFacing.NORTH.func_176745_a(), dispenser.getItems(p_74875_2_), dispenser.getCount(p_74875_2_)); +- this.field_74945_j = this.func_175806_a(worldIn, p_74875_3_, p_74875_2_, 3, -2, 1, EnumFacing.NORTH.getIndex(), field_175815_j, 2); ++ this.field_74945_j = this.func_175806_a(worldIn, p_74875_3_, p_74875_2_, 3, -2, 1, EnumFacing.NORTH.getIndex(), dispenser.getItems(p_74875_2_), dispenser.getCount(p_74875_2_)); } - this.func_175811_a(p_74875_1_, Blocks.field_150395_bd.func_176203_a(15), 3, -2, 2, p_74875_3_); + this.func_175811_a(worldIn, Blocks.vine.getStateFromMeta(15), 3, -2, 2, p_74875_3_); @@ -544,7 +563,7 @@ if (!this.field_74946_k) { -- this.field_74946_k = this.func_175806_a(p_74875_1_, p_74875_3_, p_74875_2_, 9, -2, 3, EnumFacing.WEST.func_176745_a(), field_175815_j, 2); -+ this.field_74946_k = this.func_175806_a(p_74875_1_, p_74875_3_, p_74875_2_, 9, -2, 3, EnumFacing.WEST.func_176745_a(), dispenser.getItems(p_74875_2_), dispenser.getCount(p_74875_2_)); +- this.field_74946_k = this.func_175806_a(worldIn, p_74875_3_, p_74875_2_, 9, -2, 3, EnumFacing.WEST.getIndex(), field_175815_j, 2); ++ this.field_74946_k = this.func_175806_a(worldIn, p_74875_3_, p_74875_2_, 9, -2, 3, EnumFacing.WEST.getIndex(), dispenser.getItems(p_74875_2_), dispenser.getCount(p_74875_2_)); } - this.func_175811_a(p_74875_1_, Blocks.field_150395_bd.func_176203_a(15), 8, -1, 3, p_74875_3_); + this.func_175811_a(worldIn, Blocks.vine.getStateFromMeta(15), 8, -1, 3, p_74875_3_); @@ -552,7 +571,7 @@ if (!this.field_74947_h) { -- this.field_74947_h = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 8, -3, 3, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); -+ this.field_74947_h = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 8, -3, 3, chest.getItems(p_74875_2_), chest.getCount(p_74875_2_)); +- this.field_74947_h = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 8, -3, 3, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); ++ this.field_74947_h = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 8, -3, 3, chest.getItems(p_74875_2_), chest.getCount(p_74875_2_)); } - this.func_175811_a(p_74875_1_, Blocks.field_150341_Y.func_176223_P(), 9, -3, 2, p_74875_3_); + this.func_175811_a(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 9, -3, 2, p_74875_3_); @@ -585,7 +604,7 @@ if (!this.field_74948_i) { -- this.field_74948_i = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 9, -3, 10, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); -+ this.field_74948_i = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 9, -3, 10, chest.getItems(p_74875_2_), chest.getCount(p_74875_2_)); +- this.field_74948_i = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 9, -3, 10, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); ++ this.field_74948_i = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 9, -3, 10, chest.getItems(p_74875_2_), chest.getCount(p_74875_2_)); } return true; diff --git a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch similarity index 72% rename from patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch rename to patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch index 2ac267ebb..6f64cda61 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch @@ -4,8 +4,8 @@ { BiomeGenBase biomegenbase = abiomegenbase[j]; -- if (biomegenbase != null && biomegenbase.field_76748_D > 0.0F) -+ if (biomegenbase != null && biomegenbase.field_76748_D > 0.0F && !net.minecraftforge.common.BiomeManager.strongHoldBiomesBlackList.contains(biomegenbase)) +- if (biomegenbase != null && biomegenbase.minHeight > 0.0F) ++ if (biomegenbase != null && biomegenbase.minHeight > 0.0F && !net.minecraftforge.common.BiomeManager.strongHoldBiomesBlackList.contains(biomegenbase)) { this.field_151546_e.add(biomegenbase); } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch new file mode 100644 index 000000000..0832a9001 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java +@@ -231,12 +231,12 @@ + { + if (this.field_143029_e == null) + { +- this.field_143029_e = (MapGenStructureData)worldIn.loadItemData(MapGenStructureData.class, this.getStructureName()); ++ this.field_143029_e = (MapGenStructureData)worldIn.getPerWorldStorage().loadData(MapGenStructureData.class, this.getStructureName()); + + if (this.field_143029_e == null) + { + this.field_143029_e = new MapGenStructureData(this.getStructureName()); +- worldIn.setItemData(this.getStructureName(), this.field_143029_e); ++ worldIn.getPerWorldStorage().setData(this.getStructureName(), this.field_143029_e); + } + else + { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch similarity index 78% rename from patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch rename to patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch index 8c525a612..9f41e1cad 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch @@ -9,5 +9,5 @@ + throw new RuntimeException("StructureComponent \"" + this.getClass().getName() + "\" missing ID Mapping, Modder see MapGenStructureIO"); + } NBTTagCompound nbttagcompound = new NBTTagCompound(); - nbttagcompound.func_74778_a("id", MapGenStructureIO.func_143036_a(this)); - nbttagcompound.func_74782_a("BB", this.field_74887_e.func_151535_h()); + nbttagcompound.setString("id", MapGenStructureIO.func_143036_a(this)); + nbttagcompound.setTag("BB", this.boundingBox.func_151535_h()); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch new file mode 100644 index 000000000..e1e15e013 --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch @@ -0,0 +1,42 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java +@@ -19,6 +19,8 @@ + import net.minecraft.util.EnumFacing; + import net.minecraft.util.WeightedRandomChestContent; + import net.minecraft.world.World; ++import net.minecraftforge.common.ChestGenHooks; ++import static net.minecraftforge.common.ChestGenHooks.*; + + public class StructureMineshaftPieces + { +@@ -33,6 +35,12 @@ + MapGenStructureIO.registerStructureComponent(StructureMineshaftPieces.Stairs.class, "MSStairs"); + } + ++ static ++ { ++ ChestGenHooks.init(MINESHAFT_CORRIDOR, field_175893_a, 8, 8); ++ ChestGenHooks.addItem(MINESHAFT_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); ++ } ++ + private static StructureComponent func_175892_a(List p_175892_0_, Random p_175892_1_, int p_175892_2_, int p_175892_3_, int p_175892_4_, EnumFacing p_175892_5_, int p_175892_6_) + { + int i1 = p_175892_1_.nextInt(100); +@@ -354,14 +362,15 @@ + this.func_175809_a(worldIn, p_74875_3_, p_74875_2_, 0.05F, 1, 2, k - 1, Blocks.torch.getStateFromMeta(EnumFacing.UP.getIndex())); + this.func_175809_a(worldIn, p_74875_3_, p_74875_2_, 0.05F, 1, 2, k + 1, Blocks.torch.getStateFromMeta(EnumFacing.UP.getIndex())); + ++ ChestGenHooks info = ChestGenHooks.getInfo(MINESHAFT_CORRIDOR); + if (p_74875_2_.nextInt(100) == 0) + { +- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 2, 0, k - 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.field_175893_a, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 3 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 2, 0, k - 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); + } + + if (p_74875_2_.nextInt(100) == 0) + { +- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 0, 0, k + 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.field_175893_a, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 3 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 0, 0, k + 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); + } + + if (this.hasSpiders && !this.spawnerPlaced) diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch new file mode 100644 index 000000000..44c0e67ea --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch @@ -0,0 +1,28 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java +@@ -154,7 +154,7 @@ + if (this.field_111021_b && p_74875_3_.func_175898_b(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) + { + this.field_111021_b = false; +- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 2, 3, field_111019_a, 2 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_)); + } + + this.func_175804_a(worldIn, p_74875_3_, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); +@@ -224,7 +224,7 @@ + if (this.field_111020_b && p_74875_3_.func_175898_b(new BlockPos(this.getXWithOffset(1, 3), this.getYWithOffset(2), this.getZWithOffset(1, 3)))) + { + this.field_111020_b = false; +- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 1, 2, 3, field_111019_a, 2 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 1, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_)); + } + + this.func_175804_a(worldIn, p_74875_3_, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); +@@ -953,6 +953,7 @@ + abstract static class Piece extends StructureComponent + { + protected static final List field_111019_a = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.diamond, 0, 1, 3, 5), new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 5), new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 15), new WeightedRandomChestContent(Items.golden_sword, 0, 1, 1, 5), new WeightedRandomChestContent(Items.golden_chestplate, 0, 1, 1, 5), new WeightedRandomChestContent(Items.flint_and_steel, 0, 1, 1, 5), new WeightedRandomChestContent(Items.nether_wart, 0, 3, 7, 5), new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 10), new WeightedRandomChestContent(Items.golden_horse_armor, 0, 1, 1, 8), new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 5), new WeightedRandomChestContent(Items.diamond_horse_armor, 0, 1, 1, 3), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.obsidian), 0, 2, 4, 2)}); ++ static { net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, field_111019_a, 2, 5); } + private static final String __OBFID = "CL_00000466"; + + public Piece() {} diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch similarity index 60% rename from patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch rename to patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch index c8db28dbb..1dd1abc4d 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch @@ -9,15 +9,15 @@ + throw new RuntimeException("StructureStart \"" + this.getClass().getName() + "\" missing ID Mapping, Modder see MapGenStructureIO"); + } NBTTagCompound nbttagcompound = new NBTTagCompound(); - nbttagcompound.func_74778_a("id", MapGenStructureIO.func_143033_a(this)); - nbttagcompound.func_74768_a("ChunkX", p_143021_1_); + nbttagcompound.setString("id", MapGenStructureIO.func_143033_a(this)); + nbttagcompound.setInteger("ChunkX", p_143021_1_); @@ -98,7 +102,8 @@ - for (int i = 0; i < nbttaglist.func_74745_c(); ++i) + for (int i = 0; i < nbttaglist.tagCount(); ++i) { -- this.field_75075_a.add(MapGenStructureIO.func_143032_b(nbttaglist.func_150305_b(i), p_143020_1_)); -+ StructureComponent tmp = MapGenStructureIO.func_143032_b(nbttaglist.func_150305_b(i), p_143020_1_); -+ if (tmp != null) this.field_75075_a.add(tmp); //Forge: Prevent NPEs further down the line when a componenet can't be loaded. +- this.components.add(MapGenStructureIO.func_143032_b(nbttaglist.getCompoundTagAt(i), worldIn)); ++ StructureComponent tmp = MapGenStructureIO.func_143032_b(nbttaglist.getCompoundTagAt(i), worldIn); ++ if (tmp != null) this.components.add(tmp); //Forge: Prevent NPEs further down the line when a componenet can't be loaded. } this.func_143017_b(p_143020_2_); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch new file mode 100644 index 000000000..390cdf61d --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch @@ -0,0 +1,84 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java +@@ -17,6 +17,8 @@ + import net.minecraft.util.EnumFacing; + import net.minecraft.util.WeightedRandomChestContent; + import net.minecraft.world.World; ++import net.minecraftforge.common.ChestGenHooks; ++import static net.minecraftforge.common.ChestGenHooks.*; + + public class StructureStrongholdPieces + { +@@ -248,6 +250,12 @@ + + public ChestCorridor() {} + ++ static ++ { ++ ChestGenHooks.init(STRONGHOLD_CORRIDOR, strongholdChestContents, 2, 4); ++ ChestGenHooks.addItem(STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); ++ } ++ + public ChestCorridor(int p_i45582_1_, Random p_i45582_2_, StructureBoundingBox p_i45582_3_, EnumFacing p_i45582_4_) + { + super(p_i45582_1_); +@@ -304,7 +312,7 @@ + if (!this.hasMadeChest && p_74875_3_.func_175898_b(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) + { + this.hasMadeChest = true; +- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 2, 3, WeightedRandomChestContent.func_177629_a(strongholdChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 2 + p_74875_2_.nextInt(2)); ++ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 2, 3, ChestGenHooks.getItems(STRONGHOLD_CORRIDOR, p_74875_2_), ChestGenHooks.getCount(STRONGHOLD_CORRIDOR, p_74875_2_)); + } + + return true; +@@ -599,6 +607,12 @@ + private boolean isLargeRoom; + private static final String __OBFID = "CL_00000491"; + ++ static ++ { ++ ChestGenHooks.init(STRONGHOLD_CORRIDOR, strongholdLibraryChestContents, 1, 5); ++ ChestGenHooks.addItem(STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 5, 2)); ++ } ++ + public Library() {} + + public Library(int p_i45578_1_, Random p_i45578_2_, StructureBoundingBox p_i45578_3_, EnumFacing p_i45578_4_) +@@ -742,12 +756,13 @@ + this.func_175811_a(worldIn, Blocks.torch.getDefaultState(), b1, 8, b2 + 1, p_74875_3_); + } + +- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 3, 5, WeightedRandomChestContent.func_177629_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_, 1, 5, 2)}), 1 + p_74875_2_.nextInt(4)); ++ ChestGenHooks info = ChestGenHooks.getInfo(STRONGHOLD_LIBRARY); ++ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 3, 5, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); + + if (this.isLargeRoom) + { + this.func_175811_a(worldIn, Blocks.air.getDefaultState(), 12, 9, 1, p_74875_3_); +- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 12, 8, 1, WeightedRandomChestContent.func_177629_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_, 1, 5, 2)}), 1 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 12, 8, 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); + } + + return true; +@@ -1024,6 +1039,12 @@ + protected int roomType; + private static final String __OBFID = "CL_00000496"; + ++ static ++ { ++ ChestGenHooks.init(STRONGHOLD_CROSSING, strongholdRoomCrossingChestContents, 1, 5); ++ ChestGenHooks.addItem(STRONGHOLD_CROSSING, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); ++ } ++ + public RoomCrossing() {} + + public RoomCrossing(int p_i45575_1_, Random p_i45575_2_, StructureBoundingBox p_i45575_3_, EnumFacing p_i45575_4_) +@@ -1159,7 +1180,7 @@ + this.func_175811_a(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 1, 3, p_74875_3_); + this.func_175811_a(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 2, 3, p_74875_3_); + this.func_175811_a(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 3, 3, p_74875_3_); +- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 4, 8, WeightedRandomChestContent.func_177629_a(strongholdRoomCrossingChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 1 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 4, 8, ChestGenHooks.getItems(STRONGHOLD_CROSSING, p_74875_2_), ChestGenHooks.getCount(STRONGHOLD_CROSSING, p_74875_2_)); + } + + return true; diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch similarity index 70% rename from patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch rename to patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch index ad1533e4e..e285e0cfe 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch @@ -13,9 +13,9 @@ public class StructureVillagePieces { @@ -59,6 +64,8 @@ - arraylist.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Field2.class, 3, MathHelper.func_76136_a(p_75084_0_, 2 + p_75084_1_, 4 + p_75084_1_ * 2))); - arraylist.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House2.class, 15, MathHelper.func_76136_a(p_75084_0_, 0, 1 + p_75084_1_))); - arraylist.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House3.class, 8, MathHelper.func_76136_a(p_75084_0_, 0 + p_75084_1_, 3 + p_75084_1_ * 2))); + arraylist.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Field2.class, 3, MathHelper.getRandomIntegerInRange(p_75084_0_, 2 + p_75084_1_, 4 + p_75084_1_ * 2))); + arraylist.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House2.class, 15, MathHelper.getRandomIntegerInRange(p_75084_0_, 0, 1 + p_75084_1_))); + arraylist.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House3.class, 8, MathHelper.getRandomIntegerInRange(p_75084_0_, 0 + p_75084_1_, 3 + p_75084_1_ * 2))); + net.minecraftforge.fml.common.registry.VillagerRegistry.addExtraVillageComponents(arraylist, p_75084_0_, p_75084_1_); + Iterator iterator = arraylist.iterator(); @@ -38,18 +38,18 @@ + static + { -+ ChestGenHooks.init(VILLAGE_BLACKSMITH, field_74918_a, 3, 8); ++ ChestGenHooks.init(VILLAGE_BLACKSMITH, villageBlacksmithChestContents, 3, 8); + } + public House2(StructureVillagePieces.Start p_i45563_1_, int p_i45563_2_, Random p_i45563_3_, StructureBoundingBox p_i45563_4_, EnumFacing p_i45563_5_) { super(p_i45563_1_, p_i45563_2_); @@ -920,7 +936,7 @@ - if (!this.field_74917_c && p_74875_3_.func_175898_b(new BlockPos(this.func_74865_a(5, 5), this.func_74862_a(1), this.func_74873_b(5, 5)))) + if (!this.hasMadeChest && p_74875_3_.func_175898_b(new BlockPos(this.getXWithOffset(5, 5), this.getYWithOffset(1), this.getZWithOffset(5, 5)))) { - this.field_74917_c = true; -- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 5, 1, 5, field_74918_a, 3 + p_74875_2_.nextInt(6)); -+ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 5, 1, 5, ChestGenHooks.getItems(VILLAGE_BLACKSMITH, p_74875_2_), ChestGenHooks.getCount(VILLAGE_BLACKSMITH, p_74875_2_)); + this.hasMadeChest = true; +- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 5, 1, 5, villageBlacksmithChestContents, 3 + p_74875_2_.nextInt(6)); ++ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 5, 1, 5, ChestGenHooks.getItems(VILLAGE_BLACKSMITH, p_74875_2_), ChestGenHooks.getCount(VILLAGE_BLACKSMITH, p_74875_2_)); } int i; @@ -62,15 +62,15 @@ public Start() {} @@ -1433,6 +1450,7 @@ - this.field_74928_c = p_i2104_7_; + this.terrainType = p_i2104_7_; BiomeGenBase biomegenbase = p_i2104_1_.func_180300_a(new BlockPos(p_i2104_4_, 0, p_i2104_5_), BiomeGenBase.field_180279_ad); - this.field_74927_b = biomegenbase == BiomeGenBase.field_76769_d || biomegenbase == BiomeGenBase.field_76786_s; + this.inDesert = biomegenbase == BiomeGenBase.desert || biomegenbase == BiomeGenBase.desertHills; + this.biome = biomegenbase; - this.func_175846_a(this.field_74927_b); + this.func_175846_a(this.inDesert); } @@ -1540,6 +1558,7 @@ - private int field_74896_a; + private int villagersSpawned; private boolean field_143014_b; private static final String __OBFID = "CL_00000531"; + private StructureVillagePieces.Start startPiece; @@ -80,7 +80,7 @@ @@ -1550,6 +1569,7 @@ if (p_i2107_1_ != null) { - this.field_143014_b = p_i2107_1_.field_74927_b; + this.field_143014_b = p_i2107_1_.inDesert; + startPiece = p_i2107_1_; } } @@ -94,4 +94,4 @@ + if (event.getResult() == Result.DENY) return event.replacement; if (this.field_143014_b) { - if (p_175847_1_.func_177230_c() == Blocks.field_150364_r || p_175847_1_.func_177230_c() == Blocks.field_150363_s) + if (p_175847_1_.getBlock() == Blocks.log || p_175847_1_.getBlock() == Blocks.log2) diff --git a/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch new file mode 100644 index 000000000..4221e7c3e --- /dev/null +++ b/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch @@ -0,0 +1,48 @@ +--- ../src-base/minecraft/net/minecraft/world/storage/MapData.java ++++ ../src-work/minecraft/net/minecraft/world/storage/MapData.java +@@ -22,7 +22,7 @@ + { + public int xCenter; + public int zCenter; +- public byte dimension; ++ public int dimension; //FML byte -> int + public byte scale; + public byte[] colors = new byte[16384]; + public List playersArrayList = Lists.newArrayList(); +@@ -46,7 +46,17 @@ + + public void readFromNBT(NBTTagCompound nbt) + { +- this.dimension = nbt.getByte("dimension"); ++ net.minecraft.nbt.NBTBase dimension = nbt.getTag("dimension"); ++ ++ if (dimension instanceof net.minecraft.nbt.NBTTagByte) ++ { ++ this.dimension = ((net.minecraft.nbt.NBTTagByte)dimension).getByte(); ++ } ++ else ++ { ++ this.dimension = ((net.minecraft.nbt.NBTTagInt)dimension).getInt(); ++ } ++ + this.xCenter = nbt.getInteger("xCenter"); + this.zCenter = nbt.getInteger("zCenter"); + this.scale = nbt.getByte("scale"); +@@ -87,7 +97,7 @@ + + public void writeToNBT(NBTTagCompound nbt) + { +- nbt.setByte("dimension", this.dimension); ++ nbt.setInteger("dimension", this.dimension); + nbt.setInteger("xCenter", this.xCenter); + nbt.setInteger("zCenter", this.zCenter); + nbt.setByte("scale", this.scale); +@@ -166,7 +176,7 @@ + p_82567_8_ += p_82567_8_ < 0.0D ? -8.0D : 8.0D; + b2 = (byte)((int)(p_82567_8_ * 16.0D / 360.0D)); + +- if (this.dimension < 0) ++ if (worldIn.provider.shouldMapSpin(p_82567_3_, p_82567_4_, p_82567_6_, p_82567_8_)) + { + int k = (int)(worldIn.getWorldInfo().getWorldTime() / 10L); + b2 = (byte)(k * k * 34187121 + k * 121 >> 15 & 15); diff --git a/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch similarity index 66% rename from patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch rename to patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch index f5341e4cd..304284cdb 100644 --- a/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch @@ -10,8 +10,8 @@ { try { - nbttagcompound = CompressedStreamTools.func_74796_a(new FileInputStream(file1)); - nbttagcompound1 = nbttagcompound.func_74775_l("Data"); + nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1)); + nbttagcompound1 = nbttagcompound.getCompoundTag("Data"); - return new WorldInfo(nbttagcompound1); + worldInfo = new WorldInfo(nbttagcompound1); + net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound); @@ -28,13 +28,13 @@ } + net.minecraftforge.fml.common.FMLCommonHandler.instance().confirmBackupLevelDatUse(this); - file1 = new File(this.field_75770_b, "level.dat_old"); + file1 = new File(this.worldDirectory, "level.dat_old"); if (file1.exists()) @@ -129,7 +138,13 @@ { - nbttagcompound = CompressedStreamTools.func_74796_a(new FileInputStream(file1)); - nbttagcompound1 = nbttagcompound.func_74775_l("Data"); + nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1)); + nbttagcompound1 = nbttagcompound.getCompoundTag("Data"); - return new WorldInfo(nbttagcompound1); + worldInfo = new WorldInfo(nbttagcompound1); + net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound); @@ -48,57 +48,57 @@ { @@ -146,6 +161,8 @@ NBTTagCompound nbttagcompound2 = new NBTTagCompound(); - nbttagcompound2.func_74782_a("Data", nbttagcompound1); + nbttagcompound2.setTag("Data", nbttagcompound1); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, p_75755_1_, nbttagcompound2); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, worldInformation, nbttagcompound2); + try { - File file1 = new File(this.field_75770_b, "level.dat_new"); + File file1 = new File(this.worldDirectory, "level.dat_new"); @@ -184,6 +201,8 @@ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.func_74782_a("Data", nbttagcompound); + nbttagcompound1.setTag("Data", nbttagcompound); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, p_75761_1_, nbttagcompound1); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, worldInformation, nbttagcompound1); + try { - File file1 = new File(this.field_75770_b, "level.dat_new"); + File file1 = new File(this.worldDirectory, "level.dat_new"); @@ -232,6 +251,7 @@ } file1.renameTo(file2); -+ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(p_75753_1_, this.field_75771_c, p_75753_1_.func_110124_au().toString()); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(p_75753_1_, this.playersDirectory, p_75753_1_.getUniqueID().toString()); } catch (Exception exception) { @@ -262,6 +282,7 @@ - p_75752_1_.func_70020_e(nbttagcompound); + p_75752_1_.readFromNBT(nbttagcompound); } -+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_75752_1_, field_75771_c, p_75752_1_.func_110124_au().toString()); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_75752_1_, playersDirectory, p_75752_1_.getUniqueID().toString()); return nbttagcompound; } @@ -301,4 +322,22 @@ { - return this.field_75767_f; + return this.saveDirectoryName; } + + public NBTTagCompound getPlayerNBT(net.minecraft.entity.player.EntityPlayerMP player) + { + try + { -+ File file1 = new File(this.field_75771_c, player.func_110124_au().toString() + ".dat"); ++ File file1 = new File(this.playersDirectory, player.getUniqueID().toString() + ".dat"); + + if (file1.exists() && file1.isFile()) + { -+ return CompressedStreamTools.func_74796_a(new FileInputStream(file1)); ++ return CompressedStreamTools.readCompressed(new FileInputStream(file1)); + } + } + catch (Exception exception) + { -+ field_151478_a.warn("Failed to load player data for " + player.func_70005_c_()); ++ logger.warn("Failed to load player data for " + player.getName()); + } + return null; + } diff --git a/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/WorldInfo.java.patch similarity index 94% rename from patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch rename to patches.mcp/minecraft/net/minecraft/world/storage/WorldInfo.java.patch index b1d007002..a2901b7f0 100644 --- a/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch +++ b/patches.mcp/minecraft/net/minecraft/world/storage/WorldInfo.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/world/storage/WorldInfo.java +++ ../src-work/minecraft/net/minecraft/world/storage/WorldInfo.java @@ -52,6 +52,7 @@ - private int field_176155_J; - private GameRules field_82577_x; + private int borderWarningTime; + private GameRules theGameRules; private static final String __OBFID = "CL_00000587"; + private java.util.Map additionalProperties; diff --git a/patches/minecraft/net/minecraft/block/BlockAir.java.patch b/patches/minecraft/net/minecraft/block/BlockAir.java.patch deleted file mode 100644 index 17ba5bdc7..000000000 --- a/patches/minecraft/net/minecraft/block/BlockAir.java.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockAir.java -+++ ../src-work/minecraft/net/minecraft/block/BlockAir.java -@@ -36,4 +36,6 @@ - } - - public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) {} -+ -+ public boolean func_176200_f(World worldIn, BlockPos pos){ return true; } - } diff --git a/patches/minecraft/net/minecraft/block/BlockBush.java.patch b/patches/minecraft/net/minecraft/block/BlockBush.java.patch deleted file mode 100644 index fa04998cf..000000000 --- a/patches/minecraft/net/minecraft/block/BlockBush.java.patch +++ /dev/null @@ -1,66 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockBush.java -+++ ../src-work/minecraft/net/minecraft/block/BlockBush.java -@@ -12,7 +12,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class BlockBush extends Block -+public class BlockBush extends Block implements net.minecraftforge.common.IPlantable - { - private static final String __OBFID = "CL_00000208"; - -@@ -32,7 +32,7 @@ - - public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) - { -- return super.func_176196_c(p_176196_1_, p_176196_2_) && this.func_149854_a(p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_177230_c()); -+ return super.func_176196_c(p_176196_1_, p_176196_2_) && p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_177230_c().canSustainPlant(p_176196_1_, p_176196_2_.func_177977_b(), net.minecraft.util.EnumFacing.UP, this); - } - - protected boolean func_149854_a(Block p_149854_1_) -@@ -62,7 +62,10 @@ - - public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_) - { -- return this.func_149854_a(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c()); -+ BlockPos down = p_180671_2_.func_177977_b(); -+ Block soil = p_180671_1_.func_180495_p(down).func_177230_c(); -+ if (p_180671_3_.func_177230_c() != this) return this.func_149854_a(soil); //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 soil.canSustainPlant(p_180671_1_, down, net.minecraft.util.EnumFacing.UP, this); - } - - public AxisAlignedBB func_180640_a(World p_180640_1_, BlockPos p_180640_2_, IBlockState p_180640_3_) -@@ -85,4 +88,33 @@ - { - return EnumWorldBlockLayer.CUTOUT; - } -+ -+ @Override -+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ if (this == Blocks.field_150464_aj) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.field_150459_bM) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.field_150469_bN) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.field_150394_bc) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.field_150393_bb) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.field_150330_I) return net.minecraftforge.common.EnumPlantType.Desert; -+ if (this == Blocks.field_150392_bi) return net.minecraftforge.common.EnumPlantType.Water; -+ if (this == Blocks.field_150337_Q) return net.minecraftforge.common.EnumPlantType.Cave; -+ if (this == Blocks.field_150338_P) return net.minecraftforge.common.EnumPlantType.Cave; -+ if (this == Blocks.field_150388_bm) return net.minecraftforge.common.EnumPlantType.Nether; -+ if (this == Blocks.field_150345_g) return net.minecraftforge.common.EnumPlantType.Plains; -+ if (this == Blocks.field_150329_H) return net.minecraftforge.common.EnumPlantType.Plains; -+ if (this == Blocks.field_150398_cm) return net.minecraftforge.common.EnumPlantType.Plains; -+ if (this == Blocks.field_150328_O) return net.minecraftforge.common.EnumPlantType.Plains; -+ if (this == Blocks.field_150327_N) return net.minecraftforge.common.EnumPlantType.Plains; -+ return net.minecraftforge.common.EnumPlantType.Plains; -+ } -+ -+ @Override -+ public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ IBlockState state = world.func_180495_p(pos); -+ if (state.func_177230_c() != this) return func_176223_P(); -+ return state; -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockButton.java.patch b/patches/minecraft/net/minecraft/block/BlockButton.java.patch deleted file mode 100644 index 87fff1207..000000000 --- a/patches/minecraft/net/minecraft/block/BlockButton.java.patch +++ /dev/null @@ -1,46 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockButton.java -+++ ../src-work/minecraft/net/minecraft/block/BlockButton.java -@@ -18,6 +18,7 @@ - import net.minecraft.util.EnumFacing; - import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; -+import static net.minecraft.util.EnumFacing.*; - - public abstract class BlockButton extends Block - { -@@ -57,7 +58,7 @@ - - public boolean func_176198_a(World p_176198_1_, BlockPos p_176198_2_, EnumFacing p_176198_3_) - { -- return p_176198_1_.func_180495_p(p_176198_2_.func_177972_a(p_176198_3_.func_176734_d())).func_177230_c().func_149721_r(); -+ return p_176198_1_.isSideSolid(p_176198_2_.func_177972_a(p_176198_3_.func_176734_d()), p_176198_3_, true); - } - - public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) -@@ -69,7 +70,7 @@ - { - EnumFacing enumfacing = aenumfacing[j]; - -- if (p_176196_1_.func_180495_p(p_176196_2_.func_177972_a(enumfacing)).func_177230_c().func_149721_r()) -+ if (p_176196_1_.isSideSolid(p_176196_2_.func_177972_a(enumfacing), enumfacing.func_176734_d(), true)) - { - return true; - } -@@ -80,7 +81,7 @@ - - public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) - { -- return p_180642_1_.func_180495_p(p_180642_2_.func_177972_a(p_180642_3_.func_176734_d())).func_177230_c().func_149721_r() ? this.func_176223_P().func_177226_a(field_176585_a, p_180642_3_).func_177226_a(field_176584_b, Boolean.valueOf(false)) : this.func_176223_P().func_177226_a(field_176585_a, EnumFacing.DOWN).func_177226_a(field_176584_b, Boolean.valueOf(false)); -+ return p_180642_1_.isSideSolid(p_180642_2_.func_177972_a(p_180642_3_.func_176734_d()), p_180642_3_, true) ? this.func_176223_P().func_177226_a(field_176585_a, p_180642_3_).func_177226_a(field_176584_b, Boolean.valueOf(false)) : this.func_176223_P().func_177226_a(field_176585_a, EnumFacing.DOWN).func_177226_a(field_176584_b, Boolean.valueOf(false)); - } - - public void func_176204_a(World p_176204_1_, BlockPos p_176204_2_, IBlockState p_176204_3_, Block p_176204_4_) -@@ -89,7 +90,7 @@ - { - EnumFacing enumfacing = (EnumFacing)p_176204_3_.func_177229_b(field_176585_a); - -- if (!p_176204_1_.func_180495_p(p_176204_2_.func_177972_a(enumfacing.func_176734_d())).func_177230_c().func_149721_r()) -+ if (!p_176204_1_.isSideSolid(p_176204_2_.func_177972_a(enumfacing.func_176734_d()), enumfacing, true)) - { - this.func_176226_b(p_176204_1_, p_176204_2_, p_176204_3_, 0); - p_176204_1_.func_175698_g(p_176204_2_); diff --git a/patches/minecraft/net/minecraft/block/BlockChest.java.patch b/patches/minecraft/net/minecraft/block/BlockChest.java.patch deleted file mode 100644 index 1ab56e42b..000000000 --- a/patches/minecraft/net/minecraft/block/BlockChest.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockChest.java -+++ ../src-work/minecraft/net/minecraft/block/BlockChest.java -@@ -531,7 +531,7 @@ - - private boolean func_176456_n(World p_176456_1_, BlockPos p_176456_2_) - { -- return p_176456_1_.func_180495_p(p_176456_2_.func_177984_a()).func_177230_c().func_149721_r(); -+ return p_176456_1_.isSideSolid(p_176456_2_.func_177984_a(), EnumFacing.DOWN, false); - } - - private boolean func_176453_o(World p_176453_1_, BlockPos p_176453_2_) diff --git a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch deleted file mode 100644 index cffac2037..000000000 --- a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java -+++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java -@@ -137,7 +137,14 @@ - - public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) - { -- int j = ((Integer)p_180653_3_.func_177229_b(field_176501_a)).intValue(); -+ super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); -+ } -+ -+ @Override -+ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List dropped = super.getDrops(world, pos, state, fortune); -+ int j = ((Integer)state.func_177229_b(field_176501_a)).intValue(); - byte b0 = 1; - - if (j >= 2) -@@ -147,8 +154,9 @@ - - for (int k = 0; k < b0; ++k) - { -- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(Items.field_151100_aR, 1, EnumDyeColor.BROWN.func_176767_b())); -+ dropped.add(new ItemStack(Items.field_151100_aR, 1, EnumDyeColor.BROWN.func_176767_b())); - } -+ return dropped; - } - - @SideOnly(Side.CLIENT) diff --git a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch deleted file mode 100644 index a9d87a8ea..000000000 --- a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch +++ /dev/null @@ -1,77 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockCrops.java -+++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java -@@ -82,11 +82,11 @@ - float f1 = 0.0F; - IBlockState iblockstate = p_180672_1_.func_180495_p(blockpos1.func_177982_a(i, 0, j)); - -- if (iblockstate.func_177230_c() == Blocks.field_150458_ak) -+ if (iblockstate.func_177230_c().canSustainPlant(p_180672_1_, blockpos1.func_177982_a(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)p_180672_0_)) - { - f1 = 1.0F; - -- if (((Integer)iblockstate.func_177229_b(BlockFarmland.field_176531_a)).intValue() > 0) -+ if (iblockstate.func_177230_c().isFertile(p_180672_1_, blockpos1.func_177982_a(i, 0, j))) - { - f1 = 3.0F; - } -@@ -127,7 +127,7 @@ - - public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_) - { -- return (p_180671_1_.func_175699_k(p_180671_2_) >= 8 || p_180671_1_.func_175678_i(p_180671_2_)) && this.func_149854_a(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c()); -+ return (p_180671_1_.func_175699_k(p_180671_2_) >= 8 || p_180671_1_.func_175678_i(p_180671_2_)) && p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c().canSustainPlant(p_180671_1_, p_180671_2_.func_177977_b(), net.minecraft.util.EnumFacing.UP, this); - } - - protected Item func_149866_i() -@@ -143,24 +143,6 @@ - public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) - { - super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, 0); -- -- if (!p_180653_1_.field_72995_K) -- { -- int j = ((Integer)p_180653_3_.func_177229_b(field_176488_a)).intValue(); -- -- if (j >= 7) -- { -- int k = 3 + p_180653_5_; -- -- for (int l = 0; l < k; ++l) -- { -- if (p_180653_1_.field_73012_v.nextInt(15) <= j) -- { -- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(this.func_149866_i(), 1, 0)); -- } -- } -- } -- } - } - - public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) -@@ -203,4 +185,26 @@ - { - return new BlockState(this, new IProperty[] {field_176488_a}); - } -+ -+ @Override -+ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = super.getDrops(world, pos, state, fortune); -+ int age = ((Integer)state.func_177229_b(field_176488_a)).intValue(); -+ Random rand = world instanceof World ? ((World)world).field_73012_v : new Random(); -+ -+ if (age >= 7) -+ { -+ int k = 3 + fortune; -+ -+ for (int i = 0; i < 3 + fortune; ++i) -+ { -+ if (rand.nextInt(15) <= age) -+ { -+ ret.add(new ItemStack(this.func_149866_i(), 1, 0)); -+ } -+ } -+ } -+ return ret; -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockDoor.java.patch b/patches/minecraft/net/minecraft/block/BlockDoor.java.patch deleted file mode 100644 index c30049e6b..000000000 --- a/patches/minecraft/net/minecraft/block/BlockDoor.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockDoor.java -+++ ../src-work/minecraft/net/minecraft/block/BlockDoor.java -@@ -149,7 +149,7 @@ - { - if (this.field_149764_J == Material.field_151573_f) - { -- return true; -+ return false; //Allow items to interact with the door - } - else - { -@@ -267,7 +267,7 @@ - - public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) - { -- return p_176196_2_.func_177956_o() >= 255 ? false : World.func_175683_a(p_176196_1_, p_176196_2_.func_177977_b()) && super.func_176196_c(p_176196_1_, p_176196_2_) && super.func_176196_c(p_176196_1_, p_176196_2_.func_177984_a()); -+ return p_176196_2_.func_177956_o() >= p_176196_1_.func_72800_K() - 1 ? false : World.func_175683_a(p_176196_1_, p_176196_2_.func_177977_b()) && super.func_176196_c(p_176196_1_, p_176196_2_) && super.func_176196_c(p_176196_1_, p_176196_2_.func_177984_a()); - } - - public int func_149656_h() diff --git a/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch b/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch deleted file mode 100644 index 8fe63ab74..000000000 --- a/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch +++ /dev/null @@ -1,89 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockDoublePlant.java -+++ ../src-work/minecraft/net/minecraft/block/BlockDoublePlant.java -@@ -24,7 +24,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class BlockDoublePlant extends BlockBush implements IGrowable -+public class BlockDoublePlant extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable - { - public static final PropertyEnum field_176493_a = PropertyEnum.func_177709_a("variant", BlockDoublePlant.EnumPlantType.class); - public static final PropertyEnum field_176492_b = PropertyEnum.func_177709_a("half", BlockDoublePlant.EnumBlockHalf.class); -@@ -89,6 +89,8 @@ - Object object = flag ? this : p_176475_1_.func_180495_p(blockpos1).func_177230_c(); - Object object1 = flag ? p_176475_1_.func_180495_p(blockpos2).func_177230_c() : this; - -+ if (!flag) this.func_176226_b(p_176475_1_, p_176475_2_, p_176475_3_, 0); //Forge move above the setting to air. -+ - if (object == this) - { - p_176475_1_.func_180501_a(blockpos1, Blocks.field_150350_a.func_176223_P(), 3); -@@ -97,17 +99,13 @@ - if (object1 == this) - { - p_176475_1_.func_180501_a(blockpos2, Blocks.field_150350_a.func_176223_P(), 3); -- -- if (!flag) -- { -- this.func_176226_b(p_176475_1_, blockpos2, p_176475_3_, 0); -- } - } - } - } - - public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_) - { -+ if (p_180671_3_.func_177230_c() != this) return super.func_180671_f(p_180671_1_, p_180671_2_, p_180671_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. - if (p_180671_3_.func_177229_b(field_176492_b) == BlockDoublePlant.EnumBlockHalf.UPPER) - { - return p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c() == this; -@@ -157,7 +155,6 @@ - - public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) - { -- if (p_180657_1_.field_72995_K || p_180657_2_.func_71045_bC() == null || p_180657_2_.func_71045_bC().func_77973_b() != Items.field_151097_aZ || p_180657_4_.func_177229_b(field_176492_b) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.func_176489_b(p_180657_1_, p_180657_3_, p_180657_4_, p_180657_2_)) - { - super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); - } -@@ -220,8 +217,6 @@ - else - { - p_176489_4_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); -- int i = (enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).func_177044_a(); -- func_180635_a(p_176489_1_, p_176489_2_, new ItemStack(Blocks.field_150329_H, 2, i)); - return true; - } - } -@@ -296,6 +291,32 @@ - return Block.EnumOffsetType.XZ; - } - -+ @Override -+ public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos) -+ { -+ IBlockState state = world.func_180495_p(pos); -+ EnumPlantType type = (EnumPlantType)state.func_177229_b(field_176493_a); -+ return state.func_177229_b(field_176492_b) == EnumBlockHalf.LOWER && (type == EnumPlantType.FERN || type == EnumPlantType.GRASS); -+ } -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ java.util.List ret = new java.util.ArrayList(); -+ EnumPlantType type = (EnumPlantType)world.func_180495_p(pos).func_177229_b(field_176493_a); -+ if (type == EnumPlantType.FERN) ret.add(new ItemStack(Blocks.field_150329_H, 2, BlockTallGrass.EnumType.FERN.func_177044_a())); -+ if (type == EnumPlantType.GRASS) ret.add(new ItemStack(Blocks.field_150329_H, 2, BlockTallGrass.EnumType.GRASS.func_177044_a())); -+ return ret; -+ } -+ @Override -+ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) -+ { -+ //Forge: Break both parts on the client to prevent the top part flickering as default type for a few frames. -+ IBlockState state = world.func_180495_p(pos); -+ if (state.func_177230_c() == this && state.func_177229_b(field_176492_b) == EnumBlockHalf.LOWER && world.func_180495_p(pos.func_177984_a()).func_177230_c() == this) -+ world.func_175698_g(pos.func_177984_a()); -+ return world.func_175698_g(pos); -+ } -+ - static enum EnumBlockHalf implements IStringSerializable - { - UPPER, diff --git a/patches/minecraft/net/minecraft/block/BlockFalling.java.patch b/patches/minecraft/net/minecraft/block/BlockFalling.java.patch deleted file mode 100644 index c7dd1fa25..000000000 --- a/patches/minecraft/net/minecraft/block/BlockFalling.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockFalling.java -+++ ../src-work/minecraft/net/minecraft/block/BlockFalling.java -@@ -85,6 +85,7 @@ - - public static boolean func_180685_d(World p_180685_0_, BlockPos p_180685_1_) - { -+ if (p_180685_0_.func_175623_d(p_180685_1_)) return true; - Block block = p_180685_0_.func_180495_p(p_180685_1_).func_177230_c(); - Material material = block.field_149764_J; - return block == Blocks.field_150480_ab || material == Material.field_151579_a || material == Material.field_151586_h || material == Material.field_151587_i; diff --git a/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch b/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch deleted file mode 100644 index 7547658d3..000000000 --- a/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockFarmland.java -+++ ../src-work/minecraft/net/minecraft/block/BlockFarmland.java -@@ -89,7 +89,7 @@ - private boolean func_176529_d(World p_176529_1_, BlockPos p_176529_2_) - { - Block block = p_176529_1_.func_180495_p(p_176529_2_.func_177984_a()).func_177230_c(); -- return block instanceof BlockCrops || block instanceof BlockStem; -+ return block instanceof net.minecraftforge.common.IPlantable && canSustainPlant(p_176529_1_, p_176529_2_, net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)block); - } - - private boolean func_176530_e(World p_176530_1_, BlockPos p_176530_2_) diff --git a/patches/minecraft/net/minecraft/block/BlockFire.java.patch b/patches/minecraft/net/minecraft/block/BlockFire.java.patch deleted file mode 100644 index 989c8cb5b..000000000 --- a/patches/minecraft/net/minecraft/block/BlockFire.java.patch +++ /dev/null @@ -1,211 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockFire.java -+++ ../src-work/minecraft/net/minecraft/block/BlockFire.java -@@ -42,18 +42,24 @@ - int j = p_176221_3_.func_177956_o(); - int k = p_176221_3_.func_177952_p(); - -- if (!World.func_175683_a(p_176221_2_, p_176221_3_.func_177977_b()) && !Blocks.field_150480_ab.func_176535_e(p_176221_2_, p_176221_3_.func_177977_b())) -+ if (!World.func_175683_a(p_176221_2_, p_176221_3_.func_177977_b()) && !Blocks.field_150480_ab.canCatchFire(p_176221_2_, p_176221_3_.func_177977_b(), EnumFacing.UP)) - { - boolean flag = (i + j + k & 1) == 1; - boolean flag1 = (i / 2 + j / 2 + k / 2 & 1) == 1; - int l = 0; - -- if (this.func_176535_e(p_176221_2_, p_176221_3_.func_177984_a())) -+ if (this.canCatchFire(p_176221_2_, p_176221_3_.func_177984_a(), EnumFacing.DOWN)) - { - l = flag ? 1 : 2; - } - -- return p_176221_1_.func_177226_a(field_176545_N, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177978_c()))).func_177226_a(field_176546_O, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177974_f()))).func_177226_a(field_176541_P, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177968_d()))).func_177226_a(field_176539_Q, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177976_e()))).func_177226_a(field_176542_R, Integer.valueOf(l)).func_177226_a(field_176540_b, Boolean.valueOf(flag1)).func_177226_a(field_176544_M, Boolean.valueOf(flag)); -+ return p_176221_1_.func_177226_a(field_176545_N, Boolean.valueOf(this.canCatchFire(p_176221_2_, p_176221_3_.func_177978_c(), EnumFacing.SOUTH))) -+ .func_177226_a(field_176546_O, Boolean.valueOf(this.canCatchFire(p_176221_2_, p_176221_3_.func_177974_f(), EnumFacing.EAST ))) -+ .func_177226_a(field_176541_P, Boolean.valueOf(this.canCatchFire(p_176221_2_, p_176221_3_.func_177968_d(), EnumFacing.NORTH))) -+ .func_177226_a(field_176539_Q, Boolean.valueOf(this.canCatchFire(p_176221_2_, p_176221_3_.func_177976_e(), EnumFacing.EAST ))) -+ .func_177226_a(field_176542_R, Integer.valueOf(l)) -+ .func_177226_a(field_176540_b, Boolean.valueOf(flag1)) -+ .func_177226_a(field_176544_M, Boolean.valueOf(flag)); - } - else - { -@@ -109,6 +115,7 @@ - - public 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_, Integer.valueOf(p_180686_2_)); - this.field_149848_b.put(p_180686_1_, Integer.valueOf(p_180686_3_)); - } -@@ -148,13 +155,8 @@ - } - - Block block = p_180650_1_.func_180495_p(p_180650_2_.func_177977_b()).func_177230_c(); -- boolean flag = block == Blocks.field_150424_aL; -+ boolean flag = block.isFireSource(p_180650_1_, p_180650_2_.func_177977_b(), EnumFacing.UP); - -- if (p_180650_1_.field_73011_w instanceof WorldProviderEnd && block == Blocks.field_150357_h) -- { -- flag = true; -- } -- - if (!flag && p_180650_1_.func_72896_J() && this.func_176537_d(p_180650_1_, p_180650_2_)) - { - p_180650_1_.func_175698_g(p_180650_2_); -@@ -183,7 +185,7 @@ - return; - } - -- if (!this.func_176535_e(p_180650_1_, p_180650_2_.func_177977_b()) && i == 15 && p_180650_4_.nextInt(4) == 0) -+ if (!this.canCatchFire(p_180650_1_, p_180650_2_.func_177977_b(), EnumFacing.UP) && i == 15 && p_180650_4_.nextInt(4) == 0) - { - p_180650_1_.func_175698_g(p_180650_2_); - return; -@@ -198,12 +200,12 @@ - b0 = -50; - } - -- this.func_176536_a(p_180650_1_, p_180650_2_.func_177974_f(), 300 + b0, p_180650_4_, i); -- this.func_176536_a(p_180650_1_, p_180650_2_.func_177976_e(), 300 + b0, p_180650_4_, i); -- this.func_176536_a(p_180650_1_, p_180650_2_.func_177977_b(), 250 + b0, p_180650_4_, i); -- this.func_176536_a(p_180650_1_, p_180650_2_.func_177984_a(), 250 + b0, p_180650_4_, i); -- this.func_176536_a(p_180650_1_, p_180650_2_.func_177978_c(), 300 + b0, p_180650_4_, i); -- this.func_176536_a(p_180650_1_, p_180650_2_.func_177968_d(), 300 + b0, p_180650_4_, i); -+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177974_f(), 300 + b0, p_180650_4_, i, EnumFacing.WEST); -+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177976_e(), 300 + b0, p_180650_4_, i, EnumFacing.EAST); -+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177977_b(), 250 + b0, p_180650_4_, i, EnumFacing.UP); -+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177984_a(), 250 + b0, p_180650_4_, i, EnumFacing.DOWN); -+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177978_c(), 300 + b0, p_180650_4_, i, EnumFacing.SOUTH); -+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177968_d(), 300 + b0, p_180650_4_, i, EnumFacing.NORTH); - - for (int j = -1; j <= 1; ++j) - { -@@ -262,22 +264,30 @@ - return false; - } - -+ @Deprecated // Use Block.getFlammability - public int func_176532_c(Block p_176532_1_) - { - Integer integer = (Integer)this.field_149848_b.get(p_176532_1_); - return integer == null ? 0 : integer.intValue(); - } - -+ @Deprecated // Use Block.getFlammability - public int func_176534_d(Block p_176534_1_) - { - Integer integer = (Integer)this.field_149849_a.get(p_176534_1_); - return integer == null ? 0 : integer.intValue(); - } - -+ @Deprecated // Use tryCatchFire with face below - 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 k = this.func_176532_c(p_176536_1_.func_180495_p(p_176536_2_).func_177230_c()); -+ this.tryCatchFire(p_176536_1_, p_176536_2_, p_176536_3_, p_176536_4_, p_176536_5_, EnumFacing.UP); -+ } - -+ private void tryCatchFire(World p_176536_1_, BlockPos p_176536_2_, int p_176536_3_, Random p_176536_4_, int p_176536_5_, EnumFacing face) -+ { -+ int k = p_176536_1_.func_180495_p(p_176536_2_).func_177230_c().getFlammability(p_176536_1_, p_176536_2_, face); -+ - if (p_176536_4_.nextInt(p_176536_3_) < k) - { - IBlockState iblockstate = p_176536_1_.func_180495_p(p_176536_2_); -@@ -314,7 +324,7 @@ - { - EnumFacing enumfacing = aenumfacing[j]; - -- if (this.func_176535_e(p_176533_1_, p_176533_2_.func_177972_a(enumfacing))) -+ if (this.canCatchFire(p_176533_1_, p_176533_2_.func_177972_a(enumfacing), enumfacing.func_176734_d())) - { - return true; - } -@@ -338,7 +348,7 @@ - for (int k = 0; k < j; ++k) - { - EnumFacing enumfacing = aenumfacing[k]; -- i = Math.max(this.func_176534_d(p_176538_1_.func_180495_p(p_176538_2_.func_177972_a(enumfacing)).func_177230_c()), i); -+ i = Math.max(p_176538_1_.func_180495_p(p_176538_2_.func_177972_a(enumfacing)).func_177230_c().getFlammability(p_176538_1_, p_176538_2_.func_177972_a(enumfacing), enumfacing.func_176734_d()), i); - } - - return i; -@@ -350,9 +360,10 @@ - return false; - } - -+ @Deprecated // Use canCatchFire with face sensitive version below - public boolean func_176535_e(IBlockAccess p_176535_1_, BlockPos p_176535_2_) - { -- return this.func_176534_d(p_176535_1_.func_180495_p(p_176535_2_).func_177230_c()) > 0; -+ return canCatchFire(p_176535_1_, p_176535_2_, EnumFacing.UP); - } - - public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) -@@ -396,9 +407,9 @@ - double d1; - double d2; - -- if (!World.func_175683_a(p_180655_1_, p_180655_2_.func_177977_b()) && !Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177977_b())) -+ if (!World.func_175683_a(p_180655_1_, p_180655_2_.func_177977_b()) && !Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177977_b(), EnumFacing.UP)) - { -- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177976_e())) -+ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177976_e(), EnumFacing.EAST)) - { - for (i = 0; i < 2; ++i) - { -@@ -409,7 +420,7 @@ - } - } - -- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177974_f())) -+ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177974_f(), EnumFacing.WEST)) - { - for (i = 0; i < 2; ++i) - { -@@ -420,7 +431,7 @@ - } - } - -- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177978_c())) -+ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177978_c(), EnumFacing.SOUTH)) - { - for (i = 0; i < 2; ++i) - { -@@ -431,7 +442,7 @@ - } - } - -- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177968_d())) -+ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177968_d(), EnumFacing.NORTH)) - { - for (i = 0; i < 2; ++i) - { -@@ -442,7 +453,7 @@ - } - } - -- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177984_a())) -+ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177984_a(), EnumFacing.DOWN)) - { - for (i = 0; i < 2; ++i) - { -@@ -490,4 +501,19 @@ - { - return new BlockState(this, new IProperty[] {field_176543_a, field_176545_N, field_176546_O, field_176541_P, field_176539_Q, field_176542_R, field_176540_b, field_176544_M}); - } -+ -+ /*================================= Forge Start ======================================*/ -+ /** -+ * Side sensitive version that calls the block function. -+ * -+ * @param world The current world -+ * @param pos Block position -+ * @param face The side the fire is coming from -+ * @return True if the face can catch fire. -+ */ -+ public boolean canCatchFire(IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ return world.func_180495_p(pos).func_177230_c().isFlammable(world, pos, face); -+ } -+ /*================================= Forge Start ======================================*/ - } diff --git a/patches/minecraft/net/minecraft/block/BlockGrass.java.patch b/patches/minecraft/net/minecraft/block/BlockGrass.java.patch deleted file mode 100644 index dec4d1514..000000000 --- a/patches/minecraft/net/minecraft/block/BlockGrass.java.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockGrass.java -+++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java -@@ -59,7 +59,7 @@ - { - if (!p_180650_1_.field_72995_K) - { -- if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).func_177230_c().func_149717_k() > 2) -+ if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).func_177230_c().getLightOpacity(p_180650_1_, p_180650_2_.func_177984_a()) > 2) - { - p_180650_1_.func_175656_a(p_180650_2_, Blocks.field_150346_d.func_176223_P()); - } -@@ -73,7 +73,7 @@ - Block block = p_180650_1_.func_180495_p(blockpos1.func_177984_a()).func_177230_c(); - IBlockState iblockstate1 = p_180650_1_.func_180495_p(blockpos1); - -- if (iblockstate1.func_177230_c() == Blocks.field_150346_d && iblockstate1.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos1.func_177984_a()) >= 4 && block.func_149717_k() <= 2) -+ if (iblockstate1.func_177230_c() == Blocks.field_150346_d && iblockstate1.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos1.func_177984_a()) >= 4 && block.getLightOpacity(p_180650_1_, blockpos1.func_177984_a()) <= 2) - { - p_180650_1_.func_175656_a(blockpos1, Blocks.field_150349_c.func_176223_P()); - } -@@ -120,18 +120,11 @@ - continue; - } - } -- else if (p_176474_1_.func_180495_p(blockpos2).func_177230_c().field_149764_J == Material.field_151579_a) -+ else if (p_176474_1_.func_175623_d(blockpos2)) - { - if (p_176474_2_.nextInt(8) == 0) - { -- BlockFlower.EnumFlowerType enumflowertype = p_176474_1_.func_180494_b(blockpos2).func_180623_a(p_176474_2_, blockpos2); -- BlockFlower blockflower = enumflowertype.func_176964_a().func_180346_a(); -- IBlockState iblockstate1 = blockflower.func_176223_P().func_177226_a(blockflower.func_176494_l(), enumflowertype); -- -- if (blockflower.func_180671_f(p_176474_1_, blockpos2, iblockstate1)) -- { -- p_176474_1_.func_180501_a(blockpos2, iblockstate1, 3); -- } -+ p_176474_1_.func_180494_b(blockpos2).plantFlower(p_176474_1_, p_176474_2_, blockpos2); - } - else - { diff --git a/patches/minecraft/net/minecraft/block/BlockIce.java.patch b/patches/minecraft/net/minecraft/block/BlockIce.java.patch deleted file mode 100644 index b4f3090b0..000000000 --- a/patches/minecraft/net/minecraft/block/BlockIce.java.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockIce.java -+++ ../src-work/minecraft/net/minecraft/block/BlockIce.java -@@ -40,14 +40,17 @@ - p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); - p_180657_2_.func_71020_j(0.025F); - -- if (this.func_149700_E() && EnchantmentHelper.func_77502_d(p_180657_2_)) -+ if (this.canSilkHarvest(p_180657_1_, p_180657_3_, p_180657_1_.func_180495_p(p_180657_3_), p_180657_2_) && EnchantmentHelper.func_77502_d(p_180657_2_)) - { -+ java.util.List items = new java.util.ArrayList(); - ItemStack itemstack = this.func_180643_i(p_180657_4_); - -- if (itemstack != null) -- { -- func_180635_a(p_180657_1_, p_180657_3_, itemstack); -- } -+ if (itemstack != null) items.add(itemstack); -+ -+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_1_.func_180495_p(p_180657_3_), 0, 1.0f, true, p_180657_2_); -+ -+ for (ItemStack is : items) -+ func_180635_a(p_180657_1_, p_180657_3_, is); - } - else - { -@@ -58,7 +61,9 @@ - } - - int i = EnchantmentHelper.func_77517_e(p_180657_2_); -+ harvesters.set(p_180657_2_); - this.func_176226_b(p_180657_1_, p_180657_3_, p_180657_4_, i); -+ harvesters.set(null); - Material material = p_180657_1_.func_180495_p(p_180657_3_.func_177977_b()).func_177230_c().func_149688_o(); - - if (material.func_76230_c() || material.func_76224_d()) diff --git a/patches/minecraft/net/minecraft/block/BlockLadder.java.patch b/patches/minecraft/net/minecraft/block/BlockLadder.java.patch deleted file mode 100644 index b72f616a4..000000000 --- a/patches/minecraft/net/minecraft/block/BlockLadder.java.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockLadder.java -+++ ../src-work/minecraft/net/minecraft/block/BlockLadder.java -@@ -80,7 +80,10 @@ - - public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) - { -- return p_176196_1_.func_180495_p(p_176196_2_.func_177976_e()).func_177230_c().func_149721_r() ? true : (p_176196_1_.func_180495_p(p_176196_2_.func_177974_f()).func_177230_c().func_149721_r() ? true : (p_176196_1_.func_180495_p(p_176196_2_.func_177978_c()).func_177230_c().func_149721_r() ? true : p_176196_1_.func_180495_p(p_176196_2_.func_177968_d()).func_177230_c().func_149721_r())); -+ return p_176196_1_.isSideSolid(p_176196_2_.func_177976_e(), EnumFacing.EAST, true) || -+ p_176196_1_.isSideSolid(p_176196_2_.func_177974_f(), EnumFacing.WEST, true) || -+ p_176196_1_.isSideSolid(p_176196_2_.func_177978_c(), EnumFacing.SOUTH, true) || -+ p_176196_1_.isSideSolid(p_176196_2_.func_177968_d(), EnumFacing.NORTH, true); - } - - public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) -@@ -124,7 +127,7 @@ - - protected boolean func_176381_b(World p_176381_1_, BlockPos p_176381_2_, EnumFacing p_176381_3_) - { -- return p_176381_1_.func_180495_p(p_176381_2_.func_177972_a(p_176381_3_.func_176734_d())).func_177230_c().func_149721_r(); -+ return p_176381_1_.isSideSolid(p_176381_2_.func_177972_a(p_176381_3_.func_176734_d()), p_176381_3_, true); - } - - @SideOnly(Side.CLIENT) -@@ -155,6 +158,8 @@ - return new BlockState(this, new IProperty[] {field_176382_a}); - } - -+ @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; } -+ - static final class SwitchEnumFacing - { - static final int[] field_180190_a = new int[EnumFacing.values().length]; diff --git a/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch b/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch deleted file mode 100644 index 270eade4c..000000000 --- a/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch +++ /dev/null @@ -1,130 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java -+++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java -@@ -18,7 +18,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public abstract class BlockLeaves extends BlockLeavesBase -+public abstract class BlockLeaves extends BlockLeavesBase implements net.minecraftforge.common.IShearable - { - public static final PropertyBool field_176237_a = PropertyBool.func_177716_a("decayable"); - public static final PropertyBool field_176236_b = PropertyBool.func_177716_a("check_decay"); -@@ -76,9 +76,9 @@ - BlockPos blockpos1 = p_180663_2_.func_177982_a(i1, j1, k1); - IBlockState iblockstate1 = p_180663_1_.func_180495_p(blockpos1); - -- if (iblockstate1.func_177230_c().func_149688_o() == Material.field_151584_j && !((Boolean)iblockstate1.func_177229_b(field_176236_b)).booleanValue()) -+ if (iblockstate1.func_177230_c().isLeaves(p_180663_1_, blockpos1)) - { -- p_180663_1_.func_180501_a(blockpos1, iblockstate1.func_177226_a(field_176236_b, Boolean.valueOf(true)), 4); -+ iblockstate1.func_177230_c().beginLeavesDecay(p_180663_1_, blockpos1); - } - } - } -@@ -119,11 +119,12 @@ - { - for (i2 = -b0; i2 <= b0; ++i2) - { -- Block block = p_180650_1_.func_180495_p(new BlockPos(j + k1, k + l1, l + i2)).func_177230_c(); -+ BlockPos tmp = new BlockPos(j + k1, k + l1, l + i2); -+ Block block = p_180650_1_.func_180495_p(tmp).func_177230_c(); - -- if (block != Blocks.field_150364_r && block != Blocks.field_150363_s) -+ if (!block.canSustainLeaves(p_180650_1_, tmp)) - { -- if (block.func_149688_o() == Material.field_151584_j) -+ if (block.isLeaves(p_180650_1_, tmp)) - { - this.field_150128_a[(k1 + j1) * i1 + (l1 + j1) * b1 + i2 + j1] = -2; - } -@@ -230,40 +231,7 @@ - - public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) - { -- if (!p_180653_1_.field_72995_K) -- { -- int j = this.func_176232_d(p_180653_3_); -- -- if (p_180653_5_ > 0) -- { -- j -= 2 << p_180653_5_; -- -- if (j < 10) -- { -- j = 10; -- } -- } -- -- if (p_180653_1_.field_73012_v.nextInt(j) == 0) -- { -- Item item = this.func_180660_a(p_180653_3_, p_180653_1_.field_73012_v, p_180653_5_); -- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(item, 1, this.func_180651_a(p_180653_3_))); -- } -- -- j = 200; -- -- if (p_180653_5_ > 0) -- { -- j -= 10 << p_180653_5_; -- -- if (j < 40) -- { -- j = 40; -- } -- } -- -- this.func_176234_a(p_180653_1_, p_180653_2_, p_180653_3_, j); -- } -+ super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); - } - - protected void func_176234_a(World p_176234_1_, BlockPos p_176234_2_, IBlockState p_176234_3_, int p_176234_4_) {} -@@ -298,4 +266,48 @@ - } - - public abstract BlockPlanks.EnumType func_176233_b(int p_176233_1_); -+ -+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } -+ @Override public boolean isLeaves(IBlockAccess world, BlockPos pos){ return true; } -+ -+ @Override -+ public void beginLeavesDecay(World world, BlockPos pos) -+ { -+ IBlockState state = world.func_180495_p(pos); -+ if (!(Boolean)state.func_177229_b(field_176236_b)) -+ { -+ world.func_180501_a(pos, state.func_177226_a(field_176236_b, true), 4); -+ } -+ } -+ -+ @Override -+ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = new java.util.ArrayList(); -+ Random rand = world instanceof World ? ((World)world).field_73012_v : new Random(); -+ int chance = this.func_176232_d(state); -+ -+ if (fortune > 0) -+ { -+ chance -= 2 << fortune; -+ if (chance < 10) chance = 10; -+ } -+ -+ if (rand.nextInt(chance) == 0) -+ ret.add(new ItemStack(func_180660_a(state, rand, fortune), 1, func_180651_a(state))); -+ -+ chance = 200; -+ if (fortune > 0) -+ { -+ chance -= 10 << fortune; -+ if (chance < 40) chance = 40; -+ } -+ -+ this.captureDrops(true); -+ if (world instanceof World) -+ this.func_176234_a((World)world, pos, state, chance); // Dammet mojang -+ ret.addAll(this.captureDrops(false)); -+ return ret; -+ } -+ - } diff --git a/patches/minecraft/net/minecraft/block/BlockLever.java.patch b/patches/minecraft/net/minecraft/block/BlockLever.java.patch deleted file mode 100644 index ff826eb16..000000000 --- a/patches/minecraft/net/minecraft/block/BlockLever.java.patch +++ /dev/null @@ -1,67 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockLever.java -+++ ../src-work/minecraft/net/minecraft/block/BlockLever.java -@@ -47,24 +47,24 @@ - - public boolean func_176198_a(World p_176198_1_, BlockPos p_176198_2_, EnumFacing p_176198_3_) - { -- return p_176198_3_ == EnumFacing.UP && World.func_175683_a(p_176198_1_, p_176198_2_.func_177977_b()) ? true : this.func_176358_d(p_176198_1_, p_176198_2_.func_177972_a(p_176198_3_.func_176734_d())); -+ return p_176198_3_ == EnumFacing.UP && World.func_175683_a(p_176198_1_, p_176198_2_.func_177977_b()) ? true : p_176198_1_.isSideSolid(p_176198_2_.func_177972_a(p_176198_3_.func_176734_d()), p_176198_3_); - } - - public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) - { -- return this.func_176358_d(p_176196_1_, p_176196_2_.func_177976_e()) ? true : (this.func_176358_d(p_176196_1_, p_176196_2_.func_177974_f()) ? true : (this.func_176358_d(p_176196_1_, p_176196_2_.func_177978_c()) ? true : (this.func_176358_d(p_176196_1_, p_176196_2_.func_177968_d()) ? true : (World.func_175683_a(p_176196_1_, p_176196_2_.func_177977_b()) ? true : this.func_176358_d(p_176196_1_, p_176196_2_.func_177984_a()))))); -+ return p_176196_1_.isSideSolid(p_176196_2_.func_177976_e(), EnumFacing.EAST ) || -+ p_176196_1_.isSideSolid(p_176196_2_.func_177974_f(), EnumFacing.WEST ) || -+ p_176196_1_.isSideSolid(p_176196_2_.func_177978_c(), EnumFacing.SOUTH) || -+ p_176196_1_.isSideSolid(p_176196_2_.func_177968_d(), EnumFacing.NORTH) || -+ p_176196_1_.isSideSolid(p_176196_2_.func_177977_b(), EnumFacing.UP ) || -+ p_176196_1_.isSideSolid(p_176196_2_.func_177984_a(), EnumFacing.DOWN ); - } - -- protected boolean func_176358_d(World p_176358_1_, BlockPos p_176358_2_) -- { -- return p_176358_1_.func_180495_p(p_176358_2_).func_177230_c().func_149721_r(); -- } -- - public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) - { - IBlockState iblockstate = this.func_176223_P().func_177226_a(field_176359_b, Boolean.valueOf(false)); - -- if (this.func_176358_d(p_180642_1_, p_180642_2_.func_177972_a(p_180642_3_.func_176734_d()))) -+ if (p_180642_1_.isSideSolid(p_180642_2_.func_177972_a(p_180642_3_.func_176734_d()), p_180642_3_)) - { - return iblockstate.func_177226_a(field_176360_a, BlockLever.EnumOrientation.func_176856_a(p_180642_3_, p_180642_8_.func_174811_aO())); - } -@@ -87,7 +87,7 @@ - - enumfacing1 = (EnumFacing)iterator.next(); - } -- while (enumfacing1 == p_180642_3_ || !this.func_176358_d(p_180642_1_, p_180642_2_.func_177972_a(enumfacing1.func_176734_d()))); -+ while (enumfacing1 == p_180642_3_ || !p_180642_1_.isSideSolid(p_180642_2_.func_177972_a(enumfacing1.func_176734_d()), enumfacing1)); - - return iblockstate.func_177226_a(field_176360_a, BlockLever.EnumOrientation.func_176856_a(enumfacing1, p_180642_8_.func_174811_aO())); - } -@@ -116,7 +116,8 @@ - - public void func_176204_a(World p_176204_1_, BlockPos p_176204_2_, IBlockState p_176204_3_, Block p_176204_4_) - { -- if (this.func_176356_e(p_176204_1_, p_176204_2_) && !this.func_176358_d(p_176204_1_, p_176204_2_.func_177972_a(((BlockLever.EnumOrientation)p_176204_3_.func_177229_b(field_176360_a)).func_176852_c().func_176734_d()))) -+ EnumFacing dir = ((BlockLever.EnumOrientation)p_176204_3_.func_177229_b(field_176360_a)).func_176852_c(); -+ if (this.func_176356_e(p_176204_1_, p_176204_2_) && !p_176204_1_.isSideSolid(p_176204_2_.func_177972_a(dir.func_176734_d()), dir)) - { - this.func_176226_b(p_176204_1_, p_176204_2_, p_176204_3_, 0); - p_176204_1_.func_175698_g(p_176204_2_); -@@ -235,6 +236,12 @@ - return new BlockState(this, new IProperty[] {field_176360_a, field_176359_b}); - } - -+ -+ private boolean canAttach(World world, BlockPos pos, EnumFacing side) -+ { -+ return world.isSideSolid(pos, side); -+ } -+ - public static enum EnumOrientation implements IStringSerializable - { - DOWN_X(0, "down_x", EnumFacing.DOWN), diff --git a/patches/minecraft/net/minecraft/block/BlockLog.java.patch b/patches/minecraft/net/minecraft/block/BlockLog.java.patch deleted file mode 100644 index 39ddc1c69..000000000 --- a/patches/minecraft/net/minecraft/block/BlockLog.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockLog.java -+++ ../src-work/minecraft/net/minecraft/block/BlockLog.java -@@ -38,9 +38,9 @@ - BlockPos blockpos1 = (BlockPos)iterator.next(); - IBlockState iblockstate1 = p_180663_1_.func_180495_p(blockpos1); - -- if (iblockstate1.func_177230_c().func_149688_o() == Material.field_151584_j && !((Boolean)iblockstate1.func_177229_b(BlockLeaves.field_176236_b)).booleanValue()) -+ if (iblockstate1.func_177230_c().isLeaves(p_180663_1_, blockpos1)) - { -- p_180663_1_.func_180501_a(blockpos1, iblockstate1.func_177226_a(BlockLeaves.field_176236_b, Boolean.valueOf(true)), 4); -+ iblockstate1.func_177230_c().beginLeavesDecay(p_180663_1_, blockpos1); - } - } - } -@@ -51,6 +51,9 @@ - return super.func_180642_a(p_180642_1_, p_180642_2_, p_180642_3_, p_180642_4_, p_180642_5_, p_180642_6_, p_180642_7_, p_180642_8_).func_177226_a(field_176299_a, BlockLog.EnumAxis.func_176870_a(p_180642_3_.func_176740_k())); - } - -+ @Override public boolean canSustainLeaves(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } -+ @Override public boolean isWood(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } -+ - public static enum EnumAxis implements IStringSerializable - { - X("x"), diff --git a/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch b/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch deleted file mode 100644 index cdc8c9e42..000000000 --- a/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockMobSpawner.java -+++ ../src-work/minecraft/net/minecraft/block/BlockMobSpawner.java -@@ -39,10 +39,14 @@ - public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) - { - super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); -- int j = 15 + p_180653_1_.field_73012_v.nextInt(15) + p_180653_1_.field_73012_v.nextInt(15); -- this.func_180637_b(p_180653_1_, p_180653_2_, j); - } - -+ @Override -+ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15); -+ } -+ - public boolean func_149662_c() - { - return false; diff --git a/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch b/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch deleted file mode 100644 index bf17395b9..000000000 --- a/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java -+++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java -@@ -76,7 +76,7 @@ - if (p_180671_2_.func_177956_o() >= 0 && p_180671_2_.func_177956_o() < 256) - { - IBlockState iblockstate1 = p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()); -- return iblockstate1.func_177230_c() == Blocks.field_150391_bh ? true : (iblockstate1.func_177230_c() == Blocks.field_150346_d && iblockstate1.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.PODZOL ? true : p_180671_1_.func_175699_k(p_180671_2_) < 13 && this.func_149854_a(iblockstate1.func_177230_c())); -+ return iblockstate1.func_177230_c() == Blocks.field_150391_bh ? true : (iblockstate1.func_177230_c() == Blocks.field_150346_d && iblockstate1.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.PODZOL ? true : p_180671_1_.func_175699_k(p_180671_2_) < 13 && iblockstate1.func_177230_c().canSustainPlant(p_180671_1_, p_180671_2_.func_177977_b(), net.minecraft.util.EnumFacing.UP, this)); - } - else - { diff --git a/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch b/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch deleted file mode 100644 index 4a2c0ac2c..000000000 --- a/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockMycelium.java -+++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java -@@ -39,7 +39,7 @@ - { - if (!p_180650_1_.field_72995_K) - { -- if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).func_177230_c().func_149717_k() > 2) -+ if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).func_177230_c().getLightOpacity(p_180650_1_, p_180650_2_.func_177984_a()) > 2) - { - p_180650_1_.func_175656_a(p_180650_2_, Blocks.field_150346_d.func_176223_P().func_177226_a(BlockDirt.field_176386_a, BlockDirt.DirtType.DIRT)); - } -@@ -53,7 +53,7 @@ - IBlockState iblockstate1 = p_180650_1_.func_180495_p(blockpos1); - Block block = p_180650_1_.func_180495_p(blockpos1.func_177984_a()).func_177230_c(); - -- if (iblockstate1.func_177230_c() == Blocks.field_150346_d && iblockstate1.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos1.func_177984_a()) >= 4 && block.func_149717_k() <= 2) -+ if (iblockstate1.func_177230_c() == Blocks.field_150346_d && iblockstate1.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos1.func_177984_a()) >= 4 && block.getLightOpacity(p_180650_1_, blockpos1.func_177984_a()) <= 2) - { - p_180650_1_.func_175656_a(blockpos1, this.func_176223_P()); - } diff --git a/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch b/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch deleted file mode 100644 index 374e2ef64..000000000 --- a/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java -+++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java -@@ -36,7 +36,7 @@ - - public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_) - { -- return this.func_149854_a(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c()); -+ return super.func_180671_f(p_180671_1_, p_180671_2_, p_180671_3_); - } - - public void func_180650_b(World p_180650_1_, BlockPos p_180650_2_, IBlockState p_180650_3_, Random p_180650_4_) -@@ -52,9 +52,11 @@ - super.func_180650_b(p_180650_1_, p_180650_2_, p_180650_3_, p_180650_4_); - } - -+ @SuppressWarnings("unused") - public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) - { -- if (!p_180653_1_.field_72995_K) -+ super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); -+ if (false && !p_180653_1_.field_72995_K) - { - int j = 1; - -@@ -105,4 +107,24 @@ - { - return new BlockState(this, new IProperty[] {field_176486_a}); - } -+ -+ @Override -+ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = new java.util.ArrayList(); -+ Random rand = world instanceof World ? ((World)world).field_73012_v : new Random(); -+ int count = 1; -+ -+ if (((Integer)state.func_177229_b(field_176486_a)) >= 3) -+ { -+ count = 2 + rand.nextInt(3) + (fortune > 0 ? rand.nextInt(fortune + 1) : 0); -+ } -+ -+ for (int i = 0; i < count; i++) -+ { -+ ret.add(new ItemStack(Items.field_151075_bm)); -+ } -+ -+ return ret; -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch b/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch deleted file mode 100644 index 150aabf9e..000000000 --- a/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockNewLeaf.java -+++ ../src-work/minecraft/net/minecraft/block/BlockNewLeaf.java -@@ -105,14 +105,15 @@ - - public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) - { -- if (!p_180657_1_.field_72995_K && p_180657_2_.func_71045_bC() != null && p_180657_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ) - { -- p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); -- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Item.func_150898_a(this), 1, ((BlockPlanks.EnumType)p_180657_4_.func_177229_b(field_176240_P)).func_176839_a() - 4)); -- } -- else -- { - super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); - } - } -+ -+ @Override -+ public List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ IBlockState state = world.func_180495_p(pos); -+ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.func_177229_b(field_176240_P)).func_176839_a() - 4))); -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockNote.java.patch b/patches/minecraft/net/minecraft/block/BlockNote.java.patch deleted file mode 100644 index dd913e8f5..000000000 --- a/patches/minecraft/net/minecraft/block/BlockNote.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockNote.java -+++ ../src-work/minecraft/net/minecraft/block/BlockNote.java -@@ -58,7 +58,9 @@ - if (tileentity instanceof TileEntityNote) - { - TileEntityNote tileentitynote = (TileEntityNote)tileentity; -+ int old = tileentitynote.field_145879_a; - tileentitynote.func_145877_a(); -+ if (old == tileentitynote.field_145879_a) return false; - tileentitynote.func_175108_a(p_180639_1_, p_180639_2_); - } - -@@ -96,6 +98,10 @@ - - public boolean func_180648_a(World p_180648_1_, BlockPos p_180648_2_, IBlockState p_180648_3_, int p_180648_4_, int p_180648_5_) - { -+ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(p_180648_1_, p_180648_2_, p_180648_3_, p_180648_5_, p_180648_4_); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e)) return false; -+ p_180648_4_ = e.instrument.ordinal(); -+ p_180648_5_ = e.getVanillaNoteId(); - float f = (float)Math.pow(2.0D, (double)(p_180648_5_ - 12) / 12.0D); - p_180648_1_.func_72908_a((double)p_180648_2_.func_177958_n() + 0.5D, (double)p_180648_2_.func_177956_o() + 0.5D, (double)p_180648_2_.func_177952_p() + 0.5D, "note." + this.func_176433_b(p_180648_4_), 3.0F, f); - p_180648_1_.func_175688_a(EnumParticleTypes.NOTE, (double)p_180648_2_.func_177958_n() + 0.5D, (double)p_180648_2_.func_177956_o() + 1.2D, (double)p_180648_2_.func_177952_p() + 0.5D, (double)p_180648_5_ / 24.0D, 0.0D, 0.0D, new int[0]); diff --git a/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch b/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch deleted file mode 100644 index b3bd13fbe..000000000 --- a/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockOldLeaf.java -+++ ../src-work/minecraft/net/minecraft/block/BlockOldLeaf.java -@@ -148,11 +148,17 @@ - if (!p_180657_1_.field_72995_K && p_180657_2_.func_71045_bC() != null && p_180657_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ) - { - p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); -- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Item.func_150898_a(this), 1, ((BlockPlanks.EnumType)p_180657_4_.func_177229_b(field_176239_P)).func_176839_a())); - } - else - { - super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); - } - } -+ -+ @Override -+ public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) -+ { -+ IBlockState state = world.func_180495_p(pos); -+ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.func_177229_b(field_176239_P)).func_176839_a()))); -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockOre.java.patch b/patches/minecraft/net/minecraft/block/BlockOre.java.patch deleted file mode 100644 index 8c026c147..000000000 --- a/patches/minecraft/net/minecraft/block/BlockOre.java.patch +++ /dev/null @@ -1,59 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockOre.java -+++ ../src-work/minecraft/net/minecraft/block/BlockOre.java -@@ -10,6 +10,7 @@ - import net.minecraft.item.Item; - import net.minecraft.util.BlockPos; - import net.minecraft.util.MathHelper; -+import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; - - public class BlockOre extends Block -@@ -54,34 +55,40 @@ - public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) - { - super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); -- -- if (this.func_180660_a(p_180653_3_, p_180653_1_.field_73012_v, p_180653_5_) != Item.func_150898_a(this)) -+ } -+ @Override -+ public int getExpDrop(IBlockAccess world, BlockPos pos, int fortune) -+ { -+ IBlockState state = world.func_180495_p(pos); -+ Random rand = world instanceof World ? ((World)world).field_73012_v : new Random(); -+ if (this.func_180660_a(state, rand, fortune) != Item.func_150898_a(this)) - { - int j = 0; - - if (this == Blocks.field_150365_q) - { -- j = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 0, 2); -+ j = MathHelper.func_76136_a(rand, 0, 2); - } - else if (this == Blocks.field_150482_ag) - { -- j = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 3, 7); -+ j = MathHelper.func_76136_a(rand, 3, 7); - } - else if (this == Blocks.field_150412_bA) - { -- j = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 3, 7); -+ j = MathHelper.func_76136_a(rand, 3, 7); - } - else if (this == Blocks.field_150369_x) - { -- j = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 2, 5); -+ j = MathHelper.func_76136_a(rand, 2, 5); - } - else if (this == Blocks.field_150449_bY) - { -- j = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 2, 5); -+ j = MathHelper.func_76136_a(rand, 2, 5); - } - -- this.func_180637_b(p_180653_1_, p_180653_2_, j); -+ return j; - } -+ return 0; - } - - public int func_176222_j(World p_176222_1_, BlockPos p_176222_2_) diff --git a/patches/minecraft/net/minecraft/block/BlockPane.java.patch b/patches/minecraft/net/minecraft/block/BlockPane.java.patch deleted file mode 100644 index eb7aee52d..000000000 --- a/patches/minecraft/net/minecraft/block/BlockPane.java.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPane.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPane.java -@@ -39,7 +39,10 @@ - - public IBlockState func_176221_a(IBlockState p_176221_1_, IBlockAccess p_176221_2_, BlockPos p_176221_3_) - { -- return p_176221_1_.func_177226_a(field_176241_b, Boolean.valueOf(this.func_150098_a(p_176221_2_.func_180495_p(p_176221_3_.func_177978_c()).func_177230_c()))).func_177226_a(field_176243_N, Boolean.valueOf(this.func_150098_a(p_176221_2_.func_180495_p(p_176221_3_.func_177968_d()).func_177230_c()))).func_177226_a(field_176244_O, Boolean.valueOf(this.func_150098_a(p_176221_2_.func_180495_p(p_176221_3_.func_177976_e()).func_177230_c()))).func_177226_a(field_176242_M, Boolean.valueOf(this.func_150098_a(p_176221_2_.func_180495_p(p_176221_3_.func_177974_f()).func_177230_c()))); -+ return p_176221_1_.func_177226_a(field_176241_b, canPaneConnectTo(p_176221_2_, p_176221_3_, EnumFacing.NORTH)) -+ .func_177226_a(field_176243_N, canPaneConnectTo(p_176221_2_, p_176221_3_, EnumFacing.SOUTH)) -+ .func_177226_a(field_176244_O, canPaneConnectTo(p_176221_2_, p_176221_3_, EnumFacing.WEST)) -+ .func_177226_a(field_176242_M, canPaneConnectTo(p_176221_2_, p_176221_3_, EnumFacing.EAST)); - } - - public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) -@@ -65,10 +68,10 @@ - - public void func_180638_a(World p_180638_1_, BlockPos p_180638_2_, IBlockState p_180638_3_, AxisAlignedBB p_180638_4_, List p_180638_5_, Entity p_180638_6_) - { -- boolean flag = this.func_150098_a(p_180638_1_.func_180495_p(p_180638_2_.func_177978_c()).func_177230_c()); -- boolean flag1 = this.func_150098_a(p_180638_1_.func_180495_p(p_180638_2_.func_177968_d()).func_177230_c()); -- boolean flag2 = this.func_150098_a(p_180638_1_.func_180495_p(p_180638_2_.func_177976_e()).func_177230_c()); -- boolean flag3 = this.func_150098_a(p_180638_1_.func_180495_p(p_180638_2_.func_177974_f()).func_177230_c()); -+ boolean flag = this.canPaneConnectTo(p_180638_1_, p_180638_2_, EnumFacing.NORTH); -+ boolean flag1 = this.canPaneConnectTo(p_180638_1_, p_180638_2_, EnumFacing.SOUTH); -+ boolean flag2 = this.canPaneConnectTo(p_180638_1_, p_180638_2_, EnumFacing.WEST); -+ boolean flag3 = this.canPaneConnectTo(p_180638_1_, p_180638_2_, EnumFacing.EAST); - - if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) - { -@@ -187,4 +190,11 @@ - { - return new BlockState(this, new IProperty[] {field_176241_b, field_176242_M, field_176244_O, field_176243_N}); - } -+ -+ public boolean canPaneConnectTo(IBlockAccess world, BlockPos pos, EnumFacing dir) -+ { -+ BlockPos off = pos.func_177972_a(dir); -+ Block block = world.func_180495_p(off).func_177230_c(); -+ return func_150098_a(block) || block.isSideSolid(world, off, dir.func_176734_d()); -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch b/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch deleted file mode 100644 index 20426bd9d..000000000 --- a/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java -@@ -200,7 +200,7 @@ - } - } - -- if (!flag1 && block.func_149688_o() != Material.field_151579_a && func_180696_a(block, p_180648_1_, blockpos1, enumfacing.func_176734_d(), false) && (block.func_149656_h() == 0 || block == Blocks.field_150331_J || block == Blocks.field_150320_F)) -+ if (!flag1 && !block.isAir(p_180648_1_, blockpos1) && func_180696_a(block, p_180648_1_, blockpos1, enumfacing.func_176734_d(), false) && (block.func_149656_h() == 0 || block == Blocks.field_150331_J || block == Blocks.field_150320_F)) - { - this.func_176319_a(p_180648_1_, p_180648_2_, enumfacing, false); - } -@@ -344,7 +344,7 @@ - return false; - } - -- return !(p_180696_0_ instanceof ITileEntityProvider); -+ return !(p_180696_0_.hasTileEntity(p_180696_1_.func_180495_p(p_180696_2_))); - } - else - { -@@ -384,7 +384,9 @@ - { - blockpos1 = (BlockPos)list1.get(j); - Block block = p_176319_1_.func_180495_p(blockpos1).func_177230_c(); -- block.func_176226_b(p_176319_1_, blockpos1, p_176319_1_.func_180495_p(blockpos1), 0); -+ //With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. -+ float chance = block instanceof BlockSnow ? -1.0f : 1.0f; -+ block.func_180653_a(p_176319_1_, blockpos1, p_176319_1_.func_180495_p(blockpos1), chance, 0); - p_176319_1_.func_175698_g(blockpos1); - --i; - ablock[i] = block; diff --git a/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch b/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch deleted file mode 100644 index 4f2d1c8a0..000000000 --- a/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPistonMoving.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPistonMoving.java -@@ -110,16 +110,7 @@ - - public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) - { -- if (!p_180653_1_.field_72995_K) -- { -- TileEntityPiston tileentitypiston = this.func_176422_e(p_180653_1_, p_180653_2_); -- -- if (tileentitypiston != null) -- { -- IBlockState iblockstate1 = tileentitypiston.func_174927_b(); -- iblockstate1.func_177230_c().func_176226_b(p_180653_1_, p_180653_2_, iblockstate1, 0); -- } -- } -+ super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); - } - - public MovingObjectPosition func_180636_a(World p_180636_1_, BlockPos p_180636_2_, Vec3 p_180636_3_, Vec3 p_180636_4_) -@@ -283,4 +274,16 @@ - { - return new BlockState(this, new IProperty[] {field_176426_a, field_176425_b}); - } -+ -+ @Override -+ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ TileEntityPiston tileentitypiston = this.func_176422_e(world, pos); -+ if (tileentitypiston != null) -+ { -+ IBlockState pushed = tileentitypiston.func_174927_b(); -+ return pushed.func_177230_c().getDrops(world, pos, pushed, fortune); -+ } -+ return new java.util.ArrayList(); -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockPotato.java.patch b/patches/minecraft/net/minecraft/block/BlockPotato.java.patch deleted file mode 100644 index 2adf70eee..000000000 --- a/patches/minecraft/net/minecraft/block/BlockPotato.java.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPotato.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPotato.java -@@ -24,13 +24,14 @@ - public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) - { - super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); -- -- if (!p_180653_1_.field_72995_K) -- { -- if (((Integer)p_180653_3_.func_177229_b(field_176488_a)).intValue() >= 7 && p_180653_1_.field_73012_v.nextInt(50) == 0) -- { -- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(Items.field_151170_bI)); -- } -- } - } -+ @Override -+ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = super.getDrops(world, pos, state, fortune); -+ java.util.Random rand = world instanceof World ? ((World)world).field_73012_v : new java.util.Random(); -+ if (((Integer)state.func_177229_b(field_176488_a)) >= 7 && rand.nextInt(50) == 0) -+ ret.add(new ItemStack(Items.field_151170_bI)); -+ return ret; -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch b/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch deleted file mode 100644 index 87ac6e5da..000000000 --- a/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPumpkin.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPumpkin.java -@@ -109,7 +109,7 @@ - - public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) - { -- return p_176196_1_.func_180495_p(p_176196_2_).func_177230_c().field_149764_J.func_76222_j() && World.func_175683_a(p_176196_1_, p_176196_2_.func_177977_b()); -+ return p_176196_1_.func_180495_p(p_176196_2_).func_177230_c().func_176200_f(p_176196_1_, p_176196_2_) && World.func_175683_a(p_176196_1_, p_176196_2_.func_177977_b()); - } - - public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch deleted file mode 100644 index b2ed5d2dc..000000000 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockRedstoneDiode.java -+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneDiode.java -@@ -200,6 +200,8 @@ - { - EnumFacing enumfacing = (EnumFacing)p_176400_3_.func_177229_b(field_176387_N); - BlockPos blockpos1 = p_176400_2_.func_177972_a(enumfacing.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(enumfacing.func_176734_d())).isCanceled()) -+ return; - p_176400_1_.func_180496_d(blockpos1, this); - p_176400_1_.func_175695_a(blockpos1, this, enumfacing); - } diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch deleted file mode 100644 index 7716b8837..000000000 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockRedstoneOre.java -+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneOre.java -@@ -92,12 +92,16 @@ - public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) - { - super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); -+ } - -- if (this.func_180660_a(p_180653_3_, p_180653_1_.field_73012_v, p_180653_5_) != Item.func_150898_a(this)) -+ @Override -+ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ if (this.func_180660_a(world.func_180495_p(pos), RANDOM, fortune) != Item.func_150898_a(this)) - { -- int j = 1 + p_180653_1_.field_73012_v.nextInt(5); -- this.func_180637_b(p_180653_1_, p_180653_2_, j); -+ return 1 + RANDOM.nextInt(5); - } -+ return 0; - } - - @SideOnly(Side.CLIENT) diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch deleted file mode 100644 index b6a66a746..000000000 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch +++ /dev/null @@ -1,59 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java -+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java -@@ -60,10 +60,10 @@ - BlockPos blockpos1 = p_176341_2_.func_177972_a(p_176341_3_); - Block block = p_176341_1_.func_180495_p(p_176341_2_.func_177972_a(p_176341_3_)).func_177230_c(); - -- if (!func_176343_a(p_176341_1_.func_180495_p(blockpos1), p_176341_3_) && (block.func_149637_q() || !func_176346_d(p_176341_1_.func_180495_p(blockpos1.func_177977_b())))) -+ if (!canRestoneConnect(p_176341_1_, blockpos1, p_176341_3_) && (block.func_149637_q() || !canRestoneConnect(p_176341_1_, blockpos1.func_177977_b(), null))) - { - Block block1 = p_176341_1_.func_180495_p(p_176341_2_.func_177984_a()).func_177230_c(); -- return !block1.func_149637_q() && block.func_149637_q() && func_176346_d(p_176341_1_.func_180495_p(blockpos1.func_177984_a())) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; -+ return !block1.func_149637_q() && block.func_149637_q() && canRestoneConnect(p_176341_1_, blockpos1.func_177984_a(), null) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; - } - else - { -@@ -393,35 +393,25 @@ - Block block = iblockstate.func_177230_c(); - boolean flag = block.func_149721_r(); - boolean flag1 = p_176339_1_.func_180495_p(p_176339_2_.func_177984_a()).func_177230_c().func_149721_r(); -- return !flag1 && flag && func_176340_e(p_176339_1_, blockpos1.func_177984_a()) ? true : (func_176343_a(iblockstate, p_176339_3_) ? true : (block == Blocks.field_150416_aS && iblockstate.func_177229_b(BlockRedstoneDiode.field_176387_N) == p_176339_3_ ? true : !flag && func_176340_e(p_176339_1_, blockpos1.func_177977_b()))); -+ return !flag1 && flag && canRestoneConnect(p_176339_1_, blockpos1.func_177984_a(), null) ? true : (canRestoneConnect(p_176339_1_, blockpos1, p_176339_3_) ? true : (block == Blocks.field_150416_aS && iblockstate.func_177229_b(BlockRedstoneDiode.field_176387_N) == p_176339_3_ ? true : !flag && canRestoneConnect(p_176339_1_, blockpos1.func_177977_b(), null))); - } - -- protected static boolean func_176340_e(IBlockAccess p_176340_0_, BlockPos p_176340_1_) -+ protected static boolean canRestoneConnect(IBlockAccess world, BlockPos pos, EnumFacing side) - { -- return func_176346_d(p_176340_0_.func_180495_p(p_176340_1_)); -- } -+ IBlockState state = world.func_180495_p(pos); - -- protected static boolean func_176346_d(IBlockState p_176346_0_) -- { -- return func_176343_a(p_176346_0_, (EnumFacing)null); -- } -- -- protected static boolean func_176343_a(IBlockState p_176343_0_, EnumFacing p_176343_1_) -- { -- Block block = p_176343_0_.func_177230_c(); -- -- if (block == Blocks.field_150488_af) -+ if (state.func_177230_c() == Blocks.field_150488_af) - { - return true; - } -- else if (Blocks.field_150413_aR.func_149907_e(block)) -+ else if (Blocks.field_150413_aR.func_149907_e(state.func_177230_c())) - { -- EnumFacing enumfacing1 = (EnumFacing)p_176343_0_.func_177229_b(BlockRedstoneRepeater.field_176387_N); -- return enumfacing1 == p_176343_1_ || enumfacing1.func_176734_d() == p_176343_1_; -+ EnumFacing direction = (EnumFacing)state.func_177229_b(BlockRedstoneRepeater.field_176387_N); -+ return direction == side || direction.func_176734_d() == side; - } - else - { -- return block.func_149744_f() && p_176343_1_ != null; -+ return state.func_177230_c().canConnectRedstone(world, pos, side); - } - } - diff --git a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch b/patches/minecraft/net/minecraft/block/BlockSapling.java.patch deleted file mode 100644 index b7fa64ce7..000000000 --- a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockSapling.java -+++ ../src-work/minecraft/net/minecraft/block/BlockSapling.java -@@ -66,6 +66,7 @@ - - public void func_176476_e(World p_176476_1_, BlockPos p_176476_2_, IBlockState p_176476_3_, Random p_176476_4_) - { -+ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(p_176476_1_, p_176476_4_, p_176476_2_)) return; - Object object = p_176476_4_.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true); - int i = 0; - int j = 0; diff --git a/patches/minecraft/net/minecraft/block/BlockSkull.java.patch b/patches/minecraft/net/minecraft/block/BlockSkull.java.patch deleted file mode 100644 index 9fd41a780..000000000 --- a/patches/minecraft/net/minecraft/block/BlockSkull.java.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockSkull.java -+++ ../src-work/minecraft/net/minecraft/block/BlockSkull.java -@@ -122,8 +122,6 @@ - return tileentity instanceof TileEntitySkull ? ((TileEntitySkull)tileentity).func_145904_a() : super.func_176222_j(p_176222_1_, p_176222_2_); - } - -- public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) {} -- - public void func_176208_a(World p_176208_1_, BlockPos p_176208_2_, IBlockState p_176208_3_, EntityPlayer p_176208_4_) - { - if (p_176208_4_.field_71075_bZ.field_75098_d) -@@ -131,13 +129,18 @@ - p_176208_3_ = p_176208_3_.func_177226_a(field_176417_b, Boolean.valueOf(true)); - p_176208_1_.func_180501_a(p_176208_2_, p_176208_3_, 4); - } -+ this.func_176226_b(p_176208_1_, p_176208_2_, p_176208_3_, 0); - - super.func_176208_a(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_); - } - - public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_) - { -- if (!p_180663_1_.field_72995_K) -+ super.func_180663_b(p_180663_1_, p_180663_2_, p_180663_3_); -+ } -+ public java.util.List getDrops(IBlockAccess p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_, int fortune) -+ { -+ java.util.List ret = new java.util.ArrayList(); - { - if (!((Boolean)p_180663_3_.func_177229_b(field_176417_b)).booleanValue()) - { -@@ -146,7 +149,7 @@ - if (tileentity instanceof TileEntitySkull) - { - TileEntitySkull tileentityskull = (TileEntitySkull)tileentity; -- ItemStack itemstack = new ItemStack(Items.field_151144_bL, 1, this.func_176222_j(p_180663_1_, p_180663_2_)); -+ ItemStack itemstack = new ItemStack(Items.field_151144_bL, 1, tileentityskull.func_145904_a()); - - if (tileentityskull.func_145904_a() == 3 && tileentityskull.func_152108_a() != null) - { -@@ -156,12 +159,11 @@ - itemstack.func_77978_p().func_74782_a("SkullOwner", nbttagcompound); - } - -- func_180635_a(p_180663_1_, p_180663_2_, itemstack); -+ ret.add(itemstack); - } - } -- -- super.func_180663_b(p_180663_1_, p_180663_2_, p_180663_3_); - } -+ return ret; - } - - public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) diff --git a/patches/minecraft/net/minecraft/block/BlockSnow.java.patch b/patches/minecraft/net/minecraft/block/BlockSnow.java.patch deleted file mode 100644 index c7c1efbf1..000000000 --- a/patches/minecraft/net/minecraft/block/BlockSnow.java.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockSnow.java -+++ ../src-work/minecraft/net/minecraft/block/BlockSnow.java -@@ -80,7 +80,7 @@ - { - IBlockState iblockstate = p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()); - Block block = iblockstate.func_177230_c(); -- return block != Blocks.field_150432_aD && block != Blocks.field_150403_cj ? (block.func_149688_o() == Material.field_151584_j ? true : (block == this && ((Integer)iblockstate.func_177229_b(field_176315_a)).intValue() == 7 ? true : block.func_149662_c() && block.field_149764_J.func_76230_c())) : false; -+ return block != Blocks.field_150432_aD && block != Blocks.field_150403_cj ? (block.isLeaves(p_176196_1_, p_176196_2_.func_177977_b()) ? true : (block == this && ((Integer)iblockstate.func_177229_b(field_176315_a)).intValue() == 7 ? true : block.func_149662_c() && block.field_149764_J.func_76230_c())) : false; - } - - public void func_176204_a(World p_176204_1_, BlockPos p_176204_2_, IBlockState p_176204_3_, Block p_176204_4_) -@@ -92,7 +92,6 @@ - { - if (!this.func_176196_c(p_176314_1_, p_176314_2_)) - { -- this.func_176226_b(p_176314_1_, p_176314_2_, p_176314_3_, 0); - p_176314_1_.func_175698_g(p_176314_2_); - return false; - } -@@ -104,9 +103,8 @@ - - public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) - { -- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Items.field_151126_ay, ((Integer)p_180657_4_.func_177229_b(field_176315_a)).intValue() + 1, 0)); -+ super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); - p_180657_1_.func_175698_g(p_180657_3_); -- p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); - } - - public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) -@@ -116,14 +114,13 @@ - - public int func_149745_a(Random p_149745_1_) - { -- return 0; -+ return 1; - } - - public void func_180650_b(World p_180650_1_, BlockPos p_180650_2_, IBlockState p_180650_3_, Random p_180650_4_) - { - if (p_180650_1_.func_175642_b(EnumSkyBlock.BLOCK, p_180650_2_) > 11) - { -- this.func_176226_b(p_180650_1_, p_180650_2_, p_180650_1_.func_180495_p(p_180650_2_), 0); - p_180650_1_.func_175698_g(p_180650_2_); - } - } -@@ -153,4 +150,6 @@ - { - return new BlockState(this, new IProperty[] {field_176315_a}); - } -+ -+ @Override public int quantityDropped(IBlockState state, int fortune, Random random){ return ((Integer)state.func_177229_b(field_176315_a)) + 1; } - } diff --git a/patches/minecraft/net/minecraft/block/BlockStem.java.patch b/patches/minecraft/net/minecraft/block/BlockStem.java.patch deleted file mode 100644 index ab4a31800..000000000 --- a/patches/minecraft/net/minecraft/block/BlockStem.java.patch +++ /dev/null @@ -1,45 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockStem.java -+++ ../src-work/minecraft/net/minecraft/block/BlockStem.java -@@ -108,7 +108,7 @@ - p_180650_2_ = p_180650_2_.func_177972_a(EnumFacing.Plane.HORIZONTAL.func_179518_a(p_180650_4_)); - Block block = p_180650_1_.func_180495_p(p_180650_2_.func_177977_b()).func_177230_c(); - -- if (p_180650_1_.func_180495_p(p_180650_2_).func_177230_c().field_149764_J == Material.field_151579_a && (block == Blocks.field_150458_ak || block == Blocks.field_150346_d || block == Blocks.field_150349_c)) -+ if (p_180650_1_.func_175623_d(p_180650_2_) && (block.canSustainPlant(p_180650_1_, p_180650_2_.func_177977_b(), EnumFacing.UP, this) || block == Blocks.field_150346_d || block == Blocks.field_150349_c)) - { - p_180650_1_.func_175656_a(p_180650_2_, this.field_149877_a.func_176223_P()); - } -@@ -162,24 +162,29 @@ - public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) - { - super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); -+ } - -- if (!p_180653_1_.field_72995_K) -+ @Override -+ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = new java.util.ArrayList(); - { - Item item = this.func_176481_j(); - - if (item != null) - { -- int j = ((Integer)p_180653_3_.func_177229_b(field_176484_a)).intValue(); -+ int j = ((Integer)state.func_177229_b(field_176484_a)).intValue(); - - for (int k = 0; k < 3; ++k) - { -- if (p_180653_1_.field_73012_v.nextInt(15) <= j) -+ if (RANDOM.nextInt(15) <= j) - { -- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(item)); -+ ret.add(new ItemStack(item)); - } - } - } - } -+ return ret; - } - - protected Item func_176481_j() diff --git a/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch b/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch deleted file mode 100644 index df5c0a009..000000000 --- a/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch +++ /dev/null @@ -1,66 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockTallGrass.java -+++ ../src-work/minecraft/net/minecraft/block/BlockTallGrass.java -@@ -23,7 +23,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class BlockTallGrass extends BlockBush implements IGrowable -+public class BlockTallGrass extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable - { - public static final PropertyEnum field_176497_a = PropertyEnum.func_177709_a("type", BlockTallGrass.EnumType.class); - private static final String __OBFID = "CL_00000321"; -@@ -44,7 +44,7 @@ - - public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_) - { -- return this.func_149854_a(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c()); -+ return super.func_180671_f(p_180671_1_, p_180671_2_, p_180671_3_); - } - - public boolean func_176200_f(World p_176200_1_, BlockPos p_176200_2_) -@@ -74,7 +74,7 @@ - - public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) - { -- return p_180660_2_.nextInt(8) == 0 ? Items.field_151014_N : null; -+ return null; - } - - public int func_149679_a(int p_149679_1_, Random p_149679_2_) -@@ -84,13 +84,7 @@ - - public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) - { -- if (!p_180657_1_.field_72995_K && p_180657_2_.func_71045_bC() != null && p_180657_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ) - { -- p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); -- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Blocks.field_150329_H, 1, ((BlockTallGrass.EnumType)p_180657_4_.func_177229_b(field_176497_a)).func_177044_a())); -- } -- else -- { - super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); - } - } -@@ -210,4 +204,22 @@ - } - } - } -+ -+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } -+ @Override -+ public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) -+ { -+ List ret = new java.util.ArrayList(); -+ ret.add(new ItemStack(Blocks.field_150329_H, 1, ((BlockTallGrass.EnumType)world.func_180495_p(pos).func_177229_b(field_176497_a)).func_177044_a())); -+ return ret; -+ } -+ @Override -+ public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ List ret = new java.util.ArrayList(); -+ if (RANDOM.nextInt(8) != 0) return ret; -+ ItemStack seed = net.minecraftforge.common.ForgeHooks.getGrassSeed(RANDOM); -+ if (seed != null) ret.add(seed); -+ return ret; -+ } - } diff --git a/patches/minecraft/net/minecraft/block/BlockTorch.java.patch b/patches/minecraft/net/minecraft/block/BlockTorch.java.patch deleted file mode 100644 index b7a92250f..000000000 --- a/patches/minecraft/net/minecraft/block/BlockTorch.java.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockTorch.java -+++ ../src-work/minecraft/net/minecraft/block/BlockTorch.java -@@ -70,7 +70,7 @@ - else - { - Block block = p_176594_1_.func_180495_p(p_176594_2_).func_177230_c(); -- return block instanceof BlockFence || block == Blocks.field_150359_w || block == Blocks.field_150463_bK || block == Blocks.field_150399_cn; -+ return block.canPlaceTorchOnTop(p_176594_1_, p_176594_2_); - } - } - -@@ -97,7 +97,7 @@ - { - BlockPos blockpos1 = p_176595_2_.func_177972_a(p_176595_3_.func_176734_d()); - boolean flag = p_176595_3_.func_176740_k().func_176722_c(); -- return flag && p_176595_1_.func_175677_d(blockpos1, true) || p_176595_3_.equals(EnumFacing.UP) && this.func_176594_d(p_176595_1_, blockpos1); -+ return flag && p_176595_1_.isSideSolid(blockpos1, p_176595_3_, true) || p_176595_3_.equals(EnumFacing.UP) && this.func_176594_d(p_176595_1_, blockpos1); - } - - public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) -@@ -120,7 +120,7 @@ - - enumfacing1 = (EnumFacing)iterator.next(); - } -- while (!p_180642_1_.func_175677_d(p_180642_2_.func_177972_a(enumfacing1.func_176734_d()), true)); -+ while (!p_180642_1_.isSideSolid(p_180642_2_.func_177972_a(enumfacing1.func_176734_d()), enumfacing1, true)); - - return this.func_176223_P().func_177226_a(field_176596_a, enumfacing1); - } -@@ -149,7 +149,7 @@ - EnumFacing enumfacing1 = enumfacing.func_176734_d(); - boolean flag = false; - -- if (axis.func_176722_c() && !p_176592_1_.func_175677_d(p_176592_2_.func_177972_a(enumfacing1), true)) -+ if (axis.func_176722_c() && !p_176592_1_.isSideSolid(p_176592_2_.func_177972_a(enumfacing1), enumfacing1, true)) - { - flag = true; - } diff --git a/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch b/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch deleted file mode 100644 index 21ca8d0d9..000000000 --- a/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockTrapDoor.java -+++ ../src-work/minecraft/net/minecraft/block/BlockTrapDoor.java -@@ -25,6 +25,8 @@ - - public class BlockTrapDoor extends Block - { -+ /** Set this to allow trapdoors to remain free-floating */ -+ public static boolean disableValidation = false; - public static final PropertyDirection field_176284_a = PropertyDirection.func_177712_a("facing", EnumFacing.Plane.HORIZONTAL); - public static final PropertyBool field_176283_b = PropertyBool.func_177716_a("open"); - public static final PropertyEnum field_176285_M = PropertyEnum.func_177709_a("half", BlockTrapDoor.DoorHalf.class); -@@ -141,9 +143,10 @@ - { - if (!p_176204_1_.field_72995_K) - { -+ EnumFacing direction = (EnumFacing)p_176204_3_.func_177229_b(field_176284_a); - BlockPos blockpos1 = p_176204_2_.func_177972_a(((EnumFacing)p_176204_3_.func_177229_b(field_176284_a)).func_176734_d()); - -- if (!func_150119_a(p_176204_1_.func_180495_p(blockpos1).func_177230_c())) -+ if (!(func_150119_a(p_176204_1_.func_180495_p(blockpos1).func_177230_c()) || p_176204_1_.isSideSolid(blockpos1, direction, true))) - { - p_176204_1_.func_175698_g(p_176204_2_); - this.func_176226_b(p_176204_1_, p_176204_2_, p_176204_3_, 0); -@@ -187,7 +190,10 @@ - - public boolean func_176198_a(World p_176198_1_, BlockPos p_176198_2_, EnumFacing p_176198_3_) - { -- return !p_176198_3_.func_176740_k().func_176720_b() && func_150119_a(p_176198_1_.func_180495_p(p_176198_2_.func_177972_a(p_176198_3_.func_176734_d())).func_177230_c()); -+ if (disableValidation) return true; -+ EnumFacing dir = p_176198_3_.func_176734_d(); -+ p_176198_2_ = p_176198_2_.func_177972_a(dir); -+ return !p_176198_3_.func_176740_k().func_176720_b() && (func_150119_a(p_176198_1_.func_180495_p(p_176198_2_).func_177230_c()) || p_176198_1_.isSideSolid(p_176198_2_, p_176198_3_, true)); - } - - protected static EnumFacing func_176281_b(int p_176281_0_) -@@ -224,6 +230,7 @@ - - private static boolean func_150119_a(Block p_150119_0_) - { -+ if (disableValidation) return true; - return p_150119_0_.field_149764_J.func_76218_k() && p_150119_0_.func_149686_d() || p_150119_0_ == Blocks.field_150426_aN || p_150119_0_ instanceof BlockSlab || p_150119_0_ instanceof BlockStairs; - } - diff --git a/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch b/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch deleted file mode 100644 index f5b18908b..000000000 --- a/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockTripWireHook.java -+++ ../src-work/minecraft/net/minecraft/block/BlockTripWireHook.java -@@ -60,7 +60,7 @@ - - public boolean func_176198_a(World p_176198_1_, BlockPos p_176198_2_, EnumFacing p_176198_3_) - { -- return p_176198_3_.func_176740_k().func_176722_c() && p_176198_1_.func_180495_p(p_176198_2_.func_177972_a(p_176198_3_.func_176734_d())).func_177230_c().func_149721_r(); -+ return p_176198_3_.func_176740_k().func_176722_c() && p_176198_1_.isSideSolid(p_176198_2_.func_177972_a(p_176198_3_.func_176734_d()), p_176198_3_, true); - } - - public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) -@@ -77,7 +77,7 @@ - - enumfacing = (EnumFacing)iterator.next(); - } -- while (!p_176196_1_.func_180495_p(p_176196_2_.func_177972_a(enumfacing)).func_177230_c().func_149721_r()); -+ while (!p_176196_1_.isSideSolid(p_176196_2_.func_177972_a(enumfacing), enumfacing.func_176734_d(), true)); - - return true; - } -@@ -107,7 +107,7 @@ - { - EnumFacing enumfacing = (EnumFacing)p_176204_3_.func_177229_b(field_176264_a); - -- if (!p_176204_1_.func_180495_p(p_176204_2_.func_177972_a(enumfacing.func_176734_d())).func_177230_c().func_149721_r()) -+ if (!p_176204_1_.isSideSolid(p_176204_2_.func_177972_a(enumfacing.func_176734_d()), enumfacing, true)) - { - this.func_176226_b(p_176204_1_, p_176204_2_, p_176204_3_, 0); - p_176204_1_.func_175698_g(p_176204_2_); diff --git a/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch b/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch deleted file mode 100644 index aaff29d17..000000000 --- a/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java -+++ ../src-work/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java -@@ -80,7 +80,7 @@ - { - Block block = this.field_177261_a.func_180495_p(p_177251_1_).func_177230_c(); - -- if (block.func_149688_o() == Material.field_151579_a) -+ if (block.isAir(field_177261_a, p_177251_1_)) - { - return true; - } -@@ -111,7 +111,7 @@ - BlockPos blockpos1 = p_177251_1_.func_177967_a(this.field_177257_d.func_176734_d(), i); - block = this.field_177261_a.func_180495_p(blockpos1).func_177230_c(); - -- if (block.func_149688_o() == Material.field_151579_a || !BlockPistonBase.func_180696_a(block, this.field_177261_a, blockpos1, this.field_177257_d, false) || blockpos1.equals(this.field_177259_b)) -+ if (block.isAir(field_177261_a, blockpos1)|| !BlockPistonBase.func_180696_a(block, this.field_177261_a, blockpos1, this.field_177257_d, false) || blockpos1.equals(this.field_177259_b)) - { - break; - } -@@ -159,7 +159,7 @@ - - block = this.field_177261_a.func_180495_p(blockpos2).func_177230_c(); - -- if (block.func_149688_o() == Material.field_151579_a) -+ if (block.isAir(field_177261_a, blockpos2)) - { - return true; - } diff --git a/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch b/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch deleted file mode 100644 index 9cbf23085..000000000 --- a/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/LoadingScreenRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/LoadingScreenRenderer.java -@@ -139,6 +139,10 @@ - GlStateManager.func_179086_m(16640); - } - -+ try -+ { -+ if (!net.minecraftforge.fml.client.FMLClientHandler.instance().handleLoadingScreen(scaledresolution)) //FML Don't render while FML's pre-screen is rendering -+ { - Tessellator tessellator = Tessellator.func_178181_a(); - WorldRenderer worldrenderer = tessellator.func_178180_c(); - this.field_73725_b.func_110434_K().func_110577_a(Gui.field_110325_k); -@@ -177,6 +181,12 @@ - GlStateManager.func_179120_a(770, 771, 1, 0); - this.field_73725_b.field_71466_p.func_175063_a(this.field_73726_c, (float)((l - this.field_73725_b.field_71466_p.func_78256_a(this.field_73726_c)) / 2), (float)(i1 / 2 - 4 - 16), 16777215); - this.field_73725_b.field_71466_p.func_175063_a(this.field_73727_a, (float)((l - this.field_73725_b.field_71466_p.func_78256_a(this.field_73727_a)) / 2), (float)(i1 / 2 - 4 + 8), 16777215); -+ } -+ } -+ catch (java.io.IOException e) -+ { -+ com.google.common.base.Throwables.propagate(e); -+ } //FML End - this.field_146588_g.func_147609_e(); - - if (OpenGlHelper.func_148822_b()) diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch deleted file mode 100644 index 28fcaf824..000000000 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ /dev/null @@ -1,476 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/Minecraft.java -+++ ../src-work/minecraft/net/minecraft/client/Minecraft.java -@@ -296,7 +296,6 @@ - this.field_152355_az = (new YggdrasilAuthenticationService(p_i45547_1_.field_178745_a.field_178751_c, UUID.randomUUID().toString())).createMinecraftSessionService(); - this.field_71449_j = p_i45547_1_.field_178745_a.field_178752_a; - field_147123_G.info("Setting user: " + this.field_71449_j.func_111285_a()); -- field_147123_G.info("(Session ID is " + this.field_71449_j.func_111286_b() + ")"); - this.field_71459_aj = p_i45547_1_.field_178741_d.field_178756_a; - this.field_71443_c = p_i45547_1_.field_178743_b.field_178764_a > 0 ? p_i45547_1_.field_178743_b.field_178764_a : 1; - this.field_71440_d = p_i45547_1_.field_178743_b.field_178762_b > 0 ? p_i45547_1_.field_178743_b.field_178762_b : 1; -@@ -411,10 +410,10 @@ - this.field_110451_am = new SimpleReloadableResourceManager(this.field_110452_an); - this.field_135017_as = new LanguageManager(this.field_110452_an, this.field_71474_y.field_74363_ab); - this.field_110451_am.func_110542_a(this.field_135017_as); -- this.func_110436_a(); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().beginMinecraftLoading(this, this.field_110449_ao, this.field_110451_am); - this.field_71446_o = new TextureManager(this.field_110451_am); - this.field_110451_am.func_110542_a(this.field_71446_o); -- this.func_180510_a(this.field_71446_o); -+ net.minecraftforge.fml.client.SplashProgress.drawVanillaScreen(this.field_71446_o); - this.func_175595_al(); - this.field_152350_aA = new SkinManager(this.field_71446_o, new File(this.field_110446_Y, "skins"), this.field_152355_az); - this.field_71469_aa = new AnvilSaveConverter(new File(this.field_71412_D, "saves")); -@@ -450,6 +449,8 @@ - } - }); - this.field_71417_B = new MouseHelper(); -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar= net.minecraftforge.fml.common.ProgressManager.push("Rendering Setup", 5, true); -+ bar.step("GL Setup"); - this.func_71361_d("Pre startup"); - GlStateManager.func_179098_w(); - GlStateManager.func_179103_j(7425); -@@ -463,17 +464,21 @@ - GlStateManager.func_179096_D(); - GlStateManager.func_179128_n(5888); - this.func_71361_d("Startup"); -- this.field_147128_au = new TextureMap("textures"); -+ bar.step("Loading Texture Map"); -+ this.field_147128_au = new TextureMap("textures",true); - this.field_147128_au.func_147633_a(this.field_71474_y.field_151442_I); - this.field_71446_o.func_110580_a(TextureMap.field_110575_b, this.field_147128_au); - this.field_71446_o.func_110577_a(TextureMap.field_110575_b); - this.field_147128_au.func_174937_a(false, this.field_71474_y.field_151442_I > 0); -+ bar.step("Loading Model Manager"); - this.field_175617_aL = new ModelManager(this.field_147128_au); - this.field_110451_am.func_110542_a(this.field_175617_aL); -+ bar.step("Loading Item Renderer"); - this.field_175621_X = new RenderItem(this.field_71446_o, this.field_175617_aL); - this.field_175616_W = new RenderManager(this.field_71446_o, this.field_175621_X); - this.field_175620_Y = new ItemRenderer(this); - this.field_110451_am.func_110542_a(this.field_175621_X); -+ bar.step("Loading Entity Renderer"); - this.field_71460_t = new EntityRenderer(this, this.field_110451_am); - this.field_110451_am.func_110542_a(this.field_71460_t); - this.field_175618_aM = new BlockRendererDispatcher(this.field_175617_aL.func_174954_c(), this.field_71474_y); -@@ -483,22 +488,25 @@ - this.field_71458_u = new GuiAchievement(this); - GlStateManager.func_179083_b(0, 0, this.field_71443_c, this.field_71440_d); - this.field_71452_i = new EffectRenderer(this.field_71441_e, this.field_71446_o); -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().finishMinecraftLoading(); - this.func_71361_d("Post startup"); -- this.field_71456_v = new GuiIngame(this); -+ this.field_71456_v = new net.minecraftforge.client.GuiIngameForge(this); - - if (this.field_71475_ae != null) - { -- this.func_147108_a(new GuiConnecting(new GuiMainMenu(), this, this.field_71475_ae, this.field_71477_af)); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServerAtStartup(this.field_71475_ae, this.field_71477_af); - } - else - { - this.func_147108_a(new GuiMainMenu()); - } - -- this.field_71446_o.func_147645_c(this.field_152354_ay); -+ net.minecraftforge.fml.client.SplashProgress.clearVanillaResources(field_71446_o, field_152354_ay); - this.field_152354_ay = null; - this.field_71461_s = new LoadingScreenRenderer(this); - -+ net.minecraftforge.fml.client.FMLClientHandler.instance().onInitializationComplete(); - if (this.field_71474_y.field_74353_u && !this.field_71431_Q) - { - this.func_71352_k(); -@@ -682,21 +690,23 @@ - File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt"); - Bootstrap.func_179870_a(p_71377_1_.func_71502_e()); - -+ int retVal; - if (p_71377_1_.func_71497_f() != null) - { - Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + p_71377_1_.func_71497_f()); -- System.exit(-1); -+ retVal = -1; - } - else if (p_71377_1_.func_147149_a(file2)) - { - Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath()); -- System.exit(-1); -+ retVal = -1; - } - else - { - Bootstrap.func_179870_a("#@?@# Game crashed! Crash report could not be saved. #@?@#"); -- System.exit(-2); -+ retVal = -2; - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleExit(retVal); - } - - public boolean func_152349_b() -@@ -888,11 +898,6 @@ - - public void func_147108_a(GuiScreen p_147108_1_) - { -- if (this.field_71462_r != null) -- { -- this.field_71462_r.func_146281_b(); -- } -- - if (p_147108_1_ == null && this.field_71441_e == null) - { - p_147108_1_ = new GuiMainMenu(); -@@ -902,6 +907,17 @@ - p_147108_1_ = new GuiGameOver(); - } - -+ GuiScreen old = this.field_71462_r; -+ 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.gui; -+ if (old != null && p_147108_1_ != old) -+ { -+ old.func_146281_b(); -+ } -+ - if (p_147108_1_ instanceof GuiMainMenu) - { - this.field_71474_y.field_74330_P = false; -@@ -1000,7 +1016,7 @@ - { - while (!this.field_152351_aB.isEmpty()) - { -- ((FutureTask)this.field_152351_aB.poll()).run(); -+ net.minecraftforge.fml.common.FMLCommonHandler.callFuture(((FutureTask)this.field_152351_aB.poll())); - } - } - -@@ -1035,9 +1051,11 @@ - - if (!this.field_71454_w) - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickStart(this.field_71428_T.field_74281_c); - this.field_71424_I.func_76318_c("gameRenderer"); - this.field_71460_t.func_78480_b(this.field_71428_T.field_74281_c); - this.field_71424_I.func_76319_b(); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickEnd(this.field_71428_T.field_74281_c); - } - - this.field_71424_I.func_76319_b(); -@@ -1383,7 +1401,7 @@ - - if (this.field_71441_e.func_180495_p(blockpos).func_177230_c().func_149688_o() != Material.field_151579_a && this.field_71442_b.func_180512_c(blockpos, this.field_71476_x.field_178784_b)) - { -- this.field_71452_i.func_180532_a(blockpos, this.field_71476_x.field_178784_b); -+ this.field_71452_i.addBlockHitEffects(blockpos, this.field_71476_x); - this.field_71439_g.func_71038_i(); - } - } -@@ -1463,15 +1481,19 @@ - case 2: - BlockPos blockpos = this.field_71476_x.func_178782_a(); - -- if (this.field_71441_e.func_180495_p(blockpos).func_177230_c().func_149688_o() != Material.field_151579_a) -+ if (!this.field_71441_e.func_175623_d(blockpos)) - { - int i = itemstack != null ? itemstack.field_77994_a : 0; - -+ -+ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_71439_g, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, this.field_71441_e, blockpos, this.field_71476_x.field_178784_b).isCanceled(); -+ if (result) { //Forge: Kept separate to simplify patch - if (this.field_71442_b.func_178890_a(this.field_71439_g, this.field_71441_e, itemstack, blockpos, this.field_71476_x.field_178784_b, this.field_71476_x.field_72307_f)) - { - flag = false; - this.field_71439_g.func_71038_i(); - } -+ } - - if (itemstack == null) - { -@@ -1494,7 +1516,8 @@ - { - ItemStack itemstack1 = this.field_71439_g.field_71071_by.func_70448_g(); - -- if (itemstack1 != null && this.field_71442_b.func_78769_a(this.field_71439_g, this.field_71441_e, itemstack1)) -+ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_71439_g, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, field_71441_e, null, null).isCanceled(); -+ if (result && itemstack1 != null && this.field_71442_b.func_78769_a(this.field_71439_g, this.field_71441_e, itemstack1)) - { - this.field_71460_t.field_78516_c.func_78445_c(); - } -@@ -1592,6 +1615,8 @@ - --this.field_71467_ac; - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreClientTick(); -+ - this.field_71424_I.func_76320_a("gui"); - - if (!this.field_71445_n) -@@ -1690,6 +1715,8 @@ - - while (Mouse.next()) - { -+ if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue; -+ - i = Mouse.getEventButton(); - KeyBinding.func_74510_a(i - 100, Mouse.getEventButtonState()); - -@@ -1745,6 +1772,7 @@ - this.field_71462_r.func_146274_d(); - } - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireMouseInput(); - } - - if (this.field_71429_W > 0) -@@ -1921,6 +1949,7 @@ - } - } - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireKeyInput(); - } - - for (i = 0; i < 9; ++i) -@@ -2121,12 +2150,15 @@ - this.field_71453_ak.func_74428_b(); - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostClientTick(); -+ - this.field_71424_I.func_76319_b(); - this.field_71423_H = func_71386_F(); - } - - public void func_71371_a(String p_71371_1_, String p_71371_2_, WorldSettings p_71371_3_) - { -+ net.minecraftforge.fml.client.FMLClientHandler.instance().startIntegratedServer(p_71371_1_, p_71371_2_, p_71371_3_); - this.func_71403_a((WorldClient)null); - System.gc(); - ISaveHandler isavehandler = this.field_71469_aa.func_75804_a(p_71371_1_, false); -@@ -2162,6 +2194,12 @@ - - while (!this.field_71437_Z.func_71200_ad()) - { -+ if (!net.minecraftforge.fml.common.StartupQuery.check()) -+ { -+ func_71403_a(null); -+ func_147108_a(null); -+ return; -+ } - String s2 = this.field_71437_Z.func_71195_b_(); - - if (s2 != null) -@@ -2187,8 +2225,14 @@ - SocketAddress socketaddress = this.field_71437_Z.func_147137_ag().func_151270_a(); - NetworkManager networkmanager = NetworkManager.func_150722_a(socketaddress); - networkmanager.func_150719_a(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null)); -- networkmanager.func_179290_a(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN)); -- networkmanager.func_179290_a(new C00PacketLoginStart(this.func_110432_I().func_148256_e())); -+ networkmanager.func_179290_a(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN, true)); -+ 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.func_179290_a(new C00PacketLoginStart(gameProfile)); - this.field_71453_ak = networkmanager; - } - -@@ -2199,6 +2243,8 @@ - - public void func_71353_a(WorldClient p_71353_1_, String p_71353_2_) - { -+ if (field_71441_e != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(field_71441_e)); -+ - if (p_71353_1_ == null) - { - NetHandlerPlayClient nethandlerplayclient = this.func_147114_u(); -@@ -2212,6 +2258,18 @@ - { - this.field_71437_Z.func_71263_m(); - this.field_71437_Z.func_175592_a(); -+ if (field_71461_s != null) -+ { -+ this.field_71461_s.func_73719_c(I18n.func_135052_a("forge.client.shutdown.internal")); -+ } -+ while (!field_71437_Z.func_71241_aa()) -+ { -+ try -+ { -+ Thread.sleep(10); -+ } -+ catch (InterruptedException ie) {} -+ } - } - - this.field_71437_Z = null; -@@ -2238,6 +2296,7 @@ - - this.func_71351_a((ServerData)null); - this.field_71455_al = false; -+ net.minecraftforge.fml.client.FMLClientHandler.instance().handleClientWorldClosing(this.field_71441_e); - } - - this.field_147127_av.func_147690_c(); -@@ -2342,134 +2401,11 @@ - if (this.field_71476_x != null) - { - boolean flag = this.field_71439_g.field_71075_bZ.field_75098_d; -- int i = 0; -- boolean flag1 = false; -- TileEntity tileentity = null; -- Object object; - -- if (this.field_71476_x.field_72313_a == MovingObjectPosition.MovingObjectType.BLOCK) -- { -- BlockPos blockpos = this.field_71476_x.func_178782_a(); -- Block block = this.field_71441_e.func_180495_p(blockpos).func_177230_c(); -- -- if (block.func_149688_o() == Material.field_151579_a) -- { -- return; -- } -- -- object = block.func_180665_b(this.field_71441_e, blockpos); -- -- if (object == null) -- { -- return; -- } -- -- if (flag && GuiScreen.func_146271_m()) -- { -- tileentity = this.field_71441_e.func_175625_s(blockpos); -- } -- -- Block block1 = object instanceof ItemBlock && !block.func_149648_K() ? Block.func_149634_a((Item)object) : block; -- i = block1.func_176222_j(this.field_71441_e, blockpos); -- flag1 = ((Item)object).func_77614_k(); -- } -- else -- { -- if (this.field_71476_x.field_72313_a != MovingObjectPosition.MovingObjectType.ENTITY || this.field_71476_x.field_72308_g == null || !flag) -- { -- return; -- } -- -- if (this.field_71476_x.field_72308_g instanceof EntityPainting) -- { -- object = Items.field_151159_an; -- } -- else if (this.field_71476_x.field_72308_g instanceof EntityLeashKnot) -- { -- object = Items.field_151058_ca; -- } -- else if (this.field_71476_x.field_72308_g instanceof EntityItemFrame) -- { -- EntityItemFrame entityitemframe = (EntityItemFrame)this.field_71476_x.field_72308_g; -- ItemStack itemstack = entityitemframe.func_82335_i(); -- -- if (itemstack == null) -- { -- object = Items.field_151160_bD; -- } -- else -- { -- object = itemstack.func_77973_b(); -- i = itemstack.func_77960_j(); -- flag1 = true; -- } -- } -- else if (this.field_71476_x.field_72308_g instanceof EntityMinecart) -- { -- EntityMinecart entityminecart = (EntityMinecart)this.field_71476_x.field_72308_g; -- -- switch (Minecraft.SwitchEnumMinecartType.field_178901_b[entityminecart.func_180456_s().ordinal()]) -- { -- case 1: -- object = Items.field_151109_aJ; -- break; -- case 2: -- object = Items.field_151108_aI; -- break; -- case 3: -- object = Items.field_151142_bV; -- break; -- case 4: -- object = Items.field_151140_bW; -- break; -- case 5: -- object = Items.field_151095_cc; -- break; -- default: -- object = Items.field_151143_au; -- } -- } -- else if (this.field_71476_x.field_72308_g instanceof EntityBoat) -- { -- object = Items.field_151124_az; -- } -- else if (this.field_71476_x.field_72308_g instanceof EntityArmorStand) -- { -- object = Items.field_179565_cj; -- } -- else -- { -- object = Items.field_151063_bx; -- i = EntityList.func_75619_a(this.field_71476_x.field_72308_g); -- flag1 = true; -- -- if (!EntityList.field_75627_a.containsKey(Integer.valueOf(i))) -- { -- return; -- } -- } -- } -- - InventoryPlayer inventoryplayer = this.field_71439_g.field_71071_by; - -- if (tileentity == null) -- { -- inventoryplayer.func_146030_a((Item)object, i, flag1, flag); -- } -- else -- { -- NBTTagCompound nbttagcompound1 = new NBTTagCompound(); -- tileentity.func_145841_b(nbttagcompound1); -- ItemStack itemstack1 = new ItemStack((Item)object, 1, i); -- itemstack1.func_77983_a("BlockEntityTag", nbttagcompound1); -- NBTTagCompound nbttagcompound = new NBTTagCompound(); -- NBTTagList nbttaglist = new NBTTagList(); -- nbttaglist.func_74742_a(new NBTTagString("(+NBT)")); -- nbttagcompound.func_74782_a("Lore", nbttaglist); -- itemstack1.func_77983_a("display", nbttagcompound); -- inventoryplayer.func_70299_a(inventoryplayer.field_70461_c, itemstack1); -- } -- -+ if (!net.minecraftforge.common.ForgeHooks.onPickBlock(this.field_71476_x, this.field_71439_g, this.field_71441_e)) return; -+ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions - if (flag) - { - int j = this.field_71439_g.field_71069_bz.field_75151_b.size() - 9 + inventoryplayer.field_70461_c; -@@ -2727,18 +2663,8 @@ - - public static int func_71369_N() - { -- for (int i = 16384; i > 0; i >>= 1) -- { -- GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null); -- int j = GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); -- -- if (j != 0) -- { -- return i; -- } -- } -- -- return -1; -+ //Forge we redirect this to our code which caches the value before any splash screen stuff is done. -+ return net.minecraftforge.fml.client.SplashProgress.getMaxTextureSize(); - } - - public boolean func_70002_Q() diff --git a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch deleted file mode 100644 index 4b546c294..000000000 --- a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch +++ /dev/null @@ -1,80 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/entity/EntityPlayerSP.java -+++ ../src-work/minecraft/net/minecraft/client/entity/EntityPlayerSP.java -@@ -53,6 +53,9 @@ - import net.minecraft.world.World; - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; -+import net.minecraftforge.client.ForgeHooksClient; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.PlaySoundAtEntityEvent; - - @SideOnly(Side.CLIENT) - public class EntityPlayerSP extends AbstractClientPlayer -@@ -342,6 +345,15 @@ - this.field_71159_c.field_71456_v.func_146158_b().func_146227_a(p_146105_1_); - } - -+ private boolean isHeadspaceFree(BlockPos pos, int height) -+ { -+ for (int y = 0; y < height; y++) -+ { -+ if (func_175162_d(pos.func_177982_a(0, y, 0))) return false; -+ } -+ return true; -+ } -+ - protected boolean func_145771_j(double p_145771_1_, double p_145771_3_, double p_145771_5_) - { - if (this.field_70145_X) -@@ -354,30 +366,34 @@ - double d3 = p_145771_1_ - (double)blockpos.func_177958_n(); - double d4 = p_145771_5_ - (double)blockpos.func_177952_p(); - -- if (!this.func_175162_d(blockpos)) -+ int entHeight = Math.max(Math.round(this.field_70131_O), 1); -+ -+ boolean inTranslucentBlock = this.isHeadspaceFree(blockpos, entHeight); -+ -+ if (inTranslucentBlock) - { - byte b0 = -1; - double d5 = 9999.0D; - -- if (this.func_175162_d(blockpos.func_177976_e()) && d3 < d5) -+ if (!this.isHeadspaceFree(blockpos.func_177976_e(), entHeight) && d3 < d5) - { - d5 = d3; - b0 = 0; - } - -- if (this.func_175162_d(blockpos.func_177974_f()) && 1.0D - d3 < d5) -+ if (!this.isHeadspaceFree(blockpos.func_177974_f(), entHeight) && 1.0D - d3 < d5) - { - d5 = 1.0D - d3; - b0 = 1; - } - -- if (this.func_175162_d(blockpos.func_177978_c()) && d4 < d5) -+ if (!this.isHeadspaceFree(blockpos.func_177978_c(), entHeight) && d4 < d5) - { - d5 = d4; - b0 = 4; - } - -- if (this.func_175162_d(blockpos.func_177968_d()) && 1.0D - d4 < d5) -+ if (!this.isHeadspaceFree(blockpos.func_177968_d(), entHeight) && 1.0D - d4 < d5) - { - d5 = 1.0D - d4; - b0 = 5; -@@ -445,6 +461,11 @@ - - public void func_85030_a(String p_85030_1_, float p_85030_2_, float p_85030_3_) - { -+ PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_85030_1_, p_85030_2_, p_85030_3_); -+ if (event.isCanceled() || event.name == null) return; -+ p_85030_1_ = event.name; -+ p_85030_2_ = event.newVolume; -+ p_85030_3_ = event.newPitch; - this.field_70170_p.func_72980_b(this.field_70165_t, this.field_70163_u, this.field_70161_v, p_85030_1_, p_85030_2_, p_85030_3_, false); - } - diff --git a/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch b/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch deleted file mode 100644 index 8f1d0c6ba..000000000 --- a/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch +++ /dev/null @@ -1,155 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/FontRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/gui/FontRenderer.java -@@ -57,7 +57,7 @@ - this.field_111273_g = p_i1035_2_; - this.field_78298_i = p_i1035_3_; - this.field_78293_l = p_i1035_4_; -- p_i1035_3_.func_110577_a(this.field_111273_g); -+ bindTexture(this.field_111273_g); - - for (int i = 0; i < 32; ++i) - { -@@ -97,6 +97,7 @@ - public void func_110549_a(IResourceManager p_110549_1_) - { - this.func_111272_d(); -+ this.func_98306_d(); - } - - private void func_111272_d() -@@ -105,7 +106,7 @@ - - try - { -- bufferedimage = TextureUtil.func_177053_a(Minecraft.func_71410_x().func_110442_L().func_110536_a(this.field_111273_g).func_110527_b()); -+ bufferedimage = TextureUtil.func_177053_a(getResourceInputStream(this.field_111273_g)); - } - catch (IOException ioexception) - { -@@ -172,7 +173,7 @@ - - try - { -- inputstream = Minecraft.func_71410_x().func_110442_L().func_110536_a(new ResourceLocation("font/glyph_sizes.bin")).func_110527_b(); -+ inputstream = getResourceInputStream(new ResourceLocation("font/glyph_sizes.bin")); - inputstream.read(this.field_78287_e); - } - catch (IOException ioexception) -@@ -195,7 +196,7 @@ - float f = (float)(p_78266_1_ % 16 * 8); - float f1 = (float)(p_78266_1_ / 16 * 8); - float f2 = p_78266_2_ ? 1.0F : 0.0F; -- this.field_78298_i.func_110577_a(this.field_111273_g); -+ bindTexture(this.field_111273_g); - float f3 = (float)this.field_78286_d[p_78266_1_] - 0.01F; - GL11.glBegin(GL11.GL_TRIANGLE_STRIP); - GL11.glTexCoord2f(f / 128.0F, f1 / 128.0F); -@@ -222,7 +223,7 @@ - - private void func_78257_a(int p_78257_1_) - { -- this.field_78298_i.func_110577_a(this.func_111271_a(p_78257_1_)); -+ bindTexture(this.func_111271_a(p_78257_1_)); - } - - protected float func_78277_a(char p_78277_1_, boolean p_78277_2_) -@@ -269,7 +270,7 @@ - - public int func_175065_a(String p_175065_1_, float p_175065_2_, float p_175065_3_, int p_175065_4_, boolean p_175065_5_) - { -- GlStateManager.func_179141_d(); -+ enableAlpha(); - this.func_78265_b(); - int j; - -@@ -341,7 +342,7 @@ - - k = this.field_78285_g[j]; - this.field_78304_r = k; -- GlStateManager.func_179131_c((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.field_78305_q); -+ setColor((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.field_78305_q); - } - else if (j == 16) - { -@@ -370,7 +371,7 @@ - this.field_78299_w = false; - this.field_78300_v = false; - this.field_78301_u = false; -- GlStateManager.func_179131_c(this.field_78291_n, this.field_78292_o, this.field_78306_p, this.field_78305_q); -+ setColor(this.field_78291_n, this.field_78292_o, this.field_78306_p, this.field_78305_q); - } - - ++i; -@@ -390,7 +391,7 @@ - j = k; - } - -- float f1 = this.field_78293_l ? 0.5F : 1.0F; -+ float f1 = func_78263_a(c0) / 32f; - boolean flag1 = (c0 == 0 || j == -1 || this.field_78293_l) && p_78255_2_; - - if (flag1) -@@ -429,6 +430,15 @@ - ++f; - } - -+ doDraw(f); -+ } -+ } -+ } -+ -+ protected void doDraw(float f) -+ { -+ { -+ { - Tessellator tessellator; - WorldRenderer worldrenderer; - -@@ -504,7 +514,7 @@ - this.field_78292_o = (float)(p_180455_4_ >> 8 & 255) / 255.0F; - this.field_78306_p = (float)(p_180455_4_ & 255) / 255.0F; - this.field_78305_q = (float)(p_180455_4_ >> 24 & 255) / 255.0F; -- GlStateManager.func_179131_c(this.field_78291_n, this.field_78292_o, this.field_78306_p, this.field_78305_q); -+ setColor(this.field_78291_n, this.field_78292_o, this.field_78306_p, this.field_78305_q); - this.field_78295_j = p_180455_2_; - this.field_78296_k = p_180455_3_; - this.func_78255_a(p_180455_1_, p_180455_5_); -@@ -583,11 +593,6 @@ - int j = this.field_78287_e[p_78263_1_] >>> 4; - int k = this.field_78287_e[p_78263_1_] & 15; - -- if (k > 7) -- { -- k = 15; -- j = 0; -- } - - ++k; - return (k - j) / 2 + 1; -@@ -842,6 +847,26 @@ - return this.field_78294_m; - } - -+ protected void setColor(float r, float g, float b, float a) -+ { -+ GlStateManager.func_179131_c(r,g,b,a); -+ } -+ -+ protected void enableAlpha() -+ { -+ GlStateManager.func_179141_d(); -+ } -+ -+ protected void bindTexture(ResourceLocation location) -+ { -+ field_78298_i.func_110577_a(location); -+ } -+ -+ protected InputStream getResourceInputStream(ResourceLocation location) throws IOException -+ { -+ return Minecraft.func_71410_x().func_110442_L().func_110536_a(location).func_110527_b(); -+ } -+ - public int func_175064_b(char p_175064_1_) - { - return this.field_78285_g["0123456789abcdef".indexOf(p_175064_1_)]; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch deleted file mode 100644 index dbe280e82..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java -@@ -213,6 +213,8 @@ - } - } - -+ WorldType.field_77139_a[this.field_146331_K].onGUICreateWorldPress(); -+ - WorldSettings.GameType gametype = WorldSettings.GameType.func_77142_a(this.field_146342_r); - WorldSettings worldsettings = new WorldSettings(i, gametype, this.field_146341_s, this.field_146337_w, WorldType.field_77139_a[this.field_146331_K]); - worldsettings.func_82750_a(this.field_146334_a); -@@ -320,14 +322,7 @@ - } - else if (p_146284_1_.field_146127_k == 8) - { -- if (WorldType.field_77139_a[this.field_146331_K] == WorldType.field_77138_c) -- { -- this.field_146297_k.func_147108_a(new GuiCreateFlatWorld(this, this.field_146334_a)); -- } -- else -- { -- this.field_146297_k.func_147108_a(new GuiCustomizeWorldScreen(this, this.field_146334_a)); -- } -+ WorldType.field_77139_a[this.field_146331_K].onCustomizeButton(field_146297_k, this); - } - } - } -@@ -379,7 +374,7 @@ - this.field_146326_C.field_146125_m = this.field_146344_y; - this.field_146320_D.field_146125_m = this.field_146344_y; - this.field_146321_E.field_146125_m = this.field_146344_y; -- this.field_146322_F.field_146125_m = this.field_146344_y && (WorldType.field_77139_a[this.field_146331_K] == WorldType.field_77138_c || WorldType.field_77139_a[this.field_146331_K] == WorldType.field_180271_f); -+ this.field_146322_F.field_146125_m = this.field_146344_y && WorldType.field_77139_a[this.field_146331_K].isCustomizable(); - } - - this.func_146319_h(); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch deleted file mode 100644 index aeca562a4..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiIngameMenu.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngameMenu.java -@@ -30,8 +30,9 @@ - - this.field_146292_n.add(new GuiButton(4, this.field_146294_l / 2 - 100, this.field_146295_m / 4 + 24 + b0, I18n.func_135052_a("menu.returnToGame", new Object[0]))); - this.field_146292_n.add(new GuiButton(0, this.field_146294_l / 2 - 100, this.field_146295_m / 4 + 96 + b0, 98, 20, I18n.func_135052_a("menu.options", new Object[0]))); -+ this.field_146292_n.add(new GuiButton(12, this.field_146294_l / 2 + 2, this.field_146295_m / 4 + 96 + b0, 98, 20, I18n.func_135052_a("fml.menu.modoptions"))); - GuiButton guibutton; -- this.field_146292_n.add(guibutton = new GuiButton(7, this.field_146294_l / 2 + 2, this.field_146295_m / 4 + 96 + b0, 98, 20, I18n.func_135052_a("menu.shareToLan", new Object[0]))); -+ this.field_146292_n.add(guibutton = new GuiButton(7, this.field_146294_l / 2 - 100, this.field_146295_m / 4 + 72 + b0, 200, 20, I18n.func_135052_a("menu.shareToLan", new Object[0]))); - this.field_146292_n.add(new GuiButton(5, this.field_146294_l / 2 - 100, this.field_146295_m / 4 + 48 + b0, 98, 20, I18n.func_135052_a("gui.achievements", new Object[0]))); - this.field_146292_n.add(new GuiButton(6, this.field_146294_l / 2 + 2, this.field_146295_m / 4 + 48 + b0, 98, 20, I18n.func_135052_a("gui.stats", new Object[0]))); - guibutton.field_146124_l = this.field_146297_k.func_71356_B() && !this.field_146297_k.func_71401_C().func_71344_c(); -@@ -58,13 +59,19 @@ - this.field_146297_k.func_71381_h(); - break; - case 5: -+ if (this.field_146297_k.field_71439_g != null) - this.field_146297_k.func_147108_a(new GuiAchievements(this, this.field_146297_k.field_71439_g.func_146107_m())); - break; - case 6: -+ if (this.field_146297_k.field_71439_g != null) - this.field_146297_k.func_147108_a(new GuiStats(this, this.field_146297_k.field_71439_g.func_146107_m())); - break; - case 7: - this.field_146297_k.func_147108_a(new GuiShareToLan(this)); -+ break; -+ case 12: -+ net.minecraftforge.fml.client.FMLClientHandler.instance().showInGameModOptions(this); -+ break; - } - } - diff --git a/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch deleted file mode 100644 index 5100ea6a2..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiMainMenu.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiMainMenu.java -@@ -198,6 +198,11 @@ - this.field_146292_n.add(new GuiButton(1, this.field_146294_l / 2 - 100, p_73969_1_, I18n.func_135052_a("menu.singleplayer", new Object[0]))); - this.field_146292_n.add(new GuiButton(2, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.func_135052_a("menu.multiplayer", new Object[0]))); - this.field_146292_n.add(this.field_175372_K = new GuiButton(14, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.func_135052_a("menu.online", new Object[0]))); -+ GuiButton fmlModButton = new GuiButton(6, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.func_135052_a("fml.menu.mods")); -+ fmlModButton.field_146128_h = this.field_146294_l / 2 + 2; -+ field_175372_K.field_146120_f = 98; -+ fmlModButton.field_146120_f = 98; -+ this.field_146292_n.add(fmlModButton); - } - - private void func_73972_b(int p_73972_1_, int p_73972_2_) -@@ -245,6 +250,11 @@ - this.field_146297_k.func_71400_g(); - } - -+ if (p_146284_1_.field_146127_k == 6) -+ { -+ this.field_146297_k.func_147108_a(new net.minecraftforge.fml.client.GuiModList(this)); -+ } -+ - if (p_146284_1_.field_146127_k == 11) - { - this.field_146297_k.func_71371_a("Demo_World", "Demo_World", DemoWorldServer.field_73071_a); -@@ -492,7 +502,16 @@ - s = s + " Demo"; - } - -- this.func_73731_b(this.field_146289_q, s, 2, this.field_146295_m - 10, -1); -+ java.util.List brandings = com.google.common.collect.Lists.reverse(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(true)); -+ for (int i = 0; i < brandings.size(); i++) -+ { -+ String brd = brandings.get(i); -+ if (!com.google.common.base.Strings.isNullOrEmpty(brd)) -+ { -+ this.func_73731_b(this.field_146289_q, brd, 2, this.field_146295_m - ( 10 + i * (this.field_146289_q.field_78288_b + 1)), 16777215); -+ } -+ } -+ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, this.field_146289_q, this.field_146294_l, this.field_146295_m); - String s1 = "Copyright Mojang AB. Do not distribute!"; - this.func_73731_b(this.field_146289_q, s1, this.field_146294_l - this.field_146289_q.func_78256_a(s1) - 2, this.field_146295_m - 10, -1); - diff --git a/patches/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch deleted file mode 100644 index b3e441a5e..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiMultiplayer.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiMultiplayer.java -@@ -41,6 +41,7 @@ - public GuiMultiplayer(GuiScreen p_i1040_1_) - { - this.field_146798_g = p_i1040_1_; -+ net.minecraftforge.fml.client.FMLClientHandler.instance().setupServerList(); - } - - public void func_73866_w_() -@@ -373,7 +374,7 @@ - - private void func_146791_a(ServerData p_146791_1_) - { -- this.field_146297_k.func_147108_a(new GuiConnecting(this, this.field_146297_k, p_146791_1_)); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServer(this, p_146791_1_); - } - - public void func_146790_a(int p_146790_1_) diff --git a/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch deleted file mode 100644 index dc555d651..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java -@@ -170,6 +170,9 @@ - long l = j - k; - ArrayList arraylist = Lists.newArrayList(new String[] {String.format("Java: %s %dbit", new Object[]{System.getProperty("java.version"), Integer.valueOf(this.field_175242_a.func_147111_S() ? 64 : 32)}), String.format("Mem: % 2d%% %03d/%03dMB", new Object[]{Long.valueOf(l * 100L / i), Long.valueOf(func_175240_a(l)), Long.valueOf(func_175240_a(i))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(j * 100L / i), Long.valueOf(func_175240_a(j))}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GL11.glGetString(GL11.GL_VENDOR)}), GL11.glGetString(GL11.GL_RENDERER), GL11.glGetString(GL11.GL_VERSION)}); - -+ arraylist.add(""); -+ arraylist.addAll(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(false)); -+ - if (this.func_175236_d()) - { - return arraylist; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch deleted file mode 100644 index 7ebfe23e2..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch +++ /dev/null @@ -1,113 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiScreen.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiScreen.java -@@ -37,6 +37,9 @@ - import net.minecraft.util.ChatComponentTranslation; - import net.minecraft.util.EnumChatFormatting; - import net.minecraft.util.IChatComponent; -+import net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent; -+import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; -+import net.minecraftforge.common.MinecraftForge; - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - import org.apache.commons.lang3.StringUtils; -@@ -146,7 +149,8 @@ - } - } - -- this.func_146283_a(list, p_146285_2_, p_146285_3_); -+ FontRenderer font = p_146285_1_.func_77973_b().getFontRenderer(p_146285_1_); -+ this.drawHoveringText(list, p_146285_2_, p_146285_3_, (font == null ? field_146289_q : font)); - } - - protected void func_146279_a(String p_146279_1_, int p_146279_2_, int p_146279_3_) -@@ -156,6 +160,11 @@ - - protected void func_146283_a(List p_146283_1_, int p_146283_2_, int p_146283_3_) - { -+ drawHoveringText(p_146283_1_, p_146283_2_, p_146283_3_, field_146289_q); -+ } -+ -+ protected void drawHoveringText(List p_146283_1_, int p_146283_2_, int p_146283_3_, FontRenderer font) -+ { - if (!p_146283_1_.isEmpty()) - { - GlStateManager.func_179101_C(); -@@ -168,7 +177,7 @@ - while (iterator.hasNext()) - { - String s = (String)iterator.next(); -- int l = this.field_146289_q.func_78256_a(s); -+ int l = font.func_78256_a(s); - - if (l > k) - { -@@ -213,7 +222,7 @@ - for (int i2 = 0; i2 < p_146283_1_.size(); ++i2) - { - String s1 = (String)p_146283_1_.get(i2); -- this.field_146289_q.func_175063_a(s1, (float)j2, (float)k2, -1); -+ font.func_175063_a(s1, j2, k2, -1); - - if (i2 == 0) - { -@@ -441,6 +450,7 @@ - this.field_146297_k.field_71456_v.func_146158_b().func_146239_a(p_175281_1_); - } - -+ if (net.minecraftforge.client.ClientCommandHandler.instance.func_71556_a(field_146297_k.field_71439_g, p_175281_1_) != 0) return; - this.field_146297_k.field_71439_g.func_71165_d(p_175281_1_); - } - -@@ -454,9 +464,14 @@ - - if (guibutton.func_146116_c(this.field_146297_k, p_73864_1_, p_73864_2_)) - { -- this.field_146290_a = guibutton; -- guibutton.func_146113_a(this.field_146297_k.func_147118_V()); -- this.func_146284_a(guibutton); -+ ActionPerformedEvent.Pre event = new ActionPerformedEvent.Pre(this, guibutton, this.field_146292_n); -+ if (MinecraftForge.EVENT_BUS.post(event)) -+ break; -+ this.field_146290_a = event.button; -+ event.button.func_146113_a(this.field_146297_k.func_147118_V()); -+ this.func_146284_a(event.button); -+ if (this.equals(this.field_146297_k.field_71462_r)) -+ MinecraftForge.EVENT_BUS.post(new ActionPerformedEvent.Post(this, event.button, this.field_146292_n)); - } - } - } -@@ -482,8 +497,12 @@ - this.field_146289_q = p_146280_1_.field_71466_p; - this.field_146294_l = p_146280_2_; - this.field_146295_m = p_146280_3_; -- this.field_146292_n.clear(); -- this.func_73866_w_(); -+ if (!MinecraftForge.EVENT_BUS.post(new InitGuiEvent.Pre(this, this.field_146292_n))) -+ { -+ this.field_146292_n.clear(); -+ this.func_73866_w_(); -+ } -+ MinecraftForge.EVENT_BUS.post(new InitGuiEvent.Post(this, this.field_146292_n)); - } - - public void func_73866_w_() {} -@@ -494,7 +513,9 @@ - { - while (Mouse.next()) - { -+ if (MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Pre(this))) continue; - this.func_146274_d(); -+ if (this.equals(this.field_146297_k.field_71462_r)) MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Post(this)); - } - } - -@@ -502,7 +523,9 @@ - { - while (Keyboard.next()) - { -+ if (MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Pre(this))) continue; - this.func_146282_l(); -+ if (this.equals(this.field_146297_k.field_71462_r)) MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Post(this)); - } - } - } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch deleted file mode 100644 index 972c744d6..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiSleepMP.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSleepMP.java -@@ -34,7 +34,7 @@ - - if (!s.isEmpty()) - { -- this.field_146297_k.field_71439_g.func_71165_d(s); -+ this.func_175275_f(s); // Forge: fix vanilla not adding messages to the sent list while sleeping - } - - this.field_146415_a.func_146180_a(""); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch deleted file mode 100644 index 3850da1c0..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiSlot.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSlot.java -@@ -185,16 +185,7 @@ - GlStateManager.func_179106_n(); - Tessellator tessellator = Tessellator.func_178181_a(); - WorldRenderer worldrenderer = tessellator.func_178180_c(); -- this.field_148161_k.func_110434_K().func_110577_a(Gui.field_110325_k); -- GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); -- float f1 = 32.0F; -- worldrenderer.func_178970_b(); -- worldrenderer.func_178991_c(2105376); -- worldrenderer.func_178985_a((double)this.field_148152_e, (double)this.field_148154_c, 0.0D, (double)((float)this.field_148152_e / f1), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f1)); -- worldrenderer.func_178985_a((double)this.field_148151_d, (double)this.field_148154_c, 0.0D, (double)((float)this.field_148151_d / f1), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f1)); -- worldrenderer.func_178985_a((double)this.field_148151_d, (double)this.field_148153_b, 0.0D, (double)((float)this.field_148151_d / f1), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f1)); -- worldrenderer.func_178985_a((double)this.field_148152_e, (double)this.field_148153_b, 0.0D, (double)((float)this.field_148152_e / f1), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f1)); -- tessellator.func_78381_a(); -+ this.drawContainerBackground(tessellator); - int i1 = this.field_148152_e + this.field_148155_a / 2 - this.func_148139_c() / 2 + 2; - int j1 = this.field_148153_b + 4 - (int)this.field_148169_q; - -@@ -456,4 +447,19 @@ - { - return this.field_148149_f; - } -+ -+ protected void drawContainerBackground(Tessellator tessellator) -+ { -+ WorldRenderer worldrenderer = tessellator.func_178180_c(); -+ this.field_148161_k.func_110434_K().func_110577_a(Gui.field_110325_k); -+ GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); -+ float f1 = 32.0F; -+ worldrenderer.func_178970_b(); -+ worldrenderer.func_178991_c(2105376); -+ worldrenderer.func_178985_a((double)this.field_148152_e, (double)this.field_148154_c, 0.0D, (double)((float)this.field_148152_e / f1), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f1)); -+ worldrenderer.func_178985_a((double)this.field_148151_d, (double)this.field_148154_c, 0.0D, (double)((float)this.field_148151_d / f1), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f1)); -+ worldrenderer.func_178985_a((double)this.field_148151_d, (double)this.field_148153_b, 0.0D, (double)((float)this.field_148151_d / f1), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f1)); -+ worldrenderer.func_178985_a((double)this.field_148152_e, (double)this.field_148153_b, 0.0D, (double)((float)this.field_148152_e / f1), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f1)); -+ tessellator.func_78381_a(); -+ } - } diff --git a/patches/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch b/patches/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch deleted file mode 100644 index 90dfde34b..000000000 --- a/patches/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java -+++ ../src-work/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java -@@ -84,7 +84,7 @@ - boolean flag2 = this.field_148301_e.field_82821_f < 47; - boolean flag3 = flag1 || flag2; - this.field_148300_d.field_71466_p.func_78276_b(this.field_148301_e.field_78847_a, p_180790_2_ + 32 + 3, p_180790_3_ + 1, 16777215); -- List list = this.field_148300_d.field_71466_p.func_78271_c(this.field_148301_e.field_78843_d, p_180790_4_ - 32 - 2); -+ List list = this.field_148300_d.field_71466_p.func_78271_c(net.minecraftforge.fml.client.FMLClientHandler.instance().fixDescription(this.field_148301_e.field_78843_d), p_180790_4_ - 48 - 2); - - for (int l1 = 0; l1 < Math.min(list.size(), 2); ++l1) - { -@@ -178,6 +178,11 @@ - int k2 = p_180790_6_ - p_180790_2_; - int l2 = p_180790_7_ - p_180790_3_; - -+ String tooltip = net.minecraftforge.fml.client.FMLClientHandler.instance().enhanceServerListEntry(this, this.field_148301_e, p_180790_2_, p_180790_4_, p_180790_3_, k2, l2); -+ if (tooltip != null) -+ { -+ this.field_148303_c.func_146793_a(tooltip); -+ } else - if (k2 >= p_180790_4_ - 15 && k2 <= p_180790_4_ - 5 && l2 >= 0 && l2 <= 8) - { - this.field_148303_c.func_146793_a(s1); diff --git a/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch b/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch deleted file mode 100644 index fc49d0fd7..000000000 --- a/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch +++ /dev/null @@ -1,127 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java -+++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java -@@ -24,6 +24,9 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - import org.lwjgl.input.Mouse; -+import java.util.LinkedList; -+import java.util.List; -+import net.minecraftforge.common.AchievementPage; - - @SideOnly(Side.CLIENT) - public class GuiAchievements extends GuiScreen implements IProgressMeter -@@ -50,6 +53,10 @@ - private boolean field_146558_F = true; - private static final String __OBFID = "CL_00000722"; - -+ private int currentPage = -1; -+ private GuiButton button; -+ private LinkedList minecraftAchievements = new LinkedList(); -+ - public GuiAchievements(GuiScreen p_i45026_1_, StatFileWriter p_i45026_2_) - { - this.field_146562_a = p_i45026_1_; -@@ -58,6 +65,14 @@ - short short2 = 141; - this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.field_76004_f.field_75993_a * 24 - short1 / 2 - 12); - this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.field_76004_f.field_75991_b * 24 - short2 / 2); -+ minecraftAchievements.clear(); -+ for (Object achievement : AchievementList.field_76007_e) -+ { -+ if (!AchievementPage.isAchievementInPages((Achievement)achievement)) -+ { -+ minecraftAchievements.add((Achievement)achievement); -+ } -+ } - } - - public void func_73866_w_() -@@ -65,6 +80,7 @@ - this.field_146297_k.func_147114_u().func_147297_a(new C16PacketClientStatus(C16PacketClientStatus.EnumState.REQUEST_STATS)); - this.field_146292_n.clear(); - this.field_146292_n.add(new GuiOptionButton(1, this.field_146294_l / 2 + 24, this.field_146295_m / 2 + 74, 80, 20, I18n.func_135052_a("gui.done", new Object[0]))); -+ this.field_146292_n.add(button = new GuiButton(2, (field_146294_l - field_146555_f) / 2 + 24, field_146295_m / 2 + 74, 125, 20, AchievementPage.getTitle(currentPage))); - } - - protected void func_146284_a(GuiButton p_146284_1_) throws IOException -@@ -75,6 +91,16 @@ - { - this.field_146297_k.func_147108_a(this.field_146562_a); - } -+ -+ if (p_146284_1_.field_146127_k == 2) -+ { -+ currentPage++; -+ if (currentPage >= AchievementPage.getAchievementPages().size()) -+ { -+ currentPage = -1; -+ } -+ this.button.field_146126_j = AchievementPage.getTitle(currentPage); -+ } - } - } - -@@ -260,7 +286,9 @@ - GlStateManager.func_179143_c(518); - GlStateManager.func_179094_E(); - GlStateManager.func_179109_b((float)k1, (float)l1, -200.0F); -- GlStateManager.func_179152_a(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 0.0F); -+ // FIXES models rendering weirdly in the acheivements pane -+ // see https://github.com/MinecraftForge/MinecraftForge/commit/1b7ce7592caafb760ec93066184182ae0711e793#commitcomment-10512284 -+ GlStateManager.func_179152_a(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 1.0F); - GlStateManager.func_179098_w(); - GlStateManager.func_179140_f(); - GlStateManager.func_179091_B(); -@@ -341,11 +369,12 @@ - int i4; - int l4; - -- for (i3 = 0; i3 < AchievementList.field_76007_e.size(); ++i3) -+ List achievementList = (currentPage == -1 ? minecraftAchievements : AchievementPage.getAchievementPage(currentPage).getAchievements()); -+ for (i3 = 0; i3 < achievementList.size(); ++i3) - { -- Achievement achievement1 = (Achievement)AchievementList.field_76007_e.get(i3); -+ Achievement achievement1 = achievementList.get(i3); - -- if (achievement1.field_75992_c != null) -+ if (achievement1.field_75992_c != null && achievementList.contains(achievement1.field_75992_c)) - { - j3 = achievement1.field_75993_a * 24 - k + 11; - k3 = achievement1.field_75991_b * 24 - l + 11; -@@ -401,9 +430,9 @@ - int i5; - int j5; - -- for (k3 = 0; k3 < AchievementList.field_76007_e.size(); ++k3) -+ for (k3 = 0; k3 < achievementList.size(); ++k3) - { -- Achievement achievement2 = (Achievement)AchievementList.field_76007_e.get(k3); -+ Achievement achievement2 = (Achievement)achievementList.get(k3); - l4 = achievement2.field_75993_a * 24 - k; - i5 = achievement2.field_75991_b * 24 - l; - -@@ -445,6 +474,7 @@ - - this.field_146297_k.func_110434_K().func_110577_a(field_146561_C); - -+ GlStateManager.func_179147_l(); // Forge: Specifically enable blend because it is needed here. And we fix Generic RenderItem's leakage of it. - if (achievement2.func_75984_f()) - { - this.func_73729_b(l4 - 2, i5 - 2, 26, 202, 26, 26); -@@ -453,6 +483,7 @@ - { - this.func_73729_b(l4 - 2, i5 - 2, 0, 202, 26, 26); - } -+ GlStateManager.func_179084_k(); //Forge: Cleanup states we set. - - if (!this.field_146556_E.func_77442_b(achievement2)) - { -@@ -461,7 +492,7 @@ - this.field_146296_j.func_175039_a(false); - } - -- GlStateManager.func_179145_e(); -+ GlStateManager.func_179140_f(); //Forge: Make sure Lighting is disabled. Fixes MC-33065 - GlStateManager.func_179089_o(); - this.field_146296_j.func_180450_b(achievement2.field_75990_d, l4 + 3, i5 + 3); - GlStateManager.func_179112_b(770, 771); diff --git a/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch b/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch deleted file mode 100644 index da29b12c2..000000000 --- a/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiStats.java -+++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiStats.java -@@ -769,6 +769,7 @@ - super(p_i45510_2_, GuiStats.this.field_146294_l, GuiStats.this.field_146295_m, 32, GuiStats.this.field_146295_m - 64, GuiStats.this.field_146289_q.field_78288_b * 4); - this.func_148130_a(false); - Iterator iterator = EntityList.field_75627_a.values().iterator(); -+ iterator = com.google.common.collect.Iterators.concat(iterator, net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().values().iterator()); - - while (iterator.hasNext()) - { -@@ -806,7 +807,7 @@ - protected void func_180791_a(int p_180791_1_, int p_180791_2_, int p_180791_3_, int p_180791_4_, int p_180791_5_, int p_180791_6_) - { - EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)this.field_148222_l.get(p_180791_1_); -- String s = I18n.func_135052_a("entity." + EntityList.func_75617_a(entityegginfo.field_75613_a) + ".name", new Object[0]); -+ String s = I18n.func_135052_a("entity." + entityegginfo.name + ".name", new Object[0]); - int k1 = GuiStats.this.field_146546_t.func_77444_a(entityegginfo.field_151512_d); - int l1 = GuiStats.this.field_146546_t.func_77444_a(entityegginfo.field_151513_e); - String s1 = I18n.func_135052_a("stat.entityKills", new Object[] {Integer.valueOf(k1), s}); diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch deleted file mode 100644 index d04dc9c57..000000000 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch +++ /dev/null @@ -1,65 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java -+++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java -@@ -5,6 +5,7 @@ - import java.util.Iterator; - import java.util.Set; - import net.minecraft.client.Minecraft; -+import net.minecraft.client.gui.FontRenderer; - import net.minecraft.client.gui.GuiScreen; - import net.minecraft.client.renderer.GlStateManager; - import net.minecraft.client.renderer.OpenGlHelper; -@@ -178,8 +179,11 @@ - GlStateManager.func_179109_b(0.0F, 0.0F, 32.0F); - this.field_73735_i = 200.0F; - this.field_146296_j.field_77023_b = 200.0F; -+ FontRenderer font = null; -+ if (p_146982_1_ != null) font = p_146982_1_.func_77973_b().getFontRenderer(p_146982_1_); -+ if (font == null) font = field_146289_q; - this.field_146296_j.func_180450_b(p_146982_1_, p_146982_2_, p_146982_3_); -- this.field_146296_j.func_180453_a(this.field_146289_q, p_146982_1_, p_146982_2_, p_146982_3_ - (this.field_147012_x == null ? 0 : 8), p_146982_4_); -+ this.field_146296_j.func_180453_a(font, p_146982_1_, p_146982_2_, p_146982_3_ - (this.field_147012_x == null ? 0 : 8), p_146982_4_); - this.field_73735_i = 0.0F; - this.field_146296_j.field_77023_b = 0.0F; - } -@@ -240,13 +244,12 @@ - - if (itemstack == null) - { -- String s1 = p_146977_1_.func_178171_c(); -+ TextureAtlasSprite textureatlassprite = p_146977_1_.getBackgroundSprite(); - -- if (s1 != null) -+ if (textureatlassprite != null) - { -- TextureAtlasSprite textureatlassprite = this.field_146297_k.func_147117_R().func_110572_b(s1); - GlStateManager.func_179140_f(); -- this.field_146297_k.func_110434_K().func_110577_a(TextureMap.field_110575_b); -+ this.field_146297_k.func_110434_K().func_110577_a(p_146977_1_.getBackgroundLocation()); - this.func_175175_a(i, j, textureatlassprite, 16, 16); - GlStateManager.func_179145_e(); - flag1 = true; -@@ -465,6 +468,7 @@ - - protected void func_146286_b(int p_146286_1_, int p_146286_2_, int p_146286_3_) - { -+ super.func_146286_b(p_146286_1_, p_146286_2_, p_146286_3_); //Forge, Call parent to release buttons - Slot slot = this.func_146975_c(p_146286_1_, p_146286_2_); - int l = this.field_147003_i; - int i1 = this.field_147009_r; -@@ -698,4 +702,16 @@ - this.field_146297_k.field_71439_g.func_71053_j(); - } - } -+ -+ /* ======================================== FORGE START =====================================*/ -+ -+ /** -+ * Returns the slot that is currently displayed under the mouse. -+ */ -+ public Slot getSlotUnderMouse() -+ { -+ return this.field_147006_u; -+ } -+ -+ /* ======================================== FORGE END =====================================*/ - } diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch deleted file mode 100644 index b91737a77..000000000 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch +++ /dev/null @@ -1,267 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java -+++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java -@@ -49,6 +49,8 @@ - private boolean field_147057_D; - private CreativeCrafting field_147059_E; - private static final String __OBFID = "CL_00000752"; -+ private static int tabPage = 0; -+ private int maxPages = 0; - - public GuiContainerCreative(EntityPlayer p_i1088_1_) - { -@@ -187,7 +189,7 @@ - return; - } - -- if (itemstack1 != null && itemstack2 != null && itemstack1.func_77969_a(itemstack2)) -+ if (itemstack1 != null && itemstack2 != null && itemstack1.func_77969_a(itemstack2) && ItemStack.func_77970_a(itemstack1, itemstack2)) //Forge: Bugfix, Compare NBT data, allow for deletion of enchanted books, MC-12770 - { - if (p_146984_3_ == 0) - { -@@ -262,6 +264,13 @@ - this.func_147050_b(CreativeTabs.field_78032_a[i]); - this.field_147059_E = new CreativeCrafting(this.field_146297_k); - this.field_146297_k.field_71439_g.field_71069_bz.func_75132_a(this.field_147059_E); -+ int tabCount = CreativeTabs.field_78032_a.length; -+ if (tabCount > 12) -+ { -+ field_146292_n.add(new GuiButton(101, field_147003_i, field_147009_r - 50, 20, 20, "<")); -+ field_146292_n.add(new GuiButton(102, field_147003_i + field_146999_f - 20, field_147009_r - 50, 20, 20, ">")); -+ maxPages = ((tabCount - 12) / 10) + 1; -+ } - } - else - { -@@ -283,7 +292,7 @@ - - protected void func_73869_a(char p_73869_1_, int p_73869_2_) throws IOException - { -- if (field_147058_w != CreativeTabs.field_78027_g.func_78021_a()) -+ if (!CreativeTabs.field_78032_a[field_147058_w].hasSearchBar()) - { - if (GameSettings.func_100015_a(this.field_146297_k.field_71474_y.field_74310_D)) - { -@@ -320,6 +329,15 @@ - { - GuiContainerCreative.ContainerCreative containercreative = (GuiContainerCreative.ContainerCreative)this.field_147002_h; - containercreative.field_148330_a.clear(); -+ -+ CreativeTabs tab = CreativeTabs.field_78032_a[field_147058_w]; -+ if (tab.hasSearchBar() && tab != CreativeTabs.field_78027_g) -+ { -+ tab.func_78018_a(containercreative.field_148330_a); -+ updateFilteredItems(containercreative); -+ return; -+ } -+ - Iterator iterator = Item.field_150901_e.iterator(); - - while (iterator.hasNext()) -@@ -331,10 +349,17 @@ - item.func_150895_a(item, (CreativeTabs)null, containercreative.field_148330_a); - } - } -+ updateFilteredItems(containercreative); -+ } - -+ //split from above for custom search tabs -+ private void updateFilteredItems(GuiContainerCreative.ContainerCreative containercreative) -+ { -+ Iterator iterator; - Enchantment[] aenchantment = Enchantment.field_77331_b; - int j = aenchantment.length; - -+ if (CreativeTabs.field_78032_a[field_147058_w] != CreativeTabs.field_78027_g) j = 0; //Forge: Don't add enchants to custom tabs. - for (int i = 0; i < j; ++i) - { - Enchantment enchantment = aenchantment[i]; -@@ -385,7 +410,7 @@ - { - CreativeTabs creativetabs = CreativeTabs.field_78032_a[field_147058_w]; - -- if (creativetabs.func_78019_g()) -+ if (creativetabs != null && creativetabs.func_78019_g()) - { - GlStateManager.func_179084_k(); - this.field_146289_q.func_78276_b(I18n.func_135052_a(creativetabs.func_78024_c(), new Object[0]), 8, 6, 4210752); -@@ -428,7 +453,7 @@ - { - CreativeTabs creativetabs = acreativetabs[k1]; - -- if (this.func_147049_a(creativetabs, l, i1)) -+ if (creativetabs != null && this.func_147049_a(creativetabs, l, i1)) - { - this.func_147050_b(creativetabs); - return; -@@ -441,11 +466,13 @@ - - private boolean func_147055_p() - { -+ if (CreativeTabs.field_78032_a[field_147058_w] == null) return false; - return field_147058_w != CreativeTabs.field_78036_m.func_78021_a() && CreativeTabs.field_78032_a[field_147058_w].func_78017_i() && ((GuiContainerCreative.ContainerCreative)this.field_147002_h).func_148328_e(); - } - - private void func_147050_b(CreativeTabs p_147050_1_) - { -+ if (p_147050_1_ == null) return; - int i = field_147058_w; - field_147058_w = p_147050_1_.func_78021_a(); - GuiContainerCreative.ContainerCreative containercreative = (GuiContainerCreative.ContainerCreative)this.field_147002_h; -@@ -514,12 +541,14 @@ - - if (this.field_147062_A != null) - { -- if (p_147050_1_ == CreativeTabs.field_78027_g) -+ 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); - this.field_147062_A.func_146180_a(""); -+ this.field_147062_A.field_146218_h = p_147050_1_.getSearchbarWidth(); -+ this.field_147062_A.field_146209_f = this.field_147003_i + (82 /*default left*/ + 89 /*default width*/) - this.field_147062_A.field_146218_h; - this.func_147053_i(); - } - else -@@ -590,23 +619,45 @@ - - super.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_); - CreativeTabs[] acreativetabs = CreativeTabs.field_78032_a; -- int i2 = acreativetabs.length; -+ int start = tabPage * 10; -+ int i2 = Math.min(acreativetabs.length, ((tabPage + 1) * 10) + 2); -+ if (tabPage != 0) start += 2; -+ boolean rendered = false; - -- for (int j2 = 0; j2 < i2; ++j2) -+ for (int j2 = start; j2 < i2; ++j2) - { - CreativeTabs creativetabs = acreativetabs[j2]; - -+ if (creativetabs == null) continue; - if (this.func_147052_b(creativetabs, p_73863_1_, p_73863_2_)) - { -+ rendered = true; - break; - } - } - -+ if (!rendered && func_147052_b(CreativeTabs.field_78027_g, p_73863_1_, p_73863_2_)) -+ { -+ func_147052_b(CreativeTabs.field_78036_m, p_73863_1_, p_73863_2_); -+ } -+ - if (this.field_147064_C != null && field_147058_w == CreativeTabs.field_78036_m.func_78021_a() && this.func_146978_c(this.field_147064_C.field_75223_e, this.field_147064_C.field_75221_f, 16, 16, p_73863_1_, p_73863_2_)) - { - this.func_146279_a(I18n.func_135052_a("inventory.binSlot", new Object[0]), p_73863_1_, p_73863_2_); - } - -+ if (maxPages != 0) -+ { -+ String page = String.format("%d / %d", tabPage + 1, maxPages + 1); -+ int width = field_146289_q.func_78256_a(page); -+ GlStateManager.func_179140_f(); -+ this.field_73735_i = 300.0F; -+ field_146296_j.field_77023_b = 300.0F; -+ field_146289_q.func_78276_b(page, field_147003_i + (field_146999_f / 2) - (width / 2), field_147009_r - 44, -1); -+ this.field_73735_i = 0.0F; -+ field_146296_j.field_77023_b = 0.0F; -+ } -+ - GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.func_179140_f(); - } -@@ -675,17 +726,36 @@ - int k = acreativetabs.length; - int l; - -- for (l = 0; l < k; ++l) -+ int start = tabPage * 10; -+ k = Math.min(acreativetabs.length, ((tabPage + 1) * 10 + 2)); -+ if (tabPage != 0) start += 2; -+ -+ for (l = start; l < k; ++l) - { - CreativeTabs creativetabs1 = acreativetabs[l]; - this.field_146297_k.func_110434_K().func_110577_a(field_147061_u); - -+ if (creativetabs1 == null) continue; - if (creativetabs1.func_78021_a() != field_147058_w) - { - this.func_147051_a(creativetabs1); - } - } - -+ if (tabPage != 0) -+ { -+ if (creativetabs != CreativeTabs.field_78027_g) -+ { -+ this.field_146297_k.func_110434_K().func_110577_a(field_147061_u); -+ func_147051_a(CreativeTabs.field_78027_g); -+ } -+ if (creativetabs != CreativeTabs.field_78036_m) -+ { -+ this.field_146297_k.func_110434_K().func_110577_a(field_147061_u); -+ func_147051_a(CreativeTabs.field_78036_m); -+ } -+ } -+ - this.field_146297_k.func_110434_K().func_110577_a(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.func_78015_f())); - this.func_73729_b(this.field_147003_i, this.field_147009_r, 0, 0, this.field_146999_f, this.field_147000_g); - this.field_147062_A.func_146194_f(); -@@ -700,6 +770,14 @@ - this.func_73729_b(i1, k + (int)((float)(l - k - 17) * this.field_147067_x), 232 + (this.func_147055_p() ? 0 : 12), 0, 12, 15); - } - -+ if (creativetabs == null || creativetabs.getTabPage() != tabPage) -+ { -+ if (creativetabs != CreativeTabs.field_78027_g && creativetabs != CreativeTabs.field_78036_m) -+ { -+ return; -+ } -+ } -+ - this.func_147051_a(creativetabs); - - if (creativetabs == CreativeTabs.field_78036_m) -@@ -710,6 +788,15 @@ - - protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_) - { -+ if (p_147049_1_.getTabPage() != tabPage) -+ { -+ if (p_147049_1_ != CreativeTabs.field_78027_g && -+ p_147049_1_ != CreativeTabs.field_78036_m) -+ { -+ return false; -+ } -+ } -+ - int k = p_147049_1_.func_78020_k(); - int l = 28 * k; - byte b0 = 0; -@@ -810,6 +897,8 @@ - } - - GlStateManager.func_179140_f(); -+ GlStateManager.func_179124_c(1F, 1F, 1F); //Forge: Reset color in case Items change it. -+ GlStateManager.func_179147_l(); //Forge: Make sure blend is enabled else tabs show a white border. - this.func_73729_b(l, i1, j, k, 28, b0); - this.field_73735_i = 100.0F; - this.field_146296_j.field_77023_b = 100.0F; -@@ -836,6 +925,15 @@ - { - this.field_146297_k.func_147108_a(new GuiStats(this, this.field_146297_k.field_71439_g.func_146107_m())); - } -+ -+ if (p_146284_1_.field_146127_k == 101) -+ { -+ tabPage = Math.max(tabPage - 1, 0); -+ } -+ else if (p_146284_1_.field_146127_k == 102) -+ { -+ tabPage = Math.min(tabPage + 1, maxPages); -+ } - } - - public int func_147056_g() diff --git a/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch deleted file mode 100644 index 05ba7abc5..000000000 --- a/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java -+++ ../src-work/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java -@@ -69,7 +69,7 @@ - inetaddress = InetAddress.getByName(p_146367_1_); - GuiConnecting.this.field_146371_g = NetworkManager.func_150726_a(inetaddress, p_146367_2_); - GuiConnecting.this.field_146371_g.func_150719_a(new NetHandlerLoginClient(GuiConnecting.this.field_146371_g, GuiConnecting.this.field_146297_k, GuiConnecting.this.field_146374_i)); -- GuiConnecting.this.field_146371_g.func_179290_a(new C00Handshake(47, p_146367_1_, p_146367_2_, EnumConnectionState.LOGIN)); -+ GuiConnecting.this.field_146371_g.func_179290_a(new C00Handshake(47, p_146367_1_, p_146367_2_, EnumConnectionState.LOGIN, true)); - GuiConnecting.this.field_146371_g.func_179290_a(new C00PacketLoginStart(GuiConnecting.this.field_146297_k.func_110432_I().func_148256_e())); - } - catch (UnknownHostException unknownhostexception) diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch deleted file mode 100644 index d57d6ad63..000000000 --- a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ /dev/null @@ -1,69 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java -+++ ../src-work/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java -@@ -113,6 +113,12 @@ - } - } - -+ ItemStack stack = field_78776_a.field_71439_g.func_71045_bC(); -+ if (stack != null && stack.func_77973_b() != null && stack.func_77973_b().onBlockStartBreak(stack, p_178888_1_, field_78776_a.field_71439_g)) -+ { -+ return false; -+ } -+ - if (this.field_78779_k.func_77145_d() && this.field_78776_a.field_71439_g.func_70694_bm() != null && this.field_78776_a.field_71439_g.func_70694_bm().func_77973_b() instanceof ItemSword) - { - return false; -@@ -130,7 +136,7 @@ - else - { - worldclient.func_175718_b(2001, p_178888_1_, Block.func_176210_f(iblockstate)); -- boolean flag = worldclient.func_175698_g(p_178888_1_); -+ boolean flag = block1.removedByPlayer(worldclient, p_178888_1_, field_78776_a.field_71439_g, false); - - if (flag) - { -@@ -360,11 +366,19 @@ - { - if (this.field_78779_k != WorldSettings.GameType.SPECTATOR) - { -+ -+ if (p_178890_3_ != null && -+ p_178890_3_.func_77973_b() != null && -+ p_178890_3_.func_77973_b().onItemUseFirst(p_178890_3_, p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2)) -+ { -+ return true; -+ } -+ - IBlockState iblockstate = p_178890_2_.func_180495_p(p_178890_4_); - -- if ((!p_178890_1_.func_70093_af() || p_178890_1_.func_70694_bm() == null) && iblockstate.func_177230_c().func_180639_a(p_178890_2_, p_178890_4_, iblockstate, p_178890_1_, p_178890_5_, f, f1, f2)) -+ if ((!p_178890_1_.func_70093_af() || p_178890_1_.func_70694_bm() == null || p_178890_1_.func_70694_bm().func_77973_b().doesSneakBypassUse(p_178890_2_, p_178890_4_, p_178890_1_))) - { -- flag = true; -+ flag = iblockstate.func_177230_c().func_180639_a(p_178890_2_, p_178890_4_, iblockstate, p_178890_1_, p_178890_5_, f, f1, f2); - } - - if (!flag && p_178890_3_ != null && p_178890_3_.func_77973_b() instanceof ItemBlock) -@@ -397,7 +411,9 @@ - } - else - { -- return p_178890_3_.func_179546_a(p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2); -+ if (!p_178890_3_.func_179546_a(p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2)) return false; -+ if (p_178890_3_.field_77994_a <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_178890_1_, p_178890_3_); -+ return true; - } - } - else -@@ -428,9 +444,10 @@ - { - p_78769_1_.field_71071_by.field_70462_a[p_78769_1_.field_71071_by.field_70461_c] = itemstack1; - -- if (itemstack1.field_77994_a == 0) -+ if (itemstack1.field_77994_a <= 0) - { - p_78769_1_.field_71071_by.field_70462_a[p_78769_1_.field_71071_by.field_70461_c] = null; -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_78769_1_, itemstack1); - } - - return true; diff --git a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch deleted file mode 100644 index 3418ef76c..000000000 --- a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/multiplayer/WorldClient.java -+++ ../src-work/minecraft/net/minecraft/client/multiplayer/WorldClient.java -@@ -54,12 +54,13 @@ - super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), WorldProvider.func_76570_a(p_i45063_3_), p_i45063_5_, true); - this.field_73035_a = p_i45063_1_; - this.func_72912_H().func_176144_a(p_i45063_4_); -- this.func_175652_B(new BlockPos(8, 64, 8)); - this.field_73011_w.func_76558_a(this); -+ this.func_175652_B(new BlockPos(8, 64, 8)); //Forge: Moved below registerWorld to prevent NPE in our redirect. - this.field_73020_y = this.func_72970_h(); - this.field_72988_C = new SaveDataMemoryStorage(); - this.func_72966_v(); - this.func_72947_a(); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(this)); - } - - public void func_72835_b() diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch deleted file mode 100644 index 1b37230bf..000000000 --- a/patches/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java -+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java -@@ -24,6 +24,7 @@ - - public void func_147383_a(C00Handshake p_147383_1_) - { -+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(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 NetHandlerLoginServer(this.field_147385_a, this.field_147384_b)); - } diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch deleted file mode 100644 index 0b265296c..000000000 --- a/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java -+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java -@@ -92,7 +92,10 @@ - { - this.field_175091_e = p_147390_1_.func_179730_a(); - this.field_147393_d.func_150723_a(EnumConnectionState.PLAY); -- this.field_147393_d.func_150719_a(new NetHandlerPlayClient(this.field_147394_b, this.field_147395_c, this.field_147393_d, this.field_175091_e)); -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlClientHandshake(this.field_147393_d); -+ NetHandlerPlayClient nhpc = new NetHandlerPlayClient(this.field_147394_b, this.field_147395_c, this.field_147393_d, this.field_175091_e); -+ this.field_147393_d.func_150719_a(nhpc); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().setPlayClient(nhpc); - } - - public void func_147231_a(IChatComponent p_147231_1_) diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch deleted file mode 100644 index 5da95b592..000000000 --- a/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch +++ /dev/null @@ -1,72 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java -+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java -@@ -247,7 +247,7 @@ - { - PacketThreadUtil.func_180031_a(p_147282_1_, this, this.field_147299_f); - this.field_147299_f.field_71442_b = new PlayerControllerMP(this.field_147299_f, this); -- this.field_147300_g = new WorldClient(this, new WorldSettings(0L, p_147282_1_.func_149198_e(), false, p_147282_1_.func_149195_d(), p_147282_1_.func_149196_i()), p_147282_1_.func_149194_f(), p_147282_1_.func_149192_g(), this.field_147299_f.field_71424_I); -+ this.field_147300_g = new WorldClient(this, new WorldSettings(0L, p_147282_1_.func_149198_e(), false, p_147282_1_.func_149195_d(), p_147282_1_.func_149196_i()), net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.get(func_147298_b()).getOverrideDimension(p_147282_1_), p_147282_1_.func_149192_g(), this.field_147299_f.field_71424_I); - this.field_147299_f.field_71474_y.field_74318_M = p_147282_1_.func_149192_g(); - this.field_147299_f.func_71403_a(this.field_147300_g); - this.field_147299_f.field_71439_g.field_71093_bK = p_147282_1_.func_149194_f(); -@@ -410,7 +410,8 @@ - public void func_147286_a(S11PacketSpawnExperienceOrb p_147286_1_) - { - PacketThreadUtil.func_180031_a(p_147286_1_, this, this.field_147299_f); -- EntityXPOrb entityxporb = new EntityXPOrb(this.field_147300_g, (double)p_147286_1_.func_148984_d(), (double)p_147286_1_.func_148983_e(), (double)p_147286_1_.func_148982_f(), p_147286_1_.func_148986_g()); -+ EntityXPOrb entityxporb = new EntityXPOrb(this.field_147300_g, (double)p_147286_1_.func_148984_d() / 32.0D, (double)p_147286_1_.func_148983_e() / 32.0D, (double)p_147286_1_.func_148982_f() / 32.0D, p_147286_1_.func_148986_g()); -+ // FORGE: BugFix MC-12013 Wrong XP orb clientside spawn position - entityxporb.field_70118_ct = p_147286_1_.func_148984_d(); - entityxporb.field_70117_cu = p_147286_1_.func_148983_e(); - entityxporb.field_70116_cv = p_147286_1_.func_148982_f(); -@@ -754,14 +755,16 @@ - public void func_147251_a(S02PacketChat p_147251_1_) - { - PacketThreadUtil.func_180031_a(p_147251_1_, this, this.field_147299_f); -+ net.minecraft.util.IChatComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(p_147251_1_.func_179841_c(), p_147251_1_.func_148915_c()); -+ if (message == null) return; - - if (p_147251_1_.func_179841_c() == 2) - { -- this.field_147299_f.field_71456_v.func_175188_a(p_147251_1_.func_148915_c(), false); -+ this.field_147299_f.field_71456_v.func_175188_a(message, false); - } - else - { -- this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(p_147251_1_.func_148915_c()); -+ this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(message); - } - } - -@@ -812,6 +815,11 @@ - float f = (float)(p_147281_1_.func_149028_l() * 360) / 256.0F; - float f1 = (float)(p_147281_1_.func_149030_m() * 360) / 256.0F; - EntityLivingBase entitylivingbase = (EntityLivingBase)EntityList.func_75616_a(p_147281_1_.func_149025_e(), this.field_147299_f.field_71441_e); -+ if (entitylivingbase == null) -+ { -+ net.minecraftforge.fml.common.FMLLog.info("Server attempted to spawn an unknown entity using ID: {0} at ({1}, {2}, {3}) Skipping!", p_147281_1_.func_149025_e(), d0, d1, d2); -+ return; -+ } - entitylivingbase.field_70118_ct = p_147281_1_.func_149023_f(); - entitylivingbase.field_70117_cu = p_147281_1_.func_149034_g(); - entitylivingbase.field_70116_cv = p_147281_1_.func_149029_h(); -@@ -1137,6 +1145,10 @@ - { - tileentity.func_145839_a(p_147273_1_.func_148857_g()); - } -+ else -+ { -+ tileentity.onDataPacket(field_147302_e, p_147273_1_); -+ } - } - } - -@@ -1346,7 +1358,7 @@ - - if (entity instanceof EntityLivingBase) - { -- PotionEffect potioneffect = new PotionEffect(p_147260_1_.func_149427_e(), p_147260_1_.func_180755_e(), p_147260_1_.func_149428_f(), false, p_147260_1_.func_179707_f()); -+ PotionEffect potioneffect = new PotionEffect(p_147260_1_.func_149427_e() & 0xff, p_147260_1_.func_180755_e(), p_147260_1_.func_149428_f(), false, p_147260_1_.func_179707_f()); - potioneffect.func_100012_b(p_147260_1_.func_149429_c()); - ((EntityLivingBase)entity).func_70690_d(potioneffect); - } diff --git a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch deleted file mode 100644 index 657aa973d..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch +++ /dev/null @@ -1,176 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/EntityRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/EntityRenderer.java -@@ -403,7 +403,7 @@ - - if (d3 < d2 || d2 == 0.0D) - { -- if (entity1 == entity.field_70154_o) -+ if (entity1 == entity.field_70154_o && !entity.canRiderInteract()) - { - if (d2 == 0.0D) - { -@@ -556,14 +556,8 @@ - { - BlockPos blockpos = new BlockPos(entity); - IBlockState iblockstate = this.field_78531_r.field_71441_e.func_180495_p(blockpos); -- Block block = iblockstate.func_177230_c(); -+ net.minecraftforge.client.ForgeHooksClient.orientBedCamera(this.field_78531_r.field_71441_e, blockpos, iblockstate, entity); - -- if (block == Blocks.field_150324_C) -- { -- int j = ((EnumFacing)iblockstate.func_177229_b(BlockBed.field_176387_N)).func_176736_b(); -- GlStateManager.func_179114_b((float)(j * 90), 0.0F, 1.0F, 0.0F); -- } -- - GlStateManager.func_179114_b(entity.field_70126_B + (entity.field_70177_z - entity.field_70126_B) * p_78467_1_ + 180.0F, 0.0F, -1.0F, 0.0F); - GlStateManager.func_179114_b(entity.field_70127_C + (entity.field_70125_A - entity.field_70127_C) * p_78467_1_, -1.0F, 0.0F, 0.0F); - } -@@ -630,17 +624,20 @@ - - if (!this.field_78531_r.field_71474_y.field_74325_U) - { -- GlStateManager.func_179114_b(entity.field_70127_C + (entity.field_70125_A - entity.field_70127_C) * p_78467_1_, 1.0F, 0.0F, 0.0F); -- -+ float yaw = entity.field_70126_B + (entity.field_70177_z - entity.field_70126_B) * p_78467_1_ + 180.0F; -+ float pitch = entity.field_70127_C + (entity.field_70125_A - entity.field_70127_C) * p_78467_1_; -+ float roll = 0.0F; - if (entity instanceof EntityAnimal) - { - EntityAnimal entityanimal = (EntityAnimal)entity; -- GlStateManager.func_179114_b(entityanimal.field_70758_at + (entityanimal.field_70759_as - entityanimal.field_70758_at) * p_78467_1_ + 180.0F, 0.0F, 1.0F, 0.0F); -+ yaw = entityanimal.field_70758_at + (entityanimal.field_70759_as - entityanimal.field_70758_at) * p_78467_1_ + 180.0F; - } -- else -- { -- GlStateManager.func_179114_b(entity.field_70126_B + (entity.field_70177_z - entity.field_70126_B) * p_78467_1_ + 180.0F, 0.0F, 1.0F, 0.0F); -- } -+ Block block = ActiveRenderInfo.func_180786_a(this.field_78531_r.field_71441_e, entity, p_78467_1_); -+ net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup event = new net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup(this, entity, block, p_78467_1_, yaw, pitch, roll); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ GlStateManager.func_179114_b(event.roll, 0.0F, 0.0F, 1.0F); -+ GlStateManager.func_179114_b(event.pitch, 1.0F, 0.0F, 0.0F); -+ GlStateManager.func_179114_b(event.yaw, 0.0F, 1.0F, 0.0F); - } - - GlStateManager.func_179109_b(0.0F, -f1, 0.0F); -@@ -1081,7 +1078,7 @@ - - try - { -- this.field_78531_r.field_71462_r.func_73863_a(l, i1, p_78480_1_); -+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.field_78531_r.field_71462_r, l, i1, p_78480_1_); - } - catch (Throwable throwable) - { -@@ -1145,7 +1142,7 @@ - - if (this.field_78531_r.field_71442_b.func_178889_l() == WorldSettings.GameType.SPECTATOR) - { -- flag = block.func_149716_u() && this.field_78531_r.field_71441_e.func_175625_s(blockpos) instanceof IInventory; -+ flag = block.hasTileEntity(this.field_78531_r.field_71441_e.func_180495_p(blockpos)) && this.field_78531_r.field_71441_e.func_175625_s(blockpos) instanceof IInventory; - } - else - { -@@ -1296,7 +1293,9 @@ - GlStateManager.func_179094_E(); - RenderHelper.func_74519_b(); - this.field_78531_r.field_71424_I.func_76318_c("entities"); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); - renderglobal.func_180446_a(entity, frustum, p_175068_2_); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); - RenderHelper.func_74518_a(); - this.func_175072_h(); - GlStateManager.func_179128_n(5888); -@@ -1308,6 +1307,7 @@ - entityplayer = (EntityPlayer)entity; - GlStateManager.func_179118_c(); - this.field_78531_r.field_71424_I.func_76318_c("outline"); -+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, field_78531_r.field_71476_x, 0, entityplayer.func_70694_bm(), p_175068_2_)) - renderglobal.func_72731_b(entityplayer, this.field_78531_r.field_71476_x, 0, p_175068_2_); - GlStateManager.func_179141_d(); - } -@@ -1321,6 +1321,7 @@ - entityplayer = (EntityPlayer)entity; - GlStateManager.func_179118_c(); - this.field_78531_r.field_71424_I.func_76318_c("outline"); -+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, field_78531_r.field_71476_x, 0, entityplayer.func_70694_bm(), p_175068_2_)) - renderglobal.func_72731_b(entityplayer, this.field_78531_r.field_71476_x, 0, p_175068_2_); - GlStateManager.func_179141_d(); - } -@@ -1373,6 +1374,16 @@ - renderglobal.func_174977_a(EnumWorldBlockLayer.TRANSLUCENT, (double)p_175068_2_, p_175068_1_, entity); - } - -+ if (!this.field_175078_W) //Only render if render pass 0 happens as well. -+ { -+ RenderHelper.func_74519_b(); -+ this.field_78531_r.field_71424_I.func_76318_c("entities"); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(1); -+ renderglobal.func_180446_a(entity, frustum, p_175068_2_); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(-1); -+ RenderHelper.func_74518_a(); -+ } -+ - GlStateManager.func_179103_j(7424); - GlStateManager.func_179132_a(true); - GlStateManager.func_179089_o(); -@@ -1385,8 +1396,12 @@ - this.func_180437_a(renderglobal, p_175068_2_, p_175068_1_); - } - -+ this.field_78531_r.field_71424_I.func_76318_c("forge_render_last"); -+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(renderglobal, p_175068_2_); -+ - this.field_78531_r.field_71424_I.func_76318_c("hand"); - -+ if (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(renderglobal, p_175068_2_, p_175068_1_)) - if (this.field_175074_C) - { - GlStateManager.func_179086_m(256); -@@ -1498,6 +1513,13 @@ - - protected void func_78474_d(float p_78474_1_) - { -+ net.minecraftforge.client.IRenderHandler renderer = this.field_78531_r.field_71441_e.field_73011_w.getWeatherRenderer(); -+ if (renderer != null) -+ { -+ renderer.render(p_78474_1_, this.field_78531_r.field_71441_e, field_78531_r); -+ return; -+ } -+ - float f1 = this.field_78531_r.field_71441_e.func_72867_j(p_78474_1_); - - if (f1 > 0.0F) -@@ -1835,6 +1857,13 @@ - this.field_175081_S = f8; - } - -+ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, entity, block, p_78466_1_, this.field_175080_Q, this.field_175082_R, this.field_175081_S); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ -+ this.field_175080_Q = event.red; -+ this.field_175082_R = event.green; -+ this.field_175081_S = event.blue; -+ - GlStateManager.func_179082_a(this.field_175080_Q, this.field_175082_R, this.field_175081_S, 0.0F); - } - -@@ -1854,6 +1883,10 @@ - Block block = ActiveRenderInfo.func_180786_a(this.field_78531_r.field_71441_e, entity, p_78468_2_); - float f1; - -+ float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, entity, block, p_78468_2_, 0.1F); -+ if (hook >= 0) -+ GlStateManager.func_179095_a(hook); -+ else - if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).func_70644_a(Potion.field_76440_q)) - { - f1 = 5.0F; -@@ -1931,6 +1964,7 @@ - GlStateManager.func_179102_b(f1 * 0.05F); - GlStateManager.func_179153_c(Math.min(f1, 192.0F) * 0.5F); - } -+ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, entity, block, p_78468_2_, p_78468_1_, f1); - } - - GlStateManager.func_179142_g(); diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch deleted file mode 100644 index ec9dc303d..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ /dev/null @@ -1,65 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/ItemRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/ItemRenderer.java -@@ -308,7 +308,7 @@ - - if (this.field_78453_b != null) - { -- if (this.field_78453_b.func_77973_b() == Items.field_151098_aY) -+ if (this.field_78453_b.func_77973_b() instanceof net.minecraft.item.ItemMap) - { - this.func_178097_a(entityplayersp, f3, f1, f2); - } -@@ -359,7 +359,8 @@ - - if (this.field_78455_a.field_71439_g.func_70094_T()) - { -- IBlockState iblockstate = this.field_78455_a.field_71441_e.func_180495_p(new BlockPos(this.field_78455_a.field_71439_g)); -+ BlockPos blockpos = new BlockPos(this.field_78455_a.field_71439_g); -+ IBlockState iblockstate = this.field_78455_a.field_71441_e.func_180495_p(blockpos); - EntityPlayerSP entityplayersp = this.field_78455_a.field_71439_g; - - for (int i = 0; i < 8; ++i) -@@ -367,7 +368,7 @@ - double d0 = entityplayersp.field_70165_t + (double)(((float)((i >> 0) % 2) - 0.5F) * entityplayersp.field_70130_N * 0.8F); - double d1 = entityplayersp.field_70163_u + (double)(((float)((i >> 1) % 2) - 0.5F) * 0.1F); - double d2 = entityplayersp.field_70161_v + (double)(((float)((i >> 2) % 2) - 0.5F) * entityplayersp.field_70130_N * 0.8F); -- BlockPos blockpos = new BlockPos(d0, d1 + (double)entityplayersp.func_70047_e(), d2); -+ blockpos = new BlockPos(d0, d1 + (double)entityplayersp.func_70047_e(), d2); - IBlockState iblockstate1 = this.field_78455_a.field_71441_e.func_180495_p(blockpos); - - if (iblockstate1.func_177230_c().func_176214_u()) -@@ -378,6 +379,7 @@ - - if (iblockstate.func_177230_c().func_149645_b() != -1) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(field_78455_a.field_71439_g, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, blockpos)) - this.func_178108_a(p_78447_1_, this.field_78455_a.func_175602_ab().func_175023_a().func_178122_a(iblockstate)); - } - } -@@ -386,11 +388,13 @@ - { - if (this.field_78455_a.field_71439_g.func_70055_a(Material.field_151586_h)) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderWaterOverlay(field_78455_a.field_71439_g, p_78447_1_)) - this.func_78448_c(p_78447_1_); - } - - if (this.field_78455_a.field_71439_g.func_70027_ad()) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderFireOverlay(field_78455_a.field_71439_g, p_78447_1_)) - this.func_78442_d(p_78447_1_); - } - } -@@ -507,6 +511,12 @@ - { - if (!this.field_78453_b.func_179549_c(itemstack)) - { -+ if (!this.field_78453_b.func_77973_b().shouldCauseReequipAnimation(this.field_78453_b, itemstack, field_78450_g != entityplayersp.field_71071_by.field_70461_c)) -+ { -+ this.field_78453_b = itemstack; -+ this.field_78450_g = entityplayersp.field_71071_by.field_70461_c; -+ return; -+ } - flag = true; - } - } diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch deleted file mode 100644 index e7f5b1855..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch +++ /dev/null @@ -1,134 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/RenderGlobal.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/RenderGlobal.java -@@ -517,8 +517,10 @@ - - public void func_180446_a(Entity p_180446_1_, ICamera p_180446_2_, float p_180446_3_) - { -+ int pass = net.minecraftforge.client.MinecraftForgeClient.getRenderPass(); - if (this.field_72740_G > 0) - { -+ if (pass > 0) return; - --this.field_72740_G; - } - else -@@ -529,9 +531,12 @@ - this.field_72769_h.field_72984_F.func_76320_a("prepare"); - TileEntityRendererDispatcher.field_147556_a.func_178470_a(this.field_72769_h, this.field_72777_q.func_110434_K(), this.field_72777_q.field_71466_p, this.field_72777_q.func_175606_aa(), p_180446_3_); - this.field_175010_j.func_180597_a(this.field_72769_h, this.field_72777_q.field_71466_p, this.field_72777_q.func_175606_aa(), this.field_72777_q.field_147125_j, this.field_72777_q.field_71474_y, p_180446_3_); -+ if (pass == 0) // no indentation to shrink patch -+ { - this.field_72748_H = 0; - this.field_72749_I = 0; - this.field_72750_J = 0; -+ } - Entity entity1 = this.field_72777_q.func_175606_aa(); - double d3 = entity1.field_70142_S + (entity1.field_70165_t - entity1.field_70142_S) * (double)p_180446_3_; - double d4 = entity1.field_70137_T + (entity1.field_70163_u - entity1.field_70137_T) * (double)p_180446_3_; -@@ -543,13 +548,17 @@ - this.field_72777_q.field_71460_t.func_180436_i(); - this.field_72769_h.field_72984_F.func_76318_c("global"); - List list = this.field_72769_h.func_72910_y(); -+ if (pass == 0) // no indentation to shrink patch -+ { - this.field_72748_H = list.size(); -+ } - int i; - Entity entity2; - - for (i = 0; i < this.field_72769_h.field_73007_j.size(); ++i) - { - entity2 = (Entity)this.field_72769_h.field_73007_j.get(i); -+ if (!entity2.shouldRenderInPass(pass)) continue; - ++this.field_72749_I; - - if (entity2.func_145770_h(d0, d1, d2)) -@@ -571,6 +580,7 @@ - for (i = 0; i < list.size(); ++i) - { - entity2 = (Entity)list.get(i); -+ if (!entity2.shouldRenderInPass(pass)) continue; - boolean flag = this.field_72777_q.func_175606_aa() instanceof EntityLivingBase && ((EntityLivingBase)this.field_72777_q.func_175606_aa()).func_70608_bn(); - boolean flag1 = entity2.func_145770_h(d0, d1, d2) && (entity2.field_70158_ak || p_180446_2_.func_78546_a(entity2.func_174813_aQ()) || entity2.field_70153_n == this.field_72777_q.field_71439_g) && entity2 instanceof EntityPlayer; - -@@ -605,6 +615,7 @@ - while (iterator2.hasNext()) - { - Entity entity3 = (Entity)iterator2.next(); -+ if (!entity3.shouldRenderInPass(pass)) continue; - boolean flag2 = this.field_175010_j.func_178635_a(entity3, p_180446_2_, d0, d1, d2) || entity3.field_70153_n == this.field_72777_q.field_71439_g; - - if (flag2) -@@ -640,6 +651,7 @@ - while (iterator1.hasNext()) - { - tileentity = (TileEntity)iterator1.next(); -+ if (!tileentity.shouldRenderInPass(pass) || !p_180446_2_.func_78546_a(tileentity.getRenderBoundingBox())) continue; - TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity, p_180446_3_, -1); - } - } -@@ -671,7 +683,7 @@ - - Block block = this.field_72769_h.func_180495_p(blockpos).func_177230_c(); - -- if (tileentity != null && (block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull)) -+ if (tileentity != null && tileentity.shouldRenderInPass(pass) && tileentity.canRenderBreaking() && p_180446_2_.func_78546_a(tileentity.getRenderBoundingBox())) - { - TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity, p_180446_3_, destroyblockprogress.func_73106_e()); - } -@@ -1151,6 +1163,12 @@ - - public void func_174976_a(float p_174976_1_, int p_174976_2_) - { -+ net.minecraftforge.client.IRenderHandler renderer = this.field_72769_h.field_73011_w.getSkyRenderer(); -+ if (renderer != null) -+ { -+ renderer.render(p_174976_1_, field_72769_h, field_72777_q); -+ return; -+ } - if (this.field_72777_q.field_71441_e.field_73011_w.func_177502_q() == 1) - { - this.func_180448_r(); -@@ -1381,6 +1399,12 @@ - - public void func_180447_b(float p_180447_1_, int p_180447_2_) - { -+ net.minecraftforge.client.IRenderHandler renderer = this.field_72777_q.field_71441_e.field_73011_w.getCloudRenderer(); -+ if (renderer != null) -+ { -+ renderer.render(p_180447_1_, this.field_72777_q.field_71441_e, field_72777_q); -+ return; -+ } - if (this.field_72777_q.field_71441_e.field_73011_w.func_76569_d()) - { - if (this.field_72777_q.field_71474_y.field_74347_j) -@@ -1805,8 +1829,11 @@ - double d4 = (double)blockpos.func_177956_o() - d1; - double d5 = (double)blockpos.func_177952_p() - d2; - Block block = this.field_72769_h.func_180495_p(blockpos).func_177230_c(); -+ TileEntity te = this.field_72769_h.func_175625_s(blockpos); -+ boolean hasBreak = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull; -+ if (!hasBreak) hasBreak = te != null && te.canRenderBreaking(); - -- if (!(block instanceof BlockChest) && !(block instanceof BlockEnderChest) && !(block instanceof BlockSign) && !(block instanceof BlockSkull)) -+ if (!hasBreak) - { - if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) - { -@@ -1949,13 +1976,16 @@ - if (p_174961_1_ != null) - { - ItemRecord itemrecord = ItemRecord.func_150926_b(p_174961_1_); -+ ResourceLocation resource = null; - - if (itemrecord != null) - { - this.field_72777_q.field_71456_v.func_73833_a(itemrecord.func_150927_i()); -+ resource = itemrecord.getRecordResource(p_174961_1_); - } - -- PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.func_147675_a(new ResourceLocation(p_174961_1_), (float)p_174961_2_.func_177958_n(), (float)p_174961_2_.func_177956_o(), (float)p_174961_2_.func_177952_p()); -+ if (resource == null) resource = new ResourceLocation(p_174961_1_); -+ PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.func_147675_a(resource, (float)p_174961_2_.func_177958_n(), (float)p_174961_2_.func_177956_o(), (float)p_174961_2_.func_177952_p()); - this.field_147593_P.put(p_174961_2_, positionedsoundrecord); - this.field_72777_q.func_147118_V().func_147682_a(positionedsoundrecord); - } diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch deleted file mode 100644 index a015f515f..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch +++ /dev/null @@ -1,82 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java -@@ -22,7 +22,12 @@ - - public BakedQuad func_178414_a(Vector3f p_178414_1_, Vector3f p_178414_2_, BlockPartFace p_178414_3_, TextureAtlasSprite p_178414_4_, EnumFacing p_178414_5_, ModelRotation p_178414_6_, BlockPartRotation p_178414_7_, boolean p_178414_8_, boolean p_178414_9_) - { -- int[] aint = this.func_178405_a(p_178414_3_, p_178414_4_, p_178414_5_, this.func_178403_a(p_178414_1_, p_178414_2_), p_178414_6_, p_178414_7_, p_178414_8_, p_178414_9_); -+ return makeBakedQuad(p_178414_1_, p_178414_2_, p_178414_3_, p_178414_4_, p_178414_5_, (net.minecraftforge.client.model.ITransformation)p_178414_6_, p_178414_7_, p_178414_8_, p_178414_9_); -+ } -+ -+ public BakedQuad makeBakedQuad(Vector3f p_178414_1_, Vector3f p_178414_2_, BlockPartFace p_178414_3_, TextureAtlasSprite p_178414_4_, EnumFacing p_178414_5_, net.minecraftforge.client.model.ITransformation p_178414_6_, BlockPartRotation p_178414_7_, boolean p_178414_8_, boolean p_178414_9_) -+ { -+ int[] aint = this.makeQuadVertexData(p_178414_3_, p_178414_4_, p_178414_5_, this.func_178403_a(p_178414_1_, p_178414_2_), p_178414_6_, p_178414_7_, p_178414_8_, p_178414_9_); - EnumFacing enumfacing1 = func_178410_a(aint); - - if (p_178414_8_) -@@ -35,16 +40,22 @@ - this.func_178408_a(aint, enumfacing1); - } - -+ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing1); - return new BakedQuad(aint, p_178414_3_.field_178245_c, enumfacing1); - } - - private int[] func_178405_a(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, ModelRotation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean p_178405_8_) - { -+ return makeQuadVertexData(p_178405_1_, p_178405_2_, p_178405_3_, p_178405_4_, (net.minecraftforge.client.model.ITransformation)p_178405_5_, p_178405_6_, p_178405_7_, p_178405_8_); -+ } -+ -+ private int[] makeQuadVertexData(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, net.minecraftforge.client.model.ITransformation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean p_178405_8_) -+ { - int[] aint = new int[28]; - - for (int i = 0; i < 4; ++i) - { -- this.func_178402_a(aint, i, p_178405_3_, p_178405_1_, p_178405_4_, p_178405_2_, p_178405_5_, p_178405_6_, p_178405_7_, p_178405_8_); -+ this.fillVertexData(aint, i, p_178405_3_, p_178405_1_, p_178405_4_, p_178405_2_, p_178405_5_, p_178405_6_, p_178405_7_, p_178405_8_); - } - - return aint; -@@ -90,12 +101,17 @@ - - private void func_178402_a(int[] p_178402_1_, int p_178402_2_, EnumFacing p_178402_3_, BlockPartFace p_178402_4_, float[] p_178402_5_, TextureAtlasSprite p_178402_6_, ModelRotation p_178402_7_, BlockPartRotation p_178402_8_, boolean p_178402_9_, boolean p_178402_10_) - { -- EnumFacing enumfacing1 = p_178402_7_.func_177523_a(p_178402_3_); -+ fillVertexData(p_178402_1_, p_178402_2_, p_178402_3_, p_178402_4_, p_178402_5_, p_178402_6_, (net.minecraftforge.client.model.ITransformation)p_178402_7_, p_178402_8_, p_178402_9_, p_178402_10_); -+ } -+ -+ private void fillVertexData(int[] p_178402_1_, int p_178402_2_, EnumFacing p_178402_3_, BlockPartFace p_178402_4_, float[] p_178402_5_, TextureAtlasSprite p_178402_6_, net.minecraftforge.client.model.ITransformation p_178402_7_, BlockPartRotation p_178402_8_, boolean p_178402_9_, boolean p_178402_10_) -+ { -+ EnumFacing enumfacing1 = p_178402_7_.rotate(p_178402_3_); - int j = p_178402_10_ ? this.func_178413_a(enumfacing1) : -1; - EnumFaceDirection.VertexInformation vertexinformation = EnumFaceDirection.func_179027_a(p_178402_3_).func_179025_a(p_178402_2_); - Vector3d vector3d = new Vector3d((double)p_178402_5_[vertexinformation.field_179184_a], (double)p_178402_5_[vertexinformation.field_179182_b], (double)p_178402_5_[vertexinformation.field_179183_c]); - this.func_178407_a(vector3d, p_178402_8_); -- int k = this.func_178415_a(vector3d, p_178402_3_, p_178402_2_, p_178402_7_, p_178402_9_); -+ int k = this.rotateVertex(vector3d, p_178402_3_, p_178402_2_, p_178402_7_, p_178402_9_); - this.func_178404_a(p_178402_1_, k, p_178402_2_, vector3d, j, p_178402_6_, p_178402_4_.field_178243_e); - } - -@@ -156,14 +172,19 @@ - - public int func_178415_a(Vector3d p_178415_1_, EnumFacing p_178415_2_, int p_178415_3_, ModelRotation p_178415_4_, boolean p_178415_5_) - { -+ return rotateVertex(p_178415_1_, p_178415_2_, p_178415_3_, (net.minecraftforge.client.model.ITransformation)p_178415_4_, p_178415_5_); -+ } -+ -+ public int rotateVertex(Vector3d p_178415_1_, EnumFacing p_178415_2_, int p_178415_3_, net.minecraftforge.client.model.ITransformation p_178415_4_, boolean p_178415_5_) -+ { - if (p_178415_4_ == ModelRotation.X0_Y0) - { - return p_178415_3_; - } - else - { -- this.func_178406_a(p_178415_1_, new Vector3d(0.5D, 0.5D, 0.5D), p_178415_4_.func_177525_a(), new Vector3d(1.0D, 1.0D, 1.0D)); -- return p_178415_4_.func_177520_a(p_178415_2_, p_178415_3_); -+ net.minecraftforge.client.ForgeHooksClient.transform(p_178415_1_, p_178415_4_.getMatrix()); -+ return p_178415_4_.rotate(p_178415_2_, p_178415_3_); - } - } - diff --git a/patches/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch deleted file mode 100644 index 27c36fd69..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java -@@ -40,7 +40,7 @@ - } - else - { -- s = this.field_178142_a.func_177702_a((Comparable)linkedhashmap.remove(this.field_178142_a)); -+ s = String.format("%s:%s", ((ResourceLocation)Block.field_149771_c.func_177774_c(p_178132_1_.func_177230_c())).func_110624_b(), this.field_178142_a.func_177702_a((Comparable)linkedhashmap.remove(this.field_178142_a))); - } - - if (this.field_178141_c != null) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch deleted file mode 100644 index 220d22619..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch +++ /dev/null @@ -1,128 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderItem.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderItem.java -@@ -83,7 +83,7 @@ - public RenderItem(TextureManager p_i46165_1_, ModelManager p_i46165_2_) - { - this.field_175057_n = p_i46165_1_; -- this.field_175059_m = new ItemModelMesher(p_i46165_2_); -+ this.field_175059_m = new net.minecraftforge.client.ItemModelMesherForge(p_i46165_2_); - this.func_175041_b(); - } - -@@ -222,7 +222,7 @@ - BakedQuad bakedquad; - int j; - -- for (Iterator iterator = p_175032_2_.iterator(); iterator.hasNext(); this.func_175033_a(p_175032_1_, bakedquad, j)) -+ for (Iterator iterator = p_175032_2_.iterator(); iterator.hasNext(); net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(p_175032_1_, bakedquad, j)) - { - bakedquad = (BakedQuad)iterator.next(); - j = p_175032_3_; -@@ -302,6 +302,10 @@ - modelresourcelocation = new ModelResourceLocation("bow_pulling_0", "inventory"); - } - } -+ else -+ { -+ modelresourcelocation = item.getModel(p_175049_1_, entityplayer, entityplayer.func_71052_bv()); -+ } - - if (modelresourcelocation != null) - { -@@ -314,6 +318,11 @@ - - protected void func_175034_a(ItemTransformVec3f p_175034_1_) - { -+ applyVanillaTransform(p_175034_1_); -+ } -+ -+ public static void applyVanillaTransform(ItemTransformVec3f p_175034_1_) -+ { - if (p_175034_1_ != ItemTransformVec3f.field_178366_a) - { - GlStateManager.func_179109_b(p_175034_1_.field_178365_c.x + field_175055_b, p_175034_1_.field_178365_c.y + field_175056_c, p_175034_1_.field_178365_c.z + field_175053_d); -@@ -335,23 +344,7 @@ - GlStateManager.func_179120_a(770, 771, 1, 0); - GlStateManager.func_179094_E(); - -- switch (RenderItem.SwitchTransformType.field_178640_a[p_175040_3_.ordinal()]) -- { -- case 1: -- default: -- break; -- case 2: -- this.func_175034_a(p_175040_2_.func_177552_f().field_178355_b); -- break; -- case 3: -- this.func_175034_a(p_175040_2_.func_177552_f().field_178356_c); -- break; -- case 4: -- this.func_175034_a(p_175040_2_.func_177552_f().field_178353_d); -- break; -- case 5: -- this.func_175034_a(p_175040_2_.func_177552_f().field_178354_e); -- } -+ p_175040_2_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_175040_2_, p_175040_3_); - - this.func_180454_a(p_175040_1_, p_175040_2_); - GlStateManager.func_179121_F(); -@@ -374,7 +367,7 @@ - GlStateManager.func_179112_b(770, 771); - GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); - this.func_180452_a(p_175042_2_, p_175042_3_, ibakedmodel.func_177556_c()); -- this.func_175034_a(ibakedmodel.func_177552_f().field_178354_e); -+ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GUI); - this.func_180454_a(p_175042_1_, ibakedmodel); - GlStateManager.func_179118_c(); - GlStateManager.func_179101_C(); -@@ -485,10 +478,11 @@ - GlStateManager.func_179126_j(); - } - -- if (p_180453_2_.func_77951_h()) -+ if (p_180453_2_.func_77973_b().showDurabilityBar(p_180453_2_)) - { -- int j1 = (int)Math.round(13.0D - (double)p_180453_2_.func_77952_i() * 13.0D / (double)p_180453_2_.func_77958_k()); -- int k = (int)Math.round(255.0D - (double)p_180453_2_.func_77952_i() * 255.0D / (double)p_180453_2_.func_77958_k()); -+ double health = p_180453_2_.func_77973_b().getDurabilityForDisplay(p_180453_2_); -+ int j1 = (int)Math.round(13.0D - health * 13.0D); -+ int k = (int)Math.round(255.0D - health * 255.0D); - GlStateManager.func_179140_f(); - GlStateManager.func_179097_i(); - GlStateManager.func_179090_x(); -@@ -501,7 +495,7 @@ - this.func_175044_a(worldrenderer, p_180453_3_ + 2, p_180453_4_ + 13, 13, 2, 0); - this.func_175044_a(worldrenderer, p_180453_3_ + 2, p_180453_4_ + 13, 12, 1, i1); - this.func_175044_a(worldrenderer, p_180453_3_ + 2, p_180453_4_ + 13, j1, 1, l); -- GlStateManager.func_179147_l(); -+ //GlStateManager.enableBlend(); // Forge: Disable Bled because it screws with a lot of things down the line. - GlStateManager.func_179141_d(); - GlStateManager.func_179098_w(); - GlStateManager.func_179145_e(); -@@ -1072,12 +1066,26 @@ - this.func_175029_a(Blocks.field_150420_aW, BlockHugeMushroom.EnumType.ALL_INSIDE.func_176896_a(), "brown_mushroom_block"); - this.func_175029_a(Blocks.field_150419_aX, BlockHugeMushroom.EnumType.ALL_INSIDE.func_176896_a(), "red_mushroom_block"); - this.func_175031_a(Blocks.field_150380_bt, "dragon_egg"); -+ net.minecraftforge.client.model.ModelLoader.onRegisterItems(this.field_175059_m); - } - - public void func_110549_a(IResourceManager p_110549_1_) - { - this.field_175059_m.func_178085_b(); - } -+ /*==================================== FORGE START ===========================================* / -+ private static RenderItem instance; -+ /** -+ * Returns a single lazy loaded instance of RenderItem, for use in mods who -+ * don't care about the interaction of other objects on the current state of the RenderItem they are using. -+ * @return A global instance of RenderItem -+ * / -+ public static RenderItem getInstance() -+ { -+ if (instance == null) instance = new RenderItem(); -+ return instance; -+ } -+ /*==================================== FORGE END =============================================*/ - - @SideOnly(Side.CLIENT) - diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch deleted file mode 100644 index 7b9014d93..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java -@@ -193,6 +193,10 @@ - this.field_178636_l.put("default", this.field_178637_m); - this.field_178636_l.put("slim", new RenderPlayer(this, true)); - } -+ -+ public Map getSkinMap() { -+ return (Map) java.util.Collections.unmodifiableMap(field_178636_l); -+ } - - public void func_178628_a(double p_178628_1_, double p_178628_3_, double p_178628_5_) - { -@@ -241,9 +245,9 @@ - IBlockState iblockstate = p_180597_1_.func_180495_p(new BlockPos(p_180597_3_)); - Block block = iblockstate.func_177230_c(); - -- if (block == Blocks.field_150324_C) -+ if (block.isBed(p_180597_1_, new BlockPos(p_180597_3_), (EntityLivingBase)p_180597_3_)) - { -- int i = ((EnumFacing)iblockstate.func_177229_b(BlockBed.field_176387_N)).func_176736_b(); -+ int i = block.getBedDirection(p_180597_1_, new BlockPos(p_180597_3_)).func_176736_b(); - this.field_78735_i = (float)(i * 90 + 180); - this.field_78732_j = 0.0F; - } diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch deleted file mode 100644 index 3b547aafd..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java -@@ -79,6 +79,7 @@ - { - TileEntityRendererDispatcher.field_147556_a.func_147549_a(this.field_147718_c, 0.0D, 0.0D, 0.0D, 0.0F); - } -+ else if (block != Blocks.field_150486_ae) net.minecraftforge.client.ForgeHooksClient.renderTileItem(p_179022_1_.func_77973_b(), p_179022_1_.func_77960_j()); - else - { - TileEntityRendererDispatcher.field_147556_a.func_147549_a(this.field_147717_b, 0.0D, 0.0D, 0.0D, 0.0F); diff --git a/patches/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch b/patches/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch deleted file mode 100644 index feee903f7..000000000 --- a/patches/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/AbstractResourcePack.java -+++ ../src-work/minecraft/net/minecraft/client/resources/AbstractResourcePack.java -@@ -58,7 +58,7 @@ - - protected void func_110594_c(String p_110594_1_) - { -- field_110598_a.warn("ResourcePack: ignored non-lowercase namespace: %s in %s", new Object[] {p_110594_1_, this.field_110597_b}); -+ field_110598_a.warn("ResourcePack: ignored non-lowercase namespace: {} in {}", new Object[] {p_110594_1_, this.field_110597_b}); - } - - public IMetadataSection func_135058_a(IMetadataSerializer p_135058_1_, String p_135058_2_) throws IOException diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch deleted file mode 100644 index f8e796861..000000000 --- a/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch +++ /dev/null @@ -1,103 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/model/ModelBakery.java -+++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelBakery.java -@@ -123,7 +123,7 @@ - } - catch (Exception exception) - { -- field_177603_c.warn("Unable to load variant: " + modelresourcelocation.func_177518_c() + " from " + modelresourcelocation); -+ field_177603_c.warn("Unable to load variant: " + modelresourcelocation.func_177518_c() + " from " + modelresourcelocation, exception); - } - } - catch (Exception exception1) -@@ -172,6 +172,7 @@ - } - } - } -+ catch (FileNotFoundException e) {} - catch (IOException ioexception) - { - throw new RuntimeException("Encountered an exception when loading model definition of model " + resourcelocation1.toString(), ioexception); -@@ -318,6 +319,7 @@ - - protected void func_177592_e() - { -+ this.field_177613_u.clear(); //FML clear this to prevent double ups. - this.field_177613_u.put(Item.func_150898_a(Blocks.field_150348_b), Lists.newArrayList(new String[] {"stone", "granite", "granite_smooth", "diorite", "diorite_smooth", "andesite", "andesite_smooth"})); - this.field_177613_u.put(Item.func_150898_a(Blocks.field_150346_d), Lists.newArrayList(new String[] {"dirt", "coarse_dirt", "podzol"})); - this.field_177613_u.put(Item.func_150898_a(Blocks.field_150344_f), Lists.newArrayList(new String[] {"oak_planks", "spruce_planks", "birch_planks", "jungle_planks", "acacia_planks", "dark_oak_planks"})); -@@ -360,6 +362,10 @@ - this.field_177613_u.put(Item.func_150898_a(Blocks.field_180390_bo), Lists.newArrayList(new String[] {"oak_fence_gate"})); - this.field_177613_u.put(Item.func_150898_a(Blocks.field_180407_aO), Lists.newArrayList(new String[] {"oak_fence"})); - this.field_177613_u.put(Items.field_179570_aq, Lists.newArrayList(new String[] {"oak_door"})); -+ for (Entry, Set> e : customVariantNames.entrySet()) -+ { -+ this.field_177613_u.put(e.getKey().get(), Lists.newArrayList(e.getValue().iterator())); -+ } - } - - protected List func_177596_a(Item p_177596_1_) -@@ -494,6 +500,11 @@ - - private IBakedModel func_177578_a(ModelBlock p_177578_1_, ModelRotation p_177578_2_, boolean p_177578_3_) - { -+ return bakeModel(p_177578_1_, (net.minecraftforge.client.model.ITransformation)p_177578_2_, p_177578_3_); -+ } -+ -+ protected IBakedModel bakeModel(ModelBlock p_177578_1_, net.minecraftforge.client.model.ITransformation p_177578_2_, boolean p_177578_3_) -+ { - TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.field_177599_g.get(new ResourceLocation(p_177578_1_.func_178308_c("particle"))); - SimpleBakedModel.Builder builder = (new SimpleBakedModel.Builder(p_177578_1_)).func_177646_a(textureatlassprite); - Iterator iterator = p_177578_1_.func_178298_a().iterator(); -@@ -509,13 +520,13 @@ - BlockPartFace blockpartface = (BlockPartFace)blockpart.field_178240_c.get(enumfacing); - TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.field_177599_g.get(new ResourceLocation(p_177578_1_.func_178308_c(blockpartface.field_178242_d))); - -- if (blockpartface.field_178244_b == null) -+ if (blockpartface.field_178244_b == null || !net.minecraftforge.client.model.TRSRTransformation.isInteger(p_177578_2_.getMatrix())) - { -- builder.func_177648_a(this.func_177589_a(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_)); -+ builder.func_177648_a(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_)); - } - else - { -- builder.func_177650_a(p_177578_2_.func_177523_a(blockpartface.field_178244_b), this.func_177589_a(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_)); -+ builder.func_177650_a(p_177578_2_.rotate(blockpartface.field_178244_b), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_)); - } - } - } -@@ -525,9 +536,14 @@ - - private BakedQuad func_177589_a(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_) - { -- return this.field_177607_l.func_178414_a(p_177589_1_.field_178241_a, p_177589_1_.field_178239_b, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.field_178237_d, p_177589_6_, p_177589_1_.field_178238_e); -+ return makeBakedQuad(p_177589_1_, p_177589_2_, p_177589_3_, p_177589_4_, (net.minecraftforge.client.model.ITransformation)p_177589_5_, p_177589_6_); - } - -+ protected BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, net.minecraftforge.client.model.ITransformation p_177589_5_, boolean p_177589_6_) -+ { -+ return this.field_177607_l.makeBakedQuad(p_177589_1_.field_178241_a, p_177589_1_.field_178239_b, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.field_178237_d, p_177589_6_, p_177589_1_.field_178238_e); -+ } -+ - private void func_177597_h() - { - this.func_177574_i(); -@@ -809,4 +825,19 @@ - field_177617_q.field_178317_b = "class generation marker"; - field_177616_r.field_178317_b = "block entity marker"; - } -+ -+ /*********************************************************** -+ * FML Start -+ ***********************************************************/ -+ private static Map, Set> customVariantNames = Maps.newHashMap(); -+ public static void addVariantName(Item item, String... names) -+ { -+ if (customVariantNames.containsKey(item.delegate)) -+ customVariantNames.get(item.delegate).addAll(Lists.newArrayList(names)); -+ else -+ customVariantNames.put(item.delegate, Sets.newHashSet(names)); -+ } -+ /*********************************************************** -+ * FML End -+ ***********************************************************/ - } diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch deleted file mode 100644 index ec981fa49..000000000 --- a/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/model/ModelManager.java -+++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelManager.java -@@ -25,9 +25,10 @@ - - public void func_110549_a(IResourceManager p_110549_1_) - { -- ModelBakery modelbakery = new ModelBakery(p_110549_1_, this.field_174956_b, this.field_174957_c); -+ ModelBakery modelbakery = new net.minecraftforge.client.model.ModelLoader(p_110549_1_, this.field_174956_b, this.field_174957_c); - this.field_174958_a = modelbakery.func_177570_a(); - this.field_174955_d = (IBakedModel)this.field_174958_a.func_82594_a(ModelBakery.field_177604_a); -+ net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.field_174958_a, modelbakery); - this.field_174957_c.func_178124_c(); - } - diff --git a/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch b/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch deleted file mode 100644 index caaea209c..000000000 --- a/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/command/CommandEnchant.java -+++ ../src-work/minecraft/net/minecraft/command/CommandEnchant.java -@@ -95,7 +95,7 @@ - { - Enchantment enchantment2 = Enchantment.func_180306_c(short1); - -- if (!enchantment2.func_77326_a(enchantment1)) -+ if (!enchantment2.func_77326_a(enchantment1) || !enchantment1.func_77326_a(enchantment2)) //Forge BugFix: Let Both enchantments veto being together - { - throw new CommandException("commands.enchant.cantCombine", new Object[] {enchantment1.func_77316_c(j), enchantment2.func_77316_c(nbttaglist.func_150305_b(k).func_74765_d("lvl"))}); - } diff --git a/patches/minecraft/net/minecraft/command/CommandFill.java.patch b/patches/minecraft/net/minecraft/command/CommandFill.java.patch deleted file mode 100644 index 9a592ec08..000000000 --- a/patches/minecraft/net/minecraft/command/CommandFill.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/command/CommandFill.java -+++ ../src-work/minecraft/net/minecraft/command/CommandFill.java -@@ -52,6 +52,7 @@ - { - i = func_175764_a(p_71515_2_[7], 0, 15); - } -+ IBlockState state = block.func_176203_a(i); - - BlockPos blockpos2 = new BlockPos(Math.min(blockpos.func_177958_n(), blockpos1.func_177958_n()), Math.min(blockpos.func_177956_o(), blockpos1.func_177956_o()), Math.min(blockpos.func_177952_p(), blockpos1.func_177952_p())); - BlockPos blockpos3 = new BlockPos(Math.max(blockpos.func_177958_n(), blockpos1.func_177958_n()), Math.max(blockpos.func_177956_o(), blockpos1.func_177956_o()), Math.max(blockpos.func_177952_p(), blockpos1.func_177952_p())); -@@ -79,7 +80,7 @@ - NBTTagCompound nbttagcompound = new NBTTagCompound(); - boolean flag = false; - -- if (p_71515_2_.length >= 10 && block.func_149716_u()) -+ if (p_71515_2_.length >= 10 && block.hasTileEntity(state)) - { - String s = func_147178_a(p_71515_1_, p_71515_2_, 9).func_150260_c(); - -@@ -121,7 +122,7 @@ - continue; - } - } -- else if (p_71515_2_[8].equals("replace") && !block.func_149716_u()) -+ else if (p_71515_2_[8].equals("replace") && !block.hasTileEntity(state)) - { - if (p_71515_2_.length > 9) - { diff --git a/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch b/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch deleted file mode 100644 index 8ef370f35..000000000 --- a/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/command/server/CommandSetBlock.java -+++ ../src-work/minecraft/net/minecraft/command/server/CommandSetBlock.java -@@ -54,6 +54,8 @@ - i = func_175764_a(p_71515_2_[4], 0, 15); - } - -+ IBlockState state = block.func_176203_a(i); -+ - World world = p_71515_1_.func_130014_f_(); - - if (!world.func_175667_e(blockpos)) -@@ -65,7 +67,7 @@ - NBTTagCompound nbttagcompound = new NBTTagCompound(); - boolean flag = false; - -- if (p_71515_2_.length >= 7 && block.func_149716_u()) -+ if (p_71515_2_.length >= 7 && block.hasTileEntity(state)) - { - String s = func_147178_a(p_71515_1_, p_71515_2_, 6).func_150260_c(); - diff --git a/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch b/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch deleted file mode 100644 index 9deb81cc3..000000000 --- a/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/crash/CrashReportCategory.java -+++ ../src-work/minecraft/net/minecraft/crash/CrashReportCategory.java -@@ -128,8 +128,11 @@ - } - 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); -+ int len = astacktraceelement.length - 3 - p_85073_1_; -+ // Really Mojang, Still, god damn... -+ 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; - } - } diff --git a/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch b/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch deleted file mode 100644 index 1544b50a8..000000000 --- a/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityHanging.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityHanging.java -@@ -124,6 +124,9 @@ - { - BlockPos blockpos1 = blockpos.func_177967_a(enumfacing, k).func_177981_b(l); - Block block = this.field_70170_p.func_180495_p(blockpos1).func_177230_c(); -+ -+ if ( block.isSideSolid( this.field_70170_p, blockpos1, this.field_174860_b )) -+ continue; - - if (!block.func_149688_o().func_76220_a() && !BlockRedstoneDiode.func_149909_d(block)) - { diff --git a/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch b/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch deleted file mode 100644 index 5a09c3725..000000000 --- a/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityLiving.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityLiving.java -@@ -124,6 +124,7 @@ - public void func_70624_b(EntityLivingBase p_70624_1_) - { - this.field_70696_bz = p_70624_1_; -+ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, p_70624_1_); - } - - public boolean func_70686_a(Class p_70686_1_) -@@ -507,10 +508,22 @@ - - protected void func_70623_bb() - { -+ net.minecraftforge.fml.common.eventhandler.Event.Result result = null; - if (this.field_82179_bU) - { - this.field_70708_bq = 0; - } -+ else if ((this.field_70708_bq & 0x1F) == 0x1F && (result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this)) != net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT) -+ { -+ if (result == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) -+ { -+ this.field_70708_bq = 0; -+ } -+ else -+ { -+ this.func_70106_y(); -+ } -+ } - else - { - EntityPlayer entityplayer = this.field_70170_p.func_72890_a(this, -1.0D); -@@ -628,7 +641,6 @@ - return this.field_70170_p.func_72917_a(this.func_174813_aQ(), this) && this.field_70170_p.func_72945_a(this, this.func_174813_aQ()).isEmpty() && !this.field_70170_p.func_72953_d(this.func_174813_aQ()); - } - -- @SideOnly(Side.CLIENT) - public float func_70603_bj() - { - return 1.0F; diff --git a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch deleted file mode 100644 index 95ebf1e2d..000000000 --- a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ /dev/null @@ -1,212 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java -@@ -233,7 +233,7 @@ - } - } - -- if (!this.field_70170_p.field_72995_K && this.func_70115_ae() && this.field_70154_o instanceof EntityLivingBase) -+ if (!this.field_70170_p.field_72995_K && this.func_70115_ae() && this.field_70154_o != null && field_70154_o.shouldDismountInWater(this)) - { - this.func_70078_a((Entity)null); - } -@@ -316,7 +316,7 @@ - if (!this.field_70170_p.field_72995_K && (this.field_70718_bc > 0 || this.func_70684_aJ()) && this.func_146066_aG() && this.field_70170_p.func_82736_K().func_82766_b("doMobLoot")) - { - i = this.func_70693_a(this.field_70717_bb); -- -+ i = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.field_70717_bb, i); - while (i > 0) - { - int j = EntityXPOrb.func_70527_a(i); -@@ -377,6 +377,7 @@ - { - this.field_70755_b = p_70604_1_; - this.field_70756_c = this.field_70173_aa; -+ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, p_70604_1_); - } - - public EntityLivingBase func_110144_aD() -@@ -672,7 +673,6 @@ - return this.func_70668_bt() == EnumCreatureAttribute.UNDEAD; - } - -- @SideOnly(Side.CLIENT) - public void func_70618_n(int p_70618_1_) - { - this.field_70713_bf.remove(Integer.valueOf(p_70618_1_)); -@@ -721,6 +721,8 @@ - - public void func_70691_i(float p_70691_1_) - { -+ p_70691_1_ = net.minecraftforge.event.ForgeEventFactory.onLivingHeal(this, p_70691_1_); -+ if (p_70691_1_ <= 0) return; - float f1 = this.func_110143_aJ(); - - if (f1 > 0.0F) -@@ -741,6 +743,7 @@ - - public boolean func_70097_a(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_)) - { - return false; -@@ -806,9 +809,9 @@ - this.field_70718_bc = 100; - this.field_70717_bb = (EntityPlayer)entity; - } -- else if (entity instanceof EntityWolf) -+ else if (entity instanceof net.minecraft.entity.passive.EntityTameable) - { -- EntityWolf entitywolf = (EntityWolf)entity; -+ net.minecraft.entity.passive.EntityTameable entitywolf = (net.minecraft.entity.passive.EntityTameable)entity; - - if (entitywolf.func_70909_n()) - { -@@ -894,6 +897,7 @@ - - public void func_70645_a(DamageSource p_70645_1_) - { -+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return; - Entity entity = p_70645_1_.func_76346_g(); - EntityLivingBase entitylivingbase = this.func_94060_bK(); - -@@ -919,6 +923,9 @@ - i = EnchantmentHelper.func_77519_f((EntityLivingBase)entity); - } - -+ captureDrops = true; -+ capturedDrops.clear(); -+ - if (this.func_146066_aG() && this.field_70170_p.func_82736_K().func_82766_b("doMobLoot")) - { - this.func_70628_a(this.field_70718_bc > 0, i); -@@ -929,6 +936,16 @@ - this.func_82164_bB(); - } - } -+ -+ captureDrops = false; -+ -+ if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, p_70645_1_, capturedDrops, i, field_70718_bc > 0)) -+ { -+ for (EntityItem item : capturedDrops) -+ { -+ field_70170_p.func_72838_d(item); -+ } -+ } - } - - this.field_70170_p.func_72960_a(this, (byte)3); -@@ -977,7 +994,7 @@ - int j = MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b); - int k = MathHelper.func_76128_c(this.field_70161_v); - Block block = this.field_70170_p.func_180495_p(new BlockPos(i, j, k)).func_177230_c(); -- return (block == Blocks.field_150468_ap || block == Blocks.field_150395_bd) && (!(this instanceof EntityPlayer) || !((EntityPlayer)this).func_175149_v()); -+ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(block, field_70170_p, new BlockPos(i, j, k), this); - } - - public boolean func_70089_S() -@@ -987,6 +1004,9 @@ - - public void func_180430_e(float p_180430_1_, float p_180430_2_) - { -+ float[] ret = net.minecraftforge.common.ForgeHooks.onLivingFall(this, p_180430_1_, p_180430_2_); -+ if (ret == null) return; -+ p_180430_1_ = ret[0]; p_180430_2_ = ret[1]; - super.func_180430_e(p_180430_1_, p_180430_2_); - PotionEffect potioneffect = this.func_70660_b(Potion.field_76430_j); - float f2 = potioneffect != null ? (float)(potioneffect.func_76458_c() + 1) : 0.0F; -@@ -1105,6 +1125,8 @@ - { - if (!this.func_180431_b(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 f1 = p_70665_2_; -@@ -1153,6 +1175,11 @@ - - public void func_71038_i() - { -+ ItemStack stack = this.func_70694_bm(); -+ if (stack != null && stack.func_77973_b() != null) -+ { -+ if (stack.func_77973_b().onEntitySwing(this, stack)) 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; -@@ -1294,6 +1321,7 @@ - - public void func_110145_l(Entity p_110145_1_) - { -+ if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_110145_1_, false)){ return; } - double d0 = p_110145_1_.field_70165_t; - double d1 = p_110145_1_.func_174813_aQ().field_72338_b + (double)p_110145_1_.field_70131_O; - double d2 = p_110145_1_.field_70161_v; -@@ -1359,6 +1387,7 @@ - } - - this.field_70160_al = true; -+ net.minecraftforge.common.ForgeHooks.onLivingJump(this); - } - - protected void func_70629_bd() -@@ -1545,6 +1574,7 @@ - - public void func_70071_h_() - { -+ if (net.minecraftforge.common.ForgeHooks.onLivingUpdate(this)) return; - super.func_70071_h_(); - - if (!this.field_70170_p.field_72995_K) -@@ -1828,6 +1858,7 @@ - - public void func_70078_a(Entity p_70078_1_) - { -+ if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_70078_1_, true)){ return; } - if (this.field_70154_o != null && p_70078_1_ == null) - { - if (!this.field_70170_p.field_72995_K) -@@ -2000,4 +2031,39 @@ - { - this.field_70752_e = true; - } -+ -+ /*** -+ * Removes all potion effects that have curativeItem as a curative item for its effect -+ * @param curativeItem The itemstack we are using to cure potion effects -+ */ -+ public void curePotionEffects(ItemStack curativeItem) -+ { -+ Iterator potionKey = field_70713_bf.keySet().iterator(); -+ if (field_70170_p.field_72995_K) return; -+ -+ while (potionKey.hasNext()) -+ { -+ Integer key = potionKey.next(); -+ PotionEffect effect = (PotionEffect)field_70713_bf.get(key); -+ -+ if (effect.isCurativeItem(curativeItem)) -+ { -+ potionKey.remove(); -+ func_70688_c(effect); -+ this.field_70752_e = true; -+ } -+ } -+ } -+ -+ /** -+ * Returns true if the entity's rider (EntityPlayer) should face forward when mounted. -+ * currently only used in vanilla code by pigs. -+ * -+ * @param player The player who is riding the entity. -+ * @return If the player should orient the same direction as this entity. -+ */ -+ public boolean shouldRiderFaceForward(EntityPlayer player) -+ { -+ return this instanceof net.minecraft.entity.passive.EntityPig; -+ } - } diff --git a/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch b/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch deleted file mode 100644 index 6f346c7e8..000000000 --- a/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityTrackerEntry.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityTrackerEntry.java -@@ -388,6 +388,14 @@ - this.field_73138_k = this.field_73132_a.field_70181_x; - this.field_73135_l = this.field_73132_a.field_70179_y; - -+ int posX = MathHelper.func_76128_c(this.field_73132_a.field_70165_t * 32.0D); -+ int posY = MathHelper.func_76128_c(this.field_73132_a.field_70163_u * 32.0D); -+ int posZ = MathHelper.func_76128_c(this.field_73132_a.field_70161_v * 32.0D); -+ if (posX != this.field_73128_d || posY != this.field_73129_e || posZ != this.field_73126_f) -+ { -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.makeEntitySpawnAdjustment(this.field_73132_a, p_73117_1_, this.field_73128_d, this.field_73129_e, this.field_73126_f); -+ } -+ - if (this.field_73143_t && !(packet instanceof S0FPacketSpawnMob)) - { - p_73117_1_.field_71135_a.func_147359_a(new S12PacketEntityVelocity(this.field_73132_a.func_145782_y(), this.field_73132_a.field_70159_w, this.field_73132_a.field_70181_x, this.field_73132_a.field_70179_y)); -@@ -437,12 +445,14 @@ - p_73117_1_.field_71135_a.func_147359_a(new S1DPacketEntityEffect(this.field_73132_a.func_145782_y(), potioneffect)); - } - } -+ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(field_73132_a, p_73117_1_); - } - } - else if (this.field_73134_o.contains(p_73117_1_)) - { - this.field_73134_o.remove(p_73117_1_); - p_73117_1_.func_152339_d(this.field_73132_a); -+ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(field_73132_a, p_73117_1_); - } - } - } -@@ -474,6 +484,9 @@ - field_151262_p.warn("Fetching addPacket for removed entity"); - } - -+ Packet pkt = net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.getEntitySpawningPacket(this.field_73132_a); -+ if (pkt != null) return pkt; -+ - if (this.field_73132_a instanceof EntityItem) - { - return new S0EPacketSpawnObject(this.field_73132_a, 2, 1); diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch deleted file mode 100644 index 8f01432d9..000000000 --- a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/boss/EntityDragon.java -+++ ../src-work/minecraft/net/minecraft/entity/boss/EntityDragon.java -@@ -486,9 +486,9 @@ - { - Block block = this.field_70170_p.func_180495_p(new BlockPos(k1, l1, i2)).func_177230_c(); - -- if (block.func_149688_o() != Material.field_151579_a) -+ if (!block.isAir(field_70170_p, new BlockPos(k1, l1, i2))) - { -- if (block != Blocks.field_180401_cv && block != Blocks.field_150343_Z && block != Blocks.field_150377_bs && block != Blocks.field_150357_h && block != Blocks.field_150483_bI && this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) -+ if (block.canEntityDestroy(field_70170_p, new BlockPos(k1, l1, i2), this) && this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) - { - flag1 = this.field_70170_p.func_175698_g(new BlockPos(k1, l1, i2)) || flag1; - } diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch deleted file mode 100644 index e683f35dc..000000000 --- a/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/boss/EntityWither.java -+++ ../src-work/minecraft/net/minecraft/entity/boss/EntityWither.java -@@ -351,7 +351,7 @@ - int l = j1 + i2; - Block block = this.field_70170_p.func_180495_p(new BlockPos(j2, k, l)).func_177230_c(); - -- if (block.func_149688_o() != Material.field_151579_a && block != Blocks.field_150357_h && block != Blocks.field_150384_bq && block != Blocks.field_150378_br && block != Blocks.field_150483_bI && block != Blocks.field_180401_cv) -+ if (!block.isAir(field_70170_p, new BlockPos(j2, k, l)) && block.canEntityDestroy(field_70170_p, new BlockPos(j2, k, l), this)) - { - flag = this.field_70170_p.func_175655_b(new BlockPos(j2, k, l), true) || flag; - } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch deleted file mode 100644 index c12ef4d21..000000000 --- a/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityEnderPearl.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityEnderPearl.java -@@ -50,6 +50,9 @@ - - if (entityplayermp.field_71135_a.func_147362_b().func_150724_d() && entityplayermp.field_70170_p == this.field_70170_p && !entityplayermp.func_70608_bn()) - { -+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(entityplayermp, this.field_70165_t, this.field_70163_u, this.field_70161_v, 5.0F); -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) -+ { // Don't indent to lower patch size - if (this.field_70146_Z.nextFloat() < 0.05F && this.field_70170_p.func_82736_K().func_82766_b("doMobSpawning")) - { - EntityEndermite entityendermite = new EntityEndermite(this.field_70170_p); -@@ -63,9 +66,10 @@ - entitylivingbase.func_70078_a((Entity)null); - } - -- entitylivingbase.func_70634_a(this.field_70165_t, this.field_70163_u, this.field_70161_v); -+ entitylivingbase.func_70634_a(event.targetX, event.targetY, event.targetZ); - entitylivingbase.field_70143_R = 0.0F; -- entitylivingbase.func_70097_a(DamageSource.field_76379_h, 5.0F); -+ entitylivingbase.func_70097_a(DamageSource.field_76379_h, event.attackDamage); -+ } - } - } - diff --git a/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch deleted file mode 100644 index 62ed8fc50..000000000 --- a/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch +++ /dev/null @@ -1,94 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityItem.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityItem.java -@@ -31,6 +31,11 @@ - public float field_70290_d; - private static final String __OBFID = "CL_00001669"; - -+ /** -+ * The maximum age of this EntityItem. The item is expired once this is reached. -+ */ -+ public int lifespan = 6000; -+ - public EntityItem(World p_i1709_1_, double p_i1709_2_, double p_i1709_4_, double p_i1709_6_) - { - super(p_i1709_1_); -@@ -48,6 +53,7 @@ - { - 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_.func_77973_b().getEntityLifespan(p_i1710_8_, p_i1710_1_)); - } - - protected boolean func_70041_e_() -@@ -71,6 +77,8 @@ - - public void func_70071_h_() - { -+ ItemStack stack = this.func_70096_w().func_82710_f(10); -+ if (stack != null && stack.func_77973_b() != null && stack.func_77973_b().onEntityItemUpdate(this)) return; - if (this.func_92059_d() == null) - { - this.func_70106_y(); -@@ -131,8 +139,16 @@ - - this.func_70072_I(); - -- if (!this.field_70170_p.field_72995_K && this.field_70292_b >= 6000) -+ ItemStack item = func_70096_w().func_82710_f(10); -+ -+ if (!this.field_70170_p.field_72995_K && this.field_70292_b >= lifespan) - { -+ int hook = net.minecraftforge.event.ForgeEventFactory.onItemExpire(this, item); -+ if (hook < 0) this.func_70106_y(); -+ else this.lifespan += hook; -+ } -+ if (item != null && item.field_77994_a <= 0) -+ { - this.func_70106_y(); - } - } -@@ -276,6 +292,7 @@ - p_70014_1_.func_74777_a("Health", (short)((byte)this.field_70291_e)); - p_70014_1_.func_74777_a("Age", (short)this.field_70292_b); - p_70014_1_.func_74777_a("PickupDelay", (short)this.field_145804_b); -+ p_70014_1_.func_74768_a("Lifespan", lifespan); - - if (this.func_145800_j() != null) - { -@@ -316,20 +333,23 @@ - NBTTagCompound nbttagcompound1 = p_70037_1_.func_74775_l("Item"); - this.func_92058_a(ItemStack.func_77949_a(nbttagcompound1)); - -- if (this.func_92059_d() == null) -- { -- this.func_70106_y(); -- } -+ ItemStack item = func_70096_w().func_82710_f(10); -+ if (item == null || item.field_77994_a <= 0) this.func_70106_y(); -+ if (p_70037_1_.func_74764_b("Lifespan")) lifespan = p_70037_1_.func_74762_e("Lifespan"); - } - - public void func_70100_b_(EntityPlayer p_70100_1_) - { - if (!this.field_70170_p.field_72995_K) - { -+ if (this.field_145804_b > 0) return; - ItemStack itemstack = this.func_92059_d(); - int i = itemstack.field_77994_a; - -- if (this.field_145804_b == 0 && (this.field_145802_g == null || 6000 - this.field_70292_b <= 200 || this.field_145802_g.equals(p_70100_1_.func_70005_c_())) && p_70100_1_.field_71071_by.func_70441_a(itemstack)) -+ int hook = net.minecraftforge.event.ForgeEventFactory.onItemPickup(this, p_70100_1_, itemstack); -+ if (hook < 0) return; -+ -+ 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_70005_c_())) && (hook == 1 || i <= 0 || p_70100_1_.field_71071_by.func_70441_a(itemstack))) - { - if (itemstack.func_77973_b() == Item.func_150898_a(Blocks.field_150364_r)) - { -@@ -366,6 +386,7 @@ - } - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerItemPickupEvent(p_70100_1_, this); - if (!this.func_174814_R()) - { - this.field_70170_p.func_72956_a(p_70100_1_, "random.pop", 0.2F, ((this.field_70146_Z.nextFloat() - this.field_70146_Z.nextFloat()) * 0.7F + 1.0F) * 2.0F); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch deleted file mode 100644 index 3ff9ebe83..000000000 --- a/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityItemFrame.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityItemFrame.java -@@ -123,7 +123,7 @@ - { - if (p_110131_1_ != null) - { -- if (p_110131_1_.func_77973_b() == Items.field_151098_aY) -+ if (p_110131_1_.func_77973_b() instanceof net.minecraft.item.ItemMap) - { - MapData mapdata = ((ItemMap)p_110131_1_.func_77973_b()).func_77873_a(p_110131_1_, this.field_70170_p); - mapdata.field_76203_h.remove("frame-" + this.func_145782_y()); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch deleted file mode 100644 index 6ce41fa89..000000000 --- a/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityXPOrb.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityXPOrb.java -@@ -198,6 +198,7 @@ - { - if (this.field_70532_c == 0 && p_70100_1_.field_71090_bL == 0) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerPickupXpEvent(p_70100_1_, this))) return; - p_70100_1_.field_71090_bL = 2; - this.field_70170_p.func_72956_a(p_70100_1_, "random.orb", 0.1F, 0.5F * ((this.field_70146_Z.nextFloat() - this.field_70146_Z.nextFloat()) * 0.7F + 1.8F)); - p_70100_1_.func_71001_a(this, 1); diff --git a/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch deleted file mode 100644 index 45e3d5eec..000000000 --- a/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/monster/EntitySlime.java -+++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySlime.java -@@ -271,7 +271,7 @@ - { - Chunk chunk = this.field_70170_p.func_175726_f(new BlockPos(MathHelper.func_76128_c(this.field_70165_t), 0, MathHelper.func_76128_c(this.field_70161_v))); - -- if (this.field_70170_p.func_72912_H().func_76067_t() == WorldType.field_77138_c && this.field_70146_Z.nextInt(4) != 1) -+ if (this.field_70170_p.func_72912_H().func_76067_t().handleSlimeSpawnReduction(field_70146_Z, field_70170_p)) - { - return false; - } diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch deleted file mode 100644 index 0ac7da22d..000000000 --- a/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch +++ /dev/null @@ -1,60 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/monster/EntityZombie.java -+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityZombie.java -@@ -89,7 +89,7 @@ - this.func_110148_a(SharedMonsterAttributes.field_111265_b).func_111128_a(35.0D); - this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a(0.23000000417232513D); - this.func_110148_a(SharedMonsterAttributes.field_111264_e).func_111128_a(3.0D); -- this.func_110140_aT().func_111150_b(field_110186_bp).func_111128_a(this.field_70146_Z.nextDouble() * 0.10000000149011612D); -+ this.func_110140_aT().func_111150_b(field_110186_bp).func_111128_a(this.field_70146_Z.nextDouble() * net.minecraftforge.common.ForgeModContainer.zombieSummonBaseChance); - } - - protected void func_70088_a() -@@ -231,12 +231,25 @@ - entitylivingbase = (EntityLivingBase)p_70097_1_.func_76346_g(); - } - -- if (entitylivingbase != null && this.field_70170_p.func_175659_aa() == EnumDifficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(field_110186_bp).func_111126_e()) -+ int i = MathHelper.func_76128_c(this.field_70165_t); -+ int j = MathHelper.func_76128_c(this.field_70163_u); -+ int k = MathHelper.func_76128_c(this.field_70161_v); -+ -+ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent summonAid = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, field_70170_p, i, j, k, entitylivingbase, this.func_110148_a(field_110186_bp).func_111126_e()); -+ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return true; -+ -+ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || -+ entitylivingbase != null && this.field_70170_p.func_175659_aa() == EnumDifficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(field_110186_bp).func_111126_e()) - { -- int i = MathHelper.func_76128_c(this.field_70165_t); -- int j = MathHelper.func_76128_c(this.field_70163_u); -- int k = MathHelper.func_76128_c(this.field_70161_v); -- EntityZombie entityzombie = new EntityZombie(this.field_70170_p); -+ EntityZombie entityzombie; -+ if (summonAid.customSummonedAid != null && summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW) -+ { -+ entityzombie = summonAid.customSummonedAid; -+ } -+ else -+ { -+ entityzombie = new EntityZombie(this.field_70170_p); -+ } - - for (int l = 0; l < 50; ++l) - { -@@ -251,7 +264,7 @@ - if (!this.field_70170_p.func_175636_b((double)i1, (double)j1, (double)k1, 7.0D) && this.field_70170_p.func_72917_a(entityzombie.func_174813_aQ(), entityzombie) && this.field_70170_p.func_72945_a(entityzombie, entityzombie.func_174813_aQ()).isEmpty() && !this.field_70170_p.func_72953_d(entityzombie.func_174813_aQ())) - { - this.field_70170_p.func_72838_d(entityzombie); -- entityzombie.func_70624_b(entitylivingbase); -+ if (entitylivingbase != null) entityzombie.func_70624_b(entitylivingbase); - entityzombie.func_180482_a(this.field_70170_p.func_175649_E(new BlockPos(entityzombie)), (IEntityLivingData)null); - this.func_110148_a(field_110186_bp).func_111121_a(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0)); - entityzombie.func_110148_a(field_110186_bp).func_111121_a(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0)); -@@ -458,7 +471,7 @@ - - if (p_180482_2_1 == null) - { -- p_180482_2_1 = new EntityZombie.GroupData(this.field_70170_p.field_73012_v.nextFloat() < 0.05F, this.field_70170_p.field_73012_v.nextFloat() < 0.05F, null); -+ p_180482_2_1 = new EntityZombie.GroupData(this.field_70170_p.field_73012_v.nextFloat() < net.minecraftforge.common.ForgeModContainer.zombieBabyChance, this.field_70170_p.field_73012_v.nextFloat() < 0.05F, null); - } - - if (p_180482_2_1 instanceof EntityZombie.GroupData) diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch deleted file mode 100644 index 9d9d51edf..000000000 --- a/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch +++ /dev/null @@ -1,62 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/passive/EntityMooshroom.java -+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityMooshroom.java -@@ -9,7 +9,7 @@ - import net.minecraft.util.EnumParticleTypes; - import net.minecraft.world.World; - --public class EntityMooshroom extends EntityCow -+public class EntityMooshroom extends EntityCow implements net.minecraftforge.common.IShearable - { - private static final String __OBFID = "CL_00001645"; - -@@ -20,6 +20,7 @@ - this.field_175506_bl = Blocks.field_150391_bh; - } - -+ @SuppressWarnings("unused") - public boolean func_70085_c(EntityPlayer p_70085_1_) - { - ItemStack itemstack = p_70085_1_.field_71071_by.func_70448_g(); -@@ -39,7 +40,7 @@ - } - } - -- if (itemstack != null && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_70874_b() >= 0) -+ if (false && itemstack != null && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_70874_b() >= 0) //Forge Disable, Moved to onSheared - { - this.func_70106_y(); - this.field_70170_p.func_175688_a(EnumParticleTypes.EXPLOSION_LARGE, this.field_70165_t, this.field_70163_u + (double)(this.field_70131_O / 2.0F), this.field_70161_v, 0.0D, 0.0D, 0.0D, new int[0]); -@@ -79,4 +80,33 @@ - { - return new EntityMooshroom(this.field_70170_p); - } -+ -+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos){ return func_70874_b() >= 0; } -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos, int fortune) -+ { -+ this.func_70106_y(); -+ this.field_70170_p.func_175688_a(EnumParticleTypes.EXPLOSION_LARGE, this.field_70165_t, this.field_70163_u + (double)(this.field_70131_O / 2.0F), this.field_70161_v, 0.0D, 0.0D, 0.0D, new int[0]); -+ -+ EntityCow entitycow = new EntityCow(this.field_70170_p); -+ entitycow.func_70012_b(this.field_70165_t, this.field_70163_u, this.field_70161_v, this.field_70177_z, this.field_70125_A); -+ entitycow.func_70606_j(this.func_110143_aJ()); -+ entitycow.field_70761_aq = this.field_70761_aq; -+ -+ if (this.func_145818_k_()) -+ { -+ entitycow.func_96094_a(this.func_95999_t()); -+ } -+ -+ this.field_70170_p.func_72838_d(entitycow); -+ -+ java.util.List ret = new java.util.ArrayList(); -+ for (int i = 0; i < 5; ++i) -+ { -+ ret.add(new ItemStack(Blocks.field_150337_Q)); -+ } -+ -+ this.func_85030_a("mob.sheep.shear", 1.0F, 1.0F); -+ return ret; -+ } - } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch deleted file mode 100644 index 6219ce05b..000000000 --- a/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/passive/EntityOcelot.java -+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityOcelot.java -@@ -276,7 +276,7 @@ - - Block block = this.field_70170_p.func_180495_p(blockpos.func_177977_b()).func_177230_c(); - -- if (block == Blocks.field_150349_c || block.func_149688_o() == Material.field_151584_j) -+ if (block == Blocks.field_150349_c || block.isLeaves(field_70170_p, blockpos.func_177977_b())) - { - return true; - } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch deleted file mode 100644 index ed6df82c6..000000000 --- a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/passive/EntityVillager.java -+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityVillager.java -@@ -83,6 +83,7 @@ - private boolean field_82190_bM; - private boolean field_175564_by; - private InventoryBasic field_175560_bz; -+ @Deprecated //Use VillagerRegistry - private static final EntityVillager.ITradeList[][][][] field_175561_bA = new EntityVillager.ITradeList[][][][] {{{{new EntityVillager.EmeraldForItems(Items.field_151015_O, new EntityVillager.PriceInfo(18, 22)), new EntityVillager.EmeraldForItems(Items.field_151174_bG, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.EmeraldForItems(Items.field_151172_bF, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.ListItemForEmeralds(Items.field_151025_P, new EntityVillager.PriceInfo(-4, -2))}, {new EntityVillager.EmeraldForItems(Item.func_150898_a(Blocks.field_150423_aK), new EntityVillager.PriceInfo(8, 13)), new EntityVillager.ListItemForEmeralds(Items.field_151158_bO, new EntityVillager.PriceInfo(-3, -2))}, {new EntityVillager.EmeraldForItems(Item.func_150898_a(Blocks.field_150440_ba), new EntityVillager.PriceInfo(7, 12)), new EntityVillager.ListItemForEmeralds(Items.field_151034_e, new EntityVillager.PriceInfo(-5, -7))}, {new EntityVillager.ListItemForEmeralds(Items.field_151106_aX, new EntityVillager.PriceInfo(-6, -10)), new EntityVillager.ListItemForEmeralds(Items.field_151105_aU, new EntityVillager.PriceInfo(1, 1))}}, {{new EntityVillager.EmeraldForItems(Items.field_151007_F, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ItemAndEmeraldToItem(Items.field_151115_aP, new EntityVillager.PriceInfo(6, 6), Items.field_179566_aV, new EntityVillager.PriceInfo(6, 6))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151112_aM, new EntityVillager.PriceInfo(7, 8))}}, {{new EntityVillager.EmeraldForItems(Item.func_150898_a(Blocks.field_150325_L), new EntityVillager.PriceInfo(16, 22)), new EntityVillager.ListItemForEmeralds(Items.field_151097_aZ, new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 0), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 1), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 2), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 3), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 4), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 5), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 6), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 7), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 8), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 9), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 10), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 11), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 12), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 13), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 14), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 15), new EntityVillager.PriceInfo(1, 2))}}, {{new EntityVillager.EmeraldForItems(Items.field_151007_F, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.ListItemForEmeralds(Items.field_151032_g, new EntityVillager.PriceInfo(-12, -8))}, {new EntityVillager.ListItemForEmeralds(Items.field_151031_f, new EntityVillager.PriceInfo(2, 3)), new EntityVillager.ItemAndEmeraldToItem(Item.func_150898_a(Blocks.field_150351_n), new EntityVillager.PriceInfo(10, 10), Items.field_151145_ak, new EntityVillager.PriceInfo(6, 10))}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151121_aF, new EntityVillager.PriceInfo(24, 36)), new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.EmeraldForItems(Items.field_151122_aG, new EntityVillager.PriceInfo(8, 10)), new EntityVillager.ListItemForEmeralds(Items.field_151111_aL, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.func_150898_a(Blocks.field_150342_X), new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.EmeraldForItems(Items.field_151164_bB, new EntityVillager.PriceInfo(2, 2)), new EntityVillager.ListItemForEmeralds(Items.field_151113_aN, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.func_150898_a(Blocks.field_150359_w), new EntityVillager.PriceInfo(-5, -3))}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListItemForEmeralds(Items.field_151057_cb, new EntityVillager.PriceInfo(20, 22))}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151078_bh, new EntityVillager.PriceInfo(36, 40)), new EntityVillager.EmeraldForItems(Items.field_151043_k, new EntityVillager.PriceInfo(8, 10))}, {new EntityVillager.ListItemForEmeralds(Items.field_151137_ax, new EntityVillager.PriceInfo(-4, -1)), new EntityVillager.ListItemForEmeralds(new ItemStack(Items.field_151100_aR, 1, EnumDyeColor.BLUE.func_176767_b()), new EntityVillager.PriceInfo(-2, -1))}, {new EntityVillager.ListItemForEmeralds(Items.field_151061_bv, new EntityVillager.PriceInfo(7, 11)), new EntityVillager.ListItemForEmeralds(Item.func_150898_a(Blocks.field_150426_aN), new EntityVillager.PriceInfo(-3, -1))}, {new EntityVillager.ListItemForEmeralds(Items.field_151062_by, new EntityVillager.PriceInfo(3, 11))}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.field_151028_Y, new EntityVillager.PriceInfo(4, 6))}, {new EntityVillager.EmeraldForItems(Items.field_151042_j, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListItemForEmeralds(Items.field_151030_Z, new EntityVillager.PriceInfo(10, 14))}, {new EntityVillager.EmeraldForItems(Items.field_151045_i, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151163_ad, new EntityVillager.PriceInfo(16, 19))}, {new EntityVillager.ListItemForEmeralds(Items.field_151029_X, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.field_151022_W, new EntityVillager.PriceInfo(9, 11)), new EntityVillager.ListItemForEmeralds(Items.field_151020_U, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.field_151023_V, new EntityVillager.PriceInfo(11, 15))}}, {{new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.field_151036_c, new EntityVillager.PriceInfo(6, 8))}, {new EntityVillager.EmeraldForItems(Items.field_151042_j, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151040_l, new EntityVillager.PriceInfo(9, 10))}, {new EntityVillager.EmeraldForItems(Items.field_151045_i, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151048_u, new EntityVillager.PriceInfo(12, 15)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151056_x, new EntityVillager.PriceInfo(9, 12))}}, {{new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151037_a, new EntityVillager.PriceInfo(5, 7))}, {new EntityVillager.EmeraldForItems(Items.field_151042_j, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151035_b, new EntityVillager.PriceInfo(9, 11))}, {new EntityVillager.EmeraldForItems(Items.field_151045_i, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151046_w, new EntityVillager.PriceInfo(12, 15))}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151147_al, new EntityVillager.PriceInfo(14, 18)), new EntityVillager.EmeraldForItems(Items.field_151076_bf, new EntityVillager.PriceInfo(14, 18))}, {new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.field_151157_am, new EntityVillager.PriceInfo(-7, -5)), new EntityVillager.ListItemForEmeralds(Items.field_151077_bg, new EntityVillager.PriceInfo(-8, -6))}}, {{new EntityVillager.EmeraldForItems(Items.field_151116_aA, new EntityVillager.PriceInfo(9, 12)), new EntityVillager.ListItemForEmeralds(Items.field_151026_S, new EntityVillager.PriceInfo(2, 4))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151027_R, new EntityVillager.PriceInfo(7, 12))}, {new EntityVillager.ListItemForEmeralds(Items.field_151141_av, new EntityVillager.PriceInfo(8, 10))}}}}; - private static final String __OBFID = "CL_00001707"; - -@@ -228,7 +229,7 @@ - ItemStack itemstack = p_70085_1_.field_71071_by.func_70448_g(); - boolean flag = itemstack != null && itemstack.func_77973_b() == Items.field_151063_bx; - -- if (!flag && this.func_70089_S() && !this.func_70940_q() && !this.func_70631_g_()) -+ if (!flag && this.func_70089_S() && !this.func_70940_q() && !this.func_70631_g_() && !p_70085_1_.func_70093_af()) - { - if (!this.field_70170_p.field_72995_K && (this.field_70963_i == null || this.field_70963_i.size() > 0)) - { -@@ -540,6 +541,7 @@ - - private void func_175554_cu() - { -+ //TODO: Hook into VillagerRegistry - EntityVillager.ITradeList[][][] aitradelist = field_175561_bA[this.func_70946_n()]; - - if (this.field_175563_bv != 0 && this.field_175562_bw != 0) -@@ -648,6 +650,7 @@ - } - } - -+ //TODO: Hook into VillagerRegistry to get name - if (s1 != null) - { - ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("entity.Villager." + s1, new Object[0]); -@@ -710,7 +713,7 @@ - public IEntityLivingData func_180482_a(DifficultyInstance p_180482_1_, IEntityLivingData p_180482_2_) - { - p_180482_2_ = super.func_180482_a(p_180482_1_, p_180482_2_); -- this.func_70938_b(this.field_70170_p.field_73012_v.nextInt(5)); -+ net.minecraftforge.fml.common.registry.VillagerRegistry.setRandomProfession(this, this.field_70170_p.field_73012_v); - this.func_175552_ct(); - return p_180482_2_; - } diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch deleted file mode 100644 index 610e37013..000000000 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ /dev/null @@ -1,637 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayer.java -+++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayer.java -@@ -77,9 +77,23 @@ - import net.minecraft.world.WorldSettings; - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; -+import net.minecraftforge.common.ISpecialArmor.ArmorProperties; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.ForgeEventFactory; -+import net.minecraftforge.event.entity.living.LivingHurtEvent; -+import net.minecraftforge.event.entity.player.AttackEntityEvent; -+import net.minecraftforge.event.entity.player.EntityInteractEvent; -+import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; -+import net.minecraftforge.event.entity.player.PlayerDropsEvent; -+import net.minecraftforge.event.entity.player.PlayerFlyableFallEvent; -+import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent; - - public abstract class EntityPlayer extends EntityLivingBase - { -+ public static final String PERSISTED_NBT_TAG = "PlayerPersisted"; -+ private java.util.HashMap spawnChunkMap = new java.util.HashMap(); -+ private java.util.HashMap spawnForcedMap = new java.util.HashMap(); -+ - public InventoryPlayer field_71071_by = new InventoryPlayer(this); - private InventoryEnderChest field_71078_a = new InventoryEnderChest(); - public Container field_71069_bz; -@@ -118,6 +132,7 @@ - private final GameProfile field_146106_i; - private boolean field_175153_bG = false; - public EntityFishHook field_71104_cf; -+ public float eyeHeight = this.getDefaultEyeHeight(); - private static final String __OBFID = "CL_00001711"; - - public EntityPlayer(World p_i45324_1_, GameProfile p_i45324_2_) -@@ -176,7 +191,8 @@ - { - if (this.field_71074_e != null) - { -- this.field_71074_e.func_77974_b(this.field_70170_p, this, this.field_71072_f); -+ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, field_71074_e, this.field_71072_f)) -+ this.field_71074_e.func_77974_b(this.field_70170_p, this, this.field_71072_f); - } - - this.func_71041_bz(); -@@ -200,6 +216,7 @@ - - public void func_70071_h_() - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPreTick(this); - this.field_70145_X = this.func_175149_v(); - - if (this.func_175149_v()) -@@ -213,6 +230,14 @@ - - if (itemstack == this.field_71074_e) - { -+ field_71072_f = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, field_71074_e, field_71072_f); -+ if (field_71072_f <= 0) -+ { -+ this.func_71036_o(); -+ } -+ else -+ { // Forge Keep unindented to lower patch -+ field_71074_e.func_77973_b().onUsingTick(field_71074_e, this, field_71072_f); //Forge Added - if (this.field_71072_f <= 25 && this.field_71072_f % 4 == 0) - { - this.func_71010_c(itemstack, 5); -@@ -222,6 +247,7 @@ - { - this.func_71036_o(); - } -+ } - } - else - { -@@ -267,7 +293,7 @@ - - super.func_70071_h_(); - -- if (!this.field_70170_p.field_72995_K && this.field_71070_bA != null && !this.field_71070_bA.func_75145_c(this)) -+ if (!this.field_70170_p.field_72995_K && this.field_71070_bA != null && !net.minecraftforge.common.ForgeHooks.canInteractWith(this, this.field_71070_bA)) - { - this.func_71053_j(); - this.field_71070_bA = this.field_71069_bz; -@@ -344,6 +370,7 @@ - { - this.func_70107_b(d3, this.field_70163_u, d4); - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPostTick(this); - } - - public int func_82145_z() -@@ -413,11 +440,13 @@ - int i = this.field_71074_e.field_77994_a; - ItemStack itemstack = this.field_71074_e.func_77950_b(this.field_70170_p, this); - -+ itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, field_71074_e, field_71072_f, itemstack); -+ - if (itemstack != this.field_71074_e || itemstack != null && itemstack.field_77994_a != i) - { - this.field_71071_by.field_70462_a[this.field_71071_by.field_70461_c] = itemstack; - -- if (itemstack.field_77994_a == 0) -+ if (itemstack != null && itemstack.field_77994_a == 0) - { - this.field_71071_by.field_70462_a[this.field_71071_by.field_70461_c] = null; - } -@@ -477,11 +506,11 @@ - this.field_71109_bG = 0.0F; - this.func_71015_k(this.field_70165_t - d0, this.field_70163_u - d1, this.field_70161_v - d2); - -- if (this.field_70154_o instanceof EntityPig) -+ if (this.field_70154_o instanceof EntityLivingBase && ((EntityLivingBase)field_70154_o).shouldRiderFaceForward(this)) - { - this.field_70125_A = f1; - this.field_70177_z = f; -- this.field_70761_aq = ((EntityPig)this.field_70154_o).field_70761_aq; -+ this.field_70761_aq = ((EntityLivingBase)this.field_70154_o).field_70761_aq; - } - } - } -@@ -611,11 +640,15 @@ - - public void func_70645_a(DamageSource p_70645_1_) - { -+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return; - super.func_70645_a(p_70645_1_); - this.func_70105_a(0.2F, 0.2F); - this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v); - this.field_70181_x = 0.10000000149011612D; - -+ captureDrops = true; -+ capturedDrops.clear(); -+ - if (this.func_70005_c_().equals("Notch")) - { - this.func_146097_a(new ItemStack(Items.field_151034_e, 1), true, false); -@@ -626,6 +659,9 @@ - this.field_71071_by.func_70436_m(); - } - -+ captureDrops = false; -+ if (!field_70170_p.field_72995_K) net.minecraftforge.event.ForgeEventFactory.onPlayerDrops(this, p_70645_1_, capturedDrops, field_70718_bc > 0); -+ - if (p_70645_1_ != null) - { - this.field_70159_w = (double)(-MathHelper.func_76134_b((this.field_70739_aP + this.field_70177_z) * (float)Math.PI / 180.0F) * 0.1F); -@@ -714,12 +750,25 @@ - - public EntityItem func_71040_bB(boolean p_71040_1_) - { -- return this.func_146097_a(this.field_71071_by.func_70298_a(this.field_71071_by.field_70461_c, p_71040_1_ && this.field_71071_by.func_70448_g() != null ? this.field_71071_by.func_70448_g().field_77994_a : 1), false, true); -+ ItemStack stack = field_71071_by.func_70448_g(); -+ -+ if (stack == null) -+ { -+ return null; -+ } -+ -+ if (stack.func_77973_b().onDroppedByPlayer(stack, this)) -+ { -+ int count = p_71040_1_ && this.field_71071_by.func_70448_g() != null ? this.field_71071_by.func_70448_g().field_77994_a : 1; -+ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, field_71071_by.func_70298_a(field_71071_by.field_70461_c, count), true); -+ } -+ -+ return null; - } - - public EntityItem func_71019_a(ItemStack p_71019_1_, boolean p_71019_2_) - { -- return this.func_146097_a(p_71019_1_, false, false); -+ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, p_71019_1_, false); - } - - public EntityItem func_146097_a(ItemStack p_146097_1_, boolean p_146097_2_, boolean p_146097_3_) -@@ -780,13 +829,25 @@ - - public void func_71012_a(EntityItem p_71012_1_) - { -+ if (captureDrops) -+ { -+ capturedDrops.add(p_71012_1_); -+ return; -+ } - this.field_70170_p.func_72838_d(p_71012_1_); - } - -+ @Deprecated //Use location sensitive version below - public float func_180471_a(Block p_180471_1_) - { -- float f = this.field_71071_by.func_146023_a(p_180471_1_); -+ return getBreakSpeed(p_180471_1_.func_176223_P(), new BlockPos(0, -1, 0)); -+ } - -+ public float getBreakSpeed(IBlockState state, BlockPos pos) -+ { -+ ItemStack stack = field_71071_by.func_70448_g(); -+ float f = (stack == null ? 1.0F : stack.func_77973_b().getDigSpeed(stack, state)); -+ - if (f > 1.0F) - { - int i = EnchantmentHelper.func_77509_b(this); -@@ -836,12 +897,13 @@ - f /= 5.0F; - } - -- return f; -+ f = net.minecraftforge.event.ForgeEventFactory.getBreakSpeed(this, state, f, pos); -+ return (f < 0 ? 0 : f); - } - - public boolean func_146099_a(Block p_146099_1_) - { -- return this.field_71071_by.func_146025_b(p_146099_1_); -+ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, p_146099_1_, this.field_71071_by.func_146025_b(p_146099_1_)); - } - - public void func_70037_a(NBTTagCompound p_70037_1_) -@@ -877,6 +939,16 @@ - this.field_82248_d = p_70037_1_.func_74767_n("SpawnForced"); - } - -+ NBTTagList spawnlist = null; -+ spawnlist = p_70037_1_.func_150295_c("Spawns", 10); -+ for (int i = 0; i < spawnlist.func_74745_c(); i++) -+ { -+ NBTTagCompound spawndata = (NBTTagCompound)spawnlist.func_150305_b(i); -+ int spawndim = spawndata.func_74762_e("Dim"); -+ this.spawnChunkMap.put(spawndim, new BlockPos(spawndata.func_74762_e("SpawnX"), spawndata.func_74762_e("SpawnY"), spawndata.func_74762_e("SpawnZ"))); -+ this.spawnForcedMap.put(spawndim, spawndata.func_74767_n("SpawnForced")); -+ } -+ - this.field_71100_bB.func_75112_a(p_70037_1_); - this.field_71075_bZ.func_75095_b(p_70037_1_); - -@@ -908,6 +980,23 @@ - p_70014_1_.func_74757_a("SpawnForced", this.field_82248_d); - } - -+ NBTTagList spawnlist = new NBTTagList(); -+ for (java.util.Map.Entry entry : this.spawnChunkMap.entrySet()) -+ { -+ BlockPos spawn = entry.getValue(); -+ if (spawn == null) continue; -+ Boolean forced = spawnForcedMap.get(entry.getKey()); -+ if (forced == null) forced = false; -+ NBTTagCompound spawndata = new NBTTagCompound(); -+ spawndata.func_74768_a("Dim", entry.getKey()); -+ spawndata.func_74768_a("SpawnX", spawn.func_177958_n()); -+ spawndata.func_74768_a("SpawnY", spawn.func_177956_o()); -+ spawndata.func_74768_a("SpawnZ", spawn.func_177952_p()); -+ spawndata.func_74757_a("SpawnForced", forced); -+ spawnlist.func_74742_a(spawndata); -+ } -+ p_70014_1_.func_74782_a("Spawns", spawnlist); -+ - this.field_71100_bB.func_75117_b(p_70014_1_); - this.field_71075_bZ.func_75091_a(p_70014_1_); - p_70014_1_.func_74782_a("EnderItems", this.field_71078_a.func_70487_g()); -@@ -921,6 +1010,7 @@ - - public boolean func_70097_a(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_)) - { - return false; -@@ -1021,12 +1111,15 @@ - { - if (!this.func_180431_b(p_70665_1_)) - { -+ p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, p_70665_1_, p_70665_2_); -+ if (p_70665_2_ <= 0) return; - if (!p_70665_1_.func_76363_c() && this.func_70632_aY() && p_70665_2_ > 0.0F) - { - p_70665_2_ = (1.0F + p_70665_2_) * 0.5F; - } - -- p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_); -+ p_70665_2_ = net.minecraftforge.common.ISpecialArmor.ArmorProperties.applyArmor(this, field_71071_by.field_70460_b, p_70665_1_, p_70665_2_); -+ if (p_70665_2_ <= 0) return; - p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_); - float f1 = p_70665_2_; - p_70665_2_ = Math.max(p_70665_2_ - this.func_110139_bj(), 0.0F); -@@ -1074,6 +1167,7 @@ - } - else - { -+ if (!net.minecraftforge.event.ForgeEventFactory.canInteractWith(this, p_70998_1_)) return false; - ItemStack itemstack = this.func_71045_bC(); - ItemStack itemstack1 = itemstack != null ? itemstack.func_77946_l() : null; - -@@ -1125,7 +1219,9 @@ - - public void func_71028_bD() - { -+ ItemStack orig = func_71045_bC(); - this.field_71071_by.func_70299_a(this.field_71071_by.field_70461_c, (ItemStack)null); -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, orig); - } - - public double func_70033_W() -@@ -1135,6 +1231,7 @@ - - public void func_71059_n(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)) -@@ -1305,6 +1402,8 @@ - - public EntityPlayer.EnumStatus func_180469_a(BlockPos p_180469_1_) - { -+ EntityPlayer.EnumStatus ret = net.minecraftforge.event.ForgeEventFactory.onPlayerSleepInBed(this, p_180469_1_); -+ if (ret != null) return ret; - if (!this.field_70170_p.field_72995_K) - { - if (this.func_70608_bn() || !this.func_70089_S()) -@@ -1346,7 +1445,7 @@ - - if (this.field_70170_p.func_175667_e(p_180469_1_)) - { -- EnumFacing enumfacing = (EnumFacing)this.field_70170_p.func_180495_p(p_180469_1_).func_177229_b(BlockDirectional.field_176387_N); -+ EnumFacing enumfacing = this.field_70170_p.func_180495_p(p_180469_1_).func_177230_c().getBedDirection(field_70170_p, p_180469_1_); - float f = 0.5F; - float f1 = 0.5F; - -@@ -1409,13 +1508,14 @@ - - public void func_70999_a(boolean p_70999_1_, boolean p_70999_2_, boolean p_70999_3_) - { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this, p_70999_1_, p_70999_2_, p_70999_3_); - this.func_70105_a(0.6F, 1.8F); - IBlockState iblockstate = this.field_70170_p.func_180495_p(this.field_71081_bT); - -- if (this.field_71081_bT != null && iblockstate.func_177230_c() == Blocks.field_150324_C) -+ if (this.field_71081_bT != null && iblockstate.func_177230_c().isBed(field_70170_p, field_71081_bT, this)) - { -- this.field_70170_p.func_180501_a(this.field_71081_bT, iblockstate.func_177226_a(BlockBed.field_176471_b, Boolean.valueOf(false)), 4); -- BlockPos blockpos = BlockBed.func_176468_a(this.field_70170_p, this.field_71081_bT, 0); -+ iblockstate.func_177230_c().setBedOccupied(field_70170_p, field_71081_bT, this, false); -+ BlockPos blockpos = iblockstate.func_177230_c().getBedSpawnPosition(field_70170_p, field_71081_bT, this); - - if (blockpos == null) - { -@@ -1442,12 +1542,12 @@ - - private boolean func_175143_p() - { -- return this.field_70170_p.func_180495_p(this.field_71081_bT).func_177230_c() == Blocks.field_150324_C; -+ return this.field_70170_p.func_180495_p(this.field_71081_bT).func_177230_c().isBed(field_70170_p, field_71081_bT, this); - } - - public static BlockPos func_180467_a(World p_180467_0_, BlockPos p_180467_1_, boolean p_180467_2_) - { -- if (p_180467_0_.func_180495_p(p_180467_1_).func_177230_c() != Blocks.field_150324_C) -+ if (!p_180467_0_.func_180495_p(p_180467_1_).func_177230_c().isBed(p_180467_0_, p_180467_1_, null)) - { - if (!p_180467_2_) - { -@@ -1464,7 +1564,7 @@ - } - else - { -- return BlockBed.func_176468_a(p_180467_0_, p_180467_1_, 0); -+ return p_180467_0_.func_180495_p(p_180467_1_).func_177230_c().getBedSpawnPosition(p_180467_0_, p_180467_1_, null); - } - } - -@@ -1473,7 +1573,7 @@ - { - if (this.field_71081_bT != null) - { -- EnumFacing enumfacing = (EnumFacing)this.field_70170_p.func_180495_p(this.field_71081_bT).func_177229_b(BlockDirectional.field_176387_N); -+ EnumFacing enumfacing = this.field_70170_p.func_180495_p(this.field_71081_bT).func_177230_c().getBedDirection(field_70170_p, field_71081_bT); - - switch (EntityPlayer.SwitchEnumFacing.field_179420_a[enumfacing.ordinal()]) - { -@@ -1511,16 +1611,23 @@ - - public BlockPos func_180470_cg() - { -- return this.field_71077_c; -+ return getBedLocation(this.field_71093_bK); - } - -+ @Deprecated - public boolean func_82245_bX() - { -- return this.field_82248_d; -+ return isSpawnForced(this.field_71093_bK); - } - - public void func_180473_a(BlockPos p_180473_1_, boolean p_180473_2_) - { -+ if(net.minecraftforge.event.ForgeEventFactory.onPlayerSpawnSet(this, p_180473_1_, p_180473_2_)) return; -+ if (this.field_71093_bK != 0) -+ { -+ setSpawnChunk(p_180473_1_, p_180473_2_, this.field_71093_bK); -+ return; -+ } - if (p_180473_1_ != null) - { - this.field_71077_c = p_180473_1_; -@@ -1702,6 +1809,10 @@ - - super.func_180430_e(p_180430_1_, p_180430_2_); - } -+ else -+ { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerFall(this, p_180430_1_, p_180430_2_); -+ } - } - - protected void func_71061_d_() -@@ -1725,6 +1836,7 @@ - } - - EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)EntityList.field_75627_a.get(Integer.valueOf(EntityList.func_75619_a(p_70074_1_))); -+ if (entityegginfo == null) entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.func_75621_b(p_70074_1_)); - - if (entityegginfo != null) - { -@@ -1837,6 +1949,8 @@ - { - if (p_71008_1_ != this.field_71074_e) - { -+ p_71008_2_ = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, p_71008_1_, p_71008_2_); -+ if (p_71008_2_ <= 0) return; - this.field_71074_e = p_71008_1_; - this.field_71072_f = p_71008_2_; - -@@ -1906,6 +2020,10 @@ - this.field_71106_cc = p_71049_1_.field_71106_cc; - this.func_85040_s(p_71049_1_.func_71037_bA()); - this.field_82152_aq = p_71049_1_.field_82152_aq; -+ //Copy and re-init ExtendedProperties when switching dimensions. -+ this.extendedProperties = p_71049_1_.extendedProperties; -+ for (net.minecraftforge.common.IExtendedEntityProperties p : this.extendedProperties.values()) -+ p.init(this, this.field_70170_p); - } - else if (this.field_70170_p.func_82736_K().func_82766_b("keepInventory")) - { -@@ -1918,6 +2036,18 @@ - - this.field_71078_a = p_71049_1_.field_71078_a; - this.func_70096_w().func_75692_b(10, Byte.valueOf(p_71049_1_.func_70096_w().func_75683_a(10))); -+ -+ this.spawnChunkMap = p_71049_1_.spawnChunkMap; -+ this.spawnForcedMap = p_71049_1_.spawnForcedMap; -+ -+ //Copy over a section of the Entity Data from the old player. -+ //Allows mods to specify data that persists after players respawn. -+ NBTTagCompound old = p_71049_1_.getEntityData(); -+ if (old.func_74764_b(PERSISTED_NBT_TAG)) -+ { -+ getEntityData().func_74782_a(PERSISTED_NBT_TAG, old.func_74775_l(PERSISTED_NBT_TAG)); -+ } -+ net.minecraftforge.event.ForgeEventFactory.onPlayerClone(this, p_71049_1_, !p_71049_2_); - } - - protected boolean func_70041_e_() -@@ -1951,7 +2081,14 @@ - - public void func_70062_b(int p_70062_1_, ItemStack p_70062_2_) - { -- this.field_71071_by.field_70460_b[p_70062_1_] = p_70062_2_; -+ if (p_70062_1_ == 0) //Forge: Fix issue in Player where it doen't take into account selected item -+ { -+ this.field_71071_by.field_70462_a[this.field_71071_by.field_70461_c] = p_70062_2_; -+ } -+ else -+ { -+ this.field_71071_by.field_70460_b[p_70062_1_ - 1] = p_70062_2_; -+ } - } - - @SideOnly(Side.CLIENT) -@@ -1996,7 +2133,10 @@ - - public IChatComponent func_145748_c_() - { -- ChatComponentText chatcomponenttext = new ChatComponentText(ScorePlayerTeam.func_96667_a(this.func_96124_cp(), this.func_70005_c_())); -+ ChatComponentText chatcomponenttext = new ChatComponentText(""); -+ if (!prefixes.isEmpty()) for (net.minecraft.util.IChatComponent prefix : prefixes) chatcomponenttext.func_150257_a(prefix); -+ chatcomponenttext.func_150257_a(new ChatComponentText(ScorePlayerTeam.func_96667_a(this.func_96124_cp(), this.getDisplayNameString()))); -+ if (!suffixes.isEmpty()) for (net.minecraft.util.IChatComponent suffix : suffixes) chatcomponenttext.func_150257_a(suffix); - chatcomponenttext.func_150256_b().func_150241_a(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.func_70005_c_() + " ")); - chatcomponenttext.func_150256_b().func_150209_a(this.func_174823_aP()); - chatcomponenttext.func_150256_b().func_179989_a(this.func_70005_c_()); -@@ -2005,7 +2145,7 @@ - - public float func_70047_e() - { -- float f = 1.62F; -+ float f = eyeHeight; - - if (this.func_70608_bn()) - { -@@ -2139,6 +2279,136 @@ - this.field_175153_bG = p_175150_1_; - } - -+ /** -+ * Opens a GUI with this player, uses FML's IGuiHandler system. -+ * Allows for extension by modders. -+ * -+ * @param mod The mod trying to open a GUI -+ * @param modGuiId GUI ID -+ * @param world Current World -+ * @param x Passed directly to IGuiHandler, data meaningless Typically world X position -+ * @param y Passed directly to IGuiHandler, data meaningless Typically world Y position -+ * @param z Passed directly to IGuiHandler, data meaningless Typically world Z position -+ */ -+ public void openGui(Object mod, int modGuiId, World world, int x, int y, int z) -+ { -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(this, mod, modGuiId, world, x, y, z); -+ } -+ -+ -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * A dimension aware version of getBedLocation. -+ * @param dimension The dimension to get the bed spawn for -+ * @return The player specific spawn location for the dimension. May be null. -+ */ -+ public BlockPos getBedLocation(int dimension) -+ { -+ return dimension == 0 ? field_71077_c : spawnChunkMap.get(dimension); -+ } -+ -+ /** -+ * A dimension aware version of isSpawnForced. -+ * Noramally isSpawnForced is used to determine if the respawn system should check for a bed or not. -+ * This just extends that to be dimension aware. -+ * @param dimension The dimension to get whether to check for a bed before spawning for -+ * @return The player specific spawn location for the dimension. May be null. -+ */ -+ public boolean isSpawnForced(int dimension) -+ { -+ if (dimension == 0) return this.field_82248_d; -+ Boolean forced = this.spawnForcedMap.get(dimension); -+ return forced == null ? false : forced; -+ } -+ -+ /** -+ * A dimension aware version of setSpawnChunk. -+ * This functions identically, but allows you to specify which dimension to affect, rather than affecting the player's current dimension. -+ * @param pos The spawn point to set as the player-specific spawn point for the dimension -+ * @param forced Whether or not the respawn code should check for a bed at this location (true means it won't check for a bed) -+ * @param dimension Which dimension to apply the player-specific respawn point to -+ */ -+ public void setSpawnChunk(BlockPos pos, boolean forced, int dimension) -+ { -+ if (dimension == 0) -+ { -+ if (pos != null) -+ { -+ field_71077_c = pos; -+ field_82248_d = forced; -+ } -+ else -+ { -+ field_71077_c = null; -+ field_82248_d = false; -+ } -+ return; -+ } -+ -+ if (pos != null) -+ { -+ spawnChunkMap.put(dimension, pos); -+ spawnForcedMap.put(dimension, forced); -+ } -+ else -+ { -+ spawnChunkMap.remove(dimension); -+ spawnForcedMap.remove(dimension); -+ } -+ } -+ -+ private String displayname; -+ -+ /** -+ * Returns the default eye height of the player -+ * @return player default eye height -+ */ -+ public float getDefaultEyeHeight() -+ { -+ return 1.62F; -+ } -+ -+ /** -+ * Get the currently computed display name, cached for efficiency. -+ * @return the current display name -+ */ -+ public String getDisplayNameString() -+ { -+ if(this.displayname == null) -+ { -+ this.displayname = ForgeEventFactory.getPlayerDisplayName(this, this.func_70005_c_()); -+ } -+ return this.displayname; -+ } -+ -+ /** -+ * Force the displayed name to refresh -+ */ -+ public void refreshDisplayName() -+ { -+ this.displayname = ForgeEventFactory.getPlayerDisplayName(this, this.func_70005_c_()); -+ } -+ -+ private final java.util.Collection prefixes = new java.util.LinkedList(); -+ private final java.util.Collection suffixes = new java.util.LinkedList(); -+ -+ /** -+ * Add a prefix to the player's username in chat -+ * @param prefix The prefix -+ */ -+ public void addPrefix(net.minecraft.util.IChatComponent prefix) { prefixes.add(prefix); } -+ -+ /** -+ * Add a suffix to the player's username in chat -+ * @param suffix The suffix -+ */ -+ public void addSuffix(net.minecraft.util.IChatComponent suffix) { suffixes.add(suffix); } -+ -+ public java.util.Collection getPrefixes() { return this.prefixes; } -+ public java.util.Collection getSuffixes() { return this.suffixes; } -+ -+ /* ======================================== FORGE END =====================================*/ -+ - public static enum EnumChatVisibility - { - FULL(0, "options.chat.visibility.full"), diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch deleted file mode 100644 index 7d6d0b6c8..000000000 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch +++ /dev/null @@ -1,92 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayerMP.java -+++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayerMP.java -@@ -127,14 +127,15 @@ - public boolean field_71136_j; - private static final String __OBFID = "CL_00001440"; - -+ @SuppressWarnings("unused") - public EntityPlayerMP(MinecraftServer p_i45285_1_, WorldServer p_i45285_2_, GameProfile p_i45285_3_, ItemInWorldManager p_i45285_4_) - { - super(p_i45285_2_, p_i45285_3_); - p_i45285_4_.field_73090_b = this; - this.field_71134_c = p_i45285_4_; -- BlockPos blockpos = p_i45285_2_.func_175694_M(); -+ BlockPos blockpos = p_i45285_2_.field_73011_w.getRandomizedSpawnPoint(); - -- if (!p_i45285_2_.field_73011_w.func_177495_o() && p_i45285_2_.func_72912_H().func_76077_q() != WorldSettings.GameType.ADVENTURE) -+ if (false && !p_i45285_2_.field_73011_w.func_177495_o() && p_i45285_2_.func_72912_H().func_76077_q() != WorldSettings.GameType.ADVENTURE) - { - int i = Math.max(5, p_i45285_1_.func_82357_ak() - 6); - int j = MathHelper.func_76128_c(p_i45285_2_.func_175723_af().func_177729_b((double)blockpos.func_177958_n(), (double)blockpos.func_177952_p())); -@@ -227,7 +228,7 @@ - - this.field_71070_bA.func_75142_b(); - -- if (!this.field_70170_p.field_72995_K && !this.field_71070_bA.func_75145_c(this)) -+ if (!this.field_70170_p.field_72995_K && !net.minecraftforge.common.ForgeHooks.canInteractWith(this, this.field_71070_bA)) - { - this.func_71053_j(); - this.field_71070_bA = this.field_71069_bz; -@@ -269,7 +270,8 @@ - if (chunk.func_150802_k()) - { - arraylist.add(chunk); -- arraylist1.addAll(((WorldServer)this.field_70170_p).func_147486_a(chunkcoordintpair.field_77276_a * 16, 0, chunkcoordintpair.field_77275_b * 16, chunkcoordintpair.field_77276_a * 16 + 16, 256, chunkcoordintpair.field_77275_b * 16 + 16)); -+ arraylist1.addAll(((WorldServer)this.field_70170_p).func_147486_a(chunkcoordintpair.field_77276_a * 16, 0, chunkcoordintpair.field_77275_b * 16, chunkcoordintpair.field_77276_a * 16 + 15, 256, chunkcoordintpair.field_77275_b * 16 + 15)); -+ //BugFix: 16 makes it load an extra chunk, which isn't associated with a player, which makes it not unload unless a player walks near it. - iterator1.remove(); - } - } -@@ -305,6 +307,7 @@ - { - chunk = (Chunk)iterator2.next(); - this.func_71121_q().func_73039_n().func_85172_a(this, chunk); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(chunk.func_76632_l(), this)); - } - } - } -@@ -440,6 +443,7 @@ - - public void func_70645_a(DamageSource p_70645_1_) - { -+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return; - if (this.field_70170_p.func_82736_K().func_82766_b("showDeathMessages")) - { - Team team = this.func_96124_cp(); -@@ -463,7 +467,20 @@ - - if (!this.field_70170_p.func_82736_K().func_82766_b("keepInventory")) - { -+ captureDrops = true; -+ capturedDrops.clear(); -+ - this.field_71071_by.func_70436_m(); -+ -+ captureDrops = false; -+ net.minecraftforge.event.entity.player.PlayerDropsEvent event = new net.minecraftforge.event.entity.player.PlayerDropsEvent(this, p_70645_1_, capturedDrops, field_70718_bc > 0); -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) -+ { -+ for (net.minecraft.entity.item.EntityItem item : capturedDrops) -+ { -+ func_71012_a(item); -+ } -+ } - } - - Collection collection = this.field_70170_p.func_96441_U().func_96520_a(IScoreObjectiveCriteria.field_96642_c); -@@ -481,6 +498,7 @@ - if (entitylivingbase != null) - { - EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)EntityList.field_75627_a.get(Integer.valueOf(EntityList.func_75619_a(entitylivingbase))); -+ if (entityegginfo == null) entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.func_75621_b(entitylivingbase)); - - if (entityegginfo != null) - { -@@ -849,6 +867,7 @@ - { - if (p_71064_1_ != null) - { -+ if (p_71064_1_.func_75967_d() && net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.AchievementEvent(this, (net.minecraft.stats.Achievement) p_71064_1_))) return; - this.field_147103_bO.func_150871_b(this, p_71064_1_, p_71064_2_); - Iterator iterator = this.func_96123_co().func_96520_a(p_71064_1_.func_150952_k()).iterator(); - diff --git a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch deleted file mode 100644 index 49675d1be..000000000 --- a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/player/InventoryPlayer.java -+++ ../src-work/minecraft/net/minecraft/entity/player/InventoryPlayer.java -@@ -319,6 +319,14 @@ - this.field_70462_a[i].func_77945_a(this.field_70458_d.field_70170_p, this.field_70458_d, i, this.field_70461_c == i); - } - } -+ -+ for (int i = 0; i < field_70460_b.length; i++) -+ { -+ if (field_70460_b[i] != null) -+ { -+ field_70460_b[i].func_77973_b().onArmorTick(field_70458_d.field_70170_p, field_70458_d, field_70460_b[i]); -+ } -+ } - } - - public boolean func_146026_a(Item p_146026_1_) diff --git a/patches/minecraft/net/minecraft/init/Bootstrap.java.patch b/patches/minecraft/net/minecraft/init/Bootstrap.java.patch deleted file mode 100644 index 68b643c96..000000000 --- a/patches/minecraft/net/minecraft/init/Bootstrap.java.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/init/Bootstrap.java -+++ ../src-work/minecraft/net/minecraft/init/Bootstrap.java -@@ -67,6 +67,7 @@ - return field_151355_a; - } - -+ @SuppressWarnings("unused") - static void func_151353_a() - { - BlockDispenser.field_149943_a.func_82595_a(Items.field_151032_g, new BehaviorProjectileDispense() -@@ -144,7 +145,7 @@ - double d0 = p_82487_1_.func_82615_a() + (double)enumfacing.func_82601_c(); - double d1 = (double)((float)p_82487_1_.func_180699_d().func_177956_o() + 0.2F); - double d2 = p_82487_1_.func_82616_c() + (double)enumfacing.func_82599_e(); -- Entity entity = ItemMonsterPlacer.func_77840_a(p_82487_1_.func_82618_k(), p_82487_2_.func_77960_j(), d0, d1, d2); -+ Entity entity = ItemMonsterPlacer.spawnCreature(p_82487_1_.func_82618_k(), ItemMonsterPlacer.getEntityName(p_82487_2_), d0, d1, d2); - - if (entity instanceof EntityLivingBase && p_82487_2_.func_82837_s()) - { -@@ -509,6 +510,7 @@ - } - } - }); -+ if (false){ //Forge: Removed, Fixes MC-75630 - Exploit with signs and command blocks - BlockDispenser.field_149943_a.func_82595_a(Item.func_150898_a(Blocks.field_150483_bI), new BehaviorDefaultDispenseItem() - { - private static final String __OBFID = "CL_00002276"; -@@ -535,6 +537,7 @@ - protected void func_82485_a(IBlockSource p_82485_1_) {} - protected void func_82489_a(IBlockSource p_82489_1_, EnumFacing p_82489_2_) {} - }); -+ } - } - - public static void func_151354_b() diff --git a/patches/minecraft/net/minecraft/inventory/Container.java.patch b/patches/minecraft/net/minecraft/inventory/Container.java.patch deleted file mode 100644 index 0b289ff59..000000000 --- a/patches/minecraft/net/minecraft/inventory/Container.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/Container.java -+++ ../src-work/minecraft/net/minecraft/inventory/Container.java -@@ -624,7 +624,7 @@ - slot = (Slot)this.field_75151_b.get(k); - itemstack1 = slot.func_75211_c(); - -- if (itemstack1 == null) -+ if (itemstack1 == null && slot.func_75214_a(p_75135_1_)) // Forge: Make sure to respect isItemValid in the slot. - { - slot.func_75215_d(p_75135_1_.func_77946_l()); - slot.func_75218_e(); diff --git a/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch deleted file mode 100644 index 8f34fa6a9..000000000 --- a/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerBeacon.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerBeacon.java -@@ -132,7 +132,7 @@ - - public boolean func_75214_a(ItemStack p_75214_1_) - { -- return p_75214_1_ == null ? false : p_75214_1_.func_77973_b() == Items.field_151166_bC || p_75214_1_.func_77973_b() == Items.field_151045_i || p_75214_1_.func_77973_b() == Items.field_151043_k || p_75214_1_.func_77973_b() == Items.field_151042_j; -+ return p_75214_1_ == null ? false : p_75214_1_.func_77973_b().isBeaconPayment(p_75214_1_); - } - - public int func_75219_a() diff --git a/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch deleted file mode 100644 index e281d7c01..000000000 --- a/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerBrewingStand.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerBrewingStand.java -@@ -158,7 +158,7 @@ - - public boolean func_75214_a(ItemStack p_75214_1_) - { -- return p_75214_1_ != null ? p_75214_1_.func_77973_b().func_150892_m(p_75214_1_) : false; -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(p_75214_1_); - } - - public int func_75219_a() -@@ -190,7 +190,7 @@ - - public void func_82870_a(EntityPlayer p_82870_1_, ItemStack p_82870_2_) - { -- if (p_82870_2_.func_77973_b() == Items.field_151068_bn && p_82870_2_.func_77960_j() > 0) -+ if (p_82870_2_.func_77973_b() instanceof net.minecraft.item.ItemPotion && p_82870_2_.func_77960_j() > 0) - { - this.field_75244_a.func_71029_a(AchievementList.field_76001_A); - } -@@ -200,7 +200,7 @@ - - public static boolean func_75243_a_(ItemStack p_75243_0_) - { -- return p_75243_0_ != null && (p_75243_0_.func_77973_b() == Items.field_151068_bn || p_75243_0_.func_77973_b() == Items.field_151069_bo); -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_75243_0_); - } - } - } diff --git a/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch deleted file mode 100644 index 2637c44fd..000000000 --- a/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerPlayer.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerPlayer.java -@@ -47,7 +47,8 @@ - } - public boolean func_75214_a(ItemStack p_75214_1_) - { -- return p_75214_1_ == null ? false : (p_75214_1_.func_77973_b() instanceof ItemArmor ? ((ItemArmor)p_75214_1_.func_77973_b()).field_77881_a == k : (p_75214_1_.func_77973_b() != Item.func_150898_a(Blocks.field_150423_aK) && p_75214_1_.func_77973_b() != Items.field_151144_bL ? false : k == 0)); -+ if (p_75214_1_ == null) return false; -+ return p_75214_1_.func_77973_b().isValidArmor(p_75214_1_, k, field_82862_h); - } - @SideOnly(Side.CLIENT) - public String func_178171_c() diff --git a/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch deleted file mode 100644 index fb6952611..000000000 --- a/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerRepair.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerRepair.java -@@ -73,6 +73,8 @@ - p_82870_1_.func_82242_a(-ContainerRepair.this.field_82854_e); - } - -+ float breakChance = net.minecraftforge.common.ForgeHooks.onAnvilRepair(p_82870_1_, p_82870_2_, ContainerRepair.this.field_82853_g.func_70301_a(0), ContainerRepair.this.field_82853_g.func_70301_a(1)); -+ - ContainerRepair.this.field_82853_g.func_70299_a(0, (ItemStack)null); - - if (ContainerRepair.this.field_82856_l > 0) -@@ -97,7 +99,7 @@ - ContainerRepair.this.field_82854_e = 0; - IBlockState iblockstate = p_i45807_2_.func_180495_p(p_i45807_3_); - -- if (!p_82870_1_.field_71075_bZ.field_75098_d && !p_i45807_2_.field_72995_K && iblockstate.func_177230_c() == Blocks.field_150467_bQ && p_82870_1_.func_70681_au().nextFloat() < 0.12F) -+ if (!p_82870_1_.field_71075_bZ.field_75098_d && !p_i45807_2_.field_72995_K && iblockstate.func_177230_c() == Blocks.field_150467_bQ && p_82870_1_.func_70681_au().nextFloat() < breakChance) - { - int k = ((Integer)iblockstate.func_177229_b(BlockAnvil.field_176505_b)).intValue(); - ++k; -@@ -177,6 +179,7 @@ - - if (itemstack2 != null) - { -+ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, field_82852_f, field_82857_m, i2)) return; - flag7 = itemstack2.func_77973_b() == Items.field_151134_bR && Items.field_151134_bR.func_92110_g(itemstack2).func_74745_c() > 0; - int k; - int l; -@@ -271,7 +274,8 @@ - { - int l1 = ((Integer)iterator.next()).intValue(); - -- if (l1 != l && !enchantment.func_77326_a(Enchantment.func_180306_c(l1))) -+ Enchantment e2 = Enchantment.func_180306_c(l1); -+ if (l1 != l && !(enchantment.func_77326_a(e2) && e2.func_77326_a(enchantment))) //Forge BugFix: Let Both enchantments veto being together - { - flag8 = false; - ++i; -@@ -322,6 +326,8 @@ - } - } - -+ if (flag7 && !itemstack1.func_77973_b().isBookEnchantable(itemstack1, itemstack2)) itemstack1 = null; -+ - if (StringUtils.isBlank(this.field_82857_m)) - { - if (itemstack.func_82837_s()) diff --git a/patches/minecraft/net/minecraft/item/ItemArmor.java.patch b/patches/minecraft/net/minecraft/item/ItemArmor.java.patch deleted file mode 100644 index 15adcb5a1..000000000 --- a/patches/minecraft/net/minecraft/item/ItemArmor.java.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemArmor.java -+++ ../src-work/minecraft/net/minecraft/item/ItemArmor.java -@@ -38,7 +38,7 @@ - if (list.size() > 0) - { - EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0); -- int l = entitylivingbase instanceof EntityPlayer ? 1 : 0; -+ int l = 0;// Forge: We fix the indexes. Mojang Stop hard coding this! - int i1 = EntityLiving.func_82159_b(p_82487_2_); - ItemStack itemstack1 = p_82487_2_.func_77946_l(); - itemstack1.field_77994_a = 1; -@@ -192,7 +192,7 @@ - - if (itemstack1 == null) - { -- p_77659_3_.func_70062_b(i, p_77659_1_.func_77946_l()); -+ p_77659_3_.func_70062_b(i + 1, p_77659_1_.func_77946_l()); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. - p_77659_1_.field_77994_a = 0; - } - -@@ -213,6 +213,9 @@ - - private static final String __OBFID = "CL_00001768"; - -+ //Added by forge for custom Armor materials. -+ public Item customCraftingMaterial = null; -+ - private ArmorMaterial(String p_i45789_3_, int p_i45789_4_, int[] p_i45789_5_, int p_i45789_6_) - { - this.field_179243_f = p_i45789_3_; -@@ -238,7 +241,15 @@ - - public Item func_151685_b() - { -- return this == LEATHER ? Items.field_151116_aA : (this == CHAIN ? Items.field_151042_j : (this == GOLD ? Items.field_151043_k : (this == IRON ? Items.field_151042_j : (this == DIAMOND ? Items.field_151045_i : null)))); -+ switch (this) -+ { -+ case LEATHER: return Items.field_151116_aA; -+ case CHAIN: return Items.field_151042_j; -+ case GOLD: return Items.field_151043_k; -+ case IRON: return Items.field_151042_j; -+ case DIAMOND: return Items.field_151045_i; -+ default: return customCraftingMaterial; -+ } - } - - @SideOnly(Side.CLIENT) diff --git a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch deleted file mode 100644 index 26420ad34..000000000 --- a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch +++ /dev/null @@ -1,72 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemBlock.java -+++ ../src-work/minecraft/net/minecraft/item/ItemBlock.java -@@ -63,16 +63,8 @@ - int i = this.func_77647_b(p_180614_1_.func_77960_j()); - IBlockState iblockstate1 = this.field_150939_a.func_180642_a(p_180614_3_, p_180614_4_, p_180614_5_, p_180614_6_, p_180614_7_, p_180614_8_, i, p_180614_2_); - -- if (p_180614_3_.func_180501_a(p_180614_4_, iblockstate1, 3)) -+ if (placeBlockAt(p_180614_1_, p_180614_2_, p_180614_3_, p_180614_4_, p_180614_5_, p_180614_6_, p_180614_7_, p_180614_8_, iblockstate1)) - { -- iblockstate1 = p_180614_3_.func_180495_p(p_180614_4_); -- -- if (iblockstate1.func_177230_c() == this.field_150939_a) -- { -- func_179224_a(p_180614_3_, p_180614_4_, p_180614_1_); -- this.field_150939_a.func_180633_a(p_180614_3_, p_180614_4_, iblockstate1, p_180614_2_, p_180614_1_); -- } -- - p_180614_3_.func_72908_a((double)((float)p_180614_4_.func_177958_n() + 0.5F), (double)((float)p_180614_4_.func_177956_o() + 0.5F), (double)((float)p_180614_4_.func_177952_p() + 0.5F), this.field_150939_a.field_149762_H.func_150496_b(), (this.field_150939_a.field_149762_H.func_150497_c() + 1.0F) / 2.0F, this.field_150939_a.field_149762_H.func_150494_d() * 0.8F); - --p_180614_1_.field_77994_a; - } -@@ -85,14 +77,24 @@ - } - } - -+ @Deprecated //Use player sensitive version - public static boolean func_179224_a(World p_179224_0_, BlockPos p_179224_1_, ItemStack p_179224_2_) - { -+ return setTileEntityNBT(p_179224_0_, p_179224_1_, p_179224_2_, null); -+ } -+ public static boolean setTileEntityNBT(World p_179224_0_, BlockPos p_179224_1_, ItemStack p_179224_2_, EntityPlayer player) -+ { - if (p_179224_2_.func_77942_o() && p_179224_2_.func_77978_p().func_150297_b("BlockEntityTag", 10)) - { - TileEntity tileentity = p_179224_0_.func_175625_s(p_179224_1_); - - if (tileentity != null) - { -+ //Forge: Fixes MC-75630 - Exploit with signs and command blocks -+ final net.minecraft.server.MinecraftServer server = net.minecraft.server.MinecraftServer.func_71276_C(); -+ if (!p_179224_0_.field_72995_K && tileentity.restrictNBTCopy() && -+ (server == null || !server.func_71203_ab().func_152596_g(player.func_146103_bH()))) -+ return false; - NBTTagCompound nbttagcompound = new NBTTagCompound(); - NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttagcompound.func_74737_b(); - tileentity.func_145841_b(nbttagcompound); -@@ -157,4 +159,26 @@ - { - return this.field_150939_a; - } -+ -+ /** -+ * Called to actually place the block, after the location is determined -+ * and all permission checks have been made. -+ * -+ * @param stack The item stack that was used to place the block. This can be changed inside the method. -+ * @param player The player who is placing the block. Can be null if the block is not being placed by a player. -+ * @param side The side the player (or machine) right-clicked on. -+ */ -+ public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) -+ { -+ if (!world.func_180501_a(pos, newState, 3)) return false; -+ -+ IBlockState state = world.func_180495_p(pos); -+ if (state.func_177230_c() == this.field_150939_a) -+ { -+ setTileEntityNBT(world, pos, stack, player); -+ this.field_150939_a.func_180633_a(world, pos, state, player, stack); -+ } -+ -+ return true; -+ } - } diff --git a/patches/minecraft/net/minecraft/item/ItemBow.java.patch b/patches/minecraft/net/minecraft/item/ItemBow.java.patch deleted file mode 100644 index 44892d370..000000000 --- a/patches/minecraft/net/minecraft/item/ItemBow.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemBow.java -+++ ../src-work/minecraft/net/minecraft/item/ItemBow.java -@@ -23,11 +23,15 @@ - - public void func_77615_a(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_) - { -+ int j = this.func_77626_a(p_77615_1_) - p_77615_4_; -+ net.minecraftforge.event.entity.player.ArrowLooseEvent event = new net.minecraftforge.event.entity.player.ArrowLooseEvent(p_77615_3_, p_77615_1_, j); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; -+ j = event.charge; -+ - boolean flag = p_77615_3_.field_71075_bZ.field_75098_d || EnchantmentHelper.func_77506_a(Enchantment.field_77342_w.field_77352_x, p_77615_1_) > 0; - - if (flag || p_77615_3_.field_71071_by.func_146028_b(Items.field_151032_g)) - { -- int j = this.func_77626_a(p_77615_1_) - p_77615_4_; - float f = (float)j / 20.0F; - f = (f * f + f * 2.0F) / 3.0F; - -@@ -105,6 +109,9 @@ - - public ItemStack func_77659_a(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) - { -+ net.minecraftforge.event.entity.player.ArrowNockEvent event = new net.minecraftforge.event.entity.player.ArrowNockEvent(p_77659_3_, p_77659_1_); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return event.result; -+ - if (p_77659_3_.field_71075_bZ.field_75098_d || p_77659_3_.field_71071_by.func_146028_b(Items.field_151032_g)) - { - p_77659_3_.func_71008_a(p_77659_1_, this.func_77626_a(p_77659_1_)); diff --git a/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch b/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch deleted file mode 100644 index 4fa7c76aa..000000000 --- a/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemBucketMilk.java -+++ ../src-work/minecraft/net/minecraft/item/ItemBucketMilk.java -@@ -25,7 +25,7 @@ - - if (!p_77654_2_.field_72995_K) - { -- p_77654_3_.func_70674_bp(); -+ p_77654_3_.curePotionEffects(p_77654_1_); - } - - p_77654_3_.func_71029_a(StatList.field_75929_E[Item.func_150891_b(this)]); diff --git a/patches/minecraft/net/minecraft/item/ItemDye.java.patch b/patches/minecraft/net/minecraft/item/ItemDye.java.patch deleted file mode 100644 index 68f1abec6..000000000 --- a/patches/minecraft/net/minecraft/item/ItemDye.java.patch +++ /dev/null @@ -1,56 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemDye.java -+++ ../src-work/minecraft/net/minecraft/item/ItemDye.java -@@ -48,7 +48,7 @@ - - if (enumdyecolor == EnumDyeColor.WHITE) - { -- if (func_179234_a(p_180614_1_, p_180614_3_, p_180614_4_)) -+ if (applyBonemeal(p_180614_1_, p_180614_3_, p_180614_4_, p_180614_2_)) - { - if (!p_180614_3_.field_72995_K) - { -@@ -98,8 +98,18 @@ - - public static boolean func_179234_a(ItemStack p_179234_0_, World p_179234_1_, BlockPos p_179234_2_) - { -+ if (p_179234_1_ instanceof net.minecraft.world.WorldServer) -+ return applyBonemeal(p_179234_0_, p_179234_1_, p_179234_2_, net.minecraftforge.common.util.FakePlayerFactory.getMinecraft((net.minecraft.world.WorldServer)p_179234_1_)); -+ return false; -+ } -+ -+ public static boolean applyBonemeal(ItemStack p_179234_0_, World p_179234_1_, BlockPos p_179234_2_, EntityPlayer player) -+ { - IBlockState iblockstate = p_179234_1_.func_180495_p(p_179234_2_); - -+ int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, p_179234_1_, p_179234_2_, iblockstate, p_179234_0_); -+ if (hook != 0) return hook > 0; -+ - if (iblockstate.func_177230_c() instanceof IGrowable) - { - IGrowable igrowable = (IGrowable)iblockstate.func_177230_c(); -@@ -133,7 +143,7 @@ - - Block block = p_180617_0_.func_180495_p(p_180617_1_).func_177230_c(); - -- if (block.func_149688_o() != Material.field_151579_a) -+ if (block.isAir(p_180617_0_, p_180617_1_)) - { - block.func_180654_a(p_180617_0_, p_180617_1_); - -@@ -145,6 +155,16 @@ - p_180617_0_.func_175688_a(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)p_180617_1_.func_177958_n() + field_77697_d.nextFloat()), (double)p_180617_1_.func_177956_o() + (double)field_77697_d.nextFloat() * block.func_149669_A(), (double)((float)p_180617_1_.func_177952_p() + field_77697_d.nextFloat()), d0, d1, d2, new int[0]); - } - } -+ else -+ { -+ for (int i1 = 0; i1 < p_180617_2_; ++i1) -+ { -+ double d0 = field_77697_d.nextGaussian() * 0.02D; -+ double d1 = field_77697_d.nextGaussian() * 0.02D; -+ double d2 = field_77697_d.nextGaussian() * 0.02D; -+ p_180617_0_.func_175688_a(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)p_180617_1_.func_177958_n() + field_77697_d.nextFloat()), (double)p_180617_1_.func_177956_o() + (double)field_77697_d.nextFloat() * 1.0f, (double)((float)p_180617_1_.func_177952_p() + field_77697_d.nextFloat()), d0, d1, d2, new int[0]); -+ } -+ } - } - - public boolean func_111207_a(ItemStack p_111207_1_, EntityPlayer p_111207_2_, EntityLivingBase p_111207_3_) diff --git a/patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch b/patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch deleted file mode 100644 index dce46dfd0..000000000 --- a/patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemEmptyMap.java -+++ ../src-work/minecraft/net/minecraft/item/ItemEmptyMap.java -@@ -24,7 +24,7 @@ - p_77659_2_.func_72823_a(s, mapdata); - mapdata.field_76197_d = 0; - mapdata.func_176054_a(p_77659_3_.field_70165_t, p_77659_3_.field_70161_v, mapdata.field_76197_d); -- mapdata.field_76200_c = (byte)p_77659_2_.field_73011_w.func_177502_q(); -+ mapdata.field_76200_c = p_77659_2_.field_73011_w.func_177502_q(); - mapdata.func_76185_a(); - --p_77659_1_.field_77994_a; - diff --git a/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch b/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch deleted file mode 100644 index cf8ab0013..000000000 --- a/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemFlintAndSteel.java -+++ ../src-work/minecraft/net/minecraft/item/ItemFlintAndSteel.java -@@ -29,7 +29,7 @@ - } - else - { -- if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().func_149688_o() == Material.field_151579_a) -+ if (p_180614_3_.func_175623_d(p_180614_4_)) - { - p_180614_3_.func_72908_a((double)p_180614_4_.func_177958_n() + 0.5D, (double)p_180614_4_.func_177956_o() + 0.5D, (double)p_180614_4_.func_177952_p() + 0.5D, "fire.ignite", 1.0F, field_77697_d.nextFloat() * 0.4F + 0.8F); - p_180614_3_.func_175656_a(p_180614_4_, Blocks.field_150480_ab.func_176223_P()); diff --git a/patches/minecraft/net/minecraft/item/ItemHoe.java.patch b/patches/minecraft/net/minecraft/item/ItemHoe.java.patch deleted file mode 100644 index 3d3e201ef..000000000 --- a/patches/minecraft/net/minecraft/item/ItemHoe.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemHoe.java -+++ ../src-work/minecraft/net/minecraft/item/ItemHoe.java -@@ -34,10 +34,13 @@ - } - else - { -+ int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(p_180614_1_, p_180614_2_, p_180614_3_, p_180614_4_); -+ if (hook != 0) return hook > 0; -+ - IBlockState iblockstate = p_180614_3_.func_180495_p(p_180614_4_); - Block block = iblockstate.func_177230_c(); - -- if (p_180614_5_ != EnumFacing.DOWN && p_180614_3_.func_180495_p(p_180614_4_.func_177984_a()).func_177230_c().func_149688_o() == Material.field_151579_a) -+ if (p_180614_5_ != EnumFacing.DOWN && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) - { - if (block == Blocks.field_150349_c) - { diff --git a/patches/minecraft/net/minecraft/item/ItemMap.java.patch b/patches/minecraft/net/minecraft/item/ItemMap.java.patch deleted file mode 100644 index 9201f5bba..000000000 --- a/patches/minecraft/net/minecraft/item/ItemMap.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemMap.java -+++ ../src-work/minecraft/net/minecraft/item/ItemMap.java -@@ -58,7 +58,7 @@ - mapdata = new MapData(s); - mapdata.field_76197_d = 3; - mapdata.func_176054_a((double)p_77873_2_.func_72912_H().func_76079_c(), (double)p_77873_2_.func_72912_H().func_76074_e(), mapdata.field_76197_d); -- mapdata.field_76200_c = (byte)p_77873_2_.field_73011_w.func_177502_q(); -+ mapdata.field_76200_c = p_77873_2_.field_73011_w.func_177502_q(); - mapdata.func_76185_a(); - p_77873_2_.func_72823_a(s, mapdata); - } diff --git a/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch b/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch deleted file mode 100644 index 700d90d00..000000000 --- a/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch +++ /dev/null @@ -1,107 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemMonsterPlacer.java -+++ ../src-work/minecraft/net/minecraft/item/ItemMonsterPlacer.java -@@ -39,7 +39,7 @@ - public String func_77653_i(ItemStack p_77653_1_) - { - String s = ("" + StatCollector.func_74838_a(this.func_77658_a() + ".name")).trim(); -- String s1 = EntityList.func_75617_a(p_77653_1_.func_77960_j()); -+ String s1 = ItemMonsterPlacer.getEntityName(p_77653_1_); - - if (s1 != null) - { -@@ -52,7 +52,7 @@ - @SideOnly(Side.CLIENT) - public int func_82790_a(ItemStack p_82790_1_, int p_82790_2_) - { -- EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)EntityList.field_75627_a.get(Integer.valueOf(p_82790_1_.func_77960_j())); -+ EntityList.EntityEggInfo entityegginfo = ItemMonsterPlacer.getEggInfo(p_82790_1_); - return entityegginfo != null ? (p_82790_2_ == 0 ? entityegginfo.field_75611_b : entityegginfo.field_75612_c) : 16777215; - } - -@@ -77,7 +77,7 @@ - if (tileentity instanceof TileEntityMobSpawner) - { - MobSpawnerBaseLogic mobspawnerbaselogic = ((TileEntityMobSpawner)tileentity).func_145881_a(); -- mobspawnerbaselogic.func_98272_a(EntityList.func_75617_a(p_180614_1_.func_77960_j())); -+ mobspawnerbaselogic.func_98272_a(ItemMonsterPlacer.getEntityName(p_180614_1_)); - tileentity.func_70296_d(); - p_180614_3_.func_175689_h(p_180614_4_); - -@@ -98,7 +98,7 @@ - d0 = 0.5D; - } - -- Entity entity = func_77840_a(p_180614_3_, p_180614_1_.func_77960_j(), (double)p_180614_4_.func_177958_n() + 0.5D, (double)p_180614_4_.func_177956_o() + d0, (double)p_180614_4_.func_177952_p() + 0.5D); -+ Entity entity = spawnCreature(p_180614_3_, ItemMonsterPlacer.getEntityName(p_180614_1_), (double)p_180614_4_.func_177958_n() + 0.5D, (double)p_180614_4_.func_177956_o() + d0, (double)p_180614_4_.func_177952_p() + 0.5D); - - if (entity != null) - { -@@ -149,7 +149,7 @@ - - if (p_77659_2_.func_180495_p(blockpos).func_177230_c() instanceof BlockLiquid) - { -- Entity entity = func_77840_a(p_77659_2_, p_77659_1_.func_77960_j(), (double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D); -+ Entity entity = spawnCreature(p_77659_2_, ItemMonsterPlacer.getEntityName(p_77659_1_), (double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D); - - if (entity != null) - { -@@ -173,19 +173,29 @@ - } - } - -+ @Deprecated // Use string version below. - public static Entity func_77840_a(World p_77840_0_, int p_77840_1_, double p_77840_2_, double p_77840_4_, double p_77840_6_) - { - if (!EntityList.field_75627_a.containsKey(Integer.valueOf(p_77840_1_))) - { - return null; - } -+ return spawnCreature(p_77840_0_, EntityList.func_75617_a(p_77840_1_), p_77840_2_, p_77840_4_, p_77840_6_); -+ } -+ -+ public static Entity spawnCreature(World p_77840_0_, String name, double p_77840_2_, double p_77840_4_, double p_77840_6_) -+ { -+ if (!EntityList.field_75625_b.containsKey(name)) -+ { -+ return null; -+ } - else - { - Entity entity = null; - - for (int j = 0; j < 1; ++j) - { -- entity = EntityList.func_75616_a(p_77840_1_, p_77840_0_); -+ entity = EntityList.func_75620_a(name, p_77840_0_); - - if (entity instanceof EntityLivingBase) - { -@@ -213,5 +223,28 @@ - EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)iterator.next(); - p_150895_3_.add(new ItemStack(p_150895_1_, 1, entityegginfo.field_75613_a)); - } -+ -+ for (String name : net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().keySet()) -+ { -+ ItemStack stack = new ItemStack(p_150895_1_); -+ net.minecraft.nbt.NBTTagCompound nbt = new net.minecraft.nbt.NBTTagCompound(); -+ nbt.func_74778_a("entity_name", name); -+ stack.func_77982_d(nbt); -+ p_150895_3_.add(stack); -+ } - } -+ -+ public static String getEntityName(ItemStack stack) -+ { -+ if (stack.func_77942_o() && stack.func_77978_p().func_150297_b("entity_name", 8)) -+ return stack.func_77978_p().func_74779_i("entity_name"); -+ return EntityList.func_75617_a(stack.func_77960_j()); -+ } -+ -+ private static EntityList.EntityEggInfo getEggInfo(ItemStack stack) -+ { -+ if (stack.func_77942_o() && stack.func_77978_p().func_150297_b("entity_name", 8)) -+ return net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(stack.func_77978_p().func_74779_i("entity_name")); -+ return (EntityList.EntityEggInfo)EntityList.field_75627_a.get(stack.func_77960_j()); -+ } - } diff --git a/patches/minecraft/net/minecraft/item/ItemReed.java.patch b/patches/minecraft/net/minecraft/item/ItemReed.java.patch deleted file mode 100644 index 9d6bcb61a..000000000 --- a/patches/minecraft/net/minecraft/item/ItemReed.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemReed.java -+++ ../src-work/minecraft/net/minecraft/item/ItemReed.java -@@ -54,7 +54,7 @@ - - if (iblockstate1.func_177230_c() == this.field_150935_a) - { -- ItemBlock.func_179224_a(p_180614_3_, p_180614_4_, p_180614_1_); -+ ItemBlock.setTileEntityNBT(p_180614_3_, p_180614_4_, p_180614_1_, p_180614_2_); - iblockstate1.func_177230_c().func_180633_a(p_180614_3_, p_180614_4_, iblockstate1, p_180614_2_, p_180614_1_); - } - diff --git a/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch b/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch deleted file mode 100644 index eef2fbf14..000000000 --- a/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemSeeds.java -+++ ../src-work/minecraft/net/minecraft/item/ItemSeeds.java -@@ -7,7 +7,7 @@ - import net.minecraft.util.EnumFacing; - import net.minecraft.world.World; - --public class ItemSeeds extends Item -+public class ItemSeeds extends Item implements net.minecraftforge.common.IPlantable - { - private Block field_150925_a; - private Block field_77838_b; -@@ -30,7 +30,7 @@ - { - return false; - } -- else if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c() == this.field_77838_b && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) -+ else if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().canSustainPlant(p_180614_3_, p_180614_4_, EnumFacing.UP, this) && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) - { - p_180614_3_.func_175656_a(p_180614_4_.func_177984_a(), this.field_150925_a.func_176223_P()); - --p_180614_1_.field_77994_a; -@@ -41,4 +41,16 @@ - return false; - } - } -+ -+ @Override -+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ return this.field_150925_a == net.minecraft.init.Blocks.field_150388_bm ? net.minecraftforge.common.EnumPlantType.Nether : net.minecraftforge.common.EnumPlantType.Crop; -+ } -+ -+ @Override -+ public net.minecraft.block.state.IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ return this.field_150925_a.func_176223_P(); -+ } - } diff --git a/patches/minecraft/net/minecraft/item/ItemShears.java.patch b/patches/minecraft/net/minecraft/item/ItemShears.java.patch deleted file mode 100644 index a4053e0c8..000000000 --- a/patches/minecraft/net/minecraft/item/ItemShears.java.patch +++ /dev/null @@ -1,89 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemShears.java -+++ ../src-work/minecraft/net/minecraft/item/ItemShears.java -@@ -21,13 +21,12 @@ - - public boolean func_179218_a(ItemStack p_179218_1_, World p_179218_2_, Block p_179218_3_, BlockPos p_179218_4_, EntityLivingBase p_179218_5_) - { -- if (p_179218_3_.func_149688_o() != Material.field_151584_j && p_179218_3_ != Blocks.field_150321_G && p_179218_3_ != Blocks.field_150329_H && p_179218_3_ != Blocks.field_150395_bd && p_179218_3_ != Blocks.field_150473_bD && p_179218_3_ != Blocks.field_150325_L) -+ if (p_179218_3_.func_149688_o() != Material.field_151584_j && p_179218_3_ != Blocks.field_150321_G && p_179218_3_ != Blocks.field_150329_H && p_179218_3_ != Blocks.field_150395_bd && p_179218_3_ != Blocks.field_150473_bD && p_179218_3_ != Blocks.field_150325_L && !(p_179218_3_ instanceof net.minecraftforge.common.IShearable)) - { - return super.func_179218_a(p_179218_1_, p_179218_2_, p_179218_3_, p_179218_4_, p_179218_5_); - } - else - { -- p_179218_1_.func_77972_a(1, p_179218_5_); - return true; - } - } -@@ -41,4 +40,71 @@ - { - return p_150893_2_ != Blocks.field_150321_G && p_150893_2_.func_149688_o() != Material.field_151584_j ? (p_150893_2_ == Blocks.field_150325_L ? 5.0F : super.func_150893_a(p_150893_1_, p_150893_2_)) : 15.0F; - } -+ -+ -+ @Override -+ public boolean func_111207_a(ItemStack itemstack, net.minecraft.entity.player.EntityPlayer player, EntityLivingBase entity) -+ { -+ if (entity.field_70170_p.field_72995_K) -+ { -+ return false; -+ } -+ if (entity instanceof net.minecraftforge.common.IShearable) -+ { -+ net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)entity; -+ BlockPos pos = new BlockPos(entity.field_70165_t, entity.field_70163_u, entity.field_70161_v); -+ if (target.isShearable(itemstack, entity.field_70170_p, pos)) -+ { -+ java.util.List drops = target.onSheared(itemstack, entity.field_70170_p, pos, -+ net.minecraft.enchantment.EnchantmentHelper.func_77506_a(net.minecraft.enchantment.Enchantment.field_77346_s.field_77352_x, itemstack)); -+ -+ java.util.Random rand = new java.util.Random(); -+ for(ItemStack stack : drops) -+ { -+ net.minecraft.entity.item.EntityItem ent = entity.func_70099_a(stack, 1.0F); -+ ent.field_70181_x += rand.nextFloat() * 0.05F; -+ ent.field_70159_w += (rand.nextFloat() - rand.nextFloat()) * 0.1F; -+ ent.field_70179_y += (rand.nextFloat() - rand.nextFloat()) * 0.1F; -+ } -+ itemstack.func_77972_a(1, entity); -+ } -+ return true; -+ } -+ return false; -+ } -+ -+ @Override -+ public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, net.minecraft.entity.player.EntityPlayer player) -+ { -+ if (player.field_70170_p.field_72995_K || player.field_71075_bZ.field_75098_d) -+ { -+ return false; -+ } -+ Block block = player.field_70170_p.func_180495_p(pos).func_177230_c(); -+ if (block instanceof net.minecraftforge.common.IShearable) -+ { -+ net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)block; -+ if (target.isShearable(itemstack, player.field_70170_p, pos)) -+ { -+ java.util.List drops = target.onSheared(itemstack, player.field_70170_p, pos, -+ net.minecraft.enchantment.EnchantmentHelper.func_77506_a(net.minecraft.enchantment.Enchantment.field_77346_s.field_77352_x, itemstack)); -+ java.util.Random rand = new java.util.Random(); -+ -+ for(ItemStack stack : drops) -+ { -+ float f = 0.7F; -+ double d = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -+ double d1 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -+ double d2 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -+ net.minecraft.entity.item.EntityItem entityitem = new net.minecraft.entity.item.EntityItem(player.field_70170_p, (double)pos.func_177958_n() + d, (double)pos.func_177956_o() + d1, (double)pos.func_177952_p() + d2, stack); -+ entityitem.func_174869_p(); -+ player.field_70170_p.func_72838_d(entityitem); -+ } -+ -+ itemstack.func_77972_a(1, player); -+ player.func_71064_a(net.minecraft.stats.StatList.field_75934_C[Block.func_149682_b(block)], 1); -+ } -+ } -+ return false; -+ } - } diff --git a/patches/minecraft/net/minecraft/item/ItemSign.java.patch b/patches/minecraft/net/minecraft/item/ItemSign.java.patch deleted file mode 100644 index bede8d8d9..000000000 --- a/patches/minecraft/net/minecraft/item/ItemSign.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemSign.java -+++ ../src-work/minecraft/net/minecraft/item/ItemSign.java -@@ -63,7 +63,7 @@ - --p_180614_1_.field_77994_a; - TileEntity tileentity = p_180614_3_.func_175625_s(p_180614_4_); - -- if (tileentity instanceof TileEntitySign && !ItemBlock.func_179224_a(p_180614_3_, p_180614_4_, p_180614_1_)) -+ if (tileentity instanceof TileEntitySign && !ItemBlock.setTileEntityNBT(p_180614_3_, p_180614_4_, p_180614_1_, p_180614_2_)) - { - p_180614_2_.func_175141_a((TileEntitySign)tileentity); - } diff --git a/patches/minecraft/net/minecraft/item/ItemSkull.java.patch b/patches/minecraft/net/minecraft/item/ItemSkull.java.patch deleted file mode 100644 index 83067a198..000000000 --- a/patches/minecraft/net/minecraft/item/ItemSkull.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemSkull.java -+++ ../src-work/minecraft/net/minecraft/item/ItemSkull.java -@@ -35,6 +35,11 @@ - - public boolean func_180614_a(ItemStack p_180614_1_, EntityPlayer p_180614_2_, World p_180614_3_, BlockPos p_180614_4_, EnumFacing p_180614_5_, float p_180614_6_, float p_180614_7_, float p_180614_8_) - { -+ if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().func_176200_f(p_180614_3_, p_180614_4_) && p_180614_5_ != EnumFacing.DOWN) -+ { -+ p_180614_5_ = EnumFacing.UP; -+ p_180614_4_ = p_180614_4_.func_177977_b(); -+ } - if (p_180614_5_ == EnumFacing.DOWN) - { - return false; -@@ -47,7 +52,7 @@ - - if (!flag) - { -- if (!p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().func_149688_o().func_76220_a()) -+ if (!p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().func_149688_o().func_76220_a() && !p_180614_3_.isSideSolid(p_180614_4_, p_180614_5_, true)) - { - return false; - } -@@ -67,6 +72,7 @@ - { - if (!p_180614_3_.field_72995_K) - { -+ if (!Blocks.field_150465_bP.func_176198_a(p_180614_3_, p_180614_4_, p_180614_5_)) return false; - p_180614_3_.func_180501_a(p_180614_4_, Blocks.field_150465_bP.func_176223_P().func_177226_a(BlockSkull.field_176418_a, p_180614_5_), 3); - int i = 0; - diff --git a/patches/minecraft/net/minecraft/item/ItemSnow.java.patch b/patches/minecraft/net/minecraft/item/ItemSnow.java.patch deleted file mode 100644 index 15b264e65..000000000 --- a/patches/minecraft/net/minecraft/item/ItemSnow.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemSnow.java -+++ ../src-work/minecraft/net/minecraft/item/ItemSnow.java -@@ -66,4 +66,10 @@ - { - return p_77647_1_; - } -+ -+ public boolean func_179222_a(World world, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) -+ { -+ IBlockState state = world.func_180495_p(pos); -+ return (state.func_177230_c() != net.minecraft.init.Blocks.field_150431_aC || ((Integer)state.func_177229_b(BlockSnow.field_176315_a)) > 7) ? super.func_179222_a(world, pos, side, player, stack) : true; -+ } - } diff --git a/patches/minecraft/net/minecraft/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/item/ItemStack.java.patch deleted file mode 100644 index 6a62baf61..000000000 --- a/patches/minecraft/net/minecraft/item/ItemStack.java.patch +++ /dev/null @@ -1,149 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemStack.java -+++ ../src-work/minecraft/net/minecraft/item/ItemStack.java -@@ -52,6 +52,7 @@ - private boolean field_179551_k; - private static final String __OBFID = "CL_00000043"; - -+ private net.minecraftforge.fml.common.registry.RegistryDelegate delegate; - public ItemStack(Block p_i1876_1_) - { - this(p_i1876_1_, 1); -@@ -83,7 +84,7 @@ - this.field_179553_i = false; - this.field_179550_j = null; - this.field_179551_k = false; -- this.field_151002_e = p_i1881_1_; -+ this.func_150996_a(p_i1881_1_); - this.field_77994_a = p_i1881_2_; - this.field_77991_e = p_i1881_3_; - -@@ -123,11 +124,12 @@ - - public Item func_77973_b() - { -- return this.field_151002_e; -+ return this.delegate != null ? this.delegate.get() : null; - } - - public boolean func_179546_a(EntityPlayer p_179546_1_, World p_179546_2_, BlockPos p_179546_3_, EnumFacing p_179546_4_, float p_179546_5_, float p_179546_6_, float p_179546_7_) - { -+ if (!p_179546_2_.field_72995_K) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(this, p_179546_1_, p_179546_2_, p_179546_3_, p_179546_4_, p_179546_5_, p_179546_6_, p_179546_7_); - boolean flag = this.func_77973_b().func_180614_a(this, p_179546_1_, p_179546_2_, p_179546_3_, p_179546_4_, p_179546_5_, p_179546_6_, p_179546_7_); - - if (flag) -@@ -172,11 +174,11 @@ - { - if (p_77963_1_.func_150297_b("id", 8)) - { -- this.field_151002_e = Item.func_111206_d(p_77963_1_.func_74779_i("id")); -+ this.func_150996_a(Item.func_111206_d(p_77963_1_.func_74779_i("id"))); - } - else - { -- this.field_151002_e = Item.func_150899_d(p_77963_1_.func_74765_d("id")); -+ this.func_150996_a(Item.func_150899_d(p_77963_1_.func_74765_d("id"))); - } - - this.field_77994_a = p_77963_1_.func_74771_c("Count"); -@@ -200,7 +202,7 @@ - - public int func_77976_d() - { -- return this.func_77973_b().func_77639_j(); -+ return this.func_77973_b().getItemStackLimit(this); - } - - public boolean func_77985_e() -@@ -210,7 +212,7 @@ - - public boolean func_77984_f() - { -- return this.field_151002_e == null ? false : (this.field_151002_e.func_77612_l() <= 0 ? false : !this.func_77942_o() || !this.func_77978_p().func_74767_n("Unbreakable")); -+ return this.field_151002_e == null ? false : (this.field_151002_e.getMaxDamage(this) <= 0 ? false : !this.func_77942_o() || !this.func_77978_p().func_74767_n("Unbreakable")); - } - - public boolean func_77981_g() -@@ -220,32 +222,27 @@ - - public boolean func_77951_h() - { -- return this.func_77984_f() && this.field_77991_e > 0; -+ return this.func_77984_f() && func_77973_b().isDamaged(this); - } - - public int func_77952_i() - { -- return this.field_77991_e; -+ return func_77973_b().getDamage(this); - } - - public int func_77960_j() - { -- return this.field_77991_e; -+ return func_77973_b().getMetadata(this); - } - - public void func_77964_b(int p_77964_1_) - { -- this.field_77991_e = p_77964_1_; -- -- if (this.field_77991_e < 0) -- { -- this.field_77991_e = 0; -- } -+ func_77973_b().setDamage(this, p_77964_1_); - } - - public int func_77958_k() - { -- return this.field_151002_e.func_77612_l(); -+ return this.field_151002_e.getMaxDamage(this); - } - - public boolean func_96631_a(int p_96631_1_, Random p_96631_2_) -@@ -277,8 +274,8 @@ - } - } - -- this.field_77991_e += p_96631_1_; -- return this.field_77991_e > this.func_77958_k(); -+ func_77964_b(func_77952_i() + p_96631_1_); //Redirect through Item's callback if applicable. -+ return func_77952_i() > func_77958_k(); - } - } - -@@ -337,7 +334,7 @@ - - public boolean func_150998_b(Block p_150998_1_) - { -- return this.field_151002_e.func_150897_b(p_150998_1_); -+ return func_77973_b().canHarvestBlock(p_150998_1_, this); - } - - public boolean func_111282_a(EntityPlayer p_111282_1_, EntityLivingBase p_111282_2_) -@@ -752,6 +749,8 @@ - } - } - -+ net.minecraftforge.event.ForgeEventFactory.onItemTooltip(this, p_82840_1_, arraylist, p_82840_2_); -+ - return arraylist; - } - -@@ -862,7 +861,7 @@ - } - else - { -- object = this.func_77973_b().func_111205_h(); -+ object = this.func_77973_b().getAttributeModifiers(this); - } - - return (Multimap)object; -@@ -870,6 +869,7 @@ - - public void func_150996_a(Item p_150996_1_) - { -+ this.delegate = p_150996_1_ != null ? p_150996_1_.delegate : null; - this.field_151002_e = p_150996_1_; - } - diff --git a/patches/minecraft/net/minecraft/item/ItemSword.java.patch b/patches/minecraft/net/minecraft/item/ItemSword.java.patch deleted file mode 100644 index b89d19f90..000000000 --- a/patches/minecraft/net/minecraft/item/ItemSword.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemSword.java -+++ ../src-work/minecraft/net/minecraft/item/ItemSword.java -@@ -102,7 +102,9 @@ - - public boolean func_82789_a(ItemStack p_82789_1_, ItemStack p_82789_2_) - { -- return this.field_150933_b.func_150995_f() == p_82789_2_.func_77973_b() ? true : super.func_82789_a(p_82789_1_, p_82789_2_); -+ ItemStack mat = this.field_150933_b.getRepairItemStack(); -+ if (mat != null && net.minecraftforge.oredict.OreDictionary.itemMatches(mat, p_82789_2_, false)) return true; -+ return super.func_82789_a(p_82789_1_, p_82789_2_); - } - - public Multimap func_111205_h() diff --git a/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch deleted file mode 100644 index e717399ed..000000000 --- a/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java -@@ -78,6 +78,7 @@ - - public void func_151394_a(ItemStack p_151394_1_, ItemStack p_151394_2_, float p_151394_3_) - { -+ if (func_151395_a(p_151394_1_) != null) { net.minecraftforge.fml.common.FMLLog.info("Ignored smelting recipe with conflicting input: " + p_151394_1_ + " = " + p_151394_2_); return; } - this.field_77604_b.put(p_151394_1_, p_151394_2_); - this.field_77605_c.put(p_151394_2_, Float.valueOf(p_151394_3_)); - } -@@ -113,6 +114,9 @@ - - public float func_151398_b(ItemStack p_151398_1_) - { -+ float ret = p_151398_1_.func_77973_b().getSmeltingExperience(p_151398_1_); -+ if (ret != -1) return ret; -+ - Iterator iterator = this.field_77605_c.entrySet().iterator(); - Entry entry; - diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch deleted file mode 100644 index e45703adc..000000000 --- a/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java -@@ -27,7 +27,7 @@ - { - ItemStack itemstack1 = (ItemStack)arraylist.get(0); - -- if (itemstack.func_77973_b() != itemstack1.func_77973_b() || itemstack1.field_77994_a != 1 || itemstack.field_77994_a != 1 || !itemstack1.func_77973_b().func_77645_m()) -+ if (itemstack.func_77973_b() != itemstack1.func_77973_b() || itemstack1.field_77994_a != 1 || itemstack.field_77994_a != 1 || !itemstack1.func_77973_b().isRepairable()) - { - return false; - } -@@ -55,7 +55,7 @@ - { - ItemStack itemstack1 = (ItemStack)arraylist.get(0); - -- if (itemstack.func_77973_b() != itemstack1.func_77973_b() || itemstack1.field_77994_a != 1 || itemstack.field_77994_a != 1 || !itemstack1.func_77973_b().func_77645_m()) -+ if (itemstack.func_77973_b() != itemstack1.func_77973_b() || itemstack1.field_77994_a != 1 || itemstack.field_77994_a != 1 || !itemstack1.func_77973_b().isRepairable()) - { - return null; - } -@@ -68,7 +68,7 @@ - ItemStack itemstack2 = (ItemStack)arraylist.get(0); - itemstack = (ItemStack)arraylist.get(1); - -- if (itemstack2.func_77973_b() == itemstack.func_77973_b() && itemstack2.field_77994_a == 1 && itemstack.field_77994_a == 1 && itemstack2.func_77973_b().func_77645_m()) -+ if (itemstack2.func_77973_b() == itemstack.func_77973_b() && itemstack2.field_77994_a == 1 && itemstack.field_77994_a == 1 && itemstack2.func_77973_b().isRepairable()) - { - Item item = itemstack2.func_77973_b(); - int j = item.func_77612_l() - itemstack2.func_77952_i(); -@@ -105,11 +105,7 @@ - for (int i = 0; i < aitemstack.length; ++i) - { - ItemStack itemstack = p_179532_1_.func_70301_a(i); -- -- if (itemstack != null && itemstack.func_77973_b().func_77634_r()) -- { -- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); -- } -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - - return aitemstack; diff --git a/patches/minecraft/net/minecraft/nbt/NBTTagByteArray.java.patch b/patches/minecraft/net/minecraft/nbt/NBTTagByteArray.java.patch deleted file mode 100644 index ead6ffc34..000000000 --- a/patches/minecraft/net/minecraft/nbt/NBTTagByteArray.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/nbt/NBTTagByteArray.java -+++ ../src-work/minecraft/net/minecraft/nbt/NBTTagByteArray.java -@@ -25,6 +25,7 @@ - - void func_152446_a(DataInput p_152446_1_, int p_152446_2_, NBTSizeTracker p_152446_3_) throws IOException - { -+ p_152446_3_.func_152450_a(32); //Forge: Count the length as well - int j = p_152446_1_.readInt(); - p_152446_3_.func_152450_a((long)(8 * j)); - this.field_74754_a = new byte[j]; diff --git a/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch b/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch deleted file mode 100644 index 236610d98..000000000 --- a/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/nbt/NBTTagCompound.java -+++ ../src-work/minecraft/net/minecraft/nbt/NBTTagCompound.java -@@ -48,7 +48,7 @@ - while ((b0 = func_152447_a(p_152446_1_, p_152446_3_)) != 0) - { - String s = func_152448_b(p_152446_1_, p_152446_3_); -- p_152446_3_.func_152450_a((long)(16 * s.length())); -+ NBTSizeTracker.readUTF(p_152446_3_, s); // Forge: Correctly read String length including header. - NBTBase nbtbase = func_152449_a(b0, s, p_152446_1_, p_152446_2_ + 1, p_152446_3_); - this.field_74784_a.put(s, nbtbase); - } -@@ -396,6 +396,7 @@ - - private static byte func_152447_a(DataInput p_152447_0_, NBTSizeTracker p_152447_1_) throws IOException - { -+ p_152447_1_.func_152450_a(8); - return p_152447_0_.readByte(); - } - -@@ -406,6 +407,7 @@ - - static NBTBase func_152449_a(byte p_152449_0_, String p_152449_1_, DataInput p_152449_2_, int p_152449_3_, NBTSizeTracker p_152449_4_) - { -+ p_152449_4_.func_152450_a(32); //Forge: 4 extra bytes for the object allocation. - NBTBase nbtbase = NBTBase.func_150284_a(p_152449_0_); - - try diff --git a/patches/minecraft/net/minecraft/nbt/NBTTagIntArray.java.patch b/patches/minecraft/net/minecraft/nbt/NBTTagIntArray.java.patch deleted file mode 100644 index 40a4b4cb7..000000000 --- a/patches/minecraft/net/minecraft/nbt/NBTTagIntArray.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/nbt/NBTTagIntArray.java -+++ ../src-work/minecraft/net/minecraft/nbt/NBTTagIntArray.java -@@ -29,6 +29,7 @@ - - void func_152446_a(DataInput p_152446_1_, int p_152446_2_, NBTSizeTracker p_152446_3_) throws IOException - { -+ p_152446_3_.func_152450_a(32); //Forge: Count the length as well - int j = p_152446_1_.readInt(); - p_152446_3_.func_152450_a((long)(32 * j)); - this.field_74749_a = new int[j]; diff --git a/patches/minecraft/net/minecraft/nbt/NBTTagList.java.patch b/patches/minecraft/net/minecraft/nbt/NBTTagList.java.patch deleted file mode 100644 index 1cafa5e36..000000000 --- a/patches/minecraft/net/minecraft/nbt/NBTTagList.java.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/nbt/NBTTagList.java -+++ ../src-work/minecraft/net/minecraft/nbt/NBTTagList.java -@@ -46,11 +46,13 @@ - { - p_152446_3_.func_152450_a(8L); - this.field_74746_b = p_152446_1_.readByte(); -+ p_152446_3_.func_152450_a(32); //Forge: Count the length as well - int j = p_152446_1_.readInt(); - this.field_74747_a = Lists.newArrayList(); - - for (int k = 0; k < j; ++k) - { -+ p_152446_3_.func_152450_a(32); //Forge: 4 extra bytes for the object allocation. - NBTBase nbtbase = NBTBase.func_150284_a(this.field_74746_b); - nbtbase.func_152446_a(p_152446_1_, p_152446_2_ + 1, p_152446_3_); - this.field_74747_a.add(nbtbase); diff --git a/patches/minecraft/net/minecraft/nbt/NBTTagString.java.patch b/patches/minecraft/net/minecraft/nbt/NBTTagString.java.patch deleted file mode 100644 index 56efede98..000000000 --- a/patches/minecraft/net/minecraft/nbt/NBTTagString.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/nbt/NBTTagString.java -+++ ../src-work/minecraft/net/minecraft/nbt/NBTTagString.java -@@ -32,7 +32,7 @@ - void func_152446_a(DataInput p_152446_1_, int p_152446_2_, NBTSizeTracker p_152446_3_) throws IOException - { - this.field_74751_a = p_152446_1_.readUTF(); -- p_152446_3_.func_152450_a((long)(16 * this.field_74751_a.length())); -+ NBTSizeTracker.readUTF(p_152446_3_, field_74751_a); // Forge: Correctly read String length including header. - } - - public byte func_74732_a() diff --git a/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch b/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch deleted file mode 100644 index da6530665..000000000 --- a/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch +++ /dev/null @@ -1,166 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/NetHandlerPlayServer.java -+++ ../src-work/minecraft/net/minecraft/network/NetHandlerPlayServer.java -@@ -93,6 +93,14 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - -+import net.minecraftforge.common.ForgeHooks; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.fml.common.eventhandler.Event; -+import net.minecraftforge.event.ForgeEventFactory; -+import net.minecraftforge.event.ServerChatEvent; -+import net.minecraftforge.event.entity.player.PlayerInteractEvent; -+import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; -+ - public class NetHandlerPlayServer implements INetHandlerPlayServer, IUpdatePlayerListBox - { - private static final Logger field_147370_c = LogManager.getLogger(); -@@ -246,6 +254,8 @@ - this.field_147369_b.field_70154_o.func_70043_V(); - } - -+ if (!this.field_147380_r) return; //Fixes teleportation kick while riding entities -+ - this.field_147367_d.func_71203_ab().func_72358_d(this.field_147369_b); - - if (this.field_147369_b.field_70154_o != null) -@@ -324,9 +334,10 @@ - double d11 = d8 - this.field_147369_b.field_70165_t; - double d12 = d9 - this.field_147369_b.field_70163_u; - double d13 = d10 - this.field_147369_b.field_70161_v; -- double d14 = Math.min(Math.abs(d11), Math.abs(this.field_147369_b.field_70159_w)); -- double d15 = Math.min(Math.abs(d12), Math.abs(this.field_147369_b.field_70181_x)); -- double d16 = Math.min(Math.abs(d13), Math.abs(this.field_147369_b.field_70179_y)); -+ //BUGFIX: min -> max, grabs the highest distance -+ double d14 = Math.max(Math.abs(d11), Math.abs(this.field_147369_b.field_70159_w)); -+ double d15 = Math.max(Math.abs(d12), Math.abs(this.field_147369_b.field_70181_x)); -+ double d16 = Math.max(Math.abs(d13), Math.abs(this.field_147369_b.field_70179_y)); - double d17 = d14 * d14 + d15 * d15 + d16 * d16; - - if (d17 > 100.0D && (!this.field_147367_d.func_71264_H() || !this.field_147367_d.func_71214_G().equals(this.field_147369_b.func_70005_c_()))) -@@ -344,6 +355,8 @@ - this.field_147369_b.func_70664_aZ(); - } - -+ if (!this.field_147380_r) return; //Fixes "Moved Too Fast" kick when being teleported while moving -+ - this.field_147369_b.func_70091_d(d11, d12, d13); - this.field_147369_b.field_70122_E = p_147347_1_.func_149465_i(); - double d18 = d12; -@@ -365,6 +378,8 @@ - field_147370_c.warn(this.field_147369_b.func_70005_c_() + " moved wrongly!"); - } - -+ if (!this.field_147380_r) return; //Fixes "Moved Too Fast" kick when being teleported while moving -+ - this.field_147369_b.func_70080_a(d8, d9, d10, f1, f2); - this.field_147369_b.func_71000_j(this.field_147369_b.field_70165_t - d0, this.field_147369_b.field_70163_u - d1, this.field_147369_b.field_70161_v - d2); - -@@ -372,7 +387,7 @@ - { - boolean flag2 = worldserver.func_72945_a(this.field_147369_b, this.field_147369_b.func_174813_aQ().func_72331_e((double)f3, (double)f3, (double)f3)).isEmpty(); - -- if (flag && (flag1 || !flag2) && !this.field_147369_b.func_70608_bn()) -+ if (flag && (flag1 || !flag2) && !this.field_147369_b.func_70608_bn() && !this.field_147369_b.field_70145_X) - { - this.func_147364_a(this.field_147373_o, this.field_147382_p, this.field_147381_q, f1, f2); - return; -@@ -400,6 +415,8 @@ - this.field_147365_f = 0; - } - -+ if (!this.field_147380_r) return; //Fixes "Moved Too Fast" kick when being teleported while moving -+ - this.field_147369_b.field_70122_E = p_147347_1_.func_149465_i(); - this.field_147367_d.func_71203_ab().func_72358_d(this.field_147369_b); - this.field_147369_b.func_71122_b(this.field_147369_b.field_70163_u - d7, p_147347_1_.func_149465_i()); -@@ -489,7 +506,10 @@ - double d2 = this.field_147369_b.field_70161_v - ((double)blockpos.func_177952_p() + 0.5D); - double d3 = d0 * d0 + d1 * d1 + d2 * d2; - -- if (d3 > 36.0D) -+ double dist = field_147369_b.field_71134_c.getBlockReachDistance() + 1; -+ dist *= dist; -+ -+ if (d3 > dist) - { - return; - } -@@ -540,6 +560,7 @@ - WorldServer worldserver = this.field_147367_d.func_71218_a(this.field_147369_b.field_71093_bK); - ItemStack itemstack = this.field_147369_b.field_71071_by.func_70448_g(); - boolean flag = false; -+ boolean placeResult = true; - BlockPos blockpos = p_147346_1_.func_179724_a(); - EnumFacing enumfacing = EnumFacing.func_82600_a(p_147346_1_.func_149568_f()); - this.field_147369_b.func_143004_u(); -@@ -551,7 +572,11 @@ - return; - } - -+ PlayerInteractEvent event = ForgeEventFactory.onPlayerInteract(field_147369_b, PlayerInteractEvent.Action.RIGHT_CLICK_AIR, worldserver, new BlockPos(0, 0, 0), null); -+ if (event.useItem != Event.Result.DENY) -+ { - this.field_147369_b.field_71134_c.func_73085_a(this.field_147369_b, worldserver, itemstack); -+ } - } - else if (blockpos.func_177956_o() >= this.field_147367_d.func_71207_Z() - 1 && (enumfacing == EnumFacing.UP || blockpos.func_177956_o() >= this.field_147367_d.func_71207_Z())) - { -@@ -562,9 +587,12 @@ - } - else - { -- if (this.field_147380_r && 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 && !this.field_147367_d.func_175579_a(worldserver, blockpos, this.field_147369_b) && worldserver.func_175723_af().func_177746_a(blockpos)) -+ double dist = field_147369_b.field_71134_c.getBlockReachDistance() + 1; -+ dist *= dist; -+ if (this.field_147380_r && 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 && !this.field_147367_d.func_175579_a(worldserver, blockpos, this.field_147369_b) && worldserver.func_175723_af().func_177746_a(blockpos)) - { -- this.field_147369_b.field_71134_c.func_180236_a(this.field_147369_b, worldserver, itemstack, blockpos, enumfacing, p_147346_1_.func_149573_h(), p_147346_1_.func_149569_i(), p_147346_1_.func_149575_j()); -+ // record block place result so we can update client itemstack size if place event was cancelled. -+ placeResult = this.field_147369_b.field_71134_c.func_180236_a(this.field_147369_b, worldserver, itemstack, blockpos, enumfacing, p_147346_1_.func_149573_h(), p_147346_1_.func_149569_i(), p_147346_1_.func_149575_j()); - } - - flag = true; -@@ -592,7 +620,7 @@ - this.field_147369_b.field_71070_bA.func_75142_b(); - this.field_147369_b.field_71137_h = false; - -- if (!ItemStack.func_77989_b(this.field_147369_b.field_71071_by.func_70448_g(), p_147346_1_.func_149574_g())) -+ if (!ItemStack.func_77989_b(this.field_147369_b.field_71071_by.func_70448_g(), p_147346_1_.func_149574_g()) || !placeResult) // force client itemstack update if place event was cancelled - { - this.func_147359_a(new S2FPacketSetSlot(this.field_147369_b.field_71070_bA.field_75152_c, slot.field_75222_d, this.field_147369_b.field_71071_by.func_70448_g())); - } -@@ -764,8 +792,10 @@ - } - else - { -- ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("chat.type.text", new Object[] {this.field_147369_b.func_145748_c_(), s}); -- this.field_147367_d.func_71203_ab().func_148544_a(chatcomponenttranslation1, false); -+ ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("chat.type.text", this.field_147369_b.func_145748_c_(), ForgeHooks.newChatWithLinks(s)); -+ IChatComponent chat = ForgeHooks.onServerChatEvent(this, s, chatcomponenttranslation1); -+ if (chat == null) return; -+ this.field_147367_d.func_71203_ab().func_148544_a(chat, false); - } - - this.field_147374_l += 20; -@@ -907,7 +937,7 @@ - return; - } - -- this.field_147369_b = this.field_147367_d.func_71203_ab().func_72368_a(this.field_147369_b, 0, false); -+ this.field_147369_b = this.field_147367_d.func_71203_ab().func_72368_a(this.field_147369_b, field_147369_b.field_71093_bK, false); - } - - break; -@@ -1080,7 +1110,10 @@ - return; - } - -- System.arraycopy(p_147343_1_.func_180768_b(), 0, tileentitysign.field_145915_a, 0, 4); -+ IChatComponent[] lines = p_147343_1_.func_180768_b(); //Forge: Prevent client from directly sending commands -+ for (int x = 0; x < tileentitysign.field_145915_a.length && x < lines.length; x++) -+ tileentitysign.field_145915_a[x] = new ChatComponentText(net.minecraft.util.EnumChatFormatting.func_110646_a(lines[x].func_150260_c())); -+ - tileentitysign.func_70296_d(); - worldserver.func_175689_h(blockpos); - } diff --git a/patches/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch b/patches/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch deleted file mode 100644 index 2e990c3ad..000000000 --- a/patches/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/handshake/client/C00Handshake.java -+++ ../src-work/minecraft/net/minecraft/network/handshake/client/C00Handshake.java -@@ -16,6 +16,7 @@ - private int field_149599_c; - private EnumConnectionState field_149597_d; - private static final String __OBFID = "CL_00001372"; -+ private boolean hasFMLMarker = false; - - public C00Handshake() {} - -@@ -28,18 +29,26 @@ - this.field_149597_d = p_i45266_4_; - } - -+ public C00Handshake(int protocol, String address, int port, EnumConnectionState state, boolean addFMLMarker) -+ { -+ this(protocol, address, port, state); -+ this.hasFMLMarker = addFMLMarker; -+ } -+ - public void func_148837_a(PacketBuffer p_148837_1_) throws IOException - { - this.field_149600_a = p_148837_1_.func_150792_a(); - this.field_149598_b = p_148837_1_.func_150789_c(255); - this.field_149599_c = p_148837_1_.readUnsignedShort(); - this.field_149597_d = EnumConnectionState.func_150760_a(p_148837_1_.func_150792_a()); -+ this.hasFMLMarker = this.field_149598_b.contains("\0FML\0"); -+ this.field_149598_b = this.field_149598_b.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 + "\0FML\0"); - p_148840_1_.writeShort(this.field_149599_c); - p_148840_1_.func_150787_b(this.field_149597_d.func_150759_c()); - } -@@ -63,4 +72,9 @@ - { - this.func_180770_a((INetHandlerHandshakeServer)p_148833_1_); - } -+ -+ public boolean hasFMLMarker() -+ { -+ return this.hasFMLMarker; -+ } - } diff --git a/patches/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch b/patches/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch deleted file mode 100644 index 1345ee125..000000000 --- a/patches/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java -+++ ../src-work/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java -@@ -47,7 +47,11 @@ - public void func_148840_b(PacketBuffer p_148840_1_) throws IOException - { - p_148840_1_.func_180714_a(this.field_149562_a); -+ synchronized(this.field_149561_c) { //This may be access multiple times, from multiple threads, lets be safe. -+ this.field_149561_c.markReaderIndex(); - p_148840_1_.writeBytes((ByteBuf)this.field_149561_c); -+ this.field_149561_c.resetReaderIndex(); -+ } - } - - public void func_148833_a(INetHandlerPlayServer p_148833_1_) diff --git a/patches/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch b/patches/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch deleted file mode 100644 index ae048b6b5..000000000 --- a/patches/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java -+++ ../src-work/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java -@@ -46,7 +46,11 @@ - public void func_148840_b(PacketBuffer p_148840_1_) throws IOException - { - p_148840_1_.func_180714_a(this.field_149172_a); -+ synchronized(this.field_149171_b) { //This may be access multiple times, from multiple threads, lets be safe. -+ this.field_149171_b.markReaderIndex(); - p_148840_1_.writeBytes((ByteBuf)this.field_149171_b); -+ this.field_149171_b.resetReaderIndex(); -+ } - } - - public void func_180734_a(INetHandlerPlayClient p_180734_1_) diff --git a/patches/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch b/patches/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch deleted file mode 100644 index ffc613efe..000000000 --- a/patches/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java -+++ ../src-work/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java -@@ -34,7 +34,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()); - } - - public void func_148833_a(INetHandlerStatusClient p_148833_1_) diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch deleted file mode 100644 index f75083699..000000000 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ /dev/null @@ -1,306 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/MinecraftServer.java -+++ ../src-work/minecraft/net/minecraft/server/MinecraftServer.java -@@ -99,7 +99,7 @@ - @SideOnly(Side.SERVER) - private String field_71320_r; - private int field_71319_s = -1; -- public WorldServer[] field_71305_c; -+ public WorldServer[] field_71305_c = new WorldServer[0]; - private ServerConfigurationManager field_71318_t; - private boolean field_71317_u = true; - private boolean field_71316_v; -@@ -116,7 +116,8 @@ - private int field_71280_D; - private int field_143008_E = 0; - public final long[] field_71311_j = new long[100]; -- public long[][] field_71312_k; -+ //public long[][] timeOfLastDimensionTick; -+ public java.util.Hashtable worldTickTimes = new java.util.Hashtable(); - private KeyPair field_71292_I; - private String field_71293_J; - private String field_71294_K; -@@ -222,8 +223,6 @@ - { - this.func_71237_c(p_71247_1_); - this.func_71192_d("menu.loadingLevel"); -- this.field_71305_c = new WorldServer[3]; -- this.field_71312_k = new long[this.field_71305_c.length][100]; - ISaveHandler isavehandler = this.field_71310_m.func_75804_a(p_71247_1_, true); - this.func_175584_a(this.func_71270_I(), isavehandler); - WorldInfo worldinfo = isavehandler.func_75757_d(); -@@ -254,47 +253,21 @@ - worldsettings = new WorldSettings(worldinfo); - } - -- for (int j = 0; j < this.field_71305_c.length; ++j) -+ WorldServer overWorld = (WorldServer)(func_71242_L() ? new DemoWorldServer(this, isavehandler, worldinfo, 0, field_71304_b).func_175643_b() : new WorldServer(this, isavehandler, worldinfo, 0, field_71304_b).func_175643_b()); -+ overWorld.func_72963_a(worldsettings); -+ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) - { -- byte b0 = 0; -+ WorldServer world = (dim == 0 ? overWorld : (WorldServer)new WorldServerMulti(this, isavehandler, dim, overWorld, field_71304_b).func_175643_b()); -+ world.func_72954_a(new WorldManager(this, world)); - -- if (j == 1) -- { -- b0 = -1; -- } -- -- if (j == 2) -- { -- b0 = 1; -- } -- -- if (j == 0) -- { -- if (this.func_71242_L()) -- { -- this.field_71305_c[j] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, b0, this.field_71304_b)).func_175643_b(); -- } -- else -- { -- this.field_71305_c[j] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, b0, this.field_71304_b)).func_175643_b(); -- } -- -- this.field_71305_c[j].func_72963_a(worldsettings); -- } -- else -- { -- this.field_71305_c[j] = (WorldServer)(new WorldServerMulti(this, isavehandler, b0, this.field_71305_c[0], this.field_71304_b)).func_175643_b(); -- } -- -- this.field_71305_c[j].func_72954_a(new WorldManager(this, this.field_71305_c[j])); -- - if (!this.func_71264_H()) - { -- this.field_71305_c[j].func_72912_H().func_76060_a(this.func_71265_f()); -+ world.func_72912_H().func_76060_a(this.func_71265_f()); - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); - } - -- this.field_71318_t.func_72364_a(this.field_71305_c); -+ this.field_71318_t.func_72364_a(new WorldServer[]{ overWorld }); - this.func_147139_a(this.func_147135_j()); - this.func_71222_d(); - } -@@ -309,7 +282,7 @@ - this.func_71192_d("menu.generatingTerrain"); - byte b0 = 0; - field_147145_h.info("Preparing start region for level " + b0); -- WorldServer worldserver = this.field_71305_c[b0]; -+ WorldServer worldserver = net.minecraftforge.common.DimensionManager.getWorld(b0); - BlockPos blockpos = worldserver.func_175694_M(); - long j = func_130071_aq(); - -@@ -371,6 +344,7 @@ - if (!this.field_71290_O) - { - WorldServer[] aworldserver = this.field_71305_c; -+ if (aworldserver == null) return; //Forge: Just in case, NPE protection as it has been encountered. - int i = aworldserver.length; - - for (int j = 0; j < i; ++j) -@@ -399,7 +373,7 @@ - - public void func_71260_j() - { -- if (!this.field_71290_O) -+ if (!this.field_71290_O && net.minecraftforge.fml.common.Loader.instance().hasReachedState(net.minecraftforge.fml.common.LoaderState.SERVER_STARTED) && !field_71316_v) // make sure the save is valid and we don't save twice - { - field_147145_h.info("Stopping server"); - -@@ -423,8 +397,15 @@ - for (int i = 0; i < this.field_71305_c.length; ++i) - { - WorldServer worldserver = this.field_71305_c[i]; -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); - worldserver.func_73041_k(); - } -+ -+ WorldServer[] tmp = field_71305_c; -+ for (WorldServer world : tmp) -+ { -+ net.minecraftforge.common.DimensionManager.setWorld(world.field_73011_w.func_177502_q(), null); -+ } - } - - if (this.field_71307_n.func_76468_d()) -@@ -456,6 +437,7 @@ - { - if (this.func_71197_b()) - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarted(); - this.field_175591_ab = func_130071_aq(); - long i = 0L; - this.field_147147_p.func_151315_a(new ChatComponentText(this.field_71286_C)); -@@ -500,12 +482,20 @@ - Thread.sleep(Math.max(1L, 50L - i)); - this.field_71296_Q = true; - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStopping(); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions - } - else - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions - this.func_71228_a((CrashReport)null); - } - } -+ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) -+ { -+ // ignore silently -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions -+ } - catch (Throwable throwable1) - { - field_147145_h.error("Encountered an unexpected exception", throwable1); -@@ -531,6 +521,7 @@ - field_147145_h.error("We were unable to save this crash report to disk."); - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions - this.func_71228_a(crashreport); - } - finally -@@ -546,6 +537,8 @@ - } - finally - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStopped(); -+ this.field_71316_v = true; - this.func_71240_o(); - } - } -@@ -591,6 +584,7 @@ - public void func_71217_p() - { - long i = System.nanoTime(); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreServerTick(); - ++this.field_71315_w; - - if (this.field_71295_T) -@@ -617,6 +611,7 @@ - - Collections.shuffle(Arrays.asList(agameprofile)); - this.field_147147_p.func_151318_b().func_151330_a(agameprofile); -+ this.field_147147_p.invalidateJson(); - } - - if (this.field_71315_w % 900 == 0) -@@ -644,6 +639,7 @@ - - this.field_71304_b.func_76319_b(); - this.field_71304_b.func_76319_b(); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostServerTick(); - } - - public void func_71190_q() -@@ -657,7 +653,7 @@ - { - try - { -- ((FutureTask)this.field_175589_i.poll()).run(); -+ net.minecraftforge.fml.common.FMLCommonHandler.callFuture(((FutureTask)this.field_175589_i.poll())); - } - catch (Throwable throwable2) - { -@@ -667,15 +663,18 @@ - } - - this.field_71304_b.func_76318_c("levels"); -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.tick(); - int j; - -- for (j = 0; j < this.field_71305_c.length; ++j) -+ Integer[] ids = net.minecraftforge.common.DimensionManager.getIDs(this.field_71315_w % 200 == 0); -+ for (int x = 0; x < ids.length; x++) - { -+ int id = ids[x]; - long i = System.nanoTime(); - -- if (j == 0 || this.func_71255_r()) -+ if (id == 0 || this.func_71255_r()) - { -- WorldServer worldserver = this.field_71305_c[j]; -+ WorldServer worldserver = net.minecraftforge.common.DimensionManager.getWorld(id); - this.field_71304_b.func_76320_a(worldserver.func_72912_H().func_76065_j()); - - if (this.field_71315_w % 20 == 0) -@@ -686,6 +685,7 @@ - } - - this.field_71304_b.func_76320_a("tick"); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreWorldTick(worldserver); - CrashReport crashreport; - - try -@@ -710,6 +710,7 @@ - throw new ReportedException(crashreport); - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostWorldTick(worldserver); - this.field_71304_b.func_76319_b(); - this.field_71304_b.func_76320_a("tracker"); - worldserver.func_73039_n().func_72788_a(); -@@ -717,9 +718,11 @@ - this.field_71304_b.func_76319_b(); - } - -- this.field_71312_k[j][this.field_71315_w % 100] = System.nanoTime() - i; -+ worldTickTimes.get(id)[this.field_71315_w % 100] = System.nanoTime() - i; - } - -+ this.field_71304_b.func_76318_c("dim_unloading"); -+ net.minecraftforge.common.DimensionManager.unloadWorlds(worldTickTimes); - this.field_71304_b.func_76318_c("connection"); - this.func_147137_ag().func_151269_c(); - this.field_71304_b.func_76318_c("players"); -@@ -741,6 +744,7 @@ - - public void func_71256_s() - { -+ net.minecraftforge.fml.common.StartupQuery.reset(); - this.field_175590_aa = new Thread(this, "Server thread"); - this.field_175590_aa.start(); - } -@@ -757,7 +761,13 @@ - - public WorldServer func_71218_a(int p_71218_1_) - { -- return p_71218_1_ == -1 ? this.field_71305_c[1] : (p_71218_1_ == 1 ? this.field_71305_c[2] : this.field_71305_c[0]); -+ WorldServer ret = net.minecraftforge.common.DimensionManager.getWorld(p_71218_1_); -+ if (ret == null) -+ { -+ net.minecraftforge.common.DimensionManager.initDimension(p_71218_1_); -+ ret = net.minecraftforge.common.DimensionManager.getWorld(p_71218_1_); -+ } -+ return ret; - } - - public String func_71249_w() -@@ -787,7 +797,7 @@ - - public String getServerModName() - { -- return "vanilla"; -+ return net.minecraftforge.fml.common.FMLCommonHandler.instance().getModName(); - } - - public CrashReport func_71230_b(CrashReport p_71230_1_) -@@ -1008,6 +1018,7 @@ - - if (worldserver != null) - { -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); - worldserver.func_73041_k(); - } - } -@@ -1590,7 +1601,6 @@ - this.field_71319_s = p_71208_1_; - } - -- @SideOnly(Side.SERVER) - public boolean func_71241_aa() - { - return this.field_71316_v; diff --git a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch deleted file mode 100644 index aeee11c96..000000000 --- a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch +++ /dev/null @@ -1,97 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/integrated/IntegratedServer.java -+++ ../src-work/minecraft/net/minecraft/server/integrated/IntegratedServer.java -@@ -74,8 +74,6 @@ - protected void func_71247_a(String p_71247_1_, String p_71247_2_, long p_71247_3_, WorldType p_71247_5_, String p_71247_6_) - { - this.func_71237_c(p_71247_1_); -- this.field_71305_c = new WorldServer[3]; -- this.field_71312_k = new long[this.field_71305_c.length][100]; - ISaveHandler isavehandler = this.func_71254_M().func_75804_a(p_71247_1_, true); - this.func_175584_a(this.func_71270_I(), isavehandler); - WorldInfo worldinfo = isavehandler.func_75757_d(); -@@ -88,45 +86,25 @@ - { - worldinfo.func_76062_a(p_71247_2_); - } -+ WorldServer overWorld = (func_71242_L() ? (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, 0, this.field_71304_b)).func_175643_b() : -+ (WorldServer)(new WorldServer(this, isavehandler, worldinfo, 0, this.field_71304_b)).func_175643_b()); -+ overWorld.func_72963_a(this.field_71350_m); - -- for (int j = 0; j < this.field_71305_c.length; ++j) -+ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) - { -- byte b0 = 0; - -- if (j == 1) -+ WorldServer world = (dim == 0 ? overWorld : (WorldServer)(new WorldServerMulti(this, isavehandler, dim, overWorld, this.field_71304_b)).func_175643_b()); -+ world.func_72954_a(new WorldManager(this, world)); -+ if (!this.func_71264_H()) - { -- b0 = -1; -+ world.func_72912_H().func_76060_a(func_71265_f()); - } -- -- if (j == 2) -- { -- b0 = 1; -- } -- -- if (j == 0) -- { -- if (this.func_71242_L()) -- { -- this.field_71305_c[j] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, b0, this.field_71304_b)).func_175643_b(); -- } -- else -- { -- this.field_71305_c[j] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, b0, this.field_71304_b)).func_175643_b(); -- } -- -- this.field_71305_c[j].func_72963_a(this.field_71350_m); -- } -- else -- { -- this.field_71305_c[j] = (WorldServer)(new WorldServerMulti(this, isavehandler, b0, this.field_71305_c[0], this.field_71304_b)).func_175643_b(); -- } -- -- this.field_71305_c[j].func_72954_a(new WorldManager(this, this.field_71305_c[j])); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); - } - -- this.func_71203_ab().func_72364_a(this.field_71305_c); -+ this.func_71203_ab().func_72364_a(new WorldServer[]{ overWorld }); - -- if (this.field_71305_c[0].func_72912_H().func_176130_y() == null) -+ if (overWorld.func_72912_H().func_176130_y() == null) - { - this.func_147139_a(this.field_71349_l.field_71474_y.field_74318_M); - } -@@ -144,9 +122,10 @@ - this.func_71245_h(true); - field_147148_h.info("Generating keypair"); - this.func_71253_a(CryptManager.func_75891_b()); -+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; - this.func_71247_a(this.func_71270_I(), this.func_71221_J(), this.field_71350_m.func_77160_d(), this.field_71350_m.func_77165_h(), this.field_71350_m.func_82749_j()); - this.func_71205_p(this.func_71214_G() + " - " + this.field_71305_c[0].func_72912_H().func_76065_j()); -- return true; -+ return net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarting(this); - } - - public void func_71217_p() -@@ -171,7 +150,7 @@ - { - try - { -- ((FutureTask)this.field_175589_i.poll()).run(); -+ net.minecraftforge.fml.common.FMLCommonHandler.callFuture(((FutureTask)this.field_175589_i.poll())); - } - catch (Throwable throwable) - { -@@ -232,6 +211,7 @@ - - public EnumDifficulty func_147135_j() - { -+ if (this.field_71349_l.field_71441_e == null) return this.field_71349_l.field_71474_y.field_74318_M; // Fix NPE just in case. - return this.field_71349_l.field_71441_e.func_72912_H().func_176130_y(); - } - diff --git a/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch b/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch deleted file mode 100644 index 2700fc458..000000000 --- a/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch +++ /dev/null @@ -1,257 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/management/ItemInWorldManager.java -+++ ../src-work/minecraft/net/minecraft/server/management/ItemInWorldManager.java -@@ -22,6 +22,8 @@ - - public class ItemInWorldManager - { -+ /** Forge reach distance */ -+ private double blockReachDistance = 5.0d; - public World field_73092_a; - public EntityPlayerMP field_73090_b; - private WorldSettings.GameType field_73091_c; -@@ -137,6 +139,14 @@ - - public void func_180784_a(BlockPos p_180784_1_, EnumFacing p_180784_2_) - { -+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_73090_b, -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, field_73092_a, p_180784_1_, p_180784_2_); -+ if (event.isCanceled()) -+ { -+ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(field_73092_a, p_180784_1_)); -+ return; -+ } -+ - if (this.func_73083_d()) - { - if (!this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_)) -@@ -171,18 +181,35 @@ - } - } - -- this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_); -+ // - this.field_73089_e = this.field_73100_i; - float f = 1.0F; - -- if (block.func_149688_o() != Material.field_151579_a) -+ if (!block.isAir(field_73092_a, p_180784_1_)) - { -- block.func_180649_a(this.field_73092_a, p_180784_1_, this.field_73090_b); -+ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) -+ { -+ block.func_180649_a(this.field_73092_a, p_180784_1_, this.field_73090_b); -+ this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_); -+ } -+ else -+ { -+ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(field_73092_a, p_180784_1_)); -+ } - f = block.func_180647_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180784_1_); - } - -- if (block.func_149688_o() != Material.field_151579_a && f >= 1.0F) -+ if (event.useItem == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) - { -+ if (f >= 1.0F) -+ { -+ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(field_73092_a, p_180784_1_)); -+ } -+ return; -+ } -+ -+ if (!block.isAir(field_73092_a, p_180784_1_) && f >= 1.0F) -+ { - this.func_180237_b(p_180784_1_); - } - else -@@ -203,7 +230,7 @@ - int i = this.field_73100_i - this.field_73089_e; - Block block = this.field_73092_a.func_180495_p(p_180785_1_).func_177230_c(); - -- if (block.func_149688_o() != Material.field_151579_a) -+ if (!block.isAir(field_73092_a, p_180785_1_)) - { - float f = block.func_180647_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180785_1_) * (float)(i + 1); - -@@ -232,9 +259,13 @@ - - private boolean func_180235_c(BlockPos p_180235_1_) - { -+ return removeBlock(p_180235_1_, false); -+ } -+ private boolean removeBlock(BlockPos p_180235_1_, boolean canHarvest) -+ { - IBlockState iblockstate = this.field_73092_a.func_180495_p(p_180235_1_); - iblockstate.func_177230_c().func_176208_a(this.field_73092_a, p_180235_1_, iblockstate, this.field_73090_b); -- boolean flag = this.field_73092_a.func_175698_g(p_180235_1_); -+ boolean flag = iblockstate.func_177230_c().removedByPlayer(field_73092_a, p_180235_1_, field_73090_b, canHarvest); - - if (flag) - { -@@ -246,7 +277,8 @@ - - public boolean func_180237_b(BlockPos p_180237_1_) - { -- if (this.field_73091_c.func_77145_d() && this.field_73090_b.func_70694_bm() != null && this.field_73090_b.func_70694_bm().func_77973_b() instanceof ItemSword) -+ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(field_73092_a, field_73091_c, field_73090_b, p_180237_1_); -+ if (exp == -1) - { - return false; - } -@@ -255,40 +287,21 @@ - IBlockState iblockstate = this.field_73092_a.func_180495_p(p_180237_1_); - TileEntity tileentity = this.field_73092_a.func_175625_s(p_180237_1_); - -- if (this.field_73091_c.func_82752_c()) -- { -- if (this.field_73091_c == WorldSettings.GameType.SPECTATOR) -- { -- return false; -- } -+ ItemStack stack = field_73090_b.func_71045_bC(); -+ if (stack != null && stack.func_77973_b().onBlockStartBreak(stack, p_180237_1_, field_73090_b)) return false; - -- if (!this.field_73090_b.func_175142_cm()) -- { -- ItemStack itemstack = this.field_73090_b.func_71045_bC(); -- -- if (itemstack == null) -- { -- return false; -- } -- -- if (!itemstack.func_179544_c(iblockstate.func_177230_c())) -- { -- return false; -- } -- } -- } -- - this.field_73092_a.func_180498_a(this.field_73090_b, 2001, p_180237_1_, Block.func_176210_f(iblockstate)); -- boolean flag1 = this.func_180235_c(p_180237_1_); -+ boolean flag1 = false; - - if (this.func_73083_d()) - { -+ flag1 = this.func_180235_c(p_180237_1_); - this.field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(this.field_73092_a, p_180237_1_)); - } - else - { - ItemStack itemstack1 = this.field_73090_b.func_71045_bC(); -- boolean flag = this.field_73090_b.func_146099_a(iblockstate.func_177230_c()); -+ boolean flag = iblockstate.func_177230_c().canHarvestBlock(field_73092_a, p_180237_1_, field_73090_b); - - if (itemstack1 != null) - { -@@ -300,12 +313,18 @@ - } - } - -+ flag1 = this.removeBlock(p_180237_1_, flag); - if (flag1 && flag) - { - iblockstate.func_177230_c().func_180657_a(this.field_73092_a, this.field_73090_b, p_180237_1_, iblockstate, tileentity); - } - } - -+ // Drop experiance -+ if (!this.func_73083_d() && flag1 && exp > 0) -+ { -+ iblockstate.func_177230_c().func_180637_b(field_73092_a, p_180237_1_, exp); -+ } - return flag1; - } - } -@@ -343,6 +362,7 @@ - if (itemstack1.field_77994_a == 0) - { - p_73085_1_.field_71071_by.field_70462_a[p_73085_1_.field_71071_by.field_70461_c] = null; -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_73085_1_, itemstack1); - } - - if (!p_73085_1_.func_71039_bw()) -@@ -387,33 +407,51 @@ - } - else - { -- if (!p_180236_1_.func_70093_af() || p_180236_1_.func_70694_bm() == null) -+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(p_180236_1_, -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, p_180236_2_, p_180236_4_, p_180236_5_); -+ if (event.isCanceled()) - { -- IBlockState iblockstate = p_180236_2_.func_180495_p(p_180236_4_); -- -- if (iblockstate.func_177230_c().func_180639_a(p_180236_2_, p_180236_4_, iblockstate, p_180236_1_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_)) -- { -- return true; -- } -+ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(field_73092_a, p_180236_4_)); -+ return false; - } - -- if (p_180236_3_ == null) -+ if (p_180236_3_ != null && p_180236_3_.func_77973_b().onItemUseFirst(p_180236_3_, p_180236_1_, p_180236_2_, p_180236_4_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_)) - { -- return false; -+ if (p_180236_3_.field_77994_a <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(field_73090_b, p_180236_3_); -+ return true; - } -- else if (this.func_73083_d()) -+ -+ IBlockState iblockstate = p_180236_2_.func_180495_p(p_180236_4_); -+ boolean isAir = p_180236_2_.func_175623_d(p_180236_4_); -+ boolean useBlock = !p_180236_1_.func_70093_af() || p_180236_1_.func_70694_bm() == null; -+ if (!useBlock) useBlock = p_180236_1_.func_70694_bm().func_77973_b().doesSneakBypassUse(p_180236_2_, p_180236_4_, p_180236_1_); -+ boolean result = false; -+ -+ if (useBlock) - { -- int j = p_180236_3_.func_77960_j(); -- int i = p_180236_3_.field_77994_a; -- boolean flag = p_180236_3_.func_179546_a(p_180236_1_, p_180236_2_, p_180236_4_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_); -- p_180236_3_.func_77964_b(j); -- p_180236_3_.field_77994_a = i; -- return flag; -+ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) -+ { -+ result = iblockstate.func_177230_c().func_180639_a(p_180236_2_, p_180236_4_, iblockstate, p_180236_1_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_); -+ } -+ else -+ { -+ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(field_73092_a, p_180236_4_)); -+ result = event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW; -+ } - } -- else -+ if (p_180236_3_ != null && !result && event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) - { -- return p_180236_3_.func_179546_a(p_180236_1_, p_180236_2_, p_180236_4_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_); -+ int meta = p_180236_3_.func_77960_j(); -+ int size = p_180236_3_.field_77994_a; -+ result = p_180236_3_.func_179546_a(p_180236_1_, p_180236_2_, p_180236_4_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_); -+ if (func_73083_d()) -+ { -+ p_180236_3_.func_77964_b(meta); -+ p_180236_3_.field_77994_a = size; -+ } -+ if (p_180236_3_.field_77994_a <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(field_73090_b, p_180236_3_); - } -+ return result; - } - } - -@@ -421,4 +459,13 @@ - { - this.field_73092_a = p_73080_1_; - } -+ -+ public double getBlockReachDistance() -+ { -+ return blockReachDistance; -+ } -+ public void setBlockReachDistance(double distance) -+ { -+ blockReachDistance = distance; -+ } - } diff --git a/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch deleted file mode 100644 index ac63a05cb..000000000 --- a/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch +++ /dev/null @@ -1,224 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/management/PlayerManager.java -+++ ../src-work/minecraft/net/minecraft/server/management/PlayerManager.java -@@ -122,15 +122,24 @@ - int j = (int)p_72683_1_.field_70161_v >> 4; - p_72683_1_.field_71131_d = p_72683_1_.field_70165_t; - p_72683_1_.field_71132_e = p_72683_1_.field_70161_v; -+ // Load nearby chunks first -+ List chunkList = new ArrayList(); - - for (int k = i - this.field_72698_e; k <= i + this.field_72698_e; ++k) - { - for (int l = j - this.field_72698_e; l <= j + this.field_72698_e; ++l) - { -- this.func_72690_a(k, l, true).func_73255_a(p_72683_1_); -+ chunkList.add(new ChunkCoordIntPair(k, l)); - } - } - -+ java.util.Collections.sort(chunkList, new net.minecraftforge.common.util.ChunkCoordComparator(p_72683_1_)); -+ -+ for (ChunkCoordIntPair pair : chunkList) -+ { -+ this.func_72690_a(pair.field_77276_a, pair.field_77275_b, true).func_73255_a(p_72683_1_); -+ } -+ - this.field_72699_b.add(p_72683_1_); - this.func_72691_b(p_72683_1_); - } -@@ -232,6 +241,7 @@ - int i1 = this.field_72698_e; - int j1 = i - k; - int k1 = j - l; -+ List chunksToLoad = new ArrayList(); - - if (j1 != 0 || k1 != 0) - { -@@ -241,7 +251,7 @@ - { - if (!this.func_72684_a(l1, i2, k, l, i1)) - { -- this.func_72690_a(l1, i2, true).func_73255_a(p_72685_1_); -+ chunksToLoad.add(new ChunkCoordIntPair(l1, i2)); - } - - if (!this.func_72684_a(l1 - j1, i2 - k1, i, j, i1)) -@@ -259,6 +269,18 @@ - this.func_72691_b(p_72685_1_); - p_72685_1_.field_71131_d = p_72685_1_.field_70165_t; - p_72685_1_.field_71132_e = p_72685_1_.field_70161_v; -+ // send nearest chunks first -+ java.util.Collections.sort(chunksToLoad, new net.minecraftforge.common.util.ChunkCoordComparator(p_72685_1_)); -+ -+ for (ChunkCoordIntPair pair : chunksToLoad) -+ { -+ this.func_72690_a(pair.field_77276_a, pair.field_77275_b, true).func_73255_a(p_72685_1_); -+ } -+ -+ if (i1 > 1 || i1 < -1 || j1 > 1 || j1 < -1) -+ { -+ java.util.Collections.sort(p_72685_1_.field_71129_f, new net.minecraftforge.common.util.ChunkCoordComparator(p_72685_1_)); -+ } - } - } - } -@@ -334,12 +356,21 @@ - private int field_73262_e; - private int field_73260_f; - private long field_111198_g; -+ private final java.util.HashMap players = new java.util.HashMap(); -+ private boolean loaded = false; -+ private Runnable loadedRunnable = new Runnable() -+ { -+ public void run() -+ { -+ PlayerInstance.this.loaded = true; -+ } -+ }; - private static final String __OBFID = "CL_00001435"; - - public PlayerInstance(int p_i1518_2_, int p_i1518_3_) - { - this.field_73264_c = new ChunkCoordIntPair(p_i1518_2_, p_i1518_3_); -- PlayerManager.this.func_72688_a().field_73059_b.func_73158_c(p_i1518_2_, p_i1518_3_); -+ PlayerManager.this.func_72688_a().field_73059_b.loadChunk(p_i1518_2_, p_i1518_3_, this.loadedRunnable); - } - - public void func_73255_a(EntityPlayerMP p_73255_1_) -@@ -356,7 +387,24 @@ - } - - this.field_73263_b.add(p_73255_1_); -+ Runnable playerRunnable = null; -+ if (this.loaded) -+ { - p_73255_1_.field_71129_f.add(this.field_73264_c); -+ } -+ else -+ { -+ final EntityPlayerMP tmp = p_73255_1_; -+ playerRunnable = new Runnable() -+ { -+ public void run() -+ { -+ tmp.field_71129_f.add(PlayerInstance.this.field_73264_c); -+ } -+ }; -+ PlayerManager.this.func_72688_a().field_73059_b.loadChunk(this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b, playerRunnable); -+ } -+ this.players.put(p_73255_1_, playerRunnable); - } - } - -@@ -364,6 +412,24 @@ - { - if (this.field_73263_b.contains(p_73252_1_)) - { -+ // If we haven't loaded yet don't load the chunk just so we can clean it up -+ if (!this.loaded) -+ { -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.func_72688_a(), this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b, this.players.get(p_73252_1_)); -+ this.field_73263_b.remove(p_73252_1_); -+ this.players.remove(p_73252_1_); -+ -+ if (this.field_73263_b.isEmpty()) -+ { -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.func_72688_a(), this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b, this.loadedRunnable); -+ long i = (long) this.field_73264_c.field_77276_a + 2147483647L | (long) this.field_73264_c.field_77275_b + 2147483647L << 32; -+ PlayerManager.this.field_72700_c.func_76159_d(i); -+ PlayerManager.this.field_111193_e.remove(this); -+ } -+ -+ return; -+ } -+ - Chunk chunk = PlayerManager.this.field_72701_a.func_72964_e(this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b); - - if (chunk.func_150802_k()) -@@ -371,9 +437,12 @@ - p_73252_1_.field_71135_a.func_147359_a(new S21PacketChunkData(chunk, true, 0)); - } - -+ this.players.remove(p_73252_1_); - this.field_73263_b.remove(p_73252_1_); - p_73252_1_.field_71129_f.remove(this.field_73264_c); - -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.UnWatch(field_73264_c, p_73252_1_)); -+ - if (this.field_73263_b.isEmpty()) - { - long i = (long)this.field_73264_c.field_77276_a + 2147483647L | (long)this.field_73264_c.field_77275_b + 2147483647L << 32; -@@ -411,7 +480,7 @@ - - this.field_73260_f |= 1 << (p_151253_2_ >> 4); - -- if (this.field_73262_e < 64) -+ //Forge; Cache everything, so always run - { - short short1 = (short)(p_151253_1_ << 12 | p_151253_3_ << 8 | p_151253_2_); - -@@ -423,6 +492,10 @@ - } - } - -+ if (field_73262_e == field_151254_d.length) -+ { -+ field_151254_d = java.util.Arrays.copyOf(field_151254_d, field_151254_d.length << 1); -+ } - this.field_151254_d[this.field_73262_e++] = short1; - } - } -@@ -440,6 +513,7 @@ - } - } - -+ @SuppressWarnings("unused") - public void func_73254_a() - { - if (this.field_73262_e != 0) -@@ -456,7 +530,7 @@ - BlockPos blockpos = new BlockPos(i, j, k); - this.func_151251_a(new S23PacketBlockChange(PlayerManager.this.field_72701_a, blockpos)); - -- if (PlayerManager.this.field_72701_a.func_180495_p(blockpos).func_177230_c().func_149716_u()) -+ if (PlayerManager.this.field_72701_a.func_180495_p(blockpos).func_177230_c().hasTileEntity(PlayerManager.this.field_72701_a.func_180495_p(blockpos))) - { - this.func_151252_a(PlayerManager.this.field_72701_a.func_175625_s(blockpos)); - } -@@ -465,13 +539,14 @@ - { - int i1; - -- if (this.field_73262_e == 64) -+ if (this.field_73262_e >= net.minecraftforge.common.ForgeModContainer.clumpingThreshold) - { - i = this.field_73264_c.field_77276_a * 16; - j = this.field_73264_c.field_77275_b * 16; - this.func_151251_a(new S21PacketChunkData(PlayerManager.this.field_72701_a.func_72964_e(this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b), false, this.field_73260_f)); - -- for (k = 0; k < 16; ++k) -+ // Forge: Grabs ALL tile entities is costly on a modded server, only send needed ones -+ for (k = 0; false && k < 16; ++k) - { - if ((this.field_73260_f & 1 << k) != 0) - { -@@ -488,7 +563,10 @@ - else - { - this.func_151251_a(new S22PacketMultiBlockChange(this.field_73262_e, this.field_151254_d, PlayerManager.this.field_72701_a.func_72964_e(this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b))); -+ } - -+ { //Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small -+ WorldServer world = PlayerManager.this.field_72701_a; - for (i = 0; i < this.field_73262_e; ++i) - { - j = (this.field_151254_d[i] >> 12 & 15) + this.field_73264_c.field_77276_a * 16; -@@ -496,7 +574,7 @@ - i1 = (this.field_151254_d[i] >> 8 & 15) + this.field_73264_c.field_77275_b * 16; - BlockPos blockpos1 = new BlockPos(j, k, i1); - -- if (PlayerManager.this.field_72701_a.func_180495_p(blockpos1).func_177230_c().func_149716_u()) -+ if (world.func_180495_p(blockpos1).func_177230_c().hasTileEntity(world.func_180495_p(blockpos1))) - { - this.func_151252_a(PlayerManager.this.field_72701_a.func_175625_s(blockpos1)); - } diff --git a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch deleted file mode 100644 index 25704f821..000000000 --- a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch +++ /dev/null @@ -1,223 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/management/ServerConfigurationManager.java -+++ ../src-work/minecraft/net/minecraft/server/management/ServerConfigurationManager.java -@@ -103,7 +103,7 @@ - this.field_72405_c = 8; - } - -- public void func_72355_a(NetworkManager p_72355_1_, EntityPlayerMP p_72355_2_) -+ public void func_72355_a(NetworkManager p_72355_1_, EntityPlayerMP p_72355_2_, NetHandlerPlayServer nethandlerplayserver) - { - GameProfile gameprofile = p_72355_2_.func_146103_bH(); - PlayerProfileCache playerprofilecache = this.field_72400_f.func_152358_ax(); -@@ -112,6 +112,17 @@ - playerprofilecache.func_152649_a(gameprofile); - NBTTagCompound nbttagcompound = this.func_72380_a(p_72355_2_); - p_72355_2_.func_70029_a(this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK)); -+ -+ World playerWorld = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK); -+ if (playerWorld == null) -+ { -+ p_72355_2_.field_71093_bK=0; -+ playerWorld=this.field_72400_f.func_71218_a(0); -+ BlockPos spawnPoint = playerWorld.field_73011_w.getRandomizedSpawnPoint(); -+ p_72355_2_.func_70107_b(spawnPoint.func_177958_n(), spawnPoint.func_177956_o(), spawnPoint.func_177952_p()); -+ } -+ -+ p_72355_2_.func_70029_a(playerWorld); - p_72355_2_.field_71134_c.func_73080_a((WorldServer)p_72355_2_.field_70170_p); - String s1 = "local"; - -@@ -125,7 +136,7 @@ - WorldInfo worldinfo = worldserver.func_72912_H(); - BlockPos blockpos = worldserver.func_175694_M(); - this.func_72381_a(p_72355_2_, (EntityPlayerMP)null, worldserver); -- NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.field_72400_f, p_72355_1_, p_72355_2_); -+ p_72355_2_.field_71135_a = nethandlerplayserver; - nethandlerplayserver.func_147359_a(new S01PacketJoinGame(p_72355_2_.func_145782_y(), p_72355_2_.field_71134_c.func_73081_b(), worldinfo.func_76093_s(), worldserver.field_73011_w.func_177502_q(), worldserver.func_175659_aa(), this.func_72352_l(), worldinfo.func_76067_t(), worldserver.func_82736_K().func_82766_b("reducedDebugInfo"))); - nethandlerplayserver.func_147359_a(new S3FPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).func_180714_a(this.func_72365_p().getServerModName()))); - nethandlerplayserver.func_147359_a(new S41PacketServerDifficulty(worldinfo.func_176130_y(), worldinfo.func_176123_z())); -@@ -168,6 +179,7 @@ - - p_72355_2_.func_71116_b(); - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedIn(p_72355_2_); - if (nbttagcompound != null && nbttagcompound.func_150297_b("Riding", 10)) - { - Entity entity = EntityList.func_75615_a(nbttagcompound.func_74775_l("Riding"), worldserver); -@@ -272,6 +284,7 @@ - p_72380_1_.func_70020_e(nbttagcompound); - nbttagcompound1 = nbttagcompound; - 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()); - } - else - { -@@ -281,8 +294,23 @@ - return nbttagcompound1; - } - -+ public NBTTagCompound getPlayerNBT(EntityPlayerMP player) -+ { -+ // Hacky method to allow loading the NBT for a player prior to login -+ NBTTagCompound nbttagcompound = this.field_72400_f.field_71305_c[0].func_72912_H().func_76072_h(); -+ if (player.func_70005_c_().equals(this.field_72400_f.func_71214_G()) && nbttagcompound != null) -+ { -+ return nbttagcompound; -+ } -+ else -+ { -+ return ((net.minecraft.world.storage.SaveHandler)this.field_72412_k).getPlayerNBT(player); -+ } -+ } - protected void func_72391_b(EntityPlayerMP p_72391_1_) - { -+ if (p_72391_1_.field_71135_a == null) return; -+ - this.field_72412_k.func_75753_a(p_72391_1_); - StatisticsFile statisticsfile = (StatisticsFile)this.field_148547_k.get(p_72391_1_.func_110124_au()); - -@@ -298,6 +326,7 @@ - this.field_177454_f.put(p_72377_1_.func_110124_au(), p_72377_1_); - this.func_148540_a(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {p_72377_1_})); - WorldServer worldserver = this.field_72400_f.func_71218_a(p_72377_1_.field_71093_bK); -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.func_72394_k()); - worldserver.func_72838_d(p_72377_1_); - this.func_72375_a(p_72377_1_, (WorldServer)null); - -@@ -315,6 +344,7 @@ - - public void func_72367_e(EntityPlayerMP p_72367_1_) - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedOut(p_72367_1_); - p_72367_1_.func_71029_a(StatList.field_75947_j); - this.func_72391_b(p_72367_1_); - WorldServer worldserver = p_72367_1_.func_71121_q(); -@@ -330,6 +360,7 @@ - this.field_72404_b.remove(p_72367_1_); - this.field_177454_f.remove(p_72367_1_.func_110124_au()); - this.field_148547_k.remove(p_72367_1_.func_110124_au()); -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.func_72394_k()); - this.func_148540_a(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {p_72367_1_})); - } - -@@ -411,13 +442,23 @@ - - public EntityPlayerMP func_72368_a(EntityPlayerMP p_72368_1_, int p_72368_2_, boolean p_72368_3_) - { -+ World world = field_72400_f.func_71218_a(p_72368_2_); -+ if (world == null) -+ { -+ p_72368_2_ = 0; -+ } -+ else if (!world.field_73011_w.func_76567_e()) -+ { -+ p_72368_2_ = world.field_73011_w.getRespawnDimension(p_72368_1_); -+ } -+ - p_72368_1_.func_71121_q().func_73039_n().func_72787_a(p_72368_1_); - p_72368_1_.func_71121_q().func_73039_n().func_72790_b(p_72368_1_); - p_72368_1_.func_71121_q().func_73040_p().func_72695_c(p_72368_1_); - this.field_72404_b.remove(p_72368_1_); - this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK).func_72973_f(p_72368_1_); -- BlockPos blockpos = p_72368_1_.func_180470_cg(); -- boolean flag1 = p_72368_1_.func_82245_bX(); -+ BlockPos blockpos = p_72368_1_.getBedLocation(p_72368_2_); -+ boolean flag1 = p_72368_1_.isSpawnForced(p_72368_2_); - p_72368_1_.field_71093_bK = p_72368_2_; - Object object; - -@@ -433,6 +474,7 @@ - EntityPlayerMP entityplayermp1 = new EntityPlayerMP(this.field_72400_f, this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK), p_72368_1_.func_146103_bH(), (ItemInWorldManager)object); - entityplayermp1.field_71135_a = p_72368_1_.field_71135_a; - entityplayermp1.func_71049_a(p_72368_1_, p_72368_3_); -+ entityplayermp1.field_71093_bK = p_72368_2_; - entityplayermp1.func_145769_d(p_72368_1_.func_145782_y()); - entityplayermp1.func_174817_o(p_72368_1_); - WorldServer worldserver = this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK); -@@ -473,19 +515,25 @@ - this.field_177454_f.put(entityplayermp1.func_110124_au(), entityplayermp1); - entityplayermp1.func_71116_b(); - entityplayermp1.func_70606_j(entityplayermp1.func_110143_aJ()); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp1); - return entityplayermp1; - } - - public void func_72356_a(EntityPlayerMP p_72356_1_, int p_72356_2_) - { -+ transferPlayerToDimension(p_72356_1_, p_72356_2_, field_72400_f.func_71218_a(p_72356_2_).func_85176_s()); -+ } -+ -+ public void transferPlayerToDimension(EntityPlayerMP p_72356_1_, int p_72356_2_, net.minecraft.world.Teleporter teleporter) -+ { - int j = p_72356_1_.field_71093_bK; - WorldServer worldserver = this.field_72400_f.func_71218_a(p_72356_1_.field_71093_bK); - p_72356_1_.field_71093_bK = p_72356_2_; - WorldServer worldserver1 = this.field_72400_f.func_71218_a(p_72356_1_.field_71093_bK); -- p_72356_1_.field_71135_a.func_147359_a(new S07PacketRespawn(p_72356_1_.field_71093_bK, p_72356_1_.field_70170_p.func_175659_aa(), p_72356_1_.field_70170_p.func_72912_H().func_76067_t(), p_72356_1_.field_71134_c.func_73081_b())); -+ p_72356_1_.field_71135_a.func_147359_a(new S07PacketRespawn(p_72356_1_.field_71093_bK, worldserver1.func_175659_aa(), worldserver1.func_72912_H().func_76067_t(), p_72356_1_.field_71134_c.func_73081_b())); // Forge: Use new dimensions information - worldserver.func_72973_f(p_72356_1_); - p_72356_1_.field_70128_L = false; -- this.func_82448_a(p_72356_1_, j, worldserver, worldserver1); -+ this.transferEntityToWorld(p_72356_1_, j, worldserver, worldserver1, teleporter); - this.func_72375_a(p_72356_1_, worldserver); - p_72356_1_.field_71135_a.func_147364_a(p_72356_1_.field_70165_t, p_72356_1_.field_70163_u, p_72356_1_.field_70161_v, p_72356_1_.field_70177_z, p_72356_1_.field_70125_A); - p_72356_1_.field_71134_c.func_73080_a(worldserver1); -@@ -498,17 +546,27 @@ - PotionEffect potioneffect = (PotionEffect)iterator.next(); - p_72356_1_.field_71135_a.func_147359_a(new S1DPacketEntityEffect(p_72356_1_.func_145782_y(), potioneffect)); - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(p_72356_1_, j, p_72356_2_); - } - - public void func_82448_a(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_) - { -- double d0 = p_82448_1_.field_70165_t; -- double d1 = p_82448_1_.field_70161_v; -+ transferEntityToWorld(p_82448_1_, p_82448_2_, p_82448_3_, p_82448_4_, p_82448_4_.func_85176_s()); -+ } -+ -+ @SuppressWarnings("unused") -+ public void transferEntityToWorld(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, net.minecraft.world.Teleporter teleporter) -+ { -+ net.minecraft.world.WorldProvider pOld = p_82448_3_.field_73011_w; -+ net.minecraft.world.WorldProvider pNew = p_82448_4_.field_73011_w; -+ double moveFactor = pOld.getMovementFactor() / pNew.getMovementFactor(); -+ double d0 = p_82448_1_.field_70165_t * moveFactor; -+ double d1 = p_82448_1_.field_70161_v * moveFactor; - double d2 = 8.0D; - float f = p_82448_1_.field_70177_z; - p_82448_3_.field_72984_F.func_76320_a("moving"); - -- if (p_82448_1_.field_71093_bK == -1) -+ if (false && p_82448_1_.field_71093_bK == -1) //Forge Kill it but dont comment out so we can rename it. - { - d0 = MathHelper.func_151237_a(d0 / d2, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D); - d1 = MathHelper.func_151237_a(d1 / d2, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D); -@@ -519,7 +577,7 @@ - p_82448_3_.func_72866_a(p_82448_1_, false); - } - } -- else if (p_82448_1_.field_71093_bK == 0) -+ else if (false && p_82448_1_.field_71093_bK == 0) //Forge Kill it but dont comment out so we can rename it. - { - d0 = MathHelper.func_151237_a(d0 * d2, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D); - d1 = MathHelper.func_151237_a(d1 * d2, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D); -@@ -530,7 +588,8 @@ - p_82448_3_.func_72866_a(p_82448_1_, false); - } - } -- else -+ -+ if (p_82448_1_.field_71093_bK == 1) - { - BlockPos blockpos; - -@@ -565,7 +624,7 @@ - if (p_82448_1_.func_70089_S()) - { - p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, p_82448_1_.field_70177_z, p_82448_1_.field_70125_A); -- p_82448_4_.func_85176_s().func_180266_a(p_82448_1_, f); -+ teleporter.func_180266_a(p_82448_1_, f); - p_82448_4_.func_72838_d(p_82448_1_); - p_82448_4_.func_72866_a(p_82448_1_, false); - } diff --git a/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch b/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch deleted file mode 100644 index b77bfc330..000000000 --- a/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java -+++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java -@@ -62,7 +62,7 @@ - this.func_147326_c(); - } - -- if (this.field_147336_h++ == 600) -+ if (this.field_147336_h++ == net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.LOGIN_TIMEOUT) - { - this.func_147322_a("Took too long to log in"); - } -@@ -113,7 +113,7 @@ - } - - this.field_147333_a.func_179290_a(new S02PacketLoginSuccess(this.field_147337_i)); -- this.field_147327_f.func_71203_ab().func_72355_a(this.field_147333_a, this.field_147327_f.func_71203_ab().func_148545_a(this.field_147337_i)); -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.field_147327_f.func_71203_ab(), this.field_147333_a, this.field_147327_f.func_71203_ab().func_148545_a(this.field_147337_i)); - } - } - diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch deleted file mode 100644 index 4796b71dc..000000000 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBeacon.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBeacon.java -@@ -178,7 +178,7 @@ - { - Block block = this.field_145850_b.func_180495_p(new BlockPos(l1, k1, j1)).func_177230_c(); - -- if (block != Blocks.field_150475_bE && block != Blocks.field_150340_R && block != Blocks.field_150484_ah && block != Blocks.field_150339_S) -+ if (!block.isBeaconBase(this.field_145850_b, new BlockPos(l1, k1, j1), func_174877_v())) - { - flag1 = false; - break; -@@ -363,7 +363,7 @@ - - public boolean func_94041_b(int p_94041_1_, ItemStack p_94041_2_) - { -- return p_94041_2_.func_77973_b() == Items.field_151166_bC || p_94041_2_.func_77973_b() == Items.field_151045_i || p_94041_2_.func_77973_b() == Items.field_151043_k || p_94041_2_.func_77973_b() == Items.field_151042_j; -+ return p_94041_2_.func_77973_b() != null && p_94041_2_.func_77973_b().isBeaconPayment(p_94041_2_); - } - - public String func_174875_k() diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch deleted file mode 100644 index 91343f16a..000000000 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch +++ /dev/null @@ -1,78 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java -@@ -104,7 +104,7 @@ - - private boolean func_145934_k() - { -- if (this.field_145945_j[3] != null && this.field_145945_j[3].field_77994_a > 0) -+ if (this.field_145945_j[3] != null && this.field_145945_j[3].field_77994_a > 0 && false) // Code moved to net.minecraftforge.common.brewing.VanillaBrewingRecipe - { - ItemStack itemstack = this.field_145945_j[3]; - -@@ -118,7 +118,7 @@ - - for (int i = 0; i < 3; ++i) - { -- if (this.field_145945_j[i] != null && this.field_145945_j[i].func_77973_b() == Items.field_151068_bn) -+ if (this.field_145945_j[i] != null && this.field_145945_j[i].func_77973_b() instanceof ItemPotion) - { - int j = this.field_145945_j[i].func_77960_j(); - int k = this.func_145936_c(j, itemstack); -@@ -145,19 +145,22 @@ - } - else - { -- return false; -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.canBrew(field_145945_j, field_145945_j[3], field_145947_i); - } - } - - private void func_145940_l() - { -+ if (net.minecraftforge.event.ForgeEventFactory.onPotionAttemptBreaw(field_145945_j)) return; - if (this.func_145934_k()) - { -+ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(field_145945_j, field_145945_j[3], field_145947_i); - ItemStack itemstack = this.field_145945_j[3]; - -+ if (false) { // Code moved to net.minecraftforge.common.brewing.VanillaBrewingRecipe - for (int i = 0; i < 3; ++i) - { -- if (this.field_145945_j[i] != null && this.field_145945_j[i].func_77973_b() == Items.field_151068_bn) -+ if (this.field_145945_j[i] != null && this.field_145945_j[i].func_77973_b() instanceof ItemPotion) - { - int j = this.field_145945_j[i].func_77960_j(); - int k = this.func_145936_c(j, itemstack); -@@ -177,10 +180,11 @@ - } - } - } -+ } - -- if (itemstack.func_77973_b().func_77634_r()) -+ if (itemstack.func_77973_b().hasContainerItem(itemstack)) - { -- this.field_145945_j[3] = new ItemStack(itemstack.func_77973_b().func_77668_q()); -+ this.field_145945_j[3] = itemstack.func_77973_b().getContainerItem(itemstack); - } - else - { -@@ -191,6 +195,7 @@ - this.field_145945_j[3] = null; - } - } -+ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(field_145945_j); - } - } - -@@ -306,7 +311,9 @@ - - public boolean func_94041_b(int p_94041_1_, ItemStack p_94041_2_) - { -- return p_94041_1_ == 3 ? p_94041_2_.func_77973_b().func_150892_m(p_94041_2_) : p_94041_2_.func_77973_b() == Items.field_151068_bn || p_94041_2_.func_77973_b() == Items.field_151069_bo; -+ if (p_94041_1_ == 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(p_94041_2_)) return true; -+ else if (p_94041_1_ != 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_94041_2_)) return true; -+ return false; - } - - public boolean[] func_174902_m() diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch deleted file mode 100644 index 7fd469917..000000000 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityFurnace.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityFurnace.java -@@ -233,8 +233,7 @@ - - if (this.field_145957_n[1].field_77994_a == 0) - { -- Item item = this.field_145957_n[1].func_77973_b().func_77668_q(); -- this.field_145957_n[1] = item != null ? new ItemStack(item) : null; -+ this.field_145957_n[1] = field_145957_n[1].func_77973_b().getContainerItem(field_145957_n[1]); - } - } - } -@@ -285,7 +284,11 @@ - else - { - ItemStack itemstack = FurnaceRecipes.func_77602_a().func_151395_a(this.field_145957_n[0]); -- return itemstack == null ? false : (this.field_145957_n[2] == null ? true : (!this.field_145957_n[2].func_77969_a(itemstack) ? false : (this.field_145957_n[2].field_77994_a < this.func_70297_j_() && this.field_145957_n[2].field_77994_a < this.field_145957_n[2].func_77976_d() ? true : this.field_145957_n[2].field_77994_a < itemstack.func_77976_d()))); -+ if (itemstack == null) return false; -+ if (this.field_145957_n[2] == null) return true; -+ if (!this.field_145957_n[2].func_77969_a(itemstack)) return false; -+ int result = field_145957_n[2].field_77994_a + itemstack.field_77994_a; -+ return result <= func_70297_j_() && result <= this.field_145957_n[2].func_77976_d(); //Forge BugFix: Make it respect stack sizes properly. - } - } - -@@ -301,7 +304,7 @@ - } - else if (this.field_145957_n[2].func_77973_b() == itemstack.func_77973_b()) - { -- ++this.field_145957_n[2].field_77994_a; -+ this.field_145957_n[2].field_77994_a += itemstack.field_77994_a; // Forge BugFix: Results may have multiple items - } - - if (this.field_145957_n[0].func_77973_b() == Item.func_150898_a(Blocks.field_150360_v) && this.field_145957_n[0].func_77960_j() == 1 && this.field_145957_n[1] != null && this.field_145957_n[1].func_77973_b() == Items.field_151133_ar) -@@ -348,7 +351,15 @@ - } - } - -- return item instanceof ItemTool && ((ItemTool)item).func_77861_e().equals("WOOD") ? 200 : (item instanceof ItemSword && ((ItemSword)item).func_150932_j().equals("WOOD") ? 200 : (item instanceof ItemHoe && ((ItemHoe)item).func_77842_f().equals("WOOD") ? 200 : (item == Items.field_151055_y ? 100 : (item == Items.field_151044_h ? 1600 : (item == Items.field_151129_at ? 20000 : (item == Item.func_150898_a(Blocks.field_150345_g) ? 100 : (item == Items.field_151072_bj ? 2400 : 0))))))); -+ if (item instanceof ItemTool && ((ItemTool)item).func_77861_e().equals("WOOD")) return 200; -+ if (item instanceof ItemSword && ((ItemSword)item).func_150932_j().equals("WOOD")) return 200; -+ if (item instanceof ItemHoe && ((ItemHoe)item).func_77842_f().equals("WOOD")) return 200; -+ if (item == Items.field_151055_y) return 100; -+ if (item == Items.field_151044_h) return 1600; -+ if (item == Items.field_151129_at) return 20000; -+ if (item == Item.func_150898_a(Blocks.field_150345_g)) return 100; -+ if (item == Items.field_151072_bj) return 2400; -+ return net.minecraftforge.fml.common.registry.GameRegistry.getFuelValue(p_145952_0_); - } - } - diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch deleted file mode 100644 index 2ed472779..000000000 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityHopper.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityHopper.java -@@ -523,17 +523,30 @@ - - if (itemstack1 == null) - { -- p_174916_0_.func_70299_a(p_174916_2_, p_174916_1_); -- p_174916_1_ = null; -+ //Forge: BUGFIX: Again, make things respect max stack sizes. -+ int max = Math.min(p_174916_1_.func_77976_d(), p_174916_0_.func_70297_j_()); -+ if (max >= p_174916_1_.field_77994_a) -+ { -+ p_174916_0_.func_70299_a(p_174916_2_, p_174916_1_); -+ p_174916_1_ = null; -+ } -+ else -+ { -+ p_174916_0_.func_70299_a(p_174916_2_, p_174916_1_.func_77979_a(max)); -+ } - flag = true; - } - else if (func_145894_a(itemstack1, p_174916_1_)) - { -- int j = p_174916_1_.func_77976_d() - itemstack1.field_77994_a; -- int k = Math.min(p_174916_1_.field_77994_a, j); -- p_174916_1_.field_77994_a -= k; -- itemstack1.field_77994_a += k; -- flag = k > 0; -+ //Forge: BUGFIX: Again, make things respect max stack sizes. -+ int max = Math.min(p_174916_1_.func_77976_d(), p_174916_0_.func_70297_j_()); -+ if (max > itemstack1.field_77994_a) -+ { -+ int size = Math.min(p_174916_1_.field_77994_a, max - itemstack1.field_77994_a); -+ p_174916_1_.field_77994_a -= size; -+ itemstack1.field_77994_a += size; -+ flag = size > 0; -+ } - } - - if (flag) diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch deleted file mode 100644 index 4c1454b57..000000000 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityPiston.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityPiston.java -@@ -151,7 +151,8 @@ - if (this.field_145850_b.func_180495_p(this.field_174879_c).func_177230_c() == Blocks.field_180384_M) - { - this.field_145850_b.func_180501_a(this.field_174879_c, this.field_174932_a, 3); -- this.field_145850_b.func_180496_d(this.field_174879_c, this.field_174932_a.func_177230_c()); -+ if(!net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(field_145850_b, field_174879_c, field_145850_b.func_180495_p(field_174879_c), java.util.EnumSet.noneOf(EnumFacing.class)).isCanceled()) -+ this.field_145850_b.func_180496_d(this.field_174879_c, this.field_174932_a.func_177230_c()); - } - } - } -@@ -169,7 +170,8 @@ - if (this.field_145850_b.func_180495_p(this.field_174879_c).func_177230_c() == Blocks.field_180384_M) - { - this.field_145850_b.func_180501_a(this.field_174879_c, this.field_174932_a, 3); -- this.field_145850_b.func_180496_d(this.field_174879_c, this.field_174932_a.func_177230_c()); -+ if(!net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(field_145850_b, field_174879_c, field_145850_b.func_180495_p(field_174879_c), java.util.EnumSet.noneOf(EnumFacing.class)).isCanceled()) -+ this.field_145850_b.func_180496_d(this.field_174879_c, this.field_174932_a.func_177230_c()); - } - } - else diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch deleted file mode 100644 index d1cc9e896..000000000 --- a/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntitySign.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntitySign.java -@@ -161,7 +161,7 @@ - public void func_145747_a(IChatComponent p_145747_1_) {} - public boolean func_70003_b(int p_70003_1_, String p_70003_2_) - { -- return true; -+ return p_70003_1_ <= 2; //Forge: Fixes MC-75630 - Exploit with signs and command blocks - } - public BlockPos func_180425_c() - { diff --git a/patches/minecraft/net/minecraft/util/Vec3.java.patch b/patches/minecraft/net/minecraft/util/Vec3.java.patch deleted file mode 100644 index 0ad59ca10..000000000 --- a/patches/minecraft/net/minecraft/util/Vec3.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/Vec3.java -+++ ../src-work/minecraft/net/minecraft/util/Vec3.java -@@ -1,8 +1,5 @@ - package net.minecraft.util; - --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; -- - public class Vec3 - { - public final double field_72450_a; -@@ -32,7 +29,6 @@ - this.field_72449_c = p_i1108_5_; - } - -- @SideOnly(Side.CLIENT) - public Vec3 func_72444_a(Vec3 p_72444_1_) - { - return new Vec3(p_72444_1_.field_72450_a - this.field_72450_a, p_72444_1_.field_72448_b - this.field_72448_b, p_72444_1_.field_72449_c - this.field_72449_c); -@@ -49,7 +45,6 @@ - return this.field_72450_a * p_72430_1_.field_72450_a + this.field_72448_b * p_72430_1_.field_72448_b + this.field_72449_c * p_72430_1_.field_72449_c; - } - -- @SideOnly(Side.CLIENT) - public Vec3 func_72431_c(Vec3 p_72431_1_) - { - return new Vec3(this.field_72448_b * p_72431_1_.field_72449_c - this.field_72449_c * p_72431_1_.field_72448_b, this.field_72449_c * p_72431_1_.field_72450_a - this.field_72450_a * p_72431_1_.field_72449_c, this.field_72450_a * p_72431_1_.field_72448_b - this.field_72448_b * p_72431_1_.field_72450_a); diff --git a/patches/minecraft/net/minecraft/world/ChunkCache.java.patch b/patches/minecraft/net/minecraft/world/ChunkCache.java.patch deleted file mode 100644 index 1fd5bcd2f..000000000 --- a/patches/minecraft/net/minecraft/world/ChunkCache.java.patch +++ /dev/null @@ -1,61 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/ChunkCache.java -+++ ../src-work/minecraft/net/minecraft/world/ChunkCache.java -@@ -64,6 +64,8 @@ - { - int i = (p_175625_1_.func_177958_n() >> 4) - this.field_72818_a; - int j = (p_175625_1_.func_177952_p() >> 4) - this.field_72816_b; -+ if (i < 0 || i >= field_72817_c.length || j < 0 || j >= field_72817_c[i].length) return null; -+ if (field_72817_c[i][j] == null) return null; - return this.field_72817_c[i][j].func_177424_a(p_175625_1_, Chunk.EnumCreateEntityType.IMMEDIATE); - } - -@@ -87,6 +89,7 @@ - { - int i = (p_180495_1_.func_177958_n() >> 4) - this.field_72818_a; - int j = (p_180495_1_.func_177952_p() >> 4) - this.field_72816_b; -+ if (i < 0 || i >= field_72817_c.length || j < 0 || i >= field_72817_c[i].length) return Blocks.field_150350_a.func_176223_P(); - - if (i >= 0 && i < this.field_72817_c.length && j >= 0 && j < this.field_72817_c[i].length) - { -@@ -147,6 +150,8 @@ - { - i = (p_175629_2_.func_177958_n() >> 4) - this.field_72818_a; - int j = (p_175629_2_.func_177952_p() >> 4) - this.field_72816_b; -+ if (i < 0 || i >= field_72817_c.length || j < 0 || j >= field_72817_c[i].length) return p_175629_1_.field_77198_c; -+ if (field_72817_c[i][j] == null) return p_175629_1_.field_77198_c; - return this.field_72817_c[i][j].func_177413_a(p_175629_1_, p_175629_2_); - } - } -@@ -158,7 +163,7 @@ - - public boolean func_175623_d(BlockPos p_175623_1_) - { -- return this.func_180495_p(p_175623_1_).func_177230_c().func_149688_o() == Material.field_151579_a; -+ return this.func_180495_p(p_175623_1_).func_177230_c().isAir(this, p_175623_1_); - } - - @SideOnly(Side.CLIENT) -@@ -168,6 +173,7 @@ - { - int i = (p_175628_2_.func_177958_n() >> 4) - this.field_72818_a; - int j = (p_175628_2_.func_177952_p() >> 4) - this.field_72816_b; -+ if (i < 0 || i >= field_72817_c.length || j < 0 || i >= field_72817_c[i].length) return p_175628_1_.field_77198_c; - return this.field_72817_c[i][j].func_177413_a(p_175628_1_, p_175628_2_); - } - else -@@ -187,4 +193,15 @@ - { - return this.field_72815_e.func_175624_G(); - } -+ -+ @Override -+ public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) -+ { -+ int x = (pos.func_177958_n() >> 4) - this.field_72818_a; -+ int z = (pos.func_177952_p() >> 4) - this.field_72816_b; -+ if (pos.func_177956_o() >= 0 && pos.func_177956_o() < 256) return _default; -+ if (x < 0 || x >= field_72817_c.length || z < 0 || x >= field_72817_c[x].length) return _default; -+ -+ return func_180495_p(pos).func_177230_c().isSideSolid(this, pos, side); -+ } - } diff --git a/patches/minecraft/net/minecraft/world/Explosion.java.patch b/patches/minecraft/net/minecraft/world/Explosion.java.patch deleted file mode 100644 index c7d47ad51..000000000 --- a/patches/minecraft/net/minecraft/world/Explosion.java.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/Explosion.java -+++ ../src-work/minecraft/net/minecraft/world/Explosion.java -@@ -40,6 +40,7 @@ - private final List field_77281_g; - private final Map field_77288_k; - private static final String __OBFID = "CL_00000134"; -+ private final Vec3 position; - - @SideOnly(Side.CLIENT) - public Explosion(World p_i45752_1_, Entity p_i45752_2_, double p_i45752_3_, double p_i45752_5_, double p_i45752_7_, float p_i45752_9_, List p_i45752_10_) -@@ -67,6 +68,7 @@ - this.field_77282_d = p_i45754_7_; - this.field_77286_a = p_i45754_10_; - this.field_82755_b = p_i45754_11_; -+ this.position = new Vec3(field_77284_b, field_77285_c, field_77282_d); - } - - public void func_77278_a() -@@ -103,7 +105,7 @@ - - if (iblockstate.func_177230_c().func_149688_o() != Material.field_151579_a) - { -- float f2 = this.field_77283_e != null ? this.field_77283_e.func_180428_a(this, this.field_77287_j, blockpos, iblockstate) : iblockstate.func_177230_c().func_149638_a((Entity)null); -+ float f2 = this.field_77283_e != null ? this.field_77283_e.func_180428_a(this, this.field_77287_j, blockpos, iblockstate) : iblockstate.func_177230_c().getExplosionResistance(field_77287_j, blockpos, (Entity)null, this); - f -= (f2 + 0.3F) * 0.3F; - } - -@@ -130,6 +132,7 @@ - int k1 = MathHelper.func_76128_c(this.field_77282_d - (double)f3 - 1.0D); - int i1 = MathHelper.func_76128_c(this.field_77282_d + (double)f3 + 1.0D); - List list = this.field_77287_j.func_72839_b(this.field_77283_e, new AxisAlignedBB((double)j, (double)j1, (double)k1, (double)k, (double)l, (double)i1)); -+ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.field_77287_j, this, list, f3); - Vec3 vec3 = new Vec3(this.field_77284_b, this.field_77285_c, this.field_77282_d); - - for (int l1 = 0; l1 < list.size(); ++l1) -@@ -223,8 +226,7 @@ - block.func_180653_a(this.field_77287_j, blockpos, this.field_77287_j.func_180495_p(blockpos), 1.0F / this.field_77280_f, 0); - } - -- 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); -+ block.onBlockExploded(this.field_77287_j, blockpos, this); - } - } - } -@@ -264,4 +266,6 @@ - { - return this.field_77281_g; - } -+ -+ public Vec3 getPosition(){ return this.position; } - } diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch deleted file mode 100644 index d8bf6c7f2..000000000 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ /dev/null @@ -1,930 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/World.java -+++ ../src-work/minecraft/net/minecraft/world/World.java -@@ -56,8 +56,30 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - -+import net.minecraftforge.fml.common.FMLLog; -+import com.google.common.collect.ImmutableSetMultimap; -+import net.minecraftforge.client.ForgeHooksClient; -+import net.minecraftforge.common.ForgeChunkManager; -+import net.minecraftforge.common.ForgeChunkManager.Ticket; -+import net.minecraftforge.common.ForgeModContainer; -+import net.minecraftforge.common.ForgeHooks; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.common.WorldSpecificSaveHandler; -+import net.minecraftforge.event.entity.EntityEvent; -+import net.minecraftforge.event.entity.EntityJoinWorldEvent; -+import net.minecraftforge.event.world.WorldEvent; -+import net.minecraftforge.event.entity.PlaySoundAtEntityEvent; -+import net.minecraft.entity.EnumCreatureType; -+ - public abstract class World implements IBlockAccess - { -+ /** -+ * Used in the getEntitiesWithinAABB functions to expand the search area for entities. -+ * Modders should change this variable to a higher value if it is less then the radius -+ * of one of there entities. -+ */ -+ public static double MAX_ENTITY_RADIUS = 2.0D; -+ - protected boolean field_72999_e; - public final List field_72996_f = Lists.newArrayList(); - protected final List field_72997_g = Lists.newArrayList(); -@@ -99,6 +121,10 @@ - int[] field_72994_J; - private static final String __OBFID = "CL_00000140"; - -+ public boolean restoringBlockSnapshots = false; -+ public boolean captureBlockSnapshots = false; -+ public ArrayList capturedBlockSnapshots = new ArrayList(); -+ - protected World(ISaveHandler p_i45749_1_, WorldInfo p_i45749_2_, WorldProvider p_i45749_3_, Profiler p_i45749_4_, boolean p_i45749_5_) - { - this.field_72990_M = this.field_73012_v.nextInt(12000); -@@ -111,6 +137,7 @@ - this.field_73011_w = p_i45749_3_; - this.field_72995_K = p_i45749_5_; - this.field_175728_M = p_i45749_3_.func_177501_r(); -+ perWorldStorage = new MapStorage((ISaveHandler)null); - } - - public World func_175643_b() -@@ -120,13 +147,18 @@ - - public BiomeGenBase func_180494_b(final BlockPos p_180494_1_) - { -- if (this.func_175667_e(p_180494_1_)) -+ return this.field_73011_w.getBiomeGenForCoords(p_180494_1_); -+ } -+ -+ public BiomeGenBase getBiomeGenForCoordsBody(final BlockPos pos) -+ { -+ if (this.func_175667_e(pos)) - { -- Chunk chunk = this.func_175726_f(p_180494_1_); -+ Chunk chunk = this.func_175726_f(pos); - - try - { -- return chunk.func_177411_a(p_180494_1_, this.field_73011_w.func_177499_m()); -+ return chunk.func_177411_a(pos, this.field_73011_w.func_177499_m()); - } - catch (Throwable throwable) - { -@@ -137,7 +169,7 @@ - private static final String __OBFID = "CL_00000141"; - public String call() - { -- return CrashReportCategory.func_180522_a(p_180494_1_); -+ return CrashReportCategory.func_180522_a(pos); - } - }); - throw new ReportedException(crashreport); -@@ -145,7 +177,7 @@ - } - else - { -- return this.field_73011_w.func_177499_m().func_180300_a(p_180494_1_, BiomeGenBase.field_76772_c); -+ return this.field_73011_w.func_177499_m().func_180300_a(pos, BiomeGenBase.field_76772_c); - } - } - -@@ -186,7 +218,7 @@ - - public boolean func_175623_d(BlockPos p_175623_1_) - { -- return this.func_180495_p(p_175623_1_).func_177230_c().func_149688_o() == Material.field_151579_a; -+ return this.func_180495_p(p_175623_1_).func_177230_c().isAir(this, p_175623_1_); - } - - public boolean func_175667_e(BlockPos p_175667_1_) -@@ -286,39 +318,58 @@ - { - Chunk chunk = this.func_175726_f(p_180501_1_); - Block block = p_180501_2_.func_177230_c(); -+ -+ net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null; -+ if (this.captureBlockSnapshots && !this.field_72995_K) -+ { -+ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, p_180501_1_, p_180501_3_); -+ this.capturedBlockSnapshots.add(blockSnapshot); -+ } -+ int oldLight = func_180495_p(p_180501_1_).func_177230_c().getLightValue(this, p_180501_1_); -+ - IBlockState iblockstate1 = chunk.func_177436_a(p_180501_1_, p_180501_2_); - - if (iblockstate1 == null) - { -+ if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot); - return false; - } - else - { - Block block1 = iblockstate1.func_177230_c(); - -- if (block.func_149717_k() != block1.func_149717_k() || block.func_149750_m() != block1.func_149750_m()) -+ if (block.func_149717_k() != block1.func_149717_k() || block.getLightValue(this, p_180501_1_) != oldLight) - { - this.field_72984_F.func_76320_a("checkLight"); - this.func_175664_x(p_180501_1_); - this.field_72984_F.func_76319_b(); - } - -- if ((p_180501_3_ & 2) != 0 && (!this.field_72995_K || (p_180501_3_ & 4) == 0) && chunk.func_150802_k()) -+ if (blockSnapshot == null) // Don't notify clients or update physics while capturing blockstates - { -- this.func_175689_h(p_180501_1_); -+ this.markAndNotifyBlock(p_180501_1_, chunk, iblockstate1, p_180501_2_, p_180501_3_); // Modularize client and physic updates - } - -- if (!this.field_72995_K && (p_180501_3_ & 1) != 0) -- { -- this.func_175722_b(p_180501_1_, iblockstate1.func_177230_c()); -+ return true; -+ } -+ } -+ } - -- if (block.func_149740_M()) -- { -- this.func_175666_e(p_180501_1_, block); -- } -- } -+ // Split off from original setBlockState(BlockPos, IBlockState Block p_147465_4_, int) method in order to directly send client and physic updates -+ public void markAndNotifyBlock(BlockPos pos, Chunk chunk, IBlockState old, IBlockState new_, int flags) -+ { -+ if ((flags & 2) != 0 && (!this.field_72995_K || (flags & 4) == 0) && (chunk == null || chunk.func_150802_k())) -+ { -+ this.func_175689_h(pos); -+ } - -- return true; -+ if (!this.field_72995_K && (flags & 1) != 0) -+ { -+ this.func_175722_b(pos, old.func_177230_c()); -+ -+ if (new_.func_177230_c().func_149740_M()) -+ { -+ this.func_175666_e(pos, new_.func_177230_c()); - } - } - } -@@ -408,6 +459,9 @@ - - public void func_175685_c(BlockPos p_175685_1_, Block p_175685_2_) - { -+ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_175685_1_, this.func_180495_p(p_175685_1_), java.util.EnumSet.allOf(EnumFacing.class)).isCanceled()) -+ return; -+ - this.func_180496_d(p_175685_1_.func_177976_e(), p_175685_2_); - this.func_180496_d(p_175685_1_.func_177974_f(), p_175685_2_); - this.func_180496_d(p_175685_1_.func_177977_b(), p_175685_2_); -@@ -418,6 +472,11 @@ - - public void func_175695_a(BlockPos p_175695_1_, Block p_175695_2_, EnumFacing p_175695_3_) - { -+ java.util.EnumSet directions = java.util.EnumSet.allOf(EnumFacing.class); -+ directions.remove(p_175695_3_); -+ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_175695_1_, this.func_180495_p(p_175695_1_), directions).isCanceled()) -+ return; -+ - if (p_175695_3_ != EnumFacing.WEST) - { - this.func_180496_d(p_175695_1_.func_177976_e(), p_175695_2_); -@@ -782,7 +841,7 @@ - - public boolean func_72935_r() - { -- return this.field_73008_k < 4; -+ return this.field_73011_w.isDaytime(); - } - - public MovingObjectPosition func_72933_a(Vec3 p_72933_1_, Vec3 p_72933_2_) -@@ -978,6 +1037,11 @@ - - public void func_72956_a(Entity p_72956_1_, String p_72956_2_, float p_72956_3_, float p_72956_4_) - { -+ PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_72956_1_, p_72956_2_, p_72956_3_, p_72956_4_); -+ if (event.isCanceled() || event.name == null) return; -+ p_72956_2_ = event.name; -+ p_72956_3_ = event.newVolume; -+ p_72956_4_ = event.newPitch; - for (int i = 0; i < this.field_73021_x.size(); ++i) - { - ((IWorldAccess)this.field_73021_x.get(i)).func_72704_a(p_72956_2_, p_72956_1_.field_70165_t, p_72956_1_.field_70163_u, p_72956_1_.field_70161_v, p_72956_3_, p_72956_4_); -@@ -986,6 +1050,11 @@ - - public void func_85173_a(EntityPlayer p_85173_1_, String p_85173_2_, float p_85173_3_, float p_85173_4_) - { -+ PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_85173_1_, p_85173_2_, p_85173_3_, p_85173_4_); -+ if (event.isCanceled() || event.name == null) return; -+ p_85173_2_ = event.name; -+ p_85173_3_ = event.newVolume; -+ p_85173_4_ = event.newPitch; - for (int i = 0; i < this.field_73021_x.size(); ++i) - { - ((IWorldAccess)this.field_73021_x.get(i)).func_85102_a(p_85173_1_, p_85173_2_, p_85173_1_.field_70165_t, p_85173_1_.field_70163_u, p_85173_1_.field_70161_v, p_85173_3_, p_85173_4_); -@@ -1037,6 +1106,9 @@ - - public boolean func_72838_d(Entity p_72838_1_) - { -+ // do not drop any items while restoring blocksnapshots. Prevents dupes -+ if (!this.field_72995_K && (p_72838_1_ == null || (p_72838_1_ instanceof net.minecraft.entity.item.EntityItem && this.restoringBlockSnapshots))) return false; -+ - int i = MathHelper.func_76128_c(p_72838_1_.field_70165_t / 16.0D); - int j = MathHelper.func_76128_c(p_72838_1_.field_70161_v / 16.0D); - boolean flag = p_72838_1_.field_98038_p; -@@ -1059,6 +1131,8 @@ - this.func_72854_c(); - } - -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_72838_1_, this)) && !flag) return false; -+ - this.func_72964_e(i, j).func_76612_a(p_72838_1_); - this.field_72996_f.add(p_72838_1_); - this.func_72923_a(p_72838_1_); -@@ -1271,17 +1345,29 @@ - - public int func_72967_a(float p_72967_1_) - { -+ float f2 = field_73011_w.getSunBrightnessFactor(p_72967_1_); -+ f2 = 1.0F - f2; -+ return (int)(f2 * 11.0F); -+ } -+ -+ /** -+ * The current sun brightness factor for this dimension. -+ * 0.0f means no light at all, and 1.0f means maximum sunlight. -+ * Highly recommended for sunlight detection like solar panel. -+ * -+ * @return The current brightness factor -+ * */ -+ public float getSunBrightnessFactor(float p_72967_1_) -+ { - float f1 = this.func_72826_c(p_72967_1_); - float f2 = 1.0F - (MathHelper.func_76134_b(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F); - f2 = MathHelper.func_76131_a(f2, 0.0F, 1.0F); - f2 = 1.0F - f2; - f2 = (float)((double)f2 * (1.0D - (double)(this.func_72867_j(p_72967_1_) * 5.0F) / 16.0D)); - f2 = (float)((double)f2 * (1.0D - (double)(this.func_72819_i(p_72967_1_) * 5.0F) / 16.0D)); -- f2 = 1.0F - f2; -- return (int)(f2 * 11.0F); -+ return f2; - } - -- @SideOnly(Side.CLIENT) - public void func_72848_b(IWorldAccess p_72848_1_) - { - this.field_73021_x.remove(p_72848_1_); -@@ -1290,6 +1376,12 @@ - @SideOnly(Side.CLIENT) - public float func_72971_b(float p_72971_1_) - { -+ return this.field_73011_w.getSunBrightness(p_72971_1_); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public float getSunBrightnessBody(float p_72971_1_) -+ { - float f1 = this.func_72826_c(p_72971_1_); - float f2 = 1.0F - (MathHelper.func_76134_b(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.2F); - f2 = MathHelper.func_76131_a(f2, 0.0F, 1.0F); -@@ -1302,6 +1394,12 @@ - @SideOnly(Side.CLIENT) - public Vec3 func_72833_a(Entity p_72833_1_, float p_72833_2_) - { -+ return this.field_73011_w.getSkyColor(p_72833_1_, p_72833_2_); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public Vec3 getSkyColorBody(Entity p_72833_1_, float p_72833_2_) -+ { - float f1 = this.func_72826_c(p_72833_2_); - float f2 = MathHelper.func_76134_b(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; - f2 = MathHelper.func_76131_a(f2, 0.0F, 1.0F); -@@ -1309,9 +1407,7 @@ - int j = MathHelper.func_76128_c(p_72833_1_.field_70163_u); - int k = MathHelper.func_76128_c(p_72833_1_.field_70161_v); - BlockPos blockpos = new BlockPos(i, j, k); -- BiomeGenBase biomegenbase = this.func_180494_b(blockpos); -- float f3 = biomegenbase.func_180626_a(blockpos); -- int l = biomegenbase.func_76731_a(f3); -+ int l = net.minecraftforge.client.ForgeHooksClient.getSkyBlendColour(this, blockpos); - float f4 = (float)(l >> 16 & 255) / 255.0F; - float f5 = (float)(l >> 8 & 255) / 255.0F; - float f6 = (float)(l & 255) / 255.0F; -@@ -1373,6 +1469,11 @@ - - public float func_130001_d() - { -+ return field_73011_w.getCurrentMoonPhaseFactor(); -+ } -+ -+ public float getCurrentMoonPhaseFactorBody() -+ { - return WorldProvider.field_111203_a[this.field_73011_w.func_76559_b(this.field_72986_A.func_76073_f())]; - } - -@@ -1385,6 +1486,12 @@ - @SideOnly(Side.CLIENT) - public Vec3 func_72824_f(float p_72824_1_) - { -+ return this.field_73011_w.drawClouds(p_72824_1_); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public Vec3 drawCloudsBody(float p_72824_1_) -+ { - float f1 = this.func_72826_c(p_72824_1_); - float f2 = MathHelper.func_76134_b(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; - f2 = MathHelper.func_76131_a(f2, 0.0F, 1.0F); -@@ -1442,9 +1549,9 @@ - for (blockpos1 = new BlockPos(p_175672_1_.func_177958_n(), chunk.func_76625_h() + 16, p_175672_1_.func_177952_p()); blockpos1.func_177956_o() >= 0; blockpos1 = blockpos2) - { - blockpos2 = blockpos1.func_177977_b(); -- Material material = chunk.func_177428_a(blockpos2).func_149688_o(); -+ Block block = chunk.func_177428_a(blockpos2); - -- if (material.func_76230_c() && material != Material.field_151584_j) -+ if (block.func_149688_o().func_76230_c() && !block.isLeaves(this, blockpos2) && !block.isFoliage(this, blockpos2)) - { - break; - } -@@ -1456,6 +1563,12 @@ - @SideOnly(Side.CLIENT) - public float func_72880_h(float p_72880_1_) - { -+ return this.field_73011_w.getStarBrightness(p_72880_1_); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public float getStarBrightnessBody(float p_72880_1_) -+ { - float f1 = this.func_72826_c(p_72880_1_); - float f2 = 1.0F - (MathHelper.func_76134_b(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.25F); - f2 = MathHelper.func_76131_a(f2, 0.0F, 1.0F); -@@ -1500,7 +1613,15 @@ - entity.func_85029_a(crashreportcategory); - } - -- throw new ReportedException(crashreport); -+ if (ForgeModContainer.removeErroringEntities) -+ { -+ FMLLog.severe(crashreport.func_71502_e()); -+ func_72900_e(entity); -+ } -+ else -+ { -+ throw new ReportedException(crashreport); -+ } - } - - if (entity.field_70128_L) -@@ -1562,7 +1683,16 @@ - crashreport = CrashReport.func_85055_a(throwable1, "Ticking entity"); - crashreportcategory = crashreport.func_85058_a("Entity being ticked"); - entity.func_85029_a(crashreportcategory); -- throw new ReportedException(crashreport); -+ if (ForgeModContainer.removeErroringEntities) -+ { -+ FMLLog.severe(crashreport.func_71502_e()); -+ func_72900_e(entity); -+ } -+ else -+ { -+ throw new ReportedException(crashreport); -+ } -+ - } - } - -@@ -1609,7 +1739,16 @@ - CrashReport crashreport1 = CrashReport.func_85055_a(throwable, "Ticking block entity"); - CrashReportCategory crashreportcategory1 = crashreport1.func_85058_a("Block entity being ticked"); - tileentity.func_145828_a(crashreportcategory1); -- throw new ReportedException(crashreport1); -+ if (ForgeModContainer.removeErroringTileEntities) -+ { -+ FMLLog.severe(crashreport1.func_71502_e()); -+ tileentity.func_145843_s(); -+ this.func_175713_t(tileentity.func_174877_v()); -+ } -+ else -+ { -+ throw new ReportedException(crashreport1); -+ } - } - } - } -@@ -1626,15 +1765,19 @@ - } - } - -- this.field_147481_N = false; -- - if (!this.field_147483_b.isEmpty()) - { -+ for (Object tile : field_147483_b) -+ { -+ ((TileEntity)tile).onChunkUnload(); -+ } - this.field_175730_i.removeAll(this.field_147483_b); - this.field_147482_g.removeAll(this.field_147483_b); - this.field_147483_b.clear(); - } - -+ this.field_147481_N = false; //FML Move below remove to prevent CMEs -+ - this.field_72984_F.func_76318_c("pendingBlockEntities"); - - if (!this.field_147484_a.isEmpty()) -@@ -1668,7 +1811,8 @@ - - public boolean func_175700_a(TileEntity p_175700_1_) - { -- boolean flag = this.field_147482_g.add(p_175700_1_); -+ List dest = field_147481_N ? field_147484_a : field_147482_g; -+ boolean flag = dest.add(p_175700_1_); - - if (flag && p_175700_1_ instanceof IUpdatePlayerListBox) - { -@@ -1710,9 +1854,12 @@ - { - int i = MathHelper.func_76128_c(p_72866_1_.field_70165_t); - int j = MathHelper.func_76128_c(p_72866_1_.field_70161_v); -- byte b0 = 32; -+ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(i >> 4, j >> 4)); -+ byte b0 = isForced ? (byte)0 : 32; -+ boolean canUpdate = !p_72866_2_ || this.func_175663_a(i - b0, 0, j - b0, i + b0, 0, j + b0, true); -+ if (!canUpdate) canUpdate = net.minecraftforge.event.ForgeEventFactory.canEntityUpdate(p_72866_1_); - -- if (!p_72866_2_ || this.func_175663_a(i - b0, 0, j - b0, i + b0, 0, j + b0, true)) -+ if (canUpdate) - { - p_72866_1_.field_70142_S = p_72866_1_.field_70165_t; - p_72866_1_.field_70137_T = p_72866_1_.field_70163_u; -@@ -1839,7 +1986,7 @@ - { - Block block = this.func_180495_p(new BlockPos(k1, l1, i2)).func_177230_c(); - -- if (block.func_149688_o() != Material.field_151579_a) -+ if (!block.isAir(this, new BlockPos(k1, l1, i2))) - { - return true; - } -@@ -1901,6 +2048,10 @@ - { - return true; - } -+ else if (block.isBurning(this, new BlockPos(k1, l1, i2))) -+ { -+ return true; -+ } - } - } - } -@@ -2039,6 +2190,7 @@ - public Explosion func_72885_a(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) - { - Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_); -+ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; - explosion.func_77278_a(); - explosion.func_77279_a(true); - return explosion; -@@ -2185,19 +2337,28 @@ - else - { - this.func_175700_a(p_175690_2_); -- 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_); //Forge add NPE protection -+ if (chunk != null) chunk.func_177426_a(p_175690_1_, p_175690_2_); - } -+ this.func_175666_e(p_175690_1_, func_180495_p(p_175690_1_).func_177230_c()); //Notify neighbors of changes - } - } - - public void func_175713_t(BlockPos p_175713_1_) - { -+ //Chunk chunk = this.getChunkFromBlockCoords(pos); -+ //if (chunk != null) chunk.removeTileEntity(pos); -+ //Forge ToDO: Are these patches needed anymore? -+ - TileEntity tileentity = this.func_175625_s(p_175713_1_); - - if (tileentity != null && this.field_147481_N) - { - tileentity.func_145843_s(); - this.field_147484_a.remove(tileentity); -+ if (!(tileentity instanceof IUpdatePlayerListBox)) //Forge: If they are not tickable they wont be removed in the update loop. -+ this.field_147482_g.remove(tileentity); -+ - } - else - { -@@ -2210,6 +2371,7 @@ - - this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_); - } -+ this.func_175666_e(p_175713_1_, func_180495_p(p_175713_1_).func_177230_c()); //Notify neighbors of changes - } - - public void func_147457_a(TileEntity p_147457_1_) -@@ -2228,7 +2390,7 @@ - { - IBlockState iblockstate = p_175683_0_.func_180495_p(p_175683_1_); - Block block = iblockstate.func_177230_c(); -- return block.func_149688_o().func_76218_k() && block.func_149686_d() ? true : (block instanceof BlockStairs ? iblockstate.func_177229_b(BlockStairs.field_176308_b) == BlockStairs.EnumHalf.TOP : (block instanceof BlockSlab ? iblockstate.func_177229_b(BlockSlab.field_176554_a) == BlockSlab.EnumBlockHalf.TOP : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? ((Integer)iblockstate.func_177229_b(BlockSnow.field_176315_a)).intValue() == 7 : false)))); -+ return block.isSideSolid(p_175683_0_, p_175683_1_, EnumFacing.UP); - } - - public boolean func_175677_d(BlockPos p_175677_1_, boolean p_175677_2_) -@@ -2248,7 +2410,7 @@ - else - { - Block block = this.func_180495_p(p_175677_1_).func_177230_c(); -- return block.func_149688_o().func_76218_k() && block.func_149686_d(); -+ return block.isNormalCube(this, p_175677_1_); - } - } - } -@@ -2265,8 +2427,7 @@ - - public void func_72891_a(boolean p_72891_1_, boolean p_72891_2_) - { -- this.field_72985_G = p_72891_1_; -- this.field_72992_H = p_72891_2_; -+ this.field_73011_w.setAllowedSpawnTypes(p_72891_1_, p_72891_2_); - } - - public void func_72835_b() -@@ -2276,6 +2437,11 @@ - - protected void func_72947_a() - { -+ this.field_73011_w.calculateInitialWeather(); -+ } -+ -+ public void calculateInitialWeatherBody() -+ { - if (this.field_72986_A.func_76059_o()) - { - this.field_73004_o = 1.0F; -@@ -2289,6 +2455,11 @@ - - protected void func_72979_l() - { -+ this.field_73011_w.updateWeather(); -+ } -+ -+ public void updateWeatherBody() -+ { - if (!this.field_73011_w.func_177495_o()) - { - if (!this.field_72995_K) -@@ -2383,6 +2554,7 @@ - { - this.field_72993_I.clear(); - this.field_72984_F.func_76320_a("buildList"); -+ this.field_72993_I.addAll(getPersistentChunks().keySet()); - int i; - EntityPlayer entityplayer; - int j; -@@ -2445,7 +2617,7 @@ - l += p_147467_1_; - i1 += p_147467_2_; - -- if (block.func_149688_o() == Material.field_151579_a && this.func_175699_k(blockpos) <= this.field_73012_v.nextInt(8) && this.func_175642_b(EnumSkyBlock.SKY, blockpos) <= 0) -+ if (block.isAir(this, blockpos) && this.func_175699_k(blockpos) <= this.field_73012_v.nextInt(8) && this.func_175642_b(EnumSkyBlock.SKY, blockpos) <= 0) - { - EntityPlayer entityplayer = this.func_72977_a((double)l + 0.5D, (double)j1 + 0.5D, (double)i1 + 0.5D, 8.0D); - -@@ -2485,6 +2657,11 @@ - - public boolean func_175670_e(BlockPos p_175670_1_, boolean p_175670_2_) - { -+ return this.field_73011_w.canBlockFreeze(p_175670_1_, p_175670_2_); -+ } -+ -+ public boolean canBlockFreezeBody(BlockPos p_175670_1_, boolean p_175670_2_) -+ { - BiomeGenBase biomegenbase = this.func_180494_b(p_175670_1_); - float f = biomegenbase.func_180626_a(p_175670_1_); - -@@ -2526,6 +2703,11 @@ - - public boolean func_175708_f(BlockPos p_175708_1_, boolean p_175708_2_) - { -+ return this.field_73011_w.canSnowAt(p_175708_1_, p_175708_2_); -+ } -+ -+ public boolean canSnowAtBody(BlockPos p_175708_1_, boolean p_175708_2_) -+ { - BiomeGenBase biomegenbase = this.func_180494_b(p_175708_1_); - float f = biomegenbase.func_180626_a(p_175708_1_); - -@@ -2543,7 +2725,7 @@ - { - Block block = this.func_180495_p(p_175708_1_).func_177230_c(); - -- if (block.func_149688_o() == Material.field_151579_a && Blocks.field_150431_aC.func_176196_c(this, p_175708_1_)) -+ if (block.isAir(this, p_175708_1_) && Blocks.field_150431_aC.func_176196_c(this, p_175708_1_)) - { - return true; - } -@@ -2575,10 +2757,11 @@ - else - { - Block block = this.func_180495_p(p_175638_1_).func_177230_c(); -- int i = p_175638_2_ == EnumSkyBlock.SKY ? 0 : block.func_149750_m(); -- int j = block.func_149717_k(); -+ int blockLight = block.getLightValue(this, p_175638_1_); -+ int i = p_175638_2_ == EnumSkyBlock.SKY ? 0 : blockLight; -+ int j = block.getLightOpacity(this, p_175638_1_); - -- if (j >= 15 && block.func_149750_m() > 0) -+ if (j >= 15 && blockLight > 0) - { - j = 1; - } -@@ -2792,10 +2975,10 @@ - public List func_175674_a(Entity p_175674_1_, AxisAlignedBB p_175674_2_, Predicate p_175674_3_) - { - ArrayList arraylist = 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 - MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.func_76128_c((p_175674_2_.field_72336_d + MAX_ENTITY_RADIUS) / 16.0D); -+ int k = MathHelper.func_76128_c((p_175674_2_.field_72339_c - MAX_ENTITY_RADIUS) / 16.0D); -+ int l = MathHelper.func_76128_c((p_175674_2_.field_72334_f + MAX_ENTITY_RADIUS) / 16.0D); - - for (int i1 = i; i1 <= j; ++i1) - { -@@ -2854,10 +3037,10 @@ - - public List func_175647_a(Class p_175647_1_, AxisAlignedBB p_175647_2_, Predicate p_175647_3_) - { -- int i = MathHelper.func_76128_c((p_175647_2_.field_72340_a - 2.0D) / 16.0D); -- int j = MathHelper.func_76128_c((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_76128_c((p_175647_2_.field_72334_f + 2.0D) / 16.0D); -+ int i = MathHelper.func_76128_c((p_175647_2_.field_72340_a - MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.func_76128_c((p_175647_2_.field_72336_d + MAX_ENTITY_RADIUS) / 16.0D); -+ int k = MathHelper.func_76128_c((p_175647_2_.field_72339_c - MAX_ENTITY_RADIUS) / 16.0D); -+ int l = MathHelper.func_76128_c((p_175647_2_.field_72334_f + MAX_ENTITY_RADIUS) / 16.0D); - ArrayList arraylist = Lists.newArrayList(); - - for (int i1 = i; i1 <= j; ++i1) -@@ -2938,13 +3121,16 @@ - - public void func_175650_b(Collection p_175650_1_) - { -- this.field_72996_f.addAll(p_175650_1_); - Iterator iterator = p_175650_1_.iterator(); - - while (iterator.hasNext()) - { - Entity entity = (Entity)iterator.next(); -- this.func_72923_a(entity); -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entity, this))) -+ { -+ field_72996_f.add(entity); -+ this.func_72923_a(entity); -+ } - } - } - -@@ -2957,7 +3143,9 @@ - { - Block block1 = this.func_180495_p(p_175716_2_).func_177230_c(); - AxisAlignedBB axisalignedbb = p_175716_3_ ? null : p_175716_1_.func_180640_a(this, p_175716_2_, p_175716_1_.func_176223_P()); -- return axisalignedbb != null && !this.func_72917_a(axisalignedbb, p_175716_5_) ? false : (block1.func_149688_o() == Material.field_151594_q && p_175716_1_ == Blocks.field_150467_bQ ? true : block1.func_149688_o().func_76222_j() && p_175716_1_.func_176193_a(this, p_175716_2_, p_175716_4_, p_175716_6_)); -+ if (axisalignedbb != null && !this.func_72917_a(axisalignedbb, p_175716_5_)) return false; -+ if (block1.func_149688_o() == Material.field_151594_q && p_175716_1_ == Blocks.field_150467_bQ) return true; -+ return block1.func_176200_f(this, p_175716_2_) && p_175716_1_.func_176193_a(this, p_175716_2_, p_175716_4_, p_175716_6_); - } - - public int func_175627_a(BlockPos p_175627_1_, EnumFacing p_175627_2_) -@@ -3032,7 +3220,7 @@ - { - IBlockState iblockstate = this.func_180495_p(p_175651_1_); - Block block = iblockstate.func_177230_c(); -- return block.func_149721_r() ? this.func_175676_y(p_175651_1_) : block.func_180656_a(this, p_175651_1_, iblockstate, p_175651_2_); -+ return block.shouldCheckWeakPower(this, p_175651_1_, p_175651_2_) ? this.func_175676_y(p_175651_1_) : block.func_180656_a(this, p_175651_1_, iblockstate, p_175651_2_); - } - - public boolean func_175640_z(BlockPos p_175640_1_) -@@ -3160,7 +3348,7 @@ - - public long func_72905_C() - { -- return this.field_72986_A.func_76063_b(); -+ return this.field_73011_w.getSeed(); - } - - public long func_82737_E() -@@ -3170,17 +3358,17 @@ - - public long func_72820_D() - { -- return this.field_72986_A.func_76073_f(); -+ return this.field_73011_w.getWorldTime(); - } - - public void func_72877_b(long p_72877_1_) - { -- this.field_72986_A.func_76068_b(p_72877_1_); -+ this.field_73011_w.setWorldTime(p_72877_1_); - } - - public BlockPos func_175694_M() - { -- BlockPos blockpos = new BlockPos(this.field_72986_A.func_76079_c(), this.field_72986_A.func_76075_d(), this.field_72986_A.func_76074_e()); -+ BlockPos blockpos = this.field_73011_w.getSpawnPoint(); - - if (!this.func_175723_af().func_177746_a(blockpos)) - { -@@ -3192,7 +3380,7 @@ - - public void func_175652_B(BlockPos p_175652_1_) - { -- this.field_72986_A.func_176143_a(p_175652_1_); -+ this.field_73011_w.setSpawnPoint(p_175652_1_); - } - - @SideOnly(Side.CLIENT) -@@ -3212,12 +3400,18 @@ - - if (!this.field_72996_f.contains(p_72897_1_)) - { -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_72897_1_, this))) - this.field_72996_f.add(p_72897_1_); - } - } - - public boolean func_175660_a(EntityPlayer p_175660_1_, BlockPos p_175660_2_) - { -+ return this.field_73011_w.canMineBlock(p_175660_1_, p_175660_2_); -+ } -+ -+ public boolean canMineBlockBody(EntityPlayer p_175660_1_, BlockPos p_175660_2_) -+ { - return true; - } - -@@ -3307,8 +3501,7 @@ - - public boolean func_180502_D(BlockPos p_180502_1_) - { -- BiomeGenBase biomegenbase = this.func_180494_b(p_180502_1_); -- return biomegenbase.func_76736_e(); -+ return this.field_73011_w.isBlockHighHumidity(p_180502_1_); - } - - public MapStorage func_175693_T() -@@ -3367,12 +3560,12 @@ - - public int func_72800_K() - { -- return 256; -+ return this.field_73011_w.getHeight(); - } - - public int func_72940_L() - { -- return this.field_73011_w.func_177495_o() ? 128 : 256; -+ return this.field_73011_w.getActualHeight(); - } - - public Random func_72843_D(int p_72843_1_, int p_72843_2_, int p_72843_3_) -@@ -3429,7 +3622,7 @@ - @SideOnly(Side.CLIENT) - public double func_72919_O() - { -- return this.field_72986_A.func_76067_t() == WorldType.field_77138_c ? 0.0D : 63.0D; -+ return field_73011_w.getHorizon(); - } - - public void func_175715_c(int p_175715_1_, BlockPos p_175715_2_, int p_175715_3_) -@@ -3461,29 +3654,21 @@ - - public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_) - { -- Iterator iterator = EnumFacing.Plane.HORIZONTAL.iterator(); -- -- while (iterator.hasNext()) -+ for (EnumFacing enumfacing : EnumFacing.values()) - { -- EnumFacing enumfacing = (EnumFacing)iterator.next(); - BlockPos blockpos1 = p_175666_1_.func_177972_a(enumfacing); - - if (this.func_175667_e(blockpos1)) - { - IBlockState iblockstate = this.func_180495_p(blockpos1); -- -- if (Blocks.field_150441_bU.func_149907_e(iblockstate.func_177230_c())) -+ iblockstate.func_177230_c().onNeighborChange(this, blockpos1, p_175666_1_); -+ if (iblockstate.func_177230_c().isNormalCube(this, blockpos1)) - { -- iblockstate.func_177230_c().func_176204_a(this, blockpos1, iblockstate, p_175666_2_); -- } -- else if (iblockstate.func_177230_c().func_149721_r()) -- { -- blockpos1 = blockpos1.func_177972_a(enumfacing); -- iblockstate = this.func_180495_p(blockpos1); -- -- if (Blocks.field_150441_bU.func_149907_e(iblockstate.func_177230_c())) -+ BlockPos posOther = blockpos1.func_177972_a(enumfacing); -+ Block other = func_180495_p(posOther).func_177230_c(); -+ if (other.getWeakChanges(this, posOther)) - { -- iblockstate.func_177230_c().func_176204_a(this, blockpos1, iblockstate, p_175666_2_); -+ other.onNeighborChange(this, posOther, p_175666_1_); - } - } - } -@@ -3553,4 +3738,82 @@ - short short1 = 128; - return k >= -short1 && k <= short1 && l >= -short1 && l <= short1; - } -+ -+ -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * Determine if the given block is considered solid on the -+ * specified side. Used by placement logic. -+ * -+ * @param pos Block Position -+ * @param side The Side in question -+ * @return True if the side is solid -+ */ -+ public boolean isSideSolid(BlockPos pos, EnumFacing side) -+ { -+ return isSideSolid(pos, side, false); -+ } -+ -+ /** -+ * Determine if the given block is considered solid on the -+ * specified side. Used by placement logic. -+ * -+ * @param pos Block Position -+ * @param side The Side in question -+ * @param _default The default to return if the block doesn't exist. -+ * @return True if the side is solid -+ */ -+ @Override -+ public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) -+ { -+ if (!this.func_175701_a(pos)) return _default; -+ -+ Chunk chunk = func_175726_f(pos); -+ if (chunk == null || chunk.func_76621_g()) return _default; -+ return func_180495_p(pos).func_177230_c().isSideSolid(this, pos, side); -+ } -+ -+ /** -+ * Get the persistent chunks for this world -+ * -+ * @return -+ */ -+ public ImmutableSetMultimap getPersistentChunks() -+ { -+ return ForgeChunkManager.getPersistentChunksFor(this); -+ } -+ -+ /** -+ * Readded as it was removed, very useful helper function -+ * -+ * @param pos Block position -+ * @return The blocks light opacity -+ */ -+ public int getBlockLightOpacity(BlockPos pos) -+ { -+ if (!this.func_175701_a(pos)) return 0; -+ return func_175726_f(pos).func_177437_b(pos); -+ } -+ -+ /** -+ * Returns a count of entities that classify themselves as the specified creature type. -+ */ -+ public int countEntities(EnumCreatureType type, boolean forSpawnCount) -+ { -+ int count = 0; -+ for (int x = 0; x < field_72996_f.size(); x++) -+ { -+ if (((Entity)field_72996_f.get(x)).isCreatureType(type, forSpawnCount)) -+ { -+ count++; -+ } -+ } -+ return count; -+ } -+ -+ protected MapStorage perWorldStorage; //Moved to a getter to simulate final without being final so we can load in subclasses. -+ public MapStorage getPerWorldStorage() -+ { -+ return perWorldStorage; -+ } - } diff --git a/patches/minecraft/net/minecraft/world/WorldServer.java.patch b/patches/minecraft/net/minecraft/world/WorldServer.java.patch deleted file mode 100644 index 82158837d..000000000 --- a/patches/minecraft/net/minecraft/world/WorldServer.java.patch +++ /dev/null @@ -1,257 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/WorldServer.java -+++ ../src-work/minecraft/net/minecraft/world/WorldServer.java -@@ -94,30 +94,46 @@ - private List field_94579_S = Lists.newArrayList(); - private static final String __OBFID = "CL_00001437"; - -+ /** Stores the recently processed (lighting) chunks */ -+ protected Set doneChunks = new java.util.HashSet(); -+ public List customTeleporters = new ArrayList(); -+ private static boolean initChest = false; -+ public static void fillChestHook() -+ { -+ if (!initChest) -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.BONUS_CHEST, field_73069_S, 10, 10); -+ initChest = true; -+ } -+ - public WorldServer(MinecraftServer p_i45921_1_, ISaveHandler p_i45921_2_, WorldInfo p_i45921_3_, int p_i45921_4_, Profiler p_i45921_5_) - { - super(p_i45921_2_, p_i45921_3_, WorldProvider.func_76570_a(p_i45921_4_), p_i45921_5_, false); - this.field_73061_a = p_i45921_1_; - this.field_73062_L = new EntityTracker(this); - this.field_73063_M = new PlayerManager(this); -+ // Guarantee the dimension ID was not reset by the provider -+ int providerDim = this.field_73011_w.field_76574_g; - this.field_73011_w.func_76558_a(this); -+ this.field_73011_w.field_76574_g = providerDim; - this.field_73020_y = this.func_72970_h(); -+ perWorldStorage = new MapStorage(new net.minecraftforge.common.WorldSpecificSaveHandler((WorldServer)this, p_i45921_2_)); - this.field_85177_Q = new Teleporter(this); - this.func_72966_v(); - this.func_72947_a(); - this.func_175723_af().func_177725_a(p_i45921_1_.func_175580_aG()); -+ net.minecraftforge.common.DimensionManager.setWorld(p_i45921_4_, this); - } - - public World func_175643_b() - { - this.field_72988_C = new MapStorage(this.field_73019_z); - String s = VillageCollection.func_176062_a(this.field_73011_w); -- VillageCollection villagecollection = (VillageCollection)this.field_72988_C.func_75742_a(VillageCollection.class, s); -+ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.func_75742_a(VillageCollection.class, s); - - if (villagecollection == null) - { - this.field_72982_D = new VillageCollection(this); -- this.field_72988_C.func_75745_a(s, this.field_72982_D); -+ this.perWorldStorage.func_75745_a(s, this.field_72982_D); - } - else - { -@@ -210,6 +226,10 @@ - this.field_175740_d.func_75528_a(); - this.field_72984_F.func_76318_c("portalForcer"); - this.field_85177_Q.func_85189_a(this.func_82737_E()); -+ for (Teleporter tele : customTeleporters) -+ { -+ tele.func_85189_a(func_82737_E()); -+ } - this.field_72984_F.func_76319_b(); - this.func_147488_Z(); - } -@@ -217,6 +237,7 @@ - public BiomeGenBase.SpawnListEntry func_175734_a(EnumCreatureType p_175734_1_, BlockPos p_175734_2_) - { - List list = this.func_72863_F().func_177458_a(p_175734_1_, p_175734_2_); -+ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(this, p_175734_1_, p_175734_2_, list); - return list != null && !list.isEmpty() ? (BiomeGenBase.SpawnListEntry)WeightedRandom.func_76271_a(this.field_73012_v, list) : null; - } - -@@ -274,10 +295,7 @@ - - private void func_73051_P() - { -- this.field_72986_A.func_76080_g(0); -- this.field_72986_A.func_76084_b(false); -- this.field_72986_A.func_76090_f(0); -- this.field_72986_A.func_76069_a(false); -+ this.field_73011_w.resetRainAndThunder(); - } - - public boolean func_73056_e() -@@ -367,7 +385,7 @@ - int i1; - BlockPos blockpos; - -- if (this.field_73012_v.nextInt(100000) == 0 && this.func_72896_J() && this.func_72911_I()) -+ if (this.field_73011_w.canDoLightning(chunk) && this.field_73012_v.nextInt(100000) == 0 && this.func_72896_J() && this.func_72911_I()) - { - this.field_73005_l = this.field_73005_l * 3 + 1013904223; - i1 = this.field_73005_l >> 2; -@@ -381,7 +399,7 @@ - - this.field_72984_F.func_76318_c("iceandsnow"); - -- if (this.field_73012_v.nextInt(16) == 0) -+ if (this.field_73011_w.canDoRainSnowIce(chunk) && this.field_73012_v.nextInt(16) == 0) - { - this.field_73005_l = this.field_73005_l * 3 + 1013904223; - i1 = this.field_73005_l >> 2; -@@ -483,6 +501,9 @@ - if (p_175654_2_.func_149698_L()) - { - b0 = 8; -+ //Keeping here as a note for future when it may be restored. -+ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.field_180282_a.func_177958_n() >> 4, nextticklistentry.field_180282_a.func_177952_p() >> 4)); -+ b0 = (byte)(isForced ? 0 : 8); - - if (this.func_175707_a(nextticklistentry.field_180282_a.func_177982_a(-b0, -b0, -b0), nextticklistentry.field_180282_a.func_177982_a(b0, b0, b0))) - { -@@ -535,7 +556,7 @@ - - public void func_72939_s() - { -- if (this.field_73010_i.isEmpty()) -+ if (this.field_73010_i.isEmpty() && getPersistentChunks().isEmpty()) - { - if (this.field_80004_Q++ >= 1200) - { -@@ -601,6 +622,9 @@ - { - nextticklistentry = (NextTickListEntry)iterator.next(); - iterator.remove(); -+ //Keeping here as a note for future when it may be restored. -+ //boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.xCoord >> 4, nextticklistentry.zCoord >> 4)); -+ //byte b0 = isForced ? 0 : 8; - byte b0 = 0; - - if (this.func_175707_a(nextticklistentry.field_180282_a.func_177982_a(-b0, -b0, -b0), nextticklistentry.field_180282_a.func_177982_a(b0, b0, b0))) -@@ -729,14 +753,29 @@ - { - ArrayList arraylist = Lists.newArrayList(); - -- for (int k1 = 0; k1 < this.field_147482_g.size(); ++k1) -+ //Forge: Optomize this loop to only grab from the chunks it needs -+ for (int x = (p_147486_1_ >> 4); x <= (p_147486_4_ >> 4); x++) - { -- TileEntity tileentity = (TileEntity)this.field_147482_g.get(k1); -- BlockPos blockpos = tileentity.func_174877_v(); -- -- if (blockpos.func_177958_n() >= p_147486_1_ && blockpos.func_177956_o() >= p_147486_2_ && blockpos.func_177952_p() >= p_147486_3_ && blockpos.func_177958_n() < p_147486_4_ && blockpos.func_177956_o() < p_147486_5_ && blockpos.func_177952_p() < p_147486_6_) -+ for (int z = (p_147486_3_ >> 4); z <= (p_147486_6_ >> 4); z++) - { -- arraylist.add(tileentity); -+ Chunk chunk = this.func_72964_e(x, z); -+ if (chunk != null) -+ { -+ for (Object obj : chunk.func_177434_r().values()) -+ { -+ TileEntity entity = (TileEntity)obj; -+ if (!entity.func_145837_r()) -+ { -+ BlockPos pos = entity.func_174877_v(); -+ if (pos.func_177958_n() >= p_147486_1_ && pos.func_177956_o() >= p_147486_2_ && pos.func_177952_p() >= p_147486_3_ && -+ pos.func_177958_n() <= p_147486_4_ && pos.func_177956_o() <= p_147486_5_ && pos.func_177952_p() <= p_147486_6_) -+ { -+ arraylist.add(entity); -+ } -+ -+ } -+ } -+ } - } - } - -@@ -745,6 +784,10 @@ - - public boolean func_175660_a(EntityPlayer p_175660_1_, BlockPos p_175660_2_) - { -+ return super.func_175660_a(p_175660_1_, p_175660_2_); -+ } -+ public boolean canMineBlockBody(EntityPlayer p_175660_1_, BlockPos p_175660_2_) -+ { - return !this.field_73061_a.func_175579_a(this, p_175660_2_, p_175660_1_) && this.func_175723_af().func_177746_a(p_175660_2_); - } - -@@ -810,6 +853,7 @@ - } - else - { -+ if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(this, p_73052_1_)) return; - this.field_72987_B = true; - WorldChunkManager worldchunkmanager = this.field_73011_w.func_177499_m(); - List list = worldchunkmanager.func_76932_a(); -@@ -855,7 +899,7 @@ - - protected void func_73047_i() - { -- WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(field_73069_S, 10); -+ WorldGeneratorBonusChest worldgeneratorbonuschest = net.minecraftforge.common.ForgeHooks.getBonusChest(field_73012_v); - - for (int i = 0; i < 10; ++i) - { -@@ -892,6 +936,7 @@ - } - - this.field_73020_y.func_73151_a(p_73044_1_, p_73044_2_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this)); - List list = this.field_73059_b.func_152380_a(); - Iterator iterator = list.iterator(); - -@@ -929,6 +974,7 @@ - this.field_72986_A.func_176135_e(this.func_175723_af().func_177732_i()); - this.field_73019_z.func_75755_a(this.field_72986_A, this.field_73061_a.func_71203_ab().func_72378_q()); - this.field_72988_C.func_75744_a(); -+ this.perWorldStorage.func_75744_a(); - } - - public void func_72923_a(Entity p_72923_1_) -@@ -984,6 +1030,7 @@ - public Explosion func_72885_a(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) - { - Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_); -+ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; - explosion.func_77278_a(); - explosion.func_77279_a(false); - -@@ -1074,19 +1121,23 @@ - this.field_73061_a.func_71203_ab().func_148537_a(new S2BPacketChangeGameState(8, this.field_73017_q), this.field_73011_w.func_177502_q()); - } - -+ /* 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.field_73061_a.func_71203_ab().func_148540_a(new S2BPacketChangeGameState(2, 0.0F)); -+ this.field_73061_a.func_71203_ab().func_148537_a(new S2BPacketChangeGameState(2, 0.0F), this.field_73011_w.field_76574_g); - } - else - { -- this.field_73061_a.func_71203_ab().func_148540_a(new S2BPacketChangeGameState(1, 0.0F)); -+ this.field_73061_a.func_71203_ab().func_148537_a(new S2BPacketChangeGameState(1, 0.0F), this.field_73011_w.field_76574_g); - } - -- this.field_73061_a.func_71203_ab().func_148540_a(new S2BPacketChangeGameState(7, this.field_73004_o)); -- this.field_73061_a.func_71203_ab().func_148540_a(new S2BPacketChangeGameState(8, this.field_73017_q)); -+ this.field_73061_a.func_71203_ab().func_148537_a(new S2BPacketChangeGameState(7, this.field_73004_o), this.field_73011_w.field_76574_g); -+ this.field_73061_a.func_71203_ab().func_148537_a(new S2BPacketChangeGameState(8, this.field_73017_q), this.field_73011_w.field_76574_g); - } - } - -@@ -1152,6 +1203,11 @@ - return this.field_73061_a.func_152345_ab(); - } - -+ public java.io.File getChunkSaveLocation() -+ { -+ return ((net.minecraft.world.chunk.storage.AnvilChunkLoader)field_73059_b.field_73247_e).field_75825_d; -+ } -+ - static class ServerBlockEventList extends ArrayList - { - private static final String __OBFID = "CL_00001439"; diff --git a/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch b/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch deleted file mode 100644 index 8295a73c4..000000000 --- a/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch +++ /dev/null @@ -1,62 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/WorldServerMulti.java -+++ ../src-work/minecraft/net/minecraft/world/WorldServerMulti.java -@@ -11,13 +11,14 @@ - public class WorldServerMulti extends WorldServer - { - private WorldServer field_175743_a; -+ private IBorderListener borderListener; - private static final String __OBFID = "CL_00001430"; - - public WorldServerMulti(MinecraftServer p_i45923_1_, ISaveHandler p_i45923_2_, int p_i45923_3_, WorldServer p_i45923_4_, Profiler p_i45923_5_) - { - super(p_i45923_1_, p_i45923_2_, new DerivedWorldInfo(p_i45923_4_.func_72912_H()), p_i45923_3_, p_i45923_5_); - this.field_175743_a = p_i45923_4_; -- p_i45923_4_.func_175723_af().func_177737_a(new IBorderListener() -+ this.borderListener = new IBorderListener() - { - private static final String __OBFID = "CL_00002273"; - public void func_177694_a(WorldBorder p_177694_1_, double p_177694_2_) -@@ -48,22 +49,26 @@ - { - WorldServerMulti.this.func_175723_af().func_177724_b(p_177695_2_); - } -- }); -+ }; -+ this.field_175743_a.func_175723_af().func_177737_a(this.borderListener); - } - -- protected void func_73042_a() throws MinecraftException {} -+ protected void func_73042_a() throws MinecraftException -+ { -+ this.perWorldStorage.func_75744_a(); -+ } - - public World func_175643_b() - { - this.field_72988_C = this.field_175743_a.func_175693_T(); - this.field_96442_D = this.field_175743_a.func_96441_U(); - String s = VillageCollection.func_176062_a(this.field_73011_w); -- VillageCollection villagecollection = (VillageCollection)this.field_72988_C.func_75742_a(VillageCollection.class, s); -+ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.func_75742_a(VillageCollection.class, s); - - if (villagecollection == null) - { - this.field_72982_D = new VillageCollection(this); -- this.field_72988_C.func_75745_a(s, this.field_72982_D); -+ this.perWorldStorage.func_75745_a(s, this.field_72982_D); - } - else - { -@@ -73,4 +78,12 @@ - - return this; - } -+ -+ -+ @Override -+ public void func_73041_k() -+ { -+ super.func_73041_k(); -+ this.field_175743_a.func_175723_af().removeListener(this.borderListener); // Unlink ourselves, to prevent world leak. -+ } - } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch deleted file mode 100644 index f1cbc0743..000000000 --- a/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch +++ /dev/null @@ -1,267 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeDecorator.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeDecorator.java -@@ -23,6 +23,11 @@ - import net.minecraft.world.gen.feature.WorldGenWaterlily; - import net.minecraft.world.gen.feature.WorldGenerator; - -+import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.*; -+import static net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.*; -+import net.minecraftforge.common.*; -+import net.minecraftforge.event.terraingen.*; -+ - public class BiomeDecorator - { - public World field_76815_a; -@@ -125,26 +130,30 @@ - - protected void func_150513_a(BiomeGenBase p_150513_1_) - { -+ MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(field_76815_a, field_76813_b, field_180294_c)); - this.func_76797_b(); - int i; - int j; - int k; - -- for (i = 0; i < this.field_76805_H; ++i) -+ boolean doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, SAND); -+ for (i = 0; doGen && i < this.field_76805_H; ++i) - { - j = this.field_76813_b.nextInt(16) + 8; - k = this.field_76813_b.nextInt(16) + 8; - this.field_76810_g.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_76815_a.func_175672_r(this.field_180294_c.func_177982_a(j, 0, k))); - } - -- for (i = 0; i < this.field_76806_I; ++i) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, CLAY); -+ for (i = 0; doGen && i < this.field_76806_I; ++i) - { - j = this.field_76813_b.nextInt(16) + 8; - k = this.field_76813_b.nextInt(16) + 8; - this.field_76809_f.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_76815_a.func_175672_r(this.field_180294_c.func_177982_a(j, 0, k))); - } - -- for (i = 0; i < this.field_76801_G; ++i) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, SAND_PASS2); -+ for (i = 0; doGen && i < this.field_76801_G; ++i) - { - j = this.field_76813_b.nextInt(16) + 8; - k = this.field_76813_b.nextInt(16) + 8; -@@ -161,7 +170,8 @@ - int l; - BlockPos blockpos; - -- for (j = 0; j < i; ++j) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, TREE); -+ for (j = 0; doGen && j < i; ++j) - { - k = this.field_76813_b.nextInt(16) + 8; - l = this.field_76813_b.nextInt(16) + 8; -@@ -175,7 +185,8 @@ - } - } - -- for (j = 0; j < this.field_76807_J; ++j) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, BIG_SHROOM); -+ for (j = 0; doGen && j < this.field_76807_J; ++j) - { - k = this.field_76813_b.nextInt(16) + 8; - l = this.field_76813_b.nextInt(16) + 8; -@@ -184,11 +195,12 @@ - - int i1; - -- for (j = 0; j < this.field_76802_A; ++j) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, FLOWERS); -+ for (j = 0; doGen && j < this.field_76802_A; ++j) - { - k = this.field_76813_b.nextInt(16) + 8; - l = this.field_76813_b.nextInt(16) + 8; -- i1 = this.field_76813_b.nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() + 32); -+ i1 = nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() + 32); - blockpos = this.field_180294_c.func_177982_a(k, i1, l); - BlockFlower.EnumFlowerType enumflowertype = p_150513_1_.func_180623_a(this.field_76813_b, blockpos); - BlockFlower blockflower = enumflowertype.func_176964_a().func_180346_a(); -@@ -200,29 +212,32 @@ - } - } - -- for (j = 0; j < this.field_76803_B; ++j) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, GRASS); -+ for (j = 0; doGen && j < this.field_76803_B; ++j) - { - k = this.field_76813_b.nextInt(16) + 8; - l = this.field_76813_b.nextInt(16) + 8; -- i1 = this.field_76813_b.nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); -+ i1 = nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); - p_150513_1_.func_76730_b(this.field_76813_b).func_180709_b(this.field_76815_a, this.field_76813_b, this.field_180294_c.func_177982_a(k, i1, l)); - } - -- for (j = 0; j < this.field_76804_C; ++j) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, DEAD_BUSH); -+ for (j = 0; doGen && j < this.field_76804_C; ++j) - { - k = this.field_76813_b.nextInt(16) + 8; - l = this.field_76813_b.nextInt(16) + 8; -- i1 = this.field_76813_b.nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); -+ i1 = nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); - (new WorldGenDeadBush()).func_180709_b(this.field_76815_a, this.field_76813_b, this.field_180294_c.func_177982_a(k, i1, l)); - } - - j = 0; - -- while (j < this.field_76833_y) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, LILYPAD); -+ while (doGen && j < this.field_76833_y) - { - k = this.field_76813_b.nextInt(16) + 8; - l = this.field_76813_b.nextInt(16) + 8; -- i1 = this.field_76813_b.nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); -+ i1 = nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); - blockpos = this.field_180294_c.func_177982_a(k, i1, l); - - while (true) -@@ -244,7 +259,8 @@ - } - } - -- for (j = 0; j < this.field_76798_D; ++j) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, SHROOM); -+ for (j = 0; doGen && j < this.field_76798_D; ++j) - { - if (this.field_76813_b.nextInt(4) == 0) - { -@@ -258,57 +274,60 @@ - { - k = this.field_76813_b.nextInt(16) + 8; - l = this.field_76813_b.nextInt(16) + 8; -- i1 = this.field_76813_b.nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); -+ i1 = nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); - blockpos = this.field_180294_c.func_177982_a(k, i1, l); - this.field_76827_t.func_180709_b(this.field_76815_a, this.field_76813_b, blockpos); - } - } - -- if (this.field_76813_b.nextInt(4) == 0) -+ if (doGen && this.field_76813_b.nextInt(4) == 0) - { - j = this.field_76813_b.nextInt(16) + 8; - k = this.field_76813_b.nextInt(16) + 8; -- l = this.field_76813_b.nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(j, 0, k)).func_177956_o() * 2); -+ l = nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(j, 0, k)).func_177956_o() * 2); - this.field_76828_s.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_180294_c.func_177982_a(j, l, k)); - } - -- if (this.field_76813_b.nextInt(8) == 0) -+ if (doGen && this.field_76813_b.nextInt(8) == 0) - { - j = this.field_76813_b.nextInt(16) + 8; - k = this.field_76813_b.nextInt(16) + 8; -- l = this.field_76813_b.nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(j, 0, k)).func_177956_o() * 2); -+ l = nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(j, 0, k)).func_177956_o() * 2); - this.field_76827_t.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_180294_c.func_177982_a(j, l, k)); - } - -- for (j = 0; j < this.field_76799_E; ++j) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, REED); -+ for (j = 0; doGen && j < this.field_76799_E; ++j) - { - k = this.field_76813_b.nextInt(16) + 8; - l = this.field_76813_b.nextInt(16) + 8; -- i1 = this.field_76813_b.nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); -+ i1 = nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); - this.field_76825_v.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_180294_c.func_177982_a(k, i1, l)); - } - -- for (j = 0; j < 10; ++j) -+ for (j = 0; doGen && j < 10; ++j) - { - k = this.field_76813_b.nextInt(16) + 8; - l = this.field_76813_b.nextInt(16) + 8; -- i1 = this.field_76813_b.nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); -+ i1 = nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); - this.field_76825_v.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_180294_c.func_177982_a(k, i1, l)); - } - -- if (this.field_76813_b.nextInt(32) == 0) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, PUMPKIN); -+ if (doGen && this.field_76813_b.nextInt(32) == 0) - { - j = this.field_76813_b.nextInt(16) + 8; - k = this.field_76813_b.nextInt(16) + 8; -- l = this.field_76813_b.nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(j, 0, k)).func_177956_o() * 2); -+ l = nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(j, 0, k)).func_177956_o() * 2); - (new WorldGenPumpkin()).func_180709_b(this.field_76815_a, this.field_76813_b, this.field_180294_c.func_177982_a(j, l, k)); - } - -- for (j = 0; j < this.field_76800_F; ++j) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, CACTUS); -+ for (j = 0; doGen && j < this.field_76800_F; ++j) - { - k = this.field_76813_b.nextInt(16) + 8; - l = this.field_76813_b.nextInt(16) + 8; -- i1 = this.field_76813_b.nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); -+ i1 = nextInt(this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(k, 0, l)).func_177956_o() * 2); - this.field_76824_w.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_180294_c.func_177982_a(k, i1, l)); - } - -@@ -316,18 +335,22 @@ - { - BlockPos blockpos1; - -- for (j = 0; j < 50; ++j) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, LAKE_WATER); -+ for (j = 0; doGen && j < 50; ++j) - { - blockpos1 = this.field_180294_c.func_177982_a(this.field_76813_b.nextInt(16) + 8, this.field_76813_b.nextInt(this.field_76813_b.nextInt(248) + 8), this.field_76813_b.nextInt(16) + 8); - (new WorldGenLiquids(Blocks.field_150358_i)).func_180709_b(this.field_76815_a, this.field_76813_b, blockpos1); - } - -- for (j = 0; j < 20; ++j) -+ doGen = TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, LAKE_LAVA); -+ for (j = 0; doGen && j < 20; ++j) - { - blockpos1 = this.field_180294_c.func_177982_a(this.field_76813_b.nextInt(16) + 8, this.field_76813_b.nextInt(this.field_76813_b.nextInt(this.field_76813_b.nextInt(240) + 8) + 8), this.field_76813_b.nextInt(16) + 8); - (new WorldGenLiquids(Blocks.field_150356_k)).func_180709_b(this.field_76815_a, this.field_76813_b, blockpos1); - } - } -+ -+ MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(field_76815_a, field_76813_b, field_180294_c)); - } - - protected void func_76795_a(int p_76795_1_, WorldGenerator p_76795_2_, int p_76795_3_, int p_76795_4_) -@@ -370,16 +393,35 @@ - - protected void func_76797_b() - { -+ MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Pre(field_76815_a, field_76813_b, field_180294_c)); -+ if (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76823_i, field_180294_c, DIRT)) - this.func_76795_a(this.field_180293_d.field_177790_J, this.field_76823_i, this.field_180293_d.field_177791_K, this.field_180293_d.field_177784_L); -+ if (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76820_j, field_180294_c, GRAVEL)) - this.func_76795_a(this.field_180293_d.field_177786_N, this.field_76820_j, this.field_180293_d.field_177787_O, this.field_180293_d.field_177797_P); -+ if (TerrainGen.generateOre(field_76815_a, field_76813_b, field_180297_k, field_180294_c, DIORITE)) - this.func_76795_a(this.field_180293_d.field_177795_V, this.field_180297_k, this.field_180293_d.field_177794_W, this.field_180293_d.field_177801_X); -+ if (TerrainGen.generateOre(field_76815_a, field_76813_b, field_180296_j, field_180294_c, GRANITE)) - this.func_76795_a(this.field_180293_d.field_177799_R, this.field_180296_j, this.field_180293_d.field_177798_S, this.field_180293_d.field_177793_T); -+ if (TerrainGen.generateOre(field_76815_a, field_76813_b, field_180295_l, field_180294_c, ANDESITE)) - this.func_76795_a(this.field_180293_d.field_177802_Z, this.field_180295_l, this.field_180293_d.field_177846_aa, this.field_180293_d.field_177847_ab); -+ if (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76821_k, field_180294_c, COAL)) - this.func_76795_a(this.field_180293_d.field_177845_ad, this.field_76821_k, this.field_180293_d.field_177851_ae, this.field_180293_d.field_177853_af); -+ if (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76818_l, field_180294_c, IRON)) - this.func_76795_a(this.field_180293_d.field_177849_ah, this.field_76818_l, this.field_180293_d.field_177832_ai, this.field_180293_d.field_177834_aj); -+ if (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76819_m, field_180294_c, GOLD)) - this.func_76795_a(this.field_180293_d.field_177830_al, this.field_76819_m, this.field_180293_d.field_177840_am, this.field_180293_d.field_177842_an); -+ if (TerrainGen.generateOre(field_76815_a, field_76813_b, field_180299_p, field_180294_c, REDSTONE)) - this.func_76795_a(this.field_180293_d.field_177838_ap, this.field_180299_p, this.field_180293_d.field_177818_aq, this.field_180293_d.field_177816_ar); -+ if (TerrainGen.generateOre(field_76815_a, field_76813_b, field_180298_q, field_180294_c, DIAMOND)) - this.func_76795_a(this.field_180293_d.field_177812_at, this.field_180298_q, this.field_180293_d.field_177826_au, this.field_180293_d.field_177824_av); -+ if (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76831_p, field_180294_c, LAPIS)) - this.func_76793_b(this.field_180293_d.field_177820_ax, this.field_76831_p, this.field_180293_d.field_177807_ay, this.field_180293_d.field_177805_az); -+ MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Post(field_76815_a, field_76813_b, field_180294_c)); - } -+ -+ private int nextInt(int i) { //Safety wrapper to prevent exceptions. -+ if (i <= 1) -+ return 0; -+ return this.field_76813_b.nextInt(i); -+ } - } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch deleted file mode 100644 index 951092d6d..000000000 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenHills.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenHills.java -@@ -58,7 +58,7 @@ - int i1 = p_180624_2_.nextInt(16); - BlockPos blockpos1 = p_180624_3_.func_177982_a(k, l, i1); - -- if (p_180624_1_.func_180495_p(blockpos1).func_177230_c() == Blocks.field_150348_b) -+ if (p_180624_1_.func_180495_p(blockpos1).func_177230_c().isReplaceableOreGen(p_180624_1_, blockpos1, net.minecraft.block.state.pattern.BlockHelper.func_177642_a(Blocks.field_150348_b))) - { - p_180624_1_.func_180501_a(blockpos1, Blocks.field_150412_bA.func_176223_P(), 2); - } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch deleted file mode 100644 index 52cad7625..000000000 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenJungle.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenJungle.java -@@ -61,7 +61,9 @@ - super.func_180624_a(p_180624_1_, p_180624_2_, p_180624_3_); - int i = p_180624_2_.nextInt(16) + 8; - int j = p_180624_2_.nextInt(16) + 8; -- int k = p_180624_2_.nextInt(p_180624_1_.func_175645_m(p_180624_3_.func_177982_a(i, 0, j)).func_177956_o() * 2); -+ int height = p_180624_1_.func_175645_m(p_180624_3_.func_177982_a(i, 0, j)).func_177956_o() * 2; // could == 0, which crashes nextInt -+ if (height < 1) height = 1; -+ int k = p_180624_2_.nextInt(height); - (new WorldGenMelon()).func_180709_b(p_180624_1_, p_180624_2_, p_180624_3_.func_177982_a(i, k, j)); - WorldGenVines worldgenvines = new WorldGenVines(); - diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch deleted file mode 100644 index 307fd62fc..000000000 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenPlains.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenPlains.java -@@ -109,4 +109,19 @@ - biomegenplains.field_150609_ah = 14273354; - return biomegenplains; - } -+ -+ @Override -+ public void addDefaultFlowers() -+ { -+ BlockFlower red = net.minecraft.init.Blocks.field_150328_O; -+ BlockFlower yel = net.minecraft.init.Blocks.field_150327_N; -+ addFlower(red.func_176223_P().func_177226_a(red.func_176494_l(), BlockFlower.EnumFlowerType.ORANGE_TULIP), 3); -+ addFlower(red.func_176223_P().func_177226_a(red.func_176494_l(), BlockFlower.EnumFlowerType.RED_TULIP), 3); -+ addFlower(red.func_176223_P().func_177226_a(red.func_176494_l(), BlockFlower.EnumFlowerType.PINK_TULIP), 3); -+ addFlower(red.func_176223_P().func_177226_a(red.func_176494_l(), BlockFlower.EnumFlowerType.WHITE_TULIP), 3); -+ addFlower(red.func_176223_P().func_177226_a(red.func_176494_l(), BlockFlower.EnumFlowerType.POPPY), 20); -+ addFlower(red.func_176223_P().func_177226_a(red.func_176494_l(), BlockFlower.EnumFlowerType.HOUSTONIA), 20); -+ addFlower(red.func_176223_P().func_177226_a(red.func_176494_l(), BlockFlower.EnumFlowerType.OXEYE_DAISY), 20); -+ addFlower(yel.func_176223_P().func_177226_a(yel.func_176494_l(), BlockFlower.EnumFlowerType.DANDELION), 30); -+ } - } diff --git a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch deleted file mode 100644 index 9ccc98432..000000000 --- a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ /dev/null @@ -1,264 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/chunk/Chunk.java -+++ ../src-work/minecraft/net/minecraft/world/chunk/Chunk.java -@@ -35,6 +35,9 @@ - import net.minecraft.world.gen.ChunkProviderDebug; - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.EntityEvent; -+import net.minecraftforge.event.world.ChunkEvent; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - -@@ -174,7 +177,7 @@ - { - Block block = this.func_150810_a(j, l - 1, k); - -- if (block.func_149717_k() == 0) -+ if (func_150808_b(j, l - 1, k) == 0) - { - --l; - continue; -@@ -469,12 +472,12 @@ - - public int func_177437_b(BlockPos p_177437_1_) - { -- return this.func_177428_a(p_177437_1_).func_149717_k(); -+ return this.func_177428_a(p_177437_1_).getLightOpacity(field_76637_e, p_177437_1_); - } - - private int func_150808_b(int p_150808_1_, int p_150808_2_, int p_150808_3_) - { -- return this.func_150810_a(p_150808_1_, p_150808_2_, p_150808_3_).func_149717_k(); -+ return func_177437_b(new BlockPos((field_76635_g << 4) + p_150808_1_, p_150808_2_, (field_76647_h << 4) + p_150808_3_)); - } - - private Block func_150810_a(int p_150810_1_, int p_150810_2_, int p_150810_3_) -@@ -653,16 +656,23 @@ - flag = j >= i1; - } - -+ int j1 = block.getLightOpacity(this.field_76637_e, p_177436_1_); -+ - extendedblockstorage.func_177484_a(i, j & 15, k, p_177436_2_); - -- if (block1 != block) -+ //if (block1 != block) - { - if (!this.field_76637_e.field_72995_K) - { -+ if (iblockstate1.func_177230_c() != p_177436_2_.func_177230_c()) //Only fire block breaks when the block changes. - block1.func_180663_b(this.field_76637_e, p_177436_1_, iblockstate1); -+ TileEntity te = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK); -+ if (te != null && te.shouldRefresh(this.field_76637_e, p_177436_1_, iblockstate1, p_177436_2_)) this.field_76637_e.func_175713_t(p_177436_1_); - } -- else if (block1 instanceof ITileEntityProvider) -+ else if (block1.hasTileEntity(iblockstate1)) - { -+ TileEntity te = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK); -+ if (te != null && te.shouldRefresh(this.field_76637_e, p_177436_1_, iblockstate1, p_177436_2_)) - this.field_76637_e.func_175713_t(p_177436_1_); - } - } -@@ -679,8 +689,7 @@ - } - else - { -- int j1 = block.func_149717_k(); -- int k1 = block1.func_149717_k(); -+ int k1 = block.getLightOpacity(this.field_76637_e, p_177436_1_); - - if (j1 > 0) - { -@@ -702,28 +711,18 @@ - - TileEntity tileentity; - -- if (block1 instanceof ITileEntityProvider) -- { -- tileentity = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK); -- -- if (tileentity != null) -- { -- tileentity.func_145836_u(); -- } -- } -- - if (!this.field_76637_e.field_72995_K && block1 != block) - { - block.func_176213_c(this.field_76637_e, p_177436_1_, p_177436_2_); - } - -- if (block instanceof ITileEntityProvider) -+ if (block.hasTileEntity(p_177436_2_)) - { - tileentity = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK); - - if (tileentity == null) - { -- tileentity = ((ITileEntityProvider)block).func_149915_a(this.field_76637_e, block.func_176201_c(p_177436_2_)); -+ tileentity = block.createTileEntity(this.field_76637_e, p_177436_2_); - this.field_76637_e.func_175690_a(p_177436_1_, tileentity); - } - -@@ -826,6 +825,7 @@ - k = this.field_76645_j.length - 1; - } - -+ MinecraftForge.EVENT_BUS.post(new EntityEvent.EnteringChunk(p_76612_1_, this.field_76635_g, this.field_76647_h, 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_76635_g; - p_76612_1_.field_70162_ai = k; -@@ -864,13 +864,20 @@ - private TileEntity func_177422_i(BlockPos p_177422_1_) - { - Block block = this.func_177428_a(p_177422_1_); -- return !block.func_149716_u() ? null : ((ITileEntityProvider)block).func_149915_a(this.field_76637_e, this.func_177418_c(p_177422_1_)); -+ IBlockState state = block.func_176203_a(this.func_177418_c(p_177422_1_)); -+ return !block.hasTileEntity(state) ? null : block.createTileEntity(this.field_76637_e, state); - } - - public TileEntity func_177424_a(BlockPos p_177424_1_, Chunk.EnumCreateEntityType p_177424_2_) - { - TileEntity tileentity = (TileEntity)this.field_150816_i.get(p_177424_1_); - -+ if (tileentity != null && tileentity.func_145837_r()) -+ { -+ field_150816_i.remove(p_177424_1_); -+ tileentity = null; -+ } -+ - if (tileentity == null) - { - if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE) -@@ -883,11 +890,6 @@ - this.field_177447_w.add(p_177424_1_); - } - } -- else if (tileentity.func_145837_r()) -- { -- this.field_150816_i.remove(p_177424_1_); -- return null; -- } - - return tileentity; - } -@@ -907,7 +909,7 @@ - p_177426_2_.func_145834_a(this.field_76637_e); - p_177426_2_.func_174878_a(p_177426_1_); - -- if (this.func_177428_a(p_177426_1_) instanceof ITileEntityProvider) -+ if (this.func_177428_a(p_177426_1_).hasTileEntity(func_177428_a(p_177426_1_).func_176203_a(this.func_177418_c(p_177426_1_)))) - { - if (this.field_150816_i.containsKey(p_177426_1_)) - { -@@ -947,8 +949,9 @@ - entity.func_110123_P(); - } - -- this.field_76637_e.func_175650_b(this.field_76645_j[i]); -+ this.field_76637_e.func_175650_b(com.google.common.collect.ImmutableList.copyOf(this.field_76645_j[i])); - } -+ MinecraftForge.EVENT_BUS.post(new ChunkEvent.Load(this)); - } - - public void func_76623_d() -@@ -966,6 +969,7 @@ - { - this.field_76637_e.func_175681_c(this.field_76645_j[i]); - } -+ MinecraftForge.EVENT_BUS.post(new ChunkEvent.Unload(this)); - } - - public void func_76630_e() -@@ -975,8 +979,8 @@ - - public void func_177414_a(Entity p_177414_1_, AxisAlignedBB p_177414_2_, List p_177414_3_, 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 - World.MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.func_76128_c((p_177414_2_.field_72337_e + World.MAX_ENTITY_RADIUS) / 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); - -@@ -1012,8 +1016,8 @@ - - public void func_177430_a(Class p_177430_1_, AxisAlignedBB p_177430_2_, List p_177430_3_, 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 - World.MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.func_76128_c((p_177430_2_.field_72337_e + World.MAX_ENTITY_RADIUS) / 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); - -@@ -1179,8 +1183,10 @@ - while (!this.field_177447_w.isEmpty()) - { - BlockPos blockpos = (BlockPos)this.field_177447_w.poll(); -+ Block block = this.func_177428_a(blockpos); -+ IBlockState state = block.func_176203_a(this.func_177418_c(blockpos)); - -- if (this.func_177424_a(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.func_177428_a(blockpos).func_149716_u()) -+ if (this.func_177424_a(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && block.hasTileEntity(state)) - { - TileEntity tileentity = this.func_177422_i(blockpos); - this.field_76637_e.func_175690_a(blockpos, tileentity); -@@ -1242,6 +1248,15 @@ - @SideOnly(Side.CLIENT) - public void func_177439_a(byte[] p_177439_1_, int p_177439_2_, boolean p_177439_3_) - { -+ Iterator iterator = field_150816_i.values().iterator(); -+ while(iterator.hasNext()) -+ { -+ TileEntity tileEntity = (TileEntity)iterator.next(); -+ tileEntity.func_145836_u(); -+ tileEntity.func_145832_p(); -+ tileEntity.func_145838_q(); -+ } -+ - int j = 0; - boolean flag1 = !this.field_76637_e.field_73011_w.func_177495_o(); - int k; -@@ -1311,13 +1326,18 @@ - this.field_150814_l = true; - this.field_76646_k = true; - this.func_76590_a(); -- Iterator iterator = this.field_150816_i.values().iterator(); -+ List invalidList = new java.util.ArrayList(); -+ iterator = this.field_150816_i.values().iterator(); - - while (iterator.hasNext()) - { - TileEntity tileentity = (TileEntity)iterator.next(); -+ if (tileentity.shouldRefresh(this.field_76637_e, tileentity.func_174877_v(), tileentity.func_145838_q().func_176203_a(tileentity.func_145832_p()), func_177435_g(tileentity.func_174877_v()))) -+ invalidList.add(tileentity); - tileentity.func_145836_u(); - } -+ -+ for (TileEntity te : invalidList) te.func_145843_s(); - } - - public BiomeGenBase func_177411_a(BlockPos p_177411_1_, WorldChunkManager p_177411_2_) -@@ -1644,4 +1664,20 @@ - - private static final String __OBFID = "CL_00002009"; - } -+ -+ /** -+ * Removes the tile entity at the specified position, only if it's -+ * marked as invalid. -+ */ -+ public void removeInvalidTileEntity(BlockPos pos) -+ { -+ if (field_76636_d) -+ { -+ TileEntity entity = (TileEntity)field_150816_i.get(pos); -+ if (entity != null && entity.func_145837_r()) -+ { -+ field_150816_i.remove(pos); -+ } -+ } -+ } - } diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch deleted file mode 100644 index 34fba0645..000000000 --- a/patches/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java -+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java -@@ -35,6 +35,8 @@ - - public void func_177484_a(int p_177484_1_, int p_177484_2_, int p_177484_3_, IBlockState p_177484_4_) - { -+ if (p_177484_4_ instanceof net.minecraftforge.common.property.IExtendedBlockState) -+ p_177484_4_ = ((net.minecraftforge.common.property.IExtendedBlockState) p_177484_4_).getClean(); - IBlockState iblockstate1 = this.func_177485_a(p_177484_1_, p_177484_2_, p_177484_3_); - Block block = iblockstate1.func_177230_c(); - Block block1 = p_177484_4_.func_177230_c(); diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch deleted file mode 100644 index 36e3964e9..000000000 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch +++ /dev/null @@ -1,121 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java -+++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java -@@ -24,6 +24,11 @@ - import net.minecraft.world.gen.structure.MapGenStronghold; - import net.minecraft.world.gen.structure.MapGenVillage; - import net.minecraft.world.gen.structure.StructureOceanMonument; -+import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.*; -+import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.*; -+import net.minecraftforge.common.*; -+import net.minecraftforge.fml.common.eventhandler.Event.*; -+import net.minecraftforge.event.terraingen.*; - - public class ChunkProviderGenerate implements IChunkProvider - { -@@ -68,6 +73,15 @@ - this.field_73233_x = new MapGenScatteredFeature(); - this.field_73232_y = new MapGenRavine(); - this.field_177474_A = new StructureOceanMonument(); -+ { -+ field_73226_t = TerrainGen.getModdedMapGen(field_73226_t, CAVE); -+ field_73225_u = (MapGenStronghold)TerrainGen.getModdedMapGen(field_73225_u, STRONGHOLD); -+ field_73224_v = (MapGenVillage)TerrainGen.getModdedMapGen(field_73224_v, VILLAGE); -+ field_73223_w = (MapGenMineshaft)TerrainGen.getModdedMapGen(field_73223_w, MINESHAFT); -+ field_73233_x = (MapGenScatteredFeature)TerrainGen.getModdedMapGen(field_73233_x, SCATTERED_FEATURE); -+ field_73232_y = TerrainGen.getModdedMapGen(field_73232_y, RAVINE); -+ field_177474_A = (StructureOceanMonument)TerrainGen.getModdedMapGen(field_177474_A, OCEAN_MONUMENT); -+ } - this.field_73230_p = p_i45636_1_; - this.field_73229_q = p_i45636_4_; - this.field_177475_o = p_i45636_1_.func_72912_H().func_76067_t(); -@@ -96,6 +110,16 @@ - this.field_177477_r = ChunkProviderSettings.Factory.func_177865_a(p_i45636_5_).func_177864_b(); - this.field_177476_s = this.field_177477_r.field_177778_E ? Blocks.field_150353_l : Blocks.field_150355_j; - } -+ -+ NoiseGenerator[] noiseGens = {field_147431_j, field_147432_k, field_147429_l, field_147430_m, field_73214_a, field_73212_b, field_73213_c}; -+ noiseGens = TerrainGen.getModdedNoiseGenerators(p_i45636_1_, this.field_73220_k, noiseGens); -+ this.field_147431_j = (NoiseGeneratorOctaves)noiseGens[0]; -+ this.field_147432_k = (NoiseGeneratorOctaves)noiseGens[1]; -+ this.field_147429_l = (NoiseGeneratorOctaves)noiseGens[2]; -+ this.field_147430_m = (NoiseGeneratorPerlin)noiseGens[3]; -+ this.field_73214_a = (NoiseGeneratorOctaves)noiseGens[4]; -+ this.field_73212_b = (NoiseGeneratorOctaves)noiseGens[5]; -+ this.field_73213_c = (NoiseGeneratorOctaves)noiseGens[6]; - } - - public void func_180518_a(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_) -@@ -169,6 +193,10 @@ - - public void func_180517_a(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_) - { -+ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180517_1_, p_180517_2_, p_180517_3_, this.field_73230_p); -+ MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == Result.DENY) return; -+ - double d0 = 0.03125D; - this.field_73227_s = this.field_147430_m.func_151599_a(this.field_73227_s, (double)(p_180517_1_ * 16), (double)(p_180517_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); - -@@ -375,6 +403,8 @@ - boolean flag = false; - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); - -+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag)); -+ - if (this.field_177477_r.field_177829_w && this.field_73229_q) - { - this.field_73223_w.func_175794_a(this.field_73230_p, this.field_73220_k, chunkcoordintpair); -@@ -404,7 +434,8 @@ - int l1; - int i2; - -- if (biomegenbase != BiomeGenBase.field_76769_d && biomegenbase != BiomeGenBase.field_76786_s && this.field_177477_r.field_177781_A && !flag && this.field_73220_k.nextInt(this.field_177477_r.field_177782_B) == 0) -+ if (biomegenbase != BiomeGenBase.field_76769_d && biomegenbase != BiomeGenBase.field_76786_s && this.field_177477_r.field_177781_A && !flag && this.field_73220_k.nextInt(this.field_177477_r.field_177782_B) == 0 -+ && TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, LAKE)) - { - k1 = this.field_73220_k.nextInt(16) + 8; - l1 = this.field_73220_k.nextInt(256); -@@ -412,7 +443,7 @@ - (new WorldGenLakes(Blocks.field_150355_j)).func_180709_b(this.field_73230_p, this.field_73220_k, blockpos.func_177982_a(k1, l1, i2)); - } - -- if (!flag && this.field_73220_k.nextInt(this.field_177477_r.field_177777_D / 10) == 0 && this.field_177477_r.field_177783_C) -+ if (TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, LAVA) && !flag && this.field_73220_k.nextInt(this.field_177477_r.field_177777_D / 10) == 0 && this.field_177477_r.field_177783_C) - { - k1 = this.field_73220_k.nextInt(16) + 8; - l1 = this.field_73220_k.nextInt(this.field_73220_k.nextInt(248) + 8); -@@ -426,7 +457,8 @@ - - if (this.field_177477_r.field_177837_s) - { -- for (k1 = 0; k1 < this.field_177477_r.field_177835_t; ++k1) -+ boolean doGen = TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, DUNGEON); -+ for (k1 = 0; doGen && k1 < this.field_177477_r.field_177835_t; ++k1) - { - l1 = this.field_73220_k.nextInt(16) + 8; - i2 = this.field_73220_k.nextInt(256); -@@ -436,10 +468,14 @@ - } - - biomegenbase.func_180624_a(this.field_73230_p, this.field_73220_k, new BlockPos(k, 0, l)); -+ if (TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, ANIMALS)) -+ { - SpawnerAnimals.func_77191_a(this.field_73230_p, biomegenbase, k + 8, l + 8, 16, 16, this.field_73220_k); -+ } - blockpos = blockpos.func_177982_a(8, 0, 8); - -- for (k1 = 0; k1 < 16; ++k1) -+ boolean doGen = TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, ICE); -+ for (k1 = 0; doGen && k1 < 16; ++k1) - { - for (l1 = 0; l1 < 16; ++l1) - { -@@ -458,6 +494,8 @@ - } - } - -+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag)); -+ - BlockFalling.field_149832_M = false; - } - diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch deleted file mode 100644 index 98670b6ba..000000000 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch +++ /dev/null @@ -1,145 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderHell.java -+++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderHell.java -@@ -24,6 +24,13 @@ - import net.minecraft.world.gen.feature.WorldGenMinable; - import net.minecraft.world.gen.feature.WorldGenerator; - import net.minecraft.world.gen.structure.MapGenNetherBridge; -+import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.*; -+import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.*; -+import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.*; -+import static net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.*; -+import net.minecraftforge.common.*; -+import net.minecraftforge.fml.common.eventhandler.Event.*; -+import net.minecraftforge.event.terraingen.*; - - public class ChunkProviderHell implements IChunkProvider - { -@@ -65,18 +72,30 @@ - this.field_177472_y = new WorldGenHellLava(Blocks.field_150356_k, false); - this.field_177471_z = new GeneratorBushFeature(Blocks.field_150338_P); - this.field_177465_A = new GeneratorBushFeature(Blocks.field_150337_Q); -- this.field_73172_c = new MapGenNetherBridge(); -- this.field_73182_t = new MapGenCavesHell(); -+ this.field_73172_c = (MapGenNetherBridge) TerrainGen.getModdedMapGen(new MapGenNetherBridge(), NETHER_BRIDGE); -+ this.field_73182_t = TerrainGen.getModdedMapGen(new MapGenCavesHell(), NETHER_CAVE); - this.field_73175_o = p_i45637_1_; - this.field_177466_i = p_i45637_2_; - this.field_73181_i = new Random(p_i45637_3_); -- this.field_73178_j = new NoiseGeneratorOctaves(this.field_73181_i, 16); -- this.field_73179_k = new NoiseGeneratorOctaves(this.field_73181_i, 16); -- this.field_73176_l = new NoiseGeneratorOctaves(this.field_73181_i, 8); -- this.field_73177_m = new NoiseGeneratorOctaves(this.field_73181_i, 4); -- this.field_73174_n = new NoiseGeneratorOctaves(this.field_73181_i, 4); -- this.field_73173_a = new NoiseGeneratorOctaves(this.field_73181_i, 10); -- this.field_73171_b = new NoiseGeneratorOctaves(this.field_73181_i, 16); -+ -+ NoiseGenerator[] noiseGens = -+ { -+ new NoiseGeneratorOctaves(this.field_73181_i, 16), -+ new NoiseGeneratorOctaves(this.field_73181_i, 16), -+ new NoiseGeneratorOctaves(this.field_73181_i, 8), -+ new NoiseGeneratorOctaves(this.field_73181_i, 4), -+ new NoiseGeneratorOctaves(this.field_73181_i, 4), -+ new NoiseGeneratorOctaves(this.field_73181_i, 10), -+ new NoiseGeneratorOctaves(this.field_73181_i, 16) -+ }; -+ noiseGens = TerrainGen.getModdedNoiseGenerators(p_i45637_1_, this.field_73181_i, noiseGens); -+ this.field_73178_j = (NoiseGeneratorOctaves)noiseGens[0]; -+ this.field_73179_k = (NoiseGeneratorOctaves)noiseGens[1]; -+ this.field_73176_l = (NoiseGeneratorOctaves)noiseGens[2]; -+ this.field_73177_m = (NoiseGeneratorOctaves)noiseGens[3]; -+ this.field_73174_n = (NoiseGeneratorOctaves)noiseGens[4]; -+ this.field_73173_a = (NoiseGeneratorOctaves)noiseGens[5]; -+ this.field_73171_b = (NoiseGeneratorOctaves)noiseGens[6]; - } - - public void func_180515_a(int p_180515_1_, int p_180515_2_, ChunkPrimer p_180515_3_) -@@ -155,6 +174,10 @@ - - public void func_180516_b(int p_180516_1_, int p_180516_2_, ChunkPrimer p_180516_3_) - { -+ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180516_1_, p_180516_2_, p_180516_3_, this.field_73175_o); -+ MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == Result.DENY) return; -+ - byte b0 = 64; - double d0 = 0.03125D; - this.field_73185_q = this.field_73177_m.func_76304_a(this.field_73185_q, p_180516_1_ * 16, p_180516_2_ * 16, 0, 16, 16, 1, d0, d0, 1.0D); -@@ -272,6 +295,10 @@ - - private double[] func_73164_a(double[] p_73164_1_, int p_73164_2_, int p_73164_3_, int p_73164_4_, int p_73164_5_, int p_73164_6_, int p_73164_7_) - { -+ ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, p_73164_1_, p_73164_2_, p_73164_3_, p_73164_4_, p_73164_5_, p_73164_6_, p_73164_7_); -+ MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == Result.DENY) return event.noisefield; -+ - if (p_73164_1_ == null) - { - p_73164_1_ = new double[p_73164_5_ * p_73164_6_ * p_73164_7_]; -@@ -365,47 +392,58 @@ - public void func_73153_a(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) - { - BlockFalling.field_149832_M = true; -+ -+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, field_73175_o, field_73181_i, p_73153_2_, p_73153_3_, false)); -+ - BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); - this.field_73172_c.func_175794_a(this.field_73175_o, this.field_73181_i, chunkcoordintpair); - int k; - -- for (k = 0; k < 8; ++k) -+ boolean doGen = TerrainGen.populate(p_73153_1_, field_73175_o, field_73181_i, p_73153_2_, p_73153_3_, false, NETHER_LAVA); -+ for (k = 0; doGen && k < 8; ++k) - { - this.field_177472_y.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(120) + 4, this.field_73181_i.nextInt(16) + 8)); - } - -- for (k = 0; k < this.field_73181_i.nextInt(this.field_73181_i.nextInt(10) + 1) + 1; ++k) -+ doGen = TerrainGen.populate(p_73153_1_, field_73175_o, field_73181_i, p_73153_2_, p_73153_3_, false, FIRE); -+ for (k = 0; doGen && k < this.field_73181_i.nextInt(this.field_73181_i.nextInt(10) + 1) + 1; ++k) - { - this.field_177470_t.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(120) + 4, this.field_73181_i.nextInt(16) + 8)); - } - -- for (k = 0; k < this.field_73181_i.nextInt(this.field_73181_i.nextInt(10) + 1); ++k) -+ doGen = TerrainGen.populate(p_73153_1_, field_73175_o, field_73181_i, p_73153_2_, p_73153_3_, false, GLOWSTONE); -+ for (k = 0; doGen && k < this.field_73181_i.nextInt(this.field_73181_i.nextInt(10) + 1); ++k) - { - this.field_177469_u.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(120) + 4, this.field_73181_i.nextInt(16) + 8)); - } - -- for (k = 0; k < 10; ++k) -+ for (k = 0; doGen && k < 10; ++k) - { - this.field_177468_v.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(128), this.field_73181_i.nextInt(16) + 8)); - } - -- if (this.field_73181_i.nextBoolean()) -+ MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(field_73175_o, field_73181_i, blockpos)); -+ -+ doGen = TerrainGen.decorate(field_73175_o, field_73181_i, blockpos, SHROOM); -+ if (doGen && this.field_73181_i.nextBoolean()) - { - this.field_177471_z.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(128), this.field_73181_i.nextInt(16) + 8)); - } - -- if (this.field_73181_i.nextBoolean()) -+ if (doGen && this.field_73181_i.nextBoolean()) - { - this.field_177465_A.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(128), this.field_73181_i.nextInt(16) + 8)); - } - -- for (k = 0; k < 16; ++k) -+ doGen = TerrainGen.generateOre(field_73175_o, field_73181_i, field_177467_w, blockpos, QUARTZ); -+ for (k = 0; doGen && k < 16; ++k) - { - this.field_177467_w.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16), this.field_73181_i.nextInt(108) + 10, this.field_73181_i.nextInt(16))); - } - -- for (k = 0; k < 16; ++k) -+ doGen = TerrainGen.populate(p_73153_1_, field_73175_o, field_73181_i, p_73153_2_, p_73153_3_, false, NETHER_LAVA2); -+ for (k = 0; doGen && k < 16; ++k) - { - this.field_177473_x.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16), this.field_73181_i.nextInt(108) + 10, this.field_73181_i.nextInt(16))); - } diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch deleted file mode 100644 index 0d7b3a944..000000000 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch +++ /dev/null @@ -1,138 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderServer.java -+++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderServer.java -@@ -24,6 +24,10 @@ - import net.minecraft.world.chunk.storage.IChunkLoader; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -+import net.minecraft.world.chunk.storage.AnvilChunkLoader; -+import net.minecraftforge.common.DimensionManager; -+import net.minecraftforge.common.ForgeChunkManager; -+import net.minecraftforge.common.chunkio.ChunkIOExecutor; - - public class ChunkProviderServer implements IChunkProvider - { -@@ -36,6 +40,7 @@ - public LongHashMap field_73244_f = new LongHashMap(); - public List field_73245_g = Lists.newArrayList(); - public WorldServer field_73251_h; -+ private Set loadingChunks = com.google.common.collect.Sets.newHashSet(); - private static final String __OBFID = "CL_00001436"; - - public ChunkProviderServer(WorldServer p_i1520_1_, IChunkLoader p_i1520_2_, IChunkProvider p_i1520_3_) -@@ -58,7 +63,7 @@ - - public void func_73241_b(int p_73241_1_, int p_73241_2_) - { -- if (this.field_73251_h.field_73011_w.func_76567_e()) -+ if (this.field_73251_h.field_73011_w.func_76567_e() && DimensionManager.shouldLoadSpawn(this.field_73251_h.field_73011_w.func_177502_q())) - { - if (!this.field_73251_h.func_72916_c(p_73241_1_, p_73241_2_)) - { -@@ -84,12 +89,64 @@ - - public Chunk func_73158_c(int p_73158_1_, int p_73158_2_) - { -+ return loadChunk(p_73158_1_, p_73158_2_, null); -+ } -+ -+ public Chunk loadChunk(int par1, int par2, Runnable runnable) -+ { -+ long k = ChunkCoordIntPair.func_77272_a(par1, par2); -+ this.field_73248_b.remove(Long.valueOf(k)); -+ Chunk chunk = (Chunk)this.field_73244_f.func_76164_a(k); -+ AnvilChunkLoader loader = null; -+ -+ if (this.field_73247_e instanceof AnvilChunkLoader) -+ { -+ loader = (AnvilChunkLoader) this.field_73247_e; -+ } -+ -+ // We can only use the queue for already generated chunks -+ if (chunk == null && loader != null && loader.chunkExists(this.field_73251_h, par1, par2)) -+ { -+ if (runnable != null) -+ { -+ ChunkIOExecutor.queueChunkLoad(this.field_73251_h, loader, this, par1, par2, runnable); -+ return null; -+ } -+ else -+ { -+ chunk = ChunkIOExecutor.syncChunkLoad(this.field_73251_h, loader, this, par1, par2); -+ } -+ } -+ else if (chunk == null) -+ { -+ chunk = this.originalLoadChunk(par1, par2); -+ } -+ -+ // If we didn't load the chunk async and have a callback run it now -+ if (runnable != null) -+ { -+ runnable.run(); -+ } -+ -+ return chunk; -+ } -+ -+ public Chunk originalLoadChunk(int p_73158_1_, int p_73158_2_) -+ { - long k = ChunkCoordIntPair.func_77272_a(p_73158_1_, p_73158_2_); - this.field_73248_b.remove(Long.valueOf(k)); - Chunk chunk = (Chunk)this.field_73244_f.func_76164_a(k); - - if (chunk == null) - { -+ boolean added = loadingChunks.add(k); -+ if (!added) -+ { -+ net.minecraftforge.fml.common.FMLLog.bigWarning("There is an attempt to load a chunk (%d,%d) in dimension %d that is already being loaded. This will cause weird chunk breakages.", p_73158_1_, p_73158_2_, field_73251_h.field_73011_w.func_177502_q()); -+ } -+ chunk = ForgeChunkManager.fetchDormantChunk(k, this.field_73251_h); -+ -+ if (chunk == null) - chunk = this.func_73239_e(p_73158_1_, p_73158_2_); - - if (chunk == null) -@@ -118,6 +175,7 @@ - - this.field_73244_f.func_76163_a(k, chunk); - this.field_73245_g.add(chunk); -+ loadingChunks.remove(k); - chunk.func_76631_c(); - chunk.func_76624_a(this, this, p_73158_1_, p_73158_2_); - } -@@ -209,6 +267,7 @@ - if (this.field_73246_d != null) - { - this.field_73246_d.func_73153_a(p_73153_1_, p_73153_2_, p_73153_3_); -+ net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(p_73153_2_, p_73153_3_, field_73251_h, field_73246_d, p_73153_1_); - chunk.func_76630_e(); - } - } -@@ -269,8 +328,13 @@ - { - if (!this.field_73251_h.field_73058_d) - { -- for (int i = 0; i < 100; ++i) -+ for (ChunkCoordIntPair forced : this.field_73251_h.getPersistentChunks().keySet()) - { -+ this.field_73248_b.remove(ChunkCoordIntPair.func_77272_a(forced.field_77276_a, forced.field_77275_b)); -+ } -+ -+ for (int i = 0; i < 100; ++i) -+ { - if (!this.field_73248_b.isEmpty()) - { - Long olong = (Long)this.field_73248_b.iterator().next(); -@@ -283,6 +347,11 @@ - this.func_73243_a(chunk); - this.field_73244_f.func_76159_d(olong.longValue()); - this.field_73245_g.remove(chunk); -+ ForgeChunkManager.putDormantChunk(ChunkCoordIntPair.func_77272_a(chunk.field_76635_g, chunk.field_76647_h), chunk); -+ if(field_73245_g.size() == 0 && ForgeChunkManager.getPersistentChunksFor(this.field_73251_h).size() == 0 && !DimensionManager.shouldLoadSpawn(this.field_73251_h.field_73011_w.func_177502_q())){ -+ DimensionManager.unloadWorld(this.field_73251_h.field_73011_w.func_177502_q()); -+ return field_73246_d.func_73156_b(); -+ } - } - - this.field_73248_b.remove(olong); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch deleted file mode 100644 index 087efae91..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java -@@ -30,4 +30,10 @@ - this.func_175903_a(p_175921_1_, p_175921_2_, Blocks.field_150346_d.func_176223_P()); - } - } -+ -+ public boolean isReplaceable(World world, BlockPos pos) -+ { -+ net.minecraft.block.state.IBlockState state = world.func_180495_p(pos); -+ return state.func_177230_c().isAir(world, pos) || state.func_177230_c().isLeaves(world, pos) || state.func_177230_c().isWood(world, pos) || func_150523_a(state.func_177230_c()); -+ } - } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch deleted file mode 100644 index 74b05fae4..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java -@@ -55,9 +55,10 @@ - { - if (k >= 0 && k < 256) - { -- Block block = p_180709_1_.func_180495_p(new BlockPos(l, k, i1)).func_177230_c(); -+ BlockPos pos = new BlockPos(l, k, i1); -+ net.minecraft.block.state.IBlockState state = p_180709_1_.func_180495_p(pos); - -- if (block.func_149688_o() != Material.field_151579_a && block.func_149688_o() != Material.field_151584_j) -+ if (!state.func_177230_c().isAir(p_180709_1_, pos) && !state.func_177230_c().isLeaves(p_180709_1_, pos)) - { - flag = false; - } -@@ -188,7 +189,7 @@ - { - BlockPos blockpos1 = new BlockPos(i2, l, j1); - -- if (!p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149730_j()) -+ if (p_180709_1_.func_180495_p(blockpos1).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos1)) - { - this.func_175905_a(p_180709_1_, blockpos1, Block.func_149729_e(Block.func_149682_b(Blocks.field_150420_aW) + i), k1); - } -@@ -199,9 +200,10 @@ - - for (l = 0; l < j; ++l) - { -- Block block2 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(l)).func_177230_c(); -+ BlockPos upN = p_180709_3_.func_177981_b(l); -+ net.minecraft.block.state.IBlockState state = p_180709_1_.func_180495_p(upN); - -- if (!block2.func_149730_j()) -+ if (state.func_177230_c().canBeReplacedByLeaves(p_180709_1_, upN)) - { - this.func_175905_a(p_180709_1_, p_180709_3_.func_177981_b(l), Block.func_149729_e(Block.func_149682_b(Blocks.field_150420_aW) + i), 10); - } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch deleted file mode 100644 index 4921fddef..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java -@@ -107,9 +107,9 @@ - if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_180712_2_ * p_180712_2_)) - { - BlockPos blockpos1 = p_180712_1_.func_177982_a(j, 0, k); -- Material material = this.field_175946_l.func_180495_p(blockpos1).func_177230_c().func_149688_o(); -+ net.minecraft.block.state.IBlockState state = this.field_175946_l.func_180495_p(blockpos1); - -- if (material == Material.field_151579_a || material == Material.field_151584_j) -+ if (state.func_177230_c().isAir(this.field_175946_l, blockpos1) || state.func_177230_c().isLeaves(this.field_175946_l, blockpos1)) - { - this.func_175905_a(this.field_175946_l, blockpos1, p_180712_3_, 0); - } -@@ -268,7 +268,7 @@ - { - BlockPos blockpos3 = p_175936_1_.func_177963_a((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2)); - -- if (!this.func_150523_a(this.field_175946_l.func_180495_p(blockpos3).func_177230_c())) -+ if (!this.isReplaceable(field_175946_l, blockpos3)) - { - return j; - } -@@ -296,6 +296,7 @@ - - if (!this.func_76497_e()) - { -+ this.field_175946_l = null; //Fix vanilla Mem leak, holds latest world - return false; - } - else -@@ -304,15 +305,18 @@ - this.func_175941_b(); - this.func_175942_c(); - this.func_175939_d(); -+ this.field_175946_l = null; //Fix vanilla Mem leak, holds latest world - return true; - } - } - - private boolean func_76497_e() - { -- Block block = this.field_175946_l.func_180495_p(this.field_175947_m.func_177977_b()).func_177230_c(); -+ BlockPos down = this.field_175947_m.func_177977_b(); -+ net.minecraft.block.state.IBlockState state = this.field_175946_l.func_180495_p(down); -+ boolean isSoil = state.func_177230_c().canSustainPlant(this.field_175946_l, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); - -- if (block != Blocks.field_150346_d && block != Blocks.field_150349_c && block != Blocks.field_150458_ak) -+ if (!isSoil) - { - return false; - } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch deleted file mode 100644 index 2b819de6b..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch +++ /dev/null @@ -1,67 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java -@@ -48,7 +48,7 @@ - { - if (j >= 0 && j < 256) - { -- if (!this.func_150523_a(p_180709_1_.func_180495_p(new BlockPos(k, j, l)).func_177230_c())) -+ if (!this.isReplaceable(p_180709_1_, new BlockPos(k, j, l))) - { - flag = false; - } -@@ -67,14 +67,16 @@ - } - else - { -- Block block = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); -+ BlockPos down = p_180709_3_.func_177977_b(); -+ net.minecraft.block.state.IBlockState state = p_180709_1_.func_180495_p(down); -+ boolean isSoil = state.func_177230_c().canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); - -- if ((block == Blocks.field_150349_c || block == Blocks.field_150346_d) && p_180709_3_.func_177956_o() < 256 - i - 1) -+ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) - { -- this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); -- this.func_175921_a(p_180709_1_, p_180709_3_.func_177982_a(1, -1, 0)); -- this.func_175921_a(p_180709_1_, p_180709_3_.func_177982_a(1, -1, 1)); -- this.func_175921_a(p_180709_1_, p_180709_3_.func_177982_a(0, -1, 1)); -+ this.onPlantGrow(p_180709_1_, p_180709_3_.func_177977_b(), p_180709_3_); -+ this.onPlantGrow(p_180709_1_, p_180709_3_.func_177982_a(1, -1, 0), p_180709_3_); -+ this.onPlantGrow(p_180709_1_, p_180709_3_.func_177982_a(1, -1, 1), p_180709_3_); -+ this.onPlantGrow(p_180709_1_, p_180709_3_.func_177982_a(0, -1, 1), p_180709_3_); - EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.func_179518_a(p_180709_2_); - k = i - p_180709_2_.nextInt(4); - l = 2 - p_180709_2_.nextInt(3); -@@ -96,9 +98,9 @@ - } - - BlockPos blockpos1 = new BlockPos(i1, i2, j1); -- Material material = p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149688_o(); -+ state = p_180709_1_.func_180495_p(blockpos1); - -- if (material == Material.field_151579_a || material == Material.field_151584_j) -+ if (state.func_177230_c().isAir(p_180709_1_, blockpos1) || state.func_177230_c().isLeaves(p_180709_1_, blockpos1)) - { - this.func_175905_a(p_180709_1_, blockpos1, Blocks.field_150363_s, BlockPlanks.EnumType.DARK_OAK.func_176839_a() - 4); - this.func_175905_a(p_180709_1_, blockpos1.func_177974_f(), Blocks.field_150363_s, BlockPlanks.EnumType.DARK_OAK.func_176839_a() - 4); -@@ -202,11 +204,18 @@ - - private void func_150526_a(World p_150526_1_, int p_150526_2_, int p_150526_3_, int p_150526_4_) - { -- Block block = p_150526_1_.func_180495_p(new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_)).func_177230_c(); -+ BlockPos pos = new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_); -+ net.minecraft.block.state.IBlockState state = p_150526_1_.func_180495_p(pos); - -- if (block.func_149688_o() == Material.field_151579_a) -+ if (state.func_177230_c().isAir(p_150526_1_, pos)) - { - this.func_175905_a(p_150526_1_, new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_), Blocks.field_150361_u, 1); - } - } -+ -+ //Just a helper macro -+ private void onPlantGrow(World world, BlockPos pos, BlockPos source) -+ { -+ world.func_180495_p(pos).func_177230_c().onPlantGrow(world, pos, source); -+ } - } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch deleted file mode 100644 index fea2ba727..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java -@@ -15,10 +15,12 @@ - { - Block block; - -- while (((block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c()).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && p_180709_3_.func_177956_o() > 0) -+ do - { -+ block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c(); -+ if (!block.isLeaves(p_180709_1_, p_180709_3_) && !block.isLeaves(p_180709_1_, p_180709_3_)) break; - p_180709_3_ = p_180709_3_.func_177977_b(); -- } -+ } while (p_180709_3_.func_177956_o() > 0); - - for (int i = 0; i < 4; ++i) - { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch deleted file mode 100644 index a08072e11..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java -@@ -55,7 +55,7 @@ - { - if (j >= 0 && j < 256) - { -- if (!this.func_150523_a(p_180709_1_.func_180495_p(new BlockPos(k, j, l)).func_177230_c())) -+ if (!this.isReplaceable(p_180709_1_, new BlockPos(k, j, l))) - { - flag = false; - } -@@ -74,11 +74,13 @@ - } - else - { -- Block block1 = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); -+ BlockPos down = p_180709_3_.func_177977_b(); -+ Block block1 = p_180709_1_.func_180495_p(down).func_177230_c(); -+ boolean isSoil = block1.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); - -- if ((block1 == Blocks.field_150349_c || block1 == Blocks.field_150346_d || block1 == Blocks.field_150458_ak) && p_180709_3_.func_177956_o() < 256 - i - 1) -+ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) - { -- this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); -+ block1.onPlantGrow(p_180709_1_, down, p_180709_3_); - int i2; - - for (i2 = p_180709_3_.func_177956_o() - 3 + i; i2 <= p_180709_3_.func_177956_o() + i; ++i2) -@@ -99,7 +101,7 @@ - BlockPos blockpos1 = new BlockPos(i1, i2, k1); - Block block = p_180709_1_.func_180495_p(blockpos1).func_177230_c(); - -- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) -+ if (block.isAir(p_180709_1_, blockpos1) || block.isLeaves(p_180709_1_, blockpos1)) - { - this.func_175905_a(p_180709_1_, blockpos1, Blocks.field_150362_t, BlockPlanks.EnumType.BIRCH.func_176839_a()); - } -@@ -110,9 +112,10 @@ - - for (i2 = 0; i2 < i; ++i2) - { -- Block block2 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(i2)).func_177230_c(); -+ BlockPos upN = p_180709_3_.func_177981_b(i2); -+ Block block2 = p_180709_1_.func_180495_p(upN).func_177230_c(); - -- if (block2.func_149688_o() == Material.field_151579_a || block2.func_149688_o() == Material.field_151584_j) -+ if (block2.isAir(p_180709_1_, upN) || block2.isLeaves(p_180709_1_, upN)) - { - this.func_175905_a(p_180709_1_, p_180709_3_.func_177981_b(i2), Blocks.field_150364_r, BlockPlanks.EnumType.BIRCH.func_176839_a()); - } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch deleted file mode 100644 index 553097c1b..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch +++ /dev/null @@ -1,66 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java -@@ -59,7 +59,7 @@ - { - for (int l = -b0; l <= b0 && flag; ++l) - { -- if (p_175926_2_.func_177956_o() + j < 0 || p_175926_2_.func_177956_o() + j >= 256 || !this.func_150523_a(p_175926_1_.func_180495_p(p_175926_2_.func_177982_a(k, j, l)).func_177230_c())) -+ if (p_175926_2_.func_177956_o() + j < 0 || p_175926_2_.func_177956_o() + j >= 256 || !this.isReplaceable(p_175926_1_, p_175926_2_.func_177982_a(k, j, l))) - { - flag = false; - } -@@ -79,13 +79,14 @@ - { - BlockPos blockpos1 = p_175927_1_.func_177977_b(); - Block block = p_175927_2_.func_180495_p(blockpos1).func_177230_c(); -+ boolean isSoil = block.canSustainPlant(p_175927_2_, blockpos1, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); - -- if ((block == Blocks.field_150349_c || block == Blocks.field_150346_d) && p_175927_1_.func_177956_o() >= 2) -+ if (isSoil && p_175927_1_.func_177956_o() >= 2) - { -- this.func_175921_a(p_175927_2_, blockpos1); -- this.func_175921_a(p_175927_2_, blockpos1.func_177974_f()); -- this.func_175921_a(p_175927_2_, blockpos1.func_177968_d()); -- this.func_175921_a(p_175927_2_, blockpos1.func_177968_d().func_177974_f()); -+ this.onPlantGrow(p_175927_2_, blockpos1, p_175927_1_); -+ this.onPlantGrow(p_175927_2_, blockpos1.func_177974_f(), p_175927_1_); -+ this.onPlantGrow(p_175927_2_, blockpos1.func_177968_d(), p_175927_1_); -+ this.onPlantGrow(p_175927_2_, blockpos1.func_177968_d().func_177974_f(), p_175927_1_); - return true; - } - else -@@ -113,9 +114,9 @@ - if (k * k + l * l <= j || i1 * i1 + j1 * j1 <= j || k * k + j1 * j1 <= j || i1 * i1 + l * l <= j) - { - BlockPos blockpos1 = p_175925_2_.func_177982_a(k, 0, l); -- Material material = p_175925_1_.func_180495_p(blockpos1).func_177230_c().func_149688_o(); -+ net.minecraft.block.state.IBlockState state = p_175925_1_.func_180495_p(blockpos1); - -- if (material == Material.field_151579_a || material == Material.field_151584_j) -+ if (state.func_177230_c().isAir(p_175925_1_, blockpos1) || state.func_177230_c().isLeaves(p_175925_1_, blockpos1)) - { - this.func_175905_a(p_175925_1_, blockpos1, Blocks.field_150362_t, this.field_76521_c); - } -@@ -135,9 +136,9 @@ - if (k * k + l * l <= j) - { - BlockPos blockpos1 = p_175928_2_.func_177982_a(k, 0, l); -- Material material = p_175928_1_.func_180495_p(blockpos1).func_177230_c().func_149688_o(); -+ Block block = p_175928_1_.func_180495_p(blockpos1).func_177230_c(); - -- if (material == Material.field_151579_a || material == Material.field_151584_j) -+ if (block.isAir(p_175928_1_, blockpos1) || block.isLeaves(p_175928_1_, blockpos1)) - { - this.func_175905_a(p_175928_1_, blockpos1, Blocks.field_150362_t, this.field_76521_c); - } -@@ -145,4 +146,10 @@ - } - } - } -+ -+ //Just a helper macro -+ private void onPlantGrow(World world, BlockPos pos, BlockPos source) -+ { -+ world.func_180495_p(pos).func_177230_c().onPlantGrow(world, pos, source); -+ } - } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch deleted file mode 100644 index 449385cd2..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch +++ /dev/null @@ -1,62 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java -@@ -57,7 +57,7 @@ - { - BlockPos blockpos1 = p_180709_3_.func_177981_b(i2); - -- if (this.func_175931_a(p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149688_o())) -+ if (this.isAirLeaves(p_180709_1_, blockpos1)) - { - this.func_175905_a(p_180709_1_, blockpos1, Blocks.field_150364_r, this.field_76520_b); - -@@ -72,7 +72,7 @@ - { - BlockPos blockpos2 = blockpos1.func_177974_f(); - -- if (this.func_175931_a(p_180709_1_.func_180495_p(blockpos2).func_177230_c().func_149688_o())) -+ if (this.isAirLeaves(p_180709_1_, blockpos2)) - { - this.func_175905_a(p_180709_1_, blockpos2, Blocks.field_150364_r, this.field_76520_b); - -@@ -85,7 +85,7 @@ - - BlockPos blockpos3 = blockpos1.func_177968_d().func_177974_f(); - -- if (this.func_175931_a(p_180709_1_.func_180495_p(blockpos3).func_177230_c().func_149688_o())) -+ if (this.isAirLeaves(p_180709_1_, blockpos3)) - { - this.func_175905_a(p_180709_1_, blockpos3, Blocks.field_150364_r, this.field_76520_b); - -@@ -98,7 +98,7 @@ - - BlockPos blockpos4 = blockpos1.func_177968_d(); - -- if (this.func_175931_a(p_180709_1_.func_180495_p(blockpos4).func_177230_c().func_149688_o())) -+ if (this.isAirLeaves(p_180709_1_, blockpos4)) - { - this.func_175905_a(p_180709_1_, blockpos4, Blocks.field_150364_r, this.field_76520_b); - -@@ -115,11 +115,6 @@ - } - } - -- private boolean func_175931_a(Material p_175931_1_) -- { -- return p_175931_1_ == Material.field_151579_a || p_175931_1_ == Material.field_151584_j; -- } -- - private void func_175932_b(World p_175932_1_, Random p_175932_2_, BlockPos p_175932_3_, int p_175932_4_) - { - if (p_175932_2_.nextInt(3) > 0 && p_175932_1_.func_175623_d(p_175932_3_)) -@@ -137,4 +132,11 @@ - this.func_175925_a(p_175930_1_, p_175930_2_.func_177981_b(j), p_175930_3_ + 1 - j); - } - } -+ -+ //Helper macro -+ private boolean isAirLeaves(World world, BlockPos pos) -+ { -+ net.minecraft.block.Block block = world.func_180495_p(pos).func_177230_c(); -+ return block.isAir(world, pos) || block.isLeaves(world, pos); -+ } - } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch deleted file mode 100644 index 865e78c88..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch +++ /dev/null @@ -1,65 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java -@@ -35,32 +35,24 @@ - - for (int j = 0; j < i; ++j) - { -- Block block = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(j)).func_177230_c(); -- -- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) -+ if (this.isAirLeaves(p_180709_1_, p_180709_3_.func_177981_b(j))) - { - this.func_175905_a(p_180709_1_, p_180709_3_.func_177981_b(j), Blocks.field_150364_r, this.field_76520_b); - } - - if (j < i - 1) - { -- block = p_180709_1_.func_180495_p(p_180709_3_.func_177982_a(1, j, 0)).func_177230_c(); -- -- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) -+ if (this.isAirLeaves(p_180709_1_, p_180709_3_.func_177982_a(1, j, 0))) - { - this.func_175905_a(p_180709_1_, p_180709_3_.func_177982_a(1, j, 0), Blocks.field_150364_r, this.field_76520_b); - } - -- block = p_180709_1_.func_180495_p(p_180709_3_.func_177982_a(1, j, 1)).func_177230_c(); -- -- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) -+ if (this.isAirLeaves(p_180709_1_, p_180709_3_.func_177982_a(1, j, 1))) - { - this.func_175905_a(p_180709_1_, p_180709_3_.func_177982_a(1, j, 1), Blocks.field_150364_r, this.field_76520_b); - } - -- block = p_180709_1_.func_180495_p(p_180709_3_.func_177982_a(0, j, 1)).func_177230_c(); -- -- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) -+ if (this.isAirLeaves(p_180709_1_, p_180709_3_.func_177982_a(0, j, 1))) - { - this.func_175905_a(p_180709_1_, p_180709_3_.func_177982_a(0, j, 1), Blocks.field_150364_r, this.field_76520_b); - } -@@ -126,16 +118,23 @@ - BlockPos blockpos1 = p_175934_2_.func_177981_b(i); - Block block = p_175934_1_.func_180495_p(blockpos1).func_177230_c(); - -- if (block == Blocks.field_150349_c || block == Blocks.field_150346_d) -+ if (block.canSustainPlant(p_175934_1_, blockpos1, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g))) - { - this.func_175905_a(p_175934_1_, blockpos1, Blocks.field_150346_d, BlockDirt.DirtType.PODZOL.func_176925_a()); - break; - } - -- if (block.func_149688_o() != Material.field_151579_a && i < 0) -+ if (!block.isAir(p_175934_1_, blockpos1) && i < 0) - { - break; - } - } - } -+ -+ //Helper macro -+ private boolean isAirLeaves(World world, BlockPos pos) -+ { -+ net.minecraft.block.Block block = world.func_180495_p(pos).func_177230_c(); -+ return block.isAir(world, pos) || block.isLeaves(world, pos); -+ } - } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch deleted file mode 100644 index 48c841f3b..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java -@@ -48,7 +48,7 @@ - { - if (j >= 0 && j < 256) - { -- if (!this.func_150523_a(p_180709_1_.func_180495_p(new BlockPos(k, j, l)).func_177230_c())) -+ if (!this.isReplaceable(p_180709_1_, new BlockPos(k, j, l))) - { - flag = false; - } -@@ -67,11 +67,13 @@ - } - else - { -- Block block = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); -+ BlockPos down = p_180709_3_.func_177977_b(); -+ Block block = p_180709_1_.func_180495_p(down).func_177230_c(); -+ boolean isSoil = block.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); - -- if ((block == Blocks.field_150349_c || block == Blocks.field_150346_d) && p_180709_3_.func_177956_o() < 256 - i - 1) -+ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) - { -- this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); -+ block.onPlantGrow(p_180709_1_, down, p_180709_3_); - EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.func_179518_a(p_180709_2_); - k = i - p_180709_2_.nextInt(4) - 1; - l = 3 - p_180709_2_.nextInt(3); -@@ -92,9 +94,9 @@ - } - - BlockPos blockpos1 = new BlockPos(i1, i2, j1); -- Material material = p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149688_o(); -+ block = p_180709_1_.func_180495_p(blockpos1).func_177230_c(); - -- if (material == Material.field_151579_a || material == Material.field_151584_j) -+ if (block.isAir(p_180709_1_, blockpos1) || block.isLeaves(p_180709_1_, blockpos1)) - { - this.func_175905_a(p_180709_1_, blockpos1, Blocks.field_150363_s, BlockPlanks.EnumType.ACACIA.func_176839_a() - 4); - k1 = i2; -@@ -148,9 +150,9 @@ - i1 += enumfacing1.func_82601_c(); - j1 += enumfacing1.func_82599_e(); - BlockPos blockpos2 = new BlockPos(i1, j2, j1); -- Material material1 = p_180709_1_.func_180495_p(blockpos2).func_177230_c().func_149688_o(); -+ block = p_180709_1_.func_180495_p(blockpos2).func_177230_c(); - -- if (material1 == Material.field_151579_a || material1 == Material.field_151584_j) -+ if (block.isAir(p_180709_1_, blockpos2) || block.isLeaves(p_180709_1_, blockpos2)) - { - this.func_175905_a(p_180709_1_, blockpos2, Blocks.field_150363_s, BlockPlanks.EnumType.ACACIA.func_176839_a() - 4); - k1 = j2; -@@ -204,9 +206,9 @@ - - private void func_175924_b(World p_175924_1_, BlockPos p_175924_2_) - { -- Material material = p_175924_1_.func_180495_p(p_175924_2_).func_177230_c().func_149688_o(); -+ Block block = p_175924_1_.func_180495_p(p_175924_2_).func_177230_c(); - -- if (material == Material.field_151579_a || material == Material.field_151584_j) -+ if (block.isAir(p_175924_1_, p_175924_2_) || block.isLeaves(p_175924_1_, p_175924_2_)) - { - this.func_175905_a(p_175924_1_, p_175924_2_, Blocks.field_150361_u, 0); - } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch deleted file mode 100644 index 0d9e1734f..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java -@@ -24,14 +24,16 @@ - { - Block block; - -- while (((block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c()).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && p_180709_3_.func_177956_o() > 0) -+ do - { -+ block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c(); -+ if (!block.isAir(p_180709_1_, p_180709_3_) && !block.isLeaves(p_180709_1_, p_180709_3_)) break; - p_180709_3_ = p_180709_3_.func_177977_b(); -- } -+ } while (p_180709_3_.func_177956_o() > 0); - - Block block1 = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c(); - -- if (block1 == Blocks.field_150346_d || block1 == Blocks.field_150349_c) -+ if (block1.canSustainPlant(p_180709_1_, p_180709_3_, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g))) - { - p_180709_3_ = p_180709_3_.func_177984_a(); - this.func_175905_a(p_180709_1_, p_180709_3_, Blocks.field_150364_r, this.field_150527_b); -@@ -53,7 +55,7 @@ - { - BlockPos blockpos1 = new BlockPos(l, i, j1); - -- if (!p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149730_j()) -+ if (p_180709_1_.func_180495_p(blockpos1).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos1)) - { - this.func_175905_a(p_180709_1_, blockpos1, Blocks.field_150362_t, this.field_150528_a); - } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch deleted file mode 100644 index 9f553475e..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch +++ /dev/null @@ -1,98 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java -@@ -53,9 +53,10 @@ - { - if (j >= 0 && j < 256) - { -- Block block = p_180709_1_.func_180495_p(new BlockPos(k, j, l)).func_177230_c(); -+ BlockPos pos = new BlockPos(k, j, l); -+ Block block = p_180709_1_.func_180495_p(pos).func_177230_c(); - -- if (block.func_149688_o() != Material.field_151579_a && block.func_149688_o() != Material.field_151584_j) -+ if (!block.isAir(p_180709_1_, pos) && !block.isLeaves(p_180709_1_, pos)) - { - if (block != Blocks.field_150355_j && block != Blocks.field_150358_i) - { -@@ -81,11 +82,13 @@ - } - else - { -- Block block1 = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); -+ BlockPos down = p_180709_3_.func_177977_b(); -+ Block block1 = p_180709_1_.func_180495_p(down).func_177230_c(); -+ boolean isSoil = block1.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); - -- if ((block1 == Blocks.field_150349_c || block1 == Blocks.field_150346_d) && p_180709_3_.func_177956_o() < 256 - i - 1) -+ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) - { -- this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); -+ block1.onPlantGrow(p_180709_1_, down, p_180709_3_); - int i1; - BlockPos blockpos1; - int l1; -@@ -108,7 +111,7 @@ - { - blockpos1 = new BlockPos(i2, l1, j1); - -- if (!p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149730_j()) -+ if (p_180709_1_.func_180495_p(blockpos1).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos1)) - { - this.func_175906_a(p_180709_1_, blockpos1, Blocks.field_150362_t); - } -@@ -119,9 +122,10 @@ - - for (l1 = 0; l1 < i; ++l1) - { -- Block block2 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(l1)).func_177230_c(); -+ BlockPos upN = p_180709_3_.func_177981_b(l1); -+ Block block2 = p_180709_1_.func_180495_p(upN).func_177230_c(); - -- if (block2.func_149688_o() == Material.field_151579_a || block2.func_149688_o() == Material.field_151584_j || block2 == Blocks.field_150358_i || block2 == Blocks.field_150355_j) -+ if (block2.isAir(p_180709_1_, upN) || block2.isLeaves(p_180709_1_, upN) || block2 == Blocks.field_150358_i || block2 == Blocks.field_150355_j) - { - this.func_175906_a(p_180709_1_, p_180709_3_.func_177981_b(l1), Blocks.field_150364_r); - } -@@ -138,29 +142,29 @@ - { - BlockPos blockpos4 = new BlockPos(i2, l1, i1); - -- if (p_180709_1_.func_180495_p(blockpos4).func_177230_c().func_149688_o() == Material.field_151584_j) -+ if (p_180709_1_.func_180495_p(blockpos4).func_177230_c().isLeaves(p_180709_1_, blockpos4)) - { - BlockPos blockpos5 = blockpos4.func_177976_e(); - blockpos1 = blockpos4.func_177974_f(); - BlockPos blockpos2 = blockpos4.func_177978_c(); - BlockPos blockpos3 = blockpos4.func_177968_d(); - -- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos5).func_177230_c().func_149688_o() == Material.field_151579_a) -+ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos5).func_177230_c().isAir(p_180709_1_, blockpos5)) - { - this.func_175922_a(p_180709_1_, blockpos5, BlockVine.field_176275_S); - } - -- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149688_o() == Material.field_151579_a) -+ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos1).func_177230_c().isAir(p_180709_1_, blockpos1)) - { - this.func_175922_a(p_180709_1_, blockpos1, BlockVine.field_176271_T); - } - -- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos2).func_177230_c().func_149688_o() == Material.field_151579_a) -+ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos2).func_177230_c().isAir(p_180709_1_, blockpos2)) - { - this.func_175922_a(p_180709_1_, blockpos2, BlockVine.field_176272_Q); - } - -- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos3).func_177230_c().func_149688_o() == Material.field_151579_a) -+ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos3).func_177230_c().isAir(p_180709_1_, blockpos3)) - { - this.func_175922_a(p_180709_1_, blockpos3, BlockVine.field_176276_R); - } -@@ -188,7 +192,7 @@ - this.func_175905_a(p_175922_1_, p_175922_2_, Blocks.field_150395_bd, p_175922_3_); - int j = 4; - -- for (p_175922_2_ = p_175922_2_.func_177977_b(); p_175922_1_.func_180495_p(p_175922_2_).func_177230_c().func_149688_o() == Material.field_151579_a && j > 0; --j) -+ for (p_175922_2_ = p_175922_2_.func_177977_b(); p_175922_1_.func_180495_p(p_175922_2_).func_177230_c().isAir(p_175922_1_, p_175922_2_) && j > 0; --j) - { - this.func_175905_a(p_175922_1_, p_175922_2_, Blocks.field_150395_bd, p_175922_3_); - p_175922_2_ = p_175922_2_.func_177977_b(); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch deleted file mode 100644 index a32469775..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java -@@ -50,7 +50,7 @@ - { - if (i1 >= 0 && i1 < 256) - { -- if (!this.func_150523_a(p_180709_1_.func_180495_p(new BlockPos(j1, i1, k1)).func_177230_c())) -+ if (!this.isReplaceable(p_180709_1_, new BlockPos(j1, i1, k1))) - { - flag = false; - } -@@ -69,11 +69,13 @@ - } - else - { -- Block block = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); -+ BlockPos down = p_180709_3_.func_177977_b(); -+ Block block = p_180709_1_.func_180495_p(down).func_177230_c(); -+ boolean isSoil = block.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_150345_g); - -- if ((block == Blocks.field_150349_c || block == Blocks.field_150346_d) && p_180709_3_.func_177956_o() < 256 - i - 1) -+ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) - { -- this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); -+ block.onPlantGrow(p_180709_1_, down, p_180709_3_); - k2 = 0; - - for (j1 = p_180709_3_.func_177956_o() + i; j1 >= p_180709_3_.func_177956_o() + j; --j1) -@@ -90,7 +92,7 @@ - { - BlockPos blockpos1 = new BlockPos(k1, j1, i2); - -- if (!p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149730_j()) -+ if (p_180709_1_.func_180495_p(blockpos1).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos1)) - { - this.func_175905_a(p_180709_1_, blockpos1, Blocks.field_150362_t, BlockPlanks.EnumType.SPRUCE.func_176839_a()); - } -@@ -110,9 +112,10 @@ - - for (j1 = 0; j1 < i - 1; ++j1) - { -- Block block1 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(j1)).func_177230_c(); -+ BlockPos upN = p_180709_3_.func_177981_b(j1); -+ Block block1 = p_180709_1_.func_180495_p(upN).func_177230_c(); - -- if (block1.func_149688_o() == Material.field_151579_a || block1.func_149688_o() == Material.field_151584_j) -+ if (block1.isAir(p_180709_1_, upN) || block1.isLeaves(p_180709_1_, upN)) - { - this.func_175905_a(p_180709_1_, p_180709_3_.func_177981_b(j1), Blocks.field_150364_r, BlockPlanks.EnumType.SPRUCE.func_176839_a()); - } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch deleted file mode 100644 index 9a8619068..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch +++ /dev/null @@ -1,54 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java -@@ -49,9 +49,10 @@ - { - if (i1 >= 0 && i1 < 256) - { -- Block block = p_180709_1_.func_180495_p(new BlockPos(j1, i1, k1)).func_177230_c(); -+ BlockPos off = new BlockPos(j1, i1, k1); -+ Block block = p_180709_1_.func_180495_p(off).func_177230_c(); - -- if (block.func_149688_o() != Material.field_151579_a && block.func_149688_o() != Material.field_151584_j) -+ if (!block.isAir(p_180709_1_, off) && !block.isLeaves(p_180709_1_, off)) - { - flag = false; - } -@@ -70,11 +71,13 @@ - } - else - { -- Block block1 = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); -+ BlockPos down = p_180709_3_.func_177977_b(); -+ Block block1 = p_180709_1_.func_180495_p(down).func_177230_c(); -+ boolean isSoil = block1.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_150345_g); - -- if ((block1 == Blocks.field_150349_c || block1 == Blocks.field_150346_d || block1 == Blocks.field_150458_ak) && p_180709_3_.func_177956_o() < 256 - i - 1) -+ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) - { -- this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); -+ block1.onPlantGrow(p_180709_1_, down, p_180709_3_); - i3 = p_180709_2_.nextInt(2); - j1 = 1; - byte b0 = 0; -@@ -97,7 +100,7 @@ - { - BlockPos blockpos1 = new BlockPos(i2, l1, k2); - -- if (!p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149730_j()) -+ if (p_180709_1_.func_180495_p(blockpos1).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos1)) - { - this.func_175905_a(p_180709_1_, blockpos1, Blocks.field_150362_t, BlockPlanks.EnumType.SPRUCE.func_176839_a()); - } -@@ -126,9 +129,10 @@ - - for (l1 = 0; l1 < i - j3; ++l1) - { -- Block block2 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(l1)).func_177230_c(); -+ BlockPos upN = p_180709_3_.func_177981_b(l1); -+ Block block2 = p_180709_1_.func_180495_p(upN).func_177230_c(); - -- if (block2.func_149688_o() == Material.field_151579_a || block2.func_149688_o() == Material.field_151584_j) -+ if (block2.isAir(p_180709_1_, upN) || block2.isLeaves(p_180709_1_, upN)) - { - this.func_175905_a(p_180709_1_, p_180709_3_.func_177981_b(l1), Blocks.field_150364_r, BlockPlanks.EnumType.SPRUCE.func_176839_a()); - } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch deleted file mode 100644 index b8fe9ec78..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java -@@ -23,10 +23,12 @@ - { - Block block; - -- while (((block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c()).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && p_180709_3_.func_177956_o() > 0) -+ do - { -+ block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c(); -+ if (!block.isAir(p_180709_1_, p_180709_3_) && !block.isLeaves(p_180709_1_, p_180709_3_)) break; - p_180709_3_ = p_180709_3_.func_177977_b(); -- } -+ } while (p_180709_3_.func_177956_o() > 0); - - for (int i = 0; i < 128; ++i) - { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch deleted file mode 100644 index 37d7c07ab..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch +++ /dev/null @@ -1,94 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java -@@ -61,7 +61,7 @@ - { - if (j >= 0 && j < 256) - { -- if (!this.func_150523_a(p_180709_1_.func_180495_p(new BlockPos(k, j, l)).func_177230_c())) -+ if (!this.isReplaceable(p_180709_1_, new BlockPos(k, j, l))) - { - flag = false; - } -@@ -80,11 +80,13 @@ - } - else - { -- Block block1 = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); -+ BlockPos down = p_180709_3_.func_177977_b(); -+ Block block1 = p_180709_1_.func_180495_p(down).func_177230_c(); -+ boolean isSoil = block1.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_150345_g); - -- if ((block1 == Blocks.field_150349_c || block1 == Blocks.field_150346_d || block1 == Blocks.field_150458_ak) && p_180709_3_.func_177956_o() < 256 - i - 1) -+ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) - { -- this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); -+ block1.onPlantGrow(p_180709_1_, down, p_180709_3_); - b0 = 3; - byte b1 = 0; - int i1; -@@ -111,7 +113,7 @@ - blockpos1 = new BlockPos(k1, l, i2); - Block block = p_180709_1_.func_180495_p(blockpos1).func_177230_c(); - -- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j || block.func_149688_o() == Material.field_151582_l) -+ if (block.isAir(p_180709_1_, blockpos1) || block.isLeaves(p_180709_1_, blockpos1) || block.func_149688_o() == Material.field_151582_l) - { - this.func_175905_a(p_180709_1_, blockpos1, Blocks.field_150362_t, this.field_76530_d); - } -@@ -122,9 +124,10 @@ - - for (l = 0; l < i; ++l) - { -- Block block2 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(l)).func_177230_c(); -+ BlockPos upN = p_180709_3_.func_177981_b(l); -+ Block block2 = p_180709_1_.func_180495_p(upN).func_177230_c(); - -- if (block2.func_149688_o() == Material.field_151579_a || block2.func_149688_o() == Material.field_151584_j || block2.func_149688_o() == Material.field_151582_l) -+ if (block2.isAir(p_180709_1_, upN) || block2.isLeaves(p_180709_1_, upN) || block2.func_149688_o() == Material.field_151582_l) - { - this.func_175905_a(p_180709_1_, p_180709_3_.func_177981_b(l), Blocks.field_150364_r, this.field_76532_c); - -@@ -166,29 +169,29 @@ - { - BlockPos blockpos3 = new BlockPos(k1, l, l1); - -- if (p_180709_1_.func_180495_p(blockpos3).func_177230_c().func_149688_o() == Material.field_151584_j) -+ if (p_180709_1_.func_180495_p(blockpos3).func_177230_c().isLeaves(p_180709_1_, blockpos3)) - { - BlockPos blockpos4 = blockpos3.func_177976_e(); - blockpos1 = blockpos3.func_177974_f(); - BlockPos blockpos5 = blockpos3.func_177978_c(); - BlockPos blockpos2 = blockpos3.func_177968_d(); - -- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos4).func_177230_c().func_149688_o() == Material.field_151579_a) -+ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos4).func_177230_c().isAir(p_180709_1_, blockpos4)) - { - this.func_175923_a(p_180709_1_, blockpos4, BlockVine.field_176275_S); - } - -- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149688_o() == Material.field_151579_a) -+ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos1).func_177230_c().isAir(p_180709_1_, blockpos1)) - { - this.func_175923_a(p_180709_1_, blockpos1, BlockVine.field_176271_T); - } - -- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos5).func_177230_c().func_149688_o() == Material.field_151579_a) -+ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos5).func_177230_c().isAir(p_180709_1_, blockpos5)) - { - this.func_175923_a(p_180709_1_, blockpos5, BlockVine.field_176272_Q); - } - -- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos2).func_177230_c().func_149688_o() == Material.field_151579_a) -+ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos2).func_177230_c().isAir(p_180709_1_, blockpos2)) - { - this.func_175923_a(p_180709_1_, blockpos2, BlockVine.field_176276_R); - } -@@ -233,7 +236,7 @@ - this.func_175905_a(p_175923_1_, p_175923_2_, Blocks.field_150395_bd, p_175923_3_); - int j = 4; - -- for (p_175923_2_ = p_175923_2_.func_177977_b(); p_175923_1_.func_180495_p(p_175923_2_).func_177230_c().func_149688_o() == Material.field_151579_a && j > 0; --j) -+ for (p_175923_2_ = p_175923_2_.func_177977_b(); p_175923_1_.func_180495_p(p_175923_2_).func_177230_c().isAir(p_175923_1_, p_175923_2_) && j > 0; --j) - { - this.func_175905_a(p_175923_1_, p_175923_2_, Blocks.field_150395_bd, p_175923_3_); - p_175923_2_ = p_175923_2_.func_177977_b(); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch deleted file mode 100644 index fa45af1d8..000000000 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java -@@ -27,10 +27,12 @@ - { - Block block; - -- while (((block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c()).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && p_180709_3_.func_177956_o() > 1) -+ do - { -+ block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c(); -+ if (!block.isAir(p_180709_1_, p_180709_3_) && !block.isLeaves(p_180709_1_, p_180709_3_)) break; - p_180709_3_ = p_180709_3_.func_177977_b(); -- } -+ } while (p_180709_3_.func_177956_o() > 0); - - if (p_180709_3_.func_177956_o() < 1) - { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch deleted file mode 100644 index 9aeab1702..000000000 --- a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java -@@ -231,12 +231,12 @@ - { - if (this.field_143029_e == null) - { -- this.field_143029_e = (MapGenStructureData)p_143027_1_.func_72943_a(MapGenStructureData.class, this.func_143025_a()); -+ this.field_143029_e = (MapGenStructureData)p_143027_1_.getPerWorldStorage().func_75742_a(MapGenStructureData.class, this.func_143025_a()); - - if (this.field_143029_e == null) - { - this.field_143029_e = new MapGenStructureData(this.func_143025_a()); -- p_143027_1_.func_72823_a(this.func_143025_a(), this.field_143029_e); -+ p_143027_1_.getPerWorldStorage().func_75745_a(this.func_143025_a(), this.field_143029_e); - } - else - { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch deleted file mode 100644 index 00ba3940d..000000000 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java -@@ -19,6 +19,8 @@ - import net.minecraft.util.EnumFacing; - import net.minecraft.util.WeightedRandomChestContent; - import net.minecraft.world.World; -+import net.minecraftforge.common.ChestGenHooks; -+import static net.minecraftforge.common.ChestGenHooks.*; - - public class StructureMineshaftPieces - { -@@ -33,6 +35,12 @@ - MapGenStructureIO.func_143031_a(StructureMineshaftPieces.Stairs.class, "MSStairs"); - } - -+ static -+ { -+ ChestGenHooks.init(MINESHAFT_CORRIDOR, field_175893_a, 8, 8); -+ ChestGenHooks.addItem(MINESHAFT_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); -+ } -+ - private static StructureComponent func_175892_a(List p_175892_0_, Random p_175892_1_, int p_175892_2_, int p_175892_3_, int p_175892_4_, EnumFacing p_175892_5_, int p_175892_6_) - { - int i1 = p_175892_1_.nextInt(100); -@@ -354,14 +362,15 @@ - this.func_175809_a(p_74875_1_, p_74875_3_, p_74875_2_, 0.05F, 1, 2, k - 1, Blocks.field_150478_aa.func_176203_a(EnumFacing.UP.func_176745_a())); - this.func_175809_a(p_74875_1_, p_74875_3_, p_74875_2_, 0.05F, 1, 2, k + 1, Blocks.field_150478_aa.func_176203_a(EnumFacing.UP.func_176745_a())); - -+ ChestGenHooks info = ChestGenHooks.getInfo(MINESHAFT_CORRIDOR); - if (p_74875_2_.nextInt(100) == 0) - { -- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 2, 0, k - 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.field_175893_a, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 3 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 2, 0, k - 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); - } - - if (p_74875_2_.nextInt(100) == 0) - { -- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 0, 0, k + 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.field_175893_a, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 3 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 0, 0, k + 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); - } - - if (this.field_74956_b && !this.field_74957_c) diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch deleted file mode 100644 index fbe1b5d05..000000000 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java -@@ -154,7 +154,7 @@ - if (this.field_111021_b && p_74875_3_.func_175898_b(new BlockPos(this.func_74865_a(3, 3), this.func_74862_a(2), this.func_74873_b(3, 3)))) - { - this.field_111021_b = false; -- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 2, 3, field_111019_a, 2 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_)); - } - - this.func_175804_a(p_74875_1_, p_74875_3_, 0, 6, 0, 4, 6, 4, Blocks.field_150385_bj.func_176223_P(), Blocks.field_150385_bj.func_176223_P(), false); -@@ -224,7 +224,7 @@ - if (this.field_111020_b && p_74875_3_.func_175898_b(new BlockPos(this.func_74865_a(1, 3), this.func_74862_a(2), this.func_74873_b(1, 3)))) - { - this.field_111020_b = false; -- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 1, 2, 3, field_111019_a, 2 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 1, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_)); - } - - this.func_175804_a(p_74875_1_, p_74875_3_, 0, 6, 0, 4, 6, 4, Blocks.field_150385_bj.func_176223_P(), Blocks.field_150385_bj.func_176223_P(), false); -@@ -953,6 +953,7 @@ - abstract static class Piece extends StructureComponent - { - protected static final List field_111019_a = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.field_151045_i, 0, 1, 3, 5), new WeightedRandomChestContent(Items.field_151042_j, 0, 1, 5, 5), new WeightedRandomChestContent(Items.field_151043_k, 0, 1, 3, 15), new WeightedRandomChestContent(Items.field_151010_B, 0, 1, 1, 5), new WeightedRandomChestContent(Items.field_151171_ah, 0, 1, 1, 5), new WeightedRandomChestContent(Items.field_151033_d, 0, 1, 1, 5), new WeightedRandomChestContent(Items.field_151075_bm, 0, 3, 7, 5), new WeightedRandomChestContent(Items.field_151141_av, 0, 1, 1, 10), new WeightedRandomChestContent(Items.field_151136_bY, 0, 1, 1, 8), new WeightedRandomChestContent(Items.field_151138_bX, 0, 1, 1, 5), new WeightedRandomChestContent(Items.field_151125_bZ, 0, 1, 1, 3), new WeightedRandomChestContent(Item.func_150898_a(Blocks.field_150343_Z), 0, 2, 4, 2)}); -+ static { net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, field_111019_a, 2, 5); } - private static final String __OBFID = "CL_00000466"; - - public Piece() {} diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch deleted file mode 100644 index a8d7f2e10..000000000 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch +++ /dev/null @@ -1,84 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java -@@ -17,6 +17,8 @@ - import net.minecraft.util.EnumFacing; - import net.minecraft.util.WeightedRandomChestContent; - import net.minecraft.world.World; -+import net.minecraftforge.common.ChestGenHooks; -+import static net.minecraftforge.common.ChestGenHooks.*; - - public class StructureStrongholdPieces - { -@@ -248,6 +250,12 @@ - - public ChestCorridor() {} - -+ static -+ { -+ ChestGenHooks.init(STRONGHOLD_CORRIDOR, field_75003_a, 2, 4); -+ ChestGenHooks.addItem(STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); -+ } -+ - public ChestCorridor(int p_i45582_1_, Random p_i45582_2_, StructureBoundingBox p_i45582_3_, EnumFacing p_i45582_4_) - { - super(p_i45582_1_); -@@ -304,7 +312,7 @@ - if (!this.field_75002_c && p_74875_3_.func_175898_b(new BlockPos(this.func_74865_a(3, 3), this.func_74862_a(2), this.func_74873_b(3, 3)))) - { - this.field_75002_c = true; -- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 2, 3, WeightedRandomChestContent.func_177629_a(field_75003_a, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 2 + p_74875_2_.nextInt(2)); -+ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 2, 3, ChestGenHooks.getItems(STRONGHOLD_CORRIDOR, p_74875_2_), ChestGenHooks.getCount(STRONGHOLD_CORRIDOR, p_74875_2_)); - } - - return true; -@@ -599,6 +607,12 @@ - private boolean field_75008_c; - private static final String __OBFID = "CL_00000491"; - -+ static -+ { -+ ChestGenHooks.init(STRONGHOLD_CORRIDOR, field_75007_b, 1, 5); -+ ChestGenHooks.addItem(STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 5, 2)); -+ } -+ - public Library() {} - - public Library(int p_i45578_1_, Random p_i45578_2_, StructureBoundingBox p_i45578_3_, EnumFacing p_i45578_4_) -@@ -742,12 +756,13 @@ - this.func_175811_a(p_74875_1_, Blocks.field_150478_aa.func_176223_P(), b1, 8, b2 + 1, p_74875_3_); - } - -- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 3, 5, WeightedRandomChestContent.func_177629_a(field_75007_b, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92112_a(p_74875_2_, 1, 5, 2)}), 1 + p_74875_2_.nextInt(4)); -+ ChestGenHooks info = ChestGenHooks.getInfo(STRONGHOLD_LIBRARY); -+ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 3, 5, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); - - if (this.field_75008_c) - { - this.func_175811_a(p_74875_1_, Blocks.field_150350_a.func_176223_P(), 12, 9, 1, p_74875_3_); -- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 12, 8, 1, WeightedRandomChestContent.func_177629_a(field_75007_b, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92112_a(p_74875_2_, 1, 5, 2)}), 1 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 12, 8, 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); - } - - return true; -@@ -1024,6 +1039,12 @@ - protected int field_75013_b; - private static final String __OBFID = "CL_00000496"; - -+ static -+ { -+ ChestGenHooks.init(STRONGHOLD_CROSSING, field_75014_c, 1, 5); -+ ChestGenHooks.addItem(STRONGHOLD_CROSSING, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); -+ } -+ - public RoomCrossing() {} - - public RoomCrossing(int p_i45575_1_, Random p_i45575_2_, StructureBoundingBox p_i45575_3_, EnumFacing p_i45575_4_) -@@ -1159,7 +1180,7 @@ - this.func_175811_a(p_74875_1_, Blocks.field_150468_ap.func_176203_a(this.func_151555_a(Blocks.field_150468_ap, EnumFacing.WEST.func_176745_a())), 9, 1, 3, p_74875_3_); - this.func_175811_a(p_74875_1_, Blocks.field_150468_ap.func_176203_a(this.func_151555_a(Blocks.field_150468_ap, EnumFacing.WEST.func_176745_a())), 9, 2, 3, p_74875_3_); - this.func_175811_a(p_74875_1_, Blocks.field_150468_ap.func_176203_a(this.func_151555_a(Blocks.field_150468_ap, EnumFacing.WEST.func_176745_a())), 9, 3, 3, p_74875_3_); -- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 4, 8, WeightedRandomChestContent.func_177629_a(field_75014_c, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 1 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 4, 8, ChestGenHooks.getItems(STRONGHOLD_CROSSING, p_74875_2_), ChestGenHooks.getCount(STRONGHOLD_CROSSING, p_74875_2_)); - } - - return true; diff --git a/patches/minecraft/net/minecraft/world/storage/MapData.java.patch b/patches/minecraft/net/minecraft/world/storage/MapData.java.patch deleted file mode 100644 index 60cc5db82..000000000 --- a/patches/minecraft/net/minecraft/world/storage/MapData.java.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/storage/MapData.java -+++ ../src-work/minecraft/net/minecraft/world/storage/MapData.java -@@ -22,7 +22,7 @@ - { - public int field_76201_a; - public int field_76199_b; -- public byte field_76200_c; -+ public int field_76200_c; //FML byte -> int - public byte field_76197_d; - public byte[] field_76198_e = new byte[16384]; - public List field_76196_g = Lists.newArrayList(); -@@ -46,7 +46,17 @@ - - public void func_76184_a(NBTTagCompound p_76184_1_) - { -- this.field_76200_c = p_76184_1_.func_74771_c("dimension"); -+ net.minecraft.nbt.NBTBase dimension = p_76184_1_.func_74781_a("dimension"); -+ -+ if (dimension instanceof net.minecraft.nbt.NBTTagByte) -+ { -+ this.field_76200_c = ((net.minecraft.nbt.NBTTagByte)dimension).func_150290_f(); -+ } -+ else -+ { -+ this.field_76200_c = ((net.minecraft.nbt.NBTTagInt)dimension).func_150287_d(); -+ } -+ - this.field_76201_a = p_76184_1_.func_74762_e("xCenter"); - this.field_76199_b = p_76184_1_.func_74762_e("zCenter"); - this.field_76197_d = p_76184_1_.func_74771_c("scale"); -@@ -87,7 +97,7 @@ - - public void func_76187_b(NBTTagCompound p_76187_1_) - { -- p_76187_1_.func_74774_a("dimension", this.field_76200_c); -+ p_76187_1_.func_74768_a("dimension", this.field_76200_c); - p_76187_1_.func_74768_a("xCenter", this.field_76201_a); - p_76187_1_.func_74768_a("zCenter", this.field_76199_b); - p_76187_1_.func_74774_a("scale", this.field_76197_d); -@@ -166,7 +176,7 @@ - p_82567_8_ += p_82567_8_ < 0.0D ? -8.0D : 8.0D; - b2 = (byte)((int)(p_82567_8_ * 16.0D / 360.0D)); - -- if (this.field_76200_c < 0) -+ if (p_82567_2_.field_73011_w.shouldMapSpin(p_82567_3_, p_82567_4_, p_82567_6_, p_82567_8_)) - { - int k = (int)(p_82567_2_.func_72912_H().func_76073_f() / 10L); - b2 = (byte)(k * k * 34187121 + k * 121 >> 15 & 15); From 1a6c816baccc71d7cf8253029b7256e32d5b944c Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 8 Nov 2015 23:09:33 -0500 Subject: [PATCH 004/133] Test of mcp patching --- build.gradle | 1 + .../client/gui/GuiMainMenu.java.patch | 44 +++++++++++++++++++ .../minecraftforge/common/ForgeVersion.java | 1 + .../fml/common/launcher/FMLDeobfTweaker.java | 2 +- 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch diff --git a/build.gradle b/build.gradle index 2973a331d..162d318f9 100644 --- a/build.gradle +++ b/build.gradle @@ -51,6 +51,7 @@ minecraft { patchAfter "clean" genPatchesFrom "clean" genMcpPatches = true + applyMcpPatches = true with common } } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch new file mode 100644 index 000000000..67d02e78a --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch @@ -0,0 +1,44 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiMainMenu.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiMainMenu.java +@@ -198,6 +198,11 @@ + this.buttonList.add(new GuiButton(1, this.width / 2 - 100, p_73969_1_, I18n.format("menu.singleplayer", new Object[0]))); + this.buttonList.add(new GuiButton(2, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.format("menu.multiplayer", new Object[0]))); + this.buttonList.add(this.realmsButton = new GuiButton(14, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.format("menu.online", new Object[0]))); ++ GuiButton fmlModButton = new GuiButton(6, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.format("fml.menu.mods")); ++ fmlModButton.xPosition = this.width / 2 + 2; ++ realmsButton.width = 98; ++ fmlModButton.width = 98; ++ this.buttonList.add(fmlModButton); + } + + private void addDemoButtons(int p_73972_1_, int p_73972_2_) +@@ -245,6 +250,11 @@ + this.mc.shutdown(); + } + ++ if (button.id == 6) ++ { ++ this.mc.displayGuiScreen(new net.minecraftforge.fml.client.GuiModList(this)); ++ } ++ + if (button.id == 11) + { + this.mc.launchIntegratedServer("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings); +@@ -490,7 +500,16 @@ + s = s + " Demo"; + } + +- this.drawString(this.fontRendererObj, s, 2, this.height - 10, -1); ++ java.util.List brandings = com.google.common.collect.Lists.reverse(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(true)); ++ for (int brdline = 0; i < brandings.size(); i++) ++ { ++ String brd = brandings.get(brdline); ++ if (!com.google.common.base.Strings.isNullOrEmpty(brd)) ++ { ++ this.drawString(this.fontRendererObj, brd, 2, this.height - ( 10 + brdline * (this.fontRendererObj.FONT_HEIGHT + 1)), 16777215); ++ } ++ } ++ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, this.fontRendererObj, this.width, this.height); + String s1 = "Copyright Mojang AB. Do not distribute!"; + this.drawString(this.fontRendererObj, s1, this.width - this.fontRendererObj.getStringWidth(s1) - 2, this.height - 10, -1); + diff --git a/src/main/java/net/minecraftforge/common/ForgeVersion.java b/src/main/java/net/minecraftforge/common/ForgeVersion.java index 71d594c54..fcc8796b2 100644 --- a/src/main/java/net/minecraftforge/common/ForgeVersion.java +++ b/src/main/java/net/minecraftforge/common/ForgeVersion.java @@ -255,6 +255,7 @@ public class ForgeVersion public static CheckResult getResult(ModContainer mod) { + if (mod == null) return PENDING_CHECK; if (mod instanceof InjectedModContainer) mod = ((InjectedModContainer)mod).wrappedContainer; CheckResult ret = results.get(mod); diff --git a/src/main/java/net/minecraftforge/fml/common/launcher/FMLDeobfTweaker.java b/src/main/java/net/minecraftforge/fml/common/launcher/FMLDeobfTweaker.java index e8fa78753..8079fe4c8 100644 --- a/src/main/java/net/minecraftforge/fml/common/launcher/FMLDeobfTweaker.java +++ b/src/main/java/net/minecraftforge/fml/common/launcher/FMLDeobfTweaker.java @@ -31,7 +31,7 @@ public class FMLDeobfTweaker implements ITweaker { classLoader.registerTransformer(transformer); } classLoader.registerTransformer("net.minecraftforge.fml.common.asm.transformers.ModAccessTransformer"); - classLoader.registerTransformer("net.minecraftforge.fml.common.asm.transformers.ItemStackTransformer"); +// classLoader.registerTransformer("net.minecraftforge.fml.common.asm.transformers.ItemStackTransformer"); try { FMLRelaunchLog.fine("Validating minecraft"); From 98125a97c98c7ff43e7bf356edf937d440fc7e63 Mon Sep 17 00:00:00 2001 From: cpw Date: Mon, 9 Nov 2015 01:50:45 -0500 Subject: [PATCH 005/133] Patches and rejected patches. Note: some which had imports are not listed here because they need to be refactored not to have imports. Progress: https://gist.github.com/cpw/29695e426e2b122cf8ff --- .../net/minecraft/block/Block.java.patch | 1215 +++++++++++++++++ .../net/minecraft/block/BlockBush.java.patch | 66 + .../minecraft/block/BlockButton.java.patch | 12 + .../minecraft/block/BlockCactus.java.patch | 37 + .../net/minecraft/block/BlockChest.java.patch | 11 + .../net/minecraft/block/BlockCocoa.java.patch | 27 + .../net/minecraft/block/BlockCrops.java.patch | 77 ++ .../minecraft/block/BlockDeadBush.java.patch | 33 + .../net/minecraft/block/BlockDoor.java.patch | 20 + .../block/BlockDoublePlant.java.patch | 89 ++ .../minecraft/block/BlockFalling.java.patch | 10 + .../minecraft/block/BlockFarmland.java.patch | 11 + .../net/minecraft/block/BlockFire.java.patch | 211 +++ .../minecraft/block/BlockFlowerPot.java.patch | 48 + .../net/minecraft/block/BlockGrass.java.patch | 29 + .../block/BlockHugeMushroom.java.patch | 23 + .../net/minecraft/block/BlockIce.java.patch | 35 + .../minecraft/block/BlockLadder.java.patch | 30 + .../minecraft/block/BlockLeaves.java.patch | 126 ++ .../net/minecraft/block/BlockLever.java.patch | 15 + .../net/minecraft/block/BlockLog.java.patch | 24 + .../block/BlockMobSpawner.java.patch | 19 + .../minecraft/block/BlockMushroom.java.patch | 11 + .../minecraft/block/BlockMycelium.java.patch | 20 + .../block/BlockNetherWart.java.patch | 49 + .../minecraft/block/BlockNewLeaf.java.patch | 24 + .../net/minecraft/block/BlockNote.java.patch | 23 + .../minecraft/block/BlockOldLeaf.java.patch | 21 + .../net/minecraft/block/BlockPane.java.patch | 41 + .../block/BlockPistonBase.java.patch | 31 + .../block/BlockPistonMoving.java.patch | 37 + .../minecraft/block/BlockPotato.java.patch | 25 + .../minecraft/block/BlockPumpkin.java.patch | 11 + .../minecraft/block/BlockQuartz.java.patch | 29 + .../minecraft/block/BlockRailBase.java.patch | 147 ++ .../block/BlockRedstoneComparator.java.patch | 24 + .../block/BlockRedstoneDiode.java.patch | 11 + .../block/BlockRedstoneOre.java.patch | 22 + .../block/BlockRedstoneWire.java.patch | 59 + .../net/minecraft/block/BlockReed.java.patch | 35 + .../minecraft/block/BlockSapling.java.patch | 10 + .../net/minecraft/block/BlockSkull.java.patch | 57 + .../net/minecraft/block/BlockSnow.java.patch | 53 + .../net/minecraft/block/BlockStem.java.patch | 42 + .../minecraft/block/BlockTallGrass.java.patch | 66 + .../net/minecraft/block/BlockTorch.java.patch | 38 + .../minecraft/block/BlockTrapDoor.java.patch | 43 + .../block/BlockTripWireHook.java.patch | 28 + .../net/minecraft/block/BlockVine.java.patch | 40 + .../BlockPistonStructureHelper.java.patch | 29 + .../block/state/BlockState.java.patch | 53 + .../block/state/BlockStateBase.java.patch | 12 + .../client/ClientBrandRetriever.java.patch | 10 + .../client/LoadingScreenRenderer.java.patch | 13 + .../net/minecraft/client/Minecraft.java.patch | 244 ++++ .../entity/AbstractClientPlayer.java.patch | 10 + .../client/gui/FontRenderer.java.patch | 112 ++ .../minecraft/client/gui/GuiButton.java.patch | 10 + .../minecraft/client/gui/GuiChat.java.patch | 18 + .../client/gui/GuiCreateWorld.java.patch | 27 + .../client/gui/GuiIngameMenu.java.patch | 22 + .../client/gui/GuiMultiplayer.java.patch | 19 + .../client/gui/GuiOverlayDebug.java.patch | 12 + .../client/gui/GuiSelectWorld.java.patch | 11 + .../client/gui/GuiSleepMP.java.patch | 11 + .../minecraft/client/gui/GuiSlot.java.patch | 22 + .../inventory/GuiContainerCreative.java.patch | 104 ++ .../client/model/ModelBase.java.patch | 10 + .../client/model/ModelBox.java.patch | 18 + .../client/model/ModelRenderer.java.patch | 42 + .../model/PositionTextureVertex.java.patch | 13 + .../client/model/TexturedQuad.java.patch | 13 + .../ChunkProviderClient.java.patch | 10 + .../multiplayer/GuiConnecting.java.patch | 11 + .../multiplayer/PlayerControllerMP.java.patch | 48 + .../client/multiplayer/WorldClient.java.patch | 17 + .../NetHandlerHandshakeMemory.java.patch | 10 + .../network/NetHandlerLoginClient.java.patch | 14 + .../network/NetHandlerPlayClient.java.patch | 62 + .../client/particle/EffectRenderer.java.patch | 33 + .../renderer/BlockModelShapes.java.patch | 9 + .../BlockRendererDispatcher.java.patch | 49 + .../client/renderer/EntityRenderer.java.patch | 109 ++ .../InventoryEffectRenderer.java.patch | 11 + .../renderer/ItemModelMesher.java.patch | 14 + .../client/renderer/ItemRenderer.java.patch | 46 + .../client/renderer/OpenGlHelper.java.patch | 26 + .../client/renderer/RenderGlobal.java.patch | 70 + .../client/renderer/WorldRenderer.java.patch | 17 + .../renderer/block/model/BakedQuad.java.patch | 13 + .../block/model/FaceBakery.java.patch | 14 + .../model/ItemCameraTransforms.java.patch | 14 + .../block/model/ItemTransformVec3f.java.patch | 18 + .../model/ModelBlockDefinition.java.patch | 29 + .../renderer/chunk/RenderChunk.java.patch | 46 + .../entity/RenderEntityItem.java.patch | 28 + .../renderer/entity/RenderItem.java.patch | 22 + .../renderer/entity/RenderManager.java.patch | 25 + .../renderer/entity/RenderPlayer.java.patch | 10 + .../renderer/entity/RenderVillager.java.patch | 11 + .../entity/RendererLivingEntity.java.patch | 36 + .../entity/layers/LayerArmorBase.java.patch | 16 + .../renderer/texture/Stitcher.java.patch | 19 + .../texture/TextureAtlasSprite.java.patch | 33 + .../renderer/texture/TextureMap.java.patch | 78 ++ .../renderer/texture/TextureUtil.java.patch | 15 + .../tileentity/RenderItemFrame.java.patch | 31 + .../TileEntityItemStackRenderer.java.patch | 10 + .../resources/AbstractResourcePack.java.patch | 11 + .../FallbackResourceManager.java.patch | 10 + .../resources/model/IBakedModel.java.patch | 21 + .../resources/model/ModelBakery.java.patch | 82 ++ .../resources/model/ModelManager.java.patch | 14 + .../resources/model/ModelRotation.java.patch | 21 + .../client/settings/GameSettings.java.patch | 10 + .../client/shader/Framebuffer.java.patch | 57 + .../command/CommandEnchant.java.patch | 11 + .../minecraft/command/CommandFill.java.patch | 28 + .../command/CommandHandler.java.patch | 19 + .../command/server/CommandSetBlock.java.patch | 20 + .../server/CommandTestForBlock.java.patch | 11 + .../minecraft/crash/CrashReport.java.patch | 19 + .../crash/CrashReportCategory.java.patch | 16 + .../creativetab/CreativeTabs.java.patch | 106 ++ .../enchantment/Enchantment.java.patch | 11 + .../net/minecraft/entity/Entity.java.patch | 312 +++++ .../minecraft/entity/EntityHanging.java.patch | 12 + .../minecraft/entity/EntityList.java.patch | 56 + .../minecraft/entity/EntityLiving.java.patch | 41 + .../entity/EntityLivingBase.java.patch | 185 +++ .../EntityMinecartCommandBlock.java.patch | 10 + .../EntitySpawnPlacementRegistry.java.patch | 15 + .../minecraft/entity/EntityTracker.java.patch | 35 + .../entity/EntityTrackerEntry.java.patch | 42 + .../ai/EntityAIAttackOnCollide.java.patch | 46 + .../entity/boss/EntityDragon.java.patch | 14 + .../entity/boss/IBossDisplayData.java.patch | 10 + .../effect/EntityLightningBolt.java.patch | 12 + .../entity/item/EntityEnderPearl.java.patch | 25 + .../entity/item/EntityItem.java.patch | 94 ++ .../entity/item/EntityItemFrame.java.patch | 11 + .../entity/item/EntityMinecart.java.patch | 389 ++++++ .../item/EntityMinecartContainer.java.patch | 10 + .../item/EntityMinecartEmpty.java.patch | 10 + .../item/EntityMinecartFurnace.java.patch | 10 + .../item/EntityMinecartHopper.java.patch | 10 + .../entity/item/EntityXPOrb.java.patch | 10 + .../entity/monster/EntityEnderman.java.patch | 21 + .../entity/monster/EntityMagmaCube.java.patch | 10 + .../entity/monster/EntitySlime.java.patch | 11 + .../entity/monster/EntityZombie.java.patch | 51 + .../entity/passive/EntityHorse.java.patch | 10 + .../entity/passive/EntityMooshroom.java.patch | 62 + .../entity/passive/EntityOcelot.java.patch | 11 + .../entity/passive/EntitySheep.java.patch | 45 + .../entity/passive/EntityVillager.java.patch | 36 + .../entity/player/EntityPlayerMP.java.patch | 66 + .../entity/player/InventoryPlayer.java.patch | 17 + .../projectile/EntityFishHook.java.patch | 22 + .../net/minecraft/init/Bootstrap.java.patch | 19 + .../minecraft/inventory/Container.java.patch | 11 + .../inventory/ContainerBeacon.java.patch | 11 + .../ContainerBrewingStand.java.patch | 29 + .../inventory/ContainerPlayer.java.patch | 12 + .../inventory/ContainerRepair.java.patch | 47 + .../inventory/SlotCrafting.java.patch | 14 + .../inventory/SlotFurnaceOutput.java.patch | 11 + .../net/minecraft/item/Item.java.patch | 97 ++ .../net/minecraft/item/ItemArmor.java.patch | 47 + .../net/minecraft/item/ItemBlock.java.patch | 29 + .../net/minecraft/item/ItemBow.java.patch | 12 + .../net/minecraft/item/ItemBucket.java.patch | 12 + .../minecraft/item/ItemBucketMilk.java.patch | 11 + .../net/minecraft/item/ItemDye.java.patch | 56 + .../minecraft/item/ItemEmptyMap.java.patch | 11 + .../item/ItemFlintAndSteel.java.patch | 11 + .../net/minecraft/item/ItemHoe.java.patch | 17 + .../net/minecraft/item/ItemLilyPad.java.patch | 17 + .../net/minecraft/item/ItemMap.java.patch | 11 + .../item/ItemMonsterPlacer.java.patch | 67 + .../net/minecraft/item/ItemRecord.java.patch | 18 + .../minecraft/item/ItemSeedFood.java.patch | 37 + .../net/minecraft/item/ItemSeeds.java.patch | 37 + .../net/minecraft/item/ItemShears.java.patch | 89 ++ .../net/minecraft/item/ItemSkull.java.patch | 31 + .../net/minecraft/item/ItemSnow.java.patch | 13 + .../net/minecraft/item/ItemStack.java.patch | 131 ++ .../net/minecraft/item/ItemSword.java.patch | 13 + .../net/minecraft/item/ItemTool.java.patch | 71 + .../item/crafting/FurnaceRecipes.java.patch | 10 + .../item/crafting/RecipeFireworks.java.patch | 15 + .../item/crafting/RecipeRepairItem.java.patch | 33 + .../item/crafting/RecipesArmorDyes.java.patch | 15 + .../item/crafting/RecipesBanners.java.patch | 27 + .../crafting/RecipesMapCloning.java.patch | 15 + .../item/crafting/ShapedRecipes.java.patch | 15 + .../item/crafting/ShapelessRecipes.java.patch | 15 + .../nbt/CompressedStreamTools.java.patch | 53 + .../minecraft/nbt/NBTSizeTracker.java.patch | 37 + .../minecraft/nbt/NBTTagCompound.java.patch | 18 + .../net/minecraft/nbt/NBTTagString.java.patch | 11 + .../network/NetworkManager.java.patch | 53 + .../network/ServerStatusResponse.java.patch | 48 + .../handshake/client/C00Handshake.java.patch | 48 + .../client/C17PacketCustomPayload.java.patch | 14 + .../server/S3FPacketCustomPayload.java.patch | 14 + .../net/minecraft/potion/Potion.java.patch | 30 + .../minecraft/potion/PotionEffect.java.patch | 91 ++ .../minecraft/realms/RealmsConnect.java.patch | 19 + .../server/MinecraftServer.java.patch | 186 +++ .../dedicated/DedicatedServer.java.patch | 44 + .../server/gui/MinecraftServerGui.java.patch | 24 + .../integrated/IntegratedServer.java.patch | 31 + .../management/ItemInWorldManager.java.patch | 257 ++++ .../management/PlayerManager.java.patch | 187 +++ .../management/PlayerProfileCache.java.patch | 23 + .../ServerConfigurationManager.java.patch | 153 +++ .../network/NetHandlerLoginServer.java.patch | 11 + .../net/minecraft/stats/StatList.java.patch | 29 + .../tileentity/TileEntity.java.patch | 180 +++ .../tileentity/TileEntityBeacon.java.patch | 20 + .../TileEntityBrewingStand.java.patch | 78 ++ .../tileentity/TileEntityFurnace.java.patch | 51 + .../tileentity/TileEntityNote.java.patch | 12 + .../tileentity/TileEntityPiston.java.patch | 22 + .../tileentity/TileEntitySign.java.patch | 11 + .../net/minecraft/util/EnumFacing.java.patch | 67 + .../util/EnumWorldBlockLayer.java.patch | 12 + .../util/MessageSerializer.java.patch | 11 + .../net/minecraft/util/MouseHelper.java.patch | 10 + .../util/MovingObjectPosition.java.patch | 15 + .../util/ResourceLocation.java.patch | 26 + .../net/minecraft/util/Session.java.patch | 47 + .../net/minecraft/util/Vec3.java.patch | 27 + .../WeightedRandomChestContent.java.patch | 22 + .../net/minecraft/world/ChunkCache.java.patch | 61 + .../net/minecraft/world/Explosion.java.patch | 44 + .../minecraft/world/IBlockAccess.java.patch | 17 + .../minecraft/world/WorldProvider.java.patch | 367 +++++ .../minecraft/world/WorldServer.java.patch | 173 +++ .../world/WorldServerMulti.java.patch | 31 + .../world/biome/BiomeColorHelper.java.patch | 11 + .../world/biome/BiomeGenForest.java.patch | 23 + .../world/biome/BiomeGenHills.java.patch | 11 + .../world/biome/BiomeGenJungle.java.patch | 13 + .../world/biome/BiomeGenPlains.java.patch | 22 + .../world/biome/BiomeGenSwamp.java.patch | 13 + .../world/border/WorldBorder.java.patch | 12 + .../chunk/storage/AnvilSaveHandler.java.patch | 23 + .../world/chunk/storage/RegionFile.java.patch | 42 + .../world/gen/MapGenRavine.java.patch | 80 ++ .../feature/WorldGenAbstractTree.java.patch | 13 + .../gen/feature/WorldGenBigTree.java.patch | 31 + .../gen/feature/WorldGenDeadBush.java.patch | 17 + .../gen/feature/WorldGenForest.java.patch | 11 + .../gen/feature/WorldGenHugeTrees.java.patch | 13 + .../gen/feature/WorldGenMegaJungle.java.patch | 14 + .../feature/WorldGenSavannaTree.java.patch | 31 + .../gen/feature/WorldGenShrub.java.patch | 22 + .../gen/feature/WorldGenTallGrass.java.patch | 17 + .../gen/feature/WorldGenTrees.java.patch | 11 + .../WorldGeneratorBonusChest.java.patch | 17 + .../gen/structure/MapGenStructure.java.patch | 17 + .../structure/StructureComponent.java.patch | 13 + .../StructureNetherBridgePieces.java.patch | 20 + .../gen/structure/StructureStart.java.patch | 23 + .../world/storage/MapData.java.patch | 48 + .../world/storage/SaveHandler.java.patch | 59 + .../world/storage/WorldInfo.java.patch | 35 + .../net/minecraft/block/Block.java.patch.rej | 56 + .../minecraft/block/BlockAir.java.patch.rej | 8 + .../minecraft/block/BlockCocoa.java.patch.rej | 15 + .../minecraft/block/BlockCrops.java.patch.rej | 26 + .../block/BlockDoublePlant.java.patch.rej | 40 + .../minecraft/block/BlockFire.java.patch.rej | 73 + .../minecraft/block/BlockGrass.java.patch.rej | 32 + .../block/BlockLadder.java.patch.rej | 10 + .../block/BlockLeaves.java.patch.rej | 73 + .../minecraft/block/BlockLever.java.patch.rej | 55 + .../minecraft/block/BlockLog.java.patch.rej | 13 + .../block/BlockMobSpawner.java.patch.rej | 18 + .../block/BlockMushroom.java.patch.rej | 10 + .../block/BlockMycelium.java.patch.rej | 10 + .../block/BlockPistonBase.java.patch.rej | 22 + .../block/BlockPistonMoving.java.patch.rej | 19 + .../block/BlockRailBase.java.patch.rej | 134 ++ .../block/BlockRedstoneDiode.java.patch.rej | 10 + .../block/BlockRedstoneOre.java.patch.rej | 21 + .../block/BlockRedstoneWire.java.patch.rej | 59 + .../block/BlockSapling.java.patch.rej | 9 + .../minecraft/block/BlockSkull.java.patch.rej | 10 + .../minecraft/block/BlockSnow.java.patch.rej | 10 + .../minecraft/block/BlockStem.java.patch.rej | 18 + .../minecraft/block/BlockTorch.java.patch.rej | 30 + .../block/BlockTrapDoor.java.patch.rej | 13 + .../block/BlockTripWireHook.java.patch.rej | 10 + .../minecraft/block/BlockVine.java.patch.rej | 18 + .../BlockPistonStructureHelper.java.patch.rej | 10 + .../block/state/BlockState.java.patch.rej | 10 + .../LoadingScreenRenderer.java.patch.rej | 14 + .../minecraft/client/Minecraft.java.patch.rej | 240 ++++ .../client/gui/FontRenderer.java.patch.rej | 47 + .../client/gui/GuiButton.java.patch.rej | 15 + .../client/gui/GuiChat.java.patch.rej | 15 + .../client/gui/GuiCreateWorld.java.patch.rej | 10 + .../client/gui/GuiIngameMenu.java.patch.rej | 12 + .../client/gui/GuiSlot.java.patch.rej | 19 + .../gui/ServerListEntryNormal.java.patch.rej | 23 + .../gui/achievement/GuiStats.java.patch.rej | 19 + .../GuiContainerCreative.java.patch.rej | 171 +++ .../PlayerControllerMP.java.patch.rej | 23 + .../NetHandlerPlayClient.java.patch.rej | 11 + .../network/OldServerPinger.java.patch.rej | 9 + .../renderer/BlockModelShapes.java.patch.rej | 9 + .../renderer/EntityRenderer.java.patch.rej | 73 + .../renderer/ItemRenderer.java.patch.rej | 21 + .../renderer/RenderGlobal.java.patch.rej | 70 + .../WorldVertexBufferUploader.java.patch.rej | 70 + .../block/model/FaceBakery.java.patch.rej | 57 + .../block/statemap/StateMap.java.patch.rej | 10 + .../renderer/chunk/RenderChunk.java.patch.rej | 22 + .../entity/RenderEntityItem.java.patch.rej | 26 + .../renderer/entity/RenderItem.java.patch.rej | 113 ++ .../entity/RenderPlayer.java.patch.rej | 9 + .../RendererLivingEntity.java.patch.rej | 14 + .../layers/LayerArmorBase.java.patch.rej | 88 ++ .../renderer/texture/Stitcher.java.patch.rej | 25 + .../texture/TextureManager.java.patch.rej | 17 + .../texture/TextureMap.java.patch.rej | 118 ++ .../vertex/VertexFormatElement.java.patch.rej | 49 + .../resources/LanguageManager.java.patch.rej | 9 + .../client/resources/Locale.java.patch.rej | 10 + ...leReloadableResourceManager.java.patch.rej | 46 + .../resources/SkinManager.java.patch.rej | 12 + .../model/ModelBakery.java.patch.rej | 17 + .../creativetab/CreativeTabs.java.patch.rej | 21 + .../enchantment/Enchantment.java.patch.rej | 55 + .../EnchantmentHelper.java.patch.rej | 43 + .../entity/EntityList.java.patch.rej | 13 + .../entity/EntityLivingBase.java.patch.rej | 30 + .../ai/EntityAIAttackOnCollide.java.patch.rej | 16 + .../entity/boss/EntityWither.java.patch.rej | 10 + .../entity/item/EntityMinecart.java.patch.rej | 68 + .../monster/EntityEnderman.java.patch.rej | 19 + .../monster/EntityZombie.java.patch.rej | 10 + .../passive/EntityVillager.java.patch.rej | 9 + .../player/EntityPlayerMP.java.patch.rej | 29 + .../minecraft/init/Bootstrap.java.patch.rej | 9 + .../inventory/ContainerPlayer.java.patch.rej | 11 + .../inventory/ContainerRepair.java.patch.rej | 20 + .../net/minecraft/item/Item.java.patch.rej | 593 ++++++++ .../minecraft/item/ItemBlock.java.patch.rej | 45 + .../net/minecraft/item/ItemBow.java.patch.rej | 18 + .../item/ItemMonsterPlacer.java.patch.rej | 42 + .../minecraft/item/ItemReed.java.patch.rej | 10 + .../minecraft/item/ItemSign.java.patch.rej | 10 + .../minecraft/item/ItemStack.java.patch.rej | 20 + .../crafting/FurnaceRecipes.java.patch.rej | 11 + .../crafting/RecipeFireworks.java.patch.rej | 23 + .../crafting/RecipeRepairItem.java.patch.rej | 10 + .../nbt/NBTTagByteArray.java.patch.rej | 9 + .../nbt/NBTTagCompound.java.patch.rej | 10 + .../nbt/NBTTagIntArray.java.patch.rej | 9 + .../minecraft/nbt/NBTTagList.java.patch.rej | 15 + .../network/NetworkSystem.java.patch.rej | 10 + .../ServerStatusResponse.java.patch.rej | 45 + .../client/C12PacketUpdateSign.java.patch.rej | 10 + .../server/S00PacketServerInfo.java.patch.rej | 10 + .../potion/PotionEffect.java.patch.rej | 10 + .../server/MinecraftServer.java.patch.rej | 127 ++ .../IntegratedServer.java.patch.rej | 68 + .../management/PlayerManager.java.patch.rej | 40 + .../PlayerProfileCache.java.patch.rej | 28 + .../ServerConfigurationManager.java.patch.rej | 74 + .../NetHandlerHandshakeTCP.java.patch.rej | 10 + .../NetHandlerLoginServer.java.patch.rej | 10 + .../minecraft/stats/StatList.java.patch.rej | 15 + .../tileentity/TileEntity.java.patch.rej | 13 + .../TileEntityHopper.java.patch.rej | 39 + .../util/EnumChatFormatting.java.patch.rej | 9 + .../minecraft/util/EnumFacing.java.patch.rej | 10 + .../net/minecraft/util/Session.java.patch.rej | 17 + .../util/StringTranslate.java.patch.rej | 64 + .../WeightedRandomChestContent.java.patch.rej | 54 + .../minecraft/world/Explosion.java.patch.rej | 9 + .../world/WorldProvider.java.patch.rej | 17 + .../world/WorldServer.java.patch.rej | 90 ++ .../world/WorldServerMulti.java.patch.rej | 32 + .../world/biome/BiomeGenHills.java.patch.rej | 10 + .../storage/AnvilSaveHandler.java.patch.rej | 22 + .../ExtendedBlockStorage.java.patch.rej | 10 + .../world/gen/MapGenRavine.java.patch.rej | 31 + .../WorldGenBigMushroom.java.patch.rej | 38 + .../feature/WorldGenBigTree.java.patch.rej | 23 + .../feature/WorldGenCanopyTree.java.patch.rej | 69 + .../gen/feature/WorldGenForest.java.patch.rej | 42 + .../feature/WorldGenHugeTrees.java.patch.rej | 57 + .../feature/WorldGenMegaJungle.java.patch.rej | 53 + .../WorldGenMegaPineTree.java.patch.rej | 65 + .../feature/WorldGenMinable.java.patch.rej | 10 + .../WorldGenSavannaTree.java.patch.rej | 36 + .../gen/feature/WorldGenShrub.java.patch.rej | 10 + .../gen/feature/WorldGenSwamp.java.patch.rej | 102 ++ .../gen/feature/WorldGenTaiga1.java.patch.rej | 52 + .../gen/feature/WorldGenTaiga2.java.patch.rej | 56 + .../gen/feature/WorldGenTrees.java.patch.rej | 88 ++ .../structure/MapGenStronghold.java.patch.rej | 21 + ...StructureNetherBridgePieces.java.patch.rej | 9 + .../world/storage/SaveHandler.java.patch.rej | 48 + 409 files changed, 16902 insertions(+) create mode 100644 patches/minecraft/net/minecraft/block/Block.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockBush.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockButton.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockCactus.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockChest.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockCocoa.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockCrops.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockDoor.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockFalling.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockFarmland.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockFire.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockGrass.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockIce.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockLadder.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockLeaves.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockLever.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockLog.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockMushroom.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockMycelium.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockNote.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockPane.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockPotato.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockQuartz.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockRailBase.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockReed.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockSapling.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockSkull.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockSnow.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockStem.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockTorch.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockVine.java.patch create mode 100644 patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch create mode 100644 patches/minecraft/net/minecraft/block/state/BlockState.java.patch create mode 100644 patches/minecraft/net/minecraft/block/state/BlockStateBase.java.patch create mode 100644 patches/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch create mode 100644 patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch create mode 100644 patches/minecraft/net/minecraft/client/Minecraft.java.patch create mode 100644 patches/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch create mode 100644 patches/minecraft/net/minecraft/client/model/ModelBase.java.patch create mode 100644 patches/minecraft/net/minecraft/client/model/ModelBox.java.patch create mode 100644 patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch create mode 100644 patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch create mode 100644 patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch create mode 100644 patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch create mode 100644 patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch create mode 100644 patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch create mode 100644 patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch create mode 100644 patches/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch create mode 100644 patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch create mode 100644 patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch create mode 100644 patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch create mode 100644 patches/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch create mode 100644 patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch create mode 100644 patches/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch create mode 100644 patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch create mode 100644 patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch create mode 100644 patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch create mode 100644 patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch create mode 100644 patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch create mode 100644 patches/minecraft/net/minecraft/command/CommandEnchant.java.patch create mode 100644 patches/minecraft/net/minecraft/command/CommandFill.java.patch create mode 100644 patches/minecraft/net/minecraft/command/CommandHandler.java.patch create mode 100644 patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch create mode 100644 patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch create mode 100644 patches/minecraft/net/minecraft/crash/CrashReport.java.patch create mode 100644 patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch create mode 100644 patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch create mode 100644 patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/Entity.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/EntityHanging.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/EntityList.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/EntityLiving.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/EntityTracker.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch create mode 100644 patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch create mode 100644 patches/minecraft/net/minecraft/init/Bootstrap.java.patch create mode 100644 patches/minecraft/net/minecraft/inventory/Container.java.patch create mode 100644 patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch create mode 100644 patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch create mode 100644 patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch create mode 100644 patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch create mode 100644 patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch create mode 100644 patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch create mode 100644 patches/minecraft/net/minecraft/item/Item.java.patch create mode 100644 patches/minecraft/net/minecraft/item/ItemArmor.java.patch create mode 100644 patches/minecraft/net/minecraft/item/ItemBlock.java.patch create mode 100644 patches/minecraft/net/minecraft/item/ItemBow.java.patch create mode 100644 patches/minecraft/net/minecraft/item/ItemBucket.java.patch create mode 100644 patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch create mode 100644 patches/minecraft/net/minecraft/item/ItemDye.java.patch create mode 100644 patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch create mode 100644 patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch create mode 100644 patches/minecraft/net/minecraft/item/ItemHoe.java.patch create mode 100644 patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch create mode 100644 patches/minecraft/net/minecraft/item/ItemMap.java.patch create mode 100644 patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch create mode 100644 patches/minecraft/net/minecraft/item/ItemRecord.java.patch create mode 100644 patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch create mode 100644 patches/minecraft/net/minecraft/item/ItemSeeds.java.patch create mode 100644 patches/minecraft/net/minecraft/item/ItemShears.java.patch create mode 100644 patches/minecraft/net/minecraft/item/ItemSkull.java.patch create mode 100644 patches/minecraft/net/minecraft/item/ItemSnow.java.patch create mode 100644 patches/minecraft/net/minecraft/item/ItemStack.java.patch create mode 100644 patches/minecraft/net/minecraft/item/ItemSword.java.patch create mode 100644 patches/minecraft/net/minecraft/item/ItemTool.java.patch create mode 100644 patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch create mode 100644 patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch create mode 100644 patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch create mode 100644 patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch create mode 100644 patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch create mode 100644 patches/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch create mode 100644 patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch create mode 100644 patches/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch create mode 100644 patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch create mode 100644 patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch create mode 100644 patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch create mode 100644 patches/minecraft/net/minecraft/nbt/NBTTagString.java.patch create mode 100644 patches/minecraft/net/minecraft/network/NetworkManager.java.patch create mode 100644 patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch create mode 100644 patches/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch create mode 100644 patches/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch create mode 100644 patches/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch create mode 100644 patches/minecraft/net/minecraft/potion/Potion.java.patch create mode 100644 patches/minecraft/net/minecraft/potion/PotionEffect.java.patch create mode 100644 patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch create mode 100644 patches/minecraft/net/minecraft/server/MinecraftServer.java.patch create mode 100644 patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch create mode 100644 patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch create mode 100644 patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch create mode 100644 patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch create mode 100644 patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch create mode 100644 patches/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch create mode 100644 patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch create mode 100644 patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch create mode 100644 patches/minecraft/net/minecraft/stats/StatList.java.patch create mode 100644 patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch create mode 100644 patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch create mode 100644 patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch create mode 100644 patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch create mode 100644 patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch create mode 100644 patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch create mode 100644 patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch create mode 100644 patches/minecraft/net/minecraft/util/EnumFacing.java.patch create mode 100644 patches/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch create mode 100644 patches/minecraft/net/minecraft/util/MessageSerializer.java.patch create mode 100644 patches/minecraft/net/minecraft/util/MouseHelper.java.patch create mode 100644 patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch create mode 100644 patches/minecraft/net/minecraft/util/ResourceLocation.java.patch create mode 100644 patches/minecraft/net/minecraft/util/Session.java.patch create mode 100644 patches/minecraft/net/minecraft/util/Vec3.java.patch create mode 100644 patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch create mode 100644 patches/minecraft/net/minecraft/world/ChunkCache.java.patch create mode 100644 patches/minecraft/net/minecraft/world/Explosion.java.patch create mode 100644 patches/minecraft/net/minecraft/world/IBlockAccess.java.patch create mode 100644 patches/minecraft/net/minecraft/world/WorldProvider.java.patch create mode 100644 patches/minecraft/net/minecraft/world/WorldServer.java.patch create mode 100644 patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch create mode 100644 patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch create mode 100644 patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch create mode 100644 patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch create mode 100644 patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch create mode 100644 patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch create mode 100644 patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch create mode 100644 patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch create mode 100644 patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch create mode 100644 patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch create mode 100644 patches/minecraft/net/minecraft/world/storage/MapData.java.patch create mode 100644 patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch create mode 100644 patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch create mode 100644 rejects/minecraft/net/minecraft/block/Block.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockAir.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockCocoa.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockCrops.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockDoublePlant.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockFire.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockGrass.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockLadder.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockLeaves.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockLever.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockLog.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockMobSpawner.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockMushroom.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockMycelium.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockPistonBase.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockPistonMoving.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockRailBase.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockSapling.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockSkull.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockSnow.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockStem.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockTorch.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockTrapDoor.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockTripWireHook.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/BlockVine.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/block/state/BlockState.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/Minecraft.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/gui/FontRenderer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/gui/GuiButton.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/gui/GuiChat.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/gui/GuiSlot.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/network/OldServerPinger.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/resources/LanguageManager.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/resources/Locale.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/resources/SkinManager.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/enchantment/Enchantment.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/EntityList.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/EntityLivingBase.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/boss/EntityWither.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/init/Bootstrap.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/inventory/ContainerRepair.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/Item.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/ItemBlock.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/ItemBow.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/ItemReed.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/ItemSign.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/ItemStack.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/nbt/NBTTagByteArray.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/nbt/NBTTagIntArray.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/nbt/NBTTagList.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/network/NetworkSystem.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/network/ServerStatusResponse.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/potion/PotionEffect.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/server/MinecraftServer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/server/management/PlayerManager.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/stats/StatList.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/tileentity/TileEntity.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/util/EnumChatFormatting.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/util/EnumFacing.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/util/Session.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/util/StringTranslate.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/Explosion.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/WorldProvider.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/WorldServer.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/WorldServerMulti.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch.rej create mode 100644 rejects/minecraft/net/minecraft/world/storage/SaveHandler.java.patch.rej diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch new file mode 100644 index 000000000..425b4bd1b --- /dev/null +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -0,0 +1,1215 @@ +--- ../src-base/minecraft/net/minecraft/block/Block.java ++++ ../src-work/minecraft/net/minecraft/block/Block.java +@@ -38,8 +38,9 @@ + public class Block + { + private static final ResourceLocation AIR_ID = new ResourceLocation("air"); +- public static final RegistryNamespacedDefaultedByKey blockRegistry = new RegistryNamespacedDefaultedByKey(AIR_ID); +- public static final ObjectIntIdentityMap BLOCK_STATE_IDS = new ObjectIntIdentityMap(); ++ public static final RegistryNamespacedDefaultedByKey blockRegistry = net.minecraftforge.fml.common.registry.GameData.getBlockRegistry(); ++ @Deprecated //Modders: DO NOT use this! Use GameRegistry ++ public static final ObjectIntIdentityMap BLOCK_STATE_IDS = net.minecraftforge.fml.common.registry.GameData.getBlockStateIDMap(); + private CreativeTabs displayOnCreativeTab; + public static final Block.SoundType soundTypeStone = new Block.SoundType("stone", 1.0F, 1.0F); + public static final Block.SoundType soundTypeWood = new Block.SoundType("wood", 1.0F, 1.0F); +@@ -124,6 +125,9 @@ + private String unlocalizedName; + private static final String __OBFID = "CL_00000199"; + ++ public final net.minecraftforge.fml.common.registry.RegistryDelegate delegate = ++ ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)blockRegistry).getDelegate(this, Block.class); ++ + public static int getIdFromBlock(Block blockIn) + { + return blockRegistry.getIDForObject(blockIn); +@@ -137,7 +141,8 @@ + + public static Block getBlockById(int id) + { +- return (Block)blockRegistry.getObjectById(id); ++ Block ret = (Block)blockRegistry.getObjectById(id); ++ return ret == null ? net.minecraft.init.Blocks.air : ret; + } + + public static IBlockState getStateById(int id) +@@ -308,7 +313,7 @@ + + public boolean isReplaceable(World worldIn, BlockPos pos) + { +- return false; ++ return getMaterial().isReplaceable(); + } + + public Block setHardness(float hardness) +@@ -345,9 +350,10 @@ + return this.needsRandomTick; + } + ++ @Deprecated //Forge: New State sensitive version. + public boolean hasTileEntity() + { +- return this.isBlockContainer; ++ return hasTileEntity(getDefaultState()); + } + + public final void setBlockBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ) +@@ -364,13 +370,13 @@ + public int getMixedBrightnessForBlock(IBlockAccess worldIn, BlockPos pos) + { + Block block = worldIn.getBlockState(pos).getBlock(); +- int i = worldIn.getCombinedLight(pos, block.getLightValue()); ++ int i = worldIn.getCombinedLight(pos, block.getLightValue(worldIn, pos)); + + if (i == 0 && block instanceof BlockSlab) + { + pos = pos.down(); + block = worldIn.getBlockState(pos).getBlock(); +- return worldIn.getCombinedLight(pos, block.getLightValue()); ++ return worldIn.getCombinedLight(pos, block.getLightValue(worldIn, pos)); + } + else + { +@@ -458,6 +464,10 @@ + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { ++ if (hasTileEntity(state) && !(this instanceof BlockContainer)) ++ { ++ worldIn.removeTileEntity(pos); ++ } + } + + public int quantityDropped(Random random) +@@ -472,8 +482,7 @@ + + public float getPlayerRelativeBlockHardness(EntityPlayer playerIn, World worldIn, BlockPos pos) + { +- float f = this.getBlockHardness(worldIn, pos); +- return f < 0.0F ? 0.0F : (!playerIn.canHarvestBlock(this) ? playerIn.getToolDigEfficiency(this) / f / 100.0F : playerIn.getToolDigEfficiency(this) / f / 30.0F); ++ return net.minecraftforge.common.ForgeHooks.blockStrength(worldIn.getBlockState(pos), playerIn, worldIn, pos); + } + + public final void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int forture) +@@ -483,20 +492,16 @@ + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { +- if (!worldIn.isRemote) ++ if (!worldIn.isRemote && !worldIn.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe + { +- int i = this.quantityDroppedWithBonus(fortune, worldIn.rand); ++ java.util.List items = getDrops(worldIn, pos, state, fortune); ++ chance = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, fortune, chance, false, harvesters.get()); + +- for (int j = 0; j < i; ++j) ++ for (ItemStack item : items) + { + if (worldIn.rand.nextFloat() <= chance) + { +- Item item = this.getItemDropped(state, worldIn.rand, fortune); +- +- if (item != null) +- { +- spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); +- } ++ spawnAsEntity(worldIn, pos, item); + } + } + } +@@ -504,8 +509,13 @@ + + public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack) + { +- if (!worldIn.isRemote && worldIn.getGameRules().getGameRuleBooleanValue("doTileDrops")) ++ if (!worldIn.isRemote && worldIn.getGameRules().getGameRuleBooleanValue("doTileDrops") && !worldIn.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe + { ++ if (captureDrops.get()) ++ { ++ capturedDrops.get().add(stack); ++ return; ++ } + float f = 0.5F; + double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; +@@ -692,7 +702,7 @@ + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable(); ++ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos); + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) +@@ -804,25 +814,35 @@ + player.triggerAchievement(StatList.mineBlockStatArray[getIdFromBlock(this)]); + player.addExhaustion(0.025F); + +- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) ++ if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player)) + { ++ java.util.ArrayList items = new java.util.ArrayList(); + ItemStack itemstack = this.createStackedBlock(state); + + if (itemstack != null) + { +- spawnAsEntity(worldIn, pos, itemstack); ++ items.add(itemstack); + } ++ ++ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, worldIn.getBlockState(pos), 0, 1.0f, true, player); ++ for (ItemStack stack : items) ++ { ++ spawnAsEntity(worldIn, pos, stack); ++ } + } + else + { ++ harvesters.set(player); + int i = EnchantmentHelper.getFortuneModifier(player); + this.dropBlockAsItem(worldIn, pos, state, i); ++ harvesters.set(null); + } + } + ++ @Deprecated //Forge: State sensitive version + protected boolean canSilkHarvest() + { +- return this.isFullCube() && !this.isBlockContainer; ++ return this.isFullCube() && !this.hasTileEntity(silk_check_state.get()); + } + + protected ItemStack createStackedBlock(IBlockState state) +@@ -1015,6 +1035,1033 @@ + return "Block{" + blockRegistry.getNameForObject(this) + "}"; + } + ++ /* ======================================== FORGE START =====================================*/ ++ //For ForgeInternal use Only! ++ protected ThreadLocal harvesters = new ThreadLocal(); ++ private ThreadLocal silk_check_state = new ThreadLocal(); ++ protected static java.util.Random RANDOM = new java.util.Random(); // Useful for random things without a seed. ++ /** ++ * Get a light value for the block at the specified coordinates, normal ranges are between 0 and 15 ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return The light value ++ */ ++ public int getLightValue(IBlockAccess world, BlockPos pos) ++ { ++ Block block = world.getBlockState(pos).getBlock(); ++ if (block != this) ++ { ++ return block.getLightValue(world, pos); ++ } ++ return getLightValue(); ++ } ++ ++ /** ++ * Checks if a player or entity can use this block to 'climb' like a ladder. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param entity The entity trying to use the ladder, CAN be null. ++ * @return True if the block should act like a ladder ++ */ ++ public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return false; } ++ ++ /** ++ * Return true if the block is a normal, solid cube. This ++ * determines indirect power state, entity ejection from blocks, and a few ++ * others. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return True if the block is a full cube ++ */ ++ public boolean isNormalCube(IBlockAccess world, BlockPos pos) ++ { ++ return getMaterial().isOpaque() && isFullCube() && !canProvidePower(); ++ } ++ ++ /** ++ * Checks if the block is a solid face on the given side, used by placement logic. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param side The side to check ++ * @return True if the block is solid on the specified side. ++ */ ++ public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side) ++ { ++ IBlockState state = this.getActualState(world.getBlockState(pos), world, pos); ++ ++ if (this instanceof BlockSlab) ++ { ++ return isFullBlock() || (state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP && side == EnumFacing.UP); ++ } ++ else if (this instanceof BlockFarmland) ++ { ++ return (side != EnumFacing.DOWN && side != EnumFacing.UP); ++ } ++ else if (this instanceof BlockStairs) ++ { ++ boolean flipped = state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP; ++ BlockStairs.EnumShape shape = (BlockStairs.EnumShape)state.getValue(BlockStairs.SHAPE); ++ EnumFacing facing = (EnumFacing)state.getValue(BlockStairs.FACING); ++ if (side == EnumFacing.UP) return flipped; ++ if (facing == side) return true; ++ if (flipped) ++ { ++ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.rotateYCCW(); ++ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.rotateY(); ++ } ++ else ++ { ++ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.rotateY(); ++ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.rotateYCCW(); ++ } ++ return false; ++ } ++ else if (this instanceof BlockSnow) ++ { ++ return ((Integer)state.getValue(BlockSnow.LAYERS)) >= 8; ++ } ++ else if (this instanceof BlockHopper && side == EnumFacing.UP) ++ { ++ return true; ++ } ++ else if (this instanceof BlockCompressedPowered) ++ { ++ return true; ++ } ++ return isNormalCube(world, pos); ++ } ++ ++ /** ++ * Determines if this block should set fire and deal fire damage ++ * to entities coming into contact with it. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return True if the block should deal damage ++ */ ++ public boolean isBurning(IBlockAccess world, BlockPos pos) ++ { ++ return false; ++ } ++ ++ /** ++ * Determines this block should be treated as an air block ++ * by the rest of the code. This method is primarily ++ * useful for creating pure logic-blocks that will be invisible ++ * to the player and otherwise interact as air would. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return True if the block considered air ++ */ ++ public boolean isAir(IBlockAccess world, BlockPos pos) ++ { ++ return getMaterial() == Material.air; ++ } ++ ++ /** ++ * Determines if the player can harvest this block, obtaining it's drops when the block is destroyed. ++ * ++ * @param player The player damaging the block, may be null ++ * @param meta The block's current metadata ++ * @return True to spawn the drops ++ */ ++ public boolean canHarvestBlock(IBlockAccess world, BlockPos pos, EntityPlayer player) ++ { ++ return net.minecraftforge.common.ForgeHooks.canHarvestBlock(this, player, world, pos); ++ } ++ ++ /** ++ * Called when a player removes a block. This is responsible for ++ * actually destroying the block, and the block is intact at time of call. ++ * This is called regardless of whether the player can harvest the block or ++ * not. ++ * ++ * Return true if the block is actually destroyed. ++ * ++ * Note: When used in multiplayer, this is called on both client and ++ * server sides! ++ * ++ * @param world The current world ++ * @param player The player damaging the block, may be null ++ * @param pos Block position in world ++ * @param willHarvest True if Block.harvestBlock will be called after this, if the return in true. ++ * Can be useful to delay the destruction of tile entities till after harvestBlock ++ * @return True if the block is actually destroyed. ++ */ ++ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) ++ { ++ return world.setBlockToAir(pos); ++ } ++ ++ /** ++ * Chance that fire will spread and consume this block. ++ * 300 being a 100% chance, 0, being a 0% chance. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param face The face that the fire is coming from ++ * @return A number ranging from 0 to 300 relating used to determine if the block will be consumed by fire ++ */ ++ public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) ++ { ++ return net.minecraft.init.Blocks.fire.getFlammability(this); ++ } ++ ++ /** ++ * Called when fire is updating, checks if a block face can catch fire. ++ * ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param face The face that the fire is coming from ++ * @return True if the face can be on fire, false otherwise. ++ */ ++ public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face) ++ { ++ return getFlammability(world, pos, face) > 0; ++ } ++ ++ /** ++ * Called when fire is updating on a neighbor block. ++ * The higher the number returned, the faster fire will spread around this block. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param face The face that the fire is coming from ++ * @return A number that is used to determine the speed of fire growth around the block ++ */ ++ public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) ++ { ++ return net.minecraft.init.Blocks.fire.getEncouragement(this); ++ } ++ ++ /** ++ * Currently only called by fire when it is on top of this block. ++ * Returning true will prevent the fire from naturally dying during updating. ++ * Also prevents firing from dying from rain. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param metadata The blocks current metadata ++ * @param side The face that the fire is coming from ++ * @return True if this block sustains fire, meaning it will never go out. ++ */ ++ public boolean isFireSource(World world, BlockPos pos, EnumFacing side) ++ { ++ if (this == net.minecraft.init.Blocks.netherrack && side == EnumFacing.UP) ++ { ++ return true; ++ } ++ if ((world.provider instanceof net.minecraft.world.WorldProviderEnd) && this == net.minecraft.init.Blocks.bedrock && side == EnumFacing.UP) ++ { ++ return true; ++ } ++ return false; ++ } ++ ++ private boolean isTileProvider = this instanceof ITileEntityProvider; ++ /** ++ * Called throughout the code as a replacement for block instanceof BlockContainer ++ * Moving this to the Block base class allows for mods that wish to extend vanilla ++ * blocks, and also want to have a tile entity on that block, may. ++ * ++ * Return true from this function to specify this block has a tile entity. ++ * ++ * @param state State of the current block ++ * @return True if block has a tile entity, false otherwise ++ */ ++ public boolean hasTileEntity(IBlockState state) ++ { ++ return isTileProvider; ++ } ++ ++ /** ++ * Called throughout the code as a replacement for ITileEntityProvider.createNewTileEntity ++ * Return the same thing you would from that function. ++ * This will fall back to ITileEntityProvider.createNewTileEntity(World) if this block is a ITileEntityProvider ++ * ++ * @param metadata The Metadata of the current block ++ * @return A instance of a class extending TileEntity ++ */ ++ public TileEntity createTileEntity(World world, IBlockState state) ++ { ++ if (isTileProvider) ++ { ++ return ((ITileEntityProvider)this).createNewTileEntity(world, getMetaFromState(state)); ++ } ++ return null; ++ } ++ ++ /** ++ * State and fortune sensitive version, this replaces the old (int meta, Random rand) ++ * version in 1.1. ++ * ++ * @param state Current state ++ * @param fortune Current item fortune level ++ * @param random Random number generator ++ * @return The number of items to drop ++ */ ++ public int quantityDropped(IBlockState state, int fortune, Random random) ++ { ++ return quantityDroppedWithBonus(fortune, random); ++ } ++ ++ /** ++ * This returns a complete list of items dropped from this block. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param state Current state ++ * @param fortune Breakers fortune level ++ * @return A ArrayList containing all items this block drops ++ */ ++ public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ List ret = new java.util.ArrayList(); ++ ++ Random rand = world instanceof World ? ((World)world).rand : RANDOM; ++ ++ int count = quantityDropped(state, fortune, rand); ++ for(int i = 0; i < count; i++) ++ { ++ Item item = this.getItemDropped(state, rand, fortune); ++ if (item != null) ++ { ++ ret.add(new ItemStack(item, 1, this.damageDropped(state))); ++ } ++ } ++ return ret; ++ } ++ ++ /** ++ * Return true from this function if the player with silk touch can harvest this block directly, and not it's normal drops. ++ * ++ * @param world The world ++ * @param pos Block position in world ++ * @param state current block state ++ * @param player The player doing the harvesting ++ * @return True if the block can be directly harvested using silk touch ++ */ ++ public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) ++ { ++ silk_check_state.set(state);; ++ boolean ret = this.canSilkHarvest(); ++ silk_check_state.set(null); ++ return ret; ++ } ++ ++ /** ++ * Determines if a specified mob type can spawn on this block, returning false will ++ * prevent any mob from spawning on the block. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param type The Mob Category Type ++ * @return True to allow a mob of the specified category to spawn, false to prevent it. ++ */ ++ public boolean canCreatureSpawn(IBlockAccess world, BlockPos pos, net.minecraft.entity.EntityLiving.SpawnPlacementType type) ++ { ++ IBlockState state = world.getBlockState(pos); ++ if (this instanceof BlockSlab) ++ { ++ return (isFullBlock() || state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP); ++ } ++ else if (this instanceof BlockStairs) ++ { ++ return state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP; ++ } ++ return isSideSolid(world, pos, EnumFacing.UP); ++ } ++ ++ /** ++ * Determines if this block is classified as a Bed, Allowing ++ * players to sleep in it, though the block has to specifically ++ * perform the sleeping functionality in it's activated event. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param player The player or camera entity, null in some cases. ++ * @return True to treat this as a bed ++ */ ++ public boolean isBed(IBlockAccess world, BlockPos pos, Entity player) ++ { ++ return this == net.minecraft.init.Blocks.bed; ++ } ++ ++ /** ++ * Returns the position that the player is moved to upon ++ * waking up, or respawning at the bed. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param player The player or camera entity, null in some cases. ++ * @return The spawn position ++ */ ++ public BlockPos getBedSpawnPosition(IBlockAccess world, BlockPos pos, EntityPlayer player) ++ { ++ if (world instanceof World) ++ return BlockBed.getSafeExitLocation((World)world, pos, 0); ++ return null; ++ } ++ ++ /** ++ * Called when a user either starts or stops sleeping in the bed. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param player The player or camera entity, null in some cases. ++ * @param occupied True if we are occupying the bed, or false if they are stopping use of the bed ++ */ ++ public void setBedOccupied(IBlockAccess world, BlockPos pos, EntityPlayer player, boolean occupied) ++ { ++ if (world instanceof World) ++ { ++ IBlockState state = world.getBlockState(pos); ++ state = state.getBlock().getActualState(state, world, pos); ++ state = state.withProperty(BlockBed.OCCUPIED, true); ++ ((World)world).setBlockState(pos, state, 4); ++ } ++ } ++ ++ /** ++ * Returns the direction of the block. Same values that ++ * are returned by BlockDirectional ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return Bed direction ++ */ ++ public EnumFacing getBedDirection(IBlockAccess world, BlockPos pos) ++ { ++ return (EnumFacing)getActualState(world.getBlockState(pos), world, pos).getValue(BlockDirectional.FACING); ++ } ++ ++ /** ++ * Determines if the current block is the foot half of the bed. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return True if the current block is the foot side of a bed. ++ */ ++ public boolean isBedFoot(IBlockAccess world, BlockPos pos) ++ { ++ return getActualState(world.getBlockState(pos), world, pos).getValue(BlockBed.PART) == BlockBed.EnumPartType.FOOT; ++ } ++ ++ /** ++ * Called when a leaf should start its decay process. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ */ ++ public void beginLeavesDecay(World world, BlockPos pos){} ++ ++ /** ++ * Determines if this block can prevent leaves connected to it from decaying. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return true if the presence this block can prevent leaves from decaying. ++ */ ++ public boolean canSustainLeaves(IBlockAccess world, BlockPos pos) ++ { ++ return false; ++ } ++ ++ /** ++ * Determines if this block is considered a leaf block, used to apply the leaf decay and generation system. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return true if this block is considered leaves. ++ */ ++ public boolean isLeaves(IBlockAccess world, BlockPos pos) ++ { ++ return getMaterial() == Material.leaves; ++ } ++ ++ /** ++ * Used during tree growth to determine if newly generated leaves can replace this block. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return true if this block can be replaced by growing leaves. ++ */ ++ public boolean canBeReplacedByLeaves(IBlockAccess world, BlockPos pos) ++ { ++ return !isFullBlock(); ++ } ++ ++ /** ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return true if the block is wood (logs) ++ */ ++ public boolean isWood(IBlockAccess world, BlockPos pos) ++ { ++ return false; ++ } ++ ++ /** ++ * Determines if the current block is replaceable by Ore veins during world generation. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param target The generic target block the gen is looking for, Standards define stone ++ * for overworld generation, and neatherack for the nether. ++ * @return True to allow this block to be replaced by a ore ++ */ ++ public boolean isReplaceableOreGen(World world, BlockPos pos, com.google.common.base.Predicate target) ++ { ++ return target.apply(world.getBlockState(pos)); ++ } ++ ++ /** ++ * Location sensitive version of getExplosionRestance ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param exploder The entity that caused the explosion, can be null ++ * @param explosion The explosion ++ * @return The amount of the explosion absorbed. ++ */ ++ public float getExplosionResistance(World world, BlockPos pos, Entity exploder, Explosion explosion) ++ { ++ return getExplosionResistance(exploder); ++ } ++ ++ /** ++ * Called when the block is destroyed by an explosion. ++ * Useful for allowing the block to take into account tile entities, ++ * state, etc. when exploded, before it is removed. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param Explosion The explosion instance affecting the block ++ */ ++ public void onBlockExploded(World world, BlockPos pos, Explosion explosion) ++ { ++ world.setBlockToAir(pos); ++ onBlockDestroyedByExplosion(world, pos, explosion); ++ } ++ ++ /** ++ * Determine if this block can make a redstone connection on the side provided, ++ * Useful to control which sides are inputs and outputs for redstone wires. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param side The side that is trying to make the connection, CAN BE NULL ++ * @return True to make the connection ++ */ ++ public boolean canConnectRedstone(IBlockAccess world, BlockPos pos, EnumFacing side) ++ { ++ return canProvidePower() && side != null; ++ } ++ ++ /** ++ * Determines if a torch can be placed on the top surface of this block. ++ * Useful for creating your own block that torches can be on, such as fences. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return True to allow the torch to be placed ++ */ ++ public boolean canPlaceTorchOnTop(IBlockAccess world, BlockPos pos) ++ { ++ if (isSideSolid(world, pos, EnumFacing.UP)) ++ { ++ return true; ++ } ++ else ++ { ++ return this instanceof BlockFence || this == net.minecraft.init.Blocks.glass || this == net.minecraft.init.Blocks.cobblestone_wall || this == net.minecraft.init.Blocks.stained_glass; ++ } ++ } ++ ++ /** Dont think this exists in 1.8 anymore ++ /** ++ * Determines if this block should render in this pass. ++ * ++ * @param pass The pass in question ++ * @return True to render ++ * / ++ public boolean canRenderInPass(int pass) ++ { ++ return pass == func_149701_w(); ++ } ++ */ ++ ++ /** ++ * Called when a user uses the creative pick block button on this block ++ * ++ * @param target The full target the player is looking at ++ * @return A ItemStack to add to the player's inventory, Null if nothing should be added. ++ */ ++ public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) ++ { ++ return getPickBlock(target, world, pos); ++ } ++ @Deprecated ++ public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos) ++ { ++ Item item = getItem(world, pos); ++ ++ if (item == null) ++ { ++ return null; ++ } ++ ++ Block block = item instanceof ItemBlock && !isFlowerPot() ? Block.getBlockFromItem(item) : this; ++ return new ItemStack(item, 1, block.getDamageValue(world, pos)); ++ } ++ ++ /** ++ * Used by getTopSolidOrLiquidBlock while placing biome decorations, villages, etc ++ * Also used to determine if the player can spawn on this block. ++ * ++ * @return False to disallow spawning ++ */ ++ public boolean isFoliage(IBlockAccess world, BlockPos pos) ++ { ++ return false; ++ } ++ ++ /** ++ * Spawn a digging particle effect in the world, this is a wrapper ++ * around EffectRenderer.addBlockHitEffects to allow the block more ++ * control over the particles. Useful when you have entirely different ++ * texture sheets for different sides/locations in the world. ++ * ++ * @param world The current world ++ * @param target The target the player is looking at {x/y/z/side/sub} ++ * @param effectRenderer A reference to the current effect renderer. ++ * @return True to prevent vanilla digging particles form spawning. ++ */ ++ @SideOnly(Side.CLIENT) ++ public boolean addHitEffects(World worldObj, MovingObjectPosition target, net.minecraft.client.particle.EffectRenderer effectRenderer) ++ { ++ return false; ++ } ++ ++ /** ++ * Spawn particles for when the block is destroyed. Due to the nature ++ * of how this is invoked, the x/y/z locations are not always guaranteed ++ * to host your block. So be sure to do proper sanity checks before assuming ++ * that the location is this block. ++ * ++ * @param world The current world ++ * @param pos Position to spawn the particle ++ * @param effectRenderer A reference to the current effect renderer. ++ * @return True to prevent vanilla break particles from spawning. ++ */ ++ @SideOnly(Side.CLIENT) ++ public boolean addDestroyEffects(World world, BlockPos pos, net.minecraft.client.particle.EffectRenderer effectRenderer) ++ { ++ return false; ++ } ++ ++ /** ++ * Determines if this block can support the passed in plant, allowing it to be planted and grow. ++ * Some examples: ++ * Reeds check if its a reed, or if its sand/dirt/grass and adjacent to water ++ * Cacti checks if its a cacti, or if its sand ++ * Nether types check for soul sand ++ * Crops check for tilled soil ++ * Caves check if it's a solid surface ++ * Plains check if its grass or dirt ++ * Water check if its still water ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param direction The direction relative to the given position the plant wants to be, typically its UP ++ * @param plantable The plant that wants to check ++ * @return True to allow the plant to be planted/stay. ++ */ ++ public boolean canSustainPlant(IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable) ++ { ++ IBlockState state = world.getBlockState(pos); ++ IBlockState plant = plantable.getPlant(world, pos.offset(direction)); ++ net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction)); ++ ++ if (plant.getBlock() == net.minecraft.init.Blocks.cactus && this == net.minecraft.init.Blocks.cactus) ++ { ++ return true; ++ } ++ ++ if (plant.getBlock() == net.minecraft.init.Blocks.reeds && this == net.minecraft.init.Blocks.reeds) ++ { ++ return true; ++ } ++ ++ if (plantable instanceof BlockBush && ((BlockBush)plantable).canPlaceBlockOn(this)) ++ { ++ return true; ++ } ++ ++ switch (plantType) ++ { ++ case Desert: return this == net.minecraft.init.Blocks.sand || this == net.minecraft.init.Blocks.hardened_clay || this == net.minecraft.init.Blocks.stained_hardened_clay || this == net.minecraft.init.Blocks.dirt; ++ case Nether: return this == net.minecraft.init.Blocks.soul_sand; ++ case Crop: return this == net.minecraft.init.Blocks.farmland; ++ case Cave: return isSideSolid(world, pos, EnumFacing.UP); ++ case Plains: return this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.dirt || this == net.minecraft.init.Blocks.farmland; ++ case Water: return getMaterial() == Material.water && ((Integer)state.getValue(BlockLiquid.LEVEL)) == 0; ++ case Beach: ++ boolean isBeach = this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.dirt || this == net.minecraft.init.Blocks.sand; ++ boolean hasWater = (world.getBlockState(pos.east()).getBlock().getMaterial() == Material.water || ++ world.getBlockState(pos.west()).getBlock().getMaterial() == Material.water || ++ world.getBlockState(pos.north()).getBlock().getMaterial() == Material.water || ++ world.getBlockState(pos.south()).getBlock().getMaterial() == Material.water); ++ return isBeach && hasWater; ++ } ++ ++ return false; ++ } ++ ++ /** ++ * Called when a plant grows on this block, only implemented for saplings using the WorldGen*Trees classes right now. ++ * Modder may implement this for custom plants. ++ * This does not use ForgeDirection, because large/huge trees can be located in non-representable direction, ++ * so the source location is specified. ++ * Currently this just changes the block to dirt if it was grass. ++ * ++ * Note: This happens DURING the generation, the generation may not be complete when this is called. ++ * ++ * @param world Current world ++ * @param pos Block position in world ++ * @param source Source plant's position in world ++ */ ++ public void onPlantGrow(World world, BlockPos pos, BlockPos source) ++ { ++ if (this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.farmland) ++ { ++ world.setBlockState(pos, net.minecraft.init.Blocks.dirt.getDefaultState(), 2); ++ } ++ } ++ ++ /** ++ * Checks if this soil is fertile, typically this means that growth rates ++ * of plants on this soil will be slightly sped up. ++ * Only vanilla case is tilledField when it is within range of water. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return True if the soil should be considered fertile. ++ */ ++ public boolean isFertile(World world, BlockPos pos) ++ { ++ if (this == net.minecraft.init.Blocks.farmland) ++ { ++ return ((Integer)world.getBlockState(pos).getValue(BlockFarmland.MOISTURE)) > 0; ++ } ++ ++ return false; ++ } ++ ++ /** ++ * Location aware and overrideable version of the lightOpacity array, ++ * return the number to subtract from the light value when it passes through this block. ++ * ++ * This is not guaranteed to have the tile entity in place before this is called, so it is ++ * Recommended that you have your tile entity call relight after being placed if you ++ * rely on it for light info. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return The amount of light to block, 0 for air, 255 for fully opaque. ++ */ ++ public int getLightOpacity(IBlockAccess world, BlockPos pos) ++ { ++ return getLightOpacity(); ++ } ++ ++ /** ++ * Determines if this block is can be destroyed by the specified entities normal behavior. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @return True to allow the ender dragon to destroy this block ++ */ ++ public boolean canEntityDestroy(IBlockAccess world, BlockPos pos, Entity entity) ++ { ++ if (entity instanceof net.minecraft.entity.boss.EntityWither) ++ { ++ return this != net.minecraft.init.Blocks.barrier && this != net.minecraft.init.Blocks.bedrock && this != net.minecraft.init.Blocks.end_portal && this != net.minecraft.init.Blocks.end_portal_frame && this != net.minecraft.init.Blocks.command_block; ++ } ++ else if (entity instanceof net.minecraft.entity.boss.EntityDragon) ++ { ++ return this != net.minecraft.init.Blocks.barrier && this != net.minecraft.init.Blocks.obsidian && this != net.minecraft.init.Blocks.end_stone && this != net.minecraft.init.Blocks.bedrock && this != net.minecraft.init.Blocks.command_block; ++ } ++ ++ return true; ++ } ++ ++ /** ++ * Determines if this block can be used as the base of a beacon. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param beacon Beacon position in world ++ * @return True, to support the beacon, and make it active with this block. ++ */ ++ public boolean isBeaconBase(IBlockAccess worldObj, BlockPos pos, BlockPos beacon) ++ { ++ return this == net.minecraft.init.Blocks.emerald_block || this == net.minecraft.init.Blocks.gold_block || this == net.minecraft.init.Blocks.diamond_block || this == net.minecraft.init.Blocks.iron_block; ++ } ++ ++ /** ++ * Rotate the block. For vanilla blocks this rotates around the axis passed in (generally, it should be the "face" that was hit). ++ * Note: for mod blocks, this is up to the block and modder to decide. It is not mandated that it be a rotation around the ++ * face, but could be a rotation to orient *to* that face, or a visiting of possible rotations. ++ * The method should return true if the rotation was successful though. ++ * ++ * @param world The world ++ * @param pos Block position in world ++ * @param axis The axis to rotate around ++ * @return True if the rotation was successful, False if the rotation failed, or is not possible ++ */ ++ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) ++ { ++ IBlockState state = world.getBlockState(pos); ++ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ { ++ if (prop.getName().equals("facing") || prop.getName().equals("rotation")) ++ { ++ world.setBlockState(pos, state.cycleProperty(prop)); ++ return true; ++ } ++ } ++ return false; ++ } ++ ++ /** ++ * Get the rotations that can apply to the block at the specified coordinates. Null means no rotations are possible. ++ * Note, this is up to the block to decide. It may not be accurate or representative. ++ * @param world The world ++ * @param pos Block position in world ++ * @return An array of valid axes to rotate around, or null for none or unknown ++ */ ++ public EnumFacing[] getValidRotations(World world, BlockPos pos) ++ { ++ IBlockState state = world.getBlockState(pos); ++ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ { ++ if (prop.getName().equals("facing") && prop.getValueClass() == EnumFacing.class) ++ { ++ java.util.Collection values = ((java.util.Collection)prop.getAllowedValues()); ++ return values.toArray(new EnumFacing[values.size()]); ++ } ++ } ++ return null; ++ } ++ ++ /** ++ * Determines the amount of enchanting power this block can provide to an enchanting table. ++ * @param world The World ++ * @param pos Block position in world ++ * @return The amount of enchanting power this block produces. ++ */ ++ public float getEnchantPowerBonus(World world, BlockPos pos) ++ { ++ return this == net.minecraft.init.Blocks.bookshelf ? 1 : 0; ++ } ++ ++ /** ++ * Common way to recolor a block with an external tool ++ * @param world The world ++ * @param pos Block position in world ++ * @param side The side hit with the coloring tool ++ * @param color The color to change to ++ * @return If the recoloring was successful ++ */ ++ public boolean recolorBlock(World world, BlockPos pos, EnumFacing side, net.minecraft.item.EnumDyeColor color) ++ { ++ IBlockState state = world.getBlockState(pos); ++ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ { ++ if (prop.getName().equals("color") && prop.getValueClass() == net.minecraft.item.EnumDyeColor.class) ++ { ++ net.minecraft.item.EnumDyeColor current = (net.minecraft.item.EnumDyeColor)state.getValue(prop); ++ if (current != color) ++ { ++ world.setBlockState(pos, state.withProperty(prop, color)); ++ return true; ++ } ++ } ++ } ++ return false; ++ } ++ ++ /** ++ * Gathers how much experience this block drops when broken. ++ * ++ * @param world The world ++ * @param pos Block position ++ * @param fortune ++ * @return Amount of XP from breaking this block. ++ */ ++ public int getExpDrop(IBlockAccess world, BlockPos pos, int fortune) ++ { ++ return 0; ++ } ++ ++ /** ++ * Called when a tile entity on a side of this block changes is created or is destroyed. ++ * @param world The world ++ * @param pos Block position in world ++ * @param neighbor Block position of neighbor ++ */ ++ public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor){} ++ ++ /** ++ * Called to determine whether to allow the a block to handle its own indirect power rather than using the default rules. ++ * @param world The world ++ * @param pos Block position in world ++ * @param side The INPUT side of the block to be powered - ie the opposite of this block's output side ++ * @return Whether Block#isProvidingWeakPower should be called when determining indirect power ++ */ ++ public boolean shouldCheckWeakPower(IBlockAccess world, BlockPos pos, EnumFacing side) ++ { ++ return isNormalCube(); ++ } ++ ++ /** ++ * If this block should be notified of weak changes. ++ * Weak changes are changes 1 block away through a solid block. ++ * Similar to comparators. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param side The side to check ++ * @return true To be notified of changes ++ */ ++ public boolean getWeakChanges(IBlockAccess world, BlockPos pos) ++ { ++ return false; ++ } ++ ++ private String[] harvestTool = new String[16];; ++ private int[] harvestLevel = new int[]{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; ++ /** ++ * Sets or removes the tool and level required to harvest this block. ++ * ++ * @param toolClass Class ++ * @param level Harvest level: ++ * Wood: 0 ++ * Stone: 1 ++ * Iron: 2 ++ * Diamond: 3 ++ * Gold: 0 ++ */ ++ public void setHarvestLevel(String toolClass, int level) ++ { ++ Iterator itr = getBlockState().getValidStates().iterator(); ++ while (itr.hasNext()) ++ { ++ setHarvestLevel(toolClass, level, itr.next()); ++ } ++ } ++ ++ /** ++ * Sets or removes the tool and level required to harvest this block. ++ * ++ * @param toolClass Class ++ * @param level Harvest level: ++ * Wood: 0 ++ * Stone: 1 ++ * Iron: 2 ++ * Diamond: 3 ++ * Gold: 0 ++ * @param state The specific state. ++ */ ++ public void setHarvestLevel(String toolClass, int level, IBlockState state) ++ { ++ int idx = this.getMetaFromState(state); ++ this.harvestTool[idx] = toolClass; ++ this.harvestLevel[idx] = level; ++ } ++ ++ /** ++ * Queries the class of tool required to harvest this block, if null is returned ++ * we assume that anything can harvest this block. ++ */ ++ public String getHarvestTool(IBlockState state) ++ { ++ return harvestTool[getMetaFromState(state)]; ++ } ++ ++ /** ++ * Queries the harvest level of this item stack for the specified tool class, ++ * Returns -1 if this tool is not of the specified type ++ * ++ * @param stack This item stack instance ++ * @return Harvest level, or -1 if not the specified tool type. ++ */ ++ public int getHarvestLevel(IBlockState state) ++ { ++ return harvestLevel[getMetaFromState(state)]; ++ } ++ ++ /** ++ * Checks if the specified tool type is efficient on this block, ++ * meaning that it digs at full speed. ++ */ ++ public boolean isToolEffective(String type, IBlockState state) ++ { ++ if ("pickaxe".equals(type) && (this == net.minecraft.init.Blocks.redstone_ore || this == net.minecraft.init.Blocks.lit_redstone_ore || this == net.minecraft.init.Blocks.obsidian)) ++ return false; ++ return type != null && type.equals(getHarvestTool(state)); ++ } ++ ++ /** ++ * Can return IExtendedBlockState ++ */ ++ public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) ++ { ++ return getActualState(state, world, pos); ++ } ++ ++ /** ++ * Queries if this block should render in a given layer. ++ * ISmartBlockModel can use MinecraftForgeClient.getRenderLayer to alter their model based on layer ++ */ ++ public boolean canRenderInLayer(EnumWorldBlockLayer layer) ++ { ++ return getBlockLayer() == layer; ++ } ++ ++ // For Internal use only to capture droped items inside getDrops ++ protected static ThreadLocal captureDrops = new ThreadLocal() ++ { ++ @Override protected Boolean initialValue() { return false; } ++ }; ++ protected static ThreadLocal> capturedDrops = new ThreadLocal>() ++ { ++ @Override protected List initialValue() { return new java.util.ArrayList(); } ++ }; ++ protected List captureDrops(boolean start) ++ { ++ if (start) ++ { ++ captureDrops.set(true); ++ capturedDrops.get().clear(); ++ return null; ++ } ++ else ++ { ++ captureDrops.set(false); ++ return capturedDrops.get(); ++ } ++ } ++ /* ========================================= FORGE END ======================================*/ ++ + public static void registerBlocks() + { + registerBlock(0, AIR_ID, (new BlockAir()).setUnlocalizedName("air")); diff --git a/patches/minecraft/net/minecraft/block/BlockBush.java.patch b/patches/minecraft/net/minecraft/block/BlockBush.java.patch new file mode 100644 index 000000000..ec228d628 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockBush.java.patch @@ -0,0 +1,66 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockBush.java ++++ ../src-work/minecraft/net/minecraft/block/BlockBush.java +@@ -13,7 +13,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public class BlockBush extends Block ++public class BlockBush extends Block implements net.minecraftforge.common.IPlantable + { + private static final String __OBFID = "CL_00000208"; + +@@ -38,7 +38,7 @@ + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return super.canPlaceBlockAt(worldIn, pos) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ return super.canPlaceBlockAt(worldIn, pos) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); + } + + protected boolean canPlaceBlockOn(Block ground) +@@ -68,7 +68,10 @@ + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { +- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ BlockPos down = pos.down(); ++ Block soil = worldIn.getBlockState(down).getBlock(); ++ if (state.getBlock() != this) return this.canPlaceBlockOn(soil); //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 soil.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, this); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) +@@ -91,4 +94,33 @@ + { + return EnumWorldBlockLayer.CUTOUT; + } ++ ++ @Override ++ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) ++ { ++ if (this == Blocks.wheat) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.carrots) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.potatoes) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.melon_stem) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.pumpkin_stem) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.deadbush) return net.minecraftforge.common.EnumPlantType.Desert; ++ if (this == Blocks.waterlily) return net.minecraftforge.common.EnumPlantType.Water; ++ if (this == Blocks.red_mushroom) return net.minecraftforge.common.EnumPlantType.Cave; ++ if (this == Blocks.brown_mushroom) return net.minecraftforge.common.EnumPlantType.Cave; ++ if (this == Blocks.nether_wart) return net.minecraftforge.common.EnumPlantType.Nether; ++ if (this == Blocks.sapling) return net.minecraftforge.common.EnumPlantType.Plains; ++ if (this == Blocks.tallgrass) return net.minecraftforge.common.EnumPlantType.Plains; ++ if (this == Blocks.double_plant) return net.minecraftforge.common.EnumPlantType.Plains; ++ if (this == Blocks.red_flower) return net.minecraftforge.common.EnumPlantType.Plains; ++ if (this == Blocks.yellow_flower) return net.minecraftforge.common.EnumPlantType.Plains; ++ return net.minecraftforge.common.EnumPlantType.Plains; ++ } ++ ++ @Override ++ public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) ++ { ++ IBlockState state = world.getBlockState(pos); ++ if (state.getBlock() != this) return getDefaultState(); ++ return state; ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockButton.java.patch b/patches/minecraft/net/minecraft/block/BlockButton.java.patch new file mode 100644 index 000000000..14114212f --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockButton.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockButton.java ++++ ../src-work/minecraft/net/minecraft/block/BlockButton.java +@@ -75,8 +75,7 @@ + + protected static boolean func_181088_a(World p_181088_0_, BlockPos p_181088_1_, EnumFacing p_181088_2_) + { +- BlockPos blockpos = p_181088_1_.offset(p_181088_2_); +- return p_181088_2_ == EnumFacing.DOWN ? World.doesBlockHaveSolidTopSurface(p_181088_0_, blockpos) : p_181088_0_.getBlockState(blockpos).getBlock().isNormalCube(); ++ return p_181088_2_ == EnumFacing.UP && World.doesBlockHaveSolidTopSurface(p_181088_0_, p_181088_1_.down()) ? true : p_181088_0_.isSideSolid(p_181088_1_.offset(p_181088_2_.getOpposite()), p_181088_2_); + } + + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) diff --git a/patches/minecraft/net/minecraft/block/BlockCactus.java.patch b/patches/minecraft/net/minecraft/block/BlockCactus.java.patch new file mode 100644 index 000000000..9de9be460 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockCactus.java.patch @@ -0,0 +1,37 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockCactus.java ++++ ../src-work/minecraft/net/minecraft/block/BlockCactus.java +@@ -18,7 +18,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public class BlockCactus extends Block ++public class BlockCactus extends Block implements net.minecraftforge.common.IPlantable + { + public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15); + private static final String __OBFID = "CL_00000210"; +@@ -110,7 +110,7 @@ + } + + Block block = worldIn.getBlockState(pos.down()).getBlock(); +- return block == Blocks.cactus || block == Blocks.sand; ++ return block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this); + } + + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) +@@ -138,4 +138,16 @@ + { + return new BlockState(this, new IProperty[] {AGE}); + } ++ ++ @Override ++ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) ++ { ++ return net.minecraftforge.common.EnumPlantType.Desert; ++ } ++ ++ @Override ++ public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) ++ { ++ return getDefaultState(); ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockChest.java.patch b/patches/minecraft/net/minecraft/block/BlockChest.java.patch new file mode 100644 index 000000000..8770eda2c --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockChest.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockChest.java ++++ ../src-work/minecraft/net/minecraft/block/BlockChest.java +@@ -528,7 +528,7 @@ + + private boolean isBelowSolidBlock(World worldIn, BlockPos pos) + { +- return worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); ++ return worldIn.isSideSolid(pos.up(), EnumFacing.DOWN, false); + } + + private boolean isOcelotSittingOnChest(World worldIn, BlockPos pos) diff --git a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch new file mode 100644 index 000000000..5a1871a28 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch @@ -0,0 +1,27 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java ++++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java +@@ -138,6 +138,13 @@ + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { ++ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); ++ } ++ ++ @Override ++ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List dropped = super.getDrops(world, pos, state, fortune); + int i = ((Integer)state.getValue(AGE)).intValue(); + int j = 1; + +@@ -148,8 +155,9 @@ + + for (int k = 0; k < j; ++k) + { +- spawnAsEntity(worldIn, pos, new ItemStack(Items.dye, 1, EnumDyeColor.BROWN.getDyeDamage())); ++ dropped.add(new ItemStack(Items.dye, 1, EnumDyeColor.BROWN.getDyeDamage())); + } ++ return dropped; + } + + @SideOnly(Side.CLIENT) diff --git a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch new file mode 100644 index 000000000..772607ab4 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch @@ -0,0 +1,77 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockCrops.java ++++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java +@@ -82,11 +82,11 @@ + float f1 = 0.0F; + IBlockState iblockstate = worldIn.getBlockState(blockpos.add(i, 0, j)); + +- if (iblockstate.getBlock() == Blocks.farmland) ++ if (iblockstate.getBlock().canSustainPlant(worldIn, blockpos.add(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)blockIn)) + { + f1 = 1.0F; + +- if (((Integer)iblockstate.getValue(BlockFarmland.MOISTURE)).intValue() > 0) ++ if (iblockstate.getBlock().isFertile(worldIn, blockpos.add(i, 0, j))) + { + f1 = 3.0F; + } +@@ -127,7 +127,7 @@ + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { +- return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); + } + + protected Item getSeed() +@@ -143,24 +143,6 @@ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); +- +- if (!worldIn.isRemote) +- { +- int i = ((Integer)state.getValue(AGE)).intValue(); +- +- if (i >= 7) +- { +- int j = 3 + fortune; +- +- for (int k = 0; k < j; ++k) +- { +- if (worldIn.rand.nextInt(15) <= i) +- { +- spawnAsEntity(worldIn, pos, new ItemStack(this.getSeed(), 1, 0)); +- } +- } +- } +- } + } + + public Item getItemDropped(IBlockState state, Random rand, int fortune) +@@ -203,4 +185,26 @@ + { + return new BlockState(this, new IProperty[] {AGE}); + } ++ ++ @Override ++ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List ret = super.getDrops(world, pos, state, fortune); ++ int age = ((Integer)state.getValue(AGE)).intValue(); ++ Random rand = world instanceof World ? ((World)world).rand : new Random(); ++ ++ if (age >= 7) ++ { ++ int k = 3 + fortune; ++ ++ for (int i = 0; i < 3 + fortune; ++i) ++ { ++ if (rand.nextInt(15) <= age) ++ { ++ ret.add(new ItemStack(this.getSeed(), 1, 0)); ++ } ++ } ++ } ++ return ret; ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch b/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch new file mode 100644 index 000000000..5bf52c67c --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch @@ -0,0 +1,33 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockDeadBush.java ++++ ../src-work/minecraft/net/minecraft/block/BlockDeadBush.java +@@ -14,7 +14,7 @@ + import net.minecraft.util.BlockPos; + import net.minecraft.world.World; + +-public class BlockDeadBush extends BlockBush ++public class BlockDeadBush extends BlockBush implements net.minecraftforge.common.IShearable + { + private static final String __OBFID = "CL_00000224"; + +@@ -47,14 +47,15 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0)); +- } +- else +- { + super.harvestBlock(worldIn, player, pos, state, te); + } + } ++ ++ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } ++ @Override ++ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(Blocks.deadbush))); ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockDoor.java.patch b/patches/minecraft/net/minecraft/block/BlockDoor.java.patch new file mode 100644 index 000000000..77dc1dd1a --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockDoor.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockDoor.java ++++ ../src-work/minecraft/net/minecraft/block/BlockDoor.java +@@ -155,7 +155,7 @@ + { + if (this.blockMaterial == Material.iron) + { +- return true; ++ return false; //Allow items to interact with the door + } + else + { +@@ -273,7 +273,7 @@ + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return pos.getY() >= 255 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); ++ return pos.getY() >= worldIn.getHeight() - 1 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); + } + + public int getMobilityFlag() diff --git a/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch b/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch new file mode 100644 index 000000000..7ffdec20b --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch @@ -0,0 +1,89 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockDoublePlant.java ++++ ../src-work/minecraft/net/minecraft/block/BlockDoublePlant.java +@@ -25,7 +25,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public class BlockDoublePlant extends BlockBush implements IGrowable ++public class BlockDoublePlant extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable + { + public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockDoublePlant.EnumPlantType.class); + public static final PropertyEnum HALF = PropertyEnum.create("half", BlockDoublePlant.EnumBlockHalf.class); +@@ -91,6 +91,8 @@ + Block block = (Block)(flag ? this : worldIn.getBlockState(blockpos).getBlock()); + Block block1 = (Block)(flag ? worldIn.getBlockState(blockpos1).getBlock() : this); + ++ if (!flag) this.dropBlockAsItem(worldIn, pos, state, 0); //Forge move above the setting to air. ++ + if (block == this) + { + worldIn.setBlockState(blockpos, Blocks.air.getDefaultState(), 2); +@@ -99,17 +101,13 @@ + if (block1 == this) + { + worldIn.setBlockState(blockpos1, Blocks.air.getDefaultState(), 3); +- +- if (!flag) +- { +- this.dropBlockAsItem(worldIn, blockpos1, state, 0); +- } + } + } + } + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { ++ if (state.getBlock() != this) return super.canBlockStay(worldIn, pos, state); //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. + if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) + { + return worldIn.getBlockState(pos.down()).getBlock() == this; +@@ -159,7 +157,6 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- if (worldIn.isRemote || player.getCurrentEquippedItem() == null || player.getCurrentEquippedItem().getItem() != Items.shears || state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.onHarvest(worldIn, pos, state, player)) + { + super.harvestBlock(worldIn, player, pos, state, te); + } +@@ -222,8 +219,6 @@ + else + { + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- int i = (blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).getMeta(); +- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 2, i)); + return true; + } + } +@@ -294,6 +289,32 @@ + return Block.EnumOffsetType.XZ; + } + ++ @Override ++ public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos) ++ { ++ IBlockState state = world.getBlockState(pos); ++ EnumPlantType type = (EnumPlantType)state.getValue(VARIANT); ++ return state.getValue(HALF) == EnumBlockHalf.LOWER && (type == EnumPlantType.FERN || type == EnumPlantType.GRASS); ++ } ++ @Override ++ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ java.util.List ret = new java.util.ArrayList(); ++ EnumPlantType type = (EnumPlantType)world.getBlockState(pos).getValue(VARIANT); ++ if (type == EnumPlantType.FERN) ret.add(new ItemStack(Blocks.tallgrass, 2, BlockTallGrass.EnumType.FERN.getMeta())); ++ if (type == EnumPlantType.GRASS) ret.add(new ItemStack(Blocks.tallgrass, 2, BlockTallGrass.EnumType.GRASS.getMeta())); ++ return ret; ++ } ++ @Override ++ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) ++ { ++ //Forge: Break both parts on the client to prevent the top part flickering as default type for a few frames. ++ IBlockState state = world.getBlockState(pos); ++ if (state.getBlock() == this && state.getValue(HALF) == EnumBlockHalf.LOWER && world.getBlockState(pos.up()).getBlock() == this) ++ world.setBlockToAir(pos.up()); ++ return world.setBlockToAir(pos); ++ } ++ + public static enum EnumBlockHalf implements IStringSerializable + { + UPPER, diff --git a/patches/minecraft/net/minecraft/block/BlockFalling.java.patch b/patches/minecraft/net/minecraft/block/BlockFalling.java.patch new file mode 100644 index 000000000..40b410739 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockFalling.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockFalling.java ++++ ../src-work/minecraft/net/minecraft/block/BlockFalling.java +@@ -87,6 +87,7 @@ + + public static boolean canFallInto(World worldIn, BlockPos pos) + { ++ if (worldIn.isAirBlock(pos)) return true; + Block block = worldIn.getBlockState(pos).getBlock(); + Material material = block.blockMaterial; + return block == Blocks.fire || material == Material.air || material == Material.water || material == Material.lava; diff --git a/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch b/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch new file mode 100644 index 000000000..4e0915fe1 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockFarmland.java ++++ ../src-work/minecraft/net/minecraft/block/BlockFarmland.java +@@ -90,7 +90,7 @@ + private boolean hasCrops(World worldIn, BlockPos pos) + { + Block block = worldIn.getBlockState(pos.up()).getBlock(); +- return block instanceof BlockCrops || block instanceof BlockStem; ++ return block instanceof net.minecraftforge.common.IPlantable && canSustainPlant(worldIn, pos, net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)block); + } + + private boolean hasWater(World worldIn, BlockPos pos) diff --git a/patches/minecraft/net/minecraft/block/BlockFire.java.patch b/patches/minecraft/net/minecraft/block/BlockFire.java.patch new file mode 100644 index 000000000..3c4a9fb05 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockFire.java.patch @@ -0,0 +1,211 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockFire.java ++++ ../src-work/minecraft/net/minecraft/block/BlockFire.java +@@ -42,18 +42,24 @@ + int j = pos.getY(); + int k = pos.getZ(); + +- if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down())) ++ if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP)) + { + boolean flag = (i + j + k & 1) == 1; + boolean flag1 = (i / 2 + j / 2 + k / 2 & 1) == 1; + int l = 0; + +- if (this.canCatchFire(worldIn, pos.up())) ++ if (this.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN)) + { + l = flag ? 1 : 2; + } + +- return state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west()))).withProperty(UPPER, Integer.valueOf(l)).withProperty(FLIP, Boolean.valueOf(flag1)).withProperty(ALT, Boolean.valueOf(flag)); ++ return state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH))) ++ .withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east(), EnumFacing.EAST ))) ++ .withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH))) ++ .withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west(), EnumFacing.EAST ))) ++ .withProperty(UPPER, Integer.valueOf(l)) ++ .withProperty(FLIP, Boolean.valueOf(flag1)) ++ .withProperty(ALT, Boolean.valueOf(flag)); + } + else + { +@@ -109,6 +115,7 @@ + + public void setFireInfo(Block blockIn, int encouragement, int flammability) + { ++ if (blockIn == Blocks.air) throw new IllegalArgumentException("Tried to set air on fire... This is bad."); + this.encouragements.put(blockIn, Integer.valueOf(encouragement)); + this.flammabilities.put(blockIn, Integer.valueOf(flammability)); + } +@@ -148,13 +155,8 @@ + } + + Block block = worldIn.getBlockState(pos.down()).getBlock(); +- boolean flag = block == Blocks.netherrack; ++ boolean flag = block.isFireSource(worldIn, pos.down(), EnumFacing.UP); + +- if (worldIn.provider instanceof WorldProviderEnd && block == Blocks.bedrock) +- { +- flag = true; +- } +- + if (!flag && worldIn.isRaining() && this.canDie(worldIn, pos)) + { + worldIn.setBlockToAir(pos); +@@ -183,7 +185,7 @@ + return; + } + +- if (!this.canCatchFire(worldIn, pos.down()) && i == 15 && rand.nextInt(4) == 0) ++ if (!this.canCatchFire(worldIn, pos.down(), EnumFacing.UP) && i == 15 && rand.nextInt(4) == 0) + { + worldIn.setBlockToAir(pos); + return; +@@ -198,12 +200,12 @@ + j = -50; + } + +- this.catchOnFire(worldIn, pos.east(), 300 + j, rand, i); +- this.catchOnFire(worldIn, pos.west(), 300 + j, rand, i); +- this.catchOnFire(worldIn, pos.down(), 250 + j, rand, i); +- this.catchOnFire(worldIn, pos.up(), 250 + j, rand, i); +- this.catchOnFire(worldIn, pos.north(), 300 + j, rand, i); +- this.catchOnFire(worldIn, pos.south(), 300 + j, rand, i); ++ this.tryCatchFire(worldIn, pos.east(), 300 + j, rand, i, EnumFacing.WEST); ++ this.tryCatchFire(worldIn, pos.west(), 300 + j, rand, i, EnumFacing.EAST); ++ this.tryCatchFire(worldIn, pos.down(), 250 + j, rand, i, EnumFacing.UP); ++ this.tryCatchFire(worldIn, pos.up(), 250 + j, rand, i, EnumFacing.DOWN); ++ this.tryCatchFire(worldIn, pos.north(), 300 + j, rand, i, EnumFacing.SOUTH); ++ this.tryCatchFire(worldIn, pos.south(), 300 + j, rand, i, EnumFacing.NORTH); + + for (int k = -1; k <= 1; ++k) + { +@@ -262,22 +264,30 @@ + return false; + } + ++ @Deprecated // Use Block.getFlammability + public int getFlammability(Block blockIn) + { + Integer integer = (Integer)this.flammabilities.get(blockIn); + return integer == null ? 0 : integer.intValue(); + } + ++ @Deprecated // Use Block.getFlammability + public int getEncouragement(Block blockIn) + { + Integer integer = (Integer)this.encouragements.get(blockIn); + return integer == null ? 0 : integer.intValue(); + } + ++ @Deprecated // Use tryCatchFire with face below + private void catchOnFire(World worldIn, BlockPos pos, int chance, Random random, int age) + { +- int i = this.getFlammability(worldIn.getBlockState(pos).getBlock()); ++ this.tryCatchFire(worldIn, pos, chance, random, age, EnumFacing.UP); ++ } + ++ private void tryCatchFire(World worldIn, BlockPos pos, int chance, Random random, int age, EnumFacing face) ++ { ++ int i = worldIn.getBlockState(pos).getBlock().getFlammability(worldIn, pos, face); ++ + if (random.nextInt(chance) < i) + { + IBlockState iblockstate = worldIn.getBlockState(pos); +@@ -309,7 +319,7 @@ + { + for (EnumFacing enumfacing : EnumFacing.values()) + { +- if (this.canCatchFire(worldIn, pos.offset(enumfacing))) ++ if (this.canCatchFire(worldIn, pos.offset(enumfacing), enumfacing.getOpposite())) + { + return true; + } +@@ -330,7 +340,7 @@ + + for (EnumFacing enumfacing : EnumFacing.values()) + { +- i = Math.max(this.getEncouragement(worldIn.getBlockState(pos.offset(enumfacing)).getBlock()), i); ++ i = Math.max(worldIn.getBlockState(pos.offset(enumfacing)).getBlock().getFlammability(worldIn, pos.offset(enumfacing), enumfacing.getOpposite()), i); + } + + return i; +@@ -342,9 +352,10 @@ + return false; + } + ++ @Deprecated // Use canCatchFire with face sensitive version below + public boolean canCatchFire(IBlockAccess worldIn, BlockPos pos) + { +- return this.getEncouragement(worldIn.getBlockState(pos).getBlock()) > 0; ++ return canCatchFire(worldIn, pos, EnumFacing.UP); + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) +@@ -383,9 +394,9 @@ + worldIn.playSound((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), "fire.fire", 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F, false); + } + +- if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down())) ++ if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP)) + { +- if (Blocks.fire.canCatchFire(worldIn, pos.west())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.west(), EnumFacing.EAST)) + { + for (int j = 0; j < 2; ++j) + { +@@ -396,7 +407,7 @@ + } + } + +- if (Blocks.fire.canCatchFire(worldIn, pos.east())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.east(), EnumFacing.WEST)) + { + for (int k = 0; k < 2; ++k) + { +@@ -407,7 +418,7 @@ + } + } + +- if (Blocks.fire.canCatchFire(worldIn, pos.north())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH)) + { + for (int l = 0; l < 2; ++l) + { +@@ -418,7 +429,7 @@ + } + } + +- if (Blocks.fire.canCatchFire(worldIn, pos.south())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH)) + { + for (int i1 = 0; i1 < 2; ++i1) + { +@@ -429,7 +440,7 @@ + } + } + +- if (Blocks.fire.canCatchFire(worldIn, pos.up())) ++ if (Blocks.fire.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN)) + { + for (int j1 = 0; j1 < 2; ++j1) + { +@@ -477,4 +488,19 @@ + { + return new BlockState(this, new IProperty[] {AGE, NORTH, EAST, SOUTH, WEST, UPPER, FLIP, ALT}); + } ++ ++ /*================================= Forge Start ======================================*/ ++ /** ++ * Side sensitive version that calls the block function. ++ * ++ * @param world The current world ++ * @param pos Block position ++ * @param face The side the fire is coming from ++ * @return True if the face can catch fire. ++ */ ++ public boolean canCatchFire(IBlockAccess world, BlockPos pos, EnumFacing face) ++ { ++ return world.getBlockState(pos).getBlock().isFlammable(world, pos, face); ++ } ++ /*================================= Forge Start ======================================*/ + } diff --git a/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch b/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch new file mode 100644 index 000000000..faca3a6d8 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch @@ -0,0 +1,48 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockFlowerPot.java ++++ ../src-work/minecraft/net/minecraft/block/BlockFlowerPot.java +@@ -170,13 +170,6 @@ + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { +- TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos); +- +- if (tileentityflowerpot != null && tileentityflowerpot.getFlowerPotItem() != null) +- { +- spawnAsEntity(worldIn, pos, new ItemStack(tileentityflowerpot.getFlowerPotItem(), 1, tileentityflowerpot.getFlowerPotData())); +- } +- + super.breakBlock(worldIn, pos, state); + } + +@@ -396,6 +389,31 @@ + return EnumWorldBlockLayer.CUTOUT; + } + ++ ++ /*============================FORGE START=====================================*/ ++ @Override ++ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List ret = super.getDrops(world, pos, state, fortune); ++ TileEntityFlowerPot te = world.getTileEntity(pos) instanceof TileEntityFlowerPot ? (TileEntityFlowerPot)world.getTileEntity(pos) : null; ++ if (te != null && te.getFlowerPotItem() != null) ++ ret.add(new ItemStack(te.getFlowerPotItem(), 1, te.getFlowerPotData())); ++ return ret; ++ } ++ @Override ++ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) ++ { ++ if (willHarvest) return true; //If it will harvest, delay deletion of the block until after getDrops ++ return super.removedByPlayer(world, pos, player, willHarvest); ++ } ++ @Override ++ public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) ++ { ++ super.harvestBlock(world, player, pos, state, te); ++ world.setBlockToAir(pos); ++ } ++ /*===========================FORGE END==========================================*/ ++ + public static enum EnumFlowerType implements IStringSerializable + { + EMPTY("empty"), diff --git a/patches/minecraft/net/minecraft/block/BlockGrass.java.patch b/patches/minecraft/net/minecraft/block/BlockGrass.java.patch new file mode 100644 index 000000000..632b06303 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockGrass.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockGrass.java ++++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java +@@ -59,7 +59,7 @@ + { + if (!worldIn.isRemote) + { +- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2) ++ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity(worldIn, pos.up()) > 2) + { + worldIn.setBlockState(pos, Blocks.dirt.getDefaultState()); + } +@@ -73,7 +73,7 @@ + Block block = worldIn.getBlockState(blockpos.up()).getBlock(); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + +- if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) ++ if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity(worldIn, blockpos.up()) <= 2) + { + worldIn.setBlockState(blockpos, Blocks.grass.getDefaultState()); + } +@@ -111,7 +111,7 @@ + { + if (j >= i / 16) + { +- if (worldIn.getBlockState(blockpos1).getBlock().blockMaterial == Material.air) ++ if (worldIn.isAirBlock(blockpos1)) + { + if (rand.nextInt(8) == 0) + { diff --git a/patches/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch b/patches/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch new file mode 100644 index 000000000..4e6db9303 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch @@ -0,0 +1,23 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockHugeMushroom.java ++++ ../src-work/minecraft/net/minecraft/block/BlockHugeMushroom.java +@@ -80,6 +80,20 @@ + return new BlockState(this, new IProperty[] {VARIANT}); + } + ++ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) ++ { ++ IBlockState state = world.getBlockState(pos); ++ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ { ++ if (prop.getName().equals("variant")) ++ { ++ world.setBlockState(pos, state.cycleProperty(prop)); ++ return true; ++ } ++ } ++ return false; ++ } ++ + public static enum EnumType implements IStringSerializable + { + NORTH_WEST(1, "north_west"), diff --git a/patches/minecraft/net/minecraft/block/BlockIce.java.patch b/patches/minecraft/net/minecraft/block/BlockIce.java.patch new file mode 100644 index 000000000..ebd4a9f12 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockIce.java.patch @@ -0,0 +1,35 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockIce.java ++++ ../src-work/minecraft/net/minecraft/block/BlockIce.java +@@ -40,14 +40,17 @@ + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); + player.addExhaustion(0.025F); + +- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) ++ if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player)) + { ++ java.util.List items = new java.util.ArrayList(); + ItemStack itemstack = this.createStackedBlock(state); + +- if (itemstack != null) +- { +- spawnAsEntity(worldIn, pos, itemstack); +- } ++ if (itemstack != null) items.add(itemstack); ++ ++ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, worldIn.getBlockState(pos), 0, 1.0f, true, player); ++ ++ for (ItemStack is : items) ++ spawnAsEntity(worldIn, pos, is); + } + else + { +@@ -58,7 +61,9 @@ + } + + int i = EnchantmentHelper.getFortuneModifier(player); ++ harvesters.set(player); + this.dropBlockAsItem(worldIn, pos, state, i); ++ harvesters.set(null); + Material material = worldIn.getBlockState(pos.down()).getBlock().getMaterial(); + + if (material.blocksMovement() || material.isLiquid()) diff --git a/patches/minecraft/net/minecraft/block/BlockLadder.java.patch b/patches/minecraft/net/minecraft/block/BlockLadder.java.patch new file mode 100644 index 000000000..629520652 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockLadder.java.patch @@ -0,0 +1,30 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockLadder.java ++++ ../src-work/minecraft/net/minecraft/block/BlockLadder.java +@@ -79,7 +79,10 @@ + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return worldIn.getBlockState(pos.west()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.east()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.north()).getBlock().isNormalCube() ? true : worldIn.getBlockState(pos.south()).getBlock().isNormalCube())); ++ return worldIn.isSideSolid(pos.west(), EnumFacing.EAST, true) || ++ worldIn.isSideSolid(pos.east(), EnumFacing.WEST, true) || ++ worldIn.isSideSolid(pos.north(), EnumFacing.SOUTH, true) || ++ worldIn.isSideSolid(pos.south(), EnumFacing.NORTH, true); + } + + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) +@@ -117,7 +120,7 @@ + + protected boolean canBlockStay(World worldIn, BlockPos pos, EnumFacing facing) + { +- return worldIn.getBlockState(pos.offset(facing.getOpposite())).getBlock().isNormalCube(); ++ return worldIn.isSideSolid(pos.offset(facing.getOpposite()), facing, true); + } + + public IBlockState getStateFromMeta(int meta) +@@ -147,4 +150,6 @@ + { + return new BlockState(this, new IProperty[] {FACING}); + } ++ ++ @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; } + } diff --git a/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch b/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch new file mode 100644 index 000000000..c1ec1e2ef --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch @@ -0,0 +1,126 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java ++++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java +@@ -18,7 +18,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public abstract class BlockLeaves extends BlockLeavesBase ++public abstract class BlockLeaves extends BlockLeavesBase implements net.minecraftforge.common.IShearable + { + public static final PropertyBool DECAYABLE = PropertyBool.create("decayable"); + public static final PropertyBool CHECK_DECAY = PropertyBool.create("check_decay"); +@@ -76,9 +76,9 @@ + BlockPos blockpos = pos.add(j1, k1, l1); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + +- if (iblockstate.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate.getValue(CHECK_DECAY)).booleanValue()) ++ if (iblockstate.getBlock().isLeaves(worldIn, blockpos)) + { +- worldIn.setBlockState(blockpos, iblockstate.withProperty(CHECK_DECAY, Boolean.valueOf(true)), 4); ++ iblockstate.getBlock().beginLeavesDecay(worldIn, blockpos); + } + } + } +@@ -118,9 +118,9 @@ + { + Block block = worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2)).getBlock(); + +- if (block != Blocks.log && block != Blocks.log2) ++ if (!block.canSustainLeaves(worldIn, blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2))) + { +- if (block.getMaterial() == Material.leaves) ++ if (block.isLeaves(worldIn, blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2))) + { + this.surroundings[(i2 + l1) * k1 + (j2 + l1) * j1 + k2 + l1] = -2; + } +@@ -227,40 +227,7 @@ + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { +- if (!worldIn.isRemote) +- { +- int i = this.getSaplingDropChance(state); +- +- if (fortune > 0) +- { +- i -= 2 << fortune; +- +- if (i < 10) +- { +- i = 10; +- } +- } +- +- if (worldIn.rand.nextInt(i) == 0) +- { +- Item item = this.getItemDropped(state, worldIn.rand, fortune); +- spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); +- } +- +- i = 200; +- +- if (fortune > 0) +- { +- i -= 10 << fortune; +- +- if (i < 40) +- { +- i = 40; +- } +- } +- +- this.dropApple(worldIn, pos, state, i); +- } ++ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + } + + protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance) +@@ -297,4 +264,48 @@ + } + + public abstract BlockPlanks.EnumType getWoodType(int meta); ++ ++ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } ++ @Override public boolean isLeaves(IBlockAccess world, BlockPos pos){ return true; } ++ ++ @Override ++ public void beginLeavesDecay(World world, BlockPos pos) ++ { ++ IBlockState state = world.getBlockState(pos); ++ if (!(Boolean)state.getValue(CHECK_DECAY)) ++ { ++ world.setBlockState(pos, state.withProperty(CHECK_DECAY, true), 4); ++ } ++ } ++ ++ @Override ++ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List ret = new java.util.ArrayList(); ++ Random rand = world instanceof World ? ((World)world).rand : new Random(); ++ int chance = this.getSaplingDropChance(state); ++ ++ if (fortune > 0) ++ { ++ chance -= 2 << fortune; ++ if (chance < 10) chance = 10; ++ } ++ ++ if (rand.nextInt(chance) == 0) ++ ret.add(new ItemStack(getItemDropped(state, rand, fortune), 1, damageDropped(state))); ++ ++ chance = 200; ++ if (fortune > 0) ++ { ++ chance -= 10 << fortune; ++ if (chance < 40) chance = 40; ++ } ++ ++ this.captureDrops(true); ++ if (world instanceof World) ++ this.dropApple((World)world, pos, state, chance); // Dammet mojang ++ ret.addAll(this.captureDrops(false)); ++ return ret; ++ } ++ + } diff --git a/patches/minecraft/net/minecraft/block/BlockLever.java.patch b/patches/minecraft/net/minecraft/block/BlockLever.java.patch new file mode 100644 index 000000000..bd6ae7dcf --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockLever.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockLever.java ++++ ../src-work/minecraft/net/minecraft/block/BlockLever.java +@@ -238,6 +238,12 @@ + return new BlockState(this, new IProperty[] {FACING, POWERED}); + } + ++ ++ private boolean canAttach(World world, BlockPos pos, EnumFacing side) ++ { ++ return world.isSideSolid(pos, side); ++ } ++ + public static enum EnumOrientation implements IStringSerializable + { + DOWN_X(0, "down_x", EnumFacing.DOWN), diff --git a/patches/minecraft/net/minecraft/block/BlockLog.java.patch b/patches/minecraft/net/minecraft/block/BlockLog.java.patch new file mode 100644 index 000000000..fff237c53 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockLog.java.patch @@ -0,0 +1,24 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockLog.java ++++ ../src-work/minecraft/net/minecraft/block/BlockLog.java +@@ -34,9 +34,9 @@ + { + IBlockState iblockstate = worldIn.getBlockState(blockpos); + +- if (iblockstate.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate.getValue(BlockLeaves.CHECK_DECAY)).booleanValue()) ++ if (iblockstate.getBlock().isLeaves(worldIn, blockpos)) + { +- worldIn.setBlockState(blockpos, iblockstate.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(true)), 4); ++ iblockstate.getBlock().beginLeavesDecay(worldIn, blockpos); + } + } + } +@@ -47,6 +47,9 @@ + return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(LOG_AXIS, BlockLog.EnumAxis.fromFacingAxis(facing.getAxis())); + } + ++ @Override public boolean canSustainLeaves(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } ++ @Override public boolean isWood(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } ++ + public static enum EnumAxis implements IStringSerializable + { + X("x"), diff --git a/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch b/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch new file mode 100644 index 000000000..c9b7f08e8 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockMobSpawner.java ++++ ../src-work/minecraft/net/minecraft/block/BlockMobSpawner.java +@@ -39,10 +39,14 @@ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); +- int i = 15 + worldIn.rand.nextInt(15) + worldIn.rand.nextInt(15); +- this.dropXpOnBlockBreak(worldIn, pos, i); + } + ++ @Override ++ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15); ++ } ++ + public boolean isOpaqueCube() + { + return false; diff --git a/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch b/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch new file mode 100644 index 000000000..2937e59ae --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java ++++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java +@@ -73,7 +73,7 @@ + if (pos.getY() >= 0 && pos.getY() < 256) + { + IBlockState iblockstate = worldIn.getBlockState(pos.down()); +- return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.canPlaceBlockOn(iblockstate.getBlock())); ++ return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && iblockstate.getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this)); + } + else + { diff --git a/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch b/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch new file mode 100644 index 000000000..a22a27a48 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockMycelium.java ++++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java +@@ -40,7 +40,7 @@ + { + if (!worldIn.isRemote) + { +- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2) ++ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity(worldIn, pos.up()) > 2) + { + worldIn.setBlockState(pos, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); + } +@@ -54,7 +54,7 @@ + IBlockState iblockstate = worldIn.getBlockState(blockpos); + Block block = worldIn.getBlockState(blockpos.up()).getBlock(); + +- if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) ++ if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity(worldIn, blockpos.up()) <= 2) + { + worldIn.setBlockState(blockpos, this.getDefaultState()); + } diff --git a/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch b/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch new file mode 100644 index 000000000..f036a71f5 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch @@ -0,0 +1,49 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java ++++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java +@@ -39,7 +39,7 @@ + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { +- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ return super.canBlockStay(worldIn, pos, state); + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) +@@ -55,9 +55,11 @@ + super.updateTick(worldIn, pos, state, rand); + } + ++ @SuppressWarnings("unused") + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { +- if (!worldIn.isRemote) ++ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); ++ if (false && !worldIn.isRemote) + { + int i = 1; + +@@ -108,4 +110,24 @@ + { + return new BlockState(this, new IProperty[] {AGE}); + } ++ ++ @Override ++ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List ret = new java.util.ArrayList(); ++ Random rand = world instanceof World ? ((World)world).rand : new Random(); ++ int count = 1; ++ ++ if (((Integer)state.getValue(AGE)) >= 3) ++ { ++ count = 2 + rand.nextInt(3) + (fortune > 0 ? rand.nextInt(fortune + 1) : 0); ++ } ++ ++ for (int i = 0; i < count; i++) ++ { ++ ret.add(new ItemStack(Items.nether_wart)); ++ } ++ ++ return ret; ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch b/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch new file mode 100644 index 000000000..57523ab34 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch @@ -0,0 +1,24 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockNewLeaf.java ++++ ../src-work/minecraft/net/minecraft/block/BlockNewLeaf.java +@@ -101,14 +101,15 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4)); +- } +- else +- { + super.harvestBlock(worldIn, player, pos, state, te); + } + } ++ ++ @Override ++ public List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ IBlockState state = world.getBlockState(pos); ++ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4))); ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockNote.java.patch b/patches/minecraft/net/minecraft/block/BlockNote.java.patch new file mode 100644 index 000000000..fa6a2e571 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockNote.java.patch @@ -0,0 +1,23 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockNote.java ++++ ../src-work/minecraft/net/minecraft/block/BlockNote.java +@@ -59,7 +59,9 @@ + if (tileentity instanceof TileEntityNote) + { + TileEntityNote tileentitynote = (TileEntityNote)tileentity; ++ int old = tileentitynote.note; + tileentitynote.changePitch(); ++ if (old == tileentitynote.note) return false; + tileentitynote.triggerNote(worldIn, pos); + playerIn.triggerAchievement(StatList.field_181735_S); + } +@@ -99,6 +101,10 @@ + + public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam) + { ++ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(worldIn, pos, state, eventParam, eventID); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e)) return false; ++ eventID = e.instrument.ordinal(); ++ eventParam = e.getVanillaNoteId(); + float f = (float)Math.pow(2.0D, (double)(eventParam - 12) / 12.0D); + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "note." + this.getInstrument(eventID), 3.0F, f); + worldIn.spawnParticle(EnumParticleTypes.NOTE, (double)pos.getX() + 0.5D, (double)pos.getY() + 1.2D, (double)pos.getZ() + 0.5D, (double)eventParam / 24.0D, 0.0D, 0.0D, new int[0]); diff --git a/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch b/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch new file mode 100644 index 000000000..e1640524f --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch @@ -0,0 +1,21 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockOldLeaf.java ++++ ../src-work/minecraft/net/minecraft/block/BlockOldLeaf.java +@@ -144,11 +144,17 @@ + if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata())); + } + else + { + super.harvestBlock(worldIn, player, pos, state, te); + } + } ++ ++ @Override ++ public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) ++ { ++ IBlockState state = world.getBlockState(pos); ++ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata()))); ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockPane.java.patch b/patches/minecraft/net/minecraft/block/BlockPane.java.patch new file mode 100644 index 000000000..bbfc1846f --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockPane.java.patch @@ -0,0 +1,41 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockPane.java ++++ ../src-work/minecraft/net/minecraft/block/BlockPane.java +@@ -39,7 +39,10 @@ + + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { +- return state.withProperty(NORTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.north()).getBlock()))).withProperty(SOUTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.south()).getBlock()))).withProperty(WEST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.west()).getBlock()))).withProperty(EAST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.east()).getBlock()))); ++ return state.withProperty(NORTH, canPaneConnectTo(worldIn, pos, EnumFacing.NORTH)) ++ .withProperty(SOUTH, canPaneConnectTo(worldIn, pos, EnumFacing.SOUTH)) ++ .withProperty(WEST, canPaneConnectTo(worldIn, pos, EnumFacing.WEST)) ++ .withProperty(EAST, canPaneConnectTo(worldIn, pos, EnumFacing.EAST)); + } + + public Item getItemDropped(IBlockState state, Random rand, int fortune) +@@ -65,10 +68,10 @@ + + public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) + { +- boolean flag = this.canPaneConnectToBlock(worldIn.getBlockState(pos.north()).getBlock()); +- boolean flag1 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.south()).getBlock()); +- boolean flag2 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.west()).getBlock()); +- boolean flag3 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.east()).getBlock()); ++ boolean flag = this.canPaneConnectTo(worldIn, pos, EnumFacing.NORTH); ++ boolean flag1 = this.canPaneConnectTo(worldIn, pos, EnumFacing.SOUTH); ++ boolean flag2 = this.canPaneConnectTo(worldIn, pos, EnumFacing.WEST); ++ boolean flag3 = this.canPaneConnectTo(worldIn, pos, EnumFacing.EAST); + + if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) + { +@@ -187,4 +190,11 @@ + { + return new BlockState(this, new IProperty[] {NORTH, EAST, WEST, SOUTH}); + } ++ ++ public boolean canPaneConnectTo(IBlockAccess world, BlockPos pos, EnumFacing dir) ++ { ++ BlockPos off = pos.offset(dir); ++ Block block = world.getBlockState(off).getBlock(); ++ return canPaneConnectToBlock(block) || block.isSideSolid(world, off, dir.getOpposite()); ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch b/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch new file mode 100644 index 000000000..5d7960d10 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java ++++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java +@@ -190,7 +190,7 @@ + } + } + +- if (!flag1 && block.getMaterial() != Material.air && canPush(block, worldIn, blockpos, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) ++ if (!flag1 && !block.isAir(worldIn, blockpos) && canPush(block, worldIn, blockpos, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) + { + this.doMove(worldIn, pos, enumfacing, false); + } +@@ -334,7 +334,7 @@ + return false; + } + +- return !(blockIn instanceof ITileEntityProvider); ++ return !(blockIn.hasTileEntity(worldIn.getBlockState(pos))); + } + else + { +@@ -372,7 +372,9 @@ + { + BlockPos blockpos = (BlockPos)list1.get(j); + Block block = worldIn.getBlockState(blockpos).getBlock(); +- block.dropBlockAsItem(worldIn, blockpos, worldIn.getBlockState(blockpos), 0); ++ //With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. ++ float chance = block instanceof BlockSnow ? -1.0f : 1.0f; ++ block.dropBlockAsItemWithChance(worldIn, blockpos, worldIn.getBlockState(blockpos), chance, 0); + worldIn.setBlockToAir(blockpos); + --i; + ablock[i] = block; diff --git a/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch b/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch new file mode 100644 index 000000000..679a458ff --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch @@ -0,0 +1,37 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockPistonMoving.java ++++ ../src-work/minecraft/net/minecraft/block/BlockPistonMoving.java +@@ -110,16 +110,7 @@ + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { +- if (!worldIn.isRemote) +- { +- TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos); +- +- if (tileentitypiston != null) +- { +- IBlockState iblockstate = tileentitypiston.getPistonState(); +- iblockstate.getBlock().dropBlockAsItem(worldIn, pos, iblockstate, 0); +- } +- } ++ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + } + + public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) +@@ -283,4 +274,16 @@ + { + return new BlockState(this, new IProperty[] {FACING, TYPE}); + } ++ ++ @Override ++ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ TileEntityPiston tileentitypiston = this.getTileEntity(world, pos); ++ if (tileentitypiston != null) ++ { ++ IBlockState pushed = tileentitypiston.getPistonState(); ++ return pushed.getBlock().getDrops(world, pos, pushed, fortune); ++ } ++ return new java.util.ArrayList(); ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockPotato.java.patch b/patches/minecraft/net/minecraft/block/BlockPotato.java.patch new file mode 100644 index 000000000..afe064e2b --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockPotato.java.patch @@ -0,0 +1,25 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockPotato.java ++++ ../src-work/minecraft/net/minecraft/block/BlockPotato.java +@@ -24,13 +24,14 @@ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); +- +- if (!worldIn.isRemote) +- { +- if (((Integer)state.getValue(AGE)).intValue() >= 7 && worldIn.rand.nextInt(50) == 0) +- { +- spawnAsEntity(worldIn, pos, new ItemStack(Items.poisonous_potato)); +- } +- } + } ++ @Override ++ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List ret = super.getDrops(world, pos, state, fortune); ++ java.util.Random rand = world instanceof World ? ((World)world).rand : new java.util.Random(); ++ if (((Integer)state.getValue(AGE)) >= 7 && rand.nextInt(50) == 0) ++ ret.add(new ItemStack(Items.poisonous_potato)); ++ return ret; ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch b/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch new file mode 100644 index 000000000..3e5e60593 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockPumpkin.java ++++ ../src-work/minecraft/net/minecraft/block/BlockPumpkin.java +@@ -117,7 +117,7 @@ + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable() && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); ++ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); + } + + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) diff --git a/patches/minecraft/net/minecraft/block/BlockQuartz.java.patch b/patches/minecraft/net/minecraft/block/BlockQuartz.java.patch new file mode 100644 index 000000000..7c75b6cdc --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockQuartz.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockQuartz.java ++++ ../src-work/minecraft/net/minecraft/block/BlockQuartz.java +@@ -91,6 +91,26 @@ + return new BlockState(this, new IProperty[] {VARIANT}); + } + ++ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) ++ { ++ IBlockState state = world.getBlockState(pos); ++ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ { ++ if (prop.getName().equals("variant") && prop.getValueClass() == EnumType.class) ++ { ++ EnumType current = (EnumType)state.getValue(prop); ++ EnumType next = current == EnumType.LINES_X ? EnumType.LINES_Y : ++ current == EnumType.LINES_Y ? EnumType.LINES_Z : ++ current == EnumType.LINES_Z ? EnumType.LINES_X : current; ++ if (next == current) ++ return false; ++ world.setBlockState(pos, state.withProperty(prop, next)); ++ return true; ++ } ++ } ++ return false; ++ } ++ + public static enum EnumType implements IStringSerializable + { + DEFAULT(0, "default", "default"), diff --git a/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch b/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch new file mode 100644 index 000000000..800cc78f2 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch @@ -0,0 +1,147 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockRailBase.java ++++ ../src-work/minecraft/net/minecraft/block/BlockRailBase.java +@@ -32,7 +32,7 @@ + public static boolean isRailBlock(IBlockState state) + { + Block block = state.getBlock(); +- return block == Blocks.rail || block == Blocks.golden_rail || block == Blocks.detector_rail || block == Blocks.activator_rail; ++ return block instanceof BlockRailBase; + } + + protected BlockRailBase(boolean isPowered) +@@ -176,6 +176,81 @@ + + public abstract IProperty getShapeProperty(); + ++ /* ======================================== FORGE START =====================================*/ ++ /** ++ * Return true if the rail can make corners. ++ * Used by placement logic. ++ * @param world The world. ++ * @param pod Block's position in world ++ * @return True if the rail can make corners. ++ */ ++ public boolean isFlexibleRail(IBlockAccess world, BlockPos pos) ++ { ++ return !this.isPowered; ++ } ++ ++ /** ++ * Returns true if the rail can make up and down slopes. ++ * Used by placement logic. ++ * @param world The world. ++ * @param pod Block's position in world ++ * @return True if the rail can make slopes. ++ */ ++ public boolean canMakeSlopes(IBlockAccess world, BlockPos pos) ++ { ++ return true; ++ } ++ ++ /** ++ * Returns the max speed of the rail at the specified position. ++ * @param world The world. ++ * @param cart The cart on the rail, may be null. ++ * @param pod Block's position in world ++ * @return The max speed of the current rail. ++ */ ++ public float getRailMaxSpeed(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos) ++ { ++ return 0.4f; ++ } ++ ++ /** ++ * This function is called by any minecart that passes over this rail. ++ * It is called once per update tick that the minecart is on the rail. ++ * @param world The world. ++ * @param cart The cart on the rail. ++ * @param pod Block's position in world ++ */ ++ public void onMinecartPass(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos) ++ { ++ } ++ ++ /** ++ * Rotate the block. For vanilla blocks this rotates around the axis passed in (generally, it should be the "face" that was hit). ++ * Note: for mod blocks, this is up to the block and modder to decide. It is not mandated that it be a rotation around the ++ * face, but could be a rotation to orient *to* that face, or a visiting of possible rotations. ++ * The method should return true if the rotation was successful though. ++ * ++ * @param world The world ++ * @param pos Block position in world ++ * @param axis The axis to rotate around ++ * @return True if the rotation was successful, False if the rotation failed, or is not possible ++ */ ++ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) ++ { ++ IBlockState state = world.getBlockState(pos); ++ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ { ++ if (prop.getName().equals("shape")) ++ { ++ world.setBlockState(pos, state.cycleProperty(prop)); ++ return true; ++ } ++ } ++ return false; ++ } ++ ++ /* ======================================== FORGE END =====================================*/ ++ + public static enum EnumRailDirection implements IStringSerializable + { + NORTH_SOUTH(0, "north_south"), +@@ -248,6 +323,7 @@ + private final boolean isPowered; + private final List field_150657_g = Lists.newArrayList(); + private static final String __OBFID = "CL_00000196"; ++ private final boolean canMakeSlopes; + + public Rail(World worldIn, BlockPos pos, IBlockState state) + { +@@ -256,7 +332,8 @@ + this.state = state; + this.block = (BlockRailBase)state.getBlock(); + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(BlockRailBase.this.getShapeProperty()); +- this.isPowered = this.block.isPowered; ++ this.isPowered = !this.block.isFlexibleRail(worldIn, pos); ++ canMakeSlopes = this.block.canMakeSlopes(worldIn, pos); + this.func_180360_a(blockrailbase$enumraildirection); + } + +@@ -442,7 +519,7 @@ + } + } + +- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) ++ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) + { + if (BlockRailBase.isRailBlock(this.world, blockpos.up())) + { +@@ -455,7 +532,7 @@ + } + } + +- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) ++ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) + { + if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) + { +@@ -598,7 +675,7 @@ + } + } + +- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) ++ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) + { + if (BlockRailBase.isRailBlock(this.world, blockpos.up())) + { +@@ -611,7 +688,7 @@ + } + } + +- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) ++ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) + { + if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) + { diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch new file mode 100644 index 000000000..4ffa619b9 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch @@ -0,0 +1,24 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneComparator.java ++++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneComparator.java +@@ -297,6 +297,21 @@ + return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(POWERED, Boolean.valueOf(false)).withProperty(MODE, BlockRedstoneComparator.Mode.COMPARE); + } + ++ @Override ++ public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) ++ { ++ if (pos.getY() == neighbor.getY() && world instanceof World) ++ { ++ onNeighborBlockChange((World)world, pos, world.getBlockState(pos), world.getBlockState(neighbor).getBlock()); ++ } ++ } ++ ++ @Override ++ public boolean getWeakChanges(IBlockAccess world, BlockPos pos) ++ { ++ return true; ++ } ++ + public static enum Mode implements IStringSerializable + { + COMPARE("compare"), diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch new file mode 100644 index 000000000..28bdd60d7 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneDiode.java ++++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneDiode.java +@@ -199,6 +199,8 @@ + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + BlockPos blockpos = pos.offset(enumfacing.getOpposite()); ++ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldIn, pos, worldIn.getBlockState(pos), java.util.EnumSet.of(enumfacing.getOpposite())).isCanceled()) ++ return; + worldIn.notifyBlockOfStateChange(blockpos, this); + worldIn.notifyNeighborsOfStateExcept(blockpos, this, enumfacing); + } diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch new file mode 100644 index 000000000..8acd40ee8 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneOre.java ++++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneOre.java +@@ -92,12 +92,16 @@ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); ++ } + +- if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this)) ++ @Override ++ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ if (this.getItemDropped(world.getBlockState(pos), RANDOM, fortune) != Item.getItemFromBlock(this)) + { +- int i = 1 + worldIn.rand.nextInt(5); +- this.dropXpOnBlockBreak(worldIn, pos, i); ++ return 1 + RANDOM.nextInt(5); + } ++ return 0; + } + + @SideOnly(Side.CLIENT) diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch new file mode 100644 index 000000000..6cc29f813 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch @@ -0,0 +1,59 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java ++++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java +@@ -59,10 +59,10 @@ + BlockPos blockpos = pos.offset(direction); + Block block = worldIn.getBlockState(pos.offset(direction)).getBlock(); + +- if (!canConnectTo(worldIn.getBlockState(blockpos), direction) && (block.isSolidFullCube() || !canConnectUpwardsTo(worldIn.getBlockState(blockpos.down())))) ++ if (!canRestoneConnect(worldIn, blockpos, direction) && (block.isSolidFullCube() || !canRestoneConnect(worldIn, blockpos.down(), null))) + { + Block block1 = worldIn.getBlockState(pos.up()).getBlock(); +- return !block1.isSolidFullCube() && block.isSolidFullCube() && canConnectUpwardsTo(worldIn.getBlockState(blockpos.up())) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; ++ return !block1.isSolidFullCube() && block.isSolidFullCube() && canRestoneConnect(worldIn, blockpos.up(), null) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; + } + else + { +@@ -360,35 +360,24 @@ + Block block = iblockstate.getBlock(); + boolean flag = block.isNormalCube(); + boolean flag1 = worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); +- return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos.up()) ? true : (canConnectTo(iblockstate, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos.down()))); ++ return !flag1 && flag && canRestoneConnect(worldIn, blockpos.up(), null) ? true : (canRestoneConnect(worldIn, blockpos, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canRestoneConnect(worldIn, blockpos.down(), null))); + } + +- protected static boolean canConnectUpwardsTo(IBlockAccess worldIn, BlockPos pos) ++ protected static boolean canRestoneConnect(IBlockAccess world, BlockPos pos, EnumFacing side) + { +- return canConnectUpwardsTo(worldIn.getBlockState(pos)); +- } +- +- protected static boolean canConnectUpwardsTo(IBlockState state) +- { +- return canConnectTo(state, (EnumFacing)null); +- } +- +- protected static boolean canConnectTo(IBlockState blockState, EnumFacing side) +- { +- Block block = blockState.getBlock(); +- +- if (block == Blocks.redstone_wire) ++ IBlockState state = world.getBlockState(pos); ++ if (state.getBlock() == Blocks.redstone_wire) + { + return true; + } +- else if (Blocks.unpowered_repeater.isAssociated(block)) ++ else if (Blocks.unpowered_repeater.isAssociated(state.getBlock())) + { +- EnumFacing enumfacing = (EnumFacing)blockState.getValue(BlockRedstoneRepeater.FACING); +- return enumfacing == side || enumfacing.getOpposite() == side; ++ EnumFacing direction = (EnumFacing)state.getValue(BlockRedstoneRepeater.FACING); ++ return direction == side || direction.getOpposite() == side; + } + else + { +- return block.canProvidePower() && side != null; ++ return state.getBlock().canConnectRedstone(world, pos, side); + } + } + diff --git a/patches/minecraft/net/minecraft/block/BlockReed.java.patch b/patches/minecraft/net/minecraft/block/BlockReed.java.patch new file mode 100644 index 000000000..8c782fe46 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockReed.java.patch @@ -0,0 +1,35 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockReed.java ++++ ../src-work/minecraft/net/minecraft/block/BlockReed.java +@@ -18,7 +18,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public class BlockReed extends Block ++public class BlockReed extends Block implements net.minecraftforge.common.IPlantable + { + public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15); + private static final String __OBFID = "CL_00000300"; +@@ -66,6 +66,7 @@ + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + Block block = worldIn.getBlockState(pos.down()).getBlock(); ++ if (block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this)) return true; + + if (block == this) + { +@@ -165,4 +166,15 @@ + { + return new BlockState(this, new IProperty[] {AGE}); + } ++ ++ @Override ++ public net.minecraftforge.common.EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) ++ { ++ return net.minecraftforge.common.EnumPlantType.Beach; ++ } ++ @Override ++ public IBlockState getPlant(IBlockAccess world, BlockPos pos) ++ { ++ return this.getDefaultState(); ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch b/patches/minecraft/net/minecraft/block/BlockSapling.java.patch new file mode 100644 index 000000000..eb550d0a5 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockSapling.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockSapling.java ++++ ../src-work/minecraft/net/minecraft/block/BlockSapling.java +@@ -72,6 +72,7 @@ + + public void generateTree(World worldIn, BlockPos pos, IBlockState state, Random rand) + { ++ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(worldIn, rand, pos)) return; + WorldGenerator worldgenerator = (WorldGenerator)(rand.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true)); + int i = 0; + int j = 0; diff --git a/patches/minecraft/net/minecraft/block/BlockSkull.java.patch b/patches/minecraft/net/minecraft/block/BlockSkull.java.patch new file mode 100644 index 000000000..d53f00837 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockSkull.java.patch @@ -0,0 +1,57 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockSkull.java ++++ ../src-work/minecraft/net/minecraft/block/BlockSkull.java +@@ -123,10 +123,6 @@ + return tileentity instanceof TileEntitySkull ? ((TileEntitySkull)tileentity).getSkullType() : super.getDamageValue(worldIn, pos); + } + +- public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) +- { +- } +- + public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) + { + if (player.capabilities.isCreativeMode) +@@ -134,13 +130,18 @@ + state = state.withProperty(NODROP, Boolean.valueOf(true)); + worldIn.setBlockState(pos, state, 4); + } ++ this.dropBlockAsItem(worldIn, pos, state, 0); + + super.onBlockHarvested(worldIn, pos, state, player); + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { +- if (!worldIn.isRemote) ++ super.breakBlock(worldIn, pos, state); ++ } ++ public java.util.List getDrops(IBlockAccess worldIn, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List ret = new java.util.ArrayList(); + { + if (!((Boolean)state.getValue(NODROP)).booleanValue()) + { +@@ -149,7 +150,7 @@ + if (tileentity instanceof TileEntitySkull) + { + TileEntitySkull tileentityskull = (TileEntitySkull)tileentity; +- ItemStack itemstack = new ItemStack(Items.skull, 1, this.getDamageValue(worldIn, pos)); ++ ItemStack itemstack = new ItemStack(Items.skull, 1, tileentityskull.getSkullType()); + + if (tileentityskull.getSkullType() == 3 && tileentityskull.getPlayerProfile() != null) + { +@@ -159,12 +160,11 @@ + itemstack.getTagCompound().setTag("SkullOwner", nbttagcompound); + } + +- spawnAsEntity(worldIn, pos, itemstack); ++ ret.add(itemstack); + } + } +- +- super.breakBlock(worldIn, pos, state); + } ++ return ret; + } + + public Item getItemDropped(IBlockState state, Random rand, int fortune) diff --git a/patches/minecraft/net/minecraft/block/BlockSnow.java.patch b/patches/minecraft/net/minecraft/block/BlockSnow.java.patch new file mode 100644 index 000000000..a97fd2232 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockSnow.java.patch @@ -0,0 +1,53 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockSnow.java ++++ ../src-work/minecraft/net/minecraft/block/BlockSnow.java +@@ -80,7 +80,7 @@ + { + IBlockState iblockstate = worldIn.getBlockState(pos.down()); + Block block = iblockstate.getBlock(); +- return block != Blocks.ice && block != Blocks.packed_ice ? (block.getMaterial() == Material.leaves ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; ++ return block != Blocks.ice && block != Blocks.packed_ice ? (block.isLeaves(worldIn, pos.down()) ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() == 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; + } + + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) +@@ -92,7 +92,6 @@ + { + if (!this.canPlaceBlockAt(worldIn, p_176314_2_)) + { +- this.dropBlockAsItem(worldIn, p_176314_2_, p_176314_3_, 0); + worldIn.setBlockToAir(p_176314_2_); + return false; + } +@@ -104,9 +103,8 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- spawnAsEntity(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1, 0)); ++ super.harvestBlock(worldIn, player, pos, state, te); + worldIn.setBlockToAir(pos); +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); + } + + public Item getItemDropped(IBlockState state, Random rand, int fortune) +@@ -116,14 +114,13 @@ + + public int quantityDropped(Random random) + { +- return 0; ++ return 1; + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (worldIn.getLightFor(EnumSkyBlock.BLOCK, pos) > 11) + { +- this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0); + worldIn.setBlockToAir(pos); + } + } +@@ -153,4 +150,6 @@ + { + return new BlockState(this, new IProperty[] {LAYERS}); + } ++ ++ @Override public int quantityDropped(IBlockState state, int fortune, Random random){ return ((Integer)state.getValue(LAYERS)) + 1; } + } diff --git a/patches/minecraft/net/minecraft/block/BlockStem.java.patch b/patches/minecraft/net/minecraft/block/BlockStem.java.patch new file mode 100644 index 000000000..db0468600 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockStem.java.patch @@ -0,0 +1,42 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockStem.java ++++ ../src-work/minecraft/net/minecraft/block/BlockStem.java +@@ -96,7 +96,7 @@ + pos = pos.offset(EnumFacing.Plane.HORIZONTAL.random(rand)); + Block block = worldIn.getBlockState(pos.down()).getBlock(); + +- if (worldIn.getBlockState(pos).getBlock().blockMaterial == Material.air && (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass)) ++ if (worldIn.isAirBlock(pos) && (block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this) || block == Blocks.dirt || block == Blocks.grass)) + { + worldIn.setBlockState(pos, this.crop.getDefaultState()); + } +@@ -150,8 +150,12 @@ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); ++ } + +- if (!worldIn.isRemote) ++ @Override ++ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List ret = new java.util.ArrayList(); + { + Item item = this.getSeedItem(); + +@@ -161,13 +165,14 @@ + + for (int j = 0; j < 3; ++j) + { +- if (worldIn.rand.nextInt(15) <= i) ++ if (RANDOM.nextInt(15) <= i) + { +- spawnAsEntity(worldIn, pos, new ItemStack(item)); ++ ret.add(new ItemStack(item)); + } + } + } + } ++ return ret; + } + + protected Item getSeedItem() diff --git a/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch b/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch new file mode 100644 index 000000000..cd0915eb8 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch @@ -0,0 +1,66 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockTallGrass.java ++++ ../src-work/minecraft/net/minecraft/block/BlockTallGrass.java +@@ -23,7 +23,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public class BlockTallGrass extends BlockBush implements IGrowable ++public class BlockTallGrass extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable + { + public static final PropertyEnum TYPE = PropertyEnum.create("type", BlockTallGrass.EnumType.class); + private static final String __OBFID = "CL_00000321"; +@@ -44,7 +44,7 @@ + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { +- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); ++ return super.canBlockStay(worldIn, pos, state); + } + + public boolean isReplaceable(World worldIn, BlockPos pos) +@@ -54,7 +54,7 @@ + + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { +- return rand.nextInt(8) == 0 ? Items.wheat_seeds : null; ++ return null; + } + + public int quantityDroppedWithBonus(int fortune, Random random) +@@ -64,13 +64,7 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)state.getValue(TYPE)).getMeta())); +- } +- else +- { + super.harvestBlock(worldIn, player, pos, state, te); + } + } +@@ -206,4 +200,22 @@ + } + } + } ++ ++ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } ++ @Override ++ public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) ++ { ++ List ret = new java.util.ArrayList(); ++ ret.add(new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)world.getBlockState(pos).getValue(TYPE)).getMeta())); ++ return ret; ++ } ++ @Override ++ public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ List ret = new java.util.ArrayList(); ++ if (RANDOM.nextInt(8) != 0) return ret; ++ ItemStack seed = net.minecraftforge.common.ForgeHooks.getGrassSeed(RANDOM); ++ if (seed != null) ret.add(seed); ++ return ret; ++ } + } diff --git a/patches/minecraft/net/minecraft/block/BlockTorch.java.patch b/patches/minecraft/net/minecraft/block/BlockTorch.java.patch new file mode 100644 index 000000000..c0f92632d --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockTorch.java.patch @@ -0,0 +1,38 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockTorch.java ++++ ../src-work/minecraft/net/minecraft/block/BlockTorch.java +@@ -65,7 +65,7 @@ + else + { + Block block = worldIn.getBlockState(pos).getBlock(); +- return block instanceof BlockFence || block == Blocks.glass || block == Blocks.cobblestone_wall || block == Blocks.stained_glass; ++ return block.canPlaceTorchOnTop(worldIn, pos); + } + } + +@@ -86,7 +86,7 @@ + { + BlockPos blockpos = pos.offset(facing.getOpposite()); + boolean flag = facing.getAxis().isHorizontal(); +- return flag && worldIn.isBlockNormalCube(blockpos, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos); ++ return flag && worldIn.isSideSolid(blockpos, facing, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos); + } + + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) +@@ -99,7 +99,7 @@ + { + for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) + { +- if (worldIn.isBlockNormalCube(pos.offset(enumfacing.getOpposite()), true)) ++ if (worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) + { + return this.getDefaultState().withProperty(FACING, enumfacing); + } +@@ -132,7 +132,7 @@ + EnumFacing enumfacing1 = enumfacing.getOpposite(); + boolean flag = false; + +- if (enumfacing$axis.isHorizontal() && !worldIn.isBlockNormalCube(pos.offset(enumfacing1), true)) ++ if (enumfacing$axis.isHorizontal() && !worldIn.isSideSolid(pos.offset(enumfacing1), enumfacing1, true)) + { + flag = true; + } diff --git a/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch b/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch new file mode 100644 index 000000000..e2c0c7b52 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch @@ -0,0 +1,43 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockTrapDoor.java ++++ ../src-work/minecraft/net/minecraft/block/BlockTrapDoor.java +@@ -25,6 +25,8 @@ + + public class BlockTrapDoor extends Block + { ++ /** Set this to allow trapdoors to remain free-floating */ ++ public static boolean disableValidation = false; + public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); + public static final PropertyBool OPEN = PropertyBool.create("open"); + public static final PropertyEnum HALF = PropertyEnum.create("half", BlockTrapDoor.DoorHalf.class); +@@ -141,9 +143,10 @@ + { + if (!worldIn.isRemote) + { ++ EnumFacing direction = (EnumFacing)state.getValue(FACING); + BlockPos blockpos = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite()); + +- if (!isValidSupportBlock(worldIn.getBlockState(blockpos).getBlock())) ++ if (!(isValidSupportBlock(worldIn.getBlockState(blockpos).getBlock()) || worldIn.isSideSolid(blockpos, direction, true))) + { + worldIn.setBlockToAir(pos); + this.dropBlockAsItem(worldIn, pos, state, 0); +@@ -187,7 +190,10 @@ + + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + { +- return !side.getAxis().isVertical() && isValidSupportBlock(worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock()); ++ if (disableValidation) return true; ++ EnumFacing dir = side.getOpposite(); ++ pos = pos.offset(dir); ++ return !side.getAxis().isVertical() && (isValidSupportBlock(worldIn.getBlockState(pos).getBlock()) || worldIn.isSideSolid(pos, side, true)); + } + + protected static EnumFacing getFacing(int meta) +@@ -224,6 +230,7 @@ + + private static boolean isValidSupportBlock(Block blockIn) + { ++ if (disableValidation) return true; + return blockIn.blockMaterial.isOpaque() && blockIn.isFullCube() || blockIn == Blocks.glowstone || blockIn instanceof BlockSlab || blockIn instanceof BlockStairs; + } + diff --git a/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch b/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch new file mode 100644 index 000000000..9150d02c9 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch @@ -0,0 +1,28 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockTripWireHook.java ++++ ../src-work/minecraft/net/minecraft/block/BlockTripWireHook.java +@@ -59,14 +59,14 @@ + + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + { +- return side.getAxis().isHorizontal() && worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock().isNormalCube(); ++ return side.getAxis().isHorizontal() && worldIn.isSideSolid(pos.offset(side.getOpposite()), side, true); + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) + { +- if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock().isNormalCube()) ++ if (worldIn.isSideSolid(pos.offset(enumfacing), enumfacing.getOpposite(), true)) + { + return true; + } +@@ -100,7 +100,7 @@ + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + +- if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).getBlock().isNormalCube()) ++ if (!worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); diff --git a/patches/minecraft/net/minecraft/block/BlockVine.java.patch b/patches/minecraft/net/minecraft/block/BlockVine.java.patch new file mode 100644 index 000000000..8194f2b6c --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockVine.java.patch @@ -0,0 +1,40 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockVine.java ++++ ../src-work/minecraft/net/minecraft/block/BlockVine.java +@@ -25,7 +25,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public class BlockVine extends Block ++public class BlockVine extends Block implements net.minecraftforge.common.IShearable + { + public static final PropertyBool UP = PropertyBool.create("up"); + public static final PropertyBool NORTH = PropertyBool.create("north"); +@@ -388,13 +388,7 @@ + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { +- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { +- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.vine, 1, 0)); +- } +- else +- { + super.harvestBlock(worldIn, player, pos, state, te); + } + } +@@ -475,4 +469,14 @@ + + return i; + } ++ /*************************FORGE START***********************************/ ++ @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity){ return true; } ++ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } ++ @Override ++ public java.util.List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) ++ { ++ return java.util.Arrays.asList(new ItemStack(this, 1)); ++ } ++ /*************************FORGE END***********************************/ ++ + } diff --git a/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch b/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch new file mode 100644 index 000000000..aabc4ae42 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java ++++ ../src-work/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java +@@ -79,7 +79,7 @@ + { + Block block = this.world.getBlockState(origin).getBlock(); + +- if (block.getMaterial() == Material.air) ++ if (block.isAir(world, origin)) + { + return true; + } +@@ -110,7 +110,7 @@ + BlockPos blockpos = origin.offset(this.moveDirection.getOpposite(), i); + block = this.world.getBlockState(blockpos).getBlock(); + +- if (block.getMaterial() == Material.air || !BlockPistonBase.canPush(block, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos)) ++ if (block.isAir(world, blockpos)|| !BlockPistonBase.canPush(block, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos)) + { + break; + } +@@ -157,7 +157,7 @@ + + block = this.world.getBlockState(blockpos1).getBlock(); + +- if (block.getMaterial() == Material.air) ++ if (block.isAir(world, blockpos1)) + { + return true; + } diff --git a/patches/minecraft/net/minecraft/block/state/BlockState.java.patch b/patches/minecraft/net/minecraft/block/state/BlockState.java.patch new file mode 100644 index 000000000..e2a202b48 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/state/BlockState.java.patch @@ -0,0 +1,53 @@ +--- ../src-base/minecraft/net/minecraft/block/state/BlockState.java ++++ ../src-work/minecraft/net/minecraft/block/state/BlockState.java +@@ -40,6 +40,16 @@ + + public BlockState(Block blockIn, IProperty... properties) + { ++ this(blockIn, properties, null); ++ } ++ ++ protected StateImplementation createState(Block block, ImmutableMap properties, ImmutableMap unlistedProperties) ++ { ++ return new StateImplementation(block, properties); ++ } ++ ++ protected BlockState(Block blockIn, IProperty[] properties, ImmutableMap unlistedProperties) ++ { + this.block = blockIn; + Arrays.sort(properties, new Comparator() + { +@@ -56,7 +66,7 @@ + for (List list1 : Cartesian.cartesianProduct(this.getAllowedValues())) + { + Map map1 = MapPopulator.createMap(this.properties, list1); +- BlockState.StateImplementation blockstate$stateimplementation = new BlockState.StateImplementation(blockIn, ImmutableMap.copyOf(map1)); ++ BlockState.StateImplementation blockstate$stateimplementation = createState(blockIn, ImmutableMap.copyOf(map), unlistedProperties); + map.put(map1, blockstate$stateimplementation); + list.add(blockstate$stateimplementation); + } +@@ -136,6 +146,13 @@ + } + } + ++ protected StateImplementation(Block blockIn, ImmutableMap propertiesIn, ImmutableTable propertyValueTable) ++ { ++ this.block = blockIn; ++ this.properties = propertiesIn; ++ this.propertyValueTable = propertyValueTable; ++ } ++ + public , V extends T> IBlockState withProperty(IProperty property, V value) + { + if (!this.properties.containsKey(property)) +@@ -203,5 +220,10 @@ + map.put(property, value); + return map; + } ++ ++ public ImmutableTable getPropertyValueTable() ++ { ++ return propertyValueTable; ++ } + } + } diff --git a/patches/minecraft/net/minecraft/block/state/BlockStateBase.java.patch b/patches/minecraft/net/minecraft/block/state/BlockStateBase.java.patch new file mode 100644 index 000000000..1aa5874a5 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/state/BlockStateBase.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/block/state/BlockStateBase.java ++++ ../src-work/minecraft/net/minecraft/block/state/BlockStateBase.java +@@ -69,4 +69,9 @@ + + return stringbuilder.toString(); + } ++ ++ public com.google.common.collect.ImmutableTable getPropertyValueTable() ++ { ++ return null; ++ } + } diff --git a/patches/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch b/patches/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch new file mode 100644 index 000000000..d046aa4a5 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/ClientBrandRetriever.java ++++ ../src-work/minecraft/net/minecraft/client/ClientBrandRetriever.java +@@ -10,6 +10,6 @@ + + public static String getClientModName() + { +- return "vanilla"; ++ return net.minecraftforge.fml.common.FMLCommonHandler.instance().getModName(); + } + } diff --git a/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch b/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch new file mode 100644 index 000000000..7afa2924d --- /dev/null +++ b/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/client/LoadingScreenRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/LoadingScreenRenderer.java +@@ -140,6 +140,10 @@ + GlStateManager.clear(16640); + } + ++ try ++ { ++ if (!net.minecraftforge.fml.client.FMLClientHandler.instance().handleLoadingScreen(scaledresolution)) //FML Don't render while FML's pre-screen is rendering ++ { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + this.mc.getTextureManager().bindTexture(Gui.optionsBackground); diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch new file mode 100644 index 000000000..65b28301f --- /dev/null +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -0,0 +1,244 @@ +--- ../src-base/minecraft/net/minecraft/client/Minecraft.java ++++ ../src-work/minecraft/net/minecraft/client/Minecraft.java +@@ -302,7 +302,6 @@ + this.sessionService = (new YggdrasilAuthenticationService(gameConfig.userInfo.proxy, UUID.randomUUID().toString())).createMinecraftSessionService(); + this.session = gameConfig.userInfo.session; + logger.info("Setting user: " + this.session.getUsername()); +- logger.info("(Session ID is " + this.session.getSessionID() + ")"); + this.isDemo = gameConfig.gameInfo.isDemo; + this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1; + this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1; +@@ -416,10 +415,10 @@ + this.mcResourceManager = new SimpleReloadableResourceManager(this.metadataSerializer_); + this.mcLanguageManager = new LanguageManager(this.metadataSerializer_, this.gameSettings.language); + this.mcResourceManager.registerReloadListener(this.mcLanguageManager); +- this.refreshResources(); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().beginMinecraftLoading(this, this.defaultResourcePacks, this.mcResourceManager); + this.renderEngine = new TextureManager(this.mcResourceManager); + this.mcResourceManager.registerReloadListener(this.renderEngine); +- this.drawSplashScreen(this.renderEngine); ++ net.minecraftforge.fml.client.SplashProgress.drawVanillaScreen(this.renderEngine); + this.initStream(); + this.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService); + this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves")); +@@ -455,6 +454,8 @@ + } + }); + this.mouseHelper = new MouseHelper(); ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar= net.minecraftforge.fml.common.ProgressManager.push("Rendering Setup", 5, true); ++ bar.step("GL Setup"); + this.checkGLError("Pre startup"); + GlStateManager.enableTexture2D(); + GlStateManager.shadeModel(7425); +@@ -468,17 +469,21 @@ + GlStateManager.loadIdentity(); + GlStateManager.matrixMode(5888); + this.checkGLError("Startup"); +- this.textureMapBlocks = new TextureMap("textures"); ++ bar.step("Loading Texture Map"); ++ this.textureMapBlocks = new TextureMap("textures",true); + this.textureMapBlocks.setMipmapLevels(this.gameSettings.mipmapLevels); + this.renderEngine.loadTickableTexture(TextureMap.locationBlocksTexture, this.textureMapBlocks); + this.renderEngine.bindTexture(TextureMap.locationBlocksTexture); + this.textureMapBlocks.setBlurMipmapDirect(false, this.gameSettings.mipmapLevels > 0); ++ bar.step("Loading Model Manager"); + this.modelManager = new ModelManager(this.textureMapBlocks); + this.mcResourceManager.registerReloadListener(this.modelManager); ++ bar.step("Loading Item Renderer"); + this.renderItem = new RenderItem(this.renderEngine, this.modelManager); + this.renderManager = new RenderManager(this.renderEngine, this.renderItem); + this.itemRenderer = new ItemRenderer(this); + this.mcResourceManager.registerReloadListener(this.renderItem); ++ bar.step("Loading Entity Renderer"); + this.entityRenderer = new EntityRenderer(this, this.mcResourceManager); + this.mcResourceManager.registerReloadListener(this.entityRenderer); + this.blockRenderDispatcher = new BlockRendererDispatcher(this.modelManager.getBlockModelShapes(), this.gameSettings); +@@ -488,22 +493,25 @@ + this.guiAchievement = new GuiAchievement(this); + GlStateManager.viewport(0, 0, this.displayWidth, this.displayHeight); + this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine); ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().finishMinecraftLoading(); + this.checkGLError("Post startup"); +- this.ingameGUI = new GuiIngame(this); ++ this.ingameGUI = new net.minecraftforge.client.GuiIngameForge(this); + + if (this.serverName != null) + { +- this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort)); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServerAtStartup(this.serverName, this.serverPort); + } + else + { + this.displayGuiScreen(new GuiMainMenu()); + } + +- this.renderEngine.deleteTexture(this.mojangLogo); ++ net.minecraftforge.fml.client.SplashProgress.clearVanillaResources(renderEngine, mojangLogo); + this.mojangLogo = null; + this.loadingScreen = new LoadingScreenRenderer(this); + ++ net.minecraftforge.fml.client.FMLClientHandler.instance().onInitializationComplete(); + if (this.gameSettings.fullScreen && !this.fullscreen) + { + this.toggleFullscreen(); +@@ -684,21 +692,23 @@ + File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt"); + Bootstrap.printToSYSOUT(crashReportIn.getCompleteReport()); + ++ int retVal; + if (crashReportIn.getFile() != null) + { + Bootstrap.printToSYSOUT("#@!@# Game crashed! Crash report saved to: #@!@# " + crashReportIn.getFile()); +- System.exit(-1); ++ retVal = -1; + } + else if (crashReportIn.saveToFile(file2)) + { + Bootstrap.printToSYSOUT("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath()); +- System.exit(-1); ++ retVal = -1; + } + else + { + Bootstrap.printToSYSOUT("#@?@# Game crashed! Crash report could not be saved. #@?@#"); +- System.exit(-2); ++ retVal = -2; + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleExit(retVal); + } + + public boolean isUnicode() +@@ -886,11 +896,6 @@ + + public void displayGuiScreen(GuiScreen guiScreenIn) + { +- if (this.currentScreen != null) +- { +- this.currentScreen.onGuiClosed(); +- } +- + if (guiScreenIn == null && this.theWorld == null) + { + guiScreenIn = new GuiMainMenu(); +@@ -900,6 +905,17 @@ + guiScreenIn = new GuiGameOver(); + } + ++ GuiScreen old = this.currentScreen; ++ net.minecraftforge.client.event.GuiOpenEvent event = new net.minecraftforge.client.event.GuiOpenEvent(guiScreenIn); ++ ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; ++ ++ guiScreenIn = event.gui; ++ if (old != null && guiScreenIn != old) ++ { ++ old.onGuiClosed(); ++ } ++ + if (guiScreenIn instanceof GuiMainMenu) + { + this.gameSettings.showDebugInfo = false; +@@ -1380,7 +1396,7 @@ + + if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air && this.playerController.func_180512_c(blockpos, this.objectMouseOver.sideHit)) + { +- this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver.sideHit); ++ this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver); + this.thePlayer.swingItem(); + } + } +@@ -1601,6 +1617,8 @@ + --this.rightClickDelayTimer; + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreClientTick(); ++ + this.mcProfiler.startSection("gui"); + + if (!this.isGamePaused) +@@ -1750,6 +1768,7 @@ + this.currentScreen.handleMouseInput(); + } + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireMouseInput(); + } + + if (this.leftClickCounter > 0) +@@ -1928,6 +1947,7 @@ + } + } + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireKeyInput(); + } + + for (int l = 0; l < 9; ++l) +@@ -2124,12 +2144,15 @@ + this.myNetworkManager.processReceivedPackets(); + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostClientTick(); ++ + this.mcProfiler.endSection(); + this.systemTime = getSystemTime(); + } + + public void launchIntegratedServer(String folderName, String worldName, WorldSettings worldSettingsIn) + { ++ net.minecraftforge.fml.client.FMLClientHandler.instance().startIntegratedServer(folderName, worldName, worldSettingsIn); + this.loadWorld((WorldClient)null); + System.gc(); + ISaveHandler isavehandler = this.saveLoader.getSaveLoader(folderName, false); +@@ -2190,8 +2213,14 @@ + SocketAddress socketaddress = this.theIntegratedServer.getNetworkSystem().addLocalEndpoint(); + NetworkManager networkmanager = NetworkManager.provideLocalClient(socketaddress); + networkmanager.setNetHandler(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null)); +- networkmanager.sendPacket(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN)); +- networkmanager.sendPacket(new C00PacketLoginStart(this.getSession().getProfile())); ++ networkmanager.sendPacket(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN, true)); ++ com.mojang.authlib.GameProfile gameProfile = this.getSession().getProfile(); ++ if (!this.getSession().hasCachedProperties()) ++ { ++ gameProfile = sessionService.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974. ++ this.getSession().setProperties(gameProfile.getProperties()); ++ } ++ networkmanager.sendPacket(new C00PacketLoginStart(gameProfile)); + this.myNetworkManager = networkmanager; + } + +@@ -2202,6 +2231,8 @@ + + public void loadWorld(WorldClient worldClientIn, String loadingMessage) + { ++ if (theWorld != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(theWorld)); ++ + if (worldClientIn == null) + { + NetHandlerPlayClient nethandlerplayclient = this.getNetHandler(); +@@ -2215,6 +2246,18 @@ + { + this.theIntegratedServer.initiateShutdown(); + this.theIntegratedServer.setStaticInstance(); ++ if (loadingScreen != null) ++ { ++ this.loadingScreen.displayLoadingString(I18n.format("forge.client.shutdown.internal")); ++ } ++ while (!theIntegratedServer.isServerStopped()) ++ { ++ try ++ { ++ Thread.sleep(10); ++ } ++ catch (InterruptedException ie) {} ++ } + } + + this.theIntegratedServer = null; +@@ -2237,6 +2280,7 @@ + this.ingameGUI.func_181029_i(); + this.setServerData((ServerData)null); + this.integratedServerIsRunning = false; ++ net.minecraftforge.fml.client.FMLClientHandler.instance().handleClientWorldClosing(this.theWorld); + } + + this.mcSoundHandler.stopSounds(); diff --git a/patches/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch b/patches/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch new file mode 100644 index 000000000..fe5943864 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java ++++ ../src-work/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java +@@ -129,6 +129,6 @@ + f *= 1.0F - f1 * 0.15F; + } + +- return f; ++ return net.minecraftforge.client.ForgeHooksClient.getOffsetFOV(this, f); + } + } diff --git a/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch b/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch new file mode 100644 index 000000000..f3a13cdd9 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch @@ -0,0 +1,112 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/FontRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/gui/FontRenderer.java +@@ -58,7 +58,7 @@ + this.locationFontTexture = p_i1035_2_; + this.renderEngine = p_i1035_3_; + this.unicodeFlag = p_i1035_4_; +- p_i1035_3_.bindTexture(this.locationFontTexture); ++ bindTexture(this.locationFontTexture); + + for (int i = 0; i < 32; ++i) + { +@@ -98,6 +98,7 @@ + public void onResourceManagerReload(IResourceManager resourceManager) + { + this.readFontTexture(); ++ this.readGlyphSizes(); + } + + private void readFontTexture() +@@ -106,7 +107,7 @@ + + try + { +- bufferedimage = TextureUtil.readBufferedImage(Minecraft.getMinecraft().getResourceManager().getResource(this.locationFontTexture).getInputStream()); ++ bufferedimage = TextureUtil.readBufferedImage(getResourceInputStream(this.locationFontTexture)); + } + catch (IOException ioexception) + { +@@ -166,7 +167,7 @@ + + try + { +- inputstream = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("font/glyph_sizes.bin")).getInputStream(); ++ inputstream = getResourceInputStream(new ResourceLocation("font/glyph_sizes.bin")); + inputstream.read(this.glyphWidth); + } + catch (IOException ioexception) +@@ -225,7 +226,7 @@ + + private void loadGlyphTexture(int p_78257_1_) + { +- this.renderEngine.bindTexture(this.getUnicodePageLocation(p_78257_1_)); ++ bindTexture(this.getUnicodePageLocation(p_78257_1_)); + } + + protected float renderUnicodeChar(char p_78277_1_, boolean p_78277_2_) +@@ -272,7 +273,7 @@ + + public int drawString(String p_175065_1_, float p_175065_2_, float p_175065_3_, int p_175065_4_, boolean p_175065_5_) + { +- GlStateManager.enableAlpha(); ++ enableAlpha(); + this.resetStyles(); + int i; + +@@ -371,7 +372,7 @@ + this.strikethroughStyle = false; + this.underlineStyle = false; + this.italicStyle = false; +- GlStateManager.color(this.red, this.blue, this.green, this.alpha); ++ setColor(this.red, this.blue, this.green, this.alpha); + } + + ++i; +@@ -510,7 +511,7 @@ + this.blue = (float)(p_180455_4_ >> 8 & 255) / 255.0F; + this.green = (float)(p_180455_4_ & 255) / 255.0F; + this.alpha = (float)(p_180455_4_ >> 24 & 255) / 255.0F; +- GlStateManager.color(this.red, this.blue, this.green, this.alpha); ++ setColor(this.red, this.blue, this.green, this.alpha); + this.posX = p_180455_2_; + this.posY = p_180455_3_; + this.renderStringAtPos(p_180455_1_, p_180455_5_); +@@ -589,11 +590,6 @@ + int j = this.glyphWidth[p_78263_1_] >>> 4; + int k = this.glyphWidth[p_78263_1_] & 15; + +- if (k > 7) +- { +- k = 15; +- j = 0; +- } + + ++k; + return (k - j) / 2 + 1; +@@ -847,6 +843,26 @@ + return this.bidiFlag; + } + ++ protected void setColor(float r, float g, float b, float a) ++ { ++ GlStateManager.color(r,g,b,a); ++ } ++ ++ protected void enableAlpha() ++ { ++ GlStateManager.enableAlpha(); ++ } ++ ++ protected void bindTexture(ResourceLocation location) ++ { ++ renderEngine.bindTexture(location); ++ } ++ ++ protected InputStream getResourceInputStream(ResourceLocation location) throws IOException ++ { ++ return Minecraft.getMinecraft().getResourceManager().getResource(location).getInputStream(); ++ } ++ + public int getColorCode(char p_175064_1_) + { + return this.colorCode["0123456789abcdef".indexOf(p_175064_1_)]; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch new file mode 100644 index 000000000..b25e68b9a --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiButton.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiButton.java +@@ -22,6 +22,7 @@ + public boolean visible; + protected boolean hovered; + private static final String __OBFID = "CL_00000668"; ++ public int packedFGColour; //FML + + public GuiButton(int buttonId, int x, int y, String buttonText) + { diff --git a/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch new file mode 100644 index 000000000..fc3329929 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch @@ -0,0 +1,18 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiChat.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiChat.java +@@ -216,13 +216,14 @@ + this.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(stringbuilder.toString()), 1); + } + +- this.inputField.writeText((String)this.foundPlayerNames.get(this.autocompleteIndex++)); ++ this.inputField.writeText(net.minecraft.util.EnumChatFormatting.getTextWithoutFormattingCodes((String)this.foundPlayerNames.get(this.autocompleteIndex++))); + } + + private void sendAutocompleteRequest(String p_146405_1_, String p_146405_2_) + { + if (p_146405_1_.length() >= 1) + { ++ net.minecraftforge.client.ClientCommandHandler.instance.autoComplete(p_146405_1_, p_146405_2_); + BlockPos blockpos = null; + + if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) diff --git a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch new file mode 100644 index 000000000..a5f273e6c --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch @@ -0,0 +1,27 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java +@@ -313,14 +313,7 @@ + } + else if (button.id == 8) + { +- if (WorldType.worldTypes[this.selectedIndex] == WorldType.FLAT) +- { +- this.mc.displayGuiScreen(new GuiCreateFlatWorld(this, this.chunkProviderSettingsJson)); +- } +- else +- { +- this.mc.displayGuiScreen(new GuiCustomizeWorldScreen(this, this.chunkProviderSettingsJson)); +- } ++ WorldType.worldTypes[this.selectedIndex].onCustomizeButton(mc, this); + } + } + } +@@ -372,7 +365,7 @@ + this.btnBonusItems.visible = this.field_146344_y; + this.btnMapType.visible = this.field_146344_y; + this.btnAllowCommands.visible = this.field_146344_y; +- this.btnCustomizeType.visible = this.field_146344_y && (WorldType.worldTypes[this.selectedIndex] == WorldType.FLAT || WorldType.worldTypes[this.selectedIndex] == WorldType.CUSTOMIZED); ++ this.btnCustomizeType.visible = this.field_146344_y && WorldType.worldTypes[this.selectedIndex].isCustomizable(); + } + + this.func_146319_h(); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch new file mode 100644 index 000000000..5f1c09f18 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiIngameMenu.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngameMenu.java +@@ -75,13 +75,19 @@ + this.mc.setIngameFocus(); + break; + case 5: ++ if (this.mc.thePlayer != null) + this.mc.displayGuiScreen(new GuiAchievements(this, this.mc.thePlayer.getStatFileWriter())); + break; + case 6: ++ if (this.mc.thePlayer != null) + this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter())); + break; + case 7: + this.mc.displayGuiScreen(new GuiShareToLan(this)); ++ break; ++ case 12: ++ net.minecraftforge.fml.client.FMLClientHandler.instance().showInGameModOptions(this); ++ break; + } + } + diff --git a/patches/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch new file mode 100644 index 000000000..b4563e39b --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiMultiplayer.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiMultiplayer.java +@@ -41,6 +41,7 @@ + public GuiMultiplayer(GuiScreen parentScreen) + { + this.parentScreen = parentScreen; ++ net.minecraftforge.fml.client.FMLClientHandler.instance().setupServerList(); + } + + public void initGui() +@@ -373,7 +374,7 @@ + + private void connectToServer(ServerData server) + { +- this.mc.displayGuiScreen(new GuiConnecting(this, this.mc, server)); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServer(this, server); + } + + public void selectServer(int index) diff --git a/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch new file mode 100644 index 000000000..6017c729c --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java +@@ -107,6 +107,9 @@ + { + BlockPos blockpos = new BlockPos(this.mc.getRenderViewEntity().posX, this.mc.getRenderViewEntity().getEntityBoundingBox().minY, this.mc.getRenderViewEntity().posZ); + ++ arraylist.add(""); ++ arraylist.addAll(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(false)); ++ + if (this.isReducedDebug()) + { + return Lists.newArrayList(new String[] {"Minecraft 1.8.8 (" + this.mc.getVersion() + "/" + ClientBrandRetriever.getClientModName() + ")", this.mc.debug, this.mc.renderGlobal.getDebugInfoRenders(), this.mc.renderGlobal.getDebugInfoEntities(), "P: " + this.mc.effectRenderer.getStatistics() + ". T: " + this.mc.theWorld.getDebugLoadedEntities(), this.mc.theWorld.getProviderName(), "", String.format("Chunk-relative: %d %d %d", new Object[]{Integer.valueOf(blockpos.getX() & 15), Integer.valueOf(blockpos.getY() & 15), Integer.valueOf(blockpos.getZ() & 15)})}); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch new file mode 100644 index 000000000..83c8e4e05 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiSelectWorld.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiSelectWorld.java +@@ -187,7 +187,7 @@ + + if (this.mc.getSaveLoader().canLoadWorld(s)) + { +- this.mc.launchIntegratedServer(s, s1, (WorldSettings)null); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().tryLoadExistingWorld(this, s, s1); + } + } + } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch new file mode 100644 index 000000000..5df4b471b --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiSleepMP.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiSleepMP.java +@@ -34,7 +34,7 @@ + + if (!s.isEmpty()) + { +- this.mc.thePlayer.sendChatMessage(s); ++ this.sendChatMessage(s); // Forge: fix vanilla not adding messages to the sent list while sleeping + } + + this.inputField.setText(""); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch new file mode 100644 index 000000000..3cc9d27e2 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiSlot.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiSlot.java +@@ -459,4 +459,19 @@ + { + return this.slotHeight; + } ++ ++ protected void drawContainerBackground(Tessellator tessellator) ++ { ++ WorldRenderer worldrenderer = tessellator.getWorldRenderer(); ++ this.mc.getTextureManager().bindTexture(Gui.optionsBackground); ++ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); ++ float f1 = 32.0F; ++ worldrenderer.startDrawingQuads(); ++ worldrenderer.setColorOpaque_I(2105376); ++ worldrenderer.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); ++ worldrenderer.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); ++ worldrenderer.addVertexWithUV((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); ++ worldrenderer.addVertexWithUV((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); ++ tessellator.draw(); ++ } + } diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch new file mode 100644 index 000000000..782f2ce93 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch @@ -0,0 +1,104 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java ++++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java +@@ -49,6 +49,8 @@ + private boolean field_147057_D; + private CreativeCrafting field_147059_E; + private static final String __OBFID = "CL_00000752"; ++ private static int tabPage = 0; ++ private int maxPages = 0; + + public GuiContainerCreative(EntityPlayer p_i1088_1_) + { +@@ -260,6 +262,13 @@ + this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[i]); + this.field_147059_E = new CreativeCrafting(this.mc); + this.mc.thePlayer.inventoryContainer.addCraftingToCrafters(this.field_147059_E); ++ int tabCount = CreativeTabs.creativeTabArray.length; ++ if (tabCount > 12) ++ { ++ buttonList.add(new GuiButton(101, guiLeft, guiTop - 50, 20, 20, "<")); ++ buttonList.add(new GuiButton(102, guiLeft + xSize - 20, guiTop - 50, 20, 20, ">")); ++ maxPages = ((tabCount - 12) / 10) + 1; ++ } + } + else + { +@@ -281,7 +290,7 @@ + + protected void keyTyped(char typedChar, int keyCode) throws IOException + { +- if (selectedTabIndex != CreativeTabs.tabAllSearch.getTabIndex()) ++ if (!CreativeTabs.creativeTabArray[selectedTabIndex].hasSearchBar()) + { + if (GameSettings.isKeyDown(this.mc.gameSettings.keyBindChat)) + { +@@ -366,7 +375,7 @@ + { + CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; + +- if (creativetabs.drawInForegroundOfTab()) ++ if (creativetabs != null && creativetabs.drawInForegroundOfTab()) + { + GlStateManager.disableBlend(); + this.fontRendererObj.drawString(I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]), 8, 6, 4210752); +@@ -414,11 +423,13 @@ + + private boolean needsScrollBars() + { ++ if (CreativeTabs.creativeTabArray[selectedTabIndex] == null) return false; + return selectedTabIndex != CreativeTabs.tabInventory.getTabIndex() && CreativeTabs.creativeTabArray[selectedTabIndex].shouldHidePlayerInventory() && ((GuiContainerCreative.ContainerCreative)this.inventorySlots).func_148328_e(); + } + + private void setCurrentCreativeTab(CreativeTabs p_147050_1_) + { ++ if (p_147050_1_ == null) return; + int i = selectedTabIndex; + selectedTabIndex = p_147050_1_.getTabIndex(); + GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; +@@ -484,12 +495,14 @@ + + if (this.searchField != null) + { +- if (p_147050_1_ == CreativeTabs.tabAllSearch) ++ if (p_147050_1_.hasSearchBar()) + { + this.searchField.setVisible(true); + this.searchField.setCanLoseFocus(false); + this.searchField.setFocused(true); + this.searchField.setText(""); ++ this.searchField.width = p_147050_1_.getSearchbarWidth(); ++ this.searchField.xPosition = this.guiLeft + (82 /*default left*/ + 89 /*default width*/) - this.searchField.width; + this.updateCreativeSearch(); + } + else +@@ -658,6 +671,14 @@ + this.drawTexturedModalRect(i, j + (int)((float)(k - j - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15); + } + ++ if (creativetabs == null || creativetabs.getTabPage() != tabPage) ++ { ++ if (creativetabs != CreativeTabs.tabAllSearch && creativetabs != CreativeTabs.tabInventory) ++ { ++ return; ++ } ++ } ++ + this.func_147051_a(creativetabs); + + if (creativetabs == CreativeTabs.tabInventory) +@@ -790,6 +811,15 @@ + { + this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter())); + } ++ ++ if (button.id == 101) ++ { ++ tabPage = Math.max(tabPage - 1, 0); ++ } ++ else if (button.id == 102) ++ { ++ tabPage = Math.min(tabPage + 1, maxPages); ++ } + } + + public int getSelectedTabIndex() diff --git a/patches/minecraft/net/minecraft/client/model/ModelBase.java.patch b/patches/minecraft/net/minecraft/client/model/ModelBase.java.patch new file mode 100644 index 000000000..4f3c8aede --- /dev/null +++ b/patches/minecraft/net/minecraft/client/model/ModelBase.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/model/ModelBase.java ++++ ../src-work/minecraft/net/minecraft/client/model/ModelBase.java +@@ -10,7 +10,6 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-@SideOnly(Side.CLIENT) + public abstract class ModelBase + { + public float swingProgress; diff --git a/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch b/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch new file mode 100644 index 000000000..ed3cab955 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch @@ -0,0 +1,18 @@ +--- ../src-base/minecraft/net/minecraft/client/model/ModelBox.java ++++ ../src-work/minecraft/net/minecraft/client/model/ModelBox.java +@@ -4,7 +4,6 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-@SideOnly(Side.CLIENT) + public class ModelBox + { + private PositionTextureVertex[] vertexPositions; +@@ -82,6 +81,7 @@ + } + } + ++ @SideOnly(Side.CLIENT) + public void render(WorldRenderer p_178780_1_, float p_178780_2_) + { + for (int i = 0; i < this.quadList.length; ++i) diff --git a/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch b/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch new file mode 100644 index 000000000..d27fe0f0e --- /dev/null +++ b/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch @@ -0,0 +1,42 @@ +--- ../src-base/minecraft/net/minecraft/client/model/ModelRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/model/ModelRenderer.java +@@ -10,7 +10,6 @@ + import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.opengl.GL11; + +-@SideOnly(Side.CLIENT) + public class ModelRenderer + { + public float textureWidth; +@@ -110,6 +109,7 @@ + this.rotationPointZ = p_78793_3_; + } + ++ @SideOnly(Side.CLIENT) + public void render(float p_78785_1_) + { + if (!this.isHidden) +@@ -191,6 +191,7 @@ + } + } + ++ @SideOnly(Side.CLIENT) + public void renderWithRotation(float p_78791_1_) + { + if (!this.isHidden) +@@ -226,6 +227,7 @@ + } + } + ++ @SideOnly(Side.CLIENT) + public void postRender(float p_78794_1_) + { + if (!this.isHidden) +@@ -267,6 +269,7 @@ + } + } + ++ @SideOnly(Side.CLIENT) + private void compileDisplayList(float p_78788_1_) + { + this.displayList = GLAllocation.generateDisplayLists(1); diff --git a/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch b/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch new file mode 100644 index 000000000..c3d2571d6 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/client/model/PositionTextureVertex.java ++++ ../src-work/minecraft/net/minecraft/client/model/PositionTextureVertex.java +@@ -1,10 +1,7 @@ + package net.minecraft.client.model; + + import net.minecraft.util.Vec3; +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; + +-@SideOnly(Side.CLIENT) + public class PositionTextureVertex + { + public Vec3 vector3D; diff --git a/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch b/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch new file mode 100644 index 000000000..321941a6b --- /dev/null +++ b/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/client/model/TexturedQuad.java ++++ ../src-work/minecraft/net/minecraft/client/model/TexturedQuad.java +@@ -4,10 +4,7 @@ + import net.minecraft.client.renderer.WorldRenderer; + import net.minecraft.client.renderer.vertex.DefaultVertexFormats; + import net.minecraft.util.Vec3; +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; + +-@SideOnly(Side.CLIENT) + public class TexturedQuad + { + public PositionTextureVertex[] vertexPositions; diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch new file mode 100644 index 000000000..faf4f9779 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java ++++ ../src-work/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java +@@ -56,6 +56,7 @@ + Chunk chunk = new Chunk(this.worldObj, p_73158_1_, p_73158_2_); + this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_), chunk); + this.chunkListing.add(chunk); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk)); + chunk.setChunkLoaded(true); + return chunk; + } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch new file mode 100644 index 000000000..76efc616e --- /dev/null +++ b/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java ++++ ../src-work/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java +@@ -69,7 +69,7 @@ + inetaddress = InetAddress.getByName(ip); + GuiConnecting.this.networkManager = NetworkManager.func_181124_a(inetaddress, port, GuiConnecting.this.mc.gameSettings.func_181148_f()); + GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen)); +- GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN)); ++ GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN, true)); + GuiConnecting.this.networkManager.sendPacket(new C00PacketLoginStart(GuiConnecting.this.mc.getSession().getProfile())); + } + catch (UnknownHostException unknownhostexception) diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch new file mode 100644 index 000000000..2b34255d9 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch @@ -0,0 +1,48 @@ +--- ../src-base/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java ++++ ../src-work/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java +@@ -112,6 +112,12 @@ + } + } + ++ ItemStack stack = mc.thePlayer.getCurrentEquippedItem(); ++ if (stack != null && stack.getItem() != null && stack.getItem().onBlockStartBreak(stack, pos, mc.thePlayer)) ++ { ++ return false; ++ } ++ + if (this.currentGameType.isCreative() && this.mc.thePlayer.getHeldItem() != null && this.mc.thePlayer.getHeldItem().getItem() instanceof ItemSword) + { + return false; +@@ -357,11 +363,19 @@ + { + if (this.currentGameType != WorldSettings.GameType.SPECTATOR) + { ++ ++ if (p_178890_3_ != null && ++ p_178890_3_.getItem() != null && ++ p_178890_3_.getItem().onItemUseFirst(p_178890_3_, p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2)) ++ { ++ return true; ++ } ++ + IBlockState iblockstate = p_178890_2_.getBlockState(p_178890_4_); + +- if ((!p_178890_1_.isSneaking() || p_178890_1_.getHeldItem() == null) && iblockstate.getBlock().onBlockActivated(p_178890_2_, p_178890_4_, iblockstate, p_178890_1_, p_178890_5_, f, f1, f2)) ++ if ((!p_178890_1_.isSneaking() || p_178890_1_.getHeldItem() == null || p_178890_1_.getHeldItem().getItem().doesSneakBypassUse(p_178890_2_, p_178890_4_, p_178890_1_))) + { +- flag = true; ++ flag = iblockstate.getBlock().onBlockActivated(p_178890_2_, p_178890_4_, iblockstate, p_178890_1_, p_178890_5_, f, f1, f2); + } + + if (!flag && p_178890_3_ != null && p_178890_3_.getItem() instanceof ItemBlock) +@@ -394,7 +408,9 @@ + } + else + { +- return p_178890_3_.onItemUse(p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2); ++ if (!p_178890_3_.onItemUse(p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2)) return false; ++ if (p_178890_3_.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_178890_1_, p_178890_3_); ++ return true; + } + } + else diff --git a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch new file mode 100644 index 000000000..c96066c54 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/client/multiplayer/WorldClient.java ++++ ../src-work/minecraft/net/minecraft/client/multiplayer/WorldClient.java +@@ -53,12 +53,13 @@ + super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), WorldProvider.getProviderForDimension(p_i45063_3_), p_i45063_5_, true); + this.sendQueue = p_i45063_1_; + this.getWorldInfo().setDifficulty(p_i45063_4_); +- this.setSpawnPoint(new BlockPos(8, 64, 8)); + this.provider.registerWorld(this); ++ this.setSpawnPoint(new BlockPos(8, 64, 8)); //Forge: Moved below registerWorld to prevent NPE in our redirect. + this.chunkProvider = this.createChunkProvider(); + this.mapStorage = new SaveDataMemoryStorage(); + this.calculateInitialSkylight(); + this.calculateInitialWeather(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(this)); + } + + public void tick() diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch new file mode 100644 index 000000000..c84d9a2d2 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java ++++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java +@@ -24,6 +24,7 @@ + + public void processHandshake(C00Handshake packetIn) + { ++ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return; + this.networkManager.setConnectionState(packetIn.getRequestedState()); + this.networkManager.setNetHandler(new NetHandlerLoginServer(this.mcServer, this.networkManager)); + } diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch new file mode 100644 index 000000000..540435e48 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java ++++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java +@@ -106,7 +106,10 @@ + { + this.gameProfile = packetIn.getProfile(); + this.networkManager.setConnectionState(EnumConnectionState.PLAY); +- this.networkManager.setNetHandler(new NetHandlerPlayClient(this.mc, this.previousGuiScreen, this.networkManager, this.gameProfile)); ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlClientHandshake(this.networkManager); ++ NetHandlerPlayClient nhpc = new NetHandlerPlayClient(this.mc, this.previousGuiScreen, this.networkManager, this.gameProfile); ++ this.networkManager.setNetHandler(nhpc); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().setPlayClient(nhpc); + } + + public void onDisconnect(IChatComponent reason) diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch new file mode 100644 index 000000000..5fefba49c --- /dev/null +++ b/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch @@ -0,0 +1,62 @@ +--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java ++++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java +@@ -247,7 +247,7 @@ + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + this.gameController.playerController = new PlayerControllerMP(this.gameController, this); +- this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler); ++ this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.get(getNetworkManager()).getOverrideDimension(packetIn), packetIn.getDifficulty(), this.gameController.mcProfiler); + this.gameController.gameSettings.difficulty = packetIn.getDifficulty(); + this.gameController.loadWorld(this.clientWorldController); + this.gameController.thePlayer.dimension = packetIn.getDimension(); +@@ -751,14 +751,16 @@ + public void handleChat(S02PacketChat packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); ++ net.minecraft.util.IChatComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(packetIn.func_179841_c(), packetIn.func_148915_c()); ++ if (message == null) return; + + if (packetIn.func_179841_c() == 2) + { +- this.gameController.ingameGUI.func_175188_a(packetIn.func_148915_c(), false); ++ this.gameController.ingameGUI.func_175188_a(message, false); + } + else + { +- this.gameController.ingameGUI.getChatGUI().printChatMessage(packetIn.func_148915_c()); ++ this.gameController.ingameGUI.getChatGUI().printChatMessage(message); + } + } + +@@ -809,6 +811,11 @@ + float f = (float)(packetIn.func_149028_l() * 360) / 256.0F; + float f1 = (float)(packetIn.func_149030_m() * 360) / 256.0F; + EntityLivingBase entitylivingbase = (EntityLivingBase)EntityList.createEntityByID(packetIn.func_149025_e(), this.gameController.theWorld); ++ if (entitylivingbase == null) ++ { ++ net.minecraftforge.fml.common.FMLLog.info("Server attempted to spawn an unknown entity using ID: {0} at ({1}, {2}, {3}) Skipping!", packetIn.func_149025_e(), d0, d1, d2); ++ return; ++ } + entitylivingbase.serverPosX = packetIn.func_149023_f(); + entitylivingbase.serverPosY = packetIn.func_149034_g(); + entitylivingbase.serverPosZ = packetIn.func_149029_h(); +@@ -1134,6 +1141,10 @@ + { + tileentity.readFromNBT(packetIn.getNbtCompound()); + } ++ else ++ { ++ tileentity.onDataPacket(netManager, packetIn); ++ } + } + } + +@@ -1342,7 +1353,7 @@ + + if (entity instanceof EntityLivingBase) + { +- PotionEffect potioneffect = new PotionEffect(packetIn.func_149427_e(), packetIn.func_180755_e(), packetIn.func_149428_f(), false, packetIn.func_179707_f()); ++ PotionEffect potioneffect = new PotionEffect(packetIn.func_149427_e() & 0xff, packetIn.func_180755_e(), packetIn.func_149428_f(), false, packetIn.func_179707_f()); + potioneffect.setPotionDurationMax(packetIn.func_149429_c()); + ((EntityLivingBase)entity).addPotionEffect(potioneffect); + } diff --git a/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch new file mode 100644 index 000000000..3de2c7f1a --- /dev/null +++ b/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch @@ -0,0 +1,33 @@ +--- ../src-base/minecraft/net/minecraft/client/particle/EffectRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/particle/EffectRenderer.java +@@ -134,6 +134,7 @@ + + public void addEffect(EntityFX p_78873_1_) + { ++ if (p_78873_1_ == null) return; //Forge: Prevent modders from being bad and adding nulls causing untraceable NPEs. + int i = p_78873_1_.getFXLayer(); + int j = p_78873_1_.func_174838_j() != 1.0F ? 0 : 1; + +@@ -356,7 +357,7 @@ + + public void func_180533_a(BlockPos p_180533_1_, IBlockState p_180533_2_) + { +- if (p_180533_2_.getBlock().getMaterial() != Material.air) ++ if (!p_180533_2_.getBlock().isAir(worldObj, p_180533_1_) && !p_180533_2_.getBlock().addDestroyEffects(worldObj, p_180533_1_, this)) + { + p_180533_2_ = p_180533_2_.getBlock().getActualState(p_180533_2_, this.worldObj, p_180533_1_); + int i = 4; +@@ -462,4 +463,13 @@ + + return "" + i; + } ++ ++ public void addBlockHitEffects(BlockPos pos, net.minecraft.util.MovingObjectPosition target) ++ { ++ Block block = worldObj.getBlockState(pos).getBlock(); ++ if (block != null && !block.addHitEffects(worldObj, target, this)) ++ { ++ addBlockHitEffects(pos, target.sideHit); ++ } ++ } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch new file mode 100644 index 000000000..75aa0918a --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch @@ -0,0 +1,9 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/BlockModelShapes.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/BlockModelShapes.java +@@ -317,5 +317,6 @@ + return new ModelResourceLocation(s + "_double_slab", s1); + } + }); ++ net.minecraftforge.client.model.ModelLoader.onRegisterAllBlocks(this); + } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch new file mode 100644 index 000000000..5890b09e3 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch @@ -0,0 +1,49 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java +@@ -24,7 +24,7 @@ + { + private BlockModelShapes blockModelShapes; + private final GameSettings gameSettings; +- private final BlockModelRenderer blockModelRenderer = new BlockModelRenderer(); ++ private final BlockModelRenderer blockModelRenderer = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(); + private final ChestRenderer chestRenderer = new ChestRenderer(); + private final BlockFluidRenderer fluidRenderer = new BlockFluidRenderer(); + private static final String __OBFID = "CL_00002520"; +@@ -49,6 +49,24 @@ + { + p_175020_1_ = block.getActualState(p_175020_1_, p_175020_4_, p_175020_2_); + IBakedModel ibakedmodel = this.blockModelShapes.getModelForState(p_175020_1_); ++ ++ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartBlockModel) ++ { ++ IBlockState extendedState = block.getExtendedState(p_175020_1_, p_175020_4_, p_175020_2_); ++ for ( net.minecraft.util.EnumWorldBlockLayer layer : net.minecraft.util.EnumWorldBlockLayer.values() ) ++ { ++ if ( block.canRenderInLayer( layer ) ) ++ { ++ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(layer); ++ ++ IBakedModel targetLayer = ((net.minecraftforge.client.model.ISmartBlockModel)ibakedmodel).handleBlockState(extendedState); ++ IBakedModel damageModel = (new SimpleBakedModel.Builder(targetLayer, p_175020_3_)).makeBakedModel(); ++ this.blockModelRenderer.renderModel(p_175020_4_, damageModel, p_175020_1_, p_175020_2_, Tessellator.getInstance().getWorldRenderer()); ++ } ++ } ++ return; ++ } ++ + IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(ibakedmodel, p_175020_3_)).makeBakedModel(); + this.blockModelRenderer.renderModel(p_175020_4_, ibakedmodel1, p_175020_1_, p_175020_2_, Tessellator.getInstance().getWorldRenderer()); + } +@@ -129,6 +147,12 @@ + ibakedmodel = ((WeightedBakedModel)ibakedmodel).getAlternativeModel(MathHelper.getPositionRandom(p_175022_3_)); + } + ++ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartBlockModel) ++ { ++ IBlockState extendedState = block.getExtendedState(p_175022_1_, p_175022_2_, p_175022_3_); ++ ibakedmodel = ((net.minecraftforge.client.model.ISmartBlockModel)ibakedmodel).handleBlockState(extendedState); ++ } ++ + return ibakedmodel; + } + diff --git a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch new file mode 100644 index 000000000..120177d61 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -0,0 +1,109 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/EntityRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/EntityRenderer.java +@@ -580,14 +580,8 @@ + { + BlockPos blockpos = new BlockPos(entity); + IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); +- Block block = iblockstate.getBlock(); ++ net.minecraftforge.client.ForgeHooksClient.orientBedCamera(this.mc.theWorld, blockpos, iblockstate, entity); + +- if (block == Blocks.bed) +- { +- int j = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex(); +- GlStateManager.rotate((float)(j * 90), 0.0F, 1.0F, 0.0F); +- } +- + GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_78467_1_ + 180.0F, 0.0F, -1.0F, 0.0F); + GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_78467_1_, -1.0F, 0.0F, 0.0F); + } +@@ -654,17 +648,20 @@ + + if (!this.mc.gameSettings.debugCamEnable) + { +- GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_78467_1_, 1.0F, 0.0F, 0.0F); +- ++ float yaw = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_78467_1_ + 180.0F; ++ float pitch = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_78467_1_; ++ float roll = 0.0F; + if (entity instanceof EntityAnimal) + { + EntityAnimal entityanimal = (EntityAnimal)entity; +- GlStateManager.rotate(entityanimal.prevRotationYawHead + (entityanimal.rotationYawHead - entityanimal.prevRotationYawHead) * p_78467_1_ + 180.0F, 0.0F, 1.0F, 0.0F); ++ yaw = entityanimal.prevRotationYawHead + (entityanimal.rotationYawHead - entityanimal.prevRotationYawHead) * p_78467_1_ + 180.0F; + } +- else +- { +- GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_78467_1_ + 180.0F, 0.0F, 1.0F, 0.0F); +- } ++ Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, p_78467_1_); ++ net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup event = new net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup(this, entity, block, p_78467_1_, yaw, pitch, roll); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ GlStateManager.rotate(event.roll, 0.0F, 0.0F, 1.0F); ++ GlStateManager.rotate(event.pitch, 1.0F, 0.0F, 0.0F); ++ GlStateManager.rotate(event.yaw, 0.0F, 1.0F, 0.0F); + } + + GlStateManager.translate(0.0F, -f, 0.0F); +@@ -1171,7 +1168,7 @@ + + if (this.mc.playerController.getCurrentGameType() == WorldSettings.GameType.SPECTATOR) + { +- flag = block.hasTileEntity() && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory; ++ flag = block.hasTileEntity(this.mc.theWorld.getBlockState(blockpos)) && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory; + } + else + { +@@ -1333,6 +1330,7 @@ + EntityPlayer entityplayer = (EntityPlayer)entity; + GlStateManager.disableAlpha(); + this.mc.mcProfiler.endStartSection("outline"); ++ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, entityplayer.getHeldItem(), partialTicks)) + renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); + GlStateManager.enableAlpha(); + } +@@ -1399,8 +1397,12 @@ + this.renderCloudsCheck(renderglobal, partialTicks, pass); + } + ++ this.mc.mcProfiler.endStartSection("forge_render_last"); ++ net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(renderglobal, partialTicks); ++ + this.mc.mcProfiler.endStartSection("hand"); + ++ if (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(renderglobal, partialTicks, pass)) + if (this.renderHand) + { + GlStateManager.clear(256); +@@ -1837,6 +1839,13 @@ + this.fogColorBlue = f7; + } + ++ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, entity, block, partialTicks, this.fogColorRed, this.fogColorGreen, this.fogColorBlue); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ ++ this.fogColorRed = event.red; ++ this.fogColorGreen = event.green; ++ this.fogColorBlue = event.blue; ++ + GlStateManager.clearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F); + } + +@@ -1855,6 +1864,10 @@ + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); + ++ float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, entity, block, partialTicks, 0.1F); ++ if (hook >= 0) ++ GlStateManager.setFogDensity(hook); ++ else + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.blindness)) + { + float f1 = 5.0F; +@@ -1932,6 +1945,7 @@ + GlStateManager.setFogStart(f * 0.05F); + GlStateManager.setFogEnd(Math.min(f, 192.0F) * 0.5F); + } ++ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, entity, block, partialTicks, p_78468_1_, f1); + } + + GlStateManager.enableColorMaterial(); diff --git a/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch new file mode 100644 index 000000000..9d58872a6 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java +@@ -81,6 +81,8 @@ + this.drawTexturedModalRect(i + 6, j + 7, 0 + i1 % 8 * 18, 198 + i1 / 8 * 18, 18, 18); + } + ++ potion.renderInventoryEffect(i, j, potioneffect, mc); ++ if (!potion.shouldRenderInvText(potioneffect)) continue; + String s1 = I18n.format(potion.getName(), new Object[0]); + + if (potioneffect.getAmplifier() == 1) diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch new file mode 100644 index 000000000..22fe8c9af --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/ItemModelMesher.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/ItemModelMesher.java +@@ -51,6 +51,11 @@ + } + } + ++ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartItemModel) ++ { ++ ibakedmodel = ((net.minecraftforge.client.model.ISmartItemModel)ibakedmodel).handleItemState(stack); ++ } ++ + if (ibakedmodel == null) + { + ibakedmodel = this.modelManager.getMissingModel(); diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch new file mode 100644 index 000000000..bd6f7ee7f --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -0,0 +1,46 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/ItemRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/ItemRenderer.java +@@ -314,7 +314,7 @@ + + if (this.itemToRender != null) + { +- if (this.itemToRender.getItem() == Items.filled_map) ++ if (this.itemToRender.getItem() instanceof net.minecraft.item.ItemMap) + { + this.func_178097_a(abstractclientplayer, f2, f, f1); + } +@@ -384,6 +384,7 @@ + + if (iblockstate.getBlock().getRenderType() != -1) + { ++ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(mc.thePlayer, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, blockpos)) + this.func_178108_a(p_78447_1_, this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate)); + } + } +@@ -392,11 +393,13 @@ + { + if (this.mc.thePlayer.isInsideOfMaterial(Material.water)) + { ++ if (!net.minecraftforge.event.ForgeEventFactory.renderWaterOverlay(mc.thePlayer, p_78447_1_)) + this.renderWaterOverlayTexture(p_78447_1_); + } + + if (this.mc.thePlayer.isBurning()) + { ++ if (!net.minecraftforge.event.ForgeEventFactory.renderFireOverlay(mc.thePlayer, p_78447_1_)) + this.renderFireInFirstPerson(p_78447_1_); + } + } +@@ -513,6 +516,12 @@ + { + if (!this.itemToRender.getIsItemStackEqual(itemstack)) + { ++ if (!this.itemToRender.getItem().shouldCauseReequipAnimation(this.itemToRender, itemstack, equippedItemSlot != entityplayersp.inventory.currentItem)) ++ { ++ this.itemToRender = itemstack; ++ this.equippedItemSlot = entityplayersp.inventory.currentItem; ++ return; ++ } + flag = true; + } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch b/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch new file mode 100644 index 000000000..b6bded7ef --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch @@ -0,0 +1,26 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/OpenGlHelper.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/OpenGlHelper.java +@@ -84,6 +84,10 @@ + public static int GL_STATIC_DRAW; + private static final String __OBFID = "CL_00001179"; + ++ /* Stores the last values sent into setLightmapTextureCoords */ ++ public static float lastBrightnessX = 0.0f; ++ public static float lastBrightnessY = 0.0f; ++ + public static void initializeTextures() + { + ContextCapabilities contextcapabilities = GLContext.getCapabilities(); +@@ -844,6 +848,12 @@ + { + GL13.glMultiTexCoord2f(p_77475_0_, p_77475_1_, p_77475_2_); + } ++ ++ if (p_77475_0_ == lightmapTexUnit) ++ { ++ lastBrightnessX = p_77475_1_; ++ lastBrightnessY = p_77475_2_; ++ } + } + + public static void glBlendFunc(int p_148821_0_, int p_148821_1_, int p_148821_2_, int p_148821_3_) diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch new file mode 100644 index 000000000..f1f271bb1 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch @@ -0,0 +1,70 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/RenderGlobal.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/RenderGlobal.java +@@ -526,8 +526,10 @@ + + public void renderEntities(Entity p_180446_1_, ICamera p_180446_2_, float partialTicks) + { ++ int pass = net.minecraftforge.client.MinecraftForgeClient.getRenderPass(); + if (this.renderEntitiesStartupCounter > 0) + { ++ if (pass > 0) return; + --this.renderEntitiesStartupCounter; + } + else +@@ -1162,6 +1164,12 @@ + + public void renderSky(float partialTicks, int pass) + { ++ net.minecraftforge.client.IRenderHandler renderer = this.theWorld.provider.getSkyRenderer(); ++ if (renderer != null) ++ { ++ renderer.render(partialTicks, theWorld, mc); ++ return; ++ } + if (this.mc.theWorld.provider.getDimensionId() == 1) + { + this.renderSkyEnd(); +@@ -1379,6 +1387,12 @@ + + public void renderClouds(float p_180447_1_, int p_180447_2_) + { ++ net.minecraftforge.client.IRenderHandler renderer = this.mc.theWorld.provider.getCloudRenderer(); ++ if (renderer != null) ++ { ++ renderer.render(p_180447_1_, this.mc.theWorld, mc); ++ return; ++ } + if (this.mc.theWorld.provider.isSurfaceWorld()) + { + if (this.mc.gameSettings.func_181147_e() == 2) +@@ -1794,8 +1808,11 @@ + double d4 = (double)blockpos.getY() - d1; + double d5 = (double)blockpos.getZ() - d2; + Block block = this.theWorld.getBlockState(blockpos).getBlock(); ++ TileEntity te = this.theWorld.getTileEntity(blockpos); ++ boolean hasBreak = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull; ++ if (!hasBreak) hasBreak = te != null && te.canRenderBreaking(); + +- if (!(block instanceof BlockChest) && !(block instanceof BlockEnderChest) && !(block instanceof BlockSign) && !(block instanceof BlockSkull)) ++ if (!hasBreak) + { + if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) + { +@@ -1950,13 +1967,16 @@ + if (recordName != null) + { + ItemRecord itemrecord = ItemRecord.getRecord(recordName); ++ ResourceLocation resource = null; + + if (itemrecord != null) + { + this.mc.ingameGUI.setRecordPlayingMessage(itemrecord.getRecordNameLocal()); ++ resource = itemrecord.getRecordResource(recordName); + } + +- PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(new ResourceLocation(recordName), (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ()); ++ if (resource == null) resource = new ResourceLocation(recordName); ++ PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(resource, (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ()); + this.mapSoundPositions.put(blockPosIn, positionedsoundrecord); + this.mc.getSoundHandler().playSound(positionedsoundrecord); + } diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch new file mode 100644 index 000000000..8a9166d24 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/WorldRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/WorldRenderer.java +@@ -580,6 +580,14 @@ + } + } + ++ public void checkAndGrow() ++ { ++ if (this.rawBufferIndex >= this.bufferSize - this.vertexFormat.getNextOffset()) ++ { ++ this.growBuffer(2097152); ++ } ++ } ++ + @SideOnly(Side.CLIENT) + public class State + { diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch new file mode 100644 index 000000000..97dc4cd38 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java +@@ -5,8 +5,9 @@ + import net.minecraftforge.fml.relauncher.SideOnly; + + @SideOnly(Side.CLIENT) +-public class BakedQuad ++public class BakedQuad implements net.minecraftforge.client.model.pipeline.IVertexProducer + { ++ @Override public void pipe(net.minecraftforge.client.model.pipeline.IVertexConsumer consumer) { net.minecraftforge.client.model.pipeline.LightUtil.putBakedQuad(consumer, this); } + protected final int[] vertexData; + protected final int tintIndex; + protected final EnumFacing face; diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch new file mode 100644 index 000000000..0a53ccf64 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java +@@ -21,6 +21,11 @@ + + public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) + { ++ return makeBakedQuad(posFrom, posTo, face, sprite, facing, (net.minecraftforge.client.model.ITransformation)modelRotationIn, partRotation, uvLocked, shade); ++ } ++ ++ public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) ++ { + int[] aint = this.makeQuadVertexData(face, sprite, facing, this.getPositionsDiv16(posFrom, posTo), modelRotationIn, partRotation, uvLocked, shade); + EnumFacing enumfacing = getFacingFromVertexData(aint); + diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch new file mode 100644 index 000000000..f38fed84c --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java +@@ -10,7 +10,11 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + ++/* ++ * @deprecated use {@link net.minecraftforge.client.model.IPerspectiveAwareModel} instead ++ */ + @SideOnly(Side.CLIENT) ++@Deprecated + public class ItemCameraTransforms + { + public static final ItemCameraTransforms DEFAULT = new ItemCameraTransforms(); diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch new file mode 100644 index 000000000..fc01e17a3 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch @@ -0,0 +1,18 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java +@@ -13,9 +13,14 @@ + import net.minecraftforge.fml.relauncher.SideOnly; + import org.lwjgl.util.vector.Vector3f; + ++/* ++ * @deprecated use {@link net.minecraftforge.client.model.IModelState} and {@link net.minecraftforge.client.model.TRSRTransformation} ++ */ + @SideOnly(Side.CLIENT) +-public class ItemTransformVec3f ++@Deprecated ++public class ItemTransformVec3f implements net.minecraftforge.client.model.IModelState + { ++ public net.minecraftforge.client.model.TRSRTransformation apply(net.minecraftforge.client.model.IModelPart part) { return new net.minecraftforge.client.model.TRSRTransformation(this); } + public static final ItemTransformVec3f DEFAULT = new ItemTransformVec3f(new Vector3f(), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F)); + public final Vector3f rotation; + public final Vector3f translation; diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch new file mode 100644 index 000000000..25284acf7 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java +@@ -30,7 +30,7 @@ + + public static ModelBlockDefinition parseFromReader(Reader p_178331_0_) + { +- return (ModelBlockDefinition)GSON.fromJson(p_178331_0_, ModelBlockDefinition.class); ++ return net.minecraftforge.client.model.BlockStateLoader.load(p_178331_0_, GSON); + } + + public ModelBlockDefinition(Collection p_i46221_1_) +@@ -160,11 +160,17 @@ + return this.modelLocation; + } + ++ @Deprecated + public ModelRotation getRotation() + { + return this.modelRotation; + } + ++ public net.minecraftforge.client.model.IModelState getState() ++ { ++ return this.modelRotation; ++ } ++ + public boolean isUvLocked() + { + return this.uvLock; diff --git a/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch b/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch new file mode 100644 index 000000000..dab1d3b24 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch @@ -0,0 +1,46 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java +@@ -159,7 +159,7 @@ + lvt_10_1_.func_178606_a(blockpos$mutableblockpos); + } + +- if (block.hasTileEntity()) ++ if (block.hasTileEntity(iblockstate)) + { + TileEntity tileentity = iblockaccess.getTileEntity(new BlockPos(blockpos$mutableblockpos)); + TileEntitySpecialRenderer tileentityspecialrenderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(tileentity); +@@ -190,6 +190,7 @@ + + aboolean[j] |= blockrendererdispatcher.renderBlock(iblockstate, blockpos$mutableblockpos, iblockaccess, worldrenderer); + } ++ } + } + + for (EnumWorldBlockLayer enumworldblocklayer : EnumWorldBlockLayer.values()) +@@ -386,6 +387,26 @@ + return this.needsUpdate; + } + ++ /* ======================================== FORGE START =====================================*/ ++ /** ++ * Creates a new RegionRenderCache instance.
++ * Extending classes can change the behavior of the cache, allowing to visually change ++ * blocks (schematics etc). ++ * ++ * @see RegionRenderCache ++ * @param world The world to cache. ++ * @param from The starting position of the chunk minus one on each axis. ++ * @param to The ending position of the chunk plus one on each axis. ++ * @param subtract Padding used internally by the RegionRenderCache constructor to make ++ * the cache a 20x20x20 cube, for a total of 8000 states in the cache. ++ * @return new RegionRenderCache instance ++ */ ++ protected RegionRenderCache createRegionRenderCache(World world, BlockPos from, BlockPos to, int subtract) ++ { ++ return new RegionRenderCache(world, from, to, subtract); ++ } ++ /* ========================================= FORGE END ======================================*/ ++ + public BlockPos func_181701_a(EnumFacing p_181701_1_) + { + return (BlockPos)this.field_181702_p.get(p_181701_1_); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch new file mode 100644 index 000000000..fbe25532c --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch @@ -0,0 +1,28 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java +@@ -158,4 +158,25 @@ + { + return TextureMap.locationBlocksTexture; + } ++ ++ /*==================================== FORGE START ===========================================*/ ++ ++ /** ++ * Items should spread out when rendered in 3d? ++ * @return ++ */ ++ public boolean shouldSpreadItems() ++ { ++ return true; ++ } ++ ++ /** ++ * Items should have a bob effect ++ * @return ++ */ ++ public boolean shouldBob() ++ { ++ return true; ++ } ++ /*==================================== FORGE END =============================================*/ + } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch new file mode 100644 index 000000000..1811392e2 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderItem.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderItem.java +@@ -73,7 +73,7 @@ + public RenderItem(TextureManager textureManager, ModelManager modelManager) + { + this.textureManager = textureManager; +- this.itemModelMesher = new ItemModelMesher(modelManager); ++ this.itemModelMesher = new net.minecraftforge.client.ItemModelMesherForge(modelManager); + this.registerItems(); + } + +@@ -250,6 +250,10 @@ + { + GlStateManager.scale(2.0F, 2.0F, 2.0F); + } ++ else ++ { ++ modelresourcelocation = item.getModel(stack, entityplayer, entityplayer.getItemInUseCount()); ++ } + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch new file mode 100644 index 000000000..17df82b6b --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch @@ -0,0 +1,25 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java +@@ -194,6 +194,10 @@ + this.skinMap.put("default", this.field_178637_m); + this.skinMap.put("slim", new RenderPlayer(this, true)); + } ++ ++ public Map getSkinMap() { ++ return (Map) java.util.Collections.unmodifiableMap(skinMap); ++ } + + public void setRenderPosition(double p_178628_1_, double p_178628_3_, double p_178628_5_) + { +@@ -242,9 +246,9 @@ + IBlockState iblockstate = worldIn.getBlockState(new BlockPos(p_180597_3_)); + Block block = iblockstate.getBlock(); + +- if (block == Blocks.bed) ++ if (block.isBed(worldIn, new BlockPos(p_180597_3_), (EntityLivingBase)p_180597_3_)) + { +- int i = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex(); ++ int i = block.getBedDirection(worldIn, new BlockPos(p_180597_3_)).getHorizontalIndex(); + this.playerViewY = (float)(i * 90 + 180); + this.playerViewX = 0.0F; + } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch new file mode 100644 index 000000000..bc5b356d7 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java +@@ -62,6 +62,7 @@ + this.func_177137_d(entity); + super.doRender(entity, x, d0, z, p_76986_8_, partialTicks); + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(p_180596_1_, this, p_180596_9_, p_180596_2_, p_180596_4_, p_180596_6_)); + } + + private void func_177137_d(AbstractClientPlayer p_177137_1_) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch new file mode 100644 index 000000000..8441ac0fd --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java +@@ -45,7 +45,7 @@ + case 4: + return butcherVillagerTextures; + default: +- return villagerTextures; ++ return net.minecraftforge.fml.common.registry.VillagerRegistry.getVillagerSkin(entity.getProfession(), villagerTextures); + } + } + diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch new file mode 100644 index 000000000..8548073e1 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch @@ -0,0 +1,36 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java +@@ -39,6 +39,9 @@ + protected boolean renderOutlines = false; + private static final String __OBFID = "CL_00001012"; + ++ public static float NAME_TAG_RANGE = 64.0f; ++ public static float NAME_TAG_RANGE_SNEAK = 32.0f; ++ + public RendererLivingEntity(RenderManager p_i46156_1_, ModelBase p_i46156_2_, float p_i46156_3_) + { + super(p_i46156_1_); +@@ -84,6 +87,7 @@ + + public void doRender(T entity, double x, double y, double z, float p_76986_8_, float partialTicks) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(entity, this, x, y, z))) return; + GlStateManager.pushMatrix(); + GlStateManager.disableCull(); + this.mainModel.swingProgress = this.getSwingProgress(entity, partialTicks); +@@ -192,6 +196,7 @@ + { + super.doRender(entity, x, y, z, p_76986_8_, partialTicks); + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post(entity, this, x, y, z)); + } + + protected boolean func_177088_c(T p_177088_1_) +@@ -519,6 +524,7 @@ + } + } + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Post(p_77033_1_, this, p_77033_2_, p_77033_4_, p_77033_6_)); + } + + protected boolean canRenderName(T entity) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch new file mode 100644 index 000000000..117c5c7c4 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch @@ -0,0 +1,16 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java +@@ -136,11 +136,13 @@ + GlStateManager.disableBlend(); + } + ++ @Deprecated //Use the more sensitive version getArmorResource below + private ResourceLocation getArmorResource(ItemArmor p_177181_1_, boolean p_177181_2_) + { + return this.getArmorResource(p_177181_1_, p_177181_2_, (String)null); + } + ++ @Deprecated //Use the more sensitive version getArmorResource below + private ResourceLocation getArmorResource(ItemArmor p_177178_1_, boolean p_177178_2_, String p_177178_3_) + { + String s = String.format("textures/models/armor/%s_layer_%d%s.png", new Object[] {p_177178_1_.getArmorMaterial().getName(), Integer.valueOf(p_177178_2_ ? 2 : 1), p_177178_3_ == null ? "" : String.format("_%s", new Object[]{p_177178_3_})}); diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch new file mode 100644 index 000000000..931df54bb --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/texture/Stitcher.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/texture/Stitcher.java +@@ -74,6 +74,7 @@ + this.currentWidth = MathHelper.roundUpToPowerOfTwo(this.currentWidth); + this.currentHeight = MathHelper.roundUpToPowerOfTwo(this.currentHeight); + } ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); + } + + public List getStichSlots() +@@ -262,7 +263,7 @@ + + public String toString() + { +- return "Holder{width=" + this.width + ", height=" + this.height + '}'; ++ return "Holder{width=" + this.width + ", height=" + this.height + ", name=" + this.theTexture.getIconName() + '}'; + } + + public int compareTo(Stitcher.Holder p_compareTo_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 new file mode 100644 index 000000000..f003a0c92 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch @@ -0,0 +1,33 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java +@@ -404,4 +404,30 @@ + { + return "TextureAtlasSprite{name=\'" + this.iconName + '\'' + ", frameCount=" + this.framesTextureData.size() + ", rotated=" + this.rotated + ", x=" + this.originX + ", y=" + this.originY + ", height=" + this.height + ", width=" + this.width + ", u0=" + this.minU + ", u1=" + this.maxU + ", v0=" + this.minV + ", v1=" + this.maxV + '}'; + } ++ ++ /*===================================== FORGE START =====================================*/ ++ /** ++ * The result of this function determines is the below 'load' function is called, and the ++ * default vanilla loading code is bypassed completely. ++ * @param manager ++ * @param location ++ * @return True to use your own custom load code and bypass vanilla loading. ++ */ ++ public boolean hasCustomLoader(net.minecraft.client.resources.IResourceManager manager, net.minecraft.util.ResourceLocation location) ++ { ++ return false; ++ } ++ ++ /** ++ * Load the specified resource as this sprite's data. ++ * Returning false from this function will prevent this icon from being stitched onto the master texture. ++ * @param manager Main resource manager ++ * @param location File resource location ++ * @return False to prevent this Icon from being stitched ++ */ ++ public boolean load(net.minecraft.client.resources.IResourceManager manager, net.minecraft.util.ResourceLocation location) ++ { ++ return true; ++ } ++ /*===================================== FORGE END ======================================*/ + } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch new file mode 100644 index 000000000..9cbc2e7e7 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -0,0 +1,78 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureMap.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureMap.java +@@ -28,6 +28,7 @@ + @SideOnly(Side.CLIENT) + public class TextureMap extends AbstractTexture implements ITickableTextureObject + { ++ private static final boolean ENABLE_SKIP = Boolean.parseBoolean(System.getProperty("fml.skipFirstTextureLoad", "true")); + private static final Logger logger = LogManager.getLogger(); + public static final ResourceLocation LOCATION_MISSING_TEXTURE = new ResourceLocation("missingno"); + public static final ResourceLocation locationBlocksTexture = new ResourceLocation("textures/atlas/blocks.png"); +@@ -39,6 +40,7 @@ + private int mipmapLevels; + private final TextureAtlasSprite missingImage; + private static final String __OBFID = "CL_00001058"; ++ private boolean skipFirst = false; + + public TextureMap(String p_i46099_1_) + { +@@ -167,6 +169,7 @@ + stitcher.addSprite(textureatlassprite); + } + ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); + int j1 = Math.min(j, k); + int k1 = MathHelper.calculateLogBaseTwo(j1); + +@@ -217,9 +220,13 @@ + + this.missingImage.generateMipmaps(this.mipmapLevels); + stitcher.addSprite(this.missingImage); ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); ++ skipFirst = false; ++ bar = net.minecraftforge.fml.common.ProgressManager.push("Texture creation", 3); + + try + { ++ bar.step("Stitching"); + stitcher.doStitch(); + } + catch (StitcherException stitcherexception) +@@ -323,4 +330,37 @@ + { + return this.missingImage; + } ++ ++ //=================================================================================================== ++ // Forge Start ++ //=================================================================================================== ++ /** ++ * Grabs the registered entry for the specified name, returning null if there was not a entry. ++ * Opposed to registerIcon, this will not instantiate the entry, useful to test if a mapping exists. ++ * ++ * @param name The name of the entry to find ++ * @return The registered entry, null if nothing was registered. ++ */ ++ public TextureAtlasSprite getTextureExtry(String name) ++ { ++ return (TextureAtlasSprite)mapRegisteredSprites.get(name); ++ } ++ ++ /** ++ * Adds a texture registry entry to this map for the specified name if one does not already exist. ++ * Returns false if the map already contains a entry for the specified name. ++ * ++ * @param name Entry name ++ * @param entry Entry instance ++ * @return True if the entry was added to the map, false otherwise. ++ */ ++ public boolean setTextureEntry(String name, TextureAtlasSprite entry) ++ { ++ if (!mapRegisteredSprites.containsKey(name)) ++ { ++ mapRegisteredSprites.put(name, entry); ++ return true; ++ } ++ return false; ++ } + } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch new file mode 100644 index 000000000..12794639e --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java +@@ -198,9 +198,11 @@ + + public static void allocateTextureImpl(int p_180600_0_, int p_180600_1_, int p_180600_2_, int p_180600_3_) + { ++ synchronized (net.minecraftforge.fml.client.SplashProgress.class) ++ { + deleteTexture(p_180600_0_); + bindTexture(p_180600_0_); +- ++ } + if (p_180600_1_ >= 0) + { + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, p_180600_1_); diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch new file mode 100644 index 000000000..2522c7399 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java +@@ -100,15 +100,18 @@ + GlStateManager.disableLighting(); + int i = p_82402_1_.getRotation(); + +- if (item == Items.filled_map) ++ if (item instanceof net.minecraft.item.ItemMap) + { + i = i % 4 * 2; + } + + GlStateManager.rotate((float)i * 360.0F / 8.0F, 0.0F, 0.0F, 1.0F); + +- if (item == Items.filled_map) ++ net.minecraftforge.client.event.RenderItemInFrameEvent event = new net.minecraftforge.client.event.RenderItemInFrameEvent(p_82402_1_, this); ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) + { ++ if (item instanceof net.minecraft.item.ItemMap) ++ { + this.renderManager.renderEngine.bindTexture(mapBackgroundTextures); + GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); + float f = 0.0078125F; +@@ -166,6 +169,7 @@ + textureatlassprite.updateAnimation(); + } + } ++ } + + GlStateManager.enableLighting(); + GlStateManager.popMatrix(); diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch new file mode 100644 index 000000000..9137aa309 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java +@@ -79,6 +79,7 @@ + { + TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147718_c, 0.0D, 0.0D, 0.0D, 0.0F); + } ++ else if (block != Blocks.chest) net.minecraftforge.client.ForgeHooksClient.renderTileItem(p_179022_1_.getItem(), p_179022_1_.getMetadata()); + else + { + TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147717_b, 0.0D, 0.0D, 0.0D, 0.0F); diff --git a/patches/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch b/patches/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch new file mode 100644 index 000000000..a013cf1da --- /dev/null +++ b/patches/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/AbstractResourcePack.java ++++ ../src-work/minecraft/net/minecraft/client/resources/AbstractResourcePack.java +@@ -59,7 +59,7 @@ + + protected void logNameNotLowercase(String p_110594_1_) + { +- resourceLog.warn("ResourcePack: ignored non-lowercase namespace: %s in %s", new Object[] {p_110594_1_, this.resourcePackFile}); ++ resourceLog.warn("ResourcePack: ignored non-lowercase namespace: {} in {}", new Object[] {p_110594_1_, this.resourcePackFile}); + } + + public T getPackMetadata(IMetadataSerializer p_135058_1_, String p_135058_2_) throws IOException diff --git a/patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch b/patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch new file mode 100644 index 000000000..9ec768b73 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/FallbackResourceManager.java ++++ ../src-work/minecraft/net/minecraft/client/resources/FallbackResourceManager.java +@@ -68,6 +68,7 @@ + throw new FileNotFoundException(p_110536_1_.toString()); + } + ++ @SuppressWarnings("resource") + protected InputStream getInputStream(ResourceLocation p_177245_1_, IResourcePack p_177245_2_) throws IOException + { + InputStream inputstream = p_177245_2_.getInputStream(p_177245_1_); diff --git a/patches/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch b/patches/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch new file mode 100644 index 000000000..94444e80c --- /dev/null +++ b/patches/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch @@ -0,0 +1,21 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/model/IBakedModel.java ++++ ../src-work/minecraft/net/minecraft/client/resources/model/IBakedModel.java +@@ -8,7 +8,11 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + ++/* ++ * @deprecated use {@link net.minecraftforge.client.model.IFlexibleBakedModel}, {@link net.minecraftforge.client.model.IPerspectiveAwareModel} ++ */ + @SideOnly(Side.CLIENT) ++@Deprecated + public interface IBakedModel + { + List getFaceQuads(EnumFacing p_177551_1_); +@@ -23,5 +27,6 @@ + + TextureAtlasSprite getTexture(); + ++ @Deprecated + ItemCameraTransforms getItemCameraTransforms(); + } diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch new file mode 100644 index 000000000..cf85230f4 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch @@ -0,0 +1,82 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/model/ModelBakery.java ++++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelBakery.java +@@ -115,7 +115,7 @@ + } + catch (Exception var6) + { +- LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation); ++ LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation, exception); + } + } + catch (Exception exception) +@@ -161,6 +161,7 @@ + } + } + } ++ catch (FileNotFoundException e) {} + catch (IOException ioexception) + { + throw new RuntimeException("Encountered an exception when loading model definition of model " + resourcelocation.toString(), ioexception); +@@ -295,6 +296,7 @@ + + protected void registerVariantNames() + { ++ this.variantNames.clear(); //FML clear this to prevent double ups. + this.variantNames.put(Item.getItemFromBlock(Blocks.stone), Lists.newArrayList(new String[] {"stone", "granite", "granite_smooth", "diorite", "diorite_smooth", "andesite", "andesite_smooth"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.dirt), Lists.newArrayList(new String[] {"dirt", "coarse_dirt", "podzol"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.planks), Lists.newArrayList(new String[] {"oak_planks", "spruce_planks", "birch_planks", "jungle_planks", "acacia_planks", "dark_oak_planks"})); +@@ -337,6 +339,10 @@ + this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence_gate), Lists.newArrayList(new String[] {"oak_fence_gate"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence), Lists.newArrayList(new String[] {"oak_fence"})); + this.variantNames.put(Items.oak_door, Lists.newArrayList(new String[] {"oak_door"})); ++ for (Entry, Set> e : customVariantNames.entrySet()) ++ { ++ this.variantNames.put(e.getKey().get(), Lists.newArrayList(e.getValue().iterator())); ++ } + } + + protected List getVariantNames(Item p_177596_1_) +@@ -455,6 +461,11 @@ + + private IBakedModel bakeModel(ModelBlock modelBlockIn, ModelRotation modelRotationIn, boolean uvLocked) + { ++ return bakeModel(modelBlockIn, (net.minecraftforge.client.model.ITransformation)modelRotationIn, uvLocked); ++ } ++ ++ protected IBakedModel bakeModel(ModelBlock modelBlockIn, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) ++ { + TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName("particle"))); + SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(modelBlockIn)).setTexture(textureatlassprite); + +@@ -481,6 +492,11 @@ + + private BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_) + { ++ return makeBakedQuad(p_177589_1_, p_177589_2_, p_177589_3_, p_177589_4_, (net.minecraftforge.client.model.ITransformation)p_177589_5_, p_177589_6_); ++ } ++ ++ protected BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, net.minecraftforge.client.model.ITransformation p_177589_5_, boolean p_177589_6_) ++ { + return this.faceBakery.makeBakedQuad(p_177589_1_.positionFrom, p_177589_1_.positionTo, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.partRotation, p_177589_6_, p_177589_1_.shade); + } + +@@ -725,4 +741,19 @@ + MODEL_CLOCK.name = "class generation marker"; + MODEL_ENTITY.name = "block entity marker"; + } ++ ++ /*********************************************************** ++ * FML Start ++ ***********************************************************/ ++ private static Map, Set> customVariantNames = Maps.newHashMap(); ++ public static void addVariantName(Item item, String... names) ++ { ++ if (customVariantNames.containsKey(item.delegate)) ++ customVariantNames.get(item.delegate).addAll(Lists.newArrayList(names)); ++ else ++ customVariantNames.put(item.delegate, Sets.newHashSet(names)); ++ } ++ /*********************************************************** ++ * FML End ++ ***********************************************************/ + } diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch new file mode 100644 index 000000000..cdc1701f2 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/model/ModelManager.java ++++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelManager.java +@@ -25,9 +25,10 @@ + + public void onResourceManagerReload(IResourceManager resourceManager) + { +- ModelBakery modelbakery = new ModelBakery(resourceManager, this.texMap, this.modelProvider); ++ ModelBakery modelbakery = new net.minecraftforge.client.model.ModelLoader(resourceManager, this.texMap, this.modelProvider); + this.modelRegistry = modelbakery.setupModelRegistry(); + this.defaultModel = (IBakedModel)this.modelRegistry.getObject(ModelBakery.MODEL_MISSING); ++ net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.modelRegistry, modelbakery); + this.modelProvider.reloadModels(); + } + diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch new file mode 100644 index 000000000..b32056ee8 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch @@ -0,0 +1,21 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/model/ModelRotation.java ++++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelRotation.java +@@ -10,7 +10,7 @@ + import org.lwjgl.util.vector.Vector3f; + + @SideOnly(Side.CLIENT) +-public enum ModelRotation ++public enum ModelRotation implements net.minecraftforge.client.model.IModelState, net.minecraftforge.client.model.ITransformation + { + X0_Y0(0, 0), + X0_Y90(0, 90), +@@ -117,4 +117,9 @@ + mapRotations.put(Integer.valueOf(modelrotation.combinedXY), modelrotation); + } + } ++ ++ public net.minecraftforge.client.model.TRSRTransformation apply(net.minecraftforge.client.model.IModelPart part) { return new net.minecraftforge.client.model.TRSRTransformation(getMatrix()); } ++ public javax.vecmath.Matrix4f getMatrix() { return net.minecraftforge.client.ForgeHooksClient.getMatrix(this); } ++ public EnumFacing rotate(EnumFacing facing) { return rotateFace(facing); } ++ public int rotate(EnumFacing facing, int vertexIndex) { return rotateVertex(facing, vertexIndex); } + } diff --git a/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch b/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch new file mode 100644 index 000000000..8255b2b57 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/settings/GameSettings.java ++++ ../src-work/minecraft/net/minecraft/client/settings/GameSettings.java +@@ -983,6 +983,7 @@ + + public void saveOptions() + { ++ if (net.minecraftforge.fml.client.FMLClientHandler.instance().isLoading()) return; + try + { + PrintWriter printwriter = new PrintWriter(new FileWriter(this.optionsFile)); diff --git a/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch b/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch new file mode 100644 index 000000000..c8627e9df --- /dev/null +++ b/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch @@ -0,0 +1,57 @@ +--- ../src-base/minecraft/net/minecraft/client/shader/Framebuffer.java ++++ ../src-work/minecraft/net/minecraft/client/shader/Framebuffer.java +@@ -120,8 +120,17 @@ + if (this.useDepth) + { + OpenGlHelper.glBindRenderbuffer(OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); ++ if (!this.stencilEnabled) ++ { + OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, 33190, this.framebufferTextureWidth, this.framebufferTextureHeight); + OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_DEPTH_ATTACHMENT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); ++ } ++ else ++ { ++ OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, org.lwjgl.opengl.EXTPackedDepthStencil.GL_DEPTH24_STENCIL8_EXT, this.framebufferTextureWidth, this.framebufferTextureHeight); ++ OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, org.lwjgl.opengl.EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); ++ OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, org.lwjgl.opengl.EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); ++ } + } + + this.framebufferClear(); +@@ -281,4 +290,36 @@ + GlStateManager.clear(i); + this.unbindFramebuffer(); + } ++ ++ /*================================ FORGE START ================================================*/ ++ private boolean stencilEnabled = false; ++ /** ++ * Attempts to enabled 8 bits of stencil buffer on this FrameBuffer. ++ * Modders must call this directly to set things up. ++ * This is to prevent the default cause where graphics cards do not support stencil bits. ++ * Modders should check the below 'isStencilEnabled' to check if another modder has already enabled them. ++ * ++ * Note: ++ * As of now the only thing that is checked is if FBOs are supported entirely, in the future ++ * we may expand to check for errors. ++ * ++ * @return True if the FBO was re-initialized with stencil bits. ++ */ ++ public boolean enableStencil() ++ { ++ if (!OpenGlHelper.isFramebufferEnabled()) return false; ++ stencilEnabled = true; ++ this.createBindFramebuffer(framebufferWidth, framebufferHeight); ++ return true; //TODO: Find a way to detect if this failed? ++ } ++ ++ /** ++ * Returns wither or not this FBO has been successfully initialized with stencil bits. ++ * If not, and a modder wishes it to be, they must call enableStencil. ++ */ ++ public boolean isStencilEnabled() ++ { ++ return this.stencilEnabled; ++ } ++ /*================================ FORGE END ================================================*/ + } diff --git a/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch b/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch new file mode 100644 index 000000000..d32116092 --- /dev/null +++ b/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/command/CommandEnchant.java ++++ ../src-work/minecraft/net/minecraft/command/CommandEnchant.java +@@ -95,7 +95,7 @@ + { + Enchantment enchantment2 = Enchantment.getEnchantmentById(l); + +- if (!enchantment2.canApplyTogether(enchantment1)) ++ if (!enchantment2.canApplyTogether(enchantment1) || !enchantment1.canApplyTogether(enchantment2)) //Forge BugFix: Let Both enchantments veto being together + { + throw new CommandException("commands.enchant.cantCombine", new Object[] {enchantment1.getTranslatedName(j), enchantment2.getTranslatedName(nbttaglist.getCompoundTagAt(k).getShort("lvl"))}); + } diff --git a/patches/minecraft/net/minecraft/command/CommandFill.java.patch b/patches/minecraft/net/minecraft/command/CommandFill.java.patch new file mode 100644 index 000000000..8e20f9235 --- /dev/null +++ b/patches/minecraft/net/minecraft/command/CommandFill.java.patch @@ -0,0 +1,28 @@ +--- ../src-base/minecraft/net/minecraft/command/CommandFill.java ++++ ../src-work/minecraft/net/minecraft/command/CommandFill.java +@@ -50,6 +50,7 @@ + { + i = parseInt(args[7], 0, 15); + } ++ IBlockState state = block.getStateFromMeta(i); + + BlockPos blockpos2 = new BlockPos(Math.min(blockpos.getX(), blockpos1.getX()), Math.min(blockpos.getY(), blockpos1.getY()), Math.min(blockpos.getZ(), blockpos1.getZ())); + BlockPos blockpos3 = new BlockPos(Math.max(blockpos.getX(), blockpos1.getX()), Math.max(blockpos.getY(), blockpos1.getY()), Math.max(blockpos.getZ(), blockpos1.getZ())); +@@ -77,7 +78,7 @@ + NBTTagCompound nbttagcompound = new NBTTagCompound(); + boolean flag = false; + +- if (args.length >= 10 && block.hasTileEntity()) ++ if (args.length >= 10 && block.hasTileEntity(state)) + { + String s = getChatComponentFromNthArg(sender, args, 9).getUnformattedText(); + +@@ -118,7 +119,7 @@ + continue; + } + } +- else if (args[8].equals("replace") && !block.hasTileEntity()) ++ else if (args[8].equals("replace") && !block.hasTileEntity(state)) + { + if (args.length > 9) + { diff --git a/patches/minecraft/net/minecraft/command/CommandHandler.java.patch b/patches/minecraft/net/minecraft/command/CommandHandler.java.patch new file mode 100644 index 000000000..5f0607c6e --- /dev/null +++ b/patches/minecraft/net/minecraft/command/CommandHandler.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/command/CommandHandler.java ++++ ../src-work/minecraft/net/minecraft/command/CommandHandler.java +@@ -45,6 +45,16 @@ + } + else if (icommand.canCommandSenderUse(sender)) + { ++ net.minecraftforge.event.CommandEvent event = new net.minecraftforge.event.CommandEvent(icommand, sender, astring); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) ++ { ++ if (event.exception != null) ++ { ++ com.google.common.base.Throwables.propagateIfPossible(event.exception); ++ } ++ return 1; ++ } ++ + if (i > -1) + { + List list = PlayerSelector.matchEntities(sender, astring[i], Entity.class); diff --git a/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch b/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch new file mode 100644 index 000000000..44ccb6290 --- /dev/null +++ b/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/command/server/CommandSetBlock.java ++++ ../src-work/minecraft/net/minecraft/command/server/CommandSetBlock.java +@@ -54,6 +54,8 @@ + i = parseInt(args[4], 0, 15); + } + ++ IBlockState state = block.getStateFromMeta(i); ++ + World world = sender.getEntityWorld(); + + if (!world.isBlockLoaded(blockpos)) +@@ -65,7 +67,7 @@ + NBTTagCompound nbttagcompound = new NBTTagCompound(); + boolean flag = false; + +- if (args.length >= 7 && block.hasTileEntity()) ++ if (args.length >= 7 && block.hasTileEntity(state)) + { + String s = getChatComponentFromNthArg(sender, args, 6).getUnformattedText(); + diff --git a/patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch b/patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch new file mode 100644 index 000000000..69ac8d584 --- /dev/null +++ b/patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/command/server/CommandTestForBlock.java ++++ ../src-work/minecraft/net/minecraft/command/server/CommandTestForBlock.java +@@ -72,7 +72,7 @@ + NBTTagCompound nbttagcompound = new NBTTagCompound(); + boolean flag = false; + +- if (args.length >= 6 && block.hasTileEntity()) ++ if (args.length >= 6 && block.hasTileEntity(block.getStateFromMeta(i))) + { + String s = getChatComponentFromNthArg(sender, args, 5).getUnformattedText(); + diff --git a/patches/minecraft/net/minecraft/crash/CrashReport.java.patch b/patches/minecraft/net/minecraft/crash/CrashReport.java.patch new file mode 100644 index 000000000..60537445f --- /dev/null +++ b/patches/minecraft/net/minecraft/crash/CrashReport.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/crash/CrashReport.java ++++ ../src-work/minecraft/net/minecraft/crash/CrashReport.java +@@ -123,6 +123,7 @@ + return IntCache.getCacheSizes(); + } + }); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().enhanceCrashReport(this, this.theReportCategory); + } + + public String getDescription() +@@ -211,6 +212,8 @@ + { + StringBuilder stringbuilder = new StringBuilder(); + stringbuilder.append("---- Minecraft Crash Report ----\n"); ++ net.minecraftforge.fml.common.asm.transformers.BlamingTransformer.onCrash(stringbuilder); ++ net.minecraftforge.fml.relauncher.CoreModManager.onCrash(stringbuilder); + stringbuilder.append("// "); + stringbuilder.append(getWittyComment()); + stringbuilder.append("\n\n"); diff --git a/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch b/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch new file mode 100644 index 000000000..6df8dd809 --- /dev/null +++ b/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch @@ -0,0 +1,16 @@ +--- ../src-base/minecraft/net/minecraft/crash/CrashReportCategory.java ++++ ../src-work/minecraft/net/minecraft/crash/CrashReportCategory.java +@@ -118,8 +118,11 @@ + } + else + { +- this.stackTrace = new StackTraceElement[astacktraceelement.length - 3 - size]; +- System.arraycopy(astacktraceelement, 3 + size, this.stackTrace, 0, this.stackTrace.length); ++ int len = astacktraceelement.length - 3 - size; ++ // Really Mojang, Still, god damn... ++ if (len <= 0) len = astacktraceelement.length; ++ this.stackTrace = new StackTraceElement[len]; ++ System.arraycopy(astacktraceelement, astacktraceelement.length - len, this.stackTrace, 0, this.stackTrace.length); + return this.stackTrace.length; + } + } diff --git a/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch b/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch new file mode 100644 index 000000000..a9a51a63f --- /dev/null +++ b/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch @@ -0,0 +1,106 @@ +--- ../src-base/minecraft/net/minecraft/creativetab/CreativeTabs.java ++++ ../src-work/minecraft/net/minecraft/creativetab/CreativeTabs.java +@@ -138,8 +138,22 @@ + private ItemStack iconItemStack; + private static final String __OBFID = "CL_00000005"; + ++ public CreativeTabs(String label) ++ { ++ this(getNextID(), label); ++ } ++ + public CreativeTabs(int index, String label) + { ++ if (index >= creativeTabArray.length) ++ { ++ CreativeTabs[] tmp = new CreativeTabs[index + 1]; ++ for (int x = 0; x < creativeTabArray.length; x++) ++ { ++ tmp[x] = creativeTabArray[x]; ++ } ++ creativeTabArray = tmp; ++ } + this.tabIndex = index; + this.tabLabel = label; + creativeTabArray[index] = this; +@@ -222,12 +236,20 @@ + @SideOnly(Side.CLIENT) + public int getTabColumn() + { ++ if (tabIndex > 11) ++ { ++ return ((tabIndex - 12) % 10) % 5; ++ } + return this.tabIndex % 6; + } + + @SideOnly(Side.CLIENT) + public boolean isTabInFirstRow() + { ++ if (tabIndex > 11) ++ { ++ return ((tabIndex - 12) % 10) < 5; ++ } + return this.tabIndex < 6; + } + +@@ -269,10 +291,17 @@ + { + for (Item item : Item.itemRegistry) + { +- if (item != null && item.getCreativeTab() == this) ++ if (item == null) + { +- item.getSubItems(item, this, p_78018_1_); ++ continue; + } ++ for (CreativeTabs tab : item.getCreativeTabs()) ++ { ++ if (tab == this) ++ { ++ item.getSubItems(item, this, p_78018_1_); ++ } ++ } + } + + if (this.getRelevantEnchantmentTypes() != null) +@@ -305,4 +334,39 @@ + } + } + } ++ ++ public int getTabPage() ++ { ++ if (tabIndex > 11) ++ { ++ return ((tabIndex - 12) / 10) + 1; ++ } ++ return 0; ++ } ++ ++ public static int getNextID() ++ { ++ return creativeTabArray.length; ++ } ++ ++ /** ++ * Determines if the search bar should be shown for this tab. ++ * ++ * @return True to show the bar ++ */ ++ public boolean hasSearchBar() ++ { ++ return tabIndex == CreativeTabs.tabAllSearch.tabIndex; ++ } ++ ++ /** ++ * Gets the width of the search bar of the creative tab, use this if your ++ * creative tab name overflows together with a custom texture. ++ * ++ * @return The width of the search bar, 89 by default ++ */ ++ public int getSearchbarWidth() ++ { ++ return 89; ++ } + } diff --git a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch new file mode 100644 index 000000000..a8e5b3f38 --- /dev/null +++ b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/enchantment/Enchantment.java ++++ ../src-work/minecraft/net/minecraft/enchantment/Enchantment.java +@@ -62,7 +62,7 @@ + + if (enchantmentsList[enchID] != null) + { +- throw new IllegalArgumentException("Duplicate enchantment id!"); ++ throw new IllegalArgumentException("Duplicate enchantment id! " + this.getClass() + " and " + enchantmentsList[enchID].getClass() + " Enchantment ID:" + enchID); + } + else + { diff --git a/patches/minecraft/net/minecraft/entity/Entity.java.patch b/patches/minecraft/net/minecraft/entity/Entity.java.patch new file mode 100644 index 000000000..befb40446 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/Entity.java.patch @@ -0,0 +1,312 @@ +--- ../src-base/minecraft/net/minecraft/entity/Entity.java ++++ ../src-work/minecraft/net/minecraft/entity/Entity.java +@@ -130,6 +130,14 @@ + private final CommandResultStats cmdResultStats; + private static final String __OBFID = "CL_00001533"; + ++ /** Forge: Used to store custom data for each entity. */ ++ private NBTTagCompound customEntityData; ++ public boolean captureDrops = false; ++ public java.util.ArrayList capturedDrops = new java.util.ArrayList(); ++ private UUID persistentID; ++ ++ protected java.util.HashMap extendedProperties = new java.util.HashMap(); ++ + public int getEntityId() + { + return this.entityId; +@@ -173,6 +181,8 @@ + this.dataWatcher.addObject(2, ""); + this.dataWatcher.addObject(4, Byte.valueOf((byte)0)); + this.entityInit(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this)); ++ for (net.minecraftforge.common.IExtendedEntityProperties props : extendedProperties.values()) props.init(this, worldIn); + } + + protected abstract void entityInit(); +@@ -999,10 +1009,7 @@ + + if (block.getMaterial() == materialIn) + { +- float f = BlockLiquid.getLiquidHeightPercent(iblockstate.getBlock().getMetaFromState(iblockstate)) - 0.11111111F; +- float f1 = (float)(blockpos.getY() + 1) - f; +- boolean flag = d0 < (double)f1; +- return !flag && this instanceof EntityPlayer ? false : flag; ++ return net.minecraftforge.common.ForgeHooks.isInsideOfMaterial(materialIn, this, blockpos); + } + else + { +@@ -1357,6 +1364,21 @@ + tagCompund.setBoolean("Silent", this.isSilent()); + } + ++ if (customEntityData != null) tagCompund.setTag("ForgeData", customEntityData); ++ for (String identifier : this.extendedProperties.keySet()) ++ { ++ try ++ { ++ net.minecraftforge.common.IExtendedEntityProperties props = this.extendedProperties.get(identifier); ++ props.saveNBTData(tagCompund); ++ } ++ catch (Throwable t) ++ { ++ net.minecraftforge.fml.common.FMLLog.severe("Failed to save extended properties for %s. This is a mod issue.", identifier); ++ t.printStackTrace(); ++ } ++ } ++ + this.writeEntityToNBT(tagCompund); + + if (this.ridingEntity != null) +@@ -1439,6 +1461,28 @@ + this.setAlwaysRenderNameTag(tagCompund.getBoolean("CustomNameVisible")); + this.cmdResultStats.func_179668_a(tagCompund); + this.setSilent(tagCompund.getBoolean("Silent")); ++ ++ if (tagCompund.hasKey("ForgeData")) customEntityData = tagCompund.getCompoundTag("ForgeData"); ++ for (String identifier : this.extendedProperties.keySet()) ++ { ++ try ++ { ++ net.minecraftforge.common.IExtendedEntityProperties props = this.extendedProperties.get(identifier); ++ props.loadNBTData(tagCompund); ++ } ++ catch (Throwable t) ++ { ++ net.minecraftforge.fml.common.FMLLog.severe("Failed to load extended properties for %s. This is a mod issue.", identifier); ++ t.printStackTrace(); ++ } ++ } ++ ++ //Rawr, legacy code, Vanilla added a UUID, keep this so older maps will convert properly ++ if (tagCompund.hasKey("PersistentIDMSB") && tagCompund.hasKey("PersistentIDLSB")) ++ { ++ this.entityUniqueID = new UUID(tagCompund.getLong("PersistentIDMSB"), tagCompund.getLong("PersistentIDLSB")); ++ } ++ + this.readEntityFromNBT(tagCompund); + + if (this.shouldSetPosAfterLoading()) +@@ -1513,7 +1557,10 @@ + { + EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)offsetY, this.posZ, itemStackIn); + entityitem.setDefaultPickupDelay(); +- this.worldObj.spawnEntityInWorld(entityitem); ++ if (captureDrops) ++ this.capturedDrops.add(entityitem); ++ else ++ this.worldObj.spawnEntityInWorld(entityitem); + return entityitem; + } + else +@@ -1656,6 +1703,7 @@ + + public void mountEntity(Entity entityIn) + { ++ if(!(this instanceof EntityLivingBase) && !net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entityIn, true)){ return; } + this.entityRiderPitchDelta = 0.0D; + this.entityRiderYawDelta = 0.0D; + +@@ -1790,7 +1838,7 @@ + + public boolean isRiding() + { +- return this.ridingEntity != null; ++ return this.ridingEntity != null && ridingEntity.shouldRiderSit(); + } + + public boolean isSneaking() +@@ -2093,7 +2141,7 @@ + + public float getExplosionResistance(Explosion p_180428_1_, World worldIn, BlockPos p_180428_3_, IBlockState p_180428_4_) + { +- return p_180428_4_.getBlock().getExplosionResistance(this); ++ return p_180428_4_.getBlock().getExplosionResistance(worldIn, p_180428_3_.add(0, getEyeHeight(), 0), this, p_180428_1_); + } + + public boolean func_174816_a(Explosion p_174816_1_, World worldIn, BlockPos p_174816_3_, IBlockState p_174816_4_, float p_174816_5_) +@@ -2358,4 +2406,184 @@ + + EnchantmentHelper.func_151385_b(p_174815_1_, p_174815_2_); + } ++ ++ /* ================================== Forge Start =====================================*/ ++ /** ++ * Returns a NBTTagCompound that can be used to store custom data for this entity. ++ * It will be written, and read from disc, so it persists over world saves. ++ * @return A NBTTagCompound ++ */ ++ public NBTTagCompound getEntityData() ++ { ++ if (customEntityData == null) ++ { ++ customEntityData = new NBTTagCompound(); ++ } ++ return customEntityData; ++ } ++ ++ /** ++ * Used in model rendering to determine if the entity riding this entity should be in the 'sitting' position. ++ * @return false to prevent an entity that is mounted to this entity from displaying the 'sitting' animation. ++ */ ++ public boolean shouldRiderSit() ++ { ++ return true; ++ } ++ ++ /** ++ * Called when a user uses the creative pick block button on this entity. ++ * ++ * @param target The full target the player is looking at ++ * @return A ItemStack to add to the player's inventory, Null if nothing should be added. ++ */ ++ public ItemStack getPickedResult(MovingObjectPosition target) ++ { ++ if (this instanceof net.minecraft.entity.item.EntityPainting) ++ { ++ return new ItemStack(net.minecraft.init.Items.painting); ++ } ++ else if (this instanceof EntityLeashKnot) ++ { ++ return new ItemStack(net.minecraft.init.Items.lead); ++ } ++ else if (this instanceof net.minecraft.entity.item.EntityItemFrame) ++ { ++ ItemStack held = ((net.minecraft.entity.item.EntityItemFrame)this).getDisplayedItem(); ++ if (held == null) ++ { ++ return new ItemStack(net.minecraft.init.Items.item_frame); ++ } ++ else ++ { ++ return held.copy(); ++ } ++ } ++ else if (this instanceof net.minecraft.entity.item.EntityMinecart) ++ { ++ return ((net.minecraft.entity.item.EntityMinecart)this).getCartItem(); ++ } ++ else if (this instanceof net.minecraft.entity.item.EntityBoat) ++ { ++ return new ItemStack(net.minecraft.init.Items.boat); ++ } ++ else if (this instanceof net.minecraft.entity.item.EntityArmorStand) ++ { ++ return new ItemStack(net.minecraft.init.Items.armor_stand); ++ } ++ else ++ { ++ int id = EntityList.getEntityID(this); ++ if (id > 0 && EntityList.entityEggs.containsKey(id)) ++ { ++ return new ItemStack(net.minecraft.init.Items.spawn_egg, 1, id); ++ } ++ String name = EntityList.getEntityString(this); ++ if (name != null && net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().containsKey(name)) ++ { ++ ItemStack stack = new ItemStack(net.minecraft.init.Items.spawn_egg); ++ stack.setTagInfo("entity_name", new net.minecraft.nbt.NBTTagString(name)); ++ return stack; ++ } ++ } ++ return null; ++ } ++ ++ public UUID getPersistentID() ++ { ++ return entityUniqueID; ++ } ++ ++ /** ++ * Reset the entity ID to a new value. Not to be used from Mod code ++ */ ++ public final void resetEntityId() ++ { ++ this.entityId = nextEntityID++; ++ } ++ ++ public boolean shouldRenderInPass(int pass) ++ { ++ return pass == 0; ++ } ++ ++ /** ++ * Returns true if the entity is of the @link{EnumCreatureType} provided ++ * @param type The EnumCreatureType type this entity is evaluating ++ * @param forSpawnCount If this is being invoked to check spawn count caps. ++ * @return If the creature is of the type provided ++ */ ++ public boolean isCreatureType(EnumCreatureType type, boolean forSpawnCount) ++ { ++ if (forSpawnCount && (this instanceof EntityLiving) && ((EntityLiving)this).isNoDespawnRequired()) return false; ++ return type.getCreatureClass().isAssignableFrom(this.getClass()); ++ } ++ ++ /** ++ * Register the instance of IExtendedProperties into the entity's collection. ++ * @param identifier The identifier which you can use to retrieve these properties for the entity. ++ * @param properties The instanceof IExtendedProperties to register ++ * @return The identifier that was used to register the extended properties. Empty String indicates an error. If your requested key already existed, this will return a modified one that is unique. ++ */ ++ public String registerExtendedProperties(String identifier, net.minecraftforge.common.IExtendedEntityProperties properties) ++ { ++ if (identifier == null) ++ { ++ net.minecraftforge.fml.common.FMLLog.warning("Someone is attempting to register extended properties using a null identifier. This is not allowed. Aborting. This may have caused instability."); ++ return ""; ++ } ++ if (properties == null) ++ { ++ net.minecraftforge.fml.common.FMLLog.warning("Someone is attempting to register null extended properties. This is not allowed. Aborting. This may have caused instability."); ++ return ""; ++ } ++ ++ String baseIdentifier = identifier; ++ int identifierModCount = 1; ++ while (this.extendedProperties.containsKey(identifier)) ++ { ++ identifier = String.format("%s%d", baseIdentifier, identifierModCount++); ++ } ++ ++ if (baseIdentifier != identifier) ++ { ++ net.minecraftforge.fml.common.FMLLog.info("An attempt was made to register exended properties using an existing key. The duplicate identifier (%s) has been remapped to %s.", baseIdentifier, identifier); ++ } ++ ++ this.extendedProperties.put(identifier, properties); ++ return identifier; ++ } ++ ++ /** ++ * Gets the extended properties identified by the passed in key ++ * @param identifier The key that identifies the extended properties. ++ * @return The instance of IExtendedProperties that was found, or null. ++ */ ++ public net.minecraftforge.common.IExtendedEntityProperties getExtendedProperties(String identifier) ++ { ++ return this.extendedProperties.get(identifier); ++ } ++ ++ /** ++ * If a rider of this entity can interact with this entity. Should return true on the ++ * ridden entity if so. ++ * ++ * @return if the entity can be interacted with from a rider ++ */ ++ public boolean canRiderInteract() ++ { ++ return false; ++ } ++ ++ /** ++ * If the rider should be dismounted from the entity when the entity goes under water ++ * ++ * @param rider The entity that is riding ++ * @return if the entity should be dismounted when under water ++ */ ++ public boolean shouldDismountInWater(Entity rider) ++ { ++ return this instanceof EntityLivingBase; ++ } ++ /* ================================== Forge End =====================================*/ + } diff --git a/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch b/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch new file mode 100644 index 000000000..a9cab8a70 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityHanging.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityHanging.java +@@ -124,6 +124,9 @@ + { + BlockPos blockpos1 = blockpos.offset(enumfacing, k).up(l); + Block block = this.worldObj.getBlockState(blockpos1).getBlock(); ++ ++ if ( block.isSideSolid( this.worldObj, blockpos1, this.field_174860_b )) ++ continue; + + if (!block.getMaterial().isSolid() && !BlockRedstoneDiode.isRedstoneRepeaterBlockID(block)) + { diff --git a/patches/minecraft/net/minecraft/entity/EntityList.java.patch b/patches/minecraft/net/minecraft/entity/EntityList.java.patch new file mode 100644 index 000000000..de360280c --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/EntityList.java.patch @@ -0,0 +1,56 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityList.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityList.java +@@ -89,6 +89,7 @@ + + public static void addMapping(Class p_75618_0_, String p_75618_1_, int p_75618_2_) + { ++ if (p_75618_2_ < 0 || p_75618_2_ > 255) throw new IllegalArgumentException("Attempted to register a entity with invalid ID: " + p_75618_2_ + " Name: " + p_75618_1_ + " Class: " + p_75618_0_); + if (stringToClassMapping.containsKey(p_75618_1_)) + { + throw new IllegalArgumentException("ID is already registered: " + p_75618_1_); +@@ -168,7 +169,17 @@ + + if (entity != null) + { ++ try ++ { + entity.readFromNBT(p_75615_0_); ++ } ++ catch (Exception e) ++ { ++ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, ++ "An Entity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", ++ p_75615_0_.getString("id"), oclass.getName()); ++ entity = null; ++ } + } + else + { +@@ -344,7 +355,9 @@ + + public static class EntityEggInfo + { ++ @Deprecated // This is not always a valid number in the global ID list. + public final int spawnedID; ++ public final String name; + public final int primaryColor; + public final int secondaryColor; + public final StatBase field_151512_d; +@@ -358,6 +371,17 @@ + this.secondaryColor = p_i1583_3_; + this.field_151512_d = StatList.getStatKillEntity(this); + this.field_151513_e = StatList.getStatEntityKilledBy(this); ++ this.name = EntityList.getStringFromID(p_i1583_1_); + } ++ ++ public EntityEggInfo(String name, int primaryColor, int secondaryColor) ++ { ++ this.spawnedID = -1; ++ this.name = name; ++ this.primaryColor = primaryColor; ++ this.secondaryColor = secondaryColor; ++ this.field_151512_d = (new StatBase("stat.killEntity." + name, new net.minecraft.util.ChatComponentTranslation("stat.entityKill", new net.minecraft.util.ChatComponentTranslation("entity." + name + ".name")))).registerStat(); ++ this.field_151513_e = (new StatBase("stat.entityKilledBy." + name, new net.minecraft.util.ChatComponentTranslation("stat.entityKilledBy", new net.minecraft.util.ChatComponentTranslation("entity." + name + ".name")))).registerStat(); ++ } + } + } diff --git a/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch b/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch new file mode 100644 index 000000000..58f9c41d6 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch @@ -0,0 +1,41 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityLiving.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityLiving.java +@@ -122,6 +122,7 @@ + public void setAttackTarget(EntityLivingBase p_70624_1_) + { + this.attackTarget = p_70624_1_; ++ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, p_70624_1_); + } + + public boolean canAttackClass(Class p_70686_1_) +@@ -499,10 +500,22 @@ + + protected void despawnEntity() + { ++ net.minecraftforge.fml.common.eventhandler.Event.Result result = null; + if (this.persistenceRequired) + { + this.entityAge = 0; + } ++ else if ((this.entityAge & 0x1F) == 0x1F && (result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this)) != net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT) ++ { ++ if (result == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ { ++ this.entityAge = 0; ++ } ++ else ++ { ++ this.setDead(); ++ } ++ } + else + { + Entity entity = this.worldObj.getClosestPlayerToEntity(this, -1.0D); +@@ -622,7 +635,6 @@ + return this.worldObj.checkNoEntityCollision(this.getEntityBoundingBox(), this) && this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(this.getEntityBoundingBox()); + } + +- @SideOnly(Side.CLIENT) + public float getRenderSizeModifier() + { + return 1.0F; diff --git a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch new file mode 100644 index 000000000..58a52ac43 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -0,0 +1,185 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java +@@ -381,6 +381,7 @@ + { + this.entityLivingToAttack = livingBase; + this.revengeTimer = this.ticksExisted; ++ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, livingBase); + } + + public EntityLivingBase getLastAttacker() +@@ -664,7 +665,6 @@ + return this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD; + } + +- @SideOnly(Side.CLIENT) + public void removePotionEffectClient(int p_70618_1_) + { + this.activePotionsMap.remove(Integer.valueOf(p_70618_1_)); +@@ -733,6 +733,7 @@ + + public boolean attackEntityFrom(DamageSource source, float amount) + { ++ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, source, amount)) return false; + if (this.isEntityInvulnerable(source)) + { + return false; +@@ -798,9 +799,9 @@ + this.recentlyHit = 100; + this.attackingPlayer = (EntityPlayer)entity; + } +- else if (entity instanceof EntityWolf) ++ else if (entity instanceof net.minecraft.entity.passive.EntityTameable) + { +- EntityWolf entitywolf = (EntityWolf)entity; ++ net.minecraft.entity.passive.EntityTameable entitywolf = (net.minecraft.entity.passive.EntityTameable)entity; + + if (entitywolf.isTamed()) + { +@@ -884,6 +885,7 @@ + + public void onDeath(DamageSource cause) + { ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; + Entity entity = cause.getEntity(); + EntityLivingBase entitylivingbase = this.func_94060_bK(); + +@@ -909,6 +911,9 @@ + i = EnchantmentHelper.getLootingModifier((EntityLivingBase)entity); + } + ++ captureDrops = true; ++ capturedDrops.clear(); ++ + if (this.func_146066_aG() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) + { + this.dropFewItems(this.recentlyHit > 0, i); +@@ -919,6 +924,16 @@ + this.addRandomArmor(); + } + } ++ ++ captureDrops = false; ++ ++ if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, cause, capturedDrops, i, recentlyHit > 0)) ++ { ++ for (EntityItem item : capturedDrops) ++ { ++ worldObj.spawnEntityInWorld(item); ++ } ++ } + } + + this.worldObj.setEntityState(this, (byte)3); +@@ -973,7 +988,7 @@ + int j = MathHelper.floor_double(this.getEntityBoundingBox().minY); + int k = MathHelper.floor_double(this.posZ); + Block block = this.worldObj.getBlockState(new BlockPos(i, j, k)).getBlock(); +- return (block == Blocks.ladder || block == Blocks.vine) && (!(this instanceof EntityPlayer) || !((EntityPlayer)this).isSpectator()); ++ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(block, worldObj, new BlockPos(i, j, k), this); + } + + public boolean isEntityAlive() +@@ -983,6 +998,9 @@ + + public void fall(float distance, float damageMultiplier) + { ++ float[] ret = net.minecraftforge.common.ForgeHooks.onLivingFall(this, distance, damageMultiplier); ++ if (ret == null) return; ++ distance = ret[0]; damageMultiplier = ret[1]; + super.fall(distance, damageMultiplier); + PotionEffect potioneffect = this.getActivePotionEffect(Potion.jump); + float f = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F; +@@ -1095,6 +1113,8 @@ + { + if (!this.isEntityInvulnerable(damageSrc)) + { ++ damageAmount = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, damageSrc, damageAmount); ++ if (damageAmount <= 0) return; + damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); + damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); + float f = damageAmount; +@@ -1143,6 +1163,11 @@ + + public void swingItem() + { ++ ItemStack stack = this.getHeldItem(); ++ if (stack != null && stack.getItem() != null) ++ { ++ if (stack.getItem().onEntitySwing(this, stack)) return; ++ } + if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0) + { + this.swingProgressInt = -1; +@@ -1282,6 +1307,7 @@ + + public void dismountEntity(Entity p_110145_1_) + { ++ if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_110145_1_, false)){ return; } + double d0 = p_110145_1_.posX; + double d1 = p_110145_1_.getEntityBoundingBox().minY + (double)p_110145_1_.height; + double d2 = p_110145_1_.posZ; +@@ -1347,6 +1373,7 @@ + } + + this.isAirBorne = true; ++ net.minecraftforge.common.ForgeHooks.onLivingJump(this); + } + + protected void updateAITick() +@@ -1531,6 +1558,7 @@ + + public void onUpdate() + { ++ if (net.minecraftforge.common.ForgeHooks.onLivingUpdate(this)) return; + super.onUpdate(); + + if (!this.worldObj.isRemote) +@@ -1819,6 +1847,7 @@ + + public void mountEntity(Entity entityIn) + { ++ if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entityIn, true)){ return; } + if (this.ridingEntity != null && entityIn == null) + { + if (!this.worldObj.isRemote) +@@ -2000,4 +2029,39 @@ + { + this.potionsNeedUpdate = true; + } ++ ++ /*** ++ * Removes all potion effects that have curativeItem as a curative item for its effect ++ * @param curativeItem The itemstack we are using to cure potion effects ++ */ ++ public void curePotionEffects(ItemStack curativeItem) ++ { ++ Iterator potionKey = activePotionsMap.keySet().iterator(); ++ if (worldObj.isRemote) return; ++ ++ while (potionKey.hasNext()) ++ { ++ Integer key = potionKey.next(); ++ PotionEffect effect = (PotionEffect)activePotionsMap.get(key); ++ ++ if (effect.isCurativeItem(curativeItem)) ++ { ++ potionKey.remove(); ++ onFinishedPotionEffect(effect); ++ this.potionsNeedUpdate = true; ++ } ++ } ++ } ++ ++ /** ++ * Returns true if the entity's rider (EntityPlayer) should face forward when mounted. ++ * currently only used in vanilla code by pigs. ++ * ++ * @param player The player who is riding the entity. ++ * @return If the player should orient the same direction as this entity. ++ */ ++ public boolean shouldRiderFaceForward(EntityPlayer player) ++ { ++ return this instanceof net.minecraft.entity.passive.EntityPig; ++ } + } diff --git a/patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch b/patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch new file mode 100644 index 000000000..ad187ed62 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java +@@ -111,6 +111,7 @@ + + public boolean interactFirst(EntityPlayer playerIn) + { ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; + this.commandBlockLogic.func_175574_a(playerIn); + return false; + } diff --git a/patches/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch b/patches/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch new file mode 100644 index 000000000..7ca011b1c --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java ++++ ../src-work/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java +@@ -45,6 +45,12 @@ + return (EntityLiving.SpawnPlacementType)field_180110_a.get(p_180109_0_); + } + ++ public static void setPlacementType(Class entityClass, EntityLiving.SpawnPlacementType placementType) ++ { ++ if(!field_180110_a.containsKey(entityClass)) ++ field_180110_a.put(entityClass, placementType); ++ } ++ + static + { + field_180110_a.put(EntityBat.class, EntityLiving.SpawnPlacementType.ON_GROUND); diff --git a/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch b/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch new file mode 100644 index 000000000..3af4d3ae8 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch @@ -0,0 +1,35 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityTracker.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityTracker.java +@@ -57,6 +57,8 @@ + + public void trackEntity(Entity p_72786_1_) + { ++ if (net.minecraftforge.fml.common.registry.EntityRegistry.instance().tryTrackingEntity(this, p_72786_1_)) return; ++ + if (p_72786_1_ instanceof EntityPlayerMP) + { + this.trackEntity(p_72786_1_, 512, 2); +@@ -333,4 +335,23 @@ + } + } + } ++ ++ /* ======================================== FORGE START =====================================*/ ++ ++ // don't expose the EntityTrackerEntry directly so mods can't mess with the data in there as easily ++ /** ++ * Get all players tracking the given Entity. The Entity must be part of the World that this Tracker belongs to. ++ * @param entity the Entity ++ * @return all players tracking the Entity ++ */ ++ public Set getTrackingPlayers(Entity entity) ++ { ++ EntityTrackerEntry entry = (EntityTrackerEntry) trackedEntityHashTable.lookup(entity.getEntityId()); ++ if (entry == null) ++ return java.util.Collections.emptySet(); ++ else ++ return java.util.Collections.unmodifiableSet(entry.trackingPlayers); ++ } ++ ++ /* ======================================== FORGE END =====================================*/ + } diff --git a/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch b/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch new file mode 100644 index 000000000..2aaa26245 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch @@ -0,0 +1,42 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityTrackerEntry.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityTrackerEntry.java +@@ -380,6 +380,14 @@ + this.lastTrackedEntityMotionY = this.trackedEntity.motionY; + this.motionZ = this.trackedEntity.motionZ; + ++ int posX = MathHelper.floor_double(this.trackedEntity.posX * 32.0D); ++ int posY = MathHelper.floor_double(this.trackedEntity.posY * 32.0D); ++ int posZ = MathHelper.floor_double(this.trackedEntity.posZ * 32.0D); ++ if (posX != this.encodedPosX || posY != this.encodedPosY || posZ != this.encodedPosZ) ++ { ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.makeEntitySpawnAdjustment(this.trackedEntity, p_73117_1_, this.encodedPosX, this.encodedPosY, this.encodedPosZ); ++ } ++ + if (this.sendVelocityUpdates && !(packet instanceof S0FPacketSpawnMob)) + { + p_73117_1_.playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(this.trackedEntity.getEntityId(), this.trackedEntity.motionX, this.trackedEntity.motionY, this.trackedEntity.motionZ)); +@@ -427,12 +435,14 @@ + p_73117_1_.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(this.trackedEntity.getEntityId(), potioneffect)); + } + } ++ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(trackedEntity, p_73117_1_); + } + } + else if (this.trackingPlayers.contains(p_73117_1_)) + { + this.trackingPlayers.remove(p_73117_1_); + p_73117_1_.func_152339_d(this.trackedEntity); ++ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(trackedEntity, p_73117_1_); + } + } + } +@@ -464,6 +474,9 @@ + logger.warn("Fetching addPacket for removed entity"); + } + ++ Packet pkt = net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.getEntitySpawningPacket(this.trackedEntity); ++ if (pkt != null) return pkt; ++ + if (this.trackedEntity instanceof EntityItem) + { + return new S0EPacketSpawnObject(this.trackedEntity, 2, 1); diff --git a/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch b/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch new file mode 100644 index 000000000..6060c996e --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch @@ -0,0 +1,46 @@ +--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java ++++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java +@@ -55,6 +55,19 @@ + } + else + { ++ if (canPenalize) ++ { ++ if (--this.field_75445_i <= 0) ++ { ++ this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); ++ this.field_151497_i = 4 + this.attacker.getRNG().nextInt(7); ++ return this.entityPathEntity != null; ++ } ++ else ++ { ++ return true; ++ } ++ } + this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); + return this.entityPathEntity != null; + } +@@ -92,6 +105,23 @@ + this.field_151496_k = entitylivingbase.posZ; + this.field_75445_i = 4 + this.attacker.getRNG().nextInt(7); + ++ if (this.canPenalize) ++ { ++ this.field_151497_i += failedPathFindingPenalty; ++ if (this.attacker.getNavigator().getPath() != null) ++ { ++ net.minecraft.pathfinding.PathPoint finalPathPoint = this.attacker.getNavigator().getPath().getFinalPathPoint(); ++ if (finalPathPoint != null && entitylivingbase.getDistanceSq(finalPathPoint.xCoord, finalPathPoint.yCoord, finalPathPoint.zCoord) < 1) ++ failedPathFindingPenalty = 0; ++ else ++ failedPathFindingPenalty += 10; ++ } ++ else ++ { ++ failedPathFindingPenalty += 10; ++ } ++ } ++ + if (d0 > 1024.0D) + { + this.field_75445_i += 10; diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch new file mode 100644 index 000000000..21f789a2d --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/entity/boss/EntityDragon.java ++++ ../src-work/minecraft/net/minecraft/entity/boss/EntityDragon.java +@@ -480,9 +480,9 @@ + BlockPos blockpos = new BlockPos(k1, l1, i2); + Block block = this.worldObj.getBlockState(blockpos).getBlock(); + +- if (block.getMaterial() != Material.air) ++ if (!block.isAir(worldObj, new BlockPos(k1, l1, i2))) + { +- if (block != Blocks.barrier && block != Blocks.obsidian && block != Blocks.end_stone && block != Blocks.bedrock && block != Blocks.command_block && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) ++ if (block.canEntityDestroy(worldObj, new BlockPos(k1, l1, i2), this) && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) + { + flag1 = this.worldObj.setBlockToAir(blockpos) || flag1; + } diff --git a/patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch b/patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch new file mode 100644 index 000000000..98bf84269 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/boss/IBossDisplayData.java ++++ ../src-work/minecraft/net/minecraft/entity/boss/IBossDisplayData.java +@@ -4,7 +4,6 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-@SideOnly(Side.CLIENT) + public interface IBossDisplayData + { + float getMaxHealth(); diff --git a/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch b/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch new file mode 100644 index 000000000..124b743a5 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java ++++ ../src-work/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java +@@ -91,7 +91,8 @@ + for (int i = 0; i < list.size(); ++i) + { + Entity entity = (Entity)list.get(i); +- entity.onStruckByLightning(this); ++ if (!net.minecraftforge.event.ForgeEventFactory.onEntityStruckByLightning(entity, this)) ++ entity.onStruckByLightning(this); + } + } + } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch new file mode 100644 index 000000000..b8fbabec6 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch @@ -0,0 +1,25 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityEnderPearl.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityEnderPearl.java +@@ -62,6 +62,9 @@ + + if (entityplayermp.playerNetServerHandler.getNetworkManager().isChannelOpen() && entityplayermp.worldObj == this.worldObj && !entityplayermp.isPlayerSleeping()) + { ++ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ, 5.0F); ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) ++ { // Don't indent to lower patch size + if (this.rand.nextFloat() < 0.05F && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobSpawning")) + { + EntityEndermite entityendermite = new EntityEndermite(this.worldObj); +@@ -75,9 +78,10 @@ + entitylivingbase.mountEntity((Entity)null); + } + +- entitylivingbase.setPositionAndUpdate(this.posX, this.posY, this.posZ); ++ entitylivingbase.setPositionAndUpdate(event.targetX, event.targetY, event.targetZ); + entitylivingbase.fallDistance = 0.0F; +- entitylivingbase.attackEntityFrom(DamageSource.fall, 5.0F); ++ entitylivingbase.attackEntityFrom(DamageSource.fall, event.attackDamage); ++ } + } + } + else if (entitylivingbase != null) diff --git a/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch new file mode 100644 index 000000000..d968e63ea --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch @@ -0,0 +1,94 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityItem.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityItem.java +@@ -30,6 +30,11 @@ + public float hoverStart; + private static final String __OBFID = "CL_00001669"; + ++ /** ++ * The maximum age of this EntityItem. The item is expired once this is reached. ++ */ ++ public int lifespan = 6000; ++ + public EntityItem(World worldIn, double x, double y, double z) + { + super(worldIn); +@@ -47,6 +52,7 @@ + { + this(worldIn, x, y, z); + this.setEntityItemStack(stack); ++ this.lifespan = (stack.getItem() == null ? 6000 : stack.getItem().getEntityLifespan(stack, worldIn)); + } + + protected boolean canTriggerWalking() +@@ -70,6 +76,8 @@ + + public void onUpdate() + { ++ ItemStack stack = this.getDataWatcher().getWatchableObjectItemStack(10); ++ if (stack != null && stack.getItem() != null && stack.getItem().onEntityItemUpdate(this)) return; + if (this.getEntityItem() == null) + { + this.setDead(); +@@ -130,8 +138,16 @@ + + this.handleWaterMovement(); + +- if (!this.worldObj.isRemote && this.age >= 6000) ++ ItemStack item = getDataWatcher().getWatchableObjectItemStack(10); ++ ++ if (!this.worldObj.isRemote && this.age >= lifespan) + { ++ int hook = net.minecraftforge.event.ForgeEventFactory.onItemExpire(this, item); ++ if (hook < 0) this.setDead(); ++ else this.lifespan += hook; ++ } ++ if (item != null && item.stackSize <= 0) ++ { + this.setDead(); + } + } +@@ -272,6 +288,7 @@ + tagCompound.setShort("Health", (short)((byte)this.health)); + tagCompound.setShort("Age", (short)this.age); + tagCompound.setShort("PickupDelay", (short)this.delayBeforeCanPickup); ++ tagCompound.setInteger("Lifespan", lifespan); + + if (this.getThrower() != null) + { +@@ -312,20 +329,23 @@ + NBTTagCompound nbttagcompound = tagCompund.getCompoundTag("Item"); + this.setEntityItemStack(ItemStack.loadItemStackFromNBT(nbttagcompound)); + +- if (this.getEntityItem() == null) +- { +- this.setDead(); +- } ++ ItemStack item = getDataWatcher().getWatchableObjectItemStack(10); ++ if (item == null || item.stackSize <= 0) this.setDead(); ++ if (tagCompund.hasKey("Lifespan")) lifespan = tagCompund.getInteger("Lifespan"); + } + + public void onCollideWithPlayer(EntityPlayer entityIn) + { + if (!this.worldObj.isRemote) + { ++ if (this.delayBeforeCanPickup > 0) return; + ItemStack itemstack = this.getEntityItem(); + int i = itemstack.stackSize; + +- if (this.delayBeforeCanPickup == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack)) ++ int hook = net.minecraftforge.event.ForgeEventFactory.onItemPickup(this, entityIn, itemstack); ++ if (hook < 0) return; ++ ++ if (this.delayBeforeCanPickup <= 0 && (this.owner == null || lifespan - this.age <= 200 || this.owner.equals(entityIn.getName())) && (hook == 1 || i <= 0 || entityIn.inventory.addItemStackToInventory(itemstack))) + { + if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log)) + { +@@ -362,6 +382,7 @@ + } + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerItemPickupEvent(entityIn, this); + if (!this.isSilent()) + { + this.worldObj.playSoundAtEntity(entityIn, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch new file mode 100644 index 000000000..3b105563f --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityItemFrame.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityItemFrame.java +@@ -123,7 +123,7 @@ + { + if (p_110131_1_ != null) + { +- if (p_110131_1_.getItem() == Items.filled_map) ++ if (p_110131_1_.getItem() instanceof net.minecraft.item.ItemMap) + { + MapData mapdata = ((ItemMap)p_110131_1_.getItem()).getMapData(p_110131_1_, this.worldObj); + mapdata.playersVisibleOnMap.remove("frame-" + this.getEntityId()); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch new file mode 100644 index 000000000..b63ce4387 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch @@ -0,0 +1,389 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecart.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecart.java +@@ -51,6 +51,20 @@ + private double velocityZ; + private static final String __OBFID = "CL_00001670"; + ++ /* Forge: Minecart Compatibility Layer Integration. */ ++ public static float defaultMaxSpeedAirLateral = 0.4f; ++ public static float defaultMaxSpeedAirVertical = -1f; ++ public static double defaultDragAir = 0.94999998807907104D; ++ protected boolean canUseRail = true; ++ protected boolean canBePushed = true; ++ private static net.minecraftforge.common.IMinecartCollisionHandler collisionHandler = null; ++ ++ /* Instance versions of the above physics properties */ ++ private float currentSpeedRail = getMaxCartSpeedOnRail(); ++ protected float maxSpeedAirLateral = defaultMaxSpeedAirLateral; ++ protected float maxSpeedAirVertical = defaultMaxSpeedAirVertical; ++ protected double dragAir = defaultDragAir; ++ + public EntityMinecart(World worldIn) + { + super(worldIn); +@@ -96,17 +110,19 @@ + + public AxisAlignedBB getCollisionBox(Entity entityIn) + { ++ if (getCollisionHandler() != null) return getCollisionHandler().getCollisionBox(this, entityIn); + return entityIn.canBePushed() ? entityIn.getEntityBoundingBox() : null; + } + + public AxisAlignedBB getBoundingBox() + { ++ if (getCollisionHandler() != null) return getCollisionHandler().getBoundingBox(this); + return null; + } + + public boolean canBePushed() + { +- return true; ++ return canBePushed; + } + + public EntityMinecart(World worldIn, double p_i1713_2_, double p_i1713_4_, double p_i1713_6_) +@@ -310,7 +326,7 @@ + BlockPos blockpos = new BlockPos(k, l, i1); + IBlockState iblockstate = this.worldObj.getBlockState(blockpos); + +- if (BlockRailBase.isRailBlock(iblockstate)) ++ if (canUseRail() && BlockRailBase.isRailBlock(iblockstate)) + { + this.func_180460_a(blockpos, iblockstate); + +@@ -368,6 +384,7 @@ + } + + this.handleWaterMovement(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartUpdateEvent(this, this.getCurrentRailPosition())); + } + } + +@@ -382,10 +399,21 @@ + + protected void moveDerailedMinecart() + { +- double d0 = this.func_174898_m(); ++ double d0 = onGround ? this.func_174898_m() : getMaxSpeedAirLateral(); + this.motionX = MathHelper.clamp_double(this.motionX, -d0, d0); + this.motionZ = MathHelper.clamp_double(this.motionZ, -d0, d0); + ++ double moveY = motionY; ++ if(getMaxSpeedAirVertical() > 0 && motionY > getMaxSpeedAirVertical()) ++ { ++ moveY = getMaxSpeedAirVertical(); ++ if(Math.abs(motionX) < 0.3f && Math.abs(motionZ) < 0.3f) ++ { ++ moveY = 0.15f; ++ motionY = moveY; ++ } ++ } ++ + if (this.onGround) + { + this.motionX *= 0.5D; +@@ -393,13 +421,13 @@ + this.motionZ *= 0.5D; + } + +- this.moveEntity(this.motionX, this.motionY, this.motionZ); ++ this.moveEntity(this.motionX, moveY, this.motionZ); + + if (!this.onGround) + { +- this.motionX *= 0.949999988079071D; +- this.motionY *= 0.949999988079071D; +- this.motionZ *= 0.949999988079071D; ++ this.motionX *= getDragAir(); ++ this.motionY *= getDragAir(); ++ this.motionZ *= getDragAir(); + } + } + +@@ -482,7 +510,7 @@ + } + } + +- if (flag1) ++ if (flag1 && shouldDoRailFunctions()) + { + double d17 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + +@@ -578,8 +606,14 @@ + this.motionZ = d5 * (double)(i - p_180460_1_.getZ()); + } + +- if (flag) ++ ++ if(shouldDoRailFunctions()) + { ++ ((BlockRailBase)p_180460_2_.getBlock()).onMinecartPass(worldObj, this, p_180460_1_); ++ } ++ ++ if (flag && shouldDoRailFunctions()) ++ { + double d15 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + + if (d15 > 0.01D) +@@ -818,13 +852,20 @@ + + public void applyEntityCollision(Entity entityIn) + { ++ ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartCollisionEvent(this, entityIn)); ++ if (getCollisionHandler() != null) ++ { ++ getCollisionHandler().onEntityCollision(this, entityIn); ++ return; ++ } + if (!this.worldObj.isRemote) + { + if (!entityIn.noClip && !this.noClip) + { + if (entityIn != this.riddenByEntity) + { +- if (entityIn instanceof EntityLivingBase && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && this.getMinecartType() == EntityMinecart.EnumMinecartType.RIDEABLE && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && entityIn.ridingEntity == null) ++ if (entityIn instanceof EntityLivingBase && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && canBeRidden() && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && entityIn.ridingEntity == null) + { + entityIn.mountEntity(this); + } +@@ -870,7 +911,7 @@ + double d7 = entityIn.motionX + this.motionX; + double d8 = entityIn.motionZ + this.motionZ; + +- if (((EntityMinecart)entityIn).getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE && this.getMinecartType() != EntityMinecart.EnumMinecartType.FURNACE) ++ if (((EntityMinecart)entityIn).isPoweredCart() && !isPoweredCart()) + { + this.motionX *= 0.20000000298023224D; + this.motionZ *= 0.20000000298023224D; +@@ -878,7 +919,7 @@ + entityIn.motionX *= 0.949999988079071D; + entityIn.motionZ *= 0.949999988079071D; + } +- else if (((EntityMinecart)entityIn).getMinecartType() != EntityMinecart.EnumMinecartType.FURNACE && this.getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE) ++ else if (((EntityMinecart)entityIn).isPoweredCart() && isPoweredCart()) + { + entityIn.motionX *= 0.20000000298023224D; + entityIn.motionZ *= 0.20000000298023224D; +@@ -1043,6 +1084,221 @@ + } + } + ++ /* =================================== FORGE START ===========================================*/ ++ private BlockPos getCurrentRailPosition() ++ { ++ int x = MathHelper.floor_double(this.posX); ++ int y = MathHelper.floor_double(this.posY); ++ int z = MathHelper.floor_double(this.posZ); ++ ++ if (BlockRailBase.isRailBlock(this.worldObj, new BlockPos(x, y - 1, z))) y--; ++ return new BlockPos(x, y, z); ++ } ++ ++ protected double getMaxSpeed() ++ { ++ if (!canUseRail()) return func_174898_m(); ++ BlockPos pos = this.getCurrentRailPosition(); ++ IBlockState state = this.worldObj.getBlockState(pos); ++ if (!BlockRailBase.isRailBlock(state)) return func_174898_m(); ++ ++ float railMaxSpeed = ((BlockRailBase)state.getBlock()).getRailMaxSpeed(worldObj, this, pos); ++ return Math.min(railMaxSpeed, getCurrentCartSpeedCapOnRail()); ++ } ++ ++ /** ++ * Moved to allow overrides. ++ * This code handles minecart movement and speed capping when on a rail. ++ */ ++ public void moveMinecartOnRail(BlockPos pos) ++ { ++ double mX = this.motionX; ++ double mZ = this.motionZ; ++ ++ if (this.riddenByEntity != null) ++ { ++ mX *= 0.75D; ++ mZ *= 0.75D; ++ } ++ ++ double max = this.getMaxSpeed(); ++ mX = MathHelper.clamp_double(mX, -max, max); ++ mZ = MathHelper.clamp_double(mZ, -max, max); ++ this.moveEntity(mX, 0.0D, mZ); ++ } ++ ++ /** ++ * Gets the current global Minecart Collision handler if none ++ * is registered, returns null ++ * @return The collision handler or null ++ */ ++ public static net.minecraftforge.common.IMinecartCollisionHandler getCollisionHandler() ++ { ++ return collisionHandler; ++ } ++ ++ /** ++ * Sets the global Minecart Collision handler, overwrites any ++ * that is currently set. ++ * @param handler The new handler ++ */ ++ public static void setCollisionHandler(net.minecraftforge.common.IMinecartCollisionHandler handler) ++ { ++ collisionHandler = handler; ++ } ++ ++ /** ++ * This function returns an ItemStack that represents this cart. ++ * This should be an ItemStack that can be used by the player to place the cart, ++ * but is not necessary the item the cart drops when destroyed. ++ * @return An ItemStack that can be used to place the cart. ++ */ ++ public ItemStack getCartItem() ++ { ++ if (this instanceof EntityMinecartFurnace) ++ { ++ return new ItemStack(Items.furnace_minecart); ++ } ++ else if (this instanceof EntityMinecartChest) ++ { ++ return new ItemStack(Items.chest_minecart); ++ } ++ else if (this instanceof EntityMinecartTNT) ++ { ++ return new ItemStack(Items.tnt_minecart); ++ } ++ else if (this instanceof EntityMinecartHopper) ++ { ++ return new ItemStack(Items.hopper_minecart); ++ } ++ else if (this instanceof EntityMinecartCommandBlock) ++ { ++ return new ItemStack(Items.command_block_minecart); ++ } ++ return new ItemStack(Items.minecart); ++ } ++ ++ /** ++ * Returns true if this cart can currently use rails. ++ * This function is mainly used to gracefully detach a minecart from a rail. ++ * @return True if the minecart can use rails. ++ */ ++ public boolean canUseRail() ++ { ++ return canUseRail; ++ } ++ ++ /** ++ * Set whether the minecart can use rails. ++ * This function is mainly used to gracefully detach a minecart from a rail. ++ * @param use Whether the minecart can currently use rails. ++ */ ++ public void setCanUseRail(boolean use) ++ { ++ canUseRail = use; ++ } ++ ++ /** ++ * Return false if this cart should not call onMinecartPass() and should ignore Powered Rails. ++ * @return True if this cart should call onMinecartPass(). ++ */ ++ public boolean shouldDoRailFunctions() ++ { ++ return true; ++ } ++ ++ /** ++ * Returns true if this cart is self propelled. ++ * @return True if powered. ++ */ ++ public boolean isPoweredCart() ++ { ++ return getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE; ++ } ++ ++ /** ++ * Returns true if this cart can be ridden by an Entity. ++ * @return True if this cart can be ridden. ++ */ ++ public boolean canBeRidden() ++ { ++ return this.getMinecartType() == EntityMinecart.EnumMinecartType.RIDEABLE; ++ } ++ ++ /** ++ * Getters/setters for physics variables ++ */ ++ ++ /** ++ * Returns the carts max speed when traveling on rails. Carts going faster ++ * than 1.1 cause issues with chunk loading. Carts cant traverse slopes or ++ * corners at greater than 0.5 - 0.6. This value is compared with the rails ++ * max speed and the carts current speed cap to determine the carts current ++ * max speed. A normal rail's max speed is 0.4. ++ * ++ * @return Carts max speed. ++ */ ++ public float getMaxCartSpeedOnRail() ++ { ++ return 1.2f; ++ } ++ ++ /** ++ * Returns the current speed cap for the cart when traveling on rails. This ++ * functions differs from getMaxCartSpeedOnRail() in that it controls ++ * current movement and cannot be overridden. The value however can never be ++ * higher than getMaxCartSpeedOnRail(). ++ * ++ * @return ++ */ ++ public final float getCurrentCartSpeedCapOnRail() ++ { ++ return currentSpeedRail; ++ } ++ ++ public final void setCurrentCartSpeedCapOnRail(float value) ++ { ++ value = Math.min(value, getMaxCartSpeedOnRail()); ++ currentSpeedRail = value; ++ } ++ ++ public float getMaxSpeedAirLateral() ++ { ++ return maxSpeedAirLateral; ++ } ++ ++ public void setMaxSpeedAirLateral(float value) ++ { ++ maxSpeedAirLateral = value; ++ } ++ ++ public float getMaxSpeedAirVertical() ++ { ++ return maxSpeedAirVertical; ++ } ++ ++ public void setMaxSpeedAirVertical(float value) ++ { ++ maxSpeedAirVertical = value; ++ } ++ ++ public double getDragAir() ++ { ++ return dragAir; ++ } ++ ++ public void setDragAir(double value) ++ { ++ dragAir = value; ++ } ++ ++ public double getSlopeAdjustment() ++ { ++ return 0.0078125D; ++ } ++ ++ /* =================================== FORGE END ===========================================*/ ++ + public static enum EnumMinecartType + { + RIDEABLE(0, "MinecartRideable"), diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch new file mode 100644 index 000000000..eac3dfcbd --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java +@@ -181,6 +181,7 @@ + + public boolean interactFirst(EntityPlayer playerIn) + { ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; + if (!this.worldObj.isRemote) + { + playerIn.displayGUIChest(this); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch new file mode 100644 index 000000000..729dcfd0a --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java +@@ -20,6 +20,7 @@ + + public boolean interactFirst(EntityPlayer playerIn) + { ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; + if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn) + { + return true; diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch new file mode 100644 index 000000000..46cb9f930 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java +@@ -132,6 +132,7 @@ + + public boolean interactFirst(EntityPlayer playerIn) + { ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; + ItemStack itemstack = playerIn.inventory.getCurrentItem(); + + if (itemstack != null && itemstack.getItem() == Items.coal) diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch new file mode 100644 index 000000000..9b0750816 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java +@@ -55,6 +55,7 @@ + + public boolean interactFirst(EntityPlayer playerIn) + { ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; + if (!this.worldObj.isRemote) + { + playerIn.displayGUIChest(this); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch new file mode 100644 index 000000000..8b2d12c33 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityXPOrb.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityXPOrb.java +@@ -200,6 +200,7 @@ + { + if (this.field_70532_c == 0 && entityIn.xpCooldown == 0) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerPickupXpEvent(entityIn, this))) return; + entityIn.xpCooldown = 2; + this.worldObj.playSoundAtEntity(entityIn, "random.orb", 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F)); + entityIn.onItemPickup(this, 1); diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch new file mode 100644 index 000000000..148ad918a --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch @@ -0,0 +1,21 @@ +--- ../src-base/minecraft/net/minecraft/entity/monster/EntityEnderman.java ++++ ../src-work/minecraft/net/minecraft/entity/monster/EntityEnderman.java +@@ -366,6 +366,18 @@ + } + } + ++ /*===================================== Forge Start ==============================*/ ++ public static void setCarriable(Block block, boolean canCarry) ++ { ++ if (canCarry) carriableBlocks.add(block); ++ else carriableBlocks.remove(block); ++ } ++ public static boolean getCarriable(Block block) ++ { ++ return carriableBlocks.contains(block); ++ } ++ /*===================================== Forge End ==============================*/ ++ + public boolean isScreaming() + { + return this.dataWatcher.getWatchableObjectByte(18) > 0; diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch new file mode 100644 index 000000000..b68b510e8 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java ++++ ../src-work/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java +@@ -105,6 +105,7 @@ + { + this.motionY = (double)(0.42F + (float)this.getSlimeSize() * 0.1F); + this.isAirBorne = true; ++ net.minecraftforge.common.ForgeHooks.onLivingJump(this); + } + + protected void func_180466_bG() diff --git a/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch new file mode 100644 index 000000000..9a88af07b --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/entity/monster/EntitySlime.java ++++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySlime.java +@@ -272,7 +272,7 @@ + BlockPos blockpos = new BlockPos(MathHelper.floor_double(this.posX), 0, MathHelper.floor_double(this.posZ)); + Chunk chunk = this.worldObj.getChunkFromBlockCoords(blockpos); + +- if (this.worldObj.getWorldInfo().getTerrainType() == WorldType.FLAT && this.rand.nextInt(4) != 1) ++ if (this.worldObj.getWorldInfo().getTerrainType().handleSlimeSpawnReduction(rand, worldObj)) + { + return false; + } diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch new file mode 100644 index 000000000..f14566563 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch @@ -0,0 +1,51 @@ +--- ../src-base/minecraft/net/minecraft/entity/monster/EntityZombie.java ++++ ../src-work/minecraft/net/minecraft/entity/monster/EntityZombie.java +@@ -88,7 +88,7 @@ + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(35.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); +- this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * 0.10000000149011612D); ++ this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * net.minecraftforge.common.ForgeModContainer.zombieSummonBaseChance); + } + + protected void entityInit() +@@ -230,12 +230,25 @@ + entitylivingbase = (EntityLivingBase)source.getEntity(); + } + +- if (entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue()) ++ int i = MathHelper.floor_double(this.posX); ++ int j = MathHelper.floor_double(this.posY); ++ int k = MathHelper.floor_double(this.posZ); ++ ++ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent summonAid = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, worldObj, i, j, k, entitylivingbase, this.getEntityAttribute(reinforcementChance).getAttributeValue()); ++ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return true; ++ ++ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || ++ entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue()) + { +- int i = MathHelper.floor_double(this.posX); +- int j = MathHelper.floor_double(this.posY); +- int k = MathHelper.floor_double(this.posZ); +- EntityZombie entityzombie = new EntityZombie(this.worldObj); ++ EntityZombie entityzombie; ++ if (summonAid.customSummonedAid != null && summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW) ++ { ++ entityzombie = summonAid.customSummonedAid; ++ } ++ else ++ { ++ entityzombie = new EntityZombie(this.worldObj); ++ } + + for (int l = 0; l < 50; ++l) + { +@@ -250,7 +263,7 @@ + if (!this.worldObj.func_175636_b((double)i1, (double)j1, (double)k1, 7.0D) && this.worldObj.checkNoEntityCollision(entityzombie.getEntityBoundingBox(), entityzombie) && this.worldObj.getCollidingBoundingBoxes(entityzombie, entityzombie.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(entityzombie.getEntityBoundingBox())) + { + this.worldObj.spawnEntityInWorld(entityzombie); +- entityzombie.setAttackTarget(entitylivingbase); ++ if (entitylivingbase != null) entityzombie.setAttackTarget(entitylivingbase); + entityzombie.func_180482_a(this.worldObj.getDifficultyForLocation(new BlockPos(entityzombie)), (IEntityLivingData)null); + this.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0)); + entityzombie.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0)); diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch new file mode 100644 index 000000000..797d03d7d --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/entity/passive/EntityHorse.java ++++ ../src-work/minecraft/net/minecraft/entity/passive/EntityHorse.java +@@ -1249,6 +1249,7 @@ + } + + this.jumpPower = 0.0F; ++ net.minecraftforge.common.ForgeHooks.onLivingJump(this); + } + + this.stepHeight = 1.0F; diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch new file mode 100644 index 000000000..f6bdbce10 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch @@ -0,0 +1,62 @@ +--- ../src-base/minecraft/net/minecraft/entity/passive/EntityMooshroom.java ++++ ../src-work/minecraft/net/minecraft/entity/passive/EntityMooshroom.java +@@ -9,7 +9,7 @@ + import net.minecraft.util.EnumParticleTypes; + import net.minecraft.world.World; + +-public class EntityMooshroom extends EntityCow ++public class EntityMooshroom extends EntityCow implements net.minecraftforge.common.IShearable + { + private static final String __OBFID = "CL_00001645"; + +@@ -20,6 +20,7 @@ + this.field_175506_bl = Blocks.mycelium; + } + ++ @SuppressWarnings("unused") + public boolean interact(EntityPlayer player) + { + ItemStack itemstack = player.inventory.getCurrentItem(); +@@ -39,7 +40,7 @@ + } + } + +- if (itemstack != null && itemstack.getItem() == Items.shears && this.getGrowingAge() >= 0) ++ if (false && itemstack != null && itemstack.getItem() == Items.shears && this.getGrowingAge() >= 0) //Forge Disable, Moved to onSheared + { + this.setDead(); + this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); +@@ -79,4 +80,33 @@ + { + return new EntityMooshroom(this.worldObj); + } ++ ++ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos){ return getGrowingAge() >= 0; } ++ @Override ++ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos, int fortune) ++ { ++ this.setDead(); ++ this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); ++ ++ EntityCow entitycow = new EntityCow(this.worldObj); ++ entitycow.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); ++ entitycow.setHealth(this.getHealth()); ++ entitycow.renderYawOffset = this.renderYawOffset; ++ ++ if (this.hasCustomName()) ++ { ++ entitycow.setCustomNameTag(this.getCustomNameTag()); ++ } ++ ++ this.worldObj.spawnEntityInWorld(entitycow); ++ ++ java.util.List ret = new java.util.ArrayList(); ++ for (int i = 0; i < 5; ++i) ++ { ++ ret.add(new ItemStack(Blocks.red_mushroom)); ++ } ++ ++ this.playSound("mob.sheep.shear", 1.0F, 1.0F); ++ return ret; ++ } + } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch new file mode 100644 index 000000000..993f39518 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/entity/passive/EntityOcelot.java ++++ ../src-work/minecraft/net/minecraft/entity/passive/EntityOcelot.java +@@ -280,7 +280,7 @@ + + Block block = this.worldObj.getBlockState(blockpos.down()).getBlock(); + +- if (block == Blocks.grass || block.getMaterial() == Material.leaves) ++ if (block == Blocks.grass || block.isLeaves(worldObj, blockpos.down())) + { + return true; + } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch new file mode 100644 index 000000000..11dac9488 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch @@ -0,0 +1,45 @@ +--- ../src-base/minecraft/net/minecraft/entity/passive/EntitySheep.java ++++ ../src-work/minecraft/net/minecraft/entity/passive/EntitySheep.java +@@ -35,7 +35,7 @@ + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +-public class EntitySheep extends EntityAnimal ++public class EntitySheep extends EntityAnimal implements net.minecraftforge.common.IShearable + { + private final InventoryCrafting inventoryCrafting = new InventoryCrafting(new Container() + { +@@ -142,11 +142,12 @@ + } + } + ++ @SuppressWarnings("unused") + public boolean interact(EntityPlayer player) + { + ItemStack itemstack = player.inventory.getCurrentItem(); + +- if (itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared() && !this.isChild()) ++ if (false && itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared() && !this.isChild()) //Forge: Moved to onSheared + { + if (!this.worldObj.isRemote) + { +@@ -329,4 +330,19 @@ + field_175514_bm.put(EnumDyeColor.RED, new float[] {0.6F, 0.2F, 0.2F}); + field_175514_bm.put(EnumDyeColor.BLACK, new float[] {0.1F, 0.1F, 0.1F}); + } ++ ++ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return !this.getSheared() && !this.isChild(); } ++ @Override ++ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ this.setSheared(true); ++ int i = 1 + this.rand.nextInt(3); ++ ++ java.util.List ret = new java.util.ArrayList(); ++ for (int j = 0; j < i; ++j) ++ ret.add(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, this.getFleeceColor().getMetadata())); ++ ++ this.playSound("mob.sheep.shear", 1.0F, 1.0F); ++ return ret; ++ } + } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch new file mode 100644 index 000000000..201f72c94 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch @@ -0,0 +1,36 @@ +--- ../src-base/minecraft/net/minecraft/entity/passive/EntityVillager.java ++++ ../src-work/minecraft/net/minecraft/entity/passive/EntityVillager.java +@@ -81,6 +81,7 @@ + private boolean isLookingForHome; + private boolean field_175564_by; + private InventoryBasic villagerInventory; ++ @Deprecated //Use VillagerRegistry + private static final EntityVillager.ITradeList[][][][] DEFAULT_TRADE_LIST_MAP = new EntityVillager.ITradeList[][][][] {{{{new EntityVillager.EmeraldForItems(Items.wheat, new EntityVillager.PriceInfo(18, 22)), new EntityVillager.EmeraldForItems(Items.potato, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.EmeraldForItems(Items.carrot, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.ListItemForEmeralds(Items.bread, new EntityVillager.PriceInfo(-4, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.pumpkin), new EntityVillager.PriceInfo(8, 13)), new EntityVillager.ListItemForEmeralds(Items.pumpkin_pie, new EntityVillager.PriceInfo(-3, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.melon_block), new EntityVillager.PriceInfo(7, 12)), new EntityVillager.ListItemForEmeralds(Items.apple, new EntityVillager.PriceInfo(-5, -7))}, {new EntityVillager.ListItemForEmeralds(Items.cookie, new EntityVillager.PriceInfo(-6, -10)), new EntityVillager.ListItemForEmeralds(Items.cake, new EntityVillager.PriceInfo(1, 1))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ItemAndEmeraldToItem(Items.fish, new EntityVillager.PriceInfo(6, 6), Items.cooked_fish, new EntityVillager.PriceInfo(6, 6))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.fishing_rod, new EntityVillager.PriceInfo(7, 8))}}, {{new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.wool), new EntityVillager.PriceInfo(16, 22)), new EntityVillager.ListItemForEmeralds(Items.shears, new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 0), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 1), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 2), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 3), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 4), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 5), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 6), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 7), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 8), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 9), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 10), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 11), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 12), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 13), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 14), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 15), new EntityVillager.PriceInfo(1, 2))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.ListItemForEmeralds(Items.arrow, new EntityVillager.PriceInfo(-12, -8))}, {new EntityVillager.ListItemForEmeralds(Items.bow, new EntityVillager.PriceInfo(2, 3)), new EntityVillager.ItemAndEmeraldToItem(Item.getItemFromBlock(Blocks.gravel), new EntityVillager.PriceInfo(10, 10), Items.flint, new EntityVillager.PriceInfo(6, 10))}}}, {{{new EntityVillager.EmeraldForItems(Items.paper, new EntityVillager.PriceInfo(24, 36)), new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.EmeraldForItems(Items.book, new EntityVillager.PriceInfo(8, 10)), new EntityVillager.ListItemForEmeralds(Items.compass, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.bookshelf), new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.EmeraldForItems(Items.written_book, new EntityVillager.PriceInfo(2, 2)), new EntityVillager.ListItemForEmeralds(Items.clock, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glass), new EntityVillager.PriceInfo(-5, -3))}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListItemForEmeralds(Items.name_tag, new EntityVillager.PriceInfo(20, 22))}}}, {{{new EntityVillager.EmeraldForItems(Items.rotten_flesh, new EntityVillager.PriceInfo(36, 40)), new EntityVillager.EmeraldForItems(Items.gold_ingot, new EntityVillager.PriceInfo(8, 10))}, {new EntityVillager.ListItemForEmeralds(Items.redstone, new EntityVillager.PriceInfo(-4, -1)), new EntityVillager.ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new EntityVillager.PriceInfo(-2, -1))}, {new EntityVillager.ListItemForEmeralds(Items.ender_eye, new EntityVillager.PriceInfo(7, 11)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glowstone), new EntityVillager.PriceInfo(-3, -1))}, {new EntityVillager.ListItemForEmeralds(Items.experience_bottle, new EntityVillager.PriceInfo(3, 11))}}}, {{{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_helmet, new EntityVillager.PriceInfo(4, 6))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListItemForEmeralds(Items.iron_chestplate, new EntityVillager.PriceInfo(10, 14))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_chestplate, new EntityVillager.PriceInfo(16, 19))}, {new EntityVillager.ListItemForEmeralds(Items.chainmail_boots, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_leggings, new EntityVillager.PriceInfo(9, 11)), new EntityVillager.ListItemForEmeralds(Items.chainmail_helmet, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_chestplate, new EntityVillager.PriceInfo(11, 15))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_axe, new EntityVillager.PriceInfo(6, 8))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_sword, new EntityVillager.PriceInfo(9, 10))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_sword, new EntityVillager.PriceInfo(12, 15)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_axe, new EntityVillager.PriceInfo(9, 12))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_shovel, new EntityVillager.PriceInfo(5, 7))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_pickaxe, new EntityVillager.PriceInfo(9, 11))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_pickaxe, new EntityVillager.PriceInfo(12, 15))}}}, {{{new EntityVillager.EmeraldForItems(Items.porkchop, new EntityVillager.PriceInfo(14, 18)), new EntityVillager.EmeraldForItems(Items.chicken, new EntityVillager.PriceInfo(14, 18))}, {new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.cooked_porkchop, new EntityVillager.PriceInfo(-7, -5)), new EntityVillager.ListItemForEmeralds(Items.cooked_chicken, new EntityVillager.PriceInfo(-8, -6))}}, {{new EntityVillager.EmeraldForItems(Items.leather, new EntityVillager.PriceInfo(9, 12)), new EntityVillager.ListItemForEmeralds(Items.leather_leggings, new EntityVillager.PriceInfo(2, 4))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.leather_chestplate, new EntityVillager.PriceInfo(7, 12))}, {new EntityVillager.ListItemForEmeralds(Items.saddle, new EntityVillager.PriceInfo(8, 10))}}}}; + private static final String __OBFID = "CL_00001707"; + +@@ -211,7 +212,7 @@ + ItemStack itemstack = player.inventory.getCurrentItem(); + boolean flag = itemstack != null && itemstack.getItem() == Items.spawn_egg; + +- if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild()) ++ if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild() && !player.isSneaking()) + { + if (!this.worldObj.isRemote && (this.buyingList == null || this.buyingList.size() > 0)) + { +@@ -636,6 +637,7 @@ + } + } + ++ //TODO: Hook into VillagerRegistry to get name + if (s1 != null) + { + ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("entity.Villager." + s1, new Object[0]); +@@ -698,7 +700,7 @@ + public IEntityLivingData func_180482_a(DifficultyInstance p_180482_1_, IEntityLivingData p_180482_2_) + { + p_180482_2_ = super.func_180482_a(p_180482_1_, p_180482_2_); +- this.setProfession(this.worldObj.rand.nextInt(5)); ++ net.minecraftforge.fml.common.registry.VillagerRegistry.setRandomProfession(this, this.worldObj.rand); + this.func_175552_ct(); + return p_180482_2_; + } diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch new file mode 100644 index 000000000..dd00fa8f1 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch @@ -0,0 +1,66 @@ +--- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayerMP.java ++++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayerMP.java +@@ -124,14 +124,15 @@ + public boolean playerConqueredTheEnd; + private static final String __OBFID = "CL_00001440"; + ++ @SuppressWarnings("unused") + public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, ItemInWorldManager interactionManager) + { + super(worldIn, profile); + interactionManager.thisPlayerMP = this; + this.theItemInWorldManager = interactionManager; +- BlockPos blockpos = worldIn.getSpawnPoint(); ++ BlockPos blockpos = worldIn.provider.getRandomizedSpawnPoint(); + +- if (!worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) ++ if (false && !worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) + { + int i = Math.max(5, server.getSpawnProtectionSize() - 6); + int j = MathHelper.floor_double(worldIn.getWorldBorder().getClosestDistance((double)blockpos.getX(), (double)blockpos.getZ())); +@@ -224,7 +225,7 @@ + + this.openContainer.detectAndSendChanges(); + +- if (!this.worldObj.isRemote && !this.openContainer.canInteractWith(this)) ++ if (!this.worldObj.isRemote && !net.minecraftforge.common.ForgeHooks.canInteractWith(this, this.openContainer)) + { + this.closeScreen(); + this.openContainer = this.inventoryContainer; +@@ -425,6 +426,7 @@ + + public void onDeath(DamageSource cause) + { ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; + if (this.worldObj.getGameRules().getGameRuleBooleanValue("showDeathMessages")) + { + Team team = this.getTeam(); +@@ -448,7 +450,20 @@ + + if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) + { ++ captureDrops = true; ++ capturedDrops.clear(); ++ + this.inventory.dropAllItems(); ++ ++ captureDrops = false; ++ net.minecraftforge.event.entity.player.PlayerDropsEvent event = new net.minecraftforge.event.entity.player.PlayerDropsEvent(this, cause, capturedDrops, recentlyHit > 0); ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) ++ { ++ for (net.minecraft.entity.item.EntityItem item : capturedDrops) ++ { ++ joinEntityItemWithWorld(item); ++ } ++ } + } + + for (ScoreObjective scoreobjective : this.worldObj.getScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.deathCount)) +@@ -832,6 +847,7 @@ + { + if (stat != null) + { ++ if (stat.isAchievement() && net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.AchievementEvent(this, (net.minecraft.stats.Achievement) stat))) return; + this.statsFile.func_150871_b(this, stat, amount); + + for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(stat.func_150952_k())) diff --git a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch new file mode 100644 index 000000000..ac3aca4d5 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/entity/player/InventoryPlayer.java ++++ ../src-work/minecraft/net/minecraft/entity/player/InventoryPlayer.java +@@ -316,6 +316,14 @@ + this.mainInventory[i].updateAnimation(this.player.worldObj, this.player, i, this.currentItem == i); + } + } ++ ++ for (int i = 0; i < armorInventory.length; i++) ++ { ++ if (armorInventory[i] != null) ++ { ++ armorInventory[i].getItem().onArmorTick(player.worldObj, player, armorInventory[i]); ++ } ++ } + } + + public boolean consumeInventoryItem(Item p_146026_1_) diff --git a/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch b/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch new file mode 100644 index 000000000..7f66e993b --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/entity/projectile/EntityFishHook.java ++++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityFishHook.java +@@ -568,11 +568,19 @@ + } + } + ++ @SuppressWarnings("unused") + private ItemStack getFishingResult() + { + float f = this.worldObj.rand.nextFloat(); + int i = EnchantmentHelper.getLuckOfSeaModifier(this.angler); + int j = EnchantmentHelper.getLureModifier(this.angler); ++ ++ if (true) ++ { ++ this.angler.addStat(net.minecraftforge.common.FishingHooks.getFishableCategory(f, i, j).stat, 1); ++ return net.minecraftforge.common.FishingHooks.getRandomFishable(this.rand, f, i, j); ++ } ++ + float f1 = 0.1F - (float)i * 0.025F - (float)j * 0.01F; + float f2 = 0.05F + (float)i * 0.01F - (float)j * 0.01F; + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); diff --git a/patches/minecraft/net/minecraft/init/Bootstrap.java.patch b/patches/minecraft/net/minecraft/init/Bootstrap.java.patch new file mode 100644 index 000000000..5e3c96037 --- /dev/null +++ b/patches/minecraft/net/minecraft/init/Bootstrap.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/init/Bootstrap.java ++++ ../src-work/minecraft/net/minecraft/init/Bootstrap.java +@@ -66,6 +66,7 @@ + return alreadyRegistered; + } + ++ @SuppressWarnings("unused") + static void registerDispenserBehaviors() + { + BlockDispenser.dispenseBehaviorRegistry.putObject(Items.arrow, new BehaviorProjectileDispense() +@@ -143,7 +144,7 @@ + double d0 = source.getX() + (double)enumfacing.getFrontOffsetX(); + double d1 = (double)((float)source.getBlockPos().getY() + 0.2F); + double d2 = source.getZ() + (double)enumfacing.getFrontOffsetZ(); +- Entity entity = ItemMonsterPlacer.spawnCreature(source.getWorld(), stack.getMetadata(), d0, d1, d2); ++ Entity entity = ItemMonsterPlacer.spawnCreature(source.getWorld(), ItemMonsterPlacer.getEntityName(stack), d0, d1, d2); + + if (entity instanceof EntityLivingBase && stack.hasDisplayName()) + { diff --git a/patches/minecraft/net/minecraft/inventory/Container.java.patch b/patches/minecraft/net/minecraft/inventory/Container.java.patch new file mode 100644 index 000000000..a588231ef --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/Container.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/inventory/Container.java ++++ ../src-work/minecraft/net/minecraft/inventory/Container.java +@@ -609,7 +609,7 @@ + Slot slot1 = (Slot)this.inventorySlots.get(i); + ItemStack itemstack1 = slot1.getStack(); + +- if (itemstack1 == null) ++ if (itemstack1 == null && slot.isItemValid(stack)) // Forge: Make sure to respect isItemValid in the slot. + { + slot1.putStack(stack.copy()); + slot1.onSlotChanged(); diff --git a/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch new file mode 100644 index 000000000..ddd38b322 --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/inventory/ContainerBeacon.java ++++ ../src-work/minecraft/net/minecraft/inventory/ContainerBeacon.java +@@ -146,7 +146,7 @@ + + public boolean isItemValid(ItemStack stack) + { +- return stack == null ? false : stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot; ++ return stack == null ? false : stack.getItem().isBeaconPayment(stack); + } + + public int getSlotStackLimit() diff --git a/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch new file mode 100644 index 000000000..1e81b6f65 --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/inventory/ContainerBrewingStand.java ++++ ../src-work/minecraft/net/minecraft/inventory/ContainerBrewingStand.java +@@ -157,7 +157,7 @@ + + public boolean isItemValid(ItemStack stack) + { +- return stack != null ? stack.getItem().isPotionIngredient(stack) : false; ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack); + } + + public int getSlotStackLimit() +@@ -189,7 +189,7 @@ + + public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) + { +- if (stack.getItem() == Items.potionitem && stack.getMetadata() > 0) ++ if (stack.getItem() instanceof net.minecraft.item.ItemPotion && stack.getMetadata() > 0) + { + this.player.triggerAchievement(AchievementList.potion); + } +@@ -199,7 +199,7 @@ + + public static boolean canHoldPotion(ItemStack p_75243_0_) + { +- return p_75243_0_ != null && (p_75243_0_.getItem() == Items.potionitem || p_75243_0_.getItem() == Items.glass_bottle); ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_75243_0_); + } + } + } diff --git a/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch new file mode 100644 index 000000000..35b99f86c --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/inventory/ContainerPlayer.java ++++ ../src-work/minecraft/net/minecraft/inventory/ContainerPlayer.java +@@ -45,7 +45,8 @@ + } + public boolean isItemValid(ItemStack stack) + { +- return stack == null ? false : (stack.getItem() instanceof ItemArmor ? ((ItemArmor)stack.getItem()).armorType == k_f : (stack.getItem() != Item.getItemFromBlock(Blocks.pumpkin) && stack.getItem() != Items.skull ? false : k_f == 0)); ++ if (stack == null) return false; ++ return stack.getItem().isValidArmor(stack, k_f, thePlayer); + } + @SideOnly(Side.CLIENT) + public String getSlotTexture() diff --git a/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch new file mode 100644 index 000000000..aeaba7115 --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch @@ -0,0 +1,47 @@ +--- ../src-base/minecraft/net/minecraft/inventory/ContainerRepair.java ++++ ../src-work/minecraft/net/minecraft/inventory/ContainerRepair.java +@@ -73,6 +73,8 @@ + playerIn.addExperienceLevel(-ContainerRepair.this.maximumCost); + } + ++ float breakChance = net.minecraftforge.common.ForgeHooks.onAnvilRepair(playerIn, stack, ContainerRepair.this.inputSlots.getStackInSlot(0), ContainerRepair.this.inputSlots.getStackInSlot(1)); ++ + ContainerRepair.this.inputSlots.setInventorySlotContents(0, (ItemStack)null); + + if (ContainerRepair.this.materialCost > 0) +@@ -97,7 +99,7 @@ + ContainerRepair.this.maximumCost = 0; + IBlockState iblockstate = worldIn.getBlockState(blockPosIn); + +- if (!playerIn.capabilities.isCreativeMode && !worldIn.isRemote && iblockstate.getBlock() == Blocks.anvil && playerIn.getRNG().nextFloat() < 0.12F) ++ if (!playerIn.capabilities.isCreativeMode && !worldIn.isRemote && iblockstate.getBlock() == Blocks.anvil && playerIn.getRNG().nextFloat() < breakChance) + { + int l = ((Integer)iblockstate.getValue(BlockAnvil.DAMAGE)).intValue(); + ++l; +@@ -175,6 +177,7 @@ + + if (itemstack2 != null) + { ++ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, outputSlot, repairedItemName, i2)) return; + flag = itemstack2.getItem() == Items.enchanted_book && Items.enchanted_book.getEnchantments(itemstack2).tagCount() > 0; + + if (itemstack1.isItemStackDamageable() && itemstack1.getItem().getIsRepairable(itemstack, itemstack2)) +@@ -267,7 +270,8 @@ + { + int i4 = ((Integer)iterator.next()).intValue(); + +- if (i4 != i5 && !enchantment.canApplyTogether(Enchantment.getEnchantmentById(i4))) ++ Enchantment e2 = Enchantment.getEnchantmentById(i4); ++ if (i4 != i5 && !(enchantment.canApplyTogether(e2) && e2.canApplyTogether(enchantment))) //Forge BugFix: Let Both enchantments veto being together + { + flag1 = false; + ++l1; +@@ -318,6 +322,8 @@ + } + } + ++ if (flag && !itemstack1.getItem().isBookEnchantable(itemstack1, itemstack2)) itemstack1 = null; ++ + if (StringUtils.isBlank(this.repairedItemName)) + { + if (itemstack.hasDisplayName()) diff --git a/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch b/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch new file mode 100644 index 000000000..61021f825 --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/inventory/SlotCrafting.java ++++ ../src-work/minecraft/net/minecraft/inventory/SlotCrafting.java +@@ -113,8 +113,11 @@ + + public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, craftMatrix); + this.onCrafting(stack); ++ net.minecraftforge.common.ForgeHooks.setCraftingPlayer(playerIn); + ItemStack[] aitemstack = CraftingManager.getInstance().func_180303_b(this.craftMatrix, playerIn.worldObj); ++ net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null); + + for (int i = 0; i < aitemstack.length; ++i) + { diff --git a/patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch b/patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch new file mode 100644 index 000000000..b1ada57ac --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java ++++ ../src-work/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java +@@ -82,6 +82,8 @@ + + this.field_75228_b = 0; + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerSmeltedEvent(thePlayer, stack); ++ + if (stack.getItem() == Items.iron_ingot) + { + this.thePlayer.triggerAchievement(AchievementList.acquireIron); diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch new file mode 100644 index 000000000..f1b79c590 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -0,0 +1,97 @@ +--- ../src-base/minecraft/net/minecraft/item/Item.java ++++ ../src-work/minecraft/net/minecraft/item/Item.java +@@ -62,6 +62,9 @@ + private String unlocalizedName; + private static final String __OBFID = "CL_00000041"; + ++ public final net.minecraftforge.fml.common.registry.RegistryDelegate delegate = ++ ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)itemRegistry).getDelegate(this, Item.class); ++ + public static int getIdFromItem(Item itemIn) + { + return itemIn == null ? 0 : itemRegistry.getIDForObject(itemIn); +@@ -127,6 +130,7 @@ + return stack; + } + ++ @Deprecated // Use ItemStack sensitive version below. + public int getItemStackLimit() + { + return this.maxStackSize; +@@ -240,6 +244,7 @@ + return this.containerItem; + } + ++ @Deprecated // Use ItemStack sensitive version below. + public boolean hasContainerItem() + { + return this.containerItem != null; +@@ -317,7 +322,7 @@ + + public boolean isItemTool(ItemStack stack) + { +- return this.getItemStackLimit() == 1 && this.isDamageable(); ++ return this.getItemStackLimit(stack) == 1 && this.isDamageable(); + } + + protected MovingObjectPosition getMovingObjectPositionFromPlayer(World worldIn, EntityPlayer playerIn, boolean useLiquids) +@@ -335,6 +340,10 @@ + float f6 = f3 * f4; + float f7 = f2 * f4; + double d3 = 5.0D; ++ if (playerIn instanceof net.minecraft.entity.player.EntityPlayerMP) ++ { ++ d3 = ((net.minecraft.entity.player.EntityPlayerMP)playerIn).theItemInWorldManager.getBlockReachDistance(); ++ } + Vec3 vec31 = vec3.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); + return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false); + } +@@ -874,6 +883,10 @@ + private final int enchantability; + private static final String __OBFID = "CL_00000042"; + ++ //Added by forge for custom Tool materials. ++ @Deprecated public Item customCraftingMaterial = null; // Remote in 1.8.1 ++ private ItemStack repairMaterial = null; ++ + private ToolMaterial(int harvestLevel, int maxUses, float efficiency, float damageVsEntity, int enchantability) + { + this.harvestLevel = harvestLevel; +@@ -908,9 +921,36 @@ + return this.enchantability; + } + ++ @Deprecated // Use getRepairItemStack below + public Item getRepairItem() + { +- return this == WOOD ? Item.getItemFromBlock(Blocks.planks) : (this == STONE ? Item.getItemFromBlock(Blocks.cobblestone) : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == EMERALD ? Items.diamond : null)))); ++ switch (this) ++ { ++ case WOOD: return Item.getItemFromBlock(Blocks.planks); ++ case STONE: return Item.getItemFromBlock(Blocks.cobblestone); ++ case GOLD: return Items.gold_ingot; ++ case IRON: return Items.iron_ingot; ++ case EMERALD: return Items.diamond; ++ default: return customCraftingMaterial; ++ } + } ++ ++ public ToolMaterial setRepairItem(ItemStack stack) ++ { ++ if (this.repairMaterial != null || customCraftingMaterial != null) throw new RuntimeException("Can not change already set repair material"); ++ if (this == WOOD || this == STONE || this == GOLD || this == IRON || this == EMERALD) throw new RuntimeException("Can not change vanilla tool repair materials"); ++ this.repairMaterial = stack; ++ this.customCraftingMaterial = stack.getItem(); ++ return this; ++ } ++ ++ public ItemStack getRepairItemStack() ++ { ++ if (repairMaterial != null) return repairMaterial; ++ Item ret = this.getRepairItem(); ++ if (ret == null) return null; ++ repairMaterial = new ItemStack(ret, 1, net.minecraftforge.oredict.OreDictionary.WILDCARD_VALUE); ++ return repairMaterial; ++ } + } + } diff --git a/patches/minecraft/net/minecraft/item/ItemArmor.java.patch b/patches/minecraft/net/minecraft/item/ItemArmor.java.patch new file mode 100644 index 000000000..1b2e521a5 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemArmor.java.patch @@ -0,0 +1,47 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemArmor.java ++++ ../src-work/minecraft/net/minecraft/item/ItemArmor.java +@@ -38,7 +38,7 @@ + if (list.size() > 0) + { + EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0); +- int l = entitylivingbase instanceof EntityPlayer ? 1 : 0; ++ int l = 0;// Forge: We fix the indexes. Mojang Stop hard coding this! + int i1 = EntityLiving.getArmorPosition(stack); + ItemStack itemstack = stack.copy(); + itemstack.stackSize = 1; +@@ -192,7 +192,7 @@ + + if (itemstack == null) + { +- playerIn.setCurrentItemOrArmor(i, itemStackIn.copy()); ++ playerIn.setCurrentItemOrArmor(i + 1, itemStackIn.copy()); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. + itemStackIn.stackSize = 0; + } + +@@ -213,6 +213,9 @@ + private final int enchantability; + private static final String __OBFID = "CL_00001768"; + ++ //Added by forge for custom Armor materials. ++ public Item customCraftingMaterial = null; ++ + private ArmorMaterial(String name, int p_i45789_4_, int[] reductionAmounts, int enchantability) + { + this.name = name; +@@ -238,7 +241,15 @@ + + public Item getRepairItem() + { +- return this == LEATHER ? Items.leather : (this == CHAIN ? Items.iron_ingot : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == DIAMOND ? Items.diamond : null)))); ++ switch (this) ++ { ++ case LEATHER: return Items.leather; ++ case CHAIN: return Items.iron_ingot; ++ case GOLD: return Items.gold_ingot; ++ case IRON: return Items.iron_ingot; ++ case DIAMOND: return Items.diamond; ++ default: return customCraftingMaterial; ++ } + } + + @SideOnly(Side.CLIENT) diff --git a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch new file mode 100644 index 000000000..1da8fecd8 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemBlock.java ++++ ../src-work/minecraft/net/minecraft/item/ItemBlock.java +@@ -163,4 +163,26 @@ + { + return this.block; + } ++ ++ /** ++ * Called to actually place the block, after the location is determined ++ * and all permission checks have been made. ++ * ++ * @param stack The item stack that was used to place the block. This can be changed inside the method. ++ * @param player The player who is placing the block. Can be null if the block is not being placed by a player. ++ * @param side The side the player (or machine) right-clicked on. ++ */ ++ public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) ++ { ++ if (!world.setBlockState(pos, newState, 3)) return false; ++ ++ IBlockState state = world.getBlockState(pos); ++ if (state.getBlock() == this.block) ++ { ++ setTileEntityNBT(world, pos, stack, player); ++ this.block.onBlockPlacedBy(world, pos, state, player, stack); ++ } ++ ++ return true; ++ } + } diff --git a/patches/minecraft/net/minecraft/item/ItemBow.java.patch b/patches/minecraft/net/minecraft/item/ItemBow.java.patch new file mode 100644 index 000000000..9c80583a4 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemBow.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemBow.java ++++ ../src-work/minecraft/net/minecraft/item/ItemBow.java +@@ -105,6 +105,9 @@ + + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { ++ net.minecraftforge.event.entity.player.ArrowNockEvent event = new net.minecraftforge.event.entity.player.ArrowNockEvent(playerIn, itemStackIn); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return event.result; ++ + if (playerIn.capabilities.isCreativeMode || playerIn.inventory.hasItem(Items.arrow)) + { + playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn)); diff --git a/patches/minecraft/net/minecraft/item/ItemBucket.java.patch b/patches/minecraft/net/minecraft/item/ItemBucket.java.patch new file mode 100644 index 000000000..23bf6daf0 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemBucket.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemBucket.java ++++ ../src-work/minecraft/net/minecraft/item/ItemBucket.java +@@ -37,6 +37,9 @@ + } + else + { ++ ItemStack ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(playerIn, worldIn, itemStackIn, movingobjectposition); ++ if (ret != null) return ret; ++ + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + BlockPos blockpos = movingobjectposition.getBlockPos(); diff --git a/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch b/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch new file mode 100644 index 000000000..0e6f3935e --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemBucketMilk.java ++++ ../src-work/minecraft/net/minecraft/item/ItemBucketMilk.java +@@ -25,7 +25,7 @@ + + if (!worldIn.isRemote) + { +- playerIn.clearActivePotions(); ++ playerIn.curePotionEffects(stack); + } + + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); diff --git a/patches/minecraft/net/minecraft/item/ItemDye.java.patch b/patches/minecraft/net/minecraft/item/ItemDye.java.patch new file mode 100644 index 000000000..4ae5b8110 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemDye.java.patch @@ -0,0 +1,56 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemDye.java ++++ ../src-work/minecraft/net/minecraft/item/ItemDye.java +@@ -48,7 +48,7 @@ + + if (enumdyecolor == EnumDyeColor.WHITE) + { +- if (applyBonemeal(stack, worldIn, pos)) ++ if (applyBonemeal(stack, worldIn, pos, playerIn)) + { + if (!worldIn.isRemote) + { +@@ -98,8 +98,18 @@ + + public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target) + { ++ if (worldIn instanceof net.minecraft.world.WorldServer) ++ return applyBonemeal(stack, worldIn, target, net.minecraftforge.common.util.FakePlayerFactory.getMinecraft((net.minecraft.world.WorldServer)worldIn)); ++ return false; ++ } ++ ++ public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target, EntityPlayer player) ++ { + IBlockState iblockstate = worldIn.getBlockState(target); + ++ int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, worldIn, target, iblockstate, stack); ++ if (hook != 0) return hook > 0; ++ + if (iblockstate.getBlock() instanceof IGrowable) + { + IGrowable igrowable = (IGrowable)iblockstate.getBlock(); +@@ -133,7 +143,7 @@ + + Block block = worldIn.getBlockState(pos).getBlock(); + +- if (block.getMaterial() != Material.air) ++ if (block.isAir(worldIn, pos)) + { + block.setBlockBoundsBasedOnState(worldIn, pos); + +@@ -145,6 +155,16 @@ + worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)pos.getX() + itemRand.nextFloat()), (double)pos.getY() + (double)itemRand.nextFloat() * block.getBlockBoundsMaxY(), (double)((float)pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]); + } + } ++ else ++ { ++ for (int i1 = 0; i1 < amount; ++i1) ++ { ++ double d0 = itemRand.nextGaussian() * 0.02D; ++ double d1 = itemRand.nextGaussian() * 0.02D; ++ double d2 = itemRand.nextGaussian() * 0.02D; ++ worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)pos.getX() + itemRand.nextFloat()), (double)pos.getY() + (double)itemRand.nextFloat() * 1.0f, (double)((float)pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]); ++ } ++ } + } + + public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target) diff --git a/patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch b/patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch new file mode 100644 index 000000000..2e0696c64 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemEmptyMap.java ++++ ../src-work/minecraft/net/minecraft/item/ItemEmptyMap.java +@@ -24,7 +24,7 @@ + worldIn.setItemData(s, mapdata); + mapdata.scale = 0; + mapdata.func_176054_a(playerIn.posX, playerIn.posZ, mapdata.scale); +- mapdata.dimension = (byte)worldIn.provider.getDimensionId(); ++ mapdata.dimension = worldIn.provider.getDimensionId(); + mapdata.markDirty(); + --itemStackIn.stackSize; + diff --git a/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch b/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch new file mode 100644 index 000000000..92d47f90b --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemFlintAndSteel.java ++++ ../src-work/minecraft/net/minecraft/item/ItemFlintAndSteel.java +@@ -29,7 +29,7 @@ + } + else + { +- if (worldIn.getBlockState(pos).getBlock().getMaterial() == Material.air) ++ if (worldIn.isAirBlock(pos)) + { + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); + worldIn.setBlockState(pos, Blocks.fire.getDefaultState()); diff --git a/patches/minecraft/net/minecraft/item/ItemHoe.java.patch b/patches/minecraft/net/minecraft/item/ItemHoe.java.patch new file mode 100644 index 000000000..7a27cbcb8 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemHoe.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemHoe.java ++++ ../src-work/minecraft/net/minecraft/item/ItemHoe.java +@@ -35,10 +35,13 @@ + } + else + { ++ int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(stack, playerIn, worldIn, pos); ++ if (hook != 0) return hook > 0; ++ + IBlockState iblockstate = worldIn.getBlockState(pos); + Block block = iblockstate.getBlock(); + +- if (side != EnumFacing.DOWN && worldIn.getBlockState(pos.up()).getBlock().getMaterial() == Material.air) ++ if (side != EnumFacing.DOWN && worldIn.isAirBlock(pos.up())) + { + if (block == Blocks.grass) + { diff --git a/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch b/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch new file mode 100644 index 000000000..6251c9d0f --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemLilyPad.java ++++ ../src-work/minecraft/net/minecraft/item/ItemLilyPad.java +@@ -51,7 +51,14 @@ + + if (iblockstate.getBlock().getMaterial() == Material.water && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.isAirBlock(blockpos1)) + { ++ // special case for handling block placement with water lilies ++ net.minecraftforge.common.util.BlockSnapshot blocksnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(worldIn, blockpos1); + worldIn.setBlockState(blockpos1, Blocks.waterlily.getDefaultState()); ++ if (net.minecraftforge.event.ForgeEventFactory.onPlayerBlockPlace(playerIn, blocksnapshot, net.minecraft.util.EnumFacing.UP).isCanceled()) ++ { ++ blocksnapshot.restore(true, false); ++ return itemStackIn; ++ } + + if (!playerIn.capabilities.isCreativeMode) + { diff --git a/patches/minecraft/net/minecraft/item/ItemMap.java.patch b/patches/minecraft/net/minecraft/item/ItemMap.java.patch new file mode 100644 index 000000000..98a20762f --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemMap.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemMap.java ++++ ../src-work/minecraft/net/minecraft/item/ItemMap.java +@@ -59,7 +59,7 @@ + mapdata = new MapData(s); + mapdata.scale = 3; + mapdata.func_176054_a((double)worldIn.getWorldInfo().getSpawnX(), (double)worldIn.getWorldInfo().getSpawnZ(), mapdata.scale); +- mapdata.dimension = (byte)worldIn.provider.getDimensionId(); ++ mapdata.dimension = worldIn.provider.getDimensionId(); + mapdata.markDirty(); + worldIn.setItemData(s, mapdata); + } diff --git a/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch b/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch new file mode 100644 index 000000000..9d23fda26 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch @@ -0,0 +1,67 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemMonsterPlacer.java ++++ ../src-work/minecraft/net/minecraft/item/ItemMonsterPlacer.java +@@ -38,7 +38,7 @@ + public String getItemStackDisplayName(ItemStack stack) + { + String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim(); +- String s1 = EntityList.getStringFromID(stack.getMetadata()); ++ String s1 = ItemMonsterPlacer.getEntityName(stack); + + if (s1 != null) + { +@@ -76,7 +76,7 @@ + if (tileentity instanceof TileEntityMobSpawner) + { + MobSpawnerBaseLogic mobspawnerbaselogic = ((TileEntityMobSpawner)tileentity).getSpawnerBaseLogic(); +- mobspawnerbaselogic.setEntityName(EntityList.getStringFromID(stack.getMetadata())); ++ mobspawnerbaselogic.setEntityName(ItemMonsterPlacer.getEntityName(stack)); + tileentity.markDirty(); + worldIn.markBlockForUpdate(pos); + +@@ -97,7 +97,7 @@ + d0 = 0.5D; + } + +- Entity entity = spawnCreature(worldIn, stack.getMetadata(), (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D); ++ Entity entity = spawnCreature(worldIn, ItemMonsterPlacer.getEntityName(stack), (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D); + + if (entity != null) + { +@@ -148,7 +148,7 @@ + + if (worldIn.getBlockState(blockpos).getBlock() instanceof BlockLiquid) + { +- Entity entity = spawnCreature(worldIn, itemStackIn.getMetadata(), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D); ++ Entity entity = spawnCreature(worldIn, ItemMonsterPlacer.getEntityName(itemStackIn), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D); + + if (entity != null) + { +@@ -209,5 +209,28 @@ + { + subItems.add(new ItemStack(itemIn, 1, entitylist$entityegginfo.spawnedID)); + } ++ ++ for (String name : net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().keySet()) ++ { ++ ItemStack stack = new ItemStack(itemIn); ++ net.minecraft.nbt.NBTTagCompound nbt = new net.minecraft.nbt.NBTTagCompound(); ++ nbt.setString("entity_name", name); ++ stack.setTagCompound(nbt); ++ subItems.add(stack); ++ } + } ++ ++ public static String getEntityName(ItemStack stack) ++ { ++ if (stack.hasTagCompound() && stack.getTagCompound().hasKey("entity_name", 8)) ++ return stack.getTagCompound().getString("entity_name"); ++ return EntityList.getStringFromID(stack.getMetadata()); ++ } ++ ++ private static EntityList.EntityEggInfo getEggInfo(ItemStack stack) ++ { ++ if (stack.hasTagCompound() && stack.getTagCompound().hasKey("entity_name", 8)) ++ return net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(stack.getTagCompound().getString("entity_name")); ++ return (EntityList.EntityEggInfo)EntityList.entityEggs.get(stack.getMetadata()); ++ } + } diff --git a/patches/minecraft/net/minecraft/item/ItemRecord.java.patch b/patches/minecraft/net/minecraft/item/ItemRecord.java.patch new file mode 100644 index 000000000..9bc2189e7 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemRecord.java.patch @@ -0,0 +1,18 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemRecord.java ++++ ../src-work/minecraft/net/minecraft/item/ItemRecord.java +@@ -77,4 +77,15 @@ + { + return (ItemRecord)RECORDS.get(name); + } ++ ++ /** ++ * Retrieves the resource location of the sound to play for this record. ++ * ++ * @param name The name of the record to play ++ * @return The resource location for the audio, null to use default. ++ */ ++ public net.minecraft.util.ResourceLocation getRecordResource(String name) ++ { ++ return new net.minecraft.util.ResourceLocation(name); ++ } + } diff --git a/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch b/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch new file mode 100644 index 000000000..a80f9b920 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch @@ -0,0 +1,37 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemSeedFood.java ++++ ../src-work/minecraft/net/minecraft/item/ItemSeedFood.java +@@ -6,7 +6,7 @@ + import net.minecraft.util.EnumFacing; + import net.minecraft.world.World; + +-public class ItemSeedFood extends ItemFood ++public class ItemSeedFood extends ItemFood implements net.minecraftforge.common.IPlantable + { + private Block crops; + private Block soilId; +@@ -29,7 +29,7 @@ + { + return false; + } +- else if (worldIn.getBlockState(pos).getBlock() == this.soilId && worldIn.isAirBlock(pos.up())) ++ else if (worldIn.getBlockState(pos).getBlock().canSustainPlant(worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) + { + worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); + --stack.stackSize; +@@ -40,4 +40,16 @@ + return false; + } + } ++ ++ @Override ++ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) ++ { ++ return net.minecraftforge.common.EnumPlantType.Crop; ++ } ++ ++ @Override ++ public net.minecraft.block.state.IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) ++ { ++ return this.crops.getDefaultState(); ++ } + } diff --git a/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch b/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch new file mode 100644 index 000000000..ebdd88861 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch @@ -0,0 +1,37 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemSeeds.java ++++ ../src-work/minecraft/net/minecraft/item/ItemSeeds.java +@@ -7,7 +7,7 @@ + import net.minecraft.util.EnumFacing; + import net.minecraft.world.World; + +-public class ItemSeeds extends Item ++public class ItemSeeds extends Item implements net.minecraftforge.common.IPlantable + { + private Block crops; + private Block soilBlockID; +@@ -30,7 +30,7 @@ + { + return false; + } +- else if (worldIn.getBlockState(pos).getBlock() == this.soilBlockID && worldIn.isAirBlock(pos.up())) ++ else if (worldIn.getBlockState(pos).getBlock().canSustainPlant(worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) + { + worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); + --stack.stackSize; +@@ -41,4 +41,16 @@ + return false; + } + } ++ ++ @Override ++ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) ++ { ++ return this.crops == net.minecraft.init.Blocks.nether_wart ? net.minecraftforge.common.EnumPlantType.Nether : net.minecraftforge.common.EnumPlantType.Crop; ++ } ++ ++ @Override ++ public net.minecraft.block.state.IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) ++ { ++ return this.crops.getDefaultState(); ++ } + } diff --git a/patches/minecraft/net/minecraft/item/ItemShears.java.patch b/patches/minecraft/net/minecraft/item/ItemShears.java.patch new file mode 100644 index 000000000..921a20435 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemShears.java.patch @@ -0,0 +1,89 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemShears.java ++++ ../src-work/minecraft/net/minecraft/item/ItemShears.java +@@ -21,13 +21,12 @@ + + public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) + { +- if (blockIn.getMaterial() != Material.leaves && blockIn != Blocks.web && blockIn != Blocks.tallgrass && blockIn != Blocks.vine && blockIn != Blocks.tripwire && blockIn != Blocks.wool) ++ if (blockIn.getMaterial() != Material.leaves && blockIn != Blocks.web && blockIn != Blocks.tallgrass && blockIn != Blocks.vine && blockIn != Blocks.tripwire && blockIn != Blocks.wool && !(blockIn instanceof net.minecraftforge.common.IShearable)) + { + return super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn); + } + else + { +- stack.damageItem(1, playerIn); + return true; + } + } +@@ -41,4 +40,71 @@ + { + return block != Blocks.web && block.getMaterial() != Material.leaves ? (block == Blocks.wool ? 5.0F : super.getStrVsBlock(stack, block)) : 15.0F; + } ++ ++ ++ @Override ++ public boolean itemInteractionForEntity(ItemStack itemstack, net.minecraft.entity.player.EntityPlayer player, EntityLivingBase entity) ++ { ++ if (entity.worldObj.isRemote) ++ { ++ return false; ++ } ++ if (entity instanceof net.minecraftforge.common.IShearable) ++ { ++ net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)entity; ++ BlockPos pos = new BlockPos(entity.posX, entity.posY, entity.posZ); ++ if (target.isShearable(itemstack, entity.worldObj, pos)) ++ { ++ java.util.List drops = target.onSheared(itemstack, entity.worldObj, pos, ++ net.minecraft.enchantment.EnchantmentHelper.getEnchantmentLevel(net.minecraft.enchantment.Enchantment.fortune.effectId, itemstack)); ++ ++ java.util.Random rand = new java.util.Random(); ++ for(ItemStack stack : drops) ++ { ++ net.minecraft.entity.item.EntityItem ent = entity.entityDropItem(stack, 1.0F); ++ ent.motionY += rand.nextFloat() * 0.05F; ++ ent.motionX += (rand.nextFloat() - rand.nextFloat()) * 0.1F; ++ ent.motionZ += (rand.nextFloat() - rand.nextFloat()) * 0.1F; ++ } ++ itemstack.damageItem(1, entity); ++ } ++ return true; ++ } ++ return false; ++ } ++ ++ @Override ++ public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, net.minecraft.entity.player.EntityPlayer player) ++ { ++ if (player.worldObj.isRemote || player.capabilities.isCreativeMode) ++ { ++ return false; ++ } ++ Block block = player.worldObj.getBlockState(pos).getBlock(); ++ if (block instanceof net.minecraftforge.common.IShearable) ++ { ++ net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)block; ++ if (target.isShearable(itemstack, player.worldObj, pos)) ++ { ++ java.util.List drops = target.onSheared(itemstack, player.worldObj, pos, ++ net.minecraft.enchantment.EnchantmentHelper.getEnchantmentLevel(net.minecraft.enchantment.Enchantment.fortune.effectId, itemstack)); ++ java.util.Random rand = new java.util.Random(); ++ ++ for(ItemStack stack : drops) ++ { ++ float f = 0.7F; ++ double d = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; ++ double d1 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; ++ double d2 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; ++ net.minecraft.entity.item.EntityItem entityitem = new net.minecraft.entity.item.EntityItem(player.worldObj, (double)pos.getX() + d, (double)pos.getY() + d1, (double)pos.getZ() + d2, stack); ++ entityitem.setDefaultPickupDelay(); ++ player.worldObj.spawnEntityInWorld(entityitem); ++ } ++ ++ itemstack.damageItem(1, player); ++ player.addStat(net.minecraft.stats.StatList.mineBlockStatArray[Block.getIdFromBlock(block)], 1); ++ } ++ } ++ return false; ++ } + } diff --git a/patches/minecraft/net/minecraft/item/ItemSkull.java.patch b/patches/minecraft/net/minecraft/item/ItemSkull.java.patch new file mode 100644 index 000000000..9c1921c95 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemSkull.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemSkull.java ++++ ../src-work/minecraft/net/minecraft/item/ItemSkull.java +@@ -35,6 +35,11 @@ + + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { ++ if (worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && side != EnumFacing.DOWN) ++ { ++ side = EnumFacing.UP; ++ pos = pos.down(); ++ } + if (side == EnumFacing.DOWN) + { + return false; +@@ -47,7 +52,7 @@ + + if (!flag) + { +- if (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid()) ++ if (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid() && !worldIn.isSideSolid(pos, side, true)) + { + return false; + } +@@ -67,6 +72,7 @@ + { + if (!worldIn.isRemote) + { ++ if (!Blocks.skull.canPlaceBlockOnSide(worldIn, pos, side)) return false; + worldIn.setBlockState(pos, Blocks.skull.getDefaultState().withProperty(BlockSkull.FACING, side), 3); + int i = 0; + diff --git a/patches/minecraft/net/minecraft/item/ItemSnow.java.patch b/patches/minecraft/net/minecraft/item/ItemSnow.java.patch new file mode 100644 index 000000000..a98b817dd --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemSnow.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemSnow.java ++++ ../src-work/minecraft/net/minecraft/item/ItemSnow.java +@@ -69,4 +69,10 @@ + { + return damage; + } ++ ++ public boolean canPlaceBlockOnSide(World world, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) ++ { ++ IBlockState state = world.getBlockState(pos); ++ return (state.getBlock() != net.minecraft.init.Blocks.snow_layer || ((Integer)state.getValue(BlockSnow.LAYERS)) > 7) ? super.canPlaceBlockOnSide(world, pos, side, player, stack) : true; ++ } + } diff --git a/patches/minecraft/net/minecraft/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/item/ItemStack.java.patch new file mode 100644 index 000000000..a52cb1433 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemStack.java.patch @@ -0,0 +1,131 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemStack.java ++++ ../src-work/minecraft/net/minecraft/item/ItemStack.java +@@ -50,6 +50,7 @@ + private boolean canPlaceOnCacheResult; + private static final String __OBFID = "CL_00000043"; + ++ private net.minecraftforge.fml.common.registry.RegistryDelegate delegate; + public ItemStack(Block blockIn) + { + this((Block)blockIn, 1); +@@ -81,7 +82,7 @@ + this.canDestroyCacheResult = false; + this.canPlaceOnCacheBlock = null; + this.canPlaceOnCacheResult = false; +- this.item = itemIn; ++ this.setItem(itemIn); + this.stackSize = amount; + this.itemDamage = meta; + +@@ -121,11 +122,12 @@ + + public Item getItem() + { +- return this.item; ++ return this.delegate != null ? this.delegate.get() : null; + } + + public boolean onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { ++ if (!worldIn.isRemote) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ); + boolean flag = this.getItem().onItemUse(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ); + + if (flag) +@@ -170,11 +172,11 @@ + { + if (nbt.hasKey("id", 8)) + { +- this.item = Item.getByNameOrId(nbt.getString("id")); ++ this.setItem(Item.getByNameOrId(nbt.getString("id"))); + } + else + { +- this.item = Item.getItemById(nbt.getShort("id")); ++ this.setItem(Item.getItemById(nbt.getShort("id"))); + } + + this.stackSize = nbt.getByte("Count"); +@@ -198,7 +200,7 @@ + + public int getMaxStackSize() + { +- return this.getItem().getItemStackLimit(); ++ return this.getItem().getItemStackLimit(this); + } + + public boolean isStackable() +@@ -208,7 +210,7 @@ + + public boolean isItemStackDamageable() + { +- return this.item == null ? false : (this.item.getMaxDamage() <= 0 ? false : !this.hasTagCompound() || !this.getTagCompound().getBoolean("Unbreakable")); ++ return this.item == null ? false : (this.item.getMaxDamage(this) <= 0 ? false : !this.hasTagCompound() || !this.getTagCompound().getBoolean("Unbreakable")); + } + + public boolean getHasSubtypes() +@@ -218,32 +220,27 @@ + + public boolean isItemDamaged() + { +- return this.isItemStackDamageable() && this.itemDamage > 0; ++ return this.isItemStackDamageable() && getItem().isDamaged(this); + } + + public int getItemDamage() + { +- return this.itemDamage; ++ return getItem().getDamage(this); + } + + public int getMetadata() + { +- return this.itemDamage; ++ return getItem().getMetadata(this); + } + + public void setItemDamage(int meta) + { +- this.itemDamage = meta; +- +- if (this.itemDamage < 0) +- { +- this.itemDamage = 0; +- } ++ getItem().setDamage(this, meta); + } + + public int getMaxDamage() + { +- return this.item.getMaxDamage(); ++ return this.item.getMaxDamage(this); + } + + public boolean attemptDamageItem(int amount, Random rand) +@@ -275,8 +272,8 @@ + } + } + +- this.itemDamage += amount; +- return this.itemDamage > this.getMaxDamage(); ++ setItemDamage(getItemDamage() + amount); //Redirect through Item's callback if applicable. ++ return getItemDamage() > getMaxDamage(); + } + } + +@@ -335,7 +332,7 @@ + + public boolean canHarvestBlock(Block blockIn) + { +- return this.item.canHarvestBlock(blockIn); ++ return getItem().canHarvestBlock(blockIn, this); + } + + public boolean interactWithEntity(EntityPlayer playerIn, EntityLivingBase entityIn) +@@ -861,6 +858,7 @@ + + public void setItem(Item newItem) + { ++ this.delegate = newItem != null ? newItem.delegate : null; + this.item = newItem; + } + diff --git a/patches/minecraft/net/minecraft/item/ItemSword.java.patch b/patches/minecraft/net/minecraft/item/ItemSword.java.patch new file mode 100644 index 000000000..8fc061c1e --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemSword.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemSword.java ++++ ../src-work/minecraft/net/minecraft/item/ItemSword.java +@@ -102,7 +102,9 @@ + + public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) + { +- return this.material.getRepairItem() == repair.getItem() ? true : super.getIsRepairable(toRepair, repair); ++ ItemStack mat = this.material.getRepairItemStack(); ++ if (mat != null && net.minecraftforge.oredict.OreDictionary.itemMatches(mat, repair, false)) return true; ++ return super.getIsRepairable(toRepair, repair); + } + + public Multimap getItemAttributeModifiers() diff --git a/patches/minecraft/net/minecraft/item/ItemTool.java.patch b/patches/minecraft/net/minecraft/item/ItemTool.java.patch new file mode 100644 index 000000000..0554e07a0 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/ItemTool.java.patch @@ -0,0 +1,71 @@ +--- ../src-base/minecraft/net/minecraft/item/ItemTool.java ++++ ../src-work/minecraft/net/minecraft/item/ItemTool.java +@@ -29,6 +29,18 @@ + this.efficiencyOnProperMaterial = material.getEfficiencyOnProperMaterial(); + this.damageVsEntity = attackDamage + material.getDamageVsEntity(); + this.setCreativeTab(CreativeTabs.tabTools); ++ if (this instanceof ItemPickaxe) ++ { ++ toolClass = "pickaxe"; ++ } ++ else if (this instanceof ItemAxe) ++ { ++ toolClass = "axe"; ++ } ++ else if (this instanceof ItemSpade) ++ { ++ toolClass = "shovel"; ++ } + } + + public float getStrVsBlock(ItemStack stack, Block block) +@@ -75,7 +87,9 @@ + + public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) + { +- return this.toolMaterial.getRepairItem() == repair.getItem() ? true : super.getIsRepairable(toRepair, repair); ++ ItemStack mat = this.toolMaterial.getRepairItemStack(); ++ if (mat != null && net.minecraftforge.oredict.OreDictionary.itemMatches(mat, repair, false)) return true; ++ return super.getIsRepairable(toRepair, repair); + } + + public Multimap getItemAttributeModifiers() +@@ -84,4 +98,38 @@ + multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(itemModifierUUID, "Tool modifier", (double)this.damageVsEntity, 0)); + return multimap; + } ++ ++ /*===================================== FORGE START =================================*/ ++ private String toolClass; ++ @Override ++ public int getHarvestLevel(ItemStack stack, String toolClass) ++ { ++ int level = super.getHarvestLevel(stack, toolClass); ++ if (level == -1 && toolClass != null && toolClass.equals(this.toolClass)) ++ { ++ return this.toolMaterial.getHarvestLevel(); ++ } ++ else ++ { ++ return level; ++ } ++ } ++ ++ @Override ++ public Set getToolClasses(ItemStack stack) ++ { ++ return toolClass != null ? com.google.common.collect.ImmutableSet.of(toolClass) : super.getToolClasses(stack); ++ } ++ ++ @Override ++ public float getDigSpeed(ItemStack stack, net.minecraft.block.state.IBlockState state) ++ { ++ for (String type : getToolClasses(stack)) ++ { ++ if (state.getBlock().isToolEffective(type, state)) ++ return efficiencyOnProperMaterial; ++ } ++ return super.getDigSpeed(stack, state); ++ } ++ /*===================================== FORGE END =================================*/ + } diff --git a/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch new file mode 100644 index 000000000..f30470c7f --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java +@@ -73,6 +73,7 @@ + + public void addSmeltingRecipe(ItemStack input, ItemStack stack, float experience) + { ++ if (getSmeltingResult(input) != null) { net.minecraftforge.fml.common.FMLLog.info("Ignored smelting recipe with conflicting input: " + input + " = " + stack); return; } + this.smeltingList.put(input, stack); + this.experienceList.put(stack, Float.valueOf(experience)); + } diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch new file mode 100644 index 000000000..4a6a9f32a --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/RecipeFireworks.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeFireworks.java +@@ -250,11 +250,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = p_179532_1_.getStackInSlot(i); +- +- if (itemstack != null && itemstack.getItem().hasContainerItem()) +- { +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); +- } ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + + return aitemstack; diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch new file mode 100644 index 000000000..d5b3256fc --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch @@ -0,0 +1,33 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java +@@ -27,7 +27,7 @@ + { + ItemStack itemstack1 = (ItemStack)list.get(0); + +- if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isDamageable()) ++ if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isRepairable()) + { + return false; + } +@@ -54,7 +54,7 @@ + { + ItemStack itemstack1 = (ItemStack)list.get(0); + +- if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isDamageable()) ++ if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isRepairable()) + { + return null; + } +@@ -104,11 +104,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = p_179532_1_.getStackInSlot(i); +- +- if (itemstack != null && itemstack.getItem().hasContainerItem()) +- { +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); +- } ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + + return aitemstack; diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch new file mode 100644 index 000000000..afe3c87e4 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java +@@ -148,11 +148,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = p_179532_1_.getStackInSlot(i); +- +- if (itemstack != null && itemstack.getItem().hasContainerItem()) +- { +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); +- } ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + + return aitemstack; diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch new file mode 100644 index 000000000..cdc16e800 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch @@ -0,0 +1,27 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/RecipesBanners.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesBanners.java +@@ -139,11 +139,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = p_179532_1_.getStackInSlot(i); +- +- if (itemstack != null && itemstack.getItem().hasContainerItem()) +- { +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); +- } ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + + return aitemstack; +@@ -362,9 +358,9 @@ + + if (itemstack != null) + { +- if (itemstack.getItem().hasContainerItem()) ++ if (itemstack.getItem().hasContainerItem(itemstack)) + { +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + else if (itemstack.hasTagCompound() && TileEntityBanner.getPatterns(itemstack) > 0) + { diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch new file mode 100644 index 000000000..5ad702f77 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java +@@ -110,11 +110,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = p_179532_1_.getStackInSlot(i); +- +- if (itemstack != null && itemstack.getItem().hasContainerItem()) +- { +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); +- } ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + + return aitemstack; diff --git a/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch new file mode 100644 index 000000000..02c3e7f16 --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/ShapedRecipes.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/ShapedRecipes.java +@@ -34,11 +34,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = p_179532_1_.getStackInSlot(i); +- +- if (itemstack != null && itemstack.getItem().hasContainerItem()) +- { +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); +- } ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + + return aitemstack; diff --git a/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch new file mode 100644 index 000000000..1e679060e --- /dev/null +++ b/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java ++++ ../src-work/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java +@@ -30,11 +30,7 @@ + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = p_179532_1_.getStackInSlot(i); +- +- if (itemstack != null && itemstack.getItem().hasContainerItem()) +- { +- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); +- } ++ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); + } + + return aitemstack; diff --git a/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch new file mode 100644 index 000000000..cd62e3604 --- /dev/null +++ b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch @@ -0,0 +1,53 @@ +--- ../src-base/minecraft/net/minecraft/nbt/CompressedStreamTools.java ++++ ../src-work/minecraft/net/minecraft/nbt/CompressedStreamTools.java +@@ -17,8 +17,6 @@ + import net.minecraft.crash.CrashReport; + import net.minecraft.crash.CrashReportCategory; + import net.minecraft.util.ReportedException; +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; + + public class CompressedStreamTools + { +@@ -55,7 +53,6 @@ + } + } + +- @SideOnly(Side.CLIENT) + public static void safeWrite(NBTTagCompound p_74793_0_, File p_74793_1_) throws IOException + { + File file1 = new File(p_74793_1_.getAbsolutePath() + "_tmp"); +@@ -120,6 +117,7 @@ + private static NBTBase func_152455_a(DataInput p_152455_0_, int p_152455_1_, NBTSizeTracker p_152455_2_) throws IOException + { + byte b0 = p_152455_0_.readByte(); ++ p_152455_2_.read(8); // Forge: Count everything! + + if (b0 == 0) + { +@@ -127,7 +125,8 @@ + } + else + { +- p_152455_0_.readUTF(); ++ NBTSizeTracker.readUTF(p_152455_2_, p_152455_0_.readUTF()); //Forge: Count this string. ++ p_152455_2_.read(32); //Forge: 4 extra bytes for the object allocation. + NBTBase nbtbase = NBTBase.createNewByType(b0); + + try +@@ -146,7 +145,6 @@ + } + } + +- @SideOnly(Side.CLIENT) + public static void write(NBTTagCompound p_74795_0_, File p_74795_1_) throws IOException + { + DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(p_74795_1_)); +@@ -161,7 +159,6 @@ + } + } + +- @SideOnly(Side.CLIENT) + public static NBTTagCompound read(File p_74797_0_) throws IOException + { + if (!p_74797_0_.exists()) diff --git a/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch b/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch new file mode 100644 index 000000000..e8342e794 --- /dev/null +++ b/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch @@ -0,0 +1,37 @@ +--- ../src-base/minecraft/net/minecraft/nbt/NBTSizeTracker.java ++++ ../src-work/minecraft/net/minecraft/nbt/NBTSizeTracker.java +@@ -27,4 +27,34 @@ + throw new RuntimeException("Tried to read NBT tag that was too big; tried to allocate: " + this.read + "bytes where max allowed: " + this.max); + } + } ++ ++ /* ++ * UTF8 is not a simple encoding system, each character can be either ++ * 1, 2, or 3 bytes. Depending on where it's numerical value falls. ++ * We have to count up each character individually to see the true ++ * length of the data. ++ * ++ * Basic concept is that it uses the MSB of each byte as a 'read more' signal. ++ * So it has to shift each 7-bit segment. ++ * ++ * This will accurately count the correct byte length to encode this string, plus the 2 bytes for it's length prefix. ++ */ ++ public static void readUTF(NBTSizeTracker tracker, String data) ++ { ++ tracker.read(16); //Header length ++ if (data == null) ++ return; ++ ++ int len = data.length(); ++ int utflen = 0; ++ ++ for (int i = 0; i < len; i++) ++ { ++ int c = data.charAt(i); ++ if ((c >= 0x0001) && (c <= 0x007F)) utflen += 1; ++ else if (c > 0x07FF) utflen += 3; ++ else utflen += 2; ++ } ++ tracker.read(8 * utflen); ++ } + } diff --git a/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch b/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch new file mode 100644 index 000000000..f2d5e5713 --- /dev/null +++ b/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch @@ -0,0 +1,18 @@ +--- ../src-base/minecraft/net/minecraft/nbt/NBTTagCompound.java ++++ ../src-work/minecraft/net/minecraft/nbt/NBTTagCompound.java +@@ -398,6 +398,7 @@ + + private static byte readType(DataInput input, NBTSizeTracker sizeTracker) throws IOException + { ++ sizeTracker.read(8); + return input.readByte(); + } + +@@ -408,6 +409,7 @@ + + static NBTBase readNBT(byte id, String key, DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException + { ++ sizeTracker.read(32); //Forge: 4 extra bytes for the object allocation. + NBTBase nbtbase = NBTBase.createNewByType(id); + + try diff --git a/patches/minecraft/net/minecraft/nbt/NBTTagString.java.patch b/patches/minecraft/net/minecraft/nbt/NBTTagString.java.patch new file mode 100644 index 000000000..de3e9ccba --- /dev/null +++ b/patches/minecraft/net/minecraft/nbt/NBTTagString.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/nbt/NBTTagString.java ++++ ../src-work/minecraft/net/minecraft/nbt/NBTTagString.java +@@ -33,7 +33,7 @@ + { + sizeTracker.read(288L); + this.data = input.readUTF(); +- sizeTracker.read((long)(16 * this.data.length())); ++ NBTSizeTracker.readUTF(sizeTracker, data); // Forge: Correctly read String length including header. + } + + public byte getId() diff --git a/patches/minecraft/net/minecraft/network/NetworkManager.java.patch b/patches/minecraft/net/minecraft/network/NetworkManager.java.patch new file mode 100644 index 000000000..3999ee6b3 --- /dev/null +++ b/patches/minecraft/net/minecraft/network/NetworkManager.java.patch @@ -0,0 +1,53 @@ +--- ../src-base/minecraft/net/minecraft/network/NetworkManager.java ++++ ../src-work/minecraft/net/minecraft/network/NetworkManager.java +@@ -97,6 +97,11 @@ + this.direction = packetDirection; + } + ++ public EnumPacketDirection getDirection() ++ { ++ return this.direction; ++ } ++ + public void channelActive(ChannelHandlerContext p_channelActive_1_) throws Exception + { + super.channelActive(p_channelActive_1_); +@@ -212,7 +217,7 @@ + final EnumConnectionState enumconnectionstate = EnumConnectionState.getFromPacket(inPacket); + final EnumConnectionState enumconnectionstate1 = (EnumConnectionState)this.channel.attr(attrKeyConnectionState).get(); + +- if (enumconnectionstate1 != enumconnectionstate) ++ if (enumconnectionstate1 != enumconnectionstate && !( inPacket instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) + { + logger.debug("Disabled auto read"); + this.channel.config().setAutoRead(false); +@@ -220,7 +225,7 @@ + + if (this.channel.eventLoop().inEventLoop()) + { +- if (enumconnectionstate != enumconnectionstate1) ++ if (enumconnectionstate != enumconnectionstate1 && !( inPacket instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) + { + this.setConnectionState(enumconnectionstate); + } +@@ -241,7 +246,7 @@ + private static final String __OBFID = "CL_00002312"; + public void run() + { +- if (enumconnectionstate != enumconnectionstate1) ++ if (enumconnectionstate != enumconnectionstate1 && !( inPacket instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) + { + NetworkManager.this.setConnectionState(enumconnectionstate); + } +@@ -462,6 +467,11 @@ + } + } + ++ public Channel channel() ++ { ++ return channel; ++ } ++ + static class InboundHandlerTuplePacketListener + { + private final Packet packet; diff --git a/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch b/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch new file mode 100644 index 000000000..1acebaeb3 --- /dev/null +++ b/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch @@ -0,0 +1,48 @@ +--- ../src-base/minecraft/net/minecraft/network/ServerStatusResponse.java ++++ ../src-work/minecraft/net/minecraft/network/ServerStatusResponse.java +@@ -30,6 +30,7 @@ + public void setServerDescription(IChatComponent motd) + { + this.serverMotd = motd; ++ invalidateJson(); + } + + public ServerStatusResponse.PlayerCountData getPlayerCountData() +@@ -40,6 +41,7 @@ + public void setPlayerCountData(ServerStatusResponse.PlayerCountData countData) + { + this.playerCount = countData; ++ invalidateJson(); + } + + public ServerStatusResponse.MinecraftProtocolVersionIdentifier getProtocolVersionInfo() +@@ -50,11 +52,13 @@ + public void setProtocolVersionInfo(ServerStatusResponse.MinecraftProtocolVersionIdentifier protocolVersionData) + { + this.protocolVersion = protocolVersionData; ++ invalidateJson(); + } + + public void setFavicon(String faviconBlob) + { + this.favicon = faviconBlob; ++ invalidateJson(); + } + + public String getFavicon() +@@ -224,6 +228,7 @@ + serverstatusresponse.setFavicon(JsonUtils.getJsonObjectStringFieldValue(jsonobject, "favicon")); + } + ++ net.minecraftforge.fml.client.FMLClientHandler.instance().captureAdditionalData(serverstatusresponse, jsonobject); + return serverstatusresponse; + } + +@@ -251,6 +256,7 @@ + jsonobject.addProperty("favicon", p_serialize_1_.getFavicon()); + } + ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.enhanceStatusQuery(jsonobject); + return jsonobject; + } + } diff --git a/patches/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch b/patches/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch new file mode 100644 index 000000000..216e1eec3 --- /dev/null +++ b/patches/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch @@ -0,0 +1,48 @@ +--- ../src-base/minecraft/net/minecraft/network/handshake/client/C00Handshake.java ++++ ../src-work/minecraft/net/minecraft/network/handshake/client/C00Handshake.java +@@ -15,6 +15,7 @@ + private int port; + private EnumConnectionState requestedState; + private static final String __OBFID = "CL_00001372"; ++ private boolean hasFMLMarker = false; + + public C00Handshake() + { +@@ -29,18 +30,26 @@ + this.requestedState = requestedState; + } + ++ public C00Handshake(int protocol, String address, int port, EnumConnectionState state, boolean addFMLMarker) ++ { ++ this(protocol, address, port, state); ++ this.hasFMLMarker = addFMLMarker; ++ } ++ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.protocolVersion = buf.readVarIntFromBuffer(); + this.ip = buf.readStringFromBuffer(255); + this.port = buf.readUnsignedShort(); + this.requestedState = EnumConnectionState.getById(buf.readVarIntFromBuffer()); ++ this.hasFMLMarker = this.ip.contains("\0FML\0"); ++ this.ip = this.ip.split("\0")[0]; + } + + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.protocolVersion); +- buf.writeString(this.ip); ++ buf.writeString(this.ip + "\0FML\0"); + buf.writeShort(this.port); + buf.writeVarIntToBuffer(this.requestedState.getId()); + } +@@ -59,4 +68,9 @@ + { + return this.protocolVersion; + } ++ ++ public boolean hasFMLMarker() ++ { ++ return this.hasFMLMarker; ++ } + } diff --git a/patches/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch b/patches/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch new file mode 100644 index 000000000..1da13e842 --- /dev/null +++ b/patches/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java ++++ ../src-work/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java +@@ -48,7 +48,11 @@ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeString(this.channel); ++ synchronized(this.data) { //This may be access multiple times, from multiple threads, lets be safe. ++ this.data.markReaderIndex(); + buf.writeBytes((ByteBuf)this.data); ++ this.data.resetReaderIndex(); ++ } + } + + public void processPacket(INetHandlerPlayServer handler) diff --git a/patches/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch b/patches/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch new file mode 100644 index 000000000..819e5c062 --- /dev/null +++ b/patches/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java ++++ ../src-work/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java +@@ -47,7 +47,11 @@ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeString(this.channel); ++ synchronized(this.data) { //This may be access multiple times, from multiple threads, lets be safe. ++ this.data.markReaderIndex(); + buf.writeBytes((ByteBuf)this.data); ++ this.data.resetReaderIndex(); ++ } + } + + public void processPacket(INetHandlerPlayClient handler) diff --git a/patches/minecraft/net/minecraft/potion/Potion.java.patch b/patches/minecraft/net/minecraft/potion/Potion.java.patch new file mode 100644 index 000000000..8aad8a9e8 --- /dev/null +++ b/patches/minecraft/net/minecraft/potion/Potion.java.patch @@ -0,0 +1,30 @@ +--- ../src-base/minecraft/net/minecraft/potion/Potion.java ++++ ../src-work/minecraft/net/minecraft/potion/Potion.java +@@ -311,4 +311,27 @@ + { + return p_111183_2_.getAmount() * (double)(p_111183_1_ + 1); + } ++ ++ /* ======================================== FORGE START =====================================*/ ++ ++ /** ++ * If the standard PotionEffect text (name and duration) should be drawn when this potion is active. ++ * @param effect the active PotionEffect ++ * @return true to draw the standard text ++ */ ++ public boolean shouldRenderInvText(PotionEffect effect) ++ { ++ return true; ++ } ++ ++ /** ++ * Called to draw the this Potion onto the player's inventory when it's active. ++ * This can be used to e.g. render Potion icons from your own texture. ++ * @param x the x coordinate ++ * @param y the y coordinate ++ * @param effect the active PotionEffect ++ * @param mc the Minecraft instance, for convenience ++ */ ++ @SideOnly(Side.CLIENT) ++ public void renderInventoryEffect(int x, int y, PotionEffect effect, net.minecraft.client.Minecraft mc) { } + } diff --git a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch b/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch new file mode 100644 index 000000000..eaa78b0a7 --- /dev/null +++ b/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch @@ -0,0 +1,91 @@ +--- ../src-base/minecraft/net/minecraft/potion/PotionEffect.java ++++ ../src-work/minecraft/net/minecraft/potion/PotionEffect.java +@@ -19,6 +19,8 @@ + private boolean isPotionDurationMax; + private boolean showParticles; + private static final String __OBFID = "CL_00001529"; ++ /** List of ItemStack that can cure the potion effect **/ ++ private java.util.List curativeItems; + + public PotionEffect(int id, int effectDuration) + { +@@ -37,6 +39,8 @@ + this.amplifier = effectAmplifier; + this.isAmbient = ambient; + this.showParticles = showParticles; ++ this.curativeItems = new java.util.ArrayList(); ++ this.curativeItems.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.milk_bucket)); + } + + public PotionEffect(PotionEffect other) +@@ -46,6 +50,7 @@ + this.amplifier = other.amplifier; + this.isAmbient = other.isAmbient; + this.showParticles = other.showParticles; ++ this.curativeItems = other.curativeItems; + } + + public void combine(PotionEffect other) +@@ -224,4 +229,62 @@ + { + return this.isPotionDurationMax; + } ++ ++ /* ======================================== FORGE START =====================================*/ ++ /*** ++ * Returns a list of curative items for the potion effect ++ * @return The list (ItemStack) of curative items for the potion effect ++ */ ++ public java.util.List getCurativeItems() ++ { ++ return this.curativeItems; ++ } ++ ++ /*** ++ * Checks the given ItemStack to see if it is in the list of curative items for the potion effect ++ * @param stack The ItemStack being checked against the list of curative items for the potion effect ++ * @return true if the given ItemStack is in the list of curative items for the potion effect, false otherwise ++ */ ++ public boolean isCurativeItem(net.minecraft.item.ItemStack stack) ++ { ++ boolean found = false; ++ for (net.minecraft.item.ItemStack curativeItem : this.curativeItems) ++ { ++ if (curativeItem.isItemEqual(stack)) ++ { ++ found = true; ++ } ++ } ++ ++ return found; ++ } ++ ++ /*** ++ * Sets the array of curative items for the potion effect ++ * @param curativeItems The list of ItemStacks being set to the potion effect ++ */ ++ public void setCurativeItems(java.util.List curativeItems) ++ { ++ this.curativeItems = curativeItems; ++ } ++ ++ /*** ++ * Adds the given stack to list of curative items for the potion effect ++ * @param stack The ItemStack being added to the curative item list ++ */ ++ public void addCurativeItem(net.minecraft.item.ItemStack stack) ++ { ++ boolean found = false; ++ for (net.minecraft.item.ItemStack curativeItem : this.curativeItems) ++ { ++ if (curativeItem.isItemEqual(stack)) ++ { ++ found = true; ++ } ++ } ++ if (!found) ++ { ++ this.curativeItems.add(stack); ++ } ++ } + } diff --git a/patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch b/patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch new file mode 100644 index 000000000..321fa089b --- /dev/null +++ b/patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch @@ -0,0 +1,19 @@ +--- ../src-base/minecraft/net/minecraft/realms/RealmsConnect.java ++++ ../src-work/minecraft/net/minecraft/realms/RealmsConnect.java +@@ -40,6 +40,7 @@ + + try + { ++ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToRealmsServer(p_connect_1_, p_connect_2_); + inetaddress = InetAddress.getByName(p_connect_1_); + + if (RealmsConnect.this.aborted) +@@ -61,7 +62,7 @@ + return; + } + +- RealmsConnect.this.connection.sendPacket(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN)); ++ RealmsConnect.this.connection.sendPacket(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN, true)); + + if (RealmsConnect.this.aborted) + { diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch new file mode 100644 index 000000000..319a31742 --- /dev/null +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -0,0 +1,186 @@ +--- ../src-base/minecraft/net/minecraft/server/MinecraftServer.java ++++ ../src-work/minecraft/net/minecraft/server/MinecraftServer.java +@@ -98,7 +98,7 @@ + @SideOnly(Side.SERVER) + private String hostname; + private int serverPort = -1; +- public WorldServer[] worldServers; ++ public WorldServer[] worldServers = new WorldServer[0]; + private ServerConfigurationManager serverConfigManager; + private boolean serverRunning = true; + private boolean serverStopped; +@@ -115,7 +115,8 @@ + private int buildLimit; + private int maxPlayerIdleMinutes = 0; + public final long[] tickTimeArray = new long[100]; +- public long[][] timeOfLastDimensionTick; ++ //public long[][] timeOfLastDimensionTick; ++ public java.util.Hashtable worldTickTimes = new java.util.Hashtable(); + private KeyPair serverKeyPair; + private String serverOwner; + private String folderName; +@@ -229,8 +230,6 @@ + { + this.convertMapIfNeeded(p_71247_1_); + this.setUserMessage("menu.loadingLevel"); +- this.worldServers = new WorldServer[3]; +- this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; + ISaveHandler isavehandler = this.anvilConverterForAnvilFile.getSaveLoader(p_71247_1_, true); + this.setResourcePackFromWorld(this.getFolderName(), isavehandler); + WorldInfo worldinfo = isavehandler.loadWorldInfo(); +@@ -405,7 +404,7 @@ + + public void stopServer() + { +- if (!this.worldIsBeingDeleted) ++ if (!this.worldIsBeingDeleted && net.minecraftforge.fml.common.Loader.instance().hasReachedState(net.minecraftforge.fml.common.LoaderState.SERVER_STARTED) && !serverStopped) // make sure the save is valid and we don't save twice + { + logger.info("Stopping server"); + +@@ -429,8 +428,15 @@ + for (int i = 0; i < this.worldServers.length; ++i) + { + WorldServer worldserver = this.worldServers[i]; ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); + worldserver.flush(); + } ++ ++ WorldServer[] tmp = worldServers; ++ for (WorldServer world : tmp) ++ { ++ net.minecraftforge.common.DimensionManager.setWorld(world.provider.getDimensionId(), null); ++ } + } + + if (this.usageSnooper.isSnooperRunning()) +@@ -462,6 +468,7 @@ + { + if (this.startServer()) + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarted(); + this.currentTime = getCurrentTimeMillis(); + long i = 0L; + this.statusResponse.setServerDescription(new ChatComponentText(this.motd)); +@@ -506,12 +513,20 @@ + Thread.sleep(Math.max(1L, 50L - i)); + this.serverIsRunning = true; + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStopping(); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions + } + else + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions + this.finalTick((CrashReport)null); + } + } ++ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) ++ { ++ // ignore silently ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions ++ } + catch (Throwable throwable1) + { + logger.error("Encountered an unexpected exception", throwable1); +@@ -537,6 +552,7 @@ + logger.error("We were unable to save this crash report to disk."); + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions + this.finalTick(crashreport); + } + finally +@@ -552,6 +568,8 @@ + } + finally + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStopped(); ++ this.serverStopped = true; + this.systemExitNow(); + } + } +@@ -601,6 +619,7 @@ + public void tick() + { + long i = System.nanoTime(); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreServerTick(); + ++this.tickCounter; + + if (this.startProfiling) +@@ -627,6 +646,7 @@ + + Collections.shuffle(Arrays.asList(agameprofile)); + this.statusResponse.getPlayerCountData().setPlayers(agameprofile); ++ this.statusResponse.invalidateJson(); + } + + if (this.tickCounter % 900 == 0) +@@ -654,6 +674,7 @@ + + this.theProfiler.endSection(); + this.theProfiler.endSection(); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostServerTick(); + } + + public void updateTimeLightAndEntities() +@@ -710,6 +731,7 @@ + throw new ReportedException(crashreport1); + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostWorldTick(worldserver); + this.theProfiler.endSection(); + this.theProfiler.startSection("tracker"); + worldserver.getEntityTracker().updateTrackedEntities(); +@@ -717,9 +739,11 @@ + this.theProfiler.endSection(); + } + +- this.timeOfLastDimensionTick[j][this.tickCounter % 100] = System.nanoTime() - i; ++ worldTickTimes.get(id)[this.tickCounter % 100] = System.nanoTime() - i; + } + ++ this.theProfiler.endStartSection("dim_unloading"); ++ net.minecraftforge.common.DimensionManager.unloadWorlds(worldTickTimes); + this.theProfiler.endStartSection("connection"); + this.getNetworkSystem().networkTick(); + this.theProfiler.endStartSection("players"); +@@ -741,6 +765,7 @@ + + public void startServerThread() + { ++ net.minecraftforge.fml.common.StartupQuery.reset(); + this.serverThread = new Thread(this, "Server thread"); + this.serverThread.start(); + } +@@ -757,7 +782,13 @@ + + public WorldServer worldServerForDimension(int dimension) + { +- return dimension == -1 ? this.worldServers[1] : (dimension == 1 ? this.worldServers[2] : this.worldServers[0]); ++ WorldServer ret = net.minecraftforge.common.DimensionManager.getWorld(dimension); ++ if (ret == null) ++ { ++ net.minecraftforge.common.DimensionManager.initDimension(dimension); ++ ret = net.minecraftforge.common.DimensionManager.getWorld(dimension); ++ } ++ return ret; + } + + public String getMinecraftVersion() +@@ -787,7 +818,7 @@ + + public String getServerModName() + { +- return "vanilla"; ++ return net.minecraftforge.fml.common.FMLCommonHandler.instance().getModName(); + } + + public CrashReport addServerInfoToCrashReport(CrashReport report) +@@ -1000,6 +1031,7 @@ + + if (worldserver != null) + { ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); + worldserver.flush(); + } + } diff --git a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch new file mode 100644 index 000000000..df51ee2ec --- /dev/null +++ b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -0,0 +1,44 @@ +--- ../src-base/minecraft/net/minecraft/server/dedicated/DedicatedServer.java ++++ ../src-work/minecraft/net/minecraft/server/dedicated/DedicatedServer.java +@@ -49,6 +49,7 @@ + private boolean canSpawnStructures; + private WorldSettings.GameType gameType; + private boolean guiIsEnabled; ++ public static boolean allowPlayerLogins = false; + private static final String __OBFID = "CL_00001784"; + + public DedicatedServer(File workDir) +@@ -110,6 +111,8 @@ + logger.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStart(this); ++ + logger.info("Loading properties"); + this.settings = new PropertyManager(new File("server.properties")); + this.eula = new ServerEula(new File("eula.txt")); +@@ -201,6 +204,7 @@ + } + else + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStarted(); + this.setConfigManager(new DedicatedPlayerList(this)); + long j = System.nanoTime(); + +@@ -247,6 +251,7 @@ + this.setBuildLimit((this.getBuildLimit() + 8) / 16 * 16); + this.setBuildLimit(MathHelper.clamp_int(this.getBuildLimit(), 64, 256)); + this.settings.setProperty("max-build-height", Integer.valueOf(this.getBuildLimit())); ++ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; + logger.info("Preparing level \"" + this.getFolderName() + "\""); + this.loadAllWorlds(this.getFolderName(), this.getFolderName(), k, worldtype, s2); + long i1 = System.nanoTime() - j; +@@ -275,7 +280,7 @@ + thread1.start(); + } + +- return true; ++ return net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarting(this); + } + } + } diff --git a/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch b/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch new file mode 100644 index 000000000..e2d5c0154 --- /dev/null +++ b/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch @@ -0,0 +1,24 @@ +--- ../src-base/minecraft/net/minecraft/server/gui/MinecraftServerGui.java ++++ ../src-work/minecraft/net/minecraft/server/gui/MinecraftServerGui.java +@@ -80,6 +80,7 @@ + System.exit(0); + } + }); ++ minecraftservergui.latch.countDown(); + } + + public MinecraftServerGui(DedicatedServer serverIn) +@@ -167,8 +168,13 @@ + return jpanel; + } + ++ private java.util.concurrent.CountDownLatch latch = new java.util.concurrent.CountDownLatch(1); + public void func_164247_a(final JTextArea p_164247_1_, final JScrollPane p_164247_2_, final String p_164247_3_) + { ++ try ++ { ++ latch.await(); ++ } catch (InterruptedException e){} //Prevent logging until after constructor has ended. + if (!SwingUtilities.isEventDispatchThread()) + { + SwingUtilities.invokeLater(new Runnable() diff --git a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch new file mode 100644 index 000000000..60e46c1f8 --- /dev/null +++ b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/server/integrated/IntegratedServer.java ++++ ../src-work/minecraft/net/minecraft/server/integrated/IntegratedServer.java +@@ -72,8 +72,6 @@ + protected void loadAllWorlds(String p_71247_1_, String p_71247_2_, long seed, WorldType type, String p_71247_6_) + { + this.convertMapIfNeeded(p_71247_1_); +- this.worldServers = new WorldServer[3]; +- this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; + ISaveHandler isavehandler = this.getActiveAnvilConverter().getSaveLoader(p_71247_1_, true); + this.setResourcePackFromWorld(this.getFolderName(), isavehandler); + WorldInfo worldinfo = isavehandler.loadWorldInfo(); +@@ -142,9 +140,10 @@ + this.setAllowFlight(true); + logger.info("Generating keypair"); + this.setKeyPair(CryptManager.generateKeyPair()); ++ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; + this.loadAllWorlds(this.getFolderName(), this.getWorldName(), this.theWorldSettings.getSeed(), this.theWorldSettings.getTerrainType(), this.theWorldSettings.getWorldName()); + this.setMOTD(this.getServerOwner() + " - " + this.worldServers[0].getWorldInfo().getWorldName()); +- return true; ++ return net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarting(this); + } + + public void tick() +@@ -217,6 +216,7 @@ + + public EnumDifficulty getDifficulty() + { ++ if (this.mc.theWorld == null) return this.mc.gameSettings.difficulty; // Fix NPE just in case. + return this.mc.theWorld.getWorldInfo().getDifficulty(); + } + diff --git a/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch b/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch new file mode 100644 index 000000000..2a343d61e --- /dev/null +++ b/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch @@ -0,0 +1,257 @@ +--- ../src-base/minecraft/net/minecraft/server/management/ItemInWorldManager.java ++++ ../src-work/minecraft/net/minecraft/server/management/ItemInWorldManager.java +@@ -22,6 +22,8 @@ + + public class ItemInWorldManager + { ++ /** Forge reach distance */ ++ private double blockReachDistance = 5.0d; + public World theWorld; + public EntityPlayerMP thisPlayerMP; + private WorldSettings.GameType gameType = WorldSettings.GameType.NOT_SET; +@@ -131,6 +133,14 @@ + + public void onBlockClicked(BlockPos pos, EnumFacing side) + { ++ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thisPlayerMP, ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, theWorld, pos, side); ++ if (event.isCanceled()) ++ { ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ return; ++ } ++ + if (this.isCreative()) + { + if (!this.theWorld.extinguishFire((EntityPlayer)null, pos, side)) +@@ -165,18 +175,35 @@ + } + } + +- this.theWorld.extinguishFire((EntityPlayer)null, pos, side); ++ // + this.initialDamage = this.curblockDamage; + float f = 1.0F; + +- if (block.getMaterial() != Material.air) ++ if (!block.isAir(theWorld, pos)) + { +- block.onBlockClicked(this.theWorld, pos, this.thisPlayerMP); ++ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ { ++ block.onBlockClicked(this.theWorld, pos, this.thisPlayerMP); ++ this.theWorld.extinguishFire((EntityPlayer)null, pos, side); ++ } ++ else ++ { ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ } + f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos); + } + +- if (block.getMaterial() != Material.air && f >= 1.0F) ++ if (event.useItem == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) + { ++ if (f >= 1.0F) ++ { ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ } ++ return; ++ } ++ ++ if (!block.isAir(theWorld, pos) && f >= 1.0F) ++ { + this.tryHarvestBlock(pos); + } + else +@@ -197,7 +224,7 @@ + int i = this.curblockDamage - this.initialDamage; + Block block = this.theWorld.getBlockState(pos).getBlock(); + +- if (block.getMaterial() != Material.air) ++ if (!block.isAir(theWorld, pos)) + { + float f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos) * (float)(i + 1); + +@@ -226,9 +253,13 @@ + + private boolean removeBlock(BlockPos pos) + { ++ return removeBlock(pos, false); ++ } ++ private boolean removeBlock(BlockPos pos, boolean canHarvest) ++ { + IBlockState iblockstate = this.theWorld.getBlockState(pos); + iblockstate.getBlock().onBlockHarvested(this.theWorld, pos, iblockstate, this.thisPlayerMP); +- boolean flag = this.theWorld.setBlockToAir(pos); ++ boolean flag = iblockstate.getBlock().removedByPlayer(theWorld, pos, thisPlayerMP, canHarvest); + + if (flag) + { +@@ -240,7 +271,8 @@ + + public boolean tryHarvestBlock(BlockPos pos) + { +- if (this.gameType.isCreative() && this.thisPlayerMP.getHeldItem() != null && this.thisPlayerMP.getHeldItem().getItem() instanceof ItemSword) ++ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(theWorld, gameType, thisPlayerMP, pos); ++ if (exp == -1) + { + return false; + } +@@ -249,40 +281,21 @@ + IBlockState iblockstate = this.theWorld.getBlockState(pos); + TileEntity tileentity = this.theWorld.getTileEntity(pos); + +- if (this.gameType.isAdventure()) +- { +- if (this.gameType == WorldSettings.GameType.SPECTATOR) +- { +- return false; +- } ++ ItemStack stack = thisPlayerMP.getCurrentEquippedItem(); ++ if (stack != null && stack.getItem().onBlockStartBreak(stack, pos, thisPlayerMP)) return false; + +- if (!this.thisPlayerMP.isAllowEdit()) +- { +- ItemStack itemstack = this.thisPlayerMP.getCurrentEquippedItem(); +- +- if (itemstack == null) +- { +- return false; +- } +- +- if (!itemstack.canDestroy(iblockstate.getBlock())) +- { +- return false; +- } +- } +- } +- + this.theWorld.playAuxSFXAtEntity(this.thisPlayerMP, 2001, pos, Block.getStateId(iblockstate)); +- boolean flag1 = this.removeBlock(pos); ++ boolean flag1 = false; + + if (this.isCreative()) + { ++ flag1 = this.removeBlock(pos); + this.thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(this.theWorld, pos)); + } + else + { + ItemStack itemstack1 = this.thisPlayerMP.getCurrentEquippedItem(); +- boolean flag = this.thisPlayerMP.canHarvestBlock(iblockstate.getBlock()); ++ boolean flag = iblockstate.getBlock().canHarvestBlock(theWorld, pos, thisPlayerMP); + + if (itemstack1 != null) + { +@@ -294,12 +307,18 @@ + } + } + ++ flag1 = this.removeBlock(pos, flag); + if (flag1 && flag) + { + iblockstate.getBlock().harvestBlock(this.theWorld, this.thisPlayerMP, pos, iblockstate, tileentity); + } + } + ++ // Drop experiance ++ if (!this.isCreative() && flag1 && exp > 0) ++ { ++ iblockstate.getBlock().dropXpOnBlockBreak(theWorld, pos, exp); ++ } + return flag1; + } + } +@@ -333,6 +352,7 @@ + if (itemstack.stackSize == 0) + { + player.inventory.mainInventory[player.inventory.currentItem] = null; ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, itemstack1); + } + + if (!player.isUsingItem()) +@@ -381,33 +401,51 @@ + } + else + { +- if (!player.isSneaking() || player.getHeldItem() == null) ++ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(player, ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, worldIn, pos, side); ++ if (event.isCanceled()) + { +- IBlockState iblockstate = worldIn.getBlockState(pos); +- +- if (iblockstate.getBlock().onBlockActivated(worldIn, pos, iblockstate, player, side, p_180236_6_, p_180236_7_, p_180236_8_)) +- { +- return true; +- } ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ return false; + } + +- if (stack == null) ++ if (stack != null && stack.getItem().onItemUseFirst(stack, player, worldIn, pos, side, p_180236_6_, p_180236_7_, p_180236_8_)) + { +- return false; ++ if (stack.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(thisPlayerMP, stack); ++ return true; + } +- else if (this.isCreative()) ++ ++ IBlockState iblockstate = worldIn.getBlockState(pos); ++ boolean isAir = worldIn.isAirBlock(pos); ++ boolean useBlock = !player.isSneaking() || player.getHeldItem() == null; ++ if (!useBlock) useBlock = player.getHeldItem().getItem().doesSneakBypassUse(worldIn, pos, player); ++ boolean result = false; ++ ++ if (useBlock) + { +- int j = stack.getMetadata(); +- int i = stack.stackSize; +- boolean flag = stack.onItemUse(player, worldIn, pos, side, p_180236_6_, p_180236_7_, p_180236_8_); +- stack.setItemDamage(j); +- stack.stackSize = i; +- return flag; ++ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ { ++ result = iblockstate.getBlock().onBlockActivated(worldIn, pos, iblockstate, player, side, p_180236_6_, p_180236_7_, p_180236_8_); ++ } ++ else ++ { ++ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ result = event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW; ++ } + } +- else ++ if (stack != null && !result && event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) + { +- return stack.onItemUse(player, worldIn, pos, side, p_180236_6_, p_180236_7_, p_180236_8_); ++ int meta = stack.getMetadata(); ++ int size = stack.stackSize; ++ result = stack.onItemUse(player, worldIn, pos, side, p_180236_6_, p_180236_7_, p_180236_8_); ++ if (isCreative()) ++ { ++ stack.setItemDamage(meta); ++ stack.stackSize = size; ++ } ++ if (stack.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(thisPlayerMP, stack); + } ++ return result; + } + } + +@@ -415,4 +453,13 @@ + { + this.theWorld = serverWorld; + } ++ ++ public double getBlockReachDistance() ++ { ++ return blockReachDistance; ++ } ++ public void setBlockReachDistance(double distance) ++ { ++ blockReachDistance = distance; ++ } + } diff --git a/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch new file mode 100644 index 000000000..309ef6e22 --- /dev/null +++ b/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch @@ -0,0 +1,187 @@ +--- ../src-base/minecraft/net/minecraft/server/management/PlayerManager.java ++++ ../src-work/minecraft/net/minecraft/server/management/PlayerManager.java +@@ -118,15 +118,24 @@ + int j = (int)p_72683_1_.posZ >> 4; + p_72683_1_.managedPosX = p_72683_1_.posX; + p_72683_1_.managedPosZ = p_72683_1_.posZ; ++ // Load nearby chunks first ++ List chunkList = new ArrayList(); + + for (int k = i - this.playerViewRadius; k <= i + this.playerViewRadius; ++k) + { + for (int l = j - this.playerViewRadius; l <= j + this.playerViewRadius; ++l) + { +- this.getPlayerInstance(k, l, true).addPlayer(p_72683_1_); ++ chunkList.add(new ChunkCoordIntPair(k, l)); + } + } + ++ java.util.Collections.sort(chunkList, new net.minecraftforge.common.util.ChunkCoordComparator(p_72683_1_)); ++ ++ for (ChunkCoordIntPair pair : chunkList) ++ { ++ this.getPlayerInstance(pair.chunkXPos, pair.chunkZPos, true).addPlayer(p_72683_1_); ++ } ++ + this.players.add(p_72683_1_); + this.filterChunkLoadQueue(p_72683_1_); + } +@@ -226,6 +235,7 @@ + int i1 = this.playerViewRadius; + int j1 = i - k; + int k1 = j - l; ++ List chunksToLoad = new ArrayList(); + + if (j1 != 0 || k1 != 0) + { +@@ -235,7 +245,7 @@ + { + if (!this.overlaps(l1, i2, k, l, i1)) + { +- this.getPlayerInstance(l1, i2, true).addPlayer(p_72685_1_); ++ chunksToLoad.add(new ChunkCoordIntPair(l1, i2)); + } + + if (!this.overlaps(l1 - j1, i2 - k1, i, j, i1)) +@@ -253,6 +263,18 @@ + this.filterChunkLoadQueue(p_72685_1_); + p_72685_1_.managedPosX = p_72685_1_.posX; + p_72685_1_.managedPosZ = p_72685_1_.posZ; ++ // send nearest chunks first ++ java.util.Collections.sort(chunksToLoad, new net.minecraftforge.common.util.ChunkCoordComparator(p_72685_1_)); ++ ++ for (ChunkCoordIntPair pair : chunksToLoad) ++ { ++ this.getPlayerInstance(pair.chunkXPos, pair.chunkZPos, true).addPlayer(p_72685_1_); ++ } ++ ++ if (i1 > 1 || i1 < -1 || j1 > 1 || j1 < -1) ++ { ++ java.util.Collections.sort(p_72685_1_.loadedChunks, new net.minecraftforge.common.util.ChunkCoordComparator(p_72685_1_)); ++ } + } + } + } +@@ -323,12 +345,21 @@ + private int numBlocksToUpdate; + private int flagsYAreasToUpdate; + private long previousWorldTime; ++ private final java.util.HashMap players = new java.util.HashMap(); ++ private boolean loaded = false; ++ private Runnable loadedRunnable = new Runnable() ++ { ++ public void run() ++ { ++ PlayerInstance.this.loaded = true; ++ } ++ }; + private static final String __OBFID = "CL_00001435"; + + public PlayerInstance(int p_i1518_2_, int p_i1518_3_) + { + this.chunkCoords = new ChunkCoordIntPair(p_i1518_2_, p_i1518_3_); +- PlayerManager.this.getMinecraftServer().theChunkProviderServer.loadChunk(p_i1518_2_, p_i1518_3_); ++ PlayerManager.this.getMinecraftServer().theChunkProviderServer.loadChunk(p_i1518_2_, p_i1518_3_, this.loadedRunnable); + } + + public void addPlayer(EntityPlayerMP p_73255_1_) +@@ -345,7 +376,24 @@ + } + + this.playersWatchingChunk.add(p_73255_1_); ++ Runnable playerRunnable = null; ++ if (this.loaded) ++ { + p_73255_1_.loadedChunks.add(this.chunkCoords); ++ } ++ else ++ { ++ final EntityPlayerMP tmp = p_73255_1_; ++ playerRunnable = new Runnable() ++ { ++ public void run() ++ { ++ tmp.loadedChunks.add(PlayerInstance.this.chunkCoords); ++ } ++ }; ++ PlayerManager.this.getMinecraftServer().theChunkProviderServer.loadChunk(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, playerRunnable); ++ } ++ this.players.put(p_73255_1_, playerRunnable); + } + } + +@@ -353,6 +401,24 @@ + { + if (this.playersWatchingChunk.contains(p_73252_1_)) + { ++ // If we haven't loaded yet don't load the chunk just so we can clean it up ++ if (!this.loaded) ++ { ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.getMinecraftServer(), this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, this.players.get(p_73252_1_)); ++ this.playersWatchingChunk.remove(p_73252_1_); ++ this.players.remove(p_73252_1_); ++ ++ if (this.playersWatchingChunk.isEmpty()) ++ { ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.getMinecraftServer(), this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, this.loadedRunnable); ++ long i = (long) this.chunkCoords.chunkXPos + 2147483647L | (long) this.chunkCoords.chunkZPos + 2147483647L << 32; ++ PlayerManager.this.playerInstances.remove(i); ++ PlayerManager.this.playerInstanceList.remove(this); ++ } ++ ++ return; ++ } ++ + Chunk chunk = PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos); + + if (chunk.isPopulated()) +@@ -360,9 +426,12 @@ + p_73252_1_.playerNetServerHandler.sendPacket(new S21PacketChunkData(chunk, true, 0)); + } + ++ this.players.remove(p_73252_1_); + this.playersWatchingChunk.remove(p_73252_1_); + p_73252_1_.loadedChunks.remove(this.chunkCoords); + ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.UnWatch(chunkCoords, p_73252_1_)); ++ + if (this.playersWatchingChunk.isEmpty()) + { + long i = (long)this.chunkCoords.chunkXPos + 2147483647L | (long)this.chunkCoords.chunkZPos + 2147483647L << 32; +@@ -400,7 +469,7 @@ + + this.flagsYAreasToUpdate |= 1 << (p_151253_2_ >> 4); + +- if (this.numBlocksToUpdate < 64) ++ //Forge; Cache everything, so always run + { + short short1 = (short)(p_151253_1_ << 12 | p_151253_3_ << 8 | p_151253_2_); + +@@ -412,6 +481,10 @@ + } + } + ++ if (numBlocksToUpdate == locationOfBlockChange.length) ++ { ++ locationOfBlockChange = java.util.Arrays.copyOf(locationOfBlockChange, locationOfBlockChange.length << 1); ++ } + this.locationOfBlockChange[this.numBlocksToUpdate++] = short1; + } + } +@@ -429,6 +502,7 @@ + } + } + ++ @SuppressWarnings("unused") + public void onUpdate() + { + if (this.numBlocksToUpdate != 0) +@@ -441,7 +515,7 @@ + BlockPos blockpos = new BlockPos(i, j, k); + this.sendToAllPlayersWatchingChunk(new S23PacketBlockChange(PlayerManager.this.theWorldServer, blockpos)); + +- if (PlayerManager.this.theWorldServer.getBlockState(blockpos).getBlock().hasTileEntity()) ++ if (PlayerManager.this.theWorldServer.getBlockState(blockpos).getBlock().hasTileEntity(PlayerManager.this.theWorldServer.getBlockState(blockpos))) + { + this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos)); + } diff --git a/patches/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch new file mode 100644 index 000000000..c622cc325 --- /dev/null +++ b/patches/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch @@ -0,0 +1,23 @@ +--- ../src-base/minecraft/net/minecraft/server/management/PlayerProfileCache.java ++++ ../src-work/minecraft/net/minecraft/server/management/PlayerProfileCache.java +@@ -229,6 +229,20 @@ + { + IOUtils.closeQuietly((Reader)bufferedreader); + } ++ } ++ catch (FileNotFoundException filenotfoundexception) ++ { ++ ; ++ } ++ catch (com.google.gson.JsonParseException parsefail) ++ { ++ // No op - the cache can quietly rebuild if it's junk ++ } ++ finally ++ { ++ IOUtils.closeQuietly(bufferedreader); ++ } ++ } + } + + public void func_152658_c() diff --git a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch new file mode 100644 index 000000000..39f17339e --- /dev/null +++ b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch @@ -0,0 +1,153 @@ +--- ../src-base/minecraft/net/minecraft/server/management/ServerConfigurationManager.java ++++ ../src-work/minecraft/net/minecraft/server/management/ServerConfigurationManager.java +@@ -100,7 +100,7 @@ + this.maxPlayers = 8; + } + +- public void initializeConnectionToPlayer(NetworkManager netManager, EntityPlayerMP playerIn) ++ public void initializeConnectionToPlayer(NetworkManager netManager, EntityPlayerMP playerIn, NetHandlerPlayServer nethandlerplayserver) + { + GameProfile gameprofile = playerIn.getGameProfile(); + PlayerProfileCache playerprofilecache = this.mcServer.getPlayerProfileCache(); +@@ -109,6 +109,17 @@ + playerprofilecache.func_152649_a(gameprofile); + NBTTagCompound nbttagcompound = this.readPlayerDataFromFile(playerIn); + playerIn.setWorld(this.mcServer.worldServerForDimension(playerIn.dimension)); ++ ++ World playerWorld = this.mcServer.worldServerForDimension(playerIn.dimension); ++ if (playerWorld == null) ++ { ++ playerIn.dimension=0; ++ playerWorld=this.mcServer.worldServerForDimension(0); ++ BlockPos spawnPoint = playerWorld.provider.getRandomizedSpawnPoint(); ++ playerIn.setPosition(spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ()); ++ } ++ ++ playerIn.setWorld(playerWorld); + playerIn.theItemInWorldManager.setWorld((WorldServer)playerIn.worldObj); + String s1 = "local"; + +@@ -122,7 +133,7 @@ + WorldInfo worldinfo = worldserver.getWorldInfo(); + BlockPos blockpos = worldserver.getSpawnPoint(); + this.func_72381_a(playerIn, (EntityPlayerMP)null, worldserver); +- NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.mcServer, netManager, playerIn); ++ playerIn.playerNetServerHandler = nethandlerplayserver; + nethandlerplayserver.sendPacket(new S01PacketJoinGame(playerIn.getEntityId(), playerIn.theItemInWorldManager.getGameType(), worldinfo.isHardcoreModeEnabled(), worldserver.provider.getDimensionId(), worldserver.getDifficulty(), this.getMaxPlayers(), worldinfo.getTerrainType(), worldserver.getGameRules().getGameRuleBooleanValue("reducedDebugInfo"))); + nethandlerplayserver.sendPacket(new S3FPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(this.getServerInstance().getServerModName()))); + nethandlerplayserver.sendPacket(new S41PacketServerDifficulty(worldinfo.getDifficulty(), worldinfo.isDifficultyLocked())); +@@ -162,6 +173,7 @@ + + playerIn.addSelfToInternalCraftingInventory(); + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedIn(playerIn); + if (nbttagcompound != null && nbttagcompound.hasKey("Riding", 10)) + { + Entity entity = EntityList.createEntityFromNBT(nbttagcompound.getCompoundTag("Riding"), worldserver); +@@ -264,6 +276,7 @@ + playerIn.readFromNBT(nbttagcompound); + nbttagcompound1 = nbttagcompound; + logger.debug("loading single player"); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(playerIn, this.playerNBTManagerObj, playerIn.getUniqueID().toString()); + } + else + { +@@ -273,8 +286,23 @@ + return nbttagcompound1; + } + ++ public NBTTagCompound getPlayerNBT(EntityPlayerMP player) ++ { ++ // Hacky method to allow loading the NBT for a player prior to login ++ NBTTagCompound nbttagcompound = this.mcServer.worldServers[0].getWorldInfo().getPlayerNBTTagCompound(); ++ if (player.getName().equals(this.mcServer.getServerOwner()) && nbttagcompound != null) ++ { ++ return nbttagcompound; ++ } ++ else ++ { ++ return ((net.minecraft.world.storage.SaveHandler)this.playerNBTManagerObj).getPlayerNBT(player); ++ } ++ } + protected void writePlayerData(EntityPlayerMP playerIn) + { ++ if (playerIn.playerNetServerHandler == null) return; ++ + this.playerNBTManagerObj.writePlayerData(playerIn); + StatisticsFile statisticsfile = (StatisticsFile)this.playerStatFiles.get(playerIn.getUniqueID()); + +@@ -290,6 +318,7 @@ + this.uuidToPlayerMap.put(playerIn.getUniqueID(), playerIn); + this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {playerIn})); + WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); + worldserver.spawnEntityInWorld(playerIn); + this.func_72375_a(playerIn, (WorldServer)null); + +@@ -307,6 +336,7 @@ + + public void playerLoggedOut(EntityPlayerMP playerIn) + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedOut(playerIn); + playerIn.triggerAchievement(StatList.leaveGameStat); + this.writePlayerData(playerIn); + WorldServer worldserver = playerIn.getServerForPlayer(); +@@ -495,17 +525,27 @@ + { + playerIn.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(playerIn.getEntityId(), potioneffect)); + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(playerIn, j, dimension); + } + + public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_) + { +- double d0 = entityIn.posX; +- double d1 = entityIn.posZ; ++ transferEntityToWorld(entityIn, p_82448_2_, p_82448_3_, p_82448_4_, p_82448_4_.getDefaultTeleporter()); ++ } ++ ++ @SuppressWarnings("unused") ++ public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, net.minecraft.world.Teleporter teleporter) ++ { ++ net.minecraft.world.WorldProvider pOld = p_82448_3_.provider; ++ net.minecraft.world.WorldProvider pNew = p_82448_4_.provider; ++ double moveFactor = pOld.getMovementFactor() / pNew.getMovementFactor(); ++ double d0 = entityIn.posX * moveFactor; ++ double d1 = entityIn.posZ * moveFactor; + double d2 = 8.0D; + float f = entityIn.rotationYaw; + p_82448_3_.theProfiler.startSection("moving"); + +- if (entityIn.dimension == -1) ++ if (false && entityIn.dimension == -1) //Forge Kill it but dont comment out so we can rename it. + { + d0 = MathHelper.clamp_double(d0 / d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); + d1 = MathHelper.clamp_double(d1 / d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); +@@ -516,7 +556,7 @@ + p_82448_3_.updateEntityWithOptionalForce(entityIn, false); + } + } +- else if (entityIn.dimension == 0) ++ else if (false && entityIn.dimension == 0) //Forge Kill it but dont comment out so we can rename it. + { + d0 = MathHelper.clamp_double(d0 * d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); + d1 = MathHelper.clamp_double(d1 * d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); +@@ -527,7 +567,8 @@ + p_82448_3_.updateEntityWithOptionalForce(entityIn, false); + } + } +- else ++ ++ if (entityIn.dimension == 1) + { + BlockPos blockpos; + +@@ -562,7 +603,7 @@ + if (entityIn.isEntityAlive()) + { + entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch); +- p_82448_4_.getDefaultTeleporter().placeInPortal(entityIn, f); ++ teleporter.placeInPortal(entityIn, f); + p_82448_4_.spawnEntityInWorld(entityIn); + p_82448_4_.updateEntityWithOptionalForce(entityIn, false); + } diff --git a/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch b/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch new file mode 100644 index 000000000..7c5e63706 --- /dev/null +++ b/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java ++++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java +@@ -72,7 +72,7 @@ + } + } + +- if (this.connectionTimer++ == 600) ++ if (this.connectionTimer++ == net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.LOGIN_TIMEOUT) + { + this.closeConnection("Took too long to log in"); + } diff --git a/patches/minecraft/net/minecraft/stats/StatList.java.patch b/patches/minecraft/net/minecraft/stats/StatList.java.patch new file mode 100644 index 000000000..2da9679d1 --- /dev/null +++ b/patches/minecraft/net/minecraft/stats/StatList.java.patch @@ -0,0 +1,29 @@ +--- ../src-base/minecraft/net/minecraft/stats/StatList.java ++++ ../src-work/minecraft/net/minecraft/stats/StatList.java +@@ -110,7 +110,7 @@ + { + if (item != null) + { +- int i = Item.getIdFromItem(item); ++ int i = Item.getIdFromItem(item); //TODO: Hook FML's stat change event and re-assign these + String s = func_180204_a(item); + + if (s != null) +@@ -151,7 +151,7 @@ + { + if (item != null) + { +- int i = Item.getIdFromItem(item); ++ int i = Item.getIdFromItem(item); //TODO: Hook FML's stat change event and re-assign these + String s = func_180204_a(item); + + if (s != null) +@@ -175,7 +175,7 @@ + { + if (item != null) + { +- int i = Item.getIdFromItem(item); ++ int i = Item.getIdFromItem(item); //TODO: Hook FML's stat change event and re-assign these + String s = func_180204_a(item); + + if (s != null && item.isDamageable()) diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch new file mode 100644 index 000000000..90194230c --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -0,0 +1,180 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java +@@ -60,6 +60,7 @@ + public void readFromNBT(NBTTagCompound compound) + { + this.pos = new BlockPos(compound.getInteger("x"), compound.getInteger("y"), compound.getInteger("z")); ++ if (compound.hasKey("ForgeData")) this.customTileData = compound.getCompoundTag("ForgeData"); + } + + public void writeToNBT(NBTTagCompound compound) +@@ -76,6 +77,7 @@ + compound.setInteger("x", this.pos.getX()); + compound.setInteger("y", this.pos.getY()); + compound.setInteger("z", this.pos.getZ()); ++ if (this.customTileData != null) compound.setTag("ForgeData", this.customTileData); + } + } + +@@ -103,7 +105,17 @@ + } + else + { ++ try ++ { + logger.warn("Skipping BlockEntity with id " + nbt.getString("id")); ++ } ++ catch (Exception ex) ++ { ++ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, ex, ++ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", ++ nbt.getString("id"), oclass.getName()); ++ tileentity = null; ++ } + } + + return tileentity; +@@ -135,7 +147,6 @@ + } + } + +- @SideOnly(Side.CLIENT) + public double getDistanceSq(double x, double y, double z) + { + double d0 = (double)this.pos.getX() + 0.5D - x; +@@ -283,4 +294,135 @@ + addMapping(TileEntityFlowerPot.class, "FlowerPot"); + addMapping(TileEntityBanner.class, "Banner"); + } ++ ++ // -- BEGIN FORGE PATCHES -- ++ /** ++ * Called when you receive a TileEntityData packet for the location this ++ * TileEntity is currently in. On the client, the NetworkManager will always ++ * be the remote server. On the server, it will be whomever is responsible for ++ * sending the packet. ++ * ++ * @param net The NetworkManager the packet originated from ++ * @param pkt The data packet ++ */ ++ public void onDataPacket(net.minecraft.network.NetworkManager net, net.minecraft.network.play.server.S35PacketUpdateTileEntity pkt) ++ { ++ } ++ ++ /** ++ * Called when the chunk this TileEntity is on is Unloaded. ++ */ ++ public void onChunkUnload() ++ { ++ } ++ ++ private boolean isVanilla = getClass().getName().startsWith("net.minecraft."); ++ /** ++ * Called from Chunk.setBlockIDWithMetadata, determines if this tile entity should be re-created when the ID, or Metadata changes. ++ * Use with caution as this will leave straggler TileEntities, or create conflicts with other TileEntities if not used properly. ++ * ++ * @param world Current world ++ * @param pos Tile's world position ++ * @param oldID The old ID of the block ++ * @param newID The new ID of the block (May be the same) ++ * @return True to remove the old tile entity, false to keep it in tact {and create a new one if the new values specify to} ++ */ ++ public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate) ++ { ++ return !isVanilla || (oldState.getBlock() != newSate.getBlock()); ++ } ++ ++ public boolean shouldRenderInPass(int pass) ++ { ++ return pass == 0; ++ } ++ ++ /** ++ * Sometimes default render bounding box: infinite in scope. Used to control rendering on {@link TileEntitySpecialRenderer}. ++ */ ++ public static final net.minecraft.util.AxisAlignedBB INFINITE_EXTENT_AABB = new net.minecraft.util.AxisAlignedBB(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); ++ /** ++ * Return an {@link AxisAlignedBB} that controls the visible scope of a {@link TileEntitySpecialRenderer} associated with this {@link TileEntity} ++ * Defaults to the collision bounding box {@link Block#getCollisionBoundingBoxFromPool(World, int, int, int)} associated with the block ++ * at this location. ++ * ++ * @return an appropriately size {@link AxisAlignedBB} for the {@link TileEntity} ++ */ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.util.AxisAlignedBB getRenderBoundingBox() ++ { ++ net.minecraft.util.AxisAlignedBB bb = INFINITE_EXTENT_AABB; ++ Block type = getBlockType(); ++ if (type == Blocks.enchanting_table) ++ { ++ bb = new net.minecraft.util.AxisAlignedBB(getPos(), getPos().add(1, 1, 1)); ++ } ++ else if (type == Blocks.chest || type == Blocks.trapped_chest) ++ { ++ bb = new net.minecraft.util.AxisAlignedBB(getPos().add(-1, 0, -1), getPos().add(2, 2, 2)); ++ } ++ else if (type != null && type != Blocks.beacon) ++ { ++ net.minecraft.util.AxisAlignedBB cbb = null; ++ try ++ { ++ cbb = type.getCollisionBoundingBox(worldObj, getPos(), worldObj.getBlockState(getPos())); ++ } ++ catch (Exception e) ++ { ++ // We have to capture any exceptions that may occur here because BUKKIT servers like to send ++ // the tile entity data BEFORE the chunk data, you know, the OPPOSITE of what vanilla does! ++ // So we can not GARENTEE that the world state is the real state for the block... ++ // So, once again in the long line of US having to accommodate BUKKIT breaking things, ++ // here it is, assume that the TE is only 1 cubic block. Problem with this is that it may ++ // cause the TileEntity renderer to error further down the line! But alas, nothing we can do. ++ cbb = new net.minecraft.util.AxisAlignedBB(getPos().add(-1, 0, -1), getPos().add(1, 1, 1)); ++ } ++ if (cbb != null) bb = cbb; ++ } ++ return bb; ++ } ++ ++ /** ++ * Checks if this tile entity knows how to render its 'breaking' overlay effect. ++ * If this returns true, The TileEntitySpecialRenderer will be called again with break progress set. ++ * @return True to re-render tile with breaking effect. ++ */ ++ public boolean canRenderBreaking() ++ { ++ Block block = this.getBlockType(); ++ return (block instanceof net.minecraft.block.BlockChest || ++ block instanceof net.minecraft.block.BlockEnderChest || ++ block instanceof net.minecraft.block.BlockSign || ++ block instanceof net.minecraft.block.BlockSkull); ++ } ++ ++ private NBTTagCompound customTileData; ++ ++ /** ++ * Gets a {@link NBTTagCompound} that can be used to store custom data for this tile entity. ++ * It will be written, and read from disc, so it persists over world saves. ++ * ++ * @return A compound tag for custom data ++ */ ++ public NBTTagCompound getTileData() ++ { ++ if (this.customTileData == null) ++ { ++ this.customTileData = new NBTTagCompound(); ++ } ++ return this.customTileData; ++ } ++ ++ /** ++ * Determines if the player can overwrite the NBT data of this tile entity while they place it using a ItemStack. ++ * Added as a fix for MC-75630 - Exploit with signs and command blocks ++ * @return True to prevent NBT copy, false to allow. ++ */ ++ public boolean restrictNBTCopy() ++ { ++ return this instanceof TileEntityCommandBlock || ++ this instanceof TileEntityMobSpawner || ++ this instanceof TileEntitySign; ++ } + } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch new file mode 100644 index 000000000..094394193 --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBeacon.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBeacon.java +@@ -170,7 +170,7 @@ + { + Block block = this.worldObj.getBlockState(new BlockPos(j1, i2, k1)).getBlock(); + +- if (block != Blocks.emerald_block && block != Blocks.gold_block && block != Blocks.diamond_block && block != Blocks.iron_block) ++ if (!block.isBeaconBase(this.worldObj, new BlockPos(l1, k1, j1), getPos())) + { + flag1 = false; + break; +@@ -369,7 +369,7 @@ + + public boolean isItemValidForSlot(int index, ItemStack stack) + { +- return stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot; ++ return stack.getItem() != null && stack.getItem().isBeaconPayment(stack); + } + + public String getGuiID() diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch new file mode 100644 index 000000000..4792a1dd6 --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch @@ -0,0 +1,78 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java +@@ -105,7 +105,7 @@ + + private boolean canBrew() + { +- if (this.brewingItemStacks[3] != null && this.brewingItemStacks[3].stackSize > 0) ++ if (this.brewingItemStacks[3] != null && this.brewingItemStacks[3].stackSize > 0 && false) // Code moved to net.minecraftforge.common.brewing.VanillaBrewingRecipe + { + ItemStack itemstack = this.brewingItemStacks[3]; + +@@ -119,7 +119,7 @@ + + for (int i = 0; i < 3; ++i) + { +- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem) ++ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion) + { + int j = this.brewingItemStacks[i].getMetadata(); + int k = this.func_145936_c(j, itemstack); +@@ -146,19 +146,22 @@ + } + else + { +- return false; ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.canBrew(brewingItemStacks, brewingItemStacks[3], outputSlots); + } + } + + private void brewPotions() + { ++ if (net.minecraftforge.event.ForgeEventFactory.onPotionAttemptBreaw(brewingItemStacks)) return; + if (this.canBrew()) + { ++ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(brewingItemStacks, brewingItemStacks[3], outputSlots); + ItemStack itemstack = this.brewingItemStacks[3]; + ++ if (false) { // Code moved to net.minecraftforge.common.brewing.VanillaBrewingRecipe + for (int i = 0; i < 3; ++i) + { +- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem) ++ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion) + { + int j = this.brewingItemStacks[i].getMetadata(); + int k = this.func_145936_c(j, itemstack); +@@ -178,10 +181,11 @@ + } + } + } ++ } + +- if (itemstack.getItem().hasContainerItem()) ++ if (itemstack.getItem().hasContainerItem(itemstack)) + { +- this.brewingItemStacks[3] = new ItemStack(itemstack.getItem().getContainerItem()); ++ this.brewingItemStacks[3] = itemstack.getItem().getContainerItem(itemstack); + } + else + { +@@ -192,6 +196,7 @@ + this.brewingItemStacks[3] = null; + } + } ++ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(brewingItemStacks); + } + } + +@@ -311,7 +316,9 @@ + + public boolean isItemValidForSlot(int index, ItemStack stack) + { +- return index == 3 ? stack.getItem().isPotionIngredient(stack) : stack.getItem() == Items.potionitem || stack.getItem() == Items.glass_bottle; ++ if (index == 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack)) return true; ++ else if (index != 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(stack)) return true; ++ return false; + } + + public boolean[] func_174902_m() diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch new file mode 100644 index 000000000..57b5373ee --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch @@ -0,0 +1,51 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityFurnace.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityFurnace.java +@@ -224,8 +224,7 @@ + + if (this.furnaceItemStacks[1].stackSize == 0) + { +- Item item = this.furnaceItemStacks[1].getItem().getContainerItem(); +- this.furnaceItemStacks[1] = item != null ? new ItemStack(item) : null; ++ this.furnaceItemStacks[1] = furnaceItemStacks[1].getItem().getContainerItem(furnaceItemStacks[1]); + } + } + } +@@ -280,7 +279,11 @@ + else + { + ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.furnaceItemStacks[0]); +- return itemstack == null ? false : (this.furnaceItemStacks[2] == null ? true : (!this.furnaceItemStacks[2].isItemEqual(itemstack) ? false : (this.furnaceItemStacks[2].stackSize < this.getInventoryStackLimit() && this.furnaceItemStacks[2].stackSize < this.furnaceItemStacks[2].getMaxStackSize() ? true : this.furnaceItemStacks[2].stackSize < itemstack.getMaxStackSize()))); ++ if (itemstack == null) return false; ++ if (this.furnaceItemStacks[2] == null) return true; ++ if (!this.furnaceItemStacks[2].isItemEqual(itemstack)) return false; ++ int result = furnaceItemStacks[2].stackSize + itemstack.stackSize; ++ return result <= getInventoryStackLimit() && result <= this.furnaceItemStacks[2].getMaxStackSize(); //Forge BugFix: Make it respect stack sizes properly. + } + } + +@@ -296,7 +299,7 @@ + } + else if (this.furnaceItemStacks[2].getItem() == itemstack.getItem()) + { +- ++this.furnaceItemStacks[2].stackSize; ++ this.furnaceItemStacks[2].stackSize += itemstack.stackSize; // Forge BugFix: Results may have multiple items + } + + if (this.furnaceItemStacks[0].getItem() == Item.getItemFromBlock(Blocks.sponge) && this.furnaceItemStacks[0].getMetadata() == 1 && this.furnaceItemStacks[1] != null && this.furnaceItemStacks[1].getItem() == Items.bucket) +@@ -343,7 +346,15 @@ + } + } + +- return item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD") ? 200 : (item == Items.stick ? 100 : (item == Items.coal ? 1600 : (item == Items.lava_bucket ? 20000 : (item == Item.getItemFromBlock(Blocks.sapling) ? 100 : (item == Items.blaze_rod ? 2400 : 0))))))); ++ if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200; ++ if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200; ++ if (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD")) return 200; ++ if (item == Items.stick) return 100; ++ if (item == Items.coal) return 1600; ++ if (item == Items.lava_bucket) return 20000; ++ if (item == Item.getItemFromBlock(Blocks.sapling)) return 100; ++ if (item == Items.blaze_rod) return 2400; ++ return net.minecraftforge.fml.common.registry.GameRegistry.getFuelValue(p_145952_0_); + } + } + diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch new file mode 100644 index 000000000..51de36d50 --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityNote.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityNote.java +@@ -28,7 +28,9 @@ + + public void changePitch() + { ++ byte old = note; + this.note = (byte)((this.note + 1) % 25); ++ if (!net.minecraftforge.common.ForgeHooks.onNoteChange(this, old)) return; + this.markDirty(); + } + diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch new file mode 100644 index 000000000..396abd4cf --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityPiston.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityPiston.java +@@ -149,7 +149,8 @@ + if (this.worldObj.getBlockState(this.pos).getBlock() == Blocks.piston_extension) + { + this.worldObj.setBlockState(this.pos, this.pistonState, 3); +- this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); ++ if(!net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldObj, pos, worldObj.getBlockState(pos), java.util.EnumSet.noneOf(EnumFacing.class)).isCanceled()) ++ this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); + } + } + } +@@ -167,7 +168,8 @@ + if (this.worldObj.getBlockState(this.pos).getBlock() == Blocks.piston_extension) + { + this.worldObj.setBlockState(this.pos, this.pistonState, 3); +- this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); ++ if(!net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldObj, pos, worldObj.getBlockState(pos), java.util.EnumSet.noneOf(EnumFacing.class)).isCanceled()) ++ this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); + } + } + else diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch new file mode 100644 index 000000000..8ffd40ff6 --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntitySign.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntitySign.java +@@ -63,7 +63,7 @@ + } + public boolean canUseCommand(int permLevel, String commandName) + { +- return true; ++ return permLevel <= 2; //Forge: Fixes MC-75630 - Exploit with signs and command blocks + } + public BlockPos getPosition() + { diff --git a/patches/minecraft/net/minecraft/util/EnumFacing.java.patch b/patches/minecraft/net/minecraft/util/EnumFacing.java.patch new file mode 100644 index 000000000..732263cef --- /dev/null +++ b/patches/minecraft/net/minecraft/util/EnumFacing.java.patch @@ -0,0 +1,67 @@ +--- ../src-base/minecraft/net/minecraft/util/EnumFacing.java ++++ ../src-work/minecraft/net/minecraft/util/EnumFacing.java +@@ -6,8 +6,6 @@ + import java.util.Iterator; + import java.util.Map; + import java.util.Random; +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; + + public enum EnumFacing implements IStringSerializable + { +@@ -61,7 +59,6 @@ + return getFront(this.opposite); + } + +- @SideOnly(Side.CLIENT) + public EnumFacing rotateAround(EnumFacing.Axis axis) + { + switch (axis) +@@ -112,7 +109,6 @@ + } + } + +- @SideOnly(Side.CLIENT) + private EnumFacing rotateX() + { + switch (this) +@@ -132,7 +128,6 @@ + } + } + +- @SideOnly(Side.CLIENT) + private EnumFacing rotateZ() + { + switch (this) +@@ -193,7 +188,6 @@ + return this.axis; + } + +- @SideOnly(Side.CLIENT) + public static EnumFacing byName(String name) + { + return name == null ? null : (EnumFacing)NAME_LOOKUP.get(name.toLowerCase()); +@@ -219,7 +213,6 @@ + return values()[rand.nextInt(values().length)]; + } + +- @SideOnly(Side.CLIENT) + public static EnumFacing getFacingFromVector(float p_176737_0_, float p_176737_1_, float p_176737_2_) + { + EnumFacing enumfacing = NORTH; +@@ -262,7 +255,6 @@ + throw new IllegalArgumentException("No such direction: " + p_181076_0_ + " " + p_181076_1_); + } + +- @SideOnly(Side.CLIENT) + public Vec3i getDirectionVec() + { + return this.directionVec; +@@ -299,7 +291,6 @@ + this.plane = plane; + } + +- @SideOnly(Side.CLIENT) + public static EnumFacing.Axis byName(String name) + { + return name == null ? null : (EnumFacing.Axis)NAME_LOOKUP.get(name.toLowerCase()); diff --git a/patches/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch b/patches/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch new file mode 100644 index 000000000..7bb192c6d --- /dev/null +++ b/patches/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/util/EnumWorldBlockLayer.java ++++ ../src-work/minecraft/net/minecraft/util/EnumWorldBlockLayer.java +@@ -1,9 +1,5 @@ + package net.minecraft.util; + +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; +- +-@SideOnly(Side.CLIENT) + public enum EnumWorldBlockLayer + { + SOLID("Solid"), diff --git a/patches/minecraft/net/minecraft/util/MessageSerializer.java.patch b/patches/minecraft/net/minecraft/util/MessageSerializer.java.patch new file mode 100644 index 000000000..ea204cead --- /dev/null +++ b/patches/minecraft/net/minecraft/util/MessageSerializer.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/util/MessageSerializer.java ++++ ../src-work/minecraft/net/minecraft/util/MessageSerializer.java +@@ -49,7 +49,7 @@ + { + if (p_encode_2_ instanceof S0CPacketSpawnPlayer) + { +- p_encode_2_ = p_encode_2_; ++ //p_encode_2_ = p_encode_2_; FML: Kill warning + } + + p_encode_2_.writePacketData(packetbuffer); diff --git a/patches/minecraft/net/minecraft/util/MouseHelper.java.patch b/patches/minecraft/net/minecraft/util/MouseHelper.java.patch new file mode 100644 index 000000000..a027a060e --- /dev/null +++ b/patches/minecraft/net/minecraft/util/MouseHelper.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/util/MouseHelper.java ++++ ../src-work/minecraft/net/minecraft/util/MouseHelper.java +@@ -14,6 +14,7 @@ + + public void grabMouseCursor() + { ++ if (Boolean.parseBoolean(System.getProperty("fml.noGrab","false"))) return; + Mouse.setGrabbed(true); + this.deltaX = 0; + this.deltaY = 0; diff --git a/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch b/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch new file mode 100644 index 000000000..4dce21e9b --- /dev/null +++ b/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/util/MovingObjectPosition.java ++++ ../src-work/minecraft/net/minecraft/util/MovingObjectPosition.java +@@ -11,6 +11,12 @@ + public Entity entityHit; + private static final String __OBFID = "CL_00000610"; + ++ /** Used to determine what sub-segment is hit */ ++ public int subHit = -1; ++ ++ /** Used to add extra hit info */ ++ public Object hitInfo = null; ++ + public MovingObjectPosition(Vec3 p_i45551_1_, EnumFacing p_i45551_2_, BlockPos p_i45551_3_) + { + this(MovingObjectPosition.MovingObjectType.BLOCK, p_i45551_1_, p_i45551_2_, p_i45551_3_); diff --git a/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch b/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch new file mode 100644 index 000000000..6cb2dd79b --- /dev/null +++ b/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch @@ -0,0 +1,26 @@ +--- ../src-base/minecraft/net/minecraft/util/ResourceLocation.java ++++ ../src-work/minecraft/net/minecraft/util/ResourceLocation.java +@@ -1,7 +1,5 @@ + package net.minecraft.util; + +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; + import org.apache.commons.lang3.Validate; + + public class ResourceLocation +@@ -22,7 +20,6 @@ + this(0, func_177516_a(p_i1293_1_)); + } + +- @SideOnly(Side.CLIENT) + public ResourceLocation(String p_i1292_1_, String p_i1292_2_) + { + this(0, new String[] {p_i1292_1_, p_i1292_2_}); +@@ -51,7 +48,6 @@ + return this.resourcePath; + } + +- @SideOnly(Side.CLIENT) + public String getResourceDomain() + { + return this.resourceDomain; diff --git a/patches/minecraft/net/minecraft/util/Session.java.patch b/patches/minecraft/net/minecraft/util/Session.java.patch new file mode 100644 index 000000000..a294c7fee --- /dev/null +++ b/patches/minecraft/net/minecraft/util/Session.java.patch @@ -0,0 +1,47 @@ +--- ../src-base/minecraft/net/minecraft/util/Session.java ++++ ../src-work/minecraft/net/minecraft/util/Session.java +@@ -16,9 +16,24 @@ + private final String token; + private final Session.Type sessionType; + private static final String __OBFID = "CL_00000659"; ++ /** Forge: Cache of the local session's GameProfile properties. */ ++ private com.mojang.authlib.properties.PropertyMap properties; + + public Session(String usernameIn, String playerIDIn, String tokenIn, String sessionTypeIn) + { ++ if (usernameIn == null || usernameIn.isEmpty()) ++ { ++ usernameIn = "MissingName"; ++ playerIDIn = tokenIn = "NotValid"; ++ System.out.println("========================================================="); ++ System.out.println("Warning the username was not set for this session, typically"); ++ System.out.println("this means you installed Forge incorrectly. We have set your"); ++ System.out.println("name to \"MissingName\" and your session to nothing. Please"); ++ System.out.println("check your instllation and post a console log from the launcher"); ++ System.out.println("when asking for help!"); ++ System.out.println("========================================================="); ++ } ++ + this.username = usernameIn; + this.playerID = playerIDIn; + this.token = tokenIn; +@@ -63,6 +78,19 @@ + return this.sessionType; + } + ++ /* ======================================== FORGE START ===================================== */ ++ //For internal use only. Modders should never need to use this. ++ public void setProperties(com.mojang.authlib.properties.PropertyMap properties) ++ { ++ if(this.properties == null) this.properties = properties; ++ } ++ ++ public boolean hasCachedProperties() ++ { ++ return properties != null; ++ } ++ /* ========================================= FORGE END ====================================== */ ++ + @SideOnly(Side.CLIENT) + public static enum Type + { diff --git a/patches/minecraft/net/minecraft/util/Vec3.java.patch b/patches/minecraft/net/minecraft/util/Vec3.java.patch new file mode 100644 index 000000000..cd1142a15 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/Vec3.java.patch @@ -0,0 +1,27 @@ +--- ../src-base/minecraft/net/minecraft/util/Vec3.java ++++ ../src-work/minecraft/net/minecraft/util/Vec3.java +@@ -1,8 +1,5 @@ + package net.minecraft.util; + +-import net.minecraftforge.fml.relauncher.Side; +-import net.minecraftforge.fml.relauncher.SideOnly; +- + public class Vec3 + { + public final double xCoord; +@@ -37,7 +34,6 @@ + this((double)p_i46377_1_.getX(), (double)p_i46377_1_.getY(), (double)p_i46377_1_.getZ()); + } + +- @SideOnly(Side.CLIENT) + public Vec3 subtractReverse(Vec3 vec) + { + return new Vec3(vec.xCoord - this.xCoord, vec.yCoord - this.yCoord, vec.zCoord - this.zCoord); +@@ -54,7 +50,6 @@ + return this.xCoord * vec.xCoord + this.yCoord * vec.yCoord + this.zCoord * vec.zCoord; + } + +- @SideOnly(Side.CLIENT) + public Vec3 crossProduct(Vec3 vec) + { + return new Vec3(this.yCoord * vec.zCoord - this.zCoord * vec.yCoord, this.zCoord * vec.xCoord - this.xCoord * vec.zCoord, this.xCoord * vec.yCoord - this.yCoord * vec.xCoord); diff --git a/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch b/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch new file mode 100644 index 000000000..2c0234944 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/util/WeightedRandomChestContent.java ++++ ../src-work/minecraft/net/minecraft/util/WeightedRandomChestContent.java +@@ -57,6 +57,19 @@ + } + } + ++ // -- Forge hooks ++ /** ++ * Allow a mod to submit a custom implementation that can delegate item stack generation beyond simple stack lookup ++ * ++ * @param random The current random for generation ++ * @param newInventory The inventory being generated (do not populate it, but you can refer to it) ++ * @return An array of {@link ItemStack} to put into the chest ++ */ ++ protected ItemStack[] generateChestContent(Random random, IInventory newInventory) ++ { ++ return net.minecraftforge.common.ChestGenHooks.generateStacks(random, theItemId, theMinimumChanceToGenerateItem, theMaximumChanceToGenerateItem); ++ } ++ + public static void generateDispenserContents(Random random, List p_177631_1_, TileEntityDispenser dispenser, int p_177631_3_) + { + for (int i = 0; i < p_177631_3_; ++i) diff --git a/patches/minecraft/net/minecraft/world/ChunkCache.java.patch b/patches/minecraft/net/minecraft/world/ChunkCache.java.patch new file mode 100644 index 000000000..88dced0fd --- /dev/null +++ b/patches/minecraft/net/minecraft/world/ChunkCache.java.patch @@ -0,0 +1,61 @@ +--- ../src-base/minecraft/net/minecraft/world/ChunkCache.java ++++ ../src-work/minecraft/net/minecraft/world/ChunkCache.java +@@ -62,6 +62,8 @@ + { + int i = (pos.getX() >> 4) - this.chunkX; + int j = (pos.getZ() >> 4) - this.chunkZ; ++ if (i < 0 || i >= chunkArray.length || j < 0 || j >= chunkArray[i].length) return null; ++ if (chunkArray[i][j] == null) return null; + return this.chunkArray[i][j].getTileEntity(pos, Chunk.EnumCreateEntityType.IMMEDIATE); + } + +@@ -85,6 +87,7 @@ + { + int i = (pos.getX() >> 4) - this.chunkX; + int j = (pos.getZ() >> 4) - this.chunkZ; ++ if (i < 0 || i >= chunkArray.length || j < 0 || i >= chunkArray[i].length) return Blocks.air.getDefaultState(); + + if (i >= 0 && i < this.chunkArray.length && j >= 0 && j < this.chunkArray[i].length) + { +@@ -140,6 +143,8 @@ + { + int i = (pos.getX() >> 4) - this.chunkX; + int j = (pos.getZ() >> 4) - this.chunkZ; ++ if (i < 0 || i >= chunkArray.length || j < 0 || j >= chunkArray[i].length) return p_175629_1_.defaultLightValue; ++ if (chunkArray[i][j] == null) return p_175629_1_.defaultLightValue; + return this.chunkArray[i][j].getLightFor(p_175629_1_, pos); + } + } +@@ -151,7 +156,7 @@ + + public boolean isAirBlock(BlockPos pos) + { +- return this.getBlockState(pos).getBlock().getMaterial() == Material.air; ++ return this.getBlockState(pos).getBlock().isAir(this, pos); + } + + @SideOnly(Side.CLIENT) +@@ -161,6 +166,7 @@ + { + int i = (pos.getX() >> 4) - this.chunkX; + int j = (pos.getZ() >> 4) - this.chunkZ; ++ if (i < 0 || i >= chunkArray.length || j < 0 || i >= chunkArray[i].length) return p_175628_1_.defaultLightValue; + return this.chunkArray[i][j].getLightFor(p_175628_1_, pos); + } + else +@@ -180,4 +186,15 @@ + { + return this.worldObj.getWorldType(); + } ++ ++ @Override ++ public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) ++ { ++ int x = (pos.getX() >> 4) - this.chunkX; ++ int z = (pos.getZ() >> 4) - this.chunkZ; ++ if (pos.getY() >= 0 && pos.getY() < 256) return _default; ++ if (x < 0 || x >= chunkArray.length || z < 0 || x >= chunkArray[x].length) return _default; ++ ++ return getBlockState(pos).getBlock().isSideSolid(this, pos, side); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/Explosion.java.patch b/patches/minecraft/net/minecraft/world/Explosion.java.patch new file mode 100644 index 000000000..609186749 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/Explosion.java.patch @@ -0,0 +1,44 @@ +--- ../src-base/minecraft/net/minecraft/world/Explosion.java ++++ ../src-work/minecraft/net/minecraft/world/Explosion.java +@@ -39,6 +39,7 @@ + private final List affectedBlockPositions; + private final Map field_77288_k; + private static final String __OBFID = "CL_00000134"; ++ private final Vec3 position; + + @SideOnly(Side.CLIENT) + public Explosion(World worldIn, Entity p_i45752_2_, double p_i45752_3_, double p_i45752_5_, double p_i45752_7_, float p_i45752_9_, List p_i45752_10_) +@@ -66,6 +67,7 @@ + this.explosionZ = p_i45754_7_; + this.isFlaming = p_i45754_10_; + this.isSmoking = p_i45754_11_; ++ this.position = new Vec3(explosionX, explosionY, explosionZ); + } + + public void doExplosionA() +@@ -100,7 +102,7 @@ + + if (iblockstate.getBlock().getMaterial() != Material.air) + { +- float f2 = this.exploder != null ? this.exploder.getExplosionResistance(this, this.worldObj, blockpos, iblockstate) : iblockstate.getBlock().getExplosionResistance((Entity)null); ++ float f2 = this.exploder != null ? this.exploder.getExplosionResistance(this, this.worldObj, blockpos, iblockstate) : iblockstate.getBlock().getExplosionResistance(worldObj, blockpos, (Entity)null, this); + f -= (f2 + 0.3F) * 0.3F; + } + +@@ -214,8 +216,7 @@ + block.dropBlockAsItemWithChance(this.worldObj, blockpos, this.worldObj.getBlockState(blockpos), 1.0F / this.explosionSize, 0); + } + +- this.worldObj.setBlockState(blockpos, Blocks.air.getDefaultState(), 3); +- block.onBlockDestroyedByExplosion(this.worldObj, blockpos, this); ++ block.onBlockExploded(this.worldObj, blockpos, this); + } + } + } +@@ -251,4 +252,6 @@ + { + return this.affectedBlockPositions; + } ++ ++ public Vec3 getPosition(){ return this.position; } + } diff --git a/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch b/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch new file mode 100644 index 000000000..7fb64f305 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/world/IBlockAccess.java ++++ ../src-work/minecraft/net/minecraft/world/IBlockAccess.java +@@ -29,4 +29,14 @@ + + @SideOnly(Side.CLIENT) + WorldType getWorldType(); ++ ++ /** ++ * FORGE: isSideSolid, pulled up from {@link World} ++ * ++ * @param pos Position ++ * @param side Side ++ * @param _default default return value ++ * @return if the block is solid on the side ++ */ ++ boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default); + } diff --git a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch new file mode 100644 index 000000000..5b12536d9 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch @@ -0,0 +1,367 @@ +--- ../src-base/minecraft/net/minecraft/world/WorldProvider.java ++++ ../src-work/minecraft/net/minecraft/world/WorldProvider.java +@@ -52,26 +52,12 @@ + + protected void registerWorldChunkManager() + { +- WorldType worldtype = this.worldObj.getWorldInfo().getTerrainType(); +- +- if (worldtype == WorldType.FLAT) +- { +- FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.createFlatGeneratorFromString(this.worldObj.getWorldInfo().getGeneratorOptions()); +- this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), BiomeGenBase.field_180279_ad), 0.5F); +- } +- else if (worldtype == WorldType.DEBUG_WORLD) +- { +- this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.plains, 0.0F); +- } +- else +- { +- this.worldChunkMgr = new WorldChunkManager(this.worldObj); +- } ++ this.worldChunkMgr = terrainType.getChunkManager(worldObj); + } + + public IChunkProvider createChunkGenerator() + { +- return (IChunkProvider)(this.terrainType == WorldType.FLAT ? new ChunkProviderFlat(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : (this.terrainType == WorldType.DEBUG_WORLD ? new ChunkProviderDebug(this.worldObj) : (this.terrainType == WorldType.CUSTOMIZED ? new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings)))); ++ return terrainType.getChunkGenerator(worldObj, generatorSettings); + } + + public boolean canCoordinateBeSpawn(int x, int z) +@@ -154,13 +140,13 @@ + + public static WorldProvider getProviderForDimension(int dimension) + { +- return (WorldProvider)(dimension == -1 ? new WorldProviderHell() : (dimension == 0 ? new WorldProviderSurface() : (dimension == 1 ? new WorldProviderEnd() : null))); ++ return net.minecraftforge.common.DimensionManager.createProviderFor(dimension); + } + + @SideOnly(Side.CLIENT) + public float getCloudHeight() + { +- return 128.0F; ++ return this.terrainType.getCloudHeight(); + } + + @SideOnly(Side.CLIENT) +@@ -224,4 +210,319 @@ + { + return new WorldBorder(); + } ++ ++ /*======================================= Forge Start =========================================*/ ++ private net.minecraftforge.client.IRenderHandler skyRenderer = null; ++ private net.minecraftforge.client.IRenderHandler cloudRenderer = null; ++ private net.minecraftforge.client.IRenderHandler weatherRenderer = null; ++ ++ /** ++ * Sets the providers current dimension ID, used in default getSaveFolder() ++ * Added to allow default providers to be registered for multiple dimensions. ++ * ++ * @param dim Dimension ID ++ */ ++ public void setDimension(int dim) ++ { ++ this.dimensionId = dim; ++ } ++ ++ /** ++ * Returns the sub-folder of the world folder that this WorldProvider saves to. ++ * EXA: DIM1, DIM-1 ++ * @return The sub-folder name to save this world's chunks to. ++ */ ++ public String getSaveFolder() ++ { ++ return (dimensionId == 0 ? null : "DIM" + dimensionId); ++ } ++ ++ /** ++ * A message to display to the user when they transfer to this dimension. ++ * ++ * @return The message to be displayed ++ */ ++ public String getWelcomeMessage() ++ { ++ if (this instanceof WorldProviderEnd) ++ { ++ return "Entering the End"; ++ } ++ else if (this instanceof WorldProviderHell) ++ { ++ return "Entering the Nether"; ++ } ++ return null; ++ } ++ ++ /** ++ * A Message to display to the user when they transfer out of this dismension. ++ * ++ * @return The message to be displayed ++ */ ++ public String getDepartMessage() ++ { ++ if (this instanceof WorldProviderEnd) ++ { ++ return "Leaving the End"; ++ } ++ else if (this instanceof WorldProviderHell) ++ { ++ return "Leaving the Nether"; ++ } ++ return null; ++ } ++ ++ /** ++ * The dimensions movement factor. Relative to normal overworld. ++ * It is applied to the players position when they transfer dimensions. ++ * Exa: Nether movement is 8.0 ++ * @return The movement factor ++ */ ++ public double getMovementFactor() ++ { ++ if (this instanceof WorldProviderHell) ++ { ++ return 8.0; ++ } ++ return 1.0; ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public net.minecraftforge.client.IRenderHandler getSkyRenderer() ++ { ++ return this.skyRenderer; ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public void setSkyRenderer(net.minecraftforge.client.IRenderHandler skyRenderer) ++ { ++ this.skyRenderer = skyRenderer; ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public net.minecraftforge.client.IRenderHandler getCloudRenderer() ++ { ++ return cloudRenderer; ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public void setCloudRenderer(net.minecraftforge.client.IRenderHandler renderer) ++ { ++ cloudRenderer = renderer; ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public net.minecraftforge.client.IRenderHandler getWeatherRenderer() ++ { ++ return weatherRenderer; ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public void setWeatherRenderer(net.minecraftforge.client.IRenderHandler renderer) ++ { ++ weatherRenderer = renderer; ++ } ++ ++ public BlockPos getRandomizedSpawnPoint() ++ { ++ BlockPos ret = this.worldObj.getSpawnPoint(); ++ ++ boolean isAdventure = worldObj.getWorldInfo().getGameType() == WorldSettings.GameType.ADVENTURE; ++ int spawnFuzz = terrainType.getSpawnFuzz(); ++ int border = MathHelper.floor_double(worldObj.getWorldBorder().getClosestDistance(ret.getX(), ret.getZ())); ++ if (border < spawnFuzz) spawnFuzz = border; ++ if (spawnFuzz < 1) spawnFuzz = 1; ++ int spawnFuzzHalf = spawnFuzz / 2; ++ ++ if (!getHasNoSky() && !isAdventure) ++ { ++ ret = worldObj.getTopSolidOrLiquidBlock(ret.add(worldObj.rand.nextInt(spawnFuzzHalf) - spawnFuzz, 0, worldObj.rand.nextInt(spawnFuzzHalf) - spawnFuzz)); ++ } ++ ++ return ret; ++ } ++ /** ++ * Determine if the cursor on the map should 'spin' when rendered, like it does for the player in the nether. ++ * ++ * @param entity The entity holding the map, playername, or frame-ENTITYID ++ * @param x X Position ++ * @param y Y Position ++ * @param z Z Position ++ * @return True to 'spin' the cursor ++ */ ++ public boolean shouldMapSpin(String entity, double x, double y, double z) ++ { ++ return dimensionId < 0; ++ } ++ ++ /** ++ * Determines the dimension the player will be respawned in, typically this brings them back to the overworld. ++ * ++ * @param player The player that is respawning ++ * @return The dimension to respawn the player in ++ */ ++ public int getRespawnDimension(net.minecraft.entity.player.EntityPlayerMP player) ++ { ++ return 0; ++ } ++ ++ /*======================================= Start Moved From World =========================================*/ ++ ++ public BiomeGenBase getBiomeGenForCoords(BlockPos pos) ++ { ++ return worldObj.getBiomeGenForCoordsBody(pos); ++ } ++ ++ public boolean isDaytime() ++ { ++ return worldObj.getSkylightSubtracted() < 4; ++ } ++ ++ /** ++ * The current sun brightness factor for this dimension. ++ * 0.0f means no light at all, and 1.0f means maximum sunlight. ++ * This will be used for the "calculateSkylightSubtracted" ++ * which is for Sky light value calculation. ++ * ++ * @return The current brightness factor ++ * */ ++ public float getSunBrightnessFactor(float par1) ++ { ++ return worldObj.getSunBrightnessFactor(par1); ++ } ++ ++ /** ++ * Calculates the current moon phase factor. ++ * This factor is effective for slimes. ++ * (This method do not affect the moon rendering) ++ * */ ++ public float getCurrentMoonPhaseFactor() ++ { ++ return worldObj.getCurrentMoonPhaseFactorBody(); ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public Vec3 getSkyColor(net.minecraft.entity.Entity cameraEntity, float partialTicks) ++ { ++ return worldObj.getSkyColorBody(cameraEntity, partialTicks); ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public Vec3 drawClouds(float partialTicks) ++ { ++ return worldObj.drawCloudsBody(partialTicks); ++ } ++ ++ /** ++ * Gets the Sun Brightness for rendering sky. ++ * */ ++ @SideOnly(Side.CLIENT) ++ public float getSunBrightness(float par1) ++ { ++ return worldObj.getSunBrightnessBody(par1); ++ } ++ ++ /** ++ * Gets the Star Brightness for rendering sky. ++ * */ ++ @SideOnly(Side.CLIENT) ++ public float getStarBrightness(float par1) ++ { ++ return worldObj.getStarBrightnessBody(par1); ++ } ++ ++ public void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful) ++ { ++ worldObj.spawnHostileMobs = allowHostile; ++ worldObj.spawnPeacefulMobs = allowPeaceful; ++ } ++ ++ public void calculateInitialWeather() ++ { ++ worldObj.calculateInitialWeatherBody(); ++ } ++ ++ public void updateWeather() ++ { ++ worldObj.updateWeatherBody(); ++ } ++ ++ public boolean canBlockFreeze(BlockPos pos, boolean byWater) ++ { ++ return worldObj.canBlockFreezeBody(pos, byWater); ++ } ++ ++ public boolean canSnowAt(BlockPos pos, boolean checkLight) ++ { ++ return worldObj.canSnowAtBody(pos, checkLight); ++ } ++ public void setWorldTime(long time) ++ { ++ worldObj.worldInfo.setWorldTime(time); ++ } ++ ++ public long getSeed() ++ { ++ return worldObj.worldInfo.getSeed(); ++ } ++ ++ public long getWorldTime() ++ { ++ return worldObj.worldInfo.getWorldTime(); ++ } ++ ++ public BlockPos getSpawnPoint() ++ { ++ net.minecraft.world.storage.WorldInfo info = worldObj.worldInfo; ++ return new BlockPos(info.getSpawnX(), info.getSpawnY(), info.getSpawnZ()); ++ } ++ ++ public void setSpawnPoint(BlockPos pos) ++ { ++ worldObj.worldInfo.setSpawn(pos); ++ } ++ ++ public boolean canMineBlock(net.minecraft.entity.player.EntityPlayer player, BlockPos pos) ++ { ++ return worldObj.canMineBlockBody(player, pos); ++ } ++ ++ public boolean isBlockHighHumidity(BlockPos pos) ++ { ++ return worldObj.getBiomeGenForCoords(pos).isHighHumidity(); ++ } ++ ++ public int getHeight() ++ { ++ return 256; ++ } ++ ++ public int getActualHeight() ++ { ++ return hasNoSky ? 128 : 256; ++ } ++ ++ public double getHorizon() ++ { ++ return worldObj.worldInfo.getTerrainType().getHorizon(worldObj); ++ } ++ ++ public void resetRainAndThunder() ++ { ++ worldObj.worldInfo.setRainTime(0); ++ worldObj.worldInfo.setRaining(false); ++ worldObj.worldInfo.setThunderTime(0); ++ worldObj.worldInfo.setThundering(false); ++ } ++ ++ public boolean canDoLightning(net.minecraft.world.chunk.Chunk chunk) ++ { ++ return true; ++ } ++ ++ public boolean canDoRainSnowIce(net.minecraft.world.chunk.Chunk chunk) ++ { ++ return true; ++ } + } diff --git a/patches/minecraft/net/minecraft/world/WorldServer.java.patch b/patches/minecraft/net/minecraft/world/WorldServer.java.patch new file mode 100644 index 000000000..b78fe34d8 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/WorldServer.java.patch @@ -0,0 +1,173 @@ +--- ../src-base/minecraft/net/minecraft/world/WorldServer.java ++++ ../src-work/minecraft/net/minecraft/world/WorldServer.java +@@ -95,30 +95,46 @@ + private List pendingTickListEntriesThisTick = Lists.newArrayList(); + private static final String __OBFID = "CL_00001437"; + ++ /** Stores the recently processed (lighting) chunks */ ++ protected Set doneChunks = new java.util.HashSet(); ++ public List customTeleporters = new ArrayList(); ++ private static boolean initChest = false; ++ public static void fillChestHook() ++ { ++ if (!initChest) ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.BONUS_CHEST, bonusChestContent, 10, 10); ++ initChest = true; ++ } ++ + public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn) + { + super(saveHandlerIn, info, WorldProvider.getProviderForDimension(dimensionId), profilerIn, false); + this.mcServer = server; + this.theEntityTracker = new EntityTracker(this); + this.thePlayerManager = new PlayerManager(this); ++ // Guarantee the dimension ID was not reset by the provider ++ int providerDim = this.provider.dimensionId; + this.provider.registerWorld(this); ++ this.provider.dimensionId = providerDim; + this.chunkProvider = this.createChunkProvider(); ++ perWorldStorage = new MapStorage(new net.minecraftforge.common.WorldSpecificSaveHandler((WorldServer)this, saveHandlerIn)); + this.worldTeleporter = new Teleporter(this); + this.calculateInitialSkylight(); + this.calculateInitialWeather(); + this.getWorldBorder().setSize(server.getMaxWorldSize()); ++ net.minecraftforge.common.DimensionManager.setWorld(dimensionId, this); + } + + public World init() + { + this.mapStorage = new MapStorage(this.saveHandler); + String s = VillageCollection.fileNameForProvider(this.provider); +- VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s); ++ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.loadData(VillageCollection.class, s); + + if (villagecollection == null) + { + this.villageCollectionObj = new VillageCollection(this); +- this.mapStorage.setData(s, this.villageCollectionObj); ++ this.perWorldStorage.setData(s, this.villageCollectionObj); + } + else + { +@@ -211,6 +227,10 @@ + this.villageSiege.tick(); + this.theProfiler.endStartSection("portalForcer"); + this.worldTeleporter.removeStalePortalLocations(this.getTotalWorldTime()); ++ for (Teleporter tele : customTeleporters) ++ { ++ tele.removeStalePortalLocations(getTotalWorldTime()); ++ } + this.theProfiler.endSection(); + this.sendQueuedBlockEvents(); + } +@@ -269,10 +289,7 @@ + + private void resetRainAndThunder() + { +- this.worldInfo.setRainTime(0); +- this.worldInfo.setRaining(false); +- this.worldInfo.setThunderTime(0); +- this.worldInfo.setThundering(false); ++ this.provider.resetRainAndThunder(); + } + + public boolean areAllPlayersAsleep() +@@ -350,7 +367,7 @@ + chunk.func_150804_b(false); + this.theProfiler.endStartSection("thunder"); + +- if (this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) ++ if (this.provider.canDoLightning(chunk) && this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) + { + this.updateLCG = this.updateLCG * 3 + 1013904223; + int i1 = this.updateLCG >> 2; +@@ -364,7 +381,7 @@ + + this.theProfiler.endStartSection("iceandsnow"); + +- if (this.rand.nextInt(16) == 0) ++ if (this.provider.canDoRainSnowIce(chunk) && this.rand.nextInt(16) == 0) + { + this.updateLCG = this.updateLCG * 3 + 1013904223; + int k2 = this.updateLCG >> 2; +@@ -510,7 +527,7 @@ + + public void updateEntities() + { +- if (this.playerEntities.isEmpty()) ++ if (this.playerEntities.isEmpty() && getPersistentChunks().isEmpty()) + { + if (this.updateEntityTick++ >= 1200) + { +@@ -714,6 +731,10 @@ + + public boolean isBlockModifiable(EntityPlayer player, BlockPos pos) + { ++ return super.isBlockModifiable(player, pos); ++ } ++ public boolean canMineBlockBody(EntityPlayer player, BlockPos pos) ++ { + return !this.mcServer.isBlockProtected(this, pos, player) && this.getWorldBorder().contains(pos); + } + +@@ -779,6 +800,7 @@ + } + else + { ++ if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(this, p_73052_1_)) return; + this.findingSpawnPoint = true; + WorldChunkManager worldchunkmanager = this.provider.getWorldChunkManager(); + List list = worldchunkmanager.getBiomesToSpawnIn(); +@@ -824,7 +846,7 @@ + + protected void createBonusChest() + { +- WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(bonusChestContent, 10); ++ WorldGeneratorBonusChest worldgeneratorbonuschest = net.minecraftforge.common.ForgeHooks.getBonusChest(rand); + + for (int i = 0; i < 10; ++i) + { +@@ -894,6 +916,7 @@ + this.worldInfo.setBorderLerpTime(this.getWorldBorder().getTimeUntilTarget()); + this.saveHandler.saveWorldInfoWithPlayer(this.worldInfo, this.mcServer.getConfigurationManager().getHostPlayerData()); + this.mapStorage.saveAllData(); ++ this.perWorldStorage.saveAllData(); + } + + public void onEntityAdded(Entity p_72923_1_) +@@ -949,6 +972,7 @@ + public Explosion newExplosion(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) + { + Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_); ++ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; + explosion.doExplosionA(); + explosion.doExplosionB(false); + +@@ -1028,19 +1052,23 @@ + this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.getDimensionId()); + } + ++ /* 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.isRaining()) + { + if (flag) + { +- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(2, 0.0F)); ++ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(2, 0.0F), this.provider.dimensionId); + } + else + { +- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(1, 0.0F)); ++ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(1, 0.0F), this.provider.dimensionId); + } + +- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(7, this.rainingStrength)); +- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(8, this.thunderingStrength)); ++ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId); ++ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId); + } + } + diff --git a/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch b/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch new file mode 100644 index 000000000..7bc173344 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/world/WorldServerMulti.java ++++ ../src-work/minecraft/net/minecraft/world/WorldServerMulti.java +@@ -11,13 +11,14 @@ + public class WorldServerMulti extends WorldServer + { + private WorldServer delegate; ++ private IBorderListener borderListener; + private static final String __OBFID = "CL_00001430"; + + public WorldServerMulti(MinecraftServer server, ISaveHandler saveHandlerIn, int dimensionId, WorldServer delegate, Profiler profilerIn) + { + super(server, saveHandlerIn, new DerivedWorldInfo(delegate.getWorldInfo()), dimensionId, profilerIn); + this.delegate = delegate; +- delegate.getWorldBorder().addListener(new IBorderListener() ++ this.borderListener = new IBorderListener() + { + private static final String __OBFID = "CL_00002273"; + public void onSizeChanged(WorldBorder border, double newSize) +@@ -75,4 +76,12 @@ + + return this; + } ++ ++ ++ @Override ++ public void flush() ++ { ++ super.flush(); ++ this.delegate.getWorldBorder().removeListener(this.borderListener); // Unlink ourselves, to prevent world leak. ++ } + } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch new file mode 100644 index 000000000..e76667c78 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeColorHelper.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeColorHelper.java +@@ -29,7 +29,7 @@ + private static final String __OBFID = "CL_00002146"; + public int getColorAtPos(BiomeGenBase p_180283_1_, BlockPos blockPosition) + { +- return p_180283_1_.waterColorMultiplier; ++ return p_180283_1_.getWaterColorMultiplier(); + } + }; + private static final String __OBFID = "CL_00002149"; diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch new file mode 100644 index 000000000..663692f46 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch @@ -0,0 +1,23 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenForest.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenForest.java +@@ -204,4 +204,20 @@ + }; + } + } ++ ++ @Override ++ public void addDefaultFlowers() ++ { ++ if (field_150632_aF != 1) ++ { ++ super.addDefaultFlowers(); ++ return; ++ } ++ for (BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) ++ { ++ if (type.getBlockType() == BlockFlower.EnumFlowerColor.YELLOW) continue; ++ if (type == BlockFlower.EnumFlowerType.BLUE_ORCHID) type = BlockFlower.EnumFlowerType.POPPY; ++ addFlower(net.minecraft.init.Blocks.red_flower.getDefaultState().withProperty(net.minecraft.init.Blocks.red_flower.getTypeProperty(), type), 10); ++ } ++ } + } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch new file mode 100644 index 000000000..69830eb5b --- /dev/null +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenHills.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenHills.java +@@ -50,7 +50,7 @@ + int i1 = p_180624_2_.nextInt(16); + BlockPos blockpos = p_180624_3_.add(k, l, i1); + +- if (worldIn.getBlockState(blockpos).getBlock() == Blocks.stone) ++ if (worldIn.getBlockState(blockpos).getBlock().isReplaceableOreGen(worldIn, blockpos, net.minecraft.block.state.pattern.BlockHelper.forBlock(Blocks.stone))) + { + worldIn.setBlockState(blockpos, Blocks.emerald_ore.getDefaultState(), 2); + } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch new file mode 100644 index 000000000..8bda59fbb --- /dev/null +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenJungle.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenJungle.java +@@ -69,7 +69,9 @@ + super.decorate(worldIn, p_180624_2_, p_180624_3_); + int i = p_180624_2_.nextInt(16) + 8; + int j = p_180624_2_.nextInt(16) + 8; +- int k = p_180624_2_.nextInt(worldIn.getHorizon(p_180624_3_.add(i, 0, j)).getY() * 2); ++ int height = worldIn.getHorizon(p_180624_3_.add(i, 0, j)).getY() * 2; // could == 0, which crashes nextInt ++ if (height < 1) height = 1; ++ int k = p_180624_2_.nextInt(height); + (new WorldGenMelon()).generate(worldIn, p_180624_2_, p_180624_3_.add(i, k, j)); + WorldGenVines worldgenvines = new WorldGenVines(); + diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch new file mode 100644 index 000000000..08d52f9bf --- /dev/null +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenPlains.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenPlains.java +@@ -104,4 +104,19 @@ + biomegenplains.field_150609_ah = 14273354; + return biomegenplains; + } ++ ++ @Override ++ public void addDefaultFlowers() ++ { ++ BlockFlower red = net.minecraft.init.Blocks.red_flower; ++ BlockFlower yel = net.minecraft.init.Blocks.yellow_flower; ++ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.ORANGE_TULIP), 3); ++ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.RED_TULIP), 3); ++ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.PINK_TULIP), 3); ++ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.WHITE_TULIP), 3); ++ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.POPPY), 20); ++ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.HOUSTONIA), 20); ++ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.OXEYE_DAISY), 20); ++ addFlower(yel.getDefaultState().withProperty(yel.getTypeProperty(), BlockFlower.EnumFlowerType.DANDELION), 30); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch new file mode 100644 index 000000000..c4cea2dc1 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java +@@ -86,4 +86,10 @@ + { + return 6975545; + } ++ ++ @Override ++ public void addDefaultFlowers() ++ { ++ addFlower(Blocks.red_flower.getDefaultState().withProperty(Blocks.red_flower.getTypeProperty(), BlockFlower.EnumFlowerType.BLUE_ORCHID), 10); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch b/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch new file mode 100644 index 000000000..7e8a99b80 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/world/border/WorldBorder.java ++++ ../src-work/minecraft/net/minecraft/world/border/WorldBorder.java +@@ -278,4 +278,9 @@ + iborderlistener.onWarningDistanceChanged(this, warningDistance); + } + } ++ ++ public void removeListener(IBorderListener listener) ++ { ++ this.listeners.remove(listener); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch new file mode 100644 index 000000000..be3f87839 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch @@ -0,0 +1,23 @@ +--- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java ++++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java +@@ -22,18 +22,12 @@ + { + File file1 = this.getWorldDirectory(); + +- if (provider instanceof WorldProviderHell) ++ if (provider.getSaveFolder() != null) + { +- File file3 = new File(file1, "DIM-1"); ++ File file3 = new File(file1, provider.getSaveFolder()); + file3.mkdirs(); + return new AnvilChunkLoader(file3); + } +- else if (provider instanceof WorldProviderEnd) +- { +- File file2 = new File(file1, "DIM1"); +- file2.mkdirs(); +- return new AnvilChunkLoader(file2); +- } + else + { + return new AnvilChunkLoader(file1); diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch new file mode 100644 index 000000000..706046539 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch @@ -0,0 +1,42 @@ +--- ../src-base/minecraft/net/minecraft/world/chunk/storage/RegionFile.java ++++ ../src-work/minecraft/net/minecraft/world/chunk/storage/RegionFile.java +@@ -102,6 +102,39 @@ + } + } + ++ // This is a copy (sort of) of the method below it, make sure they stay in sync ++ public synchronized boolean chunkExists(int x, int z) ++ { ++ if (this.outOfBounds(x, z)) return false; ++ ++ try ++ { ++ int offset = this.getOffset(x, z); ++ ++ if (offset == 0) return false; ++ ++ int sectorNumber = offset >> 8; ++ int numSectors = offset & 255; ++ ++ if (sectorNumber + numSectors > this.sectorFree.size()) return false; ++ ++ this.dataFile.seek((long)(sectorNumber * 4096)); ++ int length = this.dataFile.readInt(); ++ ++ if (length > 4096 * numSectors || length <= 0) return false; ++ ++ byte version = this.dataFile.readByte(); ++ ++ if (version == 1 || version == 2) return true; ++ } ++ catch (IOException ioexception) ++ { ++ return false; ++ } ++ ++ return false; ++ } ++ + public synchronized DataInputStream getChunkDataInputStream(int x, int z) + { + if (this.outOfBounds(x, z)) diff --git a/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch b/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch new file mode 100644 index 000000000..8671a0f11 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch @@ -0,0 +1,80 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/MapGenRavine.java ++++ ../src-work/minecraft/net/minecraft/world/gen/MapGenRavine.java +@@ -129,7 +129,7 @@ + { + IBlockState iblockstate = p_180707_5_.getBlockState(j1, l1, k1); + +- if (iblockstate.getBlock() == Blocks.flowing_water || iblockstate.getBlock() == Blocks.water) ++ if (isOceanBlock(p_180707_5_, k2, i2, l2, p_180707_3_, p_180707_4_)) + { + flag2 = true; + } +@@ -222,4 +222,68 @@ + } + } + } ++ protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) ++ { ++ net.minecraft.block.Block block = data.getBlockState(x, y, z).getBlock(); ++ return block== Blocks.flowing_water || block == Blocks.water; ++ } ++ ++ //Exception biomes to make sure we generate like vanilla ++ private boolean isExceptionBiome(net.minecraft.world.biome.BiomeGenBase biome) ++ { ++ if (biome == net.minecraft.world.biome.BiomeGenBase.beach) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.desert) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.mushroomIsland) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.mushroomIslandShore) return true; ++ return false; ++ } ++ ++ //Determine if the block at the specified location is the top block for the biome, we take into account ++ //Vanilla bugs to make sure that we generate the map the same way vanilla does. ++ private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) ++ { ++ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); ++ IBlockState state = data.getBlockState(x, y, z); ++ return (isExceptionBiome(biome) ? state.getBlock() == Blocks.grass : state.getBlock() == biome.topBlock); ++ } ++ ++ /** ++ * Digs out the current block, default implementation removes stone, filler, and top block ++ * Sets the block to lava if y is less then 10, and air other wise. ++ * If setting to air, it also checks to see if we've broken the surface and if so ++ * tries to make the floor the biome's top block ++ * ++ * @param data Block data array ++ * @param index Pre-calculated index into block data ++ * @param x local X position ++ * @param y local Y position ++ * @param z local Z position ++ * @param chunkX Chunk X position ++ * @param chunkZ Chunk Y position ++ * @param foundTop True if we've encountered the biome's top block. Ideally if we've broken the surface. ++ */ ++ protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop) ++ { ++ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); ++ IBlockState state = data.getBlockState(x, y, z); ++ IBlockState top = isExceptionBiome(biome) ? Blocks.grass.getDefaultState() : biome.topBlock; ++ IBlockState filler = isExceptionBiome(biome) ? Blocks.dirt.getDefaultState() : biome.fillerBlock; ++ ++ if (state.getBlock() == Blocks.stone || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock()) ++ { ++ if (y < 10) ++ { ++ data.setBlockState(x, y, z, Blocks.lava.getDefaultState()); ++ } ++ else ++ { ++ data.setBlockState(x, y, z, Blocks.air.getDefaultState()); ++ ++ if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock()) ++ { ++ data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState()); ++ } ++ } ++ } ++ } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch new file mode 100644 index 000000000..c17ab4e67 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java +@@ -33,4 +33,10 @@ + this.func_175903_a(worldIn, p_175921_2_, Blocks.dirt.getDefaultState()); + } + } ++ ++ public boolean isReplaceable(World world, BlockPos pos) ++ { ++ net.minecraft.block.state.IBlockState state = world.getBlockState(pos); ++ return state.getBlock().isAir(world, pos) || state.getBlock().isLeaves(world, pos) || state.getBlock().isWood(world, pos) || func_150523_a(state.getBlock()); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch new file mode 100644 index 000000000..2624e3901 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java +@@ -283,6 +283,7 @@ + + if (!this.validTreeLocation()) + { ++ this.world = null; //Fix vanilla Mem leak, holds latest world + return false; + } + else +@@ -291,15 +292,18 @@ + this.func_175941_b(); + this.func_175942_c(); + this.func_175939_d(); ++ this.world = null; //Fix vanilla Mem leak, holds latest world + return true; + } + } + + private boolean validTreeLocation() + { +- Block block = this.world.getBlockState(this.field_175947_m.down()).getBlock(); ++ BlockPos down = this.field_175947_m.down(); ++ net.minecraft.block.state.IBlockState state = this.world.getBlockState(down); ++ boolean isSoil = state.getBlock().canSustainPlant(this.world, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + +- if (block != Blocks.dirt && block != Blocks.grass && block != Blocks.farmland) ++ if (!isSoil) + { + return false; + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch new file mode 100644 index 000000000..f831c5456 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java +@@ -15,10 +15,12 @@ + { + Block block; + +- while (((block = worldIn.getBlockState(p_180709_3_).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && p_180709_3_.getY() > 0) ++ do + { ++ block = worldIn.getBlockState(p_180709_3_).getBlock(); ++ if (!block.isLeaves(worldIn, p_180709_3_) && !block.isLeaves(worldIn, p_180709_3_)) break; + p_180709_3_ = p_180709_3_.down(); +- } ++ } while (p_180709_3_.getY() > 0); + + for (int i = 0; i < 4; ++i) + { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch new file mode 100644 index 000000000..a25a63e45 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java +@@ -102,7 +102,7 @@ + BlockPos blockpos = new BlockPos(i3, i2, k1); + Block block = worldIn.getBlockState(blockpos).getBlock(); + +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (block.isAir(worldIn, blockpos1) || block.isLeaves(worldIn, blockpos1)) + { + this.func_175903_a(worldIn, blockpos, field_181630_b); + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch new file mode 100644 index 000000000..6bfaaf13e --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java +@@ -146,4 +146,10 @@ + } + } + } ++ ++ //Just a helper macro ++ private void onPlantGrow(World world, BlockPos pos, BlockPos source) ++ { ++ world.getBlockState(pos).getBlock().onPlantGrow(world, pos, source); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch new file mode 100644 index 000000000..f124d3f7b --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java +@@ -132,4 +132,11 @@ + this.func_175925_a(worldIn, p_175930_2_.up(j), p_175930_3_ + 1 - j); + } + } ++ ++ //Helper macro ++ private boolean isAirLeaves(World world, BlockPos pos) ++ { ++ net.minecraft.block.Block block = world.getBlockState(pos).getBlock(); ++ return block.isAir(world, pos) || block.isLeaves(world, pos); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch new file mode 100644 index 000000000..4d3c26db3 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch @@ -0,0 +1,31 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java +@@ -72,11 +72,13 @@ + } + else + { +- Block block = worldIn.getBlockState(p_180709_3_.down()).getBlock(); ++ BlockPos down = p_180709_3_.down(); ++ Block block = worldIn.getBlockState(down).getBlock(); ++ boolean isSoil = block.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + +- if ((block == Blocks.grass || block == Blocks.dirt) && p_180709_3_.getY() < 256 - i - 1) ++ if (isSoil && p_180709_3_.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, p_180709_3_.down()); ++ block.onPlantGrow(worldIn, down, p_180709_3_); + EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(p_180709_2_); + int k2 = i - p_180709_2_.nextInt(4) - 1; + int l2 = 3 - p_180709_2_.nextInt(3); +@@ -210,9 +212,9 @@ + + private void func_175924_b(World worldIn, BlockPos p_175924_2_) + { +- Material material = worldIn.getBlockState(p_175924_2_).getBlock().getMaterial(); ++ Block block = worldIn.getBlockState(p_175924_2_).getBlock(); + +- if (material == Material.air || material == Material.leaves) ++ if (block.isAir(worldIn, p_175924_2_) || block.isLeaves(worldIn, p_175924_2_)) + { + this.func_175903_a(worldIn, p_175924_2_, field_181644_b); + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch new file mode 100644 index 000000000..a5d8a11a7 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java +@@ -25,14 +25,16 @@ + { + Block block; + +- while (((block = worldIn.getBlockState(p_180709_3_).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && p_180709_3_.getY() > 0) ++ do + { ++ block = worldIn.getBlockState(p_180709_3_).getBlock(); ++ if (!block.isAir(worldIn, p_180709_3_) && !block.isLeaves(worldIn, p_180709_3_)) break; + p_180709_3_ = p_180709_3_.down(); +- } ++ } while (p_180709_3_.getY() > 0); + + Block block1 = worldIn.getBlockState(p_180709_3_).getBlock(); + +- if (block1 == Blocks.dirt || block1 == Blocks.grass) ++ if (block1.canSustainPlant(worldIn, p_180709_3_, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) + { + p_180709_3_ = p_180709_3_.up(); + this.func_175903_a(worldIn, p_180709_3_, this.field_150527_b); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch new file mode 100644 index 000000000..b4a3e7320 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java +@@ -23,10 +23,12 @@ + { + Block block; + +- while (((block = worldIn.getBlockState(p_180709_3_).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && p_180709_3_.getY() > 0) ++ do + { ++ block = worldIn.getBlockState(p_180709_3_).getBlock(); ++ if (!block.isAir(worldIn, p_180709_3_) && !block.isLeaves(worldIn, p_180709_3_)) break; + p_180709_3_ = p_180709_3_.down(); +- } ++ } while (p_180709_3_.getY() > 0); + + for (int i = 0; i < 128; ++i) + { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch new file mode 100644 index 000000000..794ac79cd --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java +@@ -114,7 +114,7 @@ + BlockPos blockpos = new BlockPos(k1, i3, i2); + Block block = worldIn.getBlockState(blockpos).getBlock(); + +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves || block.getMaterial() == Material.vine) ++ if (block.isAir(worldIn, blockpos1) || block.isLeaves(worldIn, blockpos1) || block.getMaterial() == Material.vine) + { + this.func_175903_a(worldIn, blockpos, this.metaLeaves); + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch new file mode 100644 index 000000000..e46096942 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java +@@ -27,10 +27,12 @@ + { + Block block; + +- while (((block = worldIn.getBlockState(p_180709_3_).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && p_180709_3_.getY() > 1) ++ do + { ++ block = worldIn.getBlockState(p_180709_3_).getBlock(); ++ if (!block.isAir(worldIn, p_180709_3_) && !block.isLeaves(worldIn, p_180709_3_)) break; + p_180709_3_ = p_180709_3_.down(); +- } ++ } while (p_180709_3_.getY() > 0); + + if (p_180709_3_.getY() < 1) + { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch new file mode 100644 index 000000000..9c8ed27ef --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch @@ -0,0 +1,17 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java +@@ -221,12 +221,12 @@ + { + if (this.field_143029_e == null) + { +- this.field_143029_e = (MapGenStructureData)worldIn.loadItemData(MapGenStructureData.class, this.getStructureName()); ++ this.field_143029_e = (MapGenStructureData)worldIn.getPerWorldStorage().loadData(MapGenStructureData.class, this.getStructureName()); + + if (this.field_143029_e == null) + { + this.field_143029_e = new MapGenStructureData(this.getStructureName()); +- worldIn.setItemData(this.getStructureName(), this.field_143029_e); ++ worldIn.getPerWorldStorage().setData(this.getStructureName(), this.field_143029_e); + } + else + { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch new file mode 100644 index 000000000..f1ec9e600 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureComponent.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureComponent.java +@@ -36,6 +36,10 @@ + + public NBTTagCompound func_143010_b() + { ++ if (MapGenStructureIO.func_143036_a(this) == null) // Friendlier error then the Null String error below. ++ { ++ throw new RuntimeException("StructureComponent \"" + this.getClass().getName() + "\" missing ID Mapping, Modder see MapGenStructureIO"); ++ } + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setString("id", MapGenStructureIO.func_143036_a(this)); + nbttagcompound.setTag("BB", this.boundingBox.func_151535_h()); diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch new file mode 100644 index 000000000..56202de91 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java +@@ -156,7 +156,7 @@ + if (this.field_111021_b && p_74875_3_.func_175898_b(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) + { + this.field_111021_b = false; +- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 2, 3, field_111019_a, 2 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_)); + } + + this.func_175804_a(worldIn, p_74875_3_, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); +@@ -228,7 +228,7 @@ + if (this.field_111020_b && p_74875_3_.func_175898_b(new BlockPos(this.getXWithOffset(1, 3), this.getYWithOffset(2), this.getZWithOffset(1, 3)))) + { + this.field_111020_b = false; +- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 1, 2, 3, field_111019_a, 2 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 1, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_)); + } + + this.func_175804_a(worldIn, p_74875_3_, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch new file mode 100644 index 000000000..1dd1abc4d --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch @@ -0,0 +1,23 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureStart.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureStart.java +@@ -63,6 +63,10 @@ + + public NBTTagCompound func_143021_a(int p_143021_1_, int p_143021_2_) + { ++ if (MapGenStructureIO.func_143033_a(this) == null) // This is just a more friendly error instead of the 'Null String' below ++ { ++ throw new RuntimeException("StructureStart \"" + this.getClass().getName() + "\" missing ID Mapping, Modder see MapGenStructureIO"); ++ } + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setString("id", MapGenStructureIO.func_143033_a(this)); + nbttagcompound.setInteger("ChunkX", p_143021_1_); +@@ -98,7 +102,8 @@ + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { +- this.components.add(MapGenStructureIO.func_143032_b(nbttaglist.getCompoundTagAt(i), worldIn)); ++ StructureComponent tmp = MapGenStructureIO.func_143032_b(nbttaglist.getCompoundTagAt(i), worldIn); ++ if (tmp != null) this.components.add(tmp); //Forge: Prevent NPEs further down the line when a componenet can't be loaded. + } + + this.func_143017_b(p_143020_2_); diff --git a/patches/minecraft/net/minecraft/world/storage/MapData.java.patch b/patches/minecraft/net/minecraft/world/storage/MapData.java.patch new file mode 100644 index 000000000..734f0896c --- /dev/null +++ b/patches/minecraft/net/minecraft/world/storage/MapData.java.patch @@ -0,0 +1,48 @@ +--- ../src-base/minecraft/net/minecraft/world/storage/MapData.java ++++ ../src-work/minecraft/net/minecraft/world/storage/MapData.java +@@ -21,7 +21,7 @@ + { + public int xCenter; + public int zCenter; +- public byte dimension; ++ public int dimension; //FML byte -> int + public byte scale; + public byte[] colors = new byte[16384]; + public List playersArrayList = Lists.newArrayList(); +@@ -45,7 +45,17 @@ + + public void readFromNBT(NBTTagCompound nbt) + { +- this.dimension = nbt.getByte("dimension"); ++ net.minecraft.nbt.NBTBase dimension = nbt.getTag("dimension"); ++ ++ if (dimension instanceof net.minecraft.nbt.NBTTagByte) ++ { ++ this.dimension = ((net.minecraft.nbt.NBTTagByte)dimension).getByte(); ++ } ++ else ++ { ++ this.dimension = ((net.minecraft.nbt.NBTTagInt)dimension).getInt(); ++ } ++ + this.xCenter = nbt.getInteger("xCenter"); + this.zCenter = nbt.getInteger("zCenter"); + this.scale = nbt.getByte("scale"); +@@ -86,7 +96,7 @@ + + public void writeToNBT(NBTTagCompound nbt) + { +- nbt.setByte("dimension", this.dimension); ++ nbt.setInteger("dimension", this.dimension); + nbt.setInteger("xCenter", this.xCenter); + nbt.setInteger("zCenter", this.zCenter); + nbt.setByte("scale", this.scale); +@@ -165,7 +175,7 @@ + p_82567_8_ = p_82567_8_ + (p_82567_8_ < 0.0D ? -8.0D : 8.0D); + b2 = (byte)((int)(p_82567_8_ * 16.0D / 360.0D)); + +- if (this.dimension < 0) ++ if (worldIn.provider.shouldMapSpin(p_82567_3_, p_82567_4_, p_82567_6_, p_82567_8_)) + { + int k = (int)(worldIn.getWorldInfo().getWorldTime() / 10L); + b2 = (byte)(k * k * 34187121 + k * 121 >> 15 & 15); diff --git a/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch b/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch new file mode 100644 index 000000000..356c56113 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch @@ -0,0 +1,59 @@ +--- ../src-base/minecraft/net/minecraft/world/storage/SaveHandler.java ++++ ../src-work/minecraft/net/minecraft/world/storage/SaveHandler.java +@@ -144,6 +144,8 @@ + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setTag("Data", nbttagcompound); + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, worldInformation, nbttagcompound2); ++ + try + { + File file1 = new File(this.worldDirectory, "level.dat_new"); +@@ -182,6 +184,8 @@ + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setTag("Data", nbttagcompound); + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, worldInformation, nbttagcompound1); ++ + try + { + File file1 = new File(this.worldDirectory, "level.dat_new"); +@@ -230,6 +234,7 @@ + } + + file1.renameTo(file2); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(p_75753_1_, this.playersDirectory, p_75753_1_.getUniqueID().toString()); + } + catch (Exception var5) + { +@@ -260,6 +265,7 @@ + p_75752_1_.readFromNBT(nbttagcompound); + } + ++ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_75752_1_, playersDirectory, p_75752_1_.getUniqueID().toString()); + return nbttagcompound; + } + +@@ -301,4 +307,22 @@ + { + return this.saveDirectoryName; + } ++ ++ public NBTTagCompound getPlayerNBT(net.minecraft.entity.player.EntityPlayerMP player) ++ { ++ try ++ { ++ File file1 = new File(this.playersDirectory, player.getUniqueID().toString() + ".dat"); ++ ++ if (file1.exists() && file1.isFile()) ++ { ++ return CompressedStreamTools.readCompressed(new FileInputStream(file1)); ++ } ++ } ++ catch (Exception exception) ++ { ++ logger.warn("Failed to load player data for " + player.getName()); ++ } ++ return null; ++ } + } diff --git a/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch b/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch new file mode 100644 index 000000000..7f2a2a393 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch @@ -0,0 +1,35 @@ +--- ../src-base/minecraft/net/minecraft/world/storage/WorldInfo.java ++++ ../src-work/minecraft/net/minecraft/world/storage/WorldInfo.java +@@ -52,6 +52,7 @@ + private int borderWarningTime = 15; + private GameRules theGameRules = new GameRules(); + private static final String __OBFID = "CL_00000587"; ++ private java.util.Map additionalProperties; + + protected WorldInfo() + { +@@ -755,4 +756,24 @@ + } + }); + } ++ ++ /** ++ * Allow access to additional mod specific world based properties ++ * Used by FML to store mod list associated with a world, and maybe an id map ++ * Used by Forge to store the dimensions available to a world ++ * @param additionalProperties ++ */ ++ public void setAdditionalProperties(java.util.Map additionalProperties) ++ { ++ // one time set for this ++ if (this.additionalProperties == null) ++ { ++ this.additionalProperties = additionalProperties; ++ } ++ } ++ ++ public net.minecraft.nbt.NBTBase getAdditionalProperty(String additionalProperty) ++ { ++ return this.additionalProperties!=null? this.additionalProperties.get(additionalProperty) : null; ++ } + } diff --git a/rejects/minecraft/net/minecraft/block/Block.java.patch.rej b/rejects/minecraft/net/minecraft/block/Block.java.patch.rej new file mode 100644 index 000000000..1e00b0acd --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/Block.java.patch.rej @@ -0,0 +1,56 @@ +++++ REJECTED PATCH 1 + public class Block + { + private static final ResourceLocation AIR_ID = new ResourceLocation("air"); +- public static final RegistryNamespacedDefaultedByKey blockRegistry = new RegistryNamespacedDefaultedByKey(AIR_ID); +- public static final ObjectIntIdentityMap BLOCK_STATE_IDS = new ObjectIntIdentityMap(); ++ public static final RegistryNamespacedDefaultedByKey blockRegistry = net.minecraftforge.fml.common.registry.GameData.getBlockRegistry(); ++ @Deprecated //Modders: DO NOT use this! Use GameRegistry ++ public static final ObjectIntIdentityMap BLOCK_STATE_IDS = net.minecraftforge.fml.common.registry.GameData.getBlockStateIDMap(); + private CreativeTabs displayOnCreativeTab; + public static final Block.SoundType soundTypeStone = new Block.SoundType("stone", 1.0F, 1.0F); + public static final Block.SoundType soundTypeWood = new Block.SoundType("wood", 1.0F, 1.0F); +++++ END PATCH +++++ REJECTED PATCH 7 + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {} + +- public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {} ++ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) ++ { ++ if (hasTileEntity(state) && !(this instanceof BlockContainer)) ++ { ++ worldIn.removeTileEntity(pos); ++ } ++ } + + public int quantityDropped(Random random) + { +++++ END PATCH +++++ REJECTED PATCH 9 + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { +- if (!worldIn.isRemote) ++ if (!worldIn.isRemote && !worldIn.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe + { +- int j = this.quantityDroppedWithBonus(fortune, worldIn.rand); ++ java.util.List items = getDrops(worldIn, pos, state, fortune); ++ chance = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, fortune, chance, false, harvesters.get()); + +- for (int k = 0; k < j; ++k) ++ for (ItemStack item : items) + { + if (worldIn.rand.nextFloat() <= chance) + { +- Item item = this.getItemDropped(state, worldIn.rand, fortune); +- +- if (item != null) +- { +- spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); +- } ++ spawnAsEntity(worldIn, pos, item); + } + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockAir.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockAir.java.patch.rej new file mode 100644 index 000000000..f1b988c21 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockAir.java.patch.rej @@ -0,0 +1,8 @@ +++++ REJECTED PATCH 1 + } + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) {} ++ ++ public boolean isReplaceable(World worldIn, BlockPos pos){ return true; } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockCocoa.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockCocoa.java.patch.rej new file mode 100644 index 000000000..e0e0c7e85 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockCocoa.java.patch.rej @@ -0,0 +1,15 @@ +++++ REJECTED PATCH 1 + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { ++ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); ++ } ++ ++ @Override ++ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) ++ { ++ java.util.List dropped = super.getDrops(world, pos, state, fortune); + int j = ((Integer)state.getValue(AGE)).intValue(); + byte b0 = 1; + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockCrops.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockCrops.java.patch.rej new file mode 100644 index 000000000..2119824f9 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockCrops.java.patch.rej @@ -0,0 +1,26 @@ +++++ REJECTED PATCH 3 + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); +- +- if (!worldIn.isRemote) +- { +- int j = ((Integer)state.getValue(AGE)).intValue(); +- +- if (j >= 7) +- { +- int k = 3 + fortune; +- +- for (int l = 0; l < k; ++l) +- { +- if (worldIn.rand.nextInt(15) <= j) +- { +- spawnAsEntity(worldIn, pos, new ItemStack(this.getSeed(), 1, 0)); +- } +- } +- } +- } + } + + public Item getItemDropped(IBlockState state, Random rand, int fortune) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockDoublePlant.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockDoublePlant.java.patch.rej new file mode 100644 index 000000000..950d40f7e --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockDoublePlant.java.patch.rej @@ -0,0 +1,40 @@ +++++ REJECTED PATCH 2 + Object object = flag ? this : worldIn.getBlockState(blockpos1).getBlock(); + Object object1 = flag ? worldIn.getBlockState(blockpos2).getBlock() : this; + ++ if (!flag) this.dropBlockAsItem(worldIn, pos, state, 0); //Forge move above the setting to air. ++ + if (object == this) + { + worldIn.setBlockState(blockpos1, Blocks.air.getDefaultState(), 3); +++++ END PATCH +++++ REJECTED PATCH 3 + if (object1 == this) + { + worldIn.setBlockState(blockpos2, Blocks.air.getDefaultState(), 3); +- +- if (!flag) +- { +- this.dropBlockAsItem(worldIn, blockpos2, state, 0); +- } + } + } + } + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { ++ if (state.getBlock() != this) return super.canBlockStay(worldIn, pos, state); //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. + if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) + { + return worldIn.getBlockState(pos.down()).getBlock() == this; +++++ END PATCH +++++ REJECTED PATCH 5 + else + { + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- int i = (enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).getMeta(); +- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 2, i)); + return true; + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockFire.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockFire.java.patch.rej new file mode 100644 index 000000000..2bba49786 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockFire.java.patch.rej @@ -0,0 +1,73 @@ +++++ REJECTED PATCH 5 + b0 = -50; + } + +- this.catchOnFire(worldIn, pos.east(), 300 + b0, rand, i); +- this.catchOnFire(worldIn, pos.west(), 300 + b0, rand, i); +- this.catchOnFire(worldIn, pos.down(), 250 + b0, rand, i); +- this.catchOnFire(worldIn, pos.up(), 250 + b0, rand, i); +- this.catchOnFire(worldIn, pos.north(), 300 + b0, rand, i); +- this.catchOnFire(worldIn, pos.south(), 300 + b0, rand, i); ++ this.tryCatchFire(worldIn, pos.east(), 300 + b0, rand, i, EnumFacing.WEST); ++ this.tryCatchFire(worldIn, pos.west(), 300 + b0, rand, i, EnumFacing.EAST); ++ this.tryCatchFire(worldIn, pos.down(), 250 + b0, rand, i, EnumFacing.UP); ++ this.tryCatchFire(worldIn, pos.up(), 250 + b0, rand, i, EnumFacing.DOWN); ++ this.tryCatchFire(worldIn, pos.north(), 300 + b0, rand, i, EnumFacing.SOUTH); ++ this.tryCatchFire(worldIn, pos.south(), 300 + b0, rand, i, EnumFacing.NORTH); + + for (int j = -1; j <= 1; ++j) + { +++++ END PATCH +++++ REJECTED PATCH 6 + return false; + } + ++ @Deprecated // Use Block.getFlammability + public int getFlammability(Block blockIn) + { + Integer integer = (Integer)this.flammabilities.get(blockIn); + return integer == null ? 0 : integer.intValue(); + } + ++ @Deprecated // Use Block.getFlammability + public int getEncouragement(Block blockIn) + { + Integer integer = (Integer)this.encouragements.get(blockIn); + return integer == null ? 0 : integer.intValue(); + } + ++ @Deprecated // Use tryCatchFire with face below + private void catchOnFire(World worldIn, BlockPos pos, int chance, Random random, int age) + { +- int k = this.getFlammability(worldIn.getBlockState(pos).getBlock()); ++ this.tryCatchFire(worldIn, pos, chance, random, age, EnumFacing.UP); ++ } + ++ private void tryCatchFire(World worldIn, BlockPos pos, int chance, Random random, int age, EnumFacing face) ++ { ++ int k = worldIn.getBlockState(pos).getBlock().getFlammability(worldIn, pos, face); ++ + if (random.nextInt(chance) < k) + { + IBlockState iblockstate = worldIn.getBlockState(pos); +++++ END PATCH +++++ REJECTED PATCH 7 + { + EnumFacing enumfacing = aenumfacing[j]; + +- if (this.canCatchFire(worldIn, pos.offset(enumfacing))) ++ if (this.canCatchFire(worldIn, pos.offset(enumfacing), enumfacing.getOpposite())) + { + return true; + } +++++ END PATCH +++++ REJECTED PATCH 8 + for (int k = 0; k < j; ++k) + { + EnumFacing enumfacing = aenumfacing[k]; +- i = Math.max(this.getEncouragement(worldIn.getBlockState(pos.offset(enumfacing)).getBlock()), i); ++ i = Math.max(worldIn.getBlockState(pos.offset(enumfacing)).getBlock().getFlammability(worldIn, pos.offset(enumfacing), enumfacing.getOpposite()), i); + } + + return i; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockGrass.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockGrass.java.patch.rej new file mode 100644 index 000000000..2f7804379 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockGrass.java.patch.rej @@ -0,0 +1,32 @@ +++++ REJECTED PATCH 2 + Block block = worldIn.getBlockState(blockpos1.up()).getBlock(); + IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); + +- if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity() <= 2) ++ if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity(worldIn, blockpos1.up()) <= 2) + { + worldIn.setBlockState(blockpos1, Blocks.grass.getDefaultState()); + } +++++ END PATCH +++++ REJECTED PATCH 3 + continue; + } + } +- else if (worldIn.getBlockState(blockpos2).getBlock().blockMaterial == Material.air) ++ else if (worldIn.isAirBlock(blockpos2)) + { + if (rand.nextInt(8) == 0) + { +- BlockFlower.EnumFlowerType enumflowertype = worldIn.getBiomeGenForCoords(blockpos2).pickRandomFlower(rand, blockpos2); +- BlockFlower blockflower = enumflowertype.getBlockType().getBlock(); +- IBlockState iblockstate1 = blockflower.getDefaultState().withProperty(blockflower.getTypeProperty(), enumflowertype); +- +- if (blockflower.canBlockStay(worldIn, blockpos2, iblockstate1)) +- { +- worldIn.setBlockState(blockpos2, iblockstate1, 3); +- } ++ worldIn.getBiomeGenForCoords(blockpos2).plantFlower(worldIn, rand, blockpos2); + } + else + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockLadder.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockLadder.java.patch.rej new file mode 100644 index 000000000..feee341b8 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockLadder.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 3 + return new BlockState(this, new IProperty[] {FACING}); + } + ++ @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; } ++ + static final class SwitchEnumFacing + { + static final int[] FACING_LOOKUP = new int[EnumFacing.values().length]; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockLeaves.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockLeaves.java.patch.rej new file mode 100644 index 000000000..971ebede5 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockLeaves.java.patch.rej @@ -0,0 +1,73 @@ +++++ REJECTED PATCH 2 + BlockPos blockpos1 = pos.add(i1, j1, k1); + IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); + +- if (iblockstate1.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate1.getValue(CHECK_DECAY)).booleanValue()) ++ if (iblockstate1.getBlock().isLeaves(worldIn, blockpos1)) + { +- worldIn.setBlockState(blockpos1, iblockstate1.withProperty(CHECK_DECAY, Boolean.valueOf(true)), 4); ++ iblockstate1.getBlock().beginLeavesDecay(worldIn, blockpos1); + } + } + } +++++ END PATCH +++++ REJECTED PATCH 3 + { + for (i2 = -b0; i2 <= b0; ++i2) + { +- Block block = worldIn.getBlockState(new BlockPos(j + k1, k + l1, l + i2)).getBlock(); ++ BlockPos tmp = new BlockPos(j + k1, k + l1, l + i2); ++ Block block = worldIn.getBlockState(tmp).getBlock(); + +- if (block != Blocks.log && block != Blocks.log2) ++ if (!block.canSustainLeaves(worldIn, tmp)) + { +- if (block.getMaterial() == Material.leaves) ++ if (block.isLeaves(worldIn, tmp)) + { + this.surroundings[(k1 + j1) * i1 + (l1 + j1) * b1 + i2 + j1] = -2; + } +++++ END PATCH +++++ REJECTED PATCH 4 + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { +- if (!worldIn.isRemote) +- { +- int j = this.getSaplingDropChance(state); +- +- if (fortune > 0) +- { +- j -= 2 << fortune; +- +- if (j < 10) +- { +- j = 10; +- } +- } +- +- if (worldIn.rand.nextInt(j) == 0) +- { +- Item item = this.getItemDropped(state, worldIn.rand, fortune); +- spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); +- } +- +- j = 200; +- +- if (fortune > 0) +- { +- j -= 10 << fortune; +- +- if (j < 40) +- { +- j = 40; +- } +- } +- +- this.dropApple(worldIn, pos, state, j); +- } ++ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + } + + protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance) {} +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockLever.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockLever.java.patch.rej new file mode 100644 index 000000000..259b2a559 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockLever.java.patch.rej @@ -0,0 +1,55 @@ +++++ REJECTED PATCH 1 + + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + { +- return side == EnumFacing.UP && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) ? true : this.canSustainLever(worldIn, pos.offset(side.getOpposite())); ++ return side == EnumFacing.UP && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) ? true : worldIn.isSideSolid(pos.offset(side.getOpposite()), side); + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { +- return this.canSustainLever(worldIn, pos.west()) ? true : (this.canSustainLever(worldIn, pos.east()) ? true : (this.canSustainLever(worldIn, pos.north()) ? true : (this.canSustainLever(worldIn, pos.south()) ? true : (World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) ? true : this.canSustainLever(worldIn, pos.up()))))); ++ return worldIn.isSideSolid(pos.west(), EnumFacing.EAST ) || ++ worldIn.isSideSolid(pos.east(), EnumFacing.WEST ) || ++ worldIn.isSideSolid(pos.north(), EnumFacing.SOUTH) || ++ worldIn.isSideSolid(pos.south(), EnumFacing.NORTH) || ++ worldIn.isSideSolid(pos.down(), EnumFacing.UP ) || ++ worldIn.isSideSolid(pos.up(), EnumFacing.DOWN ); + } + +- protected boolean canSustainLever(World worldIn, BlockPos pos) +- { +- return worldIn.getBlockState(pos).getBlock().isNormalCube(); +- } +- + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + IBlockState iblockstate = this.getDefaultState().withProperty(POWERED, Boolean.valueOf(false)); + +- if (this.canSustainLever(worldIn, pos.offset(facing.getOpposite()))) ++ if (worldIn.isSideSolid(pos.offset(facing.getOpposite()), facing)) + { + return iblockstate.withProperty(FACING, BlockLever.EnumOrientation.forFacings(facing, placer.getHorizontalFacing())); + } +++++ END PATCH +++++ REJECTED PATCH 2 + + enumfacing1 = (EnumFacing)iterator.next(); + } +- while (enumfacing1 == facing || !this.canSustainLever(worldIn, pos.offset(enumfacing1.getOpposite()))); ++ while (enumfacing1 == facing || !worldIn.isSideSolid(pos.offset(enumfacing1.getOpposite()), enumfacing1)); + + return iblockstate.withProperty(FACING, BlockLever.EnumOrientation.forFacings(enumfacing1, placer.getHorizontalFacing())); + } +++++ END PATCH +++++ REJECTED PATCH 3 + + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { +- if (this.checkForDrop(worldIn, pos) && !this.canSustainLever(worldIn, pos.offset(((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing().getOpposite()))) ++ EnumFacing dir = ((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing(); ++ if (this.checkForDrop(worldIn, pos) && !worldIn.isSideSolid(pos.offset(dir.getOpposite()), dir)) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockLog.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockLog.java.patch.rej new file mode 100644 index 000000000..5579362ca --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockLog.java.patch.rej @@ -0,0 +1,13 @@ +++++ REJECTED PATCH 1 + BlockPos blockpos1 = (BlockPos)iterator.next(); + IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); + +- if (iblockstate1.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate1.getValue(BlockLeaves.CHECK_DECAY)).booleanValue()) ++ if (iblockstate1.getBlock().isLeaves(worldIn, blockpos1)) + { +- worldIn.setBlockState(blockpos1, iblockstate1.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(true)), 4); ++ iblockstate1.getBlock().beginLeavesDecay(worldIn, blockpos1); + } + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockMobSpawner.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockMobSpawner.java.patch.rej new file mode 100644 index 000000000..a32b52b1f --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockMobSpawner.java.patch.rej @@ -0,0 +1,18 @@ +++++ REJECTED PATCH 1 + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); +- int j = 15 + worldIn.rand.nextInt(15) + worldIn.rand.nextInt(15); +- this.dropXpOnBlockBreak(worldIn, pos, j); + } + ++ @Override ++ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15); ++ } ++ + public boolean isOpaqueCube() + { + return false; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockMushroom.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockMushroom.java.patch.rej new file mode 100644 index 000000000..f1b2e5602 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockMushroom.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + if (pos.getY() >= 0 && pos.getY() < 256) + { + IBlockState iblockstate1 = worldIn.getBlockState(pos.down()); +- return iblockstate1.getBlock() == Blocks.mycelium ? true : (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.canPlaceBlockOn(iblockstate1.getBlock())); ++ return iblockstate1.getBlock() == Blocks.mycelium ? true : (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && iblockstate1.getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this)); + } + else + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockMycelium.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockMycelium.java.patch.rej new file mode 100644 index 000000000..6899945c5 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockMycelium.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 2 + IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); + Block block = worldIn.getBlockState(blockpos1.up()).getBlock(); + +- if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity() <= 2) ++ if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity(worldIn, blockpos1.up()) <= 2) + { + worldIn.setBlockState(blockpos1, this.getDefaultState()); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockPistonBase.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockPistonBase.java.patch.rej new file mode 100644 index 000000000..86af25d33 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockPistonBase.java.patch.rej @@ -0,0 +1,22 @@ +++++ REJECTED PATCH 1 + } + } + +- if (!flag1 && block.getMaterial() != Material.air && canPush(block, worldIn, blockpos1, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) ++ if (!flag1 && !block.isAir(worldIn, blockpos1) && canPush(block, worldIn, blockpos1, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) + { + this.doMove(worldIn, pos, enumfacing, false); + } +++++ END PATCH +++++ REJECTED PATCH 3 + { + blockpos1 = (BlockPos)list1.get(j); + Block block = worldIn.getBlockState(blockpos1).getBlock(); +- block.dropBlockAsItem(worldIn, blockpos1, worldIn.getBlockState(blockpos1), 0); ++ //With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. ++ float chance = block instanceof BlockSnow ? -1.0f : 1.0f; ++ block.dropBlockAsItemWithChance(worldIn, blockpos1, worldIn.getBlockState(blockpos1), chance, 0); + worldIn.setBlockToAir(blockpos1); + --i; + ablock[i] = block; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockPistonMoving.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockPistonMoving.java.patch.rej new file mode 100644 index 000000000..e76f9ae9d --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockPistonMoving.java.patch.rej @@ -0,0 +1,19 @@ +++++ REJECTED PATCH 1 + + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { +- if (!worldIn.isRemote) +- { +- TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos); +- +- if (tileentitypiston != null) +- { +- IBlockState iblockstate1 = tileentitypiston.getPistonState(); +- iblockstate1.getBlock().dropBlockAsItem(worldIn, pos, iblockstate1, 0); +- } +- } ++ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + } + + public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockRailBase.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockRailBase.java.patch.rej new file mode 100644 index 000000000..bbd669367 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockRailBase.java.patch.rej @@ -0,0 +1,134 @@ +++++ REJECTED PATCH 2 + } + + public abstract IProperty getShapeProperty(); ++ /* ======================================== FORGE START =====================================*/ ++ /** ++ * Return true if the rail can make corners. ++ * Used by placement logic. ++ * @param world The world. ++ * @param pod Block's position in world ++ * @return True if the rail can make corners. ++ */ ++ public boolean isFlexibleRail(IBlockAccess world, BlockPos pos) ++ { ++ return !this.isPowered; ++ } + ++ /** ++ * Returns true if the rail can make up and down slopes. ++ * Used by placement logic. ++ * @param world The world. ++ * @param pod Block's position in world ++ * @return True if the rail can make slopes. ++ */ ++ public boolean canMakeSlopes(IBlockAccess world, BlockPos pos) ++ { ++ return true; ++ } ++ ++ /** ++ * Returns the max speed of the rail at the specified position. ++ * @param world The world. ++ * @param cart The cart on the rail, may be null. ++ * @param pod Block's position in world ++ * @return The max speed of the current rail. ++ */ ++ public float getRailMaxSpeed(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos) ++ { ++ return 0.4f; ++ } ++ ++ /** ++ * This function is called by any minecart that passes over this rail. ++ * It is called once per update tick that the minecart is on the rail. ++ * @param world The world. ++ * @param cart The cart on the rail. ++ * @param pod Block's position in world ++ */ ++ public void onMinecartPass(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos) ++ { ++ } ++ ++ /** ++ * Rotate the block. For vanilla blocks this rotates around the axis passed in (generally, it should be the "face" that was hit). ++ * Note: for mod blocks, this is up to the block and modder to decide. It is not mandated that it be a rotation around the ++ * face, but could be a rotation to orient *to* that face, or a visiting of possible rotations. ++ * The method should return true if the rotation was successful though. ++ * ++ * @param world The world ++ * @param pos Block position in world ++ * @param axis The axis to rotate around ++ * @return True if the rotation was successful, False if the rotation failed, or is not possible ++ */ ++ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) ++ { ++ IBlockState state = world.getBlockState(pos); ++ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ { ++ if (prop.getName().equals("shape")) ++ { ++ world.setBlockState(pos, state.cycleProperty(prop)); ++ return true; ++ } ++ } ++ return false; ++ } ++ ++ /* ======================================== FORGE END =====================================*/ ++ + public static enum EnumRailDirection implements IStringSerializable + { + NORTH_SOUTH(0, "north_south"), +++++ END PATCH +++++ REJECTED PATCH 4 + this.state = state; + this.block = (BlockRailBase)state.getBlock(); + BlockRailBase.EnumRailDirection enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(BlockRailBase.this.getShapeProperty()); +- this.isPowered = this.block.isPowered; ++ this.isPowered = !this.block.isFlexibleRail(worldIn, pos); ++ canMakeSlopes = this.block.canMakeSlopes(worldIn, pos); + this.func_180360_a(enumraildirection); + } + +++++ END PATCH +++++ REJECTED PATCH 5 + } + } + +- if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) ++ if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) + { + if (BlockRailBase.isRailBlock(this.world, blockpos.up())) + { +++++ END PATCH +++++ REJECTED PATCH 6 + } + } + +- if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) ++ if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) + { + if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) + { +++++ END PATCH +++++ REJECTED PATCH 7 + } + } + +- if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) ++ if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) + { + if (BlockRailBase.isRailBlock(this.world, blockpos.up())) + { +++++ END PATCH +++++ REJECTED PATCH 8 + } + } + +- if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) ++ if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) + { + if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch.rej new file mode 100644 index 000000000..51dca115b --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + BlockPos blockpos1 = pos.offset(enumfacing.getOpposite()); ++ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldIn, pos, worldIn.getBlockState(pos), java.util.EnumSet.of(enumfacing.getOpposite())).isCanceled()) ++ return; + worldIn.notifyBlockOfStateChange(blockpos1, this); + worldIn.notifyNeighborsOfStateExcept(blockpos1, this, enumfacing); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch.rej new file mode 100644 index 000000000..98688e8d0 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch.rej @@ -0,0 +1,21 @@ +++++ REJECTED PATCH 1 + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); ++ } + +- if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this)) ++ @Override ++ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ if (this.getItemDropped(world.getBlockState(pos), RANDOM, fortune) != Item.getItemFromBlock(this)) + { +- int j = 1 + worldIn.rand.nextInt(5); +- this.dropXpOnBlockBreak(worldIn, pos, j); ++ return 1 + RANDOM.nextInt(5); + } ++ return 0; + } + + @SideOnly(Side.CLIENT) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch.rej new file mode 100644 index 000000000..cd65ac08d --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch.rej @@ -0,0 +1,59 @@ +++++ REJECTED PATCH 1 + BlockPos blockpos1 = pos.offset(direction); + Block block = worldIn.getBlockState(pos.offset(direction)).getBlock(); + +- if (!canConnectTo(worldIn.getBlockState(blockpos1), direction) && (block.isSolidFullCube() || !canConnectUpwardsTo(worldIn.getBlockState(blockpos1.down())))) ++ if (!canRestoneConnect(worldIn, blockpos1, direction) && (block.isSolidFullCube() || !canRestoneConnect(worldIn, blockpos1.down(), null))) + { + Block block1 = worldIn.getBlockState(pos.up()).getBlock(); +- return !block1.isSolidFullCube() && block.isSolidFullCube() && canConnectUpwardsTo(worldIn.getBlockState(blockpos1.up())) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; ++ return !block1.isSolidFullCube() && block.isSolidFullCube() && canRestoneConnect(worldIn, blockpos1.up(), null) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; + } + else + { +++++ END PATCH +++++ REJECTED PATCH 2 + Block block = iblockstate.getBlock(); + boolean flag = block.isNormalCube(); + boolean flag1 = worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); +- return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos1.up()) ? true : (canConnectTo(iblockstate, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos1.down()))); ++ return !flag1 && flag && canRestoneConnect(worldIn, blockpos1.up(), null) ? true : (canRestoneConnect(worldIn, blockpos1, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canRestoneConnect(worldIn, blockpos1.down(), null))); + } + +- protected static boolean canConnectUpwardsTo(IBlockAccess worldIn, BlockPos pos) ++ protected static boolean canRestoneConnect(IBlockAccess world, BlockPos pos, EnumFacing side) + { +- return canConnectUpwardsTo(worldIn.getBlockState(pos)); +- } ++ IBlockState state = world.getBlockState(pos); + +- protected static boolean canConnectUpwardsTo(IBlockState state) +- { +- return canConnectTo(state, (EnumFacing)null); +- } +- +- protected static boolean canConnectTo(IBlockState blockState, EnumFacing side) +- { +- Block block = blockState.getBlock(); +- +- if (block == Blocks.redstone_wire) ++ if (state.getBlock() == Blocks.redstone_wire) + { + return true; + } +- else if (Blocks.unpowered_repeater.isAssociated(block)) ++ else if (Blocks.unpowered_repeater.isAssociated(state.getBlock())) + { +- EnumFacing enumfacing1 = (EnumFacing)blockState.getValue(BlockRedstoneRepeater.FACING); +- return enumfacing1 == side || enumfacing1.getOpposite() == side; ++ EnumFacing direction = (EnumFacing)state.getValue(BlockRedstoneRepeater.FACING); ++ return direction == side || direction.getOpposite() == side; + } + else + { +- return block.canProvidePower() && side != null; ++ return state.getBlock().canConnectRedstone(world, pos, side); + } + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockSapling.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockSapling.java.patch.rej new file mode 100644 index 000000000..921d4a4e1 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockSapling.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + + public void generateTree(World worldIn, BlockPos pos, IBlockState state, Random rand) + { ++ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(worldIn, rand, pos)) return; + Object object = rand.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true); + int i = 0; + int j = 0; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockSkull.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockSkull.java.patch.rej new file mode 100644 index 000000000..b9f4f54a4 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockSkull.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + return tileentity instanceof TileEntitySkull ? ((TileEntitySkull)tileentity).getSkullType() : super.getDamageValue(worldIn, pos); + } + +- public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) {} +- + public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) + { + if (player.capabilities.isCreativeMode) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockSnow.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockSnow.java.patch.rej new file mode 100644 index 000000000..be9e93d09 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockSnow.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + { + IBlockState iblockstate = worldIn.getBlockState(pos.down()); + Block block = iblockstate.getBlock(); +- return block != Blocks.ice && block != Blocks.packed_ice ? (block.getMaterial() == Material.leaves ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() == 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; ++ return block != Blocks.ice && block != Blocks.packed_ice ? (block.isLeaves(worldIn, pos.down()) ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() == 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; + } + + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockStem.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockStem.java.patch.rej new file mode 100644 index 000000000..1b9e859f1 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockStem.java.patch.rej @@ -0,0 +1,18 @@ +++++ REJECTED PATCH 3 + + for (int k = 0; k < 3; ++k) + { +- if (worldIn.rand.nextInt(15) <= j) ++ if (RANDOM.nextInt(15) <= j) + { +- spawnAsEntity(worldIn, pos, new ItemStack(item)); ++ ret.add(new ItemStack(item)); + } + } + } + } ++ return ret; + } + + protected Item getSeedItem() +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockTorch.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockTorch.java.patch.rej new file mode 100644 index 000000000..2fd87d504 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockTorch.java.patch.rej @@ -0,0 +1,30 @@ +++++ REJECTED PATCH 2 + { + BlockPos blockpos1 = pos.offset(facing.getOpposite()); + boolean flag = facing.getAxis().isHorizontal(); +- return flag && worldIn.isBlockNormalCube(blockpos1, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos1); ++ return flag && worldIn.isSideSolid(blockpos1, facing, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos1); + } + + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) +++++ END PATCH +++++ REJECTED PATCH 3 + + enumfacing1 = (EnumFacing)iterator.next(); + } +- while (!worldIn.isBlockNormalCube(pos.offset(enumfacing1.getOpposite()), true)); ++ while (!worldIn.isSideSolid(pos.offset(enumfacing1.getOpposite()), enumfacing1, true)); + + return this.getDefaultState().withProperty(FACING, enumfacing1); + } +++++ END PATCH +++++ REJECTED PATCH 4 + EnumFacing enumfacing1 = enumfacing.getOpposite(); + boolean flag = false; + +- if (axis.isHorizontal() && !worldIn.isBlockNormalCube(pos.offset(enumfacing1), true)) ++ if (axis.isHorizontal() && !worldIn.isSideSolid(pos.offset(enumfacing1), enumfacing1, true)) + { + flag = true; + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockTrapDoor.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockTrapDoor.java.patch.rej new file mode 100644 index 000000000..3b8cb207b --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockTrapDoor.java.patch.rej @@ -0,0 +1,13 @@ +++++ REJECTED PATCH 2 + { + if (!worldIn.isRemote) + { ++ EnumFacing direction = (EnumFacing)state.getValue(FACING); + BlockPos blockpos1 = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite()); + +- if (!isValidSupportBlock(worldIn.getBlockState(blockpos1).getBlock())) ++ if (!(isValidSupportBlock(worldIn.getBlockState(blockpos1).getBlock()) || worldIn.isSideSolid(blockpos1, direction, true))) + { + worldIn.setBlockToAir(pos); + this.dropBlockAsItem(worldIn, pos, state, 0); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockTripWireHook.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockTripWireHook.java.patch.rej new file mode 100644 index 000000000..94dd08182 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockTripWireHook.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 2 + + enumfacing = (EnumFacing)iterator.next(); + } +- while (!worldIn.getBlockState(pos.offset(enumfacing)).getBlock().isNormalCube()); ++ while (!worldIn.isSideSolid(pos.offset(enumfacing), enumfacing.getOpposite(), true)); + + return true; + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockVine.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockVine.java.patch.rej new file mode 100644 index 000000000..e891e578d --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/BlockVine.java.patch.rej @@ -0,0 +1,18 @@ +++++ REJECTED PATCH 3 + return i; + } + ++ /*************************FORGE START***********************************/ ++ @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity){ return true; } ++ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } ++ @Override ++ public java.util.List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) ++ { ++ return java.util.Arrays.asList(new ItemStack(this, 1)); ++ } ++ /*************************FORGE END***********************************/ ++ + static final class SwitchEnumFacing + { + static final int[] FACING_LOOKUP = new int[EnumFacing.values().length]; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch.rej b/rejects/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch.rej new file mode 100644 index 000000000..6d2f2b55c --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 2 + BlockPos blockpos1 = origin.offset(this.moveDirection.getOpposite(), i); + block = this.world.getBlockState(blockpos1).getBlock(); + +- if (block.getMaterial() == Material.air || !BlockPistonBase.canPush(block, this.world, blockpos1, this.moveDirection, false) || blockpos1.equals(this.pistonPos)) ++ if (block.isAir(world, blockpos1)|| !BlockPistonBase.canPush(block, this.world, blockpos1, this.moveDirection, false) || blockpos1.equals(this.pistonPos)) + { + break; + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/state/BlockState.java.patch.rej b/rejects/minecraft/net/minecraft/block/state/BlockState.java.patch.rej new file mode 100644 index 000000000..2be016437 --- /dev/null +++ b/rejects/minecraft/net/minecraft/block/state/BlockState.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 2 + { + List list = (List)iterator.next(); + Map map = MapPopulator.createMap(this.properties, list); +- BlockState.StateImplementation stateimplementation = new BlockState.StateImplementation(blockIn, ImmutableMap.copyOf(map), null); ++ BlockState.StateImplementation stateimplementation = createState(blockIn, ImmutableMap.copyOf(map), unlistedProperties); + linkedhashmap.put(map, stateimplementation); + arraylist.add(stateimplementation); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch.rej new file mode 100644 index 000000000..c574d7bf3 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch.rej @@ -0,0 +1,14 @@ +++++ REJECTED PATCH 2 + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + this.mc.fontRendererObj.drawStringWithShadow(this.currentlyDisplayedText, (float)((l - this.mc.fontRendererObj.getStringWidth(this.currentlyDisplayedText)) / 2), (float)(i1 / 2 - 4 - 16), 16777215); + this.mc.fontRendererObj.drawStringWithShadow(this.message, (float)((l - this.mc.fontRendererObj.getStringWidth(this.message)) / 2), (float)(i1 / 2 - 4 + 8), 16777215); ++ } ++ } ++ catch (java.io.IOException e) ++ { ++ com.google.common.base.Throwables.propagate(e); ++ } //FML End + this.framebuffer.unbindFramebuffer(); + + if (OpenGlHelper.isFramebufferEnabled()) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/Minecraft.java.patch.rej b/rejects/minecraft/net/minecraft/client/Minecraft.java.patch.rej new file mode 100644 index 000000000..77b54313d --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/Minecraft.java.patch.rej @@ -0,0 +1,240 @@ +++++ REJECTED PATCH 9 + { + while (!this.scheduledTasks.isEmpty()) + { +- ((FutureTask)this.scheduledTasks.poll()).run(); ++ net.minecraftforge.fml.common.FMLCommonHandler.callFuture(((FutureTask)this.scheduledTasks.poll())); + } + } + +++++ END PATCH +++++ REJECTED PATCH 10 + + if (!this.skipRenderWorld) + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickStart(this.timer.renderPartialTicks); + this.mcProfiler.endStartSection("gameRenderer"); + this.entityRenderer.updateCameraAndRender(this.timer.renderPartialTicks); + this.mcProfiler.endSection(); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickEnd(this.timer.renderPartialTicks); + } + + this.mcProfiler.endSection(); +++++ END PATCH +++++ REJECTED PATCH 12 + case 2: + BlockPos blockpos = this.objectMouseOver.getBlockPos(); + +- if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air) ++ if (!this.theWorld.isAirBlock(blockpos)) + { + int i = itemstack != null ? itemstack.stackSize : 0; + ++ ++ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, this.theWorld, blockpos, this.objectMouseOver.sideHit).isCanceled(); ++ if (result) { //Forge: Kept separate to simplify patch + if (this.playerController.func_178890_a(this.thePlayer, this.theWorld, itemstack, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec)) + { + flag = false; + this.thePlayer.swingItem(); + } ++ } + + if (itemstack == null) + { +++++ END PATCH +++++ REJECTED PATCH 13 + { + ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem(); + +- if (itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) ++ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, theWorld, null, null).isCanceled(); ++ if (result && itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) + { + this.entityRenderer.itemRenderer.resetEquippedProgress2(); + } +++++ END PATCH +++++ REJECTED PATCH 15 + + while (Mouse.next()) + { ++ if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue; ++ + i = Mouse.getEventButton(); + KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState()); + +++++ END PATCH +++++ REJECTED PATCH 19 + + while (!this.theIntegratedServer.serverIsInRunLoop()) + { ++ if (!net.minecraftforge.fml.common.StartupQuery.check()) ++ { ++ loadWorld(null); ++ displayGuiScreen(null); ++ return; ++ } + String s2 = this.theIntegratedServer.getUserMessage(); + + if (s2 != null) +++++ END PATCH +++++ REJECTED PATCH 24 + if (this.objectMouseOver != null) + { + boolean flag = this.thePlayer.capabilities.isCreativeMode; +- int i = 0; +- boolean flag1 = false; +- TileEntity tileentity = null; +- Object object; + +- if (this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) +- { +- BlockPos blockpos = this.objectMouseOver.getBlockPos(); +- Block block = this.theWorld.getBlockState(blockpos).getBlock(); +- +- if (block.getMaterial() == Material.air) +- { +- return; +- } +- +- object = block.getItem(this.theWorld, blockpos); +- +- if (object == null) +- { +- return; +- } +- +- if (flag && GuiScreen.isCtrlKeyDown()) +- { +- tileentity = this.theWorld.getTileEntity(blockpos); +- } +- +- Block block1 = object instanceof ItemBlock && !block.isFlowerPot() ? Block.getBlockFromItem((Item)object) : block; +- i = block1.getDamageValue(this.theWorld, blockpos); +- flag1 = ((Item)object).getHasSubtypes(); +- } +- else +- { +- if (this.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !flag) +- { +- return; +- } +- +- if (this.objectMouseOver.entityHit instanceof EntityPainting) +- { +- object = Items.painting; +- } +- else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot) +- { +- object = Items.lead; +- } +- else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) +- { +- EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit; +- ItemStack itemstack = entityitemframe.getDisplayedItem(); +- +- if (itemstack == null) +- { +- object = Items.item_frame; +- } +- else +- { +- object = itemstack.getItem(); +- i = itemstack.getMetadata(); +- flag1 = true; +- } +- } +- else if (this.objectMouseOver.entityHit instanceof EntityMinecart) +- { +- EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit; +- +- switch (Minecraft.SwitchEnumMinecartType.field_178901_b[entityminecart.getMinecartType().ordinal()]) +- { +- case 1: +- object = Items.furnace_minecart; +- break; +- case 2: +- object = Items.chest_minecart; +- break; +- case 3: +- object = Items.tnt_minecart; +- break; +- case 4: +- object = Items.hopper_minecart; +- break; +- case 5: +- object = Items.command_block_minecart; +- break; +- default: +- object = Items.minecart; +- } +- } +- else if (this.objectMouseOver.entityHit instanceof EntityBoat) +- { +- object = Items.boat; +- } +- else if (this.objectMouseOver.entityHit instanceof EntityArmorStand) +- { +- object = Items.armor_stand; +- } +- else +- { +- object = Items.spawn_egg; +- i = EntityList.getEntityID(this.objectMouseOver.entityHit); +- flag1 = true; +- +- if (!EntityList.entityEggs.containsKey(Integer.valueOf(i))) +- { +- return; +- } +- } +- } +- + InventoryPlayer inventoryplayer = this.thePlayer.inventory; + +- if (tileentity == null) +- { +- inventoryplayer.setCurrentItem((Item)object, i, flag1, flag); +- } +- else +- { +- NBTTagCompound nbttagcompound1 = new NBTTagCompound(); +- tileentity.writeToNBT(nbttagcompound1); +- ItemStack itemstack1 = new ItemStack((Item)object, 1, i); +- itemstack1.setTagInfo("BlockEntityTag", nbttagcompound1); +- NBTTagCompound nbttagcompound = new NBTTagCompound(); +- NBTTagList nbttaglist = new NBTTagList(); +- nbttaglist.appendTag(new NBTTagString("(+NBT)")); +- nbttagcompound.setTag("Lore", nbttaglist); +- itemstack1.setTagInfo("display", nbttagcompound); +- inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, itemstack1); +- } +- ++ if (!net.minecraftforge.common.ForgeHooks.onPickBlock(this.objectMouseOver, this.thePlayer, this.theWorld)) return; ++ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions + if (flag) + { + int j = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + inventoryplayer.currentItem; +++++ END PATCH +++++ REJECTED PATCH 25 + + public static int getGLMaximumTextureSize() + { +- for (int i = 16384; i > 0; i >>= 1) +- { +- GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null); +- int j = GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); +- +- if (j != 0) +- { +- return i; +- } +- } +- +- return -1; ++ //Forge we redirect this to our code which caches the value before any splash screen stuff is done. ++ return net.minecraftforge.fml.client.SplashProgress.getMaxTextureSize(); + } + + public boolean isSnooperEnabled() +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/FontRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/FontRenderer.java.patch.rej new file mode 100644 index 000000000..c45fe36d9 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/FontRenderer.java.patch.rej @@ -0,0 +1,47 @@ +++++ REJECTED PATCH 5 + float f = (float)(p_78266_1_ % 16 * 8); + float f1 = (float)(p_78266_1_ / 16 * 8); + float f2 = p_78266_2_ ? 1.0F : 0.0F; +- this.renderEngine.bindTexture(this.locationFontTexture); ++ bindTexture(this.locationFontTexture); + float f3 = (float)this.charWidth[p_78266_1_] - 0.01F; + GL11.glBegin(GL11.GL_TRIANGLE_STRIP); + GL11.glTexCoord2f(f / 128.0F, f1 / 128.0F); +++++ END PATCH +++++ REJECTED PATCH 8 + + k = this.colorCode[j]; + this.textColor = k; +- GlStateManager.color((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.alpha); ++ setColor((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.alpha); + } + else if (j == 16) + { +++++ END PATCH +++++ REJECTED PATCH 10 + j = k; + } + +- float f1 = this.unicodeFlag ? 0.5F : 1.0F; ++ float f1 = getCharWidth(c0) / 32f; + boolean flag1 = (c0 == 0 || j == -1 || this.unicodeFlag) && p_78255_2_; + + if (flag1) +++++ END PATCH +++++ REJECTED PATCH 11 + ++f; + } + ++ doDraw(f); ++ } ++ } ++ } ++ ++ protected void doDraw(float f) ++ { ++ { ++ { + Tessellator tessellator; + WorldRenderer worldrenderer; + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiButton.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiButton.java.patch.rej new file mode 100644 index 000000000..59560fdc2 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/GuiButton.java.patch.rej @@ -0,0 +1,15 @@ +++++ REJECTED PATCH 2 + this.mouseDragged(mc, mouseX, mouseY); + int l = 14737632; + +- if (!this.enabled) ++ if (packedFGColour != 0) + { ++ l = packedFGColour; ++ } ++ else if (!this.enabled) ++ { + l = 10526880; + } + else if (this.hovered) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiChat.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiChat.java.patch.rej new file mode 100644 index 000000000..632b6e243 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/GuiChat.java.patch.rej @@ -0,0 +1,15 @@ +++++ REJECTED PATCH 2 + String[] astring1 = p_146406_1_; + int i = p_146406_1_.length; + ++ String[] complete = net.minecraftforge.client.ClientCommandHandler.instance.latestAutoComplete; ++ if (complete != null) ++ { ++ astring1 = com.google.common.collect.ObjectArrays.concat(complete, astring1, String.class); ++ i = astring1.length; ++ } ++ + for (int j = 0; j < i; ++j) + { + String s = astring1[j]; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch.rej new file mode 100644 index 000000000..2cfa568ec --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + } + } + ++ WorldType.worldTypes[this.selectedIndex].onGUICreateWorldPress(); ++ + WorldSettings.GameType gametype = WorldSettings.GameType.getByName(this.field_146342_r); + WorldSettings worldsettings = new WorldSettings(i, gametype, this.field_146341_s, this.field_146337_w, WorldType.worldTypes[this.selectedIndex]); + worldsettings.setWorldName(this.chunkProviderSettingsJson); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch.rej new file mode 100644 index 000000000..e8e38dc2a --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch.rej @@ -0,0 +1,12 @@ +++++ REJECTED PATCH 1 + + this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 24 + b0, I18n.format("menu.returnToGame", new Object[0]))); + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + b0, 98, 20, I18n.format("menu.options", new Object[0]))); ++ this.buttonList.add(new GuiButton(12, this.width / 2 + 2, this.height / 4 + 96 + b0, 98, 20, I18n.format("fml.menu.modoptions"))); + GuiButton guibutton; +- this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 + 2, this.height / 4 + 96 + b0, 98, 20, I18n.format("menu.shareToLan", new Object[0]))); ++ this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 - 100, this.height / 4 + 72 + b0, 200, 20, I18n.format("menu.shareToLan", new Object[0]))); + this.buttonList.add(new GuiButton(5, this.width / 2 - 100, this.height / 4 + 48 + b0, 98, 20, I18n.format("gui.achievements", new Object[0]))); + this.buttonList.add(new GuiButton(6, this.width / 2 + 2, this.height / 4 + 48 + b0, 98, 20, I18n.format("gui.stats", new Object[0]))); + guibutton.enabled = this.mc.isSingleplayer() && !this.mc.getIntegratedServer().getPublic(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiSlot.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiSlot.java.patch.rej new file mode 100644 index 000000000..79869a7b4 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/GuiSlot.java.patch.rej @@ -0,0 +1,19 @@ +++++ REJECTED PATCH 1 + GlStateManager.disableFog(); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); +- this.mc.getTextureManager().bindTexture(Gui.optionsBackground); +- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +- float f1 = 32.0F; +- worldrenderer.startDrawingQuads(); +- worldrenderer.setColorOpaque_I(2105376); +- worldrenderer.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); +- worldrenderer.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); +- worldrenderer.addVertexWithUV((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); +- worldrenderer.addVertexWithUV((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); +- tessellator.draw(); ++ this.drawContainerBackground(tessellator); + int i1 = this.left + this.width / 2 - this.getListWidth() / 2 + 2; + int j1 = this.top + 4 - (int)this.amountScrolled; + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch.rej new file mode 100644 index 000000000..3b5b99109 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch.rej @@ -0,0 +1,23 @@ +++++ REJECTED PATCH 1 + boolean flag2 = this.field_148301_e.version < 47; + boolean flag3 = flag1 || flag2; + this.field_148300_d.fontRendererObj.drawString(this.field_148301_e.serverName, x + 32 + 3, y + 1, 16777215); +- List list = this.field_148300_d.fontRendererObj.listFormattedStringToWidth(this.field_148301_e.serverMOTD, listWidth - 32 - 2); ++ List list = this.field_148300_d.fontRendererObj.listFormattedStringToWidth(net.minecraftforge.fml.client.FMLClientHandler.instance().fixDescription(this.field_148301_e.serverMOTD), listWidth - 48 - 2); + + for (int l1 = 0; l1 < Math.min(list.size(), 2); ++l1) + { +++++ END PATCH +++++ REJECTED PATCH 2 + int k2 = mouseX - x; + int l2 = mouseY - y; + ++ String tooltip = net.minecraftforge.fml.client.FMLClientHandler.instance().enhanceServerListEntry(this, this.field_148301_e, x, listWidth, y, k2, l2); ++ if (tooltip != null) ++ { ++ this.field_148303_c.func_146793_a(tooltip); ++ } else + if (k2 >= listWidth - 15 && k2 <= listWidth - 5 && l2 >= 0 && l2 <= 8) + { + this.field_148303_c.func_146793_a(s1); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch.rej new file mode 100644 index 000000000..79ff66de3 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch.rej @@ -0,0 +1,19 @@ +++++ REJECTED PATCH 1 + super(mcIn, GuiStats.this.width, GuiStats.this.height, 32, GuiStats.this.height - 64, GuiStats.this.fontRendererObj.FONT_HEIGHT * 4); + this.setShowSelectionBox(false); + Iterator iterator = EntityList.entityEggs.values().iterator(); ++ iterator = com.google.common.collect.Iterators.concat(iterator, net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().values().iterator()); + + while (iterator.hasNext()) + { +++++ END PATCH +++++ REJECTED PATCH 2 + protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int p_180791_5_, int p_180791_6_) + { + EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)this.field_148222_l.get(entryID); +- String s = I18n.format("entity." + EntityList.getStringFromID(entityegginfo.spawnedID) + ".name", new Object[0]); ++ String s = I18n.format("entity." + entityegginfo.name + ".name", new Object[0]); + int k1 = GuiStats.this.field_146546_t.readStat(entityegginfo.field_151512_d); + int l1 = GuiStats.this.field_146546_t.readStat(entityegginfo.field_151513_e); + String s1 = I18n.format("stat.entityKills", new Object[] {Integer.valueOf(k1), s}); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch.rej new file mode 100644 index 000000000..4db04b102 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch.rej @@ -0,0 +1,171 @@ +++++ REJECTED PATCH 2 + return; + } + +- if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2)) ++ if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2) && ItemStack.areItemStackTagsEqual(itemstack1, itemstack2)) //Forge: Bugfix, Compare NBT data, allow for deletion of enchanted books, MC-12770 + { + if (clickedButton == 0) + { +++++ END PATCH +++++ REJECTED PATCH 5 + { + GuiContainerCreative.ContainerCreative containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; + containercreative.itemList.clear(); ++ ++ CreativeTabs tab = CreativeTabs.creativeTabArray[selectedTabIndex]; ++ if (tab.hasSearchBar() && tab != CreativeTabs.tabAllSearch) ++ { ++ tab.displayAllReleventItems(containercreative.itemList); ++ updateFilteredItems(containercreative); ++ return; ++ } ++ + Iterator iterator = Item.itemRegistry.iterator(); + + while (iterator.hasNext()) +++++ END PATCH +++++ REJECTED PATCH 6 + item.getSubItems(item, (CreativeTabs)null, containercreative.itemList); + } + } ++ updateFilteredItems(containercreative); ++ } + ++ //split from above for custom search tabs ++ private void updateFilteredItems(GuiContainerCreative.ContainerCreative containercreative) ++ { ++ Iterator iterator; + Enchantment[] aenchantment = Enchantment.enchantmentsBookList; + int j = aenchantment.length; + ++ if (CreativeTabs.creativeTabArray[selectedTabIndex] != CreativeTabs.tabAllSearch) j = 0; //Forge: Don't add enchants to custom tabs. + for (int i = 0; i < j; ++i) + { + Enchantment enchantment = aenchantment[i]; +++++ END PATCH +++++ REJECTED PATCH 8 + { + CreativeTabs creativetabs = acreativetabs[k1]; + +- if (this.func_147049_a(creativetabs, l, i1)) ++ if (creativetabs != null && this.func_147049_a(creativetabs, l, i1)) + { + this.setCurrentCreativeTab(creativetabs); + return; +++++ END PATCH +++++ REJECTED PATCH 11 + + super.drawScreen(mouseX, mouseY, partialTicks); + CreativeTabs[] acreativetabs = CreativeTabs.creativeTabArray; +- int i2 = acreativetabs.length; ++ int start = tabPage * 10; ++ int i2 = Math.min(acreativetabs.length, ((tabPage + 1) * 10) + 2); ++ if (tabPage != 0) start += 2; ++ boolean rendered = false; + +- for (int j2 = 0; j2 < i2; ++j2) ++ for (int j2 = start; j2 < i2; ++j2) + { + CreativeTabs creativetabs = acreativetabs[j2]; + ++ if (creativetabs == null) continue; + if (this.renderCreativeInventoryHoveringText(creativetabs, mouseX, mouseY)) + { ++ rendered = true; + break; + } + } + ++ if (!rendered && renderCreativeInventoryHoveringText(CreativeTabs.tabAllSearch, mouseX, mouseY)) ++ { ++ renderCreativeInventoryHoveringText(CreativeTabs.tabInventory, mouseX, mouseY); ++ } ++ + if (this.field_147064_C != null && selectedTabIndex == CreativeTabs.tabInventory.getTabIndex() && this.isPointInRegion(this.field_147064_C.xDisplayPosition, this.field_147064_C.yDisplayPosition, 16, 16, mouseX, mouseY)) + { + this.drawCreativeTabHoveringText(I18n.format("inventory.binSlot", new Object[0]), mouseX, mouseY); + } + ++ if (maxPages != 0) ++ { ++ String page = String.format("%d / %d", tabPage + 1, maxPages + 1); ++ int width = fontRendererObj.getStringWidth(page); ++ GlStateManager.disableLighting(); ++ this.zLevel = 300.0F; ++ itemRender.zLevel = 300.0F; ++ fontRendererObj.drawString(page, guiLeft + (xSize / 2) - (width / 2), guiTop - 44, -1); ++ this.zLevel = 0.0F; ++ itemRender.zLevel = 0.0F; ++ } ++ + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableLighting(); + } +++++ END PATCH +++++ REJECTED PATCH 12 + int k = acreativetabs.length; + int l; + +- for (l = 0; l < k; ++l) ++ int start = tabPage * 10; ++ k = Math.min(acreativetabs.length, ((tabPage + 1) * 10 + 2)); ++ if (tabPage != 0) start += 2; ++ ++ for (l = start; l < k; ++l) + { + CreativeTabs creativetabs1 = acreativetabs[l]; + this.mc.getTextureManager().bindTexture(creativeInventoryTabs); + ++ if (creativetabs1 == null) continue; + if (creativetabs1.getTabIndex() != selectedTabIndex) + { + this.func_147051_a(creativetabs1); + } + } + ++ if (tabPage != 0) ++ { ++ if (creativetabs != CreativeTabs.tabAllSearch) ++ { ++ this.mc.getTextureManager().bindTexture(creativeInventoryTabs); ++ func_147051_a(CreativeTabs.tabAllSearch); ++ } ++ if (creativetabs != CreativeTabs.tabInventory) ++ { ++ this.mc.getTextureManager().bindTexture(creativeInventoryTabs); ++ func_147051_a(CreativeTabs.tabInventory); ++ } ++ } ++ + this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.getBackgroundImageName())); + this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); + this.searchField.drawTextBox(); +++++ END PATCH +++++ REJECTED PATCH 14 + + protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_) + { ++ if (p_147049_1_.getTabPage() != tabPage) ++ { ++ if (p_147049_1_ != CreativeTabs.tabAllSearch && ++ p_147049_1_ != CreativeTabs.tabInventory) ++ { ++ return false; ++ } ++ } ++ + int k = p_147049_1_.getTabColumn(); + int l = 28 * k; + byte b0 = 0; +++++ END PATCH +++++ REJECTED PATCH 15 + } + + GlStateManager.disableLighting(); ++ GlStateManager.color(1F, 1F, 1F); //Forge: Reset color in case Items change it. ++ GlStateManager.enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border. + this.drawTexturedModalRect(l, i1, j, k, 28, b0); + this.zLevel = 100.0F; + this.itemRender.zLevel = 100.0F; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch.rej b/rejects/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch.rej new file mode 100644 index 000000000..db68c865e --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch.rej @@ -0,0 +1,23 @@ +++++ REJECTED PATCH 2 + else + { + worldclient.playAuxSFX(2001, pos, Block.getStateId(iblockstate)); +- boolean flag = worldclient.setBlockToAir(pos); ++ boolean flag = block1.removedByPlayer(worldclient, pos, mc.thePlayer, false); + + if (flag) + { +++++ END PATCH +++++ REJECTED PATCH 5 + { + playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = itemstack1; + +- if (itemstack1.stackSize == 0) ++ if (itemstack1.stackSize <= 0) + { + playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = null; ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(playerIn, itemstack1); + } + + return true; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch.rej b/rejects/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch.rej new file mode 100644 index 000000000..682151693 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch.rej @@ -0,0 +1,11 @@ +++++ REJECTED PATCH 2 + public void handleSpawnExperienceOrb(S11PacketSpawnExperienceOrb packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); +- EntityXPOrb entityxporb = new EntityXPOrb(this.clientWorldController, (double)packetIn.func_148984_d(), (double)packetIn.func_148983_e(), (double)packetIn.func_148982_f(), packetIn.func_148986_g()); ++ EntityXPOrb entityxporb = new EntityXPOrb(this.clientWorldController, (double)packetIn.func_148984_d() / 32.0D, (double)packetIn.func_148983_e() / 32.0D, (double)packetIn.func_148982_f() / 32.0D, packetIn.func_148986_g()); ++ // FORGE: BugFix MC-12013 Wrong XP orb clientside spawn position + entityxporb.serverPosX = packetIn.func_148984_d(); + entityxporb.serverPosY = packetIn.func_148983_e(); + entityxporb.serverPosZ = packetIn.func_148982_f(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/network/OldServerPinger.java.patch.rej b/rejects/minecraft/net/minecraft/client/network/OldServerPinger.java.patch.rej new file mode 100644 index 000000000..0d7f4a3ed --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/network/OldServerPinger.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + server.setBase64EncodedIconData((String)null); + } + ++ net.minecraftforge.fml.client.FMLClientHandler.instance().bindServerListData(server, serverstatusresponse); + this.field_175092_e = Minecraft.getSystemTime(); + networkmanager.sendPacket(new C01PacketPing(this.field_175092_e)); + this.field_147403_d = true; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch.rej new file mode 100644 index 000000000..6b6d1c44d --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + return new ModelResourceLocation(s + "_double_slab", s1); + } + }); ++ net.minecraftforge.client.model.ModelLoader.onRegisterAllBlocks(this); + } + + @SideOnly(Side.CLIENT) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch.rej new file mode 100644 index 000000000..6113b99db --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch.rej @@ -0,0 +1,73 @@ +++++ REJECTED PATCH 1 + + if (d3 < d2 || d2 == 0.0D) + { +- if (entity1 == entity.ridingEntity) ++ if (entity1 == entity.ridingEntity && !entity.canRiderInteract()) + { + if (d2 == 0.0D) + { +++++ END PATCH +++++ REJECTED PATCH 4 + + try + { +- this.mc.currentScreen.drawScreen(l, i1, partialTicks); ++ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.mc.currentScreen, l, i1, partialTicks); + } + catch (Throwable throwable) + { +++++ END PATCH +++++ REJECTED PATCH 6 + GlStateManager.pushMatrix(); + RenderHelper.enableStandardItemLighting(); + this.mc.mcProfiler.endStartSection("entities"); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); + renderglobal.renderEntities(entity, frustum, partialTicks); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); + RenderHelper.disableStandardItemLighting(); + this.disableLightmap(); + GlStateManager.matrixMode(5888); +++++ END PATCH +++++ REJECTED PATCH 8 + entityplayer = (EntityPlayer)entity; + GlStateManager.disableAlpha(); + this.mc.mcProfiler.endStartSection("outline"); ++ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, entityplayer.getHeldItem(), partialTicks)) + renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); + GlStateManager.enableAlpha(); + } +++++ END PATCH +++++ REJECTED PATCH 9 + renderglobal.renderBlockLayer(EnumWorldBlockLayer.TRANSLUCENT, (double)partialTicks, pass, entity); + } + ++ if (!this.debugView) //Only render if render pass 0 happens as well. ++ { ++ RenderHelper.enableStandardItemLighting(); ++ this.mc.mcProfiler.endStartSection("entities"); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(1); ++ renderglobal.renderEntities(entity, frustum, partialTicks); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(-1); ++ RenderHelper.disableStandardItemLighting(); ++ } ++ + GlStateManager.shadeModel(7424); + GlStateManager.depthMask(true); + GlStateManager.enableCull(); +++++ END PATCH +++++ REJECTED PATCH 11 + + protected void renderRainSnow(float partialTicks) + { ++ net.minecraftforge.client.IRenderHandler renderer = this.mc.theWorld.provider.getWeatherRenderer(); ++ if (renderer != null) ++ { ++ renderer.render(partialTicks, this.mc.theWorld, mc); ++ return; ++ } ++ + float f1 = this.mc.theWorld.getRainStrength(partialTicks); + + if (f1 > 0.0F) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch.rej new file mode 100644 index 000000000..eb1f67330 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch.rej @@ -0,0 +1,21 @@ +++++ REJECTED PATCH 2 + + if (this.mc.thePlayer.isEntityInsideOpaqueBlock()) + { +- IBlockState iblockstate = this.mc.theWorld.getBlockState(new BlockPos(this.mc.thePlayer)); ++ BlockPos blockpos = new BlockPos(this.mc.thePlayer); ++ IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); + EntityPlayerSP entityplayersp = this.mc.thePlayer; + + for (int i = 0; i < 8; ++i) +++++ END PATCH +++++ REJECTED PATCH 3 + double d0 = entityplayersp.posX + (double)(((float)((i >> 0) % 2) - 0.5F) * entityplayersp.width * 0.8F); + double d1 = entityplayersp.posY + (double)(((float)((i >> 1) % 2) - 0.5F) * 0.1F); + double d2 = entityplayersp.posZ + (double)(((float)((i >> 2) % 2) - 0.5F) * entityplayersp.width * 0.8F); +- BlockPos blockpos = new BlockPos(d0, d1 + (double)entityplayersp.getEyeHeight(), d2); ++ blockpos = new BlockPos(d0, d1 + (double)entityplayersp.getEyeHeight(), d2); + IBlockState iblockstate1 = this.mc.theWorld.getBlockState(blockpos); + + if (iblockstate1.getBlock().isVisuallyOpaque()) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch.rej new file mode 100644 index 000000000..d5840df65 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch.rej @@ -0,0 +1,70 @@ +++++ REJECTED PATCH 2 + this.theWorld.theProfiler.startSection("prepare"); + TileEntityRendererDispatcher.instance.cacheActiveRenderInfo(this.theWorld, this.mc.getTextureManager(), this.mc.fontRendererObj, this.mc.getRenderViewEntity(), partialTicks); + this.renderManager.cacheActiveRenderInfo(this.theWorld, this.mc.fontRendererObj, this.mc.getRenderViewEntity(), this.mc.pointedEntity, this.mc.gameSettings, partialTicks); ++ if (pass == 0) // no indentation to shrink patch ++ { + this.countEntitiesTotal = 0; + this.countEntitiesRendered = 0; + this.countEntitiesHidden = 0; ++ } + Entity entity1 = this.mc.getRenderViewEntity(); + double d3 = entity1.lastTickPosX + (entity1.posX - entity1.lastTickPosX) * (double)partialTicks; + double d4 = entity1.lastTickPosY + (entity1.posY - entity1.lastTickPosY) * (double)partialTicks; +++++ END PATCH +++++ REJECTED PATCH 3 + this.mc.entityRenderer.enableLightmap(); + this.theWorld.theProfiler.endStartSection("global"); + List list = this.theWorld.getLoadedEntityList(); ++ if (pass == 0) // no indentation to shrink patch ++ { + this.countEntitiesTotal = list.size(); ++ } + int i; + Entity entity2; + + for (i = 0; i < this.theWorld.weatherEffects.size(); ++i) + { + entity2 = (Entity)this.theWorld.weatherEffects.get(i); ++ if (!entity2.shouldRenderInPass(pass)) continue; + ++this.countEntitiesRendered; + + if (entity2.isInRangeToRender3d(d0, d1, d2)) +++++ END PATCH +++++ REJECTED PATCH 4 + for (i = 0; i < list.size(); ++i) + { + entity2 = (Entity)list.get(i); ++ if (!entity2.shouldRenderInPass(pass)) continue; + boolean flag = this.mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping(); + boolean flag1 = entity2.isInRangeToRender3d(d0, d1, d2) && (entity2.ignoreFrustumCheck || p_180446_2_.isBoundingBoxInFrustum(entity2.getEntityBoundingBox()) || entity2.riddenByEntity == this.mc.thePlayer) && entity2 instanceof EntityPlayer; + +++++ END PATCH +++++ REJECTED PATCH 5 + while (iterator2.hasNext()) + { + Entity entity3 = (Entity)iterator2.next(); ++ if (!entity3.shouldRenderInPass(pass)) continue; + boolean flag2 = this.renderManager.shouldRender(entity3, p_180446_2_, d0, d1, d2) || entity3.riddenByEntity == this.mc.thePlayer; + + if (flag2) +++++ END PATCH +++++ REJECTED PATCH 6 + while (iterator1.hasNext()) + { + tileentity = (TileEntity)iterator1.next(); ++ if (!tileentity.shouldRenderInPass(pass) || !p_180446_2_.isBoundingBoxInFrustum(tileentity.getRenderBoundingBox())) continue; + TileEntityRendererDispatcher.instance.renderTileEntity(tileentity, partialTicks, -1); + } + } +++++ END PATCH +++++ REJECTED PATCH 7 + + Block block = this.theWorld.getBlockState(blockpos).getBlock(); + +- if (tileentity != null && (block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull)) ++ if (tileentity != null && tileentity.shouldRenderInPass(pass) && tileentity.canRenderBreaking() && p_180446_2_.isBoundingBoxInFrustum(tileentity.getRenderBoundingBox())) + { + TileEntityRendererDispatcher.instance.renderTileEntity(tileentity, partialTicks, destroyblockprogress.getPartialBlockDamage()); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch.rej new file mode 100644 index 000000000..0d3d3d9fa --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch.rej @@ -0,0 +1,70 @@ +++++ REJECTED PATCH 1 + + while (iterator.hasNext()) + { ++ // moved to VertexFormatElement.preDraw + vertexformatelement = (VertexFormatElement)iterator.next(); +- enumusage = vertexformatelement.getUsage(); +- k = vertexformatelement.getType().getGlConstant(); +- int l = vertexformatelement.getIndex(); +- +- switch (WorldVertexBufferUploader.SwitchEnumUsage.VALUES[enumusage.ordinal()]) +- { +- case 1: +- bytebuffer.position(vertexformatelement.getOffset()); +- GL11.glVertexPointer(vertexformatelement.getElementCount(), k, j, bytebuffer); +- GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); +- break; +- case 2: +- bytebuffer.position(vertexformatelement.getOffset()); +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + l); +- GL11.glTexCoordPointer(vertexformatelement.getElementCount(), k, j, bytebuffer); +- GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); +- break; +- case 3: +- bytebuffer.position(vertexformatelement.getOffset()); +- GL11.glColorPointer(vertexformatelement.getElementCount(), k, j, bytebuffer); +- GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); +- break; +- case 4: +- bytebuffer.position(vertexformatelement.getOffset()); +- GL11.glNormalPointer(k, j, bytebuffer); +- GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY); +- } ++ vertexformatelement.getUsage().preDraw(vertexformatelement, j, bytebuffer); + } + + GL11.glDrawArrays(p_178177_1_.getDrawMode(), 0, p_178177_1_.getVertexCount()); +++++ END PATCH +++++ REJECTED PATCH 2 + + while (iterator.hasNext()) + { ++ // moved to VertexFormatElement.postDraw + vertexformatelement = (VertexFormatElement)iterator.next(); +- enumusage = vertexformatelement.getUsage(); +- k = vertexformatelement.getIndex(); +- +- switch (WorldVertexBufferUploader.SwitchEnumUsage.VALUES[enumusage.ordinal()]) +- { +- case 1: +- GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); +- break; +- case 2: +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + k); +- GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); +- break; +- case 3: +- GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); +- GlStateManager.resetColor(); +- break; +- case 4: +- GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); +- } ++ vertexformatelement.getUsage().postDraw(vertexformatelement, j, bytebuffer); + } + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch.rej new file mode 100644 index 000000000..a93e37504 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch.rej @@ -0,0 +1,57 @@ +++++ REJECTED PATCH 2 + this.func_178408_a(aint, enumfacing1); + } + ++ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing1); + return new BakedQuad(aint, face.tintIndex, enumfacing1); + } + + private int[] makeQuadVertexData(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, ModelRotation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean shade) + { ++ return makeQuadVertexData(p_178405_1_, p_178405_2_, p_178405_3_, p_178405_4_, (net.minecraftforge.client.model.ITransformation)p_178405_5_, p_178405_6_, p_178405_7_, shade); ++ } ++ ++ private int[] makeQuadVertexData(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, net.minecraftforge.client.model.ITransformation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean shade) ++ { + int[] aint = new int[28]; + + for (int i = 0; i < 4; ++i) +++++ END PATCH +++++ REJECTED PATCH 3 + + private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) + { +- EnumFacing enumfacing1 = modelRotationIn.rotateFace(facing); ++ fillVertexData(faceData, vertexIndex, facing, partFace, p_178402_5_, sprite, (net.minecraftforge.client.model.ITransformation)modelRotationIn, partRotation, uvLocked, shade); ++ } ++ ++ private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) ++ { ++ EnumFacing enumfacing1 = modelRotationIn.rotate(facing); + int j = shade ? this.getFaceShadeColor(enumfacing1) : -1; + EnumFaceDirection.VertexInformation vertexinformation = EnumFaceDirection.getFacing(facing).func_179025_a(vertexIndex); + Vector3d vector3d = new Vector3d((double)p_178402_5_[vertexinformation.field_179184_a], (double)p_178402_5_[vertexinformation.field_179182_b], (double)p_178402_5_[vertexinformation.field_179183_c]); +++++ END PATCH +++++ REJECTED PATCH 4 + + public int rotateVertex(Vector3d position, EnumFacing facing, int vertexIndex, ModelRotation modelRotationIn, boolean uvLocked) + { ++ return rotateVertex(position, facing, vertexIndex, (net.minecraftforge.client.model.ITransformation)modelRotationIn, uvLocked); ++ } ++ ++ public int rotateVertex(Vector3d position, EnumFacing facing, int vertexIndex, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) ++ { + if (modelRotationIn == ModelRotation.X0_Y0) + { + return vertexIndex; + } + else + { +- this.rotateScale(position, new Vector3d(0.5D, 0.5D, 0.5D), modelRotationIn.getMatrix4d(), new Vector3d(1.0D, 1.0D, 1.0D)); +- return modelRotationIn.rotateVertex(facing, vertexIndex); ++ net.minecraftforge.client.ForgeHooksClient.transform(position, modelRotationIn.getMatrix()); ++ return modelRotationIn.rotate(facing, vertexIndex); + } + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch.rej new file mode 100644 index 000000000..c1c645ac6 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + } + else + { +- s = this.property.getName((Comparable)linkedhashmap.remove(this.property)); ++ s = String.format("%s:%s", ((ResourceLocation)Block.blockRegistry.getNameForObject(p_178132_1_.getBlock())).getResourceDomain(), this.property.getName((Comparable)linkedhashmap.remove(this.property))); + } + + if (this.suffix != null) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch.rej new file mode 100644 index 000000000..73ee667f8 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch.rej @@ -0,0 +1,22 @@ +++++ REJECTED PATCH 1 + return; + } + +- regionrendercache = new RegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1); ++ regionrendercache = createRegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1); + p_178581_4_.setCompiledChunk(compiledchunk); + } + finally +++++ END PATCH +++++ REJECTED PATCH 3 + } + } + +- EnumWorldBlockLayer enumworldblocklayer1 = block.getBlockLayer(); ++ for(EnumWorldBlockLayer enumworldblocklayer1 : EnumWorldBlockLayer.values()) { ++ if(!block.canRenderInLayer(enumworldblocklayer1)) continue; ++ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(enumworldblocklayer1); + int i = enumworldblocklayer1.ordinal(); + + if (block.getRenderType() != -1) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch.rej new file mode 100644 index 000000000..06899dd6e --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch.rej @@ -0,0 +1,26 @@ +++++ REJECTED PATCH 1 + boolean flag = p_177077_9_.isGui3d(); + int i = this.func_177078_a(itemstack); + float f1 = 0.25F; +- float f2 = MathHelper.sin(((float)p_177077_1_.getAge() + p_177077_8_) / 10.0F + p_177077_1_.hoverStart) * 0.1F + 0.1F; ++ float f2 = shouldBob() ? MathHelper.sin(((float)p_177077_1_.getAge() + p_177077_8_) / 10.0F + p_177077_1_.hoverStart) * 0.1F + 0.1F : 0.0F; + GlStateManager.translate((float)p_177077_2_, (float)p_177077_4_ + f2 + 0.25F, (float)p_177077_6_); + float f3; + +++++ END PATCH +++++ REJECTED PATCH 2 + } + else + { ++ // Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug... ++ if (j > 0 && shouldSpreadItems()) ++ { ++ float f2 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; ++ float f3 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; ++ float f4 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; ++ GlStateManager.translate(f2, f3, 0); ++ } + this.field_177080_a.renderItem(itemstack, ibakedmodel); + GlStateManager.translate(0.0F, 0.0F, 0.046875F); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch.rej new file mode 100644 index 000000000..4bf581bd0 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch.rej @@ -0,0 +1,113 @@ +++++ REJECTED PATCH 2 + BakedQuad bakedquad; + int j; + +- for (Iterator iterator = quads.iterator(); iterator.hasNext(); this.renderQuad(renderer, bakedquad, j)) ++ for (Iterator iterator = quads.iterator(); iterator.hasNext(); net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(renderer, bakedquad, j)) + { + bakedquad = (BakedQuad)iterator.next(); + j = color; +++++ END PATCH +++++ REJECTED PATCH 4 + + protected void applyTransform(ItemTransformVec3f transform) + { ++ applyVanillaTransform(transform); ++ } ++ ++ public static void applyVanillaTransform(ItemTransformVec3f transform) ++ { + if (transform != ItemTransformVec3f.DEFAULT) + { + GlStateManager.translate(transform.translation.x + debugItemOffsetX, transform.translation.y + debugItemOffsetY, transform.translation.z + debugItemOffsetZ); +++++ END PATCH +++++ REJECTED PATCH 5 + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.pushMatrix(); + +- switch (RenderItem.SwitchTransformType.TRANSFORM_LOOKUP[cameraTransformType.ordinal()]) +- { +- case 1: +- default: +- break; +- case 2: +- this.applyTransform(model.getItemCameraTransforms().thirdPerson); +- break; +- case 3: +- this.applyTransform(model.getItemCameraTransforms().firstPerson); +- break; +- case 4: +- this.applyTransform(model.getItemCameraTransforms().head); +- break; +- case 5: +- this.applyTransform(model.getItemCameraTransforms().gui); +- } ++ model = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(model, cameraTransformType); + + this.renderItem(stack, model); + GlStateManager.popMatrix(); +++++ END PATCH +++++ REJECTED PATCH 6 + GlStateManager.blendFunc(770, 771); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.setupGuiTransform(x, y, ibakedmodel.isGui3d()); +- this.applyTransform(ibakedmodel.getItemCameraTransforms().gui); ++ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GUI); + this.renderItem(stack, ibakedmodel); + GlStateManager.disableAlpha(); + GlStateManager.disableRescaleNormal(); +++++ END PATCH +++++ REJECTED PATCH 7 + GlStateManager.enableDepth(); + } + +- if (stack.isItemDamaged()) ++ if (stack.getItem().showDurabilityBar(stack)) + { +- int j1 = (int)Math.round(13.0D - (double)stack.getItemDamage() * 13.0D / (double)stack.getMaxDamage()); +- int k = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage()); ++ double health = stack.getItem().getDurabilityForDisplay(stack); ++ int j1 = (int)Math.round(13.0D - health * 13.0D); ++ int k = (int)Math.round(255.0D - health * 255.0D); + GlStateManager.disableLighting(); + GlStateManager.disableDepth(); + GlStateManager.disableTexture2D(); +++++ END PATCH +++++ REJECTED PATCH 8 + this.drawRect(worldrenderer, xPosition + 2, yPosition + 13, 13, 2, 0); + this.drawRect(worldrenderer, xPosition + 2, yPosition + 13, 12, 1, i1); + this.drawRect(worldrenderer, xPosition + 2, yPosition + 13, j1, 1, l); +- GlStateManager.enableBlend(); ++ //GlStateManager.enableBlend(); // Forge: Disable Bled because it screws with a lot of things down the line. + GlStateManager.enableAlpha(); + GlStateManager.enableTexture2D(); + GlStateManager.enableLighting(); +++++ END PATCH +++++ REJECTED PATCH 9 + this.registerBlock(Blocks.brown_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "brown_mushroom_block"); + this.registerBlock(Blocks.red_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "red_mushroom_block"); + this.registerBlock(Blocks.dragon_egg, "dragon_egg"); ++ net.minecraftforge.client.model.ModelLoader.onRegisterItems(this.itemModelMesher); + } + + public void onResourceManagerReload(IResourceManager resourceManager) + { + this.itemModelMesher.rebuildCache(); + } ++ /*==================================== FORGE START ===========================================* / ++ private static RenderItem instance; ++ /** ++ * Returns a single lazy loaded instance of RenderItem, for use in mods who ++ * don't care about the interaction of other objects on the current state of the RenderItem they are using. ++ * @return A global instance of RenderItem ++ * / ++ public static RenderItem getInstance() ++ { ++ if (instance == null) instance = new RenderItem(); ++ return instance; ++ } ++ /*==================================== FORGE END =============================================*/ + + @SideOnly(Side.CLIENT) + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch.rej new file mode 100644 index 000000000..1cd962de4 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + + public void func_180596_a(AbstractClientPlayer p_180596_1_, double p_180596_2_, double p_180596_4_, double p_180596_6_, float p_180596_8_, float p_180596_9_) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(p_180596_1_, this, p_180596_9_, p_180596_2_, p_180596_4_, p_180596_6_))) return; + if (!p_180596_1_.isUser() || this.renderManager.livingPlayer == p_180596_1_) + { + double d3 = p_180596_4_; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch.rej new file mode 100644 index 000000000..6d8c9bea4 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch.rej @@ -0,0 +1,14 @@ +++++ REJECTED PATCH 4 + + public void passSpecialRender(EntityLivingBase p_77033_1_, double p_77033_2_, double p_77033_4_, double p_77033_6_) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre(p_77033_1_, this, p_77033_2_, p_77033_4_, p_77033_6_))) return; + if (this.canRenderName(p_77033_1_)) + { + double d3 = p_77033_1_.getDistanceSqToEntity(this.renderManager.livingPlayer); +- float f = p_77033_1_.isSneaking() ? 32.0F : 64.0F; ++ float f = p_77033_1_.isSneaking() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE; + + if (d3 < (double)(f * f)) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch.rej new file mode 100644 index 000000000..e50d4cdfc --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch.rej @@ -0,0 +1,88 @@ +++++ REJECTED PATCH 1 + ModelBase modelbase = this.func_177175_a(p_177182_9_); + modelbase.setModelAttributes(this.field_177190_a.getMainModel()); + modelbase.setLivingAnimations(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_4_); ++ modelbase = net.minecraftforge.client.ForgeHooksClient.getArmorModel(p_177182_1_, itemstack, p_177182_9_, modelbase); + this.func_177179_a(modelbase, p_177182_9_); + boolean flag = this.func_177180_b(p_177182_9_); +- this.field_177190_a.bindTexture(this.getArmorResource(itemarmor, flag)); ++ this.field_177190_a.bindTexture(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, null)); + +- switch (LayerArmorBase.SwitchArmorMaterial.field_178747_a[itemarmor.getArmorMaterial().ordinal()]) + { +- case 1: +- int j = itemarmor.getColor(itemstack); ++ int j = itemarmor.getColor(itemstack); ++ if (j != -1) //Allow this for anything, not only cloth. ++ { + float f7 = (float)(j >> 16 & 255) / 255.0F; + float f8 = (float)(j >> 8 & 255) / 255.0F; + float f9 = (float)(j & 255) / 255.0F; + GlStateManager.color(this.field_177184_f * f7, this.field_177185_g * f8, this.field_177192_h * f9, this.field_177187_e); + modelbase.render(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); +- this.field_177190_a.bindTexture(this.getArmorResource(itemarmor, flag, "overlay")); +- case 2: +- case 3: +- case 4: +- case 5: ++ this.field_177190_a.bindTexture(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, "overlay")); ++ } ++ { // Non-cloth + GlStateManager.color(this.field_177184_f, this.field_177185_g, this.field_177192_h, this.field_177187_e); + modelbase.render(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); +- default: ++ } ++ { // Default, Why is this a switch? there were no breaks. + if (!this.field_177193_i && itemstack.isItemEnchanted()) + { + this.func_177183_a(p_177182_1_, modelbase, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); + } ++ } + } + } + } +++++ END PATCH +++++ REJECTED PATCH 3 + + protected abstract void func_177179_a(ModelBase p_177179_1_, int p_177179_2_); + ++ /*=================================== FORGE START =========================================*/ ++ /** ++ * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide. ++ * ++ * @param entity Entity wearing the armor ++ * @param stack ItemStack for the armor ++ * @param slot Slot ID that the item is in ++ * @param type Subtype, can be null or "overlay" ++ * @return ResourceLocation pointing at the armor's texture ++ */ ++ public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, int slot, String type) ++ { ++ ItemArmor item = (ItemArmor)stack.getItem(); ++ String texture = ((ItemArmor)stack.getItem()).getArmorMaterial().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, (slot == 2 ? 2 : 1), type == null ? "" : String.format("_%s", type)); ++ ++ s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type); ++ ResourceLocation resourcelocation = (ResourceLocation)field_177191_j.get(s1); ++ ++ if (resourcelocation == null) ++ { ++ resourcelocation = new ResourceLocation(s1); ++ field_177191_j.put(s1, resourcelocation); ++ } ++ ++ return resourcelocation; ++ } ++ /*=================================== FORGE END ===========================================*/ ++ + @SideOnly(Side.CLIENT) + + static final class SwitchArmorMaterial +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch.rej new file mode 100644 index 000000000..6f2b2d715 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch.rej @@ -0,0 +1,25 @@ +++++ REJECTED PATCH 1 + public void doStitch() + { + Stitcher.Holder[] aholder = (Stitcher.Holder[])this.setStitchHolders.toArray(new Stitcher.Holder[this.setStitchHolders.size()]); ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", aholder.length); + Arrays.sort(aholder); + Stitcher.Holder[] aholder1 = aholder; + int i = aholder.length; +++++ END PATCH +++++ REJECTED PATCH 2 + for (int j = 0; j < i; ++j) + { + Stitcher.Holder holder = aholder1[j]; ++ bar.step(holder.getAtlasSprite().getIconName()); + + if (!this.allocateSlot(holder)) + { + String s = String.format("Unable to fit: %s - size: %dx%d - Maybe try a lowerresolution resourcepack?", new Object[] {holder.getAtlasSprite().getIconName(), Integer.valueOf(holder.getAtlasSprite().getIconWidth()), Integer.valueOf(holder.getAtlasSprite().getIconHeight())}); ++ net.minecraftforge.fml.common.FMLLog.info(s); ++ for (Stitcher.Holder h : aholder) ++ net.minecraftforge.fml.common.FMLLog.info(" %s", h); + throw new StitcherException(holder, s); + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch.rej new file mode 100644 index 000000000..9d314e062 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch.rej @@ -0,0 +1,17 @@ +++++ REJECTED PATCH 1 + + public void onResourceManagerReload(IResourceManager resourceManager) + { ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Reloading Texture Manager", this.mapTextureObjects.keySet().size(), true); + Iterator iterator = this.mapTextureObjects.entrySet().iterator(); + + while (iterator.hasNext()) + { + Entry entry = (Entry)iterator.next(); ++ bar.step(entry.getKey().toString()); + this.loadTexture((ResourceLocation)entry.getKey(), (ITextureObject)entry.getValue()); + } ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch.rej new file mode 100644 index 000000000..05280aa76 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch.rej @@ -0,0 +1,118 @@ +++++ REJECTED PATCH 3 + + public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn) + { ++ this(p_i46100_1_, iconCreatorIn, false); ++ } ++ ++ public TextureMap(String p_i46100_1_, boolean skipFirst) ++ { ++ this(p_i46100_1_, null, skipFirst); ++ } ++ ++ public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn, boolean skipFirst) ++ { + this.listAnimatedSprites = Lists.newArrayList(); + this.mapRegisteredSprites = Maps.newHashMap(); + this.mapUploadedSprites = Maps.newHashMap(); + this.missingImage = new TextureAtlasSprite("missingno"); + this.basePath = p_i46100_1_; + this.iconCreator = iconCreatorIn; ++ this.skipFirst = skipFirst && ENABLE_SKIP; + } + + private void initMissingImage() +++++ END PATCH +++++ REJECTED PATCH 4 + this.listAnimatedSprites.clear(); + int j = Integer.MAX_VALUE; + int k = 1 << this.mipmapLevels; ++ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(this); ++ net.minecraftforge.fml.common.FMLLog.info("Max texture size: %d", i); ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", skipFirst ? 0 : this.mapRegisteredSprites.size()); + Iterator iterator = this.mapRegisteredSprites.entrySet().iterator(); + +- while (iterator.hasNext()) ++ while (!skipFirst && iterator.hasNext()) + { + Entry entry = (Entry)iterator.next(); + TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue(); + ResourceLocation resourcelocation = new ResourceLocation(textureatlassprite.getIconName()); + ResourceLocation resourcelocation1 = this.completeResourceLocation(resourcelocation, 0); ++ bar.step(resourcelocation1.getResourcePath()); + ++ if (textureatlassprite.hasCustomLoader(resourceManager, resourcelocation)) ++ { ++ if (!textureatlassprite.load(resourceManager, resourcelocation)) ++ { ++ j = Math.min(j, Math.min(textureatlassprite.getIconWidth(), textureatlassprite.getIconHeight())); ++ stitcher.addSprite(textureatlassprite); ++ } ++ continue; ++ } ++ + try + { + IResource iresource = resourceManager.getResource(resourcelocation1); +++++ END PATCH +++++ REJECTED PATCH 5 + } + catch (RuntimeException runtimeexception) + { +- logger.error("Unable to parse metadata from " + resourcelocation1, runtimeexception); ++ //logger.error("Unable to parse metadata from " + resourcelocation1, runtimeexception); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().trackBrokenTexture(resourcelocation1, runtimeexception.getMessage()); + continue; + } + catch (IOException ioexception1) + { +- logger.error("Using missing texture, unable to load " + resourcelocation1, ioexception1); ++ //logger.error("Using missing texture, unable to load " + resourcelocation1, ioexception1); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().trackMissingTexture(resourcelocation1); + continue; + } + +++++ END PATCH +++++ REJECTED PATCH 7 + } + + Iterator iterator1 = this.mapRegisteredSprites.values().iterator(); ++ bar = net.minecraftforge.fml.common.ProgressManager.push("Mipmap generation", skipFirst ? 0 : this.mapRegisteredSprites.size()); + +- while (iterator1.hasNext()) ++ while (!skipFirst && iterator1.hasNext()) + { + final TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)iterator1.next(); ++ bar.step(textureatlassprite1.getIconName()); + + try + { +++++ END PATCH +++++ REJECTED PATCH 9 + } + + logger.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.getCurrentWidth()), Integer.valueOf(stitcher.getCurrentHeight()), this.basePath}); ++ bar.step("Allocating GL texture"); + TextureUtil.allocateTextureImpl(this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); + HashMap hashmap = Maps.newHashMap(this.mapRegisteredSprites); + Iterator iterator2 = stitcher.getStichSlots().iterator(); + TextureAtlasSprite textureatlassprite2; + ++ bar.step("Uploading GL texture"); + while (iterator2.hasNext()) + { + textureatlassprite2 = (TextureAtlasSprite)iterator2.next(); +++++ END PATCH +++++ REJECTED PATCH 10 + textureatlassprite2.copyFrom(this.missingImage); + } + ++ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this); ++ ++ if (!net.minecraftforge.common.ForgeModContainer.disableStitchedFileSaving) + TextureUtil.saveGlTexture(this.basePath.replaceAll("/", "_"), this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); + } + + private ResourceLocation completeResourceLocation(ResourceLocation location, int p_147634_2_) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch.rej new file mode 100644 index 000000000..3bb0ba7b2 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch.rej @@ -0,0 +1,49 @@ +++++ REJECTED PATCH 1 + @SideOnly(Side.CLIENT) + public static enum EnumType + { +- FLOAT(4, "Float", 5126), +- UBYTE(1, "Unsigned Byte", 5121), +- BYTE(1, "Byte", 5120), +- USHORT(2, "Unsigned Short", 5123), +- SHORT(2, "Short", 5122), +- UINT(4, "Unsigned Int", 5125), +- INT(4, "Int", 5124); ++ FLOAT(4, "Float", org.lwjgl.opengl.GL11.GL_FLOAT), ++ UBYTE(1, "Unsigned Byte", org.lwjgl.opengl.GL11.GL_UNSIGNED_BYTE), ++ BYTE(1, "Byte", org.lwjgl.opengl.GL11.GL_BYTE), ++ USHORT(2, "Unsigned Short", org.lwjgl.opengl.GL11.GL_UNSIGNED_SHORT), ++ SHORT(2, "Short", org.lwjgl.opengl.GL11.GL_SHORT), ++ UINT(4, "Unsigned Int", org.lwjgl.opengl.GL11.GL_UNSIGNED_INT), ++ INT(4, "Int", org.lwjgl.opengl.GL11.GL_INT); ++ // Commented for now, might be added in the future if anyone needs them ++ //HALF_FLOAT(2, "Half Float", org.lwjgl.opengl.GL30.GL_HALF_FLOAT), ++ //DOUBLE(8, "Double", org.lwjgl.opengl.GL11.GL_DOUBLE), ++ //INT_2_10_10_10_REV(4, "Int 2-10-10-10 reversed", org.lwjgl.opengl.GL33.GL_INT_2_10_10_10_REV), ++ //UINT_2_10_10_10_REV(4, "Unsigned Int 2-10-10-10 reversed", org.lwjgl.opengl.GL12.GL_UNSIGNED_INT_2_10_10_10_REV), ++ //UINT_10F_11F_11F_REV(4, "Unsigned Int 10F 11F 11F reversed", GL_UNSIGNED_INT_10F_11F_11F_REV); ++ + private final int size; + private final String displayName; + private final int glConstant; +++++ END PATCH +++++ REJECTED PATCH 2 + NORMAL("Normal"), + COLOR("Vertex Color"), + UV("UV"), ++ // As of 1.8 - unused in vanilla; use GENERIC for now ++ @Deprecated + MATRIX("Bone Matrix"), ++ @Deprecated + BLEND_WEIGHT("Blend Weight"), +- PADDING("Padding"); ++ PADDING("Padding"), ++ GENERIC("Generic Attribute"); ++ ++ public void preDraw(VertexFormatElement element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.preDraw(this, element, stride, buffer); } ++ public void postDraw(VertexFormatElement element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.postDraw(this, element, stride, buffer); } ++ + private final String displayName; + + private static final String __OBFID = "CL_00002397"; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/resources/LanguageManager.java.patch.rej b/rejects/minecraft/net/minecraft/client/resources/LanguageManager.java.patch.rej new file mode 100644 index 000000000..5a48fdf7a --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/resources/LanguageManager.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + } + + currentLocale.loadLocaleDataFiles(resourceManager, arraylist); ++ net.minecraftforge.fml.common.registry.LanguageRegistry.instance().mergeLanguageTable(currentLocale.properties, this.currentLanguage); + StringTranslate.replaceWith(currentLocale.properties); + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/resources/Locale.java.patch.rej b/rejects/minecraft/net/minecraft/client/resources/Locale.java.patch.rej new file mode 100644 index 000000000..f93346344 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/resources/Locale.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + + private void loadLocaleData(InputStream p_135021_1_) throws IOException + { ++ p_135021_1_ = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(properties, p_135021_1_); ++ if (p_135021_1_ == null) return; + Iterator iterator = IOUtils.readLines(p_135021_1_, Charsets.UTF_8).iterator(); + + while (iterator.hasNext()) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch.rej b/rejects/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch.rej new file mode 100644 index 000000000..ba37e2416 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch.rej @@ -0,0 +1,46 @@ +++++ REJECTED PATCH 1 + public void reloadResources(List p_110541_1_) + { + this.clearResources(); ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Loading Resources", p_110541_1_.size()+1, true); + logger.info("Reloading ResourceManager: " + joinerResourcePacks.join(Iterables.transform(p_110541_1_, new Function() + { + private static final String __OBFID = "CL_00001092"; +++++ END PATCH +++++ REJECTED PATCH 2 + while (iterator.hasNext()) + { + IResourcePack iresourcepack = (IResourcePack)iterator.next(); ++ resReload.step(iresourcepack.getPackName()); + this.reloadResourcePack(iresourcepack); + } + ++ resReload.step("Reloading listeners"); + this.notifyReloadListeners(); ++ net.minecraftforge.fml.common.ProgressManager.pop(resReload); + } + + public void registerReloadListener(IResourceManagerReloadListener p_110542_1_) + { + this.reloadListeners.add(p_110542_1_); ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Loading Resource", 1); ++ resReload.step(p_110542_1_.getClass()); + p_110542_1_.onResourceManagerReload(this); ++ net.minecraftforge.fml.common.ProgressManager.pop(resReload); + } + + private void notifyReloadListeners() + { + Iterator iterator = this.reloadListeners.iterator(); + ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Reloading", this.reloadListeners.size()); + while (iterator.hasNext()) + { + IResourceManagerReloadListener iresourcemanagerreloadlistener = (IResourceManagerReloadListener)iterator.next(); ++ resReload.step(iresourcemanagerreloadlistener.getClass()); + iresourcemanagerreloadlistener.onResourceManagerReload(this); + } ++ net.minecraftforge.fml.common.ProgressManager.pop(resReload); + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/resources/SkinManager.java.patch.rej b/rejects/minecraft/net/minecraft/client/resources/SkinManager.java.patch.rej new file mode 100644 index 000000000..7dc5509d7 --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/resources/SkinManager.java.patch.rej @@ -0,0 +1,12 @@ +++++ REJECTED PATCH 1 + + if (hashmap.isEmpty() && p_152790_1_.getId().equals(Minecraft.getMinecraft().getSession().getProfile().getId())) + { +- hashmap.putAll(SkinManager.this.sessionService.getTextures(SkinManager.this.sessionService.fillProfileProperties(p_152790_1_, false), false)); ++ // FORGE: Use already filled profile from session rather ++ // than getting rate limited by filling the input profile ++ hashmap.putAll(SkinManager.this.sessionService.getTextures(Minecraft.getMinecraft().getSession().getProfile(), false)); + } + + Minecraft.getMinecraft().addScheduledTask(new Runnable() +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch.rej b/rejects/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch.rej new file mode 100644 index 000000000..76cbbcd2d --- /dev/null +++ b/rejects/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch.rej @@ -0,0 +1,17 @@ +++++ REJECTED PATCH 6 + BlockPartFace blockpartface = (BlockPartFace)blockpart.mapFaces.get(enumfacing); + TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName(blockpartface.texture))); + +- if (blockpartface.cullFace == null) ++ if (blockpartface.cullFace == null || !net.minecraftforge.client.model.TRSRTransformation.isInteger(modelRotationIn.getMatrix())) + { + builder.addGeneralQuad(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); + } + else + { +- builder.addFaceQuad(modelRotationIn.rotateFace(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); ++ builder.addFaceQuad(modelRotationIn.rotate(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); + } + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch.rej b/rejects/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch.rej new file mode 100644 index 000000000..a8730e054 --- /dev/null +++ b/rejects/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch.rej @@ -0,0 +1,21 @@ +++++ REJECTED PATCH 3 + while (iterator.hasNext()) + { + Item item = (Item)iterator.next(); ++ if (item == null) ++ { ++ continue; ++ } + +- if (item != null && item.getCreativeTab() == this) ++ for (CreativeTabs tab : item.getCreativeTabs()) + { +- item.getSubItems(item, this, p_78018_1_); ++ if (tab == this) ++ { ++ item.getSubItems(item, this, p_78018_1_); ++ } + } + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/enchantment/Enchantment.java.patch.rej b/rejects/minecraft/net/minecraft/enchantment/Enchantment.java.patch.rej new file mode 100644 index 000000000..d074e8eaa --- /dev/null +++ b/rejects/minecraft/net/minecraft/enchantment/Enchantment.java.patch.rej @@ -0,0 +1,55 @@ +++++ REJECTED PATCH 2 + + public boolean canApply(ItemStack stack) + { +- return this.type.canEnchantItem(stack.getItem()); ++ return canApplyAtEnchantingTable(stack); + } + + public void onEntityDamaged(EntityLivingBase user, Entity target, int level) {} + + public void onUserHurt(EntityLivingBase user, Entity attacker, int level) {} + ++ /** ++ * This applies specifically to applying at the enchanting table. The other method {@link #canApply(ItemStack)} ++ * applies for all possible enchantments. ++ * @param stack ++ * @return ++ */ ++ public boolean canApplyAtEnchantingTable(ItemStack stack) ++ { ++ return this.type.canEnchantItem(stack.getItem()); ++ } ++ ++ private static final java.lang.reflect.Field bookSetter = Enchantment.class.getDeclaredFields()[1]; ++ /** ++ * Add to the list of enchantments applicable by the anvil from a book ++ * ++ * @param enchantment ++ */ ++ public static void addToBookList(Enchantment enchantment) ++ { ++ try ++ { ++ net.minecraftforge.common.util.EnumHelper.setFailsafeFieldValue(bookSetter, null, ++ com.google.common.collect.ObjectArrays.concat(enchantmentsBookList, enchantment)); ++ } ++ catch (Exception e) ++ { ++ throw new RuntimeException(e); //Rethrow see what happens ++ } ++ } ++ ++ /** ++ * Is this enchantment allowed to be enchanted on books via Enchantment Table ++ * @return false to disable the vanilla feature ++ */ ++ public boolean isAllowedOnBooks() ++ { ++ return true; ++ } ++ + static + { + ArrayList var0 = Lists.newArrayList(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch.rej b/rejects/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch.rej new file mode 100644 index 000000000..974dff0f7 --- /dev/null +++ b/rejects/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch.rej @@ -0,0 +1,43 @@ +++++ REJECTED PATCH 1 + public static int calcItemStackEnchantability(Random p_77514_0_, int p_77514_1_, int p_77514_2_, ItemStack p_77514_3_) + { + Item item = p_77514_3_.getItem(); +- int k = item.getItemEnchantability(); ++ int k = item.getItemEnchantability(p_77514_3_); + + if (k <= 0) + { +++++ END PATCH +++++ REJECTED PATCH 2 + public static List buildEnchantmentList(Random p_77513_0_, ItemStack p_77513_1_, int p_77513_2_) + { + Item item = p_77513_1_.getItem(); +- int j = item.getItemEnchantability(); ++ int j = item.getItemEnchantability(p_77513_1_); + + if (j <= 0) + { +++++ END PATCH +++++ REJECTED PATCH 3 + { + EnchantmentData enchantmentdata1 = (EnchantmentData)iterator1.next(); + +- if (enchantmentdata1.enchantmentobj.canApplyTogether(Enchantment.getEnchantmentById(integer.intValue()))) ++ Enchantment e1 = enchantmentdata1.enchantmentobj; ++ Enchantment e2 = Enchantment.getEnchantmentById(integer.intValue()); ++ if (e1.canApplyTogether(e2) && e2.canApplyTogether(e1)) //Forge BugFix: Let Both enchantments veto being together + { + continue; + } +++++ END PATCH +++++ REJECTED PATCH 4 + { + Enchantment enchantment = aenchantment[k]; + +- if (enchantment != null && (enchantment.type.canEnchantItem(item) || flag)) ++ if (enchantment == null) continue; ++ if (enchantment.canApplyAtEnchantingTable(p_77505_1_) || ((item == Items.book) && enchantment.isAllowedOnBooks())) + { + for (int l = enchantment.getMinLevel(); l <= enchantment.getMaxLevel(); ++l) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/EntityList.java.patch.rej b/rejects/minecraft/net/minecraft/entity/EntityList.java.patch.rej new file mode 100644 index 000000000..84a4fc1ab --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/EntityList.java.patch.rej @@ -0,0 +1,13 @@ +++++ REJECTED PATCH 2 + p_75615_0_.removeTag("Type"); + } + ++ Class oclass = null; + try + { +- Class oclass = (Class)stringToClassMapping.get(p_75615_0_.getString("id")); ++ oclass = (Class)stringToClassMapping.get(p_75615_0_.getString("id")); + + if (oclass != null) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/EntityLivingBase.java.patch.rej b/rejects/minecraft/net/minecraft/entity/EntityLivingBase.java.patch.rej new file mode 100644 index 000000000..3399d9aee --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/EntityLivingBase.java.patch.rej @@ -0,0 +1,30 @@ +++++ REJECTED PATCH 1 + } + } + +- if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity instanceof EntityLivingBase) ++ if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity != null && ridingEntity.shouldDismountInWater(this)) + { + this.mountEntity((Entity)null); + } +++++ END PATCH +++++ REJECTED PATCH 2 + if (!this.worldObj.isRemote && (this.recentlyHit > 0 || this.isPlayer()) && this.func_146066_aG() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) + { + i = this.getExperiencePoints(this.attackingPlayer); +- ++ i = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.attackingPlayer, i); + while (i > 0) + { + int j = EntityXPOrb.getXPSplit(i); +++++ END PATCH +++++ REJECTED PATCH 5 + + public void heal(float healAmount) + { ++ healAmount = net.minecraftforge.event.ForgeEventFactory.onLivingHeal(this, healAmount); ++ if (healAmount <= 0) return; + float f1 = this.getHealth(); + + if (f1 > 0.0F) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch.rej b/rejects/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch.rej new file mode 100644 index 000000000..6ae31bd0f --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch.rej @@ -0,0 +1,16 @@ +++++ REJECTED PATCH 1 + private double field_151495_j; + private double field_151496_k; + private static final String __OBFID = "CL_00001595"; ++ private int failedPathFindingPenalty = 0; ++ private boolean canPenalize = false; + + public EntityAIAttackOnCollide(EntityCreature p_i1635_1_, Class p_i1635_2_, double p_i1635_3_, boolean p_i1635_5_) + { + this(p_i1635_1_, p_i1635_3_, p_i1635_5_); + this.classTarget = p_i1635_2_; ++ canPenalize = classTarget == null || !net.minecraft.entity.player.EntityPlayer.class.isAssignableFrom(classTarget); //Only enable delaying when not targeting players. + } + + public EntityAIAttackOnCollide(EntityCreature p_i1636_1_, double p_i1636_2_, boolean p_i1636_4_) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/boss/EntityWither.java.patch.rej b/rejects/minecraft/net/minecraft/entity/boss/EntityWither.java.patch.rej new file mode 100644 index 000000000..30937f47e --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/boss/EntityWither.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + int l = j1 + i2; + Block block = this.worldObj.getBlockState(new BlockPos(j2, k, l)).getBlock(); + +- if (block.getMaterial() != Material.air && block != Blocks.bedrock && block != Blocks.end_portal && block != Blocks.end_portal_frame && block != Blocks.command_block && block != Blocks.barrier) ++ if (!block.isAir(worldObj, new BlockPos(j2, k, l)) && block.canEntityDestroy(worldObj, new BlockPos(j2, k, l), this)) + { + flag = this.worldObj.destroyBlock(new BlockPos(j2, k, l), true) || flag; + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch.rej b/rejects/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch.rej new file mode 100644 index 000000000..a4efeca13 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch.rej @@ -0,0 +1,68 @@ +++++ REJECTED PATCH 4 + } + + this.setRotation(this.rotationYaw, this.rotationPitch); +- Iterator iterator = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D)).iterator(); ++ AxisAlignedBB box; ++ if (getCollisionHandler() != null) box = this.getCollisionHandler().getMinecartCollisionBox(this); ++ else box = this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D); ++ Iterator iterator = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, box).iterator(); + + while (iterator.hasNext()) + { +++++ END PATCH +++++ REJECTED PATCH 8 + flag1 = !flag; + } + +- double d0 = 0.0078125D; ++ double slopeAdjustment = getSlopeAdjustment(); + BlockRailBase.EnumRailDirection enumraildirection = (BlockRailBase.EnumRailDirection)p_180460_2_.getValue(blockrailbase.getShapeProperty()); + + switch (EntityMinecart.SwitchEnumMinecartType.RAIL_SHAPE_LOOKUP[enumraildirection.ordinal()]) + { + case 1: +- this.motionX -= 0.0078125D; ++ this.motionX -= slopeAdjustment; + ++this.posY; + break; + case 2: +- this.motionX += 0.0078125D; ++ this.motionX += slopeAdjustment; + ++this.posY; + break; + case 3: +- this.motionZ += 0.0078125D; ++ this.motionZ += slopeAdjustment; + ++this.posY; + break; + case 4: +- this.motionZ -= 0.0078125D; ++ this.motionZ -= slopeAdjustment; + ++this.posY; + } + +++++ END PATCH +++++ REJECTED PATCH 10 + this.posX = d7 + d1 * d6; + this.posZ = d8 + d2 * d6; + this.setPosition(this.posX, this.posY, this.posZ); +- d11 = this.motionX; +- d12 = this.motionZ; ++ this.moveMinecartOnRail(p_180460_1_); + +- if (this.riddenByEntity != null) +- { +- d11 *= 0.75D; +- d12 *= 0.75D; +- } +- +- double d13 = this.func_174898_m(); +- d11 = MathHelper.clamp_double(d11, -d13, d13); +- d12 = MathHelper.clamp_double(d12, -d13, d13); +- this.moveEntity(d11, 0.0D, d12); +- + if (aint[0][1] != 0 && MathHelper.floor_double(this.posX) - p_180460_1_.getX() == aint[0][0] && MathHelper.floor_double(this.posZ) - p_180460_1_.getZ() == aint[0][2]) + { + this.setPosition(this.posX, this.posY + (double)aint[0][1], this.posZ); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch.rej b/rejects/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch.rej new file mode 100644 index 000000000..e32f40b66 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch.rej @@ -0,0 +1,19 @@ +++++ REJECTED PATCH 1 + + protected boolean teleportTo(double p_70825_1_, double p_70825_3_, double p_70825_5_) + { ++ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, p_70825_1_, p_70825_3_, p_70825_5_, 0); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false; + double d3 = this.posX; + double d4 = this.posY; + double d5 = this.posZ; +- this.posX = p_70825_1_; +- this.posY = p_70825_3_; +- this.posZ = p_70825_5_; ++ this.posX = event.targetX; ++ this.posY = event.targetY; ++ this.posZ = event.targetZ; + boolean flag = false; + BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ); + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch.rej b/rejects/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch.rej new file mode 100644 index 000000000..ed935ae5f --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 4 + + if (p_180482_2_1 == null) + { +- p_180482_2_1 = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < 0.05F, this.worldObj.rand.nextFloat() < 0.05F, null); ++ p_180482_2_1 = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < net.minecraftforge.common.ForgeModContainer.zombieBabyChance, this.worldObj.rand.nextFloat() < 0.05F, null); + } + + if (p_180482_2_1 instanceof EntityZombie.GroupData) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch.rej b/rejects/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch.rej new file mode 100644 index 000000000..4eec41fb9 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 3 + + private void populateBuyingList() + { ++ //TODO: Hook into VillagerRegistry + EntityVillager.ITradeList[][][] aitradelist = DEFAULT_TRADE_LIST_MAP[this.getProfession()]; + + if (this.careerId != 0 && this.careerLevel != 0) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch.rej b/rejects/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch.rej new file mode 100644 index 000000000..fcdb36365 --- /dev/null +++ b/rejects/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch.rej @@ -0,0 +1,29 @@ +++++ REJECTED PATCH 3 + if (chunk.isPopulated()) + { + arraylist.add(chunk); +- arraylist1.addAll(((WorldServer)this.worldObj).func_147486_a(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 16, 256, chunkcoordintpair.chunkZPos * 16 + 16)); ++ arraylist1.addAll(((WorldServer)this.worldObj).func_147486_a(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 15, 256, chunkcoordintpair.chunkZPos * 16 + 15)); ++ //BugFix: 16 makes it load an extra chunk, which isn't associated with a player, which makes it not unload unless a player walks near it. + iterator1.remove(); + } + } +++++ END PATCH +++++ REJECTED PATCH 4 + { + chunk = (Chunk)iterator2.next(); + this.getServerForPlayer().getEntityTracker().func_85172_a(this, chunk); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(chunk.getChunkCoordIntPair(), this)); + } + } + } +++++ END PATCH +++++ REJECTED PATCH 7 + if (entitylivingbase != null) + { + EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entitylivingbase))); ++ if (entityegginfo == null) entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.getEntityString(entitylivingbase)); + + if (entityegginfo != null) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/init/Bootstrap.java.patch.rej b/rejects/minecraft/net/minecraft/init/Bootstrap.java.patch.rej new file mode 100644 index 000000000..5897ff274 --- /dev/null +++ b/rejects/minecraft/net/minecraft/init/Bootstrap.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 3 + } + } + }); ++ if (false){ //Forge: Removed, Fixes MC-75630 - Exploit with signs and command blocks + BlockDispenser.dispenseBehaviorRegistry.putObject(Item.getItemFromBlock(Blocks.command_block), new BehaviorDefaultDispenseItem() + { + private static final String __OBFID = "CL_00002276"; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch.rej b/rejects/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch.rej new file mode 100644 index 000000000..dee299c5f --- /dev/null +++ b/rejects/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch.rej @@ -0,0 +1,11 @@ +++++ REJECTED PATCH 1 + } + public boolean isItemValid(ItemStack stack) + { +- return stack == null ? false : (stack.getItem() instanceof ItemArmor ? ((ItemArmor)stack.getItem()).armorType == k : (stack.getItem() != Item.getItemFromBlock(Blocks.pumpkin) && stack.getItem() != Items.skull ? false : k == 0)); ++ if (stack == null) return false; ++ return stack.getItem().isValidArmor(stack, k, thePlayer); + } + @SideOnly(Side.CLIENT) + public String getSlotTexture() +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/inventory/ContainerRepair.java.patch.rej b/rejects/minecraft/net/minecraft/inventory/ContainerRepair.java.patch.rej new file mode 100644 index 000000000..26181b054 --- /dev/null +++ b/rejects/minecraft/net/minecraft/inventory/ContainerRepair.java.patch.rej @@ -0,0 +1,20 @@ +++++ REJECTED PATCH 3 + + if (itemstack2 != null) + { ++ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, outputSlot, repairedItemName, i2)) return; + flag7 = itemstack2.getItem() == Items.enchanted_book && Items.enchanted_book.getEnchantments(itemstack2).tagCount() > 0; + int k; + int l; +++++ END PATCH +++++ REJECTED PATCH 4 + { + int l1 = ((Integer)iterator.next()).intValue(); + +- if (l1 != l && !enchantment.canApplyTogether(Enchantment.getEnchantmentById(l1))) ++ Enchantment e2 = Enchantment.getEnchantmentById(l1); ++ if (l1 != l && !(enchantment.canApplyTogether(e2) && e2.canApplyTogether(enchantment))) //Forge BugFix: Let Both enchantments veto being together + { + flag8 = false; + ++i; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/Item.java.patch.rej b/rejects/minecraft/net/minecraft/item/Item.java.patch.rej new file mode 100644 index 000000000..459b12091 --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/Item.java.patch.rej @@ -0,0 +1,593 @@ +++++ REJECTED PATCH 1 + + public class Item + { +- public static final RegistryNamespaced itemRegistry = new RegistryNamespaced(); +- private static final Map BLOCK_TO_ITEM = Maps.newHashMap(); ++ public static final RegistryNamespaced itemRegistry = net.minecraftforge.fml.common.registry.GameData.getItemRegistry(); ++ private static final Map BLOCK_TO_ITEM = net.minecraftforge.fml.common.registry.GameData.getBlockItemMap(); + protected static final UUID itemModifierUUID = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); + private CreativeTabs tabToDisplayOn; + protected static Random itemRand = new Random(); +++++ END PATCH +++++ REJECTED PATCH 7 + return false; + } + ++ @Deprecated // Use ItemStack sensitive version below. + public Multimap getItemAttributeModifiers() + { + return HashMultimap.create(); + } + ++ /* ======================================== FORGE START =====================================*/ ++ /** ++ * ItemStack sensitive version of getItemAttributeModifiers ++ */ ++ public Multimap getAttributeModifiers(ItemStack stack) ++ { ++ return this.getItemAttributeModifiers(); ++ } ++ ++ /** ++ * Called when a player drops the item into the world, ++ * returning false from this will prevent the item from ++ * being removed from the players inventory and spawning ++ * in the world ++ * ++ * @param player The player that dropped the item ++ * @param item The item stack, before the item is removed. ++ */ ++ public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player) ++ { ++ return true; ++ } ++ ++ /** ++ * This is called when the item is used, before the block is activated. ++ * @param stack The Item Stack ++ * @param player The Player that used the item ++ * @param world The Current World ++ * @param pos Target position ++ * @param side The side of the target hit ++ * @return Return true to prevent any further processing. ++ */ ++ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) ++ { ++ return false; ++ } ++ ++ /** ++ * Metadata-sensitive version of getStrVsBlock ++ * @param itemstack The Item Stack ++ * @param state The block state ++ * @return The damage strength ++ */ ++ public float getDigSpeed(ItemStack itemstack, net.minecraft.block.state.IBlockState state) ++ { ++ return getStrVsBlock(itemstack, state.getBlock()); ++ } ++ ++ ++ protected boolean canRepair = true; ++ /** ++ * Called by CraftingManager to determine if an item is reparable. ++ * @return True if reparable ++ */ ++ public boolean isRepairable() ++ { ++ return canRepair && isDamageable(); ++ } ++ ++ /** ++ * Call to disable repair recipes. ++ * @return The current Item instance ++ */ ++ public Item setNoRepair() ++ { ++ canRepair = false; ++ return this; ++ } ++ ++ /** ++ * Called before a block is broken. Return true to prevent default block harvesting. ++ * ++ * Note: In SMP, this is called on both client and server sides! ++ * ++ * @param itemstack The current ItemStack ++ * @param pos Block's position in world ++ * @param player The Player that is wielding the item ++ * @return True to prevent harvesting, false to continue as normal ++ */ ++ public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) ++ { ++ return false; ++ } ++ ++ /** ++ * Called each tick while using an item. ++ * @param stack The Item being used ++ * @param player The Player using the item ++ * @param count The amount of time in tick the item has been used for continuously ++ */ ++ public void onUsingTick(ItemStack stack, EntityPlayer player, int count) ++ { ++ } ++ ++ /** ++ * Called when the player Left Clicks (attacks) an entity. ++ * Processed before damage is done, if return value is true further processing is canceled ++ * and the entity is not attacked. ++ * ++ * @param stack The Item being used ++ * @param player The player that is attacking ++ * @param entity The entity being attacked ++ * @return True to cancel the rest of the interaction. ++ */ ++ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) ++ { ++ return false; ++ } ++ ++ /** ++ * Player, Render pass, and item usage sensitive version of getIconIndex. ++ * ++ * @param stack The item stack to get the icon for. ++ * @param player The player holding the item ++ * @param useRemaining The ticks remaining for the active item. ++ * @return Null to use default model, or a custom ModelResourceLocation for the stage of use. ++ */ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.client.resources.model.ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) ++ { ++ return null; ++ } ++ ++ /** ++ * ItemStack sensitive version of getContainerItem. ++ * Returns a full ItemStack instance of the result. ++ * ++ * @param itemStack The current ItemStack ++ * @return The resulting ItemStack ++ */ ++ public ItemStack getContainerItem(ItemStack itemStack) ++ { ++ if (!hasContainerItem(itemStack)) ++ { ++ return null; ++ } ++ return new ItemStack(getContainerItem()); ++ } ++ ++ /** ++ * ItemStack sensitive version of hasContainerItem ++ * @param stack The current item stack ++ * @return True if this item has a 'container' ++ */ ++ public boolean hasContainerItem(ItemStack stack) ++ { ++ return hasContainerItem(); ++ } ++ ++ /** ++ * Retrieves the normal 'lifespan' of this item when it is dropped on the ground as a EntityItem. ++ * This is in ticks, standard result is 6000, or 5 mins. ++ * ++ * @param itemStack The current ItemStack ++ * @param world The world the entity is in ++ * @return The normal lifespan in ticks. ++ */ ++ public int getEntityLifespan(ItemStack itemStack, World world) ++ { ++ return 6000; ++ } ++ ++ /** ++ * Determines if this Item has a special entity for when they are in the world. ++ * Is called when a EntityItem is spawned in the world, if true and Item#createCustomEntity ++ * returns non null, the EntityItem will be destroyed and the new Entity will be added to the world. ++ * ++ * @param stack The current item stack ++ * @return True of the item has a custom entity, If true, Item#createCustomEntity will be called ++ */ ++ public boolean hasCustomEntity(ItemStack stack) ++ { ++ return false; ++ } ++ ++ /** ++ * This function should return a new entity to replace the dropped item. ++ * Returning null here will not kill the EntityItem and will leave it to function normally. ++ * Called when the item it placed in a world. ++ * ++ * @param world The world object ++ * @param location The EntityItem object, useful for getting the position of the entity ++ * @param itemstack The current item stack ++ * @return A new Entity object to spawn or null ++ */ ++ public Entity createEntity(World world, Entity location, ItemStack itemstack) ++ { ++ return null; ++ } ++ ++ /** ++ * Called by the default implemetation of EntityItem's onUpdate method, allowing for cleaner ++ * control over the update of the item without having to write a subclass. ++ * ++ * @param entityItem The entity Item ++ * @return Return true to skip any further update code. ++ */ ++ public boolean onEntityItemUpdate(net.minecraft.entity.item.EntityItem entityItem) ++ { ++ return false; ++ } ++ ++ /** ++ * Gets a list of tabs that items belonging to this class can display on, ++ * combined properly with getSubItems allows for a single item to span ++ * many sub-items across many tabs. ++ * ++ * @return A list of all tabs that this item could possibly be one. ++ */ ++ public CreativeTabs[] getCreativeTabs() ++ { ++ return new CreativeTabs[]{ getCreativeTab() }; ++ } ++ ++ /** ++ * Determines the base experience for a player when they remove this item from a furnace slot. ++ * This number must be between 0 and 1 for it to be valid. ++ * This number will be multiplied by the stack size to get the total experience. ++ * ++ * @param item The item stack the player is picking up. ++ * @return The amount to award for each item. ++ */ ++ public float getSmeltingExperience(ItemStack item) ++ { ++ return -1; //-1 will default to the old lookups. ++ } ++ ++ /** ++ * Return the correct icon for rendering based on the supplied ItemStack and render pass. ++ * ++ * Defers to {@link #getIconFromDamageForRenderPass(int, int)} ++ * @param stack to render for ++ * @param pass the multi-render pass ++ * @return the icon ++ * / ++ public IIcon getIcon(ItemStack stack, int pass) ++ { ++ return func_77618_c(stack.getMetadata(), pass); ++ } ++ */ ++ ++ /** ++ * Generates the base Random item for a specific instance of the chest gen, ++ * Enchanted books use this to pick a random enchantment. ++ * ++ * @param chest The chest category to generate for ++ * @param rnd World RNG ++ * @param original Original result registered with the chest gen hooks. ++ * @return New values to use as the random item, typically this will be original ++ */ ++ public net.minecraft.util.WeightedRandomChestContent getChestGenBase(net.minecraftforge.common.ChestGenHooks chest, Random rnd, net.minecraft.util.WeightedRandomChestContent original) ++ { ++ if (this instanceof ItemEnchantedBook) ++ { ++ return ((ItemEnchantedBook)this).getRandom(rnd, ++ original.theMinimumChanceToGenerateItem, ++ original.theMaximumChanceToGenerateItem, original.itemWeight); ++ } ++ return original; ++ } ++ ++ /** ++ * ++ * Should this item, when held, allow sneak-clicks to pass through to the underlying block? ++ * ++ * @param world The world ++ * @param pos Block position in world ++ * @param player The Player that is wielding the item ++ * @return ++ */ ++ public boolean doesSneakBypassUse(World world, BlockPos pos, EntityPlayer player) ++ { ++ return false; ++ } ++ ++ /** ++ * Called to tick armor in the armor slot. Override to do something ++ */ ++ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack){} ++ ++ /** ++ * Determines if the specific ItemStack can be placed in the specified armor slot. ++ * ++ * @param stack The ItemStack ++ * @param armorType Armor slot ID: 0: Helmet, 1: Chest, 2: Legs, 3: Boots ++ * @param entity The entity trying to equip the armor ++ * @return True if the given ItemStack can be inserted in the slot ++ */ ++ public boolean isValidArmor(ItemStack stack, int armorType, Entity entity) ++ { ++ if (this instanceof ItemArmor) ++ { ++ return ((ItemArmor)this).armorType == armorType; ++ } ++ ++ if (armorType == 0) ++ { ++ return this == Item.getItemFromBlock(Blocks.pumpkin) || this == Items.skull; ++ } ++ ++ return false; ++ } ++ ++ /** ++ * Allow or forbid the specific book/item combination as an anvil enchant ++ * ++ * @param stack The item ++ * @param book The book ++ * @return if the enchantment is allowed ++ */ ++ public boolean isBookEnchantable(ItemStack stack, ItemStack book) ++ { ++ return true; ++ } ++ ++ /** ++ * Called by RenderBiped and RenderPlayer to determine the armor texture that ++ * should be use for the currently equipped item. ++ * This will only be called on instances of ItemArmor. ++ * ++ * Returning null from this function will use the default value. ++ * ++ * @param stack ItemStack for the equipped armor ++ * @param entity The entity wearing the armor ++ * @param slot The slot the armor is in ++ * @param type The subtype, can be null or "overlay" ++ * @return Path of texture to bind, or null to use default ++ */ ++ public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) ++ { ++ return null; ++ } ++ ++ /** ++ * Returns the font renderer used to render tooltips and overlays for this item. ++ * Returning null will use the standard font renderer. ++ * ++ * @param stack The current item stack ++ * @return A instance of FontRenderer or null to use default ++ */ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.client.gui.FontRenderer getFontRenderer(ItemStack stack) ++ { ++ return null; ++ } ++ ++ /** ++ * Override this method to have an item handle its own armor rendering. ++ * ++ * @param entityLiving The entity wearing the armor ++ * @param itemStack The itemStack to render the model of ++ * @param armorSlot 0=head, 1=torso, 2=legs, 3=feet ++ * ++ * @return A ModelBiped to render instead of the default ++ */ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) ++ { ++ return null; ++ } ++ ++ /** ++ * Called when a entity tries to play the 'swing' animation. ++ * ++ * @param entityLiving The entity swinging the item. ++ * @param stack The Item stack ++ * @return True to cancel any further processing by EntityLiving ++ */ ++ public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) ++ { ++ return false; ++ } ++ ++ /** ++ * Called when the client starts rendering the HUD, for whatever item the player currently has as a helmet. ++ * This is where pumpkins would render there overlay. ++ * ++ * @param stack The ItemStack that is equipped ++ * @param player Reference to the current client entity ++ * @param resolution Resolution information about the current viewport and configured GUI Scale ++ * @param partialTicks Partial ticks for the renderer, useful for interpolation ++ */ ++ @SideOnly(Side.CLIENT) ++ public void renderHelmetOverlay(ItemStack stack, EntityPlayer player, net.minecraft.client.gui.ScaledResolution resolution, float partialTicks){} ++ ++ /** ++ * Return the itemDamage represented by this ItemStack. Defaults to the itemDamage field on ItemStack, but can be overridden here for other sources such as NBT. ++ * ++ * @param stack The itemstack that is damaged ++ * @return the damage value ++ */ ++ public int getDamage(ItemStack stack) ++ { ++ return stack.itemDamage; ++ } ++ ++ /** ++ * This used to be 'display damage' but its really just 'aux' data in the ItemStack, usually shares the same variable as damage. ++ * @param stack ++ * @return ++ */ ++ public int getMetadata(ItemStack stack) ++ { ++ return stack.itemDamage; ++ } ++ ++ /** ++ * Determines if the durability bar should be rendered for this item. ++ * Defaults to vanilla stack.isDamaged behavior. ++ * But modders can use this for any data they wish. ++ * ++ * @param stack The current Item Stack ++ * @return True if it should render the 'durability' bar. ++ */ ++ public boolean showDurabilityBar(ItemStack stack) ++ { ++ return stack.isItemDamaged(); ++ } ++ ++ /** ++ * Queries the percentage of the 'Durability' bar that should be drawn. ++ * ++ * @param stack The current ItemStack ++ * @return 1.0 for 100% 0 for 0% ++ */ ++ public double getDurabilityForDisplay(ItemStack stack) ++ { ++ return (double)stack.getItemDamage() / (double)stack.getMaxDamage(); ++ } ++ ++ /** ++ * Return the maxDamage for this ItemStack. Defaults to the maxDamage field in this item, ++ * but can be overridden here for other sources such as NBT. ++ * ++ * @param stack The itemstack that is damaged ++ * @return the damage value ++ */ ++ public int getMaxDamage(ItemStack stack) ++ { ++ return getMaxDamage(); ++ } ++ ++ /** ++ * Return if this itemstack is damaged. Note only called if {@link #isDamageable()} is true. ++ * @param stack the stack ++ * @return if the stack is damaged ++ */ ++ public boolean isDamaged(ItemStack stack) ++ { ++ return stack.itemDamage > 0; ++ } ++ ++ /** ++ * Set the damage for this itemstack. Note, this method is responsible for zero checking. ++ * @param stack the stack ++ * @param damage the new damage value ++ */ ++ public void setDamage(ItemStack stack, int damage) ++ { ++ stack.itemDamage = damage; ++ ++ if (stack.itemDamage < 0) ++ { ++ stack.itemDamage = 0; ++ } ++ } ++ ++ /** ++ * ItemStack sensitive version of {@link #canHarvestBlock(Block)} ++ * @param par1Block The block trying to harvest ++ * @param itemStack The itemstack used to harvest the block ++ * @return true if can harvest the block ++ */ ++ public boolean canHarvestBlock(Block par1Block, ItemStack itemStack) ++ { ++ return canHarvestBlock(par1Block); ++ } ++ ++ /** ++ * Gets the maximum number of items that this stack should be able to hold. ++ * This is a ItemStack (and thus NBT) sensitive version of Item.getItemStackLimit() ++ * ++ * @param stack The ItemStack ++ * @return THe maximum number this item can be stacked to ++ */ ++ public int getItemStackLimit(ItemStack stack) ++ { ++ return this.getItemStackLimit(); ++ } ++ ++ private java.util.Map toolClasses = new java.util.HashMap(); ++ /** ++ * Sets or removes the harvest level for the specified tool class. ++ * ++ * @param toolClass Class ++ * @param level Harvest level: ++ * Wood: 0 ++ * Stone: 1 ++ * Iron: 2 ++ * Diamond: 3 ++ * Gold: 0 ++ */ ++ public void setHarvestLevel(String toolClass, int level) ++ { ++ if (level < 0) ++ toolClasses.remove(toolClass); ++ else ++ toolClasses.put(toolClass, level); ++ } ++ ++ public java.util.Set getToolClasses(ItemStack stack) ++ { ++ return toolClasses.keySet(); ++ } ++ ++ /** ++ * Queries the harvest level of this item stack for the specifred tool class, ++ * Returns -1 if this tool is not of the specified type ++ * ++ * @param stack This item stack instance ++ * @param toolClass Tool Class ++ * @return Harvest level, or -1 if not the specified tool type. ++ */ ++ public int getHarvestLevel(ItemStack stack, String toolClass) ++ { ++ Integer ret = toolClasses.get(toolClass); ++ return ret == null ? -1 : ret; ++ } ++ ++ /** ++ * ItemStack sensitive version of getItemEnchantability ++ * ++ * @param stack The ItemStack ++ * @return the item echantability value ++ */ ++ public int getItemEnchantability(ItemStack stack) ++ { ++ return getItemEnchantability(); ++ } ++ ++ /** ++ * Whether this Item can be used as a payment to activate the vanilla beacon. ++ * @param stack the ItemStack ++ * @return true if this Item can be used ++ */ ++ public boolean isBeaconPayment(ItemStack stack) ++ { ++ return this == Items.emerald || this == Items.diamond || this == Items.gold_ingot || this == Items.iron_ingot; ++ } ++ ++ ++ /** ++ * Determine if the player switching between these two item stacks ++ * @param oldStack The old stack that was equipped ++ * @param newStack The new stack ++ * @param slotChanged If the current equipped slot was changed, ++ * Vanilla does not play the animation if you switch between two ++ * slots that hold the exact same item. ++ * @return True to play the item change animation ++ */ ++ public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) ++ { ++ return !ItemStack.areItemStacksEqual(oldStack, newStack); ++ } ++ /* ======================================== FORGE END =====================================*/ ++ ++ + public static void registerItems() + { + registerItemBlock(Blocks.stone, (new ItemMultiTexture(Blocks.stone, Blocks.stone, new Function() +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemBlock.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemBlock.java.patch.rej new file mode 100644 index 000000000..a25b08932 --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemBlock.java.patch.rej @@ -0,0 +1,45 @@ +++++ REJECTED PATCH 1 + int i = this.getMetadata(stack.getMetadata()); + IBlockState iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, i, playerIn); + +- if (worldIn.setBlockState(pos, iblockstate1, 3)) ++ if (placeBlockAt(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ, iblockstate1)) + { +- iblockstate1 = worldIn.getBlockState(pos); +- +- if (iblockstate1.getBlock() == this.block) +- { +- setTileEntityNBT(worldIn, pos, stack); +- this.block.onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack); +- } +- + worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), this.block.stepSound.getPlaceSound(), (this.block.stepSound.getVolume() + 1.0F) / 2.0F, this.block.stepSound.getFrequency() * 0.8F); + --stack.stackSize; + } +++++ END PATCH +++++ REJECTED PATCH 2 + } + } + ++ @Deprecated //Use player sensitive version + public static boolean setTileEntityNBT(World worldIn, BlockPos pos, ItemStack stack) + { ++ return setTileEntityNBT(worldIn, pos, stack, null); ++ } ++ public static boolean setTileEntityNBT(World worldIn, BlockPos pos, ItemStack stack, EntityPlayer player) ++ { + if (stack.hasTagCompound() && stack.getTagCompound().hasKey("BlockEntityTag", 10)) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity != null) + { ++ //Forge: Fixes MC-75630 - Exploit with signs and command blocks ++ final net.minecraft.server.MinecraftServer server = net.minecraft.server.MinecraftServer.getServer(); ++ if (!worldIn.isRemote && tileentity.restrictNBTCopy() && ++ (server == null || !server.getConfigurationManager().canSendCommands(player.getGameProfile()))) ++ return false; + NBTTagCompound nbttagcompound = new NBTTagCompound(); + NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttagcompound.copy(); + tileentity.writeToNBT(nbttagcompound); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemBow.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemBow.java.patch.rej new file mode 100644 index 000000000..4da43f942 --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemBow.java.patch.rej @@ -0,0 +1,18 @@ +++++ REJECTED PATCH 1 + + public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityPlayer playerIn, int timeLeft) + { ++ int j = this.getMaxItemUseDuration(stack) - timeLeft; ++ net.minecraftforge.event.entity.player.ArrowLooseEvent event = new net.minecraftforge.event.entity.player.ArrowLooseEvent(playerIn, stack, j); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; ++ j = event.charge; ++ + boolean flag = playerIn.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0; + + if (flag || playerIn.inventory.hasItem(Items.arrow)) + { +- int j = this.getMaxItemUseDuration(stack) - timeLeft; + float f = (float)j / 20.0F; + f = (f * f + f * 2.0F) / 3.0F; + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch.rej new file mode 100644 index 000000000..b28b8be6a --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch.rej @@ -0,0 +1,42 @@ +++++ REJECTED PATCH 2 + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack stack, int renderPass) + { +- EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(stack.getMetadata())); ++ EntityList.EntityEggInfo entityegginfo = ItemMonsterPlacer.getEggInfo(stack); + return entityegginfo != null ? (renderPass == 0 ? entityegginfo.primaryColor : entityegginfo.secondaryColor) : 16777215; + } + +++++ END PATCH +++++ REJECTED PATCH 6 + } + } + ++ @Deprecated // Use string version below. + public static Entity spawnCreature(World worldIn, int entityID, double x, double y, double z) + { + if (!EntityList.entityEggs.containsKey(Integer.valueOf(entityID))) + { + return null; + } ++ return spawnCreature(worldIn, EntityList.getStringFromID(entityID), x, y, z); ++ } ++ ++ public static Entity spawnCreature(World worldIn, String name, double x, double y, double z) ++ { ++ if (!EntityList.stringToClassMapping.containsKey(name)) ++ { ++ return null; ++ } + else + { + Entity entity = null; + + for (int j = 0; j < 1; ++j) + { +- entity = EntityList.createEntityByID(entityID, worldIn); ++ entity = EntityList.createEntityByName(name, worldIn); + + if (entity instanceof EntityLivingBase) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemReed.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemReed.java.patch.rej new file mode 100644 index 000000000..8281b9838 --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemReed.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + + if (iblockstate1.getBlock() == this.block) + { +- ItemBlock.setTileEntityNBT(worldIn, pos, stack); ++ ItemBlock.setTileEntityNBT(worldIn, pos, stack, playerIn); + iblockstate1.getBlock().onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack); + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemSign.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemSign.java.patch.rej new file mode 100644 index 000000000..790c3449e --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemSign.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + --stack.stackSize; + TileEntity tileentity = worldIn.getTileEntity(pos); + +- if (tileentity instanceof TileEntitySign && !ItemBlock.setTileEntityNBT(worldIn, pos, stack)) ++ if (tileentity instanceof TileEntitySign && !ItemBlock.setTileEntityNBT(worldIn, pos, stack, playerIn)) + { + playerIn.openEditSign((TileEntitySign)tileentity); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemStack.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemStack.java.patch.rej new file mode 100644 index 000000000..eee0c2642 --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/ItemStack.java.patch.rej @@ -0,0 +1,20 @@ +++++ REJECTED PATCH 10 + } + } + ++ net.minecraftforge.event.ForgeEventFactory.onItemTooltip(this, playerIn, arraylist, advanced); ++ + return arraylist; + } + +++++ END PATCH +++++ REJECTED PATCH 11 + } + else + { +- object = this.getItem().getItemAttributeModifiers(); ++ object = this.getItem().getAttributeModifiers(this); + } + + return (Multimap)object; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch.rej b/rejects/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch.rej new file mode 100644 index 000000000..5dfe144df --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch.rej @@ -0,0 +1,11 @@ +++++ REJECTED PATCH 2 + + public float getSmeltingExperience(ItemStack stack) + { ++ float ret = stack.getItem().getSmeltingExperience(stack); ++ if (ret != -1) return ret; ++ + Iterator iterator = this.experienceList.entrySet().iterator(); + Entry entry; + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch.rej b/rejects/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch.rej new file mode 100644 index 000000000..c5f4d4693 --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch.rej @@ -0,0 +1,23 @@ +++++ REJECTED PATCH 1 + { + this.field_92102_a = new ItemStack(Items.fireworks); + ++ nbttagcompound = new NBTTagCompound(); + if (l > 0) + { +- nbttagcompound = new NBTTagCompound(); + nbttagcompound1 = new NBTTagCompound(); + NBTTagList nbttaglist = new NBTTagList(); + +++++ END PATCH +++++ REJECTED PATCH 2 + nbttagcompound1.setTag("Explosions", nbttaglist); + nbttagcompound1.setByte("Flight", (byte)j); + nbttagcompound.setTag("Fireworks", nbttagcompound1); +- this.field_92102_a.setTagCompound(nbttagcompound); + } ++ this.field_92102_a.setTagCompound(nbttagcompound); //Forge BugFix: NPE Protection + + return true; + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch.rej b/rejects/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch.rej new file mode 100644 index 000000000..bb4871784 --- /dev/null +++ b/rejects/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 3 + ItemStack itemstack2 = (ItemStack)arraylist.get(0); + itemstack = (ItemStack)arraylist.get(1); + +- if (itemstack2.getItem() == itemstack.getItem() && itemstack2.stackSize == 1 && itemstack.stackSize == 1 && itemstack2.getItem().isDamageable()) ++ if (itemstack2.getItem() == itemstack.getItem() && itemstack2.stackSize == 1 && itemstack.stackSize == 1 && itemstack2.getItem().isRepairable()) + { + Item item = itemstack2.getItem(); + int j = item.getMaxDamage() - itemstack2.getItemDamage(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/nbt/NBTTagByteArray.java.patch.rej b/rejects/minecraft/net/minecraft/nbt/NBTTagByteArray.java.patch.rej new file mode 100644 index 000000000..2f48a9fbb --- /dev/null +++ b/rejects/minecraft/net/minecraft/nbt/NBTTagByteArray.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + + void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException + { ++ sizeTracker.read(32); //Forge: Count the length as well + int j = input.readInt(); + sizeTracker.read((long)(8 * j)); + this.data = new byte[j]; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch.rej b/rejects/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch.rej new file mode 100644 index 000000000..2873b145b --- /dev/null +++ b/rejects/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + while ((b0 = readType(input, sizeTracker)) != 0) + { + String s = readKey(input, sizeTracker); +- sizeTracker.read((long)(16 * s.length())); ++ NBTSizeTracker.readUTF(sizeTracker, s); // Forge: Correctly read String length including header. + NBTBase nbtbase = readNBT(b0, s, input, depth + 1, sizeTracker); + this.tagMap.put(s, nbtbase); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/nbt/NBTTagIntArray.java.patch.rej b/rejects/minecraft/net/minecraft/nbt/NBTTagIntArray.java.patch.rej new file mode 100644 index 000000000..891176729 --- /dev/null +++ b/rejects/minecraft/net/minecraft/nbt/NBTTagIntArray.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + + void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException + { ++ sizeTracker.read(32); //Forge: Count the length as well + int j = input.readInt(); + sizeTracker.read((long)(32 * j)); + this.intArray = new int[j]; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/nbt/NBTTagList.java.patch.rej b/rejects/minecraft/net/minecraft/nbt/NBTTagList.java.patch.rej new file mode 100644 index 000000000..40455e211 --- /dev/null +++ b/rejects/minecraft/net/minecraft/nbt/NBTTagList.java.patch.rej @@ -0,0 +1,15 @@ +++++ REJECTED PATCH 1 + { + sizeTracker.read(8L); + this.tagType = input.readByte(); ++ sizeTracker.read(32); //Forge: Count the length as well + int j = input.readInt(); + this.tagList = Lists.newArrayList(); + + for (int k = 0; k < j; ++k) + { ++ sizeTracker.read(32); //Forge: 4 extra bytes for the object allocation. + NBTBase nbtbase = NBTBase.createNewByType(this.tagType); + nbtbase.read(input, depth + 1, sizeTracker); + this.tagList.add(nbtbase); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/network/NetworkSystem.java.patch.rej b/rejects/minecraft/net/minecraft/network/NetworkSystem.java.patch.rej new file mode 100644 index 000000000..ef370c551 --- /dev/null +++ b/rejects/minecraft/net/minecraft/network/NetworkSystem.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + ; + } + +- p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new PingResponseHandler(NetworkSystem.this)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer(EnumPacketDirection.SERVERBOUND)).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer(EnumPacketDirection.CLIENTBOUND)); ++ p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.READ_TIMEOUT)).addLast("legacy_query", new PingResponseHandler(NetworkSystem.this)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer(EnumPacketDirection.SERVERBOUND)).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer(EnumPacketDirection.CLIENTBOUND)); + NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND); + NetworkSystem.this.networkManagers.add(networkmanager); + p_initChannel_1_.pipeline().addLast("packet_handler", networkmanager); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/network/ServerStatusResponse.java.patch.rej b/rejects/minecraft/net/minecraft/network/ServerStatusResponse.java.patch.rej new file mode 100644 index 000000000..e909ac525 --- /dev/null +++ b/rejects/minecraft/net/minecraft/network/ServerStatusResponse.java.patch.rej @@ -0,0 +1,45 @@ +++++ REJECTED PATCH 6 + return this.serialize((ServerStatusResponse)p_serialize_1_, p_serialize_2_, p_serialize_3_); + } + } ++ ++ private java.util.concurrent.Semaphore mutex = new java.util.concurrent.Semaphore(1); ++ private String json = null; ++ /** ++ * Returns this object as a Json string. ++ * Converting to JSON if a cached version is not available. ++ * ++ * Also to prevent potentially large memory allocations on the server ++ * this is moved from the S00PacketServerInfo writePacket function ++ * ++ * As this method is called from the network threads thread safety is important! ++ * ++ * @return ++ */ ++ public String getJson() ++ { ++ String ret = this.json; ++ if (ret == null) ++ { ++ mutex.acquireUninterruptibly(); ++ ret = this.json; ++ if (ret == null) ++ { ++ ret = net.minecraft.network.status.server.S00PacketServerInfo.GSON.toJson(this); ++ this.json = ret; ++ } ++ mutex.release(); ++ } ++ return ret; ++ } ++ ++ /** ++ * Invalidates the cached json, causing the next call to getJson to rebuild it. ++ * This is needed externally because PlayerCountData.setPlayer's is public. ++ */ ++ public void invalidateJson() ++ { ++ this.json = null; ++ } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch.rej b/rejects/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch.rej new file mode 100644 index 000000000..1a76b2f19 --- /dev/null +++ b/rejects/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + + for (int i = 0; i < 4; ++i) + { +- this.lines[i] = buf.readChatComponent(); ++ this.lines[i] = IChatComponent.Serializer.jsonToComponent(buf.readStringFromBuffer(384)); + } + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch.rej b/rejects/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch.rej new file mode 100644 index 000000000..a1201ecf7 --- /dev/null +++ b/rejects/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + + public void writePacketData(PacketBuffer buf) throws IOException + { +- buf.writeString(GSON.toJson(this.response)); ++ buf.writeString(this.response.getJson()); + } + + public void processPacket(INetHandlerStatusClient handler) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/potion/PotionEffect.java.patch.rej b/rejects/minecraft/net/minecraft/potion/PotionEffect.java.patch.rej new file mode 100644 index 000000000..af2f10358 --- /dev/null +++ b/rejects/minecraft/net/minecraft/potion/PotionEffect.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 4 + + public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt) + { +- byte b0 = nbt.getByte("Id"); ++ int b0 = nbt.getByte("Id") & 0xff; + + if (b0 >= 0 && b0 < Potion.potionTypes.length && Potion.potionTypes[b0] != null) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/MinecraftServer.java.patch.rej b/rejects/minecraft/net/minecraft/server/MinecraftServer.java.patch.rej new file mode 100644 index 000000000..cfdcbd57e --- /dev/null +++ b/rejects/minecraft/net/minecraft/server/MinecraftServer.java.patch.rej @@ -0,0 +1,127 @@ +++++ REJECTED PATCH 4 + worldsettings = new WorldSettings(worldinfo); + } + +- for (int j = 0; j < this.worldServers.length; ++j) ++ WorldServer overWorld = (WorldServer)(isDemo() ? new DemoWorldServer(this, isavehandler, worldinfo, 0, theProfiler).init() : new WorldServer(this, isavehandler, worldinfo, 0, theProfiler).init()); ++ overWorld.initialize(worldsettings); ++ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) + { +- byte b0 = 0; ++ WorldServer world = (dim == 0 ? overWorld : (WorldServer)new WorldServerMulti(this, isavehandler, dim, overWorld, theProfiler).init()); ++ world.addWorldAccess(new WorldManager(this, world)); + +- if (j == 1) +- { +- b0 = -1; +- } +- +- if (j == 2) +- { +- b0 = 1; +- } +- +- if (j == 0) +- { +- if (this.isDemo()) +- { +- this.worldServers[j] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, b0, this.theProfiler)).init(); +- } +- else +- { +- this.worldServers[j] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, b0, this.theProfiler)).init(); +- } +- +- this.worldServers[j].initialize(worldsettings); +- } +- else +- { +- this.worldServers[j] = (WorldServer)(new WorldServerMulti(this, isavehandler, b0, this.worldServers[0], this.theProfiler)).init(); +- } +- +- this.worldServers[j].addWorldAccess(new WorldManager(this, this.worldServers[j])); +- + if (!this.isSinglePlayer()) + { +- this.worldServers[j].getWorldInfo().setGameType(this.getGameType()); ++ world.getWorldInfo().setGameType(this.getGameType()); + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); + } + +- this.serverConfigManager.setPlayerManager(this.worldServers); ++ this.serverConfigManager.setPlayerManager(new WorldServer[]{ overWorld }); + this.setDifficultyForAllWorlds(this.getDifficulty()); + this.initialWorldChunkLoad(); + } +++++ END PATCH +++++ REJECTED PATCH 5 + this.setUserMessage("menu.generatingTerrain"); + byte b0 = 0; + logger.info("Preparing start region for level " + b0); +- WorldServer worldserver = this.worldServers[b0]; ++ WorldServer worldserver = net.minecraftforge.common.DimensionManager.getWorld(b0); + BlockPos blockpos = worldserver.getSpawnPoint(); + long j = getCurrentTimeMillis(); + +++++ END PATCH +++++ REJECTED PATCH 6 + if (!this.worldIsBeingDeleted) + { + WorldServer[] aworldserver = this.worldServers; ++ if (aworldserver == null) return; //Forge: Just in case, NPE protection as it has been encountered. + int i = aworldserver.length; + + for (int j = 0; j < i; ++j) +++++ END PATCH +++++ REJECTED PATCH 16 + { + try + { +- ((FutureTask)this.futureTaskQueue.poll()).run(); ++ net.minecraftforge.fml.common.FMLCommonHandler.callFuture(((FutureTask)this.futureTaskQueue.poll())); + } + catch (Throwable throwable2) + { +++++ END PATCH +++++ REJECTED PATCH 17 + } + + this.theProfiler.endStartSection("levels"); ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.tick(); + int j; + +- for (j = 0; j < this.worldServers.length; ++j) ++ Integer[] ids = net.minecraftforge.common.DimensionManager.getIDs(this.tickCounter % 200 == 0); ++ for (int x = 0; x < ids.length; x++) + { ++ int id = ids[x]; + long i = System.nanoTime(); + +- if (j == 0 || this.getAllowNether()) ++ if (id == 0 || this.getAllowNether()) + { +- WorldServer worldserver = this.worldServers[j]; ++ WorldServer worldserver = net.minecraftforge.common.DimensionManager.getWorld(id); + this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName()); + + if (this.tickCounter % 20 == 0) +++++ END PATCH +++++ REJECTED PATCH 18 + } + + this.theProfiler.startSection("tick"); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreWorldTick(worldserver); + CrashReport crashreport; + + try +++++ END PATCH +++++ REJECTED PATCH 25 + this.serverPort = port; + } + +- @SideOnly(Side.SERVER) + public boolean isServerStopped() + { + return this.serverStopped; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej b/rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej new file mode 100644 index 000000000..6fffb6baf --- /dev/null +++ b/rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej @@ -0,0 +1,68 @@ +++++ REJECTED PATCH 2 + { + worldinfo.setWorldName(p_71247_2_); + } ++ WorldServer overWorld = (isDemo() ? (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init() : ++ (WorldServer)(new WorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init()); ++ overWorld.initialize(this.theWorldSettings); + +- for (int j = 0; j < this.worldServers.length; ++j) ++ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) + { +- byte b0 = 0; + +- if (j == 1) ++ WorldServer world = (dim == 0 ? overWorld : (WorldServer)(new WorldServerMulti(this, isavehandler, dim, overWorld, this.theProfiler)).init()); ++ world.addWorldAccess(new WorldManager(this, world)); ++ if (!this.isSinglePlayer()) + { +- b0 = -1; ++ world.getWorldInfo().setGameType(getGameType()); + } +- +- if (j == 2) +- { +- b0 = 1; +- } +- +- if (j == 0) +- { +- if (this.isDemo()) +- { +- this.worldServers[j] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, b0, this.theProfiler)).init(); +- } +- else +- { +- this.worldServers[j] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, b0, this.theProfiler)).init(); +- } +- +- this.worldServers[j].initialize(this.theWorldSettings); +- } +- else +- { +- this.worldServers[j] = (WorldServer)(new WorldServerMulti(this, isavehandler, b0, this.worldServers[0], this.theProfiler)).init(); +- } +- +- this.worldServers[j].addWorldAccess(new WorldManager(this, this.worldServers[j])); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); + } + +- this.getConfigurationManager().setPlayerManager(this.worldServers); ++ this.getConfigurationManager().setPlayerManager(new WorldServer[]{ overWorld }); + +- if (this.worldServers[0].getWorldInfo().getDifficulty() == null) ++ if (overWorld.getWorldInfo().getDifficulty() == null) + { + this.setDifficultyForAllWorlds(this.mc.gameSettings.difficulty); + } +++++ END PATCH +++++ REJECTED PATCH 4 + { + try + { +- ((FutureTask)this.futureTaskQueue.poll()).run(); ++ net.minecraftforge.fml.common.FMLCommonHandler.callFuture(((FutureTask)this.futureTaskQueue.poll())); + } + catch (Throwable throwable) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/management/PlayerManager.java.patch.rej b/rejects/minecraft/net/minecraft/server/management/PlayerManager.java.patch.rej new file mode 100644 index 000000000..fa38e8910 --- /dev/null +++ b/rejects/minecraft/net/minecraft/server/management/PlayerManager.java.patch.rej @@ -0,0 +1,40 @@ +++++ REJECTED PATCH 13 + { + int i1; + +- if (this.numBlocksToUpdate == 64) ++ if (this.numBlocksToUpdate >= net.minecraftforge.common.ForgeModContainer.clumpingThreshold) + { + i = this.chunkCoords.chunkXPos * 16; + j = this.chunkCoords.chunkZPos * 16; + this.sendToAllPlayersWatchingChunk(new S21PacketChunkData(PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos), false, this.flagsYAreasToUpdate)); + +- for (k = 0; k < 16; ++k) ++ // Forge: Grabs ALL tile entities is costly on a modded server, only send needed ones ++ for (k = 0; false && k < 16; ++k) + { + if ((this.flagsYAreasToUpdate & 1 << k) != 0) + { +++++ END PATCH +++++ REJECTED PATCH 14 + else + { + this.sendToAllPlayersWatchingChunk(new S22PacketMultiBlockChange(this.numBlocksToUpdate, this.locationOfBlockChange, PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos))); ++ } + ++ { //Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small ++ WorldServer world = PlayerManager.this.theWorldServer; + for (i = 0; i < this.numBlocksToUpdate; ++i) + { + j = (this.locationOfBlockChange[i] >> 12 & 15) + this.chunkCoords.chunkXPos * 16; +++++ END PATCH +++++ REJECTED PATCH 15 + i1 = (this.locationOfBlockChange[i] >> 8 & 15) + this.chunkCoords.chunkZPos * 16; + BlockPos blockpos1 = new BlockPos(j, k, i1); + +- if (PlayerManager.this.theWorldServer.getBlockState(blockpos1).getBlock().hasTileEntity()) ++ if (world.getBlockState(blockpos1).getBlock().hasTileEntity(world.getBlockState(blockpos1))) + { + this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos1)); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch.rej b/rejects/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch.rej new file mode 100644 index 000000000..5572fafa5 --- /dev/null +++ b/rejects/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch.rej @@ -0,0 +1,28 @@ +++++ REJECTED PATCH 1 + { + List list = null; + BufferedReader bufferedreader = null; +- label64: + { + try + { + bufferedreader = Files.newReader(this.usercacheFile, Charsets.UTF_8); + list = (List)this.gson.fromJson(bufferedreader, field_152666_h); +- break label64; +- } +- catch (FileNotFoundException filenotfoundexception) +- { +- ; +- } +- finally +- { +- IOUtils.closeQuietly(bufferedreader); +- } + +- return; +- } +- + if (list != null) + { + this.field_152661_c.clear(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch.rej b/rejects/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch.rej new file mode 100644 index 000000000..29f9d27b3 --- /dev/null +++ b/rejects/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch.rej @@ -0,0 +1,74 @@ +++++ REJECTED PATCH 9 + this.playerEntityList.remove(playerIn); + this.uuidToPlayerMap.remove(playerIn.getUniqueID()); + this.playerStatFiles.remove(playerIn.getUniqueID()); ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); + this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn})); + } + +++++ END PATCH +++++ REJECTED PATCH 10 + + public EntityPlayerMP recreatePlayerEntity(EntityPlayerMP playerIn, int dimension, boolean conqueredEnd) + { ++ World world = mcServer.worldServerForDimension(dimension); ++ if (world == null) ++ { ++ dimension = 0; ++ } ++ else if (!world.provider.canRespawnHere()) ++ { ++ dimension = world.provider.getRespawnDimension(playerIn); ++ } ++ + playerIn.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(playerIn); + playerIn.getServerForPlayer().getEntityTracker().untrackEntity(playerIn); + playerIn.getServerForPlayer().getPlayerManager().removePlayer(playerIn); + this.playerEntityList.remove(playerIn); + this.mcServer.worldServerForDimension(playerIn.dimension).removePlayerEntityDangerously(playerIn); +- BlockPos blockpos = playerIn.getBedLocation(); +- boolean flag1 = playerIn.isSpawnForced(); ++ BlockPos blockpos = playerIn.getBedLocation(dimension); ++ boolean flag1 = playerIn.isSpawnForced(dimension); + playerIn.dimension = dimension; + Object object; + +++++ END PATCH +++++ REJECTED PATCH 11 + EntityPlayerMP entityplayermp1 = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(playerIn.dimension), playerIn.getGameProfile(), (ItemInWorldManager)object); + entityplayermp1.playerNetServerHandler = playerIn.playerNetServerHandler; + entityplayermp1.clonePlayer(playerIn, conqueredEnd); ++ entityplayermp1.dimension = dimension; + entityplayermp1.setEntityId(playerIn.getEntityId()); + entityplayermp1.func_174817_o(playerIn); + WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); +++++ END PATCH +++++ REJECTED PATCH 12 + this.uuidToPlayerMap.put(entityplayermp1.getUniqueID(), entityplayermp1); + entityplayermp1.addSelfToInternalCraftingInventory(); + entityplayermp1.setHealth(entityplayermp1.getHealth()); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp1); + return entityplayermp1; + } + + public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension) + { ++ transferPlayerToDimension(playerIn, dimension, mcServer.worldServerForDimension(dimension).getDefaultTeleporter()); ++ } ++ ++ public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension, net.minecraft.world.Teleporter teleporter) ++ { + int j = playerIn.dimension; + WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); + playerIn.dimension = dimension; + WorldServer worldserver1 = this.mcServer.worldServerForDimension(playerIn.dimension); +- playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, playerIn.worldObj.getDifficulty(), playerIn.worldObj.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); ++ playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); // Forge: Use new dimensions information + worldserver.removePlayerEntityDangerously(playerIn); + playerIn.isDead = false; +- this.transferEntityToWorld(playerIn, j, worldserver, worldserver1); ++ this.transferEntityToWorld(playerIn, j, worldserver, worldserver1, teleporter); + this.func_72375_a(playerIn, worldserver); + playerIn.playerNetServerHandler.setPlayerLocation(playerIn.posX, playerIn.posY, playerIn.posZ, playerIn.rotationYaw, playerIn.rotationPitch); + playerIn.theItemInWorldManager.setWorld(worldserver1); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch.rej b/rejects/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch.rej new file mode 100644 index 000000000..8e844f913 --- /dev/null +++ b/rejects/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + + public void processHandshake(C00Handshake packetIn) + { ++ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return; ++ + switch (NetHandlerHandshakeTCP.SwitchEnumConnectionState.VALUES[packetIn.getRequestedState().ordinal()]) + { + case 1: +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch.rej b/rejects/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch.rej new file mode 100644 index 000000000..6b058fdfe --- /dev/null +++ b/rejects/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 2 + } + + this.networkManager.sendPacket(new S02PacketLoginSuccess(this.loginGameProfile)); +- this.server.getConfigurationManager().initializeConnectionToPlayer(this.networkManager, this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile)); ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.getConfigurationManager(), this.networkManager, this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile)); + } + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/stats/StatList.java.patch.rej b/rejects/minecraft/net/minecraft/stats/StatList.java.patch.rej new file mode 100644 index 000000000..ccf210286 --- /dev/null +++ b/rejects/minecraft/net/minecraft/stats/StatList.java.patch.rej @@ -0,0 +1,15 @@ +++++ REJECTED PATCH 2 + while (iterator.hasNext()) + { + Block block = (Block)iterator.next(); +- Item item = Item.getItemFromBlock(block); ++ Item item = Item.getItemFromBlock(block); //TODO: Hook FML's stat change event and re-assign these + + if (item != null) + { +- int i = Block.getIdFromBlock(block); ++ int i = Block.getIdFromBlock(block); //TODO: Hook FML's stat change event and re-assign these + String s = func_180204_a(item); + + if (s != null && block.getEnableStats()) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/tileentity/TileEntity.java.patch.rej b/rejects/minecraft/net/minecraft/tileentity/TileEntity.java.patch.rej new file mode 100644 index 000000000..7a2b4ecfd --- /dev/null +++ b/rejects/minecraft/net/minecraft/tileentity/TileEntity.java.patch.rej @@ -0,0 +1,13 @@ +++++ REJECTED PATCH 3 + { + TileEntity tileentity = null; + ++ Class oclass = null; + try + { +- Class oclass = (Class)nameToClassMap.get(nbt.getString("id")); ++ oclass = (Class)nameToClassMap.get(nbt.getString("id")); + + if (oclass != null) + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch.rej b/rejects/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch.rej new file mode 100644 index 000000000..5e7eb1c9e --- /dev/null +++ b/rejects/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch.rej @@ -0,0 +1,39 @@ +++++ REJECTED PATCH 1 + + if (itemstack1 == null) + { +- p_174916_0_.setInventorySlotContents(p_174916_2_, p_174916_1_); +- p_174916_1_ = null; ++ //Forge: BUGFIX: Again, make things respect max stack sizes. ++ int max = Math.min(p_174916_1_.getMaxStackSize(), p_174916_0_.getInventoryStackLimit()); ++ if (max >= p_174916_1_.stackSize) ++ { ++ p_174916_0_.setInventorySlotContents(p_174916_2_, p_174916_1_); ++ p_174916_1_ = null; ++ } ++ else ++ { ++ p_174916_0_.setInventorySlotContents(p_174916_2_, p_174916_1_.splitStack(max)); ++ } + flag = true; + } + else if (canCombine(itemstack1, p_174916_1_)) + { +- int j = p_174916_1_.getMaxStackSize() - itemstack1.stackSize; +- int k = Math.min(p_174916_1_.stackSize, j); +- p_174916_1_.stackSize -= k; +- itemstack1.stackSize += k; +- flag = k > 0; ++ //Forge: BUGFIX: Again, make things respect max stack sizes. ++ int max = Math.min(p_174916_1_.getMaxStackSize(), p_174916_0_.getInventoryStackLimit()); ++ if (max > itemstack1.stackSize) ++ { ++ int size = Math.min(p_174916_1_.stackSize, max - itemstack1.stackSize); ++ p_174916_1_.stackSize -= size; ++ itemstack1.stackSize += size; ++ flag = size > 0; ++ } + } + + if (flag) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/EnumChatFormatting.java.patch.rej b/rejects/minecraft/net/minecraft/util/EnumChatFormatting.java.patch.rej new file mode 100644 index 000000000..3a2334006 --- /dev/null +++ b/rejects/minecraft/net/minecraft/util/EnumChatFormatting.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 1 + return this.controlString; + } + +- @SideOnly(Side.CLIENT) + public static String getTextWithoutFormattingCodes(String text) + { + return text == null ? null : formattingCodePattern.matcher(text).replaceAll(""); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/EnumFacing.java.patch.rej b/rejects/minecraft/net/minecraft/util/EnumFacing.java.patch.rej new file mode 100644 index 000000000..81b2d786d --- /dev/null +++ b/rejects/minecraft/net/minecraft/util/EnumFacing.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 9 + } + } + +- public static enum Plane implements Predicate, Iterable { ++ public static enum Plane implements Predicate, Iterable { //Forge re-add generic because it just makes life easier. + HORIZONTAL, + VERTICAL; + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/Session.java.patch.rej b/rejects/minecraft/net/minecraft/util/Session.java.patch.rej new file mode 100644 index 000000000..11b745c24 --- /dev/null +++ b/rejects/minecraft/net/minecraft/util/Session.java.patch.rej @@ -0,0 +1,17 @@ +++++ REJECTED PATCH 2 + try + { + UUID uuid = UUIDTypeAdapter.fromString(this.getPlayerID()); +- return new GameProfile(uuid, this.getUsername()); ++ GameProfile ret = new GameProfile(uuid, this.getUsername()); //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.getUsername()); ++ return new GameProfile(net.minecraft.entity.player.EntityPlayer.getUUID(new GameProfile((UUID)null, this.getUsername())), this.getUsername()); + } + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/StringTranslate.java.patch.rej b/rejects/minecraft/net/minecraft/util/StringTranslate.java.patch.rej new file mode 100644 index 000000000..b552d2408 --- /dev/null +++ b/rejects/minecraft/net/minecraft/util/StringTranslate.java.patch.rej @@ -0,0 +1,64 @@ +++++ REJECTED PATCH 1 + { + private static final Pattern numericVariablePattern = Pattern.compile("%(\\d+\\$)?[\\d\\.]*[df]"); + private static final Splitter equalSignSplitter = Splitter.on('=').limit(2); ++ private final Map languageList; + private static StringTranslate instance = new StringTranslate(); +- private final Map languageList = Maps.newHashMap(); + private long lastUpdateTimeInMilliseconds; + private static final String __OBFID = "CL_00001212"; + + public StringTranslate() + { ++ InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); ++ languageList = Maps.newHashMap(); ++ inject(this, inputstream); ++ } ++ ++ public static void inject(InputStream inputstream) ++ { ++ inject(instance, inputstream); ++ } ++ ++ private static void inject(StringTranslate inst, InputStream inputstream) ++ { ++ java.util.HashMap map = parseLangFile(inputstream); ++ inst.languageList.putAll(map); ++ inst.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); ++ } ++ ++ public static java.util.HashMap parseLangFile(InputStream inputstream) ++ { ++ java.util.HashMap table = Maps.newHashMap(); + try + { +- InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); ++ inputstream = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(table, inputstream); ++ if (inputstream == null) return table; ++ + Iterator iterator = IOUtils.readLines(inputstream, Charsets.UTF_8).iterator(); + + while (iterator.hasNext()) +++++ END PATCH +++++ REJECTED PATCH 2 + { + String s1 = astring[0]; + String s2 = numericVariablePattern.matcher(astring[1]).replaceAll("%$1s"); +- this.languageList.put(s1, s2); ++ table.put(s1, s2); + } + } + } + +- this.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); + } +- catch (IOException ioexception) ++ catch (Exception ioexception) + { + ; + } ++ return table; + } + + static StringTranslate getInstance() +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch.rej b/rejects/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch.rej new file mode 100644 index 000000000..422036166 --- /dev/null +++ b/rejects/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch.rej @@ -0,0 +1,54 @@ +++++ REJECTED PATCH 1 + for (int j = 0; j < p_177630_3_; ++j) + { + WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, p_177630_1_); +- int k = weightedrandomchestcontent.theMinimumChanceToGenerateItem + random.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1); ++ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, p_177630_2_); + +- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= k) ++ for (ItemStack itemstack : stacks) + { +- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); +- itemstack.stackSize = k; + p_177630_2_.setInventorySlotContents(random.nextInt(p_177630_2_.getSizeInventory()), itemstack); + } +- else +- { +- for (int l = 0; l < k; ++l) +- { +- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); +- itemstack1.stackSize = 1; +- p_177630_2_.setInventorySlotContents(random.nextInt(p_177630_2_.getSizeInventory()), itemstack1); +- } +- } + } + } + +++++ END PATCH +++++ REJECTED PATCH 2 + for (int j = 0; j < p_177631_3_; ++j) + { + WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, p_177631_1_); +- int k = weightedrandomchestcontent.theMinimumChanceToGenerateItem + random.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1); ++ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, dispenser); + +- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= k) ++ for (ItemStack itemstack : stacks) + { +- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); +- itemstack.stackSize = k; + dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack); + } +- else +- { +- for (int l = 0; l < k; ++l) +- { +- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); +- itemstack1.stackSize = 1; +- dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack1); +- } +- } + } + } + +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/Explosion.java.patch.rej b/rejects/minecraft/net/minecraft/world/Explosion.java.patch.rej new file mode 100644 index 000000000..2cd87d5d3 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/Explosion.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 4 + int k1 = MathHelper.floor_double(this.explosionZ - (double)f3 - 1.0D); + int i1 = MathHelper.floor_double(this.explosionZ + (double)f3 + 1.0D); + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, new AxisAlignedBB((double)j, (double)j1, (double)k1, (double)k, (double)l, (double)i1)); ++ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.worldObj, this, list, f3); + Vec3 vec3 = new Vec3(this.explosionX, this.explosionY, this.explosionZ); + + for (int l1 = 0; l1 < list.size(); ++l1) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/WorldProvider.java.patch.rej b/rejects/minecraft/net/minecraft/world/WorldProvider.java.patch.rej new file mode 100644 index 000000000..909aac637 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/WorldProvider.java.patch.rej @@ -0,0 +1,17 @@ +++++ REJECTED PATCH 3 + + public int getAverageGroundLevel() + { +- return this.terrainType == WorldType.FLAT ? 4 : 64; ++ return this.terrainType.getMinimumSpawnHeight(this.worldObj); + } + + @SideOnly(Side.CLIENT) + public double getVoidFogYFactor() + { +- return this.terrainType == WorldType.FLAT ? 1.0D : 0.03125D; ++ return this.terrainType.voidFadeMagnitude(); + } + + @SideOnly(Side.CLIENT) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/WorldServer.java.patch.rej b/rejects/minecraft/net/minecraft/world/WorldServer.java.patch.rej new file mode 100644 index 000000000..e14cede12 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/WorldServer.java.patch.rej @@ -0,0 +1,90 @@ +++++ REJECTED PATCH 3 + public BiomeGenBase.SpawnListEntry func_175734_a(EnumCreatureType p_175734_1_, BlockPos p_175734_2_) + { + List list = this.getChunkProvider().func_177458_a(p_175734_1_, p_175734_2_); ++ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(this, p_175734_1_, p_175734_2_, list); + return list != null && !list.isEmpty() ? (BiomeGenBase.SpawnListEntry)WeightedRandom.getRandomItem(this.rand, list) : null; + } + +++++ END PATCH +++++ REJECTED PATCH 7 + if (p_175654_2_.requiresUpdates()) + { + b0 = 8; ++ //Keeping here as a note for future when it may be restored. ++ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.position.getX() >> 4, nextticklistentry.position.getZ() >> 4)); ++ b0 = (byte)(isForced ? 0 : 8); + + if (this.isAreaLoaded(nextticklistentry.position.add(-b0, -b0, -b0), nextticklistentry.position.add(b0, b0, b0))) + { +++++ END PATCH +++++ REJECTED PATCH 9 + { + nextticklistentry = (NextTickListEntry)iterator.next(); + iterator.remove(); ++ //Keeping here as a note for future when it may be restored. ++ //boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.xCoord >> 4, nextticklistentry.zCoord >> 4)); ++ //byte b0 = isForced ? 0 : 8; + byte b0 = 0; + + if (this.isAreaLoaded(nextticklistentry.position.add(-b0, -b0, -b0), nextticklistentry.position.add(b0, b0, b0))) +++++ END PATCH +++++ REJECTED PATCH 10 + { + ArrayList arraylist = Lists.newArrayList(); + +- for (int k1 = 0; k1 < this.loadedTileEntityList.size(); ++k1) ++ //Forge: Optomize this loop to only grab from the chunks it needs ++ for (int x = (p_147486_1_ >> 4); x <= (p_147486_4_ >> 4); x++) + { +- TileEntity tileentity = (TileEntity)this.loadedTileEntityList.get(k1); +- BlockPos blockpos = tileentity.getPos(); +- +- if (blockpos.getX() >= p_147486_1_ && blockpos.getY() >= p_147486_2_ && blockpos.getZ() >= p_147486_3_ && blockpos.getX() < p_147486_4_ && blockpos.getY() < p_147486_5_ && blockpos.getZ() < p_147486_6_) ++ for (int z = (p_147486_3_ >> 4); z <= (p_147486_6_ >> 4); z++) + { +- arraylist.add(tileentity); ++ Chunk chunk = this.getChunkFromChunkCoords(x, z); ++ if (chunk != null) ++ { ++ for (Object obj : chunk.getTileEntityMap().values()) ++ { ++ TileEntity entity = (TileEntity)obj; ++ if (!entity.isInvalid()) ++ { ++ BlockPos pos = entity.getPos(); ++ if (pos.getX() >= p_147486_1_ && pos.getY() >= p_147486_2_ && pos.getZ() >= p_147486_3_ && ++ pos.getX() <= p_147486_4_ && pos.getY() <= p_147486_5_ && pos.getZ() <= p_147486_6_) ++ { ++ arraylist.add(entity); ++ } ++ ++ } ++ } ++ } + } + } + +++++ END PATCH +++++ REJECTED PATCH 14 + } + + this.chunkProvider.saveChunks(p_73044_1_, p_73044_2_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this)); + List list = this.theChunkProviderServer.func_152380_a(); + Iterator iterator = list.iterator(); + +++++ END PATCH +++++ REJECTED PATCH 18 + return this.mcServer.isCallingFromMinecraftThread(); + } + ++ public java.io.File getChunkSaveLocation() ++ { ++ return ((net.minecraft.world.chunk.storage.AnvilChunkLoader)theChunkProviderServer.chunkLoader).chunkSaveLocation; ++ } ++ + static class ServerBlockEventList extends ArrayList + { + private static final String __OBFID = "CL_00001439"; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/WorldServerMulti.java.patch.rej b/rejects/minecraft/net/minecraft/world/WorldServerMulti.java.patch.rej new file mode 100644 index 000000000..d7ea32b1c --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/WorldServerMulti.java.patch.rej @@ -0,0 +1,32 @@ +++++ REJECTED PATCH 2 + { + WorldServerMulti.this.getWorldBorder().setDamageBuffer(newSize); + } +- }); ++ }; ++ this.delegate.getWorldBorder().addListener(this.borderListener); + } + +- protected void saveLevel() throws MinecraftException {} ++ protected void saveLevel() throws MinecraftException ++ { ++ this.perWorldStorage.saveAllData(); ++ } + + public World init() + { + this.mapStorage = this.delegate.getMapStorage(); + this.worldScoreboard = this.delegate.getScoreboard(); + String s = VillageCollection.fileNameForProvider(this.provider); +- VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s); ++ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.loadData(VillageCollection.class, s); + + if (villagecollection == null) + { + this.villageCollectionObj = new VillageCollection(this); +- this.mapStorage.setData(s, this.villageCollectionObj); ++ this.perWorldStorage.setData(s, this.villageCollectionObj); + } + else + { +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch.rej b/rejects/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch.rej new file mode 100644 index 000000000..c9c7d3934 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + int i1 = p_180624_2_.nextInt(16); + BlockPos blockpos1 = p_180624_3_.add(k, l, i1); + +- if (worldIn.getBlockState(blockpos1).getBlock() == Blocks.stone) ++ if (worldIn.getBlockState(blockpos1).getBlock().isReplaceableOreGen(worldIn, blockpos1, net.minecraft.block.state.pattern.BlockHelper.forBlock(Blocks.stone))) + { + worldIn.setBlockState(blockpos1, Blocks.emerald_ore.getDefaultState(), 2); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch.rej b/rejects/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch.rej new file mode 100644 index 000000000..911c315e6 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch.rej @@ -0,0 +1,22 @@ +++++ REJECTED PATCH 1 + File file1 = this.getWorldDirectory(); + File file2; + +- if (provider instanceof WorldProviderHell) ++ if (provider.getSaveFolder() != null) + { +- file2 = new File(file1, "DIM-1"); ++ file2 = new File(file1, provider.getSaveFolder()); + file2.mkdirs(); + return new AnvilChunkLoader(file2); + } +- else if (provider instanceof WorldProviderEnd) +- { +- file2 = new File(file1, "DIM1"); +- file2.mkdirs(); +- return new AnvilChunkLoader(file2); +- } + else + { + return new AnvilChunkLoader(file1); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch.rej b/rejects/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch.rej new file mode 100644 index 000000000..89b9cdc9a --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + + public void set(int x, int y, int z, IBlockState state) + { ++ if (state instanceof net.minecraftforge.common.property.IExtendedBlockState) ++ state = ((net.minecraftforge.common.property.IExtendedBlockState) state).getClean(); + IBlockState iblockstate1 = this.get(x, y, z); + Block block = iblockstate1.getBlock(); + Block block1 = state.getBlock(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch.rej new file mode 100644 index 000000000..091395f9c --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch.rej @@ -0,0 +1,31 @@ +++++ REJECTED PATCH 2 + { + IBlockState iblockstate1 = p_180707_5_.getBlockState(k2, j3, j4); + +- if (iblockstate1.getBlock() == Blocks.grass) ++ if (isTopBlock(p_180707_5_, k2, j3, j4, p_180707_3_, p_180707_4_)) + { + flag = true; + } + +- if (iblockstate1.getBlock() == Blocks.stone || iblockstate1.getBlock() == Blocks.dirt || iblockstate1.getBlock() == Blocks.grass) +- { +- if (j3 - 1 < 10) +- { +- p_180707_5_.setBlockState(k2, j3, j4, Blocks.flowing_lava.getDefaultState()); +- } +- else +- { +- p_180707_5_.setBlockState(k2, j3, j4, Blocks.air.getDefaultState()); +- +- if (flag && p_180707_5_.getBlockState(k2, j3 - 1, j4).getBlock() == Blocks.dirt) +- { +- p_180707_5_.setBlockState(k2, j3 - 1, j4, this.worldObj.getBiomeGenForCoords(new BlockPos(k2 + p_180707_3_ * 16, 0, j4 + p_180707_4_ * 16)).topBlock); +- } +- } +- } ++ digBlock(p_180707_5_, k2, j3, j4, p_180707_3_, p_180707_4_, flag); + } + } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch.rej new file mode 100644 index 000000000..9f4017dba --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch.rej @@ -0,0 +1,38 @@ +++++ REJECTED PATCH 1 + { + if (k >= 0 && k < 256) + { +- Block block = worldIn.getBlockState(new BlockPos(l, k, i1)).getBlock(); ++ BlockPos pos = new BlockPos(l, k, i1); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(pos); + +- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) ++ if (!state.getBlock().isAir(worldIn, pos) && !state.getBlock().isLeaves(worldIn, pos)) + { + flag = false; + } +++++ END PATCH +++++ REJECTED PATCH 2 + { + BlockPos blockpos1 = new BlockPos(i2, l, j1); + +- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Block.getBlockById(Block.getIdFromBlock(Blocks.brown_mushroom_block) + i), k1); + } +++++ END PATCH +++++ REJECTED PATCH 3 + + for (l = 0; l < j; ++l) + { +- Block block2 = worldIn.getBlockState(p_180709_3_.up(l)).getBlock(); ++ BlockPos upN = p_180709_3_.up(l); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(upN); + +- if (!block2.isFullBlock()) ++ if (state.getBlock().canBeReplacedByLeaves(worldIn, upN)) + { + this.func_175905_a(worldIn, p_180709_3_.up(l), Block.getBlockById(Block.getIdFromBlock(Blocks.brown_mushroom_block) + i), 10); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch.rej new file mode 100644 index 000000000..442445d1e --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch.rej @@ -0,0 +1,23 @@ +++++ REJECTED PATCH 1 + if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_180712_2_ * p_180712_2_)) + { + BlockPos blockpos1 = p_180712_1_.add(j, 0, k); +- Material material = this.world.getBlockState(blockpos1).getBlock().getMaterial(); ++ net.minecraft.block.state.IBlockState state = this.world.getBlockState(blockpos1); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(this.world, blockpos1) || state.getBlock().isLeaves(this.world, blockpos1)) + { + this.func_175905_a(this.world, blockpos1, p_180712_3_, 0); + } +++++ END PATCH +++++ REJECTED PATCH 2 + { + BlockPos blockpos3 = p_175936_1_.add((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2)); + +- if (!this.func_150523_a(this.world.getBlockState(blockpos3).getBlock())) ++ if (!this.isReplaceable(world, blockpos3)) + { + return j; + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch.rej new file mode 100644 index 000000000..d0aa9d329 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch.rej @@ -0,0 +1,69 @@ +++++ REJECTED PATCH 1 + { + if (j >= 0 && j < 256) + { +- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(k, j, l)).getBlock())) ++ if (!this.isReplaceable(worldIn, new BlockPos(k, j, l))) + { + flag = false; + } +++++ END PATCH +++++ REJECTED PATCH 2 + } + else + { +- Block block = worldIn.getBlockState(p_180709_3_.down()).getBlock(); ++ BlockPos down = p_180709_3_.down(); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(down); ++ boolean isSoil = state.getBlock().canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + +- if ((block == Blocks.grass || block == Blocks.dirt) && p_180709_3_.getY() < 256 - i - 1) ++ if (isSoil && p_180709_3_.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, p_180709_3_.down()); +- this.func_175921_a(worldIn, p_180709_3_.add(1, -1, 0)); +- this.func_175921_a(worldIn, p_180709_3_.add(1, -1, 1)); +- this.func_175921_a(worldIn, p_180709_3_.add(0, -1, 1)); ++ this.onPlantGrow(worldIn, p_180709_3_.down(), p_180709_3_); ++ this.onPlantGrow(worldIn, p_180709_3_.add(1, -1, 0), p_180709_3_); ++ this.onPlantGrow(worldIn, p_180709_3_.add(1, -1, 1), p_180709_3_); ++ this.onPlantGrow(worldIn, p_180709_3_.add(0, -1, 1), p_180709_3_); + EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(p_180709_2_); + k = i - p_180709_2_.nextInt(4); + l = 2 - p_180709_2_.nextInt(3); +++++ END PATCH +++++ REJECTED PATCH 3 + } + + BlockPos blockpos1 = new BlockPos(i1, i2, j1); +- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); ++ state = worldIn.getBlockState(blockpos1); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(worldIn, blockpos1) || state.getBlock().isLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.log2, BlockPlanks.EnumType.DARK_OAK.getMetadata() - 4); + this.func_175905_a(worldIn, blockpos1.east(), Blocks.log2, BlockPlanks.EnumType.DARK_OAK.getMetadata() - 4); +++++ END PATCH +++++ REJECTED PATCH 4 + + private void func_150526_a(World worldIn, int p_150526_2_, int p_150526_3_, int p_150526_4_) + { +- Block block = worldIn.getBlockState(new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_)).getBlock(); ++ BlockPos pos = new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(pos); + +- if (block.getMaterial() == Material.air) ++ if (state.getBlock().isAir(worldIn, pos)) + { + this.func_175905_a(worldIn, new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_), Blocks.leaves2, 1); + } + } ++ ++ //Just a helper macro ++ private void onPlantGrow(World world, BlockPos pos, BlockPos source) ++ { ++ world.getBlockState(pos).getBlock().onPlantGrow(world, pos, source); ++ } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch.rej new file mode 100644 index 000000000..a00224614 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch.rej @@ -0,0 +1,42 @@ +++++ REJECTED PATCH 1 + { + if (j >= 0 && j < 256) + { +- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(k, j, l)).getBlock())) ++ if (!this.isReplaceable(worldIn, new BlockPos(k, j, l))) + { + flag = false; + } +++++ END PATCH +++++ REJECTED PATCH 2 + } + else + { +- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); ++ BlockPos down = p_180709_3_.down(); ++ Block block1 = worldIn.getBlockState(down).getBlock(); ++ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + +- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && p_180709_3_.getY() < 256 - i - 1) ++ if (isSoil && p_180709_3_.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, p_180709_3_.down()); ++ block1.onPlantGrow(worldIn, down, p_180709_3_); + int i2; + + for (i2 = p_180709_3_.getY() - 3 + i; i2 <= p_180709_3_.getY() + i; ++i2) +++++ END PATCH +++++ REJECTED PATCH 4 + + for (i2 = 0; i2 < i; ++i2) + { +- Block block2 = worldIn.getBlockState(p_180709_3_.up(i2)).getBlock(); ++ BlockPos upN = p_180709_3_.up(i2); ++ Block block2 = worldIn.getBlockState(upN).getBlock(); + +- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves) ++ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN)) + { + this.func_175905_a(worldIn, p_180709_3_.up(i2), Blocks.log, BlockPlanks.EnumType.BIRCH.getMetadata()); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch.rej new file mode 100644 index 000000000..967d42121 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch.rej @@ -0,0 +1,57 @@ +++++ REJECTED PATCH 1 + { + for (int l = -b0; l <= b0 && flag; ++l) + { +- if (p_175926_2_.getY() + j < 0 || p_175926_2_.getY() + j >= 256 || !this.func_150523_a(worldIn.getBlockState(p_175926_2_.add(k, j, l)).getBlock())) ++ if (p_175926_2_.getY() + j < 0 || p_175926_2_.getY() + j >= 256 || !this.isReplaceable(worldIn, p_175926_2_.add(k, j, l))) + { + flag = false; + } +++++ END PATCH +++++ REJECTED PATCH 2 + { + BlockPos blockpos1 = p_175927_1_.down(); + Block block = worldIn.getBlockState(blockpos1).getBlock(); ++ boolean isSoil = block.canSustainPlant(worldIn, blockpos1, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + +- if ((block == Blocks.grass || block == Blocks.dirt) && p_175927_1_.getY() >= 2) ++ if (isSoil && p_175927_1_.getY() >= 2) + { +- this.func_175921_a(worldIn, blockpos1); +- this.func_175921_a(worldIn, blockpos1.east()); +- this.func_175921_a(worldIn, blockpos1.south()); +- this.func_175921_a(worldIn, blockpos1.south().east()); ++ this.onPlantGrow(worldIn, blockpos1, p_175927_1_); ++ this.onPlantGrow(worldIn, blockpos1.east(), p_175927_1_); ++ this.onPlantGrow(worldIn, blockpos1.south(), p_175927_1_); ++ this.onPlantGrow(worldIn, blockpos1.south().east(), p_175927_1_); + return true; + } + else +++++ END PATCH +++++ REJECTED PATCH 3 + if (k * k + l * l <= j || i1 * i1 + j1 * j1 <= j || k * k + j1 * j1 <= j || i1 * i1 + l * l <= j) + { + BlockPos blockpos1 = p_175925_2_.add(k, 0, l); +- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos1); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(worldIn, blockpos1) || state.getBlock().isLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.leaves, this.leavesMetadata); + } +++++ END PATCH +++++ REJECTED PATCH 4 + if (k * k + l * l <= j) + { + BlockPos blockpos1 = p_175928_2_.add(k, 0, l); +- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); ++ Block block = worldIn.getBlockState(blockpos1).getBlock(); + +- if (material == Material.air || material == Material.leaves) ++ if (block.isAir(worldIn, blockpos1) || block.isLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.leaves, this.leavesMetadata); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch.rej new file mode 100644 index 000000000..9b9e63413 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch.rej @@ -0,0 +1,53 @@ +++++ REJECTED PATCH 1 + { + BlockPos blockpos1 = p_180709_3_.up(i2); + +- if (this.func_175931_a(worldIn.getBlockState(blockpos1).getBlock().getMaterial())) ++ if (this.isAirLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.log, this.woodMetadata); + +++++ END PATCH +++++ REJECTED PATCH 2 + { + BlockPos blockpos2 = blockpos1.east(); + +- if (this.func_175931_a(worldIn.getBlockState(blockpos2).getBlock().getMaterial())) ++ if (this.isAirLeaves(worldIn, blockpos2)) + { + this.func_175905_a(worldIn, blockpos2, Blocks.log, this.woodMetadata); + +++++ END PATCH +++++ REJECTED PATCH 3 + + BlockPos blockpos3 = blockpos1.south().east(); + +- if (this.func_175931_a(worldIn.getBlockState(blockpos3).getBlock().getMaterial())) ++ if (this.isAirLeaves(worldIn, blockpos3)) + { + this.func_175905_a(worldIn, blockpos3, Blocks.log, this.woodMetadata); + +++++ END PATCH +++++ REJECTED PATCH 4 + + BlockPos blockpos4 = blockpos1.south(); + +- if (this.func_175931_a(worldIn.getBlockState(blockpos4).getBlock().getMaterial())) ++ if (this.isAirLeaves(worldIn, blockpos4)) + { + this.func_175905_a(worldIn, blockpos4, Blocks.log, this.woodMetadata); + +++++ END PATCH +++++ REJECTED PATCH 5 + } + } + +- private boolean func_175931_a(Material p_175931_1_) +- { +- return p_175931_1_ == Material.air || p_175931_1_ == Material.leaves; +- } +- + private void func_175932_b(World worldIn, Random p_175932_2_, BlockPos p_175932_3_, int p_175932_4_) + { + if (p_175932_2_.nextInt(3) > 0 && worldIn.isAirBlock(p_175932_3_)) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch.rej new file mode 100644 index 000000000..5fcea52b7 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch.rej @@ -0,0 +1,65 @@ +++++ REJECTED PATCH 1 + + for (int j = 0; j < i; ++j) + { +- Block block = worldIn.getBlockState(p_180709_3_.up(j)).getBlock(); +- +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (this.isAirLeaves(worldIn, p_180709_3_.up(j))) + { + this.func_175905_a(worldIn, p_180709_3_.up(j), Blocks.log, this.woodMetadata); + } + + if (j < i - 1) + { +- block = worldIn.getBlockState(p_180709_3_.add(1, j, 0)).getBlock(); +- +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (this.isAirLeaves(worldIn, p_180709_3_.add(1, j, 0))) + { + this.func_175905_a(worldIn, p_180709_3_.add(1, j, 0), Blocks.log, this.woodMetadata); + } + +- block = worldIn.getBlockState(p_180709_3_.add(1, j, 1)).getBlock(); +- +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (this.isAirLeaves(worldIn, p_180709_3_.add(1, j, 1))) + { + this.func_175905_a(worldIn, p_180709_3_.add(1, j, 1), Blocks.log, this.woodMetadata); + } + +- block = worldIn.getBlockState(p_180709_3_.add(0, j, 1)).getBlock(); +- +- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) ++ if (this.isAirLeaves(worldIn, p_180709_3_.add(0, j, 1))) + { + this.func_175905_a(worldIn, p_180709_3_.add(0, j, 1), Blocks.log, this.woodMetadata); + } +++++ END PATCH +++++ REJECTED PATCH 2 + BlockPos blockpos1 = p_175934_2_.up(i); + Block block = worldIn.getBlockState(blockpos1).getBlock(); + +- if (block == Blocks.grass || block == Blocks.dirt) ++ if (block.canSustainPlant(worldIn, blockpos1, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) + { + this.func_175905_a(worldIn, blockpos1, Blocks.dirt, BlockDirt.DirtType.PODZOL.getMetadata()); + break; + } + +- if (block.getMaterial() != Material.air && i < 0) ++ if (!block.isAir(worldIn, blockpos1) && i < 0) + { + break; + } + } + } ++ ++ //Helper macro ++ private boolean isAirLeaves(World world, BlockPos pos) ++ { ++ net.minecraft.block.Block block = world.getBlockState(pos).getBlock(); ++ return block.isAir(world, pos) || block.isLeaves(world, pos); ++ } + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch.rej new file mode 100644 index 000000000..a059962cc --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 1 + { + BlockPos blockpos1 = new BlockPos(l1, i2, j2); + +- if (this.field_175919_c.apply(worldIn.getBlockState(blockpos1))) ++ if (worldIn.getBlockState(blockpos1).getBlock().isReplaceableOreGen(worldIn, blockpos1, this.field_175919_c)) + { + worldIn.setBlockState(blockpos1, this.oreBlock, 2); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch.rej new file mode 100644 index 000000000..bdaa224b7 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch.rej @@ -0,0 +1,36 @@ +++++ REJECTED PATCH 1 + { + if (j >= 0 && j < 256) + { +- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(k, j, l)).getBlock())) ++ if (!this.isReplaceable(worldIn, new BlockPos(k, j, l))) + { + flag = false; + } +++++ END PATCH +++++ REJECTED PATCH 3 + } + + BlockPos blockpos1 = new BlockPos(i1, i2, j1); +- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); ++ block = worldIn.getBlockState(blockpos1).getBlock(); + +- if (material == Material.air || material == Material.leaves) ++ if (block.isAir(worldIn, blockpos1) || block.isLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.log2, BlockPlanks.EnumType.ACACIA.getMetadata() - 4); + k1 = i2; +++++ END PATCH +++++ REJECTED PATCH 4 + i1 += enumfacing1.getFrontOffsetX(); + j1 += enumfacing1.getFrontOffsetZ(); + BlockPos blockpos2 = new BlockPos(i1, j2, j1); +- Material material1 = worldIn.getBlockState(blockpos2).getBlock().getMaterial(); ++ block = worldIn.getBlockState(blockpos2).getBlock(); + +- if (material1 == Material.air || material1 == Material.leaves) ++ if (block.isAir(worldIn, blockpos2) || block.isLeaves(worldIn, blockpos2)) + { + this.func_175905_a(worldIn, blockpos2, Blocks.log2, BlockPlanks.EnumType.ACACIA.getMetadata() - 4); + k1 = j2; +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch.rej new file mode 100644 index 000000000..dc7aec5a2 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch.rej @@ -0,0 +1,10 @@ +++++ REJECTED PATCH 2 + { + BlockPos blockpos1 = new BlockPos(l, i, j1); + +- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.leaves, this.field_150528_a); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch.rej new file mode 100644 index 000000000..61f1d8a60 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch.rej @@ -0,0 +1,102 @@ +++++ REJECTED PATCH 1 + { + if (j >= 0 && j < 256) + { +- Block block = worldIn.getBlockState(new BlockPos(k, j, l)).getBlock(); ++ BlockPos pos = new BlockPos(k, j, l); ++ Block block = worldIn.getBlockState(pos).getBlock(); + +- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) ++ if (!block.isAir(worldIn, pos) && !block.isLeaves(worldIn, pos)) + { + if (block != Blocks.water && block != Blocks.flowing_water) + { +++++ END PATCH +++++ REJECTED PATCH 2 + } + else + { +- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); ++ BlockPos down = p_180709_3_.down(); ++ Block block1 = worldIn.getBlockState(down).getBlock(); ++ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + +- if ((block1 == Blocks.grass || block1 == Blocks.dirt) && p_180709_3_.getY() < 256 - i - 1) ++ if (isSoil && p_180709_3_.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, p_180709_3_.down()); ++ block1.onPlantGrow(worldIn, down, p_180709_3_); + int i1; + BlockPos blockpos1; + int l1; +++++ END PATCH +++++ REJECTED PATCH 3 + { + blockpos1 = new BlockPos(i2, l1, j1); + +- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) + { + this.func_175906_a(worldIn, blockpos1, Blocks.leaves); + } +++++ END PATCH +++++ REJECTED PATCH 4 + + for (l1 = 0; l1 < i; ++l1) + { +- Block block2 = worldIn.getBlockState(p_180709_3_.up(l1)).getBlock(); ++ BlockPos upN = p_180709_3_.up(l1); ++ Block block2 = worldIn.getBlockState(upN).getBlock(); + +- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves || block2 == Blocks.flowing_water || block2 == Blocks.water) ++ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN) || block2 == Blocks.flowing_water || block2 == Blocks.water) + { + this.func_175906_a(worldIn, p_180709_3_.up(l1), Blocks.log); + } +++++ END PATCH +++++ REJECTED PATCH 5 + { + BlockPos blockpos4 = new BlockPos(i2, l1, i1); + +- if (worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.leaves) ++ if (worldIn.getBlockState(blockpos4).getBlock().isLeaves(worldIn, blockpos4)) + { + BlockPos blockpos5 = blockpos4.west(); + blockpos1 = blockpos4.east(); + BlockPos blockpos2 = blockpos4.north(); + BlockPos blockpos3 = blockpos4.south(); + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos5).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos5).getBlock().isAir(worldIn, blockpos5)) + { + this.func_175922_a(worldIn, blockpos5, BlockVine.EAST_FLAG); + } + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().isAir(worldIn, blockpos1)) + { + this.func_175922_a(worldIn, blockpos1, BlockVine.WEST_FLAG); + } + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().isAir(worldIn, blockpos2)) + { + this.func_175922_a(worldIn, blockpos2, BlockVine.SOUTH_FLAG); + } + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().isAir(worldIn, blockpos3)) + { + this.func_175922_a(worldIn, blockpos3, BlockVine.NORTH_FLAG); + } +++++ END PATCH +++++ REJECTED PATCH 6 + this.func_175905_a(worldIn, p_175922_2_, Blocks.vine, p_175922_3_); + int j = 4; + +- for (p_175922_2_ = p_175922_2_.down(); worldIn.getBlockState(p_175922_2_).getBlock().getMaterial() == Material.air && j > 0; --j) ++ for (p_175922_2_ = p_175922_2_.down(); worldIn.getBlockState(p_175922_2_).getBlock().isAir(worldIn, p_175922_2_) && j > 0; --j) + { + this.func_175905_a(worldIn, p_175922_2_, Blocks.vine, p_175922_3_); + p_175922_2_ = p_175922_2_.down(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch.rej new file mode 100644 index 000000000..349fa3cca --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch.rej @@ -0,0 +1,52 @@ +++++ REJECTED PATCH 1 + { + if (i1 >= 0 && i1 < 256) + { +- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(j1, i1, k1)).getBlock())) ++ if (!this.isReplaceable(worldIn, new BlockPos(j1, i1, k1))) + { + flag = false; + } +++++ END PATCH +++++ REJECTED PATCH 2 + } + else + { +- Block block = worldIn.getBlockState(p_180709_3_.down()).getBlock(); ++ BlockPos down = p_180709_3_.down(); ++ Block block = worldIn.getBlockState(down).getBlock(); ++ boolean isSoil = block.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); + +- if ((block == Blocks.grass || block == Blocks.dirt) && p_180709_3_.getY() < 256 - i - 1) ++ if (isSoil && p_180709_3_.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, p_180709_3_.down()); ++ block.onPlantGrow(worldIn, down, p_180709_3_); + k2 = 0; + + for (j1 = p_180709_3_.getY() + i; j1 >= p_180709_3_.getY() + j; --j1) +++++ END PATCH +++++ REJECTED PATCH 3 + { + BlockPos blockpos1 = new BlockPos(k1, j1, i2); + +- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.leaves, BlockPlanks.EnumType.SPRUCE.getMetadata()); + } +++++ END PATCH +++++ REJECTED PATCH 4 + + for (j1 = 0; j1 < i - 1; ++j1) + { +- Block block1 = worldIn.getBlockState(p_180709_3_.up(j1)).getBlock(); ++ BlockPos upN = p_180709_3_.up(j1); ++ Block block1 = worldIn.getBlockState(upN).getBlock(); + +- if (block1.getMaterial() == Material.air || block1.getMaterial() == Material.leaves) ++ if (block1.isAir(worldIn, upN) || block1.isLeaves(worldIn, upN)) + { + this.func_175905_a(worldIn, p_180709_3_.up(j1), Blocks.log, BlockPlanks.EnumType.SPRUCE.getMetadata()); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch.rej new file mode 100644 index 000000000..677e44789 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch.rej @@ -0,0 +1,56 @@ +++++ REJECTED PATCH 1 + { + if (i1 >= 0 && i1 < 256) + { +- Block block = worldIn.getBlockState(new BlockPos(j1, i1, k1)).getBlock(); ++ BlockPos off = new BlockPos(j1, i1, k1); ++ Block block = worldIn.getBlockState(off).getBlock(); + +- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) ++ if (!block.isAir(worldIn, off) && !block.isLeaves(worldIn, off)) + { + flag = false; + } +++++ END PATCH +++++ REJECTED PATCH 2 + } + else + { +- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); ++ BlockPos down = p_180709_3_.down(); ++ Block block1 = worldIn.getBlockState(down).getBlock(); ++ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); + +- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && p_180709_3_.getY() < 256 - i - 1) ++ if (isSoil && p_180709_3_.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, p_180709_3_.down()); ++ block1.onPlantGrow(worldIn, down, p_180709_3_); + i3 = p_180709_2_.nextInt(2); + j1 = 1; + byte b0 = 0; +++++ END PATCH +++++ REJECTED PATCH 3 + { + BlockPos blockpos1 = new BlockPos(i2, l1, k2); + +- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) + { + this.func_175905_a(worldIn, blockpos1, Blocks.leaves, BlockPlanks.EnumType.SPRUCE.getMetadata()); + } +++++ END PATCH +++++ REJECTED PATCH 4 + + for (l1 = 0; l1 < i - j3; ++l1) + { +- Block block2 = worldIn.getBlockState(p_180709_3_.up(l1)).getBlock(); ++ BlockPos upN = p_180709_3_.up(l1); ++ Block block2 = worldIn.getBlockState(upN).getBlock(); + +- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves) ++ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN)) + { + this.func_175905_a(worldIn, p_180709_3_.up(l1), Blocks.log, BlockPlanks.EnumType.SPRUCE.getMetadata()); + } +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch.rej new file mode 100644 index 000000000..6cd81a581 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch.rej @@ -0,0 +1,88 @@ +++++ REJECTED PATCH 1 + { + if (j >= 0 && j < 256) + { +- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(k, j, l)).getBlock())) ++ if (!this.isReplaceable(worldIn, new BlockPos(k, j, l))) + { + flag = false; + } +++++ END PATCH +++++ REJECTED PATCH 2 + } + else + { +- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); ++ BlockPos down = p_180709_3_.down(); ++ Block block1 = worldIn.getBlockState(down).getBlock(); ++ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); + +- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && p_180709_3_.getY() < 256 - i - 1) ++ if (isSoil && p_180709_3_.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, p_180709_3_.down()); ++ block1.onPlantGrow(worldIn, down, p_180709_3_); + b0 = 3; + byte b1 = 0; + int i1; +++++ END PATCH +++++ REJECTED PATCH 4 + + for (l = 0; l < i; ++l) + { +- Block block2 = worldIn.getBlockState(p_180709_3_.up(l)).getBlock(); ++ BlockPos upN = p_180709_3_.up(l); ++ Block block2 = worldIn.getBlockState(upN).getBlock(); + +- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves || block2.getMaterial() == Material.vine) ++ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN) || block2.getMaterial() == Material.vine) + { + this.func_175905_a(worldIn, p_180709_3_.up(l), Blocks.log, this.metaWood); + +++++ END PATCH +++++ REJECTED PATCH 5 + { + BlockPos blockpos3 = new BlockPos(k1, l, l1); + +- if (worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.leaves) ++ if (worldIn.getBlockState(blockpos3).getBlock().isLeaves(worldIn, blockpos3)) + { + BlockPos blockpos4 = blockpos3.west(); + blockpos1 = blockpos3.east(); + BlockPos blockpos5 = blockpos3.north(); + BlockPos blockpos2 = blockpos3.south(); + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().isAir(worldIn, blockpos4)) + { + this.func_175923_a(worldIn, blockpos4, BlockVine.EAST_FLAG); + } + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().isAir(worldIn, blockpos1)) + { + this.func_175923_a(worldIn, blockpos1, BlockVine.WEST_FLAG); + } + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos5).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos5).getBlock().isAir(worldIn, blockpos5)) + { + this.func_175923_a(worldIn, blockpos5, BlockVine.SOUTH_FLAG); + } + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().isAir(worldIn, blockpos2)) + { + this.func_175923_a(worldIn, blockpos2, BlockVine.NORTH_FLAG); + } +++++ END PATCH +++++ REJECTED PATCH 6 + this.func_175905_a(worldIn, p_175923_2_, Blocks.vine, p_175923_3_); + int j = 4; + +- for (p_175923_2_ = p_175923_2_.down(); worldIn.getBlockState(p_175923_2_).getBlock().getMaterial() == Material.air && j > 0; --j) ++ for (p_175923_2_ = p_175923_2_.down(); worldIn.getBlockState(p_175923_2_).getBlock().isAir(worldIn, p_175923_2_) && j > 0; --j) + { + this.func_175905_a(worldIn, p_175923_2_, Blocks.vine, p_175923_3_); + p_175923_2_ = p_175923_2_.down(); +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch.rej new file mode 100644 index 000000000..35b8bd6db --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch.rej @@ -0,0 +1,21 @@ +++++ REJECTED PATCH 1 + { + BiomeGenBase biomegenbase = abiomegenbase[j]; + +- if (biomegenbase != null && biomegenbase.minHeight > 0.0F) ++ if (biomegenbase != null && biomegenbase.minHeight > 0.0F && !net.minecraftforge.common.BiomeManager.strongHoldBiomesBlackList.contains(biomegenbase)) + { + this.field_151546_e.add(biomegenbase); + } + } ++ for (BiomeGenBase biome : net.minecraftforge.common.BiomeManager.strongHoldBiomes) ++ { ++ if (!this.field_151546_e.contains(biome)) ++ { ++ this.field_151546_e.add(biome); ++ } ++ } + } + + public MapGenStronghold(Map p_i2068_1_) +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch.rej new file mode 100644 index 000000000..8cb954dc5 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch.rej @@ -0,0 +1,9 @@ +++++ REJECTED PATCH 3 + abstract static class Piece extends StructureComponent + { + protected static final List field_111019_a = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.diamond, 0, 1, 3, 5), new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 5), new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 15), new WeightedRandomChestContent(Items.golden_sword, 0, 1, 1, 5), new WeightedRandomChestContent(Items.golden_chestplate, 0, 1, 1, 5), new WeightedRandomChestContent(Items.flint_and_steel, 0, 1, 1, 5), new WeightedRandomChestContent(Items.nether_wart, 0, 3, 7, 5), new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 10), new WeightedRandomChestContent(Items.golden_horse_armor, 0, 1, 1, 8), new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 5), new WeightedRandomChestContent(Items.diamond_horse_armor, 0, 1, 1, 3), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.obsidian), 0, 2, 4, 2)}); ++ static { net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, field_111019_a, 2, 5); } + private static final String __OBFID = "CL_00000466"; + + public Piece() {} +++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/storage/SaveHandler.java.patch.rej b/rejects/minecraft/net/minecraft/world/storage/SaveHandler.java.patch.rej new file mode 100644 index 000000000..5c25036b4 --- /dev/null +++ b/rejects/minecraft/net/minecraft/world/storage/SaveHandler.java.patch.rej @@ -0,0 +1,48 @@ +++++ REJECTED PATCH 1 + NBTTagCompound nbttagcompound; + NBTTagCompound nbttagcompound1; + ++ WorldInfo worldInfo = null; ++ + if (file1.exists()) + { + try + { + nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1)); + nbttagcompound1 = nbttagcompound.getCompoundTag("Data"); +- return new WorldInfo(nbttagcompound1); ++ worldInfo = new WorldInfo(nbttagcompound1); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound); ++ return worldInfo; + } ++ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) ++ { ++ throw e; ++ } + catch (Exception exception1) + { + exception1.printStackTrace(); + } + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().confirmBackupLevelDatUse(this); + file1 = new File(this.worldDirectory, "level.dat_old"); + + if (file1.exists()) +++++ END PATCH +++++ REJECTED PATCH 2 + { + nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1)); + nbttagcompound1 = nbttagcompound.getCompoundTag("Data"); +- return new WorldInfo(nbttagcompound1); ++ worldInfo = new WorldInfo(nbttagcompound1); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound); ++ return worldInfo; ++ } ++ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) ++ { ++ throw e; + } + catch (Exception exception) + { +++++ END PATCH From e833ee81fb1be00514a69eb50daf2f803e05b799 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 10 Nov 2015 00:03:39 +0300 Subject: [PATCH 006/133] Updated various rendering-related patches and classes to 1.8.8; forge still uses vecmath. --- .../client/renderer/WorldRenderer.java.patch | 7 +- .../WorldVertexBufferUploader.java.patch | 66 ++++++++++++++ .../block/model/FaceBakery.java.patch | 54 +++++++++++ .../renderer/chunk/RenderChunk.java.patch | 24 ++++- .../renderer/entity/RenderItem.java.patch | 60 +++++++++++-- .../vertex/VertexFormatElement.java.patch | 21 +++++ .../resources/model/ModelBakery.java.patch | 18 +++- .../WorldVertexBufferUploader.java.patch.rej | 70 --------------- .../block/model/FaceBakery.java.patch.rej | 57 ------------ .../renderer/chunk/RenderChunk.java.patch.rej | 22 ----- .../renderer/entity/RenderItem.java.patch.rej | 65 -------------- .../vertex/VertexFormatElement.java.patch.rej | 49 ---------- .../model/ModelBakery.java.patch.rej | 17 ---- .../client/ForgeHooksClient.java | 38 +++----- .../client/model/Attributes.java | 89 +------------------ .../client/model/ModelLoader.java | 13 ++- .../client/model/TRSRTransformation.java | 55 +++++++++++- .../client/model/pipeline/LightUtil.java | 4 +- .../model/pipeline/VertexLighterFlat.java | 2 +- src/main/resources/forge.exc | 4 +- .../minecraftforge/debug/ModelFluidDebug.java | 4 - .../debug/ModelLoaderRegistryDebug.java | 6 +- 22 files changed, 323 insertions(+), 422 deletions(-) create mode 100644 patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch.rej diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch index 8a9166d24..4741c65e3 100644 --- a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch @@ -1,15 +1,12 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/WorldRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/WorldRenderer.java -@@ -580,6 +580,14 @@ +@@ -580,6 +580,11 @@ } } + public void checkAndGrow() + { -+ if (this.rawBufferIndex >= this.bufferSize - this.vertexFormat.getNextOffset()) -+ { -+ this.growBuffer(2097152); -+ } ++ this.func_181670_b(vertexFormat.getNextOffset()/* / 4 * 4 */); + } + @SideOnly(Side.CLIENT) diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch b/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch new file mode 100644 index 000000000..4e2816de1 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch @@ -0,0 +1,66 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java +@@ -25,32 +25,9 @@ + + for (int j = 0; j < list.size(); ++j) + { ++ // moved to VertexFormatElement.preDraw + VertexFormatElement vertexformatelement = (VertexFormatElement)list.get(j); +- VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.getUsage(); +- int k = vertexformatelement.getType().getGlConstant(); +- int l = vertexformatelement.getIndex(); +- bytebuffer.position(vertexformat.func_181720_d(j)); +- +- switch (vertexformatelement$enumusage) +- { +- case POSITION: +- GL11.glVertexPointer(vertexformatelement.getElementCount(), k, i, bytebuffer); +- GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); +- break; +- case UV: +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + l); +- GL11.glTexCoordPointer(vertexformatelement.getElementCount(), k, i, bytebuffer); +- GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); +- break; +- case COLOR: +- GL11.glColorPointer(vertexformatelement.getElementCount(), k, i, bytebuffer); +- GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); +- break; +- case NORMAL: +- GL11.glNormalPointer(k, i, bytebuffer); +- GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY); +- } ++ vertexformatelement.getUsage().preDraw(vertexformat, j, i, bytebuffer); + } + + GL11.glDrawArrays(p_181679_1_.getDrawMode(), 0, p_181679_1_.getVertexCount()); +@@ -59,26 +36,8 @@ + for (int j1 = list.size(); i1 < j1; ++i1) + { + VertexFormatElement vertexformatelement1 = (VertexFormatElement)list.get(i1); +- VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.getUsage(); +- int k1 = vertexformatelement1.getIndex(); +- +- switch (vertexformatelement$enumusage1) +- { +- case POSITION: +- GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); +- break; +- case UV: +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + k1); +- GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); +- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); +- break; +- case COLOR: +- GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); +- GlStateManager.resetColor(); +- break; +- case NORMAL: +- GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); +- } ++ // moved to VertexFormatElement.postDraw ++ vertexformatelement1.getUsage().postDraw(vertexformat, j1, i, bytebuffer); + } + } + diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch index 0a53ccf64..646e52fff 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch @@ -12,3 +12,57 @@ int[] aint = this.makeQuadVertexData(face, sprite, facing, this.getPositionsDiv16(posFrom, posTo), modelRotationIn, partRotation, uvLocked, shade); EnumFacing enumfacing = getFacingFromVertexData(aint); +@@ -34,11 +39,17 @@ + this.func_178408_a(aint, enumfacing); + } + ++ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing); + return new BakedQuad(aint, face.tintIndex, enumfacing); + } + + private int[] makeQuadVertexData(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, ModelRotation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean shade) + { ++ return makeQuadVertexData(p_178405_1_, p_178405_2_, p_178405_3_, p_178405_4_, p_178405_5_, p_178405_6_, p_178405_7_, shade); ++ } ++ ++ private int[] makeQuadVertexData(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, net.minecraftforge.client.model.ITransformation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean shade) ++ { + int[] aint = new int[28]; + + for (int i = 0; i < 4; ++i) +@@ -89,7 +100,12 @@ + + private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) + { +- EnumFacing enumfacing = modelRotationIn.rotateFace(facing); ++ fillVertexData(faceData, vertexIndex, facing, partFace, p_178402_5_, sprite, modelRotationIn, partRotation, uvLocked, shade); ++ } ++ ++ private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) ++ { ++ EnumFacing enumfacing = modelRotationIn.rotate(facing); + int i = shade ? this.getFaceShadeColor(enumfacing) : -1; + EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = EnumFaceDirection.getFacing(facing).func_179025_a(vertexIndex); + Vector3f vector3f = new Vector3f(p_178402_5_[enumfacedirection$vertexinformation.field_179184_a], p_178402_5_[enumfacedirection$vertexinformation.field_179182_b], p_178402_5_[enumfacedirection$vertexinformation.field_179183_c]); +@@ -155,14 +171,19 @@ + + public int rotateVertex(Vector3f position, EnumFacing facing, int vertexIndex, ModelRotation modelRotationIn, boolean uvLocked) + { ++ return rotateVertex(position, facing, vertexIndex, modelRotationIn, uvLocked); ++ } ++ ++ public int rotateVertex(Vector3f position, EnumFacing facing, int vertexIndex, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) ++ { + if (modelRotationIn == ModelRotation.X0_Y0) + { + return vertexIndex; + } + else + { +- this.rotateScale(position, new Vector3f(0.5F, 0.5F, 0.5F), modelRotationIn.getMatrix4d(), new Vector3f(1.0F, 1.0F, 1.0F)); +- return modelRotationIn.rotateVertex(facing, vertexIndex); ++ net.minecraftforge.client.ForgeHooksClient.transform(position, modelRotationIn.getMatrix()); ++ return modelRotationIn.rotate(facing, vertexIndex); + } + } + diff --git a/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch b/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch index dab1d3b24..cc3b5a373 100644 --- a/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch @@ -1,5 +1,14 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java +++ ../src-work/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java +@@ -132,7 +132,7 @@ + return; + } + +- iblockaccess = new RegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1); ++ iblockaccess = createRegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1); + p_178581_4_.setCompiledChunk(compiledchunk); + } + finally @@ -159,7 +159,7 @@ lvt_10_1_.func_178606_a(blockpos$mutableblockpos); } @@ -9,7 +18,18 @@ { TileEntity tileentity = iblockaccess.getTileEntity(new BlockPos(blockpos$mutableblockpos)); TileEntitySpecialRenderer tileentityspecialrenderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(tileentity); -@@ -190,6 +190,7 @@ +@@ -175,7 +175,9 @@ + } + } + +- EnumWorldBlockLayer enumworldblocklayer1 = block.getBlockLayer(); ++ for(EnumWorldBlockLayer enumworldblocklayer1 : EnumWorldBlockLayer.values()) { ++ if(!block.canRenderInLayer(enumworldblocklayer1)) continue; ++ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(enumworldblocklayer1); + int j = enumworldblocklayer1.ordinal(); + + if (block.getRenderType() != -1) +@@ -190,6 +192,7 @@ aboolean[j] |= blockrendererdispatcher.renderBlock(iblockstate, blockpos$mutableblockpos, iblockaccess, worldrenderer); } @@ -17,7 +37,7 @@ } for (EnumWorldBlockLayer enumworldblocklayer : EnumWorldBlockLayer.values()) -@@ -386,6 +387,26 @@ +@@ -386,6 +389,26 @@ return this.needsUpdate; } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch index 1811392e2..e3ebd0b1b 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch @@ -9,14 +9,58 @@ this.registerItems(); } -@@ -250,6 +250,10 @@ - { - GlStateManager.scale(2.0F, 2.0F, 2.0F); +@@ -227,7 +227,7 @@ + k = k | -16777216; } -+ else -+ { -+ modelresourcelocation = item.getModel(stack, entityplayer, entityplayer.getItemInUseCount()); -+ } - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +- this.renderQuad(renderer, bakedquad, k); ++ net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(renderer, bakedquad, k); } + } + +@@ -297,6 +297,11 @@ + modelresourcelocation = new ModelResourceLocation("bow_pulling_0", "inventory"); + } + } ++ else ++ { ++ // TODO: add back getModel; maybe switch to the smart player model / normal smart item model? ++ modelresourcelocation = item.getModel(stack, entityplayer, entityplayer.getItemInUseCount()); ++ } + + if (modelresourcelocation != null) + { +@@ -318,14 +323,9 @@ + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.pushMatrix(); +- ItemCameraTransforms itemcameratransforms = model.getItemCameraTransforms(); +- itemcameratransforms.func_181689_a(cameraTransformType); ++ // TODO: check if negative scale is a thing ++ model = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(model, cameraTransformType); + +- if (this.func_183005_a(itemcameratransforms.func_181688_b(cameraTransformType))) +- { +- GlStateManager.cullFace(1028); +- } +- + this.renderItem(stack, model); + GlStateManager.cullFace(1029); + GlStateManager.popMatrix(); +@@ -353,7 +353,7 @@ + GlStateManager.blendFunc(770, 771); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.setupGuiTransform(x, y, ibakedmodel.isGui3d()); +- ibakedmodel.getItemCameraTransforms().func_181689_a(ItemCameraTransforms.TransformType.GUI); ++ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GUI); + this.renderItem(stack, ibakedmodel); + GlStateManager.disableAlpha(); + GlStateManager.disableRescaleNormal(); +@@ -1048,6 +1048,7 @@ + this.registerBlock(Blocks.brown_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "brown_mushroom_block"); + this.registerBlock(Blocks.red_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "red_mushroom_block"); + this.registerBlock(Blocks.dragon_egg, "dragon_egg"); ++ net.minecraftforge.client.model.ModelLoader.onRegisterItems(this.itemModelMesher); + } + + public void onResourceManagerReload(IResourceManager resourceManager) diff --git a/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch b/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch new file mode 100644 index 000000000..de4aa6880 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch @@ -0,0 +1,21 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java +@@ -144,10 +144,17 @@ + NORMAL("Normal"), + COLOR("Vertex Color"), + UV("UV"), ++ // As of 1.8.8 - unused in vanilla; use GENERIC for now ++ @Deprecated + MATRIX("Bone Matrix"), ++ @Deprecated + BLEND_WEIGHT("Blend Weight"), +- PADDING("Padding"); ++ PADDING("Padding"), ++ GENERIC("Generic"); + ++ public void preDraw(VertexFormat format, int element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.preDraw(this, format, element, stride, buffer); } ++ public void postDraw(VertexFormat format, int element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.postDraw(this, format, element, stride, buffer); } ++ + private final String displayName; + private static final String __OBFID = "CL_00002397"; + diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch index cf85230f4..3755c0653 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch @@ -5,7 +5,7 @@ catch (Exception var6) { - LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation); -+ LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation, exception); ++ LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation, var6); } } catch (Exception exception) @@ -48,6 +48,22 @@ TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName("particle"))); SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(modelBlockIn)).setTexture(textureatlassprite); +@@ -465,13 +476,13 @@ + BlockPartFace blockpartface = (BlockPartFace)blockpart.mapFaces.get(enumfacing); + TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName(blockpartface.texture))); + +- if (blockpartface.cullFace == null) ++ if (blockpartface.cullFace == null || !net.minecraftforge.client.model.TRSRTransformation.isInteger(modelRotationIn.getMatrix())) + { + simplebakedmodel$builder.addGeneralQuad(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); + } + else + { +- simplebakedmodel$builder.addFaceQuad(modelRotationIn.rotateFace(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); ++ simplebakedmodel$builder.addFaceQuad(modelRotationIn.rotate(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); + } + } + } @@ -481,6 +492,11 @@ private BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_) diff --git a/rejects/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch.rej deleted file mode 100644 index 0d3d3d9fa..000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch.rej +++ /dev/null @@ -1,70 +0,0 @@ -++++ REJECTED PATCH 1 - - while (iterator.hasNext()) - { -+ // moved to VertexFormatElement.preDraw - vertexformatelement = (VertexFormatElement)iterator.next(); -- enumusage = vertexformatelement.getUsage(); -- k = vertexformatelement.getType().getGlConstant(); -- int l = vertexformatelement.getIndex(); -- -- switch (WorldVertexBufferUploader.SwitchEnumUsage.VALUES[enumusage.ordinal()]) -- { -- case 1: -- bytebuffer.position(vertexformatelement.getOffset()); -- GL11.glVertexPointer(vertexformatelement.getElementCount(), k, j, bytebuffer); -- GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); -- break; -- case 2: -- bytebuffer.position(vertexformatelement.getOffset()); -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + l); -- GL11.glTexCoordPointer(vertexformatelement.getElementCount(), k, j, bytebuffer); -- GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); -- break; -- case 3: -- bytebuffer.position(vertexformatelement.getOffset()); -- GL11.glColorPointer(vertexformatelement.getElementCount(), k, j, bytebuffer); -- GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); -- break; -- case 4: -- bytebuffer.position(vertexformatelement.getOffset()); -- GL11.glNormalPointer(k, j, bytebuffer); -- GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY); -- } -+ vertexformatelement.getUsage().preDraw(vertexformatelement, j, bytebuffer); - } - - GL11.glDrawArrays(p_178177_1_.getDrawMode(), 0, p_178177_1_.getVertexCount()); -++++ END PATCH -++++ REJECTED PATCH 2 - - while (iterator.hasNext()) - { -+ // moved to VertexFormatElement.postDraw - vertexformatelement = (VertexFormatElement)iterator.next(); -- enumusage = vertexformatelement.getUsage(); -- k = vertexformatelement.getIndex(); -- -- switch (WorldVertexBufferUploader.SwitchEnumUsage.VALUES[enumusage.ordinal()]) -- { -- case 1: -- GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); -- break; -- case 2: -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + k); -- GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); -- break; -- case 3: -- GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); -- GlStateManager.resetColor(); -- break; -- case 4: -- GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); -- } -+ vertexformatelement.getUsage().postDraw(vertexformatelement, j, bytebuffer); - } - } - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch.rej deleted file mode 100644 index a93e37504..000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch.rej +++ /dev/null @@ -1,57 +0,0 @@ -++++ REJECTED PATCH 2 - this.func_178408_a(aint, enumfacing1); - } - -+ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing1); - return new BakedQuad(aint, face.tintIndex, enumfacing1); - } - - private int[] makeQuadVertexData(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, ModelRotation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean shade) - { -+ return makeQuadVertexData(p_178405_1_, p_178405_2_, p_178405_3_, p_178405_4_, (net.minecraftforge.client.model.ITransformation)p_178405_5_, p_178405_6_, p_178405_7_, shade); -+ } -+ -+ private int[] makeQuadVertexData(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, net.minecraftforge.client.model.ITransformation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean shade) -+ { - int[] aint = new int[28]; - - for (int i = 0; i < 4; ++i) -++++ END PATCH -++++ REJECTED PATCH 3 - - private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) - { -- EnumFacing enumfacing1 = modelRotationIn.rotateFace(facing); -+ fillVertexData(faceData, vertexIndex, facing, partFace, p_178402_5_, sprite, (net.minecraftforge.client.model.ITransformation)modelRotationIn, partRotation, uvLocked, shade); -+ } -+ -+ private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) -+ { -+ EnumFacing enumfacing1 = modelRotationIn.rotate(facing); - int j = shade ? this.getFaceShadeColor(enumfacing1) : -1; - EnumFaceDirection.VertexInformation vertexinformation = EnumFaceDirection.getFacing(facing).func_179025_a(vertexIndex); - Vector3d vector3d = new Vector3d((double)p_178402_5_[vertexinformation.field_179184_a], (double)p_178402_5_[vertexinformation.field_179182_b], (double)p_178402_5_[vertexinformation.field_179183_c]); -++++ END PATCH -++++ REJECTED PATCH 4 - - public int rotateVertex(Vector3d position, EnumFacing facing, int vertexIndex, ModelRotation modelRotationIn, boolean uvLocked) - { -+ return rotateVertex(position, facing, vertexIndex, (net.minecraftforge.client.model.ITransformation)modelRotationIn, uvLocked); -+ } -+ -+ public int rotateVertex(Vector3d position, EnumFacing facing, int vertexIndex, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) -+ { - if (modelRotationIn == ModelRotation.X0_Y0) - { - return vertexIndex; - } - else - { -- this.rotateScale(position, new Vector3d(0.5D, 0.5D, 0.5D), modelRotationIn.getMatrix4d(), new Vector3d(1.0D, 1.0D, 1.0D)); -- return modelRotationIn.rotateVertex(facing, vertexIndex); -+ net.minecraftforge.client.ForgeHooksClient.transform(position, modelRotationIn.getMatrix()); -+ return modelRotationIn.rotate(facing, vertexIndex); - } - } - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch.rej deleted file mode 100644 index 73ee667f8..000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch.rej +++ /dev/null @@ -1,22 +0,0 @@ -++++ REJECTED PATCH 1 - return; - } - -- regionrendercache = new RegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1); -+ regionrendercache = createRegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1); - p_178581_4_.setCompiledChunk(compiledchunk); - } - finally -++++ END PATCH -++++ REJECTED PATCH 3 - } - } - -- EnumWorldBlockLayer enumworldblocklayer1 = block.getBlockLayer(); -+ for(EnumWorldBlockLayer enumworldblocklayer1 : EnumWorldBlockLayer.values()) { -+ if(!block.canRenderInLayer(enumworldblocklayer1)) continue; -+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(enumworldblocklayer1); - int i = enumworldblocklayer1.ordinal(); - - if (block.getRenderType() != -1) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch.rej index 4bf581bd0..a97c64bc2 100644 --- a/rejects/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch.rej +++ b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch.rej @@ -1,62 +1,3 @@ -++++ REJECTED PATCH 2 - BakedQuad bakedquad; - int j; - -- for (Iterator iterator = quads.iterator(); iterator.hasNext(); this.renderQuad(renderer, bakedquad, j)) -+ for (Iterator iterator = quads.iterator(); iterator.hasNext(); net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(renderer, bakedquad, j)) - { - bakedquad = (BakedQuad)iterator.next(); - j = color; -++++ END PATCH -++++ REJECTED PATCH 4 - - protected void applyTransform(ItemTransformVec3f transform) - { -+ applyVanillaTransform(transform); -+ } -+ -+ public static void applyVanillaTransform(ItemTransformVec3f transform) -+ { - if (transform != ItemTransformVec3f.DEFAULT) - { - GlStateManager.translate(transform.translation.x + debugItemOffsetX, transform.translation.y + debugItemOffsetY, transform.translation.z + debugItemOffsetZ); -++++ END PATCH -++++ REJECTED PATCH 5 - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - GlStateManager.pushMatrix(); - -- switch (RenderItem.SwitchTransformType.TRANSFORM_LOOKUP[cameraTransformType.ordinal()]) -- { -- case 1: -- default: -- break; -- case 2: -- this.applyTransform(model.getItemCameraTransforms().thirdPerson); -- break; -- case 3: -- this.applyTransform(model.getItemCameraTransforms().firstPerson); -- break; -- case 4: -- this.applyTransform(model.getItemCameraTransforms().head); -- break; -- case 5: -- this.applyTransform(model.getItemCameraTransforms().gui); -- } -+ model = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(model, cameraTransformType); - - this.renderItem(stack, model); - GlStateManager.popMatrix(); -++++ END PATCH -++++ REJECTED PATCH 6 - GlStateManager.blendFunc(770, 771); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - this.setupGuiTransform(x, y, ibakedmodel.isGui3d()); -- this.applyTransform(ibakedmodel.getItemCameraTransforms().gui); -+ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GUI); - this.renderItem(stack, ibakedmodel); - GlStateManager.disableAlpha(); - GlStateManager.disableRescaleNormal(); -++++ END PATCH ++++ REJECTED PATCH 7 GlStateManager.enableDepth(); } @@ -84,12 +25,6 @@ GlStateManager.enableLighting(); ++++ END PATCH ++++ REJECTED PATCH 9 - this.registerBlock(Blocks.brown_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "brown_mushroom_block"); - this.registerBlock(Blocks.red_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "red_mushroom_block"); - this.registerBlock(Blocks.dragon_egg, "dragon_egg"); -+ net.minecraftforge.client.model.ModelLoader.onRegisterItems(this.itemModelMesher); - } - public void onResourceManagerReload(IResourceManager resourceManager) { this.itemModelMesher.rebuildCache(); diff --git a/rejects/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch.rej deleted file mode 100644 index 3bb0ba7b2..000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch.rej +++ /dev/null @@ -1,49 +0,0 @@ -++++ REJECTED PATCH 1 - @SideOnly(Side.CLIENT) - public static enum EnumType - { -- FLOAT(4, "Float", 5126), -- UBYTE(1, "Unsigned Byte", 5121), -- BYTE(1, "Byte", 5120), -- USHORT(2, "Unsigned Short", 5123), -- SHORT(2, "Short", 5122), -- UINT(4, "Unsigned Int", 5125), -- INT(4, "Int", 5124); -+ FLOAT(4, "Float", org.lwjgl.opengl.GL11.GL_FLOAT), -+ UBYTE(1, "Unsigned Byte", org.lwjgl.opengl.GL11.GL_UNSIGNED_BYTE), -+ BYTE(1, "Byte", org.lwjgl.opengl.GL11.GL_BYTE), -+ USHORT(2, "Unsigned Short", org.lwjgl.opengl.GL11.GL_UNSIGNED_SHORT), -+ SHORT(2, "Short", org.lwjgl.opengl.GL11.GL_SHORT), -+ UINT(4, "Unsigned Int", org.lwjgl.opengl.GL11.GL_UNSIGNED_INT), -+ INT(4, "Int", org.lwjgl.opengl.GL11.GL_INT); -+ // Commented for now, might be added in the future if anyone needs them -+ //HALF_FLOAT(2, "Half Float", org.lwjgl.opengl.GL30.GL_HALF_FLOAT), -+ //DOUBLE(8, "Double", org.lwjgl.opengl.GL11.GL_DOUBLE), -+ //INT_2_10_10_10_REV(4, "Int 2-10-10-10 reversed", org.lwjgl.opengl.GL33.GL_INT_2_10_10_10_REV), -+ //UINT_2_10_10_10_REV(4, "Unsigned Int 2-10-10-10 reversed", org.lwjgl.opengl.GL12.GL_UNSIGNED_INT_2_10_10_10_REV), -+ //UINT_10F_11F_11F_REV(4, "Unsigned Int 10F 11F 11F reversed", GL_UNSIGNED_INT_10F_11F_11F_REV); -+ - private final int size; - private final String displayName; - private final int glConstant; -++++ END PATCH -++++ REJECTED PATCH 2 - NORMAL("Normal"), - COLOR("Vertex Color"), - UV("UV"), -+ // As of 1.8 - unused in vanilla; use GENERIC for now -+ @Deprecated - MATRIX("Bone Matrix"), -+ @Deprecated - BLEND_WEIGHT("Blend Weight"), -- PADDING("Padding"); -+ PADDING("Padding"), -+ GENERIC("Generic Attribute"); -+ -+ public void preDraw(VertexFormatElement element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.preDraw(this, element, stride, buffer); } -+ public void postDraw(VertexFormatElement element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.postDraw(this, element, stride, buffer); } -+ - private final String displayName; - - private static final String __OBFID = "CL_00002397"; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch.rej b/rejects/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch.rej deleted file mode 100644 index 76cbbcd2d..000000000 --- a/rejects/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch.rej +++ /dev/null @@ -1,17 +0,0 @@ -++++ REJECTED PATCH 6 - BlockPartFace blockpartface = (BlockPartFace)blockpart.mapFaces.get(enumfacing); - TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName(blockpartface.texture))); - -- if (blockpartface.cullFace == null) -+ if (blockpartface.cullFace == null || !net.minecraftforge.client.model.TRSRTransformation.isInteger(modelRotationIn.getMatrix())) - { - builder.addGeneralQuad(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); - } - else - { -- builder.addFaceQuad(modelRotationIn.rotateFace(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); -+ builder.addFaceQuad(modelRotationIn.rotate(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); - } - } - } -++++ END PATCH diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index ed12e6f70..fdf0c3059 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -37,6 +37,7 @@ import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormatElement; import net.minecraft.client.renderer.vertex.VertexFormatElement.EnumUsage; import net.minecraft.client.resources.I18n; @@ -72,6 +73,7 @@ import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.client.event.sound.PlaySoundEvent; import net.minecraftforge.client.model.IPerspectiveAwareModel; import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.client.model.TRSRTransformation; import net.minecraftforge.common.ForgeModContainer; import net.minecraftforge.common.ForgeVersion; import net.minecraftforge.common.ForgeVersion.Status; @@ -87,6 +89,8 @@ import org.lwjgl.opengl.GL11; //import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.*; + + import com.google.common.collect.Maps; public class ForgeHooksClient @@ -518,7 +522,7 @@ public class ForgeHooksClient { javax.vecmath.Matrix4f m = new javax.vecmath.Matrix4f(), t = new javax.vecmath.Matrix4f(); m.setIdentity(); - m.setTranslation(transform.translation); + m.setTranslation(TRSRTransformation.toVecmath(transform.translation)); t.setIdentity(); t.rotY(transform.rotation.y); m.mul(t); @@ -547,23 +551,7 @@ public class ForgeHooksClient } else { - switch(cameraTransformType) - { - case FIRST_PERSON: - RenderItem.applyVanillaTransform(model.getItemCameraTransforms().firstPerson); - break; - case GUI: - RenderItem.applyVanillaTransform(model.getItemCameraTransforms().gui); - break; - case HEAD: - RenderItem.applyVanillaTransform(model.getItemCameraTransforms().head); - break; - case THIRD_PERSON: - RenderItem.applyVanillaTransform(model.getItemCameraTransforms().thirdPerson); - break; - default: - break; - } + model.getItemCameraTransforms().func_181689_a(cameraTransformType); } return model; } @@ -585,9 +573,10 @@ public class ForgeHooksClient // moved and expanded from WorldVertexBufferUploader.draw - public static void preDraw(EnumUsage attrType, VertexFormatElement attr, int stride, ByteBuffer buffer) + public static void preDraw(EnumUsage attrType, VertexFormat format, int element, int stride, ByteBuffer buffer) { - buffer.position(attr.getOffset()); + VertexFormatElement attr = format.getElement(element); + buffer.position(format.func_181720_d(element)); switch(attrType) { case POSITION: @@ -622,8 +611,9 @@ public class ForgeHooksClient } } - public static void postDraw(EnumUsage attrType, VertexFormatElement attr, int stride, ByteBuffer buffer) + public static void postDraw(EnumUsage attrType, VertexFormat format, int element, int stride, ByteBuffer buffer) { + VertexFormatElement attr = format.getElement(element); switch(attrType) { case POSITION: @@ -651,9 +641,9 @@ public class ForgeHooksClient } } - public static void transform(Vector3d vec, Matrix4f m) + public static void transform(org.lwjgl.util.vector.Vector3f vec, Matrix4f m) { - Vector4f tmp = new Vector4f((float)vec.x, (float)vec.y, (float)vec.z, 1f); + Vector4f tmp = new Vector4f(vec.x, vec.y, vec.z, 1f); m.transform(tmp); if(Math.abs(tmp.w - 1f) > 1e-5) tmp.scale(1f / tmp.w); vec.set(tmp.x, tmp.y, tmp.z); @@ -661,7 +651,7 @@ public class ForgeHooksClient public static Matrix4f getMatrix(ModelRotation modelRotation) { - Matrix4f ret = new Matrix4f(modelRotation.getMatrix4d()), tmp = new Matrix4f(); + Matrix4f ret = new Matrix4f(TRSRTransformation.toVecmath(modelRotation.getMatrix4d())), tmp = new Matrix4f(); tmp.setIdentity(); tmp.m03 = tmp.m13 = tmp.m23 = .5f; ret.mul(tmp, ret); diff --git a/src/main/java/net/minecraftforge/client/model/Attributes.java b/src/main/java/net/minecraftforge/client/model/Attributes.java index 67f5b8949..cd693f58a 100644 --- a/src/main/java/net/minecraftforge/client/model/Attributes.java +++ b/src/main/java/net/minecraftforge/client/model/Attributes.java @@ -1,12 +1,7 @@ package net.minecraftforge.client.model; -import java.nio.ByteBuffer; -import java.util.Arrays; import java.util.List; -import javax.vecmath.Vector4f; - -import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormatElement; import net.minecraft.client.renderer.vertex.VertexFormatElement.EnumType; @@ -22,10 +17,10 @@ public class Attributes static { DEFAULT_BAKED_FORMAT = new VertexFormat(); - DEFAULT_BAKED_FORMAT.setElement(new VertexFormatElement(0, EnumType.FLOAT, EnumUsage.POSITION, 3)); - DEFAULT_BAKED_FORMAT.setElement(new VertexFormatElement(0, EnumType.UBYTE, EnumUsage.COLOR, 4)); - DEFAULT_BAKED_FORMAT.setElement(new VertexFormatElement(0, EnumType.FLOAT, EnumUsage.UV, 2)); - DEFAULT_BAKED_FORMAT.setElement(new VertexFormatElement(0, EnumType.BYTE, EnumUsage.PADDING, 4)); + DEFAULT_BAKED_FORMAT.func_181721_a(new VertexFormatElement(0, EnumType.FLOAT, EnumUsage.POSITION, 3)); + DEFAULT_BAKED_FORMAT.func_181721_a(new VertexFormatElement(0, EnumType.UBYTE, EnumUsage.COLOR, 4)); + DEFAULT_BAKED_FORMAT.func_181721_a(new VertexFormatElement(0, EnumType.FLOAT, EnumUsage.UV, 2)); + DEFAULT_BAKED_FORMAT.func_181721_a(new VertexFormatElement(0, EnumType.BYTE, EnumUsage.PADDING, 4)); } /* @@ -73,80 +68,4 @@ public class Attributes if(padding != 0 || j != second.getElementCount()) return false; return true; } - - /** - * @deprecated use UnpackedBakedQuad.Builder - */ - @Deprecated - public static void put(ByteBuffer buf, VertexFormatElement e, boolean denormalize, Number fill, Number... ns) - { - if(e.getElementCount() > ns.length && fill == null) throw new IllegalArgumentException("not enough elements"); - Number n; - for(int i = 0; i < e.getElementCount(); i++) - { - if(i < ns.length) n = ns[i]; - else n = fill; - switch(e.getType()) - { - case BYTE: - buf.put(denormalize ? (byte)(n.floatValue() * (Byte.MAX_VALUE - 1)) : n.byteValue()); - break; - case UBYTE: - buf.put(denormalize ? (byte)(n.floatValue() * ((1 << Byte.SIZE) - 1)) : n.byteValue()); - break; - case SHORT: - buf.putShort(denormalize ? (short)(n.floatValue() * (Short.MAX_VALUE - 1)) : n.shortValue()); - break; - case USHORT: - buf.putShort(denormalize ? (short)(n.floatValue() * ((1 << Short.SIZE) - 1)) : n.shortValue()); - break; - case INT: - buf.putInt(denormalize ? (int)(n.doubleValue() * (Integer.MAX_VALUE - 1)) : n.intValue()); - break; - case UINT: - buf.putInt(denormalize ? (int)(n.doubleValue() * ((1L << Integer.SIZE) - 1)) : n.intValue()); - break; - case FLOAT: - buf.putFloat(n.floatValue()); - break; - } - } - } - - /** - * @deprecated use IVertexConsumer - */ - @Deprecated - public static BakedQuad transform(TRSRTransformation transform, BakedQuad quad, VertexFormat format) - { - for (VertexFormatElement e : (List)format.getElements()) - { - if (e.getUsage() == VertexFormatElement.EnumUsage.POSITION) - { - if (e.getType() != VertexFormatElement.EnumType.FLOAT) - { - throw new IllegalArgumentException("can only transform float position"); - } - int[] data = Arrays.copyOf(quad.getVertexData(), quad.getVertexData().length); - int shift = data.length / 4; - for(int v = 0; v < 4; v++) - { - float[] pos = new float[] { 0f, 0f, 0f, 1f }; - for (int i = 0; i < Math.min(4, e.getElementCount()); i++) - { - pos[i] = Float.intBitsToFloat(data[shift * v + e.getOffset() / 4 + i]); - } - Vector4f vec = new Vector4f(pos); - transform.getMatrix().transform(vec); - vec.get(pos); - for (int i = 0; i < Math.min(4, e.getElementCount()); i++) - { - data[shift * v + e.getOffset() / 4 + i] = Float.floatToRawIntBits(pos[i]); - } - } - return new BakedQuad(data, quad.getTintIndex(), quad.getFace()); - } - } - return quad; - } } diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 9217d5bee..fda396881 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -331,7 +331,7 @@ public class ModelLoader extends ModelBakery } ModelBlock model = this.model; if(model == null) return getMissingModel().bake(state, format, bakedTextureGetter); - ItemCameraTransforms transforms = new ItemCameraTransforms(model.getThirdPersonTransform(), model.getFirstPersonTransform(), model.getHeadTransform(), model.getInGuiTransform()); + ItemCameraTransforms transforms = model.func_181682_g(); boolean uvlock = false; if(state instanceof UVLock) { @@ -391,7 +391,7 @@ public class ModelLoader extends ModelBakery ModelBlock neweModel = new ModelBlock(this.model.getParentLocation(), elements, Maps.newHashMap(this.model.textures), this.model.isAmbientOcclusion(), this.model.isGui3d(), //New Textures man VERY IMPORTANT - new ItemCameraTransforms(this.model.getThirdPersonTransform(), this.model.getFirstPersonTransform(), this.model.getHeadTransform(), this.model.getInGuiTransform())); + model.func_181682_g()); neweModel.name = this.model.name; neweModel.parent = this.model.parent; @@ -700,7 +700,14 @@ public class ModelLoader extends ModelBakery graphics.clearRect(0, 0, 16, 16); BufferedImage[] images = new BufferedImage[Minecraft.getMinecraft().gameSettings.mipmapLevels + 1]; images[0] = image; - loadSprite(images, null); + try + { + loadSprite(images, null); + } + catch(IOException e) + { + throw new RuntimeException(e); + } return false; } diff --git a/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java b/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java index 34d7962ea..189069c6d 100644 --- a/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java +++ b/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java @@ -67,7 +67,7 @@ public class TRSRTransformation implements IModelState, ITransformation public static Matrix4f getMatrix(ItemTransformVec3f transform) { - TRSRTransformation ret = new TRSRTransformation(transform.translation, quatFromYXZDegrees(transform.rotation), transform.scale, null); + TRSRTransformation ret = new TRSRTransformation(toVecmath(transform.translation), quatFromYXZDegrees(toVecmath(transform.rotation)), toVecmath(transform.scale), null); return blockCenterToCorner(ret).getMatrix(); } @@ -428,7 +428,7 @@ public class TRSRTransformation implements IModelState, ITransformation */ public ItemTransformVec3f toItemTransform() { - return new ItemTransformVec3f(getTranslation(), toYXZ(getLeftRot()), getScale()); + return new ItemTransformVec3f(toLwjgl(getTranslation()), toLwjgl(toYXZ(getLeftRot())), toLwjgl(getScale())); } public Matrix4f getMatrix() @@ -566,4 +566,55 @@ public class TRSRTransformation implements IModelState, ITransformation else if (!matrix.equals(other.matrix)) return false; return true; } + + public static Vector3f toVecmath(org.lwjgl.util.vector.Vector3f vec) + { + return new Vector3f(vec.x, vec.y, vec.z); + } + + public static Vector4f toVecmath(org.lwjgl.util.vector.Vector4f vec) + { + return new Vector4f(vec.x, vec.y, vec.z, vec.w); + } + + public static Matrix4f toVecmath(org.lwjgl.util.vector.Matrix4f m) + { + return new Matrix4f( + m.m00, m.m10, m.m20, m.m30, + m.m01, m.m11, m.m21, m.m31, + m.m02, m.m12, m.m22, m.m32, + m.m03, m.m13, m.m23, m.m33); + } + + public static org.lwjgl.util.vector.Vector3f toLwjgl(Vector3f vec) + { + return new org.lwjgl.util.vector.Vector3f(vec.x, vec.y, vec.z); + } + + public static org.lwjgl.util.vector.Vector4f toLwjgl(Vector4f vec) + { + return new org.lwjgl.util.vector.Vector4f(vec.x, vec.y, vec.z, vec.w); + } + + public static org.lwjgl.util.vector.Matrix4f toLwjgl(Matrix4f m) + { + org.lwjgl.util.vector.Matrix4f r = new org.lwjgl.util.vector.Matrix4f(); + r.m00 = m.m00; + r.m01 = m.m10; + r.m02 = m.m20; + r.m03 = m.m30; + r.m10 = m.m01; + r.m11 = m.m11; + r.m12 = m.m21; + r.m13 = m.m31; + r.m20 = m.m02; + r.m21 = m.m12; + r.m22 = m.m22; + r.m23 = m.m32; + r.m30 = m.m03; + r.m31 = m.m13; + r.m32 = m.m23; + r.m33 = m.m33; + return r; + } } diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java b/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java index 0fc6ae3ab..ff84baebe 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java @@ -139,7 +139,7 @@ public class LightUtil { if(i < element.getElementCount()) { - int pos = v * formatFrom.getNextOffset() + element.getOffset() + element.getType().getSize() * i; + int pos = v * formatFrom.getNextOffset() + formatFrom.func_181720_d(e) + element.getType().getSize() * i; int index = pos >> 2; int offset = pos & 3; int bits = from[index]; @@ -187,7 +187,7 @@ public class LightUtil { if(i < element.getElementCount()) { - int pos = v * formatTo.getNextOffset() + element.getOffset() + element.getType().getSize() * i; + int pos = v * formatTo.getNextOffset() + formatTo.func_181720_d(e) + element.getType().getSize() * i; int index = pos >> 2; int offset = pos & 3; int bits = 0; diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java index 039c3eb31..72d005aa3 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java @@ -69,7 +69,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer VertexFormat format = parent.getVertexFormat(); if(format.hasNormal()) return format; format = new VertexFormat(format); - format.setElement(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.NORMAL, 4)); + format.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.NORMAL, 4)); return format; } diff --git a/src/main/resources/forge.exc b/src/main/resources/forge.exc index 8801190df..225802f04 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -31,10 +31,10 @@ net/minecraft/block/state/BlockState.(Lnet/minecraft/block/Block;[Lnet/min net/minecraft/client/renderer/entity/RenderItem.applyVanillaTransform(Lnet/minecraft/client/renderer/block/model/ItemTransformVec3f;)V=|p_175034_1_ net/minecraft/client/resources/model/ModelBakery.bakeModel(Lnet/minecraft/client/renderer/block/model/ModelBlock;Lnet/minecraftforge/client/model/ITransformation;Z)Lnet/minecraft/client/resources/model/IBakedModel;=|p_177578_1_,p_177578_2_,p_177578_3_ net/minecraft/client/resources/model/ModelBakery.makeBakedQuad(Lnet/minecraft/client/renderer/block/model/BlockPart;Lnet/minecraft/client/renderer/block/model/BlockPartFace;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/EnumFacing;Lnet/minecraftforge/client/model/ITransformation;Z)Lnet/minecraft/client/renderer/block/model/BakedQuad;=|p_177589_1_,p_177589_2_,p_177589_3_,p_177589_4_,p_177589_5_,p_177589_6_ -net/minecraft/client/renderer/block/model/FaceBakery.makeBakedQuad(Ljavax/vecmath/Vector3f;Ljavax/vecmath/Vector3f;Lnet/minecraft/client/renderer/block/model/BlockPartFace;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/EnumFacing;Lnet/minecraftforge/client/model/ITransformation;Lnet/minecraft/client/renderer/block/model/BlockPartRotation;ZZ)Lnet/minecraft/client/renderer/block/model/BakedQuad;=|p_178414_1_,p_178414_2_,p_178414_3_,p_178414_4_,p_178414_5_,p_178414_6_,p_178414_7_,p_178414_8_,p_178414_9_ +net/minecraft/client/renderer/block/model/FaceBakery.makeBakedQuad(Lorg/lwjgl/util/vector/Vector3f;Lorg/lwjgl/util/vector/Vector3f;Lnet/minecraft/client/renderer/block/model/BlockPartFace;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/EnumFacing;Lnet/minecraftforge/client/model/ITransformation;Lnet/minecraft/client/renderer/block/model/BlockPartRotation;ZZ)Lnet/minecraft/client/renderer/block/model/BakedQuad;=|p_178414_1_,p_178414_2_,p_178414_3_,p_178414_4_,p_178414_5_,p_178414_6_,p_178414_7_,p_178414_8_,p_178414_9_ net/minecraft/client/renderer/block/model/FaceBakery.makeQuadVertexData(Lnet/minecraft/client/renderer/block/model/BlockPartFace;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/EnumFacing;[FLnet/minecraftforge/client/model/ITransformation;Lnet/minecraft/client/renderer/block/model/BlockPartRotation;ZZ)[I=|p_178405_1_,p_178405_2_,p_178405_3_,p_178405_4_,p_178405_5_,p_178405_6_,p_178405_7_,p_178405_8_ net/minecraft/client/renderer/block/model/FaceBakery.fillVertexData([IILnet/minecraft/util/EnumFacing;Lnet/minecraft/client/renderer/block/model/BlockPartFace;[FLnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraftforge/client/model/ITransformation;Lnet/minecraft/client/renderer/block/model/BlockPartRotation;ZZ)V=|p_178402_1_,p_178402_2_,p_178402_3_,p_178402_4_,p_178402_5_,p_178402_6_,p_178402_7_,p_178402_8_,p_178402_9_,p_178402_10_ -net/minecraft/client/renderer/block/model/FaceBakery.rotateVertex(Ljavax/vecmath/Vector3d;Lnet/minecraft/util/EnumFacing;ILnet/minecraftforge/client/model/ITransformation;Z)I=|p_178415_1_,p_178415_2_,p_178415_3_,p_178415_4_,p_178415_5_ +net/minecraft/client/renderer/block/model/FaceBakery.rotateVertex(Lorg/lwjgl/util/vector/Vector3f;Lnet/minecraft/util/EnumFacing;ILnet/minecraftforge/client/model/ITransformation;Z)I=|p_178415_1_,p_178415_2_,p_178415_3_,p_178415_4_,p_178415_5_ net/minecraft/item/ItemBlock.setTileEntityNBT(Lnet/minecraft/world/World;Lnet/minecraft/util/BlockPos;Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/player/EntityPlayer;)Z=|p_179224_0_,p_179224_1_,p_179224_2_,player diff --git a/src/test/java/net/minecraftforge/debug/ModelFluidDebug.java b/src/test/java/net/minecraftforge/debug/ModelFluidDebug.java index c3d285200..537eb3817 100644 --- a/src/test/java/net/minecraftforge/debug/ModelFluidDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelFluidDebug.java @@ -1,8 +1,6 @@ package net.minecraftforge.debug; import net.minecraft.block.material.Material; -import net.minecraft.block.properties.IProperty; -import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.renderer.block.statemap.StateMapperBase; @@ -12,9 +10,7 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.ModelFluid; import net.minecraftforge.client.model.ModelLoader; -import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; diff --git a/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java b/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java index c4a00d3e9..38c6124bc 100644 --- a/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java @@ -26,11 +26,11 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; -import net.minecraft.server.gui.IUpdatePlayerListBox; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumFacing; +import net.minecraft.util.ITickable; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraft.world.IBlockAccess; @@ -785,7 +785,7 @@ public class ModelLoaderRegistryDebug } } - public static class OBJDynamicEyeTileEntity extends TileEntity implements IUpdatePlayerListBox + public static class OBJDynamicEyeTileEntity extends TileEntity implements ITickable { public OBJModel.OBJState state; @@ -803,7 +803,7 @@ public class ModelLoaderRegistryDebug EntityPlayer player = Minecraft.getMinecraft().thePlayer; Vector3d playerLoc = new Vector3d(); playerLoc.setX(player.posX); - playerLoc.setY(player.posY + player.eyeHeight); + playerLoc.setY(player.posY + player.getEyeHeight()); playerLoc.setZ(player.posZ); Vector3d lookVec = new Vector3d(playerLoc.getX() - teLoc.getX(), playerLoc.getY() - teLoc.getY(), playerLoc.getZ() - teLoc.getZ()); double angleYaw = Math.atan2(lookVec.getZ(), lookVec.getX()) - Math.PI/2d; From f20b40fb80aabdf577d636108bda0fc279432f43 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 10 Nov 2015 00:42:56 +0300 Subject: [PATCH 007/133] Fix generics and error in the BlockState patch. --- .../net/minecraft/block/state/BlockState.java.patch | 8 ++++---- .../common/property/ExtendedBlockState.java | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/patches/minecraft/net/minecraft/block/state/BlockState.java.patch b/patches/minecraft/net/minecraft/block/state/BlockState.java.patch index e2a202b48..5d82d564b 100644 --- a/patches/minecraft/net/minecraft/block/state/BlockState.java.patch +++ b/patches/minecraft/net/minecraft/block/state/BlockState.java.patch @@ -7,12 +7,12 @@ + this(blockIn, properties, null); + } + -+ protected StateImplementation createState(Block block, ImmutableMap properties, ImmutableMap unlistedProperties) ++ protected StateImplementation createState(Block block, ImmutableMap properties, ImmutableMap, com.google.common.base.Optional> unlistedProperties) + { + return new StateImplementation(block, properties); + } + -+ protected BlockState(Block blockIn, IProperty[] properties, ImmutableMap unlistedProperties) ++ protected BlockState(Block blockIn, IProperty[] properties, ImmutableMap, com.google.common.base.Optional> unlistedProperties) + { this.block = blockIn; Arrays.sort(properties, new Comparator() @@ -22,7 +22,7 @@ { Map map1 = MapPopulator.createMap(this.properties, list1); - BlockState.StateImplementation blockstate$stateimplementation = new BlockState.StateImplementation(blockIn, ImmutableMap.copyOf(map1)); -+ BlockState.StateImplementation blockstate$stateimplementation = createState(blockIn, ImmutableMap.copyOf(map), unlistedProperties); ++ BlockState.StateImplementation blockstate$stateimplementation = createState(blockIn, ImmutableMap.copyOf(map1), unlistedProperties); map.put(map1, blockstate$stateimplementation); list.add(blockstate$stateimplementation); } @@ -30,7 +30,7 @@ } } -+ protected StateImplementation(Block blockIn, ImmutableMap propertiesIn, ImmutableTable propertyValueTable) ++ protected StateImplementation(Block blockIn, ImmutableMap propertiesIn, ImmutableTable propertyValueTable) + { + this.block = blockIn; + this.properties = propertiesIn; diff --git a/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java b/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java index c299e3fa5..a0b5a318f 100644 --- a/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java +++ b/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java @@ -56,7 +56,7 @@ public class ExtendedBlockState extends BlockState private final ImmutableMap, Optional> unlistedProperties; private Map, IBlockState> normalMap; - protected ExtendedStateImplementation(Block block, ImmutableMap properties, ImmutableMap, Optional> unlistedProperties, ImmutableTable table) + protected ExtendedStateImplementation(Block block, ImmutableMap properties, ImmutableMap, Optional> unlistedProperties, ImmutableTable table) { super(block, properties); this.unlistedProperties = unlistedProperties; @@ -64,7 +64,7 @@ public class ExtendedBlockState extends BlockState } @Override - public IBlockState withProperty(IProperty property, Comparable value) + public , V extends T> IBlockState withProperty(IProperty property, V value) { if (!this.getProperties().containsKey(property)) { From 4c4d1096a73579aa70c69f2a1fc2e277191037ab Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 10 Nov 2015 01:14:37 +0300 Subject: [PATCH 008/133] FontRenderer + Item patch update; WorldVertexBufferUploader patch derp fix. --- .../client/gui/FontRenderer.java.patch | 50 +- .../WorldVertexBufferUploader.java.patch | 2 +- .../net/minecraft/item/Item.java.patch | 594 +++++++++++++++++- .../client/gui/FontRenderer.java.patch.rej | 47 -- .../net/minecraft/item/Item.java.patch.rej | 593 ----------------- 5 files changed, 640 insertions(+), 646 deletions(-) delete mode 100644 rejects/minecraft/net/minecraft/client/gui/FontRenderer.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/item/Item.java.patch.rej diff --git a/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch b/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch index f3a13cdd9..16716591d 100644 --- a/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch @@ -35,6 +35,15 @@ inputstream.read(this.glyphWidth); } catch (IOException ioexception) +@@ -197,7 +198,7 @@ + int i = p_78266_1_ % 16 * 8; + int j = p_78266_1_ / 16 * 8; + int k = p_78266_2_ ? 1 : 0; +- this.renderEngine.bindTexture(this.locationFontTexture); ++ bindTexture(this.locationFontTexture); + int l = this.charWidth[p_78266_1_]; + float f = (float)l - 0.01F; + GL11.glBegin(GL11.GL_TRIANGLE_STRIP); @@ -225,7 +226,7 @@ private void loadGlyphTexture(int p_78257_1_) @@ -53,6 +62,15 @@ this.resetStyles(); int i; +@@ -342,7 +343,7 @@ + + int j1 = this.colorCode[i1]; + this.textColor = j1; +- GlStateManager.color((float)(j1 >> 16) / 255.0F, (float)(j1 >> 8 & 255) / 255.0F, (float)(j1 & 255) / 255.0F, this.alpha); ++ setColor((float)(j1 >> 16) / 255.0F, (float)(j1 >> 8 & 255) / 255.0F, (float)(j1 & 255) / 255.0F, this.alpha); + } + else if (i1 == 16) + { @@ -371,7 +372,7 @@ this.strikethroughStyle = false; this.underlineStyle = false; @@ -62,7 +80,33 @@ } ++i; -@@ -510,7 +511,7 @@ +@@ -399,7 +400,7 @@ + c0 = c1; + } + +- float f1 = this.unicodeFlag ? 0.5F : 1.0F; ++ float f1 = getCharWidth(c0) / 32f; + boolean flag = (c0 == 0 || j == -1 || this.unicodeFlag) && p_78255_2_; + + if (flag) +@@ -437,7 +438,16 @@ + + ++f; + } ++ doDraw(f); ++ } ++ } ++ } + ++ protected void doDraw(float f) ++ { ++ { ++ { ++ + if (this.strikethroughStyle) + { + Tessellator tessellator = Tessellator.getInstance(); +@@ -510,7 +520,7 @@ this.blue = (float)(p_180455_4_ >> 8 & 255) / 255.0F; this.green = (float)(p_180455_4_ & 255) / 255.0F; this.alpha = (float)(p_180455_4_ >> 24 & 255) / 255.0F; @@ -71,7 +115,7 @@ this.posX = p_180455_2_; this.posY = p_180455_3_; this.renderStringAtPos(p_180455_1_, p_180455_5_); -@@ -589,11 +590,6 @@ +@@ -589,11 +599,6 @@ int j = this.glyphWidth[p_78263_1_] >>> 4; int k = this.glyphWidth[p_78263_1_] & 15; @@ -83,7 +127,7 @@ ++k; return (k - j) / 2 + 1; -@@ -847,6 +843,26 @@ +@@ -847,6 +852,26 @@ return this.bidiFlag; } diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch b/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch index 4e2816de1..598b85363 100644 --- a/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch @@ -60,7 +60,7 @@ - GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); - } + // moved to VertexFormatElement.postDraw -+ vertexformatelement1.getUsage().postDraw(vertexformat, j1, i, bytebuffer); ++ vertexformatelement1.getUsage().postDraw(vertexformat, i1, i, bytebuffer); } } diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index f1b79c590..d09253616 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -1,5 +1,16 @@ --- ../src-base/minecraft/net/minecraft/item/Item.java +++ ../src-work/minecraft/net/minecraft/item/Item.java +@@ -48,8 +48,8 @@ + + public class Item + { +- public static final RegistryNamespaced itemRegistry = new RegistryNamespaced(); +- private static final Map BLOCK_TO_ITEM = Maps.newHashMap(); ++ public static final RegistryNamespaced itemRegistry = net.minecraftforge.fml.common.registry.GameData.getItemRegistry(); ++ private static final Map BLOCK_TO_ITEM = net.minecraftforge.fml.common.registry.GameData.getBlockItemMap(); + protected static final UUID itemModifierUUID = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); + private CreativeTabs tabToDisplayOn; + protected static Random itemRand = new Random(); @@ -62,6 +62,9 @@ private String unlocalizedName; private static final String __OBFID = "CL_00000041"; @@ -46,7 +57,586 @@ Vec3 vec31 = vec3.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false); } -@@ -874,6 +883,10 @@ +@@ -372,11 +381,578 @@ + return false; + } + ++ @Deprecated // Use ItemStack sensitive version below. + public Multimap getItemAttributeModifiers() + { + return HashMultimap.create(); + } + ++ /* ======================================== FORGE START =====================================*/ ++ /** ++ * ItemStack sensitive version of getItemAttributeModifiers ++ */ ++ public Multimap getAttributeModifiers(ItemStack stack) ++ { ++ return this.getItemAttributeModifiers(); ++ } ++ ++ /** ++ * Called when a player drops the item into the world, ++ * returning false from this will prevent the item from ++ * being removed from the players inventory and spawning ++ * in the world ++ * ++ * @param player The player that dropped the item ++ * @param item The item stack, before the item is removed. ++ */ ++ public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player) ++ { ++ return true; ++ } ++ ++ /** ++ * This is called when the item is used, before the block is activated. ++ * @param stack The Item Stack ++ * @param player The Player that used the item ++ * @param world The Current World ++ * @param pos Target position ++ * @param side The side of the target hit ++ * @return Return true to prevent any further processing. ++ */ ++ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) ++ { ++ return false; ++ } ++ ++ /** ++ * Metadata-sensitive version of getStrVsBlock ++ * @param itemstack The Item Stack ++ * @param state The block state ++ * @return The damage strength ++ */ ++ public float getDigSpeed(ItemStack itemstack, net.minecraft.block.state.IBlockState state) ++ { ++ return getStrVsBlock(itemstack, state.getBlock()); ++ } ++ ++ ++ protected boolean canRepair = true; ++ /** ++ * Called by CraftingManager to determine if an item is reparable. ++ * @return True if reparable ++ */ ++ public boolean isRepairable() ++ { ++ return canRepair && isDamageable(); ++ } ++ ++ /** ++ * Call to disable repair recipes. ++ * @return The current Item instance ++ */ ++ public Item setNoRepair() ++ { ++ canRepair = false; ++ return this; ++ } ++ ++ /** ++ * Called before a block is broken. Return true to prevent default block harvesting. ++ * ++ * Note: In SMP, this is called on both client and server sides! ++ * ++ * @param itemstack The current ItemStack ++ * @param pos Block's position in world ++ * @param player The Player that is wielding the item ++ * @return True to prevent harvesting, false to continue as normal ++ */ ++ public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) ++ { ++ return false; ++ } ++ ++ /** ++ * Called each tick while using an item. ++ * @param stack The Item being used ++ * @param player The Player using the item ++ * @param count The amount of time in tick the item has been used for continuously ++ */ ++ public void onUsingTick(ItemStack stack, EntityPlayer player, int count) ++ { ++ } ++ ++ /** ++ * Called when the player Left Clicks (attacks) an entity. ++ * Processed before damage is done, if return value is true further processing is canceled ++ * and the entity is not attacked. ++ * ++ * @param stack The Item being used ++ * @param player The player that is attacking ++ * @param entity The entity being attacked ++ * @return True to cancel the rest of the interaction. ++ */ ++ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) ++ { ++ return false; ++ } ++ ++ /** ++ * Player, Render pass, and item usage sensitive version of getIconIndex. ++ * ++ * @param stack The item stack to get the icon for. ++ * @param player The player holding the item ++ * @param useRemaining The ticks remaining for the active item. ++ * @return Null to use default model, or a custom ModelResourceLocation for the stage of use. ++ */ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.client.resources.model.ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) ++ { ++ return null; ++ } ++ ++ /** ++ * ItemStack sensitive version of getContainerItem. ++ * Returns a full ItemStack instance of the result. ++ * ++ * @param itemStack The current ItemStack ++ * @return The resulting ItemStack ++ */ ++ public ItemStack getContainerItem(ItemStack itemStack) ++ { ++ if (!hasContainerItem(itemStack)) ++ { ++ return null; ++ } ++ return new ItemStack(getContainerItem()); ++ } ++ ++ /** ++ * ItemStack sensitive version of hasContainerItem ++ * @param stack The current item stack ++ * @return True if this item has a 'container' ++ */ ++ public boolean hasContainerItem(ItemStack stack) ++ { ++ return hasContainerItem(); ++ } ++ ++ /** ++ * Retrieves the normal 'lifespan' of this item when it is dropped on the ground as a EntityItem. ++ * This is in ticks, standard result is 6000, or 5 mins. ++ * ++ * @param itemStack The current ItemStack ++ * @param world The world the entity is in ++ * @return The normal lifespan in ticks. ++ */ ++ public int getEntityLifespan(ItemStack itemStack, World world) ++ { ++ return 6000; ++ } ++ ++ /** ++ * Determines if this Item has a special entity for when they are in the world. ++ * Is called when a EntityItem is spawned in the world, if true and Item#createCustomEntity ++ * returns non null, the EntityItem will be destroyed and the new Entity will be added to the world. ++ * ++ * @param stack The current item stack ++ * @return True of the item has a custom entity, If true, Item#createCustomEntity will be called ++ */ ++ public boolean hasCustomEntity(ItemStack stack) ++ { ++ return false; ++ } ++ ++ /** ++ * This function should return a new entity to replace the dropped item. ++ * Returning null here will not kill the EntityItem and will leave it to function normally. ++ * Called when the item it placed in a world. ++ * ++ * @param world The world object ++ * @param location The EntityItem object, useful for getting the position of the entity ++ * @param itemstack The current item stack ++ * @return A new Entity object to spawn or null ++ */ ++ public Entity createEntity(World world, Entity location, ItemStack itemstack) ++ { ++ return null; ++ } ++ ++ /** ++ * Called by the default implemetation of EntityItem's onUpdate method, allowing for cleaner ++ * control over the update of the item without having to write a subclass. ++ * ++ * @param entityItem The entity Item ++ * @return Return true to skip any further update code. ++ */ ++ public boolean onEntityItemUpdate(net.minecraft.entity.item.EntityItem entityItem) ++ { ++ return false; ++ } ++ ++ /** ++ * Gets a list of tabs that items belonging to this class can display on, ++ * combined properly with getSubItems allows for a single item to span ++ * many sub-items across many tabs. ++ * ++ * @return A list of all tabs that this item could possibly be one. ++ */ ++ public CreativeTabs[] getCreativeTabs() ++ { ++ return new CreativeTabs[]{ getCreativeTab() }; ++ } ++ ++ /** ++ * Determines the base experience for a player when they remove this item from a furnace slot. ++ * This number must be between 0 and 1 for it to be valid. ++ * This number will be multiplied by the stack size to get the total experience. ++ * ++ * @param item The item stack the player is picking up. ++ * @return The amount to award for each item. ++ */ ++ public float getSmeltingExperience(ItemStack item) ++ { ++ return -1; //-1 will default to the old lookups. ++ } ++ ++ /** ++ * Return the correct icon for rendering based on the supplied ItemStack and render pass. ++ * ++ * Defers to {@link #getIconFromDamageForRenderPass(int, int)} ++ * @param stack to render for ++ * @param pass the multi-render pass ++ * @return the icon ++ * / ++ public IIcon getIcon(ItemStack stack, int pass) ++ { ++ return func_77618_c(stack.getMetadata(), pass); ++ } ++ */ ++ ++ /** ++ * Generates the base Random item for a specific instance of the chest gen, ++ * Enchanted books use this to pick a random enchantment. ++ * ++ * @param chest The chest category to generate for ++ * @param rnd World RNG ++ * @param original Original result registered with the chest gen hooks. ++ * @return New values to use as the random item, typically this will be original ++ */ ++ public net.minecraft.util.WeightedRandomChestContent getChestGenBase(net.minecraftforge.common.ChestGenHooks chest, Random rnd, net.minecraft.util.WeightedRandomChestContent original) ++ { ++ if (this instanceof ItemEnchantedBook) ++ { ++ return ((ItemEnchantedBook)this).getRandom(rnd, ++ original.theMinimumChanceToGenerateItem, ++ original.theMaximumChanceToGenerateItem, original.itemWeight); ++ } ++ return original; ++ } ++ ++ /** ++ * ++ * Should this item, when held, allow sneak-clicks to pass through to the underlying block? ++ * ++ * @param world The world ++ * @param pos Block position in world ++ * @param player The Player that is wielding the item ++ * @return ++ */ ++ public boolean doesSneakBypassUse(World world, BlockPos pos, EntityPlayer player) ++ { ++ return false; ++ } ++ ++ /** ++ * Called to tick armor in the armor slot. Override to do something ++ */ ++ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack){} ++ ++ /** ++ * Determines if the specific ItemStack can be placed in the specified armor slot. ++ * ++ * @param stack The ItemStack ++ * @param armorType Armor slot ID: 0: Helmet, 1: Chest, 2: Legs, 3: Boots ++ * @param entity The entity trying to equip the armor ++ * @return True if the given ItemStack can be inserted in the slot ++ */ ++ public boolean isValidArmor(ItemStack stack, int armorType, Entity entity) ++ { ++ if (this instanceof ItemArmor) ++ { ++ return ((ItemArmor)this).armorType == armorType; ++ } ++ ++ if (armorType == 0) ++ { ++ return this == Item.getItemFromBlock(Blocks.pumpkin) || this == Items.skull; ++ } ++ ++ return false; ++ } ++ ++ /** ++ * Allow or forbid the specific book/item combination as an anvil enchant ++ * ++ * @param stack The item ++ * @param book The book ++ * @return if the enchantment is allowed ++ */ ++ public boolean isBookEnchantable(ItemStack stack, ItemStack book) ++ { ++ return true; ++ } ++ ++ /** ++ * Called by RenderBiped and RenderPlayer to determine the armor texture that ++ * should be use for the currently equipped item. ++ * This will only be called on instances of ItemArmor. ++ * ++ * Returning null from this function will use the default value. ++ * ++ * @param stack ItemStack for the equipped armor ++ * @param entity The entity wearing the armor ++ * @param slot The slot the armor is in ++ * @param type The subtype, can be null or "overlay" ++ * @return Path of texture to bind, or null to use default ++ */ ++ public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) ++ { ++ return null; ++ } ++ ++ /** ++ * Returns the font renderer used to render tooltips and overlays for this item. ++ * Returning null will use the standard font renderer. ++ * ++ * @param stack The current item stack ++ * @return A instance of FontRenderer or null to use default ++ */ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.client.gui.FontRenderer getFontRenderer(ItemStack stack) ++ { ++ return null; ++ } ++ ++ /** ++ * Override this method to have an item handle its own armor rendering. ++ * ++ * @param entityLiving The entity wearing the armor ++ * @param itemStack The itemStack to render the model of ++ * @param armorSlot 0=head, 1=torso, 2=legs, 3=feet ++ * ++ * @return A ModelBiped to render instead of the default ++ */ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) ++ { ++ return null; ++ } ++ ++ /** ++ * Called when a entity tries to play the 'swing' animation. ++ * ++ * @param entityLiving The entity swinging the item. ++ * @param stack The Item stack ++ * @return True to cancel any further processing by EntityLiving ++ */ ++ public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) ++ { ++ return false; ++ } ++ ++ /** ++ * Called when the client starts rendering the HUD, for whatever item the player currently has as a helmet. ++ * This is where pumpkins would render there overlay. ++ * ++ * @param stack The ItemStack that is equipped ++ * @param player Reference to the current client entity ++ * @param resolution Resolution information about the current viewport and configured GUI Scale ++ * @param partialTicks Partial ticks for the renderer, useful for interpolation ++ */ ++ @SideOnly(Side.CLIENT) ++ public void renderHelmetOverlay(ItemStack stack, EntityPlayer player, net.minecraft.client.gui.ScaledResolution resolution, float partialTicks){} ++ ++ /** ++ * Return the itemDamage represented by this ItemStack. Defaults to the itemDamage field on ItemStack, but can be overridden here for other sources such as NBT. ++ * ++ * @param stack The itemstack that is damaged ++ * @return the damage value ++ */ ++ public int getDamage(ItemStack stack) ++ { ++ return stack.itemDamage; ++ } ++ ++ /** ++ * This used to be 'display damage' but its really just 'aux' data in the ItemStack, usually shares the same variable as damage. ++ * @param stack ++ * @return ++ */ ++ public int getMetadata(ItemStack stack) ++ { ++ return stack.itemDamage; ++ } ++ ++ /** ++ * Determines if the durability bar should be rendered for this item. ++ * Defaults to vanilla stack.isDamaged behavior. ++ * But modders can use this for any data they wish. ++ * ++ * @param stack The current Item Stack ++ * @return True if it should render the 'durability' bar. ++ */ ++ public boolean showDurabilityBar(ItemStack stack) ++ { ++ return stack.isItemDamaged(); ++ } ++ ++ /** ++ * Queries the percentage of the 'Durability' bar that should be drawn. ++ * ++ * @param stack The current ItemStack ++ * @return 1.0 for 100% 0 for 0% ++ */ ++ public double getDurabilityForDisplay(ItemStack stack) ++ { ++ return (double)stack.getItemDamage() / (double)stack.getMaxDamage(); ++ } ++ ++ /** ++ * Return the maxDamage for this ItemStack. Defaults to the maxDamage field in this item, ++ * but can be overridden here for other sources such as NBT. ++ * ++ * @param stack The itemstack that is damaged ++ * @return the damage value ++ */ ++ public int getMaxDamage(ItemStack stack) ++ { ++ return getMaxDamage(); ++ } ++ ++ /** ++ * Return if this itemstack is damaged. Note only called if {@link #isDamageable()} is true. ++ * @param stack the stack ++ * @return if the stack is damaged ++ */ ++ public boolean isDamaged(ItemStack stack) ++ { ++ return stack.itemDamage > 0; ++ } ++ ++ /** ++ * Set the damage for this itemstack. Note, this method is responsible for zero checking. ++ * @param stack the stack ++ * @param damage the new damage value ++ */ ++ public void setDamage(ItemStack stack, int damage) ++ { ++ stack.itemDamage = damage; ++ ++ if (stack.itemDamage < 0) ++ { ++ stack.itemDamage = 0; ++ } ++ } ++ ++ /** ++ * ItemStack sensitive version of {@link #canHarvestBlock(Block)} ++ * @param par1Block The block trying to harvest ++ * @param itemStack The itemstack used to harvest the block ++ * @return true if can harvest the block ++ */ ++ public boolean canHarvestBlock(Block par1Block, ItemStack itemStack) ++ { ++ return canHarvestBlock(par1Block); ++ } ++ ++ /** ++ * Gets the maximum number of items that this stack should be able to hold. ++ * This is a ItemStack (and thus NBT) sensitive version of Item.getItemStackLimit() ++ * ++ * @param stack The ItemStack ++ * @return THe maximum number this item can be stacked to ++ */ ++ public int getItemStackLimit(ItemStack stack) ++ { ++ return this.getItemStackLimit(); ++ } ++ ++ private java.util.Map toolClasses = new java.util.HashMap(); ++ /** ++ * Sets or removes the harvest level for the specified tool class. ++ * ++ * @param toolClass Class ++ * @param level Harvest level: ++ * Wood: 0 ++ * Stone: 1 ++ * Iron: 2 ++ * Diamond: 3 ++ * Gold: 0 ++ */ ++ public void setHarvestLevel(String toolClass, int level) ++ { ++ if (level < 0) ++ toolClasses.remove(toolClass); ++ else ++ toolClasses.put(toolClass, level); ++ } ++ ++ public java.util.Set getToolClasses(ItemStack stack) ++ { ++ return toolClasses.keySet(); ++ } ++ ++ /** ++ * Queries the harvest level of this item stack for the specifred tool class, ++ * Returns -1 if this tool is not of the specified type ++ * ++ * @param stack This item stack instance ++ * @param toolClass Tool Class ++ * @return Harvest level, or -1 if not the specified tool type. ++ */ ++ public int getHarvestLevel(ItemStack stack, String toolClass) ++ { ++ Integer ret = toolClasses.get(toolClass); ++ return ret == null ? -1 : ret; ++ } ++ ++ /** ++ * ItemStack sensitive version of getItemEnchantability ++ * ++ * @param stack The ItemStack ++ * @return the item echantability value ++ */ ++ public int getItemEnchantability(ItemStack stack) ++ { ++ return getItemEnchantability(); ++ } ++ ++ /** ++ * Whether this Item can be used as a payment to activate the vanilla beacon. ++ * @param stack the ItemStack ++ * @return true if this Item can be used ++ */ ++ public boolean isBeaconPayment(ItemStack stack) ++ { ++ return this == Items.emerald || this == Items.diamond || this == Items.gold_ingot || this == Items.iron_ingot; ++ } ++ ++ ++ /** ++ * Determine if the player switching between these two item stacks ++ * @param oldStack The old stack that was equipped ++ * @param newStack The new stack ++ * @param slotChanged If the current equipped slot was changed, ++ * Vanilla does not play the animation if you switch between two ++ * slots that hold the exact same item. ++ * @return True to play the item change animation ++ */ ++ public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) ++ { ++ return !ItemStack.areItemStacksEqual(oldStack, newStack); ++ } ++ /* ======================================== FORGE END =====================================*/ ++ + public static void registerItems() + { + registerItemBlock(Blocks.stone, (new ItemMultiTexture(Blocks.stone, Blocks.stone, new Function() +@@ -874,6 +1450,10 @@ private final int enchantability; private static final String __OBFID = "CL_00000042"; @@ -57,7 +647,7 @@ private ToolMaterial(int harvestLevel, int maxUses, float efficiency, float damageVsEntity, int enchantability) { this.harvestLevel = harvestLevel; -@@ -908,9 +921,36 @@ +@@ -908,9 +1488,36 @@ return this.enchantability; } diff --git a/rejects/minecraft/net/minecraft/client/gui/FontRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/FontRenderer.java.patch.rej deleted file mode 100644 index c45fe36d9..000000000 --- a/rejects/minecraft/net/minecraft/client/gui/FontRenderer.java.patch.rej +++ /dev/null @@ -1,47 +0,0 @@ -++++ REJECTED PATCH 5 - float f = (float)(p_78266_1_ % 16 * 8); - float f1 = (float)(p_78266_1_ / 16 * 8); - float f2 = p_78266_2_ ? 1.0F : 0.0F; -- this.renderEngine.bindTexture(this.locationFontTexture); -+ bindTexture(this.locationFontTexture); - float f3 = (float)this.charWidth[p_78266_1_] - 0.01F; - GL11.glBegin(GL11.GL_TRIANGLE_STRIP); - GL11.glTexCoord2f(f / 128.0F, f1 / 128.0F); -++++ END PATCH -++++ REJECTED PATCH 8 - - k = this.colorCode[j]; - this.textColor = k; -- GlStateManager.color((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.alpha); -+ setColor((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.alpha); - } - else if (j == 16) - { -++++ END PATCH -++++ REJECTED PATCH 10 - j = k; - } - -- float f1 = this.unicodeFlag ? 0.5F : 1.0F; -+ float f1 = getCharWidth(c0) / 32f; - boolean flag1 = (c0 == 0 || j == -1 || this.unicodeFlag) && p_78255_2_; - - if (flag1) -++++ END PATCH -++++ REJECTED PATCH 11 - ++f; - } - -+ doDraw(f); -+ } -+ } -+ } -+ -+ protected void doDraw(float f) -+ { -+ { -+ { - Tessellator tessellator; - WorldRenderer worldrenderer; - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/Item.java.patch.rej b/rejects/minecraft/net/minecraft/item/Item.java.patch.rej deleted file mode 100644 index 459b12091..000000000 --- a/rejects/minecraft/net/minecraft/item/Item.java.patch.rej +++ /dev/null @@ -1,593 +0,0 @@ -++++ REJECTED PATCH 1 - - public class Item - { -- public static final RegistryNamespaced itemRegistry = new RegistryNamespaced(); -- private static final Map BLOCK_TO_ITEM = Maps.newHashMap(); -+ public static final RegistryNamespaced itemRegistry = net.minecraftforge.fml.common.registry.GameData.getItemRegistry(); -+ private static final Map BLOCK_TO_ITEM = net.minecraftforge.fml.common.registry.GameData.getBlockItemMap(); - protected static final UUID itemModifierUUID = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); - private CreativeTabs tabToDisplayOn; - protected static Random itemRand = new Random(); -++++ END PATCH -++++ REJECTED PATCH 7 - return false; - } - -+ @Deprecated // Use ItemStack sensitive version below. - public Multimap getItemAttributeModifiers() - { - return HashMultimap.create(); - } - -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * ItemStack sensitive version of getItemAttributeModifiers -+ */ -+ public Multimap getAttributeModifiers(ItemStack stack) -+ { -+ return this.getItemAttributeModifiers(); -+ } -+ -+ /** -+ * Called when a player drops the item into the world, -+ * returning false from this will prevent the item from -+ * being removed from the players inventory and spawning -+ * in the world -+ * -+ * @param player The player that dropped the item -+ * @param item The item stack, before the item is removed. -+ */ -+ public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player) -+ { -+ return true; -+ } -+ -+ /** -+ * This is called when the item is used, before the block is activated. -+ * @param stack The Item Stack -+ * @param player The Player that used the item -+ * @param world The Current World -+ * @param pos Target position -+ * @param side The side of the target hit -+ * @return Return true to prevent any further processing. -+ */ -+ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) -+ { -+ return false; -+ } -+ -+ /** -+ * Metadata-sensitive version of getStrVsBlock -+ * @param itemstack The Item Stack -+ * @param state The block state -+ * @return The damage strength -+ */ -+ public float getDigSpeed(ItemStack itemstack, net.minecraft.block.state.IBlockState state) -+ { -+ return getStrVsBlock(itemstack, state.getBlock()); -+ } -+ -+ -+ protected boolean canRepair = true; -+ /** -+ * Called by CraftingManager to determine if an item is reparable. -+ * @return True if reparable -+ */ -+ public boolean isRepairable() -+ { -+ return canRepair && isDamageable(); -+ } -+ -+ /** -+ * Call to disable repair recipes. -+ * @return The current Item instance -+ */ -+ public Item setNoRepair() -+ { -+ canRepair = false; -+ return this; -+ } -+ -+ /** -+ * Called before a block is broken. Return true to prevent default block harvesting. -+ * -+ * Note: In SMP, this is called on both client and server sides! -+ * -+ * @param itemstack The current ItemStack -+ * @param pos Block's position in world -+ * @param player The Player that is wielding the item -+ * @return True to prevent harvesting, false to continue as normal -+ */ -+ public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) -+ { -+ return false; -+ } -+ -+ /** -+ * Called each tick while using an item. -+ * @param stack The Item being used -+ * @param player The Player using the item -+ * @param count The amount of time in tick the item has been used for continuously -+ */ -+ public void onUsingTick(ItemStack stack, EntityPlayer player, int count) -+ { -+ } -+ -+ /** -+ * Called when the player Left Clicks (attacks) an entity. -+ * Processed before damage is done, if return value is true further processing is canceled -+ * and the entity is not attacked. -+ * -+ * @param stack The Item being used -+ * @param player The player that is attacking -+ * @param entity The entity being attacked -+ * @return True to cancel the rest of the interaction. -+ */ -+ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) -+ { -+ return false; -+ } -+ -+ /** -+ * Player, Render pass, and item usage sensitive version of getIconIndex. -+ * -+ * @param stack The item stack to get the icon for. -+ * @param player The player holding the item -+ * @param useRemaining The ticks remaining for the active item. -+ * @return Null to use default model, or a custom ModelResourceLocation for the stage of use. -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.client.resources.model.ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) -+ { -+ return null; -+ } -+ -+ /** -+ * ItemStack sensitive version of getContainerItem. -+ * Returns a full ItemStack instance of the result. -+ * -+ * @param itemStack The current ItemStack -+ * @return The resulting ItemStack -+ */ -+ public ItemStack getContainerItem(ItemStack itemStack) -+ { -+ if (!hasContainerItem(itemStack)) -+ { -+ return null; -+ } -+ return new ItemStack(getContainerItem()); -+ } -+ -+ /** -+ * ItemStack sensitive version of hasContainerItem -+ * @param stack The current item stack -+ * @return True if this item has a 'container' -+ */ -+ public boolean hasContainerItem(ItemStack stack) -+ { -+ return hasContainerItem(); -+ } -+ -+ /** -+ * Retrieves the normal 'lifespan' of this item when it is dropped on the ground as a EntityItem. -+ * This is in ticks, standard result is 6000, or 5 mins. -+ * -+ * @param itemStack The current ItemStack -+ * @param world The world the entity is in -+ * @return The normal lifespan in ticks. -+ */ -+ public int getEntityLifespan(ItemStack itemStack, World world) -+ { -+ return 6000; -+ } -+ -+ /** -+ * Determines if this Item has a special entity for when they are in the world. -+ * Is called when a EntityItem is spawned in the world, if true and Item#createCustomEntity -+ * returns non null, the EntityItem will be destroyed and the new Entity will be added to the world. -+ * -+ * @param stack The current item stack -+ * @return True of the item has a custom entity, If true, Item#createCustomEntity will be called -+ */ -+ public boolean hasCustomEntity(ItemStack stack) -+ { -+ return false; -+ } -+ -+ /** -+ * This function should return a new entity to replace the dropped item. -+ * Returning null here will not kill the EntityItem and will leave it to function normally. -+ * Called when the item it placed in a world. -+ * -+ * @param world The world object -+ * @param location The EntityItem object, useful for getting the position of the entity -+ * @param itemstack The current item stack -+ * @return A new Entity object to spawn or null -+ */ -+ public Entity createEntity(World world, Entity location, ItemStack itemstack) -+ { -+ return null; -+ } -+ -+ /** -+ * Called by the default implemetation of EntityItem's onUpdate method, allowing for cleaner -+ * control over the update of the item without having to write a subclass. -+ * -+ * @param entityItem The entity Item -+ * @return Return true to skip any further update code. -+ */ -+ public boolean onEntityItemUpdate(net.minecraft.entity.item.EntityItem entityItem) -+ { -+ return false; -+ } -+ -+ /** -+ * Gets a list of tabs that items belonging to this class can display on, -+ * combined properly with getSubItems allows for a single item to span -+ * many sub-items across many tabs. -+ * -+ * @return A list of all tabs that this item could possibly be one. -+ */ -+ public CreativeTabs[] getCreativeTabs() -+ { -+ return new CreativeTabs[]{ getCreativeTab() }; -+ } -+ -+ /** -+ * Determines the base experience for a player when they remove this item from a furnace slot. -+ * This number must be between 0 and 1 for it to be valid. -+ * This number will be multiplied by the stack size to get the total experience. -+ * -+ * @param item The item stack the player is picking up. -+ * @return The amount to award for each item. -+ */ -+ public float getSmeltingExperience(ItemStack item) -+ { -+ return -1; //-1 will default to the old lookups. -+ } -+ -+ /** -+ * Return the correct icon for rendering based on the supplied ItemStack and render pass. -+ * -+ * Defers to {@link #getIconFromDamageForRenderPass(int, int)} -+ * @param stack to render for -+ * @param pass the multi-render pass -+ * @return the icon -+ * / -+ public IIcon getIcon(ItemStack stack, int pass) -+ { -+ return func_77618_c(stack.getMetadata(), pass); -+ } -+ */ -+ -+ /** -+ * Generates the base Random item for a specific instance of the chest gen, -+ * Enchanted books use this to pick a random enchantment. -+ * -+ * @param chest The chest category to generate for -+ * @param rnd World RNG -+ * @param original Original result registered with the chest gen hooks. -+ * @return New values to use as the random item, typically this will be original -+ */ -+ public net.minecraft.util.WeightedRandomChestContent getChestGenBase(net.minecraftforge.common.ChestGenHooks chest, Random rnd, net.minecraft.util.WeightedRandomChestContent original) -+ { -+ if (this instanceof ItemEnchantedBook) -+ { -+ return ((ItemEnchantedBook)this).getRandom(rnd, -+ original.theMinimumChanceToGenerateItem, -+ original.theMaximumChanceToGenerateItem, original.itemWeight); -+ } -+ return original; -+ } -+ -+ /** -+ * -+ * Should this item, when held, allow sneak-clicks to pass through to the underlying block? -+ * -+ * @param world The world -+ * @param pos Block position in world -+ * @param player The Player that is wielding the item -+ * @return -+ */ -+ public boolean doesSneakBypassUse(World world, BlockPos pos, EntityPlayer player) -+ { -+ return false; -+ } -+ -+ /** -+ * Called to tick armor in the armor slot. Override to do something -+ */ -+ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack){} -+ -+ /** -+ * Determines if the specific ItemStack can be placed in the specified armor slot. -+ * -+ * @param stack The ItemStack -+ * @param armorType Armor slot ID: 0: Helmet, 1: Chest, 2: Legs, 3: Boots -+ * @param entity The entity trying to equip the armor -+ * @return True if the given ItemStack can be inserted in the slot -+ */ -+ public boolean isValidArmor(ItemStack stack, int armorType, Entity entity) -+ { -+ if (this instanceof ItemArmor) -+ { -+ return ((ItemArmor)this).armorType == armorType; -+ } -+ -+ if (armorType == 0) -+ { -+ return this == Item.getItemFromBlock(Blocks.pumpkin) || this == Items.skull; -+ } -+ -+ return false; -+ } -+ -+ /** -+ * Allow or forbid the specific book/item combination as an anvil enchant -+ * -+ * @param stack The item -+ * @param book The book -+ * @return if the enchantment is allowed -+ */ -+ public boolean isBookEnchantable(ItemStack stack, ItemStack book) -+ { -+ return true; -+ } -+ -+ /** -+ * Called by RenderBiped and RenderPlayer to determine the armor texture that -+ * should be use for the currently equipped item. -+ * This will only be called on instances of ItemArmor. -+ * -+ * Returning null from this function will use the default value. -+ * -+ * @param stack ItemStack for the equipped armor -+ * @param entity The entity wearing the armor -+ * @param slot The slot the armor is in -+ * @param type The subtype, can be null or "overlay" -+ * @return Path of texture to bind, or null to use default -+ */ -+ public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) -+ { -+ return null; -+ } -+ -+ /** -+ * Returns the font renderer used to render tooltips and overlays for this item. -+ * Returning null will use the standard font renderer. -+ * -+ * @param stack The current item stack -+ * @return A instance of FontRenderer or null to use default -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.client.gui.FontRenderer getFontRenderer(ItemStack stack) -+ { -+ return null; -+ } -+ -+ /** -+ * Override this method to have an item handle its own armor rendering. -+ * -+ * @param entityLiving The entity wearing the armor -+ * @param itemStack The itemStack to render the model of -+ * @param armorSlot 0=head, 1=torso, 2=legs, 3=feet -+ * -+ * @return A ModelBiped to render instead of the default -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) -+ { -+ return null; -+ } -+ -+ /** -+ * Called when a entity tries to play the 'swing' animation. -+ * -+ * @param entityLiving The entity swinging the item. -+ * @param stack The Item stack -+ * @return True to cancel any further processing by EntityLiving -+ */ -+ public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) -+ { -+ return false; -+ } -+ -+ /** -+ * Called when the client starts rendering the HUD, for whatever item the player currently has as a helmet. -+ * This is where pumpkins would render there overlay. -+ * -+ * @param stack The ItemStack that is equipped -+ * @param player Reference to the current client entity -+ * @param resolution Resolution information about the current viewport and configured GUI Scale -+ * @param partialTicks Partial ticks for the renderer, useful for interpolation -+ */ -+ @SideOnly(Side.CLIENT) -+ public void renderHelmetOverlay(ItemStack stack, EntityPlayer player, net.minecraft.client.gui.ScaledResolution resolution, float partialTicks){} -+ -+ /** -+ * Return the itemDamage represented by this ItemStack. Defaults to the itemDamage field on ItemStack, but can be overridden here for other sources such as NBT. -+ * -+ * @param stack The itemstack that is damaged -+ * @return the damage value -+ */ -+ public int getDamage(ItemStack stack) -+ { -+ return stack.itemDamage; -+ } -+ -+ /** -+ * This used to be 'display damage' but its really just 'aux' data in the ItemStack, usually shares the same variable as damage. -+ * @param stack -+ * @return -+ */ -+ public int getMetadata(ItemStack stack) -+ { -+ return stack.itemDamage; -+ } -+ -+ /** -+ * Determines if the durability bar should be rendered for this item. -+ * Defaults to vanilla stack.isDamaged behavior. -+ * But modders can use this for any data they wish. -+ * -+ * @param stack The current Item Stack -+ * @return True if it should render the 'durability' bar. -+ */ -+ public boolean showDurabilityBar(ItemStack stack) -+ { -+ return stack.isItemDamaged(); -+ } -+ -+ /** -+ * Queries the percentage of the 'Durability' bar that should be drawn. -+ * -+ * @param stack The current ItemStack -+ * @return 1.0 for 100% 0 for 0% -+ */ -+ public double getDurabilityForDisplay(ItemStack stack) -+ { -+ return (double)stack.getItemDamage() / (double)stack.getMaxDamage(); -+ } -+ -+ /** -+ * Return the maxDamage for this ItemStack. Defaults to the maxDamage field in this item, -+ * but can be overridden here for other sources such as NBT. -+ * -+ * @param stack The itemstack that is damaged -+ * @return the damage value -+ */ -+ public int getMaxDamage(ItemStack stack) -+ { -+ return getMaxDamage(); -+ } -+ -+ /** -+ * Return if this itemstack is damaged. Note only called if {@link #isDamageable()} is true. -+ * @param stack the stack -+ * @return if the stack is damaged -+ */ -+ public boolean isDamaged(ItemStack stack) -+ { -+ return stack.itemDamage > 0; -+ } -+ -+ /** -+ * Set the damage for this itemstack. Note, this method is responsible for zero checking. -+ * @param stack the stack -+ * @param damage the new damage value -+ */ -+ public void setDamage(ItemStack stack, int damage) -+ { -+ stack.itemDamage = damage; -+ -+ if (stack.itemDamage < 0) -+ { -+ stack.itemDamage = 0; -+ } -+ } -+ -+ /** -+ * ItemStack sensitive version of {@link #canHarvestBlock(Block)} -+ * @param par1Block The block trying to harvest -+ * @param itemStack The itemstack used to harvest the block -+ * @return true if can harvest the block -+ */ -+ public boolean canHarvestBlock(Block par1Block, ItemStack itemStack) -+ { -+ return canHarvestBlock(par1Block); -+ } -+ -+ /** -+ * Gets the maximum number of items that this stack should be able to hold. -+ * This is a ItemStack (and thus NBT) sensitive version of Item.getItemStackLimit() -+ * -+ * @param stack The ItemStack -+ * @return THe maximum number this item can be stacked to -+ */ -+ public int getItemStackLimit(ItemStack stack) -+ { -+ return this.getItemStackLimit(); -+ } -+ -+ private java.util.Map toolClasses = new java.util.HashMap(); -+ /** -+ * Sets or removes the harvest level for the specified tool class. -+ * -+ * @param toolClass Class -+ * @param level Harvest level: -+ * Wood: 0 -+ * Stone: 1 -+ * Iron: 2 -+ * Diamond: 3 -+ * Gold: 0 -+ */ -+ public void setHarvestLevel(String toolClass, int level) -+ { -+ if (level < 0) -+ toolClasses.remove(toolClass); -+ else -+ toolClasses.put(toolClass, level); -+ } -+ -+ public java.util.Set getToolClasses(ItemStack stack) -+ { -+ return toolClasses.keySet(); -+ } -+ -+ /** -+ * Queries the harvest level of this item stack for the specifred tool class, -+ * Returns -1 if this tool is not of the specified type -+ * -+ * @param stack This item stack instance -+ * @param toolClass Tool Class -+ * @return Harvest level, or -1 if not the specified tool type. -+ */ -+ public int getHarvestLevel(ItemStack stack, String toolClass) -+ { -+ Integer ret = toolClasses.get(toolClass); -+ return ret == null ? -1 : ret; -+ } -+ -+ /** -+ * ItemStack sensitive version of getItemEnchantability -+ * -+ * @param stack The ItemStack -+ * @return the item echantability value -+ */ -+ public int getItemEnchantability(ItemStack stack) -+ { -+ return getItemEnchantability(); -+ } -+ -+ /** -+ * Whether this Item can be used as a payment to activate the vanilla beacon. -+ * @param stack the ItemStack -+ * @return true if this Item can be used -+ */ -+ public boolean isBeaconPayment(ItemStack stack) -+ { -+ return this == Items.emerald || this == Items.diamond || this == Items.gold_ingot || this == Items.iron_ingot; -+ } -+ -+ -+ /** -+ * Determine if the player switching between these two item stacks -+ * @param oldStack The old stack that was equipped -+ * @param newStack The new stack -+ * @param slotChanged If the current equipped slot was changed, -+ * Vanilla does not play the animation if you switch between two -+ * slots that hold the exact same item. -+ * @return True to play the item change animation -+ */ -+ public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) -+ { -+ return !ItemStack.areItemStacksEqual(oldStack, newStack); -+ } -+ /* ======================================== FORGE END =====================================*/ -+ -+ - public static void registerItems() - { - registerItemBlock(Blocks.stone, (new ItemMultiTexture(Blocks.stone, Blocks.stone, new Function() -++++ END PATCH From adddfab850cbe733986bd98bcc86d494d4fde5e5 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 10 Nov 2015 19:39:41 +0300 Subject: [PATCH 009/133] IntegratedServer, World, EnumChatFormatting and EnumFacing --- .../integrated/IntegratedServer.java.patch | 61 +- .../net/minecraft/world/World.java.patch | 869 ++++++++++++++++++ .../IntegratedServer.java.patch.rej | 59 +- .../util/EnumChatFormatting.java.patch.rej | 9 - .../minecraft/util/EnumFacing.java.patch.rej | 10 - 5 files changed, 929 insertions(+), 79 deletions(-) create mode 100644 patches/minecraft/net/minecraft/world/World.java.patch delete mode 100644 rejects/minecraft/net/minecraft/util/EnumChatFormatting.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/util/EnumFacing.java.patch.rej diff --git a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch index 60e46c1f8..72385a840 100644 --- a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch @@ -9,7 +9,64 @@ ISaveHandler isavehandler = this.getActiveAnvilConverter().getSaveLoader(p_71247_1_, true); this.setResourcePackFromWorld(this.getFolderName(), isavehandler); WorldInfo worldinfo = isavehandler.loadWorldInfo(); -@@ -142,9 +140,10 @@ +@@ -87,44 +85,24 @@ + worldinfo.setWorldName(p_71247_2_); + } + +- for (int i = 0; i < this.worldServers.length; ++i) +- { +- int j = 0; ++ WorldServer overWorld = (isDemo() ? (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init() : ++ (WorldServer)(new WorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init()); ++ overWorld.initialize(this.theWorldSettings); + +- if (i == 1) ++ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) ++ { ++ WorldServer world = (dim == 0 ? overWorld : (WorldServer)(new WorldServerMulti(this, isavehandler, dim, overWorld, this.theProfiler)).init()); ++ world.addWorldAccess(new WorldManager(this, world)); ++ if (!this.isSinglePlayer()) + { +- j = -1; ++ world.getWorldInfo().setGameType(getGameType()); + } +- +- if (i == 2) +- { +- j = 1; +- } +- +- if (i == 0) +- { +- if (this.isDemo()) +- { +- this.worldServers[i] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); +- } +- else +- { +- this.worldServers[i] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); +- } +- +- this.worldServers[i].initialize(this.theWorldSettings); +- } +- else +- { +- this.worldServers[i] = (WorldServer)(new WorldServerMulti(this, isavehandler, j, this.worldServers[0], this.theProfiler)).init(); +- } +- +- this.worldServers[i].addWorldAccess(new WorldManager(this, this.worldServers[i])); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); + } + +- this.getConfigurationManager().setPlayerManager(this.worldServers); ++ this.getConfigurationManager().setPlayerManager(new WorldServer[]{ overWorld }); + +- if (this.worldServers[0].getWorldInfo().getDifficulty() == null) ++ if (overWorld.getWorldInfo().getDifficulty() == null) + { + this.setDifficultyForAllWorlds(this.mc.gameSettings.difficulty); + } +@@ -142,9 +120,10 @@ this.setAllowFlight(true); logger.info("Generating keypair"); this.setKeyPair(CryptManager.generateKeyPair()); @@ -21,7 +78,7 @@ } public void tick() -@@ -217,6 +216,7 @@ +@@ -217,6 +196,7 @@ public EnumDifficulty getDifficulty() { diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch new file mode 100644 index 000000000..d12e541c9 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -0,0 +1,869 @@ +--- ../src-base/minecraft/net/minecraft/world/World.java ++++ ../src-work/minecraft/net/minecraft/world/World.java +@@ -57,6 +57,13 @@ + + public abstract class World implements IBlockAccess + { ++ /** ++ * Used in the getEntitiesWithinAABB functions to expand the search area for entities. ++ * Modders should change this variable to a higher value if it is less then the radius ++ * of one of there entities. ++ */ ++ public static double MAX_ENTITY_RADIUS = 2.0D; ++ + private int field_181546_a = 63; + protected boolean scheduledUpdatesAreImmediate; + public final List loadedEntityList = Lists.newArrayList(); +@@ -99,6 +106,10 @@ + int[] lightUpdateBlockList; + private static final String __OBFID = "CL_00000140"; + ++ public boolean restoringBlockSnapshots = false; ++ public boolean captureBlockSnapshots = false; ++ public java.util.ArrayList capturedBlockSnapshots = new java.util.ArrayList(); ++ + protected World(ISaveHandler saveHandlerIn, WorldInfo info, WorldProvider providerIn, Profiler profilerIn, boolean client) + { + this.ambientTickCountdown = this.rand.nextInt(12000); +@@ -111,6 +122,7 @@ + this.provider = providerIn; + this.isRemote = client; + this.worldBorder = providerIn.getWorldBorder(); ++ perWorldStorage = new MapStorage((ISaveHandler)null); + } + + public World init() +@@ -120,6 +132,11 @@ + + public BiomeGenBase getBiomeGenForCoords(final BlockPos pos) + { ++ return this.provider.getBiomeGenForCoords(pos); ++ } ++ ++ public BiomeGenBase getBiomeGenForCoordsBody(final BlockPos pos) ++ { + if (this.isBlockLoaded(pos)) + { + Chunk chunk = this.getChunkFromBlockCoords(pos); +@@ -186,7 +203,7 @@ + + public boolean isAirBlock(BlockPos pos) + { +- return this.getBlockState(pos).getBlock().getMaterial() == Material.air; ++ return this.getBlockState(pos).getBlock().isAir(this, pos); + } + + public boolean isBlockLoaded(BlockPos pos) +@@ -286,39 +303,61 @@ + { + Chunk chunk = this.getChunkFromBlockCoords(pos); + Block block = newState.getBlock(); ++ ++ net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null; ++ if (this.captureBlockSnapshots && !this.isRemote) ++ { ++ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, pos, flags); ++ this.capturedBlockSnapshots.add(blockSnapshot); ++ } ++ int oldLight = getBlockState(pos).getBlock().getLightValue(this, pos); ++ + IBlockState iblockstate = chunk.setBlockState(pos, newState); + + if (iblockstate == null) + { ++ if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot); + return false; + } + else + { + Block block1 = iblockstate.getBlock(); + +- if (block.getLightOpacity() != block1.getLightOpacity() || block.getLightValue() != block1.getLightValue()) ++ if (block.getLightOpacity() != block1.getLightOpacity() || block.getLightValue(this, pos) != block1.getLightValue()) + { + this.theProfiler.startSection("checkLight"); + this.checkLight(pos); + this.theProfiler.endSection(); + } + +- if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && chunk.isPopulated()) ++ if (blockSnapshot == null) // Don't notify clients or update physics while capturing blockstates + { +- this.markBlockForUpdate(pos); ++ this.markAndNotifyBlock(pos, chunk, iblockstate, newState, flags); // Modularize client and physic updates + } + ++ return true; ++ } ++ } ++ } ++ ++ // Split off from original setBlockState(BlockPos, IBlockState Block p_147465_4_, int) method in order to directly send client and physic updates ++ public void markAndNotifyBlock(BlockPos pos, Chunk chunk, IBlockState old, IBlockState new_, int flags) ++ { ++ if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && (chunk == null || chunk.isPopulated())) ++ { ++ this.markBlockForUpdate(pos); ++ } ++ { ++ { + if (!this.isRemote && (flags & 1) != 0) + { +- this.notifyNeighborsRespectDebug(pos, iblockstate.getBlock()); ++ this.notifyNeighborsRespectDebug(pos, new_.getBlock()); + +- if (block.hasComparatorInputOverride()) ++ if (new_.getBlock().hasComparatorInputOverride()) + { +- this.updateComparatorOutputLevel(pos, block); ++ this.updateComparatorOutputLevel(pos, new_.getBlock()); + } + } +- +- return true; + } + } + } +@@ -406,6 +445,9 @@ + + public void notifyNeighborsOfStateChange(BlockPos pos, Block blockType) + { ++ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, pos, this.getBlockState(pos), java.util.EnumSet.allOf(EnumFacing.class)).isCanceled()) ++ return; ++ + this.notifyBlockOfStateChange(pos.west(), blockType); + this.notifyBlockOfStateChange(pos.east(), blockType); + this.notifyBlockOfStateChange(pos.down(), blockType); +@@ -416,6 +458,11 @@ + + public void notifyNeighborsOfStateExcept(BlockPos pos, Block blockType, EnumFacing skipSide) + { ++ java.util.EnumSet directions = java.util.EnumSet.allOf(EnumFacing.class); ++ directions.remove(skipSide); ++ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, pos, this.getBlockState(pos), directions).isCanceled()) ++ return; ++ + if (skipSide != EnumFacing.WEST) + { + this.notifyBlockOfStateChange(pos.west(), blockType); +@@ -780,7 +827,7 @@ + + public boolean isDaytime() + { +- return this.skylightSubtracted < 4; ++ return this.provider.isDaytime(); + } + + public MovingObjectPosition rayTraceBlocks(Vec3 p_72933_1_, Vec3 p_72933_2_) +@@ -975,6 +1022,12 @@ + + public void playSoundAtEntity(Entity p_72956_1_, String p_72956_2_, float p_72956_3_, float p_72956_4_) + { ++ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_72956_1_, p_72956_2_, p_72956_3_, p_72956_4_); ++ if (event.isCanceled() || event.name == null) return; ++ p_72956_2_ = event.name; ++ p_72956_3_ = event.newVolume; ++ p_72956_4_ = event.newPitch; ++ + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).playSound(p_72956_2_, p_72956_1_.posX, p_72956_1_.posY, p_72956_1_.posZ, p_72956_3_, p_72956_4_); +@@ -983,6 +1036,12 @@ + + public void playSoundToNearExcept(EntityPlayer p_85173_1_, String p_85173_2_, float p_85173_3_, float p_85173_4_) + { ++ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_85173_1_, p_85173_2_, p_85173_3_, p_85173_4_); ++ if (event.isCanceled() || event.name == null) return; ++ p_85173_2_ = event.name; ++ p_85173_3_ = event.newVolume; ++ p_85173_4_ = event.newPitch; ++ + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).playSoundToNearExcept(p_85173_1_, p_85173_2_, p_85173_1_.posX, p_85173_1_.posY, p_85173_1_.posZ, p_85173_3_, p_85173_4_); +@@ -1036,6 +1095,9 @@ + + public boolean spawnEntityInWorld(Entity p_72838_1_) + { ++ // do not drop any items while restoring blocksnapshots. Prevents dupes ++ if (!this.isRemote && (p_72838_1_ == null || (p_72838_1_ instanceof net.minecraft.entity.item.EntityItem && this.restoringBlockSnapshots))) return false; ++ + int i = MathHelper.floor_double(p_72838_1_.posX / 16.0D); + int j = MathHelper.floor_double(p_72838_1_.posZ / 16.0D); + boolean flag = p_72838_1_.forceSpawn; +@@ -1058,6 +1120,8 @@ + this.updateAllPlayersSleepingFlag(); + } + ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_72838_1_, this)) && !flag) return false; ++ + this.getChunkFromChunkCoords(i, j).addEntity(p_72838_1_); + this.loadedEntityList.add(p_72838_1_); + this.onEntityAdded(p_72838_1_); +@@ -1270,17 +1334,29 @@ + + public int calculateSkylightSubtracted(float p_72967_1_) + { ++ float f = provider.getSunBrightnessFactor(p_72967_1_); ++ f = 1 - f; ++ return (int)(f * 11); ++ } ++ ++ /** ++ * The current sun brightness factor for this dimension. ++ * 0.0f means no light at all, and 1.0f means maximum sunlight. ++ * Highly recommended for sunlight detection like solar panel. ++ * ++ * @return The current brightness factor ++ * */ ++ public float getSunBrightnessFactor(float p_72967_1_) ++ { + float f = this.getCelestialAngle(p_72967_1_); + float f1 = 1.0F - (MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F); + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); + f1 = 1.0F - f1; + f1 = (float)((double)f1 * (1.0D - (double)(this.getRainStrength(p_72967_1_) * 5.0F) / 16.0D)); + f1 = (float)((double)f1 * (1.0D - (double)(this.getThunderStrength(p_72967_1_) * 5.0F) / 16.0D)); +- f1 = 1.0F - f1; +- return (int)(f1 * 11.0F); ++ return f1; + } + +- @SideOnly(Side.CLIENT) + public void removeWorldAccess(IWorldAccess p_72848_1_) + { + this.worldAccesses.remove(p_72848_1_); +@@ -1289,6 +1365,12 @@ + @SideOnly(Side.CLIENT) + public float getSunBrightness(float p_72971_1_) + { ++ return this.provider.getSunBrightness(p_72971_1_); ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public float getSunBrightnessBody(float p_72971_1_) ++ { + float f = this.getCelestialAngle(p_72971_1_); + float f1 = 1.0F - (MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.2F); + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); +@@ -1301,6 +1383,12 @@ + @SideOnly(Side.CLIENT) + public Vec3 getSkyColor(Entity p_72833_1_, float p_72833_2_) + { ++ return this.provider.getSkyColor(p_72833_1_, p_72833_2_); ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public Vec3 getSkyColorBody(Entity p_72833_1_, float p_72833_2_) ++ { + float f = this.getCelestialAngle(p_72833_2_); + float f1 = MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F; + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); +@@ -1308,9 +1396,7 @@ + int j = MathHelper.floor_double(p_72833_1_.posY); + int k = MathHelper.floor_double(p_72833_1_.posZ); + BlockPos blockpos = new BlockPos(i, j, k); +- BiomeGenBase biomegenbase = this.getBiomeGenForCoords(blockpos); +- float f2 = biomegenbase.getFloatTemperature(blockpos); +- int l = biomegenbase.getSkyColorByTemp(f2); ++ int l = net.minecraftforge.client.ForgeHooksClient.getSkyBlendColour(this, blockpos); + float f3 = (float)(l >> 16 & 255) / 255.0F; + float f4 = (float)(l >> 8 & 255) / 255.0F; + float f5 = (float)(l & 255) / 255.0F; +@@ -1370,6 +1456,11 @@ + + public float getCurrentMoonPhaseFactor() + { ++ return provider.getCurrentMoonPhaseFactor(); ++ } ++ ++ public float getCurrentMoonPhaseFactorBody() ++ { + return WorldProvider.moonPhaseFactors[this.provider.getMoonPhase(this.worldInfo.getWorldTime())]; + } + +@@ -1382,6 +1473,12 @@ + @SideOnly(Side.CLIENT) + public Vec3 getCloudColour(float p_72824_1_) + { ++ return this.provider.drawClouds(p_72824_1_); ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public Vec3 drawCloudsBody(float p_72824_1_) ++ { + float f = this.getCelestialAngle(p_72824_1_); + float f1 = MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F; + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); +@@ -1437,9 +1534,9 @@ + for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1) + { + blockpos1 = blockpos.down(); +- Material material = chunk.getBlock(blockpos1).getMaterial(); ++ Block block = chunk.getBlock(blockpos1); + +- if (material.blocksMovement() && material != Material.leaves) ++ if (block.getMaterial().blocksMovement() && !block.isLeaves(this, blockpos1) && !block.isFoliage(this, blockpos1)) + { + break; + } +@@ -1451,6 +1548,12 @@ + @SideOnly(Side.CLIENT) + public float getStarBrightness(float p_72880_1_) + { ++ return this.provider.getStarBrightness(p_72880_1_); ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public float getStarBrightnessBody(float p_72880_1_) ++ { + float f = this.getCelestialAngle(p_72880_1_); + float f1 = 1.0F - (MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.25F); + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); +@@ -1497,7 +1600,15 @@ + entity.addEntityCrashInfo(crashreportcategory); + } + +- throw new ReportedException(crashreport); ++ if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities) ++ { ++ net.minecraftforge.fml.common.FMLLog.severe(crashreport.getCompleteReport()); ++ removeEntity(entity); ++ } ++ else ++ { ++ throw new ReportedException(crashreport); ++ } + } + + if (entity.isDead) +@@ -1557,7 +1668,15 @@ + CrashReport crashreport1 = CrashReport.makeCrashReport(throwable1, "Ticking entity"); + CrashReportCategory crashreportcategory2 = crashreport1.makeCategory("Entity being ticked"); + entity2.addEntityCrashInfo(crashreportcategory2); +- throw new ReportedException(crashreport1); ++ if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities) ++ { ++ net.minecraftforge.fml.common.FMLLog.severe(crashreport1.getCompleteReport()); ++ removeEntity(entity2); ++ } ++ else ++ { ++ throw new ReportedException(crashreport1); ++ } + } + } + +@@ -1604,7 +1723,16 @@ + CrashReport crashreport2 = CrashReport.makeCrashReport(throwable, "Ticking block entity"); + CrashReportCategory crashreportcategory1 = crashreport2.makeCategory("Block entity being ticked"); + tileentity.addInfoToCrashReport(crashreportcategory1); +- throw new ReportedException(crashreport2); ++ if (net.minecraftforge.common.ForgeModContainer.removeErroringTileEntities) ++ { ++ net.minecraftforge.fml.common.FMLLog.severe(crashreport2.getCompleteReport()); ++ tileentity.invalidate(); ++ this.removeTileEntity(tileentity.getPos()); ++ } ++ else ++ { ++ throw new ReportedException(crashreport2); ++ } + } + } + } +@@ -1621,15 +1749,20 @@ + } + } + +- this.processingLoadedTiles = false; +- + if (!this.tileEntitiesToBeRemoved.isEmpty()) + { ++ for (Object tile : tileEntitiesToBeRemoved) ++ { ++ ((TileEntity)tile).onChunkUnload(); ++ } ++ + this.tickableTileEntities.removeAll(this.tileEntitiesToBeRemoved); + this.loadedTileEntityList.removeAll(this.tileEntitiesToBeRemoved); + this.tileEntitiesToBeRemoved.clear(); + } + ++ this.processingLoadedTiles = false; //FML Move below remove to prevent CMEs ++ + this.theProfiler.endStartSection("pendingBlockEntities"); + + if (!this.addedTileEntityList.isEmpty()) +@@ -1663,7 +1796,8 @@ + + public boolean addTileEntity(TileEntity tile) + { +- boolean flag = this.loadedTileEntityList.add(tile); ++ List dest = processingLoadedTiles ? addedTileEntityList : loadedTileEntityList; ++ boolean flag = dest.add(tile); + + if (flag && tile instanceof ITickable) + { +@@ -1702,9 +1836,13 @@ + { + int i = MathHelper.floor_double(p_72866_1_.posX); + int j = MathHelper.floor_double(p_72866_1_.posZ); +- int k = 32; ++ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(i >> 4, j >> 4)); ++ int k = isForced ? 0 : 32; ++ boolean canUpdate = !p_72866_2_ || this.isAreaLoaded(i - k, 0, j - k, i + k, 0, j + k, true); + +- if (!p_72866_2_ || this.isAreaLoaded(i - k, 0, j - k, i + k, 0, j + k, true)) ++ if (!canUpdate) canUpdate = net.minecraftforge.event.ForgeEventFactory.canEntityUpdate(p_72866_1_); ++ ++ if (canUpdate) + { + p_72866_1_.lastTickPosX = p_72866_1_.posX; + p_72866_1_.lastTickPosY = p_72866_1_.posY; +@@ -1832,7 +1970,7 @@ + { + Block block = this.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, l1, i2)).getBlock(); + +- if (block.getMaterial() != Material.air) ++ if (!block.isAir(this, new BlockPos(k1, l1, i2))) + { + return true; + } +@@ -1897,6 +2035,10 @@ + { + return true; + } ++ else if (block.isBurning(this, new BlockPos(k1, l1, i2))) ++ { ++ return true; ++ } + } + } + } +@@ -2037,6 +2179,7 @@ + public Explosion newExplosion(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) + { + Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_); ++ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; + explosion.doExplosionA(); + explosion.doExplosionB(true); + return explosion; +@@ -2183,19 +2326,27 @@ + else + { + this.addTileEntity(tileEntityIn); +- this.getChunkFromBlockCoords(pos).addTileEntity(pos, tileEntityIn); ++ Chunk chunk = this.getChunkFromBlockCoords(pos); //Forge add NPE protection ++ if (chunk != null) chunk.addTileEntity(pos, tileEntityIn); + } ++ this.updateComparatorOutputLevel(pos, getBlockState(pos).getBlock()); //Notify neighbors of changes + } + } + + public void removeTileEntity(BlockPos pos) + { ++ //Chunk chunk = this.getChunkFromBlockCoords(pos); ++ //if (chunk != null) chunk.removeTileEntity(pos); ++ //Forge ToDO: Are these patches needed anymore? ++ + TileEntity tileentity = this.getTileEntity(pos); + + if (tileentity != null && this.processingLoadedTiles) + { + tileentity.invalidate(); + this.addedTileEntityList.remove(tileentity); ++ if (!(tileentity instanceof ITickable)) //Forge: If they are not tickable they wont be removed in the update loop. ++ this.loadedTileEntityList.remove(tileentity); + } + else + { +@@ -2208,6 +2359,7 @@ + + this.getChunkFromBlockCoords(pos).removeTileEntity(pos); + } ++ this.updateComparatorOutputLevel(pos, getBlockState(pos).getBlock()); //Notify neighbors of changes + } + + public void markTileEntityForRemoval(TileEntity tileEntityIn) +@@ -2226,7 +2378,7 @@ + { + IBlockState iblockstate = p_175683_0_.getBlockState(p_175683_1_); + Block block = iblockstate.getBlock(); +- return block.getMaterial().isOpaque() && block.isFullCube() ? true : (block instanceof BlockStairs ? iblockstate.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP : (block instanceof BlockSlab ? iblockstate.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? ((Integer)iblockstate.getValue(BlockSnow.LAYERS)).intValue() == 7 : false)))); ++ return block.isSideSolid(p_175683_0_, p_175683_1_, EnumFacing.UP); + } + + public boolean isBlockNormalCube(BlockPos p_175677_1_, boolean p_175677_2_) +@@ -2246,7 +2398,7 @@ + else + { + Block block = this.getBlockState(p_175677_1_).getBlock(); +- return block.getMaterial().isOpaque() && block.isFullCube(); ++ return block.isNormalCube(this, p_175677_1_); + } + } + } +@@ -2265,6 +2417,7 @@ + { + this.spawnHostileMobs = hostile; + this.spawnPeacefulMobs = peaceful; ++ this.provider.setAllowedSpawnTypes(hostile, peaceful); + } + + public void tick() +@@ -2274,6 +2427,11 @@ + + protected void calculateInitialWeather() + { ++ this.provider.calculateInitialWeather(); ++ } ++ ++ public void calculateInitialWeatherBody() ++ { + if (this.worldInfo.isRaining()) + { + this.rainingStrength = 1.0F; +@@ -2287,6 +2445,11 @@ + + protected void updateWeather() + { ++ this.provider.updateWeather(); ++ } ++ ++ public void updateWeatherBody() ++ { + if (!this.provider.getHasNoSky()) + { + if (!this.isRemote) +@@ -2381,6 +2544,7 @@ + { + this.activeChunkSet.clear(); + this.theProfiler.startSection("buildList"); ++ this.activeChunkSet.addAll(getPersistentChunks().keySet()); + + for (int i = 0; i < this.playerEntities.size(); ++i) + { +@@ -2438,7 +2602,7 @@ + j = j + p_147467_1_; + k = k + p_147467_2_; + +- if (block.getMaterial() == Material.air && this.getLight(blockpos) <= this.rand.nextInt(8) && this.getLightFor(EnumSkyBlock.SKY, blockpos) <= 0) ++ if (block.isAir(this, blockpos) && this.getLight(blockpos) <= this.rand.nextInt(8) && this.getLightFor(EnumSkyBlock.SKY, blockpos) <= 0) + { + EntityPlayer entityplayer = this.getClosestPlayer((double)j + 0.5D, (double)l + 0.5D, (double)k + 0.5D, 8.0D); + +@@ -2478,6 +2642,11 @@ + + public boolean canBlockFreeze(BlockPos pos, boolean noWaterAdj) + { ++ return this.provider.canBlockFreeze(pos, noWaterAdj); ++ } ++ ++ public boolean canBlockFreezeBody(BlockPos pos, boolean noWaterAdj) ++ { + BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); + float f = biomegenbase.getFloatTemperature(pos); + +@@ -2519,6 +2688,11 @@ + + public boolean canSnowAt(BlockPos pos, boolean checkLight) + { ++ return this.provider.canSnowAt(pos, checkLight); ++ } ++ ++ public boolean canSnowAtBody(BlockPos pos, boolean checkLight) ++ { + BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); + float f = biomegenbase.getFloatTemperature(pos); + +@@ -2536,7 +2710,7 @@ + { + Block block = this.getBlockState(pos).getBlock(); + +- if (block.getMaterial() == Material.air && Blocks.snow_layer.canPlaceBlockAt(this, pos)) ++ if (block.isAir(this, pos) && Blocks.snow_layer.canPlaceBlockAt(this, pos)) + { + return true; + } +@@ -2568,10 +2742,11 @@ + else + { + Block block = this.getBlockState(pos).getBlock(); +- int i = lightType == EnumSkyBlock.SKY ? 0 : block.getLightValue(); +- int j = block.getLightOpacity(); ++ int blockLight = block.getLightValue(this, pos); ++ int i = lightType == EnumSkyBlock.SKY ? 0 : blockLight; ++ int j = block.getLightOpacity(this, pos); + +- if (j >= 15 && block.getLightValue() > 0) ++ if (j >= 15 && blockLight > 0) + { + j = 1; + } +@@ -2771,10 +2946,10 @@ + public List func_175674_a(Entity entityIn, AxisAlignedBB p_175674_2_, Predicate p_175674_3_) + { + List list = Lists.newArrayList(); +- int i = MathHelper.floor_double((p_175674_2_.minX - 2.0D) / 16.0D); +- int j = MathHelper.floor_double((p_175674_2_.maxX + 2.0D) / 16.0D); +- int k = MathHelper.floor_double((p_175674_2_.minZ - 2.0D) / 16.0D); +- int l = MathHelper.floor_double((p_175674_2_.maxZ + 2.0D) / 16.0D); ++ int i = MathHelper.floor_double((p_175674_2_.minX - MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.floor_double((p_175674_2_.maxX + MAX_ENTITY_RADIUS) / 16.0D); ++ int k = MathHelper.floor_double((p_175674_2_.minZ - MAX_ENTITY_RADIUS) / 16.0D); ++ int l = MathHelper.floor_double((p_175674_2_.maxZ + MAX_ENTITY_RADIUS) / 16.0D); + + for (int i1 = i; i1 <= j; ++i1) + { +@@ -2827,10 +3002,10 @@ + + public List getEntitiesWithinAABB(Class clazz, AxisAlignedBB aabb, Predicate filter) + { +- int i = MathHelper.floor_double((aabb.minX - 2.0D) / 16.0D); +- int j = MathHelper.floor_double((aabb.maxX + 2.0D) / 16.0D); +- int k = MathHelper.floor_double((aabb.minZ - 2.0D) / 16.0D); +- int l = MathHelper.floor_double((aabb.maxZ + 2.0D) / 16.0D); ++ int i = MathHelper.floor_double((aabb.minX - MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.floor_double((aabb.maxX + MAX_ENTITY_RADIUS) / 16.0D); ++ int k = MathHelper.floor_double((aabb.minZ - MAX_ENTITY_RADIUS) / 16.0D); ++ int l = MathHelper.floor_double((aabb.maxZ + MAX_ENTITY_RADIUS) / 16.0D); + List list = Lists.newArrayList(); + + for (int i1 = i; i1 <= j; ++i1) +@@ -2908,11 +3083,13 @@ + + public void loadEntities(Collection entityCollection) + { +- this.loadedEntityList.addAll(entityCollection); +- + for (Entity entity : entityCollection) + { +- this.onEntityAdded(entity); ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entity, this))) ++ { ++ loadedEntityList.add(entity); ++ this.onEntityAdded(entity); ++ } + } + } + +@@ -2925,7 +3102,9 @@ + { + Block block = this.getBlockState(p_175716_2_).getBlock(); + AxisAlignedBB axisalignedbb = p_175716_3_ ? null : p_175716_1_.getCollisionBoundingBox(this, p_175716_2_, p_175716_1_.getDefaultState()); +- return axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, p_175716_5_) ? false : (block.getMaterial() == Material.circuits && p_175716_1_ == Blocks.anvil ? true : block.getMaterial().isReplaceable() && p_175716_1_.canReplace(this, p_175716_2_, p_175716_4_, p_175716_6_)); ++ if (axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, p_175716_5_)) return false; ++ if (block.getMaterial() == Material.circuits && p_175716_1_ == Blocks.anvil) return true; ++ return block.isReplaceable(this, p_175716_2_) && p_175716_1_.canReplace(this, p_175716_2_, p_175716_4_, p_175716_6_); + } + + public int func_181545_F() +@@ -3010,7 +3189,7 @@ + { + IBlockState iblockstate = this.getBlockState(pos); + Block block = iblockstate.getBlock(); +- return block.isNormalCube() ? this.getStrongPower(pos) : block.isProvidingWeakPower(this, pos, iblockstate, facing); ++ return block.shouldCheckWeakPower(this, pos, facing) ? this.getStrongPower(pos) : block.isProvidingWeakPower(this, pos, iblockstate, facing); + } + + public boolean isBlockPowered(BlockPos pos) +@@ -3137,7 +3316,7 @@ + + public long getSeed() + { +- return this.worldInfo.getSeed(); ++ return this.provider.getSeed(); + } + + public long getTotalWorldTime() +@@ -3147,17 +3326,17 @@ + + public long getWorldTime() + { +- return this.worldInfo.getWorldTime(); ++ return this.provider.getWorldTime(); + } + + public void setWorldTime(long time) + { +- this.worldInfo.setWorldTime(time); ++ this.provider.setWorldTime(time); + } + + public BlockPos getSpawnPoint() + { +- BlockPos blockpos = new BlockPos(this.worldInfo.getSpawnX(), this.worldInfo.getSpawnY(), this.worldInfo.getSpawnZ()); ++ BlockPos blockpos = this.provider.getSpawnPoint(); + + if (!this.getWorldBorder().contains(blockpos)) + { +@@ -3169,7 +3348,7 @@ + + public void setSpawnPoint(BlockPos pos) + { +- this.worldInfo.setSpawn(pos); ++ this.provider.setSpawnPoint(pos); + } + + @SideOnly(Side.CLIENT) +@@ -3189,12 +3368,18 @@ + + if (!this.loadedEntityList.contains(entityIn)) + { ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entityIn, this))) + this.loadedEntityList.add(entityIn); + } + } + + public boolean isBlockModifiable(EntityPlayer player, BlockPos pos) + { ++ return this.provider.canMineBlock(player, pos); ++ } ++ ++ public boolean canMineBlockBody(EntityPlayer player, BlockPos pos) ++ { + return true; + } + +@@ -3288,8 +3473,7 @@ + + public boolean isBlockinHighHumidity(BlockPos pos) + { +- BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); +- return biomegenbase.isHighHumidity(); ++ return this.provider.isBlockHighHumidity(pos); + } + + public MapStorage getMapStorage() +@@ -3348,12 +3532,12 @@ + + public int getHeight() + { +- return 256; ++ return this.provider.getHeight(); + } + + public int getActualHeight() + { +- return this.provider.getHasNoSky() ? 128 : 256; ++ return this.provider.getActualHeight(); + } + + public Random setRandomSeed(int p_72843_1_, int p_72843_2_, int p_72843_3_) +@@ -3410,7 +3594,7 @@ + @SideOnly(Side.CLIENT) + public double getHorizon() + { +- return this.worldInfo.getTerrainType() == WorldType.FLAT ? 0.0D : 63.0D; ++ return provider.getHorizon(); + } + + public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress) +@@ -3452,18 +3636,14 @@ + { + IBlockState iblockstate = this.getBlockState(blockpos); + +- if (Blocks.unpowered_comparator.isAssociated(iblockstate.getBlock())) ++ iblockstate.getBlock().onNeighborChange(this, blockpos, pos); ++ if (iblockstate.getBlock().isNormalCube(this, blockpos)) + { +- iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn); +- } +- else if (iblockstate.getBlock().isNormalCube()) +- { +- blockpos = blockpos.offset(enumfacing); +- iblockstate = this.getBlockState(blockpos); +- +- if (Blocks.unpowered_comparator.isAssociated(iblockstate.getBlock())) ++ BlockPos posOther = blockpos.offset(enumfacing); ++ Block other = getBlockState(posOther).getBlock(); ++ if (other.getWeakChanges(this, posOther)) + { +- iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn); ++ other.onNeighborChange(this, posOther, pos); + } + } + } +@@ -3533,4 +3713,81 @@ + int k = 128; + return i >= -k && i <= k && j >= -k && j <= k; + } ++ ++ /* ======================================== FORGE START =====================================*/ ++ /** ++ * Determine if the given block is considered solid on the ++ * specified side. Used by placement logic. ++ * ++ * @param pos Block Position ++ * @param side The Side in question ++ * @return True if the side is solid ++ */ ++ public boolean isSideSolid(BlockPos pos, EnumFacing side) ++ { ++ return isSideSolid(pos, side, false); ++ } ++ ++ /** ++ * Determine if the given block is considered solid on the ++ * specified side. Used by placement logic. ++ * ++ * @param pos Block Position ++ * @param side The Side in question ++ * @param _default The default to return if the block doesn't exist. ++ * @return True if the side is solid ++ */ ++ @Override ++ public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) ++ { ++ if (!this.isValid(pos)) return _default; ++ ++ Chunk chunk = getChunkFromBlockCoords(pos); ++ if (chunk == null || chunk.isEmpty()) return _default; ++ return getBlockState(pos).getBlock().isSideSolid(this, pos, side); ++ } ++ ++ /** ++ * Get the persistent chunks for this world ++ * ++ * @return ++ */ ++ public com.google.common.collect.ImmutableSetMultimap getPersistentChunks() ++ { ++ return net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this); ++ } ++ ++ /** ++ * Readded as it was removed, very useful helper function ++ * ++ * @param pos Block position ++ * @return The blocks light opacity ++ */ ++ public int getBlockLightOpacity(BlockPos pos) ++ { ++ if (!this.isValid(pos)) return 0; ++ return getChunkFromBlockCoords(pos).getBlockLightOpacity(pos); ++ } ++ ++ /** ++ * Returns a count of entities that classify themselves as the specified creature type. ++ */ ++ public int countEntities(net.minecraft.entity.EnumCreatureType type, boolean forSpawnCount) ++ { ++ int count = 0; ++ for (int x = 0; x < loadedEntityList.size(); x++) ++ { ++ if (((Entity)loadedEntityList.get(x)).isCreatureType(type, forSpawnCount)) ++ { ++ count++; ++ } ++ } ++ return count; ++ } ++ ++ protected MapStorage perWorldStorage; //Moved to a getter to simulate final without being final so we can load in subclasses. ++ public MapStorage getPerWorldStorage() ++ { ++ return perWorldStorage; ++ } + } diff --git a/rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej b/rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej index 6fffb6baf..fe21c355f 100644 --- a/rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej +++ b/rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej @@ -1,61 +1,4 @@ -++++ REJECTED PATCH 2 - { - worldinfo.setWorldName(p_71247_2_); - } -+ WorldServer overWorld = (isDemo() ? (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init() : -+ (WorldServer)(new WorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init()); -+ overWorld.initialize(this.theWorldSettings); - -- for (int j = 0; j < this.worldServers.length; ++j) -+ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) - { -- byte b0 = 0; - -- if (j == 1) -+ WorldServer world = (dim == 0 ? overWorld : (WorldServer)(new WorldServerMulti(this, isavehandler, dim, overWorld, this.theProfiler)).init()); -+ world.addWorldAccess(new WorldManager(this, world)); -+ if (!this.isSinglePlayer()) - { -- b0 = -1; -+ world.getWorldInfo().setGameType(getGameType()); - } -- -- if (j == 2) -- { -- b0 = 1; -- } -- -- if (j == 0) -- { -- if (this.isDemo()) -- { -- this.worldServers[j] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, b0, this.theProfiler)).init(); -- } -- else -- { -- this.worldServers[j] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, b0, this.theProfiler)).init(); -- } -- -- this.worldServers[j].initialize(this.theWorldSettings); -- } -- else -- { -- this.worldServers[j] = (WorldServer)(new WorldServerMulti(this, isavehandler, b0, this.worldServers[0], this.theProfiler)).init(); -- } -- -- this.worldServers[j].addWorldAccess(new WorldManager(this, this.worldServers[j])); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); - } - -- this.getConfigurationManager().setPlayerManager(this.worldServers); -+ this.getConfigurationManager().setPlayerManager(new WorldServer[]{ overWorld }); - -- if (this.worldServers[0].getWorldInfo().getDifficulty() == null) -+ if (overWorld.getWorldInfo().getDifficulty() == null) - { - this.setDifficultyForAllWorlds(this.mc.gameSettings.difficulty); - } -++++ END PATCH +// This in now a method in Util, which does almost the same, do we need this still? ++++ REJECTED PATCH 4 { try diff --git a/rejects/minecraft/net/minecraft/util/EnumChatFormatting.java.patch.rej b/rejects/minecraft/net/minecraft/util/EnumChatFormatting.java.patch.rej deleted file mode 100644 index 3a2334006..000000000 --- a/rejects/minecraft/net/minecraft/util/EnumChatFormatting.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 1 - return this.controlString; - } - -- @SideOnly(Side.CLIENT) - public static String getTextWithoutFormattingCodes(String text) - { - return text == null ? null : formattingCodePattern.matcher(text).replaceAll(""); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/EnumFacing.java.patch.rej b/rejects/minecraft/net/minecraft/util/EnumFacing.java.patch.rej deleted file mode 100644 index 81b2d786d..000000000 --- a/rejects/minecraft/net/minecraft/util/EnumFacing.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 9 - } - } - -- public static enum Plane implements Predicate, Iterable { -+ public static enum Plane implements Predicate, Iterable { //Forge re-add generic because it just makes life easier. - HORIZONTAL, - VERTICAL; - -++++ END PATCH From df05edaa11717f443e6d68c905fd102d380e1c61 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 10 Nov 2015 20:09:49 +0300 Subject: [PATCH 010/133] WorldProvider, WorldType, WorldServer, WorldServerMulti --- .../minecraft/world/WorldProvider.java.patch | 16 ++ .../minecraft/world/WorldServer.java.patch | 104 ++++++++++-- .../world/WorldServerMulti.java.patch | 32 +++- .../net/minecraft/world/WorldType.java.patch | 155 ++++++++++++++++++ .../world/WorldProvider.java.patch.rej | 17 -- .../world/WorldServer.java.patch.rej | 90 ---------- .../world/WorldServerMulti.java.patch.rej | 32 ---- 7 files changed, 296 insertions(+), 150 deletions(-) create mode 100644 patches/minecraft/net/minecraft/world/WorldType.java.patch delete mode 100644 rejects/minecraft/net/minecraft/world/WorldProvider.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/WorldServer.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/WorldServerMulti.java.patch.rej diff --git a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch index 5b12536d9..cae3f92a9 100644 --- a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch @@ -44,6 +44,22 @@ + return this.terrainType.getCloudHeight(); } + @SideOnly(Side.CLIENT) +@@ -176,13 +162,13 @@ + + public int getAverageGroundLevel() + { +- return this.terrainType == WorldType.FLAT ? 4 : this.worldObj.func_181545_F() + 1; ++ return this.terrainType.getMinimumSpawnHeight(this.worldObj); + } + + @SideOnly(Side.CLIENT) + public double getVoidFogYFactor() + { +- return this.terrainType == WorldType.FLAT ? 1.0D : 0.03125D; ++ return this.terrainType.voidFadeMagnitude(); + } + @SideOnly(Side.CLIENT) @@ -224,4 +210,319 @@ { diff --git a/patches/minecraft/net/minecraft/world/WorldServer.java.patch b/patches/minecraft/net/minecraft/world/WorldServer.java.patch index b78fe34d8..25fb5d87c 100644 --- a/patches/minecraft/net/minecraft/world/WorldServer.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldServer.java.patch @@ -60,7 +60,15 @@ this.theProfiler.endSection(); this.sendQueuedBlockEvents(); } -@@ -269,10 +289,7 @@ +@@ -218,6 +238,7 @@ + public BiomeGenBase.SpawnListEntry func_175734_a(EnumCreatureType p_175734_1_, BlockPos p_175734_2_) + { + List list = this.getChunkProvider().func_177458_a(p_175734_1_, p_175734_2_); ++ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(this, p_175734_1_, p_175734_2_, list); + return list != null && !list.isEmpty() ? (BiomeGenBase.SpawnListEntry)WeightedRandom.getRandomItem(this.rand, list) : null; + } + +@@ -269,10 +290,7 @@ private void resetRainAndThunder() { @@ -72,7 +80,7 @@ } public boolean areAllPlayersAsleep() -@@ -350,7 +367,7 @@ +@@ -350,7 +368,7 @@ chunk.func_150804_b(false); this.theProfiler.endStartSection("thunder"); @@ -81,7 +89,7 @@ { this.updateLCG = this.updateLCG * 3 + 1013904223; int i1 = this.updateLCG >> 2; -@@ -364,7 +381,7 @@ +@@ -364,7 +382,7 @@ this.theProfiler.endStartSection("iceandsnow"); @@ -90,7 +98,17 @@ { this.updateLCG = this.updateLCG * 3 + 1013904223; int k2 = this.updateLCG >> 2; -@@ -510,7 +527,7 @@ +@@ -458,6 +476,9 @@ + if (p_175654_2_.requiresUpdates()) + { + i = 8; ++ //Keeping here as a note for future when it may be restored. ++ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.position.getX() >> 4, nextticklistentry.position.getZ() >> 4)); ++ i = isForced ? 0 : 8; + + if (this.isAreaLoaded(nextticklistentry.position.add(-i, -i, -i), nextticklistentry.position.add(i, i, i))) + { +@@ -510,7 +531,7 @@ public void updateEntities() { @@ -99,7 +117,53 @@ { if (this.updateEntityTick++ >= 1200) { -@@ -714,6 +731,10 @@ +@@ -575,6 +596,9 @@ + { + NextTickListEntry nextticklistentry1 = (NextTickListEntry)iterator.next(); + iterator.remove(); ++ //Keeping here as a note for future when it may be restored. ++ //boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.xCoord >> 4, nextticklistentry.zCoord >> 4)); ++ //byte b0 = isForced ? 0 : 8; + int k = 0; + + if (this.isAreaLoaded(nextticklistentry1.position.add(-k, -k, -k), nextticklistentry1.position.add(k, k, k))) +@@ -698,22 +722,39 @@ + { + List list = Lists.newArrayList(); + +- for (int i = 0; i < this.loadedTileEntityList.size(); ++i) ++ //Forge: Optomize this loop to only grab from the chunks it needs ++ for (int x = (p_147486_1_ >> 4); x <= (p_147486_4_ >> 4); x++) + { +- TileEntity tileentity = (TileEntity)this.loadedTileEntityList.get(i); +- BlockPos blockpos = tileentity.getPos(); +- +- if (blockpos.getX() >= p_147486_1_ && blockpos.getY() >= p_147486_2_ && blockpos.getZ() >= p_147486_3_ && blockpos.getX() < p_147486_4_ && blockpos.getY() < p_147486_5_ && blockpos.getZ() < p_147486_6_) ++ for (int z = (p_147486_3_ >> 4); z <= (p_147486_6_ >> 4); z++) + { +- list.add(tileentity); ++ Chunk chunk = this.getChunkFromChunkCoords(x, z); ++ if (chunk != null) ++ { ++ for (TileEntity entity : chunk.getTileEntityMap().values()) ++ { ++ if (!entity.isInvalid()) ++ { ++ BlockPos pos = entity.getPos(); ++ if (pos.getX() >= p_147486_1_ && pos.getY() >= p_147486_2_ && pos.getZ() >= p_147486_3_ && ++ pos.getX() <= p_147486_4_ && pos.getY() <= p_147486_5_ && pos.getZ() <= p_147486_6_) ++ { ++ list.add(entity); ++ } ++ ++ } ++ } ++ } + } + } +- + return list; + } public boolean isBlockModifiable(EntityPlayer player, BlockPos pos) { @@ -110,7 +174,7 @@ return !this.mcServer.isBlockProtected(this, pos, player) && this.getWorldBorder().contains(pos); } -@@ -779,6 +800,7 @@ +@@ -779,6 +820,7 @@ } else { @@ -118,7 +182,7 @@ this.findingSpawnPoint = true; WorldChunkManager worldchunkmanager = this.provider.getWorldChunkManager(); List list = worldchunkmanager.getBiomesToSpawnIn(); -@@ -824,7 +846,7 @@ +@@ -824,7 +866,7 @@ protected void createBonusChest() { @@ -127,7 +191,15 @@ for (int i = 0; i < 10; ++i) { -@@ -894,6 +916,7 @@ +@@ -861,6 +903,7 @@ + } + + this.chunkProvider.saveChunks(p_73044_1_, p_73044_2_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this)); + + for (Chunk chunk : Lists.newArrayList(this.theChunkProviderServer.func_152380_a())) + { +@@ -894,6 +937,7 @@ this.worldInfo.setBorderLerpTime(this.getWorldBorder().getTimeUntilTarget()); this.saveHandler.saveWorldInfoWithPlayer(this.worldInfo, this.mcServer.getConfigurationManager().getHostPlayerData()); this.mapStorage.saveAllData(); @@ -135,7 +207,7 @@ } public void onEntityAdded(Entity p_72923_1_) -@@ -949,6 +972,7 @@ +@@ -949,6 +993,7 @@ public Explosion newExplosion(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) { Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_); @@ -143,7 +215,7 @@ explosion.doExplosionA(); explosion.doExplosionB(false); -@@ -1028,19 +1052,23 @@ +@@ -1028,19 +1073,23 @@ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.getDimensionId()); } @@ -171,3 +243,15 @@ } } +@@ -1106,6 +1155,11 @@ + return this.mcServer.isCallingFromMinecraftThread(); + } + ++ public java.io.File getChunkSaveLocation() ++ { ++ return ((net.minecraft.world.chunk.storage.AnvilChunkLoader)theChunkProviderServer.chunkLoader).chunkSaveLocation; ++ } ++ + static class ServerBlockEventList extends ArrayList + { + private static final String __OBFID = "CL_00001439"; diff --git a/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch b/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch index 7bc173344..ee4637dac 100644 --- a/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch @@ -16,7 +16,37 @@ { private static final String __OBFID = "CL_00002273"; public void onSizeChanged(WorldBorder border, double newSize) -@@ -75,4 +76,12 @@ +@@ -48,11 +49,13 @@ + { + WorldServerMulti.this.getWorldBorder().setDamageBuffer(newSize); + } +- }); ++ }; ++ this.delegate.getWorldBorder().addListener(this.borderListener); + } + + protected void saveLevel() throws MinecraftException + { ++ this.perWorldStorage.saveAllData(); + } + + public World init() +@@ -60,12 +63,12 @@ + this.mapStorage = this.delegate.getMapStorage(); + this.worldScoreboard = this.delegate.getScoreboard(); + String s = VillageCollection.fileNameForProvider(this.provider); +- VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s); ++ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.loadData(VillageCollection.class, s); + + if (villagecollection == null) + { + this.villageCollectionObj = new VillageCollection(this); +- this.mapStorage.setData(s, this.villageCollectionObj); ++ this.perWorldStorage.setData(s, this.villageCollectionObj); + } + else + { +@@ -75,4 +78,12 @@ return this; } diff --git a/patches/minecraft/net/minecraft/world/WorldType.java.patch b/patches/minecraft/net/minecraft/world/WorldType.java.patch new file mode 100644 index 000000000..9ab71dae1 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/WorldType.java.patch @@ -0,0 +1,155 @@ +--- ../src-base/minecraft/net/minecraft/world/WorldType.java ++++ ../src-work/minecraft/net/minecraft/world/WorldType.java +@@ -28,6 +28,7 @@ + + private WorldType(int id, String name, int version) + { ++ if (name.length() > 16 && DEBUG_WORLD != null) throw new IllegalArgumentException("World type names must not be longer then 16: " + name); + this.worldType = name; + this.generatorVersion = version; + this.canBeCreated = true; +@@ -114,4 +115,144 @@ + this.hasNotificationData = true; + return this; + } ++ ++ public net.minecraft.world.biome.WorldChunkManager getChunkManager(World world) ++ { ++ if (this == FLAT) ++ { ++ net.minecraft.world.gen.FlatGeneratorInfo flatgeneratorinfo = net.minecraft.world.gen.FlatGeneratorInfo.createFlatGeneratorFromString(world.getWorldInfo().getGeneratorOptions()); ++ return new net.minecraft.world.biome.WorldChunkManagerHell(net.minecraft.world.biome.BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), net.minecraft.world.biome.BiomeGenBase.field_180279_ad), 0.5F); ++ } ++ else if (this == DEBUG_WORLD) ++ { ++ return new net.minecraft.world.biome.WorldChunkManagerHell(net.minecraft.world.biome.BiomeGenBase.plains, 0.0F); ++ } ++ else ++ { ++ return new net.minecraft.world.biome.WorldChunkManager(world); ++ } ++ } ++ ++ public net.minecraft.world.chunk.IChunkProvider getChunkGenerator(World world, String generatorOptions) ++ { ++ if (this == FLAT) return new net.minecraft.world.gen.ChunkProviderFlat(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions); ++ if (this == DEBUG_WORLD) return new net.minecraft.world.gen.ChunkProviderDebug(world); ++ return new net.minecraft.world.gen.ChunkProviderGenerate(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions); ++ } ++ ++ public int getMinimumSpawnHeight(World world) ++ { ++ return this == FLAT ? 4 : 64; ++ } ++ ++ public double getHorizon(World world) ++ { ++ return this == FLAT ? 0.0D : 63.0D; ++ } ++ ++ public double voidFadeMagnitude() ++ { ++ return this == FLAT ? 1.0D : 0.03125D; ++ } ++ ++ public boolean handleSlimeSpawnReduction(java.util.Random random, World world) ++ { ++ return this == FLAT ? random.nextInt(4) != 1 : false; ++ } ++ ++ /*=================================================== FORGE START ======================================*/ ++ private static int getNextID() ++ { ++ for (int x = 0; x < worldTypes.length; x++) ++ { ++ if (worldTypes[x] == null) ++ { ++ return x; ++ } ++ } ++ ++ int oldLen = worldTypes.length; ++ worldTypes = java.util.Arrays.copyOf(worldTypes, oldLen + 16); ++ return oldLen; ++ } ++ ++ /** ++ * Creates a new world type, the ID is hidden and should not be referenced by modders. ++ * It will automatically expand the underlying workdType array if there are no IDs left. ++ * @param name ++ */ ++ public WorldType(String name) ++ { ++ this(getNextID(), name); ++ } ++ ++ /** ++ * Called when 'Create New World' button is pressed before starting game ++ */ ++ public void onGUICreateWorldPress() { } ++ ++ /** ++ * Gets the spawn fuzz for players who join the world. ++ * Useful for void world types. ++ * @return Fuzz for entity initial spawn in blocks. ++ */ ++ public int getSpawnFuzz() ++ { ++ return Math.max(5, net.minecraft.server.MinecraftServer.getServer().getSpawnProtectionSize() - 6); ++ } ++ ++ /** ++ * Called when the 'Customize' button is pressed on world creation GUI ++ * @param mc The Minecraft instance ++ * @param guiCreateWorld the createworld GUI ++ */ ++ @SideOnly(Side.CLIENT) ++ public void onCustomizeButton(net.minecraft.client.Minecraft mc, net.minecraft.client.gui.GuiCreateWorld guiCreateWorld) ++ { ++ if (this == WorldType.FLAT) ++ { ++ mc.displayGuiScreen(new net.minecraft.client.gui.GuiCreateFlatWorld(guiCreateWorld, guiCreateWorld.chunkProviderSettingsJson)); ++ } ++ else if (this == WorldType.CUSTOMIZED) ++ { ++ mc.displayGuiScreen(new net.minecraft.client.gui.GuiCustomizeWorldScreen(guiCreateWorld, guiCreateWorld.chunkProviderSettingsJson)); ++ } ++ } ++ ++ /** ++ * Should world creation GUI show 'Customize' button for this world type? ++ * @return if this world type has customization parameters ++ */ ++ public boolean isCustomizable() ++ { ++ return this == FLAT || this == WorldType.CUSTOMIZED; ++ } ++ ++ ++ /** ++ * Get the height to render the clouds for this world type ++ * @return The height to render clouds at ++ */ ++ public float getCloudHeight() ++ { ++ return 128.0F; ++ } ++ ++ /** ++ * Creates the GenLayerBiome used for generating the world with the specified ChunkProviderSettings JSON String ++ * *IF AND ONLY IF* this WorldType == WorldType.CUSTOMIZED. ++ * ++ * ++ * @param worldSeed The world seed ++ * @param parentLayer The parent layer to feed into any layer you return ++ * @param chunkProviderSettingsJson The JSON string to use when initializing ChunkProviderSettings.Factory ++ * @return A GenLayer that will return ints representing the Biomes to be generated, see GenLayerBiome ++ */ ++ public net.minecraft.world.gen.layer.GenLayer getBiomeLayer(long worldSeed, net.minecraft.world.gen.layer.GenLayer parentLayer, String chunkProviderSettingsJson) ++ { ++ net.minecraft.world.gen.layer.GenLayer ret = new net.minecraft.world.gen.layer.GenLayerBiome(200L, parentLayer, this, chunkProviderSettingsJson); ++ ret = net.minecraft.world.gen.layer.GenLayerZoom.magnify(1000L, ret, 2); ++ ret = new net.minecraft.world.gen.layer.GenLayerBiomeEdge(1000L, ret); ++ return ret; ++ } + } diff --git a/rejects/minecraft/net/minecraft/world/WorldProvider.java.patch.rej b/rejects/minecraft/net/minecraft/world/WorldProvider.java.patch.rej deleted file mode 100644 index 909aac637..000000000 --- a/rejects/minecraft/net/minecraft/world/WorldProvider.java.patch.rej +++ /dev/null @@ -1,17 +0,0 @@ -++++ REJECTED PATCH 3 - - public int getAverageGroundLevel() - { -- return this.terrainType == WorldType.FLAT ? 4 : 64; -+ return this.terrainType.getMinimumSpawnHeight(this.worldObj); - } - - @SideOnly(Side.CLIENT) - public double getVoidFogYFactor() - { -- return this.terrainType == WorldType.FLAT ? 1.0D : 0.03125D; -+ return this.terrainType.voidFadeMagnitude(); - } - - @SideOnly(Side.CLIENT) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/WorldServer.java.patch.rej b/rejects/minecraft/net/minecraft/world/WorldServer.java.patch.rej deleted file mode 100644 index e14cede12..000000000 --- a/rejects/minecraft/net/minecraft/world/WorldServer.java.patch.rej +++ /dev/null @@ -1,90 +0,0 @@ -++++ REJECTED PATCH 3 - public BiomeGenBase.SpawnListEntry func_175734_a(EnumCreatureType p_175734_1_, BlockPos p_175734_2_) - { - List list = this.getChunkProvider().func_177458_a(p_175734_1_, p_175734_2_); -+ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(this, p_175734_1_, p_175734_2_, list); - return list != null && !list.isEmpty() ? (BiomeGenBase.SpawnListEntry)WeightedRandom.getRandomItem(this.rand, list) : null; - } - -++++ END PATCH -++++ REJECTED PATCH 7 - if (p_175654_2_.requiresUpdates()) - { - b0 = 8; -+ //Keeping here as a note for future when it may be restored. -+ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.position.getX() >> 4, nextticklistentry.position.getZ() >> 4)); -+ b0 = (byte)(isForced ? 0 : 8); - - if (this.isAreaLoaded(nextticklistentry.position.add(-b0, -b0, -b0), nextticklistentry.position.add(b0, b0, b0))) - { -++++ END PATCH -++++ REJECTED PATCH 9 - { - nextticklistentry = (NextTickListEntry)iterator.next(); - iterator.remove(); -+ //Keeping here as a note for future when it may be restored. -+ //boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.xCoord >> 4, nextticklistentry.zCoord >> 4)); -+ //byte b0 = isForced ? 0 : 8; - byte b0 = 0; - - if (this.isAreaLoaded(nextticklistentry.position.add(-b0, -b0, -b0), nextticklistentry.position.add(b0, b0, b0))) -++++ END PATCH -++++ REJECTED PATCH 10 - { - ArrayList arraylist = Lists.newArrayList(); - -- for (int k1 = 0; k1 < this.loadedTileEntityList.size(); ++k1) -+ //Forge: Optomize this loop to only grab from the chunks it needs -+ for (int x = (p_147486_1_ >> 4); x <= (p_147486_4_ >> 4); x++) - { -- TileEntity tileentity = (TileEntity)this.loadedTileEntityList.get(k1); -- BlockPos blockpos = tileentity.getPos(); -- -- if (blockpos.getX() >= p_147486_1_ && blockpos.getY() >= p_147486_2_ && blockpos.getZ() >= p_147486_3_ && blockpos.getX() < p_147486_4_ && blockpos.getY() < p_147486_5_ && blockpos.getZ() < p_147486_6_) -+ for (int z = (p_147486_3_ >> 4); z <= (p_147486_6_ >> 4); z++) - { -- arraylist.add(tileentity); -+ Chunk chunk = this.getChunkFromChunkCoords(x, z); -+ if (chunk != null) -+ { -+ for (Object obj : chunk.getTileEntityMap().values()) -+ { -+ TileEntity entity = (TileEntity)obj; -+ if (!entity.isInvalid()) -+ { -+ BlockPos pos = entity.getPos(); -+ if (pos.getX() >= p_147486_1_ && pos.getY() >= p_147486_2_ && pos.getZ() >= p_147486_3_ && -+ pos.getX() <= p_147486_4_ && pos.getY() <= p_147486_5_ && pos.getZ() <= p_147486_6_) -+ { -+ arraylist.add(entity); -+ } -+ -+ } -+ } -+ } - } - } - -++++ END PATCH -++++ REJECTED PATCH 14 - } - - this.chunkProvider.saveChunks(p_73044_1_, p_73044_2_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this)); - List list = this.theChunkProviderServer.func_152380_a(); - Iterator iterator = list.iterator(); - -++++ END PATCH -++++ REJECTED PATCH 18 - return this.mcServer.isCallingFromMinecraftThread(); - } - -+ public java.io.File getChunkSaveLocation() -+ { -+ return ((net.minecraft.world.chunk.storage.AnvilChunkLoader)theChunkProviderServer.chunkLoader).chunkSaveLocation; -+ } -+ - static class ServerBlockEventList extends ArrayList - { - private static final String __OBFID = "CL_00001439"; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/WorldServerMulti.java.patch.rej b/rejects/minecraft/net/minecraft/world/WorldServerMulti.java.patch.rej deleted file mode 100644 index d7ea32b1c..000000000 --- a/rejects/minecraft/net/minecraft/world/WorldServerMulti.java.patch.rej +++ /dev/null @@ -1,32 +0,0 @@ -++++ REJECTED PATCH 2 - { - WorldServerMulti.this.getWorldBorder().setDamageBuffer(newSize); - } -- }); -+ }; -+ this.delegate.getWorldBorder().addListener(this.borderListener); - } - -- protected void saveLevel() throws MinecraftException {} -+ protected void saveLevel() throws MinecraftException -+ { -+ this.perWorldStorage.saveAllData(); -+ } - - public World init() - { - this.mapStorage = this.delegate.getMapStorage(); - this.worldScoreboard = this.delegate.getScoreboard(); - String s = VillageCollection.fileNameForProvider(this.provider); -- VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s); -+ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.loadData(VillageCollection.class, s); - - if (villagecollection == null) - { - this.villageCollectionObj = new VillageCollection(this); -- this.mapStorage.setData(s, this.villageCollectionObj); -+ this.perWorldStorage.setData(s, this.villageCollectionObj); - } - else - { -++++ END PATCH From d31ca0dbd83176a9c60e59daf57def215da662b7 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 10 Nov 2015 21:47:08 +0300 Subject: [PATCH 011/133] EntityAIAttackOnCollide, ServerStatusResponse, MinecraftServer, NetHandlerLoginServer, Vec3, BiomeGenBase, AnvilChunkLoader, ChunkProviderServer, MapGenRavine, MinecraftServer updated; fix in Block, GuiIngameForge; can load the world and play with ~20 more manual error fixes. --- .../net/minecraft/block/Block.java.patch | 2 +- .../ai/EntityAIAttackOnCollide.java.patch | 19 +- .../network/ServerStatusResponse.java.patch | 42 ++++- .../server/MinecraftServer.java.patch | 124 ++++++++++++-- .../network/NetHandlerLoginServer.java.patch | 9 + .../net/minecraft/util/Vec3.java.patch | 8 + .../world/biome/BiomeGenBase.java.patch | 138 +++++++++++++++ .../chunk/storage/AnvilChunkLoader.java.patch | 162 ++++++++++++++++++ .../world/gen/ChunkProviderServer.java.patch | 125 ++++++++++++++ .../world/gen/MapGenRavine.java.patch | 35 +++- .../ai/EntityAIAttackOnCollide.java.patch.rej | 16 -- .../ServerStatusResponse.java.patch.rej | 45 ----- .../server/MinecraftServer.java.patch.rej | 118 +------------ .../NetHandlerLoginServer.java.patch.rej | 10 -- .../world/gen/MapGenRavine.java.patch.rej | 31 ---- .../minecraftforge/client/GuiIngameForge.java | 2 +- 16 files changed, 645 insertions(+), 241 deletions(-) create mode 100644 patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch create mode 100644 patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch delete mode 100644 rejects/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/network/ServerStatusResponse.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch.rej diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 425b4bd1b..91a1c1d28 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -1110,7 +1110,7 @@ + */ + public void setHarvestLevel(String toolClass, int level) + { -+ Iterator itr = getBlockState().getValidStates().iterator(); ++ java.util.Iterator itr = getBlockState().getValidStates().iterator(); + while (itr.hasNext()) + { + setHarvestLevel(toolClass, level, itr.next()); diff --git a/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch b/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch index 6060c996e..e0e63f53c 100644 --- a/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch @@ -1,6 +1,21 @@ --- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java +++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java -@@ -55,6 +55,19 @@ +@@ -21,11 +21,14 @@ + private double field_151495_j; + private double field_151496_k; + private static final String __OBFID = "CL_00001595"; ++ private int failedPathFindingPenalty = 0; ++ private boolean canPenalize = false; + + public EntityAIAttackOnCollide(EntityCreature p_i1635_1_, Class p_i1635_2_, double p_i1635_3_, boolean p_i1635_5_) + { + this(p_i1635_1_, p_i1635_3_, p_i1635_5_); + this.classTarget = p_i1635_2_; ++ canPenalize = classTarget == null || !net.minecraft.entity.player.EntityPlayer.class.isAssignableFrom(classTarget); //Only enable delaying when not targeting players. + } + + public EntityAIAttackOnCollide(EntityCreature p_i1636_1_, double p_i1636_2_, boolean p_i1636_4_) +@@ -55,6 +58,19 @@ } else { @@ -20,7 +35,7 @@ this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); return this.entityPathEntity != null; } -@@ -92,6 +105,23 @@ +@@ -92,6 +108,23 @@ this.field_151496_k = entitylivingbase.posZ; this.field_75445_i = 4 + this.attacker.getRNG().nextInt(7); diff --git a/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch b/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch index 1acebaeb3..5b32599ba 100644 --- a/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch +++ b/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch @@ -38,7 +38,7 @@ return serverstatusresponse; } -@@ -251,6 +256,7 @@ +@@ -251,7 +256,47 @@ jsonobject.addProperty("favicon", p_serialize_1_.getFavicon()); } @@ -46,3 +46,43 @@ return jsonobject; } } ++ ++ private java.util.concurrent.Semaphore mutex = new java.util.concurrent.Semaphore(1); ++ private String json = null; ++ /** ++ * Returns this object as a Json string. ++ * Converting to JSON if a cached version is not available. ++ * ++ * Also to prevent potentially large memory allocations on the server ++ * this is moved from the S00PacketServerInfo writePacket function ++ * ++ * As this method is called from the network threads thread safety is important! ++ * ++ * @return ++ */ ++ public String getJson() ++ { ++ String ret = this.json; ++ if (ret == null) ++ { ++ mutex.acquireUninterruptibly(); ++ ret = this.json; ++ if (ret == null) ++ { ++ ret = net.minecraft.network.status.server.S00PacketServerInfo.GSON.toJson(this); ++ this.json = ret; ++ } ++ mutex.release(); ++ } ++ return ret; ++ } ++ ++ /** ++ * Invalidates the cached json, causing the next call to getJson to rebuild it. ++ * This is needed externally because PlayerCountData.setPlayer's is public. ++ */ ++ public void invalidateJson() ++ { ++ this.json = null; ++ } + } diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch index 319a31742..6347d1b7c 100644 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -28,7 +28,72 @@ ISaveHandler isavehandler = this.anvilConverterForAnvilFile.getSaveLoader(p_71247_1_, true); this.setResourcePackFromWorld(this.getFolderName(), isavehandler); WorldInfo worldinfo = isavehandler.loadWorldInfo(); -@@ -405,7 +404,7 @@ +@@ -261,47 +260,21 @@ + worldsettings = new WorldSettings(worldinfo); + } + +- for (int i = 0; i < this.worldServers.length; ++i) ++ WorldServer overWorld = (WorldServer)(isDemo() ? new DemoWorldServer(this, isavehandler, worldinfo, 0, theProfiler).init() : new WorldServer(this, isavehandler, worldinfo, 0, theProfiler).init()); ++ overWorld.initialize(worldsettings); ++ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) + { +- int j = 0; ++ WorldServer world = (dim == 0 ? overWorld : (WorldServer)new WorldServerMulti(this, isavehandler, dim, overWorld, theProfiler).init()); ++ world.addWorldAccess(new WorldManager(this, world)); + +- if (i == 1) +- { +- j = -1; +- } +- +- if (i == 2) +- { +- j = 1; +- } +- +- if (i == 0) +- { +- if (this.isDemo()) +- { +- this.worldServers[i] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); +- } +- else +- { +- this.worldServers[i] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); +- } +- +- this.worldServers[i].initialize(worldsettings); +- } +- else +- { +- this.worldServers[i] = (WorldServer)(new WorldServerMulti(this, isavehandler, j, this.worldServers[0], this.theProfiler)).init(); +- } +- +- this.worldServers[i].addWorldAccess(new WorldManager(this, this.worldServers[i])); +- + if (!this.isSinglePlayer()) + { +- this.worldServers[i].getWorldInfo().setGameType(this.getGameType()); ++ world.getWorldInfo().setGameType(this.getGameType()); + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); + } + +- this.serverConfigManager.setPlayerManager(this.worldServers); ++ this.serverConfigManager.setPlayerManager(new WorldServer[]{ overWorld }); + this.setDifficultyForAllWorlds(this.getDifficulty()); + this.initialWorldChunkLoad(); + } +@@ -316,7 +289,7 @@ + this.setUserMessage("menu.generatingTerrain"); + int j1 = 0; + logger.info("Preparing start region for level " + j1); +- WorldServer worldserver = this.worldServers[j1]; ++ WorldServer worldserver = net.minecraftforge.common.DimensionManager.getWorld(j1); + BlockPos blockpos = worldserver.getSpawnPoint(); + long k1 = getCurrentTimeMillis(); + +@@ -405,7 +378,7 @@ public void stopServer() { @@ -37,7 +102,7 @@ { logger.info("Stopping server"); -@@ -429,8 +428,15 @@ +@@ -429,8 +402,15 @@ for (int i = 0; i < this.worldServers.length; ++i) { WorldServer worldserver = this.worldServers[i]; @@ -53,7 +118,7 @@ } if (this.usageSnooper.isSnooperRunning()) -@@ -462,6 +468,7 @@ +@@ -462,6 +442,7 @@ { if (this.startServer()) { @@ -61,7 +126,7 @@ this.currentTime = getCurrentTimeMillis(); long i = 0L; this.statusResponse.setServerDescription(new ChatComponentText(this.motd)); -@@ -506,12 +513,20 @@ +@@ -506,12 +487,20 @@ Thread.sleep(Math.max(1L, 50L - i)); this.serverIsRunning = true; } @@ -82,7 +147,7 @@ catch (Throwable throwable1) { logger.error("Encountered an unexpected exception", throwable1); -@@ -537,6 +552,7 @@ +@@ -537,6 +526,7 @@ logger.error("We were unable to save this crash report to disk."); } @@ -90,7 +155,7 @@ this.finalTick(crashreport); } finally -@@ -552,6 +568,8 @@ +@@ -552,6 +542,8 @@ } finally { @@ -99,7 +164,7 @@ this.systemExitNow(); } } -@@ -601,6 +619,7 @@ +@@ -601,6 +593,7 @@ public void tick() { long i = System.nanoTime(); @@ -107,7 +172,7 @@ ++this.tickCounter; if (this.startProfiling) -@@ -627,6 +646,7 @@ +@@ -627,6 +620,7 @@ Collections.shuffle(Arrays.asList(agameprofile)); this.statusResponse.getPlayerCountData().setPlayers(agameprofile); @@ -115,7 +180,7 @@ } if (this.tickCounter % 900 == 0) -@@ -654,6 +674,7 @@ +@@ -654,6 +648,7 @@ this.theProfiler.endSection(); this.theProfiler.endSection(); @@ -123,7 +188,36 @@ } public void updateTimeLightAndEntities() -@@ -710,6 +731,7 @@ +@@ -669,14 +664,17 @@ + } + + this.theProfiler.endStartSection("levels"); ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.tick(); + +- for (int j = 0; j < this.worldServers.length; ++j) ++ Integer[] ids = net.minecraftforge.common.DimensionManager.getIDs(this.tickCounter % 200 == 0); ++ for (int x = 0; x < ids.length; x++) + { ++ int id = ids[x]; + long i = System.nanoTime(); + +- if (j == 0 || this.getAllowNether()) ++ if (id == 0 || this.getAllowNether()) + { +- WorldServer worldserver = this.worldServers[j]; ++ WorldServer worldserver = net.minecraftforge.common.DimensionManager.getWorld(id); + this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName()); + + if (this.tickCounter % 20 == 0) +@@ -687,6 +685,7 @@ + } + + this.theProfiler.startSection("tick"); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreWorldTick(worldserver); + + try + { +@@ -710,6 +709,7 @@ throw new ReportedException(crashreport1); } @@ -131,7 +225,7 @@ this.theProfiler.endSection(); this.theProfiler.startSection("tracker"); worldserver.getEntityTracker().updateTrackedEntities(); -@@ -717,9 +739,11 @@ +@@ -717,9 +717,11 @@ this.theProfiler.endSection(); } @@ -144,7 +238,7 @@ this.theProfiler.endStartSection("connection"); this.getNetworkSystem().networkTick(); this.theProfiler.endStartSection("players"); -@@ -741,6 +765,7 @@ +@@ -741,6 +743,7 @@ public void startServerThread() { @@ -152,7 +246,7 @@ this.serverThread = new Thread(this, "Server thread"); this.serverThread.start(); } -@@ -757,7 +782,13 @@ +@@ -757,7 +760,13 @@ public WorldServer worldServerForDimension(int dimension) { @@ -167,7 +261,7 @@ } public String getMinecraftVersion() -@@ -787,7 +818,7 @@ +@@ -787,7 +796,7 @@ public String getServerModName() { @@ -176,7 +270,7 @@ } public CrashReport addServerInfoToCrashReport(CrashReport report) -@@ -1000,6 +1031,7 @@ +@@ -1000,6 +1009,7 @@ if (worldserver != null) { diff --git a/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch b/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch index 7c5e63706..c27eab907 100644 --- a/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch +++ b/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch @@ -9,3 +9,12 @@ { this.closeConnection("Took too long to log in"); } +@@ -132,7 +132,7 @@ + } + else + { +- this.server.getConfigurationManager().initializeConnectionToPlayer(this.networkManager, this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile)); ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.getConfigurationManager(), this.networkManager, this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile)); + } + } + } diff --git a/patches/minecraft/net/minecraft/util/Vec3.java.patch b/patches/minecraft/net/minecraft/util/Vec3.java.patch index cd1142a15..96c890b92 100644 --- a/patches/minecraft/net/minecraft/util/Vec3.java.patch +++ b/patches/minecraft/net/minecraft/util/Vec3.java.patch @@ -25,3 +25,11 @@ public Vec3 crossProduct(Vec3 vec) { return new Vec3(this.yCoord * vec.zCoord - this.zCoord * vec.yCoord, this.zCoord * vec.xCoord - this.xCoord * vec.zCoord, this.xCoord * vec.yCoord - this.yCoord * vec.xCoord); +@@ -80,7 +75,6 @@ + return new Vec3(this.xCoord + x, this.yCoord + y, this.zCoord + z); + } + +- @SideOnly(Side.CLIENT) + public double distanceTo(Vec3 vec) + { + double d0 = vec.xCoord - this.xCoord; diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch new file mode 100644 index 000000000..ad6f56998 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch @@ -0,0 +1,138 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenBase.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenBase.java +@@ -139,6 +139,10 @@ + + public BiomeGenBase(int p_i1971_1_) + { ++ this(p_i1971_1_, true); ++ } ++ public BiomeGenBase(int p_i1971_1_, boolean register) ++ { + this.minHeight = height_Default.rootHeight; + this.maxHeight = height_Default.variation; + this.temperature = 0.5F; +@@ -153,6 +157,7 @@ + this.worldGeneratorBigTree = new WorldGenBigTree(false); + this.worldGeneratorSwamp = new WorldGenSwamp(); + this.biomeID = p_i1971_1_; ++ if (register) + biomeList[p_i1971_1_] = this; + this.theBiomeDecorator = this.createBiomeDecorator(); + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySheep.class, 12, 4, 4)); +@@ -169,11 +174,12 @@ + this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityWitch.class, 5, 1, 1)); + this.spawnableWaterCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySquid.class, 10, 4, 4)); + this.spawnableCaveCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 10, 8, 8)); ++ this.addDefaultFlowers(); + } + + public BiomeDecorator createBiomeDecorator() + { +- return new BiomeDecorator(); ++ return getModdedBiomeDecorator(new BiomeDecorator()); + } + + public BiomeGenBase setTemperatureRainfall(float p_76732_1_, float p_76732_2_) +@@ -343,7 +349,7 @@ + { + double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(p_180627_1_), 0.0F, 1.0F); + double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); +- return ColorizerGrass.getGrassColor(d0, d1); ++ return getModdedBiomeGrassColor(ColorizerGrass.getGrassColor(d0, d1)); + } + + @SideOnly(Side.CLIENT) +@@ -351,7 +357,7 @@ + { + double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(p_180625_1_), 0.0F, 1.0F); + double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); +- return ColorizerFoliage.getFoliageColor(d0, d1); ++ return getModdedBiomeFoliageColor(ColorizerFoliage.getFoliageColor(d0, d1)); + } + + public boolean isSnowyBiome() +@@ -498,6 +504,84 @@ + } + } + ++ /* ========================================= FORGE START ======================================*/ ++ protected List flowers = new java.util.ArrayList(); ++ ++ public BiomeDecorator getModdedBiomeDecorator(BiomeDecorator original) ++ { ++ return new net.minecraftforge.event.terraingen.DeferredBiomeDecorator(original); ++ } ++ ++ public int getWaterColorMultiplier() ++ { ++ net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor(this, waterColorMultiplier); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ return event.newColor; ++ } ++ ++ public int getModdedBiomeGrassColor(int original) ++ { ++ net.minecraftforge.event.terraingen.BiomeEvent.GetGrassColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetGrassColor(this, original); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ return event.newColor; ++ } ++ ++ public int getModdedBiomeFoliageColor(int original) ++ { ++ net.minecraftforge.event.terraingen.BiomeEvent.GetFoliageColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetFoliageColor(this, original); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ return event.newColor; ++ } ++ ++ /** ++ * Weighted random holder class used to hold possible flowers ++ * that can spawn in this biome when bonemeal is used on grass. ++ */ ++ public static class FlowerEntry extends WeightedRandom.Item ++ { ++ public final net.minecraft.block.state.IBlockState state; ++ public FlowerEntry(net.minecraft.block.state.IBlockState state, int weight) ++ { ++ super(weight); ++ this.state = state; ++ } ++ } ++ ++ /** ++ * Adds the default flowers, as of 1.7, it is 2 yellow, and 1 red. I chose 10 to allow some wiggle room in the numbers. ++ */ ++ public void addDefaultFlowers() ++ { ++ addFlower(Blocks.yellow_flower.getDefaultState().withProperty(Blocks.yellow_flower.getTypeProperty(), BlockFlower.EnumFlowerType.DANDELION), 20); ++ addFlower(Blocks.red_flower.getDefaultState().withProperty(Blocks.red_flower.getTypeProperty(), BlockFlower.EnumFlowerType.POPPY), 20); ++ } ++ ++ /** Register a new plant to be planted when bonemeal is used on grass. ++ * @param state The block to place. ++ * @param weight The weight of the plant, where red flowers are ++ * 10 and yellow flowers are 20. ++ */ ++ public void addFlower(IBlockState state, int weight) ++ { ++ this.flowers.add(new FlowerEntry(state, weight)); ++ } ++ ++ public void plantFlower(World world, Random rand, BlockPos pos) ++ { ++ FlowerEntry flower = (FlowerEntry)WeightedRandom.getRandomItem(rand, flowers); ++ if (flower == null || flower.state == null || ++ (flower.state.getBlock() instanceof net.minecraft.block.BlockBush && ++ !((net.minecraft.block.BlockBush)flower.state.getBlock()).canBlockStay(world, pos, flower.state))) ++ { ++ return; ++ } ++ ++ world.setBlockState(pos, flower.state, 3); ++ } ++ ++ ++ /* ========================================= FORGE END ======================================*/ ++ + static + { + plains.createMutation(); diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch new file mode 100644 index 000000000..3ed1e56b3 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch @@ -0,0 +1,162 @@ +--- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java ++++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java +@@ -43,8 +43,41 @@ + this.chunkSaveLocation = chunkSaveLocationIn; + } + ++ public boolean chunkExists(World world, int x, int z) ++ { ++ ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(x, z); ++ ++ if (this.pendingAnvilChunksCoordinates.contains(chunkcoordintpair)) ++ { ++ for(ChunkCoordIntPair pendingChunkCoord : this.chunksToRemove.keySet()) ++ { ++ if (pendingChunkCoord.equals(chunkcoordintpair)) ++ { ++ return true; ++ } ++ } ++ } ++ ++ return RegionFileCache.createOrLoadRegionFile(this.chunkSaveLocation, x, z).chunkExists(x & 31, z & 31); ++ } ++ + public Chunk loadChunk(World worldIn, int x, int z) throws IOException + { ++ Object[] data = this.loadChunk__Async(worldIn, x, z); ++ ++ if (data != null) ++ { ++ Chunk chunk = (Chunk) data[0]; ++ NBTTagCompound nbttagcompound = (NBTTagCompound) data[1]; ++ this.loadEntities(worldIn, nbttagcompound.getCompoundTag("Level"), chunk); ++ return chunk; ++ } ++ ++ return null; ++ } ++ ++ public Object[] loadChunk__Async(World worldIn, int x, int z) throws IOException ++ { + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(x, z); + NBTTagCompound nbttagcompound = (NBTTagCompound)this.chunksToRemove.get(chunkcoordintpair); + +@@ -60,11 +93,17 @@ + nbttagcompound = CompressedStreamTools.read(datainputstream); + } + +- return this.checkedReadChunkFromNBT(worldIn, x, z, nbttagcompound); ++ return this.checkedReadChunkFromNBT__Async(worldIn, x, z, nbttagcompound); + } + + protected Chunk checkedReadChunkFromNBT(World worldIn, int x, int z, NBTTagCompound p_75822_4_) + { ++ Object[] data = this.checkedReadChunkFromNBT__Async(worldIn, x, z, p_75822_4_); ++ return data != null ? (Chunk)data[0] : null; ++ } ++ ++ protected Object[] checkedReadChunkFromNBT__Async(World worldIn, int x, int z, NBTTagCompound p_75822_4_) ++ { + if (!p_75822_4_.hasKey("Level", 10)) + { + logger.error("Chunk file at " + x + "," + z + " is missing level data, skipping"); +@@ -88,10 +127,29 @@ + logger.error("Chunk file at " + x + "," + z + " is in the wrong location; relocating. (Expected " + x + ", " + z + ", got " + chunk.xPosition + ", " + chunk.zPosition + ")"); + nbttagcompound.setInteger("xPos", x); + nbttagcompound.setInteger("zPos", z); ++ ++ // Have to move tile entities since we don't load them at this stage ++ NBTTagList _tileEntities = nbttagcompound.getTagList("TileEntities", 10); ++ ++ if (_tileEntities != null) ++ { ++ for (int te = 0; te < _tileEntities.tagCount(); te++) ++ { ++ NBTTagCompound _nbt = (NBTTagCompound) _tileEntities.getCompoundTagAt(te); ++ _nbt.setInteger("x", x * 16 + (_nbt.getInteger("x") - chunk.xPosition * 16)); ++ _nbt.setInteger("z", z * 16 + (_nbt.getInteger("z") - chunk.zPosition * 16)); ++ } ++ } ++ + chunk = this.readChunkFromNBT(worldIn, nbttagcompound); + } + +- return chunk; ++ Object[] data = new Object[2]; ++ data[0] = chunk; ++ data[1] = p_75822_4_; ++ // event is fired in ChunkIOProvider.callStage2 since it must be fired after TE's load. ++ // MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Load(chunk, par4NBTTagCompound)); ++ return data; + } + } + } +@@ -106,6 +164,7 @@ + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound.setTag("Level", nbttagcompound1); + this.writeChunkToNBT(chunkIn, worldIn, nbttagcompound1); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Save(chunkIn, nbttagcompound)); + this.addChunkToPending(chunkIn.getChunkCoordIntPair(), nbttagcompound); + } + catch (Exception exception) +@@ -282,11 +341,20 @@ + { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + ++ try ++ { + if (entity.writeToNBTOptional(nbttagcompound1)) + { + chunkIn.setHasEntities(true); + nbttaglist1.appendTag(nbttagcompound1); + } ++ } ++ catch (Exception e) ++ { ++ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, ++ "An Entity type %s has thrown an exception trying to write state. It will not persist. Report this to the mod author", ++ entity.getClass().getName()); ++ } + } + } + +@@ -296,8 +364,17 @@ + for (TileEntity tileentity : chunkIn.getTileEntityMap().values()) + { + NBTTagCompound nbttagcompound2 = new NBTTagCompound(); ++ try ++ { + tileentity.writeToNBT(nbttagcompound2); + nbttaglist2.appendTag(nbttagcompound2); ++ } ++ catch (Exception e) ++ { ++ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, ++ "A TileEntity type %s has throw an exception trying to write state. It will not persist. Report this to the mod author", ++ tileentity.getClass().getName()); ++ } + } + + p_75820_3_.setTag("TileEntities", nbttaglist2); +@@ -377,6 +454,12 @@ + chunk.setBiomeArray(p_75823_2_.getByteArray("Biomes")); + } + ++ // End this method here and split off entity loading to another method ++ return chunk; ++ } ++ ++ public void loadEntities(World worldIn, NBTTagCompound p_75823_2_, Chunk chunk) ++ { + NBTTagList nbttaglist1 = p_75823_2_.getTagList("Entities", 10); + + if (nbttaglist1 != null) +@@ -448,7 +531,5 @@ + } + } + } +- +- return chunk; + } + } diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch new file mode 100644 index 000000000..284195ebf --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch @@ -0,0 +1,125 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderServer.java ++++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderServer.java +@@ -36,6 +36,7 @@ + public LongHashMap id2ChunkMap = new LongHashMap(); + public List loadedChunks = Lists.newArrayList(); + public WorldServer worldObj; ++ private Set loadingChunks = com.google.common.collect.Sets.newHashSet(); + private static final String __OBFID = "CL_00001436"; + + public ChunkProviderServer(WorldServer p_i1520_1_, IChunkLoader p_i1520_2_, IChunkProvider p_i1520_3_) +@@ -58,7 +59,7 @@ + + public void dropChunk(int p_73241_1_, int p_73241_2_) + { +- if (this.worldObj.provider.canRespawnHere()) ++ if (this.worldObj.provider.canRespawnHere() && net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.worldObj.provider.getDimensionId())) + { + if (!this.worldObj.isSpawnChunk(p_73241_1_, p_73241_2_)) + { +@@ -81,12 +82,64 @@ + + public Chunk loadChunk(int p_73158_1_, int p_73158_2_) + { ++ return loadChunk(p_73158_1_, p_73158_2_, null); ++ } ++ ++ public Chunk loadChunk(int par1, int par2, Runnable runnable) ++ { ++ long k = ChunkCoordIntPair.chunkXZ2Int(par1, par2); ++ this.droppedChunksSet.remove(Long.valueOf(k)); ++ Chunk chunk = (Chunk)this.id2ChunkMap.getValueByKey(k); ++ net.minecraft.world.chunk.storage.AnvilChunkLoader loader = null; ++ ++ if (this.chunkLoader instanceof net.minecraft.world.chunk.storage.AnvilChunkLoader) ++ { ++ loader = (net.minecraft.world.chunk.storage.AnvilChunkLoader) this.chunkLoader; ++ } ++ ++ // We can only use the queue for already generated chunks ++ if (chunk == null && loader != null && loader.chunkExists(this.worldObj, par1, par2)) ++ { ++ if (runnable != null) ++ { ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.queueChunkLoad(this.worldObj, loader, this, par1, par2, runnable); ++ return null; ++ } ++ else ++ { ++ chunk = net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(this.worldObj, loader, this, par1, par2); ++ } ++ } ++ else if (chunk == null) ++ { ++ chunk = this.originalLoadChunk(par1, par2); ++ } ++ ++ // If we didn't load the chunk async and have a callback run it now ++ if (runnable != null) ++ { ++ runnable.run(); ++ } ++ ++ return chunk; ++ } ++ ++ public Chunk originalLoadChunk(int p_73158_1_, int p_73158_2_) ++ { + long i = ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_); + this.droppedChunksSet.remove(Long.valueOf(i)); + Chunk chunk = (Chunk)this.id2ChunkMap.getValueByKey(i); + + if (chunk == null) + { ++ boolean added = loadingChunks.add(i); ++ if (!added) ++ { ++ net.minecraftforge.fml.common.FMLLog.bigWarning("There is an attempt to load a chunk (%d,%d) in di >mension %d that is already being loaded. This will cause weird chunk breakages.", p_73158_1_, p_73158_2_, worldObj.provider.getDimensionId()); ++ } ++ chunk = net.minecraftforge.common.ForgeChunkManager.fetchDormantChunk(i, this.worldObj); ++ ++ if (chunk == null) + chunk = this.loadChunkFromFile(p_73158_1_, p_73158_2_); + + if (chunk == null) +@@ -115,6 +168,7 @@ + + this.id2ChunkMap.add(i, chunk); + this.loadedChunks.add(chunk); ++ loadingChunks.remove(i); + chunk.onChunkLoad(); + chunk.populateChunk(this, this, p_73158_1_, p_73158_2_); + } +@@ -206,6 +260,7 @@ + if (this.serverChunkGenerator != null) + { + this.serverChunkGenerator.populate(p_73153_1_, p_73153_2_, p_73153_3_); ++ net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(p_73153_2_, p_73153_3_, worldObj, serverChunkGenerator, p_73153_1_); + chunk.setChunkModified(); + } + } +@@ -267,6 +322,11 @@ + { + if (!this.worldObj.disableLevelSaving) + { ++ for (ChunkCoordIntPair forced : this.worldObj.getPersistentChunks().keySet()) ++ { ++ this.droppedChunksSet.remove(ChunkCoordIntPair.chunkXZ2Int(forced.chunkXPos, forced.chunkZPos)); ++ } ++ + for (int i = 0; i < 100; ++i) + { + if (!this.droppedChunksSet.isEmpty()) +@@ -281,6 +341,12 @@ + this.saveChunkExtraData(chunk); + this.id2ChunkMap.remove(olong.longValue()); + this.loadedChunks.remove(chunk); ++ net.minecraftforge.common.ForgeChunkManager.putDormantChunk(ChunkCoordIntPair.chunkXZ2Int(chunk.xPosition, chunk.zPosition), chunk); ++ if(loadedChunks.size() == 0 && net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this.worldObj).size() == 0 && !net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.worldObj.provider.getDimensionId())){ ++ net.minecraftforge.common.DimensionManager.unloadWorld(this.worldObj.provider.getDimensionId()); ++ return serverChunkGenerator.unloadQueuedChunks(); ++ } ++ + } + + this.droppedChunksSet.remove(olong); diff --git a/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch b/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch index 8671a0f11..48e386ee6 100644 --- a/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch @@ -5,11 +5,42 @@ IBlockState iblockstate = p_180707_5_.getBlockState(j1, l1, k1); - if (iblockstate.getBlock() == Blocks.flowing_water || iblockstate.getBlock() == Blocks.water) -+ if (isOceanBlock(p_180707_5_, k2, i2, l2, p_180707_3_, p_180707_4_)) ++ if (isOceanBlock(p_180707_5_, j1, l1, k1, p_180707_3_, p_180707_4_)) { flag2 = true; } -@@ -222,4 +222,68 @@ +@@ -166,28 +166,12 @@ + { + IBlockState iblockstate1 = p_180707_5_.getBlockState(j3, j2, i2); + +- if (iblockstate1.getBlock() == Blocks.grass) ++ if (isTopBlock(p_180707_5_, j3, j2, i2, p_180707_3_, p_180707_4_)) + { + flag = true; + } + +- if (iblockstate1.getBlock() == Blocks.stone || iblockstate1.getBlock() == Blocks.dirt || iblockstate1.getBlock() == Blocks.grass) +- { +- if (j2 - 1 < 10) +- { +- p_180707_5_.setBlockState(j3, j2, i2, Blocks.flowing_lava.getDefaultState()); +- } +- else +- { +- p_180707_5_.setBlockState(j3, j2, i2, Blocks.air.getDefaultState()); +- +- if (flag && p_180707_5_.getBlockState(j3, j2 - 1, i2).getBlock() == Blocks.dirt) +- { +- blockpos$mutableblockpos.func_181079_c(j3 + p_180707_3_ * 16, 0, i2 + p_180707_4_ * 16); +- p_180707_5_.setBlockState(j3, j2 - 1, i2, this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).topBlock); +- } +- } +- } ++ digBlock(p_180707_5_, j3, j2, i2, p_180707_3_, p_180707_4_, flag); + } + } + } +@@ -222,4 +206,68 @@ } } } diff --git a/rejects/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch.rej b/rejects/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch.rej deleted file mode 100644 index 6ae31bd0f..000000000 --- a/rejects/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch.rej +++ /dev/null @@ -1,16 +0,0 @@ -++++ REJECTED PATCH 1 - private double field_151495_j; - private double field_151496_k; - private static final String __OBFID = "CL_00001595"; -+ private int failedPathFindingPenalty = 0; -+ private boolean canPenalize = false; - - public EntityAIAttackOnCollide(EntityCreature p_i1635_1_, Class p_i1635_2_, double p_i1635_3_, boolean p_i1635_5_) - { - this(p_i1635_1_, p_i1635_3_, p_i1635_5_); - this.classTarget = p_i1635_2_; -+ canPenalize = classTarget == null || !net.minecraft.entity.player.EntityPlayer.class.isAssignableFrom(classTarget); //Only enable delaying when not targeting players. - } - - public EntityAIAttackOnCollide(EntityCreature p_i1636_1_, double p_i1636_2_, boolean p_i1636_4_) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/network/ServerStatusResponse.java.patch.rej b/rejects/minecraft/net/minecraft/network/ServerStatusResponse.java.patch.rej deleted file mode 100644 index e909ac525..000000000 --- a/rejects/minecraft/net/minecraft/network/ServerStatusResponse.java.patch.rej +++ /dev/null @@ -1,45 +0,0 @@ -++++ REJECTED PATCH 6 - return this.serialize((ServerStatusResponse)p_serialize_1_, p_serialize_2_, p_serialize_3_); - } - } -+ -+ private java.util.concurrent.Semaphore mutex = new java.util.concurrent.Semaphore(1); -+ private String json = null; -+ /** -+ * Returns this object as a Json string. -+ * Converting to JSON if a cached version is not available. -+ * -+ * Also to prevent potentially large memory allocations on the server -+ * this is moved from the S00PacketServerInfo writePacket function -+ * -+ * As this method is called from the network threads thread safety is important! -+ * -+ * @return -+ */ -+ public String getJson() -+ { -+ String ret = this.json; -+ if (ret == null) -+ { -+ mutex.acquireUninterruptibly(); -+ ret = this.json; -+ if (ret == null) -+ { -+ ret = net.minecraft.network.status.server.S00PacketServerInfo.GSON.toJson(this); -+ this.json = ret; -+ } -+ mutex.release(); -+ } -+ return ret; -+ } -+ -+ /** -+ * Invalidates the cached json, causing the next call to getJson to rebuild it. -+ * This is needed externally because PlayerCountData.setPlayer's is public. -+ */ -+ public void invalidateJson() -+ { -+ this.json = null; -+ } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/MinecraftServer.java.patch.rej b/rejects/minecraft/net/minecraft/server/MinecraftServer.java.patch.rej index cfdcbd57e..43108a30c 100644 --- a/rejects/minecraft/net/minecraft/server/MinecraftServer.java.patch.rej +++ b/rejects/minecraft/net/minecraft/server/MinecraftServer.java.patch.rej @@ -1,79 +1,4 @@ -++++ REJECTED PATCH 4 - worldsettings = new WorldSettings(worldinfo); - } - -- for (int j = 0; j < this.worldServers.length; ++j) -+ WorldServer overWorld = (WorldServer)(isDemo() ? new DemoWorldServer(this, isavehandler, worldinfo, 0, theProfiler).init() : new WorldServer(this, isavehandler, worldinfo, 0, theProfiler).init()); -+ overWorld.initialize(worldsettings); -+ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) - { -- byte b0 = 0; -+ WorldServer world = (dim == 0 ? overWorld : (WorldServer)new WorldServerMulti(this, isavehandler, dim, overWorld, theProfiler).init()); -+ world.addWorldAccess(new WorldManager(this, world)); - -- if (j == 1) -- { -- b0 = -1; -- } -- -- if (j == 2) -- { -- b0 = 1; -- } -- -- if (j == 0) -- { -- if (this.isDemo()) -- { -- this.worldServers[j] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, b0, this.theProfiler)).init(); -- } -- else -- { -- this.worldServers[j] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, b0, this.theProfiler)).init(); -- } -- -- this.worldServers[j].initialize(worldsettings); -- } -- else -- { -- this.worldServers[j] = (WorldServer)(new WorldServerMulti(this, isavehandler, b0, this.worldServers[0], this.theProfiler)).init(); -- } -- -- this.worldServers[j].addWorldAccess(new WorldManager(this, this.worldServers[j])); -- - if (!this.isSinglePlayer()) - { -- this.worldServers[j].getWorldInfo().setGameType(this.getGameType()); -+ world.getWorldInfo().setGameType(this.getGameType()); - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); - } - -- this.serverConfigManager.setPlayerManager(this.worldServers); -+ this.serverConfigManager.setPlayerManager(new WorldServer[]{ overWorld }); - this.setDifficultyForAllWorlds(this.getDifficulty()); - this.initialWorldChunkLoad(); - } -++++ END PATCH -++++ REJECTED PATCH 5 - this.setUserMessage("menu.generatingTerrain"); - byte b0 = 0; - logger.info("Preparing start region for level " + b0); -- WorldServer worldserver = this.worldServers[b0]; -+ WorldServer worldserver = net.minecraftforge.common.DimensionManager.getWorld(b0); - BlockPos blockpos = worldserver.getSpawnPoint(); - long j = getCurrentTimeMillis(); - -++++ END PATCH -++++ REJECTED PATCH 6 - if (!this.worldIsBeingDeleted) - { - WorldServer[] aworldserver = this.worldServers; -+ if (aworldserver == null) return; //Forge: Just in case, NPE protection as it has been encountered. - int i = aworldserver.length; - - for (int j = 0; j < i; ++j) -++++ END PATCH +// do we still need this? ++++ REJECTED PATCH 16 { try @@ -84,44 +9,3 @@ catch (Throwable throwable2) { ++++ END PATCH -++++ REJECTED PATCH 17 - } - - this.theProfiler.endStartSection("levels"); -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.tick(); - int j; - -- for (j = 0; j < this.worldServers.length; ++j) -+ Integer[] ids = net.minecraftforge.common.DimensionManager.getIDs(this.tickCounter % 200 == 0); -+ for (int x = 0; x < ids.length; x++) - { -+ int id = ids[x]; - long i = System.nanoTime(); - -- if (j == 0 || this.getAllowNether()) -+ if (id == 0 || this.getAllowNether()) - { -- WorldServer worldserver = this.worldServers[j]; -+ WorldServer worldserver = net.minecraftforge.common.DimensionManager.getWorld(id); - this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName()); - - if (this.tickCounter % 20 == 0) -++++ END PATCH -++++ REJECTED PATCH 18 - } - - this.theProfiler.startSection("tick"); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreWorldTick(worldserver); - CrashReport crashreport; - - try -++++ END PATCH -++++ REJECTED PATCH 25 - this.serverPort = port; - } - -- @SideOnly(Side.SERVER) - public boolean isServerStopped() - { - return this.serverStopped; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch.rej b/rejects/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch.rej deleted file mode 100644 index 6b058fdfe..000000000 --- a/rejects/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 2 - } - - this.networkManager.sendPacket(new S02PacketLoginSuccess(this.loginGameProfile)); -- this.server.getConfigurationManager().initializeConnectionToPlayer(this.networkManager, this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile)); -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.getConfigurationManager(), this.networkManager, this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile)); - } - } - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch.rej deleted file mode 100644 index 091395f9c..000000000 --- a/rejects/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch.rej +++ /dev/null @@ -1,31 +0,0 @@ -++++ REJECTED PATCH 2 - { - IBlockState iblockstate1 = p_180707_5_.getBlockState(k2, j3, j4); - -- if (iblockstate1.getBlock() == Blocks.grass) -+ if (isTopBlock(p_180707_5_, k2, j3, j4, p_180707_3_, p_180707_4_)) - { - flag = true; - } - -- if (iblockstate1.getBlock() == Blocks.stone || iblockstate1.getBlock() == Blocks.dirt || iblockstate1.getBlock() == Blocks.grass) -- { -- if (j3 - 1 < 10) -- { -- p_180707_5_.setBlockState(k2, j3, j4, Blocks.flowing_lava.getDefaultState()); -- } -- else -- { -- p_180707_5_.setBlockState(k2, j3, j4, Blocks.air.getDefaultState()); -- -- if (flag && p_180707_5_.getBlockState(k2, j3 - 1, j4).getBlock() == Blocks.dirt) -- { -- p_180707_5_.setBlockState(k2, j3 - 1, j4, this.worldObj.getBiomeGenForCoords(new BlockPos(k2 + p_180707_3_ * 16, 0, j4 + p_180707_4_ * 16)).topBlock); -- } -- } -- } -+ digBlock(p_180707_5_, k2, j3, j4, p_180707_3_, p_180707_4_, flag); - } - } - } -++++ END PATCH diff --git a/src/main/java/net/minecraftforge/client/GuiIngameForge.java b/src/main/java/net/minecraftforge/client/GuiIngameForge.java index 8025d44e0..5c3adae6b 100644 --- a/src/main/java/net/minecraftforge/client/GuiIngameForge.java +++ b/src/main/java/net/minecraftforge/client/GuiIngameForge.java @@ -94,7 +94,7 @@ public class GuiIngameForge extends GuiIngame @Override public void renderGameOverlay(float partialTicks) { - res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); + res = new ScaledResolution(mc); eventParent = new RenderGameOverlayEvent(partialTicks, res); int width = res.getScaledWidth(); int height = res.getScaledHeight(); From 41bd8a41fadd5c6e43d59df3b8143351e2e14e9c Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 11 Nov 2015 15:51:32 +0300 Subject: [PATCH 012/133] BlockOre, BlockRotatedPillar, SoundManager, EntityPlayerSP, GuiScreen, GuiAchievements, GuiContainer, BlockModelRenderer, ContainerEnchantment, Slot updated manually and imports removed; GitSlot patch updated. --- .../net/minecraft/block/BlockOre.java.patch | 51 ++++++++ .../block/BlockRotatedPillar.java.patch | 21 ++++ .../client/audio/SoundManager.java.patch | 41 ++++++ .../client/entity/EntityPlayerSP.java.patch | 71 +++++++++++ .../minecraft/client/gui/GuiScreen.java.patch | 99 +++++++++++++++ .../minecraft/client/gui/GuiSlot.java.patch | 33 +++-- .../achievement/GuiAchievements.java.patch | 117 ++++++++++++++++++ .../gui/inventory/GuiContainer.java.patch | 57 +++++++++ .../renderer/BlockModelRenderer.java.patch | 24 ++++ .../inventory/ContainerEnchantment.java.patch | 77 ++++++++++++ .../net/minecraft/inventory/Slot.java.patch | 76 ++++++++++++ .../client/gui/GuiSlot.java.patch.rej | 19 --- 12 files changed, 659 insertions(+), 27 deletions(-) create mode 100644 patches/minecraft/net/minecraft/block/BlockOre.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch create mode 100644 patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch create mode 100644 patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch create mode 100644 patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch create mode 100644 patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch create mode 100644 patches/minecraft/net/minecraft/inventory/Slot.java.patch delete mode 100644 rejects/minecraft/net/minecraft/client/gui/GuiSlot.java.patch.rej diff --git a/patches/minecraft/net/minecraft/block/BlockOre.java.patch b/patches/minecraft/net/minecraft/block/BlockOre.java.patch new file mode 100644 index 000000000..35a3ddd9d --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockOre.java.patch @@ -0,0 +1,51 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockOre.java ++++ ../src-work/minecraft/net/minecraft/block/BlockOre.java +@@ -60,34 +60,40 @@ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); +- +- if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this)) ++ } ++ @Override ++ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) ++ { ++ IBlockState state = world.getBlockState(pos); ++ Random rand = world instanceof World ? ((World)world).rand : new Random(); ++ if (this.getItemDropped(state, rand, fortune) != Item.getItemFromBlock(this)) + { + int i = 0; + + if (this == Blocks.coal_ore) + { +- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 0, 2); ++ i = MathHelper.getRandomIntegerInRange(rand, 0, 2); + } + else if (this == Blocks.diamond_ore) + { +- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 3, 7); ++ i = MathHelper.getRandomIntegerInRange(rand, 3, 7); + } + else if (this == Blocks.emerald_ore) + { +- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 3, 7); ++ i = MathHelper.getRandomIntegerInRange(rand, 3, 7); + } + else if (this == Blocks.lapis_ore) + { +- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); ++ i = MathHelper.getRandomIntegerInRange(rand, 2, 5); + } + else if (this == Blocks.quartz_ore) + { +- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); ++ i = MathHelper.getRandomIntegerInRange(rand, 2, 5); + } + +- this.dropXpOnBlockBreak(worldIn, pos, i); ++ return i; + } ++ return 0; + } + + public int getDamageValue(World worldIn, BlockPos pos) diff --git a/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch b/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch new file mode 100644 index 000000000..586091cc9 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch @@ -0,0 +1,21 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockRotatedPillar.java ++++ ../src-work/minecraft/net/minecraft/block/BlockRotatedPillar.java +@@ -19,4 +19,18 @@ + { + super(p_i46385_1_, p_i46385_2_); + } ++ ++ public boolean rotateBlock(net.minecraft.world.World world, net.minecraft.util.BlockPos pos, EnumFacing axis) ++ { ++ net.minecraft.block.state.IBlockState state = world.getBlockState(pos); ++ for (net.minecraft.block.properties.IProperty prop : state.getProperties().keySet()) ++ { ++ if (prop.getName().equals("axis")) ++ { ++ world.setBlockState(pos, state.cycleProperty(prop)); ++ return true; ++ } ++ } ++ return false; ++ } + } diff --git a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch new file mode 100644 index 000000000..95f78a511 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch @@ -0,0 +1,41 @@ +--- ../src-base/minecraft/net/minecraft/client/audio/SoundManager.java ++++ ../src-work/minecraft/net/minecraft/client/audio/SoundManager.java +@@ -70,6 +70,7 @@ + { + SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class); + SoundSystemConfig.setCodec("ogg", CodecJOrbis.class); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundSetupEvent(this)); + } + catch (SoundSystemException soundsystemexception) + { +@@ -81,6 +82,7 @@ + { + this.unloadSoundSystem(); + this.loadSoundSystem(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundLoadEvent(this)); + } + + private synchronized void loadSoundSystem() +@@ -319,6 +321,9 @@ + } + else + { ++ sound = net.minecraftforge.client.ForgeHooksClient.playSound(this, sound); ++ if (sound == null) return; ++ + SoundEventAccessorComposite soundeventaccessorcomposite = this.sndHandler.getSound(sound.getSoundLocation()); + + if (soundeventaccessorcomposite == null) +@@ -360,10 +365,12 @@ + if (soundpoolentry.isStreamingSound()) + { + this.sndSystem.newStreamingSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlayStreamingSourceEvent(this, sound, s)); + } + else + { + this.sndSystem.newSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlaySoundSourceEvent(this, sound, s)); + } + + logger.debug(LOG_MARKER, "Playing sound {} for event {} as channel {}", new Object[] {soundpoolentry.getSoundPoolEntryLocation(), soundeventaccessorcomposite.getSoundEventLocation(), s}); diff --git a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch new file mode 100644 index 000000000..41abf7b94 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch @@ -0,0 +1,71 @@ +--- ../src-base/minecraft/net/minecraft/client/entity/EntityPlayerSP.java ++++ ../src-work/minecraft/net/minecraft/client/entity/EntityPlayerSP.java +@@ -346,6 +346,15 @@ + this.mc.ingameGUI.getChatGUI().printChatMessage(chatComponent); + } + ++ private boolean isHeadspaceFree(BlockPos pos, int height) ++ { ++ for (int y = 0; y < height; y++) ++ { ++ if (isOpenBlockSpace(pos.add(0, y, 0))) return false; ++ } ++ return true; ++ } ++ + protected boolean pushOutOfBlocks(double x, double y, double z) + { + if (this.noClip) +@@ -358,30 +367,34 @@ + double d0 = x - (double)blockpos.getX(); + double d1 = z - (double)blockpos.getZ(); + +- if (!this.isOpenBlockSpace(blockpos)) ++ int entHeight = Math.max(Math.round(this.height), 1); ++ ++ boolean inTranslucentBlock = this.isHeadspaceFree(blockpos, entHeight); ++ ++ if (inTranslucentBlock) + { + int i = -1; + double d2 = 9999.0D; + +- if (this.isOpenBlockSpace(blockpos.west()) && d0 < d2) ++ if (!this.isHeadspaceFree(blockpos.west(), entHeight) && d0 < d2) + { + d2 = d0; + i = 0; + } + +- if (this.isOpenBlockSpace(blockpos.east()) && 1.0D - d0 < d2) ++ if (!this.isHeadspaceFree(blockpos.east(), entHeight) && 1.0D - d0 < d2) + { + d2 = 1.0D - d0; + i = 1; + } + +- if (this.isOpenBlockSpace(blockpos.north()) && d1 < d2) ++ if (!this.isHeadspaceFree(blockpos.north(), entHeight) && d1 < d2) + { + d2 = d1; + i = 4; + } + +- if (this.isOpenBlockSpace(blockpos.south()) && 1.0D - d1 < d2) ++ if (!this.isHeadspaceFree(blockpos.south(), entHeight) && 1.0D - d1 < d2) + { + d2 = 1.0D - d1; + i = 5; +@@ -449,6 +462,12 @@ + + public void playSound(String name, float volume, float pitch) + { ++ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, name, volume, pitch); ++ if (event.isCanceled() || event.name == null) return; ++ name = event.name; ++ volume = event.newVolume; ++ pitch = event.newPitch; ++ + this.worldObj.playSound(this.posX, this.posY, this.posZ, name, volume, pitch, false); + } + diff --git a/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch new file mode 100644 index 000000000..37d51e97f --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch @@ -0,0 +1,99 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/GuiScreen.java ++++ ../src-work/minecraft/net/minecraft/client/gui/GuiScreen.java +@@ -144,7 +144,8 @@ + } + } + +- this.drawHoveringText(list, x, y); ++ FontRenderer font = stack.getItem().getFontRenderer(stack); ++ this.drawHoveringText(list, x, y, (font == null ? fontRendererObj : font)); + } + + protected void drawCreativeTabHoveringText(String tabName, int mouseX, int mouseY) +@@ -154,6 +155,11 @@ + + protected void drawHoveringText(List textLines, int x, int y) + { ++ drawHoveringText(textLines, x, y, fontRendererObj); ++ } ++ ++ protected void drawHoveringText(List textLines, int x, int y, FontRenderer font) ++ { + if (!textLines.isEmpty()) + { + GlStateManager.disableRescaleNormal(); +@@ -164,7 +170,7 @@ + + for (String s : textLines) + { +- int j = this.fontRendererObj.getStringWidth(s); ++ int j = font.getStringWidth(s); + + if (j > i) + { +@@ -209,7 +215,7 @@ + for (int k1 = 0; k1 < textLines.size(); ++k1) + { + String s1 = (String)textLines.get(k1); +- this.fontRendererObj.drawStringWithShadow(s1, (float)l1, (float)i2, -1); ++ font.drawStringWithShadow(s1, (float)l1, (float)i2, -1); + + if (k1 == 0) + { +@@ -437,6 +443,7 @@ + { + this.mc.ingameGUI.getChatGUI().addToSentMessages(msg); + } ++ if (net.minecraftforge.client.ClientCommandHandler.instance.executeCommand(mc.thePlayer, msg) != 0) return; + + this.mc.thePlayer.sendChatMessage(msg); + } +@@ -451,9 +458,15 @@ + + if (guibutton.mousePressed(this.mc, mouseX, mouseY)) + { ++ net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Pre event = new net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Pre(this, guibutton, this.buttonList); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) ++ break; ++ guibutton = event.button; + this.selectedButton = guibutton; + guibutton.playPressSound(this.mc.getSoundHandler()); + this.actionPerformed(guibutton); ++ if (this.equals(this.mc.currentScreen)) ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Post(this, event.button, this.buttonList)); + } + } + } +@@ -483,8 +496,12 @@ + this.fontRendererObj = mc.fontRendererObj; + this.width = width; + this.height = height; ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Pre(this, this.buttonList))) ++ { + this.buttonList.clear(); + this.initGui(); ++ } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Post(this, this.buttonList)); + } + + public void initGui() +@@ -497,7 +514,9 @@ + { + while (Mouse.next()) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Pre(this))) continue; + this.handleMouseInput(); ++ if (this.equals(this.mc.currentScreen)) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Post(this)); + } + } + +@@ -505,7 +524,9 @@ + { + while (Keyboard.next()) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Pre(this))) continue; + this.handleKeyboardInput(); ++ if (this.equals(this.mc.currentScreen)) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Post(this)); + } + } + } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch index 3cc9d27e2..422650fdf 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch @@ -1,6 +1,24 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiSlot.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiSlot.java -@@ -459,4 +459,19 @@ +@@ -182,15 +182,8 @@ + GlStateManager.disableFog(); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); +- this.mc.getTextureManager().bindTexture(Gui.optionsBackground); +- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); +- float f = 32.0F; +- worldrenderer.func_181668_a(7, DefaultVertexFormats.field_181709_i); +- worldrenderer.func_181662_b((double)this.left, (double)this.bottom, 0.0D).func_181673_a((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); +- worldrenderer.func_181662_b((double)this.right, (double)this.bottom, 0.0D).func_181673_a((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); +- worldrenderer.func_181662_b((double)this.right, (double)this.top, 0.0D).func_181673_a((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); +- worldrenderer.func_181662_b((double)this.left, (double)this.top, 0.0D).func_181673_a((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); +- tessellator.draw(); ++ // Forge: background rendering moved into separate method. ++ this.drawContainerBackground(tessellator); + int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2; + int l = this.top + 4 - (int)this.amountScrolled; + +@@ -459,4 +452,18 @@ { return this.slotHeight; } @@ -10,13 +28,12 @@ + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + this.mc.getTextureManager().bindTexture(Gui.optionsBackground); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); -+ float f1 = 32.0F; -+ worldrenderer.startDrawingQuads(); -+ worldrenderer.setColorOpaque_I(2105376); -+ worldrenderer.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); -+ worldrenderer.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); -+ worldrenderer.addVertexWithUV((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); -+ worldrenderer.addVertexWithUV((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); ++ float f = 32.0F; ++ worldrenderer.func_181668_a(7, DefaultVertexFormats.field_181709_i); ++ worldrenderer.func_181662_b((double)this.left, (double)this.bottom, 0.0D).func_181673_a((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); ++ worldrenderer.func_181662_b((double)this.right, (double)this.bottom, 0.0D).func_181673_a((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); ++ worldrenderer.func_181662_b((double)this.right, (double)this.top, 0.0D).func_181673_a((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); ++ worldrenderer.func_181662_b((double)this.left, (double)this.top, 0.0D).func_181673_a((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); + tessellator.draw(); + } } diff --git a/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch b/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch new file mode 100644 index 000000000..6551b16eb --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch @@ -0,0 +1,117 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java ++++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java +@@ -50,6 +50,10 @@ + private boolean loadingAchievements = true; + private static final String __OBFID = "CL_00000722"; + ++ private int currentPage = -1; ++ private GuiButton button; ++ private java.util.LinkedList minecraftAchievements = new java.util.LinkedList(); ++ + public GuiAchievements(GuiScreen p_i45026_1_, StatFileWriter p_i45026_2_) + { + this.parentScreen = p_i45026_1_; +@@ -58,6 +62,14 @@ + int j = 141; + this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.openInventory.displayColumn * 24 - i / 2 - 12); + this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.openInventory.displayRow * 24 - j / 2); ++ minecraftAchievements.clear(); ++ for (Achievement achievement : AchievementList.achievementList) ++ { ++ if (!net.minecraftforge.common.AchievementPage.isAchievementInPages(achievement)) ++ { ++ minecraftAchievements.add(achievement); ++ } ++ } + } + + public void initGui() +@@ -65,6 +77,7 @@ + this.mc.getNetHandler().addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.REQUEST_STATS)); + this.buttonList.clear(); + this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, I18n.format("gui.done", new Object[0]))); ++ this.buttonList.add(button = new GuiButton(2, (width - field_146555_f) / 2 + 24, height / 2 + 74, 125, 20, net.minecraftforge.common.AchievementPage.getTitle(currentPage))); + } + + protected void actionPerformed(GuiButton button) throws IOException +@@ -75,6 +88,16 @@ + { + this.mc.displayGuiScreen(this.parentScreen); + } ++ ++ if (button.id == 2) ++ { ++ currentPage++; ++ if (currentPage >= net.minecraftforge.common.AchievementPage.getAchievementPages().size()) ++ { ++ currentPage = -1; ++ } ++ this.button.displayString = net.minecraftforge.common.AchievementPage.getTitle(currentPage); ++ } + } + } + +@@ -258,7 +281,9 @@ + GlStateManager.depthFunc(518); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)i1, (float)j1, -200.0F); +- GlStateManager.scale(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 0.0F); ++ // FIXES models rendering weirdly in the acheivements pane ++ // see https://github.com/MinecraftForge/MinecraftForge/commit/1b7ce7592caafb760ec93066184182ae0711e793#commitcomment-10512284 ++ GlStateManager.scale(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 1.0F); + GlStateManager.enableTexture2D(); + GlStateManager.disableLighting(); + GlStateManager.enableRescaleNormal(); +@@ -332,11 +357,12 @@ + GlStateManager.depthFunc(515); + this.mc.getTextureManager().bindTexture(field_146561_C); + +- for (int j5 = 0; j5 < AchievementList.achievementList.size(); ++j5) ++ java.util.List achievementList = (currentPage == -1 ? minecraftAchievements : net.minecraftforge.common.AchievementPage.getAchievementPage(currentPage).getAchievements()); ++ for (int j5 = 0; j5 < achievementList.size(); ++j5) + { +- Achievement achievement1 = (Achievement)AchievementList.achievementList.get(j5); ++ Achievement achievement1 = achievementList.get(j5); + +- if (achievement1.parentAchievement != null) ++ if (achievement1.parentAchievement != null && achievementList.contains(achievement1.parentAchievement)) + { + int k5 = achievement1.displayColumn * 24 - i + 11; + int l5 = achievement1.displayRow * 24 - j + 11; +@@ -390,9 +416,9 @@ + GlStateManager.enableRescaleNormal(); + GlStateManager.enableColorMaterial(); + +- for (int i6 = 0; i6 < AchievementList.achievementList.size(); ++i6) ++ for (int i6 = 0; i6 < achievementList.size(); ++i6) + { +- Achievement achievement2 = (Achievement)AchievementList.achievementList.get(i6); ++ Achievement achievement2 = achievementList.get(i6); + int l6 = achievement2.displayColumn * 24 - i; + int j7 = achievement2.displayRow * 24 - j; + +@@ -433,6 +459,7 @@ + + this.mc.getTextureManager().bindTexture(field_146561_C); + ++ GlStateManager.enableBlend(); // Forge: Specifically enable blend because it is needed here. And we fix Generic RenderItem's leakage of it. + if (achievement2.getSpecial()) + { + this.drawTexturedModalRect(l6 - 2, j7 - 2, 26, 202, 26, 26); +@@ -441,6 +468,7 @@ + { + this.drawTexturedModalRect(l6 - 2, j7 - 2, 0, 202, 26, 26); + } ++ GlStateManager.disableBlend(); //Forge: Cleanup states we set. + + if (!this.statFileWriter.canUnlockAchievement(achievement2)) + { +@@ -449,7 +477,7 @@ + this.itemRender.func_175039_a(false); + } + +- GlStateManager.enableLighting(); ++ GlStateManager.disableLighting(); //Forge: Make sure Lighting is disabled. Fixes MC-33065 + GlStateManager.enableCull(); + this.itemRender.renderItemAndEffectIntoGUI(achievement2.theItemStack, l6 + 3, j7 + 3); + GlStateManager.blendFunc(770, 771); diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch new file mode 100644 index 000000000..b5535336b --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch @@ -0,0 +1,57 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java ++++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java +@@ -176,8 +176,11 @@ + GlStateManager.translate(0.0F, 0.0F, 32.0F); + this.zLevel = 200.0F; + this.itemRender.zLevel = 200.0F; ++ net.minecraft.client.gui.FontRenderer font = null; ++ if (stack != null) font = stack.getItem().getFontRenderer(stack); ++ if (font == null) font = fontRendererObj; + this.itemRender.renderItemAndEffectIntoGUI(stack, x, y); +- this.itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, stack, x, y - (this.draggedStack == null ? 0 : 8), altText); ++ this.itemRender.renderItemOverlayIntoGUI(font, stack, x, y - (this.draggedStack == null ? 0 : 8), altText); + this.zLevel = 0.0F; + this.itemRender.zLevel = 0.0F; + } +@@ -240,13 +243,12 @@ + + if (itemstack == null) + { +- String s1 = slotIn.getSlotTexture(); ++ TextureAtlasSprite textureatlassprite = slotIn.getBackgroundSprite(); + +- if (s1 != null) ++ if (textureatlassprite != null) + { +- TextureAtlasSprite textureatlassprite = this.mc.getTextureMapBlocks().getAtlasSprite(s1); + GlStateManager.disableLighting(); +- this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); ++ this.mc.getTextureManager().bindTexture(slotIn.getBackgroundLocation()); + this.drawTexturedModalRect(i, j, textureatlassprite, 16, 16); + GlStateManager.enableLighting(); + flag1 = true; +@@ -464,6 +466,7 @@ + + protected void mouseReleased(int mouseX, int mouseY, int state) + { ++ super.mouseReleased(mouseX, mouseY, state); //Forge, Call parent to release buttons + Slot slot = this.getSlotAtPosition(mouseX, mouseY); + int i = this.guiLeft; + int j = this.guiTop; +@@ -686,4 +689,16 @@ + this.mc.thePlayer.closeScreen(); + } + } ++ ++ /* ======================================== FORGE START =====================================*/ ++ ++ /** ++ * Returns the slot that is currently displayed under the mouse. ++ */ ++ public Slot getSlotUnderMouse() ++ { ++ return this.theSlot; ++ } ++ ++ /* ======================================== FORGE END =====================================*/ + } diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch new file mode 100644 index 000000000..9a78c5a86 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch @@ -0,0 +1,24 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java +@@ -536,8 +536,19 @@ + @SideOnly(Side.CLIENT) + public static enum EnumNeighborInfo + { +- DOWN(new EnumFacing[]{EnumFacing.WEST, EnumFacing.EAST, EnumFacing.NORTH, EnumFacing.SOUTH}, 0.5F, false, new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0]), +- UP(new EnumFacing[]{EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH}, 1.0F, false, new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0]), ++ // -- Forge Patch to Fix Top/Bottom Lighting Interpolation -- ++ // Forge PR - https://github.com/MinecraftForge/MinecraftForge/pull/1892 ++ // Mojang Bug - https://bugs.mojang.com/browse/MC-80148 ++ DOWN( new EnumFacing[]{ EnumFacing.WEST, EnumFacing.EAST, EnumFacing.NORTH, EnumFacing.SOUTH }, 0.5F, true, ++ new Orientation[]{ Orientation.FLIP_WEST, Orientation.SOUTH, Orientation.FLIP_WEST, Orientation.FLIP_SOUTH, Orientation.WEST, Orientation.FLIP_SOUTH, Orientation.WEST, Orientation.SOUTH }, ++ new Orientation[]{ Orientation.FLIP_WEST, Orientation.NORTH, Orientation.FLIP_WEST, Orientation.FLIP_NORTH, Orientation.WEST, Orientation.FLIP_NORTH, Orientation.WEST, Orientation.NORTH }, ++ new Orientation[]{ Orientation.FLIP_EAST, Orientation.NORTH, Orientation.FLIP_EAST, Orientation.FLIP_NORTH, Orientation.EAST, Orientation.FLIP_NORTH, Orientation.EAST, Orientation.NORTH }, ++ new Orientation[]{ Orientation.FLIP_EAST, Orientation.SOUTH, Orientation.FLIP_EAST, Orientation.FLIP_SOUTH, Orientation.EAST, Orientation.FLIP_SOUTH, Orientation.EAST, Orientation.SOUTH } ), ++ UP( new EnumFacing[]{ EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH }, 1.0F, true, ++ new Orientation[]{ Orientation.EAST, Orientation.SOUTH, Orientation.EAST, Orientation.FLIP_SOUTH, Orientation.FLIP_EAST, Orientation.FLIP_SOUTH, Orientation.FLIP_EAST, Orientation.SOUTH }, ++ new Orientation[]{ Orientation.EAST, Orientation.NORTH, Orientation.EAST, Orientation.FLIP_NORTH, Orientation.FLIP_EAST, Orientation.FLIP_NORTH, Orientation.FLIP_EAST, Orientation.NORTH }, ++ new Orientation[]{ Orientation.WEST, Orientation.NORTH, Orientation.WEST, Orientation.FLIP_NORTH, Orientation.FLIP_WEST, Orientation.FLIP_NORTH, Orientation.FLIP_WEST, Orientation.NORTH }, ++ new Orientation[]{ Orientation.WEST, Orientation.SOUTH, Orientation.WEST, Orientation.FLIP_SOUTH, Orientation.FLIP_WEST, Orientation.FLIP_SOUTH, Orientation.FLIP_WEST, Orientation.SOUTH } ), + NORTH(new EnumFacing[]{EnumFacing.UP, EnumFacing.DOWN, EnumFacing.EAST, EnumFacing.WEST}, 0.8F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_WEST}), + SOUTH(new EnumFacing[]{EnumFacing.WEST, EnumFacing.EAST, EnumFacing.DOWN, EnumFacing.UP}, 0.8F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.EAST}), + WEST(new EnumFacing[]{EnumFacing.UP, EnumFacing.DOWN, EnumFacing.NORTH, EnumFacing.SOUTH}, 0.6F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.SOUTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.SOUTH}), diff --git a/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch new file mode 100644 index 000000000..e816639eb --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch @@ -0,0 +1,77 @@ +--- ../src-base/minecraft/net/minecraft/inventory/ContainerEnchantment.java ++++ ../src-work/minecraft/net/minecraft/inventory/ContainerEnchantment.java +@@ -69,9 +69,12 @@ + this.addSlotToContainer(new Slot(this.tableInventory, 1, 35, 47) + { + private static final String __OBFID = "CL_00002185"; ++ java.util.List ores = net.minecraftforge.oredict.OreDictionary.getOres("gemLapis"); + public boolean isItemValid(ItemStack stack) + { +- return stack.getItem() == Items.dye && EnumDyeColor.byDyeDamage(stack.getMetadata()) == EnumDyeColor.BLUE; ++ for (ItemStack ore : ores) ++ if (net.minecraftforge.oredict.OreDictionary.itemMatches(ore, stack, false)) return true; ++ return false; + } + }); + +@@ -150,6 +153,7 @@ + if (!this.worldPointer.isRemote) + { + int l = 0; ++ float power = 0; + + for (int j = -1; j <= 1; ++j) + { +@@ -157,37 +161,14 @@ + { + if ((j != 0 || k != 0) && this.worldPointer.isAirBlock(this.position.add(k, 0, j)) && this.worldPointer.isAirBlock(this.position.add(k, 1, j))) + { +- if (this.worldPointer.getBlockState(this.position.add(k * 2, 0, j * 2)).getBlock() == Blocks.bookshelf) +- { +- ++l; +- } +- +- if (this.worldPointer.getBlockState(this.position.add(k * 2, 1, j * 2)).getBlock() == Blocks.bookshelf) +- { +- ++l; +- } +- ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 0, j * 2)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 1, j * 2)); + if (k != 0 && j != 0) + { +- if (this.worldPointer.getBlockState(this.position.add(k * 2, 0, j)).getBlock() == Blocks.bookshelf) +- { +- ++l; +- } +- +- if (this.worldPointer.getBlockState(this.position.add(k * 2, 1, j)).getBlock() == Blocks.bookshelf) +- { +- ++l; +- } +- +- if (this.worldPointer.getBlockState(this.position.add(k, 0, j * 2)).getBlock() == Blocks.bookshelf) +- { +- ++l; +- } +- +- if (this.worldPointer.getBlockState(this.position.add(k, 1, j * 2)).getBlock() == Blocks.bookshelf) +- { +- ++l; +- } ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 0, j)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 1, j)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k, 0, j * 2)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k, 1, j * 2)); + } + } + } +@@ -197,7 +178,7 @@ + + for (int i1 = 0; i1 < 3; ++i1) + { +- this.enchantLevels[i1] = EnchantmentHelper.calcItemStackEnchantability(this.rand, i1, l, itemstack); ++ this.enchantLevels[i1] = EnchantmentHelper.calcItemStackEnchantability(this.rand, i1, (int)power, itemstack); + this.field_178151_h[i1] = -1; + + if (this.enchantLevels[i1] < i1 + 1) diff --git a/patches/minecraft/net/minecraft/inventory/Slot.java.patch b/patches/minecraft/net/minecraft/inventory/Slot.java.patch new file mode 100644 index 000000000..135b9fe84 --- /dev/null +++ b/patches/minecraft/net/minecraft/inventory/Slot.java.patch @@ -0,0 +1,76 @@ +--- ../src-base/minecraft/net/minecraft/inventory/Slot.java ++++ ../src-work/minecraft/net/minecraft/inventory/Slot.java +@@ -90,7 +90,7 @@ + @SideOnly(Side.CLIENT) + public String getSlotTexture() + { +- return null; ++ return backgroundName; + } + + public ItemStack decrStackSize(int amount) +@@ -113,4 +113,64 @@ + { + return true; + } ++ ++ /*========================================= FORGE START =====================================*/ ++ protected String backgroundName = null; ++ protected net.minecraft.util.ResourceLocation backgroundLocation = null; ++ protected Object backgroundMap; ++ /** ++ * Gets the path of the texture file to use for the background image of this slot when drawing the GUI. ++ * @return String: The texture file that will be used in GuiContainer.drawSlotInventory for the slot background. ++ */ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.util.ResourceLocation getBackgroundLocation() ++ { ++ return (backgroundLocation == null ? net.minecraft.client.renderer.texture.TextureMap.locationBlocksTexture : backgroundLocation); ++ } ++ ++ /** ++ * Sets the texture file to use for the background image of the slot when it's empty. ++ * @param textureFilename String: Path of texture file to use, or null to use "/gui/items.png" ++ */ ++ @SideOnly(Side.CLIENT) ++ public void setBackgroundLocation(net.minecraft.util.ResourceLocation texture) ++ { ++ this.backgroundLocation = texture; ++ } ++ ++ /** ++ * Sets which icon index to use as the background image of the slot when it's empty. ++ * Getter is func_178171_c ++ * @param icon The icon to use, null for none ++ */ ++ public void setBackgroundName(String name) ++ { ++ this.backgroundName = name; ++ } ++ ++ @SideOnly(Side.CLIENT) ++ public net.minecraft.client.renderer.texture.TextureAtlasSprite getBackgroundSprite() ++ { ++ String name = getSlotTexture(); ++ return name == null ? null : getBackgroundMap().getAtlasSprite(name); ++ } ++ ++ @SideOnly(Side.CLIENT) ++ protected net.minecraft.client.renderer.texture.TextureMap getBackgroundMap() ++ { ++ if (backgroundMap == null) backgroundMap = net.minecraft.client.Minecraft.getMinecraft().getTextureMapBlocks(); ++ return (net.minecraft.client.renderer.texture.TextureMap)backgroundMap; ++ } ++ ++ /** ++ * Retrieves the index in the inventory for this slot, this value should typically not ++ * be used, but can be useful for some occasions. ++ * ++ * @return Index in associated inventory for this slot. ++ */ ++ public int getSlotIndex() ++ { ++ return slotIndex; ++ } ++ /*========================================= FORGE END =====================================*/ + } diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiSlot.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiSlot.java.patch.rej deleted file mode 100644 index 79869a7b4..000000000 --- a/rejects/minecraft/net/minecraft/client/gui/GuiSlot.java.patch.rej +++ /dev/null @@ -1,19 +0,0 @@ -++++ REJECTED PATCH 1 - GlStateManager.disableFog(); - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); -- this.mc.getTextureManager().bindTexture(Gui.optionsBackground); -- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); -- float f1 = 32.0F; -- worldrenderer.startDrawingQuads(); -- worldrenderer.setColorOpaque_I(2105376); -- worldrenderer.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); -- worldrenderer.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); -- worldrenderer.addVertexWithUV((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); -- worldrenderer.addVertexWithUV((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); -- tessellator.draw(); -+ this.drawContainerBackground(tessellator); - int i1 = this.left + this.width / 2 - this.getListWidth() / 2 + 2; - int j1 = this.top + 4 - (int)this.amountScrolled; - -++++ END PATCH From 514774204957fcc091d3c349537f2d87ad826df9 Mon Sep 17 00:00:00 2001 From: cpw Date: Wed, 11 Nov 2015 08:48:04 -0500 Subject: [PATCH 013/133] Delete rejects that I initially processed. --- .../net/minecraft/block/Block.java.patch.rej | 56 -------- .../minecraft/block/BlockAir.java.patch.rej | 8 -- .../minecraft/block/BlockCocoa.java.patch.rej | 15 -- .../minecraft/block/BlockCrops.java.patch.rej | 26 ---- .../block/BlockDoublePlant.java.patch.rej | 40 ------ .../minecraft/block/BlockFire.java.patch.rej | 73 ---------- .../minecraft/block/BlockGrass.java.patch.rej | 32 ----- .../block/BlockLadder.java.patch.rej | 10 -- .../block/BlockLeaves.java.patch.rej | 73 ---------- .../minecraft/block/BlockLever.java.patch.rej | 55 ------- .../minecraft/block/BlockLog.java.patch.rej | 13 -- .../block/BlockMobSpawner.java.patch.rej | 18 --- .../block/BlockMushroom.java.patch.rej | 10 -- .../block/BlockMycelium.java.patch.rej | 10 -- .../block/BlockPistonBase.java.patch.rej | 22 --- .../block/BlockPistonMoving.java.patch.rej | 19 --- .../block/BlockRailBase.java.patch.rej | 134 ------------------ .../block/BlockRedstoneDiode.java.patch.rej | 10 -- .../block/BlockRedstoneOre.java.patch.rej | 21 --- .../block/BlockRedstoneWire.java.patch.rej | 59 -------- .../block/BlockSapling.java.patch.rej | 9 -- .../minecraft/block/BlockSkull.java.patch.rej | 10 -- .../minecraft/block/BlockSnow.java.patch.rej | 10 -- .../minecraft/block/BlockStem.java.patch.rej | 18 --- .../minecraft/block/BlockTorch.java.patch.rej | 30 ---- .../block/BlockTrapDoor.java.patch.rej | 13 -- .../block/BlockTripWireHook.java.patch.rej | 10 -- .../minecraft/block/BlockVine.java.patch.rej | 18 --- .../BlockPistonStructureHelper.java.patch.rej | 10 -- .../block/state/BlockState.java.patch.rej | 10 -- .../renderer/BlockModelShapes.java.patch.rej | 9 -- .../creativetab/CreativeTabs.java.patch.rej | 21 --- .../minecraft/init/Bootstrap.java.patch.rej | 9 -- .../inventory/ContainerPlayer.java.patch.rej | 11 -- .../inventory/ContainerRepair.java.patch.rej | 20 --- .../client/C12PacketUpdateSign.java.patch.rej | 10 -- .../world/biome/BiomeGenHills.java.patch.rej | 10 -- .../storage/AnvilSaveHandler.java.patch.rej | 22 --- 38 files changed, 954 deletions(-) delete mode 100644 rejects/minecraft/net/minecraft/block/Block.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockAir.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockCocoa.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockCrops.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockDoublePlant.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockFire.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockGrass.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockLadder.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockLeaves.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockLever.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockLog.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockMobSpawner.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockMushroom.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockMycelium.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockPistonBase.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockPistonMoving.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockRailBase.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockSapling.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockSkull.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockSnow.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockStem.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockTorch.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockTrapDoor.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockTripWireHook.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/BlockVine.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/block/state/BlockState.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/init/Bootstrap.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/inventory/ContainerRepair.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch.rej diff --git a/rejects/minecraft/net/minecraft/block/Block.java.patch.rej b/rejects/minecraft/net/minecraft/block/Block.java.patch.rej deleted file mode 100644 index 1e00b0acd..000000000 --- a/rejects/minecraft/net/minecraft/block/Block.java.patch.rej +++ /dev/null @@ -1,56 +0,0 @@ -++++ REJECTED PATCH 1 - public class Block - { - private static final ResourceLocation AIR_ID = new ResourceLocation("air"); -- public static final RegistryNamespacedDefaultedByKey blockRegistry = new RegistryNamespacedDefaultedByKey(AIR_ID); -- public static final ObjectIntIdentityMap BLOCK_STATE_IDS = new ObjectIntIdentityMap(); -+ public static final RegistryNamespacedDefaultedByKey blockRegistry = net.minecraftforge.fml.common.registry.GameData.getBlockRegistry(); -+ @Deprecated //Modders: DO NOT use this! Use GameRegistry -+ public static final ObjectIntIdentityMap BLOCK_STATE_IDS = net.minecraftforge.fml.common.registry.GameData.getBlockStateIDMap(); - private CreativeTabs displayOnCreativeTab; - public static final Block.SoundType soundTypeStone = new Block.SoundType("stone", 1.0F, 1.0F); - public static final Block.SoundType soundTypeWood = new Block.SoundType("wood", 1.0F, 1.0F); -++++ END PATCH -++++ REJECTED PATCH 7 - - public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {} - -- public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {} -+ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) -+ { -+ if (hasTileEntity(state) && !(this instanceof BlockContainer)) -+ { -+ worldIn.removeTileEntity(pos); -+ } -+ } - - public int quantityDropped(Random random) - { -++++ END PATCH -++++ REJECTED PATCH 9 - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -- if (!worldIn.isRemote) -+ if (!worldIn.isRemote && !worldIn.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe - { -- int j = this.quantityDroppedWithBonus(fortune, worldIn.rand); -+ java.util.List items = getDrops(worldIn, pos, state, fortune); -+ chance = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, fortune, chance, false, harvesters.get()); - -- for (int k = 0; k < j; ++k) -+ for (ItemStack item : items) - { - if (worldIn.rand.nextFloat() <= chance) - { -- Item item = this.getItemDropped(state, worldIn.rand, fortune); -- -- if (item != null) -- { -- spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); -- } -+ spawnAsEntity(worldIn, pos, item); - } - } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockAir.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockAir.java.patch.rej deleted file mode 100644 index f1b988c21..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockAir.java.patch.rej +++ /dev/null @@ -1,8 +0,0 @@ -++++ REJECTED PATCH 1 - } - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) {} -+ -+ public boolean isReplaceable(World worldIn, BlockPos pos){ return true; } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockCocoa.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockCocoa.java.patch.rej deleted file mode 100644 index e0e0c7e85..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockCocoa.java.patch.rej +++ /dev/null @@ -1,15 +0,0 @@ -++++ REJECTED PATCH 1 - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -+ } -+ -+ @Override -+ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List dropped = super.getDrops(world, pos, state, fortune); - int j = ((Integer)state.getValue(AGE)).intValue(); - byte b0 = 1; - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockCrops.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockCrops.java.patch.rej deleted file mode 100644 index 2119824f9..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockCrops.java.patch.rej +++ /dev/null @@ -1,26 +0,0 @@ -++++ REJECTED PATCH 3 - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); -- -- if (!worldIn.isRemote) -- { -- int j = ((Integer)state.getValue(AGE)).intValue(); -- -- if (j >= 7) -- { -- int k = 3 + fortune; -- -- for (int l = 0; l < k; ++l) -- { -- if (worldIn.rand.nextInt(15) <= j) -- { -- spawnAsEntity(worldIn, pos, new ItemStack(this.getSeed(), 1, 0)); -- } -- } -- } -- } - } - - public Item getItemDropped(IBlockState state, Random rand, int fortune) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockDoublePlant.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockDoublePlant.java.patch.rej deleted file mode 100644 index 950d40f7e..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockDoublePlant.java.patch.rej +++ /dev/null @@ -1,40 +0,0 @@ -++++ REJECTED PATCH 2 - Object object = flag ? this : worldIn.getBlockState(blockpos1).getBlock(); - Object object1 = flag ? worldIn.getBlockState(blockpos2).getBlock() : this; - -+ if (!flag) this.dropBlockAsItem(worldIn, pos, state, 0); //Forge move above the setting to air. -+ - if (object == this) - { - worldIn.setBlockState(blockpos1, Blocks.air.getDefaultState(), 3); -++++ END PATCH -++++ REJECTED PATCH 3 - if (object1 == this) - { - worldIn.setBlockState(blockpos2, Blocks.air.getDefaultState(), 3); -- -- if (!flag) -- { -- this.dropBlockAsItem(worldIn, blockpos2, state, 0); -- } - } - } - } - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -+ if (state.getBlock() != this) return super.canBlockStay(worldIn, pos, state); //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. - if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) - { - return worldIn.getBlockState(pos.down()).getBlock() == this; -++++ END PATCH -++++ REJECTED PATCH 5 - else - { - player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- int i = (enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).getMeta(); -- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 2, i)); - return true; - } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockFire.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockFire.java.patch.rej deleted file mode 100644 index 2bba49786..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockFire.java.patch.rej +++ /dev/null @@ -1,73 +0,0 @@ -++++ REJECTED PATCH 5 - b0 = -50; - } - -- this.catchOnFire(worldIn, pos.east(), 300 + b0, rand, i); -- this.catchOnFire(worldIn, pos.west(), 300 + b0, rand, i); -- this.catchOnFire(worldIn, pos.down(), 250 + b0, rand, i); -- this.catchOnFire(worldIn, pos.up(), 250 + b0, rand, i); -- this.catchOnFire(worldIn, pos.north(), 300 + b0, rand, i); -- this.catchOnFire(worldIn, pos.south(), 300 + b0, rand, i); -+ this.tryCatchFire(worldIn, pos.east(), 300 + b0, rand, i, EnumFacing.WEST); -+ this.tryCatchFire(worldIn, pos.west(), 300 + b0, rand, i, EnumFacing.EAST); -+ this.tryCatchFire(worldIn, pos.down(), 250 + b0, rand, i, EnumFacing.UP); -+ this.tryCatchFire(worldIn, pos.up(), 250 + b0, rand, i, EnumFacing.DOWN); -+ this.tryCatchFire(worldIn, pos.north(), 300 + b0, rand, i, EnumFacing.SOUTH); -+ this.tryCatchFire(worldIn, pos.south(), 300 + b0, rand, i, EnumFacing.NORTH); - - for (int j = -1; j <= 1; ++j) - { -++++ END PATCH -++++ REJECTED PATCH 6 - return false; - } - -+ @Deprecated // Use Block.getFlammability - public int getFlammability(Block blockIn) - { - Integer integer = (Integer)this.flammabilities.get(blockIn); - return integer == null ? 0 : integer.intValue(); - } - -+ @Deprecated // Use Block.getFlammability - public int getEncouragement(Block blockIn) - { - Integer integer = (Integer)this.encouragements.get(blockIn); - return integer == null ? 0 : integer.intValue(); - } - -+ @Deprecated // Use tryCatchFire with face below - private void catchOnFire(World worldIn, BlockPos pos, int chance, Random random, int age) - { -- int k = this.getFlammability(worldIn.getBlockState(pos).getBlock()); -+ this.tryCatchFire(worldIn, pos, chance, random, age, EnumFacing.UP); -+ } - -+ private void tryCatchFire(World worldIn, BlockPos pos, int chance, Random random, int age, EnumFacing face) -+ { -+ int k = worldIn.getBlockState(pos).getBlock().getFlammability(worldIn, pos, face); -+ - if (random.nextInt(chance) < k) - { - IBlockState iblockstate = worldIn.getBlockState(pos); -++++ END PATCH -++++ REJECTED PATCH 7 - { - EnumFacing enumfacing = aenumfacing[j]; - -- if (this.canCatchFire(worldIn, pos.offset(enumfacing))) -+ if (this.canCatchFire(worldIn, pos.offset(enumfacing), enumfacing.getOpposite())) - { - return true; - } -++++ END PATCH -++++ REJECTED PATCH 8 - for (int k = 0; k < j; ++k) - { - EnumFacing enumfacing = aenumfacing[k]; -- i = Math.max(this.getEncouragement(worldIn.getBlockState(pos.offset(enumfacing)).getBlock()), i); -+ i = Math.max(worldIn.getBlockState(pos.offset(enumfacing)).getBlock().getFlammability(worldIn, pos.offset(enumfacing), enumfacing.getOpposite()), i); - } - - return i; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockGrass.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockGrass.java.patch.rej deleted file mode 100644 index 2f7804379..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockGrass.java.patch.rej +++ /dev/null @@ -1,32 +0,0 @@ -++++ REJECTED PATCH 2 - Block block = worldIn.getBlockState(blockpos1.up()).getBlock(); - IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); - -- if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity() <= 2) -+ if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity(worldIn, blockpos1.up()) <= 2) - { - worldIn.setBlockState(blockpos1, Blocks.grass.getDefaultState()); - } -++++ END PATCH -++++ REJECTED PATCH 3 - continue; - } - } -- else if (worldIn.getBlockState(blockpos2).getBlock().blockMaterial == Material.air) -+ else if (worldIn.isAirBlock(blockpos2)) - { - if (rand.nextInt(8) == 0) - { -- BlockFlower.EnumFlowerType enumflowertype = worldIn.getBiomeGenForCoords(blockpos2).pickRandomFlower(rand, blockpos2); -- BlockFlower blockflower = enumflowertype.getBlockType().getBlock(); -- IBlockState iblockstate1 = blockflower.getDefaultState().withProperty(blockflower.getTypeProperty(), enumflowertype); -- -- if (blockflower.canBlockStay(worldIn, blockpos2, iblockstate1)) -- { -- worldIn.setBlockState(blockpos2, iblockstate1, 3); -- } -+ worldIn.getBiomeGenForCoords(blockpos2).plantFlower(worldIn, rand, blockpos2); - } - else - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockLadder.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockLadder.java.patch.rej deleted file mode 100644 index feee341b8..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockLadder.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 3 - return new BlockState(this, new IProperty[] {FACING}); - } - -+ @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; } -+ - static final class SwitchEnumFacing - { - static final int[] FACING_LOOKUP = new int[EnumFacing.values().length]; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockLeaves.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockLeaves.java.patch.rej deleted file mode 100644 index 971ebede5..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockLeaves.java.patch.rej +++ /dev/null @@ -1,73 +0,0 @@ -++++ REJECTED PATCH 2 - BlockPos blockpos1 = pos.add(i1, j1, k1); - IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); - -- if (iblockstate1.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate1.getValue(CHECK_DECAY)).booleanValue()) -+ if (iblockstate1.getBlock().isLeaves(worldIn, blockpos1)) - { -- worldIn.setBlockState(blockpos1, iblockstate1.withProperty(CHECK_DECAY, Boolean.valueOf(true)), 4); -+ iblockstate1.getBlock().beginLeavesDecay(worldIn, blockpos1); - } - } - } -++++ END PATCH -++++ REJECTED PATCH 3 - { - for (i2 = -b0; i2 <= b0; ++i2) - { -- Block block = worldIn.getBlockState(new BlockPos(j + k1, k + l1, l + i2)).getBlock(); -+ BlockPos tmp = new BlockPos(j + k1, k + l1, l + i2); -+ Block block = worldIn.getBlockState(tmp).getBlock(); - -- if (block != Blocks.log && block != Blocks.log2) -+ if (!block.canSustainLeaves(worldIn, tmp)) - { -- if (block.getMaterial() == Material.leaves) -+ if (block.isLeaves(worldIn, tmp)) - { - this.surroundings[(k1 + j1) * i1 + (l1 + j1) * b1 + i2 + j1] = -2; - } -++++ END PATCH -++++ REJECTED PATCH 4 - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -- if (!worldIn.isRemote) -- { -- int j = this.getSaplingDropChance(state); -- -- if (fortune > 0) -- { -- j -= 2 << fortune; -- -- if (j < 10) -- { -- j = 10; -- } -- } -- -- if (worldIn.rand.nextInt(j) == 0) -- { -- Item item = this.getItemDropped(state, worldIn.rand, fortune); -- spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); -- } -- -- j = 200; -- -- if (fortune > 0) -- { -- j -= 10 << fortune; -- -- if (j < 40) -- { -- j = 40; -- } -- } -- -- this.dropApple(worldIn, pos, state, j); -- } -+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); - } - - protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance) {} -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockLever.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockLever.java.patch.rej deleted file mode 100644 index 259b2a559..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockLever.java.patch.rej +++ /dev/null @@ -1,55 +0,0 @@ -++++ REJECTED PATCH 1 - - public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) - { -- return side == EnumFacing.UP && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) ? true : this.canSustainLever(worldIn, pos.offset(side.getOpposite())); -+ return side == EnumFacing.UP && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) ? true : worldIn.isSideSolid(pos.offset(side.getOpposite()), side); - } - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return this.canSustainLever(worldIn, pos.west()) ? true : (this.canSustainLever(worldIn, pos.east()) ? true : (this.canSustainLever(worldIn, pos.north()) ? true : (this.canSustainLever(worldIn, pos.south()) ? true : (World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) ? true : this.canSustainLever(worldIn, pos.up()))))); -+ return worldIn.isSideSolid(pos.west(), EnumFacing.EAST ) || -+ worldIn.isSideSolid(pos.east(), EnumFacing.WEST ) || -+ worldIn.isSideSolid(pos.north(), EnumFacing.SOUTH) || -+ worldIn.isSideSolid(pos.south(), EnumFacing.NORTH) || -+ worldIn.isSideSolid(pos.down(), EnumFacing.UP ) || -+ worldIn.isSideSolid(pos.up(), EnumFacing.DOWN ); - } - -- protected boolean canSustainLever(World worldIn, BlockPos pos) -- { -- return worldIn.getBlockState(pos).getBlock().isNormalCube(); -- } -- - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) - { - IBlockState iblockstate = this.getDefaultState().withProperty(POWERED, Boolean.valueOf(false)); - -- if (this.canSustainLever(worldIn, pos.offset(facing.getOpposite()))) -+ if (worldIn.isSideSolid(pos.offset(facing.getOpposite()), facing)) - { - return iblockstate.withProperty(FACING, BlockLever.EnumOrientation.forFacings(facing, placer.getHorizontalFacing())); - } -++++ END PATCH -++++ REJECTED PATCH 2 - - enumfacing1 = (EnumFacing)iterator.next(); - } -- while (enumfacing1 == facing || !this.canSustainLever(worldIn, pos.offset(enumfacing1.getOpposite()))); -+ while (enumfacing1 == facing || !worldIn.isSideSolid(pos.offset(enumfacing1.getOpposite()), enumfacing1)); - - return iblockstate.withProperty(FACING, BlockLever.EnumOrientation.forFacings(enumfacing1, placer.getHorizontalFacing())); - } -++++ END PATCH -++++ REJECTED PATCH 3 - - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) - { -- if (this.checkForDrop(worldIn, pos) && !this.canSustainLever(worldIn, pos.offset(((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing().getOpposite()))) -+ EnumFacing dir = ((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing(); -+ if (this.checkForDrop(worldIn, pos) && !worldIn.isSideSolid(pos.offset(dir.getOpposite()), dir)) - { - this.dropBlockAsItem(worldIn, pos, state, 0); - worldIn.setBlockToAir(pos); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockLog.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockLog.java.patch.rej deleted file mode 100644 index 5579362ca..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockLog.java.patch.rej +++ /dev/null @@ -1,13 +0,0 @@ -++++ REJECTED PATCH 1 - BlockPos blockpos1 = (BlockPos)iterator.next(); - IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); - -- if (iblockstate1.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate1.getValue(BlockLeaves.CHECK_DECAY)).booleanValue()) -+ if (iblockstate1.getBlock().isLeaves(worldIn, blockpos1)) - { -- worldIn.setBlockState(blockpos1, iblockstate1.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(true)), 4); -+ iblockstate1.getBlock().beginLeavesDecay(worldIn, blockpos1); - } - } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockMobSpawner.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockMobSpawner.java.patch.rej deleted file mode 100644 index a32b52b1f..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockMobSpawner.java.patch.rej +++ /dev/null @@ -1,18 +0,0 @@ -++++ REJECTED PATCH 1 - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -- int j = 15 + worldIn.rand.nextInt(15) + worldIn.rand.nextInt(15); -- this.dropXpOnBlockBreak(worldIn, pos, j); - } - -+ @Override -+ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15); -+ } -+ - public boolean isOpaqueCube() - { - return false; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockMushroom.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockMushroom.java.patch.rej deleted file mode 100644 index f1b2e5602..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockMushroom.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - if (pos.getY() >= 0 && pos.getY() < 256) - { - IBlockState iblockstate1 = worldIn.getBlockState(pos.down()); -- return iblockstate1.getBlock() == Blocks.mycelium ? true : (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.canPlaceBlockOn(iblockstate1.getBlock())); -+ return iblockstate1.getBlock() == Blocks.mycelium ? true : (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && iblockstate1.getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this)); - } - else - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockMycelium.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockMycelium.java.patch.rej deleted file mode 100644 index 6899945c5..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockMycelium.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 2 - IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); - Block block = worldIn.getBlockState(blockpos1.up()).getBlock(); - -- if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity() <= 2) -+ if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity(worldIn, blockpos1.up()) <= 2) - { - worldIn.setBlockState(blockpos1, this.getDefaultState()); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockPistonBase.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockPistonBase.java.patch.rej deleted file mode 100644 index 86af25d33..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockPistonBase.java.patch.rej +++ /dev/null @@ -1,22 +0,0 @@ -++++ REJECTED PATCH 1 - } - } - -- if (!flag1 && block.getMaterial() != Material.air && canPush(block, worldIn, blockpos1, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) -+ if (!flag1 && !block.isAir(worldIn, blockpos1) && canPush(block, worldIn, blockpos1, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) - { - this.doMove(worldIn, pos, enumfacing, false); - } -++++ END PATCH -++++ REJECTED PATCH 3 - { - blockpos1 = (BlockPos)list1.get(j); - Block block = worldIn.getBlockState(blockpos1).getBlock(); -- block.dropBlockAsItem(worldIn, blockpos1, worldIn.getBlockState(blockpos1), 0); -+ //With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. -+ float chance = block instanceof BlockSnow ? -1.0f : 1.0f; -+ block.dropBlockAsItemWithChance(worldIn, blockpos1, worldIn.getBlockState(blockpos1), chance, 0); - worldIn.setBlockToAir(blockpos1); - --i; - ablock[i] = block; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockPistonMoving.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockPistonMoving.java.patch.rej deleted file mode 100644 index e76f9ae9d..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockPistonMoving.java.patch.rej +++ /dev/null @@ -1,19 +0,0 @@ -++++ REJECTED PATCH 1 - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -- if (!worldIn.isRemote) -- { -- TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos); -- -- if (tileentitypiston != null) -- { -- IBlockState iblockstate1 = tileentitypiston.getPistonState(); -- iblockstate1.getBlock().dropBlockAsItem(worldIn, pos, iblockstate1, 0); -- } -- } -+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); - } - - public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockRailBase.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockRailBase.java.patch.rej deleted file mode 100644 index bbd669367..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockRailBase.java.patch.rej +++ /dev/null @@ -1,134 +0,0 @@ -++++ REJECTED PATCH 2 - } - - public abstract IProperty getShapeProperty(); -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * Return true if the rail can make corners. -+ * Used by placement logic. -+ * @param world The world. -+ * @param pod Block's position in world -+ * @return True if the rail can make corners. -+ */ -+ public boolean isFlexibleRail(IBlockAccess world, BlockPos pos) -+ { -+ return !this.isPowered; -+ } - -+ /** -+ * Returns true if the rail can make up and down slopes. -+ * Used by placement logic. -+ * @param world The world. -+ * @param pod Block's position in world -+ * @return True if the rail can make slopes. -+ */ -+ public boolean canMakeSlopes(IBlockAccess world, BlockPos pos) -+ { -+ return true; -+ } -+ -+ /** -+ * Returns the max speed of the rail at the specified position. -+ * @param world The world. -+ * @param cart The cart on the rail, may be null. -+ * @param pod Block's position in world -+ * @return The max speed of the current rail. -+ */ -+ public float getRailMaxSpeed(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos) -+ { -+ return 0.4f; -+ } -+ -+ /** -+ * This function is called by any minecart that passes over this rail. -+ * It is called once per update tick that the minecart is on the rail. -+ * @param world The world. -+ * @param cart The cart on the rail. -+ * @param pod Block's position in world -+ */ -+ public void onMinecartPass(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos) -+ { -+ } -+ -+ /** -+ * Rotate the block. For vanilla blocks this rotates around the axis passed in (generally, it should be the "face" that was hit). -+ * Note: for mod blocks, this is up to the block and modder to decide. It is not mandated that it be a rotation around the -+ * face, but could be a rotation to orient *to* that face, or a visiting of possible rotations. -+ * The method should return true if the rotation was successful though. -+ * -+ * @param world The world -+ * @param pos Block position in world -+ * @param axis The axis to rotate around -+ * @return True if the rotation was successful, False if the rotation failed, or is not possible -+ */ -+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) -+ { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) -+ { -+ if (prop.getName().equals("shape")) -+ { -+ world.setBlockState(pos, state.cycleProperty(prop)); -+ return true; -+ } -+ } -+ return false; -+ } -+ -+ /* ======================================== FORGE END =====================================*/ -+ - public static enum EnumRailDirection implements IStringSerializable - { - NORTH_SOUTH(0, "north_south"), -++++ END PATCH -++++ REJECTED PATCH 4 - this.state = state; - this.block = (BlockRailBase)state.getBlock(); - BlockRailBase.EnumRailDirection enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(BlockRailBase.this.getShapeProperty()); -- this.isPowered = this.block.isPowered; -+ this.isPowered = !this.block.isFlexibleRail(worldIn, pos); -+ canMakeSlopes = this.block.canMakeSlopes(worldIn, pos); - this.func_180360_a(enumraildirection); - } - -++++ END PATCH -++++ REJECTED PATCH 5 - } - } - -- if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) -+ if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) - { - if (BlockRailBase.isRailBlock(this.world, blockpos.up())) - { -++++ END PATCH -++++ REJECTED PATCH 6 - } - } - -- if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) -+ if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) - { - if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) - { -++++ END PATCH -++++ REJECTED PATCH 7 - } - } - -- if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) -+ if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) - { - if (BlockRailBase.isRailBlock(this.world, blockpos.up())) - { -++++ END PATCH -++++ REJECTED PATCH 8 - } - } - -- if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) -+ if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) - { - if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch.rej deleted file mode 100644 index 51dca115b..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - { - EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); - BlockPos blockpos1 = pos.offset(enumfacing.getOpposite()); -+ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldIn, pos, worldIn.getBlockState(pos), java.util.EnumSet.of(enumfacing.getOpposite())).isCanceled()) -+ return; - worldIn.notifyBlockOfStateChange(blockpos1, this); - worldIn.notifyNeighborsOfStateExcept(blockpos1, this, enumfacing); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch.rej deleted file mode 100644 index 98688e8d0..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch.rej +++ /dev/null @@ -1,21 +0,0 @@ -++++ REJECTED PATCH 1 - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -+ } - -- if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this)) -+ @Override -+ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ if (this.getItemDropped(world.getBlockState(pos), RANDOM, fortune) != Item.getItemFromBlock(this)) - { -- int j = 1 + worldIn.rand.nextInt(5); -- this.dropXpOnBlockBreak(worldIn, pos, j); -+ return 1 + RANDOM.nextInt(5); - } -+ return 0; - } - - @SideOnly(Side.CLIENT) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch.rej deleted file mode 100644 index cd65ac08d..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch.rej +++ /dev/null @@ -1,59 +0,0 @@ -++++ REJECTED PATCH 1 - BlockPos blockpos1 = pos.offset(direction); - Block block = worldIn.getBlockState(pos.offset(direction)).getBlock(); - -- if (!canConnectTo(worldIn.getBlockState(blockpos1), direction) && (block.isSolidFullCube() || !canConnectUpwardsTo(worldIn.getBlockState(blockpos1.down())))) -+ if (!canRestoneConnect(worldIn, blockpos1, direction) && (block.isSolidFullCube() || !canRestoneConnect(worldIn, blockpos1.down(), null))) - { - Block block1 = worldIn.getBlockState(pos.up()).getBlock(); -- return !block1.isSolidFullCube() && block.isSolidFullCube() && canConnectUpwardsTo(worldIn.getBlockState(blockpos1.up())) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; -+ return !block1.isSolidFullCube() && block.isSolidFullCube() && canRestoneConnect(worldIn, blockpos1.up(), null) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; - } - else - { -++++ END PATCH -++++ REJECTED PATCH 2 - Block block = iblockstate.getBlock(); - boolean flag = block.isNormalCube(); - boolean flag1 = worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); -- return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos1.up()) ? true : (canConnectTo(iblockstate, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos1.down()))); -+ return !flag1 && flag && canRestoneConnect(worldIn, blockpos1.up(), null) ? true : (canRestoneConnect(worldIn, blockpos1, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canRestoneConnect(worldIn, blockpos1.down(), null))); - } - -- protected static boolean canConnectUpwardsTo(IBlockAccess worldIn, BlockPos pos) -+ protected static boolean canRestoneConnect(IBlockAccess world, BlockPos pos, EnumFacing side) - { -- return canConnectUpwardsTo(worldIn.getBlockState(pos)); -- } -+ IBlockState state = world.getBlockState(pos); - -- protected static boolean canConnectUpwardsTo(IBlockState state) -- { -- return canConnectTo(state, (EnumFacing)null); -- } -- -- protected static boolean canConnectTo(IBlockState blockState, EnumFacing side) -- { -- Block block = blockState.getBlock(); -- -- if (block == Blocks.redstone_wire) -+ if (state.getBlock() == Blocks.redstone_wire) - { - return true; - } -- else if (Blocks.unpowered_repeater.isAssociated(block)) -+ else if (Blocks.unpowered_repeater.isAssociated(state.getBlock())) - { -- EnumFacing enumfacing1 = (EnumFacing)blockState.getValue(BlockRedstoneRepeater.FACING); -- return enumfacing1 == side || enumfacing1.getOpposite() == side; -+ EnumFacing direction = (EnumFacing)state.getValue(BlockRedstoneRepeater.FACING); -+ return direction == side || direction.getOpposite() == side; - } - else - { -- return block.canProvidePower() && side != null; -+ return state.getBlock().canConnectRedstone(world, pos, side); - } - } - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockSapling.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockSapling.java.patch.rej deleted file mode 100644 index 921d4a4e1..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockSapling.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 1 - - public void generateTree(World worldIn, BlockPos pos, IBlockState state, Random rand) - { -+ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(worldIn, rand, pos)) return; - Object object = rand.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true); - int i = 0; - int j = 0; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockSkull.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockSkull.java.patch.rej deleted file mode 100644 index b9f4f54a4..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockSkull.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - return tileentity instanceof TileEntitySkull ? ((TileEntitySkull)tileentity).getSkullType() : super.getDamageValue(worldIn, pos); - } - -- public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) {} -- - public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) - { - if (player.capabilities.isCreativeMode) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockSnow.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockSnow.java.patch.rej deleted file mode 100644 index be9e93d09..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockSnow.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - { - IBlockState iblockstate = worldIn.getBlockState(pos.down()); - Block block = iblockstate.getBlock(); -- return block != Blocks.ice && block != Blocks.packed_ice ? (block.getMaterial() == Material.leaves ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() == 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; -+ return block != Blocks.ice && block != Blocks.packed_ice ? (block.isLeaves(worldIn, pos.down()) ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() == 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; - } - - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockStem.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockStem.java.patch.rej deleted file mode 100644 index 1b9e859f1..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockStem.java.patch.rej +++ /dev/null @@ -1,18 +0,0 @@ -++++ REJECTED PATCH 3 - - for (int k = 0; k < 3; ++k) - { -- if (worldIn.rand.nextInt(15) <= j) -+ if (RANDOM.nextInt(15) <= j) - { -- spawnAsEntity(worldIn, pos, new ItemStack(item)); -+ ret.add(new ItemStack(item)); - } - } - } - } -+ return ret; - } - - protected Item getSeedItem() -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockTorch.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockTorch.java.patch.rej deleted file mode 100644 index 2fd87d504..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockTorch.java.patch.rej +++ /dev/null @@ -1,30 +0,0 @@ -++++ REJECTED PATCH 2 - { - BlockPos blockpos1 = pos.offset(facing.getOpposite()); - boolean flag = facing.getAxis().isHorizontal(); -- return flag && worldIn.isBlockNormalCube(blockpos1, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos1); -+ return flag && worldIn.isSideSolid(blockpos1, facing, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos1); - } - - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) -++++ END PATCH -++++ REJECTED PATCH 3 - - enumfacing1 = (EnumFacing)iterator.next(); - } -- while (!worldIn.isBlockNormalCube(pos.offset(enumfacing1.getOpposite()), true)); -+ while (!worldIn.isSideSolid(pos.offset(enumfacing1.getOpposite()), enumfacing1, true)); - - return this.getDefaultState().withProperty(FACING, enumfacing1); - } -++++ END PATCH -++++ REJECTED PATCH 4 - EnumFacing enumfacing1 = enumfacing.getOpposite(); - boolean flag = false; - -- if (axis.isHorizontal() && !worldIn.isBlockNormalCube(pos.offset(enumfacing1), true)) -+ if (axis.isHorizontal() && !worldIn.isSideSolid(pos.offset(enumfacing1), enumfacing1, true)) - { - flag = true; - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockTrapDoor.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockTrapDoor.java.patch.rej deleted file mode 100644 index 3b8cb207b..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockTrapDoor.java.patch.rej +++ /dev/null @@ -1,13 +0,0 @@ -++++ REJECTED PATCH 2 - { - if (!worldIn.isRemote) - { -+ EnumFacing direction = (EnumFacing)state.getValue(FACING); - BlockPos blockpos1 = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite()); - -- if (!isValidSupportBlock(worldIn.getBlockState(blockpos1).getBlock())) -+ if (!(isValidSupportBlock(worldIn.getBlockState(blockpos1).getBlock()) || worldIn.isSideSolid(blockpos1, direction, true))) - { - worldIn.setBlockToAir(pos); - this.dropBlockAsItem(worldIn, pos, state, 0); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockTripWireHook.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockTripWireHook.java.patch.rej deleted file mode 100644 index 94dd08182..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockTripWireHook.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 2 - - enumfacing = (EnumFacing)iterator.next(); - } -- while (!worldIn.getBlockState(pos.offset(enumfacing)).getBlock().isNormalCube()); -+ while (!worldIn.isSideSolid(pos.offset(enumfacing), enumfacing.getOpposite(), true)); - - return true; - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/BlockVine.java.patch.rej b/rejects/minecraft/net/minecraft/block/BlockVine.java.patch.rej deleted file mode 100644 index e891e578d..000000000 --- a/rejects/minecraft/net/minecraft/block/BlockVine.java.patch.rej +++ /dev/null @@ -1,18 +0,0 @@ -++++ REJECTED PATCH 3 - return i; - } - -+ /*************************FORGE START***********************************/ -+ @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity){ return true; } -+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } -+ @Override -+ public java.util.List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) -+ { -+ return java.util.Arrays.asList(new ItemStack(this, 1)); -+ } -+ /*************************FORGE END***********************************/ -+ - static final class SwitchEnumFacing - { - static final int[] FACING_LOOKUP = new int[EnumFacing.values().length]; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch.rej b/rejects/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch.rej deleted file mode 100644 index 6d2f2b55c..000000000 --- a/rejects/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 2 - BlockPos blockpos1 = origin.offset(this.moveDirection.getOpposite(), i); - block = this.world.getBlockState(blockpos1).getBlock(); - -- if (block.getMaterial() == Material.air || !BlockPistonBase.canPush(block, this.world, blockpos1, this.moveDirection, false) || blockpos1.equals(this.pistonPos)) -+ if (block.isAir(world, blockpos1)|| !BlockPistonBase.canPush(block, this.world, blockpos1, this.moveDirection, false) || blockpos1.equals(this.pistonPos)) - { - break; - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/block/state/BlockState.java.patch.rej b/rejects/minecraft/net/minecraft/block/state/BlockState.java.patch.rej deleted file mode 100644 index 2be016437..000000000 --- a/rejects/minecraft/net/minecraft/block/state/BlockState.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 2 - { - List list = (List)iterator.next(); - Map map = MapPopulator.createMap(this.properties, list); -- BlockState.StateImplementation stateimplementation = new BlockState.StateImplementation(blockIn, ImmutableMap.copyOf(map), null); -+ BlockState.StateImplementation stateimplementation = createState(blockIn, ImmutableMap.copyOf(map), unlistedProperties); - linkedhashmap.put(map, stateimplementation); - arraylist.add(stateimplementation); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch.rej deleted file mode 100644 index 6b6d1c44d..000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 1 - return new ModelResourceLocation(s + "_double_slab", s1); - } - }); -+ net.minecraftforge.client.model.ModelLoader.onRegisterAllBlocks(this); - } - - @SideOnly(Side.CLIENT) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch.rej b/rejects/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch.rej deleted file mode 100644 index a8730e054..000000000 --- a/rejects/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch.rej +++ /dev/null @@ -1,21 +0,0 @@ -++++ REJECTED PATCH 3 - while (iterator.hasNext()) - { - Item item = (Item)iterator.next(); -+ if (item == null) -+ { -+ continue; -+ } - -- if (item != null && item.getCreativeTab() == this) -+ for (CreativeTabs tab : item.getCreativeTabs()) - { -- item.getSubItems(item, this, p_78018_1_); -+ if (tab == this) -+ { -+ item.getSubItems(item, this, p_78018_1_); -+ } - } - } - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/init/Bootstrap.java.patch.rej b/rejects/minecraft/net/minecraft/init/Bootstrap.java.patch.rej deleted file mode 100644 index 5897ff274..000000000 --- a/rejects/minecraft/net/minecraft/init/Bootstrap.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 3 - } - } - }); -+ if (false){ //Forge: Removed, Fixes MC-75630 - Exploit with signs and command blocks - BlockDispenser.dispenseBehaviorRegistry.putObject(Item.getItemFromBlock(Blocks.command_block), new BehaviorDefaultDispenseItem() - { - private static final String __OBFID = "CL_00002276"; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch.rej b/rejects/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch.rej deleted file mode 100644 index dee299c5f..000000000 --- a/rejects/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch.rej +++ /dev/null @@ -1,11 +0,0 @@ -++++ REJECTED PATCH 1 - } - public boolean isItemValid(ItemStack stack) - { -- return stack == null ? false : (stack.getItem() instanceof ItemArmor ? ((ItemArmor)stack.getItem()).armorType == k : (stack.getItem() != Item.getItemFromBlock(Blocks.pumpkin) && stack.getItem() != Items.skull ? false : k == 0)); -+ if (stack == null) return false; -+ return stack.getItem().isValidArmor(stack, k, thePlayer); - } - @SideOnly(Side.CLIENT) - public String getSlotTexture() -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/inventory/ContainerRepair.java.patch.rej b/rejects/minecraft/net/minecraft/inventory/ContainerRepair.java.patch.rej deleted file mode 100644 index 26181b054..000000000 --- a/rejects/minecraft/net/minecraft/inventory/ContainerRepair.java.patch.rej +++ /dev/null @@ -1,20 +0,0 @@ -++++ REJECTED PATCH 3 - - if (itemstack2 != null) - { -+ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, outputSlot, repairedItemName, i2)) return; - flag7 = itemstack2.getItem() == Items.enchanted_book && Items.enchanted_book.getEnchantments(itemstack2).tagCount() > 0; - int k; - int l; -++++ END PATCH -++++ REJECTED PATCH 4 - { - int l1 = ((Integer)iterator.next()).intValue(); - -- if (l1 != l && !enchantment.canApplyTogether(Enchantment.getEnchantmentById(l1))) -+ Enchantment e2 = Enchantment.getEnchantmentById(l1); -+ if (l1 != l && !(enchantment.canApplyTogether(e2) && e2.canApplyTogether(enchantment))) //Forge BugFix: Let Both enchantments veto being together - { - flag8 = false; - ++i; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch.rej b/rejects/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch.rej deleted file mode 100644 index 1a76b2f19..000000000 --- a/rejects/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - - for (int i = 0; i < 4; ++i) - { -- this.lines[i] = buf.readChatComponent(); -+ this.lines[i] = IChatComponent.Serializer.jsonToComponent(buf.readStringFromBuffer(384)); - } - } - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch.rej b/rejects/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch.rej deleted file mode 100644 index c9c7d3934..000000000 --- a/rejects/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - int i1 = p_180624_2_.nextInt(16); - BlockPos blockpos1 = p_180624_3_.add(k, l, i1); - -- if (worldIn.getBlockState(blockpos1).getBlock() == Blocks.stone) -+ if (worldIn.getBlockState(blockpos1).getBlock().isReplaceableOreGen(worldIn, blockpos1, net.minecraft.block.state.pattern.BlockHelper.forBlock(Blocks.stone))) - { - worldIn.setBlockState(blockpos1, Blocks.emerald_ore.getDefaultState(), 2); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch.rej b/rejects/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch.rej deleted file mode 100644 index 911c315e6..000000000 --- a/rejects/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch.rej +++ /dev/null @@ -1,22 +0,0 @@ -++++ REJECTED PATCH 1 - File file1 = this.getWorldDirectory(); - File file2; - -- if (provider instanceof WorldProviderHell) -+ if (provider.getSaveFolder() != null) - { -- file2 = new File(file1, "DIM-1"); -+ file2 = new File(file1, provider.getSaveFolder()); - file2.mkdirs(); - return new AnvilChunkLoader(file2); - } -- else if (provider instanceof WorldProviderEnd) -- { -- file2 = new File(file1, "DIM1"); -- file2.mkdirs(); -- return new AnvilChunkLoader(file2); -- } - else - { - return new AnvilChunkLoader(file1); -++++ END PATCH From 13c7d038eb6c7bf40647331bb3f8fa66cd34c1b7 Mon Sep 17 00:00:00 2001 From: cpw Date: Wed, 11 Nov 2015 10:33:37 -0500 Subject: [PATCH 014/133] LoadingScreenRenderer,Minecraft,GuiContainerCreative,PlayerControllerMP,LanguageManager,Locale,SimpleReloadableResourceManager,EntityList,EntityLivingBase,EntityWither,EntityMinecart,EntityPlayerMP NethanlderPlayClient patch is now in vanilla. The FMLCommonHandler future exception catcher is not needed anymore, it's in Util. The caching of player profiles is now in vanilla (SkinManager). --- .../net/minecraft/block/Block.java.patch | 8 +- .../client/LoadingScreenRenderer.java.patch | 13 + .../net/minecraft/client/Minecraft.java.patch | 233 ++++++++++++++++- .../inventory/GuiContainerCreative.java.patch | 171 ++++++++++++- .../multiplayer/PlayerControllerMP.java.patch | 21 ++ .../client/network/OldServerPinger.java.patch | 10 + .../resources/LanguageManager.java.patch | 10 + .../client/resources/Locale.java.patch | 11 + ...SimpleReloadableResourceManager.java.patch | 23 +- .../minecraft/entity/EntityList.java.patch | 18 +- .../entity/EntityLivingBase.java.patch | 55 +++- .../entity/boss/EntityWither.java.patch | 11 + .../entity/item/EntityMinecart.java.patch | 83 +++++- .../entity/player/EntityPlayerMP.java.patch | 32 ++- .../LoadingScreenRenderer.java.patch.rej | 14 - .../minecraft/client/Minecraft.java.patch.rej | 240 ------------------ .../GuiContainerCreative.java.patch.rej | 171 ------------- .../PlayerControllerMP.java.patch.rej | 23 -- .../NetHandlerPlayClient.java.patch.rej | 11 - .../network/OldServerPinger.java.patch.rej | 9 - .../resources/LanguageManager.java.patch.rej | 9 - .../client/resources/Locale.java.patch.rej | 10 - .../resources/SkinManager.java.patch.rej | 12 - .../entity/EntityList.java.patch.rej | 13 - .../entity/EntityLivingBase.java.patch.rej | 30 --- .../entity/boss/EntityWither.java.patch.rej | 10 - .../entity/item/EntityMinecart.java.patch.rej | 68 ----- .../player/EntityPlayerMP.java.patch.rej | 29 --- .../net/minecraftforge/common/ForgeHooks.java | 130 ++++++++++ 29 files changed, 767 insertions(+), 711 deletions(-) create mode 100644 patches/minecraft/net/minecraft/client/network/OldServerPinger.java.patch create mode 100644 patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch create mode 100644 patches/minecraft/net/minecraft/client/resources/Locale.java.patch rename rejects/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch.rej => patches/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch (75%) create mode 100644 patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch delete mode 100644 rejects/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/Minecraft.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/network/OldServerPinger.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/resources/LanguageManager.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/resources/Locale.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/resources/SkinManager.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/EntityList.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/EntityLivingBase.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/boss/EntityWither.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch.rej diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 91a1c1d28..10500041a 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -179,7 +179,7 @@ } protected ItemStack createStackedBlock(IBlockState state) -@@ -1015,6 +1035,1033 @@ +@@ -1015,6 +1035,1029 @@ return "Block{" + blockRegistry.getNameForObject(this) + "}"; } @@ -939,11 +939,7 @@ + */ + public boolean canEntityDestroy(IBlockAccess world, BlockPos pos, Entity entity) + { -+ if (entity instanceof net.minecraft.entity.boss.EntityWither) -+ { -+ return this != net.minecraft.init.Blocks.barrier && this != net.minecraft.init.Blocks.bedrock && this != net.minecraft.init.Blocks.end_portal && this != net.minecraft.init.Blocks.end_portal_frame && this != net.minecraft.init.Blocks.command_block; -+ } -+ else if (entity instanceof net.minecraft.entity.boss.EntityDragon) ++ if (entity instanceof net.minecraft.entity.boss.EntityDragon) + { + return this != net.minecraft.init.Blocks.barrier && this != net.minecraft.init.Blocks.obsidian && this != net.minecraft.init.Blocks.end_stone && this != net.minecraft.init.Blocks.bedrock && this != net.minecraft.init.Blocks.command_block; + } diff --git a/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch b/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch index 7afa2924d..04b3e0e54 100644 --- a/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch @@ -11,3 +11,16 @@ Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); this.mc.getTextureManager().bindTexture(Gui.optionsBackground); +@@ -175,6 +179,12 @@ + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + this.mc.fontRendererObj.drawStringWithShadow(this.currentlyDisplayedText, (float)((k - this.mc.fontRendererObj.getStringWidth(this.currentlyDisplayedText)) / 2), (float)(l / 2 - 4 - 16), 16777215); + this.mc.fontRendererObj.drawStringWithShadow(this.message, (float)((k - this.mc.fontRendererObj.getStringWidth(this.message)) / 2), (float)(l / 2 - 4 + 8), 16777215); ++ } ++ } ++ catch (java.io.IOException e) ++ { ++ com.google.common.base.Throwables.propagate(e); ++ } //FML End + this.framebuffer.unbindFramebuffer(); + + if (OpenGlHelper.isFramebufferEnabled()) diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 65b28301f..9287061d8 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -139,7 +139,19 @@ if (guiScreenIn instanceof GuiMainMenu) { this.gameSettings.showDebugInfo = false; -@@ -1380,7 +1396,7 @@ +@@ -1033,9 +1049,11 @@ + + if (!this.skipRenderWorld) + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickStart(this.timer.renderPartialTicks); + this.mcProfiler.endStartSection("gameRenderer"); + this.entityRenderer.func_181560_a(this.timer.renderPartialTicks, i); + this.mcProfiler.endSection(); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickEnd(this.timer.renderPartialTicks); + } + + this.mcProfiler.endSection(); +@@ -1380,7 +1398,7 @@ if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air && this.playerController.func_180512_c(blockpos, this.objectMouseOver.sideHit)) { @@ -148,7 +160,38 @@ this.thePlayer.swingItem(); } } -@@ -1601,6 +1617,8 @@ +@@ -1466,15 +1484,19 @@ + case BLOCK: + BlockPos blockpos = this.objectMouseOver.getBlockPos(); + +- if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air) ++ if (!this.theWorld.isAirBlock(blockpos)) + { + int i = itemstack != null ? itemstack.stackSize : 0; + ++ ++ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, this.theWorld, blockpos, this.objectMouseOver.sideHit).isCanceled(); ++ if (result) { //Forge: Kept separate to simplify patch + if (this.playerController.func_178890_a(this.thePlayer, this.theWorld, itemstack, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec)) + { + flag = false; + this.thePlayer.swingItem(); + } ++ } + + if (itemstack == null) + { +@@ -1497,7 +1519,8 @@ + { + ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem(); + +- if (itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) ++ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, theWorld, null, null).isCanceled(); ++ if (result && itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) + { + this.entityRenderer.itemRenderer.resetEquippedProgress2(); + } +@@ -1601,6 +1624,8 @@ --this.rightClickDelayTimer; } @@ -157,7 +200,16 @@ this.mcProfiler.startSection("gui"); if (!this.isGamePaused) -@@ -1750,6 +1768,7 @@ +@@ -1695,6 +1720,8 @@ + + while (Mouse.next()) + { ++ if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue; ++ + int i = Mouse.getEventButton(); + KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState()); + +@@ -1750,6 +1777,7 @@ this.currentScreen.handleMouseInput(); } } @@ -165,7 +217,7 @@ } if (this.leftClickCounter > 0) -@@ -1928,6 +1947,7 @@ +@@ -1928,6 +1956,7 @@ } } } @@ -173,7 +225,7 @@ } for (int l = 0; l < 9; ++l) -@@ -2124,12 +2144,15 @@ +@@ -2124,12 +2153,15 @@ this.myNetworkManager.processReceivedPackets(); } @@ -189,7 +241,20 @@ this.loadWorld((WorldClient)null); System.gc(); ISaveHandler isavehandler = this.saveLoader.getSaveLoader(folderName, false); -@@ -2190,8 +2213,14 @@ +@@ -2165,6 +2197,12 @@ + + while (!this.theIntegratedServer.serverIsInRunLoop()) + { ++ if (!net.minecraftforge.fml.common.StartupQuery.check()) ++ { ++ loadWorld(null); ++ displayGuiScreen(null); ++ return; ++ } + String s = this.theIntegratedServer.getUserMessage(); + + if (s != null) +@@ -2190,8 +2228,14 @@ SocketAddress socketaddress = this.theIntegratedServer.getNetworkSystem().addLocalEndpoint(); NetworkManager networkmanager = NetworkManager.provideLocalClient(socketaddress); networkmanager.setNetHandler(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null)); @@ -206,7 +271,7 @@ this.myNetworkManager = networkmanager; } -@@ -2202,6 +2231,8 @@ +@@ -2202,6 +2246,8 @@ public void loadWorld(WorldClient worldClientIn, String loadingMessage) { @@ -215,7 +280,7 @@ if (worldClientIn == null) { NetHandlerPlayClient nethandlerplayclient = this.getNetHandler(); -@@ -2215,6 +2246,18 @@ +@@ -2215,6 +2261,18 @@ { this.theIntegratedServer.initiateShutdown(); this.theIntegratedServer.setStaticInstance(); @@ -234,7 +299,7 @@ } this.theIntegratedServer = null; -@@ -2237,6 +2280,7 @@ +@@ -2237,6 +2295,7 @@ this.ingameGUI.func_181029_i(); this.setServerData((ServerData)null); this.integratedServerIsRunning = false; @@ -242,3 +307,153 @@ } this.mcSoundHandler.stopSounds(); +@@ -2341,126 +2400,10 @@ + if (this.objectMouseOver != null) + { + boolean flag = this.thePlayer.capabilities.isCreativeMode; +- int i = 0; +- boolean flag1 = false; +- TileEntity tileentity = null; +- Item item; +- +- if (this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) +- { +- BlockPos blockpos = this.objectMouseOver.getBlockPos(); +- Block block = this.theWorld.getBlockState(blockpos).getBlock(); +- +- if (block.getMaterial() == Material.air) +- { +- return; +- } +- +- item = block.getItem(this.theWorld, blockpos); +- +- if (item == null) +- { +- return; +- } +- +- if (flag && GuiScreen.isCtrlKeyDown()) +- { +- tileentity = this.theWorld.getTileEntity(blockpos); +- } +- +- Block block1 = item instanceof ItemBlock && !block.isFlowerPot() ? Block.getBlockFromItem(item) : block; +- i = block1.getDamageValue(this.theWorld, blockpos); +- flag1 = item.getHasSubtypes(); +- } +- else +- { +- if (this.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !flag) +- { +- return; +- } +- +- if (this.objectMouseOver.entityHit instanceof EntityPainting) +- { +- item = Items.painting; +- } +- else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot) +- { +- item = Items.lead; +- } +- else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) +- { +- EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit; +- ItemStack itemstack = entityitemframe.getDisplayedItem(); +- +- if (itemstack == null) +- { +- item = Items.item_frame; +- } +- else +- { +- item = itemstack.getItem(); +- i = itemstack.getMetadata(); +- flag1 = true; +- } +- } +- else if (this.objectMouseOver.entityHit instanceof EntityMinecart) +- { +- EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit; +- +- switch (entityminecart.getMinecartType()) +- { +- case FURNACE: +- item = Items.furnace_minecart; +- break; +- case CHEST: +- item = Items.chest_minecart; +- break; +- case TNT: +- item = Items.tnt_minecart; +- break; +- case HOPPER: +- item = Items.hopper_minecart; +- break; +- case COMMAND_BLOCK: +- item = Items.command_block_minecart; +- break; +- default: +- item = Items.minecart; +- } +- } +- else if (this.objectMouseOver.entityHit instanceof EntityBoat) +- { +- item = Items.boat; +- } +- else if (this.objectMouseOver.entityHit instanceof EntityArmorStand) +- { +- item = Items.armor_stand; +- } +- else +- { +- item = Items.spawn_egg; +- i = EntityList.getEntityID(this.objectMouseOver.entityHit); +- flag1 = true; +- +- if (!EntityList.entityEggs.containsKey(Integer.valueOf(i))) +- { +- return; +- } +- } +- } +- + InventoryPlayer inventoryplayer = this.thePlayer.inventory; + +- if (tileentity == null) +- { +- inventoryplayer.setCurrentItem(item, i, flag1, flag); +- } +- else +- { +- ItemStack itemstack1 = this.func_181036_a(item, i, tileentity); +- inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, itemstack1); +- } +- ++ if (!net.minecraftforge.common.ForgeHooks.onPickBlock(this.objectMouseOver, this.thePlayer, this.theWorld)) return; ++ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions + if (flag) + { + int j = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + inventoryplayer.currentItem; +@@ -2773,18 +2716,8 @@ + + public static int getGLMaximumTextureSize() + { +- for (int i = 16384; i > 0; i >>= 1) +- { +- GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)((ByteBuffer)null)); +- int j = GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); +- +- if (j != 0) +- { +- return i; +- } +- } +- +- return -1; ++ //Forge we redirect this to our code which caches the value before any splash screen stuff is done. ++ return net.minecraftforge.fml.client.SplashProgress.getMaxTextureSize(); + } + + public boolean isSnooperEnabled() diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch index 782f2ce93..89e9b7caa 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch @@ -9,6 +9,15 @@ public GuiContainerCreative(EntityPlayer p_i1088_1_) { +@@ -176,7 +178,7 @@ + return; + } + +- if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2)) ++ if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2) && ItemStack.areItemStackTagsEqual(itemstack1, itemstack2)) //Forge: Bugfix, Compare NBT data, allow for deletion of enchanted books, MC-12770 + { + if (clickedButton == 0) + { @@ -260,6 +262,13 @@ this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[i]); this.field_147059_E = new CreativeCrafting(this.mc); @@ -32,7 +41,44 @@ { if (GameSettings.isKeyDown(this.mc.gameSettings.keyBindChat)) { -@@ -366,7 +375,7 @@ +@@ -319,6 +328,14 @@ + GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; + guicontainercreative$containercreative.itemList.clear(); + ++ CreativeTabs tab = CreativeTabs.creativeTabArray[selectedTabIndex]; ++ if (tab.hasSearchBar() && tab != CreativeTabs.tabAllSearch) ++ { ++ tab.displayAllReleventItems(guicontainercreative$containercreative.itemList); ++ updateFilteredItems(guicontainercreative$containercreative); ++ return; ++ } ++ + for (Item item : Item.itemRegistry) + { + if (item != null && item.getCreativeTab() != null) +@@ -326,7 +343,13 @@ + item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList); + } + } ++ updateFilteredItems(guicontainercreative$containercreative); ++ } + ++ //split from above for custom search tabs ++ private void updateFilteredItems(GuiContainerCreative.ContainerCreative guicontainercreative$containercreative) ++ { ++ if (CreativeTabs.creativeTabArray[selectedTabIndex] == CreativeTabs.tabAllSearch) // FORGE: Only add enchanted books to the regular search + for (Enchantment enchantment : Enchantment.enchantmentsBookList) + { + if (enchantment != null && enchantment.type != null) +@@ -334,7 +357,6 @@ + Items.enchanted_book.getAll(enchantment, guicontainercreative$containercreative.itemList); + } + } +- + Iterator iterator = guicontainercreative$containercreative.itemList.iterator(); + String s1 = this.searchField.getText().toLowerCase(); + +@@ -366,7 +388,7 @@ { CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; @@ -41,7 +87,16 @@ { GlStateManager.disableBlend(); this.fontRendererObj.drawString(I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]), 8, 6, 4210752); -@@ -414,11 +423,13 @@ +@@ -401,7 +423,7 @@ + + for (CreativeTabs creativetabs : CreativeTabs.creativeTabArray) + { +- if (this.func_147049_a(creativetabs, i, j)) ++ if (creativetabs != null && this.func_147049_a(creativetabs, i, j)) + { + this.setCurrentCreativeTab(creativetabs); + return; +@@ -414,11 +436,13 @@ private boolean needsScrollBars() { @@ -55,7 +110,7 @@ int i = selectedTabIndex; selectedTabIndex = p_147050_1_.getTabIndex(); GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; -@@ -484,12 +495,14 @@ +@@ -484,12 +508,14 @@ if (this.searchField != null) { @@ -71,7 +126,89 @@ this.updateCreativeSearch(); } else -@@ -658,6 +671,14 @@ +@@ -559,20 +585,43 @@ + } + + super.drawScreen(mouseX, mouseY, partialTicks); ++ int start = tabPage * 10; ++ int end = Math.min(CreativeTabs.creativeTabArray.length, ((tabPage + 1) * 10) + 2); ++ if (tabPage != 0) start += 2; ++ boolean rendered = false; + +- for (CreativeTabs creativetabs : CreativeTabs.creativeTabArray) ++ for (CreativeTabs creativetabs : java.util.Arrays.copyOfRange(CreativeTabs.creativeTabArray,start,end)) + { ++ if (creativetabs == null) continue; + if (this.renderCreativeInventoryHoveringText(creativetabs, mouseX, mouseY)) + { ++ rendered = true; + break; + } + } + ++ if (!rendered && renderCreativeInventoryHoveringText(CreativeTabs.tabAllSearch, mouseX, mouseY)) ++ { ++ renderCreativeInventoryHoveringText(CreativeTabs.tabInventory, mouseX, mouseY); ++ } ++ + if (this.field_147064_C != null && selectedTabIndex == CreativeTabs.tabInventory.getTabIndex() && this.isPointInRegion(this.field_147064_C.xDisplayPosition, this.field_147064_C.yDisplayPosition, 16, 16, mouseX, mouseY)) + { + this.drawCreativeTabHoveringText(I18n.format("inventory.binSlot", new Object[0]), mouseX, mouseY); + } + ++ if (maxPages != 0) ++ { ++ String page = String.format("%d / %d", tabPage + 1, maxPages + 1); ++ int width = fontRendererObj.getStringWidth(page); ++ GlStateManager.disableLighting(); ++ this.zLevel = 300.0F; ++ itemRender.zLevel = 300.0F; ++ fontRendererObj.drawString(page, guiLeft + (xSize / 2) - (width / 2), guiTop - 44, -1); ++ this.zLevel = 0.0F; ++ itemRender.zLevel = 0.0F; ++ } ++ + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableLighting(); + } +@@ -634,16 +683,35 @@ + RenderHelper.enableGUIStandardItemLighting(); + CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; + +- for (CreativeTabs creativetabs1 : CreativeTabs.creativeTabArray) ++ int start = tabPage * 10; ++ int end = Math.min(CreativeTabs.creativeTabArray.length, ((tabPage + 1) * 10 + 2)); ++ if (tabPage != 0) start += 2; ++ ++ for (CreativeTabs creativetabs1 : java.util.Arrays.copyOfRange(CreativeTabs.creativeTabArray,start,end)) + { + this.mc.getTextureManager().bindTexture(creativeInventoryTabs); + ++ if (creativetabs1 == null) continue; + if (creativetabs1.getTabIndex() != selectedTabIndex) + { + this.func_147051_a(creativetabs1); + } + } + ++ if (tabPage != 0) ++ { ++ if (creativetabs != CreativeTabs.tabAllSearch) ++ { ++ this.mc.getTextureManager().bindTexture(creativeInventoryTabs); ++ func_147051_a(CreativeTabs.tabAllSearch); ++ } ++ if (creativetabs != CreativeTabs.tabInventory) ++ { ++ this.mc.getTextureManager().bindTexture(creativeInventoryTabs); ++ func_147051_a(CreativeTabs.tabInventory); ++ } ++ } ++ + this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.getBackgroundImageName())); + this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); + this.searchField.drawTextBox(); +@@ -658,6 +726,14 @@ this.drawTexturedModalRect(i, j + (int)((float)(k - j - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15); } @@ -86,7 +223,31 @@ this.func_147051_a(creativetabs); if (creativetabs == CreativeTabs.tabInventory) -@@ -790,6 +811,15 @@ +@@ -668,6 +744,14 @@ + + protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_) + { ++ if (p_147049_1_.getTabPage() != tabPage) ++ { ++ if (p_147049_1_ != CreativeTabs.tabAllSearch && p_147049_1_ != CreativeTabs.tabInventory) ++ { ++ return false; ++ } ++ } ++ + int i = p_147049_1_.getTabColumn(); + int j = 28 * i; + int k = 0; +@@ -764,6 +848,8 @@ + } + + GlStateManager.disableLighting(); ++ GlStateManager.color(1F, 1F, 1F); //Forge: Reset color in case Items change it. ++ GlStateManager.enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border. + this.drawTexturedModalRect(l, i1, j, k, 28, j1); + this.zLevel = 100.0F; + this.itemRender.zLevel = 100.0F; +@@ -790,6 +876,15 @@ { this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter())); } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch index 2b34255d9..64893d581 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch @@ -13,6 +13,15 @@ if (this.currentGameType.isCreative() && this.mc.thePlayer.getHeldItem() != null && this.mc.thePlayer.getHeldItem().getItem() instanceof ItemSword) { return false; +@@ -129,7 +135,7 @@ + else + { + world.playAuxSFX(2001, pos, Block.getStateId(iblockstate)); +- boolean flag = world.setBlockToAir(pos); ++ boolean flag = block1.removedByPlayer(world, pos, mc.thePlayer, false); + + if (flag) + { @@ -357,11 +363,19 @@ { if (this.currentGameType != WorldSettings.GameType.SPECTATOR) @@ -46,3 +55,15 @@ } } else +@@ -421,9 +437,10 @@ + { + playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = itemstack; + +- if (itemstack.stackSize == 0) ++ if (itemstack.stackSize <= 0) + { + playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = null; ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(playerIn, itemstack); + } + + return true; diff --git a/patches/minecraft/net/minecraft/client/network/OldServerPinger.java.patch b/patches/minecraft/net/minecraft/client/network/OldServerPinger.java.patch new file mode 100644 index 000000000..ffc495966 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/network/OldServerPinger.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/network/OldServerPinger.java ++++ ../src-work/minecraft/net/minecraft/client/network/OldServerPinger.java +@@ -152,6 +152,7 @@ + server.setBase64EncodedIconData((String)null); + } + ++ net.minecraftforge.fml.client.FMLClientHandler.instance().bindServerListData(server, serverstatusresponse); + this.field_175092_e = Minecraft.getSystemTime(); + networkmanager.sendPacket(new C01PacketPing(this.field_175092_e)); + this.field_147403_d = true; diff --git a/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch b/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch new file mode 100644 index 000000000..65bab8982 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/LanguageManager.java ++++ ../src-work/minecraft/net/minecraft/client/resources/LanguageManager.java +@@ -74,6 +74,7 @@ + } + + currentLocale.loadLocaleDataFiles(resourceManager, list); ++ net.minecraftforge.fml.common.registry.LanguageRegistry.instance().mergeLanguageTable(currentLocale.properties, this.currentLanguage); + StringTranslate.replaceWith(currentLocale.properties); + } + diff --git a/patches/minecraft/net/minecraft/client/resources/Locale.java.patch b/patches/minecraft/net/minecraft/client/resources/Locale.java.patch new file mode 100644 index 000000000..874f7383f --- /dev/null +++ b/patches/minecraft/net/minecraft/client/resources/Locale.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/resources/Locale.java ++++ ../src-work/minecraft/net/minecraft/client/resources/Locale.java +@@ -96,6 +96,8 @@ + + private void loadLocaleData(InputStream p_135021_1_) throws IOException + { ++ p_135021_1_ = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(properties, p_135021_1_); ++ if (p_135021_1_ == null) return; + for (String s : IOUtils.readLines(p_135021_1_, Charsets.UTF_8)) + { + if (!s.isEmpty() && s.charAt(0) != 35) diff --git a/rejects/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch.rej b/patches/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch similarity index 75% rename from rejects/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch.rej rename to patches/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch index ba37e2416..66047fe57 100644 --- a/rejects/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch.rej +++ b/patches/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch @@ -1,16 +1,17 @@ -++++ REJECTED PATCH 1 - public void reloadResources(List p_110541_1_) +--- ../src-base/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java ++++ ../src-work/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java +@@ -93,6 +93,7 @@ + public void reloadResources(List p_110541_1_) { this.clearResources(); + net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Loading Resources", p_110541_1_.size()+1, true); - logger.info("Reloading ResourceManager: " + joinerResourcePacks.join(Iterables.transform(p_110541_1_, new Function() + logger.info("Reloading ResourceManager: " + joinerResourcePacks.join(Iterables.transform(p_110541_1_, new Function() { private static final String __OBFID = "CL_00001092"; -++++ END PATCH -++++ REJECTED PATCH 2 - while (iterator.hasNext()) +@@ -104,23 +105,32 @@ + + for (IResourcePack iresourcepack : p_110541_1_) { - IResourcePack iresourcepack = (IResourcePack)iterator.next(); + resReload.step(iresourcepack.getPackName()); this.reloadResourcePack(iresourcepack); } @@ -22,25 +23,21 @@ public void registerReloadListener(IResourceManagerReloadListener p_110542_1_) { - this.reloadListeners.add(p_110542_1_); + net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Loading Resource", 1); + resReload.step(p_110542_1_.getClass()); + this.reloadListeners.add(p_110542_1_); p_110542_1_.onResourceManagerReload(this); + net.minecraftforge.fml.common.ProgressManager.pop(resReload); } private void notifyReloadListeners() { - Iterator iterator = this.reloadListeners.iterator(); - + net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Reloading", this.reloadListeners.size()); - while (iterator.hasNext()) + for (IResourceManagerReloadListener iresourcemanagerreloadlistener : this.reloadListeners) { - IResourceManagerReloadListener iresourcemanagerreloadlistener = (IResourceManagerReloadListener)iterator.next(); + resReload.step(iresourcemanagerreloadlistener.getClass()); iresourcemanagerreloadlistener.onResourceManagerReload(this); } + net.minecraftforge.fml.common.ProgressManager.pop(resReload); } } -++++ END PATCH diff --git a/patches/minecraft/net/minecraft/entity/EntityList.java.patch b/patches/minecraft/net/minecraft/entity/EntityList.java.patch index de360280c..2aacbb3d6 100644 --- a/patches/minecraft/net/minecraft/entity/EntityList.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityList.java.patch @@ -8,7 +8,19 @@ if (stringToClassMapping.containsKey(p_75618_1_)) { throw new IllegalArgumentException("ID is already registered: " + p_75618_1_); -@@ -168,7 +169,17 @@ +@@ -152,9 +153,10 @@ + p_75615_0_.removeTag("Type"); + } + ++ Class oclass = null; + try + { +- Class oclass = (Class)stringToClassMapping.get(p_75615_0_.getString("id")); ++ oclass = stringToClassMapping.get(p_75615_0_.getString("id")); + + if (oclass != null) + { +@@ -168,7 +170,17 @@ if (entity != null) { @@ -26,7 +38,7 @@ } else { -@@ -344,7 +355,9 @@ +@@ -344,7 +356,9 @@ public static class EntityEggInfo { @@ -36,7 +48,7 @@ public final int primaryColor; public final int secondaryColor; public final StatBase field_151512_d; -@@ -358,6 +371,17 @@ +@@ -358,6 +372,17 @@ this.secondaryColor = p_i1583_3_; this.field_151512_d = StatList.getStatKillEntity(this); this.field_151513_e = StatList.getStatEntityKilledBy(this); diff --git a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch index 58a52ac43..e4ac69354 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -1,5 +1,23 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java +++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java +@@ -238,7 +238,7 @@ + } + } + +- if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity instanceof EntityLivingBase) ++ if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity != null && ridingEntity.shouldDismountInWater(this)) + { + this.mountEntity((Entity)null); + } +@@ -320,7 +320,7 @@ + if (!this.worldObj.isRemote && (this.recentlyHit > 0 || this.isPlayer()) && this.func_146066_aG() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) + { + int i = this.getExperiencePoints(this.attackingPlayer); +- ++ i = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.attackingPlayer, i); + while (i > 0) + { + int j = EntityXPOrb.getXPSplit(i); @@ -381,6 +381,7 @@ { this.entityLivingToAttack = livingBase; @@ -16,7 +34,16 @@ public void removePotionEffectClient(int p_70618_1_) { this.activePotionsMap.remove(Integer.valueOf(p_70618_1_)); -@@ -733,6 +733,7 @@ +@@ -713,6 +713,8 @@ + + public void heal(float healAmount) + { ++ healAmount = net.minecraftforge.event.ForgeEventFactory.onLivingHeal(this, healAmount); ++ if (healAmount <= 0) return; + float f = this.getHealth(); + + if (f > 0.0F) +@@ -733,6 +735,7 @@ public boolean attackEntityFrom(DamageSource source, float amount) { @@ -24,7 +51,7 @@ if (this.isEntityInvulnerable(source)) { return false; -@@ -798,9 +799,9 @@ +@@ -798,9 +801,9 @@ this.recentlyHit = 100; this.attackingPlayer = (EntityPlayer)entity; } @@ -36,7 +63,7 @@ if (entitywolf.isTamed()) { -@@ -884,6 +885,7 @@ +@@ -884,6 +887,7 @@ public void onDeath(DamageSource cause) { @@ -44,7 +71,7 @@ Entity entity = cause.getEntity(); EntityLivingBase entitylivingbase = this.func_94060_bK(); -@@ -909,6 +911,9 @@ +@@ -909,6 +913,9 @@ i = EnchantmentHelper.getLootingModifier((EntityLivingBase)entity); } @@ -54,7 +81,7 @@ if (this.func_146066_aG() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) { this.dropFewItems(this.recentlyHit > 0, i); -@@ -919,6 +924,16 @@ +@@ -919,6 +926,16 @@ this.addRandomArmor(); } } @@ -71,7 +98,7 @@ } this.worldObj.setEntityState(this, (byte)3); -@@ -973,7 +988,7 @@ +@@ -973,7 +990,7 @@ int j = MathHelper.floor_double(this.getEntityBoundingBox().minY); int k = MathHelper.floor_double(this.posZ); Block block = this.worldObj.getBlockState(new BlockPos(i, j, k)).getBlock(); @@ -80,7 +107,7 @@ } public boolean isEntityAlive() -@@ -983,6 +998,9 @@ +@@ -983,6 +1000,9 @@ public void fall(float distance, float damageMultiplier) { @@ -90,7 +117,7 @@ super.fall(distance, damageMultiplier); PotionEffect potioneffect = this.getActivePotionEffect(Potion.jump); float f = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F; -@@ -1095,6 +1113,8 @@ +@@ -1095,6 +1115,8 @@ { if (!this.isEntityInvulnerable(damageSrc)) { @@ -99,7 +126,7 @@ damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); float f = damageAmount; -@@ -1143,6 +1163,11 @@ +@@ -1143,6 +1165,11 @@ public void swingItem() { @@ -111,7 +138,7 @@ if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0) { this.swingProgressInt = -1; -@@ -1282,6 +1307,7 @@ +@@ -1282,6 +1309,7 @@ public void dismountEntity(Entity p_110145_1_) { @@ -119,7 +146,7 @@ double d0 = p_110145_1_.posX; double d1 = p_110145_1_.getEntityBoundingBox().minY + (double)p_110145_1_.height; double d2 = p_110145_1_.posZ; -@@ -1347,6 +1373,7 @@ +@@ -1347,6 +1375,7 @@ } this.isAirBorne = true; @@ -127,7 +154,7 @@ } protected void updateAITick() -@@ -1531,6 +1558,7 @@ +@@ -1531,6 +1560,7 @@ public void onUpdate() { @@ -135,7 +162,7 @@ super.onUpdate(); if (!this.worldObj.isRemote) -@@ -1819,6 +1847,7 @@ +@@ -1819,6 +1849,7 @@ public void mountEntity(Entity entityIn) { @@ -143,7 +170,7 @@ if (this.ridingEntity != null && entityIn == null) { if (!this.worldObj.isRemote) -@@ -2000,4 +2029,39 @@ +@@ -2000,4 +2031,39 @@ { this.potionsNeedUpdate = true; } diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch new file mode 100644 index 000000000..9cc66593e --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/entity/boss/EntityWither.java ++++ ../src-work/minecraft/net/minecraft/entity/boss/EntityWither.java +@@ -345,7 +345,7 @@ + BlockPos blockpos = new BlockPos(i3, k, l); + Block block = this.worldObj.getBlockState(blockpos).getBlock(); + +- if (block.getMaterial() != Material.air && func_181033_a(block)) ++ if (!block.isAir(worldObj,blockpos) && func_181033_a(block) && block.canEntityDestroy(worldObj, blockpos, this)) + { + flag = this.worldObj.destroyBlock(blockpos, true) || flag; + } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch index b63ce4387..b3961469a 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch @@ -51,7 +51,19 @@ { this.func_180460_a(blockpos, iblockstate); -@@ -368,6 +384,7 @@ +@@ -349,7 +365,10 @@ + + this.setRotation(this.rotationYaw, this.rotationPitch); + +- for (Entity entity : this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D))) ++ AxisAlignedBB box; ++ if (getCollisionHandler() != null) box = getCollisionHandler().getMinecartCollisionBox(this); ++ else box = this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D); ++ for (Entity entity : this.worldObj.getEntitiesWithinAABBExcludingEntity(this, box)) + { + if (entity != this.riddenByEntity && entity.canBePushed() && entity instanceof EntityMinecart) + { +@@ -368,6 +387,7 @@ } this.handleWaterMovement(); @@ -59,7 +71,7 @@ } } -@@ -382,10 +399,21 @@ +@@ -382,10 +402,21 @@ protected void moveDerailedMinecart() { @@ -82,7 +94,7 @@ if (this.onGround) { this.motionX *= 0.5D; -@@ -393,13 +421,13 @@ +@@ -393,13 +424,13 @@ this.motionZ *= 0.5D; } @@ -100,7 +112,38 @@ } } -@@ -482,7 +510,7 @@ +@@ -419,25 +450,25 @@ + flag1 = !flag; + } + +- double d0 = 0.0078125D; ++ double slopeAdjustment = getSlopeAdjustment(); + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)p_180460_2_.getValue(blockrailbase.getShapeProperty()); + + switch (blockrailbase$enumraildirection) + { + case ASCENDING_EAST: +- this.motionX -= 0.0078125D; ++ this.motionX -= slopeAdjustment; + ++this.posY; + break; + case ASCENDING_WEST: +- this.motionX += 0.0078125D; ++ this.motionX += slopeAdjustment; + ++this.posY; + break; + case ASCENDING_NORTH: +- this.motionZ += 0.0078125D; ++ this.motionZ += slopeAdjustment; + ++this.posY; + break; + case ASCENDING_SOUTH: +- this.motionZ -= 0.0078125D; ++ this.motionZ -= slopeAdjustment; + ++this.posY; + } + +@@ -482,7 +513,7 @@ } } @@ -109,7 +152,29 @@ { double d17 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); -@@ -578,8 +606,14 @@ +@@ -528,20 +559,8 @@ + this.posX = d19 + d1 * d18; + this.posZ = d20 + d2 * d18; + this.setPosition(this.posX, this.posY, this.posZ); +- double d22 = this.motionX; +- double d23 = this.motionZ; ++ this.moveMinecartOnRail(p_180460_1_); + +- if (this.riddenByEntity != null) +- { +- d22 *= 0.75D; +- d23 *= 0.75D; +- } +- +- double d13 = this.func_174898_m(); +- d22 = MathHelper.clamp_double(d22, -d13, d13); +- d23 = MathHelper.clamp_double(d23, -d13, d13); +- this.moveEntity(d22, 0.0D, d23); +- + if (aint[0][1] != 0 && MathHelper.floor_double(this.posX) - p_180460_1_.getX() == aint[0][0] && MathHelper.floor_double(this.posZ) - p_180460_1_.getZ() == aint[0][2]) + { + this.setPosition(this.posX, this.posY + (double)aint[0][1], this.posZ); +@@ -578,8 +597,14 @@ this.motionZ = d5 * (double)(i - p_180460_1_.getZ()); } @@ -125,7 +190,7 @@ double d15 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); if (d15 > 0.01D) -@@ -818,13 +852,20 @@ +@@ -818,13 +843,20 @@ public void applyEntityCollision(Entity entityIn) { @@ -147,7 +212,7 @@ { entityIn.mountEntity(this); } -@@ -870,7 +911,7 @@ +@@ -870,7 +902,7 @@ double d7 = entityIn.motionX + this.motionX; double d8 = entityIn.motionZ + this.motionZ; @@ -156,7 +221,7 @@ { this.motionX *= 0.20000000298023224D; this.motionZ *= 0.20000000298023224D; -@@ -878,7 +919,7 @@ +@@ -878,7 +910,7 @@ entityIn.motionX *= 0.949999988079071D; entityIn.motionZ *= 0.949999988079071D; } @@ -165,7 +230,7 @@ { entityIn.motionX *= 0.20000000298023224D; entityIn.motionZ *= 0.20000000298023224D; -@@ -1043,6 +1084,221 @@ +@@ -1043,6 +1075,221 @@ } } diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch index dd00fa8f1..c5c383307 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch @@ -27,7 +27,25 @@ { this.closeScreen(); this.openContainer = this.inventoryContainer; -@@ -425,6 +426,7 @@ +@@ -265,7 +266,8 @@ + if (chunk.isPopulated()) + { + list.add(chunk); +- list1.addAll(((WorldServer)this.worldObj).func_147486_a(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 16, 256, chunkcoordintpair.chunkZPos * 16 + 16)); ++ list1.addAll(((WorldServer)this.worldObj).func_147486_a(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 16, 256, chunkcoordintpair.chunkZPos * 16 + 15)); ++ //BugFix: 16 makes it load an extra chunk, which isn't associated with a player, which makes it not unload unless a player walks near it. + iterator1.remove(); + } + } +@@ -295,6 +297,7 @@ + for (Chunk chunk1 : list) + { + this.getServerForPlayer().getEntityTracker().func_85172_a(this, chunk1); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(chunk1.getChunkCoordIntPair(), this)); + } + } + } +@@ -425,6 +428,7 @@ public void onDeath(DamageSource cause) { @@ -35,7 +53,7 @@ if (this.worldObj.getGameRules().getGameRuleBooleanValue("showDeathMessages")) { Team team = this.getTeam(); -@@ -448,7 +450,20 @@ +@@ -448,7 +452,20 @@ if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) { @@ -56,7 +74,15 @@ } for (ScoreObjective scoreobjective : this.worldObj.getScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.deathCount)) -@@ -832,6 +847,7 @@ +@@ -462,6 +479,7 @@ + if (entitylivingbase != null) + { + EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entitylivingbase))); ++ if (entitylist$entityegginfo == null) entitylist$entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.getEntityString(entitylivingbase)); + + if (entitylist$entityegginfo != null) + { +@@ -832,6 +850,7 @@ { if (stat != null) { diff --git a/rejects/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch.rej deleted file mode 100644 index c574d7bf3..000000000 --- a/rejects/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch.rej +++ /dev/null @@ -1,14 +0,0 @@ -++++ REJECTED PATCH 2 - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - this.mc.fontRendererObj.drawStringWithShadow(this.currentlyDisplayedText, (float)((l - this.mc.fontRendererObj.getStringWidth(this.currentlyDisplayedText)) / 2), (float)(i1 / 2 - 4 - 16), 16777215); - this.mc.fontRendererObj.drawStringWithShadow(this.message, (float)((l - this.mc.fontRendererObj.getStringWidth(this.message)) / 2), (float)(i1 / 2 - 4 + 8), 16777215); -+ } -+ } -+ catch (java.io.IOException e) -+ { -+ com.google.common.base.Throwables.propagate(e); -+ } //FML End - this.framebuffer.unbindFramebuffer(); - - if (OpenGlHelper.isFramebufferEnabled()) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/Minecraft.java.patch.rej b/rejects/minecraft/net/minecraft/client/Minecraft.java.patch.rej deleted file mode 100644 index 77b54313d..000000000 --- a/rejects/minecraft/net/minecraft/client/Minecraft.java.patch.rej +++ /dev/null @@ -1,240 +0,0 @@ -++++ REJECTED PATCH 9 - { - while (!this.scheduledTasks.isEmpty()) - { -- ((FutureTask)this.scheduledTasks.poll()).run(); -+ net.minecraftforge.fml.common.FMLCommonHandler.callFuture(((FutureTask)this.scheduledTasks.poll())); - } - } - -++++ END PATCH -++++ REJECTED PATCH 10 - - if (!this.skipRenderWorld) - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickStart(this.timer.renderPartialTicks); - this.mcProfiler.endStartSection("gameRenderer"); - this.entityRenderer.updateCameraAndRender(this.timer.renderPartialTicks); - this.mcProfiler.endSection(); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickEnd(this.timer.renderPartialTicks); - } - - this.mcProfiler.endSection(); -++++ END PATCH -++++ REJECTED PATCH 12 - case 2: - BlockPos blockpos = this.objectMouseOver.getBlockPos(); - -- if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air) -+ if (!this.theWorld.isAirBlock(blockpos)) - { - int i = itemstack != null ? itemstack.stackSize : 0; - -+ -+ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, this.theWorld, blockpos, this.objectMouseOver.sideHit).isCanceled(); -+ if (result) { //Forge: Kept separate to simplify patch - if (this.playerController.func_178890_a(this.thePlayer, this.theWorld, itemstack, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec)) - { - flag = false; - this.thePlayer.swingItem(); - } -+ } - - if (itemstack == null) - { -++++ END PATCH -++++ REJECTED PATCH 13 - { - ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem(); - -- if (itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) -+ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, theWorld, null, null).isCanceled(); -+ if (result && itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) - { - this.entityRenderer.itemRenderer.resetEquippedProgress2(); - } -++++ END PATCH -++++ REJECTED PATCH 15 - - while (Mouse.next()) - { -+ if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue; -+ - i = Mouse.getEventButton(); - KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState()); - -++++ END PATCH -++++ REJECTED PATCH 19 - - while (!this.theIntegratedServer.serverIsInRunLoop()) - { -+ if (!net.minecraftforge.fml.common.StartupQuery.check()) -+ { -+ loadWorld(null); -+ displayGuiScreen(null); -+ return; -+ } - String s2 = this.theIntegratedServer.getUserMessage(); - - if (s2 != null) -++++ END PATCH -++++ REJECTED PATCH 24 - if (this.objectMouseOver != null) - { - boolean flag = this.thePlayer.capabilities.isCreativeMode; -- int i = 0; -- boolean flag1 = false; -- TileEntity tileentity = null; -- Object object; - -- if (this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) -- { -- BlockPos blockpos = this.objectMouseOver.getBlockPos(); -- Block block = this.theWorld.getBlockState(blockpos).getBlock(); -- -- if (block.getMaterial() == Material.air) -- { -- return; -- } -- -- object = block.getItem(this.theWorld, blockpos); -- -- if (object == null) -- { -- return; -- } -- -- if (flag && GuiScreen.isCtrlKeyDown()) -- { -- tileentity = this.theWorld.getTileEntity(blockpos); -- } -- -- Block block1 = object instanceof ItemBlock && !block.isFlowerPot() ? Block.getBlockFromItem((Item)object) : block; -- i = block1.getDamageValue(this.theWorld, blockpos); -- flag1 = ((Item)object).getHasSubtypes(); -- } -- else -- { -- if (this.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !flag) -- { -- return; -- } -- -- if (this.objectMouseOver.entityHit instanceof EntityPainting) -- { -- object = Items.painting; -- } -- else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot) -- { -- object = Items.lead; -- } -- else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) -- { -- EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit; -- ItemStack itemstack = entityitemframe.getDisplayedItem(); -- -- if (itemstack == null) -- { -- object = Items.item_frame; -- } -- else -- { -- object = itemstack.getItem(); -- i = itemstack.getMetadata(); -- flag1 = true; -- } -- } -- else if (this.objectMouseOver.entityHit instanceof EntityMinecart) -- { -- EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit; -- -- switch (Minecraft.SwitchEnumMinecartType.field_178901_b[entityminecart.getMinecartType().ordinal()]) -- { -- case 1: -- object = Items.furnace_minecart; -- break; -- case 2: -- object = Items.chest_minecart; -- break; -- case 3: -- object = Items.tnt_minecart; -- break; -- case 4: -- object = Items.hopper_minecart; -- break; -- case 5: -- object = Items.command_block_minecart; -- break; -- default: -- object = Items.minecart; -- } -- } -- else if (this.objectMouseOver.entityHit instanceof EntityBoat) -- { -- object = Items.boat; -- } -- else if (this.objectMouseOver.entityHit instanceof EntityArmorStand) -- { -- object = Items.armor_stand; -- } -- else -- { -- object = Items.spawn_egg; -- i = EntityList.getEntityID(this.objectMouseOver.entityHit); -- flag1 = true; -- -- if (!EntityList.entityEggs.containsKey(Integer.valueOf(i))) -- { -- return; -- } -- } -- } -- - InventoryPlayer inventoryplayer = this.thePlayer.inventory; - -- if (tileentity == null) -- { -- inventoryplayer.setCurrentItem((Item)object, i, flag1, flag); -- } -- else -- { -- NBTTagCompound nbttagcompound1 = new NBTTagCompound(); -- tileentity.writeToNBT(nbttagcompound1); -- ItemStack itemstack1 = new ItemStack((Item)object, 1, i); -- itemstack1.setTagInfo("BlockEntityTag", nbttagcompound1); -- NBTTagCompound nbttagcompound = new NBTTagCompound(); -- NBTTagList nbttaglist = new NBTTagList(); -- nbttaglist.appendTag(new NBTTagString("(+NBT)")); -- nbttagcompound.setTag("Lore", nbttaglist); -- itemstack1.setTagInfo("display", nbttagcompound); -- inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, itemstack1); -- } -- -+ if (!net.minecraftforge.common.ForgeHooks.onPickBlock(this.objectMouseOver, this.thePlayer, this.theWorld)) return; -+ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions - if (flag) - { - int j = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + inventoryplayer.currentItem; -++++ END PATCH -++++ REJECTED PATCH 25 - - public static int getGLMaximumTextureSize() - { -- for (int i = 16384; i > 0; i >>= 1) -- { -- GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null); -- int j = GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); -- -- if (j != 0) -- { -- return i; -- } -- } -- -- return -1; -+ //Forge we redirect this to our code which caches the value before any splash screen stuff is done. -+ return net.minecraftforge.fml.client.SplashProgress.getMaxTextureSize(); - } - - public boolean isSnooperEnabled() -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch.rej deleted file mode 100644 index 4db04b102..000000000 --- a/rejects/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch.rej +++ /dev/null @@ -1,171 +0,0 @@ -++++ REJECTED PATCH 2 - return; - } - -- if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2)) -+ if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2) && ItemStack.areItemStackTagsEqual(itemstack1, itemstack2)) //Forge: Bugfix, Compare NBT data, allow for deletion of enchanted books, MC-12770 - { - if (clickedButton == 0) - { -++++ END PATCH -++++ REJECTED PATCH 5 - { - GuiContainerCreative.ContainerCreative containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; - containercreative.itemList.clear(); -+ -+ CreativeTabs tab = CreativeTabs.creativeTabArray[selectedTabIndex]; -+ if (tab.hasSearchBar() && tab != CreativeTabs.tabAllSearch) -+ { -+ tab.displayAllReleventItems(containercreative.itemList); -+ updateFilteredItems(containercreative); -+ return; -+ } -+ - Iterator iterator = Item.itemRegistry.iterator(); - - while (iterator.hasNext()) -++++ END PATCH -++++ REJECTED PATCH 6 - item.getSubItems(item, (CreativeTabs)null, containercreative.itemList); - } - } -+ updateFilteredItems(containercreative); -+ } - -+ //split from above for custom search tabs -+ private void updateFilteredItems(GuiContainerCreative.ContainerCreative containercreative) -+ { -+ Iterator iterator; - Enchantment[] aenchantment = Enchantment.enchantmentsBookList; - int j = aenchantment.length; - -+ if (CreativeTabs.creativeTabArray[selectedTabIndex] != CreativeTabs.tabAllSearch) j = 0; //Forge: Don't add enchants to custom tabs. - for (int i = 0; i < j; ++i) - { - Enchantment enchantment = aenchantment[i]; -++++ END PATCH -++++ REJECTED PATCH 8 - { - CreativeTabs creativetabs = acreativetabs[k1]; - -- if (this.func_147049_a(creativetabs, l, i1)) -+ if (creativetabs != null && this.func_147049_a(creativetabs, l, i1)) - { - this.setCurrentCreativeTab(creativetabs); - return; -++++ END PATCH -++++ REJECTED PATCH 11 - - super.drawScreen(mouseX, mouseY, partialTicks); - CreativeTabs[] acreativetabs = CreativeTabs.creativeTabArray; -- int i2 = acreativetabs.length; -+ int start = tabPage * 10; -+ int i2 = Math.min(acreativetabs.length, ((tabPage + 1) * 10) + 2); -+ if (tabPage != 0) start += 2; -+ boolean rendered = false; - -- for (int j2 = 0; j2 < i2; ++j2) -+ for (int j2 = start; j2 < i2; ++j2) - { - CreativeTabs creativetabs = acreativetabs[j2]; - -+ if (creativetabs == null) continue; - if (this.renderCreativeInventoryHoveringText(creativetabs, mouseX, mouseY)) - { -+ rendered = true; - break; - } - } - -+ if (!rendered && renderCreativeInventoryHoveringText(CreativeTabs.tabAllSearch, mouseX, mouseY)) -+ { -+ renderCreativeInventoryHoveringText(CreativeTabs.tabInventory, mouseX, mouseY); -+ } -+ - if (this.field_147064_C != null && selectedTabIndex == CreativeTabs.tabInventory.getTabIndex() && this.isPointInRegion(this.field_147064_C.xDisplayPosition, this.field_147064_C.yDisplayPosition, 16, 16, mouseX, mouseY)) - { - this.drawCreativeTabHoveringText(I18n.format("inventory.binSlot", new Object[0]), mouseX, mouseY); - } - -+ if (maxPages != 0) -+ { -+ String page = String.format("%d / %d", tabPage + 1, maxPages + 1); -+ int width = fontRendererObj.getStringWidth(page); -+ GlStateManager.disableLighting(); -+ this.zLevel = 300.0F; -+ itemRender.zLevel = 300.0F; -+ fontRendererObj.drawString(page, guiLeft + (xSize / 2) - (width / 2), guiTop - 44, -1); -+ this.zLevel = 0.0F; -+ itemRender.zLevel = 0.0F; -+ } -+ - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.disableLighting(); - } -++++ END PATCH -++++ REJECTED PATCH 12 - int k = acreativetabs.length; - int l; - -- for (l = 0; l < k; ++l) -+ int start = tabPage * 10; -+ k = Math.min(acreativetabs.length, ((tabPage + 1) * 10 + 2)); -+ if (tabPage != 0) start += 2; -+ -+ for (l = start; l < k; ++l) - { - CreativeTabs creativetabs1 = acreativetabs[l]; - this.mc.getTextureManager().bindTexture(creativeInventoryTabs); - -+ if (creativetabs1 == null) continue; - if (creativetabs1.getTabIndex() != selectedTabIndex) - { - this.func_147051_a(creativetabs1); - } - } - -+ if (tabPage != 0) -+ { -+ if (creativetabs != CreativeTabs.tabAllSearch) -+ { -+ this.mc.getTextureManager().bindTexture(creativeInventoryTabs); -+ func_147051_a(CreativeTabs.tabAllSearch); -+ } -+ if (creativetabs != CreativeTabs.tabInventory) -+ { -+ this.mc.getTextureManager().bindTexture(creativeInventoryTabs); -+ func_147051_a(CreativeTabs.tabInventory); -+ } -+ } -+ - this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.getBackgroundImageName())); - this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); - this.searchField.drawTextBox(); -++++ END PATCH -++++ REJECTED PATCH 14 - - protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_) - { -+ if (p_147049_1_.getTabPage() != tabPage) -+ { -+ if (p_147049_1_ != CreativeTabs.tabAllSearch && -+ p_147049_1_ != CreativeTabs.tabInventory) -+ { -+ return false; -+ } -+ } -+ - int k = p_147049_1_.getTabColumn(); - int l = 28 * k; - byte b0 = 0; -++++ END PATCH -++++ REJECTED PATCH 15 - } - - GlStateManager.disableLighting(); -+ GlStateManager.color(1F, 1F, 1F); //Forge: Reset color in case Items change it. -+ GlStateManager.enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border. - this.drawTexturedModalRect(l, i1, j, k, 28, b0); - this.zLevel = 100.0F; - this.itemRender.zLevel = 100.0F; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch.rej b/rejects/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch.rej deleted file mode 100644 index db68c865e..000000000 --- a/rejects/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch.rej +++ /dev/null @@ -1,23 +0,0 @@ -++++ REJECTED PATCH 2 - else - { - worldclient.playAuxSFX(2001, pos, Block.getStateId(iblockstate)); -- boolean flag = worldclient.setBlockToAir(pos); -+ boolean flag = block1.removedByPlayer(worldclient, pos, mc.thePlayer, false); - - if (flag) - { -++++ END PATCH -++++ REJECTED PATCH 5 - { - playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = itemstack1; - -- if (itemstack1.stackSize == 0) -+ if (itemstack1.stackSize <= 0) - { - playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = null; -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(playerIn, itemstack1); - } - - return true; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch.rej b/rejects/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch.rej deleted file mode 100644 index 682151693..000000000 --- a/rejects/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch.rej +++ /dev/null @@ -1,11 +0,0 @@ -++++ REJECTED PATCH 2 - public void handleSpawnExperienceOrb(S11PacketSpawnExperienceOrb packetIn) - { - PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); -- EntityXPOrb entityxporb = new EntityXPOrb(this.clientWorldController, (double)packetIn.func_148984_d(), (double)packetIn.func_148983_e(), (double)packetIn.func_148982_f(), packetIn.func_148986_g()); -+ EntityXPOrb entityxporb = new EntityXPOrb(this.clientWorldController, (double)packetIn.func_148984_d() / 32.0D, (double)packetIn.func_148983_e() / 32.0D, (double)packetIn.func_148982_f() / 32.0D, packetIn.func_148986_g()); -+ // FORGE: BugFix MC-12013 Wrong XP orb clientside spawn position - entityxporb.serverPosX = packetIn.func_148984_d(); - entityxporb.serverPosY = packetIn.func_148983_e(); - entityxporb.serverPosZ = packetIn.func_148982_f(); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/network/OldServerPinger.java.patch.rej b/rejects/minecraft/net/minecraft/client/network/OldServerPinger.java.patch.rej deleted file mode 100644 index 0d7f4a3ed..000000000 --- a/rejects/minecraft/net/minecraft/client/network/OldServerPinger.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 1 - server.setBase64EncodedIconData((String)null); - } - -+ net.minecraftforge.fml.client.FMLClientHandler.instance().bindServerListData(server, serverstatusresponse); - this.field_175092_e = Minecraft.getSystemTime(); - networkmanager.sendPacket(new C01PacketPing(this.field_175092_e)); - this.field_147403_d = true; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/resources/LanguageManager.java.patch.rej b/rejects/minecraft/net/minecraft/client/resources/LanguageManager.java.patch.rej deleted file mode 100644 index 5a48fdf7a..000000000 --- a/rejects/minecraft/net/minecraft/client/resources/LanguageManager.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 1 - } - - currentLocale.loadLocaleDataFiles(resourceManager, arraylist); -+ net.minecraftforge.fml.common.registry.LanguageRegistry.instance().mergeLanguageTable(currentLocale.properties, this.currentLanguage); - StringTranslate.replaceWith(currentLocale.properties); - } - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/resources/Locale.java.patch.rej b/rejects/minecraft/net/minecraft/client/resources/Locale.java.patch.rej deleted file mode 100644 index f93346344..000000000 --- a/rejects/minecraft/net/minecraft/client/resources/Locale.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - - private void loadLocaleData(InputStream p_135021_1_) throws IOException - { -+ p_135021_1_ = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(properties, p_135021_1_); -+ if (p_135021_1_ == null) return; - Iterator iterator = IOUtils.readLines(p_135021_1_, Charsets.UTF_8).iterator(); - - while (iterator.hasNext()) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/resources/SkinManager.java.patch.rej b/rejects/minecraft/net/minecraft/client/resources/SkinManager.java.patch.rej deleted file mode 100644 index 7dc5509d7..000000000 --- a/rejects/minecraft/net/minecraft/client/resources/SkinManager.java.patch.rej +++ /dev/null @@ -1,12 +0,0 @@ -++++ REJECTED PATCH 1 - - if (hashmap.isEmpty() && p_152790_1_.getId().equals(Minecraft.getMinecraft().getSession().getProfile().getId())) - { -- hashmap.putAll(SkinManager.this.sessionService.getTextures(SkinManager.this.sessionService.fillProfileProperties(p_152790_1_, false), false)); -+ // FORGE: Use already filled profile from session rather -+ // than getting rate limited by filling the input profile -+ hashmap.putAll(SkinManager.this.sessionService.getTextures(Minecraft.getMinecraft().getSession().getProfile(), false)); - } - - Minecraft.getMinecraft().addScheduledTask(new Runnable() -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/EntityList.java.patch.rej b/rejects/minecraft/net/minecraft/entity/EntityList.java.patch.rej deleted file mode 100644 index 84a4fc1ab..000000000 --- a/rejects/minecraft/net/minecraft/entity/EntityList.java.patch.rej +++ /dev/null @@ -1,13 +0,0 @@ -++++ REJECTED PATCH 2 - p_75615_0_.removeTag("Type"); - } - -+ Class oclass = null; - try - { -- Class oclass = (Class)stringToClassMapping.get(p_75615_0_.getString("id")); -+ oclass = (Class)stringToClassMapping.get(p_75615_0_.getString("id")); - - if (oclass != null) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/EntityLivingBase.java.patch.rej b/rejects/minecraft/net/minecraft/entity/EntityLivingBase.java.patch.rej deleted file mode 100644 index 3399d9aee..000000000 --- a/rejects/minecraft/net/minecraft/entity/EntityLivingBase.java.patch.rej +++ /dev/null @@ -1,30 +0,0 @@ -++++ REJECTED PATCH 1 - } - } - -- if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity instanceof EntityLivingBase) -+ if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity != null && ridingEntity.shouldDismountInWater(this)) - { - this.mountEntity((Entity)null); - } -++++ END PATCH -++++ REJECTED PATCH 2 - if (!this.worldObj.isRemote && (this.recentlyHit > 0 || this.isPlayer()) && this.func_146066_aG() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) - { - i = this.getExperiencePoints(this.attackingPlayer); -- -+ i = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.attackingPlayer, i); - while (i > 0) - { - int j = EntityXPOrb.getXPSplit(i); -++++ END PATCH -++++ REJECTED PATCH 5 - - public void heal(float healAmount) - { -+ healAmount = net.minecraftforge.event.ForgeEventFactory.onLivingHeal(this, healAmount); -+ if (healAmount <= 0) return; - float f1 = this.getHealth(); - - if (f1 > 0.0F) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/boss/EntityWither.java.patch.rej b/rejects/minecraft/net/minecraft/entity/boss/EntityWither.java.patch.rej deleted file mode 100644 index 30937f47e..000000000 --- a/rejects/minecraft/net/minecraft/entity/boss/EntityWither.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - int l = j1 + i2; - Block block = this.worldObj.getBlockState(new BlockPos(j2, k, l)).getBlock(); - -- if (block.getMaterial() != Material.air && block != Blocks.bedrock && block != Blocks.end_portal && block != Blocks.end_portal_frame && block != Blocks.command_block && block != Blocks.barrier) -+ if (!block.isAir(worldObj, new BlockPos(j2, k, l)) && block.canEntityDestroy(worldObj, new BlockPos(j2, k, l), this)) - { - flag = this.worldObj.destroyBlock(new BlockPos(j2, k, l), true) || flag; - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch.rej b/rejects/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch.rej deleted file mode 100644 index a4efeca13..000000000 --- a/rejects/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch.rej +++ /dev/null @@ -1,68 +0,0 @@ -++++ REJECTED PATCH 4 - } - - this.setRotation(this.rotationYaw, this.rotationPitch); -- Iterator iterator = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D)).iterator(); -+ AxisAlignedBB box; -+ if (getCollisionHandler() != null) box = this.getCollisionHandler().getMinecartCollisionBox(this); -+ else box = this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D); -+ Iterator iterator = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, box).iterator(); - - while (iterator.hasNext()) - { -++++ END PATCH -++++ REJECTED PATCH 8 - flag1 = !flag; - } - -- double d0 = 0.0078125D; -+ double slopeAdjustment = getSlopeAdjustment(); - BlockRailBase.EnumRailDirection enumraildirection = (BlockRailBase.EnumRailDirection)p_180460_2_.getValue(blockrailbase.getShapeProperty()); - - switch (EntityMinecart.SwitchEnumMinecartType.RAIL_SHAPE_LOOKUP[enumraildirection.ordinal()]) - { - case 1: -- this.motionX -= 0.0078125D; -+ this.motionX -= slopeAdjustment; - ++this.posY; - break; - case 2: -- this.motionX += 0.0078125D; -+ this.motionX += slopeAdjustment; - ++this.posY; - break; - case 3: -- this.motionZ += 0.0078125D; -+ this.motionZ += slopeAdjustment; - ++this.posY; - break; - case 4: -- this.motionZ -= 0.0078125D; -+ this.motionZ -= slopeAdjustment; - ++this.posY; - } - -++++ END PATCH -++++ REJECTED PATCH 10 - this.posX = d7 + d1 * d6; - this.posZ = d8 + d2 * d6; - this.setPosition(this.posX, this.posY, this.posZ); -- d11 = this.motionX; -- d12 = this.motionZ; -+ this.moveMinecartOnRail(p_180460_1_); - -- if (this.riddenByEntity != null) -- { -- d11 *= 0.75D; -- d12 *= 0.75D; -- } -- -- double d13 = this.func_174898_m(); -- d11 = MathHelper.clamp_double(d11, -d13, d13); -- d12 = MathHelper.clamp_double(d12, -d13, d13); -- this.moveEntity(d11, 0.0D, d12); -- - if (aint[0][1] != 0 && MathHelper.floor_double(this.posX) - p_180460_1_.getX() == aint[0][0] && MathHelper.floor_double(this.posZ) - p_180460_1_.getZ() == aint[0][2]) - { - this.setPosition(this.posX, this.posY + (double)aint[0][1], this.posZ); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch.rej b/rejects/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch.rej deleted file mode 100644 index fcdb36365..000000000 --- a/rejects/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch.rej +++ /dev/null @@ -1,29 +0,0 @@ -++++ REJECTED PATCH 3 - if (chunk.isPopulated()) - { - arraylist.add(chunk); -- arraylist1.addAll(((WorldServer)this.worldObj).func_147486_a(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 16, 256, chunkcoordintpair.chunkZPos * 16 + 16)); -+ arraylist1.addAll(((WorldServer)this.worldObj).func_147486_a(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 15, 256, chunkcoordintpair.chunkZPos * 16 + 15)); -+ //BugFix: 16 makes it load an extra chunk, which isn't associated with a player, which makes it not unload unless a player walks near it. - iterator1.remove(); - } - } -++++ END PATCH -++++ REJECTED PATCH 4 - { - chunk = (Chunk)iterator2.next(); - this.getServerForPlayer().getEntityTracker().func_85172_a(this, chunk); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(chunk.getChunkCoordIntPair(), this)); - } - } - } -++++ END PATCH -++++ REJECTED PATCH 7 - if (entitylivingbase != null) - { - EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entitylivingbase))); -+ if (entityegginfo == null) entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.getEntityString(entitylivingbase)); - - if (entityegginfo != null) - { -++++ END PATCH diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index 65dd5b154..896c83e4c 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -24,10 +24,18 @@ import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLeashKnot; +import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.entity.item.EntityBoat; import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.entity.item.EntityPainting; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.event.ClickEvent; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -38,6 +46,7 @@ import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemAxe; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBucket; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemSpade; @@ -249,6 +258,127 @@ public class ForgeHooks */ public static boolean onPickBlock(MovingObjectPosition target, EntityPlayer player, World world) { + /* + int i = 0; + boolean flag1 = false; + TileEntity tileentity = null; + Item item; + + if (this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + BlockPos blockpos = this.objectMouseOver.getBlockPos(); + Block block = this.theWorld.getBlockState(blockpos).getBlock(); + + if (block.getMaterial() == Material.air) + { + return; + } + + item = block.getItem(this.theWorld, blockpos); + + if (item == null) + { + return; + } + + if (flag && GuiScreen.isCtrlKeyDown()) + { + tileentity = this.theWorld.getTileEntity(blockpos); + } + + Block block1 = item instanceof ItemBlock && !block.isFlowerPot() ? Block.getBlockFromItem(item) : block; + i = block1.getDamageValue(this.theWorld, blockpos); + flag1 = item.getHasSubtypes(); + } + else + { + if (this.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !flag) + { + return; + } + + if (this.objectMouseOver.entityHit instanceof EntityPainting) + { + item = Items.painting; + } + else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot) + { + item = Items.lead; + } + else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) + { + EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit; + ItemStack itemstack = entityitemframe.getDisplayedItem(); + + if (itemstack == null) + { + item = Items.item_frame; + } + else + { + item = itemstack.getItem(); + i = itemstack.getMetadata(); + flag1 = true; + } + } + else if (this.objectMouseOver.entityHit instanceof EntityMinecart) + { + EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit; + + switch (entityminecart.getMinecartType()) + { + case FURNACE: + item = Items.furnace_minecart; + break; + case CHEST: + item = Items.chest_minecart; + break; + case TNT: + item = Items.tnt_minecart; + break; + case HOPPER: + item = Items.hopper_minecart; + break; + case COMMAND_BLOCK: + item = Items.command_block_minecart; + break; + default: + item = Items.minecart; + } + } + else if (this.objectMouseOver.entityHit instanceof EntityBoat) + { + item = Items.boat; + } + else if (this.objectMouseOver.entityHit instanceof EntityArmorStand) + { + item = Items.armor_stand; + } + else + { + item = Items.spawn_egg; + i = EntityList.getEntityID(this.objectMouseOver.entityHit); + flag1 = true; + + if (!EntityList.entityEggs.containsKey(Integer.valueOf(i))) + { + return; + } + } + } + + InventoryPlayer inventoryplayer = this.thePlayer.inventory; + + if (tileentity == null) + { + inventoryplayer.setCurrentItem(item, i, flag1, flag); + } + else + { + ItemStack itemstack1 = this.func_181036_a(item, i, tileentity); + inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, itemstack1); + } + */ ItemStack result = null; boolean isCreative = player.capabilities.isCreativeMode; TileEntity te = null; From 426340fed59a399e4b54cef50474620c95346357 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 11 Nov 2015 19:16:55 +0300 Subject: [PATCH 015/133] Updated FML Gui methods to WorldRenderer API changes. --- .../minecraftforge/fml/client/GuiModList.java | 13 +- .../fml/client/GuiScrollingList.java | 115 ++++++++---------- .../fml/client/config/GuiUtils.java | 17 +-- 3 files changed, 67 insertions(+), 78 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/client/GuiModList.java b/src/main/java/net/minecraftforge/fml/client/GuiModList.java index 720e3e087..1fe8e7256 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiModList.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiModList.java @@ -37,6 +37,7 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.IResourcePack; import net.minecraft.util.ChatComponentText; @@ -529,13 +530,13 @@ public class GuiModList extends GuiScreen { GlStateManager.enableBlend(); GuiModList.this.mc.renderEngine.bindTexture(logoPath); - WorldRenderer world = tess.getWorldRenderer(); + WorldRenderer wr = tess.getWorldRenderer(); int offset = (this.left + this.listWidth/2) - (logoDims.width / 2); - world.startDrawingQuads(); - world.addVertexWithUV(offset, top + logoDims.height, zLevel, 0, 1); - world.addVertexWithUV(offset + logoDims.width, top + logoDims.height, zLevel, 1, 1); - world.addVertexWithUV(offset + logoDims.width, top, zLevel, 1, 0); - world.addVertexWithUV(offset, top, zLevel, 0, 0); + wr.func_181668_a(7, DefaultVertexFormats.field_181707_g); + wr.func_181662_b(offset, top + logoDims.height, zLevel).func_181673_a(0, 1).func_181675_d(); + wr.func_181662_b(offset + logoDims.width, top + logoDims.height, zLevel).func_181673_a(1, 1).func_181675_d(); + wr.func_181662_b(offset + logoDims.width, top, zLevel).func_181673_a(1, 0).func_181675_d(); + wr.func_181662_b(offset, top, zLevel).func_181673_a(0, 0).func_181675_d(); tess.draw(); GlStateManager.disableBlend(); top += logoDims.height + 10; diff --git a/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java b/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java index d7f374a1b..48b0bbde8 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java @@ -20,6 +20,7 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; @@ -262,12 +263,11 @@ public abstract class GuiScrollingList this.client.renderEngine.bindTexture(Gui.optionsBackground); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); float scale = 32.0F; - worldr.startDrawingQuads(); - worldr.setColorOpaque_I(2105376); - worldr.addVertexWithUV(this.left, this.bottom, 0.0D, this.left / scale, (this.bottom + (int)this.scrollDistance) / scale); - worldr.addVertexWithUV(this.right, this.bottom, 0.0D, this.right / scale, (this.bottom + (int)this.scrollDistance) / scale); - worldr.addVertexWithUV(this.right, this.top, 0.0D, this.right / scale, (this.top + (int)this.scrollDistance) / scale); - worldr.addVertexWithUV(this.left, this.top, 0.0D, this.left / scale, (this.top + (int)this.scrollDistance) / scale); + worldr.func_181668_a(7, DefaultVertexFormats.field_181709_i); + worldr.func_181662_b(this.left, this.bottom, 0.0D).func_181673_a(this.left / scale, (this.bottom + (int)this.scrollDistance) / scale).func_181669_b(0x20, 0x20, 0x20, 0xFF).func_181675_d(); + worldr.func_181662_b(this.right, this.bottom, 0.0D).func_181673_a(this.right / scale, (this.bottom + (int)this.scrollDistance) / scale).func_181669_b(0x20, 0x20, 0x20, 0xFF).func_181675_d(); + worldr.func_181662_b(this.right, this.top, 0.0D).func_181673_a(this.right / scale, (this.top + (int)this.scrollDistance) / scale).func_181669_b(0x20, 0x20, 0x20, 0xFF).func_181675_d(); + worldr.func_181662_b(this.left, this.top, 0.0D).func_181673_a(this.left / scale, (this.top + (int)this.scrollDistance) / scale).func_181669_b(0x20, 0x20, 0x20, 0xFF).func_181675_d(); tess.draw(); } @@ -290,17 +290,15 @@ public abstract class GuiScrollingList int max = entryRight; GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableTexture2D(); - worldr.startDrawingQuads(); - worldr.setColorOpaque_I(0x808080); - worldr.addVertexWithUV(min, slotTop + slotBuffer + 2, 0.0D, 0.0D, 1.0D); - worldr.addVertexWithUV(max, slotTop + slotBuffer + 2, 0.0D, 1.0D, 1.0D); - worldr.addVertexWithUV(max, slotTop - 2, 0.0D, 1.0D, 0.0D); - worldr.addVertexWithUV(min, slotTop - 2, 0.0D, 0.0D, 0.0D); - worldr.setColorOpaque_I(0); - worldr.addVertexWithUV(min + 1, slotTop + slotBuffer + 1, 0.0D, 0.0D, 1.0D); - worldr.addVertexWithUV(max - 1, slotTop + slotBuffer + 1, 0.0D, 1.0D, 1.0D); - worldr.addVertexWithUV(max - 1, slotTop - 1, 0.0D, 1.0D, 0.0D); - worldr.addVertexWithUV(min + 1, slotTop - 1, 0.0D, 0.0D, 0.0D); + worldr.func_181668_a(7, DefaultVertexFormats.field_181709_i); + worldr.func_181662_b(min, slotTop + slotBuffer + 2, 0).func_181673_a(0, 1).func_181669_b(0x80, 0x80, 0x80, 0xFF).func_181675_d(); + worldr.func_181662_b(max, slotTop + slotBuffer + 2, 0).func_181673_a(1, 1).func_181669_b(0x80, 0x80, 0x80, 0xFF).func_181675_d(); + worldr.func_181662_b(max, slotTop - 2, 0).func_181673_a(1, 0).func_181669_b(0x80, 0x80, 0x80, 0xFF).func_181675_d(); + worldr.func_181662_b(min, slotTop - 2, 0).func_181673_a(0, 0).func_181669_b(0x80, 0x80, 0x80, 0xFF).func_181675_d(); + worldr.func_181662_b(min + 1, slotTop + slotBuffer + 1, 0).func_181673_a(0, 1).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d(); + worldr.func_181662_b(max - 1, slotTop + slotBuffer + 1, 0).func_181673_a(1, 1).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d(); + worldr.func_181662_b(max - 1, slotTop - 1, 0).func_181673_a(1, 0).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d(); + worldr.func_181662_b(min + 1, slotTop - 1, 0).func_181673_a(0, 0).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d(); tess.draw(); GlStateManager.enableTexture2D(); } @@ -322,21 +320,17 @@ public abstract class GuiScrollingList GlStateManager.disableAlpha(); GlStateManager.shadeModel(GL11.GL_SMOOTH); GlStateManager.disableTexture2D(); - worldr.startDrawingQuads(); - worldr.setColorRGBA_I(0, 0); - worldr.addVertexWithUV(this.left, this.top + border, 0.0D, 0.0D, 1.0D); - worldr.addVertexWithUV(this.right, this.top + border, 0.0D, 1.0D, 1.0D); - worldr.setColorRGBA_I(0, 255); - worldr.addVertexWithUV(this.right, this.top, 0.0D, 1.0D, 0.0D); - worldr.addVertexWithUV(this.left, this.top, 0.0D, 0.0D, 0.0D); + worldr.func_181668_a(7, DefaultVertexFormats.field_181709_i); + worldr.func_181662_b(this.left, this.top + border, 0).func_181673_a(0, 1).func_181669_b(0x00, 0x00, 0x00, 0x00).func_181675_d(); + worldr.func_181662_b(this.right, this.top + border, 0).func_181673_a(1, 1).func_181669_b(0x00, 0x00, 0x00, 0x00).func_181675_d(); + worldr.func_181662_b(this.right, this.top, 0).func_181673_a(1, 0).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d(); + worldr.func_181662_b(this.left, this.top, 0).func_181673_a(0, 0).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d(); tess.draw(); - worldr.startDrawingQuads(); - worldr.setColorRGBA_I(0, 255); - worldr.addVertexWithUV(this.left, this.bottom, 0.0D, 0.0D, 1.0D); - worldr.addVertexWithUV(this.right, this.bottom, 0.0D, 1.0D, 1.0D); - worldr.setColorRGBA_I(0, 0); - worldr.addVertexWithUV(this.right, this.bottom - border, 0.0D, 1.0D, 0.0D); - worldr.addVertexWithUV(this.left, this.bottom - border, 0.0D, 0.0D, 0.0D); + worldr.func_181668_a(7, DefaultVertexFormats.field_181709_i); + worldr.func_181662_b(this.left, this.bottom, 0).func_181673_a(0, 1).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d(); + worldr.func_181662_b(this.right, this.bottom, 0).func_181673_a(1, 1).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d(); + worldr.func_181662_b(this.right, this.bottom - border, 0).func_181673_a(1, 0).func_181669_b(0x00, 0x00, 0x00, 0x00).func_181675_d(); + worldr.func_181662_b(this.left, this.bottom - border, 0).func_181673_a(0, 0).func_181669_b(0x00, 0x00, 0x00, 0x00).func_181675_d(); tess.draw(); int extraHeight = this.getContentHeight() - viewHeight - border; @@ -355,26 +349,23 @@ public abstract class GuiScrollingList barTop = this.top; } - worldr.startDrawingQuads(); - worldr.setColorRGBA_I(0, 255); - worldr.addVertexWithUV(scrollBarLeft, this.bottom, 0.0D, 0.0D, 1.0D); - worldr.addVertexWithUV(scrollBarRight, this.bottom, 0.0D, 1.0D, 1.0D); - worldr.addVertexWithUV(scrollBarRight, this.top, 0.0D, 1.0D, 0.0D); - worldr.addVertexWithUV(scrollBarLeft, this.top, 0.0D, 0.0D, 0.0D); + worldr.func_181668_a(7, DefaultVertexFormats.field_181709_i); + worldr.func_181662_b(scrollBarLeft, this.bottom, 0.0D).func_181673_a(0.0D, 1.0D).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d(); + worldr.func_181662_b(scrollBarRight, this.bottom, 0.0D).func_181673_a(1.0D, 1.0D).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d(); + worldr.func_181662_b(scrollBarRight, this.top, 0.0D).func_181673_a(1.0D, 0.0D).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d(); + worldr.func_181662_b(scrollBarLeft, this.top, 0.0D).func_181673_a(0.0D, 0.0D).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d(); tess.draw(); - worldr.startDrawingQuads(); - worldr.setColorRGBA_I(0x808080, 255); - worldr.addVertexWithUV(scrollBarLeft, barTop + height, 0.0D, 0.0D, 1.0D); - worldr.addVertexWithUV(scrollBarRight, barTop + height, 0.0D, 1.0D, 1.0D); - worldr.addVertexWithUV(scrollBarRight, barTop, 0.0D, 1.0D, 0.0D); - worldr.addVertexWithUV(scrollBarLeft, barTop, 0.0D, 0.0D, 0.0D); + worldr.func_181668_a(7, DefaultVertexFormats.field_181709_i); + worldr.func_181662_b(scrollBarLeft, barTop + height, 0.0D).func_181673_a(0.0D, 1.0D).func_181669_b(0x80, 0x80, 0x80, 0xFF).func_181675_d(); + worldr.func_181662_b(scrollBarRight, barTop + height, 0.0D).func_181673_a(1.0D, 1.0D).func_181669_b(0x80, 0x80, 0x80, 0xFF).func_181675_d(); + worldr.func_181662_b(scrollBarRight, barTop, 0.0D).func_181673_a(1.0D, 0.0D).func_181669_b(0x80, 0x80, 0x80, 0xFF).func_181675_d(); + worldr.func_181662_b(scrollBarLeft, barTop, 0.0D).func_181673_a(0.0D, 0.0D).func_181669_b(0x80, 0x80, 0x80, 0xFF).func_181675_d(); tess.draw(); - worldr.startDrawingQuads(); - worldr.setColorRGBA_I(0xC0C0C0, 255); - worldr.addVertexWithUV(scrollBarLeft, barTop + height - 1, 0.0D, 0.0D, 1.0D); - worldr.addVertexWithUV(scrollBarRight - 1, barTop + height - 1, 0.0D, 1.0D, 1.0D); - worldr.addVertexWithUV(scrollBarRight - 1, barTop, 0.0D, 1.0D, 0.0D); - worldr.addVertexWithUV(scrollBarLeft, barTop, 0.0D, 0.0D, 0.0D); + worldr.func_181668_a(7, DefaultVertexFormats.field_181709_i); + worldr.func_181662_b(scrollBarLeft, barTop + height - 1, 0.0D).func_181673_a(0.0D, 1.0D).func_181669_b(0xC0, 0xC0, 0xC0, 0xFF).func_181675_d(); + worldr.func_181662_b(scrollBarRight - 1, barTop + height - 1, 0.0D).func_181673_a(1.0D, 1.0D).func_181669_b(0xC0, 0xC0, 0xC0, 0xFF).func_181675_d(); + worldr.func_181662_b(scrollBarRight - 1, barTop, 0.0D).func_181673_a(1.0D, 0.0D).func_181669_b(0xC0, 0xC0, 0xC0, 0xFF).func_181675_d(); + worldr.func_181662_b(scrollBarLeft, barTop, 0.0D).func_181673_a(0.0D, 0.0D).func_181669_b(0xC0, 0xC0, 0xC0, 0xFF).func_181675_d(); tess.draw(); } @@ -385,7 +376,7 @@ public abstract class GuiScrollingList GlStateManager.disableBlend(); } - private void overlayBackground(int top, int height, int alpha1, int alpah2) + private void overlayBackground(int top, int height, int alpha1, int alpha2) { Tessellator tess = Tessellator.getInstance(); WorldRenderer worldr = tess.getWorldRenderer(); @@ -393,13 +384,11 @@ public abstract class GuiScrollingList GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); float scale = 32.0F; double startUV = (screenWidth / scale) / screenWidth * (left-0); - worldr.startDrawingQuads(); - worldr.setColorRGBA_I(0x404040, alpah2); - worldr.addVertexWithUV(left, height, 0.0D, startUV, height / scale); - worldr.addVertexWithUV(left+listWidth+8, height, 0.0D, (left+listWidth+8) / scale, height / scale); - worldr.setColorRGBA_I(0x404040, alpha1); - worldr.addVertexWithUV(left+listWidth+8, top, 0.0D, (left+listWidth+8) / scale, top / scale); - worldr.addVertexWithUV(left, top, 0.0D, startUV, top / scale); + worldr.func_181668_a(7, DefaultVertexFormats.field_181709_i); + worldr.func_181662_b(left, height, 0.0D).func_181673_a(startUV, height / scale).func_181669_b(0x40, 0x40, 0x40, alpha2).func_181675_d(); + worldr.func_181662_b(left+listWidth+8, height, 0.0D).func_181673_a((left+listWidth+8) / scale, height / scale).func_181669_b(0x40, 0x40, 0x40, alpha2).func_181675_d(); + worldr.func_181662_b(left+listWidth+8, top, 0.0D).func_181673_a((left+listWidth+8) / scale, top / scale ).func_181669_b(0x40, 0x40, 0x40, alpha1).func_181675_d(); + worldr.func_181662_b(left, top, 0.0D).func_181673_a(startUV, top / scale ).func_181669_b(0x40, 0x40, 0x40, alpha1).func_181675_d(); tess.draw(); } @@ -420,13 +409,11 @@ public abstract class GuiScrollingList GlStateManager.shadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - worldrenderer.startDrawingQuads(); - worldrenderer.setColorRGBA_F(r1, g1, b1, a1); - worldrenderer.addVertex(right, top, 0.0D); - worldrenderer.addVertex(left, top, 0.0D); - worldrenderer.setColorRGBA_F(r2, g2, b2, a2); - worldrenderer.addVertex(left, bottom, 0.0D); - worldrenderer.addVertex(right, bottom, 0.0D); + worldrenderer.func_181668_a(7, DefaultVertexFormats.field_181706_f); + worldrenderer.func_181662_b(right, top, 0.0D).func_181666_a(r1, g1, b1, a1).func_181675_d(); + worldrenderer.func_181662_b(left, top, 0.0D).func_181666_a(r1, g1, b1, a1).func_181675_d(); + worldrenderer.func_181662_b(left, bottom, 0.0D).func_181666_a(r2, g2, b2, a2).func_181675_d(); + worldrenderer.func_181662_b(right, bottom, 0.0D).func_181666_a(r2, g2, b2, a2).func_181675_d(); tessellator.draw(); GlStateManager.shadeModel(GL11.GL_FLAT); GlStateManager.disableBlend(); diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java b/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java index c115cfc2d..75a79493e 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java @@ -17,6 +17,7 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; @@ -181,15 +182,15 @@ public class GuiUtils public static void drawTexturedModalRect(int x, int y, int u, int v, int width, int height, float zLevel) { - float var7 = 0.00390625F; - float var8 = 0.00390625F; + float uScale = 1f / 0x100; + float vScale = 1f / 0x100; Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldr = tessellator.getWorldRenderer(); - worldr.startDrawingQuads(); - worldr.addVertexWithUV((x + 0), (y + height), zLevel, ((u + 0) * var7), ((v + height) * var8)); - worldr.addVertexWithUV((x + width), (y + height), zLevel, ((u + width) * var7), ((v + height) * var8)); - worldr.addVertexWithUV((x + width), (y + 0), zLevel, ((u + width) * var7), ((v + 0) * var8)); - worldr.addVertexWithUV((x + 0), (y + 0), zLevel, ((u + 0) * var7), ((v + 0) * var8)); + WorldRenderer wr = tessellator.getWorldRenderer(); + wr.func_181668_a(7, DefaultVertexFormats.field_181707_g); + wr.func_181662_b(x , y + height, zLevel).func_181673_a( u * uScale, ((v + height) * vScale)).func_181675_d(); + wr.func_181662_b(x + width, y + height, zLevel).func_181673_a((u + width) * uScale, ((v + height) * vScale)).func_181675_d(); + wr.func_181662_b(x + width, y , zLevel).func_181673_a((u + width) * uScale, ( v * vScale)).func_181675_d(); + wr.func_181662_b(x , y , zLevel).func_181673_a( u * uScale, ( v * vScale)).func_181675_d(); tessellator.draw(); } From b6f91817f0ac47dca380695dca703d211da5cc38 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 11 Nov 2015 22:21:38 +0300 Subject: [PATCH 016/133] EntityPlayer patch updated. --- .../entity/player/EntityPlayer.java.patch | 619 ++++++++++++++++++ 1 file changed, 619 insertions(+) create mode 100644 patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch new file mode 100644 index 000000000..092bc3a96 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -0,0 +1,619 @@ +--- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayer.java ++++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayer.java +@@ -80,6 +80,11 @@ + @SuppressWarnings("incomplete-switch") + public abstract class EntityPlayer extends EntityLivingBase + { ++ public static final String PERSISTED_NBT_TAG = "PlayerPersisted"; ++ private java.util.HashMap spawnChunkMap = new java.util.HashMap(); ++ private java.util.HashMap spawnForcedMap = new java.util.HashMap(); ++ public float eyeHeight = this.getDefaultEyeHeight(); ++ + public InventoryPlayer inventory = new InventoryPlayer(this); + private InventoryEnderChest theInventoryEnderChest = new InventoryEnderChest(); + public Container inventoryContainer; +@@ -176,7 +181,8 @@ + { + if (this.itemInUse != null) + { +- this.itemInUse.onPlayerStoppedUsing(this.worldObj, this, this.itemInUseCount); ++ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, itemInUse, this.itemInUseCount)) ++ this.itemInUse.onPlayerStoppedUsing(this.worldObj, this, this.itemInUseCount); + } + + this.clearItemInUse(); +@@ -200,6 +206,7 @@ + + public void onUpdate() + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPreTick(this); + this.noClip = this.isSpectator(); + + if (this.isSpectator()) +@@ -213,6 +220,14 @@ + + if (itemstack == this.itemInUse) + { ++ itemInUseCount = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, itemInUse, itemInUseCount); ++ if (itemInUseCount <= 0) ++ { ++ this.onItemUseFinish(); ++ } ++ else ++ { // Forge Keep unindented to lower patch ++ itemInUse.getItem().onUsingTick(itemInUse, this, itemInUseCount); //Forge Added + if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0) + { + this.updateItemUse(itemstack, 5); +@@ -222,6 +237,7 @@ + { + this.onItemUseFinish(); + } ++ } + } + else + { +@@ -267,7 +283,7 @@ + + super.onUpdate(); + +- if (!this.worldObj.isRemote && this.openContainer != null && !this.openContainer.canInteractWith(this)) ++ if (!this.worldObj.isRemote && this.openContainer != null && !net.minecraftforge.common.ForgeHooks.canInteractWith(this, this.openContainer)) + { + this.closeScreen(); + this.openContainer = this.inventoryContainer; +@@ -344,6 +360,7 @@ + { + this.setPosition(d3, this.posY, d4); + } ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPostTick(this); + } + + public int getMaxInPortalTime() +@@ -413,11 +430,12 @@ + int i = this.itemInUse.stackSize; + ItemStack itemstack = this.itemInUse.onItemUseFinish(this.worldObj, this); + ++ itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, itemInUse, itemInUseCount, itemstack); + if (itemstack != this.itemInUse || itemstack != null && itemstack.stackSize != i) + { + this.inventory.mainInventory[this.inventory.currentItem] = itemstack; + +- if (itemstack.stackSize == 0) ++ if (itemstack != null && itemstack.stackSize == 0) + { + this.inventory.mainInventory[this.inventory.currentItem] = null; + } +@@ -477,11 +495,11 @@ + this.cameraYaw = 0.0F; + this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2); + +- if (this.ridingEntity instanceof EntityPig) ++ if (this.ridingEntity instanceof EntityLivingBase && ((EntityLivingBase)ridingEntity).shouldRiderFaceForward(this)) + { + this.rotationPitch = f1; + this.rotationYaw = f; +- this.renderYawOffset = ((EntityPig)this.ridingEntity).renderYawOffset; ++ this.renderYawOffset = ((EntityLivingBase)this.ridingEntity).renderYawOffset; + } + } + } +@@ -611,11 +629,15 @@ + + public void onDeath(DamageSource cause) + { ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; + super.onDeath(cause); + this.setSize(0.2F, 0.2F); + this.setPosition(this.posX, this.posY, this.posZ); + this.motionY = 0.10000000149011612D; + ++ captureDrops = true; ++ capturedDrops.clear(); ++ + if (this.getName().equals("Notch")) + { + this.dropItem(new ItemStack(Items.apple, 1), true, false); +@@ -626,6 +648,9 @@ + this.inventory.dropAllItems(); + } + ++ captureDrops = false; ++ if (!worldObj.isRemote) net.minecraftforge.event.ForgeEventFactory.onPlayerDrops(this, cause, capturedDrops, recentlyHit > 0); ++ + if (cause != null) + { + this.motionX = (double)(-MathHelper.cos((this.attackedAtYaw + this.rotationYaw) * (float)Math.PI / 180.0F) * 0.1F); +@@ -708,12 +733,25 @@ + + public EntityItem dropOneItem(boolean p_71040_1_) + { +- return this.dropItem(this.inventory.decrStackSize(this.inventory.currentItem, p_71040_1_ && this.inventory.getCurrentItem() != null ? this.inventory.getCurrentItem().stackSize : 1), false, true); ++ ItemStack stack = inventory.getCurrentItem(); ++ ++ if (stack == null) ++ { ++ return null; ++ } ++ ++ if (stack.getItem().onDroppedByPlayer(stack, this)) ++ { ++ int count = p_71040_1_ && this.inventory.getCurrentItem() != null ? this.inventory.getCurrentItem().stackSize : 1; ++ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, inventory.decrStackSize(inventory.currentItem, count), true); ++ } ++ ++ return null; + } + + public EntityItem dropPlayerItemWithRandomChoice(ItemStack itemStackIn, boolean unused) + { +- return this.dropItem(itemStackIn, false, false); ++ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, itemStackIn, false); + } + + public EntityItem dropItem(ItemStack droppedItem, boolean dropAround, boolean traceItem) +@@ -771,13 +809,25 @@ + + public void joinEntityItemWithWorld(EntityItem p_71012_1_) + { ++ if (captureDrops) ++ { ++ capturedDrops.add(p_71012_1_); ++ return; ++ } ++ + this.worldObj.spawnEntityInWorld(p_71012_1_); + } + ++ @Deprecated //Use location sensitive version below + public float getToolDigEfficiency(Block p_180471_1_) + { +- float f = this.inventory.getStrVsBlock(p_180471_1_); ++ return getBreakSpeed(p_180471_1_.getDefaultState(), new BlockPos(0, -1, 0)); ++ } + ++ public float getBreakSpeed(IBlockState state, BlockPos pos) ++ { ++ ItemStack stack = inventory.getCurrentItem(); ++ float f = (stack == null ? 1.0F : stack.getItem().getDigSpeed(stack, state)); + if (f > 1.0F) + { + int i = EnchantmentHelper.getEfficiencyModifier(this); +@@ -827,12 +877,13 @@ + f /= 5.0F; + } + +- return f; ++ f = net.minecraftforge.event.ForgeEventFactory.getBreakSpeed(this, state, f, pos); ++ return (f < 0 ? 0 : f); + } + + public boolean canHarvestBlock(Block p_146099_1_) + { +- return this.inventory.func_146025_b(p_146099_1_); ++ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, p_146099_1_, this.inventory.func_146025_b(p_146099_1_)); + } + + public void readEntityFromNBT(NBTTagCompound tagCompund) +@@ -868,6 +919,16 @@ + this.spawnForced = tagCompund.getBoolean("SpawnForced"); + } + ++ NBTTagList spawnlist = null; ++ spawnlist = tagCompund.getTagList("Spawns", 10); ++ for (int i = 0; i < spawnlist.tagCount(); i++) ++ { ++ NBTTagCompound spawndata = (NBTTagCompound)spawnlist.getCompoundTagAt(i); ++ int spawndim = spawndata.getInteger("Dim"); ++ this.spawnChunkMap.put(spawndim, new BlockPos(spawndata.getInteger("SpawnX"), spawndata.getInteger("SpawnY"), spawndata.getInteger("SpawnZ"))); ++ this.spawnForcedMap.put(spawndim, spawndata.getBoolean("SpawnForced")); ++ } ++ + this.foodStats.readNBT(tagCompund); + this.capabilities.readCapabilitiesFromNBT(tagCompund); + +@@ -899,6 +960,23 @@ + tagCompound.setBoolean("SpawnForced", this.spawnForced); + } + ++ NBTTagList spawnlist = new NBTTagList(); ++ for (java.util.Map.Entry entry : this.spawnChunkMap.entrySet()) ++ { ++ BlockPos spawn = entry.getValue(); ++ if (spawn == null) continue; ++ Boolean forced = spawnForcedMap.get(entry.getKey()); ++ if (forced == null) forced = false; ++ NBTTagCompound spawndata = new NBTTagCompound(); ++ spawndata.setInteger("Dim", entry.getKey()); ++ spawndata.setInteger("SpawnX", spawn.getX()); ++ spawndata.setInteger("SpawnY", spawn.getY()); ++ spawndata.setInteger("SpawnZ", spawn.getZ()); ++ spawndata.setBoolean("SpawnForced", forced); ++ spawnlist.appendTag(spawndata); ++ } ++ tagCompound.setTag("Spawns", spawnlist); ++ + this.foodStats.writeNBT(tagCompound); + this.capabilities.writeCapabilitiesToNBT(tagCompound); + tagCompound.setTag("EnderItems", this.theInventoryEnderChest.saveInventoryToNBT()); +@@ -912,6 +990,7 @@ + + public boolean attackEntityFrom(DamageSource source, float amount) + { ++ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, source, amount)) return false; + if (this.isEntityInvulnerable(source)) + { + return false; +@@ -1008,12 +1087,15 @@ + { + if (!this.isEntityInvulnerable(damageSrc)) + { ++ damageAmount = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, damageSrc, damageAmount); ++ if (damageAmount <= 0) return; + if (!damageSrc.isUnblockable() && this.isBlocking() && damageAmount > 0.0F) + { + damageAmount = (1.0F + damageAmount) * 0.5F; + } + +- damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); ++ damageAmount = net.minecraftforge.common.ISpecialArmor.ArmorProperties.applyArmor(this, inventory.armorInventory, damageSrc, damageAmount); ++ if (damageAmount <= 0) return; + damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); + float f = damageAmount; + damageAmount = Math.max(damageAmount - this.getAbsorptionAmount(), 0.0F); +@@ -1075,6 +1157,7 @@ + } + else + { ++ if (!net.minecraftforge.event.ForgeEventFactory.canInteractWith(this, p_70998_1_)) return false; + ItemStack itemstack = this.getCurrentEquippedItem(); + ItemStack itemstack1 = itemstack != null ? itemstack.copy() : null; + +@@ -1126,7 +1209,9 @@ + + public void destroyCurrentEquippedItem() + { ++ ItemStack orig = getCurrentEquippedItem(); + this.inventory.setInventorySlotContents(this.inventory.currentItem, (ItemStack)null); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, orig); + } + + public double getYOffset() +@@ -1136,6 +1221,7 @@ + + public void attackTargetEntityWithCurrentItem(Entity targetEntity) + { ++ if (!net.minecraftforge.common.ForgeHooks.onPlayerAttackTarget(this, targetEntity)) return; + if (targetEntity.canAttackWithItem()) + { + if (!targetEntity.hitByEntity(this)) +@@ -1312,6 +1398,8 @@ + + public EntityPlayer.EnumStatus trySleep(BlockPos bedLocation) + { ++ EntityPlayer.EnumStatus ret = net.minecraftforge.event.ForgeEventFactory.onPlayerSleepInBed(this, bedLocation); ++ if (ret != null) return ret; + if (!this.worldObj.isRemote) + { + if (this.isPlayerSleeping() || !this.isEntityAlive()) +@@ -1353,7 +1441,7 @@ + + if (this.worldObj.isBlockLoaded(bedLocation)) + { +- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(bedLocation).getValue(BlockDirectional.FACING); ++ EnumFacing enumfacing = this.worldObj.getBlockState(bedLocation).getBlock().getBedDirection(worldObj, bedLocation); + float f = 0.5F; + float f1 = 0.5F; + +@@ -1416,13 +1504,14 @@ + + public void wakeUpPlayer(boolean p_70999_1_, boolean updateWorldFlag, boolean setSpawn) + { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this, p_70999_1_, updateWorldFlag, setSpawn); + this.setSize(0.6F, 1.8F); + IBlockState iblockstate = this.worldObj.getBlockState(this.playerLocation); + +- if (this.playerLocation != null && iblockstate.getBlock() == Blocks.bed) ++ if (this.playerLocation != null && iblockstate.getBlock().isBed(worldObj, playerLocation, this)) + { +- this.worldObj.setBlockState(this.playerLocation, iblockstate.withProperty(BlockBed.OCCUPIED, Boolean.valueOf(false)), 4); +- BlockPos blockpos = BlockBed.getSafeExitLocation(this.worldObj, this.playerLocation, 0); ++ iblockstate.getBlock().setBedOccupied(worldObj, playerLocation, this, false); ++ BlockPos blockpos = iblockstate.getBlock().getBedSpawnPosition(worldObj, playerLocation, this); + + if (blockpos == null) + { +@@ -1449,14 +1538,14 @@ + + private boolean isInBed() + { +- return this.worldObj.getBlockState(this.playerLocation).getBlock() == Blocks.bed; ++ return this.worldObj.getBlockState(this.playerLocation).getBlock().isBed(worldObj, playerLocation, this); + } + + public static BlockPos getBedSpawnLocation(World worldIn, BlockPos bedLocation, boolean forceSpawn) + { + Block block = worldIn.getBlockState(bedLocation).getBlock(); + +- if (block != Blocks.bed) ++ if (!block.isBed(worldIn, bedLocation, null)) + { + if (!forceSpawn) + { +@@ -1471,7 +1560,7 @@ + } + else + { +- return BlockBed.getSafeExitLocation(worldIn, bedLocation, 0); ++ return worldIn.getBlockState(bedLocation).getBlock().getBedSpawnPosition(worldIn, bedLocation, null); + } + } + +@@ -1480,7 +1569,7 @@ + { + if (this.playerLocation != null) + { +- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(this.playerLocation).getValue(BlockDirectional.FACING); ++ EnumFacing enumfacing = this.worldObj.getBlockState(this.playerLocation).getBlock().getBedDirection(worldObj, playerLocation); + + switch (enumfacing) + { +@@ -1520,16 +1609,24 @@ + + public BlockPos getBedLocation() + { +- return this.spawnChunk; ++ return getBedLocation(this.dimension); + } + ++ @Deprecated // Use dimension-sensitive version. + public boolean isSpawnForced() + { +- return this.spawnForced; ++ return isSpawnForced(this.dimension); + } + + public void setSpawnPoint(BlockPos pos, boolean forced) + { ++ if(net.minecraftforge.event.ForgeEventFactory.onPlayerSpawnSet(this, pos, forced)) return; ++ if (this.dimension != 0) ++ { ++ setSpawnChunk(pos, forced, this.dimension); ++ return; ++ } ++ + if (pos != null) + { + this.spawnChunk = pos; +@@ -1713,6 +1810,10 @@ + + super.fall(distance, damageMultiplier); + } ++ else ++ { ++ net.minecraftforge.event.ForgeEventFactory.onPlayerFall(this, distance, damageMultiplier); ++ } + } + + protected void resetHeight() +@@ -1736,6 +1837,7 @@ + } + + EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entityLivingIn))); ++ if (entitylist$entityegginfo == null) entitylist$entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.getEntityString(entityLivingIn)); + + if (entitylist$entityegginfo != null) + { +@@ -1848,6 +1950,8 @@ + { + if (stack != this.itemInUse) + { ++ duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, stack, duration); ++ if (duration <= 0) return; + this.itemInUse = stack; + this.itemInUseCount = duration; + +@@ -1919,6 +2023,10 @@ + this.field_181016_an = oldPlayer.field_181016_an; + this.field_181017_ao = oldPlayer.field_181017_ao; + this.field_181018_ap = oldPlayer.field_181018_ap; ++ //Copy and re-init ExtendedProperties when switching dimensions. ++ this.extendedProperties = oldPlayer.extendedProperties; ++ for (net.minecraftforge.common.IExtendedEntityProperties p : this.extendedProperties.values()) ++ p.init(this, this.worldObj); + } + else if (this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) + { +@@ -1932,6 +2040,18 @@ + this.xpSeed = oldPlayer.xpSeed; + this.theInventoryEnderChest = oldPlayer.theInventoryEnderChest; + this.getDataWatcher().updateObject(10, Byte.valueOf(oldPlayer.getDataWatcher().getWatchableObjectByte(10))); ++ ++ this.spawnChunkMap = oldPlayer.spawnChunkMap; ++ this.spawnForcedMap = oldPlayer.spawnForcedMap; ++ ++ //Copy over a section of the Entity Data from the old player. ++ //Allows mods to specify data that persists after players respawn. ++ NBTTagCompound old = oldPlayer.getEntityData(); ++ if (old.hasKey(PERSISTED_NBT_TAG)) ++ { ++ getEntityData().setTag(PERSISTED_NBT_TAG, old.getCompoundTag(PERSISTED_NBT_TAG)); ++ } ++ net.minecraftforge.event.ForgeEventFactory.onPlayerClone(this, oldPlayer, !respawnFromEnd); + } + + protected boolean canTriggerWalking() +@@ -1969,7 +2089,14 @@ + + public void setCurrentItemOrArmor(int slotIn, ItemStack stack) + { +- this.inventory.armorInventory[slotIn] = stack; ++ if (slotIn == 0) //Forge: Fix issue in Player where it doen't take into account selected item ++ { ++ this.inventory.mainInventory[this.inventory.currentItem] = stack; ++ } ++ else ++ { ++ this.inventory.armorInventory[slotIn - 1] = stack; ++ } + } + + @SideOnly(Side.CLIENT) +@@ -2014,7 +2141,10 @@ + + public IChatComponent getDisplayName() + { +- IChatComponent ichatcomponent = new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getName())); ++ IChatComponent ichatcomponent = new ChatComponentText(""); ++ if (!prefixes.isEmpty()) for (net.minecraft.util.IChatComponent prefix : prefixes) ichatcomponent.appendSibling(prefix); ++ ichatcomponent.appendSibling(new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getDisplayNameString()))); ++ if (!suffixes.isEmpty()) for (net.minecraft.util.IChatComponent suffix : suffixes) ichatcomponent.appendSibling(suffix); + ichatcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.getName() + " ")); + ichatcomponent.getChatStyle().setChatHoverEvent(this.func_174823_aP()); + ichatcomponent.getChatStyle().setInsertion(this.getName()); +@@ -2023,7 +2153,7 @@ + + public float getEyeHeight() + { +- float f = 1.62F; ++ float f = eyeHeight; + + if (this.isPlayerSleeping()) + { +@@ -2156,6 +2286,136 @@ + this.hasReducedDebug = reducedDebug; + } + ++ /** ++ * Opens a GUI with this player, uses FML's IGuiHandler system. ++ * Allows for extension by modders. ++ * ++ * @param mod The mod trying to open a GUI ++ * @param modGuiId GUI ID ++ * @param world Current World ++ * @param x Passed directly to IGuiHandler, data meaningless Typically world X position ++ * @param y Passed directly to IGuiHandler, data meaningless Typically world Y position ++ * @param z Passed directly to IGuiHandler, data meaningless Typically world Z position ++ */ ++ public void openGui(Object mod, int modGuiId, World world, int x, int y, int z) ++ { ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(this, mod, modGuiId, world, x, y, z); ++ } ++ ++ ++ /* ======================================== FORGE START =====================================*/ ++ /** ++ * A dimension aware version of getBedLocation. ++ * @param dimension The dimension to get the bed spawn for ++ * @return The player specific spawn location for the dimension. May be null. ++ */ ++ public BlockPos getBedLocation(int dimension) ++ { ++ return dimension == 0 ? spawnChunk : spawnChunkMap.get(dimension); ++ } ++ ++ /** ++ * A dimension aware version of isSpawnForced. ++ * Noramally isSpawnForced is used to determine if the respawn system should check for a bed or not. ++ * This just extends that to be dimension aware. ++ * @param dimension The dimension to get whether to check for a bed before spawning for ++ * @return The player specific spawn location for the dimension. May be null. ++ */ ++ public boolean isSpawnForced(int dimension) ++ { ++ if (dimension == 0) return this.spawnForced; ++ Boolean forced = this.spawnForcedMap.get(dimension); ++ return forced == null ? false : forced; ++ } ++ ++ /** ++ * A dimension aware version of setSpawnChunk. ++ * This functions identically, but allows you to specify which dimension to affect, rather than affecting the player's current dimension. ++ * @param pos The spawn point to set as the player-specific spawn point for the dimension ++ * @param forced Whether or not the respawn code should check for a bed at this location (true means it won't check for a bed) ++ * @param dimension Which dimension to apply the player-specific respawn point to ++ */ ++ public void setSpawnChunk(BlockPos pos, boolean forced, int dimension) ++ { ++ if (dimension == 0) ++ { ++ if (pos != null) ++ { ++ spawnChunk = pos; ++ spawnForced = forced; ++ } ++ else ++ { ++ spawnChunk = null; ++ spawnForced = false; ++ } ++ return; ++ } ++ ++ if (pos != null) ++ { ++ spawnChunkMap.put(dimension, pos); ++ spawnForcedMap.put(dimension, forced); ++ } ++ else ++ { ++ spawnChunkMap.remove(dimension); ++ spawnForcedMap.remove(dimension); ++ } ++ } ++ ++ private String displayname; ++ ++ /** ++ * Returns the default eye height of the player ++ * @return player default eye height ++ */ ++ public float getDefaultEyeHeight() ++ { ++ return 1.62F; ++ } ++ ++ /** ++ * Get the currently computed display name, cached for efficiency. ++ * @return the current display name ++ */ ++ public String getDisplayNameString() ++ { ++ if(this.displayname == null) ++ { ++ this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.getName()); ++ } ++ return this.displayname; ++ } ++ ++ /** ++ * Force the displayed name to refresh ++ */ ++ public void refreshDisplayName() ++ { ++ this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.getName()); ++ } ++ ++ private final java.util.Collection prefixes = new java.util.LinkedList(); ++ private final java.util.Collection suffixes = new java.util.LinkedList(); ++ ++ /** ++ * Add a prefix to the player's username in chat ++ * @param prefix The prefix ++ */ ++ public void addPrefix(net.minecraft.util.IChatComponent prefix) { prefixes.add(prefix); } ++ ++ /** ++ * Add a suffix to the player's username in chat ++ * @param suffix The suffix ++ */ ++ public void addSuffix(net.minecraft.util.IChatComponent suffix) { suffixes.add(suffix); } ++ ++ public java.util.Collection getPrefixes() { return this.prefixes; } ++ public java.util.Collection getSuffixes() { return this.suffixes; } ++ ++ /* ======================================== FORGE END =====================================*/ ++ + public static enum EnumChatVisibility + { + FULL(0, "options.chat.visibility.full"), From 632c190e6f4ac28b2ff88c559d0f515f422308b1 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 11 Nov 2015 23:30:06 +0300 Subject: [PATCH 017/133] GuiButton, GuiChat, GuiCreateWorld, GuiIngameMenu, ServerListEntryNormal, GuiStats rejects updated. --- .../minecraft/client/gui/GuiButton.java.patch | 12 ++++++++++ .../minecraft/client/gui/GuiChat.java.patch | 13 +++++++++++ .../client/gui/GuiCreateWorld.java.patch | 13 +++++++++-- .../client/gui/GuiIngameMenu.java.patch | 13 ++++++++++- .../gui/ServerListEntryNormal.java.patch | 23 +++++++++++++++++++ .../gui/achievement/GuiStats.java.patch | 20 ++++++++++++++++ .../client/gui/GuiButton.java.patch.rej | 15 ------------ .../client/gui/GuiChat.java.patch.rej | 15 ------------ .../client/gui/GuiCreateWorld.java.patch.rej | 10 -------- .../client/gui/GuiIngameMenu.java.patch.rej | 12 ---------- .../gui/ServerListEntryNormal.java.patch.rej | 23 ------------------- .../gui/achievement/GuiStats.java.patch.rej | 19 --------------- 12 files changed, 91 insertions(+), 97 deletions(-) create mode 100644 patches/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch create mode 100644 patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch delete mode 100644 rejects/minecraft/net/minecraft/client/gui/GuiButton.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/gui/GuiChat.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch.rej diff --git a/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch index b25e68b9a..280ace37b 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch @@ -8,3 +8,15 @@ public GuiButton(int buttonId, int x, int y, String buttonText) { +@@ -75,6 +76,11 @@ + this.mouseDragged(mc, mouseX, mouseY); + int j = 14737632; + ++ if (packedFGColour != 0) ++ { ++ j = packedFGColour; ++ } ++ else + if (!this.enabled) + { + j = 10526880; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch index fc3329929..96f7a74eb 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch @@ -16,3 +16,16 @@ BlockPos blockpos = null; if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) +@@ -282,6 +283,12 @@ + this.playerNamesFound = false; + this.foundPlayerNames.clear(); + ++ String[] complete = net.minecraftforge.client.ClientCommandHandler.instance.latestAutoComplete; ++ if (complete != null) ++ { ++ p_146406_1_ = com.google.common.collect.ObjectArrays.concat(complete, p_146406_1_, String.class); ++ } ++ + for (String s : p_146406_1_) + { + if (s.length() > 0) diff --git a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch index a5f273e6c..4cbd0e65b 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch @@ -1,6 +1,15 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java -@@ -313,14 +313,7 @@ +@@ -206,6 +206,8 @@ + } + } + ++ WorldType.worldTypes[this.selectedIndex].onGUICreateWorldPress(); ++ + WorldSettings.GameType worldsettings$gametype = WorldSettings.GameType.getByName(this.field_146342_r); + WorldSettings worldsettings = new WorldSettings(i, worldsettings$gametype, this.field_146341_s, this.field_146337_w, WorldType.worldTypes[this.selectedIndex]); + worldsettings.setWorldName(this.chunkProviderSettingsJson); +@@ -313,14 +315,7 @@ } else if (button.id == 8) { @@ -16,7 +25,7 @@ } } } -@@ -372,7 +365,7 @@ +@@ -372,7 +367,7 @@ this.btnBonusItems.visible = this.field_146344_y; this.btnMapType.visible = this.field_146344_y; this.btnAllowCommands.visible = this.field_146344_y; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch index 5f1c09f18..6d0d95970 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch @@ -1,6 +1,17 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiIngameMenu.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngameMenu.java -@@ -75,13 +75,19 @@ +@@ -31,8 +31,9 @@ + + this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 24 + i, I18n.format("menu.returnToGame", new Object[0]))); + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + i, 98, 20, I18n.format("menu.options", new Object[0]))); ++ this.buttonList.add(new GuiButton(12, this.width / 2 + 2, this.height / 4 + 96 + i, 98, 20, I18n.format("fml.menu.modoptions"))); + GuiButton guibutton; +- this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 + 2, this.height / 4 + 96 + i, 98, 20, I18n.format("menu.shareToLan", new Object[0]))); ++ this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 - 100, this.height / 4 + 72 + i, 200, 20, I18n.format("menu.shareToLan", new Object[0]))); + this.buttonList.add(new GuiButton(5, this.width / 2 - 100, this.height / 4 + 48 + i, 98, 20, I18n.format("gui.achievements", new Object[0]))); + this.buttonList.add(new GuiButton(6, this.width / 2 + 2, this.height / 4 + 48 + i, 98, 20, I18n.format("gui.stats", new Object[0]))); + guibutton.enabled = this.mc.isSingleplayer() && !this.mc.getIntegratedServer().getPublic(); +@@ -75,13 +76,19 @@ this.mc.setIngameFocus(); break; case 5: diff --git a/patches/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch b/patches/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch new file mode 100644 index 000000000..559859f08 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch @@ -0,0 +1,23 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java ++++ ../src-work/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java +@@ -84,7 +84,7 @@ + boolean flag1 = this.field_148301_e.version < 47; + boolean flag2 = flag || flag1; + this.field_148300_d.fontRendererObj.drawString(this.field_148301_e.serverName, x + 32 + 3, y + 1, 16777215); +- List list = this.field_148300_d.fontRendererObj.listFormattedStringToWidth(this.field_148301_e.serverMOTD, listWidth - 32 - 2); ++ List list = this.field_148300_d.fontRendererObj.listFormattedStringToWidth(net.minecraftforge.fml.client.FMLClientHandler.instance().fixDescription(this.field_148301_e.serverMOTD), listWidth - 48 - 2); + + for (int i = 0; i < Math.min(list.size(), 2); ++i) + { +@@ -178,6 +178,11 @@ + int i1 = mouseX - x; + int j1 = mouseY - y; + ++ String tooltip = net.minecraftforge.fml.client.FMLClientHandler.instance().enhanceServerListEntry(this, this.field_148301_e, x, listWidth, y, i1, j1); ++ if (tooltip != null) ++ { ++ this.field_148303_c.func_146793_a(tooltip); ++ } else + if (i1 >= listWidth - 15 && i1 <= listWidth - 5 && j1 >= 0 && j1 <= 8) + { + this.field_148303_c.func_146793_a(s1); diff --git a/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch b/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch new file mode 100644 index 000000000..04f8f99be --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch @@ -0,0 +1,20 @@ +--- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiStats.java ++++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiStats.java +@@ -759,7 +759,7 @@ + super(mcIn, GuiStats.this.width, GuiStats.this.height, 32, GuiStats.this.height - 64, GuiStats.this.fontRendererObj.FONT_HEIGHT * 4); + this.setShowSelectionBox(false); + +- for (EntityList.EntityEggInfo entitylist$entityegginfo : EntityList.entityEggs.values()) ++ for (EntityList.EntityEggInfo entitylist$entityegginfo : com.google.common.collect.Iterables.concat(EntityList.entityEggs.values(), net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().values())) + { + if (GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151512_d) > 0 || GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151513_e) > 0) + { +@@ -795,7 +795,7 @@ + protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int p_180791_5_, int p_180791_6_) + { + EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)this.field_148222_l.get(entryID); +- String s = I18n.format("entity." + EntityList.getStringFromID(entitylist$entityegginfo.spawnedID) + ".name", new Object[0]); ++ String s = I18n.format("entity." + entitylist$entityegginfo.name + ".name", new Object[0]); + int i = GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151512_d); + int j = GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151513_e); + String s1 = I18n.format("stat.entityKills", new Object[] {Integer.valueOf(i), s}); diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiButton.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiButton.java.patch.rej deleted file mode 100644 index 59560fdc2..000000000 --- a/rejects/minecraft/net/minecraft/client/gui/GuiButton.java.patch.rej +++ /dev/null @@ -1,15 +0,0 @@ -++++ REJECTED PATCH 2 - this.mouseDragged(mc, mouseX, mouseY); - int l = 14737632; - -- if (!this.enabled) -+ if (packedFGColour != 0) - { -+ l = packedFGColour; -+ } -+ else if (!this.enabled) -+ { - l = 10526880; - } - else if (this.hovered) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiChat.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiChat.java.patch.rej deleted file mode 100644 index 632b6e243..000000000 --- a/rejects/minecraft/net/minecraft/client/gui/GuiChat.java.patch.rej +++ /dev/null @@ -1,15 +0,0 @@ -++++ REJECTED PATCH 2 - String[] astring1 = p_146406_1_; - int i = p_146406_1_.length; - -+ String[] complete = net.minecraftforge.client.ClientCommandHandler.instance.latestAutoComplete; -+ if (complete != null) -+ { -+ astring1 = com.google.common.collect.ObjectArrays.concat(complete, astring1, String.class); -+ i = astring1.length; -+ } -+ - for (int j = 0; j < i; ++j) - { - String s = astring1[j]; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch.rej deleted file mode 100644 index 2cfa568ec..000000000 --- a/rejects/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - } - } - -+ WorldType.worldTypes[this.selectedIndex].onGUICreateWorldPress(); -+ - WorldSettings.GameType gametype = WorldSettings.GameType.getByName(this.field_146342_r); - WorldSettings worldsettings = new WorldSettings(i, gametype, this.field_146341_s, this.field_146337_w, WorldType.worldTypes[this.selectedIndex]); - worldsettings.setWorldName(this.chunkProviderSettingsJson); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch.rej deleted file mode 100644 index e8e38dc2a..000000000 --- a/rejects/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch.rej +++ /dev/null @@ -1,12 +0,0 @@ -++++ REJECTED PATCH 1 - - this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 24 + b0, I18n.format("menu.returnToGame", new Object[0]))); - this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + b0, 98, 20, I18n.format("menu.options", new Object[0]))); -+ this.buttonList.add(new GuiButton(12, this.width / 2 + 2, this.height / 4 + 96 + b0, 98, 20, I18n.format("fml.menu.modoptions"))); - GuiButton guibutton; -- this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 + 2, this.height / 4 + 96 + b0, 98, 20, I18n.format("menu.shareToLan", new Object[0]))); -+ this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 - 100, this.height / 4 + 72 + b0, 200, 20, I18n.format("menu.shareToLan", new Object[0]))); - this.buttonList.add(new GuiButton(5, this.width / 2 - 100, this.height / 4 + 48 + b0, 98, 20, I18n.format("gui.achievements", new Object[0]))); - this.buttonList.add(new GuiButton(6, this.width / 2 + 2, this.height / 4 + 48 + b0, 98, 20, I18n.format("gui.stats", new Object[0]))); - guibutton.enabled = this.mc.isSingleplayer() && !this.mc.getIntegratedServer().getPublic(); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch.rej deleted file mode 100644 index 3b5b99109..000000000 --- a/rejects/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch.rej +++ /dev/null @@ -1,23 +0,0 @@ -++++ REJECTED PATCH 1 - boolean flag2 = this.field_148301_e.version < 47; - boolean flag3 = flag1 || flag2; - this.field_148300_d.fontRendererObj.drawString(this.field_148301_e.serverName, x + 32 + 3, y + 1, 16777215); -- List list = this.field_148300_d.fontRendererObj.listFormattedStringToWidth(this.field_148301_e.serverMOTD, listWidth - 32 - 2); -+ List list = this.field_148300_d.fontRendererObj.listFormattedStringToWidth(net.minecraftforge.fml.client.FMLClientHandler.instance().fixDescription(this.field_148301_e.serverMOTD), listWidth - 48 - 2); - - for (int l1 = 0; l1 < Math.min(list.size(), 2); ++l1) - { -++++ END PATCH -++++ REJECTED PATCH 2 - int k2 = mouseX - x; - int l2 = mouseY - y; - -+ String tooltip = net.minecraftforge.fml.client.FMLClientHandler.instance().enhanceServerListEntry(this, this.field_148301_e, x, listWidth, y, k2, l2); -+ if (tooltip != null) -+ { -+ this.field_148303_c.func_146793_a(tooltip); -+ } else - if (k2 >= listWidth - 15 && k2 <= listWidth - 5 && l2 >= 0 && l2 <= 8) - { - this.field_148303_c.func_146793_a(s1); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch.rej b/rejects/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch.rej deleted file mode 100644 index 79ff66de3..000000000 --- a/rejects/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch.rej +++ /dev/null @@ -1,19 +0,0 @@ -++++ REJECTED PATCH 1 - super(mcIn, GuiStats.this.width, GuiStats.this.height, 32, GuiStats.this.height - 64, GuiStats.this.fontRendererObj.FONT_HEIGHT * 4); - this.setShowSelectionBox(false); - Iterator iterator = EntityList.entityEggs.values().iterator(); -+ iterator = com.google.common.collect.Iterators.concat(iterator, net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().values().iterator()); - - while (iterator.hasNext()) - { -++++ END PATCH -++++ REJECTED PATCH 2 - protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int p_180791_5_, int p_180791_6_) - { - EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)this.field_148222_l.get(entryID); -- String s = I18n.format("entity." + EntityList.getStringFromID(entityegginfo.spawnedID) + ".name", new Object[0]); -+ String s = I18n.format("entity." + entityegginfo.name + ".name", new Object[0]); - int k1 = GuiStats.this.field_146546_t.readStat(entityegginfo.field_151512_d); - int l1 = GuiStats.this.field_146546_t.readStat(entityegginfo.field_151513_e); - String s1 = I18n.format("stat.entityKills", new Object[] {Integer.valueOf(k1), s}); -++++ END PATCH From 9deb54b75fbe43ebaa1ddd2688c68d92f8448ce4 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Thu, 12 Nov 2015 18:24:15 +0300 Subject: [PATCH 018/133] RenderEntityItem, RenderPlayer, RendererLivingEntity, LayerArmorBase, ItemStack rejects fixed; changed Armor Layer hook to catch LayerBipedArmor only. --- .../entity/RenderEntityItem.java.patch | 9 ++ .../renderer/entity/RenderPlayer.java.patch | 12 ++- .../entity/RendererLivingEntity.java.patch | 17 +++- .../entity/layers/LayerArmorBase.java.patch | 89 +++++++++++++++++++ .../entity/layers/LayerBipedArmor.java.patch | 13 +++ .../net/minecraft/item/Item.java.patch | 2 +- .../net/minecraft/item/ItemStack.java.patch | 19 +++- .../entity/RenderEntityItem.java.patch.rej | 26 ------ .../entity/RenderPlayer.java.patch.rej | 9 -- .../RendererLivingEntity.java.patch.rej | 14 --- .../layers/LayerArmorBase.java.patch.rej | 88 ------------------ .../minecraft/item/ItemStack.java.patch.rej | 20 ----- .../client/ForgeHooksClient.java | 11 ++- 13 files changed, 160 insertions(+), 169 deletions(-) create mode 100644 patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/item/ItemStack.java.patch.rej diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch index fbe25532c..3e67a9229 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch @@ -1,5 +1,14 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java +@@ -42,7 +42,7 @@ + boolean flag = p_177077_9_.isGui3d(); + int i = this.func_177078_a(itemstack); + float f = 0.25F; +- float f1 = MathHelper.sin(((float)p_177077_1_.getAge() + p_177077_8_) / 10.0F + p_177077_1_.hoverStart) * 0.1F + 0.1F; ++ float f1 = shouldBob() ? MathHelper.sin(((float)p_177077_1_.getAge() + p_177077_8_) / 10.0F + p_177077_1_.hoverStart) * 0.1F + 0.1F : 0; + float f2 = p_177077_9_.getItemCameraTransforms().func_181688_b(ItemCameraTransforms.TransformType.GROUND).scale.y; + GlStateManager.translate((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_); + @@ -158,4 +158,25 @@ { return TextureMap.locationBlocksTexture; diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch index bc5b356d7..d00961be8 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch @@ -1,10 +1,18 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java -@@ -62,6 +62,7 @@ +@@ -50,6 +50,7 @@ + + public void doRender(AbstractClientPlayer entity, double x, double y, double z, float p_76986_8_, float partialTicks) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(entity, this, partialTicks, x, y, z))) return; + if (!entity.isUser() || this.renderManager.livingPlayer == entity) + { + double d0 = y; +@@ -62,6 +63,7 @@ this.func_177137_d(entity); super.doRender(entity, x, d0, z, p_76986_8_, partialTicks); } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(p_180596_1_, this, p_180596_9_, p_180596_2_, p_180596_4_, p_180596_6_)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(entity, this, partialTicks, x, y, z)); } private void func_177137_d(AbstractClientPlayer p_177137_1_) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch index 8548073e1..e18e068cd 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch @@ -26,11 +26,24 @@ } protected boolean func_177088_c(T p_177088_1_) -@@ -519,6 +524,7 @@ +@@ -470,10 +475,11 @@ + + public void renderName(T entity, double x, double y, double z) + { ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre(entity, this, x, y, z))) return; + if (this.canRenderName(entity)) + { + double d0 = entity.getDistanceSqToEntity(this.renderManager.livingPlayer); +- float f = entity.isSneaking() ? 32.0F : 64.0F; ++ float f = entity.isSneaking() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE; + + if (d0 < (double)(f * f)) + { +@@ -519,6 +525,7 @@ } } } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Post(p_77033_1_, this, p_77033_2_, p_77033_4_, p_77033_6_)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Post(entity, this, x, y, z)); } protected boolean canRenderName(T entity) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch index 117c5c7c4..49f5846e7 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch @@ -1,5 +1,44 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java +@@ -56,28 +56,28 @@ + T t = this.func_177175_a(p_177182_9_); + t.setModelAttributes(this.field_177190_a.getMainModel()); + t.setLivingAnimations(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_4_); ++ t = getArmorModelHook(p_177182_1_, itemstack, p_177182_9_, t); + this.func_177179_a(t, p_177182_9_); + boolean flag = this.func_177180_b(p_177182_9_); + this.field_177190_a.bindTexture(this.getArmorResource(itemarmor, flag)); + +- switch (itemarmor.getArmorMaterial()) +- { +- case LEATHER: + int i = itemarmor.getColor(itemstack); ++ { ++ if (i != -1) // Allow this for anything, not only cloth. ++ { + float f = (float)(i >> 16 & 255) / 255.0F; + float f1 = (float)(i >> 8 & 255) / 255.0F; + float f2 = (float)(i & 255) / 255.0F; + GlStateManager.color(this.field_177184_f * f, this.field_177185_g * f1, this.field_177192_h * f2, this.field_177187_e); + t.render(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); +- this.field_177190_a.bindTexture(this.getArmorResource(itemarmor, flag, "overlay")); +- case CHAIN: +- case IRON: +- case GOLD: +- case DIAMOND: ++ this.field_177190_a.bindTexture(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, "overlay")); ++ } ++ else // Non-colored ++ { + GlStateManager.color(this.field_177184_f, this.field_177185_g, this.field_177192_h, this.field_177187_e); + t.render(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); +- default: +- ++ } ++ // Default + if (!this.field_177193_i && itemstack.isItemEnchanted()) + { + this.func_177183_a(p_177182_1_, t, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); @@ -136,11 +136,13 @@ GlStateManager.disableBlend(); } @@ -14,3 +53,53 @@ private ResourceLocation getArmorResource(ItemArmor p_177178_1_, boolean p_177178_2_, String p_177178_3_) { String s = String.format("textures/models/armor/%s_layer_%d%s.png", new Object[] {p_177178_1_.getArmorMaterial().getName(), Integer.valueOf(p_177178_2_ ? 2 : 1), p_177178_3_ == null ? "" : String.format("_%s", new Object[]{p_177178_3_})}); +@@ -158,4 +160,49 @@ + protected abstract void func_177177_a(); + + protected abstract void func_177179_a(T p_177179_1_, int p_177179_2_); ++ ++ /*=================================== FORGE START =========================================*/ ++ ++ /** ++ * Hook to allow item-sensitive armor model. for LayerBipedArmor. ++ */ ++ protected T getArmorModelHook(EntityLivingBase entity, ItemStack itemStack, int slot, T model) ++ { ++ return model; ++ } ++ ++ /** ++ * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide. ++ * ++ * @param entity Entity wearing the armor ++ * @param stack ItemStack for the armor ++ * @param slot Slot ID that the item is in ++ * @param type Subtype, can be null or "overlay" ++ * @return ResourceLocation pointing at the armor's texture ++ */ ++ public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, int slot, String type) ++ { ++ ItemArmor item = (ItemArmor)stack.getItem(); ++ String texture = item.getArmorMaterial().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, (slot == 2 ? 2 : 1), type == null ? "" : String.format("_%s", type)); ++ ++ s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type); ++ ResourceLocation resourcelocation = (ResourceLocation)field_177191_j.get(s1); ++ ++ if (resourcelocation == null) ++ { ++ resourcelocation = new ResourceLocation(s1); ++ field_177191_j.put(s1, resourcelocation); ++ } ++ ++ return resourcelocation; ++ } ++ /*=================================== FORGE END ===========================================*/ + } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch new file mode 100644 index 000000000..9990cb44a --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch @@ -0,0 +1,13 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java +@@ -51,4 +51,10 @@ + { + p_177194_1_.setInvisible(false); + } ++ ++ @Override ++ protected ModelBiped getArmorModelHook(net.minecraft.entity.EntityLivingBase entity, net.minecraft.item.ItemStack itemStack, int slot, ModelBiped model) ++ { ++ return net.minecraftforge.client.ForgeHooksClient.getArmorModel(entity, itemStack, slot, model); ++ } + } diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index d09253616..2bd466c34 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -71,7 +71,7 @@ + /** + * ItemStack sensitive version of getItemAttributeModifiers + */ -+ public Multimap getAttributeModifiers(ItemStack stack) ++ public Multimap getAttributeModifiers(ItemStack stack) + { + return this.getItemAttributeModifiers(); + } diff --git a/patches/minecraft/net/minecraft/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/item/ItemStack.java.patch index a52cb1433..d750d56ce 100644 --- a/patches/minecraft/net/minecraft/item/ItemStack.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemStack.java.patch @@ -121,7 +121,24 @@ } public boolean interactWithEntity(EntityPlayer playerIn, EntityLivingBase entityIn) -@@ -861,6 +858,7 @@ +@@ -743,6 +740,7 @@ + } + } + ++ net.minecraftforge.event.ForgeEventFactory.onItemTooltip(this, playerIn, list, advanced); + return list; + } + +@@ -853,7 +851,7 @@ + } + else + { +- multimap = this.getItem().getItemAttributeModifiers(); ++ multimap = this.getItem().getAttributeModifiers(this); + } + + return multimap; +@@ -861,6 +859,7 @@ public void setItem(Item newItem) { diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch.rej deleted file mode 100644 index 06899dd6e..000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch.rej +++ /dev/null @@ -1,26 +0,0 @@ -++++ REJECTED PATCH 1 - boolean flag = p_177077_9_.isGui3d(); - int i = this.func_177078_a(itemstack); - float f1 = 0.25F; -- float f2 = MathHelper.sin(((float)p_177077_1_.getAge() + p_177077_8_) / 10.0F + p_177077_1_.hoverStart) * 0.1F + 0.1F; -+ float f2 = shouldBob() ? MathHelper.sin(((float)p_177077_1_.getAge() + p_177077_8_) / 10.0F + p_177077_1_.hoverStart) * 0.1F + 0.1F : 0.0F; - GlStateManager.translate((float)p_177077_2_, (float)p_177077_4_ + f2 + 0.25F, (float)p_177077_6_); - float f3; - -++++ END PATCH -++++ REJECTED PATCH 2 - } - else - { -+ // Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug... -+ if (j > 0 && shouldSpreadItems()) -+ { -+ float f2 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; -+ float f3 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; -+ float f4 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; -+ GlStateManager.translate(f2, f3, 0); -+ } - this.field_177080_a.renderItem(itemstack, ibakedmodel); - GlStateManager.translate(0.0F, 0.0F, 0.046875F); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch.rej deleted file mode 100644 index 1cd962de4..000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 1 - - public void func_180596_a(AbstractClientPlayer p_180596_1_, double p_180596_2_, double p_180596_4_, double p_180596_6_, float p_180596_8_, float p_180596_9_) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(p_180596_1_, this, p_180596_9_, p_180596_2_, p_180596_4_, p_180596_6_))) return; - if (!p_180596_1_.isUser() || this.renderManager.livingPlayer == p_180596_1_) - { - double d3 = p_180596_4_; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch.rej deleted file mode 100644 index 6d8c9bea4..000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch.rej +++ /dev/null @@ -1,14 +0,0 @@ -++++ REJECTED PATCH 4 - - public void passSpecialRender(EntityLivingBase p_77033_1_, double p_77033_2_, double p_77033_4_, double p_77033_6_) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre(p_77033_1_, this, p_77033_2_, p_77033_4_, p_77033_6_))) return; - if (this.canRenderName(p_77033_1_)) - { - double d3 = p_77033_1_.getDistanceSqToEntity(this.renderManager.livingPlayer); -- float f = p_77033_1_.isSneaking() ? 32.0F : 64.0F; -+ float f = p_77033_1_.isSneaking() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE; - - if (d3 < (double)(f * f)) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch.rej deleted file mode 100644 index e50d4cdfc..000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch.rej +++ /dev/null @@ -1,88 +0,0 @@ -++++ REJECTED PATCH 1 - ModelBase modelbase = this.func_177175_a(p_177182_9_); - modelbase.setModelAttributes(this.field_177190_a.getMainModel()); - modelbase.setLivingAnimations(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_4_); -+ modelbase = net.minecraftforge.client.ForgeHooksClient.getArmorModel(p_177182_1_, itemstack, p_177182_9_, modelbase); - this.func_177179_a(modelbase, p_177182_9_); - boolean flag = this.func_177180_b(p_177182_9_); -- this.field_177190_a.bindTexture(this.getArmorResource(itemarmor, flag)); -+ this.field_177190_a.bindTexture(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, null)); - -- switch (LayerArmorBase.SwitchArmorMaterial.field_178747_a[itemarmor.getArmorMaterial().ordinal()]) - { -- case 1: -- int j = itemarmor.getColor(itemstack); -+ int j = itemarmor.getColor(itemstack); -+ if (j != -1) //Allow this for anything, not only cloth. -+ { - float f7 = (float)(j >> 16 & 255) / 255.0F; - float f8 = (float)(j >> 8 & 255) / 255.0F; - float f9 = (float)(j & 255) / 255.0F; - GlStateManager.color(this.field_177184_f * f7, this.field_177185_g * f8, this.field_177192_h * f9, this.field_177187_e); - modelbase.render(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); -- this.field_177190_a.bindTexture(this.getArmorResource(itemarmor, flag, "overlay")); -- case 2: -- case 3: -- case 4: -- case 5: -+ this.field_177190_a.bindTexture(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, "overlay")); -+ } -+ { // Non-cloth - GlStateManager.color(this.field_177184_f, this.field_177185_g, this.field_177192_h, this.field_177187_e); - modelbase.render(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); -- default: -+ } -+ { // Default, Why is this a switch? there were no breaks. - if (!this.field_177193_i && itemstack.isItemEnchanted()) - { - this.func_177183_a(p_177182_1_, modelbase, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); - } -+ } - } - } - } -++++ END PATCH -++++ REJECTED PATCH 3 - - protected abstract void func_177179_a(ModelBase p_177179_1_, int p_177179_2_); - -+ /*=================================== FORGE START =========================================*/ -+ /** -+ * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide. -+ * -+ * @param entity Entity wearing the armor -+ * @param stack ItemStack for the armor -+ * @param slot Slot ID that the item is in -+ * @param type Subtype, can be null or "overlay" -+ * @return ResourceLocation pointing at the armor's texture -+ */ -+ public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, int slot, String type) -+ { -+ ItemArmor item = (ItemArmor)stack.getItem(); -+ String texture = ((ItemArmor)stack.getItem()).getArmorMaterial().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, (slot == 2 ? 2 : 1), type == null ? "" : String.format("_%s", type)); -+ -+ s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type); -+ ResourceLocation resourcelocation = (ResourceLocation)field_177191_j.get(s1); -+ -+ if (resourcelocation == null) -+ { -+ resourcelocation = new ResourceLocation(s1); -+ field_177191_j.put(s1, resourcelocation); -+ } -+ -+ return resourcelocation; -+ } -+ /*=================================== FORGE END ===========================================*/ -+ - @SideOnly(Side.CLIENT) - - static final class SwitchArmorMaterial -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemStack.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemStack.java.patch.rej deleted file mode 100644 index eee0c2642..000000000 --- a/rejects/minecraft/net/minecraft/item/ItemStack.java.patch.rej +++ /dev/null @@ -1,20 +0,0 @@ -++++ REJECTED PATCH 10 - } - } - -+ net.minecraftforge.event.ForgeEventFactory.onItemTooltip(this, playerIn, arraylist, advanced); -+ - return arraylist; - } - -++++ END PATCH -++++ REJECTED PATCH 11 - } - else - { -- object = this.getItem().getItemAttributeModifiers(); -+ object = this.getItem().getAttributeModifiers(this); - } - - return (Multimap)object; -++++ END PATCH diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index fdf0c3059..2fc962352 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -10,7 +10,6 @@ import java.nio.FloatBuffer; import java.util.Map; import javax.vecmath.Matrix4f; -import javax.vecmath.Vector3d; import javax.vecmath.Vector3f; import javax.vecmath.Vector4f; @@ -23,7 +22,7 @@ import net.minecraft.client.audio.SoundManager; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.EntityRenderer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; @@ -32,7 +31,6 @@ import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.block.model.ItemTransformVec3f; -import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; @@ -91,6 +89,7 @@ import org.lwjgl.opengl.GL11; + import com.google.common.collect.Maps; public class ForgeHooksClient @@ -326,10 +325,10 @@ public class ForgeHooksClient renderLayer.set(layer); } - public static ModelBase getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int slotID, ModelBase _default) + public static ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int slotID, ModelBiped _default) { - ModelBase modelbase = itemStack.getItem().getArmorModel(entityLiving, itemStack, slotID); - return modelbase == null ? _default : modelbase; + ModelBiped model = itemStack.getItem().getArmorModel(entityLiving, itemStack, slotID); + return model == null ? _default : model; } //This properly moves the domain, if provided, to the front of the string before concatenating From 8000e22830b9ad991dcde7ffab83973861b1f7da Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Thu, 12 Nov 2015 19:12:58 +0300 Subject: [PATCH 019/133] ItemRenderer, RenderGlobal, StateMap, RenderItem rejects updated. --- .../client/renderer/ItemRenderer.java.patch | 6 +- .../client/renderer/RenderGlobal.java.patch | 78 ++++++++++++++++++- .../block/statemap/StateMap.java.patch | 11 +++ .../renderer/entity/RenderItem.java.patch | 28 ++++++- .../renderer/ItemRenderer.java.patch.rej | 21 ----- .../renderer/RenderGlobal.java.patch.rej | 70 ----------------- .../block/statemap/StateMap.java.patch.rej | 10 --- .../renderer/entity/RenderItem.java.patch.rej | 48 ------------ 8 files changed, 114 insertions(+), 158 deletions(-) create mode 100644 patches/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch.rej diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch index bd6f7ee7f..21f3f3166 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -13,7 +13,7 @@ if (iblockstate.getBlock().getRenderType() != -1) { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(mc.thePlayer, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, blockpos)) ++ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(mc.thePlayer, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, new BlockPos(this.mc.thePlayer))) this.func_178108_a(p_78447_1_, this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate)); } } @@ -35,10 +35,10 @@ { if (!this.itemToRender.getIsItemStackEqual(itemstack)) { -+ if (!this.itemToRender.getItem().shouldCauseReequipAnimation(this.itemToRender, itemstack, equippedItemSlot != entityplayersp.inventory.currentItem)) ++ if (!this.itemToRender.getItem().shouldCauseReequipAnimation(this.itemToRender, itemstack, equippedItemSlot != entityplayer.inventory.currentItem)) + { + this.itemToRender = itemstack; -+ this.equippedItemSlot = entityplayersp.inventory.currentItem; ++ this.equippedItemSlot = entityplayer.inventory.currentItem; + return; + } flag = true; diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch index f1f271bb1..4f94ca678 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch @@ -11,7 +11,77 @@ --this.renderEntitiesStartupCounter; } else -@@ -1162,6 +1164,12 @@ +@@ -538,9 +540,12 @@ + this.theWorld.theProfiler.startSection("prepare"); + TileEntityRendererDispatcher.instance.cacheActiveRenderInfo(this.theWorld, this.mc.getTextureManager(), this.mc.fontRendererObj, this.mc.getRenderViewEntity(), partialTicks); + this.renderManager.cacheActiveRenderInfo(this.theWorld, this.mc.fontRendererObj, this.mc.getRenderViewEntity(), this.mc.pointedEntity, this.mc.gameSettings, partialTicks); ++ if(pass == 0) ++ { + this.countEntitiesTotal = 0; + this.countEntitiesRendered = 0; + this.countEntitiesHidden = 0; ++ } + Entity entity = this.mc.getRenderViewEntity(); + double d3 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; + double d4 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; +@@ -552,11 +557,15 @@ + this.mc.entityRenderer.enableLightmap(); + this.theWorld.theProfiler.endStartSection("global"); + List list = this.theWorld.getLoadedEntityList(); ++ if (pass == 0) ++ { + this.countEntitiesTotal = list.size(); ++ } + + for (int i = 0; i < this.theWorld.weatherEffects.size(); ++i) + { + Entity entity1 = (Entity)this.theWorld.weatherEffects.get(i); ++ if (!entity1.shouldRenderInPass(pass)) continue; + ++this.countEntitiesRendered; + + if (entity1.isInRangeToRender3d(d0, d1, d2)) +@@ -578,6 +587,7 @@ + for (int j = 0; j < list.size(); ++j) + { + Entity entity3 = (Entity)list.get(j); ++ if (!entity3.shouldRenderInPass(pass)) continue; + boolean flag = this.mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping(); + boolean flag1 = entity3.isInRangeToRender3d(d0, d1, d2) && (entity3.ignoreFrustumCheck || p_180446_2_.isBoundingBoxInFrustum(entity3.getEntityBoundingBox()) || entity3.riddenByEntity == this.mc.thePlayer) && entity3 instanceof EntityPlayer; + +@@ -627,6 +637,7 @@ + } + + entity2 = (Entity)iterator.next(); ++ if (!entity2.shouldRenderInPass(pass)) continue; + flag2 = this.renderManager.shouldRender(entity2, p_180446_2_, d0, d1, d2) || entity2.riddenByEntity == this.mc.thePlayer; + + if (!flag2) +@@ -663,6 +674,7 @@ + { + for (TileEntity tileentity2 : list1) + { ++ if (!tileentity2.shouldRenderInPass(pass) || !p_180446_2_.isBoundingBoxInFrustum(tileentity2.getRenderBoundingBox())) continue; + TileEntityRendererDispatcher.instance.renderTileEntity(tileentity2, partialTicks, -1); + } + } +@@ -672,6 +684,7 @@ + { + for (TileEntity tileentity : this.field_181024_n) + { ++ if (!tileentity.shouldRenderInPass(pass) || !p_180446_2_.isBoundingBoxInFrustum(tileentity.getRenderBoundingBox())) continue; + TileEntityRendererDispatcher.instance.renderTileEntity(tileentity, partialTicks, -1); + } + } +@@ -701,7 +714,7 @@ + + Block block = this.theWorld.getBlockState(blockpos).getBlock(); + +- if (tileentity1 != null && (block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull)) ++ if (tileentity1 != null && tileentity1.shouldRenderInPass(pass) && tileentity1.canRenderBreaking() && p_180446_2_.isBoundingBoxInFrustum(tileentity1.getRenderBoundingBox())) + { + TileEntityRendererDispatcher.instance.renderTileEntity(tileentity1, partialTicks, destroyblockprogress.getPartialBlockDamage()); + } +@@ -1162,6 +1175,12 @@ public void renderSky(float partialTicks, int pass) { @@ -24,7 +94,7 @@ if (this.mc.theWorld.provider.getDimensionId() == 1) { this.renderSkyEnd(); -@@ -1379,6 +1387,12 @@ +@@ -1379,6 +1398,12 @@ public void renderClouds(float p_180447_1_, int p_180447_2_) { @@ -37,7 +107,7 @@ if (this.mc.theWorld.provider.isSurfaceWorld()) { if (this.mc.gameSettings.func_181147_e() == 2) -@@ -1794,8 +1808,11 @@ +@@ -1794,8 +1819,11 @@ double d4 = (double)blockpos.getY() - d1; double d5 = (double)blockpos.getZ() - d2; Block block = this.theWorld.getBlockState(blockpos).getBlock(); @@ -50,7 +120,7 @@ { if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) { -@@ -1950,13 +1967,16 @@ +@@ -1950,13 +1978,16 @@ if (recordName != null) { ItemRecord itemrecord = ItemRecord.getRecord(recordName); diff --git a/patches/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch new file mode 100644 index 000000000..dc720dc0a --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java +@@ -39,7 +39,7 @@ + } + else + { +- s = ((IProperty)this.property).getName((Comparable)map.remove(this.property)); ++ s = String.format("%s:%s", ((ResourceLocation)Block.blockRegistry.getNameForObject(p_178132_1_.getBlock())).getResourceDomain(), ((IProperty)this.property).getName((Comparable)map.remove(this.property))); + } + + if (this.suffix != null) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch index e3ebd0b1b..4539a84eb 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch @@ -24,7 +24,7 @@ } + else + { -+ // TODO: add back getModel; maybe switch to the smart player model / normal smart item model? ++ // TODO: maybe switch to the smart player model / normal smart item model? + modelresourcelocation = item.getModel(stack, entityplayer, entityplayer.getItemInUseCount()); + } @@ -56,7 +56,31 @@ this.renderItem(stack, ibakedmodel); GlStateManager.disableAlpha(); GlStateManager.disableRescaleNormal(); -@@ -1048,6 +1048,7 @@ +@@ -464,10 +464,11 @@ + GlStateManager.enableDepth(); + } + +- if (stack.isItemDamaged()) ++ if (stack.getItem().showDurabilityBar(stack)) + { +- int j = (int)Math.round(13.0D - (double)stack.getItemDamage() * 13.0D / (double)stack.getMaxDamage()); +- int i = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage()); ++ double health = stack.getItem().getDurabilityForDisplay(stack); ++ int j = (int)Math.round(13.0D - health * 13.0D); ++ int i = (int)Math.round(255.0D - health * 255.0D); + GlStateManager.disableLighting(); + GlStateManager.disableDepth(); + GlStateManager.disableTexture2D(); +@@ -478,7 +479,7 @@ + this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255); + this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 12, 1, (255 - i) / 4, 64, 0, 255); + this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, j, 1, 255 - i, i, 0, 255); +- GlStateManager.enableBlend(); ++ //GlStateManager.enableBlend(); // Forge: Disable Blend because it screws with a lot of things down the line. + GlStateManager.enableAlpha(); + GlStateManager.enableTexture2D(); + GlStateManager.enableLighting(); +@@ -1048,6 +1049,7 @@ this.registerBlock(Blocks.brown_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "brown_mushroom_block"); this.registerBlock(Blocks.red_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "red_mushroom_block"); this.registerBlock(Blocks.dragon_egg, "dragon_egg"); diff --git a/rejects/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch.rej deleted file mode 100644 index eb1f67330..000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch.rej +++ /dev/null @@ -1,21 +0,0 @@ -++++ REJECTED PATCH 2 - - if (this.mc.thePlayer.isEntityInsideOpaqueBlock()) - { -- IBlockState iblockstate = this.mc.theWorld.getBlockState(new BlockPos(this.mc.thePlayer)); -+ BlockPos blockpos = new BlockPos(this.mc.thePlayer); -+ IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); - EntityPlayerSP entityplayersp = this.mc.thePlayer; - - for (int i = 0; i < 8; ++i) -++++ END PATCH -++++ REJECTED PATCH 3 - double d0 = entityplayersp.posX + (double)(((float)((i >> 0) % 2) - 0.5F) * entityplayersp.width * 0.8F); - double d1 = entityplayersp.posY + (double)(((float)((i >> 1) % 2) - 0.5F) * 0.1F); - double d2 = entityplayersp.posZ + (double)(((float)((i >> 2) % 2) - 0.5F) * entityplayersp.width * 0.8F); -- BlockPos blockpos = new BlockPos(d0, d1 + (double)entityplayersp.getEyeHeight(), d2); -+ blockpos = new BlockPos(d0, d1 + (double)entityplayersp.getEyeHeight(), d2); - IBlockState iblockstate1 = this.mc.theWorld.getBlockState(blockpos); - - if (iblockstate1.getBlock().isVisuallyOpaque()) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch.rej deleted file mode 100644 index d5840df65..000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch.rej +++ /dev/null @@ -1,70 +0,0 @@ -++++ REJECTED PATCH 2 - this.theWorld.theProfiler.startSection("prepare"); - TileEntityRendererDispatcher.instance.cacheActiveRenderInfo(this.theWorld, this.mc.getTextureManager(), this.mc.fontRendererObj, this.mc.getRenderViewEntity(), partialTicks); - this.renderManager.cacheActiveRenderInfo(this.theWorld, this.mc.fontRendererObj, this.mc.getRenderViewEntity(), this.mc.pointedEntity, this.mc.gameSettings, partialTicks); -+ if (pass == 0) // no indentation to shrink patch -+ { - this.countEntitiesTotal = 0; - this.countEntitiesRendered = 0; - this.countEntitiesHidden = 0; -+ } - Entity entity1 = this.mc.getRenderViewEntity(); - double d3 = entity1.lastTickPosX + (entity1.posX - entity1.lastTickPosX) * (double)partialTicks; - double d4 = entity1.lastTickPosY + (entity1.posY - entity1.lastTickPosY) * (double)partialTicks; -++++ END PATCH -++++ REJECTED PATCH 3 - this.mc.entityRenderer.enableLightmap(); - this.theWorld.theProfiler.endStartSection("global"); - List list = this.theWorld.getLoadedEntityList(); -+ if (pass == 0) // no indentation to shrink patch -+ { - this.countEntitiesTotal = list.size(); -+ } - int i; - Entity entity2; - - for (i = 0; i < this.theWorld.weatherEffects.size(); ++i) - { - entity2 = (Entity)this.theWorld.weatherEffects.get(i); -+ if (!entity2.shouldRenderInPass(pass)) continue; - ++this.countEntitiesRendered; - - if (entity2.isInRangeToRender3d(d0, d1, d2)) -++++ END PATCH -++++ REJECTED PATCH 4 - for (i = 0; i < list.size(); ++i) - { - entity2 = (Entity)list.get(i); -+ if (!entity2.shouldRenderInPass(pass)) continue; - boolean flag = this.mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping(); - boolean flag1 = entity2.isInRangeToRender3d(d0, d1, d2) && (entity2.ignoreFrustumCheck || p_180446_2_.isBoundingBoxInFrustum(entity2.getEntityBoundingBox()) || entity2.riddenByEntity == this.mc.thePlayer) && entity2 instanceof EntityPlayer; - -++++ END PATCH -++++ REJECTED PATCH 5 - while (iterator2.hasNext()) - { - Entity entity3 = (Entity)iterator2.next(); -+ if (!entity3.shouldRenderInPass(pass)) continue; - boolean flag2 = this.renderManager.shouldRender(entity3, p_180446_2_, d0, d1, d2) || entity3.riddenByEntity == this.mc.thePlayer; - - if (flag2) -++++ END PATCH -++++ REJECTED PATCH 6 - while (iterator1.hasNext()) - { - tileentity = (TileEntity)iterator1.next(); -+ if (!tileentity.shouldRenderInPass(pass) || !p_180446_2_.isBoundingBoxInFrustum(tileentity.getRenderBoundingBox())) continue; - TileEntityRendererDispatcher.instance.renderTileEntity(tileentity, partialTicks, -1); - } - } -++++ END PATCH -++++ REJECTED PATCH 7 - - Block block = this.theWorld.getBlockState(blockpos).getBlock(); - -- if (tileentity != null && (block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull)) -+ if (tileentity != null && tileentity.shouldRenderInPass(pass) && tileentity.canRenderBreaking() && p_180446_2_.isBoundingBoxInFrustum(tileentity.getRenderBoundingBox())) - { - TileEntityRendererDispatcher.instance.renderTileEntity(tileentity, partialTicks, destroyblockprogress.getPartialBlockDamage()); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch.rej deleted file mode 100644 index c1c645ac6..000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - } - else - { -- s = this.property.getName((Comparable)linkedhashmap.remove(this.property)); -+ s = String.format("%s:%s", ((ResourceLocation)Block.blockRegistry.getNameForObject(p_178132_1_.getBlock())).getResourceDomain(), this.property.getName((Comparable)linkedhashmap.remove(this.property))); - } - - if (this.suffix != null) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch.rej deleted file mode 100644 index a97c64bc2..000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch.rej +++ /dev/null @@ -1,48 +0,0 @@ -++++ REJECTED PATCH 7 - GlStateManager.enableDepth(); - } - -- if (stack.isItemDamaged()) -+ if (stack.getItem().showDurabilityBar(stack)) - { -- int j1 = (int)Math.round(13.0D - (double)stack.getItemDamage() * 13.0D / (double)stack.getMaxDamage()); -- int k = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage()); -+ double health = stack.getItem().getDurabilityForDisplay(stack); -+ int j1 = (int)Math.round(13.0D - health * 13.0D); -+ int k = (int)Math.round(255.0D - health * 255.0D); - GlStateManager.disableLighting(); - GlStateManager.disableDepth(); - GlStateManager.disableTexture2D(); -++++ END PATCH -++++ REJECTED PATCH 8 - this.drawRect(worldrenderer, xPosition + 2, yPosition + 13, 13, 2, 0); - this.drawRect(worldrenderer, xPosition + 2, yPosition + 13, 12, 1, i1); - this.drawRect(worldrenderer, xPosition + 2, yPosition + 13, j1, 1, l); -- GlStateManager.enableBlend(); -+ //GlStateManager.enableBlend(); // Forge: Disable Bled because it screws with a lot of things down the line. - GlStateManager.enableAlpha(); - GlStateManager.enableTexture2D(); - GlStateManager.enableLighting(); -++++ END PATCH -++++ REJECTED PATCH 9 - public void onResourceManagerReload(IResourceManager resourceManager) - { - this.itemModelMesher.rebuildCache(); - } -+ /*==================================== FORGE START ===========================================* / -+ private static RenderItem instance; -+ /** -+ * Returns a single lazy loaded instance of RenderItem, for use in mods who -+ * don't care about the interaction of other objects on the current state of the RenderItem they are using. -+ * @return A global instance of RenderItem -+ * / -+ public static RenderItem getInstance() -+ { -+ if (instance == null) instance = new RenderItem(); -+ return instance; -+ } -+ /*==================================== FORGE END =============================================*/ - - @SideOnly(Side.CLIENT) - -++++ END PATCH From c976ec494e5a1fa379fe478e2bb9a0357a5c2fc7 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Thu, 12 Nov 2015 19:27:14 +0300 Subject: [PATCH 020/133] TileEntity and TileEntityHopper rejects fixed, GuiOverlayDebug patch fixed. --- .../client/gui/GuiOverlayDebug.java.patch | 12 +++--- .../tileentity/TileEntity.java.patch | 18 +++++++-- .../tileentity/TileEntityHopper.java.patch | 35 +++++++++++++++++ .../tileentity/TileEntity.java.patch.rej | 13 ------- .../TileEntityHopper.java.patch.rej | 39 ------------------- 5 files changed, 56 insertions(+), 61 deletions(-) create mode 100644 patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch delete mode 100644 rejects/minecraft/net/minecraft/tileentity/TileEntity.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch.rej diff --git a/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch index 6017c729c..c2b87f70f 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch @@ -1,12 +1,12 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java -@@ -107,6 +107,9 @@ - { - BlockPos blockpos = new BlockPos(this.mc.getRenderViewEntity().posX, this.mc.getRenderViewEntity().getEntityBoundingBox().minY, this.mc.getRenderViewEntity().posZ); +@@ -177,6 +177,9 @@ + long l = j - k; + List list = Lists.newArrayList(new String[] {String.format("Java: %s %dbit", new Object[]{System.getProperty("java.version"), Integer.valueOf(this.mc.isJava64bit() ? 64 : 32)}), String.format("Mem: % 2d%% %03d/%03dMB", new Object[]{Long.valueOf(l * 100L / i), Long.valueOf(bytesToMb(l)), Long.valueOf(bytesToMb(i))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(j * 100L / i), Long.valueOf(bytesToMb(j))}), "", String.format("CPU: %s", new Object[]{OpenGlHelper.func_183029_j()}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GL11.glGetString(GL11.GL_VENDOR)}), GL11.glGetString(GL11.GL_RENDERER), GL11.glGetString(GL11.GL_VERSION)}); -+ arraylist.add(""); -+ arraylist.addAll(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(false)); ++ list.add(""); ++ list.addAll(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(false)); + if (this.isReducedDebug()) { - return Lists.newArrayList(new String[] {"Minecraft 1.8.8 (" + this.mc.getVersion() + "/" + ClientBrandRetriever.getClientModName() + ")", this.mc.debug, this.mc.renderGlobal.getDebugInfoRenders(), this.mc.renderGlobal.getDebugInfoEntities(), "P: " + this.mc.effectRenderer.getStatistics() + ". T: " + this.mc.theWorld.getDebugLoadedEntities(), this.mc.theWorld.getProviderName(), "", String.format("Chunk-relative: %d %d %d", new Object[]{Integer.valueOf(blockpos.getX() & 15), Integer.valueOf(blockpos.getY() & 15), Integer.valueOf(blockpos.getZ() & 15)})}); + return list; diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch index 90194230c..6eb02f833 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -16,7 +16,19 @@ } } -@@ -103,7 +105,17 @@ +@@ -83,9 +85,10 @@ + { + TileEntity tileentity = null; + ++ Class oclass = null; + try + { +- Class oclass = (Class)nameToClassMap.get(nbt.getString("id")); ++ oclass = (Class)nameToClassMap.get(nbt.getString("id")); + + if (oclass != null) + { +@@ -103,7 +106,17 @@ } else { @@ -34,7 +46,7 @@ } return tileentity; -@@ -135,7 +147,6 @@ +@@ -135,7 +148,6 @@ } } @@ -42,7 +54,7 @@ public double getDistanceSq(double x, double y, double z) { double d0 = (double)this.pos.getX() + 0.5D - x; -@@ -283,4 +294,135 @@ +@@ -283,4 +295,135 @@ addMapping(TileEntityFlowerPot.class, "FlowerPot"); addMapping(TileEntityBanner.class, "Banner"); } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch new file mode 100644 index 000000000..c8e28eb85 --- /dev/null +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch @@ -0,0 +1,35 @@ +--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityHopper.java ++++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityHopper.java +@@ -516,17 +516,31 @@ + + if (itemstack == null) + { ++ //Forge: BUGFIX: Again, make things respect max stack sizes. ++ int max = Math.min(p_174916_1_.getMaxStackSize(), p_174916_0_.getInventoryStackLimit()); ++ if (max >= p_174916_1_.stackSize) ++ { + p_174916_0_.setInventorySlotContents(p_174916_2_, p_174916_1_); + p_174916_1_ = null; ++ } ++ else ++ { ++ p_174916_0_.setInventorySlotContents(p_174916_2_, p_174916_1_.splitStack(max)); ++ } + flag = true; + } + else if (canCombine(itemstack, p_174916_1_)) + { +- int i = p_174916_1_.getMaxStackSize() - itemstack.stackSize; ++ //Forge: BUGFIX: Again, make things respect max stack sizes. ++ int max = Math.min(p_174916_1_.getMaxStackSize(), p_174916_0_.getInventoryStackLimit()); ++ if (max > itemstack.stackSize) ++ { ++ int i = max - itemstack.stackSize; + int j = Math.min(p_174916_1_.stackSize, i); + p_174916_1_.stackSize -= j; + itemstack.stackSize += j; + flag = j > 0; ++ } + } + + if (flag) diff --git a/rejects/minecraft/net/minecraft/tileentity/TileEntity.java.patch.rej b/rejects/minecraft/net/minecraft/tileentity/TileEntity.java.patch.rej deleted file mode 100644 index 7a2b4ecfd..000000000 --- a/rejects/minecraft/net/minecraft/tileentity/TileEntity.java.patch.rej +++ /dev/null @@ -1,13 +0,0 @@ -++++ REJECTED PATCH 3 - { - TileEntity tileentity = null; - -+ Class oclass = null; - try - { -- Class oclass = (Class)nameToClassMap.get(nbt.getString("id")); -+ oclass = (Class)nameToClassMap.get(nbt.getString("id")); - - if (oclass != null) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch.rej b/rejects/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch.rej deleted file mode 100644 index 5e7eb1c9e..000000000 --- a/rejects/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch.rej +++ /dev/null @@ -1,39 +0,0 @@ -++++ REJECTED PATCH 1 - - if (itemstack1 == null) - { -- p_174916_0_.setInventorySlotContents(p_174916_2_, p_174916_1_); -- p_174916_1_ = null; -+ //Forge: BUGFIX: Again, make things respect max stack sizes. -+ int max = Math.min(p_174916_1_.getMaxStackSize(), p_174916_0_.getInventoryStackLimit()); -+ if (max >= p_174916_1_.stackSize) -+ { -+ p_174916_0_.setInventorySlotContents(p_174916_2_, p_174916_1_); -+ p_174916_1_ = null; -+ } -+ else -+ { -+ p_174916_0_.setInventorySlotContents(p_174916_2_, p_174916_1_.splitStack(max)); -+ } - flag = true; - } - else if (canCombine(itemstack1, p_174916_1_)) - { -- int j = p_174916_1_.getMaxStackSize() - itemstack1.stackSize; -- int k = Math.min(p_174916_1_.stackSize, j); -- p_174916_1_.stackSize -= k; -- itemstack1.stackSize += k; -- flag = k > 0; -+ //Forge: BUGFIX: Again, make things respect max stack sizes. -+ int max = Math.min(p_174916_1_.getMaxStackSize(), p_174916_0_.getInventoryStackLimit()); -+ if (max > itemstack1.stackSize) -+ { -+ int size = Math.min(p_174916_1_.stackSize, max - itemstack1.stackSize); -+ p_174916_1_.stackSize -= size; -+ itemstack1.stackSize += size; -+ flag = size > 0; -+ } - } - - if (flag) -++++ END PATCH From a8a69775a1d71703c7b152d9f48d8f59395b13ee Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Thu, 12 Nov 2015 20:05:25 +0300 Subject: [PATCH 021/133] PlayerManager, PlayerProfileCache, ServerConfigurationManager, NetHandlerHandshakeTCP rejects fixed; ItemInWorldManager patch error fixed. --- .../management/ItemInWorldManager.java.patch | 2 +- .../management/PlayerManager.java.patch | 40 +++++++++- .../management/PlayerProfileCache.java.patch | 23 ------ .../ServerConfigurationManager.java.patch | 80 +++++++++++++++++-- .../network/NetHandlerHandshakeTCP.java.patch | 11 +++ .../management/PlayerManager.java.patch.rej | 40 ---------- .../PlayerProfileCache.java.patch.rej | 28 ------- .../ServerConfigurationManager.java.patch.rej | 74 ----------------- .../NetHandlerHandshakeTCP.java.patch.rej | 10 --- 9 files changed, 124 insertions(+), 184 deletions(-) delete mode 100644 patches/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch create mode 100644 patches/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch delete mode 100644 rejects/minecraft/net/minecraft/server/management/PlayerManager.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch.rej diff --git a/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch b/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch index 2a343d61e..17cf566f2 100644 --- a/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch @@ -167,7 +167,7 @@ if (itemstack.stackSize == 0) { player.inventory.mainInventory[player.inventory.currentItem] = null; -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, itemstack1); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, itemstack); } if (!player.isUsingItem()) diff --git a/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch index 309ef6e22..259f16246 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch @@ -5,7 +5,7 @@ p_72683_1_.managedPosX = p_72683_1_.posX; p_72683_1_.managedPosZ = p_72683_1_.posZ; + // Load nearby chunks first -+ List chunkList = new ArrayList(); ++ List chunkList = Lists.newArrayList(); for (int k = i - this.playerViewRadius; k <= i + this.playerViewRadius; ++k) { @@ -30,7 +30,7 @@ int i1 = this.playerViewRadius; int j1 = i - k; int k1 = j - l; -+ List chunksToLoad = new ArrayList(); ++ List chunksToLoad = Lists.newArrayList(); if (j1 != 0 || k1 != 0) { @@ -176,7 +176,7 @@ public void onUpdate() { if (this.numBlocksToUpdate != 0) -@@ -441,7 +515,7 @@ +@@ -441,18 +515,19 @@ BlockPos blockpos = new BlockPos(i, j, k); this.sendToAllPlayersWatchingChunk(new S23PacketBlockChange(PlayerManager.this.theWorldServer, blockpos)); @@ -185,3 +185,37 @@ { this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos)); } + } +- else if (this.numBlocksToUpdate == 64) ++ else if (this.numBlocksToUpdate >= net.minecraftforge.common.ForgeModContainer.clumpingThreshold) + { + int i1 = this.chunkCoords.chunkXPos * 16; + int k1 = this.chunkCoords.chunkZPos * 16; + this.sendToAllPlayersWatchingChunk(new S21PacketChunkData(PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos), false, this.flagsYAreasToUpdate)); + +- for (int i2 = 0; i2 < 16; ++i2) ++ // Forge: Grabs ALL tile entities is costly on a modded server, only send needed ones ++ for (int i2 = 0; false && i2 < 16; ++i2) + { + if ((this.flagsYAreasToUpdate & 1 << i2) != 0) + { +@@ -469,7 +544,9 @@ + else + { + this.sendToAllPlayersWatchingChunk(new S22PacketMultiBlockChange(this.numBlocksToUpdate, this.locationOfBlockChange, PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos))); +- ++ } ++ { // Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small ++ WorldServer world = PlayerManager.this.theWorldServer; + for (int j1 = 0; j1 < this.numBlocksToUpdate; ++j1) + { + int l1 = (this.locationOfBlockChange[j1] >> 12 & 15) + this.chunkCoords.chunkXPos * 16; +@@ -477,7 +554,7 @@ + int l2 = (this.locationOfBlockChange[j1] >> 8 & 15) + this.chunkCoords.chunkZPos * 16; + BlockPos blockpos1 = new BlockPos(l1, j2, l2); + +- if (PlayerManager.this.theWorldServer.getBlockState(blockpos1).getBlock().hasTileEntity()) ++ if (world.getBlockState(blockpos1).getBlock().hasTileEntity(world.getBlockState(blockpos1))) + { + this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos1)); + } diff --git a/patches/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch deleted file mode 100644 index c622cc325..000000000 --- a/patches/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/management/PlayerProfileCache.java -+++ ../src-work/minecraft/net/minecraft/server/management/PlayerProfileCache.java -@@ -229,6 +229,20 @@ - { - IOUtils.closeQuietly((Reader)bufferedreader); - } -+ } -+ catch (FileNotFoundException filenotfoundexception) -+ { -+ ; -+ } -+ catch (com.google.gson.JsonParseException parsefail) -+ { -+ // No op - the cache can quietly rebuild if it's junk -+ } -+ finally -+ { -+ IOUtils.closeQuietly(bufferedreader); -+ } -+ } - } - - public void func_152658_c() diff --git a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch index 39f17339e..b4c725aca 100644 --- a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch @@ -92,11 +92,81 @@ playerIn.triggerAchievement(StatList.leaveGameStat); this.writePlayerData(playerIn); WorldServer worldserver = playerIn.getServerForPlayer(); -@@ -495,17 +525,27 @@ +@@ -328,6 +358,7 @@ + this.uuidToPlayerMap.remove(uuid); + this.playerStatFiles.remove(uuid); + } ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); + + this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn})); + } +@@ -411,13 +442,23 @@ + + public EntityPlayerMP recreatePlayerEntity(EntityPlayerMP playerIn, int dimension, boolean conqueredEnd) + { ++ World world = mcServer.worldServerForDimension(dimension); ++ if (world == null) ++ { ++ dimension = 0; ++ } ++ else if (!world.provider.canRespawnHere()) ++ { ++ dimension = world.provider.getRespawnDimension(playerIn); ++ } ++ + playerIn.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(playerIn); + playerIn.getServerForPlayer().getEntityTracker().untrackEntity(playerIn); + playerIn.getServerForPlayer().getPlayerManager().removePlayer(playerIn); + this.playerEntityList.remove(playerIn); + this.mcServer.worldServerForDimension(playerIn.dimension).removePlayerEntityDangerously(playerIn); +- BlockPos blockpos = playerIn.getBedLocation(); +- boolean flag = playerIn.isSpawnForced(); ++ BlockPos blockpos = playerIn.getBedLocation(dimension); ++ boolean flag = playerIn.isSpawnForced(dimension); + playerIn.dimension = dimension; + ItemInWorldManager iteminworldmanager; + +@@ -433,6 +474,7 @@ + EntityPlayerMP entityplayermp = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(playerIn.dimension), playerIn.getGameProfile(), iteminworldmanager); + entityplayermp.playerNetServerHandler = playerIn.playerNetServerHandler; + entityplayermp.clonePlayer(playerIn, conqueredEnd); ++ entityplayermp.dimension = dimension; + entityplayermp.setEntityId(playerIn.getEntityId()); + entityplayermp.func_174817_o(playerIn); + WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); +@@ -472,19 +514,25 @@ + this.uuidToPlayerMap.put(entityplayermp.getUniqueID(), entityplayermp); + entityplayermp.addSelfToInternalCraftingInventory(); + entityplayermp.setHealth(entityplayermp.getHealth()); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp); + return entityplayermp; + } + + public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension) + { ++ transferPlayerToDimension(playerIn, dimension, mcServer.worldServerForDimension(dimension).getDefaultTeleporter()); ++ } ++ ++ public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension, net.minecraft.world.Teleporter teleporter) ++ { + int i = playerIn.dimension; + WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); + playerIn.dimension = dimension; + WorldServer worldserver1 = this.mcServer.worldServerForDimension(playerIn.dimension); +- playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, playerIn.worldObj.getDifficulty(), playerIn.worldObj.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); ++ playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); + worldserver.removePlayerEntityDangerously(playerIn); + playerIn.isDead = false; +- this.transferEntityToWorld(playerIn, i, worldserver, worldserver1); ++ this.transferEntityToWorld(playerIn, i, worldserver, worldserver1, teleporter); + this.func_72375_a(playerIn, worldserver); + playerIn.playerNetServerHandler.setPlayerLocation(playerIn.posX, playerIn.posY, playerIn.posZ, playerIn.rotationYaw, playerIn.rotationPitch); + playerIn.theItemInWorldManager.setWorld(worldserver1); +@@ -495,17 +543,27 @@ { playerIn.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(playerIn.getEntityId(), potioneffect)); } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(playerIn, j, dimension); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(playerIn, i, dimension); } public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_) @@ -123,7 +193,7 @@ { d0 = MathHelper.clamp_double(d0 / d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); d1 = MathHelper.clamp_double(d1 / d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); -@@ -516,7 +556,7 @@ +@@ -516,7 +574,7 @@ p_82448_3_.updateEntityWithOptionalForce(entityIn, false); } } @@ -132,7 +202,7 @@ { d0 = MathHelper.clamp_double(d0 * d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); d1 = MathHelper.clamp_double(d1 * d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); -@@ -527,7 +567,8 @@ +@@ -527,7 +585,8 @@ p_82448_3_.updateEntityWithOptionalForce(entityIn, false); } } @@ -142,7 +212,7 @@ { BlockPos blockpos; -@@ -562,7 +603,7 @@ +@@ -562,7 +621,7 @@ if (entityIn.isEntityAlive()) { entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch); diff --git a/patches/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch b/patches/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch new file mode 100644 index 000000000..f4e6fa526 --- /dev/null +++ b/patches/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java ++++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java +@@ -23,6 +23,8 @@ + + public void processHandshake(C00Handshake packetIn) + { ++ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return; ++ + switch (packetIn.getRequestedState()) + { + case LOGIN: diff --git a/rejects/minecraft/net/minecraft/server/management/PlayerManager.java.patch.rej b/rejects/minecraft/net/minecraft/server/management/PlayerManager.java.patch.rej deleted file mode 100644 index fa38e8910..000000000 --- a/rejects/minecraft/net/minecraft/server/management/PlayerManager.java.patch.rej +++ /dev/null @@ -1,40 +0,0 @@ -++++ REJECTED PATCH 13 - { - int i1; - -- if (this.numBlocksToUpdate == 64) -+ if (this.numBlocksToUpdate >= net.minecraftforge.common.ForgeModContainer.clumpingThreshold) - { - i = this.chunkCoords.chunkXPos * 16; - j = this.chunkCoords.chunkZPos * 16; - this.sendToAllPlayersWatchingChunk(new S21PacketChunkData(PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos), false, this.flagsYAreasToUpdate)); - -- for (k = 0; k < 16; ++k) -+ // Forge: Grabs ALL tile entities is costly on a modded server, only send needed ones -+ for (k = 0; false && k < 16; ++k) - { - if ((this.flagsYAreasToUpdate & 1 << k) != 0) - { -++++ END PATCH -++++ REJECTED PATCH 14 - else - { - this.sendToAllPlayersWatchingChunk(new S22PacketMultiBlockChange(this.numBlocksToUpdate, this.locationOfBlockChange, PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos))); -+ } - -+ { //Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small -+ WorldServer world = PlayerManager.this.theWorldServer; - for (i = 0; i < this.numBlocksToUpdate; ++i) - { - j = (this.locationOfBlockChange[i] >> 12 & 15) + this.chunkCoords.chunkXPos * 16; -++++ END PATCH -++++ REJECTED PATCH 15 - i1 = (this.locationOfBlockChange[i] >> 8 & 15) + this.chunkCoords.chunkZPos * 16; - BlockPos blockpos1 = new BlockPos(j, k, i1); - -- if (PlayerManager.this.theWorldServer.getBlockState(blockpos1).getBlock().hasTileEntity()) -+ if (world.getBlockState(blockpos1).getBlock().hasTileEntity(world.getBlockState(blockpos1))) - { - this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos1)); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch.rej b/rejects/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch.rej deleted file mode 100644 index 5572fafa5..000000000 --- a/rejects/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch.rej +++ /dev/null @@ -1,28 +0,0 @@ -++++ REJECTED PATCH 1 - { - List list = null; - BufferedReader bufferedreader = null; -- label64: - { - try - { - bufferedreader = Files.newReader(this.usercacheFile, Charsets.UTF_8); - list = (List)this.gson.fromJson(bufferedreader, field_152666_h); -- break label64; -- } -- catch (FileNotFoundException filenotfoundexception) -- { -- ; -- } -- finally -- { -- IOUtils.closeQuietly(bufferedreader); -- } - -- return; -- } -- - if (list != null) - { - this.field_152661_c.clear(); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch.rej b/rejects/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch.rej deleted file mode 100644 index 29f9d27b3..000000000 --- a/rejects/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch.rej +++ /dev/null @@ -1,74 +0,0 @@ -++++ REJECTED PATCH 9 - this.playerEntityList.remove(playerIn); - this.uuidToPlayerMap.remove(playerIn.getUniqueID()); - this.playerStatFiles.remove(playerIn.getUniqueID()); -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); - this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn})); - } - -++++ END PATCH -++++ REJECTED PATCH 10 - - public EntityPlayerMP recreatePlayerEntity(EntityPlayerMP playerIn, int dimension, boolean conqueredEnd) - { -+ World world = mcServer.worldServerForDimension(dimension); -+ if (world == null) -+ { -+ dimension = 0; -+ } -+ else if (!world.provider.canRespawnHere()) -+ { -+ dimension = world.provider.getRespawnDimension(playerIn); -+ } -+ - playerIn.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(playerIn); - playerIn.getServerForPlayer().getEntityTracker().untrackEntity(playerIn); - playerIn.getServerForPlayer().getPlayerManager().removePlayer(playerIn); - this.playerEntityList.remove(playerIn); - this.mcServer.worldServerForDimension(playerIn.dimension).removePlayerEntityDangerously(playerIn); -- BlockPos blockpos = playerIn.getBedLocation(); -- boolean flag1 = playerIn.isSpawnForced(); -+ BlockPos blockpos = playerIn.getBedLocation(dimension); -+ boolean flag1 = playerIn.isSpawnForced(dimension); - playerIn.dimension = dimension; - Object object; - -++++ END PATCH -++++ REJECTED PATCH 11 - EntityPlayerMP entityplayermp1 = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(playerIn.dimension), playerIn.getGameProfile(), (ItemInWorldManager)object); - entityplayermp1.playerNetServerHandler = playerIn.playerNetServerHandler; - entityplayermp1.clonePlayer(playerIn, conqueredEnd); -+ entityplayermp1.dimension = dimension; - entityplayermp1.setEntityId(playerIn.getEntityId()); - entityplayermp1.func_174817_o(playerIn); - WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); -++++ END PATCH -++++ REJECTED PATCH 12 - this.uuidToPlayerMap.put(entityplayermp1.getUniqueID(), entityplayermp1); - entityplayermp1.addSelfToInternalCraftingInventory(); - entityplayermp1.setHealth(entityplayermp1.getHealth()); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp1); - return entityplayermp1; - } - - public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension) - { -+ transferPlayerToDimension(playerIn, dimension, mcServer.worldServerForDimension(dimension).getDefaultTeleporter()); -+ } -+ -+ public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension, net.minecraft.world.Teleporter teleporter) -+ { - int j = playerIn.dimension; - WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); - playerIn.dimension = dimension; - WorldServer worldserver1 = this.mcServer.worldServerForDimension(playerIn.dimension); -- playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, playerIn.worldObj.getDifficulty(), playerIn.worldObj.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); -+ playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); // Forge: Use new dimensions information - worldserver.removePlayerEntityDangerously(playerIn); - playerIn.isDead = false; -- this.transferEntityToWorld(playerIn, j, worldserver, worldserver1); -+ this.transferEntityToWorld(playerIn, j, worldserver, worldserver1, teleporter); - this.func_72375_a(playerIn, worldserver); - playerIn.playerNetServerHandler.setPlayerLocation(playerIn.posX, playerIn.posY, playerIn.posZ, playerIn.rotationYaw, playerIn.rotationPitch); - playerIn.theItemInWorldManager.setWorld(worldserver1); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch.rej b/rejects/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch.rej deleted file mode 100644 index 8e844f913..000000000 --- a/rejects/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - - public void processHandshake(C00Handshake packetIn) - { -+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return; -+ - switch (NetHandlerHandshakeTCP.SwitchEnumConnectionState.VALUES[packetIn.getRequestedState().ordinal()]) - { - case 1: -++++ END PATCH From bf6385529267b3f08df25239f02c7a3983f76d7f Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Thu, 12 Nov 2015 20:27:54 +0300 Subject: [PATCH 022/133] ItemBlock, ItemBow, ItemMonsterPlacer, ItemReed, ItemSign rejects fixed. --- .../net/minecraft/item/ItemBlock.java.patch | 22 ++++++++- .../net/minecraft/item/ItemBow.java.patch | 12 ++++- .../item/ItemMonsterPlacer.java.patch | 42 ++++++++++++++++- .../minecraft/item/ItemBlock.java.patch.rej | 45 ------------------- .../net/minecraft/item/ItemBow.java.patch.rej | 18 -------- .../item/ItemMonsterPlacer.java.patch.rej | 42 ----------------- .../minecraft/item/ItemReed.java.patch.rej | 10 ----- .../minecraft/item/ItemSign.java.patch.rej | 10 ----- 8 files changed, 72 insertions(+), 129 deletions(-) delete mode 100644 rejects/minecraft/net/minecraft/item/ItemBlock.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/item/ItemBow.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/item/ItemReed.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/item/ItemSign.java.patch.rej diff --git a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch index 1da8fecd8..f92205dec 100644 --- a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch @@ -1,6 +1,24 @@ --- ../src-base/minecraft/net/minecraft/item/ItemBlock.java +++ ../src-work/minecraft/net/minecraft/item/ItemBlock.java -@@ -163,4 +163,26 @@ +@@ -55,16 +55,8 @@ + int i = this.getMetadata(stack.getMetadata()); + IBlockState iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, i, playerIn); + +- if (worldIn.setBlockState(pos, iblockstate1, 3)) ++ if (placeBlockAt(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ, iblockstate1)) + { +- iblockstate1 = worldIn.getBlockState(pos); +- +- if (iblockstate1.getBlock() == this.block) +- { +- setTileEntityNBT(worldIn, playerIn, pos, stack); +- this.block.onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack); +- } +- + worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), this.block.stepSound.getPlaceSound(), (this.block.stepSound.getVolume() + 1.0F) / 2.0F, this.block.stepSound.getFrequency() * 0.8F); + --stack.stackSize; + } +@@ -163,4 +155,26 @@ { return this.block; } @@ -20,7 +38,7 @@ + IBlockState state = world.getBlockState(pos); + if (state.getBlock() == this.block) + { -+ setTileEntityNBT(world, pos, stack, player); ++ setTileEntityNBT(world, player, pos, stack); + this.block.onBlockPlacedBy(world, pos, state, player, stack); + } + diff --git a/patches/minecraft/net/minecraft/item/ItemBow.java.patch b/patches/minecraft/net/minecraft/item/ItemBow.java.patch index 9c80583a4..8d346a3b3 100644 --- a/patches/minecraft/net/minecraft/item/ItemBow.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBow.java.patch @@ -1,6 +1,16 @@ --- ../src-base/minecraft/net/minecraft/item/ItemBow.java +++ ../src-work/minecraft/net/minecraft/item/ItemBow.java -@@ -105,6 +105,9 @@ +@@ -28,6 +28,9 @@ + if (flag || playerIn.inventory.hasItem(Items.arrow)) + { + int i = this.getMaxItemUseDuration(stack) - timeLeft; ++ net.minecraftforge.event.entity.player.ArrowLooseEvent event = new net.minecraftforge.event.entity.player.ArrowLooseEvent(playerIn, stack, i); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; ++ i = event.charge; + float f = (float)i / 20.0F; + f = (f * f + f * 2.0F) / 3.0F; + +@@ -105,6 +108,9 @@ public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) { diff --git a/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch b/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch index 9d23fda26..5372c4ec0 100644 --- a/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch @@ -9,6 +9,15 @@ if (s1 != null) { +@@ -51,7 +51,7 @@ + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack stack, int renderPass) + { +- EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(stack.getMetadata())); ++ EntityList.EntityEggInfo entitylist$entityegginfo = ItemMonsterPlacer.getEggInfo(stack); + return entitylist$entityegginfo != null ? (renderPass == 0 ? entitylist$entityegginfo.primaryColor : entitylist$entityegginfo.secondaryColor) : 16777215; + } + @@ -76,7 +76,7 @@ if (tileentity instanceof TileEntityMobSpawner) { @@ -36,7 +45,38 @@ if (entity != null) { -@@ -209,5 +209,28 @@ +@@ -172,19 +172,29 @@ + } + } + ++ @Deprecated // Use string version below. + public static Entity spawnCreature(World worldIn, int entityID, double x, double y, double z) + { + if (!EntityList.entityEggs.containsKey(Integer.valueOf(entityID))) + { + return null; + } ++ return spawnCreature(worldIn, EntityList.getStringFromID(entityID), x, y, z); ++ } ++ ++ public static Entity spawnCreature(World worldIn, String name, double x, double y, double z) ++ { ++ if (!EntityList.stringToClassMapping.containsKey(name)) ++ { ++ return null; ++ } + else + { + Entity entity = null; + + for (int i = 0; i < 1; ++i) + { +- entity = EntityList.createEntityByID(entityID, worldIn); ++ entity = EntityList.createEntityByName(name, worldIn); + + if (entity instanceof EntityLivingBase) + { +@@ -209,5 +219,28 @@ { subItems.add(new ItemStack(itemIn, 1, entitylist$entityegginfo.spawnedID)); } diff --git a/rejects/minecraft/net/minecraft/item/ItemBlock.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemBlock.java.patch.rej deleted file mode 100644 index a25b08932..000000000 --- a/rejects/minecraft/net/minecraft/item/ItemBlock.java.patch.rej +++ /dev/null @@ -1,45 +0,0 @@ -++++ REJECTED PATCH 1 - int i = this.getMetadata(stack.getMetadata()); - IBlockState iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, i, playerIn); - -- if (worldIn.setBlockState(pos, iblockstate1, 3)) -+ if (placeBlockAt(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ, iblockstate1)) - { -- iblockstate1 = worldIn.getBlockState(pos); -- -- if (iblockstate1.getBlock() == this.block) -- { -- setTileEntityNBT(worldIn, pos, stack); -- this.block.onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack); -- } -- - worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), this.block.stepSound.getPlaceSound(), (this.block.stepSound.getVolume() + 1.0F) / 2.0F, this.block.stepSound.getFrequency() * 0.8F); - --stack.stackSize; - } -++++ END PATCH -++++ REJECTED PATCH 2 - } - } - -+ @Deprecated //Use player sensitive version - public static boolean setTileEntityNBT(World worldIn, BlockPos pos, ItemStack stack) - { -+ return setTileEntityNBT(worldIn, pos, stack, null); -+ } -+ public static boolean setTileEntityNBT(World worldIn, BlockPos pos, ItemStack stack, EntityPlayer player) -+ { - if (stack.hasTagCompound() && stack.getTagCompound().hasKey("BlockEntityTag", 10)) - { - TileEntity tileentity = worldIn.getTileEntity(pos); - - if (tileentity != null) - { -+ //Forge: Fixes MC-75630 - Exploit with signs and command blocks -+ final net.minecraft.server.MinecraftServer server = net.minecraft.server.MinecraftServer.getServer(); -+ if (!worldIn.isRemote && tileentity.restrictNBTCopy() && -+ (server == null || !server.getConfigurationManager().canSendCommands(player.getGameProfile()))) -+ return false; - NBTTagCompound nbttagcompound = new NBTTagCompound(); - NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttagcompound.copy(); - tileentity.writeToNBT(nbttagcompound); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemBow.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemBow.java.patch.rej deleted file mode 100644 index 4da43f942..000000000 --- a/rejects/minecraft/net/minecraft/item/ItemBow.java.patch.rej +++ /dev/null @@ -1,18 +0,0 @@ -++++ REJECTED PATCH 1 - - public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityPlayer playerIn, int timeLeft) - { -+ int j = this.getMaxItemUseDuration(stack) - timeLeft; -+ net.minecraftforge.event.entity.player.ArrowLooseEvent event = new net.minecraftforge.event.entity.player.ArrowLooseEvent(playerIn, stack, j); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; -+ j = event.charge; -+ - boolean flag = playerIn.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0; - - if (flag || playerIn.inventory.hasItem(Items.arrow)) - { -- int j = this.getMaxItemUseDuration(stack) - timeLeft; - float f = (float)j / 20.0F; - f = (f * f + f * 2.0F) / 3.0F; - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch.rej deleted file mode 100644 index b28b8be6a..000000000 --- a/rejects/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch.rej +++ /dev/null @@ -1,42 +0,0 @@ -++++ REJECTED PATCH 2 - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack stack, int renderPass) - { -- EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(stack.getMetadata())); -+ EntityList.EntityEggInfo entityegginfo = ItemMonsterPlacer.getEggInfo(stack); - return entityegginfo != null ? (renderPass == 0 ? entityegginfo.primaryColor : entityegginfo.secondaryColor) : 16777215; - } - -++++ END PATCH -++++ REJECTED PATCH 6 - } - } - -+ @Deprecated // Use string version below. - public static Entity spawnCreature(World worldIn, int entityID, double x, double y, double z) - { - if (!EntityList.entityEggs.containsKey(Integer.valueOf(entityID))) - { - return null; - } -+ return spawnCreature(worldIn, EntityList.getStringFromID(entityID), x, y, z); -+ } -+ -+ public static Entity spawnCreature(World worldIn, String name, double x, double y, double z) -+ { -+ if (!EntityList.stringToClassMapping.containsKey(name)) -+ { -+ return null; -+ } - else - { - Entity entity = null; - - for (int j = 0; j < 1; ++j) - { -- entity = EntityList.createEntityByID(entityID, worldIn); -+ entity = EntityList.createEntityByName(name, worldIn); - - if (entity instanceof EntityLivingBase) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemReed.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemReed.java.patch.rej deleted file mode 100644 index 8281b9838..000000000 --- a/rejects/minecraft/net/minecraft/item/ItemReed.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - - if (iblockstate1.getBlock() == this.block) - { -- ItemBlock.setTileEntityNBT(worldIn, pos, stack); -+ ItemBlock.setTileEntityNBT(worldIn, pos, stack, playerIn); - iblockstate1.getBlock().onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack); - } - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/ItemSign.java.patch.rej b/rejects/minecraft/net/minecraft/item/ItemSign.java.patch.rej deleted file mode 100644 index 790c3449e..000000000 --- a/rejects/minecraft/net/minecraft/item/ItemSign.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - --stack.stackSize; - TileEntity tileentity = worldIn.getTileEntity(pos); - -- if (tileentity instanceof TileEntitySign && !ItemBlock.setTileEntityNBT(worldIn, pos, stack)) -+ if (tileentity instanceof TileEntitySign && !ItemBlock.setTileEntityNBT(worldIn, pos, stack, playerIn)) - { - playerIn.openEditSign((TileEntitySign)tileentity); - } -++++ END PATCH From e80f66778b8e3f285534b517035801727561247c Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Thu, 12 Nov 2015 21:26:52 +0300 Subject: [PATCH 023/133] Manually updated WorldChunkManager, Chunk and BiomeDecorator patches, removed imports. --- .../world/biome/BiomeDecorator.java.patch | 169 ++++++++++++ .../world/biome/WorldChunkManager.java.patch | 45 ++++ .../minecraft/world/chunk/Chunk.java.patch | 246 ++++++++++++++++++ 3 files changed, 460 insertions(+) create mode 100644 patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch create mode 100644 patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch create mode 100644 patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch new file mode 100644 index 000000000..c0e91d25d --- /dev/null +++ b/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch @@ -0,0 +1,169 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/BiomeDecorator.java ++++ ../src-work/minecraft/net/minecraft/world/biome/BiomeDecorator.java +@@ -106,8 +106,10 @@ + + protected void genDecorations(BiomeGenBase p_150513_1_) + { ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(currentWorld, randomGenerator, field_180294_c)); + this.generateOres(); + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND)) + for (int i = 0; i < this.sandPerChunk2; ++i) + { + int j = this.randomGenerator.nextInt(16) + 8; +@@ -115,6 +117,7 @@ + this.sandGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getTopSolidOrLiquidBlock(this.field_180294_c.add(j, 0, k))); + } + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CLAY)) + for (int i1 = 0; i1 < this.clayPerChunk; ++i1) + { + int l1 = this.randomGenerator.nextInt(16) + 8; +@@ -122,6 +125,7 @@ + this.clayGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getTopSolidOrLiquidBlock(this.field_180294_c.add(l1, 0, i6))); + } + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND_PASS2)) + for (int j1 = 0; j1 < this.sandPerChunk; ++j1) + { + int i2 = this.randomGenerator.nextInt(16) + 8; +@@ -136,6 +140,7 @@ + ++k1; + } + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.TREE)) + for (int j2 = 0; j2 < k1; ++j2) + { + int k6 = this.randomGenerator.nextInt(16) + 8; +@@ -150,6 +155,7 @@ + } + } + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.BIG_SHROOM)) + for (int k2 = 0; k2 < this.bigMushroomsPerChunk; ++k2) + { + int l6 = this.randomGenerator.nextInt(16) + 8; +@@ -157,6 +163,7 @@ + this.bigMushroomGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getHorizon(this.field_180294_c.add(l6, 0, k10))); + } + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.FLOWERS)) + for (int l2 = 0; l2 < this.flowersPerChunk; ++l2) + { + int i7 = this.randomGenerator.nextInt(16) + 8; +@@ -178,6 +185,7 @@ + } + } + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.GRASS)) + for (int i3 = 0; i3 < this.grassPerChunk; ++i3) + { + int j7 = this.randomGenerator.nextInt(16) + 8; +@@ -191,6 +199,7 @@ + } + } + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.DEAD_BUSH)) + for (int j3 = 0; j3 < this.deadBushPerChunk; ++j3) + { + int k7 = this.randomGenerator.nextInt(16) + 8; +@@ -204,6 +213,7 @@ + } + } + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LILYPAD)) + for (int k3 = 0; k3 < this.waterlilyPerChunk; ++k3) + { + int l7 = this.randomGenerator.nextInt(16) + 8; +@@ -230,6 +240,8 @@ + } + } + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM)) ++ { + for (int l3 = 0; l3 < this.mushroomsPerChunk; ++l3) + { + if (this.randomGenerator.nextInt(4) == 0) +@@ -280,7 +292,9 @@ + this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(j4, l15, l8)); + } + } +- ++ } // End of Mushroom generation ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.REED)) ++ { + for (int k4 = 0; k4 < this.reedsPerChunk; ++k4) + { + int i9 = this.randomGenerator.nextInt(16) + 8; +@@ -306,7 +320,8 @@ + this.reedGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(j9, i19, i13)); + } + } +- ++ } // End of Reed generation ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.PUMPKIN)) + if (this.randomGenerator.nextInt(32) == 0) + { + int i5 = this.randomGenerator.nextInt(16) + 8; +@@ -320,6 +335,7 @@ + } + } + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CACTUS)) + for (int j5 = 0; j5 < this.cactiPerChunk; ++j5) + { + int l9 = this.randomGenerator.nextInt(16) + 8; +@@ -335,6 +351,7 @@ + + if (this.generateLakes) + { ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_WATER)) + for (int k5 = 0; k5 < 50; ++k5) + { + int i10 = this.randomGenerator.nextInt(16) + 8; +@@ -349,6 +366,7 @@ + } + } + ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_LAVA)) + for (int l5 = 0; l5 < 20; ++l5) + { + int j10 = this.randomGenerator.nextInt(16) + 8; +@@ -358,6 +376,7 @@ + (new WorldGenLiquids(Blocks.flowing_lava)).generate(this.currentWorld, this.randomGenerator, blockpos3); + } + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Post(currentWorld, randomGenerator, field_180294_c)); + } + + protected void genStandardOre1(int p_76795_1_, WorldGenerator p_76795_2_, int p_76795_3_, int p_76795_4_) +@@ -398,16 +417,29 @@ + + protected void generateOres() + { ++ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Pre(currentWorld, randomGenerator, field_180294_c)); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, dirtGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIRT)) + this.genStandardOre1(this.chunkProviderSettings.dirtCount, this.dirtGen, this.chunkProviderSettings.dirtMinHeight, this.chunkProviderSettings.dirtMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, gravelGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRAVEL)) + this.genStandardOre1(this.chunkProviderSettings.gravelCount, this.gravelGen, this.chunkProviderSettings.gravelMinHeight, this.chunkProviderSettings.gravelMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, dioriteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIORITE)) + this.genStandardOre1(this.chunkProviderSettings.dioriteCount, this.dioriteGen, this.chunkProviderSettings.dioriteMinHeight, this.chunkProviderSettings.dioriteMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, graniteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRANITE)) + this.genStandardOre1(this.chunkProviderSettings.graniteCount, this.graniteGen, this.chunkProviderSettings.graniteMinHeight, this.chunkProviderSettings.graniteMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, andesiteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.ANDESITE)) + this.genStandardOre1(this.chunkProviderSettings.andesiteCount, this.andesiteGen, this.chunkProviderSettings.andesiteMinHeight, this.chunkProviderSettings.andesiteMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, coalGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.COAL)) + this.genStandardOre1(this.chunkProviderSettings.coalCount, this.coalGen, this.chunkProviderSettings.coalMinHeight, this.chunkProviderSettings.coalMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, ironGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.IRON)) + this.genStandardOre1(this.chunkProviderSettings.ironCount, this.ironGen, this.chunkProviderSettings.ironMinHeight, this.chunkProviderSettings.ironMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, goldGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GOLD)) + this.genStandardOre1(this.chunkProviderSettings.goldCount, this.goldGen, this.chunkProviderSettings.goldMinHeight, this.chunkProviderSettings.goldMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, redstoneGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.REDSTONE)) + this.genStandardOre1(this.chunkProviderSettings.redstoneCount, this.redstoneGen, this.chunkProviderSettings.redstoneMinHeight, this.chunkProviderSettings.redstoneMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, diamondGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIAMOND)) + this.genStandardOre1(this.chunkProviderSettings.diamondCount, this.diamondGen, this.chunkProviderSettings.diamondMinHeight, this.chunkProviderSettings.diamondMaxHeight); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, lapisGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.LAPIS)) + this.genStandardOre2(this.chunkProviderSettings.lapisCount, this.lapisGen, this.chunkProviderSettings.lapisCenterHeight, this.chunkProviderSettings.lapisSpread); ++ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Post(currentWorld, randomGenerator, field_180294_c)); + } + } diff --git a/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch b/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch new file mode 100644 index 000000000..6ce27c9c8 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch @@ -0,0 +1,45 @@ +--- ../src-base/minecraft/net/minecraft/world/biome/WorldChunkManager.java ++++ ../src-work/minecraft/net/minecraft/world/biome/WorldChunkManager.java +@@ -16,6 +16,7 @@ + + public class WorldChunkManager + { ++ public static List allowedBiomes = Lists.newArrayList(BiomeGenBase.forest, BiomeGenBase.plains, BiomeGenBase.taiga, BiomeGenBase.taigaHills, BiomeGenBase.forestHills, BiomeGenBase.jungle, BiomeGenBase.jungleHills); + private GenLayer genBiomes; + private GenLayer biomeIndexLayer; + private BiomeCache biomeCache; +@@ -28,13 +29,7 @@ + this.biomeCache = new BiomeCache(this); + this.field_180301_f = ""; + this.biomesToSpawnIn = Lists.newArrayList(); +- this.biomesToSpawnIn.add(BiomeGenBase.forest); +- this.biomesToSpawnIn.add(BiomeGenBase.plains); +- this.biomesToSpawnIn.add(BiomeGenBase.taiga); +- this.biomesToSpawnIn.add(BiomeGenBase.taigaHills); +- this.biomesToSpawnIn.add(BiomeGenBase.forestHills); +- this.biomesToSpawnIn.add(BiomeGenBase.jungle); +- this.biomesToSpawnIn.add(BiomeGenBase.jungleHills); ++ this.biomesToSpawnIn.addAll(allowedBiomes); + } + + public WorldChunkManager(long p_i45744_1_, WorldType p_i45744_3_, String p_i45744_4_) +@@ -42,6 +37,7 @@ + this(); + this.field_180301_f = p_i45744_4_; + GenLayer[] agenlayer = GenLayer.initializeAllBiomeGenerators(p_i45744_1_, p_i45744_3_, p_i45744_4_); ++ agenlayer = getModdedBiomeGenerators(p_i45744_3_, p_i45744_1_, agenlayer); + this.genBiomes = agenlayer[0]; + this.biomeIndexLayer = agenlayer[1]; + } +@@ -250,4 +246,11 @@ + { + this.biomeCache.cleanupCache(); + } ++ ++ public GenLayer[] getModdedBiomeGenerators(WorldType worldType, long seed, GenLayer[] original) ++ { ++ net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens event = new net.minecraftforge.event.terraingen.WorldTypeEvent.InitBiomeGens(worldType, seed, original); ++ net.minecraftforge.common.MinecraftForge.TERRAIN_GEN_BUS.post(event); ++ return event.newBiomeGens; ++ } + } diff --git a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch new file mode 100644 index 000000000..51f17e070 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -0,0 +1,246 @@ +--- ../src-base/minecraft/net/minecraft/world/chunk/Chunk.java ++++ ../src-work/minecraft/net/minecraft/world/chunk/Chunk.java +@@ -168,7 +168,7 @@ + { + Block block = this.getBlock0(j, l - 1, k); + +- if (block.getLightOpacity() != 0) ++ if (getBlockLightOpacity(j, l - 1, k) != 0) + { + this.heightMap[k << 4 | j] = l; + +@@ -441,12 +441,12 @@ + + public int getBlockLightOpacity(BlockPos pos) + { +- return this.getBlock(pos).getLightOpacity(); ++ return this.getBlock(pos).getLightOpacity(worldObj, pos); + } + + private int getBlockLightOpacity(int x, int y, int z) + { +- return this.getBlock0(x, y, z).getLightOpacity(); ++ return getBlockLightOpacity(new BlockPos((xPosition << 4) + x, y, (zPosition << 4) + z)); + } + + private Block getBlock0(int x, int y, int z) +@@ -627,14 +627,19 @@ + + extendedblockstorage.set(i, j & 15, k, state); + +- if (block1 != block) ++ //if (block1 != block) + { + if (!this.worldObj.isRemote) + { ++ if (block1 != block) //Only fire block breaks when the block changes. + block1.breakBlock(this.worldObj, pos, iblockstate); ++ TileEntity te = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); ++ if (te != null && te.shouldRefresh(this.worldObj, pos, iblockstate, state)) this.worldObj.removeTileEntity(pos); + } +- else if (block1 instanceof ITileEntityProvider) ++ else if (block1.hasTileEntity(iblockstate)) + { ++ TileEntity te = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); ++ if (te != null && te.shouldRefresh(this.worldObj, pos, iblockstate, state)) + this.worldObj.removeTileEntity(pos); + } + } +@@ -651,8 +656,8 @@ + } + else + { +- int j1 = block.getLightOpacity(); +- int k1 = block1.getLightOpacity(); ++ int j1 = block.getLightOpacity(this.worldObj, pos); ++ int k1 = block1.getLightOpacity(this.worldObj, pos); + + if (j1 > 0) + { +@@ -672,28 +677,18 @@ + } + } + +- if (block1 instanceof ITileEntityProvider) +- { +- TileEntity tileentity = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); +- +- if (tileentity != null) +- { +- tileentity.updateContainingBlockInfo(); +- } +- } +- + if (!this.worldObj.isRemote && block1 != block) + { + block.onBlockAdded(this.worldObj, pos, state); + } + +- if (block instanceof ITileEntityProvider) ++ if (block.hasTileEntity(state)) + { + TileEntity tileentity1 = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); + + if (tileentity1 == null) + { +- tileentity1 = ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, block.getMetaFromState(state)); ++ tileentity1 = block.createTileEntity(this.worldObj, state); + this.worldObj.setTileEntity(pos, tileentity1); + } + +@@ -796,6 +791,7 @@ + k = this.entityLists.length - 1; + } + ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EnteringChunk(entityIn, this.xPosition, this.zPosition, entityIn.chunkCoordX, entityIn.chunkCoordZ)); + entityIn.addedToChunk = true; + entityIn.chunkCoordX = this.xPosition; + entityIn.chunkCoordY = k; +@@ -834,13 +830,20 @@ + private TileEntity createNewTileEntity(BlockPos pos) + { + Block block = this.getBlock(pos); +- return !block.hasTileEntity() ? null : ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, this.getBlockMetadata(pos)); ++ IBlockState state = block.getStateFromMeta(this.getBlockMetadata(pos)); ++ return !block.hasTileEntity(state) ? null : block.createTileEntity(this.worldObj, state); + } + + public TileEntity getTileEntity(BlockPos pos, Chunk.EnumCreateEntityType p_177424_2_) + { + TileEntity tileentity = (TileEntity)this.chunkTileEntityMap.get(pos); + ++ if (tileentity != null && tileentity.isInvalid()) ++ { ++ chunkTileEntityMap.remove(pos); ++ tileentity = null; ++ } ++ + if (tileentity == null) + { + if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE) +@@ -853,11 +856,6 @@ + this.field_177447_w.add(pos); + } + } +- else if (tileentity.isInvalid()) +- { +- this.chunkTileEntityMap.remove(pos); +- return null; +- } + + return tileentity; + } +@@ -877,7 +875,7 @@ + tileEntityIn.setWorldObj(this.worldObj); + tileEntityIn.setPos(pos); + +- if (this.getBlock(pos) instanceof ITileEntityProvider) ++ if (this.getBlock(pos).hasTileEntity(getBlock(pos).getStateFromMeta(this.getBlockMetadata(pos)))) + { + if (this.chunkTileEntityMap.containsKey(pos)) + { +@@ -914,8 +912,9 @@ + entity.onChunkLoad(); + } + +- this.worldObj.loadEntities(this.entityLists[i]); ++ this.worldObj.loadEntities(com.google.common.collect.ImmutableList.copyOf(this.entityLists[i])); + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(this)); + } + + public void onChunkUnload() +@@ -931,6 +930,7 @@ + { + this.worldObj.unloadEntities(this.entityLists[i]); + } ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Unload(this)); + } + + public void setChunkModified() +@@ -940,8 +940,8 @@ + + public void getEntitiesWithinAABBForEntity(Entity entityIn, AxisAlignedBB aabb, List listToFill, Predicate p_177414_4_) + { +- int i = MathHelper.floor_double((aabb.minY - 2.0D) / 16.0D); +- int j = MathHelper.floor_double((aabb.maxY + 2.0D) / 16.0D); ++ int i = MathHelper.floor_double((aabb.minY - World.MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.floor_double((aabb.maxY + World.MAX_ENTITY_RADIUS) / 16.0D); + i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); + j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); + +@@ -980,8 +980,8 @@ + + public void getEntitiesOfTypeWithinAAAB(Class entityClass, AxisAlignedBB aabb, List listToFill, Predicate p_177430_4_) + { +- int i = MathHelper.floor_double((aabb.minY - 2.0D) / 16.0D); +- int j = MathHelper.floor_double((aabb.maxY + 2.0D) / 16.0D); ++ int i = MathHelper.floor_double((aabb.minY - World.MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.floor_double((aabb.maxY + World.MAX_ENTITY_RADIUS) / 16.0D); + i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); + j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); + +@@ -1141,8 +1141,10 @@ + while (!this.field_177447_w.isEmpty()) + { + BlockPos blockpos = (BlockPos)this.field_177447_w.poll(); ++ Block block = this.getBlock(blockpos); ++ IBlockState state = block.getStateFromMeta(this.getBlockMetadata(blockpos)); + +- if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.getBlock(blockpos).hasTileEntity()) ++ if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && block.hasTileEntity(state)) + { + TileEntity tileentity = this.createNewTileEntity(blockpos); + this.worldObj.setTileEntity(blockpos, tileentity); +@@ -1204,6 +1206,13 @@ + @SideOnly(Side.CLIENT) + public void fillChunk(byte[] p_177439_1_, int p_177439_2_, boolean p_177439_3_) + { ++ for(TileEntity tileEntity : chunkTileEntityMap.values()) ++ { ++ tileEntity.updateContainingBlockInfo(); ++ tileEntity.getBlockMetadata(); ++ tileEntity.getBlockType(); ++ } ++ + int i = 0; + boolean flag = !this.worldObj.provider.getHasNoSky(); + +@@ -1271,10 +1280,16 @@ + this.isTerrainPopulated = true; + this.generateHeightMap(); + ++ List invalidList = new java.util.ArrayList(); ++ + for (TileEntity tileentity : this.chunkTileEntityMap.values()) + { ++ if (tileentity.shouldRefresh(this.worldObj, tileentity.getPos(), tileentity.getBlockType().getStateFromMeta(tileentity.getBlockMetadata()), getBlockState(tileentity.getPos()))) ++ invalidList.add(tileentity); + tileentity.updateContainingBlockInfo(); + } ++ ++ for (TileEntity te : invalidList) te.invalidate(); + } + + public BiomeGenBase getBiome(BlockPos pos, WorldChunkManager chunkManager) +@@ -1589,4 +1604,20 @@ + + private static final String __OBFID = "CL_00002009"; + } ++ ++ /** ++ * Removes the tile entity at the specified position, only if it's ++ * marked as invalid. ++ */ ++ public void removeInvalidTileEntity(BlockPos pos) ++ { ++ if (isChunkLoaded) ++ { ++ TileEntity entity = (TileEntity)chunkTileEntityMap.get(pos); ++ if (entity != null && entity.isInvalid()) ++ { ++ chunkTileEntityMap.remove(pos); ++ } ++ } ++ } + } From 3a5b7427a1775553a0fcad267aa9b2d23196d605 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Thu, 12 Nov 2015 22:42:41 +0300 Subject: [PATCH 024/133] TextureMap, TextureManager and Stitcher rejects fixed. --- .../renderer/texture/Stitcher.java.patch | 22 +++- .../texture/TextureManager.java.patch | 10 +- .../renderer/texture/TextureMap.java.patch | 113 ++++++++++++++++- .../renderer/texture/Stitcher.java.patch.rej | 25 ---- .../texture/TextureMap.java.patch.rej | 118 ------------------ 5 files changed, 134 insertions(+), 154 deletions(-) rename rejects/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch.rej => patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch (64%) delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch.rej 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 931df54bb..6d226df92 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch @@ -1,6 +1,24 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/texture/Stitcher.java +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/Stitcher.java -@@ -74,6 +74,7 @@ +@@ -59,12 +59,17 @@ + { + Stitcher.Holder[] astitcher$holder = (Stitcher.Holder[])this.setStitchHolders.toArray(new Stitcher.Holder[this.setStitchHolders.size()]); + Arrays.sort((Object[])astitcher$holder); ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", astitcher$holder.length); + + for (Stitcher.Holder stitcher$holder : astitcher$holder) + { ++ bar.step(stitcher$holder.getAtlasSprite().getIconName()); + if (!this.allocateSlot(stitcher$holder)) + { + String s = String.format("Unable to fit: %s - size: %dx%d - Maybe try a lowerresolution resourcepack?", new Object[] {stitcher$holder.getAtlasSprite().getIconName(), Integer.valueOf(stitcher$holder.getAtlasSprite().getIconWidth()), Integer.valueOf(stitcher$holder.getAtlasSprite().getIconHeight())}); ++ net.minecraftforge.fml.common.FMLLog.info(s); ++ for (Stitcher.Holder h : astitcher$holder) ++ net.minecraftforge.fml.common.FMLLog.info(" %s", h); + throw new StitcherException(stitcher$holder, s); + } + } +@@ -74,6 +79,7 @@ this.currentWidth = MathHelper.roundUpToPowerOfTwo(this.currentWidth); this.currentHeight = MathHelper.roundUpToPowerOfTwo(this.currentHeight); } @@ -8,7 +26,7 @@ } public List getStichSlots() -@@ -262,7 +263,7 @@ +@@ -262,7 +268,7 @@ public String toString() { diff --git a/rejects/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch.rej b/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch similarity index 64% rename from rejects/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch.rej rename to patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch index 9d314e062..94c0bb386 100644 --- a/rejects/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch.rej +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch @@ -1,17 +1,15 @@ -++++ REJECTED PATCH 1 +--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureManager.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureManager.java +@@ -139,9 +139,12 @@ public void onResourceManagerReload(IResourceManager resourceManager) { + net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Reloading Texture Manager", this.mapTextureObjects.keySet().size(), true); - Iterator iterator = this.mapTextureObjects.entrySet().iterator(); - - while (iterator.hasNext()) + for (Entry entry : this.mapTextureObjects.entrySet()) { - Entry entry = (Entry)iterator.next(); + bar.step(entry.getKey().toString()); this.loadTexture((ResourceLocation)entry.getKey(), (ITextureObject)entry.getValue()); } + net.minecraftforge.fml.common.ProgressManager.pop(bar); } } -++++ END PATCH diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index 9cbc2e7e7..1c6f3e180 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -16,7 +16,77 @@ public TextureMap(String p_i46099_1_) { -@@ -167,6 +169,7 @@ +@@ -47,12 +49,23 @@ + + public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn) + { ++ this(p_i46100_1_, iconCreatorIn, false); ++ } ++ ++ public TextureMap(String p_i46100_1_, boolean skipFirst) ++ { ++ this(p_i46100_1_, null, skipFirst); ++ } ++ ++ public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn, boolean skipFirst) ++ { + this.listAnimatedSprites = Lists.newArrayList(); + this.mapRegisteredSprites = Maps.newHashMap(); + this.mapUploadedSprites = Maps.newHashMap(); + this.missingImage = new TextureAtlasSprite("missingno"); + this.basePath = p_i46100_1_; + this.iconCreator = iconCreatorIn; ++ this.skipFirst = skipFirst && ENABLE_SKIP; + } + + private void initMissingImage() +@@ -91,12 +104,28 @@ + int j = Integer.MAX_VALUE; + int k = 1 << this.mipmapLevels; + ++ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(this); ++ net.minecraftforge.fml.common.FMLLog.info("Max texture size: %d", i); ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", skipFirst ? 0 : this.mapRegisteredSprites.size()); ++ ++ if(!skipFirst) + for (Entry entry : this.mapRegisteredSprites.entrySet()) + { + TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue(); + ResourceLocation resourcelocation = new ResourceLocation(textureatlassprite.getIconName()); + ResourceLocation resourcelocation1 = this.completeResourceLocation(resourcelocation, 0); ++ bar.step(resourcelocation1.getResourcePath()); + ++ if (textureatlassprite.hasCustomLoader(resourceManager, resourcelocation)) ++ { ++ if (!textureatlassprite.load(resourceManager, resourcelocation)) ++ { ++ j = Math.min(j, Math.min(textureatlassprite.getIconWidth(), textureatlassprite.getIconHeight())); ++ stitcher.addSprite(textureatlassprite); ++ } ++ continue; ++ } ++ + try + { + IResource iresource = resourceManager.getResource(resourcelocation1); +@@ -146,12 +175,14 @@ + } + catch (RuntimeException runtimeexception) + { +- logger.error((String)("Unable to parse metadata from " + resourcelocation1), (Throwable)runtimeexception); ++ //logger.error((String)("Unable to parse metadata from " + resourcelocation1), (Throwable)runtimeexception); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().trackBrokenTexture(resourcelocation1, runtimeexception.getMessage()); + continue; + } + catch (IOException ioexception1) + { +- logger.error((String)("Using missing texture, unable to load " + resourcelocation1), (Throwable)ioexception1); ++ //logger.error((String)("Using missing texture, unable to load " + resourcelocation1), (Throwable)ioexception1); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().trackMissingTexture(resourcelocation1); + continue; + } + +@@ -167,6 +198,7 @@ stitcher.addSprite(textureatlassprite); } @@ -24,7 +94,18 @@ int j1 = Math.min(j, k); int k1 = MathHelper.calculateLogBaseTwo(j1); -@@ -217,9 +220,13 @@ +@@ -176,8 +208,10 @@ + this.mipmapLevels = k1; + } + ++ bar = net.minecraftforge.fml.common.ProgressManager.push("Mipmap generation", skipFirst ? 0 : this.mapRegisteredSprites.size()); + for (final TextureAtlasSprite textureatlassprite1 : this.mapRegisteredSprites.values()) + { ++ bar.step(textureatlassprite1.getIconName()); + try + { + textureatlassprite1.generateMipmaps(this.mipmapLevels); +@@ -217,9 +251,13 @@ this.missingImage.generateMipmaps(this.mipmapLevels); stitcher.addSprite(this.missingImage); @@ -38,7 +119,33 @@ stitcher.doStitch(); } catch (StitcherException stitcherexception) -@@ -323,4 +330,37 @@ +@@ -228,9 +266,11 @@ + } + + logger.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.getCurrentWidth()), Integer.valueOf(stitcher.getCurrentHeight()), this.basePath}); ++ bar.step("Allocating GL texture"); + TextureUtil.allocateTextureImpl(this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); + Map map = Maps.newHashMap(this.mapRegisteredSprites); + ++ bar.step("Uploading GL texture"); + for (TextureAtlasSprite textureatlassprite2 : stitcher.getStichSlots()) + { + String s = textureatlassprite2.getIconName(); +@@ -260,6 +300,13 @@ + { + textureatlassprite3.copyFrom(this.missingImage); + } ++ ++ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this); ++ ++ // TextureUtil.saveGlTexture is gone, FIXME ++ //if (!net.minecraftforge.common.ForgeModContainer.disableStitchedFileSaving) ++ //TextureUtil.saveGlTexture(this.basePath.replaceAll("/", "_"), this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); ++ net.minecraftforge.fml.common.ProgressManager.pop(bar); + } + + private ResourceLocation completeResourceLocation(ResourceLocation location, int p_147634_2_) +@@ -323,4 +370,37 @@ { return this.missingImage; } diff --git a/rejects/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch.rej deleted file mode 100644 index 6f2b2d715..000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch.rej +++ /dev/null @@ -1,25 +0,0 @@ -++++ REJECTED PATCH 1 - public void doStitch() - { - Stitcher.Holder[] aholder = (Stitcher.Holder[])this.setStitchHolders.toArray(new Stitcher.Holder[this.setStitchHolders.size()]); -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", aholder.length); - Arrays.sort(aholder); - Stitcher.Holder[] aholder1 = aholder; - int i = aholder.length; -++++ END PATCH -++++ REJECTED PATCH 2 - for (int j = 0; j < i; ++j) - { - Stitcher.Holder holder = aholder1[j]; -+ bar.step(holder.getAtlasSprite().getIconName()); - - if (!this.allocateSlot(holder)) - { - String s = String.format("Unable to fit: %s - size: %dx%d - Maybe try a lowerresolution resourcepack?", new Object[] {holder.getAtlasSprite().getIconName(), Integer.valueOf(holder.getAtlasSprite().getIconWidth()), Integer.valueOf(holder.getAtlasSprite().getIconHeight())}); -+ net.minecraftforge.fml.common.FMLLog.info(s); -+ for (Stitcher.Holder h : aholder) -+ net.minecraftforge.fml.common.FMLLog.info(" %s", h); - throw new StitcherException(holder, s); - } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch.rej deleted file mode 100644 index 05280aa76..000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch.rej +++ /dev/null @@ -1,118 +0,0 @@ -++++ REJECTED PATCH 3 - - public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn) - { -+ this(p_i46100_1_, iconCreatorIn, false); -+ } -+ -+ public TextureMap(String p_i46100_1_, boolean skipFirst) -+ { -+ this(p_i46100_1_, null, skipFirst); -+ } -+ -+ public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn, boolean skipFirst) -+ { - this.listAnimatedSprites = Lists.newArrayList(); - this.mapRegisteredSprites = Maps.newHashMap(); - this.mapUploadedSprites = Maps.newHashMap(); - this.missingImage = new TextureAtlasSprite("missingno"); - this.basePath = p_i46100_1_; - this.iconCreator = iconCreatorIn; -+ this.skipFirst = skipFirst && ENABLE_SKIP; - } - - private void initMissingImage() -++++ END PATCH -++++ REJECTED PATCH 4 - this.listAnimatedSprites.clear(); - int j = Integer.MAX_VALUE; - int k = 1 << this.mipmapLevels; -+ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(this); -+ net.minecraftforge.fml.common.FMLLog.info("Max texture size: %d", i); -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", skipFirst ? 0 : this.mapRegisteredSprites.size()); - Iterator iterator = this.mapRegisteredSprites.entrySet().iterator(); - -- while (iterator.hasNext()) -+ while (!skipFirst && iterator.hasNext()) - { - Entry entry = (Entry)iterator.next(); - TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue(); - ResourceLocation resourcelocation = new ResourceLocation(textureatlassprite.getIconName()); - ResourceLocation resourcelocation1 = this.completeResourceLocation(resourcelocation, 0); -+ bar.step(resourcelocation1.getResourcePath()); - -+ if (textureatlassprite.hasCustomLoader(resourceManager, resourcelocation)) -+ { -+ if (!textureatlassprite.load(resourceManager, resourcelocation)) -+ { -+ j = Math.min(j, Math.min(textureatlassprite.getIconWidth(), textureatlassprite.getIconHeight())); -+ stitcher.addSprite(textureatlassprite); -+ } -+ continue; -+ } -+ - try - { - IResource iresource = resourceManager.getResource(resourcelocation1); -++++ END PATCH -++++ REJECTED PATCH 5 - } - catch (RuntimeException runtimeexception) - { -- logger.error("Unable to parse metadata from " + resourcelocation1, runtimeexception); -+ //logger.error("Unable to parse metadata from " + resourcelocation1, runtimeexception); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackBrokenTexture(resourcelocation1, runtimeexception.getMessage()); - continue; - } - catch (IOException ioexception1) - { -- logger.error("Using missing texture, unable to load " + resourcelocation1, ioexception1); -+ //logger.error("Using missing texture, unable to load " + resourcelocation1, ioexception1); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackMissingTexture(resourcelocation1); - continue; - } - -++++ END PATCH -++++ REJECTED PATCH 7 - } - - Iterator iterator1 = this.mapRegisteredSprites.values().iterator(); -+ bar = net.minecraftforge.fml.common.ProgressManager.push("Mipmap generation", skipFirst ? 0 : this.mapRegisteredSprites.size()); - -- while (iterator1.hasNext()) -+ while (!skipFirst && iterator1.hasNext()) - { - final TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)iterator1.next(); -+ bar.step(textureatlassprite1.getIconName()); - - try - { -++++ END PATCH -++++ REJECTED PATCH 9 - } - - logger.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.getCurrentWidth()), Integer.valueOf(stitcher.getCurrentHeight()), this.basePath}); -+ bar.step("Allocating GL texture"); - TextureUtil.allocateTextureImpl(this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); - HashMap hashmap = Maps.newHashMap(this.mapRegisteredSprites); - Iterator iterator2 = stitcher.getStichSlots().iterator(); - TextureAtlasSprite textureatlassprite2; - -+ bar.step("Uploading GL texture"); - while (iterator2.hasNext()) - { - textureatlassprite2 = (TextureAtlasSprite)iterator2.next(); -++++ END PATCH -++++ REJECTED PATCH 10 - textureatlassprite2.copyFrom(this.missingImage); - } - -+ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this); -+ -+ if (!net.minecraftforge.common.ForgeModContainer.disableStitchedFileSaving) - TextureUtil.saveGlTexture(this.basePath.replaceAll("/", "_"), this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); - } - - private ResourceLocation completeResourceLocation(ResourceLocation location, int p_147634_2_) -++++ END PATCH From b77b0364599d05b8a821afebde24b1374ca1fa74 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Thu, 12 Nov 2015 23:26:44 +0300 Subject: [PATCH 025/133] EntityRenderer, StringTranslate rejects fixed. --- .../client/renderer/EntityRenderer.java.patch | 78 +++++++++++++++++-- .../minecraft/util/StringTranslate.java.patch | 26 ++----- .../renderer/EntityRenderer.java.patch.rej | 73 ----------------- 3 files changed, 80 insertions(+), 97 deletions(-) rename rejects/minecraft/net/minecraft/util/StringTranslate.java.patch.rej => patches/minecraft/net/minecraft/util/StringTranslate.java.patch (67%) delete mode 100644 rejects/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch.rej diff --git a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch index 120177d61..0cae971c7 100644 --- a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -1,5 +1,14 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/EntityRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/EntityRenderer.java +@@ -423,7 +423,7 @@ + + if (d3 < d2 || d2 == 0.0D) + { +- if (entity1 == entity.ridingEntity) ++ if (entity1 == entity.ridingEntity && !entity.canRiderInteract()) + { + if (d2 == 0.0D) + { @@ -580,14 +580,8 @@ { BlockPos blockpos = new BlockPos(entity); @@ -44,6 +53,15 @@ } GlStateManager.translate(0.0F, -f, 0.0F); +@@ -1107,7 +1104,7 @@ + + try + { +- this.mc.currentScreen.drawScreen(k1, l1, p_181560_1_); ++ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.mc.currentScreen, k1, l1, p_181560_1_); + } + catch (Throwable throwable) + { @@ -1171,7 +1168,7 @@ if (this.mc.playerController.getCurrentGameType() == WorldSettings.GameType.SPECTATOR) @@ -53,7 +71,17 @@ } else { -@@ -1333,6 +1330,7 @@ +@@ -1321,7 +1318,9 @@ + GlStateManager.pushMatrix(); + RenderHelper.enableStandardItemLighting(); + this.mc.mcProfiler.endStartSection("entities"); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); + renderglobal.renderEntities(entity, icamera, partialTicks); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); + RenderHelper.disableStandardItemLighting(); + this.disableLightmap(); + GlStateManager.matrixMode(5888); +@@ -1333,6 +1332,7 @@ EntityPlayer entityplayer = (EntityPlayer)entity; GlStateManager.disableAlpha(); this.mc.mcProfiler.endStartSection("outline"); @@ -61,7 +89,31 @@ renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); GlStateManager.enableAlpha(); } -@@ -1399,8 +1397,12 @@ +@@ -1346,6 +1346,7 @@ + EntityPlayer entityplayer1 = (EntityPlayer)entity; + GlStateManager.disableAlpha(); + this.mc.mcProfiler.endStartSection("outline"); ++ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer1, mc.objectMouseOver, 0, entityplayer1.getHeldItem(), partialTicks)) + renderglobal.drawSelectionBox(entityplayer1, this.mc.objectMouseOver, 0, partialTicks); + GlStateManager.enableAlpha(); + } +@@ -1387,6 +1388,15 @@ + GlStateManager.shadeModel(7425); + this.mc.mcProfiler.endStartSection("translucent"); + renderglobal.renderBlockLayer(EnumWorldBlockLayer.TRANSLUCENT, (double)partialTicks, pass, entity); ++ if (!this.debugView) //Only render if render pass 0 happens as well. ++ { ++ RenderHelper.enableStandardItemLighting(); ++ this.mc.mcProfiler.endStartSection("entities"); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(1); ++ renderglobal.renderEntities(entity, icamera, partialTicks); ++ net.minecraftforge.client.ForgeHooksClient.setRenderPass(-1); ++ RenderHelper.disableStandardItemLighting(); ++ } + GlStateManager.shadeModel(7424); + GlStateManager.depthMask(true); + GlStateManager.enableCull(); +@@ -1399,8 +1409,12 @@ this.renderCloudsCheck(renderglobal, partialTicks, pass); } @@ -74,7 +126,21 @@ if (this.renderHand) { GlStateManager.clear(256); -@@ -1837,6 +1839,13 @@ +@@ -1512,6 +1526,13 @@ + + protected void renderRainSnow(float partialTicks) + { ++ net.minecraftforge.client.IRenderHandler renderer = this.mc.theWorld.provider.getWeatherRenderer(); ++ if (renderer != null) ++ { ++ renderer.render(partialTicks, this.mc.theWorld, mc); ++ return; ++ } ++ + float f = this.mc.theWorld.getRainStrength(partialTicks); + + if (f > 0.0F) +@@ -1837,6 +1858,13 @@ this.fogColorBlue = f7; } @@ -88,7 +154,7 @@ GlStateManager.clearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F); } -@@ -1855,6 +1864,10 @@ +@@ -1855,6 +1883,10 @@ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); @@ -99,11 +165,11 @@ if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.blindness)) { float f1 = 5.0F; -@@ -1932,6 +1945,7 @@ +@@ -1932,6 +1964,7 @@ GlStateManager.setFogStart(f * 0.05F); GlStateManager.setFogEnd(Math.min(f, 192.0F) * 0.5F); } -+ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, entity, block, partialTicks, p_78468_1_, f1); ++ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, entity, block, partialTicks, p_78468_1_, f); } GlStateManager.enableColorMaterial(); diff --git a/rejects/minecraft/net/minecraft/util/StringTranslate.java.patch.rej b/patches/minecraft/net/minecraft/util/StringTranslate.java.patch similarity index 67% rename from rejects/minecraft/net/minecraft/util/StringTranslate.java.patch.rej rename to patches/minecraft/net/minecraft/util/StringTranslate.java.patch index b552d2408..c5464bc1e 100644 --- a/rejects/minecraft/net/minecraft/util/StringTranslate.java.patch.rej +++ b/patches/minecraft/net/minecraft/util/StringTranslate.java.patch @@ -1,17 +1,10 @@ -++++ REJECTED PATCH 1 - { - private static final Pattern numericVariablePattern = Pattern.compile("%(\\d+\\$)?[\\d\\.]*[df]"); - private static final Splitter equalSignSplitter = Splitter.on('=').limit(2); -+ private final Map languageList; - private static StringTranslate instance = new StringTranslate(); -- private final Map languageList = Maps.newHashMap(); - private long lastUpdateTimeInMilliseconds; - private static final String __OBFID = "CL_00001212"; +--- ../src-base/minecraft/net/minecraft/util/StringTranslate.java ++++ ../src-work/minecraft/net/minecraft/util/StringTranslate.java +@@ -24,9 +24,29 @@ public StringTranslate() { + InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); -+ languageList = Maps.newHashMap(); + inject(this, inputstream); + } + @@ -35,12 +28,10 @@ - InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); + inputstream = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(table, inputstream); + if (inputstream == null) return table; -+ - Iterator iterator = IOUtils.readLines(inputstream, Charsets.UTF_8).iterator(); - while (iterator.hasNext()) -++++ END PATCH -++++ REJECTED PATCH 2 + for (String s : IOUtils.readLines(inputstream, Charsets.UTF_8)) + { +@@ -38,17 +58,17 @@ { String s1 = astring[0]; String s2 = numericVariablePattern.matcher(astring[1]).replaceAll("%$1s"); @@ -52,8 +43,8 @@ - this.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); } -- catch (IOException ioexception) -+ catch (Exception ioexception) +- catch (IOException var7) ++ catch (Exception var7) { ; } @@ -61,4 +52,3 @@ } static StringTranslate getInstance() -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch.rej b/rejects/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch.rej deleted file mode 100644 index 6113b99db..000000000 --- a/rejects/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch.rej +++ /dev/null @@ -1,73 +0,0 @@ -++++ REJECTED PATCH 1 - - if (d3 < d2 || d2 == 0.0D) - { -- if (entity1 == entity.ridingEntity) -+ if (entity1 == entity.ridingEntity && !entity.canRiderInteract()) - { - if (d2 == 0.0D) - { -++++ END PATCH -++++ REJECTED PATCH 4 - - try - { -- this.mc.currentScreen.drawScreen(l, i1, partialTicks); -+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.mc.currentScreen, l, i1, partialTicks); - } - catch (Throwable throwable) - { -++++ END PATCH -++++ REJECTED PATCH 6 - GlStateManager.pushMatrix(); - RenderHelper.enableStandardItemLighting(); - this.mc.mcProfiler.endStartSection("entities"); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); - renderglobal.renderEntities(entity, frustum, partialTicks); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); - RenderHelper.disableStandardItemLighting(); - this.disableLightmap(); - GlStateManager.matrixMode(5888); -++++ END PATCH -++++ REJECTED PATCH 8 - entityplayer = (EntityPlayer)entity; - GlStateManager.disableAlpha(); - this.mc.mcProfiler.endStartSection("outline"); -+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, entityplayer.getHeldItem(), partialTicks)) - renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); - GlStateManager.enableAlpha(); - } -++++ END PATCH -++++ REJECTED PATCH 9 - renderglobal.renderBlockLayer(EnumWorldBlockLayer.TRANSLUCENT, (double)partialTicks, pass, entity); - } - -+ if (!this.debugView) //Only render if render pass 0 happens as well. -+ { -+ RenderHelper.enableStandardItemLighting(); -+ this.mc.mcProfiler.endStartSection("entities"); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(1); -+ renderglobal.renderEntities(entity, frustum, partialTicks); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(-1); -+ RenderHelper.disableStandardItemLighting(); -+ } -+ - GlStateManager.shadeModel(7424); - GlStateManager.depthMask(true); - GlStateManager.enableCull(); -++++ END PATCH -++++ REJECTED PATCH 11 - - protected void renderRainSnow(float partialTicks) - { -+ net.minecraftforge.client.IRenderHandler renderer = this.mc.theWorld.provider.getWeatherRenderer(); -+ if (renderer != null) -+ { -+ renderer.render(partialTicks, this.mc.theWorld, mc); -+ return; -+ } -+ - float f1 = this.mc.theWorld.getRainStrength(partialTicks); - - if (f1 > 0.0F) -++++ END PATCH From 7258d577cd3109c6948572104aacea4c71649db9 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Fri, 13 Nov 2015 00:05:19 +0300 Subject: [PATCH 026/133] Overlay patch fix: use the correct block position. --- .../client/renderer/ItemRenderer.java.patch | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch index 21f3f3166..09748f96f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -9,15 +9,29 @@ { this.func_178097_a(abstractclientplayer, f2, f, f1); } -@@ -384,6 +384,7 @@ +@@ -366,6 +366,7 @@ + if (this.mc.thePlayer.isEntityInsideOpaqueBlock()) + { + IBlockState iblockstate = this.mc.theWorld.getBlockState(new BlockPos(this.mc.thePlayer)); ++ BlockPos overlayPos = new BlockPos(this.mc.thePlayer); + EntityPlayer entityplayer = this.mc.thePlayer; + + for (int i = 0; i < 8; ++i) +@@ -379,11 +380,13 @@ + if (iblockstate1.getBlock().isVisuallyOpaque()) + { + iblockstate = iblockstate1; ++ overlayPos = blockpos; + } + } if (iblockstate.getBlock().getRenderType() != -1) { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(mc.thePlayer, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, new BlockPos(this.mc.thePlayer))) ++ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(mc.thePlayer, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, overlayPos)) this.func_178108_a(p_78447_1_, this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate)); } } -@@ -392,11 +393,13 @@ +@@ -392,11 +395,13 @@ { if (this.mc.thePlayer.isInsideOfMaterial(Material.water)) { @@ -31,7 +45,7 @@ this.renderFireInFirstPerson(p_78447_1_); } } -@@ -513,6 +516,12 @@ +@@ -513,6 +518,12 @@ { if (!this.itemToRender.getIsItemStackEqual(itemstack)) { From 8f94ff14ff399327e2b07a090cf6d76890bc9849 Mon Sep 17 00:00:00 2001 From: cpw Date: Thu, 12 Nov 2015 22:02:41 -0500 Subject: [PATCH 027/133] Enchantment,EnchantmentHelper,EntityEnderman,EntityZombie,EntityVillager,FurnaceRecipes,RecipeFireworks,RecipeRepairItem,NetworkSystem,S00PacketServerInfo PotionEffect,StatList,Session,WeightedRandomChestContent,Explosion,ExtendedBlockStorage,SaveHandler. All NBT patches seem to have been merged upstream, so removing. The IntegratedServer and MinecraftServer pending queue changes also removed, as fixed upstream. --- .../enchantment/Enchantment.java.patch | 55 ++++++++++++++++ .../enchantment/EnchantmentHelper.java.patch | 41 ++++++++++++ .../entity/monster/EntityEnderman.java.patch | 20 +++++- .../entity/monster/EntityZombie.java.patch | 9 +++ .../entity/passive/EntityVillager.java.patch | 12 +++- .../item/crafting/FurnaceRecipes.java.patch | 10 +++ .../item/crafting/RecipeFireworks.java.patch | 22 +++++++ .../item/crafting/RecipeRepairItem.java.patch | 9 +++ .../network/NetworkSystem.java.patch | 11 ++++ .../server/S00PacketServerInfo.java.patch | 11 ++++ .../minecraft/potion/PotionEffect.java.patch | 9 +++ .../net/minecraft/stats/StatList.java.patch | 14 +++++ .../net/minecraft/util/Session.java.patch | 18 +++++- .../WeightedRandomChestContent.java.patch | 48 +++++++++++++- .../net/minecraft/world/Explosion.java.patch | 12 +++- .../storage/ExtendedBlockStorage.java.patch | 9 +-- .../world/storage/SaveHandler.java.patch | 62 ++++++++++++++++--- .../enchantment/Enchantment.java.patch.rej | 55 ---------------- .../EnchantmentHelper.java.patch.rej | 43 ------------- .../monster/EntityEnderman.java.patch.rej | 19 ------ .../monster/EntityZombie.java.patch.rej | 10 --- .../passive/EntityVillager.java.patch.rej | 9 --- .../crafting/FurnaceRecipes.java.patch.rej | 11 ---- .../crafting/RecipeFireworks.java.patch.rej | 23 ------- .../crafting/RecipeRepairItem.java.patch.rej | 10 --- .../nbt/NBTTagByteArray.java.patch.rej | 9 --- .../nbt/NBTTagCompound.java.patch.rej | 10 --- .../nbt/NBTTagIntArray.java.patch.rej | 9 --- .../minecraft/nbt/NBTTagList.java.patch.rej | 15 ----- .../network/NetworkSystem.java.patch.rej | 10 --- .../server/S00PacketServerInfo.java.patch.rej | 10 --- .../potion/PotionEffect.java.patch.rej | 10 --- .../server/MinecraftServer.java.patch.rej | 11 ---- .../IntegratedServer.java.patch.rej | 11 ---- .../minecraft/stats/StatList.java.patch.rej | 15 ----- .../net/minecraft/util/Session.java.patch.rej | 17 ----- .../WeightedRandomChestContent.java.patch.rej | 54 ---------------- .../minecraft/world/Explosion.java.patch.rej | 9 --- .../world/storage/SaveHandler.java.patch.rej | 48 -------------- 39 files changed, 351 insertions(+), 439 deletions(-) create mode 100644 patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch create mode 100644 patches/minecraft/net/minecraft/network/NetworkSystem.java.patch create mode 100644 patches/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch rename rejects/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch.rej => patches/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch (50%) delete mode 100644 rejects/minecraft/net/minecraft/enchantment/Enchantment.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/nbt/NBTTagByteArray.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/nbt/NBTTagIntArray.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/nbt/NBTTagList.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/network/NetworkSystem.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/potion/PotionEffect.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/server/MinecraftServer.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/stats/StatList.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/util/Session.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/Explosion.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/storage/SaveHandler.java.patch.rej diff --git a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch index a8e5b3f38..556e26af0 100644 --- a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch @@ -9,3 +9,58 @@ } else { +@@ -140,7 +140,7 @@ + + public boolean canApply(ItemStack stack) + { +- return this.type.canEnchantItem(stack.getItem()); ++ return canApplyAtEnchantingTable(stack); + } + + public void onEntityDamaged(EntityLivingBase user, Entity target, int level) +@@ -151,6 +151,45 @@ + { + } + ++ /** ++ * This applies specifically to applying at the enchanting table. The other method {@link #canApply(ItemStack)} ++ * applies for all possible enchantments. ++ * @param stack ++ * @return ++ */ ++ public boolean canApplyAtEnchantingTable(ItemStack stack) ++ { ++ return this.type.canEnchantItem(stack.getItem()); ++ } ++ ++ private static final java.lang.reflect.Field bookSetter = Enchantment.class.getDeclaredFields()[1]; ++ /** ++ * Add to the list of enchantments applicable by the anvil from a book ++ * ++ * @param enchantment ++ */ ++ public static void addToBookList(Enchantment enchantment) ++ { ++ try ++ { ++ net.minecraftforge.common.util.EnumHelper.setFailsafeFieldValue(bookSetter, null, ++ com.google.common.collect.ObjectArrays.concat(enchantmentsBookList, enchantment)); ++ } ++ catch (Exception e) ++ { ++ throw new RuntimeException(e); //Rethrow see what happens ++ } ++ } ++ ++ /** ++ * Is this enchantment allowed to be enchanted on books via Enchantment Table ++ * @return false to disable the vanilla feature ++ */ ++ public boolean isAllowedOnBooks() ++ { ++ return true; ++ } ++ + static + { + List list = Lists.newArrayList(); diff --git a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch new file mode 100644 index 000000000..b9e79d5c7 --- /dev/null +++ b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch @@ -0,0 +1,41 @@ +--- ../src-base/minecraft/net/minecraft/enchantment/EnchantmentHelper.java ++++ ../src-work/minecraft/net/minecraft/enchantment/EnchantmentHelper.java +@@ -297,7 +297,7 @@ + public static int calcItemStackEnchantability(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.getItemEnchantability(); ++ int i = item.getItemEnchantability(p_77514_3_); + + if (i <= 0) + { +@@ -346,7 +346,7 @@ + public static List buildEnchantmentList(Random p_77513_0_, ItemStack p_77513_1_, int p_77513_2_) + { + Item item = p_77513_1_.getItem(); +- int i = item.getItemEnchantability(); ++ int i = item.getItemEnchantability(p_77513_1_); + + if (i <= 0) + { +@@ -388,7 +388,9 @@ + + for (EnchantmentData enchantmentdata1 : list) + { +- if (!enchantmentdata1.enchantmentobj.canApplyTogether(Enchantment.getEnchantmentById(integer.intValue()))) ++ Enchantment e1 = enchantmentdata1.enchantmentobj; ++ Enchantment e2 = Enchantment.getEnchantmentById(integer.intValue()); ++ if (e1.canApplyTogether(e2) && e2.canApplyTogether(e1)) //Forge BugFix: Let Both enchantments veto being together + { + flag = false; + break; +@@ -422,7 +424,8 @@ + + for (Enchantment enchantment : Enchantment.enchantmentsBookList) + { +- if (enchantment != null && (enchantment.type.canEnchantItem(item) || flag)) ++ if (enchantment == null) continue; ++ if (enchantment.canApplyAtEnchantingTable(p_77505_1_) || (flag && enchantment.isAllowedOnBooks())) + { + for (int i = enchantment.getMinLevel(); i <= enchantment.getMaxLevel(); ++i) + { diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch index 148ad918a..4acd59693 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch @@ -1,6 +1,24 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntityEnderman.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityEnderman.java -@@ -366,6 +366,18 @@ +@@ -200,12 +200,14 @@ + + protected boolean teleportTo(double p_70825_1_, double p_70825_3_, double p_70825_5_) + { ++ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, p_70825_1_, p_70825_3_, p_70825_5_, 0); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false; + double d0 = this.posX; + double d1 = this.posY; + double d2 = this.posZ; +- this.posX = p_70825_1_; +- this.posY = p_70825_3_; +- this.posZ = p_70825_5_; ++ this.posX = event.targetX; ++ this.posY = event.targetY; ++ this.posZ = event.targetZ; + boolean flag = false; + BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ); + +@@ -366,6 +368,18 @@ } } diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch index f14566563..717cbb1ca 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch @@ -49,3 +49,12 @@ entityzombie.func_180482_a(this.worldObj.getDifficultyForLocation(new BlockPos(entityzombie)), (IEntityLivingData)null); this.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0)); entityzombie.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0)); +@@ -466,7 +479,7 @@ + + if (p_180482_2_ == null) + { +- p_180482_2_ = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < 0.05F, this.worldObj.rand.nextFloat() < 0.05F); ++ p_180482_2_ = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < net.minecraftforge.common.ForgeModContainer.zombieBabyChance, this.worldObj.rand.nextFloat() < 0.05F); + } + + if (p_180482_2_ instanceof EntityZombie.GroupData) diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch index 201f72c94..daa11a660 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch @@ -17,7 +17,15 @@ { if (!this.worldObj.isRemote && (this.buyingList == null || this.buyingList.size() > 0)) { -@@ -636,6 +637,7 @@ +@@ -523,6 +524,7 @@ + + private void populateBuyingList() + { ++ //TODO: Hook into VillagerRegistry + EntityVillager.ITradeList[][][] aentityvillager$itradelist = DEFAULT_TRADE_LIST_MAP[this.getProfession()]; + + if (this.careerId != 0 && this.careerLevel != 0) +@@ -636,6 +638,7 @@ } } @@ -25,7 +33,7 @@ if (s1 != null) { ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("entity.Villager." + s1, new Object[0]); -@@ -698,7 +700,7 @@ +@@ -698,7 +701,7 @@ public IEntityLivingData func_180482_a(DifficultyInstance p_180482_1_, IEntityLivingData p_180482_2_) { p_180482_2_ = super.func_180482_a(p_180482_1_, p_180482_2_); diff --git a/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch index f30470c7f..5f38ff604 100644 --- a/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch @@ -8,3 +8,13 @@ this.smeltingList.put(input, stack); this.experienceList.put(stack, Float.valueOf(experience)); } +@@ -102,6 +103,9 @@ + + public float getSmeltingExperience(ItemStack stack) + { ++ float ret = stack.getItem().getSmeltingExperience(stack); ++ if (ret != -1) return ret; ++ + for (Entry entry : this.experienceList.entrySet()) + { + if (this.compareItemStacks(stack, (ItemStack)entry.getKey())) diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch index 4a6a9f32a..b9fbb01af 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch @@ -1,5 +1,27 @@ --- ../src-base/minecraft/net/minecraft/item/crafting/RecipeFireworks.java +++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeFireworks.java +@@ -87,9 +87,9 @@ + { + this.field_92102_a = new ItemStack(Items.fireworks); + ++ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + if (l > 0) + { +- NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + NBTTagCompound nbttagcompound3 = new NBTTagCompound(); + NBTTagList nbttaglist = new NBTTagList(); + +@@ -106,9 +106,9 @@ + nbttagcompound3.setTag("Explosions", nbttaglist); + nbttagcompound3.setByte("Flight", (byte)j); + nbttagcompound1.setTag("Fireworks", nbttagcompound3); +- this.field_92102_a.setTagCompound(nbttagcompound1); + } + ++ this.field_92102_a.setTagCompound(nbttagcompound1); //Forge BugFix: NPE Protection + return true; + } + else if (j == 1 && i == 0 && l == 0 && k > 0 && j1 <= 1) @@ -250,11 +250,7 @@ for (int i = 0; i < aitemstack.length; ++i) { diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch index d5b3256fc..a9d4349e8 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch @@ -18,6 +18,15 @@ { return null; } +@@ -67,7 +67,7 @@ + ItemStack itemstack2 = (ItemStack)list.get(0); + ItemStack itemstack3 = (ItemStack)list.get(1); + +- if (itemstack2.getItem() == itemstack3.getItem() && itemstack2.stackSize == 1 && itemstack3.stackSize == 1 && itemstack2.getItem().isDamageable()) ++ if (itemstack2.getItem() == itemstack3.getItem() && itemstack2.stackSize == 1 && itemstack3.stackSize == 1 && itemstack2.getItem().isRepairable()) + { + Item item = itemstack2.getItem(); + int j = item.getMaxDamage() - itemstack2.getItemDamage(); @@ -104,11 +104,7 @@ for (int i = 0; i < aitemstack.length; ++i) { diff --git a/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch b/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch new file mode 100644 index 000000000..2382e65e7 --- /dev/null +++ b/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/network/NetworkSystem.java ++++ ../src-work/minecraft/net/minecraft/network/NetworkSystem.java +@@ -120,7 +120,7 @@ + ; + } + +- p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(30))).addLast((String)"legacy_query", (ChannelHandler)(new PingResponseHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new MessageDeserializer2())).addLast((String)"decoder", (ChannelHandler)(new MessageDeserializer(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new MessageSerializer2())).addLast((String)"encoder", (ChannelHandler)(new MessageSerializer(EnumPacketDirection.CLIENTBOUND))); ++ p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.READ_TIMEOUT))).addLast((String)"legacy_query", (ChannelHandler)(new PingResponseHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new MessageDeserializer2())).addLast((String)"decoder", (ChannelHandler)(new MessageDeserializer(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new MessageSerializer2())).addLast((String)"encoder", (ChannelHandler)(new MessageSerializer(EnumPacketDirection.CLIENTBOUND))); + NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND); + NetworkSystem.this.networkManagers.add(networkmanager); + p_initChannel_1_.pipeline().addLast((String)"packet_handler", (ChannelHandler)networkmanager); diff --git a/patches/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch b/patches/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch new file mode 100644 index 000000000..0b578a6e2 --- /dev/null +++ b/patches/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java ++++ ../src-work/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java +@@ -35,7 +35,7 @@ + + public void writePacketData(PacketBuffer buf) throws IOException + { +- buf.writeString(GSON.toJson((Object)this.response)); ++ buf.writeString(this.response.getJson()); + } + + public void processPacket(INetHandlerStatusClient handler) diff --git a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch b/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch index eaa78b0a7..c2e4d17f4 100644 --- a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch +++ b/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch @@ -26,6 +26,15 @@ } public void combine(PotionEffect other) +@@ -191,7 +196,7 @@ + + public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt) + { +- int i = nbt.getByte("Id"); ++ int i = nbt.getByte("Id") & 0xff; + + if (i >= 0 && i < Potion.potionTypes.length && Potion.potionTypes[i] != null) + { @@ -224,4 +229,62 @@ { return this.isPotionDurationMax; diff --git a/patches/minecraft/net/minecraft/stats/StatList.java.patch b/patches/minecraft/net/minecraft/stats/StatList.java.patch index 2da9679d1..12e4a29dc 100644 --- a/patches/minecraft/net/minecraft/stats/StatList.java.patch +++ b/patches/minecraft/net/minecraft/stats/StatList.java.patch @@ -9,6 +9,20 @@ String s = func_180204_a(item); if (s != null) +@@ -127,11 +127,11 @@ + { + for (Block block : Block.blockRegistry) + { +- Item item = Item.getItemFromBlock(block); ++ Item item = Item.getItemFromBlock(block); //TODO: Hook FML's stat change event and re-assign these + + if (item != null) + { +- int i = Block.getIdFromBlock(block); ++ int i = Block.getIdFromBlock(block); //TODO: Hook FML's stat change event and re-assign these + String s = func_180204_a(item); + + if (s != null && block.getEnableStats()) @@ -151,7 +151,7 @@ { if (item != null) diff --git a/patches/minecraft/net/minecraft/util/Session.java.patch b/patches/minecraft/net/minecraft/util/Session.java.patch index a294c7fee..dfb470818 100644 --- a/patches/minecraft/net/minecraft/util/Session.java.patch +++ b/patches/minecraft/net/minecraft/util/Session.java.patch @@ -25,7 +25,23 @@ this.username = usernameIn; this.playerID = playerIDIn; this.token = tokenIn; -@@ -63,6 +78,19 @@ +@@ -50,11 +65,13 @@ + try + { + UUID uuid = UUIDTypeAdapter.fromString(this.getPlayerID()); +- return new GameProfile(uuid, this.getUsername()); ++ GameProfile ret = new GameProfile(uuid, this.getUsername()); //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 var2) + { +- return new GameProfile((UUID)null, this.getUsername()); ++ return new GameProfile(net.minecraft.entity.player.EntityPlayer.getUUID(new GameProfile((UUID)null, this.getUsername())), this.getUsername()); + } + } + +@@ -63,6 +80,19 @@ return this.sessionType; } diff --git a/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch b/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch index 2c0234944..aaba98a5c 100644 --- a/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch +++ b/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch @@ -1,6 +1,28 @@ --- ../src-base/minecraft/net/minecraft/util/WeightedRandomChestContent.java +++ ../src-work/minecraft/net/minecraft/util/WeightedRandomChestContent.java -@@ -57,6 +57,19 @@ +@@ -37,48 +37,39 @@ + for (int i = 0; i < p_177630_3_; ++i) + { + WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, p_177630_1_); +- int j = weightedrandomchestcontent.theMinimumChanceToGenerateItem + random.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1); ++ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, p_177630_2_); + +- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= j) ++ for (ItemStack itemstack1 : stacks) + { +- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); +- itemstack1.stackSize = j; + p_177630_2_.setInventorySlotContents(random.nextInt(p_177630_2_.getSizeInventory()), itemstack1); + } +- else +- { +- for (int k = 0; k < j; ++k) +- { +- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); +- itemstack.stackSize = 1; +- p_177630_2_.setInventorySlotContents(random.nextInt(p_177630_2_.getSizeInventory()), itemstack); +- } +- } } } @@ -20,3 +42,27 @@ public static void generateDispenserContents(Random random, List p_177631_1_, TileEntityDispenser dispenser, int p_177631_3_) { for (int i = 0; i < p_177631_3_; ++i) + { + WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, p_177631_1_); +- int j = weightedrandomchestcontent.theMinimumChanceToGenerateItem + random.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1); ++ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, dispenser); + +- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= j) ++ for (ItemStack itemstack1 : stacks) + { +- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); +- itemstack1.stackSize = j; + dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack1); + } +- else +- { +- for (int k = 0; k < j; ++k) +- { +- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); +- itemstack.stackSize = 1; +- dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack); +- } +- } + } + } + diff --git a/patches/minecraft/net/minecraft/world/Explosion.java.patch b/patches/minecraft/net/minecraft/world/Explosion.java.patch index 609186749..e3ee43bba 100644 --- a/patches/minecraft/net/minecraft/world/Explosion.java.patch +++ b/patches/minecraft/net/minecraft/world/Explosion.java.patch @@ -25,7 +25,15 @@ f -= (f2 + 0.3F) * 0.3F; } -@@ -214,8 +216,7 @@ +@@ -127,6 +129,7 @@ + int j2 = MathHelper.floor_double(this.explosionZ - (double)f3 - 1.0D); + int j1 = MathHelper.floor_double(this.explosionZ + (double)f3 + 1.0D); + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, new AxisAlignedBB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1)); ++ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.worldObj, this, list, f3); + Vec3 vec3 = new Vec3(this.explosionX, this.explosionY, this.explosionZ); + + for (int k2 = 0; k2 < list.size(); ++k2) +@@ -214,8 +217,7 @@ block.dropBlockAsItemWithChance(this.worldObj, blockpos, this.worldObj.getBlockState(blockpos), 1.0F / this.explosionSize, 0); } @@ -35,7 +43,7 @@ } } } -@@ -251,4 +252,6 @@ +@@ -251,4 +253,6 @@ { return this.affectedBlockPositions; } diff --git a/rejects/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch.rej b/patches/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch similarity index 50% rename from rejects/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch.rej rename to patches/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch index 89b9cdc9a..8533e65ff 100644 --- a/rejects/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch.rej +++ b/patches/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch @@ -1,10 +1,11 @@ -++++ REJECTED PATCH 1 +--- ../src-base/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java ++++ ../src-work/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java +@@ -35,6 +35,8 @@ public void set(int x, int y, int z, IBlockState state) { + if (state instanceof net.minecraftforge.common.property.IExtendedBlockState) + state = ((net.minecraftforge.common.property.IExtendedBlockState) state).getClean(); - IBlockState iblockstate1 = this.get(x, y, z); - Block block = iblockstate1.getBlock(); + IBlockState iblockstate = this.get(x, y, z); + Block block = iblockstate.getBlock(); Block block1 = state.getBlock(); -++++ END PATCH diff --git a/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch b/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch index 356c56113..a8c83b6be 100644 --- a/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch @@ -1,15 +1,48 @@ --- ../src-base/minecraft/net/minecraft/world/storage/SaveHandler.java +++ ../src-work/minecraft/net/minecraft/world/storage/SaveHandler.java -@@ -144,6 +144,8 @@ - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.setTag("Data", nbttagcompound); +@@ -105,13 +105,17 @@ + { + File file1 = new File(this.worldDirectory, "level.dat"); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, worldInformation, nbttagcompound2); ++ WorldInfo worldInfo = null; + - try + if (file1.exists()) { - File file1 = new File(this.worldDirectory, "level.dat_new"); -@@ -182,6 +184,8 @@ + try + { + NBTTagCompound nbttagcompound2 = CompressedStreamTools.readCompressed(new FileInputStream(file1)); + NBTTagCompound nbttagcompound3 = nbttagcompound2.getCompoundTag("Data"); +- return new WorldInfo(nbttagcompound3); ++ worldInfo = new WorldInfo(nbttagcompound3); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound2); ++ return worldInfo; + } + catch (Exception exception1) + { +@@ -119,6 +123,7 @@ + } + } + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().confirmBackupLevelDatUse(this); + file1 = new File(this.worldDirectory, "level.dat_old"); + + if (file1.exists()) +@@ -127,7 +132,13 @@ + { + NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1)); + NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Data"); +- return new WorldInfo(nbttagcompound1); ++ worldInfo = new WorldInfo(nbttagcompound1); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound); ++ return worldInfo; ++ } ++ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) ++ { ++ throw e; + } + catch (Exception exception) + { +@@ -144,6 +155,8 @@ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setTag("Data", nbttagcompound); @@ -18,7 +51,16 @@ try { File file1 = new File(this.worldDirectory, "level.dat_new"); -@@ -230,6 +234,7 @@ +@@ -182,6 +195,8 @@ + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setTag("Data", nbttagcompound); + ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, worldInformation, nbttagcompound1); ++ + try + { + File file1 = new File(this.worldDirectory, "level.dat_new"); +@@ -230,6 +245,7 @@ } file1.renameTo(file2); @@ -26,7 +68,7 @@ } catch (Exception var5) { -@@ -260,6 +265,7 @@ +@@ -260,6 +276,7 @@ p_75752_1_.readFromNBT(nbttagcompound); } @@ -34,7 +76,7 @@ return nbttagcompound; } -@@ -301,4 +307,22 @@ +@@ -301,4 +318,22 @@ { return this.saveDirectoryName; } diff --git a/rejects/minecraft/net/minecraft/enchantment/Enchantment.java.patch.rej b/rejects/minecraft/net/minecraft/enchantment/Enchantment.java.patch.rej deleted file mode 100644 index d074e8eaa..000000000 --- a/rejects/minecraft/net/minecraft/enchantment/Enchantment.java.patch.rej +++ /dev/null @@ -1,55 +0,0 @@ -++++ REJECTED PATCH 2 - - public boolean canApply(ItemStack stack) - { -- return this.type.canEnchantItem(stack.getItem()); -+ return canApplyAtEnchantingTable(stack); - } - - public void onEntityDamaged(EntityLivingBase user, Entity target, int level) {} - - public void onUserHurt(EntityLivingBase user, Entity attacker, int level) {} - -+ /** -+ * This applies specifically to applying at the enchanting table. The other method {@link #canApply(ItemStack)} -+ * applies for all possible enchantments. -+ * @param stack -+ * @return -+ */ -+ public boolean canApplyAtEnchantingTable(ItemStack stack) -+ { -+ return this.type.canEnchantItem(stack.getItem()); -+ } -+ -+ private static final java.lang.reflect.Field bookSetter = Enchantment.class.getDeclaredFields()[1]; -+ /** -+ * Add to the list of enchantments applicable by the anvil from a book -+ * -+ * @param enchantment -+ */ -+ public static void addToBookList(Enchantment enchantment) -+ { -+ try -+ { -+ net.minecraftforge.common.util.EnumHelper.setFailsafeFieldValue(bookSetter, null, -+ com.google.common.collect.ObjectArrays.concat(enchantmentsBookList, enchantment)); -+ } -+ catch (Exception e) -+ { -+ throw new RuntimeException(e); //Rethrow see what happens -+ } -+ } -+ -+ /** -+ * Is this enchantment allowed to be enchanted on books via Enchantment Table -+ * @return false to disable the vanilla feature -+ */ -+ public boolean isAllowedOnBooks() -+ { -+ return true; -+ } -+ - static - { - ArrayList var0 = Lists.newArrayList(); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch.rej b/rejects/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch.rej deleted file mode 100644 index 974dff0f7..000000000 --- a/rejects/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch.rej +++ /dev/null @@ -1,43 +0,0 @@ -++++ REJECTED PATCH 1 - public static int calcItemStackEnchantability(Random p_77514_0_, int p_77514_1_, int p_77514_2_, ItemStack p_77514_3_) - { - Item item = p_77514_3_.getItem(); -- int k = item.getItemEnchantability(); -+ int k = item.getItemEnchantability(p_77514_3_); - - if (k <= 0) - { -++++ END PATCH -++++ REJECTED PATCH 2 - public static List buildEnchantmentList(Random p_77513_0_, ItemStack p_77513_1_, int p_77513_2_) - { - Item item = p_77513_1_.getItem(); -- int j = item.getItemEnchantability(); -+ int j = item.getItemEnchantability(p_77513_1_); - - if (j <= 0) - { -++++ END PATCH -++++ REJECTED PATCH 3 - { - EnchantmentData enchantmentdata1 = (EnchantmentData)iterator1.next(); - -- if (enchantmentdata1.enchantmentobj.canApplyTogether(Enchantment.getEnchantmentById(integer.intValue()))) -+ Enchantment e1 = enchantmentdata1.enchantmentobj; -+ Enchantment e2 = Enchantment.getEnchantmentById(integer.intValue()); -+ if (e1.canApplyTogether(e2) && e2.canApplyTogether(e1)) //Forge BugFix: Let Both enchantments veto being together - { - continue; - } -++++ END PATCH -++++ REJECTED PATCH 4 - { - Enchantment enchantment = aenchantment[k]; - -- if (enchantment != null && (enchantment.type.canEnchantItem(item) || flag)) -+ if (enchantment == null) continue; -+ if (enchantment.canApplyAtEnchantingTable(p_77505_1_) || ((item == Items.book) && enchantment.isAllowedOnBooks())) - { - for (int l = enchantment.getMinLevel(); l <= enchantment.getMaxLevel(); ++l) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch.rej b/rejects/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch.rej deleted file mode 100644 index e32f40b66..000000000 --- a/rejects/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch.rej +++ /dev/null @@ -1,19 +0,0 @@ -++++ REJECTED PATCH 1 - - protected boolean teleportTo(double p_70825_1_, double p_70825_3_, double p_70825_5_) - { -+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, p_70825_1_, p_70825_3_, p_70825_5_, 0); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false; - double d3 = this.posX; - double d4 = this.posY; - double d5 = this.posZ; -- this.posX = p_70825_1_; -- this.posY = p_70825_3_; -- this.posZ = p_70825_5_; -+ this.posX = event.targetX; -+ this.posY = event.targetY; -+ this.posZ = event.targetZ; - boolean flag = false; - BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ); - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch.rej b/rejects/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch.rej deleted file mode 100644 index ed935ae5f..000000000 --- a/rejects/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 4 - - if (p_180482_2_1 == null) - { -- p_180482_2_1 = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < 0.05F, this.worldObj.rand.nextFloat() < 0.05F, null); -+ p_180482_2_1 = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < net.minecraftforge.common.ForgeModContainer.zombieBabyChance, this.worldObj.rand.nextFloat() < 0.05F, null); - } - - if (p_180482_2_1 instanceof EntityZombie.GroupData) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch.rej b/rejects/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch.rej deleted file mode 100644 index 4eec41fb9..000000000 --- a/rejects/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 3 - - private void populateBuyingList() - { -+ //TODO: Hook into VillagerRegistry - EntityVillager.ITradeList[][][] aitradelist = DEFAULT_TRADE_LIST_MAP[this.getProfession()]; - - if (this.careerId != 0 && this.careerLevel != 0) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch.rej b/rejects/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch.rej deleted file mode 100644 index 5dfe144df..000000000 --- a/rejects/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch.rej +++ /dev/null @@ -1,11 +0,0 @@ -++++ REJECTED PATCH 2 - - public float getSmeltingExperience(ItemStack stack) - { -+ float ret = stack.getItem().getSmeltingExperience(stack); -+ if (ret != -1) return ret; -+ - Iterator iterator = this.experienceList.entrySet().iterator(); - Entry entry; - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch.rej b/rejects/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch.rej deleted file mode 100644 index c5f4d4693..000000000 --- a/rejects/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch.rej +++ /dev/null @@ -1,23 +0,0 @@ -++++ REJECTED PATCH 1 - { - this.field_92102_a = new ItemStack(Items.fireworks); - -+ nbttagcompound = new NBTTagCompound(); - if (l > 0) - { -- nbttagcompound = new NBTTagCompound(); - nbttagcompound1 = new NBTTagCompound(); - NBTTagList nbttaglist = new NBTTagList(); - -++++ END PATCH -++++ REJECTED PATCH 2 - nbttagcompound1.setTag("Explosions", nbttaglist); - nbttagcompound1.setByte("Flight", (byte)j); - nbttagcompound.setTag("Fireworks", nbttagcompound1); -- this.field_92102_a.setTagCompound(nbttagcompound); - } -+ this.field_92102_a.setTagCompound(nbttagcompound); //Forge BugFix: NPE Protection - - return true; - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch.rej b/rejects/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch.rej deleted file mode 100644 index bb4871784..000000000 --- a/rejects/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 3 - ItemStack itemstack2 = (ItemStack)arraylist.get(0); - itemstack = (ItemStack)arraylist.get(1); - -- if (itemstack2.getItem() == itemstack.getItem() && itemstack2.stackSize == 1 && itemstack.stackSize == 1 && itemstack2.getItem().isDamageable()) -+ if (itemstack2.getItem() == itemstack.getItem() && itemstack2.stackSize == 1 && itemstack.stackSize == 1 && itemstack2.getItem().isRepairable()) - { - Item item = itemstack2.getItem(); - int j = item.getMaxDamage() - itemstack2.getItemDamage(); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/nbt/NBTTagByteArray.java.patch.rej b/rejects/minecraft/net/minecraft/nbt/NBTTagByteArray.java.patch.rej deleted file mode 100644 index 2f48a9fbb..000000000 --- a/rejects/minecraft/net/minecraft/nbt/NBTTagByteArray.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 1 - - void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException - { -+ sizeTracker.read(32); //Forge: Count the length as well - int j = input.readInt(); - sizeTracker.read((long)(8 * j)); - this.data = new byte[j]; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch.rej b/rejects/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch.rej deleted file mode 100644 index 2873b145b..000000000 --- a/rejects/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - while ((b0 = readType(input, sizeTracker)) != 0) - { - String s = readKey(input, sizeTracker); -- sizeTracker.read((long)(16 * s.length())); -+ NBTSizeTracker.readUTF(sizeTracker, s); // Forge: Correctly read String length including header. - NBTBase nbtbase = readNBT(b0, s, input, depth + 1, sizeTracker); - this.tagMap.put(s, nbtbase); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/nbt/NBTTagIntArray.java.patch.rej b/rejects/minecraft/net/minecraft/nbt/NBTTagIntArray.java.patch.rej deleted file mode 100644 index 891176729..000000000 --- a/rejects/minecraft/net/minecraft/nbt/NBTTagIntArray.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 1 - - void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException - { -+ sizeTracker.read(32); //Forge: Count the length as well - int j = input.readInt(); - sizeTracker.read((long)(32 * j)); - this.intArray = new int[j]; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/nbt/NBTTagList.java.patch.rej b/rejects/minecraft/net/minecraft/nbt/NBTTagList.java.patch.rej deleted file mode 100644 index 40455e211..000000000 --- a/rejects/minecraft/net/minecraft/nbt/NBTTagList.java.patch.rej +++ /dev/null @@ -1,15 +0,0 @@ -++++ REJECTED PATCH 1 - { - sizeTracker.read(8L); - this.tagType = input.readByte(); -+ sizeTracker.read(32); //Forge: Count the length as well - int j = input.readInt(); - this.tagList = Lists.newArrayList(); - - for (int k = 0; k < j; ++k) - { -+ sizeTracker.read(32); //Forge: 4 extra bytes for the object allocation. - NBTBase nbtbase = NBTBase.createNewByType(this.tagType); - nbtbase.read(input, depth + 1, sizeTracker); - this.tagList.add(nbtbase); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/network/NetworkSystem.java.patch.rej b/rejects/minecraft/net/minecraft/network/NetworkSystem.java.patch.rej deleted file mode 100644 index ef370c551..000000000 --- a/rejects/minecraft/net/minecraft/network/NetworkSystem.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - ; - } - -- p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new PingResponseHandler(NetworkSystem.this)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer(EnumPacketDirection.SERVERBOUND)).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer(EnumPacketDirection.CLIENTBOUND)); -+ p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.READ_TIMEOUT)).addLast("legacy_query", new PingResponseHandler(NetworkSystem.this)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer(EnumPacketDirection.SERVERBOUND)).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer(EnumPacketDirection.CLIENTBOUND)); - NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND); - NetworkSystem.this.networkManagers.add(networkmanager); - p_initChannel_1_.pipeline().addLast("packet_handler", networkmanager); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch.rej b/rejects/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch.rej deleted file mode 100644 index a1201ecf7..000000000 --- a/rejects/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - - public void writePacketData(PacketBuffer buf) throws IOException - { -- buf.writeString(GSON.toJson(this.response)); -+ buf.writeString(this.response.getJson()); - } - - public void processPacket(INetHandlerStatusClient handler) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/potion/PotionEffect.java.patch.rej b/rejects/minecraft/net/minecraft/potion/PotionEffect.java.patch.rej deleted file mode 100644 index af2f10358..000000000 --- a/rejects/minecraft/net/minecraft/potion/PotionEffect.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 4 - - public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt) - { -- byte b0 = nbt.getByte("Id"); -+ int b0 = nbt.getByte("Id") & 0xff; - - if (b0 >= 0 && b0 < Potion.potionTypes.length && Potion.potionTypes[b0] != null) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/MinecraftServer.java.patch.rej b/rejects/minecraft/net/minecraft/server/MinecraftServer.java.patch.rej deleted file mode 100644 index 43108a30c..000000000 --- a/rejects/minecraft/net/minecraft/server/MinecraftServer.java.patch.rej +++ /dev/null @@ -1,11 +0,0 @@ -// do we still need this? -++++ REJECTED PATCH 16 - { - try - { -- ((FutureTask)this.futureTaskQueue.poll()).run(); -+ net.minecraftforge.fml.common.FMLCommonHandler.callFuture(((FutureTask)this.futureTaskQueue.poll())); - } - catch (Throwable throwable2) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej b/rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej deleted file mode 100644 index fe21c355f..000000000 --- a/rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej +++ /dev/null @@ -1,11 +0,0 @@ -// This in now a method in Util, which does almost the same, do we need this still? -++++ REJECTED PATCH 4 - { - try - { -- ((FutureTask)this.futureTaskQueue.poll()).run(); -+ net.minecraftforge.fml.common.FMLCommonHandler.callFuture(((FutureTask)this.futureTaskQueue.poll())); - } - catch (Throwable throwable) - { -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/stats/StatList.java.patch.rej b/rejects/minecraft/net/minecraft/stats/StatList.java.patch.rej deleted file mode 100644 index ccf210286..000000000 --- a/rejects/minecraft/net/minecraft/stats/StatList.java.patch.rej +++ /dev/null @@ -1,15 +0,0 @@ -++++ REJECTED PATCH 2 - while (iterator.hasNext()) - { - Block block = (Block)iterator.next(); -- Item item = Item.getItemFromBlock(block); -+ Item item = Item.getItemFromBlock(block); //TODO: Hook FML's stat change event and re-assign these - - if (item != null) - { -- int i = Block.getIdFromBlock(block); -+ int i = Block.getIdFromBlock(block); //TODO: Hook FML's stat change event and re-assign these - String s = func_180204_a(item); - - if (s != null && block.getEnableStats()) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/Session.java.patch.rej b/rejects/minecraft/net/minecraft/util/Session.java.patch.rej deleted file mode 100644 index 11b745c24..000000000 --- a/rejects/minecraft/net/minecraft/util/Session.java.patch.rej +++ /dev/null @@ -1,17 +0,0 @@ -++++ REJECTED PATCH 2 - try - { - UUID uuid = UUIDTypeAdapter.fromString(this.getPlayerID()); -- return new GameProfile(uuid, this.getUsername()); -+ GameProfile ret = new GameProfile(uuid, this.getUsername()); //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.getUsername()); -+ return new GameProfile(net.minecraft.entity.player.EntityPlayer.getUUID(new GameProfile((UUID)null, this.getUsername())), this.getUsername()); - } - } - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch.rej b/rejects/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch.rej deleted file mode 100644 index 422036166..000000000 --- a/rejects/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch.rej +++ /dev/null @@ -1,54 +0,0 @@ -++++ REJECTED PATCH 1 - for (int j = 0; j < p_177630_3_; ++j) - { - WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, p_177630_1_); -- int k = weightedrandomchestcontent.theMinimumChanceToGenerateItem + random.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1); -+ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, p_177630_2_); - -- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= k) -+ for (ItemStack itemstack : stacks) - { -- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); -- itemstack.stackSize = k; - p_177630_2_.setInventorySlotContents(random.nextInt(p_177630_2_.getSizeInventory()), itemstack); - } -- else -- { -- for (int l = 0; l < k; ++l) -- { -- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); -- itemstack1.stackSize = 1; -- p_177630_2_.setInventorySlotContents(random.nextInt(p_177630_2_.getSizeInventory()), itemstack1); -- } -- } - } - } - -++++ END PATCH -++++ REJECTED PATCH 2 - for (int j = 0; j < p_177631_3_; ++j) - { - WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, p_177631_1_); -- int k = weightedrandomchestcontent.theMinimumChanceToGenerateItem + random.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1); -+ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, dispenser); - -- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= k) -+ for (ItemStack itemstack : stacks) - { -- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); -- itemstack.stackSize = k; - dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack); - } -- else -- { -- for (int l = 0; l < k; ++l) -- { -- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); -- itemstack1.stackSize = 1; -- dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack1); -- } -- } - } - } - -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/Explosion.java.patch.rej b/rejects/minecraft/net/minecraft/world/Explosion.java.patch.rej deleted file mode 100644 index 2cd87d5d3..000000000 --- a/rejects/minecraft/net/minecraft/world/Explosion.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 4 - int k1 = MathHelper.floor_double(this.explosionZ - (double)f3 - 1.0D); - int i1 = MathHelper.floor_double(this.explosionZ + (double)f3 + 1.0D); - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, new AxisAlignedBB((double)j, (double)j1, (double)k1, (double)k, (double)l, (double)i1)); -+ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.worldObj, this, list, f3); - Vec3 vec3 = new Vec3(this.explosionX, this.explosionY, this.explosionZ); - - for (int l1 = 0; l1 < list.size(); ++l1) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/storage/SaveHandler.java.patch.rej b/rejects/minecraft/net/minecraft/world/storage/SaveHandler.java.patch.rej deleted file mode 100644 index 5c25036b4..000000000 --- a/rejects/minecraft/net/minecraft/world/storage/SaveHandler.java.patch.rej +++ /dev/null @@ -1,48 +0,0 @@ -++++ REJECTED PATCH 1 - NBTTagCompound nbttagcompound; - NBTTagCompound nbttagcompound1; - -+ WorldInfo worldInfo = null; -+ - if (file1.exists()) - { - try - { - nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1)); - nbttagcompound1 = nbttagcompound.getCompoundTag("Data"); -- return new WorldInfo(nbttagcompound1); -+ worldInfo = new WorldInfo(nbttagcompound1); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound); -+ return worldInfo; - } -+ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) -+ { -+ throw e; -+ } - catch (Exception exception1) - { - exception1.printStackTrace(); - } - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().confirmBackupLevelDatUse(this); - file1 = new File(this.worldDirectory, "level.dat_old"); - - if (file1.exists()) -++++ END PATCH -++++ REJECTED PATCH 2 - { - nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1)); - nbttagcompound1 = nbttagcompound.getCompoundTag("Data"); -- return new WorldInfo(nbttagcompound1); -+ worldInfo = new WorldInfo(nbttagcompound1); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound); -+ return worldInfo; -+ } -+ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) -+ { -+ throw e; - } - catch (Exception exception) - { -++++ END PATCH From ce40f91fb0702ca4f07a6c54823157f89f12e6ac Mon Sep 17 00:00:00 2001 From: cpw Date: Thu, 12 Nov 2015 23:30:53 -0500 Subject: [PATCH 028/133] WorldGen rejects, lots of them. Couple of small fixes elsewhere. --- .../minecraft/inventory/Container.java.patch | 2 +- .../feature/WorldGenBigMushroom.java.patch | 33 ++++++ .../gen/feature/WorldGenBigTree.java.patch | 21 ++++ .../gen/feature/WorldGenCanopyTree.java.patch | 71 +++++++++++ .../gen/feature/WorldGenForest.java.patch | 43 ++++++- .../gen/feature/WorldGenHugeTrees.java.patch | 55 ++++++++- .../gen/feature/WorldGenMegaJungle.java.patch | 36 ++++++ .../feature/WorldGenMegaPineTree.java.patch | 40 +++---- .../gen/feature/WorldGenMinable.java.patch | 11 ++ .../feature/WorldGenSavannaTree.java.patch | 33 ++++++ .../gen/feature/WorldGenShrub.java.patch | 9 ++ .../gen/feature/WorldGenSwamp.java.patch | 112 ++++++++---------- .../gen/feature/WorldGenTaiga1.java.patch | 38 +++--- .../gen/feature/WorldGenTaiga2.java.patch | 44 +++---- .../gen/feature/WorldGenTrees.java.patch | 87 +++++++++++++- .../gen/structure/MapGenStronghold.java.patch | 11 +- .../StructureNetherBridgePieces.java.patch | 8 ++ .../WorldGenBigMushroom.java.patch.rej | 38 ------ .../feature/WorldGenBigTree.java.patch.rej | 23 ---- .../feature/WorldGenCanopyTree.java.patch.rej | 69 ----------- .../gen/feature/WorldGenForest.java.patch.rej | 42 ------- .../feature/WorldGenHugeTrees.java.patch.rej | 57 --------- .../feature/WorldGenMegaJungle.java.patch.rej | 53 --------- .../feature/WorldGenMinable.java.patch.rej | 10 -- .../WorldGenSavannaTree.java.patch.rej | 36 ------ .../gen/feature/WorldGenShrub.java.patch.rej | 10 -- .../gen/feature/WorldGenTrees.java.patch.rej | 88 -------------- ...StructureNetherBridgePieces.java.patch.rej | 9 -- .../fml/client/FMLClientHandler.java | 4 +- .../client/registry/RenderingRegistry.java | 10 +- 30 files changed, 524 insertions(+), 579 deletions(-) create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch rename rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch.rej => patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch (51%) create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch rename rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch.rej => patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch (54%) rename rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch.rej => patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch (58%) rename rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch.rej => patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch (56%) rename rejects/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch.rej => patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch (65%) delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch.rej diff --git a/patches/minecraft/net/minecraft/inventory/Container.java.patch b/patches/minecraft/net/minecraft/inventory/Container.java.patch index a588231ef..a32c9d708 100644 --- a/patches/minecraft/net/minecraft/inventory/Container.java.patch +++ b/patches/minecraft/net/minecraft/inventory/Container.java.patch @@ -5,7 +5,7 @@ ItemStack itemstack1 = slot1.getStack(); - if (itemstack1 == null) -+ if (itemstack1 == null && slot.isItemValid(stack)) // Forge: Make sure to respect isItemValid in the slot. ++ if (itemstack1 == null && slot1.isItemValid(stack)) // Forge: Make sure to respect isItemValid in the slot. { slot1.putStack(stack.copy()); slot1.onSlotChanged(); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch new file mode 100644 index 000000000..dd5301bd2 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch @@ -0,0 +1,33 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java +@@ -55,7 +55,7 @@ + { + Block block = worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(l, j, i1)).getBlock(); + +- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) ++ if (!block.isAir(worldIn,blockpos$mutableblockpos) && !block.isLeaves(worldIn,blockpos$mutableblockpos)) + { + flag = false; + } +@@ -191,7 +191,7 @@ + { + BlockPos blockpos = new BlockPos(l1, l2, i2); + +- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) ++ if (!worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) + { + this.func_175903_a(worldIn, blockpos, this.mushroomType.getDefaultState().withProperty(BlockHugeMushroom.VARIANT, blockhugemushroom$enumtype)); + } +@@ -202,9 +202,10 @@ + + for (int i3 = 0; i3 < i; ++i3) + { +- Block block2 = worldIn.getBlockState(p_180709_3_.up(i3)).getBlock(); ++ BlockPos upN = p_180709_3_.up(i3); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(upN); + +- if (!block2.isFullBlock()) ++ if (state.getBlock().canBeReplacedByLeaves(worldIn, upN)) + { + this.func_175903_a(worldIn, p_180709_3_.up(i3), this.mushroomType.getDefaultState().withProperty(BlockHugeMushroom.VARIANT, BlockHugeMushroom.EnumType.STEM)); + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch index 2624e3901..d44de7d8f 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch @@ -1,5 +1,26 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java +@@ -100,9 +100,9 @@ + if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_181631_2_ * p_181631_2_)) + { + BlockPos blockpos = p_181631_1_.add(j, 0, k); +- Material material = this.world.getBlockState(blockpos).getBlock().getMaterial(); ++ net.minecraft.block.state.IBlockState state = this.world.getBlockState(blockpos); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(this.world, blockpos) || state.getBlock().isLeaves(this.world, blockpos)) + { + this.func_175903_a(this.world, blockpos, p_181631_3_); + } +@@ -255,7 +255,7 @@ + { + BlockPos blockpos1 = p_175936_1_.add((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2)); + +- if (!this.func_150523_a(this.world.getBlockState(blockpos1).getBlock())) ++ if (!this.isReplaceable(world, blockpos1)) + { + return j; + } @@ -283,6 +283,7 @@ if (!this.validTreeLocation()) diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch new file mode 100644 index 000000000..6a5cb5826 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch @@ -0,0 +1,71 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java +@@ -34,9 +34,10 @@ + if (k >= 1 && k + i + 1 < 256) + { + BlockPos blockpos = p_180709_3_.down(); +- Block block = worldIn.getBlockState(blockpos).getBlock(); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos); ++ boolean isSoil = state.getBlock().canSustainPlant(worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + +- if (block != Blocks.grass && block != Blocks.dirt) ++ if (!(isSoil && p_180709_3_.getY() < 256 - i - 1)) + { + return false; + } +@@ -46,10 +47,10 @@ + } + else + { +- this.func_175921_a(worldIn, blockpos); +- this.func_175921_a(worldIn, blockpos.east()); +- this.func_175921_a(worldIn, blockpos.south()); +- this.func_175921_a(worldIn, blockpos.south().east()); ++ this.onPlantGrow(worldIn, blockpos, p_180709_3_); ++ this.onPlantGrow(worldIn, blockpos.east(), p_180709_3_); ++ this.onPlantGrow(worldIn, blockpos.south(), p_180709_3_); ++ this.onPlantGrow(worldIn, blockpos.south().east(), p_180709_3_); + EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(p_180709_2_); + int i1 = i - p_180709_2_.nextInt(4); + int j1 = 2 - p_180709_2_.nextInt(3); +@@ -68,9 +69,9 @@ + + int k2 = k + j2; + BlockPos blockpos1 = new BlockPos(k1, k2, l1); +- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); ++ state = worldIn.getBlockState(blockpos1); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(worldIn, blockpos1) || state.getBlock().isLeaves(worldIn, blockpos1)) + { + this.func_181639_b(worldIn, blockpos1); + this.func_181639_b(worldIn, blockpos1.east()); +@@ -188,7 +189,7 @@ + { + for (int k1 = -i1; k1 <= i1; ++k1) + { +- if (!this.func_150523_a(p_181638_1_.getBlockState(blockpos$mutableblockpos.func_181079_c(i + j1, j + l, k + k1)).getBlock())) ++ if (!this.isReplaceable(p_181638_1_, blockpos$mutableblockpos.func_181079_c(i + j1, j + l, k + k1))) + { + return false; + } +@@ -210,11 +211,17 @@ + private void func_150526_a(World worldIn, int p_150526_2_, int p_150526_3_, int p_150526_4_) + { + BlockPos blockpos = new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_); +- Block block = worldIn.getBlockState(blockpos).getBlock(); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos); + +- if (block.getMaterial() == Material.air) ++ if (state.getBlock().isAir(worldIn, blockpos)) + { + this.func_175903_a(worldIn, blockpos, field_181641_b); + } + } ++ ++ //Just a helper macro ++ private void onPlantGrow(World world, BlockPos pos, BlockPos source) ++ { ++ world.getBlockState(pos).getBlock().onPlantGrow(world, pos, source); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch index a25a63e45..17e83e43e 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch @@ -1,11 +1,50 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java -@@ -102,7 +102,7 @@ +@@ -59,7 +59,7 @@ + { + if (j >= 0 && j < 256) + { +- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(l, j, i1)).getBlock())) ++ if (!this.isReplaceable(worldIn, blockpos$mutableblockpos.func_181079_c(l, j, i1))) + { + flag = false; + } +@@ -78,11 +78,13 @@ + } + else + { +- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); ++ BlockPos down = p_180709_3_.down(); ++ Block block1 = worldIn.getBlockState(down).getBlock(); ++ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + +- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && p_180709_3_.getY() < 256 - i - 1) ++ if (isSoil && p_180709_3_.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, p_180709_3_.down()); ++ block1.onPlantGrow(worldIn, down, p_180709_3_); + + for (int i2 = p_180709_3_.getY() - 3 + i; i2 <= p_180709_3_.getY() + i; ++i2) + { +@@ -102,7 +104,7 @@ BlockPos blockpos = new BlockPos(i3, i2, k1); Block block = worldIn.getBlockState(blockpos).getBlock(); - if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (block.isAir(worldIn, blockpos1) || block.isLeaves(worldIn, blockpos1)) ++ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos)) { this.func_175903_a(worldIn, blockpos, field_181630_b); } +@@ -113,9 +115,9 @@ + + for (int j2 = 0; j2 < i; ++j2) + { +- Block block2 = worldIn.getBlockState(p_180709_3_.up(j2)).getBlock(); +- +- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves) ++ BlockPos upN = p_180709_3_.up(j2); ++ Block block2 = worldIn.getBlockState(upN).getBlock(); ++ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN)) + { + this.func_175903_a(worldIn, p_180709_3_.up(j2), field_181629_a); + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch index 6bfaaf13e..27dae21c4 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch @@ -1,6 +1,59 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java -@@ -146,4 +146,10 @@ +@@ -60,7 +60,7 @@ + { + for (int l = -j; l <= j && flag; ++l) + { +- if (p_175926_2_.getY() + i < 0 || p_175926_2_.getY() + i >= 256 || !this.func_150523_a(worldIn.getBlockState(p_175926_2_.add(k, i, l)).getBlock())) ++ if (p_175926_2_.getY() + i < 0 || p_175926_2_.getY() + i >= 256 || !this.isReplaceable(worldIn,p_175926_2_.add(k, i, l))) + { + flag = false; + } +@@ -80,13 +80,14 @@ + { + BlockPos blockpos = p_175927_1_.down(); + Block block = worldIn.getBlockState(blockpos).getBlock(); ++ boolean isSoil = block.canSustainPlant(worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + +- if ((block == Blocks.grass || block == Blocks.dirt) && p_175927_1_.getY() >= 2) ++ if (isSoil && p_175927_1_.getY() >= 2) + { +- this.func_175921_a(worldIn, blockpos); +- this.func_175921_a(worldIn, blockpos.east()); +- this.func_175921_a(worldIn, blockpos.south()); +- this.func_175921_a(worldIn, blockpos.south().east()); ++ this.onPlantGrow(worldIn, blockpos, p_175927_1_); ++ this.onPlantGrow(worldIn, blockpos.east(), p_175927_1_); ++ this.onPlantGrow(worldIn, blockpos.south(), p_175927_1_); ++ this.onPlantGrow(worldIn, blockpos.south().east(), p_175927_1_); + return true; + } + else +@@ -114,9 +115,9 @@ + if (j * j + k * k <= i || l * l + i1 * i1 <= i || j * j + i1 * i1 <= i || l * l + k * k <= i) + { + BlockPos blockpos = p_175925_2_.add(j, 0, k); +- Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial(); ++ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos); + +- if (material == Material.air || material == Material.leaves) ++ if (state.getBlock().isAir(worldIn, blockpos) || state.getBlock().isLeaves(worldIn, blockpos)) + { + this.func_175903_a(worldIn, blockpos, this.leavesMetadata); + } +@@ -136,9 +137,9 @@ + if (j * j + k * k <= i) + { + BlockPos blockpos = p_175928_2_.add(j, 0, k); +- Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial(); ++ Block block = worldIn.getBlockState(blockpos).getBlock(); + +- if (material == Material.air || material == Material.leaves) ++ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos)) + { + this.func_175903_a(worldIn, blockpos, this.leavesMetadata); + } +@@ -146,4 +147,10 @@ } } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch index f124d3f7b..6a5d20fe9 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch @@ -1,5 +1,41 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java +@@ -57,7 +57,7 @@ + { + BlockPos blockpos = p_180709_3_.up(i2); + +- if (this.func_150523_a(worldIn.getBlockState(blockpos).getBlock())) ++ if (this.isAirLeaves(worldIn,blockpos)) + { + this.func_175903_a(worldIn, blockpos, this.woodMetadata); + +@@ -72,7 +72,7 @@ + { + BlockPos blockpos1 = blockpos.east(); + +- if (this.func_150523_a(worldIn.getBlockState(blockpos1).getBlock())) ++ if (this.isAirLeaves(worldIn,blockpos1)) + { + this.func_175903_a(worldIn, blockpos1, this.woodMetadata); + +@@ -85,7 +85,7 @@ + + BlockPos blockpos2 = blockpos.south().east(); + +- if (this.func_150523_a(worldIn.getBlockState(blockpos2).getBlock())) ++ if (this.isAirLeaves(worldIn,blockpos2)) + { + this.func_175903_a(worldIn, blockpos2, this.woodMetadata); + +@@ -98,7 +98,7 @@ + + BlockPos blockpos3 = blockpos.south(); + +- if (this.func_150523_a(worldIn.getBlockState(blockpos3).getBlock())) ++ if (this.isAirLeaves(worldIn,blockpos3)) + { + this.func_175903_a(worldIn, blockpos3, this.woodMetadata); + @@ -132,4 +132,11 @@ this.func_175925_a(worldIn, p_175930_2_.up(j), p_175930_3_ + 1 - j); } diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch.rej b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch similarity index 51% rename from rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch.rej rename to patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch index 5fcea52b7..4159f4282 100644 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch.rej +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch @@ -1,13 +1,13 @@ -++++ REJECTED PATCH 1 - - for (int j = 0; j < i; ++j) +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java +@@ -44,30 +44,24 @@ { -- Block block = worldIn.getBlockState(p_180709_3_.up(j)).getBlock(); -- + Block block = worldIn.getBlockState(p_180709_3_.up(j)).getBlock(); + - if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (this.isAirLeaves(worldIn, p_180709_3_.up(j))) ++ if (isAirLeaves(worldIn,p_180709_3_.up(j))) { - this.func_175905_a(worldIn, p_180709_3_.up(j), Blocks.log, this.woodMetadata); + this.func_175903_a(worldIn, p_180709_3_.up(j), this.woodMetadata); } if (j < i - 1) @@ -15,40 +15,39 @@ - block = worldIn.getBlockState(p_180709_3_.add(1, j, 0)).getBlock(); - - if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (this.isAirLeaves(worldIn, p_180709_3_.add(1, j, 0))) ++ if (isAirLeaves(worldIn,p_180709_3_.add(1, j, 0))) { - this.func_175905_a(worldIn, p_180709_3_.add(1, j, 0), Blocks.log, this.woodMetadata); + this.func_175903_a(worldIn, p_180709_3_.add(1, j, 0), this.woodMetadata); } - block = worldIn.getBlockState(p_180709_3_.add(1, j, 1)).getBlock(); - - if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (this.isAirLeaves(worldIn, p_180709_3_.add(1, j, 1))) ++ if (isAirLeaves(worldIn,p_180709_3_.add(1, j, 1))) { - this.func_175905_a(worldIn, p_180709_3_.add(1, j, 1), Blocks.log, this.woodMetadata); + this.func_175903_a(worldIn, p_180709_3_.add(1, j, 1), this.woodMetadata); } - block = worldIn.getBlockState(p_180709_3_.add(0, j, 1)).getBlock(); - - if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (this.isAirLeaves(worldIn, p_180709_3_.add(0, j, 1))) ++ if (isAirLeaves(worldIn,p_180709_3_.add(0, j, 1))) { - this.func_175905_a(worldIn, p_180709_3_.add(0, j, 1), Blocks.log, this.woodMetadata); + this.func_175903_a(worldIn, p_180709_3_.add(0, j, 1), this.woodMetadata); } -++++ END PATCH -++++ REJECTED PATCH 2 - BlockPos blockpos1 = p_175934_2_.up(i); - Block block = worldIn.getBlockState(blockpos1).getBlock(); +@@ -133,16 +127,23 @@ + BlockPos blockpos = p_175934_2_.up(i); + Block block = worldIn.getBlockState(blockpos).getBlock(); - if (block == Blocks.grass || block == Blocks.dirt) -+ if (block.canSustainPlant(worldIn, blockpos1, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) ++ if (block.canSustainPlant(worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) { - this.func_175905_a(worldIn, blockpos1, Blocks.dirt, BlockDirt.DirtType.PODZOL.getMetadata()); + this.func_175903_a(worldIn, blockpos, field_181635_g); break; } - if (block.getMaterial() != Material.air && i < 0) -+ if (!block.isAir(worldIn, blockpos1) && i < 0) ++ if (!block.isAir(worldIn, blockpos) && i < 0) { break; } @@ -62,4 +61,3 @@ + return block.isAir(world, pos) || block.isLeaves(world, pos); + } } -++++ END PATCH diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch new file mode 100644 index 000000000..e8ae4f03e --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java +@@ -74,7 +74,7 @@ + { + BlockPos blockpos = new BlockPos(l1, i2, j2); + +- if (this.field_175919_c.apply(worldIn.getBlockState(blockpos))) ++ if (worldIn.getBlockState(blockpos).getBlock().isReplaceableOreGen(worldIn, blockpos, this.field_175919_c)) + { + worldIn.setBlockState(blockpos, this.oreBlock, 2); + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch index 4d3c26db3..3d16c0867 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch @@ -1,5 +1,14 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java +@@ -53,7 +53,7 @@ + { + if (j >= 0 && j < 256) + { +- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(l, j, i1)).getBlock())) ++ if (!this.isReplaceable(worldIn,blockpos$mutableblockpos.func_181079_c(l, j, i1))) + { + flag = false; + } @@ -72,11 +72,13 @@ } else @@ -17,6 +26,30 @@ EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(p_180709_2_); int k2 = i - p_180709_2_.nextInt(4) - 1; int l2 = 3 - p_180709_2_.nextInt(3); +@@ -96,9 +98,9 @@ + } + + BlockPos blockpos = new BlockPos(i3, i2, j1); +- Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial(); ++ block = worldIn.getBlockState(blockpos).getBlock(); + +- if (material == Material.air || material == Material.leaves) ++ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos)) + { + this.func_181642_b(worldIn, blockpos); + k1 = i2; +@@ -150,9 +152,9 @@ + i3 += enumfacing1.getFrontOffsetX(); + j1 += enumfacing1.getFrontOffsetZ(); + BlockPos blockpos1 = new BlockPos(i3, j2, j1); +- Material material1 = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); ++ block = worldIn.getBlockState(blockpos1).getBlock(); + +- if (material1 == Material.air || material1 == Material.leaves) ++ if (block.isAir(worldIn, blockpos2) || block.isLeaves(worldIn, blockpos2)) + { + this.func_181642_b(worldIn, blockpos1); + k1 = j2; @@ -210,9 +212,9 @@ private void func_175924_b(World worldIn, BlockPos p_175924_2_) diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch index a5d8a11a7..24a18af07 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch @@ -20,3 +20,12 @@ { p_180709_3_ = p_180709_3_.up(); this.func_175903_a(worldIn, p_180709_3_, this.field_150527_b); +@@ -54,7 +56,7 @@ + { + BlockPos blockpos = new BlockPos(l, i, j1); + +- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) + { + this.func_175903_a(worldIn, blockpos, this.field_150528_a); + } diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch.rej b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch similarity index 54% rename from rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch.rej rename to patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch index 61f1d8a60..ad4f76817 100644 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch.rej +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch @@ -1,18 +1,15 @@ -++++ REJECTED PATCH 1 - { - if (j >= 0 && j < 256) +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java +@@ -61,7 +61,7 @@ { -- Block block = worldIn.getBlockState(new BlockPos(k, j, l)).getBlock(); -+ BlockPos pos = new BlockPos(k, j, l); -+ Block block = worldIn.getBlockState(pos).getBlock(); + Block block = worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(l, j, i1)).getBlock(); - if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) -+ if (!block.isAir(worldIn, pos) && !block.isLeaves(worldIn, pos)) ++ if (!block.isAir(worldIn, blockpos$mutableblockpos.func_181079_c(l, j, i1)) && !block.isLeaves(worldIn, blockpos$mutableblockpos.func_181079_c(l, j, i1))) { if (block != Blocks.water && block != Blocks.flowing_water) { -++++ END PATCH -++++ REJECTED PATCH 2 +@@ -87,11 +87,13 @@ } else { @@ -25,78 +22,73 @@ + if (isSoil && p_180709_3_.getY() < 256 - i - 1) { - this.func_175921_a(worldIn, p_180709_3_.down()); -+ block1.onPlantGrow(worldIn, down, p_180709_3_); - int i1; - BlockPos blockpos1; - int l1; -++++ END PATCH -++++ REJECTED PATCH 3 - { - blockpos1 = new BlockPos(i2, l1, j1); ++ block1.onPlantGrow(worldIn, p_180709_3_.down(),p_180709_3_); -- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) -+ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) - { - this.func_175906_a(worldIn, blockpos1, Blocks.leaves); - } -++++ END PATCH -++++ REJECTED PATCH 4 - - for (l1 = 0; l1 < i; ++l1) + for (int l1 = p_180709_3_.getY() - 3 + i; l1 <= p_180709_3_.getY() + i; ++l1) { -- Block block2 = worldIn.getBlockState(p_180709_3_.up(l1)).getBlock(); -+ BlockPos upN = p_180709_3_.up(l1); +@@ -110,7 +112,7 @@ + { + BlockPos blockpos = new BlockPos(k3, l1, j1); + +- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) + { + this.func_175903_a(worldIn, blockpos, field_181649_b); + } +@@ -121,9 +123,10 @@ + + for (int i2 = 0; i2 < i; ++i2) + { +- Block block2 = worldIn.getBlockState(p_180709_3_.up(i2)).getBlock(); ++ BlockPos upN = p_180709_3_.up(i2); + Block block2 = worldIn.getBlockState(upN).getBlock(); - if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves || block2 == Blocks.flowing_water || block2 == Blocks.water) + if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN) || block2 == Blocks.flowing_water || block2 == Blocks.water) { - this.func_175906_a(worldIn, p_180709_3_.up(l1), Blocks.log); + this.func_175903_a(worldIn, p_180709_3_.up(i2), field_181648_a); } -++++ END PATCH -++++ REJECTED PATCH 5 +@@ -141,29 +144,29 @@ { - BlockPos blockpos4 = new BlockPos(i2, l1, i1); + blockpos$mutableblockpos1.func_181079_c(i4, j2, j4); -- if (worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.leaves) -+ if (worldIn.getBlockState(blockpos4).getBlock().isLeaves(worldIn, blockpos4)) +- if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().getMaterial() == Material.leaves) ++ if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().isLeaves(worldIn, blockpos$mutableblockpos1)) { - BlockPos blockpos5 = blockpos4.west(); - blockpos1 = blockpos4.east(); - BlockPos blockpos2 = blockpos4.north(); - BlockPos blockpos3 = blockpos4.south(); + BlockPos blockpos3 = blockpos$mutableblockpos1.west(); + BlockPos blockpos4 = blockpos$mutableblockpos1.east(); + BlockPos blockpos1 = blockpos$mutableblockpos1.north(); + BlockPos blockpos2 = blockpos$mutableblockpos1.south(); -- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos5).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos5).getBlock().isAir(worldIn, blockpos5)) +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().isAir(worldIn,blockpos3)) { - this.func_175922_a(worldIn, blockpos5, BlockVine.EAST_FLAG); + this.func_181647_a(worldIn, blockpos3, BlockVine.EAST); + } + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().isAir(worldIn,blockpos4)) + { + this.func_181647_a(worldIn, blockpos4, BlockVine.WEST); } - if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().isAir(worldIn, blockpos1)) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().isAir(worldIn,blockpos1)) { - this.func_175922_a(worldIn, blockpos1, BlockVine.WEST_FLAG); + this.func_181647_a(worldIn, blockpos1, BlockVine.SOUTH); } - if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().isAir(worldIn, blockpos2)) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().isAir(worldIn,blockpos2)) { - this.func_175922_a(worldIn, blockpos2, BlockVine.SOUTH_FLAG); + this.func_181647_a(worldIn, blockpos2, BlockVine.NORTH); } +@@ -192,7 +195,7 @@ + this.func_175903_a(p_181647_1_, p_181647_2_, iblockstate); + int i = 4; -- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().isAir(worldIn, blockpos3)) - { - this.func_175922_a(worldIn, blockpos3, BlockVine.NORTH_FLAG); - } -++++ END PATCH -++++ REJECTED PATCH 6 - this.func_175905_a(worldIn, p_175922_2_, Blocks.vine, p_175922_3_); - int j = 4; - -- for (p_175922_2_ = p_175922_2_.down(); worldIn.getBlockState(p_175922_2_).getBlock().getMaterial() == Material.air && j > 0; --j) -+ for (p_175922_2_ = p_175922_2_.down(); worldIn.getBlockState(p_175922_2_).getBlock().isAir(worldIn, p_175922_2_) && j > 0; --j) +- for (p_181647_2_ = p_181647_2_.down(); p_181647_1_.getBlockState(p_181647_2_).getBlock().getMaterial() == Material.air && i > 0; --i) ++ for (p_181647_2_ = p_181647_2_.down(); p_181647_1_.getBlockState(p_181647_2_).getBlock().isAir(p_181647_1_,p_181647_2_) && i > 0; --i) { - this.func_175905_a(worldIn, p_175922_2_, Blocks.vine, p_175922_3_); - p_175922_2_ = p_175922_2_.down(); -++++ END PATCH + this.func_175903_a(p_181647_1_, p_181647_2_, iblockstate); + p_181647_2_ = p_181647_2_.down(); diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch.rej b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch similarity index 58% rename from rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch.rej rename to patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch index 349fa3cca..dadf0ec27 100644 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch.rej +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch @@ -1,14 +1,15 @@ -++++ REJECTED PATCH 1 +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java +@@ -54,7 +54,7 @@ { if (i1 >= 0 && i1 < 256) { -- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(j1, i1, k1)).getBlock())) -+ if (!this.isReplaceable(worldIn, new BlockPos(j1, i1, k1))) +- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, i1, l1)).getBlock())) ++ if (!this.isReplaceable(worldIn,blockpos$mutableblockpos.func_181079_c(k1, i1, l1))) { flag = false; } -++++ END PATCH -++++ REJECTED PATCH 2 +@@ -73,11 +73,13 @@ } else { @@ -22,31 +23,28 @@ { - this.func_175921_a(worldIn, p_180709_3_.down()); + block.onPlantGrow(worldIn, down, p_180709_3_); - k2 = 0; + int k2 = 0; - for (j1 = p_180709_3_.getY() + i; j1 >= p_180709_3_.getY() + j; --j1) -++++ END PATCH -++++ REJECTED PATCH 3 + for (int l2 = p_180709_3_.getY() + i; l2 >= p_180709_3_.getY() + j; --l2) +@@ -94,7 +96,7 @@ { - BlockPos blockpos1 = new BlockPos(k1, j1, i2); + BlockPos blockpos = new BlockPos(j3, l2, i2); -- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) -+ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) +- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) ++ if (!worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) { - this.func_175905_a(worldIn, blockpos1, Blocks.leaves, BlockPlanks.EnumType.SPRUCE.getMetadata()); + this.func_175903_a(worldIn, blockpos, field_181637_b); } -++++ END PATCH -++++ REJECTED PATCH 4 +@@ -114,9 +116,10 @@ - for (j1 = 0; j1 < i - 1; ++j1) + for (int i3 = 0; i3 < i - 1; ++i3) { -- Block block1 = worldIn.getBlockState(p_180709_3_.up(j1)).getBlock(); -+ BlockPos upN = p_180709_3_.up(j1); +- Block block1 = worldIn.getBlockState(p_180709_3_.up(i3)).getBlock(); ++ BlockPos upN = p_180709_3_.up(i3); + Block block1 = worldIn.getBlockState(upN).getBlock(); - if (block1.getMaterial() == Material.air || block1.getMaterial() == Material.leaves) + if (block1.isAir(worldIn, upN) || block1.isLeaves(worldIn, upN)) { - this.func_175905_a(worldIn, p_180709_3_.up(j1), Blocks.log, BlockPlanks.EnumType.SPRUCE.getMetadata()); + this.func_175903_a(worldIn, p_180709_3_.up(i3), field_181636_a); } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch.rej b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch similarity index 56% rename from rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch.rej rename to patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch index 677e44789..2f98ff9d8 100644 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch.rej +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch @@ -1,18 +1,15 @@ -++++ REJECTED PATCH 1 - { - if (i1 >= 0 && i1 < 256) +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java +@@ -56,7 +56,7 @@ { -- Block block = worldIn.getBlockState(new BlockPos(j1, i1, k1)).getBlock(); -+ BlockPos off = new BlockPos(j1, i1, k1); -+ Block block = worldIn.getBlockState(off).getBlock(); + Block block = worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, i1, l1)).getBlock(); - if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) -+ if (!block.isAir(worldIn, off) && !block.isLeaves(worldIn, off)) ++ if (block.isAir(worldIn, blockpos$mutableblockpos) && !block.isLeaves(worldIn, blockpos$mutableblockpos)) { flag = false; } -++++ END PATCH -++++ REJECTED PATCH 2 +@@ -75,11 +75,13 @@ } else { @@ -26,31 +23,28 @@ { - this.func_175921_a(worldIn, p_180709_3_.down()); + block1.onPlantGrow(worldIn, down, p_180709_3_); - i3 = p_180709_2_.nextInt(2); - j1 = 1; - byte b0 = 0; -++++ END PATCH -++++ REJECTED PATCH 3 + int i3 = p_180709_2_.nextInt(2); + int j3 = 1; + int k3 = 0; +@@ -100,7 +102,7 @@ { - BlockPos blockpos1 = new BlockPos(i2, l1, k2); + BlockPos blockpos = new BlockPos(i2, j4, k2); -- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) -+ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) +- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) ++ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) { - this.func_175905_a(worldIn, blockpos1, Blocks.leaves, BlockPlanks.EnumType.SPRUCE.getMetadata()); + this.func_175903_a(worldIn, blockpos, field_181646_b); } -++++ END PATCH -++++ REJECTED PATCH 4 +@@ -129,9 +131,10 @@ - for (l1 = 0; l1 < i - j3; ++l1) + for (int k4 = 0; k4 < i - i4; ++k4) { -- Block block2 = worldIn.getBlockState(p_180709_3_.up(l1)).getBlock(); -+ BlockPos upN = p_180709_3_.up(l1); +- Block block2 = worldIn.getBlockState(p_180709_3_.up(k4)).getBlock(); ++ BlockPos upN = p_180709_3_.up(k4); + Block block2 = worldIn.getBlockState(upN).getBlock(); - if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves) + if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN)) { - this.func_175905_a(worldIn, p_180709_3_.up(l1), Blocks.log, BlockPlanks.EnumType.SPRUCE.getMetadata()); + this.func_175903_a(worldIn, p_180709_3_.up(k4), field_181645_a); } -++++ END PATCH diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch index 794ac79cd..bcb74f72a 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch @@ -1,11 +1,94 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java -@@ -114,7 +114,7 @@ +@@ -69,7 +69,7 @@ + { + if (j >= 0 && j < 256) + { +- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(l, j, i1)).getBlock())) ++ if (!this.isReplaceable(worldIn,blockpos$mutableblockpos.func_181079_c(l, j, i1))) + { + flag = false; + } +@@ -88,11 +88,13 @@ + } + else + { +- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); ++ BlockPos down = p_180709_3_.down(); ++ Block block1 = worldIn.getBlockState(down).getBlock(); ++ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); + +- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && p_180709_3_.getY() < 256 - i - 1) ++ if (isSoil && p_180709_3_.getY() < 256 - i - 1) + { +- this.func_175921_a(worldIn, p_180709_3_.down()); ++ block1.onPlantGrow(worldIn, down, p_180709_3_); + int k2 = 3; + int l2 = 0; + +@@ -114,7 +116,7 @@ BlockPos blockpos = new BlockPos(k1, i3, i2); Block block = worldIn.getBlockState(blockpos).getBlock(); - if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves || block.getMaterial() == Material.vine) -+ if (block.isAir(worldIn, blockpos1) || block.isLeaves(worldIn, blockpos1) || block.getMaterial() == Material.vine) ++ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos) || block.getMaterial() == Material.vine) { this.func_175903_a(worldIn, blockpos, this.metaLeaves); } +@@ -125,9 +127,10 @@ + + for (int j3 = 0; j3 < i; ++j3) + { +- Block block2 = worldIn.getBlockState(p_180709_3_.up(j3)).getBlock(); ++ BlockPos upN = p_180709_3_.up(j3); ++ Block block2 = worldIn.getBlockState(upN).getBlock(); + +- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves || block2.getMaterial() == Material.vine) ++ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN) || block2.getMaterial() == Material.vine) + { + this.func_175903_a(worldIn, p_180709_3_.up(j3), this.metaWood); + +@@ -170,29 +173,29 @@ + { + blockpos$mutableblockpos1.func_181079_c(l4, k3, i5); + +- if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().getMaterial() == Material.leaves) ++ if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().isLeaves(worldIn,blockpos$mutableblockpos1)) + { + BlockPos blockpos2 = blockpos$mutableblockpos1.west(); + BlockPos blockpos3 = blockpos$mutableblockpos1.east(); + BlockPos blockpos4 = blockpos$mutableblockpos1.north(); + BlockPos blockpos1 = blockpos$mutableblockpos1.south(); + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().isAir(worldIn,blockpos2)) + { + this.func_181650_b(worldIn, blockpos2, BlockVine.EAST); + } + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().isAir(worldIn,blockpos3)) + { + this.func_181650_b(worldIn, blockpos3, BlockVine.WEST); + } + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().isAir(worldIn,blockpos4)) + { + this.func_181650_b(worldIn, blockpos4, BlockVine.SOUTH); + } + +- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air) ++ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().isAir(worldIn,blockpos1)) + { + this.func_181650_b(worldIn, blockpos1, BlockVine.NORTH); + } +@@ -246,7 +249,7 @@ + this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); + int i = 4; + +- for (p_181650_2_ = p_181650_2_.down(); p_181650_1_.getBlockState(p_181650_2_).getBlock().getMaterial() == Material.air && i > 0; --i) ++ for (p_181650_2_ = p_181650_2_.down(); p_181650_1_.getBlockState(p_181650_2_).getBlock().isAir(p_181650_1_,p_181650_2_) && i > 0; --i) + { + this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); + p_181650_2_ = p_181650_2_.down(); diff --git a/rejects/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch.rej b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch similarity index 65% rename from rejects/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch.rej rename to patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch index 35b8bd6db..f29f9f475 100644 --- a/rejects/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch.rej +++ b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch @@ -1,7 +1,9 @@ -++++ REJECTED PATCH 1 - { - BiomeGenBase biomegenbase = abiomegenbase[j]; +--- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java +@@ -29,11 +29,18 @@ + for (BiomeGenBase biomegenbase : BiomeGenBase.getBiomeGenArray()) + { - if (biomegenbase != null && biomegenbase.minHeight > 0.0F) + if (biomegenbase != null && biomegenbase.minHeight > 0.0F && !net.minecraftforge.common.BiomeManager.strongHoldBiomesBlackList.contains(biomegenbase)) { @@ -17,5 +19,4 @@ + } } - public MapGenStronghold(Map p_i2068_1_) -++++ END PATCH + public MapGenStronghold(Map p_i2068_1_) diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch index 56202de91..93dc9905c 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch @@ -18,3 +18,11 @@ } this.func_175804_a(worldIn, p_74875_3_, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); +@@ -963,6 +963,7 @@ + abstract static class Piece extends StructureComponent + { + protected static final List field_111019_a = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.diamond, 0, 1, 3, 5), new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 5), new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 15), new WeightedRandomChestContent(Items.golden_sword, 0, 1, 1, 5), new WeightedRandomChestContent(Items.golden_chestplate, 0, 1, 1, 5), new WeightedRandomChestContent(Items.flint_and_steel, 0, 1, 1, 5), new WeightedRandomChestContent(Items.nether_wart, 0, 3, 7, 5), new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 10), new WeightedRandomChestContent(Items.golden_horse_armor, 0, 1, 1, 8), new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 5), new WeightedRandomChestContent(Items.diamond_horse_armor, 0, 1, 1, 3), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.obsidian), 0, 2, 4, 2)}); ++ static { net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, field_111019_a, 2, 5); } + private static final String __OBFID = "CL_00000466"; + + public Piece() diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch.rej deleted file mode 100644 index 9f4017dba..000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch.rej +++ /dev/null @@ -1,38 +0,0 @@ -++++ REJECTED PATCH 1 - { - if (k >= 0 && k < 256) - { -- Block block = worldIn.getBlockState(new BlockPos(l, k, i1)).getBlock(); -+ BlockPos pos = new BlockPos(l, k, i1); -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(pos); - -- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) -+ if (!state.getBlock().isAir(worldIn, pos) && !state.getBlock().isLeaves(worldIn, pos)) - { - flag = false; - } -++++ END PATCH -++++ REJECTED PATCH 2 - { - BlockPos blockpos1 = new BlockPos(i2, l, j1); - -- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) -+ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) - { - this.func_175905_a(worldIn, blockpos1, Block.getBlockById(Block.getIdFromBlock(Blocks.brown_mushroom_block) + i), k1); - } -++++ END PATCH -++++ REJECTED PATCH 3 - - for (l = 0; l < j; ++l) - { -- Block block2 = worldIn.getBlockState(p_180709_3_.up(l)).getBlock(); -+ BlockPos upN = p_180709_3_.up(l); -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(upN); - -- if (!block2.isFullBlock()) -+ if (state.getBlock().canBeReplacedByLeaves(worldIn, upN)) - { - this.func_175905_a(worldIn, p_180709_3_.up(l), Block.getBlockById(Block.getIdFromBlock(Blocks.brown_mushroom_block) + i), 10); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch.rej deleted file mode 100644 index 442445d1e..000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch.rej +++ /dev/null @@ -1,23 +0,0 @@ -++++ REJECTED PATCH 1 - if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_180712_2_ * p_180712_2_)) - { - BlockPos blockpos1 = p_180712_1_.add(j, 0, k); -- Material material = this.world.getBlockState(blockpos1).getBlock().getMaterial(); -+ net.minecraft.block.state.IBlockState state = this.world.getBlockState(blockpos1); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(this.world, blockpos1) || state.getBlock().isLeaves(this.world, blockpos1)) - { - this.func_175905_a(this.world, blockpos1, p_180712_3_, 0); - } -++++ END PATCH -++++ REJECTED PATCH 2 - { - BlockPos blockpos3 = p_175936_1_.add((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2)); - -- if (!this.func_150523_a(this.world.getBlockState(blockpos3).getBlock())) -+ if (!this.isReplaceable(world, blockpos3)) - { - return j; - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch.rej deleted file mode 100644 index d0aa9d329..000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch.rej +++ /dev/null @@ -1,69 +0,0 @@ -++++ REJECTED PATCH 1 - { - if (j >= 0 && j < 256) - { -- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(k, j, l)).getBlock())) -+ if (!this.isReplaceable(worldIn, new BlockPos(k, j, l))) - { - flag = false; - } -++++ END PATCH -++++ REJECTED PATCH 2 - } - else - { -- Block block = worldIn.getBlockState(p_180709_3_.down()).getBlock(); -+ BlockPos down = p_180709_3_.down(); -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(down); -+ boolean isSoil = state.getBlock().canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - -- if ((block == Blocks.grass || block == Blocks.dirt) && p_180709_3_.getY() < 256 - i - 1) -+ if (isSoil && p_180709_3_.getY() < 256 - i - 1) - { -- this.func_175921_a(worldIn, p_180709_3_.down()); -- this.func_175921_a(worldIn, p_180709_3_.add(1, -1, 0)); -- this.func_175921_a(worldIn, p_180709_3_.add(1, -1, 1)); -- this.func_175921_a(worldIn, p_180709_3_.add(0, -1, 1)); -+ this.onPlantGrow(worldIn, p_180709_3_.down(), p_180709_3_); -+ this.onPlantGrow(worldIn, p_180709_3_.add(1, -1, 0), p_180709_3_); -+ this.onPlantGrow(worldIn, p_180709_3_.add(1, -1, 1), p_180709_3_); -+ this.onPlantGrow(worldIn, p_180709_3_.add(0, -1, 1), p_180709_3_); - EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(p_180709_2_); - k = i - p_180709_2_.nextInt(4); - l = 2 - p_180709_2_.nextInt(3); -++++ END PATCH -++++ REJECTED PATCH 3 - } - - BlockPos blockpos1 = new BlockPos(i1, i2, j1); -- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); -+ state = worldIn.getBlockState(blockpos1); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(worldIn, blockpos1) || state.getBlock().isLeaves(worldIn, blockpos1)) - { - this.func_175905_a(worldIn, blockpos1, Blocks.log2, BlockPlanks.EnumType.DARK_OAK.getMetadata() - 4); - this.func_175905_a(worldIn, blockpos1.east(), Blocks.log2, BlockPlanks.EnumType.DARK_OAK.getMetadata() - 4); -++++ END PATCH -++++ REJECTED PATCH 4 - - private void func_150526_a(World worldIn, int p_150526_2_, int p_150526_3_, int p_150526_4_) - { -- Block block = worldIn.getBlockState(new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_)).getBlock(); -+ BlockPos pos = new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_); -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(pos); - -- if (block.getMaterial() == Material.air) -+ if (state.getBlock().isAir(worldIn, pos)) - { - this.func_175905_a(worldIn, new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_), Blocks.leaves2, 1); - } - } -+ -+ //Just a helper macro -+ private void onPlantGrow(World world, BlockPos pos, BlockPos source) -+ { -+ world.getBlockState(pos).getBlock().onPlantGrow(world, pos, source); -+ } - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch.rej deleted file mode 100644 index a00224614..000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch.rej +++ /dev/null @@ -1,42 +0,0 @@ -++++ REJECTED PATCH 1 - { - if (j >= 0 && j < 256) - { -- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(k, j, l)).getBlock())) -+ if (!this.isReplaceable(worldIn, new BlockPos(k, j, l))) - { - flag = false; - } -++++ END PATCH -++++ REJECTED PATCH 2 - } - else - { -- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); -+ BlockPos down = p_180709_3_.down(); -+ Block block1 = worldIn.getBlockState(down).getBlock(); -+ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - -- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && p_180709_3_.getY() < 256 - i - 1) -+ if (isSoil && p_180709_3_.getY() < 256 - i - 1) - { -- this.func_175921_a(worldIn, p_180709_3_.down()); -+ block1.onPlantGrow(worldIn, down, p_180709_3_); - int i2; - - for (i2 = p_180709_3_.getY() - 3 + i; i2 <= p_180709_3_.getY() + i; ++i2) -++++ END PATCH -++++ REJECTED PATCH 4 - - for (i2 = 0; i2 < i; ++i2) - { -- Block block2 = worldIn.getBlockState(p_180709_3_.up(i2)).getBlock(); -+ BlockPos upN = p_180709_3_.up(i2); -+ Block block2 = worldIn.getBlockState(upN).getBlock(); - -- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves) -+ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN)) - { - this.func_175905_a(worldIn, p_180709_3_.up(i2), Blocks.log, BlockPlanks.EnumType.BIRCH.getMetadata()); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch.rej deleted file mode 100644 index 967d42121..000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch.rej +++ /dev/null @@ -1,57 +0,0 @@ -++++ REJECTED PATCH 1 - { - for (int l = -b0; l <= b0 && flag; ++l) - { -- if (p_175926_2_.getY() + j < 0 || p_175926_2_.getY() + j >= 256 || !this.func_150523_a(worldIn.getBlockState(p_175926_2_.add(k, j, l)).getBlock())) -+ if (p_175926_2_.getY() + j < 0 || p_175926_2_.getY() + j >= 256 || !this.isReplaceable(worldIn, p_175926_2_.add(k, j, l))) - { - flag = false; - } -++++ END PATCH -++++ REJECTED PATCH 2 - { - BlockPos blockpos1 = p_175927_1_.down(); - Block block = worldIn.getBlockState(blockpos1).getBlock(); -+ boolean isSoil = block.canSustainPlant(worldIn, blockpos1, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - -- if ((block == Blocks.grass || block == Blocks.dirt) && p_175927_1_.getY() >= 2) -+ if (isSoil && p_175927_1_.getY() >= 2) - { -- this.func_175921_a(worldIn, blockpos1); -- this.func_175921_a(worldIn, blockpos1.east()); -- this.func_175921_a(worldIn, blockpos1.south()); -- this.func_175921_a(worldIn, blockpos1.south().east()); -+ this.onPlantGrow(worldIn, blockpos1, p_175927_1_); -+ this.onPlantGrow(worldIn, blockpos1.east(), p_175927_1_); -+ this.onPlantGrow(worldIn, blockpos1.south(), p_175927_1_); -+ this.onPlantGrow(worldIn, blockpos1.south().east(), p_175927_1_); - return true; - } - else -++++ END PATCH -++++ REJECTED PATCH 3 - if (k * k + l * l <= j || i1 * i1 + j1 * j1 <= j || k * k + j1 * j1 <= j || i1 * i1 + l * l <= j) - { - BlockPos blockpos1 = p_175925_2_.add(k, 0, l); -- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos1); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(worldIn, blockpos1) || state.getBlock().isLeaves(worldIn, blockpos1)) - { - this.func_175905_a(worldIn, blockpos1, Blocks.leaves, this.leavesMetadata); - } -++++ END PATCH -++++ REJECTED PATCH 4 - if (k * k + l * l <= j) - { - BlockPos blockpos1 = p_175928_2_.add(k, 0, l); -- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); -+ Block block = worldIn.getBlockState(blockpos1).getBlock(); - -- if (material == Material.air || material == Material.leaves) -+ if (block.isAir(worldIn, blockpos1) || block.isLeaves(worldIn, blockpos1)) - { - this.func_175905_a(worldIn, blockpos1, Blocks.leaves, this.leavesMetadata); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch.rej deleted file mode 100644 index 9b9e63413..000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch.rej +++ /dev/null @@ -1,53 +0,0 @@ -++++ REJECTED PATCH 1 - { - BlockPos blockpos1 = p_180709_3_.up(i2); - -- if (this.func_175931_a(worldIn.getBlockState(blockpos1).getBlock().getMaterial())) -+ if (this.isAirLeaves(worldIn, blockpos1)) - { - this.func_175905_a(worldIn, blockpos1, Blocks.log, this.woodMetadata); - -++++ END PATCH -++++ REJECTED PATCH 2 - { - BlockPos blockpos2 = blockpos1.east(); - -- if (this.func_175931_a(worldIn.getBlockState(blockpos2).getBlock().getMaterial())) -+ if (this.isAirLeaves(worldIn, blockpos2)) - { - this.func_175905_a(worldIn, blockpos2, Blocks.log, this.woodMetadata); - -++++ END PATCH -++++ REJECTED PATCH 3 - - BlockPos blockpos3 = blockpos1.south().east(); - -- if (this.func_175931_a(worldIn.getBlockState(blockpos3).getBlock().getMaterial())) -+ if (this.isAirLeaves(worldIn, blockpos3)) - { - this.func_175905_a(worldIn, blockpos3, Blocks.log, this.woodMetadata); - -++++ END PATCH -++++ REJECTED PATCH 4 - - BlockPos blockpos4 = blockpos1.south(); - -- if (this.func_175931_a(worldIn.getBlockState(blockpos4).getBlock().getMaterial())) -+ if (this.isAirLeaves(worldIn, blockpos4)) - { - this.func_175905_a(worldIn, blockpos4, Blocks.log, this.woodMetadata); - -++++ END PATCH -++++ REJECTED PATCH 5 - } - } - -- private boolean func_175931_a(Material p_175931_1_) -- { -- return p_175931_1_ == Material.air || p_175931_1_ == Material.leaves; -- } -- - private void func_175932_b(World worldIn, Random p_175932_2_, BlockPos p_175932_3_, int p_175932_4_) - { - if (p_175932_2_.nextInt(3) > 0 && worldIn.isAirBlock(p_175932_3_)) -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch.rej deleted file mode 100644 index a059962cc..000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 1 - { - BlockPos blockpos1 = new BlockPos(l1, i2, j2); - -- if (this.field_175919_c.apply(worldIn.getBlockState(blockpos1))) -+ if (worldIn.getBlockState(blockpos1).getBlock().isReplaceableOreGen(worldIn, blockpos1, this.field_175919_c)) - { - worldIn.setBlockState(blockpos1, this.oreBlock, 2); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch.rej deleted file mode 100644 index bdaa224b7..000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch.rej +++ /dev/null @@ -1,36 +0,0 @@ -++++ REJECTED PATCH 1 - { - if (j >= 0 && j < 256) - { -- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(k, j, l)).getBlock())) -+ if (!this.isReplaceable(worldIn, new BlockPos(k, j, l))) - { - flag = false; - } -++++ END PATCH -++++ REJECTED PATCH 3 - } - - BlockPos blockpos1 = new BlockPos(i1, i2, j1); -- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); -+ block = worldIn.getBlockState(blockpos1).getBlock(); - -- if (material == Material.air || material == Material.leaves) -+ if (block.isAir(worldIn, blockpos1) || block.isLeaves(worldIn, blockpos1)) - { - this.func_175905_a(worldIn, blockpos1, Blocks.log2, BlockPlanks.EnumType.ACACIA.getMetadata() - 4); - k1 = i2; -++++ END PATCH -++++ REJECTED PATCH 4 - i1 += enumfacing1.getFrontOffsetX(); - j1 += enumfacing1.getFrontOffsetZ(); - BlockPos blockpos2 = new BlockPos(i1, j2, j1); -- Material material1 = worldIn.getBlockState(blockpos2).getBlock().getMaterial(); -+ block = worldIn.getBlockState(blockpos2).getBlock(); - -- if (material1 == Material.air || material1 == Material.leaves) -+ if (block.isAir(worldIn, blockpos2) || block.isLeaves(worldIn, blockpos2)) - { - this.func_175905_a(worldIn, blockpos2, Blocks.log2, BlockPlanks.EnumType.ACACIA.getMetadata() - 4); - k1 = j2; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch.rej deleted file mode 100644 index dc7aec5a2..000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch.rej +++ /dev/null @@ -1,10 +0,0 @@ -++++ REJECTED PATCH 2 - { - BlockPos blockpos1 = new BlockPos(l, i, j1); - -- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) -+ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) - { - this.func_175905_a(worldIn, blockpos1, Blocks.leaves, this.field_150528_a); - } -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch.rej deleted file mode 100644 index 6cd81a581..000000000 --- a/rejects/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch.rej +++ /dev/null @@ -1,88 +0,0 @@ -++++ REJECTED PATCH 1 - { - if (j >= 0 && j < 256) - { -- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(k, j, l)).getBlock())) -+ if (!this.isReplaceable(worldIn, new BlockPos(k, j, l))) - { - flag = false; - } -++++ END PATCH -++++ REJECTED PATCH 2 - } - else - { -- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); -+ BlockPos down = p_180709_3_.down(); -+ Block block1 = worldIn.getBlockState(down).getBlock(); -+ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); - -- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && p_180709_3_.getY() < 256 - i - 1) -+ if (isSoil && p_180709_3_.getY() < 256 - i - 1) - { -- this.func_175921_a(worldIn, p_180709_3_.down()); -+ block1.onPlantGrow(worldIn, down, p_180709_3_); - b0 = 3; - byte b1 = 0; - int i1; -++++ END PATCH -++++ REJECTED PATCH 4 - - for (l = 0; l < i; ++l) - { -- Block block2 = worldIn.getBlockState(p_180709_3_.up(l)).getBlock(); -+ BlockPos upN = p_180709_3_.up(l); -+ Block block2 = worldIn.getBlockState(upN).getBlock(); - -- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves || block2.getMaterial() == Material.vine) -+ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN) || block2.getMaterial() == Material.vine) - { - this.func_175905_a(worldIn, p_180709_3_.up(l), Blocks.log, this.metaWood); - -++++ END PATCH -++++ REJECTED PATCH 5 - { - BlockPos blockpos3 = new BlockPos(k1, l, l1); - -- if (worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.leaves) -+ if (worldIn.getBlockState(blockpos3).getBlock().isLeaves(worldIn, blockpos3)) - { - BlockPos blockpos4 = blockpos3.west(); - blockpos1 = blockpos3.east(); - BlockPos blockpos5 = blockpos3.north(); - BlockPos blockpos2 = blockpos3.south(); - -- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().isAir(worldIn, blockpos4)) - { - this.func_175923_a(worldIn, blockpos4, BlockVine.EAST_FLAG); - } - -- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().isAir(worldIn, blockpos1)) - { - this.func_175923_a(worldIn, blockpos1, BlockVine.WEST_FLAG); - } - -- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos5).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos5).getBlock().isAir(worldIn, blockpos5)) - { - this.func_175923_a(worldIn, blockpos5, BlockVine.SOUTH_FLAG); - } - -- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().isAir(worldIn, blockpos2)) - { - this.func_175923_a(worldIn, blockpos2, BlockVine.NORTH_FLAG); - } -++++ END PATCH -++++ REJECTED PATCH 6 - this.func_175905_a(worldIn, p_175923_2_, Blocks.vine, p_175923_3_); - int j = 4; - -- for (p_175923_2_ = p_175923_2_.down(); worldIn.getBlockState(p_175923_2_).getBlock().getMaterial() == Material.air && j > 0; --j) -+ for (p_175923_2_ = p_175923_2_.down(); worldIn.getBlockState(p_175923_2_).getBlock().isAir(worldIn, p_175923_2_) && j > 0; --j) - { - this.func_175905_a(worldIn, p_175923_2_, Blocks.vine, p_175923_3_); - p_175923_2_ = p_175923_2_.down(); -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch.rej b/rejects/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch.rej deleted file mode 100644 index 8cb954dc5..000000000 --- a/rejects/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch.rej +++ /dev/null @@ -1,9 +0,0 @@ -++++ REJECTED PATCH 3 - abstract static class Piece extends StructureComponent - { - protected static final List field_111019_a = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.diamond, 0, 1, 3, 5), new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 5), new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 15), new WeightedRandomChestContent(Items.golden_sword, 0, 1, 1, 5), new WeightedRandomChestContent(Items.golden_chestplate, 0, 1, 1, 5), new WeightedRandomChestContent(Items.flint_and_steel, 0, 1, 1, 5), new WeightedRandomChestContent(Items.nether_wart, 0, 3, 7, 5), new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 10), new WeightedRandomChestContent(Items.golden_horse_armor, 0, 1, 1, 8), new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 5), new WeightedRandomChestContent(Items.diamond_horse_armor, 0, 1, 1, 3), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.obsidian), 0, 2, 4, 2)}); -+ static { net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, field_111019_a, 2, 5); } - private static final String __OBFID = "CL_00000466"; - - public Piece() {} -++++ END PATCH diff --git a/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java b/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java index 978b753b1..cf0dbd7d4 100644 --- a/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java +++ b/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java @@ -330,7 +330,7 @@ public class FMLClientHandler implements IFMLSidedHandler // Reload resources client.refreshResources(); - RenderingRegistry.loadEntityRenderers((Map, Render>)Minecraft.getMinecraft().getRenderManager().entityRenderMap); + RenderingRegistry.loadEntityRenderers(Minecraft.getMinecraft().getRenderManager().entityRenderMap); guiFactories = HashBiMap.create(); for (ModContainer mc : Loader.instance().getActiveModList()) { @@ -825,7 +825,7 @@ public class FMLClientHandler implements IFMLSidedHandler { setupServerList(); OldServerPinger osp = new OldServerPinger(); - ServerData serverData = new ServerData("Command Line", host+":"+port); + ServerData serverData = new ServerData("Command Line", host+":"+port,false); try { osp.ping(serverData); diff --git a/src/main/java/net/minecraftforge/fml/client/registry/RenderingRegistry.java b/src/main/java/net/minecraftforge/fml/client/registry/RenderingRegistry.java index 607d7362f..d8c3071e2 100644 --- a/src/main/java/net/minecraftforge/fml/client/registry/RenderingRegistry.java +++ b/src/main/java/net/minecraftforge/fml/client/registry/RenderingRegistry.java @@ -36,27 +36,27 @@ public class RenderingRegistry * @param entityClass * @param renderer */ - public static void registerEntityRenderingHandler(Class entityClass, Render renderer) + public static void registerEntityRenderingHandler(Class entityClass, Render renderer) { INSTANCE.entityRenderers.add(new EntityRendererInfo(entityClass, renderer)); } private static class EntityRendererInfo { - public EntityRendererInfo(Class target, Render renderer) + public EntityRendererInfo(Class target, Render renderer) { this.target = target; this.renderer = renderer; } private Class target; - private Render renderer; + private Render renderer; } - public static void loadEntityRenderers(Map, Render> rendererMap) + public static void loadEntityRenderers(Map, Render> entityRenderMap) { for (EntityRendererInfo info : INSTANCE.entityRenderers) { - rendererMap.put(info.target, info.renderer); + entityRenderMap.put(info.target, info.renderer); } } } From a26c4017b17f86588ac566e7371b2f1a81ffce57 Mon Sep 17 00:00:00 2001 From: cpw Date: Fri, 13 Nov 2015 00:09:34 -0500 Subject: [PATCH 029/133] Fix a newly missing AT. Remove all CL_ references. OBFID is gone. --- .../net/minecraft/block/Block.java.patch | 26 ++-- .../net/minecraft/block/BlockBush.java.patch | 10 +- .../minecraft/block/BlockButton.java.patch | 2 +- .../minecraft/block/BlockCactus.java.patch | 6 +- .../net/minecraft/block/BlockChest.java.patch | 2 +- .../net/minecraft/block/BlockCocoa.java.patch | 4 +- .../net/minecraft/block/BlockCrops.java.patch | 8 +- .../minecraft/block/BlockDeadBush.java.patch | 6 +- .../net/minecraft/block/BlockDoor.java.patch | 4 +- .../block/BlockDoublePlant.java.patch | 10 +- .../minecraft/block/BlockFalling.java.patch | 2 +- .../minecraft/block/BlockFarmland.java.patch | 2 +- .../net/minecraft/block/BlockFire.java.patch | 30 ++--- .../minecraft/block/BlockFlowerPot.java.patch | 4 +- .../net/minecraft/block/BlockGrass.java.patch | 6 +- .../block/BlockHugeMushroom.java.patch | 2 +- .../net/minecraft/block/BlockIce.java.patch | 4 +- .../minecraft/block/BlockLadder.java.patch | 6 +- .../minecraft/block/BlockLeaves.java.patch | 8 +- .../net/minecraft/block/BlockLever.java.patch | 2 +- .../net/minecraft/block/BlockLog.java.patch | 4 +- .../block/BlockMobSpawner.java.patch | 2 +- .../minecraft/block/BlockMushroom.java.patch | 2 +- .../minecraft/block/BlockMycelium.java.patch | 4 +- .../block/BlockNetherWart.java.patch | 6 +- .../minecraft/block/BlockNewLeaf.java.patch | 2 +- .../net/minecraft/block/BlockNote.java.patch | 4 +- .../minecraft/block/BlockOldLeaf.java.patch | 2 +- .../net/minecraft/block/BlockOre.java.patch | 2 +- .../net/minecraft/block/BlockPane.java.patch | 6 +- .../block/BlockPistonBase.java.patch | 6 +- .../block/BlockPistonMoving.java.patch | 4 +- .../minecraft/block/BlockPotato.java.patch | 2 +- .../minecraft/block/BlockPumpkin.java.patch | 2 +- .../minecraft/block/BlockQuartz.java.patch | 2 +- .../minecraft/block/BlockRailBase.java.patch | 18 +-- .../block/BlockRedstoneComparator.java.patch | 2 +- .../block/BlockRedstoneDiode.java.patch | 2 +- .../block/BlockRedstoneOre.java.patch | 2 +- .../block/BlockRedstoneWire.java.patch | 4 +- .../net/minecraft/block/BlockReed.java.patch | 6 +- .../block/BlockRotatedPillar.java.patch | 2 +- .../minecraft/block/BlockSapling.java.patch | 2 +- .../net/minecraft/block/BlockSkull.java.patch | 8 +- .../net/minecraft/block/BlockSnow.java.patch | 10 +- .../net/minecraft/block/BlockStem.java.patch | 6 +- .../minecraft/block/BlockTallGrass.java.patch | 10 +- .../net/minecraft/block/BlockTorch.java.patch | 8 +- .../minecraft/block/BlockTrapDoor.java.patch | 6 +- .../block/BlockTripWireHook.java.patch | 4 +- .../net/minecraft/block/BlockVine.java.patch | 4 +- .../BlockPistonStructureHelper.java.patch | 6 +- .../block/state/BlockState.java.patch | 8 +- .../block/state/BlockStateBase.java.patch | 2 +- .../client/ClientBrandRetriever.java.patch | 4 +- .../client/LoadingScreenRenderer.java.patch | 4 +- .../net/minecraft/client/Minecraft.java.patch | 48 ++++---- .../client/audio/SoundManager.java.patch | 8 +- .../entity/AbstractClientPlayer.java.patch | 2 +- .../client/entity/EntityPlayerSP.java.patch | 6 +- .../client/gui/FontRenderer.java.patch | 28 ++--- .../minecraft/client/gui/GuiButton.java.patch | 6 +- .../minecraft/client/gui/GuiChat.java.patch | 4 +- .../client/gui/GuiCreateWorld.java.patch | 6 +- .../client/gui/GuiIngameMenu.java.patch | 4 +- .../client/gui/GuiMainMenu.java.patch | 6 +- .../client/gui/GuiMultiplayer.java.patch | 4 +- .../client/gui/GuiOverlayDebug.java.patch | 2 +- .../minecraft/client/gui/GuiScreen.java.patch | 18 +-- .../client/gui/GuiSelectWorld.java.patch | 2 +- .../client/gui/GuiSleepMP.java.patch | 2 +- .../minecraft/client/gui/GuiSlot.java.patch | 4 +- .../gui/ServerListEntryNormal.java.patch | 4 +- .../achievement/GuiAchievements.java.patch | 22 ++-- .../gui/achievement/GuiStats.java.patch | 4 +- .../gui/inventory/GuiContainer.java.patch | 8 +- .../inventory/GuiContainerCreative.java.patch | 36 +++--- .../client/model/ModelBox.java.patch | 2 +- .../client/model/ModelRenderer.java.patch | 8 +- .../ChunkProviderClient.java.patch | 2 +- .../multiplayer/GuiConnecting.java.patch | 2 +- .../multiplayer/PlayerControllerMP.java.patch | 10 +- .../client/multiplayer/WorldClient.java.patch | 2 +- .../NetHandlerHandshakeMemory.java.patch | 2 +- .../network/NetHandlerLoginClient.java.patch | 2 +- .../network/NetHandlerPlayClient.java.patch | 10 +- .../client/network/OldServerPinger.java.patch | 2 +- .../client/particle/EffectRenderer.java.patch | 6 +- .../renderer/BlockModelRenderer.java.patch | 2 +- .../renderer/BlockModelShapes.java.patch | 2 +- .../BlockRendererDispatcher.java.patch | 6 +- .../client/renderer/EntityRenderer.java.patch | 28 ++--- .../InventoryEffectRenderer.java.patch | 2 +- .../renderer/ItemModelMesher.java.patch | 2 +- .../client/renderer/ItemRenderer.java.patch | 10 +- .../client/renderer/OpenGlHelper.java.patch | 6 +- .../client/renderer/RenderGlobal.java.patch | 24 ++-- .../client/renderer/WorldRenderer.java.patch | 2 +- .../WorldVertexBufferUploader.java.patch | 4 +- .../block/model/FaceBakery.java.patch | 8 +- .../model/ModelBlockDefinition.java.patch | 4 +- .../block/statemap/StateMap.java.patch | 2 +- .../renderer/chunk/RenderChunk.java.patch | 10 +- .../entity/RenderEntityItem.java.patch | 4 +- .../renderer/entity/RenderItem.java.patch | 16 +-- .../renderer/entity/RenderManager.java.patch | 4 +- .../renderer/entity/RenderPlayer.java.patch | 4 +- .../renderer/entity/RenderVillager.java.patch | 2 +- .../entity/RendererLivingEntity.java.patch | 12 +- .../entity/layers/LayerArmorBase.java.patch | 6 +- .../entity/layers/LayerBipedArmor.java.patch | 2 +- .../renderer/texture/Stitcher.java.patch | 6 +- .../texture/TextureAtlasSprite.java.patch | 2 +- .../texture/TextureManager.java.patch | 2 +- .../renderer/texture/TextureMap.java.patch | 22 ++-- .../renderer/texture/TextureUtil.java.patch | 2 +- .../tileentity/RenderItemFrame.java.patch | 4 +- .../TileEntityItemStackRenderer.java.patch | 2 +- .../vertex/VertexFormatElement.java.patch | 4 +- .../resources/AbstractResourcePack.java.patch | 2 +- .../FallbackResourceManager.java.patch | 2 +- .../resources/LanguageManager.java.patch | 2 +- .../client/resources/Locale.java.patch | 2 +- ...SimpleReloadableResourceManager.java.patch | 6 +- .../resources/model/ModelBakery.java.patch | 16 +-- .../resources/model/ModelManager.java.patch | 2 +- .../resources/model/ModelRotation.java.patch | 2 +- .../client/settings/GameSettings.java.patch | 2 +- .../client/shader/Framebuffer.java.patch | 4 +- .../command/CommandEnchant.java.patch | 2 +- .../minecraft/command/CommandFill.java.patch | 6 +- .../command/CommandHandler.java.patch | 2 +- .../command/server/CommandSetBlock.java.patch | 4 +- .../server/CommandTestForBlock.java.patch | 2 +- .../minecraft/crash/CrashReport.java.patch | 4 +- .../crash/CrashReportCategory.java.patch | 2 +- .../creativetab/CreativeTabs.java.patch | 10 +- .../enchantment/Enchantment.java.patch | 6 +- .../enchantment/EnchantmentHelper.java.patch | 8 +- .../net/minecraft/entity/Entity.java.patch | 22 ++-- .../minecraft/entity/EntityHanging.java.patch | 2 +- .../minecraft/entity/EntityList.java.patch | 10 +- .../minecraft/entity/EntityLiving.java.patch | 6 +- .../entity/EntityLivingBase.java.patch | 38 +++--- .../EntityMinecartCommandBlock.java.patch | 2 +- .../EntitySpawnPlacementRegistry.java.patch | 2 +- .../minecraft/entity/EntityTracker.java.patch | 4 +- .../entity/EntityTrackerEntry.java.patch | 6 +- .../ai/EntityAIAttackOnCollide.java.patch | 14 +-- .../entity/boss/EntityDragon.java.patch | 2 +- .../entity/boss/EntityWither.java.patch | 2 +- .../effect/EntityLightningBolt.java.patch | 2 +- .../entity/item/EntityEnderPearl.java.patch | 4 +- .../entity/item/EntityItem.java.patch | 16 +-- .../entity/item/EntityItemFrame.java.patch | 2 +- .../entity/item/EntityMinecart.java.patch | 32 ++--- .../item/EntityMinecartContainer.java.patch | 2 +- .../item/EntityMinecartEmpty.java.patch | 2 +- .../item/EntityMinecartFurnace.java.patch | 2 +- .../item/EntityMinecartHopper.java.patch | 2 +- .../entity/item/EntityXPOrb.java.patch | 2 +- .../entity/monster/EntityEnderman.java.patch | 4 +- .../entity/monster/EntityMagmaCube.java.patch | 2 +- .../entity/monster/EntitySlime.java.patch | 2 +- .../entity/monster/EntityZombie.java.patch | 8 +- .../entity/passive/EntityHorse.java.patch | 2 +- .../entity/passive/EntityMooshroom.java.patch | 10 +- .../entity/passive/EntityOcelot.java.patch | 2 +- .../entity/passive/EntitySheep.java.patch | 4 +- .../entity/passive/EntityVillager.java.patch | 10 +- .../entity/player/EntityPlayer.java.patch | 72 +++++------ .../entity/player/EntityPlayerMP.java.patch | 18 +-- .../entity/player/InventoryPlayer.java.patch | 2 +- .../projectile/EntityFishHook.java.patch | 2 +- .../net/minecraft/init/Bootstrap.java.patch | 4 +- .../minecraft/inventory/Container.java.patch | 2 +- .../inventory/ContainerBeacon.java.patch | 2 +- .../ContainerBrewingStand.java.patch | 6 +- .../inventory/ContainerEnchantment.java.patch | 10 +- .../inventory/ContainerPlayer.java.patch | 2 +- .../inventory/ContainerRepair.java.patch | 10 +- .../net/minecraft/inventory/Slot.java.patch | 4 +- .../inventory/SlotCrafting.java.patch | 2 +- .../inventory/SlotFurnaceOutput.java.patch | 2 +- .../net/minecraft/item/Item.java.patch | 20 +-- .../net/minecraft/item/ItemArmor.java.patch | 10 +- .../net/minecraft/item/ItemBlock.java.patch | 4 +- .../net/minecraft/item/ItemBow.java.patch | 4 +- .../net/minecraft/item/ItemBucket.java.patch | 2 +- .../minecraft/item/ItemBucketMilk.java.patch | 2 +- .../net/minecraft/item/ItemDye.java.patch | 8 +- .../minecraft/item/ItemEmptyMap.java.patch | 2 +- .../item/ItemFlintAndSteel.java.patch | 2 +- .../net/minecraft/item/ItemHoe.java.patch | 2 +- .../net/minecraft/item/ItemLilyPad.java.patch | 2 +- .../net/minecraft/item/ItemMap.java.patch | 2 +- .../item/ItemMonsterPlacer.java.patch | 14 +-- .../net/minecraft/item/ItemRecord.java.patch | 2 +- .../minecraft/item/ItemSeedFood.java.patch | 4 +- .../net/minecraft/item/ItemSeeds.java.patch | 4 +- .../net/minecraft/item/ItemShears.java.patch | 4 +- .../net/minecraft/item/ItemSkull.java.patch | 6 +- .../net/minecraft/item/ItemSnow.java.patch | 2 +- .../net/minecraft/item/ItemStack.java.patch | 26 ++-- .../net/minecraft/item/ItemSword.java.patch | 2 +- .../net/minecraft/item/ItemTool.java.patch | 6 +- .../item/crafting/FurnaceRecipes.java.patch | 4 +- .../item/crafting/RecipeFireworks.java.patch | 6 +- .../item/crafting/RecipeRepairItem.java.patch | 8 +- .../item/crafting/RecipesArmorDyes.java.patch | 2 +- .../item/crafting/RecipesBanners.java.patch | 4 +- .../crafting/RecipesMapCloning.java.patch | 2 +- .../item/crafting/ShapedRecipes.java.patch | 2 +- .../item/crafting/ShapelessRecipes.java.patch | 2 +- .../nbt/CompressedStreamTools.java.patch | 10 +- .../minecraft/nbt/NBTSizeTracker.java.patch | 2 +- .../minecraft/nbt/NBTTagCompound.java.patch | 4 +- .../net/minecraft/nbt/NBTTagString.java.patch | 2 +- .../network/NetworkManager.java.patch | 12 +- .../network/NetworkSystem.java.patch | 2 +- .../network/ServerStatusResponse.java.patch | 10 +- .../handshake/client/C00Handshake.java.patch | 8 +- .../client/C17PacketCustomPayload.java.patch | 2 +- .../server/S3FPacketCustomPayload.java.patch | 2 +- .../server/S00PacketServerInfo.java.patch | 2 +- .../net/minecraft/potion/Potion.java.patch | 2 +- .../minecraft/potion/PotionEffect.java.patch | 12 +- .../minecraft/realms/RealmsConnect.java.patch | 4 +- .../server/MinecraftServer.java.patch | 40 +++--- .../dedicated/DedicatedServer.java.patch | 10 +- .../server/gui/MinecraftServerGui.java.patch | 4 +- .../integrated/IntegratedServer.java.patch | 8 +- .../management/ItemInWorldManager.java.patch | 20 +-- .../management/PlayerManager.java.patch | 29 +++-- .../ServerConfigurationManager.java.patch | 32 ++--- .../network/NetHandlerHandshakeTCP.java.patch | 2 +- .../network/NetHandlerLoginServer.java.patch | 4 +- .../net/minecraft/stats/StatList.java.patch | 8 +- .../tileentity/TileEntity.java.patch | 12 +- .../tileentity/TileEntityBeacon.java.patch | 4 +- .../TileEntityBrewingStand.java.patch | 12 +- .../tileentity/TileEntityFurnace.java.patch | 8 +- .../tileentity/TileEntityHopper.java.patch | 2 +- .../tileentity/TileEntityNote.java.patch | 2 +- .../tileentity/TileEntityPiston.java.patch | 4 +- .../tileentity/TileEntitySign.java.patch | 2 +- .../net/minecraft/util/EnumFacing.java.patch | 14 +-- .../util/MessageSerializer.java.patch | 11 -- .../net/minecraft/util/MouseHelper.java.patch | 2 +- .../util/MovingObjectPosition.java.patch | 4 +- .../util/ResourceLocation.java.patch | 4 +- .../net/minecraft/util/Session.java.patch | 31 +++-- .../minecraft/util/StringTranslate.java.patch | 4 +- .../net/minecraft/util/Vec3.java.patch | 6 +- .../WeightedRandomChestContent.java.patch | 2 +- .../net/minecraft/world/ChunkCache.java.patch | 12 +- .../net/minecraft/world/Explosion.java.patch | 14 +-- .../net/minecraft/world/World.java.patch | 114 +++++++++--------- .../minecraft/world/WorldProvider.java.patch | 8 +- .../minecraft/world/WorldServer.java.patch | 38 +++--- .../world/WorldServerMulti.java.patch | 11 +- .../net/minecraft/world/WorldType.java.patch | 4 +- .../world/biome/BiomeColorHelper.java.patch | 6 +- .../world/biome/BiomeDecorator.java.patch | 34 +++--- .../world/biome/BiomeGenBase.java.patch | 12 +- .../world/biome/BiomeGenForest.java.patch | 2 +- .../world/biome/BiomeGenHills.java.patch | 2 +- .../world/biome/BiomeGenJungle.java.patch | 2 +- .../world/biome/BiomeGenPlains.java.patch | 2 +- .../world/biome/BiomeGenSwamp.java.patch | 2 +- .../world/biome/WorldChunkManager.java.patch | 6 +- .../world/border/WorldBorder.java.patch | 2 +- .../minecraft/world/chunk/Chunk.java.patch | 38 +++--- .../chunk/storage/AnvilChunkLoader.java.patch | 16 +-- .../chunk/storage/AnvilSaveHandler.java.patch | 2 +- .../storage/ExtendedBlockStorage.java.patch | 2 +- .../world/chunk/storage/RegionFile.java.patch | 2 +- .../world/gen/ChunkProviderServer.java.patch | 14 +-- .../world/gen/MapGenRavine.java.patch | 6 +- .../feature/WorldGenAbstractTree.java.patch | 2 +- .../feature/WorldGenBigMushroom.java.patch | 6 +- .../gen/feature/WorldGenBigTree.java.patch | 8 +- .../gen/feature/WorldGenCanopyTree.java.patch | 10 +- .../gen/feature/WorldGenDeadBush.java.patch | 2 +- .../gen/feature/WorldGenForest.java.patch | 8 +- .../gen/feature/WorldGenHugeTrees.java.patch | 10 +- .../gen/feature/WorldGenMegaJungle.java.patch | 10 +- .../feature/WorldGenMegaPineTree.java.patch | 4 +- .../gen/feature/WorldGenMinable.java.patch | 2 +- .../feature/WorldGenSavannaTree.java.patch | 10 +- .../gen/feature/WorldGenShrub.java.patch | 4 +- .../gen/feature/WorldGenSwamp.java.patch | 12 +- .../gen/feature/WorldGenTaiga1.java.patch | 8 +- .../gen/feature/WorldGenTaiga2.java.patch | 8 +- .../gen/feature/WorldGenTallGrass.java.patch | 2 +- .../gen/feature/WorldGenTrees.java.patch | 12 +- .../WorldGeneratorBonusChest.java.patch | 2 +- .../gen/structure/MapGenStronghold.java.patch | 2 +- .../gen/structure/MapGenStructure.java.patch | 2 +- .../structure/StructureComponent.java.patch | 2 +- .../StructureNetherBridgePieces.java.patch | 8 +- .../gen/structure/StructureStart.java.patch | 4 +- .../world/storage/MapData.java.patch | 6 +- .../world/storage/SaveHandler.java.patch | 16 +-- .../world/storage/WorldInfo.java.patch | 6 +- src/main/resources/forge_at.cfg | 4 + 306 files changed, 1132 insertions(+), 1138 deletions(-) delete mode 100644 patches/minecraft/net/minecraft/util/MessageSerializer.java.patch diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 10500041a..e15a21353 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -12,9 +12,9 @@ private CreativeTabs displayOnCreativeTab; public static final Block.SoundType soundTypeStone = new Block.SoundType("stone", 1.0F, 1.0F); public static final Block.SoundType soundTypeWood = new Block.SoundType("wood", 1.0F, 1.0F); -@@ -124,6 +125,9 @@ +@@ -119,6 +120,9 @@ + private IBlockState defaultBlockState; private String unlocalizedName; - private static final String __OBFID = "CL_00000199"; + public final net.minecraftforge.fml.common.registry.RegistryDelegate delegate = + ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)blockRegistry).getDelegate(this, Block.class); @@ -22,7 +22,7 @@ public static int getIdFromBlock(Block blockIn) { return blockRegistry.getIDForObject(blockIn); -@@ -137,7 +141,8 @@ +@@ -132,7 +136,8 @@ public static Block getBlockById(int id) { @@ -32,7 +32,7 @@ } public static IBlockState getStateById(int id) -@@ -308,7 +313,7 @@ +@@ -303,7 +308,7 @@ public boolean isReplaceable(World worldIn, BlockPos pos) { @@ -41,7 +41,7 @@ } public Block setHardness(float hardness) -@@ -345,9 +350,10 @@ +@@ -340,9 +345,10 @@ return this.needsRandomTick; } @@ -53,7 +53,7 @@ } public final void setBlockBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ) -@@ -364,13 +370,13 @@ +@@ -359,13 +365,13 @@ public int getMixedBrightnessForBlock(IBlockAccess worldIn, BlockPos pos) { Block block = worldIn.getBlockState(pos).getBlock(); @@ -69,7 +69,7 @@ } else { -@@ -458,6 +464,10 @@ +@@ -453,6 +459,10 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { @@ -80,7 +80,7 @@ } public int quantityDropped(Random random) -@@ -472,8 +482,7 @@ +@@ -467,8 +477,7 @@ public float getPlayerRelativeBlockHardness(EntityPlayer playerIn, World worldIn, BlockPos pos) { @@ -90,7 +90,7 @@ } public final void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int forture) -@@ -483,20 +492,16 @@ +@@ -478,20 +487,16 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { @@ -116,7 +116,7 @@ } } } -@@ -504,8 +509,13 @@ +@@ -499,8 +504,13 @@ public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack) { @@ -131,7 +131,7 @@ float f = 0.5F; double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -@@ -692,7 +702,7 @@ +@@ -687,7 +697,7 @@ public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { @@ -140,7 +140,7 @@ } public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) -@@ -804,25 +814,35 @@ +@@ -799,25 +809,35 @@ player.triggerAchievement(StatList.mineBlockStatArray[getIdFromBlock(this)]); player.addExhaustion(0.025F); @@ -179,7 +179,7 @@ } protected ItemStack createStackedBlock(IBlockState state) -@@ -1015,6 +1035,1029 @@ +@@ -1010,6 +1030,1029 @@ return "Block{" + blockRegistry.getNameForObject(this) + "}"; } diff --git a/patches/minecraft/net/minecraft/block/BlockBush.java.patch b/patches/minecraft/net/minecraft/block/BlockBush.java.patch index ec228d628..26af27af2 100644 --- a/patches/minecraft/net/minecraft/block/BlockBush.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockBush.java.patch @@ -7,9 +7,9 @@ -public class BlockBush extends Block +public class BlockBush extends Block implements net.minecraftforge.common.IPlantable { - private static final String __OBFID = "CL_00000208"; - -@@ -38,7 +38,7 @@ + protected BlockBush() + { +@@ -36,7 +36,7 @@ public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { @@ -18,7 +18,7 @@ } protected boolean canPlaceBlockOn(Block ground) -@@ -68,7 +68,10 @@ +@@ -66,7 +66,10 @@ public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) { @@ -30,7 +30,7 @@ } public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) -@@ -91,4 +94,33 @@ +@@ -89,4 +92,33 @@ { return EnumWorldBlockLayer.CUTOUT; } diff --git a/patches/minecraft/net/minecraft/block/BlockButton.java.patch b/patches/minecraft/net/minecraft/block/BlockButton.java.patch index 14114212f..c5bfc5fa7 100644 --- a/patches/minecraft/net/minecraft/block/BlockButton.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockButton.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockButton.java +++ ../src-work/minecraft/net/minecraft/block/BlockButton.java -@@ -75,8 +75,7 @@ +@@ -74,8 +74,7 @@ protected static boolean func_181088_a(World p_181088_0_, BlockPos p_181088_1_, EnumFacing p_181088_2_) { diff --git a/patches/minecraft/net/minecraft/block/BlockCactus.java.patch b/patches/minecraft/net/minecraft/block/BlockCactus.java.patch index 9de9be460..04f56d217 100644 --- a/patches/minecraft/net/minecraft/block/BlockCactus.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCactus.java.patch @@ -8,8 +8,8 @@ +public class BlockCactus extends Block implements net.minecraftforge.common.IPlantable { public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15); - private static final String __OBFID = "CL_00000210"; -@@ -110,7 +110,7 @@ + +@@ -109,7 +109,7 @@ } Block block = worldIn.getBlockState(pos.down()).getBlock(); @@ -18,7 +18,7 @@ } public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) -@@ -138,4 +138,16 @@ +@@ -137,4 +137,16 @@ { return new BlockState(this, new IProperty[] {AGE}); } diff --git a/patches/minecraft/net/minecraft/block/BlockChest.java.patch b/patches/minecraft/net/minecraft/block/BlockChest.java.patch index 8770eda2c..af3911451 100644 --- a/patches/minecraft/net/minecraft/block/BlockChest.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockChest.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockChest.java +++ ../src-work/minecraft/net/minecraft/block/BlockChest.java -@@ -528,7 +528,7 @@ +@@ -527,7 +527,7 @@ private boolean isBelowSolidBlock(World worldIn, BlockPos pos) { diff --git a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch index 5a1871a28..e5f3922b4 100644 --- a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java +++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java -@@ -138,6 +138,13 @@ +@@ -137,6 +137,13 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { @@ -14,7 +14,7 @@ int i = ((Integer)state.getValue(AGE)).intValue(); int j = 1; -@@ -148,8 +155,9 @@ +@@ -147,8 +154,9 @@ for (int k = 0; k < j; ++k) { diff --git a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch index 772607ab4..3d2a7232a 100644 --- a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockCrops.java +++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java -@@ -82,11 +82,11 @@ +@@ -81,11 +81,11 @@ float f1 = 0.0F; IBlockState iblockstate = worldIn.getBlockState(blockpos.add(i, 0, j)); @@ -14,7 +14,7 @@ { f1 = 3.0F; } -@@ -127,7 +127,7 @@ +@@ -126,7 +126,7 @@ public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) { @@ -23,7 +23,7 @@ } protected Item getSeed() -@@ -143,24 +143,6 @@ +@@ -142,24 +142,6 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); @@ -48,7 +48,7 @@ } public Item getItemDropped(IBlockState state, Random rand, int fortune) -@@ -203,4 +185,26 @@ +@@ -202,4 +184,26 @@ { return new BlockState(this, new IProperty[] {AGE}); } diff --git a/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch b/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch index 5bf52c67c..c0c9491c9 100644 --- a/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch @@ -7,9 +7,9 @@ -public class BlockDeadBush extends BlockBush +public class BlockDeadBush extends BlockBush implements net.minecraftforge.common.IShearable { - private static final String __OBFID = "CL_00000224"; - -@@ -47,14 +47,15 @@ + protected BlockDeadBush() + { +@@ -45,14 +45,15 @@ public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) { diff --git a/patches/minecraft/net/minecraft/block/BlockDoor.java.patch b/patches/minecraft/net/minecraft/block/BlockDoor.java.patch index 77dc1dd1a..ec621d11f 100644 --- a/patches/minecraft/net/minecraft/block/BlockDoor.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockDoor.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockDoor.java +++ ../src-work/minecraft/net/minecraft/block/BlockDoor.java -@@ -155,7 +155,7 @@ +@@ -154,7 +154,7 @@ { if (this.blockMaterial == Material.iron) { @@ -9,7 +9,7 @@ } else { -@@ -273,7 +273,7 @@ +@@ -272,7 +272,7 @@ public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { diff --git a/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch b/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch index 7ffdec20b..8cbc62e73 100644 --- a/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch @@ -9,7 +9,7 @@ { public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockDoublePlant.EnumPlantType.class); public static final PropertyEnum HALF = PropertyEnum.create("half", BlockDoublePlant.EnumBlockHalf.class); -@@ -91,6 +91,8 @@ +@@ -90,6 +90,8 @@ Block block = (Block)(flag ? this : worldIn.getBlockState(blockpos).getBlock()); Block block1 = (Block)(flag ? worldIn.getBlockState(blockpos1).getBlock() : this); @@ -18,7 +18,7 @@ if (block == this) { worldIn.setBlockState(blockpos, Blocks.air.getDefaultState(), 2); -@@ -99,17 +101,13 @@ +@@ -98,17 +100,13 @@ if (block1 == this) { worldIn.setBlockState(blockpos1, Blocks.air.getDefaultState(), 3); @@ -37,7 +37,7 @@ if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) { return worldIn.getBlockState(pos.down()).getBlock() == this; -@@ -159,7 +157,6 @@ +@@ -158,7 +156,6 @@ public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) { @@ -45,7 +45,7 @@ { super.harvestBlock(worldIn, player, pos, state, te); } -@@ -222,8 +219,6 @@ +@@ -221,8 +218,6 @@ else { player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); @@ -54,7 +54,7 @@ return true; } } -@@ -294,6 +289,32 @@ +@@ -293,6 +288,32 @@ return Block.EnumOffsetType.XZ; } diff --git a/patches/minecraft/net/minecraft/block/BlockFalling.java.patch b/patches/minecraft/net/minecraft/block/BlockFalling.java.patch index 40b410739..4ac1d2847 100644 --- a/patches/minecraft/net/minecraft/block/BlockFalling.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFalling.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockFalling.java +++ ../src-work/minecraft/net/minecraft/block/BlockFalling.java -@@ -87,6 +87,7 @@ +@@ -86,6 +86,7 @@ public static boolean canFallInto(World worldIn, BlockPos pos) { diff --git a/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch b/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch index 4e0915fe1..b94b5429e 100644 --- a/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockFarmland.java +++ ../src-work/minecraft/net/minecraft/block/BlockFarmland.java -@@ -90,7 +90,7 @@ +@@ -89,7 +89,7 @@ private boolean hasCrops(World worldIn, BlockPos pos) { Block block = worldIn.getBlockState(pos.up()).getBlock(); diff --git a/patches/minecraft/net/minecraft/block/BlockFire.java.patch b/patches/minecraft/net/minecraft/block/BlockFire.java.patch index 3c4a9fb05..287e8d5dd 100644 --- a/patches/minecraft/net/minecraft/block/BlockFire.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFire.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockFire.java +++ ../src-work/minecraft/net/minecraft/block/BlockFire.java -@@ -42,18 +42,24 @@ +@@ -41,18 +41,24 @@ int j = pos.getY(); int k = pos.getZ(); @@ -28,7 +28,7 @@ } else { -@@ -109,6 +115,7 @@ +@@ -108,6 +114,7 @@ public void setFireInfo(Block blockIn, int encouragement, int flammability) { @@ -36,7 +36,7 @@ this.encouragements.put(blockIn, Integer.valueOf(encouragement)); this.flammabilities.put(blockIn, Integer.valueOf(flammability)); } -@@ -148,13 +155,8 @@ +@@ -147,13 +154,8 @@ } Block block = worldIn.getBlockState(pos.down()).getBlock(); @@ -51,7 +51,7 @@ if (!flag && worldIn.isRaining() && this.canDie(worldIn, pos)) { worldIn.setBlockToAir(pos); -@@ -183,7 +185,7 @@ +@@ -182,7 +184,7 @@ return; } @@ -60,7 +60,7 @@ { worldIn.setBlockToAir(pos); return; -@@ -198,12 +200,12 @@ +@@ -197,12 +199,12 @@ j = -50; } @@ -79,7 +79,7 @@ for (int k = -1; k <= 1; ++k) { -@@ -262,22 +264,30 @@ +@@ -261,22 +263,30 @@ return false; } @@ -111,7 +111,7 @@ if (random.nextInt(chance) < i) { IBlockState iblockstate = worldIn.getBlockState(pos); -@@ -309,7 +319,7 @@ +@@ -308,7 +318,7 @@ { for (EnumFacing enumfacing : EnumFacing.values()) { @@ -120,7 +120,7 @@ { return true; } -@@ -330,7 +340,7 @@ +@@ -329,7 +339,7 @@ for (EnumFacing enumfacing : EnumFacing.values()) { @@ -129,7 +129,7 @@ } return i; -@@ -342,9 +352,10 @@ +@@ -341,9 +351,10 @@ return false; } @@ -141,7 +141,7 @@ } public boolean canPlaceBlockAt(World worldIn, BlockPos pos) -@@ -383,9 +394,9 @@ +@@ -382,9 +393,9 @@ worldIn.playSound((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), "fire.fire", 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F, false); } @@ -153,7 +153,7 @@ { for (int j = 0; j < 2; ++j) { -@@ -396,7 +407,7 @@ +@@ -395,7 +406,7 @@ } } @@ -162,7 +162,7 @@ { for (int k = 0; k < 2; ++k) { -@@ -407,7 +418,7 @@ +@@ -406,7 +417,7 @@ } } @@ -171,7 +171,7 @@ { for (int l = 0; l < 2; ++l) { -@@ -418,7 +429,7 @@ +@@ -417,7 +428,7 @@ } } @@ -180,7 +180,7 @@ { for (int i1 = 0; i1 < 2; ++i1) { -@@ -429,7 +440,7 @@ +@@ -428,7 +439,7 @@ } } @@ -189,7 +189,7 @@ { for (int j1 = 0; j1 < 2; ++j1) { -@@ -477,4 +488,19 @@ +@@ -476,4 +487,19 @@ { return new BlockState(this, new IProperty[] {AGE, NORTH, EAST, SOUTH, WEST, UPPER, FLIP, ALT}); } diff --git a/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch b/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch index faca3a6d8..d4e12c92c 100644 --- a/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockFlowerPot.java +++ ../src-work/minecraft/net/minecraft/block/BlockFlowerPot.java -@@ -170,13 +170,6 @@ +@@ -169,13 +169,6 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { @@ -14,7 +14,7 @@ super.breakBlock(worldIn, pos, state); } -@@ -396,6 +389,31 @@ +@@ -395,6 +388,31 @@ return EnumWorldBlockLayer.CUTOUT; } diff --git a/patches/minecraft/net/minecraft/block/BlockGrass.java.patch b/patches/minecraft/net/minecraft/block/BlockGrass.java.patch index 632b06303..b373fbe3a 100644 --- a/patches/minecraft/net/minecraft/block/BlockGrass.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockGrass.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockGrass.java +++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java -@@ -59,7 +59,7 @@ +@@ -58,7 +58,7 @@ { if (!worldIn.isRemote) { @@ -9,7 +9,7 @@ { worldIn.setBlockState(pos, Blocks.dirt.getDefaultState()); } -@@ -73,7 +73,7 @@ +@@ -72,7 +72,7 @@ Block block = worldIn.getBlockState(blockpos.up()).getBlock(); IBlockState iblockstate = worldIn.getBlockState(blockpos); @@ -18,7 +18,7 @@ { worldIn.setBlockState(blockpos, Blocks.grass.getDefaultState()); } -@@ -111,7 +111,7 @@ +@@ -110,7 +110,7 @@ { if (j >= i / 16) { diff --git a/patches/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch b/patches/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch index 4e6db9303..4034822ae 100644 --- a/patches/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockHugeMushroom.java +++ ../src-work/minecraft/net/minecraft/block/BlockHugeMushroom.java -@@ -80,6 +80,20 @@ +@@ -79,6 +79,20 @@ return new BlockState(this, new IProperty[] {VARIANT}); } diff --git a/patches/minecraft/net/minecraft/block/BlockIce.java.patch b/patches/minecraft/net/minecraft/block/BlockIce.java.patch index ebd4a9f12..c1631128c 100644 --- a/patches/minecraft/net/minecraft/block/BlockIce.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockIce.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockIce.java +++ ../src-work/minecraft/net/minecraft/block/BlockIce.java -@@ -40,14 +40,17 @@ +@@ -38,14 +38,17 @@ player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); player.addExhaustion(0.025F); @@ -23,7 +23,7 @@ } else { -@@ -58,7 +61,9 @@ +@@ -56,7 +59,9 @@ } int i = EnchantmentHelper.getFortuneModifier(player); diff --git a/patches/minecraft/net/minecraft/block/BlockLadder.java.patch b/patches/minecraft/net/minecraft/block/BlockLadder.java.patch index 629520652..a6e678065 100644 --- a/patches/minecraft/net/minecraft/block/BlockLadder.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLadder.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockLadder.java +++ ../src-work/minecraft/net/minecraft/block/BlockLadder.java -@@ -79,7 +79,10 @@ +@@ -78,7 +78,10 @@ public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { @@ -12,7 +12,7 @@ } public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) -@@ -117,7 +120,7 @@ +@@ -116,7 +119,7 @@ protected boolean canBlockStay(World worldIn, BlockPos pos, EnumFacing facing) { @@ -21,7 +21,7 @@ } public IBlockState getStateFromMeta(int meta) -@@ -147,4 +150,6 @@ +@@ -146,4 +149,6 @@ { return new BlockState(this, new IProperty[] {FACING}); } diff --git a/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch b/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch index c1ec1e2ef..a736fd6bb 100644 --- a/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch @@ -9,7 +9,7 @@ { public static final PropertyBool DECAYABLE = PropertyBool.create("decayable"); public static final PropertyBool CHECK_DECAY = PropertyBool.create("check_decay"); -@@ -76,9 +76,9 @@ +@@ -75,9 +75,9 @@ BlockPos blockpos = pos.add(j1, k1, l1); IBlockState iblockstate = worldIn.getBlockState(blockpos); @@ -21,7 +21,7 @@ } } } -@@ -118,9 +118,9 @@ +@@ -117,9 +117,9 @@ { Block block = worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2)).getBlock(); @@ -33,7 +33,7 @@ { this.surroundings[(i2 + l1) * k1 + (j2 + l1) * j1 + k2 + l1] = -2; } -@@ -227,40 +227,7 @@ +@@ -226,40 +226,7 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { @@ -75,7 +75,7 @@ } protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance) -@@ -297,4 +264,48 @@ +@@ -296,4 +263,48 @@ } public abstract BlockPlanks.EnumType getWoodType(int meta); diff --git a/patches/minecraft/net/minecraft/block/BlockLever.java.patch b/patches/minecraft/net/minecraft/block/BlockLever.java.patch index bd6ae7dcf..21869253d 100644 --- a/patches/minecraft/net/minecraft/block/BlockLever.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLever.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockLever.java +++ ../src-work/minecraft/net/minecraft/block/BlockLever.java -@@ -238,6 +238,12 @@ +@@ -237,6 +237,12 @@ return new BlockState(this, new IProperty[] {FACING, POWERED}); } diff --git a/patches/minecraft/net/minecraft/block/BlockLog.java.patch b/patches/minecraft/net/minecraft/block/BlockLog.java.patch index fff237c53..e1ad4d6e7 100644 --- a/patches/minecraft/net/minecraft/block/BlockLog.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLog.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockLog.java +++ ../src-work/minecraft/net/minecraft/block/BlockLog.java -@@ -34,9 +34,9 @@ +@@ -33,9 +33,9 @@ { IBlockState iblockstate = worldIn.getBlockState(blockpos); @@ -12,7 +12,7 @@ } } } -@@ -47,6 +47,9 @@ +@@ -46,6 +46,9 @@ return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(LOG_AXIS, BlockLog.EnumAxis.fromFacingAxis(facing.getAxis())); } diff --git a/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch b/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch index c9b7f08e8..1ea021a24 100644 --- a/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockMobSpawner.java +++ ../src-work/minecraft/net/minecraft/block/BlockMobSpawner.java -@@ -39,10 +39,14 @@ +@@ -37,10 +37,14 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); diff --git a/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch b/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch index 2937e59ae..c8f6e6acd 100644 --- a/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java +++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java -@@ -73,7 +73,7 @@ +@@ -71,7 +71,7 @@ if (pos.getY() >= 0 && pos.getY() < 256) { IBlockState iblockstate = worldIn.getBlockState(pos.down()); diff --git a/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch b/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch index a22a27a48..774ac7079 100644 --- a/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockMycelium.java +++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java -@@ -40,7 +40,7 @@ +@@ -39,7 +39,7 @@ { if (!worldIn.isRemote) { @@ -9,7 +9,7 @@ { worldIn.setBlockState(pos, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); } -@@ -54,7 +54,7 @@ +@@ -53,7 +53,7 @@ IBlockState iblockstate = worldIn.getBlockState(blockpos); Block block = worldIn.getBlockState(blockpos.up()).getBlock(); diff --git a/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch b/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch index f036a71f5..1640b0ea1 100644 --- a/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java +++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java -@@ -39,7 +39,7 @@ +@@ -38,7 +38,7 @@ public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) { @@ -9,7 +9,7 @@ } public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) -@@ -55,9 +55,11 @@ +@@ -54,9 +54,11 @@ super.updateTick(worldIn, pos, state, rand); } @@ -22,7 +22,7 @@ { int i = 1; -@@ -108,4 +110,24 @@ +@@ -107,4 +109,24 @@ { return new BlockState(this, new IProperty[] {AGE}); } diff --git a/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch b/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch index 57523ab34..4696ecb98 100644 --- a/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockNewLeaf.java +++ ../src-work/minecraft/net/minecraft/block/BlockNewLeaf.java -@@ -101,14 +101,15 @@ +@@ -99,14 +99,15 @@ public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) { diff --git a/patches/minecraft/net/minecraft/block/BlockNote.java.patch b/patches/minecraft/net/minecraft/block/BlockNote.java.patch index fa6a2e571..f93eeb428 100644 --- a/patches/minecraft/net/minecraft/block/BlockNote.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockNote.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockNote.java +++ ../src-work/minecraft/net/minecraft/block/BlockNote.java -@@ -59,7 +59,9 @@ +@@ -58,7 +58,9 @@ if (tileentity instanceof TileEntityNote) { TileEntityNote tileentitynote = (TileEntityNote)tileentity; @@ -10,7 +10,7 @@ tileentitynote.triggerNote(worldIn, pos); playerIn.triggerAchievement(StatList.field_181735_S); } -@@ -99,6 +101,10 @@ +@@ -98,6 +100,10 @@ public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam) { diff --git a/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch b/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch index e1640524f..efca433f4 100644 --- a/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockOldLeaf.java +++ ../src-work/minecraft/net/minecraft/block/BlockOldLeaf.java -@@ -144,11 +144,17 @@ +@@ -142,11 +142,17 @@ if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) { player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); diff --git a/patches/minecraft/net/minecraft/block/BlockOre.java.patch b/patches/minecraft/net/minecraft/block/BlockOre.java.patch index 35a3ddd9d..28763cd3c 100644 --- a/patches/minecraft/net/minecraft/block/BlockOre.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockOre.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockOre.java +++ ../src-work/minecraft/net/minecraft/block/BlockOre.java -@@ -60,34 +60,40 @@ +@@ -58,34 +58,40 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); diff --git a/patches/minecraft/net/minecraft/block/BlockPane.java.patch b/patches/minecraft/net/minecraft/block/BlockPane.java.patch index bbfc1846f..c5061c08f 100644 --- a/patches/minecraft/net/minecraft/block/BlockPane.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPane.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockPane.java +++ ../src-work/minecraft/net/minecraft/block/BlockPane.java -@@ -39,7 +39,10 @@ +@@ -38,7 +38,10 @@ public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { @@ -12,7 +12,7 @@ } public Item getItemDropped(IBlockState state, Random rand, int fortune) -@@ -65,10 +68,10 @@ +@@ -64,10 +67,10 @@ public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) { @@ -27,7 +27,7 @@ if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) { -@@ -187,4 +190,11 @@ +@@ -186,4 +189,11 @@ { return new BlockState(this, new IProperty[] {NORTH, EAST, WEST, SOUTH}); } diff --git a/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch b/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch index 5d7960d10..c696444af 100644 --- a/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java +++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java -@@ -190,7 +190,7 @@ +@@ -189,7 +189,7 @@ } } @@ -9,7 +9,7 @@ { this.doMove(worldIn, pos, enumfacing, false); } -@@ -334,7 +334,7 @@ +@@ -333,7 +333,7 @@ return false; } @@ -18,7 +18,7 @@ } else { -@@ -372,7 +372,9 @@ +@@ -371,7 +371,9 @@ { BlockPos blockpos = (BlockPos)list1.get(j); Block block = worldIn.getBlockState(blockpos).getBlock(); diff --git a/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch b/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch index 679a458ff..c1bf64fbd 100644 --- a/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockPistonMoving.java +++ ../src-work/minecraft/net/minecraft/block/BlockPistonMoving.java -@@ -110,16 +110,7 @@ +@@ -109,16 +109,7 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { @@ -18,7 +18,7 @@ } public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) -@@ -283,4 +274,16 @@ +@@ -282,4 +273,16 @@ { return new BlockState(this, new IProperty[] {FACING, TYPE}); } diff --git a/patches/minecraft/net/minecraft/block/BlockPotato.java.patch b/patches/minecraft/net/minecraft/block/BlockPotato.java.patch index afe064e2b..7c4e2d199 100644 --- a/patches/minecraft/net/minecraft/block/BlockPotato.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPotato.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockPotato.java +++ ../src-work/minecraft/net/minecraft/block/BlockPotato.java -@@ -24,13 +24,14 @@ +@@ -22,13 +22,14 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); diff --git a/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch b/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch index 3e5e60593..6d75c0f94 100644 --- a/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockPumpkin.java +++ ../src-work/minecraft/net/minecraft/block/BlockPumpkin.java -@@ -117,7 +117,7 @@ +@@ -115,7 +115,7 @@ public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { diff --git a/patches/minecraft/net/minecraft/block/BlockQuartz.java.patch b/patches/minecraft/net/minecraft/block/BlockQuartz.java.patch index 7c75b6cdc..413d42a6f 100644 --- a/patches/minecraft/net/minecraft/block/BlockQuartz.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockQuartz.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockQuartz.java +++ ../src-work/minecraft/net/minecraft/block/BlockQuartz.java -@@ -91,6 +91,26 @@ +@@ -90,6 +90,26 @@ return new BlockState(this, new IProperty[] {VARIANT}); } diff --git a/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch b/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch index 800cc78f2..8dea2624e 100644 --- a/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRailBase.java +++ ../src-work/minecraft/net/minecraft/block/BlockRailBase.java -@@ -32,7 +32,7 @@ +@@ -31,7 +31,7 @@ public static boolean isRailBlock(IBlockState state) { Block block = state.getBlock(); @@ -9,7 +9,7 @@ } protected BlockRailBase(boolean isPowered) -@@ -176,6 +176,81 @@ +@@ -175,6 +175,81 @@ public abstract IProperty getShapeProperty(); @@ -91,15 +91,15 @@ public static enum EnumRailDirection implements IStringSerializable { NORTH_SOUTH(0, "north_south"), -@@ -248,6 +323,7 @@ +@@ -245,6 +320,7 @@ + private IBlockState state; private final boolean isPowered; private final List field_150657_g = Lists.newArrayList(); - private static final String __OBFID = "CL_00000196"; + private final boolean canMakeSlopes; public Rail(World worldIn, BlockPos pos, IBlockState state) { -@@ -256,7 +332,8 @@ +@@ -253,7 +329,8 @@ this.state = state; this.block = (BlockRailBase)state.getBlock(); BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(BlockRailBase.this.getShapeProperty()); @@ -109,7 +109,7 @@ this.func_180360_a(blockrailbase$enumraildirection); } -@@ -442,7 +519,7 @@ +@@ -439,7 +516,7 @@ } } @@ -118,7 +118,7 @@ { if (BlockRailBase.isRailBlock(this.world, blockpos.up())) { -@@ -455,7 +532,7 @@ +@@ -452,7 +529,7 @@ } } @@ -127,7 +127,7 @@ { if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) { -@@ -598,7 +675,7 @@ +@@ -595,7 +672,7 @@ } } @@ -136,7 +136,7 @@ { if (BlockRailBase.isRailBlock(this.world, blockpos.up())) { -@@ -611,7 +688,7 @@ +@@ -608,7 +685,7 @@ } } diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch index 4ffa619b9..6799d4271 100644 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRedstoneComparator.java +++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneComparator.java -@@ -297,6 +297,21 @@ +@@ -295,6 +295,21 @@ return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(POWERED, Boolean.valueOf(false)).withProperty(MODE, BlockRedstoneComparator.Mode.COMPARE); } diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch index 28bdd60d7..f165b66c8 100644 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRedstoneDiode.java +++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneDiode.java -@@ -199,6 +199,8 @@ +@@ -198,6 +198,8 @@ { EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); BlockPos blockpos = pos.offset(enumfacing.getOpposite()); diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch index 8acd40ee8..61ff6434e 100644 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRedstoneOre.java +++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneOre.java -@@ -92,12 +92,16 @@ +@@ -91,12 +91,16 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch index 6cc29f813..8fc040e78 100644 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java +++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java -@@ -59,10 +59,10 @@ +@@ -58,10 +58,10 @@ BlockPos blockpos = pos.offset(direction); Block block = worldIn.getBlockState(pos.offset(direction)).getBlock(); @@ -13,7 +13,7 @@ } else { -@@ -360,35 +360,24 @@ +@@ -359,35 +359,24 @@ Block block = iblockstate.getBlock(); boolean flag = block.isNormalCube(); boolean flag1 = worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); diff --git a/patches/minecraft/net/minecraft/block/BlockReed.java.patch b/patches/minecraft/net/minecraft/block/BlockReed.java.patch index 8c782fe46..a6e2c2ae8 100644 --- a/patches/minecraft/net/minecraft/block/BlockReed.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockReed.java.patch @@ -8,8 +8,8 @@ +public class BlockReed extends Block implements net.minecraftforge.common.IPlantable { public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15); - private static final String __OBFID = "CL_00000300"; -@@ -66,6 +66,7 @@ + +@@ -65,6 +65,7 @@ public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { Block block = worldIn.getBlockState(pos.down()).getBlock(); @@ -17,7 +17,7 @@ if (block == this) { -@@ -165,4 +166,15 @@ +@@ -164,4 +165,15 @@ { return new BlockState(this, new IProperty[] {AGE}); } diff --git a/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch b/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch index 586091cc9..e450bf907 100644 --- a/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRotatedPillar.java +++ ../src-work/minecraft/net/minecraft/block/BlockRotatedPillar.java -@@ -19,4 +19,18 @@ +@@ -18,4 +18,18 @@ { super(p_i46385_1_, p_i46385_2_); } diff --git a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch b/patches/minecraft/net/minecraft/block/BlockSapling.java.patch index eb550d0a5..ce119c1ba 100644 --- a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSapling.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockSapling.java +++ ../src-work/minecraft/net/minecraft/block/BlockSapling.java -@@ -72,6 +72,7 @@ +@@ -71,6 +71,7 @@ public void generateTree(World worldIn, BlockPos pos, IBlockState state, Random rand) { diff --git a/patches/minecraft/net/minecraft/block/BlockSkull.java.patch b/patches/minecraft/net/minecraft/block/BlockSkull.java.patch index d53f00837..abe2893df 100644 --- a/patches/minecraft/net/minecraft/block/BlockSkull.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSkull.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockSkull.java +++ ../src-work/minecraft/net/minecraft/block/BlockSkull.java -@@ -123,10 +123,6 @@ +@@ -121,10 +121,6 @@ return tileentity instanceof TileEntitySkull ? ((TileEntitySkull)tileentity).getSkullType() : super.getDamageValue(worldIn, pos); } @@ -11,7 +11,7 @@ public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) { if (player.capabilities.isCreativeMode) -@@ -134,13 +130,18 @@ +@@ -132,13 +128,18 @@ state = state.withProperty(NODROP, Boolean.valueOf(true)); worldIn.setBlockState(pos, state, 4); } @@ -31,7 +31,7 @@ { if (!((Boolean)state.getValue(NODROP)).booleanValue()) { -@@ -149,7 +150,7 @@ +@@ -147,7 +148,7 @@ if (tileentity instanceof TileEntitySkull) { TileEntitySkull tileentityskull = (TileEntitySkull)tileentity; @@ -40,7 +40,7 @@ if (tileentityskull.getSkullType() == 3 && tileentityskull.getPlayerProfile() != null) { -@@ -159,12 +160,11 @@ +@@ -157,12 +158,11 @@ itemstack.getTagCompound().setTag("SkullOwner", nbttagcompound); } diff --git a/patches/minecraft/net/minecraft/block/BlockSnow.java.patch b/patches/minecraft/net/minecraft/block/BlockSnow.java.patch index a97fd2232..0e607c12d 100644 --- a/patches/minecraft/net/minecraft/block/BlockSnow.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSnow.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockSnow.java +++ ../src-work/minecraft/net/minecraft/block/BlockSnow.java -@@ -80,7 +80,7 @@ +@@ -79,7 +79,7 @@ { IBlockState iblockstate = worldIn.getBlockState(pos.down()); Block block = iblockstate.getBlock(); @@ -9,7 +9,7 @@ } public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) -@@ -92,7 +92,6 @@ +@@ -91,7 +91,6 @@ { if (!this.canPlaceBlockAt(worldIn, p_176314_2_)) { @@ -17,7 +17,7 @@ worldIn.setBlockToAir(p_176314_2_); return false; } -@@ -104,9 +103,8 @@ +@@ -103,9 +102,8 @@ public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) { @@ -28,7 +28,7 @@ } public Item getItemDropped(IBlockState state, Random rand, int fortune) -@@ -116,14 +114,13 @@ +@@ -115,14 +113,13 @@ public int quantityDropped(Random random) { @@ -44,7 +44,7 @@ worldIn.setBlockToAir(pos); } } -@@ -153,4 +150,6 @@ +@@ -152,4 +149,6 @@ { return new BlockState(this, new IProperty[] {LAYERS}); } diff --git a/patches/minecraft/net/minecraft/block/BlockStem.java.patch b/patches/minecraft/net/minecraft/block/BlockStem.java.patch index db0468600..41d70ce17 100644 --- a/patches/minecraft/net/minecraft/block/BlockStem.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockStem.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockStem.java +++ ../src-work/minecraft/net/minecraft/block/BlockStem.java -@@ -96,7 +96,7 @@ +@@ -94,7 +94,7 @@ pos = pos.offset(EnumFacing.Plane.HORIZONTAL.random(rand)); Block block = worldIn.getBlockState(pos.down()).getBlock(); @@ -9,7 +9,7 @@ { worldIn.setBlockState(pos, this.crop.getDefaultState()); } -@@ -150,8 +150,12 @@ +@@ -148,8 +148,12 @@ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); @@ -23,7 +23,7 @@ { Item item = this.getSeedItem(); -@@ -161,13 +165,14 @@ +@@ -159,13 +163,14 @@ for (int j = 0; j < 3; ++j) { diff --git a/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch b/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch index cd0915eb8..d0a3b75f3 100644 --- a/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch @@ -8,8 +8,8 @@ +public class BlockTallGrass extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable { public static final PropertyEnum TYPE = PropertyEnum.create("type", BlockTallGrass.EnumType.class); - private static final String __OBFID = "CL_00000321"; -@@ -44,7 +44,7 @@ + +@@ -43,7 +43,7 @@ public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) { @@ -18,7 +18,7 @@ } public boolean isReplaceable(World worldIn, BlockPos pos) -@@ -54,7 +54,7 @@ +@@ -53,7 +53,7 @@ public Item getItemDropped(IBlockState state, Random rand, int fortune) { @@ -27,7 +27,7 @@ } public int quantityDroppedWithBonus(int fortune, Random random) -@@ -64,13 +64,7 @@ +@@ -63,13 +63,7 @@ public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) { @@ -41,7 +41,7 @@ super.harvestBlock(worldIn, player, pos, state, te); } } -@@ -206,4 +200,22 @@ +@@ -204,4 +198,22 @@ } } } diff --git a/patches/minecraft/net/minecraft/block/BlockTorch.java.patch b/patches/minecraft/net/minecraft/block/BlockTorch.java.patch index c0f92632d..ca42046b1 100644 --- a/patches/minecraft/net/minecraft/block/BlockTorch.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTorch.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockTorch.java +++ ../src-work/minecraft/net/minecraft/block/BlockTorch.java -@@ -65,7 +65,7 @@ +@@ -63,7 +63,7 @@ else { Block block = worldIn.getBlockState(pos).getBlock(); @@ -9,7 +9,7 @@ } } -@@ -86,7 +86,7 @@ +@@ -84,7 +84,7 @@ { BlockPos blockpos = pos.offset(facing.getOpposite()); boolean flag = facing.getAxis().isHorizontal(); @@ -18,7 +18,7 @@ } public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) -@@ -99,7 +99,7 @@ +@@ -97,7 +97,7 @@ { for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) { @@ -27,7 +27,7 @@ { return this.getDefaultState().withProperty(FACING, enumfacing); } -@@ -132,7 +132,7 @@ +@@ -130,7 +130,7 @@ EnumFacing enumfacing1 = enumfacing.getOpposite(); boolean flag = false; diff --git a/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch b/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch index e2c0c7b52..7de11cc75 100644 --- a/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch @@ -9,7 +9,7 @@ public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); public static final PropertyBool OPEN = PropertyBool.create("open"); public static final PropertyEnum HALF = PropertyEnum.create("half", BlockTrapDoor.DoorHalf.class); -@@ -141,9 +143,10 @@ +@@ -140,9 +142,10 @@ { if (!worldIn.isRemote) { @@ -21,7 +21,7 @@ { worldIn.setBlockToAir(pos); this.dropBlockAsItem(worldIn, pos, state, 0); -@@ -187,7 +190,10 @@ +@@ -186,7 +189,10 @@ public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) { @@ -33,7 +33,7 @@ } protected static EnumFacing getFacing(int meta) -@@ -224,6 +230,7 @@ +@@ -223,6 +229,7 @@ private static boolean isValidSupportBlock(Block blockIn) { diff --git a/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch b/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch index 9150d02c9..a8de6b96f 100644 --- a/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockTripWireHook.java +++ ../src-work/minecraft/net/minecraft/block/BlockTripWireHook.java -@@ -59,14 +59,14 @@ +@@ -58,14 +58,14 @@ public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) { @@ -17,7 +17,7 @@ { return true; } -@@ -100,7 +100,7 @@ +@@ -99,7 +99,7 @@ { EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); diff --git a/patches/minecraft/net/minecraft/block/BlockVine.java.patch b/patches/minecraft/net/minecraft/block/BlockVine.java.patch index 8194f2b6c..a3536a850 100644 --- a/patches/minecraft/net/minecraft/block/BlockVine.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockVine.java.patch @@ -9,7 +9,7 @@ { public static final PropertyBool UP = PropertyBool.create("up"); public static final PropertyBool NORTH = PropertyBool.create("north"); -@@ -388,13 +388,7 @@ +@@ -387,13 +387,7 @@ public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) { @@ -23,7 +23,7 @@ super.harvestBlock(worldIn, player, pos, state, te); } } -@@ -475,4 +469,14 @@ +@@ -474,4 +468,14 @@ return i; } diff --git a/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch b/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch index aabc4ae42..a9bcee491 100644 --- a/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch +++ b/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java +++ ../src-work/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java -@@ -79,7 +79,7 @@ +@@ -78,7 +78,7 @@ { Block block = this.world.getBlockState(origin).getBlock(); @@ -9,7 +9,7 @@ { return true; } -@@ -110,7 +110,7 @@ +@@ -109,7 +109,7 @@ BlockPos blockpos = origin.offset(this.moveDirection.getOpposite(), i); block = this.world.getBlockState(blockpos).getBlock(); @@ -18,7 +18,7 @@ { break; } -@@ -157,7 +157,7 @@ +@@ -156,7 +156,7 @@ block = this.world.getBlockState(blockpos1).getBlock(); diff --git a/patches/minecraft/net/minecraft/block/state/BlockState.java.patch b/patches/minecraft/net/minecraft/block/state/BlockState.java.patch index 5d82d564b..357204736 100644 --- a/patches/minecraft/net/minecraft/block/state/BlockState.java.patch +++ b/patches/minecraft/net/minecraft/block/state/BlockState.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/state/BlockState.java +++ ../src-work/minecraft/net/minecraft/block/state/BlockState.java -@@ -40,6 +40,16 @@ +@@ -38,6 +38,16 @@ public BlockState(Block blockIn, IProperty... properties) { @@ -17,7 +17,7 @@ this.block = blockIn; Arrays.sort(properties, new Comparator() { -@@ -56,7 +66,7 @@ +@@ -53,7 +63,7 @@ for (List list1 : Cartesian.cartesianProduct(this.getAllowedValues())) { Map map1 = MapPopulator.createMap(this.properties, list1); @@ -26,7 +26,7 @@ map.put(map1, blockstate$stateimplementation); list.add(blockstate$stateimplementation); } -@@ -136,6 +146,13 @@ +@@ -132,6 +142,13 @@ } } @@ -40,7 +40,7 @@ public , V extends T> IBlockState withProperty(IProperty property, V value) { if (!this.properties.containsKey(property)) -@@ -203,5 +220,10 @@ +@@ -199,5 +216,10 @@ map.put(property, value); return map; } diff --git a/patches/minecraft/net/minecraft/block/state/BlockStateBase.java.patch b/patches/minecraft/net/minecraft/block/state/BlockStateBase.java.patch index 1aa5874a5..a8c502863 100644 --- a/patches/minecraft/net/minecraft/block/state/BlockStateBase.java.patch +++ b/patches/minecraft/net/minecraft/block/state/BlockStateBase.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/state/BlockStateBase.java +++ ../src-work/minecraft/net/minecraft/block/state/BlockStateBase.java -@@ -69,4 +69,9 @@ +@@ -67,4 +67,9 @@ return stringbuilder.toString(); } diff --git a/patches/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch b/patches/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch index d046aa4a5..e666d37fe 100644 --- a/patches/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch +++ b/patches/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/client/ClientBrandRetriever.java +++ ../src-work/minecraft/net/minecraft/client/ClientBrandRetriever.java -@@ -10,6 +10,6 @@ - +@@ -8,6 +8,6 @@ + { public static String getClientModName() { - return "vanilla"; diff --git a/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch b/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch index 04b3e0e54..093758d5b 100644 --- a/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/LoadingScreenRenderer.java +++ ../src-work/minecraft/net/minecraft/client/LoadingScreenRenderer.java -@@ -140,6 +140,10 @@ +@@ -139,6 +139,10 @@ GlStateManager.clear(16640); } @@ -11,7 +11,7 @@ Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); this.mc.getTextureManager().bindTexture(Gui.optionsBackground); -@@ -175,6 +179,12 @@ +@@ -174,6 +178,12 @@ GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); this.mc.fontRendererObj.drawStringWithShadow(this.currentlyDisplayedText, (float)((k - this.mc.fontRendererObj.getStringWidth(this.currentlyDisplayedText)) / 2), (float)(l / 2 - 4 - 16), 16777215); this.mc.fontRendererObj.drawStringWithShadow(this.message, (float)((k - this.mc.fontRendererObj.getStringWidth(this.message)) / 2), (float)(l / 2 - 4 + 8), 16777215); diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 9287061d8..d1f5d382a 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/Minecraft.java +++ ../src-work/minecraft/net/minecraft/client/Minecraft.java -@@ -302,7 +302,6 @@ +@@ -301,7 +301,6 @@ this.sessionService = (new YggdrasilAuthenticationService(gameConfig.userInfo.proxy, UUID.randomUUID().toString())).createMinecraftSessionService(); this.session = gameConfig.userInfo.session; logger.info("Setting user: " + this.session.getUsername()); @@ -8,7 +8,7 @@ this.isDemo = gameConfig.gameInfo.isDemo; this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1; this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1; -@@ -416,10 +415,10 @@ +@@ -415,10 +414,10 @@ this.mcResourceManager = new SimpleReloadableResourceManager(this.metadataSerializer_); this.mcLanguageManager = new LanguageManager(this.metadataSerializer_, this.gameSettings.language); this.mcResourceManager.registerReloadListener(this.mcLanguageManager); @@ -21,7 +21,7 @@ this.initStream(); this.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService); this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves")); -@@ -455,6 +454,8 @@ +@@ -453,6 +452,8 @@ } }); this.mouseHelper = new MouseHelper(); @@ -30,7 +30,7 @@ this.checkGLError("Pre startup"); GlStateManager.enableTexture2D(); GlStateManager.shadeModel(7425); -@@ -468,17 +469,21 @@ +@@ -466,17 +467,21 @@ GlStateManager.loadIdentity(); GlStateManager.matrixMode(5888); this.checkGLError("Startup"); @@ -53,7 +53,7 @@ this.entityRenderer = new EntityRenderer(this, this.mcResourceManager); this.mcResourceManager.registerReloadListener(this.entityRenderer); this.blockRenderDispatcher = new BlockRendererDispatcher(this.modelManager.getBlockModelShapes(), this.gameSettings); -@@ -488,22 +493,25 @@ +@@ -486,22 +491,25 @@ this.guiAchievement = new GuiAchievement(this); GlStateManager.viewport(0, 0, this.displayWidth, this.displayHeight); this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine); @@ -82,7 +82,7 @@ if (this.gameSettings.fullScreen && !this.fullscreen) { this.toggleFullscreen(); -@@ -684,21 +692,23 @@ +@@ -681,21 +689,23 @@ File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt"); Bootstrap.printToSYSOUT(crashReportIn.getCompleteReport()); @@ -109,7 +109,7 @@ } public boolean isUnicode() -@@ -886,11 +896,6 @@ +@@ -883,11 +893,6 @@ public void displayGuiScreen(GuiScreen guiScreenIn) { @@ -121,7 +121,7 @@ if (guiScreenIn == null && this.theWorld == null) { guiScreenIn = new GuiMainMenu(); -@@ -900,6 +905,17 @@ +@@ -897,6 +902,17 @@ guiScreenIn = new GuiGameOver(); } @@ -139,7 +139,7 @@ if (guiScreenIn instanceof GuiMainMenu) { this.gameSettings.showDebugInfo = false; -@@ -1033,9 +1049,11 @@ +@@ -1030,9 +1046,11 @@ if (!this.skipRenderWorld) { @@ -151,7 +151,7 @@ } this.mcProfiler.endSection(); -@@ -1380,7 +1398,7 @@ +@@ -1377,7 +1395,7 @@ if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air && this.playerController.func_180512_c(blockpos, this.objectMouseOver.sideHit)) { @@ -160,7 +160,7 @@ this.thePlayer.swingItem(); } } -@@ -1466,15 +1484,19 @@ +@@ -1463,15 +1481,19 @@ case BLOCK: BlockPos blockpos = this.objectMouseOver.getBlockPos(); @@ -181,7 +181,7 @@ if (itemstack == null) { -@@ -1497,7 +1519,8 @@ +@@ -1494,7 +1516,8 @@ { ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem(); @@ -191,7 +191,7 @@ { this.entityRenderer.itemRenderer.resetEquippedProgress2(); } -@@ -1601,6 +1624,8 @@ +@@ -1598,6 +1621,8 @@ --this.rightClickDelayTimer; } @@ -200,7 +200,7 @@ this.mcProfiler.startSection("gui"); if (!this.isGamePaused) -@@ -1695,6 +1720,8 @@ +@@ -1690,6 +1715,8 @@ while (Mouse.next()) { @@ -209,7 +209,7 @@ int i = Mouse.getEventButton(); KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState()); -@@ -1750,6 +1777,7 @@ +@@ -1745,6 +1772,7 @@ this.currentScreen.handleMouseInput(); } } @@ -217,7 +217,7 @@ } if (this.leftClickCounter > 0) -@@ -1928,6 +1956,7 @@ +@@ -1923,6 +1951,7 @@ } } } @@ -225,7 +225,7 @@ } for (int l = 0; l < 9; ++l) -@@ -2124,12 +2153,15 @@ +@@ -2119,12 +2148,15 @@ this.myNetworkManager.processReceivedPackets(); } @@ -241,7 +241,7 @@ this.loadWorld((WorldClient)null); System.gc(); ISaveHandler isavehandler = this.saveLoader.getSaveLoader(folderName, false); -@@ -2165,6 +2197,12 @@ +@@ -2160,6 +2192,12 @@ while (!this.theIntegratedServer.serverIsInRunLoop()) { @@ -254,7 +254,7 @@ String s = this.theIntegratedServer.getUserMessage(); if (s != null) -@@ -2190,8 +2228,14 @@ +@@ -2185,8 +2223,14 @@ SocketAddress socketaddress = this.theIntegratedServer.getNetworkSystem().addLocalEndpoint(); NetworkManager networkmanager = NetworkManager.provideLocalClient(socketaddress); networkmanager.setNetHandler(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null)); @@ -271,7 +271,7 @@ this.myNetworkManager = networkmanager; } -@@ -2202,6 +2246,8 @@ +@@ -2197,6 +2241,8 @@ public void loadWorld(WorldClient worldClientIn, String loadingMessage) { @@ -280,7 +280,7 @@ if (worldClientIn == null) { NetHandlerPlayClient nethandlerplayclient = this.getNetHandler(); -@@ -2215,6 +2261,18 @@ +@@ -2210,6 +2256,18 @@ { this.theIntegratedServer.initiateShutdown(); this.theIntegratedServer.setStaticInstance(); @@ -299,7 +299,7 @@ } this.theIntegratedServer = null; -@@ -2237,6 +2295,7 @@ +@@ -2232,6 +2290,7 @@ this.ingameGUI.func_181029_i(); this.setServerData((ServerData)null); this.integratedServerIsRunning = false; @@ -307,7 +307,7 @@ } this.mcSoundHandler.stopSounds(); -@@ -2341,126 +2400,10 @@ +@@ -2336,126 +2395,10 @@ if (this.objectMouseOver != null) { boolean flag = this.thePlayer.capabilities.isCreativeMode; @@ -436,7 +436,7 @@ if (flag) { int j = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + inventoryplayer.currentItem; -@@ -2773,18 +2716,8 @@ +@@ -2756,18 +2699,8 @@ public static int getGLMaximumTextureSize() { diff --git a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch index 95f78a511..3d4c13816 100644 --- a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch +++ b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/audio/SoundManager.java +++ ../src-work/minecraft/net/minecraft/client/audio/SoundManager.java -@@ -70,6 +70,7 @@ +@@ -69,6 +69,7 @@ { SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class); SoundSystemConfig.setCodec("ogg", CodecJOrbis.class); @@ -8,7 +8,7 @@ } catch (SoundSystemException soundsystemexception) { -@@ -81,6 +82,7 @@ +@@ -80,6 +81,7 @@ { this.unloadSoundSystem(); this.loadSoundSystem(); @@ -16,7 +16,7 @@ } private synchronized void loadSoundSystem() -@@ -319,6 +321,9 @@ +@@ -316,6 +318,9 @@ } else { @@ -26,7 +26,7 @@ SoundEventAccessorComposite soundeventaccessorcomposite = this.sndHandler.getSound(sound.getSoundLocation()); if (soundeventaccessorcomposite == null) -@@ -360,10 +365,12 @@ +@@ -357,10 +362,12 @@ if (soundpoolentry.isStreamingSound()) { this.sndSystem.newStreamingSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1); diff --git a/patches/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch b/patches/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch index fe5943864..840d193e0 100644 --- a/patches/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java +++ ../src-work/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java -@@ -129,6 +129,6 @@ +@@ -128,6 +128,6 @@ f *= 1.0F - f1 * 0.15F; } diff --git a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch index 41abf7b94..42c1d4605 100644 --- a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch +++ b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/entity/EntityPlayerSP.java +++ ../src-work/minecraft/net/minecraft/client/entity/EntityPlayerSP.java -@@ -346,6 +346,15 @@ +@@ -345,6 +345,15 @@ this.mc.ingameGUI.getChatGUI().printChatMessage(chatComponent); } @@ -16,7 +16,7 @@ protected boolean pushOutOfBlocks(double x, double y, double z) { if (this.noClip) -@@ -358,30 +367,34 @@ +@@ -357,30 +366,34 @@ double d0 = x - (double)blockpos.getX(); double d1 = z - (double)blockpos.getZ(); @@ -56,7 +56,7 @@ { d2 = 1.0D - d1; i = 5; -@@ -449,6 +462,12 @@ +@@ -448,6 +461,12 @@ public void playSound(String name, float volume, float pitch) { diff --git a/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch b/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch index 16716591d..04062e634 100644 --- a/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/FontRenderer.java +++ ../src-work/minecraft/net/minecraft/client/gui/FontRenderer.java -@@ -58,7 +58,7 @@ +@@ -57,7 +57,7 @@ this.locationFontTexture = p_i1035_2_; this.renderEngine = p_i1035_3_; this.unicodeFlag = p_i1035_4_; @@ -9,7 +9,7 @@ for (int i = 0; i < 32; ++i) { -@@ -98,6 +98,7 @@ +@@ -97,6 +97,7 @@ public void onResourceManagerReload(IResourceManager resourceManager) { this.readFontTexture(); @@ -17,7 +17,7 @@ } private void readFontTexture() -@@ -106,7 +107,7 @@ +@@ -105,7 +106,7 @@ try { @@ -26,7 +26,7 @@ } catch (IOException ioexception) { -@@ -166,7 +167,7 @@ +@@ -165,7 +166,7 @@ try { @@ -35,7 +35,7 @@ inputstream.read(this.glyphWidth); } catch (IOException ioexception) -@@ -197,7 +198,7 @@ +@@ -196,7 +197,7 @@ int i = p_78266_1_ % 16 * 8; int j = p_78266_1_ / 16 * 8; int k = p_78266_2_ ? 1 : 0; @@ -44,7 +44,7 @@ int l = this.charWidth[p_78266_1_]; float f = (float)l - 0.01F; GL11.glBegin(GL11.GL_TRIANGLE_STRIP); -@@ -225,7 +226,7 @@ +@@ -224,7 +225,7 @@ private void loadGlyphTexture(int p_78257_1_) { @@ -53,7 +53,7 @@ } protected float renderUnicodeChar(char p_78277_1_, boolean p_78277_2_) -@@ -272,7 +273,7 @@ +@@ -271,7 +272,7 @@ public int drawString(String p_175065_1_, float p_175065_2_, float p_175065_3_, int p_175065_4_, boolean p_175065_5_) { @@ -62,7 +62,7 @@ this.resetStyles(); int i; -@@ -342,7 +343,7 @@ +@@ -341,7 +342,7 @@ int j1 = this.colorCode[i1]; this.textColor = j1; @@ -71,7 +71,7 @@ } else if (i1 == 16) { -@@ -371,7 +372,7 @@ +@@ -370,7 +371,7 @@ this.strikethroughStyle = false; this.underlineStyle = false; this.italicStyle = false; @@ -80,7 +80,7 @@ } ++i; -@@ -399,7 +400,7 @@ +@@ -398,7 +399,7 @@ c0 = c1; } @@ -89,7 +89,7 @@ boolean flag = (c0 == 0 || j == -1 || this.unicodeFlag) && p_78255_2_; if (flag) -@@ -437,7 +438,16 @@ +@@ -436,7 +437,16 @@ ++f; } @@ -106,7 +106,7 @@ if (this.strikethroughStyle) { Tessellator tessellator = Tessellator.getInstance(); -@@ -510,7 +520,7 @@ +@@ -509,7 +519,7 @@ this.blue = (float)(p_180455_4_ >> 8 & 255) / 255.0F; this.green = (float)(p_180455_4_ & 255) / 255.0F; this.alpha = (float)(p_180455_4_ >> 24 & 255) / 255.0F; @@ -115,7 +115,7 @@ this.posX = p_180455_2_; this.posY = p_180455_3_; this.renderStringAtPos(p_180455_1_, p_180455_5_); -@@ -589,11 +599,6 @@ +@@ -588,11 +598,6 @@ int j = this.glyphWidth[p_78263_1_] >>> 4; int k = this.glyphWidth[p_78263_1_] & 15; @@ -127,7 +127,7 @@ ++k; return (k - j) / 2 + 1; -@@ -847,6 +852,26 @@ +@@ -846,6 +851,26 @@ return this.bidiFlag; } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch index 280ace37b..ee9c09180 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch @@ -1,14 +1,14 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiButton.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiButton.java -@@ -22,6 +22,7 @@ +@@ -21,6 +21,7 @@ + public boolean enabled; public boolean visible; protected boolean hovered; - private static final String __OBFID = "CL_00000668"; + public int packedFGColour; //FML public GuiButton(int buttonId, int x, int y, String buttonText) { -@@ -75,6 +76,11 @@ +@@ -74,6 +75,11 @@ this.mouseDragged(mc, mouseX, mouseY); int j = 14737632; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch index 96f7a74eb..3b956b4e3 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiChat.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiChat.java -@@ -216,13 +216,14 @@ +@@ -215,13 +215,14 @@ this.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(stringbuilder.toString()), 1); } @@ -16,7 +16,7 @@ BlockPos blockpos = null; if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) -@@ -282,6 +283,12 @@ +@@ -281,6 +282,12 @@ this.playerNamesFound = false; this.foundPlayerNames.clear(); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch index 4cbd0e65b..2555e2a26 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java -@@ -206,6 +206,8 @@ +@@ -205,6 +205,8 @@ } } @@ -9,7 +9,7 @@ WorldSettings.GameType worldsettings$gametype = WorldSettings.GameType.getByName(this.field_146342_r); WorldSettings worldsettings = new WorldSettings(i, worldsettings$gametype, this.field_146341_s, this.field_146337_w, WorldType.worldTypes[this.selectedIndex]); worldsettings.setWorldName(this.chunkProviderSettingsJson); -@@ -313,14 +315,7 @@ +@@ -312,14 +314,7 @@ } else if (button.id == 8) { @@ -25,7 +25,7 @@ } } } -@@ -372,7 +367,7 @@ +@@ -371,7 +366,7 @@ this.btnBonusItems.visible = this.field_146344_y; this.btnMapType.visible = this.field_146344_y; this.btnAllowCommands.visible = this.field_146344_y; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch index 6d0d95970..aef607d2c 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiIngameMenu.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngameMenu.java -@@ -31,8 +31,9 @@ +@@ -30,8 +30,9 @@ this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 24 + i, I18n.format("menu.returnToGame", new Object[0]))); this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + i, 98, 20, I18n.format("menu.options", new Object[0]))); @@ -11,7 +11,7 @@ this.buttonList.add(new GuiButton(5, this.width / 2 - 100, this.height / 4 + 48 + i, 98, 20, I18n.format("gui.achievements", new Object[0]))); this.buttonList.add(new GuiButton(6, this.width / 2 + 2, this.height / 4 + 48 + i, 98, 20, I18n.format("gui.stats", new Object[0]))); guibutton.enabled = this.mc.isSingleplayer() && !this.mc.getIntegratedServer().getPublic(); -@@ -75,13 +76,19 @@ +@@ -74,13 +75,19 @@ this.mc.setIngameFocus(); break; case 5: diff --git a/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch index 67d02e78a..0eec18b3f 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiMainMenu.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiMainMenu.java -@@ -198,6 +198,11 @@ +@@ -197,6 +197,11 @@ this.buttonList.add(new GuiButton(1, this.width / 2 - 100, p_73969_1_, I18n.format("menu.singleplayer", new Object[0]))); this.buttonList.add(new GuiButton(2, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.format("menu.multiplayer", new Object[0]))); this.buttonList.add(this.realmsButton = new GuiButton(14, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.format("menu.online", new Object[0]))); @@ -12,7 +12,7 @@ } private void addDemoButtons(int p_73972_1_, int p_73972_2_) -@@ -245,6 +250,11 @@ +@@ -244,6 +249,11 @@ this.mc.shutdown(); } @@ -24,7 +24,7 @@ if (button.id == 11) { this.mc.launchIntegratedServer("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings); -@@ -490,7 +500,16 @@ +@@ -489,7 +499,16 @@ s = s + " Demo"; } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch index b4563e39b..4e8b2f3eb 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiMultiplayer.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiMultiplayer.java -@@ -41,6 +41,7 @@ +@@ -40,6 +40,7 @@ public GuiMultiplayer(GuiScreen parentScreen) { this.parentScreen = parentScreen; @@ -8,7 +8,7 @@ } public void initGui() -@@ -373,7 +374,7 @@ +@@ -372,7 +373,7 @@ private void connectToServer(ServerData server) { diff --git a/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch index c2b87f70f..73cf65cef 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java -@@ -177,6 +177,9 @@ +@@ -176,6 +176,9 @@ long l = j - k; List list = Lists.newArrayList(new String[] {String.format("Java: %s %dbit", new Object[]{System.getProperty("java.version"), Integer.valueOf(this.mc.isJava64bit() ? 64 : 32)}), String.format("Mem: % 2d%% %03d/%03dMB", new Object[]{Long.valueOf(l * 100L / i), Long.valueOf(bytesToMb(l)), Long.valueOf(bytesToMb(i))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(j * 100L / i), Long.valueOf(bytesToMb(j))}), "", String.format("CPU: %s", new Object[]{OpenGlHelper.func_183029_j()}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GL11.glGetString(GL11.GL_VENDOR)}), GL11.glGetString(GL11.GL_RENDERER), GL11.glGetString(GL11.GL_VERSION)}); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch index 37d51e97f..f97ed83fd 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiScreen.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiScreen.java -@@ -144,7 +144,8 @@ +@@ -143,7 +143,8 @@ } } @@ -10,7 +10,7 @@ } protected void drawCreativeTabHoveringText(String tabName, int mouseX, int mouseY) -@@ -154,6 +155,11 @@ +@@ -153,6 +154,11 @@ protected void drawHoveringText(List textLines, int x, int y) { @@ -22,7 +22,7 @@ if (!textLines.isEmpty()) { GlStateManager.disableRescaleNormal(); -@@ -164,7 +170,7 @@ +@@ -163,7 +169,7 @@ for (String s : textLines) { @@ -31,7 +31,7 @@ if (j > i) { -@@ -209,7 +215,7 @@ +@@ -208,7 +214,7 @@ for (int k1 = 0; k1 < textLines.size(); ++k1) { String s1 = (String)textLines.get(k1); @@ -40,7 +40,7 @@ if (k1 == 0) { -@@ -437,6 +443,7 @@ +@@ -436,6 +442,7 @@ { this.mc.ingameGUI.getChatGUI().addToSentMessages(msg); } @@ -48,7 +48,7 @@ this.mc.thePlayer.sendChatMessage(msg); } -@@ -451,9 +458,15 @@ +@@ -450,9 +457,15 @@ if (guibutton.mousePressed(this.mc, mouseX, mouseY)) { @@ -64,7 +64,7 @@ } } } -@@ -483,8 +496,12 @@ +@@ -482,8 +495,12 @@ this.fontRendererObj = mc.fontRendererObj; this.width = width; this.height = height; @@ -77,7 +77,7 @@ } public void initGui() -@@ -497,7 +514,9 @@ +@@ -496,7 +513,9 @@ { while (Mouse.next()) { @@ -87,7 +87,7 @@ } } -@@ -505,7 +524,9 @@ +@@ -504,7 +523,9 @@ { while (Keyboard.next()) { diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch index 83c8e4e05..8327deb5f 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiSelectWorld.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiSelectWorld.java -@@ -187,7 +187,7 @@ +@@ -186,7 +186,7 @@ if (this.mc.getSaveLoader().canLoadWorld(s)) { diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch index 5df4b471b..a179369e2 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiSleepMP.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiSleepMP.java -@@ -34,7 +34,7 @@ +@@ -32,7 +32,7 @@ if (!s.isEmpty()) { diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch index 422650fdf..726608794 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiSlot.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiSlot.java -@@ -182,15 +182,8 @@ +@@ -181,15 +181,8 @@ GlStateManager.disableFog(); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); @@ -18,7 +18,7 @@ int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2; int l = this.top + 4 - (int)this.amountScrolled; -@@ -459,4 +452,18 @@ +@@ -458,4 +451,18 @@ { return this.slotHeight; } diff --git a/patches/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch b/patches/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch index 559859f08..658585c9c 100644 --- a/patches/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java +++ ../src-work/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java -@@ -84,7 +84,7 @@ +@@ -82,7 +82,7 @@ boolean flag1 = this.field_148301_e.version < 47; boolean flag2 = flag || flag1; this.field_148300_d.fontRendererObj.drawString(this.field_148301_e.serverName, x + 32 + 3, y + 1, 16777215); @@ -9,7 +9,7 @@ for (int i = 0; i < Math.min(list.size(), 2); ++i) { -@@ -178,6 +178,11 @@ +@@ -176,6 +176,11 @@ int i1 = mouseX - x; int j1 = mouseY - y; diff --git a/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch b/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch index 6551b16eb..44c399134 100644 --- a/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java +++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java -@@ -50,6 +50,10 @@ +@@ -49,6 +49,10 @@ + private StatFileWriter statFileWriter; private boolean loadingAchievements = true; - private static final String __OBFID = "CL_00000722"; + private int currentPage = -1; + private GuiButton button; @@ -11,7 +11,7 @@ public GuiAchievements(GuiScreen p_i45026_1_, StatFileWriter p_i45026_2_) { this.parentScreen = p_i45026_1_; -@@ -58,6 +62,14 @@ +@@ -57,6 +61,14 @@ int j = 141; this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.openInventory.displayColumn * 24 - i / 2 - 12); this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.openInventory.displayRow * 24 - j / 2); @@ -26,7 +26,7 @@ } public void initGui() -@@ -65,6 +77,7 @@ +@@ -64,6 +76,7 @@ this.mc.getNetHandler().addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.REQUEST_STATS)); this.buttonList.clear(); this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, I18n.format("gui.done", new Object[0]))); @@ -34,7 +34,7 @@ } protected void actionPerformed(GuiButton button) throws IOException -@@ -75,6 +88,16 @@ +@@ -74,6 +87,16 @@ { this.mc.displayGuiScreen(this.parentScreen); } @@ -51,7 +51,7 @@ } } -@@ -258,7 +281,9 @@ +@@ -257,7 +280,9 @@ GlStateManager.depthFunc(518); GlStateManager.pushMatrix(); GlStateManager.translate((float)i1, (float)j1, -200.0F); @@ -62,7 +62,7 @@ GlStateManager.enableTexture2D(); GlStateManager.disableLighting(); GlStateManager.enableRescaleNormal(); -@@ -332,11 +357,12 @@ +@@ -331,11 +356,12 @@ GlStateManager.depthFunc(515); this.mc.getTextureManager().bindTexture(field_146561_C); @@ -78,7 +78,7 @@ { int k5 = achievement1.displayColumn * 24 - i + 11; int l5 = achievement1.displayRow * 24 - j + 11; -@@ -390,9 +416,9 @@ +@@ -389,9 +415,9 @@ GlStateManager.enableRescaleNormal(); GlStateManager.enableColorMaterial(); @@ -90,7 +90,7 @@ int l6 = achievement2.displayColumn * 24 - i; int j7 = achievement2.displayRow * 24 - j; -@@ -433,6 +459,7 @@ +@@ -432,6 +458,7 @@ this.mc.getTextureManager().bindTexture(field_146561_C); @@ -98,7 +98,7 @@ if (achievement2.getSpecial()) { this.drawTexturedModalRect(l6 - 2, j7 - 2, 26, 202, 26, 26); -@@ -441,6 +468,7 @@ +@@ -440,6 +467,7 @@ { this.drawTexturedModalRect(l6 - 2, j7 - 2, 0, 202, 26, 26); } @@ -106,7 +106,7 @@ if (!this.statFileWriter.canUnlockAchievement(achievement2)) { -@@ -449,7 +477,7 @@ +@@ -448,7 +476,7 @@ this.itemRender.func_175039_a(false); } diff --git a/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch b/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch index 04f8f99be..fd6bcf0ba 100644 --- a/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiStats.java +++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiStats.java -@@ -759,7 +759,7 @@ +@@ -748,7 +748,7 @@ super(mcIn, GuiStats.this.width, GuiStats.this.height, 32, GuiStats.this.height - 64, GuiStats.this.fontRendererObj.FONT_HEIGHT * 4); this.setShowSelectionBox(false); @@ -9,7 +9,7 @@ { if (GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151512_d) > 0 || GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151513_e) > 0) { -@@ -795,7 +795,7 @@ +@@ -784,7 +784,7 @@ protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int p_180791_5_, int p_180791_6_) { EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)this.field_148222_l.get(entryID); diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch index b5535336b..52bb89b7e 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java +++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java -@@ -176,8 +176,11 @@ +@@ -175,8 +175,11 @@ GlStateManager.translate(0.0F, 0.0F, 32.0F); this.zLevel = 200.0F; this.itemRender.zLevel = 200.0F; @@ -13,7 +13,7 @@ this.zLevel = 0.0F; this.itemRender.zLevel = 0.0F; } -@@ -240,13 +243,12 @@ +@@ -239,13 +242,12 @@ if (itemstack == null) { @@ -30,7 +30,7 @@ this.drawTexturedModalRect(i, j, textureatlassprite, 16, 16); GlStateManager.enableLighting(); flag1 = true; -@@ -464,6 +466,7 @@ +@@ -463,6 +465,7 @@ protected void mouseReleased(int mouseX, int mouseY, int state) { @@ -38,7 +38,7 @@ Slot slot = this.getSlotAtPosition(mouseX, mouseY); int i = this.guiLeft; int j = this.guiTop; -@@ -686,4 +689,16 @@ +@@ -685,4 +688,16 @@ this.mc.thePlayer.closeScreen(); } } diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch index 89e9b7caa..6ae29806b 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java +++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java -@@ -49,6 +49,8 @@ +@@ -48,6 +48,8 @@ + private Slot field_147064_C; private boolean field_147057_D; private CreativeCrafting field_147059_E; - private static final String __OBFID = "CL_00000752"; + private static int tabPage = 0; + private int maxPages = 0; public GuiContainerCreative(EntityPlayer p_i1088_1_) { -@@ -176,7 +178,7 @@ +@@ -175,7 +177,7 @@ return; } @@ -18,7 +18,7 @@ { if (clickedButton == 0) { -@@ -260,6 +262,13 @@ +@@ -259,6 +261,13 @@ this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[i]); this.field_147059_E = new CreativeCrafting(this.mc); this.mc.thePlayer.inventoryContainer.addCraftingToCrafters(this.field_147059_E); @@ -32,7 +32,7 @@ } else { -@@ -281,7 +290,7 @@ +@@ -280,7 +289,7 @@ protected void keyTyped(char typedChar, int keyCode) throws IOException { @@ -41,7 +41,7 @@ { if (GameSettings.isKeyDown(this.mc.gameSettings.keyBindChat)) { -@@ -319,6 +328,14 @@ +@@ -318,6 +327,14 @@ GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; guicontainercreative$containercreative.itemList.clear(); @@ -56,7 +56,7 @@ for (Item item : Item.itemRegistry) { if (item != null && item.getCreativeTab() != null) -@@ -326,7 +343,13 @@ +@@ -325,7 +342,13 @@ item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList); } } @@ -70,7 +70,7 @@ for (Enchantment enchantment : Enchantment.enchantmentsBookList) { if (enchantment != null && enchantment.type != null) -@@ -334,7 +357,6 @@ +@@ -333,7 +356,6 @@ Items.enchanted_book.getAll(enchantment, guicontainercreative$containercreative.itemList); } } @@ -78,7 +78,7 @@ Iterator iterator = guicontainercreative$containercreative.itemList.iterator(); String s1 = this.searchField.getText().toLowerCase(); -@@ -366,7 +388,7 @@ +@@ -365,7 +387,7 @@ { CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; @@ -87,7 +87,7 @@ { GlStateManager.disableBlend(); this.fontRendererObj.drawString(I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]), 8, 6, 4210752); -@@ -401,7 +423,7 @@ +@@ -400,7 +422,7 @@ for (CreativeTabs creativetabs : CreativeTabs.creativeTabArray) { @@ -96,7 +96,7 @@ { this.setCurrentCreativeTab(creativetabs); return; -@@ -414,11 +436,13 @@ +@@ -413,11 +435,13 @@ private boolean needsScrollBars() { @@ -110,7 +110,7 @@ int i = selectedTabIndex; selectedTabIndex = p_147050_1_.getTabIndex(); GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; -@@ -484,12 +508,14 @@ +@@ -483,12 +507,14 @@ if (this.searchField != null) { @@ -126,7 +126,7 @@ this.updateCreativeSearch(); } else -@@ -559,20 +585,43 @@ +@@ -558,20 +584,43 @@ } super.drawScreen(mouseX, mouseY, partialTicks); @@ -171,7 +171,7 @@ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableLighting(); } -@@ -634,16 +683,35 @@ +@@ -633,16 +682,35 @@ RenderHelper.enableGUIStandardItemLighting(); CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; @@ -208,7 +208,7 @@ this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.getBackgroundImageName())); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); this.searchField.drawTextBox(); -@@ -658,6 +726,14 @@ +@@ -657,6 +725,14 @@ this.drawTexturedModalRect(i, j + (int)((float)(k - j - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15); } @@ -223,7 +223,7 @@ this.func_147051_a(creativetabs); if (creativetabs == CreativeTabs.tabInventory) -@@ -668,6 +744,14 @@ +@@ -667,6 +743,14 @@ protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_) { @@ -238,7 +238,7 @@ int i = p_147049_1_.getTabColumn(); int j = 28 * i; int k = 0; -@@ -764,6 +848,8 @@ +@@ -763,6 +847,8 @@ } GlStateManager.disableLighting(); @@ -247,7 +247,7 @@ this.drawTexturedModalRect(l, i1, j, k, 28, j1); this.zLevel = 100.0F; this.itemRender.zLevel = 100.0F; -@@ -790,6 +876,15 @@ +@@ -789,6 +875,15 @@ { this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter())); } diff --git a/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch b/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch index ed3cab955..5b0a3f1d0 100644 --- a/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch +++ b/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch @@ -8,7 +8,7 @@ public class ModelBox { private PositionTextureVertex[] vertexPositions; -@@ -82,6 +81,7 @@ +@@ -81,6 +80,7 @@ } } diff --git a/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch b/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch index d27fe0f0e..2e3e1f197 100644 --- a/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch @@ -8,7 +8,7 @@ public class ModelRenderer { public float textureWidth; -@@ -110,6 +109,7 @@ +@@ -109,6 +108,7 @@ this.rotationPointZ = p_78793_3_; } @@ -16,7 +16,7 @@ public void render(float p_78785_1_) { if (!this.isHidden) -@@ -191,6 +191,7 @@ +@@ -190,6 +190,7 @@ } } @@ -24,7 +24,7 @@ public void renderWithRotation(float p_78791_1_) { if (!this.isHidden) -@@ -226,6 +227,7 @@ +@@ -225,6 +226,7 @@ } } @@ -32,7 +32,7 @@ public void postRender(float p_78794_1_) { if (!this.isHidden) -@@ -267,6 +269,7 @@ +@@ -266,6 +268,7 @@ } } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch index faf4f9779..dd87a5fdd 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java +++ ../src-work/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java -@@ -56,6 +56,7 @@ +@@ -55,6 +55,7 @@ Chunk chunk = new Chunk(this.worldObj, p_73158_1_, p_73158_2_); this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_), chunk); this.chunkListing.add(chunk); diff --git a/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch index 76efc616e..d19712b43 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java +++ ../src-work/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java -@@ -69,7 +69,7 @@ +@@ -67,7 +67,7 @@ inetaddress = InetAddress.getByName(ip); GuiConnecting.this.networkManager = NetworkManager.func_181124_a(inetaddress, port, GuiConnecting.this.mc.gameSettings.func_181148_f()); GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen)); diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch index 64893d581..4193c9878 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java +++ ../src-work/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java -@@ -112,6 +112,12 @@ +@@ -111,6 +111,12 @@ } } @@ -13,7 +13,7 @@ if (this.currentGameType.isCreative() && this.mc.thePlayer.getHeldItem() != null && this.mc.thePlayer.getHeldItem().getItem() instanceof ItemSword) { return false; -@@ -129,7 +135,7 @@ +@@ -128,7 +134,7 @@ else { world.playAuxSFX(2001, pos, Block.getStateId(iblockstate)); @@ -22,7 +22,7 @@ if (flag) { -@@ -357,11 +363,19 @@ +@@ -356,11 +362,19 @@ { if (this.currentGameType != WorldSettings.GameType.SPECTATOR) { @@ -44,7 +44,7 @@ } if (!flag && p_178890_3_ != null && p_178890_3_.getItem() instanceof ItemBlock) -@@ -394,7 +408,9 @@ +@@ -393,7 +407,9 @@ } else { @@ -55,7 +55,7 @@ } } else -@@ -421,9 +437,10 @@ +@@ -420,9 +436,10 @@ { playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = itemstack; diff --git a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch index c96066c54..a0e81d054 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/multiplayer/WorldClient.java +++ ../src-work/minecraft/net/minecraft/client/multiplayer/WorldClient.java -@@ -53,12 +53,13 @@ +@@ -52,12 +52,13 @@ super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), WorldProvider.getProviderForDimension(p_i45063_3_), p_i45063_5_, true); this.sendQueue = p_i45063_1_; this.getWorldInfo().setDifficulty(p_i45063_4_); diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch index c84d9a2d2..e1acbc07d 100644 --- a/patches/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch +++ b/patches/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java +++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java -@@ -24,6 +24,7 @@ +@@ -23,6 +23,7 @@ public void processHandshake(C00Handshake packetIn) { diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch index 540435e48..2c10876e5 100644 --- a/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch +++ b/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java +++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java -@@ -106,7 +106,10 @@ +@@ -104,7 +104,10 @@ { this.gameProfile = packetIn.getProfile(); this.networkManager.setConnectionState(EnumConnectionState.PLAY); diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch index 5fefba49c..6a68a7639 100644 --- a/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch +++ b/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java +++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java -@@ -247,7 +247,7 @@ +@@ -246,7 +246,7 @@ { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); this.gameController.playerController = new PlayerControllerMP(this.gameController, this); @@ -9,7 +9,7 @@ this.gameController.gameSettings.difficulty = packetIn.getDifficulty(); this.gameController.loadWorld(this.clientWorldController); this.gameController.thePlayer.dimension = packetIn.getDimension(); -@@ -751,14 +751,16 @@ +@@ -750,14 +750,16 @@ public void handleChat(S02PacketChat packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); @@ -28,7 +28,7 @@ } } -@@ -809,6 +811,11 @@ +@@ -808,6 +810,11 @@ float f = (float)(packetIn.func_149028_l() * 360) / 256.0F; float f1 = (float)(packetIn.func_149030_m() * 360) / 256.0F; EntityLivingBase entitylivingbase = (EntityLivingBase)EntityList.createEntityByID(packetIn.func_149025_e(), this.gameController.theWorld); @@ -40,7 +40,7 @@ entitylivingbase.serverPosX = packetIn.func_149023_f(); entitylivingbase.serverPosY = packetIn.func_149034_g(); entitylivingbase.serverPosZ = packetIn.func_149029_h(); -@@ -1134,6 +1141,10 @@ +@@ -1133,6 +1140,10 @@ { tileentity.readFromNBT(packetIn.getNbtCompound()); } @@ -51,7 +51,7 @@ } } -@@ -1342,7 +1353,7 @@ +@@ -1341,7 +1352,7 @@ if (entity instanceof EntityLivingBase) { diff --git a/patches/minecraft/net/minecraft/client/network/OldServerPinger.java.patch b/patches/minecraft/net/minecraft/client/network/OldServerPinger.java.patch index ffc495966..5631206e3 100644 --- a/patches/minecraft/net/minecraft/client/network/OldServerPinger.java.patch +++ b/patches/minecraft/net/minecraft/client/network/OldServerPinger.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/network/OldServerPinger.java +++ ../src-work/minecraft/net/minecraft/client/network/OldServerPinger.java -@@ -152,6 +152,7 @@ +@@ -150,6 +150,7 @@ server.setBase64EncodedIconData((String)null); } diff --git a/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch index 3de2c7f1a..3acadd6a8 100644 --- a/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/particle/EffectRenderer.java +++ ../src-work/minecraft/net/minecraft/client/particle/EffectRenderer.java -@@ -134,6 +134,7 @@ +@@ -133,6 +133,7 @@ public void addEffect(EntityFX p_78873_1_) { @@ -8,7 +8,7 @@ int i = p_78873_1_.getFXLayer(); int j = p_78873_1_.func_174838_j() != 1.0F ? 0 : 1; -@@ -356,7 +357,7 @@ +@@ -351,7 +352,7 @@ public void func_180533_a(BlockPos p_180533_1_, IBlockState p_180533_2_) { @@ -17,7 +17,7 @@ { p_180533_2_ = p_180533_2_.getBlock().getActualState(p_180533_2_, this.worldObj, p_180533_1_); int i = 4; -@@ -462,4 +463,13 @@ +@@ -457,4 +458,13 @@ return "" + i; } diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch index 9a78c5a86..39f2cb169 100644 --- a/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java -@@ -536,8 +536,19 @@ +@@ -533,8 +533,19 @@ @SideOnly(Side.CLIENT) public static enum EnumNeighborInfo { diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch index 75aa0918a..af6ec831d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/BlockModelShapes.java +++ ../src-work/minecraft/net/minecraft/client/renderer/BlockModelShapes.java -@@ -317,5 +317,6 @@ +@@ -309,5 +309,6 @@ return new ModelResourceLocation(s + "_double_slab", s1); } }); diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch index 5890b09e3..ab5266c3f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch @@ -8,8 +8,8 @@ + private final BlockModelRenderer blockModelRenderer = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(); private final ChestRenderer chestRenderer = new ChestRenderer(); private final BlockFluidRenderer fluidRenderer = new BlockFluidRenderer(); - private static final String __OBFID = "CL_00002520"; -@@ -49,6 +49,24 @@ + +@@ -48,6 +48,24 @@ { p_175020_1_ = block.getActualState(p_175020_1_, p_175020_4_, p_175020_2_); IBakedModel ibakedmodel = this.blockModelShapes.getModelForState(p_175020_1_); @@ -34,7 +34,7 @@ IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(ibakedmodel, p_175020_3_)).makeBakedModel(); this.blockModelRenderer.renderModel(p_175020_4_, ibakedmodel1, p_175020_1_, p_175020_2_, Tessellator.getInstance().getWorldRenderer()); } -@@ -129,6 +147,12 @@ +@@ -128,6 +146,12 @@ ibakedmodel = ((WeightedBakedModel)ibakedmodel).getAlternativeModel(MathHelper.getPositionRandom(p_175022_3_)); } diff --git a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch index 0cae971c7..6195c804c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/EntityRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/EntityRenderer.java -@@ -423,7 +423,7 @@ +@@ -419,7 +419,7 @@ if (d3 < d2 || d2 == 0.0D) { @@ -9,7 +9,7 @@ { if (d2 == 0.0D) { -@@ -580,14 +580,8 @@ +@@ -576,14 +576,8 @@ { BlockPos blockpos = new BlockPos(entity); IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); @@ -25,7 +25,7 @@ GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_78467_1_ + 180.0F, 0.0F, -1.0F, 0.0F); GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_78467_1_, -1.0F, 0.0F, 0.0F); } -@@ -654,17 +648,20 @@ +@@ -650,17 +644,20 @@ if (!this.mc.gameSettings.debugCamEnable) { @@ -53,7 +53,7 @@ } GlStateManager.translate(0.0F, -f, 0.0F); -@@ -1107,7 +1104,7 @@ +@@ -1103,7 +1100,7 @@ try { @@ -62,7 +62,7 @@ } catch (Throwable throwable) { -@@ -1171,7 +1168,7 @@ +@@ -1164,7 +1161,7 @@ if (this.mc.playerController.getCurrentGameType() == WorldSettings.GameType.SPECTATOR) { @@ -71,7 +71,7 @@ } else { -@@ -1321,7 +1318,9 @@ +@@ -1314,7 +1311,9 @@ GlStateManager.pushMatrix(); RenderHelper.enableStandardItemLighting(); this.mc.mcProfiler.endStartSection("entities"); @@ -81,7 +81,7 @@ RenderHelper.disableStandardItemLighting(); this.disableLightmap(); GlStateManager.matrixMode(5888); -@@ -1333,6 +1332,7 @@ +@@ -1326,6 +1325,7 @@ EntityPlayer entityplayer = (EntityPlayer)entity; GlStateManager.disableAlpha(); this.mc.mcProfiler.endStartSection("outline"); @@ -89,7 +89,7 @@ renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); GlStateManager.enableAlpha(); } -@@ -1346,6 +1346,7 @@ +@@ -1339,6 +1339,7 @@ EntityPlayer entityplayer1 = (EntityPlayer)entity; GlStateManager.disableAlpha(); this.mc.mcProfiler.endStartSection("outline"); @@ -97,7 +97,7 @@ renderglobal.drawSelectionBox(entityplayer1, this.mc.objectMouseOver, 0, partialTicks); GlStateManager.enableAlpha(); } -@@ -1387,6 +1388,15 @@ +@@ -1380,6 +1381,15 @@ GlStateManager.shadeModel(7425); this.mc.mcProfiler.endStartSection("translucent"); renderglobal.renderBlockLayer(EnumWorldBlockLayer.TRANSLUCENT, (double)partialTicks, pass, entity); @@ -113,7 +113,7 @@ GlStateManager.shadeModel(7424); GlStateManager.depthMask(true); GlStateManager.enableCull(); -@@ -1399,8 +1409,12 @@ +@@ -1392,8 +1402,12 @@ this.renderCloudsCheck(renderglobal, partialTicks, pass); } @@ -126,7 +126,7 @@ if (this.renderHand) { GlStateManager.clear(256); -@@ -1512,6 +1526,13 @@ +@@ -1505,6 +1519,13 @@ protected void renderRainSnow(float partialTicks) { @@ -140,7 +140,7 @@ float f = this.mc.theWorld.getRainStrength(partialTicks); if (f > 0.0F) -@@ -1837,6 +1858,13 @@ +@@ -1830,6 +1851,13 @@ this.fogColorBlue = f7; } @@ -154,7 +154,7 @@ GlStateManager.clearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F); } -@@ -1855,6 +1883,10 @@ +@@ -1848,6 +1876,10 @@ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); @@ -165,7 +165,7 @@ if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.blindness)) { float f1 = 5.0F; -@@ -1932,6 +1964,7 @@ +@@ -1925,6 +1957,7 @@ GlStateManager.setFogStart(f * 0.05F); GlStateManager.setFogEnd(Math.min(f, 192.0F) * 0.5F); } diff --git a/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch index 9d58872a6..54170de87 100644 --- a/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java -@@ -81,6 +81,8 @@ +@@ -80,6 +80,8 @@ this.drawTexturedModalRect(i + 6, j + 7, 0 + i1 % 8 * 18, 198 + i1 / 8 * 18, 18, 18); } diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch index 22fe8c9af..deb8b5987 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/ItemModelMesher.java +++ ../src-work/minecraft/net/minecraft/client/renderer/ItemModelMesher.java -@@ -51,6 +51,11 @@ +@@ -50,6 +50,11 @@ } } diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch index 09748f96f..601dcb350 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/ItemRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/ItemRenderer.java -@@ -314,7 +314,7 @@ +@@ -313,7 +313,7 @@ if (this.itemToRender != null) { @@ -9,7 +9,7 @@ { this.func_178097_a(abstractclientplayer, f2, f, f1); } -@@ -366,6 +366,7 @@ +@@ -365,6 +365,7 @@ if (this.mc.thePlayer.isEntityInsideOpaqueBlock()) { IBlockState iblockstate = this.mc.theWorld.getBlockState(new BlockPos(this.mc.thePlayer)); @@ -17,7 +17,7 @@ EntityPlayer entityplayer = this.mc.thePlayer; for (int i = 0; i < 8; ++i) -@@ -379,11 +380,13 @@ +@@ -378,11 +379,13 @@ if (iblockstate1.getBlock().isVisuallyOpaque()) { iblockstate = iblockstate1; @@ -31,7 +31,7 @@ this.func_178108_a(p_78447_1_, this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate)); } } -@@ -392,11 +395,13 @@ +@@ -391,11 +394,13 @@ { if (this.mc.thePlayer.isInsideOfMaterial(Material.water)) { @@ -45,7 +45,7 @@ this.renderFireInFirstPerson(p_78447_1_); } } -@@ -513,6 +518,12 @@ +@@ -512,6 +517,12 @@ { if (!this.itemToRender.getIsItemStackEqual(itemstack)) { diff --git a/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch b/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch index b6bded7ef..385023ab0 100644 --- a/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/OpenGlHelper.java +++ ../src-work/minecraft/net/minecraft/client/renderer/OpenGlHelper.java -@@ -84,6 +84,10 @@ +@@ -83,6 +83,10 @@ + public static int GL_ARRAY_BUFFER; public static int GL_STATIC_DRAW; - private static final String __OBFID = "CL_00001179"; + /* Stores the last values sent into setLightmapTextureCoords */ + public static float lastBrightnessX = 0.0f; @@ -11,7 +11,7 @@ public static void initializeTextures() { ContextCapabilities contextcapabilities = GLContext.getCapabilities(); -@@ -844,6 +848,12 @@ +@@ -843,6 +847,12 @@ { GL13.glMultiTexCoord2f(p_77475_0_, p_77475_1_, p_77475_2_); } diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch index 4f94ca678..b16266d6c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/RenderGlobal.java +++ ../src-work/minecraft/net/minecraft/client/renderer/RenderGlobal.java -@@ -526,8 +526,10 @@ +@@ -525,8 +525,10 @@ public void renderEntities(Entity p_180446_1_, ICamera p_180446_2_, float partialTicks) { @@ -11,7 +11,7 @@ --this.renderEntitiesStartupCounter; } else -@@ -538,9 +540,12 @@ +@@ -537,9 +539,12 @@ this.theWorld.theProfiler.startSection("prepare"); TileEntityRendererDispatcher.instance.cacheActiveRenderInfo(this.theWorld, this.mc.getTextureManager(), this.mc.fontRendererObj, this.mc.getRenderViewEntity(), partialTicks); this.renderManager.cacheActiveRenderInfo(this.theWorld, this.mc.fontRendererObj, this.mc.getRenderViewEntity(), this.mc.pointedEntity, this.mc.gameSettings, partialTicks); @@ -24,7 +24,7 @@ Entity entity = this.mc.getRenderViewEntity(); double d3 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; double d4 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; -@@ -552,11 +557,15 @@ +@@ -551,11 +556,15 @@ this.mc.entityRenderer.enableLightmap(); this.theWorld.theProfiler.endStartSection("global"); List list = this.theWorld.getLoadedEntityList(); @@ -40,7 +40,7 @@ ++this.countEntitiesRendered; if (entity1.isInRangeToRender3d(d0, d1, d2)) -@@ -578,6 +587,7 @@ +@@ -577,6 +586,7 @@ for (int j = 0; j < list.size(); ++j) { Entity entity3 = (Entity)list.get(j); @@ -48,7 +48,7 @@ boolean flag = this.mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping(); boolean flag1 = entity3.isInRangeToRender3d(d0, d1, d2) && (entity3.ignoreFrustumCheck || p_180446_2_.isBoundingBoxInFrustum(entity3.getEntityBoundingBox()) || entity3.riddenByEntity == this.mc.thePlayer) && entity3 instanceof EntityPlayer; -@@ -627,6 +637,7 @@ +@@ -626,6 +636,7 @@ } entity2 = (Entity)iterator.next(); @@ -56,7 +56,7 @@ flag2 = this.renderManager.shouldRender(entity2, p_180446_2_, d0, d1, d2) || entity2.riddenByEntity == this.mc.thePlayer; if (!flag2) -@@ -663,6 +674,7 @@ +@@ -662,6 +673,7 @@ { for (TileEntity tileentity2 : list1) { @@ -64,7 +64,7 @@ TileEntityRendererDispatcher.instance.renderTileEntity(tileentity2, partialTicks, -1); } } -@@ -672,6 +684,7 @@ +@@ -671,6 +683,7 @@ { for (TileEntity tileentity : this.field_181024_n) { @@ -72,7 +72,7 @@ TileEntityRendererDispatcher.instance.renderTileEntity(tileentity, partialTicks, -1); } } -@@ -701,7 +714,7 @@ +@@ -700,7 +713,7 @@ Block block = this.theWorld.getBlockState(blockpos).getBlock(); @@ -81,7 +81,7 @@ { TileEntityRendererDispatcher.instance.renderTileEntity(tileentity1, partialTicks, destroyblockprogress.getPartialBlockDamage()); } -@@ -1162,6 +1175,12 @@ +@@ -1161,6 +1174,12 @@ public void renderSky(float partialTicks, int pass) { @@ -94,7 +94,7 @@ if (this.mc.theWorld.provider.getDimensionId() == 1) { this.renderSkyEnd(); -@@ -1379,6 +1398,12 @@ +@@ -1378,6 +1397,12 @@ public void renderClouds(float p_180447_1_, int p_180447_2_) { @@ -107,7 +107,7 @@ if (this.mc.theWorld.provider.isSurfaceWorld()) { if (this.mc.gameSettings.func_181147_e() == 2) -@@ -1794,8 +1819,11 @@ +@@ -1793,8 +1818,11 @@ double d4 = (double)blockpos.getY() - d1; double d5 = (double)blockpos.getZ() - d2; Block block = this.theWorld.getBlockState(blockpos).getBlock(); @@ -120,7 +120,7 @@ { if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) { -@@ -1950,13 +1978,16 @@ +@@ -1949,13 +1977,16 @@ if (recordName != null) { ItemRecord itemrecord = ItemRecord.getRecord(recordName); diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch index 4741c65e3..4e597ab6f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/WorldRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/WorldRenderer.java -@@ -580,6 +580,11 @@ +@@ -578,6 +578,11 @@ } } diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch b/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch index 598b85363..2551f52b9 100644 --- a/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java +++ ../src-work/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java -@@ -25,32 +25,9 @@ +@@ -23,32 +23,9 @@ for (int j = 0; j < list.size(); ++j) { @@ -35,7 +35,7 @@ } GL11.glDrawArrays(p_181679_1_.getDrawMode(), 0, p_181679_1_.getVertexCount()); -@@ -59,26 +36,8 @@ +@@ -57,26 +34,8 @@ for (int j1 = list.size(); i1 < j1; ++i1) { VertexFormatElement vertexformatelement1 = (VertexFormatElement)list.get(i1); diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch index 646e52fff..a26f6c4b9 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java -@@ -21,6 +21,11 @@ +@@ -20,6 +20,11 @@ public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) { @@ -12,7 +12,7 @@ int[] aint = this.makeQuadVertexData(face, sprite, facing, this.getPositionsDiv16(posFrom, posTo), modelRotationIn, partRotation, uvLocked, shade); EnumFacing enumfacing = getFacingFromVertexData(aint); -@@ -34,11 +39,17 @@ +@@ -33,11 +38,17 @@ this.func_178408_a(aint, enumfacing); } @@ -30,7 +30,7 @@ int[] aint = new int[28]; for (int i = 0; i < 4; ++i) -@@ -89,7 +100,12 @@ +@@ -88,7 +99,12 @@ private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) { @@ -44,7 +44,7 @@ int i = shade ? this.getFaceShadeColor(enumfacing) : -1; EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = EnumFaceDirection.getFacing(facing).func_179025_a(vertexIndex); Vector3f vector3f = new Vector3f(p_178402_5_[enumfacedirection$vertexinformation.field_179184_a], p_178402_5_[enumfacedirection$vertexinformation.field_179182_b], p_178402_5_[enumfacedirection$vertexinformation.field_179183_c]); -@@ -155,14 +171,19 @@ +@@ -154,14 +170,19 @@ public int rotateVertex(Vector3f position, EnumFacing facing, int vertexIndex, ModelRotation modelRotationIn, boolean uvLocked) { diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch index 25284acf7..f336ff667 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java -@@ -30,7 +30,7 @@ +@@ -29,7 +29,7 @@ public static ModelBlockDefinition parseFromReader(Reader p_178331_0_) { @@ -9,7 +9,7 @@ } public ModelBlockDefinition(Collection p_i46221_1_) -@@ -160,11 +160,17 @@ +@@ -155,11 +155,17 @@ return this.modelLocation; } diff --git a/patches/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch index dc720dc0a..8bc0885c1 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java -@@ -39,7 +39,7 @@ +@@ -38,7 +38,7 @@ } else { diff --git a/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch b/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch index cc3b5a373..2703427da 100644 --- a/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java +++ ../src-work/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java -@@ -132,7 +132,7 @@ +@@ -131,7 +131,7 @@ return; } @@ -9,7 +9,7 @@ p_178581_4_.setCompiledChunk(compiledchunk); } finally -@@ -159,7 +159,7 @@ +@@ -158,7 +158,7 @@ lvt_10_1_.func_178606_a(blockpos$mutableblockpos); } @@ -18,7 +18,7 @@ { TileEntity tileentity = iblockaccess.getTileEntity(new BlockPos(blockpos$mutableblockpos)); TileEntitySpecialRenderer tileentityspecialrenderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(tileentity); -@@ -175,7 +175,9 @@ +@@ -174,7 +174,9 @@ } } @@ -29,7 +29,7 @@ int j = enumworldblocklayer1.ordinal(); if (block.getRenderType() != -1) -@@ -190,6 +192,7 @@ +@@ -189,6 +191,7 @@ aboolean[j] |= blockrendererdispatcher.renderBlock(iblockstate, blockpos$mutableblockpos, iblockaccess, worldrenderer); } @@ -37,7 +37,7 @@ } for (EnumWorldBlockLayer enumworldblocklayer : EnumWorldBlockLayer.values()) -@@ -386,6 +389,26 @@ +@@ -385,6 +388,26 @@ return this.needsUpdate; } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch index 3e67a9229..2025f1404 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java -@@ -42,7 +42,7 @@ +@@ -41,7 +41,7 @@ boolean flag = p_177077_9_.isGui3d(); int i = this.func_177078_a(itemstack); float f = 0.25F; @@ -9,7 +9,7 @@ float f2 = p_177077_9_.getItemCameraTransforms().func_181688_b(ItemCameraTransforms.TransformType.GROUND).scale.y; GlStateManager.translate((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_); -@@ -158,4 +158,25 @@ +@@ -157,4 +157,25 @@ { return TextureMap.locationBlocksTexture; } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch index 4539a84eb..79fc448ff 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderItem.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderItem.java -@@ -73,7 +73,7 @@ +@@ -72,7 +72,7 @@ public RenderItem(TextureManager textureManager, ModelManager modelManager) { this.textureManager = textureManager; @@ -9,7 +9,7 @@ this.registerItems(); } -@@ -227,7 +227,7 @@ +@@ -226,7 +226,7 @@ k = k | -16777216; } @@ -18,7 +18,7 @@ } } -@@ -297,6 +297,11 @@ +@@ -296,6 +296,11 @@ modelresourcelocation = new ModelResourceLocation("bow_pulling_0", "inventory"); } } @@ -30,7 +30,7 @@ if (modelresourcelocation != null) { -@@ -318,14 +323,9 @@ +@@ -317,14 +322,9 @@ GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.pushMatrix(); @@ -47,7 +47,7 @@ this.renderItem(stack, model); GlStateManager.cullFace(1029); GlStateManager.popMatrix(); -@@ -353,7 +353,7 @@ +@@ -352,7 +352,7 @@ GlStateManager.blendFunc(770, 771); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.setupGuiTransform(x, y, ibakedmodel.isGui3d()); @@ -56,7 +56,7 @@ this.renderItem(stack, ibakedmodel); GlStateManager.disableAlpha(); GlStateManager.disableRescaleNormal(); -@@ -464,10 +464,11 @@ +@@ -459,10 +459,11 @@ GlStateManager.enableDepth(); } @@ -71,7 +71,7 @@ GlStateManager.disableLighting(); GlStateManager.disableDepth(); GlStateManager.disableTexture2D(); -@@ -478,7 +479,7 @@ +@@ -473,7 +474,7 @@ this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255); this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 12, 1, (255 - i) / 4, 64, 0, 255); this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, j, 1, 255 - i, i, 0, 255); @@ -80,7 +80,7 @@ GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); GlStateManager.enableLighting(); -@@ -1048,6 +1049,7 @@ +@@ -1038,6 +1039,7 @@ this.registerBlock(Blocks.brown_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "brown_mushroom_block"); this.registerBlock(Blocks.red_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "red_mushroom_block"); this.registerBlock(Blocks.dragon_egg, "dragon_egg"); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch index 17df82b6b..7513d3e08 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java -@@ -194,6 +194,10 @@ +@@ -193,6 +193,10 @@ this.skinMap.put("default", this.field_178637_m); this.skinMap.put("slim", new RenderPlayer(this, true)); } @@ -11,7 +11,7 @@ public void setRenderPosition(double p_178628_1_, double p_178628_3_, double p_178628_5_) { -@@ -242,9 +246,9 @@ +@@ -241,9 +245,9 @@ IBlockState iblockstate = worldIn.getBlockState(new BlockPos(p_180597_3_)); Block block = iblockstate.getBlock(); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch index d00961be8..af5f1e424 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java -@@ -50,6 +50,7 @@ +@@ -49,6 +49,7 @@ public void doRender(AbstractClientPlayer entity, double x, double y, double z, float p_76986_8_, float partialTicks) { @@ -8,7 +8,7 @@ if (!entity.isUser() || this.renderManager.livingPlayer == entity) { double d0 = y; -@@ -62,6 +63,7 @@ +@@ -61,6 +62,7 @@ this.func_177137_d(entity); super.doRender(entity, x, d0, z, p_76986_8_, partialTicks); } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch index 8441ac0fd..e4a92b81b 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java -@@ -45,7 +45,7 @@ +@@ -44,7 +44,7 @@ case 4: return butcherVillagerTextures; default: diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch index e18e068cd..e45eb4648 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java -@@ -39,6 +39,9 @@ +@@ -38,6 +38,9 @@ + protected List> layerRenderers = Lists.>newArrayList(); protected boolean renderOutlines = false; - private static final String __OBFID = "CL_00001012"; + public static float NAME_TAG_RANGE = 64.0f; + public static float NAME_TAG_RANGE_SNEAK = 32.0f; @@ -10,7 +10,7 @@ public RendererLivingEntity(RenderManager p_i46156_1_, ModelBase p_i46156_2_, float p_i46156_3_) { super(p_i46156_1_); -@@ -84,6 +87,7 @@ +@@ -83,6 +86,7 @@ public void doRender(T entity, double x, double y, double z, float p_76986_8_, float partialTicks) { @@ -18,7 +18,7 @@ GlStateManager.pushMatrix(); GlStateManager.disableCull(); this.mainModel.swingProgress = this.getSwingProgress(entity, partialTicks); -@@ -192,6 +196,7 @@ +@@ -191,6 +195,7 @@ { super.doRender(entity, x, y, z, p_76986_8_, partialTicks); } @@ -26,7 +26,7 @@ } protected boolean func_177088_c(T p_177088_1_) -@@ -470,10 +475,11 @@ +@@ -469,10 +474,11 @@ public void renderName(T entity, double x, double y, double z) { @@ -39,7 +39,7 @@ if (d0 < (double)(f * f)) { -@@ -519,6 +525,7 @@ +@@ -518,6 +524,7 @@ } } } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch index 49f5846e7..b87eb4a6c 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java -@@ -56,28 +56,28 @@ +@@ -55,28 +55,28 @@ T t = this.func_177175_a(p_177182_9_); t.setModelAttributes(this.field_177190_a.getMainModel()); t.setLivingAnimations(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_4_); @@ -39,7 +39,7 @@ if (!this.field_177193_i && itemstack.isItemEnchanted()) { this.func_177183_a(p_177182_1_, t, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); -@@ -136,11 +136,13 @@ +@@ -135,11 +135,13 @@ GlStateManager.disableBlend(); } @@ -53,7 +53,7 @@ private ResourceLocation getArmorResource(ItemArmor p_177178_1_, boolean p_177178_2_, String p_177178_3_) { String s = String.format("textures/models/armor/%s_layer_%d%s.png", new Object[] {p_177178_1_.getArmorMaterial().getName(), Integer.valueOf(p_177178_2_ ? 2 : 1), p_177178_3_ == null ? "" : String.format("_%s", new Object[]{p_177178_3_})}); -@@ -158,4 +160,49 @@ +@@ -157,4 +159,49 @@ protected abstract void func_177177_a(); protected abstract void func_177179_a(T p_177179_1_, int p_177179_2_); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch index 9990cb44a..50001b770 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java -@@ -51,4 +51,10 @@ +@@ -49,4 +49,10 @@ { p_177194_1_.setInvisible(false); } 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 6d226df92..fdbf34c9e 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/texture/Stitcher.java +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/Stitcher.java -@@ -59,12 +59,17 @@ +@@ -58,12 +58,17 @@ { Stitcher.Holder[] astitcher$holder = (Stitcher.Holder[])this.setStitchHolders.toArray(new Stitcher.Holder[this.setStitchHolders.size()]); Arrays.sort((Object[])astitcher$holder); @@ -18,7 +18,7 @@ throw new StitcherException(stitcher$holder, s); } } -@@ -74,6 +79,7 @@ +@@ -73,6 +78,7 @@ this.currentWidth = MathHelper.roundUpToPowerOfTwo(this.currentWidth); this.currentHeight = MathHelper.roundUpToPowerOfTwo(this.currentHeight); } @@ -26,7 +26,7 @@ } public List getStichSlots() -@@ -262,7 +268,7 @@ +@@ -260,7 +266,7 @@ public String toString() { 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 f003a0c92..fb734bf69 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java -@@ -404,4 +404,30 @@ +@@ -402,4 +402,30 @@ { return "TextureAtlasSprite{name=\'" + this.iconName + '\'' + ", frameCount=" + this.framesTextureData.size() + ", rotated=" + this.rotated + ", x=" + this.originX + ", y=" + this.originY + ", height=" + this.height + ", width=" + this.width + ", u0=" + this.minU + ", u1=" + this.maxU + ", v0=" + this.minV + ", v1=" + this.maxV + '}'; } 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 94c0bb386..62022a2a2 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureManager.java +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureManager.java -@@ -139,9 +139,12 @@ +@@ -137,9 +137,12 @@ public void onResourceManagerReload(IResourceManager resourceManager) { diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index 1c6f3e180..340072044 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -8,15 +8,15 @@ private static final Logger logger = LogManager.getLogger(); public static final ResourceLocation LOCATION_MISSING_TEXTURE = new ResourceLocation("missingno"); public static final ResourceLocation locationBlocksTexture = new ResourceLocation("textures/atlas/blocks.png"); -@@ -39,6 +40,7 @@ +@@ -38,6 +39,7 @@ + private final IIconCreator iconCreator; private int mipmapLevels; private final TextureAtlasSprite missingImage; - private static final String __OBFID = "CL_00001058"; + private boolean skipFirst = false; public TextureMap(String p_i46099_1_) { -@@ -47,12 +49,23 @@ +@@ -46,12 +48,23 @@ public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn) { @@ -40,7 +40,7 @@ } private void initMissingImage() -@@ -91,12 +104,28 @@ +@@ -90,12 +103,28 @@ int j = Integer.MAX_VALUE; int k = 1 << this.mipmapLevels; @@ -69,7 +69,7 @@ try { IResource iresource = resourceManager.getResource(resourcelocation1); -@@ -146,12 +175,14 @@ +@@ -145,12 +174,14 @@ } catch (RuntimeException runtimeexception) { @@ -86,7 +86,7 @@ continue; } -@@ -167,6 +198,7 @@ +@@ -166,6 +197,7 @@ stitcher.addSprite(textureatlassprite); } @@ -94,7 +94,7 @@ int j1 = Math.min(j, k); int k1 = MathHelper.calculateLogBaseTwo(j1); -@@ -176,8 +208,10 @@ +@@ -175,8 +207,10 @@ this.mipmapLevels = k1; } @@ -105,7 +105,7 @@ try { textureatlassprite1.generateMipmaps(this.mipmapLevels); -@@ -217,9 +251,13 @@ +@@ -213,9 +247,13 @@ this.missingImage.generateMipmaps(this.mipmapLevels); stitcher.addSprite(this.missingImage); @@ -119,7 +119,7 @@ stitcher.doStitch(); } catch (StitcherException stitcherexception) -@@ -228,9 +266,11 @@ +@@ -224,9 +262,11 @@ } logger.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.getCurrentWidth()), Integer.valueOf(stitcher.getCurrentHeight()), this.basePath}); @@ -131,7 +131,7 @@ for (TextureAtlasSprite textureatlassprite2 : stitcher.getStichSlots()) { String s = textureatlassprite2.getIconName(); -@@ -260,6 +300,13 @@ +@@ -256,6 +296,13 @@ { textureatlassprite3.copyFrom(this.missingImage); } @@ -145,7 +145,7 @@ } private ResourceLocation completeResourceLocation(ResourceLocation location, int p_147634_2_) -@@ -323,4 +370,37 @@ +@@ -319,4 +366,37 @@ { return this.missingImage; } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch index 12794639e..d067a7ffb 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java -@@ -198,9 +198,11 @@ +@@ -197,9 +197,11 @@ public static void allocateTextureImpl(int p_180600_0_, int p_180600_1_, int p_180600_2_, int p_180600_3_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch index 2522c7399..d05ff8ac8 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java +++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java -@@ -100,15 +100,18 @@ +@@ -99,15 +99,18 @@ GlStateManager.disableLighting(); int i = p_82402_1_.getRotation(); @@ -21,7 +21,7 @@ this.renderManager.renderEngine.bindTexture(mapBackgroundTextures); GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); float f = 0.0078125F; -@@ -166,6 +169,7 @@ +@@ -165,6 +168,7 @@ textureatlassprite.updateAnimation(); } } diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch index 9137aa309..9de0c31ca 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java -@@ -79,6 +79,7 @@ +@@ -78,6 +78,7 @@ { TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147718_c, 0.0D, 0.0D, 0.0D, 0.0F); } 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 de4aa6880..c51b7af57 100644 --- a/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java +++ ../src-work/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java -@@ -144,10 +144,17 @@ +@@ -142,10 +142,17 @@ NORMAL("Normal"), COLOR("Vertex Color"), UV("UV"), @@ -17,5 +17,5 @@ + public void postDraw(VertexFormat format, int element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.postDraw(this, format, element, stride, buffer); } + private final String displayName; - private static final String __OBFID = "CL_00002397"; + private EnumUsage(String p_i46094_3_) diff --git a/patches/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch b/patches/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch index a013cf1da..2e4117099 100644 --- a/patches/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/resources/AbstractResourcePack.java +++ ../src-work/minecraft/net/minecraft/client/resources/AbstractResourcePack.java -@@ -59,7 +59,7 @@ +@@ -58,7 +58,7 @@ protected void logNameNotLowercase(String p_110594_1_) { diff --git a/patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch b/patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch index 9ec768b73..f80172ba7 100644 --- a/patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/resources/FallbackResourceManager.java +++ ../src-work/minecraft/net/minecraft/client/resources/FallbackResourceManager.java -@@ -68,6 +68,7 @@ +@@ -67,6 +67,7 @@ throw new FileNotFoundException(p_110536_1_.toString()); } diff --git a/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch b/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch index 65bab8982..fa44d5f1b 100644 --- a/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/resources/LanguageManager.java +++ ../src-work/minecraft/net/minecraft/client/resources/LanguageManager.java -@@ -74,6 +74,7 @@ +@@ -73,6 +73,7 @@ } currentLocale.loadLocaleDataFiles(resourceManager, list); diff --git a/patches/minecraft/net/minecraft/client/resources/Locale.java.patch b/patches/minecraft/net/minecraft/client/resources/Locale.java.patch index 874f7383f..c6fcea8cd 100644 --- a/patches/minecraft/net/minecraft/client/resources/Locale.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/Locale.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/resources/Locale.java +++ ../src-work/minecraft/net/minecraft/client/resources/Locale.java -@@ -96,6 +96,8 @@ +@@ -95,6 +95,8 @@ private void loadLocaleData(InputStream p_135021_1_) throws IOException { diff --git a/patches/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch b/patches/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch index 66047fe57..9859bbc84 100644 --- a/patches/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch @@ -1,14 +1,14 @@ --- ../src-base/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java +++ ../src-work/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java -@@ -93,6 +93,7 @@ +@@ -92,6 +92,7 @@ public void reloadResources(List p_110541_1_) { this.clearResources(); + net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Loading Resources", p_110541_1_.size()+1, true); logger.info("Reloading ResourceManager: " + joinerResourcePacks.join(Iterables.transform(p_110541_1_, new Function() { - private static final String __OBFID = "CL_00001092"; -@@ -104,23 +105,32 @@ + public String apply(IResourcePack p_apply_1_) +@@ -102,23 +103,32 @@ for (IResourcePack iresourcepack : p_110541_1_) { diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch index 3755c0653..16b116a9f 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/resources/model/ModelBakery.java +++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelBakery.java -@@ -115,7 +115,7 @@ +@@ -114,7 +114,7 @@ } catch (Exception var6) { @@ -9,7 +9,7 @@ } } catch (Exception exception) -@@ -161,6 +161,7 @@ +@@ -160,6 +160,7 @@ } } } @@ -17,7 +17,7 @@ catch (IOException ioexception) { throw new RuntimeException("Encountered an exception when loading model definition of model " + resourcelocation.toString(), ioexception); -@@ -295,6 +296,7 @@ +@@ -294,6 +295,7 @@ protected void registerVariantNames() { @@ -25,7 +25,7 @@ this.variantNames.put(Item.getItemFromBlock(Blocks.stone), Lists.newArrayList(new String[] {"stone", "granite", "granite_smooth", "diorite", "diorite_smooth", "andesite", "andesite_smooth"})); this.variantNames.put(Item.getItemFromBlock(Blocks.dirt), Lists.newArrayList(new String[] {"dirt", "coarse_dirt", "podzol"})); this.variantNames.put(Item.getItemFromBlock(Blocks.planks), Lists.newArrayList(new String[] {"oak_planks", "spruce_planks", "birch_planks", "jungle_planks", "acacia_planks", "dark_oak_planks"})); -@@ -337,6 +339,10 @@ +@@ -336,6 +338,10 @@ this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence_gate), Lists.newArrayList(new String[] {"oak_fence_gate"})); this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence), Lists.newArrayList(new String[] {"oak_fence"})); this.variantNames.put(Items.oak_door, Lists.newArrayList(new String[] {"oak_door"})); @@ -36,7 +36,7 @@ } protected List getVariantNames(Item p_177596_1_) -@@ -455,6 +461,11 @@ +@@ -453,6 +459,11 @@ private IBakedModel bakeModel(ModelBlock modelBlockIn, ModelRotation modelRotationIn, boolean uvLocked) { @@ -48,7 +48,7 @@ TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName("particle"))); SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(modelBlockIn)).setTexture(textureatlassprite); -@@ -465,13 +476,13 @@ +@@ -463,13 +474,13 @@ BlockPartFace blockpartface = (BlockPartFace)blockpart.mapFaces.get(enumfacing); TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName(blockpartface.texture))); @@ -64,7 +64,7 @@ } } } -@@ -481,6 +492,11 @@ +@@ -479,6 +490,11 @@ private BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_) { @@ -76,7 +76,7 @@ return this.faceBakery.makeBakedQuad(p_177589_1_.positionFrom, p_177589_1_.positionTo, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.partRotation, p_177589_6_, p_177589_1_.shade); } -@@ -725,4 +741,19 @@ +@@ -722,4 +738,19 @@ MODEL_CLOCK.name = "class generation marker"; MODEL_ENTITY.name = "block entity marker"; } diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch index cdc1701f2..62b6e2b6e 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/resources/model/ModelManager.java +++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelManager.java -@@ -25,9 +25,10 @@ +@@ -24,9 +24,10 @@ public void onResourceManagerReload(IResourceManager resourceManager) { diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch index b32056ee8..33a8da83d 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch @@ -9,7 +9,7 @@ { X0_Y0(0, 0), X0_Y90(0, 90), -@@ -117,4 +117,9 @@ +@@ -116,4 +116,9 @@ mapRotations.put(Integer.valueOf(modelrotation.combinedXY), modelrotation); } } diff --git a/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch b/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch index 8255b2b57..1b0f54267 100644 --- a/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch +++ b/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/settings/GameSettings.java +++ ../src-work/minecraft/net/minecraft/client/settings/GameSettings.java -@@ -983,6 +983,7 @@ +@@ -981,6 +981,7 @@ public void saveOptions() { diff --git a/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch b/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch index c8627e9df..ec5e56034 100644 --- a/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch +++ b/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/shader/Framebuffer.java +++ ../src-work/minecraft/net/minecraft/client/shader/Framebuffer.java -@@ -120,8 +120,17 @@ +@@ -119,8 +119,17 @@ if (this.useDepth) { OpenGlHelper.glBindRenderbuffer(OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); @@ -18,7 +18,7 @@ } this.framebufferClear(); -@@ -281,4 +290,36 @@ +@@ -280,4 +289,36 @@ GlStateManager.clear(i); this.unbindFramebuffer(); } diff --git a/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch b/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch index d32116092..630385eaa 100644 --- a/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch +++ b/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/command/CommandEnchant.java +++ ../src-work/minecraft/net/minecraft/command/CommandEnchant.java -@@ -95,7 +95,7 @@ +@@ -93,7 +93,7 @@ { Enchantment enchantment2 = Enchantment.getEnchantmentById(l); diff --git a/patches/minecraft/net/minecraft/command/CommandFill.java.patch b/patches/minecraft/net/minecraft/command/CommandFill.java.patch index 8e20f9235..777a3d061 100644 --- a/patches/minecraft/net/minecraft/command/CommandFill.java.patch +++ b/patches/minecraft/net/minecraft/command/CommandFill.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/command/CommandFill.java +++ ../src-work/minecraft/net/minecraft/command/CommandFill.java -@@ -50,6 +50,7 @@ +@@ -48,6 +48,7 @@ { i = parseInt(args[7], 0, 15); } @@ -8,7 +8,7 @@ BlockPos blockpos2 = new BlockPos(Math.min(blockpos.getX(), blockpos1.getX()), Math.min(blockpos.getY(), blockpos1.getY()), Math.min(blockpos.getZ(), blockpos1.getZ())); BlockPos blockpos3 = new BlockPos(Math.max(blockpos.getX(), blockpos1.getX()), Math.max(blockpos.getY(), blockpos1.getY()), Math.max(blockpos.getZ(), blockpos1.getZ())); -@@ -77,7 +78,7 @@ +@@ -75,7 +76,7 @@ NBTTagCompound nbttagcompound = new NBTTagCompound(); boolean flag = false; @@ -17,7 +17,7 @@ { String s = getChatComponentFromNthArg(sender, args, 9).getUnformattedText(); -@@ -118,7 +119,7 @@ +@@ -116,7 +117,7 @@ continue; } } diff --git a/patches/minecraft/net/minecraft/command/CommandHandler.java.patch b/patches/minecraft/net/minecraft/command/CommandHandler.java.patch index 5f0607c6e..3d877eba8 100644 --- a/patches/minecraft/net/minecraft/command/CommandHandler.java.patch +++ b/patches/minecraft/net/minecraft/command/CommandHandler.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/command/CommandHandler.java +++ ../src-work/minecraft/net/minecraft/command/CommandHandler.java -@@ -45,6 +45,16 @@ +@@ -44,6 +44,16 @@ } else if (icommand.canCommandSenderUse(sender)) { diff --git a/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch b/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch index 44ccb6290..b67266339 100644 --- a/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch +++ b/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/command/server/CommandSetBlock.java +++ ../src-work/minecraft/net/minecraft/command/server/CommandSetBlock.java -@@ -54,6 +54,8 @@ +@@ -52,6 +52,8 @@ i = parseInt(args[4], 0, 15); } @@ -9,7 +9,7 @@ World world = sender.getEntityWorld(); if (!world.isBlockLoaded(blockpos)) -@@ -65,7 +67,7 @@ +@@ -63,7 +65,7 @@ NBTTagCompound nbttagcompound = new NBTTagCompound(); boolean flag = false; diff --git a/patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch b/patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch index 69ac8d584..be6dce538 100644 --- a/patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch +++ b/patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/command/server/CommandTestForBlock.java +++ ../src-work/minecraft/net/minecraft/command/server/CommandTestForBlock.java -@@ -72,7 +72,7 @@ +@@ -70,7 +70,7 @@ NBTTagCompound nbttagcompound = new NBTTagCompound(); boolean flag = false; diff --git a/patches/minecraft/net/minecraft/crash/CrashReport.java.patch b/patches/minecraft/net/minecraft/crash/CrashReport.java.patch index 60537445f..2ad18820d 100644 --- a/patches/minecraft/net/minecraft/crash/CrashReport.java.patch +++ b/patches/minecraft/net/minecraft/crash/CrashReport.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/crash/CrashReport.java +++ ../src-work/minecraft/net/minecraft/crash/CrashReport.java -@@ -123,6 +123,7 @@ +@@ -115,6 +115,7 @@ return IntCache.getCacheSizes(); } }); @@ -8,7 +8,7 @@ } public String getDescription() -@@ -211,6 +212,8 @@ +@@ -203,6 +204,8 @@ { StringBuilder stringbuilder = new StringBuilder(); stringbuilder.append("---- Minecraft Crash Report ----\n"); diff --git a/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch b/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch index 6df8dd809..3918b6866 100644 --- a/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch +++ b/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/crash/CrashReportCategory.java +++ ../src-work/minecraft/net/minecraft/crash/CrashReportCategory.java -@@ -118,8 +118,11 @@ +@@ -117,8 +117,11 @@ } else { diff --git a/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch b/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch index a9a51a63f..83ecfbcea 100644 --- a/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch +++ b/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/creativetab/CreativeTabs.java +++ ../src-work/minecraft/net/minecraft/creativetab/CreativeTabs.java -@@ -138,8 +138,22 @@ +@@ -125,8 +125,22 @@ + @SideOnly(Side.CLIENT) private ItemStack iconItemStack; - private static final String __OBFID = "CL_00000005"; + public CreativeTabs(String label) + { @@ -23,7 +23,7 @@ this.tabIndex = index; this.tabLabel = label; creativeTabArray[index] = this; -@@ -222,12 +236,20 @@ +@@ -209,12 +223,20 @@ @SideOnly(Side.CLIENT) public int getTabColumn() { @@ -44,7 +44,7 @@ return this.tabIndex < 6; } -@@ -269,10 +291,17 @@ +@@ -256,10 +278,17 @@ { for (Item item : Item.itemRegistry) { @@ -64,7 +64,7 @@ } if (this.getRelevantEnchantmentTypes() != null) -@@ -305,4 +334,39 @@ +@@ -292,4 +321,39 @@ } } } diff --git a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch index 556e26af0..f3dc07bd2 100644 --- a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/enchantment/Enchantment.java +++ ../src-work/minecraft/net/minecraft/enchantment/Enchantment.java -@@ -62,7 +62,7 @@ +@@ -61,7 +61,7 @@ if (enchantmentsList[enchID] != null) { @@ -9,7 +9,7 @@ } else { -@@ -140,7 +140,7 @@ +@@ -139,7 +139,7 @@ public boolean canApply(ItemStack stack) { @@ -18,7 +18,7 @@ } public void onEntityDamaged(EntityLivingBase user, Entity target, int level) -@@ -151,6 +151,45 @@ +@@ -150,6 +150,45 @@ { } diff --git a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch index b9e79d5c7..7632c6c5d 100644 --- a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/enchantment/EnchantmentHelper.java +++ ../src-work/minecraft/net/minecraft/enchantment/EnchantmentHelper.java -@@ -297,7 +297,7 @@ +@@ -296,7 +296,7 @@ public static int calcItemStackEnchantability(Random p_77514_0_, int p_77514_1_, int p_77514_2_, ItemStack p_77514_3_) { Item item = p_77514_3_.getItem(); @@ -9,7 +9,7 @@ if (i <= 0) { -@@ -346,7 +346,7 @@ +@@ -345,7 +345,7 @@ public static List buildEnchantmentList(Random p_77513_0_, ItemStack p_77513_1_, int p_77513_2_) { Item item = p_77513_1_.getItem(); @@ -18,7 +18,7 @@ if (i <= 0) { -@@ -388,7 +388,9 @@ +@@ -387,7 +387,9 @@ for (EnchantmentData enchantmentdata1 : list) { @@ -29,7 +29,7 @@ { flag = false; break; -@@ -422,7 +424,8 @@ +@@ -421,7 +423,8 @@ for (Enchantment enchantment : Enchantment.enchantmentsBookList) { diff --git a/patches/minecraft/net/minecraft/entity/Entity.java.patch b/patches/minecraft/net/minecraft/entity/Entity.java.patch index befb40446..e19b11f4d 100644 --- a/patches/minecraft/net/minecraft/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/entity/Entity.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/entity/Entity.java +++ ../src-work/minecraft/net/minecraft/entity/Entity.java -@@ -130,6 +130,14 @@ +@@ -129,6 +129,14 @@ + protected UUID entityUniqueID; private final CommandResultStats cmdResultStats; - private static final String __OBFID = "CL_00001533"; + /** Forge: Used to store custom data for each entity. */ + private NBTTagCompound customEntityData; @@ -15,7 +15,7 @@ public int getEntityId() { return this.entityId; -@@ -173,6 +181,8 @@ +@@ -172,6 +180,8 @@ this.dataWatcher.addObject(2, ""); this.dataWatcher.addObject(4, Byte.valueOf((byte)0)); this.entityInit(); @@ -24,7 +24,7 @@ } protected abstract void entityInit(); -@@ -999,10 +1009,7 @@ +@@ -998,10 +1008,7 @@ if (block.getMaterial() == materialIn) { @@ -36,7 +36,7 @@ } else { -@@ -1357,6 +1364,21 @@ +@@ -1356,6 +1363,21 @@ tagCompund.setBoolean("Silent", this.isSilent()); } @@ -58,7 +58,7 @@ this.writeEntityToNBT(tagCompund); if (this.ridingEntity != null) -@@ -1439,6 +1461,28 @@ +@@ -1438,6 +1460,28 @@ this.setAlwaysRenderNameTag(tagCompund.getBoolean("CustomNameVisible")); this.cmdResultStats.func_179668_a(tagCompund); this.setSilent(tagCompund.getBoolean("Silent")); @@ -87,7 +87,7 @@ this.readEntityFromNBT(tagCompund); if (this.shouldSetPosAfterLoading()) -@@ -1513,7 +1557,10 @@ +@@ -1512,7 +1556,10 @@ { EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)offsetY, this.posZ, itemStackIn); entityitem.setDefaultPickupDelay(); @@ -99,7 +99,7 @@ return entityitem; } else -@@ -1656,6 +1703,7 @@ +@@ -1655,6 +1702,7 @@ public void mountEntity(Entity entityIn) { @@ -107,7 +107,7 @@ this.entityRiderPitchDelta = 0.0D; this.entityRiderYawDelta = 0.0D; -@@ -1790,7 +1838,7 @@ +@@ -1789,7 +1837,7 @@ public boolean isRiding() { @@ -116,7 +116,7 @@ } public boolean isSneaking() -@@ -2093,7 +2141,7 @@ +@@ -2092,7 +2140,7 @@ public float getExplosionResistance(Explosion p_180428_1_, World worldIn, BlockPos p_180428_3_, IBlockState p_180428_4_) { @@ -125,7 +125,7 @@ } public boolean func_174816_a(Explosion p_174816_1_, World worldIn, BlockPos p_174816_3_, IBlockState p_174816_4_, float p_174816_5_) -@@ -2358,4 +2406,184 @@ +@@ -2353,4 +2401,184 @@ EnchantmentHelper.func_151385_b(p_174815_1_, p_174815_2_); } diff --git a/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch b/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch index a9cab8a70..e064546a1 100644 --- a/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityHanging.java +++ ../src-work/minecraft/net/minecraft/entity/EntityHanging.java -@@ -124,6 +124,9 @@ +@@ -123,6 +123,9 @@ { BlockPos blockpos1 = blockpos.offset(enumfacing, k).up(l); Block block = this.worldObj.getBlockState(blockpos1).getBlock(); diff --git a/patches/minecraft/net/minecraft/entity/EntityList.java.patch b/patches/minecraft/net/minecraft/entity/EntityList.java.patch index 2aacbb3d6..ed5935e63 100644 --- a/patches/minecraft/net/minecraft/entity/EntityList.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityList.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityList.java +++ ../src-work/minecraft/net/minecraft/entity/EntityList.java -@@ -89,6 +89,7 @@ +@@ -88,6 +88,7 @@ public static void addMapping(Class p_75618_0_, String p_75618_1_, int p_75618_2_) { @@ -8,7 +8,7 @@ if (stringToClassMapping.containsKey(p_75618_1_)) { throw new IllegalArgumentException("ID is already registered: " + p_75618_1_); -@@ -152,9 +153,10 @@ +@@ -151,9 +152,10 @@ p_75615_0_.removeTag("Type"); } @@ -20,7 +20,7 @@ if (oclass != null) { -@@ -168,7 +170,17 @@ +@@ -167,7 +169,17 @@ if (entity != null) { @@ -38,7 +38,7 @@ } else { -@@ -344,7 +356,9 @@ +@@ -343,7 +355,9 @@ public static class EntityEggInfo { @@ -48,7 +48,7 @@ public final int primaryColor; public final int secondaryColor; public final StatBase field_151512_d; -@@ -358,6 +372,17 @@ +@@ -356,6 +370,17 @@ this.secondaryColor = p_i1583_3_; this.field_151512_d = StatList.getStatKillEntity(this); this.field_151513_e = StatList.getStatEntityKilledBy(this); diff --git a/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch b/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch index 58f9c41d6..c5577637a 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityLiving.java +++ ../src-work/minecraft/net/minecraft/entity/EntityLiving.java -@@ -122,6 +122,7 @@ +@@ -121,6 +121,7 @@ public void setAttackTarget(EntityLivingBase p_70624_1_) { this.attackTarget = p_70624_1_; @@ -8,7 +8,7 @@ } public boolean canAttackClass(Class p_70686_1_) -@@ -499,10 +500,22 @@ +@@ -498,10 +499,22 @@ protected void despawnEntity() { @@ -31,7 +31,7 @@ else { Entity entity = this.worldObj.getClosestPlayerToEntity(this, -1.0D); -@@ -622,7 +635,6 @@ +@@ -621,7 +634,6 @@ return this.worldObj.checkNoEntityCollision(this.getEntityBoundingBox(), this) && this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(this.getEntityBoundingBox()); } diff --git a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch index e4ac69354..c528bd8cd 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java +++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java -@@ -238,7 +238,7 @@ +@@ -237,7 +237,7 @@ } } @@ -9,7 +9,7 @@ { this.mountEntity((Entity)null); } -@@ -320,7 +320,7 @@ +@@ -319,7 +319,7 @@ if (!this.worldObj.isRemote && (this.recentlyHit > 0 || this.isPlayer()) && this.func_146066_aG() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) { int i = this.getExperiencePoints(this.attackingPlayer); @@ -18,7 +18,7 @@ while (i > 0) { int j = EntityXPOrb.getXPSplit(i); -@@ -381,6 +381,7 @@ +@@ -380,6 +380,7 @@ { this.entityLivingToAttack = livingBase; this.revengeTimer = this.ticksExisted; @@ -26,7 +26,7 @@ } public EntityLivingBase getLastAttacker() -@@ -664,7 +665,6 @@ +@@ -663,7 +664,6 @@ return this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD; } @@ -34,7 +34,7 @@ public void removePotionEffectClient(int p_70618_1_) { this.activePotionsMap.remove(Integer.valueOf(p_70618_1_)); -@@ -713,6 +713,8 @@ +@@ -712,6 +712,8 @@ public void heal(float healAmount) { @@ -43,7 +43,7 @@ float f = this.getHealth(); if (f > 0.0F) -@@ -733,6 +735,7 @@ +@@ -732,6 +734,7 @@ public boolean attackEntityFrom(DamageSource source, float amount) { @@ -51,7 +51,7 @@ if (this.isEntityInvulnerable(source)) { return false; -@@ -798,9 +801,9 @@ +@@ -797,9 +800,9 @@ this.recentlyHit = 100; this.attackingPlayer = (EntityPlayer)entity; } @@ -63,7 +63,7 @@ if (entitywolf.isTamed()) { -@@ -884,6 +887,7 @@ +@@ -883,6 +886,7 @@ public void onDeath(DamageSource cause) { @@ -71,7 +71,7 @@ Entity entity = cause.getEntity(); EntityLivingBase entitylivingbase = this.func_94060_bK(); -@@ -909,6 +913,9 @@ +@@ -908,6 +912,9 @@ i = EnchantmentHelper.getLootingModifier((EntityLivingBase)entity); } @@ -81,7 +81,7 @@ if (this.func_146066_aG() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) { this.dropFewItems(this.recentlyHit > 0, i); -@@ -919,6 +926,16 @@ +@@ -918,6 +925,16 @@ this.addRandomArmor(); } } @@ -98,7 +98,7 @@ } this.worldObj.setEntityState(this, (byte)3); -@@ -973,7 +990,7 @@ +@@ -972,7 +989,7 @@ int j = MathHelper.floor_double(this.getEntityBoundingBox().minY); int k = MathHelper.floor_double(this.posZ); Block block = this.worldObj.getBlockState(new BlockPos(i, j, k)).getBlock(); @@ -107,7 +107,7 @@ } public boolean isEntityAlive() -@@ -983,6 +1000,9 @@ +@@ -982,6 +999,9 @@ public void fall(float distance, float damageMultiplier) { @@ -117,7 +117,7 @@ super.fall(distance, damageMultiplier); PotionEffect potioneffect = this.getActivePotionEffect(Potion.jump); float f = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F; -@@ -1095,6 +1115,8 @@ +@@ -1094,6 +1114,8 @@ { if (!this.isEntityInvulnerable(damageSrc)) { @@ -126,7 +126,7 @@ damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); float f = damageAmount; -@@ -1143,6 +1165,11 @@ +@@ -1142,6 +1164,11 @@ public void swingItem() { @@ -138,7 +138,7 @@ if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0) { this.swingProgressInt = -1; -@@ -1282,6 +1309,7 @@ +@@ -1281,6 +1308,7 @@ public void dismountEntity(Entity p_110145_1_) { @@ -146,7 +146,7 @@ double d0 = p_110145_1_.posX; double d1 = p_110145_1_.getEntityBoundingBox().minY + (double)p_110145_1_.height; double d2 = p_110145_1_.posZ; -@@ -1347,6 +1375,7 @@ +@@ -1346,6 +1374,7 @@ } this.isAirBorne = true; @@ -154,7 +154,7 @@ } protected void updateAITick() -@@ -1531,6 +1560,7 @@ +@@ -1530,6 +1559,7 @@ public void onUpdate() { @@ -162,7 +162,7 @@ super.onUpdate(); if (!this.worldObj.isRemote) -@@ -1819,6 +1849,7 @@ +@@ -1817,6 +1847,7 @@ public void mountEntity(Entity entityIn) { @@ -170,7 +170,7 @@ if (this.ridingEntity != null && entityIn == null) { if (!this.worldObj.isRemote) -@@ -2000,4 +2031,39 @@ +@@ -1998,4 +2029,39 @@ { this.potionsNeedUpdate = true; } diff --git a/patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch b/patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch index ad187ed62..c7d458160 100644 --- a/patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java +++ ../src-work/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java -@@ -111,6 +111,7 @@ +@@ -109,6 +109,7 @@ public boolean interactFirst(EntityPlayer playerIn) { diff --git a/patches/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch b/patches/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch index 7ca011b1c..018d2b397 100644 --- a/patches/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java +++ ../src-work/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java -@@ -45,6 +45,12 @@ +@@ -44,6 +44,12 @@ return (EntityLiving.SpawnPlacementType)field_180110_a.get(p_180109_0_); } diff --git a/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch b/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch index 3af4d3ae8..95c893a22 100644 --- a/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityTracker.java +++ ../src-work/minecraft/net/minecraft/entity/EntityTracker.java -@@ -57,6 +57,8 @@ +@@ -56,6 +56,8 @@ public void trackEntity(Entity p_72786_1_) { @@ -9,7 +9,7 @@ if (p_72786_1_ instanceof EntityPlayerMP) { this.trackEntity(p_72786_1_, 512, 2); -@@ -333,4 +335,23 @@ +@@ -331,4 +333,23 @@ } } } diff --git a/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch b/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch index 2aaa26245..324f26799 100644 --- a/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityTrackerEntry.java +++ ../src-work/minecraft/net/minecraft/entity/EntityTrackerEntry.java -@@ -380,6 +380,14 @@ +@@ -379,6 +379,14 @@ this.lastTrackedEntityMotionY = this.trackedEntity.motionY; this.motionZ = this.trackedEntity.motionZ; @@ -15,7 +15,7 @@ if (this.sendVelocityUpdates && !(packet instanceof S0FPacketSpawnMob)) { p_73117_1_.playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(this.trackedEntity.getEntityId(), this.trackedEntity.motionX, this.trackedEntity.motionY, this.trackedEntity.motionZ)); -@@ -427,12 +435,14 @@ +@@ -426,12 +434,14 @@ p_73117_1_.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(this.trackedEntity.getEntityId(), potioneffect)); } } @@ -30,7 +30,7 @@ } } } -@@ -464,6 +474,9 @@ +@@ -463,6 +473,9 @@ logger.warn("Fetching addPacket for removed entity"); } diff --git a/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch b/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch index e0e63f53c..85d012159 100644 --- a/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch @@ -1,21 +1,15 @@ --- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java +++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java -@@ -21,11 +21,14 @@ +@@ -20,6 +20,8 @@ + private double field_151497_i; private double field_151495_j; private double field_151496_k; - private static final String __OBFID = "CL_00001595"; + private int failedPathFindingPenalty = 0; + private boolean canPenalize = false; public EntityAIAttackOnCollide(EntityCreature p_i1635_1_, Class p_i1635_2_, double p_i1635_3_, boolean p_i1635_5_) { - this(p_i1635_1_, p_i1635_3_, p_i1635_5_); - this.classTarget = p_i1635_2_; -+ canPenalize = classTarget == null || !net.minecraft.entity.player.EntityPlayer.class.isAssignableFrom(classTarget); //Only enable delaying when not targeting players. - } - - public EntityAIAttackOnCollide(EntityCreature p_i1636_1_, double p_i1636_2_, boolean p_i1636_4_) -@@ -55,6 +58,19 @@ +@@ -54,6 +56,19 @@ } else { @@ -35,7 +29,7 @@ this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); return this.entityPathEntity != null; } -@@ -92,6 +108,23 @@ +@@ -91,6 +106,23 @@ this.field_151496_k = entitylivingbase.posZ; this.field_75445_i = 4 + this.attacker.getRNG().nextInt(7); diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch index 21f789a2d..dc04cfb26 100644 --- a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/boss/EntityDragon.java +++ ../src-work/minecraft/net/minecraft/entity/boss/EntityDragon.java -@@ -480,9 +480,9 @@ +@@ -479,9 +479,9 @@ BlockPos blockpos = new BlockPos(k1, l1, i2); Block block = this.worldObj.getBlockState(blockpos).getBlock(); diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch index 9cc66593e..c999b9d32 100644 --- a/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/boss/EntityWither.java +++ ../src-work/minecraft/net/minecraft/entity/boss/EntityWither.java -@@ -345,7 +345,7 @@ +@@ -343,7 +343,7 @@ BlockPos blockpos = new BlockPos(i3, k, l); Block block = this.worldObj.getBlockState(blockpos).getBlock(); diff --git a/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch b/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch index 124b743a5..662a54e4d 100644 --- a/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch +++ b/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java +++ ../src-work/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java -@@ -91,7 +91,8 @@ +@@ -90,7 +90,8 @@ for (int i = 0; i < list.size(); ++i) { Entity entity = (Entity)list.get(i); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch index b8fbabec6..2e2f47cd3 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityEnderPearl.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityEnderPearl.java -@@ -62,6 +62,9 @@ +@@ -61,6 +61,9 @@ if (entityplayermp.playerNetServerHandler.getNetworkManager().isChannelOpen() && entityplayermp.worldObj == this.worldObj && !entityplayermp.isPlayerSleeping()) { @@ -10,7 +10,7 @@ if (this.rand.nextFloat() < 0.05F && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobSpawning")) { EntityEndermite entityendermite = new EntityEndermite(this.worldObj); -@@ -75,9 +78,10 @@ +@@ -74,9 +77,10 @@ entitylivingbase.mountEntity((Entity)null); } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch index d968e63ea..a2c16df04 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityItem.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityItem.java -@@ -30,6 +30,11 @@ +@@ -29,6 +29,11 @@ + private String owner; public float hoverStart; - private static final String __OBFID = "CL_00001669"; + /** + * The maximum age of this EntityItem. The item is expired once this is reached. @@ -12,7 +12,7 @@ public EntityItem(World worldIn, double x, double y, double z) { super(worldIn); -@@ -47,6 +52,7 @@ +@@ -46,6 +51,7 @@ { this(worldIn, x, y, z); this.setEntityItemStack(stack); @@ -20,7 +20,7 @@ } protected boolean canTriggerWalking() -@@ -70,6 +76,8 @@ +@@ -69,6 +75,8 @@ public void onUpdate() { @@ -29,7 +29,7 @@ if (this.getEntityItem() == null) { this.setDead(); -@@ -130,8 +138,16 @@ +@@ -129,8 +137,16 @@ this.handleWaterMovement(); @@ -47,7 +47,7 @@ this.setDead(); } } -@@ -272,6 +288,7 @@ +@@ -271,6 +287,7 @@ tagCompound.setShort("Health", (short)((byte)this.health)); tagCompound.setShort("Age", (short)this.age); tagCompound.setShort("PickupDelay", (short)this.delayBeforeCanPickup); @@ -55,7 +55,7 @@ if (this.getThrower() != null) { -@@ -312,20 +329,23 @@ +@@ -311,20 +328,23 @@ NBTTagCompound nbttagcompound = tagCompund.getCompoundTag("Item"); this.setEntityItemStack(ItemStack.loadItemStackFromNBT(nbttagcompound)); @@ -84,7 +84,7 @@ { if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log)) { -@@ -362,6 +382,7 @@ +@@ -361,6 +381,7 @@ } } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch index 3b105563f..6a6f26cf8 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityItemFrame.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityItemFrame.java -@@ -123,7 +123,7 @@ +@@ -122,7 +122,7 @@ { if (p_110131_1_ != null) { diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch index b3961469a..48be61e48 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecart.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecart.java -@@ -51,6 +51,20 @@ +@@ -50,6 +50,20 @@ + @SideOnly(Side.CLIENT) private double velocityZ; - private static final String __OBFID = "CL_00001670"; + /* Forge: Minecart Compatibility Layer Integration. */ + public static float defaultMaxSpeedAirLateral = 0.4f; @@ -21,7 +21,7 @@ public EntityMinecart(World worldIn) { super(worldIn); -@@ -96,17 +110,19 @@ +@@ -95,17 +109,19 @@ public AxisAlignedBB getCollisionBox(Entity entityIn) { @@ -42,7 +42,7 @@ } public EntityMinecart(World worldIn, double p_i1713_2_, double p_i1713_4_, double p_i1713_6_) -@@ -310,7 +326,7 @@ +@@ -309,7 +325,7 @@ BlockPos blockpos = new BlockPos(k, l, i1); IBlockState iblockstate = this.worldObj.getBlockState(blockpos); @@ -51,7 +51,7 @@ { this.func_180460_a(blockpos, iblockstate); -@@ -349,7 +365,10 @@ +@@ -348,7 +364,10 @@ this.setRotation(this.rotationYaw, this.rotationPitch); @@ -63,7 +63,7 @@ { if (entity != this.riddenByEntity && entity.canBePushed() && entity instanceof EntityMinecart) { -@@ -368,6 +387,7 @@ +@@ -367,6 +386,7 @@ } this.handleWaterMovement(); @@ -71,7 +71,7 @@ } } -@@ -382,10 +402,21 @@ +@@ -381,10 +401,21 @@ protected void moveDerailedMinecart() { @@ -94,7 +94,7 @@ if (this.onGround) { this.motionX *= 0.5D; -@@ -393,13 +424,13 @@ +@@ -392,13 +423,13 @@ this.motionZ *= 0.5D; } @@ -112,7 +112,7 @@ } } -@@ -419,25 +450,25 @@ +@@ -418,25 +449,25 @@ flag1 = !flag; } @@ -143,7 +143,7 @@ ++this.posY; } -@@ -482,7 +513,7 @@ +@@ -481,7 +512,7 @@ } } @@ -152,7 +152,7 @@ { double d17 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); -@@ -528,20 +559,8 @@ +@@ -527,20 +558,8 @@ this.posX = d19 + d1 * d18; this.posZ = d20 + d2 * d18; this.setPosition(this.posX, this.posY, this.posZ); @@ -174,7 +174,7 @@ if (aint[0][1] != 0 && MathHelper.floor_double(this.posX) - p_180460_1_.getX() == aint[0][0] && MathHelper.floor_double(this.posZ) - p_180460_1_.getZ() == aint[0][2]) { this.setPosition(this.posX, this.posY + (double)aint[0][1], this.posZ); -@@ -578,8 +597,14 @@ +@@ -577,8 +596,14 @@ this.motionZ = d5 * (double)(i - p_180460_1_.getZ()); } @@ -190,7 +190,7 @@ double d15 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); if (d15 > 0.01D) -@@ -818,13 +843,20 @@ +@@ -817,13 +842,20 @@ public void applyEntityCollision(Entity entityIn) { @@ -212,7 +212,7 @@ { entityIn.mountEntity(this); } -@@ -870,7 +902,7 @@ +@@ -869,7 +901,7 @@ double d7 = entityIn.motionX + this.motionX; double d8 = entityIn.motionZ + this.motionZ; @@ -221,7 +221,7 @@ { this.motionX *= 0.20000000298023224D; this.motionZ *= 0.20000000298023224D; -@@ -878,7 +910,7 @@ +@@ -877,7 +909,7 @@ entityIn.motionX *= 0.949999988079071D; entityIn.motionZ *= 0.949999988079071D; } @@ -230,7 +230,7 @@ { entityIn.motionX *= 0.20000000298023224D; entityIn.motionZ *= 0.20000000298023224D; -@@ -1043,6 +1075,221 @@ +@@ -1042,6 +1074,221 @@ } } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch index eac3dfcbd..fcac570fb 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java -@@ -181,6 +181,7 @@ +@@ -180,6 +180,7 @@ public boolean interactFirst(EntityPlayer playerIn) { diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch index 729dcfd0a..e262844ee 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java -@@ -20,6 +20,7 @@ +@@ -18,6 +18,7 @@ public boolean interactFirst(EntityPlayer playerIn) { diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch index 46cb9f930..6c351329f 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java -@@ -132,6 +132,7 @@ +@@ -131,6 +131,7 @@ public boolean interactFirst(EntityPlayer playerIn) { diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch index 9b0750816..79d7a4a27 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java -@@ -55,6 +55,7 @@ +@@ -54,6 +54,7 @@ public boolean interactFirst(EntityPlayer playerIn) { diff --git a/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch index 8b2d12c33..c10781a8d 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityXPOrb.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityXPOrb.java -@@ -200,6 +200,7 @@ +@@ -199,6 +199,7 @@ { if (this.field_70532_c == 0 && entityIn.xpCooldown == 0) { diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch index 4acd59693..8946e7b58 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntityEnderman.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityEnderman.java -@@ -200,12 +200,14 @@ +@@ -198,12 +198,14 @@ protected boolean teleportTo(double p_70825_1_, double p_70825_3_, double p_70825_5_) { @@ -18,7 +18,7 @@ boolean flag = false; BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ); -@@ -366,6 +368,18 @@ +@@ -364,6 +366,18 @@ } } diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch index b68b510e8..87582d358 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java -@@ -105,6 +105,7 @@ +@@ -103,6 +103,7 @@ { this.motionY = (double)(0.42F + (float)this.getSlimeSize() * 0.1F); this.isAirBorne = true; diff --git a/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch index 9a88af07b..bb6fe2bf7 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntitySlime.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySlime.java -@@ -272,7 +272,7 @@ +@@ -271,7 +271,7 @@ BlockPos blockpos = new BlockPos(MathHelper.floor_double(this.posX), 0, MathHelper.floor_double(this.posZ)); Chunk chunk = this.worldObj.getChunkFromBlockCoords(blockpos); diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch index 717cbb1ca..085d75e65 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntityZombie.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityZombie.java -@@ -88,7 +88,7 @@ +@@ -87,7 +87,7 @@ this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(35.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); @@ -9,7 +9,7 @@ } protected void entityInit() -@@ -230,12 +230,25 @@ +@@ -229,12 +229,25 @@ entitylivingbase = (EntityLivingBase)source.getEntity(); } @@ -40,7 +40,7 @@ for (int l = 0; l < 50; ++l) { -@@ -250,7 +263,7 @@ +@@ -249,7 +262,7 @@ if (!this.worldObj.func_175636_b((double)i1, (double)j1, (double)k1, 7.0D) && this.worldObj.checkNoEntityCollision(entityzombie.getEntityBoundingBox(), entityzombie) && this.worldObj.getCollidingBoundingBoxes(entityzombie, entityzombie.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(entityzombie.getEntityBoundingBox())) { this.worldObj.spawnEntityInWorld(entityzombie); @@ -49,7 +49,7 @@ entityzombie.func_180482_a(this.worldObj.getDifficultyForLocation(new BlockPos(entityzombie)), (IEntityLivingData)null); this.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0)); entityzombie.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0)); -@@ -466,7 +479,7 @@ +@@ -465,7 +478,7 @@ if (p_180482_2_ == null) { diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch index 797d03d7d..172f84a75 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntityHorse.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntityHorse.java -@@ -1249,6 +1249,7 @@ +@@ -1247,6 +1247,7 @@ } this.jumpPower = 0.0F; diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch index f6bdbce10..17b3f0256 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch @@ -7,9 +7,9 @@ -public class EntityMooshroom extends EntityCow +public class EntityMooshroom extends EntityCow implements net.minecraftforge.common.IShearable { - private static final String __OBFID = "CL_00001645"; - -@@ -20,6 +20,7 @@ + public EntityMooshroom(World worldIn) + { +@@ -18,6 +18,7 @@ this.field_175506_bl = Blocks.mycelium; } @@ -17,7 +17,7 @@ public boolean interact(EntityPlayer player) { ItemStack itemstack = player.inventory.getCurrentItem(); -@@ -39,7 +40,7 @@ +@@ -37,7 +38,7 @@ } } @@ -26,7 +26,7 @@ { this.setDead(); this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); -@@ -79,4 +80,33 @@ +@@ -77,4 +78,33 @@ { return new EntityMooshroom(this.worldObj); } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch index 993f39518..247ecdbad 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntityOcelot.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntityOcelot.java -@@ -280,7 +280,7 @@ +@@ -279,7 +279,7 @@ Block block = this.worldObj.getBlockState(blockpos.down()).getBlock(); diff --git a/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch index 11dac9488..5252358ed 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch @@ -9,7 +9,7 @@ { private final InventoryCrafting inventoryCrafting = new InventoryCrafting(new Container() { -@@ -142,11 +142,12 @@ +@@ -140,11 +140,12 @@ } } @@ -23,7 +23,7 @@ { if (!this.worldObj.isRemote) { -@@ -329,4 +330,19 @@ +@@ -327,4 +328,19 @@ field_175514_bm.put(EnumDyeColor.RED, new float[] {0.6F, 0.2F, 0.2F}); field_175514_bm.put(EnumDyeColor.BLACK, new float[] {0.1F, 0.1F, 0.1F}); } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch index daa11a660..980be12b6 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch @@ -6,9 +6,9 @@ private InventoryBasic villagerInventory; + @Deprecated //Use VillagerRegistry private static final EntityVillager.ITradeList[][][][] DEFAULT_TRADE_LIST_MAP = new EntityVillager.ITradeList[][][][] {{{{new EntityVillager.EmeraldForItems(Items.wheat, new EntityVillager.PriceInfo(18, 22)), new EntityVillager.EmeraldForItems(Items.potato, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.EmeraldForItems(Items.carrot, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.ListItemForEmeralds(Items.bread, new EntityVillager.PriceInfo(-4, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.pumpkin), new EntityVillager.PriceInfo(8, 13)), new EntityVillager.ListItemForEmeralds(Items.pumpkin_pie, new EntityVillager.PriceInfo(-3, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.melon_block), new EntityVillager.PriceInfo(7, 12)), new EntityVillager.ListItemForEmeralds(Items.apple, new EntityVillager.PriceInfo(-5, -7))}, {new EntityVillager.ListItemForEmeralds(Items.cookie, new EntityVillager.PriceInfo(-6, -10)), new EntityVillager.ListItemForEmeralds(Items.cake, new EntityVillager.PriceInfo(1, 1))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ItemAndEmeraldToItem(Items.fish, new EntityVillager.PriceInfo(6, 6), Items.cooked_fish, new EntityVillager.PriceInfo(6, 6))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.fishing_rod, new EntityVillager.PriceInfo(7, 8))}}, {{new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.wool), new EntityVillager.PriceInfo(16, 22)), new EntityVillager.ListItemForEmeralds(Items.shears, new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 0), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 1), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 2), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 3), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 4), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 5), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 6), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 7), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 8), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 9), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 10), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 11), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 12), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 13), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 14), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 15), new EntityVillager.PriceInfo(1, 2))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.ListItemForEmeralds(Items.arrow, new EntityVillager.PriceInfo(-12, -8))}, {new EntityVillager.ListItemForEmeralds(Items.bow, new EntityVillager.PriceInfo(2, 3)), new EntityVillager.ItemAndEmeraldToItem(Item.getItemFromBlock(Blocks.gravel), new EntityVillager.PriceInfo(10, 10), Items.flint, new EntityVillager.PriceInfo(6, 10))}}}, {{{new EntityVillager.EmeraldForItems(Items.paper, new EntityVillager.PriceInfo(24, 36)), new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.EmeraldForItems(Items.book, new EntityVillager.PriceInfo(8, 10)), new EntityVillager.ListItemForEmeralds(Items.compass, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.bookshelf), new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.EmeraldForItems(Items.written_book, new EntityVillager.PriceInfo(2, 2)), new EntityVillager.ListItemForEmeralds(Items.clock, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glass), new EntityVillager.PriceInfo(-5, -3))}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListItemForEmeralds(Items.name_tag, new EntityVillager.PriceInfo(20, 22))}}}, {{{new EntityVillager.EmeraldForItems(Items.rotten_flesh, new EntityVillager.PriceInfo(36, 40)), new EntityVillager.EmeraldForItems(Items.gold_ingot, new EntityVillager.PriceInfo(8, 10))}, {new EntityVillager.ListItemForEmeralds(Items.redstone, new EntityVillager.PriceInfo(-4, -1)), new EntityVillager.ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new EntityVillager.PriceInfo(-2, -1))}, {new EntityVillager.ListItemForEmeralds(Items.ender_eye, new EntityVillager.PriceInfo(7, 11)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glowstone), new EntityVillager.PriceInfo(-3, -1))}, {new EntityVillager.ListItemForEmeralds(Items.experience_bottle, new EntityVillager.PriceInfo(3, 11))}}}, {{{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_helmet, new EntityVillager.PriceInfo(4, 6))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListItemForEmeralds(Items.iron_chestplate, new EntityVillager.PriceInfo(10, 14))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_chestplate, new EntityVillager.PriceInfo(16, 19))}, {new EntityVillager.ListItemForEmeralds(Items.chainmail_boots, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_leggings, new EntityVillager.PriceInfo(9, 11)), new EntityVillager.ListItemForEmeralds(Items.chainmail_helmet, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_chestplate, new EntityVillager.PriceInfo(11, 15))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_axe, new EntityVillager.PriceInfo(6, 8))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_sword, new EntityVillager.PriceInfo(9, 10))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_sword, new EntityVillager.PriceInfo(12, 15)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_axe, new EntityVillager.PriceInfo(9, 12))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_shovel, new EntityVillager.PriceInfo(5, 7))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_pickaxe, new EntityVillager.PriceInfo(9, 11))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_pickaxe, new EntityVillager.PriceInfo(12, 15))}}}, {{{new EntityVillager.EmeraldForItems(Items.porkchop, new EntityVillager.PriceInfo(14, 18)), new EntityVillager.EmeraldForItems(Items.chicken, new EntityVillager.PriceInfo(14, 18))}, {new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.cooked_porkchop, new EntityVillager.PriceInfo(-7, -5)), new EntityVillager.ListItemForEmeralds(Items.cooked_chicken, new EntityVillager.PriceInfo(-8, -6))}}, {{new EntityVillager.EmeraldForItems(Items.leather, new EntityVillager.PriceInfo(9, 12)), new EntityVillager.ListItemForEmeralds(Items.leather_leggings, new EntityVillager.PriceInfo(2, 4))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.leather_chestplate, new EntityVillager.PriceInfo(7, 12))}, {new EntityVillager.ListItemForEmeralds(Items.saddle, new EntityVillager.PriceInfo(8, 10))}}}}; - private static final String __OBFID = "CL_00001707"; -@@ -211,7 +212,7 @@ + public EntityVillager(World worldIn) +@@ -210,7 +211,7 @@ ItemStack itemstack = player.inventory.getCurrentItem(); boolean flag = itemstack != null && itemstack.getItem() == Items.spawn_egg; @@ -17,7 +17,7 @@ { if (!this.worldObj.isRemote && (this.buyingList == null || this.buyingList.size() > 0)) { -@@ -523,6 +524,7 @@ +@@ -522,6 +523,7 @@ private void populateBuyingList() { @@ -25,7 +25,7 @@ EntityVillager.ITradeList[][][] aentityvillager$itradelist = DEFAULT_TRADE_LIST_MAP[this.getProfession()]; if (this.careerId != 0 && this.careerLevel != 0) -@@ -636,6 +638,7 @@ +@@ -635,6 +637,7 @@ } } @@ -33,7 +33,7 @@ if (s1 != null) { ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("entity.Villager." + s1, new Object[0]); -@@ -698,7 +701,7 @@ +@@ -697,7 +700,7 @@ public IEntityLivingData func_180482_a(DifficultyInstance p_180482_1_, IEntityLivingData p_180482_2_) { p_180482_2_ = super.func_180482_a(p_180482_1_, p_180482_2_); diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index 092bc3a96..c37cc423d 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -12,7 +12,7 @@ public InventoryPlayer inventory = new InventoryPlayer(this); private InventoryEnderChest theInventoryEnderChest = new InventoryEnderChest(); public Container inventoryContainer; -@@ -176,7 +181,8 @@ +@@ -175,7 +180,8 @@ { if (this.itemInUse != null) { @@ -22,7 +22,7 @@ } this.clearItemInUse(); -@@ -200,6 +206,7 @@ +@@ -199,6 +205,7 @@ public void onUpdate() { @@ -30,7 +30,7 @@ this.noClip = this.isSpectator(); if (this.isSpectator()) -@@ -213,6 +220,14 @@ +@@ -212,6 +219,14 @@ if (itemstack == this.itemInUse) { @@ -45,7 +45,7 @@ if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0) { this.updateItemUse(itemstack, 5); -@@ -222,6 +237,7 @@ +@@ -221,6 +236,7 @@ { this.onItemUseFinish(); } @@ -53,7 +53,7 @@ } else { -@@ -267,7 +283,7 @@ +@@ -266,7 +282,7 @@ super.onUpdate(); @@ -62,7 +62,7 @@ { this.closeScreen(); this.openContainer = this.inventoryContainer; -@@ -344,6 +360,7 @@ +@@ -343,6 +359,7 @@ { this.setPosition(d3, this.posY, d4); } @@ -70,7 +70,7 @@ } public int getMaxInPortalTime() -@@ -413,11 +430,12 @@ +@@ -412,11 +429,12 @@ int i = this.itemInUse.stackSize; ItemStack itemstack = this.itemInUse.onItemUseFinish(this.worldObj, this); @@ -84,7 +84,7 @@ { this.inventory.mainInventory[this.inventory.currentItem] = null; } -@@ -477,11 +495,11 @@ +@@ -476,11 +494,11 @@ this.cameraYaw = 0.0F; this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2); @@ -98,7 +98,7 @@ } } } -@@ -611,11 +629,15 @@ +@@ -610,11 +628,15 @@ public void onDeath(DamageSource cause) { @@ -114,7 +114,7 @@ if (this.getName().equals("Notch")) { this.dropItem(new ItemStack(Items.apple, 1), true, false); -@@ -626,6 +648,9 @@ +@@ -625,6 +647,9 @@ this.inventory.dropAllItems(); } @@ -124,7 +124,7 @@ if (cause != null) { this.motionX = (double)(-MathHelper.cos((this.attackedAtYaw + this.rotationYaw) * (float)Math.PI / 180.0F) * 0.1F); -@@ -708,12 +733,25 @@ +@@ -707,12 +732,25 @@ public EntityItem dropOneItem(boolean p_71040_1_) { @@ -152,7 +152,7 @@ } public EntityItem dropItem(ItemStack droppedItem, boolean dropAround, boolean traceItem) -@@ -771,13 +809,25 @@ +@@ -770,13 +808,25 @@ public void joinEntityItemWithWorld(EntityItem p_71012_1_) { @@ -179,7 +179,7 @@ if (f > 1.0F) { int i = EnchantmentHelper.getEfficiencyModifier(this); -@@ -827,12 +877,13 @@ +@@ -826,12 +876,13 @@ f /= 5.0F; } @@ -195,7 +195,7 @@ } public void readEntityFromNBT(NBTTagCompound tagCompund) -@@ -868,6 +919,16 @@ +@@ -867,6 +918,16 @@ this.spawnForced = tagCompund.getBoolean("SpawnForced"); } @@ -212,7 +212,7 @@ this.foodStats.readNBT(tagCompund); this.capabilities.readCapabilitiesFromNBT(tagCompund); -@@ -899,6 +960,23 @@ +@@ -898,6 +959,23 @@ tagCompound.setBoolean("SpawnForced", this.spawnForced); } @@ -236,7 +236,7 @@ this.foodStats.writeNBT(tagCompound); this.capabilities.writeCapabilitiesToNBT(tagCompound); tagCompound.setTag("EnderItems", this.theInventoryEnderChest.saveInventoryToNBT()); -@@ -912,6 +990,7 @@ +@@ -911,6 +989,7 @@ public boolean attackEntityFrom(DamageSource source, float amount) { @@ -244,7 +244,7 @@ if (this.isEntityInvulnerable(source)) { return false; -@@ -1008,12 +1087,15 @@ +@@ -1007,12 +1086,15 @@ { if (!this.isEntityInvulnerable(damageSrc)) { @@ -261,7 +261,7 @@ damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); float f = damageAmount; damageAmount = Math.max(damageAmount - this.getAbsorptionAmount(), 0.0F); -@@ -1075,6 +1157,7 @@ +@@ -1074,6 +1156,7 @@ } else { @@ -269,7 +269,7 @@ ItemStack itemstack = this.getCurrentEquippedItem(); ItemStack itemstack1 = itemstack != null ? itemstack.copy() : null; -@@ -1126,7 +1209,9 @@ +@@ -1125,7 +1208,9 @@ public void destroyCurrentEquippedItem() { @@ -279,7 +279,7 @@ } public double getYOffset() -@@ -1136,6 +1221,7 @@ +@@ -1135,6 +1220,7 @@ public void attackTargetEntityWithCurrentItem(Entity targetEntity) { @@ -287,7 +287,7 @@ if (targetEntity.canAttackWithItem()) { if (!targetEntity.hitByEntity(this)) -@@ -1312,6 +1398,8 @@ +@@ -1311,6 +1397,8 @@ public EntityPlayer.EnumStatus trySleep(BlockPos bedLocation) { @@ -296,7 +296,7 @@ if (!this.worldObj.isRemote) { if (this.isPlayerSleeping() || !this.isEntityAlive()) -@@ -1353,7 +1441,7 @@ +@@ -1352,7 +1440,7 @@ if (this.worldObj.isBlockLoaded(bedLocation)) { @@ -305,7 +305,7 @@ float f = 0.5F; float f1 = 0.5F; -@@ -1416,13 +1504,14 @@ +@@ -1415,13 +1503,14 @@ public void wakeUpPlayer(boolean p_70999_1_, boolean updateWorldFlag, boolean setSpawn) { @@ -323,7 +323,7 @@ if (blockpos == null) { -@@ -1449,14 +1538,14 @@ +@@ -1448,14 +1537,14 @@ private boolean isInBed() { @@ -340,7 +340,7 @@ { if (!forceSpawn) { -@@ -1471,7 +1560,7 @@ +@@ -1470,7 +1559,7 @@ } else { @@ -349,7 +349,7 @@ } } -@@ -1480,7 +1569,7 @@ +@@ -1479,7 +1568,7 @@ { if (this.playerLocation != null) { @@ -358,7 +358,7 @@ switch (enumfacing) { -@@ -1520,16 +1609,24 @@ +@@ -1519,16 +1608,24 @@ public BlockPos getBedLocation() { @@ -385,7 +385,7 @@ if (pos != null) { this.spawnChunk = pos; -@@ -1713,6 +1810,10 @@ +@@ -1712,6 +1809,10 @@ super.fall(distance, damageMultiplier); } @@ -396,7 +396,7 @@ } protected void resetHeight() -@@ -1736,6 +1837,7 @@ +@@ -1735,6 +1836,7 @@ } EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entityLivingIn))); @@ -404,7 +404,7 @@ if (entitylist$entityegginfo != null) { -@@ -1848,6 +1950,8 @@ +@@ -1847,6 +1949,8 @@ { if (stack != this.itemInUse) { @@ -413,7 +413,7 @@ this.itemInUse = stack; this.itemInUseCount = duration; -@@ -1919,6 +2023,10 @@ +@@ -1918,6 +2022,10 @@ this.field_181016_an = oldPlayer.field_181016_an; this.field_181017_ao = oldPlayer.field_181017_ao; this.field_181018_ap = oldPlayer.field_181018_ap; @@ -424,7 +424,7 @@ } else if (this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) { -@@ -1932,6 +2040,18 @@ +@@ -1931,6 +2039,18 @@ this.xpSeed = oldPlayer.xpSeed; this.theInventoryEnderChest = oldPlayer.theInventoryEnderChest; this.getDataWatcher().updateObject(10, Byte.valueOf(oldPlayer.getDataWatcher().getWatchableObjectByte(10))); @@ -443,7 +443,7 @@ } protected boolean canTriggerWalking() -@@ -1969,7 +2089,14 @@ +@@ -1968,7 +2088,14 @@ public void setCurrentItemOrArmor(int slotIn, ItemStack stack) { @@ -459,7 +459,7 @@ } @SideOnly(Side.CLIENT) -@@ -2014,7 +2141,10 @@ +@@ -2013,7 +2140,10 @@ public IChatComponent getDisplayName() { @@ -471,7 +471,7 @@ ichatcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.getName() + " ")); ichatcomponent.getChatStyle().setChatHoverEvent(this.func_174823_aP()); ichatcomponent.getChatStyle().setInsertion(this.getName()); -@@ -2023,7 +2153,7 @@ +@@ -2022,7 +2152,7 @@ public float getEyeHeight() { @@ -480,7 +480,7 @@ if (this.isPlayerSleeping()) { -@@ -2156,6 +2286,136 @@ +@@ -2155,6 +2285,136 @@ this.hasReducedDebug = reducedDebug; } diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch index c5c383307..13520054c 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayerMP.java +++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayerMP.java -@@ -124,14 +124,15 @@ +@@ -123,14 +123,15 @@ + public int ping; public boolean playerConqueredTheEnd; - private static final String __OBFID = "CL_00001440"; + @SuppressWarnings("unused") public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, ItemInWorldManager interactionManager) @@ -18,7 +18,7 @@ { int i = Math.max(5, server.getSpawnProtectionSize() - 6); int j = MathHelper.floor_double(worldIn.getWorldBorder().getClosestDistance((double)blockpos.getX(), (double)blockpos.getZ())); -@@ -224,7 +225,7 @@ +@@ -223,7 +224,7 @@ this.openContainer.detectAndSendChanges(); @@ -27,7 +27,7 @@ { this.closeScreen(); this.openContainer = this.inventoryContainer; -@@ -265,7 +266,8 @@ +@@ -264,7 +265,8 @@ if (chunk.isPopulated()) { list.add(chunk); @@ -37,7 +37,7 @@ iterator1.remove(); } } -@@ -295,6 +297,7 @@ +@@ -294,6 +296,7 @@ for (Chunk chunk1 : list) { this.getServerForPlayer().getEntityTracker().func_85172_a(this, chunk1); @@ -45,7 +45,7 @@ } } } -@@ -425,6 +428,7 @@ +@@ -424,6 +427,7 @@ public void onDeath(DamageSource cause) { @@ -53,7 +53,7 @@ if (this.worldObj.getGameRules().getGameRuleBooleanValue("showDeathMessages")) { Team team = this.getTeam(); -@@ -448,7 +452,20 @@ +@@ -447,7 +451,20 @@ if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) { @@ -74,7 +74,7 @@ } for (ScoreObjective scoreobjective : this.worldObj.getScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.deathCount)) -@@ -462,6 +479,7 @@ +@@ -461,6 +478,7 @@ if (entitylivingbase != null) { EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entitylivingbase))); @@ -82,7 +82,7 @@ if (entitylist$entityegginfo != null) { -@@ -832,6 +850,7 @@ +@@ -831,6 +849,7 @@ { if (stat != null) { diff --git a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch index ac3aca4d5..9cf5fa6e4 100644 --- a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/player/InventoryPlayer.java +++ ../src-work/minecraft/net/minecraft/entity/player/InventoryPlayer.java -@@ -316,6 +316,14 @@ +@@ -315,6 +315,14 @@ this.mainInventory[i].updateAnimation(this.player.worldObj, this.player, i, this.currentItem == i); } } diff --git a/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch b/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch index 7f66e993b..fa1e0f4b7 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/projectile/EntityFishHook.java +++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityFishHook.java -@@ -568,11 +568,19 @@ +@@ -567,11 +567,19 @@ } } diff --git a/patches/minecraft/net/minecraft/init/Bootstrap.java.patch b/patches/minecraft/net/minecraft/init/Bootstrap.java.patch index 5e3c96037..c1ce77797 100644 --- a/patches/minecraft/net/minecraft/init/Bootstrap.java.patch +++ b/patches/minecraft/net/minecraft/init/Bootstrap.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/init/Bootstrap.java +++ ../src-work/minecraft/net/minecraft/init/Bootstrap.java -@@ -66,6 +66,7 @@ +@@ -65,6 +65,7 @@ return alreadyRegistered; } @@ -8,7 +8,7 @@ static void registerDispenserBehaviors() { BlockDispenser.dispenseBehaviorRegistry.putObject(Items.arrow, new BehaviorProjectileDispense() -@@ -143,7 +144,7 @@ +@@ -135,7 +136,7 @@ double d0 = source.getX() + (double)enumfacing.getFrontOffsetX(); double d1 = (double)((float)source.getBlockPos().getY() + 0.2F); double d2 = source.getZ() + (double)enumfacing.getFrontOffsetZ(); diff --git a/patches/minecraft/net/minecraft/inventory/Container.java.patch b/patches/minecraft/net/minecraft/inventory/Container.java.patch index a32c9d708..84a24da4d 100644 --- a/patches/minecraft/net/minecraft/inventory/Container.java.patch +++ b/patches/minecraft/net/minecraft/inventory/Container.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/inventory/Container.java +++ ../src-work/minecraft/net/minecraft/inventory/Container.java -@@ -609,7 +609,7 @@ +@@ -608,7 +608,7 @@ Slot slot1 = (Slot)this.inventorySlots.get(i); ItemStack itemstack1 = slot1.getStack(); diff --git a/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch index ddd38b322..d8b6bd0eb 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/inventory/ContainerBeacon.java +++ ../src-work/minecraft/net/minecraft/inventory/ContainerBeacon.java -@@ -146,7 +146,7 @@ +@@ -143,7 +143,7 @@ public boolean isItemValid(ItemStack stack) { diff --git a/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch index 1e81b6f65..a6984df04 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/inventory/ContainerBrewingStand.java +++ ../src-work/minecraft/net/minecraft/inventory/ContainerBrewingStand.java -@@ -157,7 +157,7 @@ +@@ -154,7 +154,7 @@ public boolean isItemValid(ItemStack stack) { @@ -9,7 +9,7 @@ } public int getSlotStackLimit() -@@ -189,7 +189,7 @@ +@@ -185,7 +185,7 @@ public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) { @@ -18,7 +18,7 @@ { this.player.triggerAchievement(AchievementList.potion); } -@@ -199,7 +199,7 @@ +@@ -195,7 +195,7 @@ public static boolean canHoldPotion(ItemStack p_75243_0_) { diff --git a/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch index e816639eb..292d16a78 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch @@ -1,9 +1,9 @@ --- ../src-base/minecraft/net/minecraft/inventory/ContainerEnchantment.java +++ ../src-work/minecraft/net/minecraft/inventory/ContainerEnchantment.java -@@ -69,9 +69,12 @@ +@@ -65,9 +65,12 @@ + }); this.addSlotToContainer(new Slot(this.tableInventory, 1, 35, 47) { - private static final String __OBFID = "CL_00002185"; + java.util.List ores = net.minecraftforge.oredict.OreDictionary.getOres("gemLapis"); public boolean isItemValid(ItemStack stack) { @@ -14,7 +14,7 @@ } }); -@@ -150,6 +153,7 @@ +@@ -146,6 +149,7 @@ if (!this.worldPointer.isRemote) { int l = 0; @@ -22,7 +22,7 @@ for (int j = -1; j <= 1; ++j) { -@@ -157,37 +161,14 @@ +@@ -153,37 +157,14 @@ { if ((j != 0 || k != 0) && this.worldPointer.isAirBlock(this.position.add(k, 0, j)) && this.worldPointer.isAirBlock(this.position.add(k, 1, j))) { @@ -66,7 +66,7 @@ } } } -@@ -197,7 +178,7 @@ +@@ -193,7 +174,7 @@ for (int i1 = 0; i1 < 3; ++i1) { diff --git a/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch index 35b99f86c..2b87f8433 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/inventory/ContainerPlayer.java +++ ../src-work/minecraft/net/minecraft/inventory/ContainerPlayer.java -@@ -45,7 +45,8 @@ +@@ -43,7 +43,8 @@ } public boolean isItemValid(ItemStack stack) { diff --git a/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch index aeaba7115..8ca672062 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/inventory/ContainerRepair.java +++ ../src-work/minecraft/net/minecraft/inventory/ContainerRepair.java -@@ -73,6 +73,8 @@ +@@ -70,6 +70,8 @@ playerIn.addExperienceLevel(-ContainerRepair.this.maximumCost); } @@ -9,7 +9,7 @@ ContainerRepair.this.inputSlots.setInventorySlotContents(0, (ItemStack)null); if (ContainerRepair.this.materialCost > 0) -@@ -97,7 +99,7 @@ +@@ -94,7 +96,7 @@ ContainerRepair.this.maximumCost = 0; IBlockState iblockstate = worldIn.getBlockState(blockPosIn); @@ -18,7 +18,7 @@ { int l = ((Integer)iblockstate.getValue(BlockAnvil.DAMAGE)).intValue(); ++l; -@@ -175,6 +177,7 @@ +@@ -172,6 +174,7 @@ if (itemstack2 != null) { @@ -26,7 +26,7 @@ flag = itemstack2.getItem() == Items.enchanted_book && Items.enchanted_book.getEnchantments(itemstack2).tagCount() > 0; if (itemstack1.isItemStackDamageable() && itemstack1.getItem().getIsRepairable(itemstack, itemstack2)) -@@ -267,7 +270,8 @@ +@@ -264,7 +267,8 @@ { int i4 = ((Integer)iterator.next()).intValue(); @@ -36,7 +36,7 @@ { flag1 = false; ++l1; -@@ -318,6 +322,8 @@ +@@ -315,6 +319,8 @@ } } diff --git a/patches/minecraft/net/minecraft/inventory/Slot.java.patch b/patches/minecraft/net/minecraft/inventory/Slot.java.patch index 135b9fe84..c2d09be0f 100644 --- a/patches/minecraft/net/minecraft/inventory/Slot.java.patch +++ b/patches/minecraft/net/minecraft/inventory/Slot.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/inventory/Slot.java +++ ../src-work/minecraft/net/minecraft/inventory/Slot.java -@@ -90,7 +90,7 @@ +@@ -89,7 +89,7 @@ @SideOnly(Side.CLIENT) public String getSlotTexture() { @@ -9,7 +9,7 @@ } public ItemStack decrStackSize(int amount) -@@ -113,4 +113,64 @@ +@@ -112,4 +112,64 @@ { return true; } diff --git a/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch b/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch index 61021f825..59cf4f617 100644 --- a/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch +++ b/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/inventory/SlotCrafting.java +++ ../src-work/minecraft/net/minecraft/inventory/SlotCrafting.java -@@ -113,8 +113,11 @@ +@@ -112,8 +112,11 @@ public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) { diff --git a/patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch b/patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch index b1ada57ac..5de127a2d 100644 --- a/patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch +++ b/patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java +++ ../src-work/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java -@@ -82,6 +82,8 @@ +@@ -81,6 +81,8 @@ this.field_75228_b = 0; diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index 2bd466c34..b44a7ee96 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -11,9 +11,9 @@ protected static final UUID itemModifierUUID = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); private CreativeTabs tabToDisplayOn; protected static Random itemRand = new Random(); -@@ -62,6 +62,9 @@ +@@ -61,6 +61,9 @@ + private String potionEffect; private String unlocalizedName; - private static final String __OBFID = "CL_00000041"; + public final net.minecraftforge.fml.common.registry.RegistryDelegate delegate = + ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)itemRegistry).getDelegate(this, Item.class); @@ -21,7 +21,7 @@ public static int getIdFromItem(Item itemIn) { return itemIn == null ? 0 : itemRegistry.getIDForObject(itemIn); -@@ -127,6 +130,7 @@ +@@ -126,6 +129,7 @@ return stack; } @@ -29,7 +29,7 @@ public int getItemStackLimit() { return this.maxStackSize; -@@ -240,6 +244,7 @@ +@@ -239,6 +243,7 @@ return this.containerItem; } @@ -37,7 +37,7 @@ public boolean hasContainerItem() { return this.containerItem != null; -@@ -317,7 +322,7 @@ +@@ -316,7 +321,7 @@ public boolean isItemTool(ItemStack stack) { @@ -46,7 +46,7 @@ } protected MovingObjectPosition getMovingObjectPositionFromPlayer(World worldIn, EntityPlayer playerIn, boolean useLiquids) -@@ -335,6 +340,10 @@ +@@ -334,6 +339,10 @@ float f6 = f3 * f4; float f7 = f2 * f4; double d3 = 5.0D; @@ -57,7 +57,7 @@ Vec3 vec31 = vec3.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false); } -@@ -372,11 +381,578 @@ +@@ -371,11 +380,578 @@ return false; } @@ -636,9 +636,9 @@ public static void registerItems() { registerItemBlock(Blocks.stone, (new ItemMultiTexture(Blocks.stone, Blocks.stone, new Function() -@@ -874,6 +1450,10 @@ +@@ -855,6 +1431,10 @@ + private final float damageVsEntity; private final int enchantability; - private static final String __OBFID = "CL_00000042"; + //Added by forge for custom Tool materials. + @Deprecated public Item customCraftingMaterial = null; // Remote in 1.8.1 @@ -647,7 +647,7 @@ private ToolMaterial(int harvestLevel, int maxUses, float efficiency, float damageVsEntity, int enchantability) { this.harvestLevel = harvestLevel; -@@ -908,9 +1488,36 @@ +@@ -889,9 +1469,36 @@ return this.enchantability; } diff --git a/patches/minecraft/net/minecraft/item/ItemArmor.java.patch b/patches/minecraft/net/minecraft/item/ItemArmor.java.patch index 1b2e521a5..de61a14ac 100644 --- a/patches/minecraft/net/minecraft/item/ItemArmor.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemArmor.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemArmor.java +++ ../src-work/minecraft/net/minecraft/item/ItemArmor.java -@@ -38,7 +38,7 @@ +@@ -37,7 +37,7 @@ if (list.size() > 0) { EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0); @@ -9,7 +9,7 @@ int i1 = EntityLiving.getArmorPosition(stack); ItemStack itemstack = stack.copy(); itemstack.stackSize = 1; -@@ -192,7 +192,7 @@ +@@ -190,7 +190,7 @@ if (itemstack == null) { @@ -18,9 +18,9 @@ itemStackIn.stackSize = 0; } -@@ -213,6 +213,9 @@ +@@ -210,6 +210,9 @@ + private final int[] damageReductionAmountArray; private final int enchantability; - private static final String __OBFID = "CL_00001768"; + //Added by forge for custom Armor materials. + public Item customCraftingMaterial = null; @@ -28,7 +28,7 @@ private ArmorMaterial(String name, int p_i45789_4_, int[] reductionAmounts, int enchantability) { this.name = name; -@@ -238,7 +241,15 @@ +@@ -235,7 +238,15 @@ public Item getRepairItem() { diff --git a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch index f92205dec..cf8cc6de1 100644 --- a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemBlock.java +++ ../src-work/minecraft/net/minecraft/item/ItemBlock.java -@@ -55,16 +55,8 @@ +@@ -54,16 +54,8 @@ int i = this.getMetadata(stack.getMetadata()); IBlockState iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, i, playerIn); @@ -18,7 +18,7 @@ worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), this.block.stepSound.getPlaceSound(), (this.block.stepSound.getVolume() + 1.0F) / 2.0F, this.block.stepSound.getFrequency() * 0.8F); --stack.stackSize; } -@@ -163,4 +155,26 @@ +@@ -162,4 +154,26 @@ { return this.block; } diff --git a/patches/minecraft/net/minecraft/item/ItemBow.java.patch b/patches/minecraft/net/minecraft/item/ItemBow.java.patch index 8d346a3b3..751ab8367 100644 --- a/patches/minecraft/net/minecraft/item/ItemBow.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBow.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemBow.java +++ ../src-work/minecraft/net/minecraft/item/ItemBow.java -@@ -28,6 +28,9 @@ +@@ -27,6 +27,9 @@ if (flag || playerIn.inventory.hasItem(Items.arrow)) { int i = this.getMaxItemUseDuration(stack) - timeLeft; @@ -10,7 +10,7 @@ float f = (float)i / 20.0F; f = (f * f + f * 2.0F) / 3.0F; -@@ -105,6 +108,9 @@ +@@ -104,6 +107,9 @@ public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) { diff --git a/patches/minecraft/net/minecraft/item/ItemBucket.java.patch b/patches/minecraft/net/minecraft/item/ItemBucket.java.patch index 23bf6daf0..490b21677 100644 --- a/patches/minecraft/net/minecraft/item/ItemBucket.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBucket.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemBucket.java +++ ../src-work/minecraft/net/minecraft/item/ItemBucket.java -@@ -37,6 +37,9 @@ +@@ -36,6 +36,9 @@ } else { diff --git a/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch b/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch index 0e6f3935e..e1b1013f4 100644 --- a/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemBucketMilk.java +++ ../src-work/minecraft/net/minecraft/item/ItemBucketMilk.java -@@ -25,7 +25,7 @@ +@@ -23,7 +23,7 @@ if (!worldIn.isRemote) { diff --git a/patches/minecraft/net/minecraft/item/ItemDye.java.patch b/patches/minecraft/net/minecraft/item/ItemDye.java.patch index 4ae5b8110..fa9033555 100644 --- a/patches/minecraft/net/minecraft/item/ItemDye.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemDye.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemDye.java +++ ../src-work/minecraft/net/minecraft/item/ItemDye.java -@@ -48,7 +48,7 @@ +@@ -47,7 +47,7 @@ if (enumdyecolor == EnumDyeColor.WHITE) { @@ -9,7 +9,7 @@ { if (!worldIn.isRemote) { -@@ -98,8 +98,18 @@ +@@ -97,8 +97,18 @@ public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target) { @@ -28,7 +28,7 @@ if (iblockstate.getBlock() instanceof IGrowable) { IGrowable igrowable = (IGrowable)iblockstate.getBlock(); -@@ -133,7 +143,7 @@ +@@ -132,7 +142,7 @@ Block block = worldIn.getBlockState(pos).getBlock(); @@ -37,7 +37,7 @@ { block.setBlockBoundsBasedOnState(worldIn, pos); -@@ -145,6 +155,16 @@ +@@ -144,6 +154,16 @@ worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)pos.getX() + itemRand.nextFloat()), (double)pos.getY() + (double)itemRand.nextFloat() * block.getBlockBoundsMaxY(), (double)((float)pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]); } } diff --git a/patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch b/patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch index 2e0696c64..2707df433 100644 --- a/patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemEmptyMap.java +++ ../src-work/minecraft/net/minecraft/item/ItemEmptyMap.java -@@ -24,7 +24,7 @@ +@@ -22,7 +22,7 @@ worldIn.setItemData(s, mapdata); mapdata.scale = 0; mapdata.func_176054_a(playerIn.posX, playerIn.posZ, mapdata.scale); diff --git a/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch b/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch index 92d47f90b..17bd77146 100644 --- a/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemFlintAndSteel.java +++ ../src-work/minecraft/net/minecraft/item/ItemFlintAndSteel.java -@@ -29,7 +29,7 @@ +@@ -27,7 +27,7 @@ } else { diff --git a/patches/minecraft/net/minecraft/item/ItemHoe.java.patch b/patches/minecraft/net/minecraft/item/ItemHoe.java.patch index 7a27cbcb8..28920005f 100644 --- a/patches/minecraft/net/minecraft/item/ItemHoe.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemHoe.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemHoe.java +++ ../src-work/minecraft/net/minecraft/item/ItemHoe.java -@@ -35,10 +35,13 @@ +@@ -34,10 +34,13 @@ } else { diff --git a/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch b/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch index 6251c9d0f..86d27a443 100644 --- a/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemLilyPad.java +++ ../src-work/minecraft/net/minecraft/item/ItemLilyPad.java -@@ -51,7 +51,14 @@ +@@ -49,7 +49,14 @@ if (iblockstate.getBlock().getMaterial() == Material.water && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.isAirBlock(blockpos1)) { diff --git a/patches/minecraft/net/minecraft/item/ItemMap.java.patch b/patches/minecraft/net/minecraft/item/ItemMap.java.patch index 98a20762f..bd169ec19 100644 --- a/patches/minecraft/net/minecraft/item/ItemMap.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemMap.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemMap.java +++ ../src-work/minecraft/net/minecraft/item/ItemMap.java -@@ -59,7 +59,7 @@ +@@ -57,7 +57,7 @@ mapdata = new MapData(s); mapdata.scale = 3; mapdata.func_176054_a((double)worldIn.getWorldInfo().getSpawnX(), (double)worldIn.getWorldInfo().getSpawnZ(), mapdata.scale); diff --git a/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch b/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch index 5372c4ec0..1af20c125 100644 --- a/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemMonsterPlacer.java +++ ../src-work/minecraft/net/minecraft/item/ItemMonsterPlacer.java -@@ -38,7 +38,7 @@ +@@ -36,7 +36,7 @@ public String getItemStackDisplayName(ItemStack stack) { String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim(); @@ -9,7 +9,7 @@ if (s1 != null) { -@@ -51,7 +51,7 @@ +@@ -49,7 +49,7 @@ @SideOnly(Side.CLIENT) public int getColorFromItemStack(ItemStack stack, int renderPass) { @@ -18,7 +18,7 @@ return entitylist$entityegginfo != null ? (renderPass == 0 ? entitylist$entityegginfo.primaryColor : entitylist$entityegginfo.secondaryColor) : 16777215; } -@@ -76,7 +76,7 @@ +@@ -74,7 +74,7 @@ if (tileentity instanceof TileEntityMobSpawner) { MobSpawnerBaseLogic mobspawnerbaselogic = ((TileEntityMobSpawner)tileentity).getSpawnerBaseLogic(); @@ -27,7 +27,7 @@ tileentity.markDirty(); worldIn.markBlockForUpdate(pos); -@@ -97,7 +97,7 @@ +@@ -95,7 +95,7 @@ d0 = 0.5D; } @@ -36,7 +36,7 @@ if (entity != null) { -@@ -148,7 +148,7 @@ +@@ -146,7 +146,7 @@ if (worldIn.getBlockState(blockpos).getBlock() instanceof BlockLiquid) { @@ -45,7 +45,7 @@ if (entity != null) { -@@ -172,19 +172,29 @@ +@@ -170,19 +170,29 @@ } } @@ -76,7 +76,7 @@ if (entity instanceof EntityLivingBase) { -@@ -209,5 +219,28 @@ +@@ -207,5 +217,28 @@ { subItems.add(new ItemStack(itemIn, 1, entitylist$entityegginfo.spawnedID)); } diff --git a/patches/minecraft/net/minecraft/item/ItemRecord.java.patch b/patches/minecraft/net/minecraft/item/ItemRecord.java.patch index 9bc2189e7..e6bf3bf5d 100644 --- a/patches/minecraft/net/minecraft/item/ItemRecord.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemRecord.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemRecord.java +++ ../src-work/minecraft/net/minecraft/item/ItemRecord.java -@@ -77,4 +77,15 @@ +@@ -76,4 +76,15 @@ { return (ItemRecord)RECORDS.get(name); } diff --git a/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch b/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch index a80f9b920..53391bf0b 100644 --- a/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch @@ -9,7 +9,7 @@ { private Block crops; private Block soilId; -@@ -29,7 +29,7 @@ +@@ -28,7 +28,7 @@ { return false; } @@ -18,7 +18,7 @@ { worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); --stack.stackSize; -@@ -40,4 +40,16 @@ +@@ -39,4 +39,16 @@ return false; } } diff --git a/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch b/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch index ebdd88861..053649392 100644 --- a/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch @@ -9,7 +9,7 @@ { private Block crops; private Block soilBlockID; -@@ -30,7 +30,7 @@ +@@ -29,7 +29,7 @@ { return false; } @@ -18,7 +18,7 @@ { worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); --stack.stackSize; -@@ -41,4 +41,16 @@ +@@ -40,4 +40,16 @@ return false; } } diff --git a/patches/minecraft/net/minecraft/item/ItemShears.java.patch b/patches/minecraft/net/minecraft/item/ItemShears.java.patch index 921a20435..6c0e83931 100644 --- a/patches/minecraft/net/minecraft/item/ItemShears.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemShears.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemShears.java +++ ../src-work/minecraft/net/minecraft/item/ItemShears.java -@@ -21,13 +21,12 @@ +@@ -19,13 +19,12 @@ public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) { @@ -15,7 +15,7 @@ return true; } } -@@ -41,4 +40,71 @@ +@@ -39,4 +38,71 @@ { return block != Blocks.web && block.getMaterial() != Material.leaves ? (block == Blocks.wool ? 5.0F : super.getStrVsBlock(stack, block)) : 15.0F; } diff --git a/patches/minecraft/net/minecraft/item/ItemSkull.java.patch b/patches/minecraft/net/minecraft/item/ItemSkull.java.patch index 9c1921c95..4e8acb4a5 100644 --- a/patches/minecraft/net/minecraft/item/ItemSkull.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemSkull.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemSkull.java +++ ../src-work/minecraft/net/minecraft/item/ItemSkull.java -@@ -35,6 +35,11 @@ +@@ -34,6 +34,11 @@ public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) { @@ -12,7 +12,7 @@ if (side == EnumFacing.DOWN) { return false; -@@ -47,7 +52,7 @@ +@@ -46,7 +51,7 @@ if (!flag) { @@ -21,7 +21,7 @@ { return false; } -@@ -67,6 +72,7 @@ +@@ -66,6 +71,7 @@ { if (!worldIn.isRemote) { diff --git a/patches/minecraft/net/minecraft/item/ItemSnow.java.patch b/patches/minecraft/net/minecraft/item/ItemSnow.java.patch index a98b817dd..3d986ba7b 100644 --- a/patches/minecraft/net/minecraft/item/ItemSnow.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemSnow.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemSnow.java +++ ../src-work/minecraft/net/minecraft/item/ItemSnow.java -@@ -69,4 +69,10 @@ +@@ -67,4 +67,10 @@ { return damage; } diff --git a/patches/minecraft/net/minecraft/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/item/ItemStack.java.patch index d750d56ce..448854d90 100644 --- a/patches/minecraft/net/minecraft/item/ItemStack.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemStack.java.patch @@ -1,14 +1,14 @@ --- ../src-base/minecraft/net/minecraft/item/ItemStack.java +++ ../src-work/minecraft/net/minecraft/item/ItemStack.java -@@ -50,6 +50,7 @@ +@@ -49,6 +49,7 @@ + private Block canPlaceOnCacheBlock; private boolean canPlaceOnCacheResult; - private static final String __OBFID = "CL_00000043"; + private net.minecraftforge.fml.common.registry.RegistryDelegate delegate; public ItemStack(Block blockIn) { this((Block)blockIn, 1); -@@ -81,7 +82,7 @@ +@@ -80,7 +81,7 @@ this.canDestroyCacheResult = false; this.canPlaceOnCacheBlock = null; this.canPlaceOnCacheResult = false; @@ -17,7 +17,7 @@ this.stackSize = amount; this.itemDamage = meta; -@@ -121,11 +122,12 @@ +@@ -120,11 +121,12 @@ public Item getItem() { @@ -31,7 +31,7 @@ boolean flag = this.getItem().onItemUse(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ); if (flag) -@@ -170,11 +172,11 @@ +@@ -169,11 +171,11 @@ { if (nbt.hasKey("id", 8)) { @@ -45,7 +45,7 @@ } this.stackSize = nbt.getByte("Count"); -@@ -198,7 +200,7 @@ +@@ -197,7 +199,7 @@ public int getMaxStackSize() { @@ -54,7 +54,7 @@ } public boolean isStackable() -@@ -208,7 +210,7 @@ +@@ -207,7 +209,7 @@ public boolean isItemStackDamageable() { @@ -63,7 +63,7 @@ } public boolean getHasSubtypes() -@@ -218,32 +220,27 @@ +@@ -217,32 +219,27 @@ public boolean isItemDamaged() { @@ -101,7 +101,7 @@ } public boolean attemptDamageItem(int amount, Random rand) -@@ -275,8 +272,8 @@ +@@ -274,8 +271,8 @@ } } @@ -112,7 +112,7 @@ } } -@@ -335,7 +332,7 @@ +@@ -334,7 +331,7 @@ public boolean canHarvestBlock(Block blockIn) { @@ -121,7 +121,7 @@ } public boolean interactWithEntity(EntityPlayer playerIn, EntityLivingBase entityIn) -@@ -743,6 +740,7 @@ +@@ -742,6 +739,7 @@ } } @@ -129,7 +129,7 @@ return list; } -@@ -853,7 +851,7 @@ +@@ -852,7 +850,7 @@ } else { @@ -138,7 +138,7 @@ } return multimap; -@@ -861,6 +859,7 @@ +@@ -860,6 +858,7 @@ public void setItem(Item newItem) { diff --git a/patches/minecraft/net/minecraft/item/ItemSword.java.patch b/patches/minecraft/net/minecraft/item/ItemSword.java.patch index 8fc061c1e..3b7d5e0e0 100644 --- a/patches/minecraft/net/minecraft/item/ItemSword.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemSword.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemSword.java +++ ../src-work/minecraft/net/minecraft/item/ItemSword.java -@@ -102,7 +102,9 @@ +@@ -101,7 +101,9 @@ public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { diff --git a/patches/minecraft/net/minecraft/item/ItemTool.java.patch b/patches/minecraft/net/minecraft/item/ItemTool.java.patch index 0554e07a0..cb9392232 100644 --- a/patches/minecraft/net/minecraft/item/ItemTool.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemTool.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/ItemTool.java +++ ../src-work/minecraft/net/minecraft/item/ItemTool.java -@@ -29,6 +29,18 @@ +@@ -28,6 +28,18 @@ this.efficiencyOnProperMaterial = material.getEfficiencyOnProperMaterial(); this.damageVsEntity = attackDamage + material.getDamageVsEntity(); this.setCreativeTab(CreativeTabs.tabTools); @@ -19,7 +19,7 @@ } public float getStrVsBlock(ItemStack stack, Block block) -@@ -75,7 +87,9 @@ +@@ -74,7 +86,9 @@ public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { @@ -30,7 +30,7 @@ } public Multimap getItemAttributeModifiers() -@@ -84,4 +98,38 @@ +@@ -83,4 +97,38 @@ multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(itemModifierUUID, "Tool modifier", (double)this.damageVsEntity, 0)); return multimap; } diff --git a/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch index 5f38ff604..727558622 100644 --- a/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java +++ ../src-work/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java -@@ -73,6 +73,7 @@ +@@ -72,6 +72,7 @@ public void addSmeltingRecipe(ItemStack input, ItemStack stack, float experience) { @@ -8,7 +8,7 @@ this.smeltingList.put(input, stack); this.experienceList.put(stack, Float.valueOf(experience)); } -@@ -102,6 +103,9 @@ +@@ -101,6 +102,9 @@ public float getSmeltingExperience(ItemStack stack) { diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch index b9fbb01af..f35700bf9 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/crafting/RecipeFireworks.java +++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeFireworks.java -@@ -87,9 +87,9 @@ +@@ -86,9 +86,9 @@ { this.field_92102_a = new ItemStack(Items.fireworks); @@ -11,7 +11,7 @@ NBTTagCompound nbttagcompound3 = new NBTTagCompound(); NBTTagList nbttaglist = new NBTTagList(); -@@ -106,9 +106,9 @@ +@@ -105,9 +105,9 @@ nbttagcompound3.setTag("Explosions", nbttaglist); nbttagcompound3.setByte("Flight", (byte)j); nbttagcompound1.setTag("Fireworks", nbttagcompound3); @@ -22,7 +22,7 @@ return true; } else if (j == 1 && i == 0 && l == 0 && k > 0 && j1 <= 1) -@@ -250,11 +250,7 @@ +@@ -249,11 +249,7 @@ for (int i = 0; i < aitemstack.length; ++i) { ItemStack itemstack = p_179532_1_.getStackInSlot(i); diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch index a9d4349e8..cf7479b97 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java +++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java -@@ -27,7 +27,7 @@ +@@ -25,7 +25,7 @@ { ItemStack itemstack1 = (ItemStack)list.get(0); @@ -9,7 +9,7 @@ { return false; } -@@ -54,7 +54,7 @@ +@@ -52,7 +52,7 @@ { ItemStack itemstack1 = (ItemStack)list.get(0); @@ -18,7 +18,7 @@ { return null; } -@@ -67,7 +67,7 @@ +@@ -65,7 +65,7 @@ ItemStack itemstack2 = (ItemStack)list.get(0); ItemStack itemstack3 = (ItemStack)list.get(1); @@ -27,7 +27,7 @@ { Item item = itemstack2.getItem(); int j = item.getMaxDamage() - itemstack2.getItemDamage(); -@@ -104,11 +104,7 @@ +@@ -102,11 +102,7 @@ for (int i = 0; i < aitemstack.length; ++i) { ItemStack itemstack = p_179532_1_.getStackInSlot(i); diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch index afe3c87e4..24a99a368 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java +++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java -@@ -148,11 +148,7 @@ +@@ -146,11 +146,7 @@ for (int i = 0; i < aitemstack.length; ++i) { ItemStack itemstack = p_179532_1_.getStackInSlot(i); diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch index cdc16e800..90f95d3d2 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/crafting/RecipesBanners.java +++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesBanners.java -@@ -139,11 +139,7 @@ +@@ -135,11 +135,7 @@ for (int i = 0; i < aitemstack.length; ++i) { ItemStack itemstack = p_179532_1_.getStackInSlot(i); @@ -13,7 +13,7 @@ } return aitemstack; -@@ -362,9 +358,9 @@ +@@ -356,9 +352,9 @@ if (itemstack != null) { diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch index 5ad702f77..ea8e4e664 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java +++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java -@@ -110,11 +110,7 @@ +@@ -108,11 +108,7 @@ for (int i = 0; i < aitemstack.length; ++i) { ItemStack itemstack = p_179532_1_.getStackInSlot(i); diff --git a/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch index 02c3e7f16..601a4a1cb 100644 --- a/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/crafting/ShapedRecipes.java +++ ../src-work/minecraft/net/minecraft/item/crafting/ShapedRecipes.java -@@ -34,11 +34,7 @@ +@@ -33,11 +33,7 @@ for (int i = 0; i < aitemstack.length; ++i) { ItemStack itemstack = p_179532_1_.getStackInSlot(i); diff --git a/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch index 1e679060e..640ed7648 100644 --- a/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java +++ ../src-work/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java -@@ -30,11 +30,7 @@ +@@ -29,11 +29,7 @@ for (int i = 0; i < aitemstack.length; ++i) { ItemStack itemstack = p_179532_1_.getStackInSlot(i); diff --git a/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch index cd62e3604..76f2e6739 100644 --- a/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch +++ b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch @@ -9,7 +9,7 @@ public class CompressedStreamTools { -@@ -55,7 +53,6 @@ +@@ -53,7 +51,6 @@ } } @@ -17,7 +17,7 @@ public static void safeWrite(NBTTagCompound p_74793_0_, File p_74793_1_) throws IOException { File file1 = new File(p_74793_1_.getAbsolutePath() + "_tmp"); -@@ -120,6 +117,7 @@ +@@ -118,6 +115,7 @@ private static NBTBase func_152455_a(DataInput p_152455_0_, int p_152455_1_, NBTSizeTracker p_152455_2_) throws IOException { byte b0 = p_152455_0_.readByte(); @@ -25,7 +25,7 @@ if (b0 == 0) { -@@ -127,7 +125,8 @@ +@@ -125,7 +123,8 @@ } else { @@ -35,7 +35,7 @@ NBTBase nbtbase = NBTBase.createNewByType(b0); try -@@ -146,7 +145,6 @@ +@@ -144,7 +143,6 @@ } } @@ -43,7 +43,7 @@ public static void write(NBTTagCompound p_74795_0_, File p_74795_1_) throws IOException { DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(p_74795_1_)); -@@ -161,7 +159,6 @@ +@@ -159,7 +157,6 @@ } } diff --git a/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch b/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch index e8342e794..078cb5b16 100644 --- a/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch +++ b/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/nbt/NBTSizeTracker.java +++ ../src-work/minecraft/net/minecraft/nbt/NBTSizeTracker.java -@@ -27,4 +27,34 @@ +@@ -25,4 +25,34 @@ throw new RuntimeException("Tried to read NBT tag that was too big; tried to allocate: " + this.read + "bytes where max allowed: " + this.max); } } diff --git a/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch b/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch index f2d5e5713..a5014d15a 100644 --- a/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch +++ b/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/nbt/NBTTagCompound.java +++ ../src-work/minecraft/net/minecraft/nbt/NBTTagCompound.java -@@ -398,6 +398,7 @@ +@@ -395,6 +395,7 @@ private static byte readType(DataInput input, NBTSizeTracker sizeTracker) throws IOException { @@ -8,7 +8,7 @@ return input.readByte(); } -@@ -408,6 +409,7 @@ +@@ -405,6 +406,7 @@ static NBTBase readNBT(byte id, String key, DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException { diff --git a/patches/minecraft/net/minecraft/nbt/NBTTagString.java.patch b/patches/minecraft/net/minecraft/nbt/NBTTagString.java.patch index de3e9ccba..c8ca6ca1a 100644 --- a/patches/minecraft/net/minecraft/nbt/NBTTagString.java.patch +++ b/patches/minecraft/net/minecraft/nbt/NBTTagString.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/nbt/NBTTagString.java +++ ../src-work/minecraft/net/minecraft/nbt/NBTTagString.java -@@ -33,7 +33,7 @@ +@@ -32,7 +32,7 @@ { sizeTracker.read(288L); this.data = input.readUTF(); diff --git a/patches/minecraft/net/minecraft/network/NetworkManager.java.patch b/patches/minecraft/net/minecraft/network/NetworkManager.java.patch index 3999ee6b3..6578510e0 100644 --- a/patches/minecraft/net/minecraft/network/NetworkManager.java.patch +++ b/patches/minecraft/net/minecraft/network/NetworkManager.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/network/NetworkManager.java +++ ../src-work/minecraft/net/minecraft/network/NetworkManager.java -@@ -97,6 +97,11 @@ +@@ -93,6 +93,11 @@ this.direction = packetDirection; } @@ -12,7 +12,7 @@ public void channelActive(ChannelHandlerContext p_channelActive_1_) throws Exception { super.channelActive(p_channelActive_1_); -@@ -212,7 +217,7 @@ +@@ -208,7 +213,7 @@ final EnumConnectionState enumconnectionstate = EnumConnectionState.getFromPacket(inPacket); final EnumConnectionState enumconnectionstate1 = (EnumConnectionState)this.channel.attr(attrKeyConnectionState).get(); @@ -21,7 +21,7 @@ { logger.debug("Disabled auto read"); this.channel.config().setAutoRead(false); -@@ -220,7 +225,7 @@ +@@ -216,7 +221,7 @@ if (this.channel.eventLoop().inEventLoop()) { @@ -30,8 +30,8 @@ { this.setConnectionState(enumconnectionstate); } -@@ -241,7 +246,7 @@ - private static final String __OBFID = "CL_00002312"; +@@ -236,7 +241,7 @@ + { public void run() { - if (enumconnectionstate != enumconnectionstate1) @@ -39,7 +39,7 @@ { NetworkManager.this.setConnectionState(enumconnectionstate); } -@@ -462,6 +467,11 @@ +@@ -455,6 +460,11 @@ } } diff --git a/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch b/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch index 2382e65e7..218327728 100644 --- a/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch +++ b/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/network/NetworkSystem.java +++ ../src-work/minecraft/net/minecraft/network/NetworkSystem.java -@@ -120,7 +120,7 @@ +@@ -115,7 +115,7 @@ ; } diff --git a/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch b/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch index 5b32599ba..4b12b60e0 100644 --- a/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch +++ b/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/network/ServerStatusResponse.java +++ ../src-work/minecraft/net/minecraft/network/ServerStatusResponse.java -@@ -30,6 +30,7 @@ +@@ -29,6 +29,7 @@ public void setServerDescription(IChatComponent motd) { this.serverMotd = motd; @@ -8,7 +8,7 @@ } public ServerStatusResponse.PlayerCountData getPlayerCountData() -@@ -40,6 +41,7 @@ +@@ -39,6 +40,7 @@ public void setPlayerCountData(ServerStatusResponse.PlayerCountData countData) { this.playerCount = countData; @@ -16,7 +16,7 @@ } public ServerStatusResponse.MinecraftProtocolVersionIdentifier getProtocolVersionInfo() -@@ -50,11 +52,13 @@ +@@ -49,11 +51,13 @@ public void setProtocolVersionInfo(ServerStatusResponse.MinecraftProtocolVersionIdentifier protocolVersionData) { this.protocolVersion = protocolVersionData; @@ -30,7 +30,7 @@ } public String getFavicon() -@@ -224,6 +228,7 @@ +@@ -215,6 +219,7 @@ serverstatusresponse.setFavicon(JsonUtils.getJsonObjectStringFieldValue(jsonobject, "favicon")); } @@ -38,7 +38,7 @@ return serverstatusresponse; } -@@ -251,7 +256,47 @@ +@@ -242,7 +247,47 @@ jsonobject.addProperty("favicon", p_serialize_1_.getFavicon()); } diff --git a/patches/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch b/patches/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch index 216e1eec3..dbeee89f6 100644 --- a/patches/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch +++ b/patches/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch @@ -1,14 +1,14 @@ --- ../src-base/minecraft/net/minecraft/network/handshake/client/C00Handshake.java +++ ../src-work/minecraft/net/minecraft/network/handshake/client/C00Handshake.java -@@ -15,6 +15,7 @@ +@@ -14,6 +14,7 @@ + private String ip; private int port; private EnumConnectionState requestedState; - private static final String __OBFID = "CL_00001372"; + private boolean hasFMLMarker = false; public C00Handshake() { -@@ -29,18 +30,26 @@ +@@ -28,18 +29,26 @@ this.requestedState = requestedState; } @@ -36,7 +36,7 @@ buf.writeShort(this.port); buf.writeVarIntToBuffer(this.requestedState.getId()); } -@@ -59,4 +68,9 @@ +@@ -58,4 +67,9 @@ { return this.protocolVersion; } diff --git a/patches/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch b/patches/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch index 1da13e842..331306c78 100644 --- a/patches/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch +++ b/patches/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java +++ ../src-work/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java -@@ -48,7 +48,11 @@ +@@ -47,7 +47,11 @@ public void writePacketData(PacketBuffer buf) throws IOException { buf.writeString(this.channel); diff --git a/patches/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch b/patches/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch index 819e5c062..8218d2cac 100644 --- a/patches/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch +++ b/patches/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java +++ ../src-work/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java -@@ -47,7 +47,11 @@ +@@ -46,7 +46,11 @@ public void writePacketData(PacketBuffer buf) throws IOException { buf.writeString(this.channel); diff --git a/patches/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch b/patches/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch index 0b578a6e2..086221d57 100644 --- a/patches/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch +++ b/patches/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java +++ ../src-work/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java -@@ -35,7 +35,7 @@ +@@ -34,7 +34,7 @@ public void writePacketData(PacketBuffer buf) throws IOException { diff --git a/patches/minecraft/net/minecraft/potion/Potion.java.patch b/patches/minecraft/net/minecraft/potion/Potion.java.patch index 8aad8a9e8..0e3c45bb3 100644 --- a/patches/minecraft/net/minecraft/potion/Potion.java.patch +++ b/patches/minecraft/net/minecraft/potion/Potion.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/potion/Potion.java +++ ../src-work/minecraft/net/minecraft/potion/Potion.java -@@ -311,4 +311,27 @@ +@@ -310,4 +310,27 @@ { return p_111183_2_.getAmount() * (double)(p_111183_1_ + 1); } diff --git a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch b/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch index c2e4d17f4..913aaeb06 100644 --- a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch +++ b/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/potion/PotionEffect.java +++ ../src-work/minecraft/net/minecraft/potion/PotionEffect.java -@@ -19,6 +19,8 @@ +@@ -18,6 +18,8 @@ + @SideOnly(Side.CLIENT) private boolean isPotionDurationMax; private boolean showParticles; - private static final String __OBFID = "CL_00001529"; + /** List of ItemStack that can cure the potion effect **/ + private java.util.List curativeItems; public PotionEffect(int id, int effectDuration) { -@@ -37,6 +39,8 @@ +@@ -36,6 +38,8 @@ this.amplifier = effectAmplifier; this.isAmbient = ambient; this.showParticles = showParticles; @@ -18,7 +18,7 @@ } public PotionEffect(PotionEffect other) -@@ -46,6 +50,7 @@ +@@ -45,6 +49,7 @@ this.amplifier = other.amplifier; this.isAmbient = other.isAmbient; this.showParticles = other.showParticles; @@ -26,7 +26,7 @@ } public void combine(PotionEffect other) -@@ -191,7 +196,7 @@ +@@ -190,7 +195,7 @@ public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt) { @@ -35,7 +35,7 @@ if (i >= 0 && i < Potion.potionTypes.length && Potion.potionTypes[i] != null) { -@@ -224,4 +229,62 @@ +@@ -223,4 +228,62 @@ { return this.isPotionDurationMax; } diff --git a/patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch b/patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch index 321fa089b..2aab40a37 100644 --- a/patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch +++ b/patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/realms/RealmsConnect.java +++ ../src-work/minecraft/net/minecraft/realms/RealmsConnect.java -@@ -40,6 +40,7 @@ +@@ -38,6 +38,7 @@ try { @@ -8,7 +8,7 @@ inetaddress = InetAddress.getByName(p_connect_1_); if (RealmsConnect.this.aborted) -@@ -61,7 +62,7 @@ +@@ -59,7 +60,7 @@ return; } diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch index 6347d1b7c..e03c919c1 100644 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -19,7 +19,7 @@ private KeyPair serverKeyPair; private String serverOwner; private String folderName; -@@ -229,8 +230,6 @@ +@@ -227,8 +228,6 @@ { this.convertMapIfNeeded(p_71247_1_); this.setUserMessage("menu.loadingLevel"); @@ -28,7 +28,7 @@ ISaveHandler isavehandler = this.anvilConverterForAnvilFile.getSaveLoader(p_71247_1_, true); this.setResourcePackFromWorld(this.getFolderName(), isavehandler); WorldInfo worldinfo = isavehandler.loadWorldInfo(); -@@ -261,47 +260,21 @@ +@@ -259,47 +258,21 @@ worldsettings = new WorldSettings(worldinfo); } @@ -84,7 +84,7 @@ this.setDifficultyForAllWorlds(this.getDifficulty()); this.initialWorldChunkLoad(); } -@@ -316,7 +289,7 @@ +@@ -314,7 +287,7 @@ this.setUserMessage("menu.generatingTerrain"); int j1 = 0; logger.info("Preparing start region for level " + j1); @@ -93,7 +93,7 @@ BlockPos blockpos = worldserver.getSpawnPoint(); long k1 = getCurrentTimeMillis(); -@@ -405,7 +378,7 @@ +@@ -403,7 +376,7 @@ public void stopServer() { @@ -102,7 +102,7 @@ { logger.info("Stopping server"); -@@ -429,8 +402,15 @@ +@@ -427,8 +400,15 @@ for (int i = 0; i < this.worldServers.length; ++i) { WorldServer worldserver = this.worldServers[i]; @@ -118,7 +118,7 @@ } if (this.usageSnooper.isSnooperRunning()) -@@ -462,6 +442,7 @@ +@@ -460,6 +440,7 @@ { if (this.startServer()) { @@ -126,7 +126,7 @@ this.currentTime = getCurrentTimeMillis(); long i = 0L; this.statusResponse.setServerDescription(new ChatComponentText(this.motd)); -@@ -506,12 +487,20 @@ +@@ -504,12 +485,20 @@ Thread.sleep(Math.max(1L, 50L - i)); this.serverIsRunning = true; } @@ -147,7 +147,7 @@ catch (Throwable throwable1) { logger.error("Encountered an unexpected exception", throwable1); -@@ -537,6 +526,7 @@ +@@ -535,6 +524,7 @@ logger.error("We were unable to save this crash report to disk."); } @@ -155,7 +155,7 @@ this.finalTick(crashreport); } finally -@@ -552,6 +542,8 @@ +@@ -550,6 +540,8 @@ } finally { @@ -164,7 +164,7 @@ this.systemExitNow(); } } -@@ -601,6 +593,7 @@ +@@ -599,6 +591,7 @@ public void tick() { long i = System.nanoTime(); @@ -172,7 +172,7 @@ ++this.tickCounter; if (this.startProfiling) -@@ -627,6 +620,7 @@ +@@ -625,6 +618,7 @@ Collections.shuffle(Arrays.asList(agameprofile)); this.statusResponse.getPlayerCountData().setPlayers(agameprofile); @@ -180,7 +180,7 @@ } if (this.tickCounter % 900 == 0) -@@ -654,6 +648,7 @@ +@@ -652,6 +646,7 @@ this.theProfiler.endSection(); this.theProfiler.endSection(); @@ -188,7 +188,7 @@ } public void updateTimeLightAndEntities() -@@ -669,14 +664,17 @@ +@@ -667,14 +662,17 @@ } this.theProfiler.endStartSection("levels"); @@ -209,7 +209,7 @@ this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName()); if (this.tickCounter % 20 == 0) -@@ -687,6 +685,7 @@ +@@ -685,6 +683,7 @@ } this.theProfiler.startSection("tick"); @@ -217,7 +217,7 @@ try { -@@ -710,6 +709,7 @@ +@@ -708,6 +707,7 @@ throw new ReportedException(crashreport1); } @@ -225,7 +225,7 @@ this.theProfiler.endSection(); this.theProfiler.startSection("tracker"); worldserver.getEntityTracker().updateTrackedEntities(); -@@ -717,9 +717,11 @@ +@@ -715,9 +715,11 @@ this.theProfiler.endSection(); } @@ -238,7 +238,7 @@ this.theProfiler.endStartSection("connection"); this.getNetworkSystem().networkTick(); this.theProfiler.endStartSection("players"); -@@ -741,6 +743,7 @@ +@@ -739,6 +741,7 @@ public void startServerThread() { @@ -246,7 +246,7 @@ this.serverThread = new Thread(this, "Server thread"); this.serverThread.start(); } -@@ -757,7 +760,13 @@ +@@ -755,7 +758,13 @@ public WorldServer worldServerForDimension(int dimension) { @@ -261,7 +261,7 @@ } public String getMinecraftVersion() -@@ -787,7 +796,7 @@ +@@ -785,7 +794,7 @@ public String getServerModName() { @@ -270,7 +270,7 @@ } public CrashReport addServerInfoToCrashReport(CrashReport report) -@@ -1000,6 +1009,7 @@ +@@ -996,6 +1005,7 @@ if (worldserver != null) { diff --git a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch index df51ee2ec..05d5aafc1 100644 --- a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -5,10 +5,10 @@ private WorldSettings.GameType gameType; private boolean guiIsEnabled; + public static boolean allowPlayerLogins = false; - private static final String __OBFID = "CL_00001784"; public DedicatedServer(File workDir) -@@ -110,6 +111,8 @@ + { +@@ -107,6 +108,8 @@ logger.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); } @@ -17,7 +17,7 @@ logger.info("Loading properties"); this.settings = new PropertyManager(new File("server.properties")); this.eula = new ServerEula(new File("eula.txt")); -@@ -201,6 +204,7 @@ +@@ -198,6 +201,7 @@ } else { @@ -25,7 +25,7 @@ this.setConfigManager(new DedicatedPlayerList(this)); long j = System.nanoTime(); -@@ -247,6 +251,7 @@ +@@ -244,6 +248,7 @@ this.setBuildLimit((this.getBuildLimit() + 8) / 16 * 16); this.setBuildLimit(MathHelper.clamp_int(this.getBuildLimit(), 64, 256)); this.settings.setProperty("max-build-height", Integer.valueOf(this.getBuildLimit())); @@ -33,7 +33,7 @@ logger.info("Preparing level \"" + this.getFolderName() + "\""); this.loadAllWorlds(this.getFolderName(), this.getFolderName(), k, worldtype, s2); long i1 = System.nanoTime() - j; -@@ -275,7 +280,7 @@ +@@ -272,7 +277,7 @@ thread1.start(); } diff --git a/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch b/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch index e2d5c0154..1aca6a5bc 100644 --- a/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch +++ b/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/server/gui/MinecraftServerGui.java +++ ../src-work/minecraft/net/minecraft/server/gui/MinecraftServerGui.java -@@ -80,6 +80,7 @@ +@@ -78,6 +78,7 @@ System.exit(0); } }); @@ -8,7 +8,7 @@ } public MinecraftServerGui(DedicatedServer serverIn) -@@ -167,8 +168,13 @@ +@@ -162,8 +163,13 @@ return jpanel; } diff --git a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch index 72385a840..6b4e353d1 100644 --- a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/server/integrated/IntegratedServer.java +++ ../src-work/minecraft/net/minecraft/server/integrated/IntegratedServer.java -@@ -72,8 +72,6 @@ +@@ -71,8 +71,6 @@ protected void loadAllWorlds(String p_71247_1_, String p_71247_2_, long seed, WorldType type, String p_71247_6_) { this.convertMapIfNeeded(p_71247_1_); @@ -9,7 +9,7 @@ ISaveHandler isavehandler = this.getActiveAnvilConverter().getSaveLoader(p_71247_1_, true); this.setResourcePackFromWorld(this.getFolderName(), isavehandler); WorldInfo worldinfo = isavehandler.loadWorldInfo(); -@@ -87,44 +85,24 @@ +@@ -86,44 +84,24 @@ worldinfo.setWorldName(p_71247_2_); } @@ -66,7 +66,7 @@ { this.setDifficultyForAllWorlds(this.mc.gameSettings.difficulty); } -@@ -142,9 +120,10 @@ +@@ -141,9 +119,10 @@ this.setAllowFlight(true); logger.info("Generating keypair"); this.setKeyPair(CryptManager.generateKeyPair()); @@ -78,7 +78,7 @@ } public void tick() -@@ -217,6 +196,7 @@ +@@ -216,6 +195,7 @@ public EnumDifficulty getDifficulty() { diff --git a/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch b/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch index 17cf566f2..7ec3ff397 100644 --- a/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch @@ -9,7 +9,7 @@ public World theWorld; public EntityPlayerMP thisPlayerMP; private WorldSettings.GameType gameType = WorldSettings.GameType.NOT_SET; -@@ -131,6 +133,14 @@ +@@ -130,6 +132,14 @@ public void onBlockClicked(BlockPos pos, EnumFacing side) { @@ -24,7 +24,7 @@ if (this.isCreative()) { if (!this.theWorld.extinguishFire((EntityPlayer)null, pos, side)) -@@ -165,18 +175,35 @@ +@@ -164,18 +174,35 @@ } } @@ -64,7 +64,7 @@ this.tryHarvestBlock(pos); } else -@@ -197,7 +224,7 @@ +@@ -196,7 +223,7 @@ int i = this.curblockDamage - this.initialDamage; Block block = this.theWorld.getBlockState(pos).getBlock(); @@ -73,7 +73,7 @@ { float f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos) * (float)(i + 1); -@@ -226,9 +253,13 @@ +@@ -225,9 +252,13 @@ private boolean removeBlock(BlockPos pos) { @@ -88,7 +88,7 @@ if (flag) { -@@ -240,7 +271,8 @@ +@@ -239,7 +270,8 @@ public boolean tryHarvestBlock(BlockPos pos) { @@ -98,7 +98,7 @@ { return false; } -@@ -249,40 +281,21 @@ +@@ -248,40 +280,21 @@ IBlockState iblockstate = this.theWorld.getBlockState(pos); TileEntity tileentity = this.theWorld.getTileEntity(pos); @@ -144,7 +144,7 @@ if (itemstack1 != null) { -@@ -294,12 +307,18 @@ +@@ -293,12 +306,18 @@ } } @@ -163,7 +163,7 @@ return flag1; } } -@@ -333,6 +352,7 @@ +@@ -332,6 +351,7 @@ if (itemstack.stackSize == 0) { player.inventory.mainInventory[player.inventory.currentItem] = null; @@ -171,7 +171,7 @@ } if (!player.isUsingItem()) -@@ -381,33 +401,51 @@ +@@ -380,33 +400,51 @@ } else { @@ -241,7 +241,7 @@ } } -@@ -415,4 +453,13 @@ +@@ -414,4 +452,13 @@ { this.theWorld = serverWorld; } diff --git a/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch index 259f16246..87dfd5295 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/server/management/PlayerManager.java +++ ../src-work/minecraft/net/minecraft/server/management/PlayerManager.java -@@ -118,15 +118,24 @@ +@@ -117,15 +117,24 @@ int j = (int)p_72683_1_.posZ >> 4; p_72683_1_.managedPosX = p_72683_1_.posX; p_72683_1_.managedPosZ = p_72683_1_.posZ; @@ -26,7 +26,7 @@ this.players.add(p_72683_1_); this.filterChunkLoadQueue(p_72683_1_); } -@@ -226,6 +235,7 @@ +@@ -225,6 +234,7 @@ int i1 = this.playerViewRadius; int j1 = i - k; int k1 = j - l; @@ -34,7 +34,7 @@ if (j1 != 0 || k1 != 0) { -@@ -235,7 +245,7 @@ +@@ -234,7 +244,7 @@ { if (!this.overlaps(l1, i2, k, l, i1)) { @@ -43,7 +43,7 @@ } if (!this.overlaps(l1 - j1, i2 - k1, i, j, i1)) -@@ -253,6 +263,18 @@ +@@ -252,6 +262,18 @@ this.filterChunkLoadQueue(p_72685_1_); p_72685_1_.managedPosX = p_72685_1_.posX; p_72685_1_.managedPosZ = p_72685_1_.posZ; @@ -62,7 +62,7 @@ } } } -@@ -323,12 +345,21 @@ +@@ -322,11 +344,20 @@ private int numBlocksToUpdate; private int flagsYAreasToUpdate; private long previousWorldTime; @@ -75,7 +75,6 @@ + PlayerInstance.this.loaded = true; + } + }; - private static final String __OBFID = "CL_00001435"; public PlayerInstance(int p_i1518_2_, int p_i1518_3_) { @@ -85,7 +84,7 @@ } public void addPlayer(EntityPlayerMP p_73255_1_) -@@ -345,7 +376,24 @@ +@@ -343,7 +374,24 @@ } this.playersWatchingChunk.add(p_73255_1_); @@ -110,7 +109,7 @@ } } -@@ -353,6 +401,24 @@ +@@ -351,6 +399,24 @@ { if (this.playersWatchingChunk.contains(p_73252_1_)) { @@ -135,7 +134,7 @@ Chunk chunk = PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos); if (chunk.isPopulated()) -@@ -360,9 +426,12 @@ +@@ -358,9 +424,12 @@ p_73252_1_.playerNetServerHandler.sendPacket(new S21PacketChunkData(chunk, true, 0)); } @@ -148,7 +147,7 @@ if (this.playersWatchingChunk.isEmpty()) { long i = (long)this.chunkCoords.chunkXPos + 2147483647L | (long)this.chunkCoords.chunkZPos + 2147483647L << 32; -@@ -400,7 +469,7 @@ +@@ -398,7 +467,7 @@ this.flagsYAreasToUpdate |= 1 << (p_151253_2_ >> 4); @@ -157,7 +156,7 @@ { short short1 = (short)(p_151253_1_ << 12 | p_151253_3_ << 8 | p_151253_2_); -@@ -412,6 +481,10 @@ +@@ -410,6 +479,10 @@ } } @@ -168,7 +167,7 @@ this.locationOfBlockChange[this.numBlocksToUpdate++] = short1; } } -@@ -429,6 +502,7 @@ +@@ -427,6 +500,7 @@ } } @@ -176,7 +175,7 @@ public void onUpdate() { if (this.numBlocksToUpdate != 0) -@@ -441,18 +515,19 @@ +@@ -439,18 +513,19 @@ BlockPos blockpos = new BlockPos(i, j, k); this.sendToAllPlayersWatchingChunk(new S23PacketBlockChange(PlayerManager.this.theWorldServer, blockpos)); @@ -199,7 +198,7 @@ { if ((this.flagsYAreasToUpdate & 1 << i2) != 0) { -@@ -469,7 +544,9 @@ +@@ -467,7 +542,9 @@ else { this.sendToAllPlayersWatchingChunk(new S22PacketMultiBlockChange(this.numBlocksToUpdate, this.locationOfBlockChange, PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos))); @@ -210,7 +209,7 @@ for (int j1 = 0; j1 < this.numBlocksToUpdate; ++j1) { int l1 = (this.locationOfBlockChange[j1] >> 12 & 15) + this.chunkCoords.chunkXPos * 16; -@@ -477,7 +554,7 @@ +@@ -475,7 +552,7 @@ int l2 = (this.locationOfBlockChange[j1] >> 8 & 15) + this.chunkCoords.chunkZPos * 16; BlockPos blockpos1 = new BlockPos(l1, j2, l2); diff --git a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch index b4c725aca..49fa524a5 100644 --- a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/server/management/ServerConfigurationManager.java +++ ../src-work/minecraft/net/minecraft/server/management/ServerConfigurationManager.java -@@ -100,7 +100,7 @@ +@@ -99,7 +99,7 @@ this.maxPlayers = 8; } @@ -9,7 +9,7 @@ { GameProfile gameprofile = playerIn.getGameProfile(); PlayerProfileCache playerprofilecache = this.mcServer.getPlayerProfileCache(); -@@ -109,6 +109,17 @@ +@@ -108,6 +108,17 @@ playerprofilecache.func_152649_a(gameprofile); NBTTagCompound nbttagcompound = this.readPlayerDataFromFile(playerIn); playerIn.setWorld(this.mcServer.worldServerForDimension(playerIn.dimension)); @@ -27,7 +27,7 @@ playerIn.theItemInWorldManager.setWorld((WorldServer)playerIn.worldObj); String s1 = "local"; -@@ -122,7 +133,7 @@ +@@ -121,7 +132,7 @@ WorldInfo worldinfo = worldserver.getWorldInfo(); BlockPos blockpos = worldserver.getSpawnPoint(); this.func_72381_a(playerIn, (EntityPlayerMP)null, worldserver); @@ -36,7 +36,7 @@ nethandlerplayserver.sendPacket(new S01PacketJoinGame(playerIn.getEntityId(), playerIn.theItemInWorldManager.getGameType(), worldinfo.isHardcoreModeEnabled(), worldserver.provider.getDimensionId(), worldserver.getDifficulty(), this.getMaxPlayers(), worldinfo.getTerrainType(), worldserver.getGameRules().getGameRuleBooleanValue("reducedDebugInfo"))); nethandlerplayserver.sendPacket(new S3FPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(this.getServerInstance().getServerModName()))); nethandlerplayserver.sendPacket(new S41PacketServerDifficulty(worldinfo.getDifficulty(), worldinfo.isDifficultyLocked())); -@@ -162,6 +173,7 @@ +@@ -161,6 +172,7 @@ playerIn.addSelfToInternalCraftingInventory(); @@ -44,7 +44,7 @@ if (nbttagcompound != null && nbttagcompound.hasKey("Riding", 10)) { Entity entity = EntityList.createEntityFromNBT(nbttagcompound.getCompoundTag("Riding"), worldserver); -@@ -264,6 +276,7 @@ +@@ -262,6 +274,7 @@ playerIn.readFromNBT(nbttagcompound); nbttagcompound1 = nbttagcompound; logger.debug("loading single player"); @@ -52,7 +52,7 @@ } else { -@@ -273,8 +286,23 @@ +@@ -271,8 +284,23 @@ return nbttagcompound1; } @@ -76,7 +76,7 @@ this.playerNBTManagerObj.writePlayerData(playerIn); StatisticsFile statisticsfile = (StatisticsFile)this.playerStatFiles.get(playerIn.getUniqueID()); -@@ -290,6 +318,7 @@ +@@ -288,6 +316,7 @@ this.uuidToPlayerMap.put(playerIn.getUniqueID(), playerIn); this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {playerIn})); WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); @@ -84,7 +84,7 @@ worldserver.spawnEntityInWorld(playerIn); this.func_72375_a(playerIn, (WorldServer)null); -@@ -307,6 +336,7 @@ +@@ -305,6 +334,7 @@ public void playerLoggedOut(EntityPlayerMP playerIn) { @@ -92,7 +92,7 @@ playerIn.triggerAchievement(StatList.leaveGameStat); this.writePlayerData(playerIn); WorldServer worldserver = playerIn.getServerForPlayer(); -@@ -328,6 +358,7 @@ +@@ -326,6 +356,7 @@ this.uuidToPlayerMap.remove(uuid); this.playerStatFiles.remove(uuid); } @@ -100,7 +100,7 @@ this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn})); } -@@ -411,13 +442,23 @@ +@@ -409,13 +440,23 @@ public EntityPlayerMP recreatePlayerEntity(EntityPlayerMP playerIn, int dimension, boolean conqueredEnd) { @@ -126,7 +126,7 @@ playerIn.dimension = dimension; ItemInWorldManager iteminworldmanager; -@@ -433,6 +474,7 @@ +@@ -431,6 +472,7 @@ EntityPlayerMP entityplayermp = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(playerIn.dimension), playerIn.getGameProfile(), iteminworldmanager); entityplayermp.playerNetServerHandler = playerIn.playerNetServerHandler; entityplayermp.clonePlayer(playerIn, conqueredEnd); @@ -134,7 +134,7 @@ entityplayermp.setEntityId(playerIn.getEntityId()); entityplayermp.func_174817_o(playerIn); WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); -@@ -472,19 +514,25 @@ +@@ -470,19 +512,25 @@ this.uuidToPlayerMap.put(entityplayermp.getUniqueID(), entityplayermp); entityplayermp.addSelfToInternalCraftingInventory(); entityplayermp.setHealth(entityplayermp.getHealth()); @@ -162,7 +162,7 @@ this.func_72375_a(playerIn, worldserver); playerIn.playerNetServerHandler.setPlayerLocation(playerIn.posX, playerIn.posY, playerIn.posZ, playerIn.rotationYaw, playerIn.rotationPitch); playerIn.theItemInWorldManager.setWorld(worldserver1); -@@ -495,17 +543,27 @@ +@@ -493,17 +541,27 @@ { playerIn.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(playerIn.getEntityId(), potioneffect)); } @@ -193,7 +193,7 @@ { d0 = MathHelper.clamp_double(d0 / d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); d1 = MathHelper.clamp_double(d1 / d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); -@@ -516,7 +574,7 @@ +@@ -514,7 +572,7 @@ p_82448_3_.updateEntityWithOptionalForce(entityIn, false); } } @@ -202,7 +202,7 @@ { d0 = MathHelper.clamp_double(d0 * d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); d1 = MathHelper.clamp_double(d1 * d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); -@@ -527,7 +585,8 @@ +@@ -525,7 +583,8 @@ p_82448_3_.updateEntityWithOptionalForce(entityIn, false); } } @@ -212,7 +212,7 @@ { BlockPos blockpos; -@@ -562,7 +621,7 @@ +@@ -560,7 +619,7 @@ if (entityIn.isEntityAlive()) { entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch); diff --git a/patches/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch b/patches/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch index f4e6fa526..6c4b46942 100644 --- a/patches/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch +++ b/patches/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java +++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java -@@ -23,6 +23,8 @@ +@@ -22,6 +22,8 @@ public void processHandshake(C00Handshake packetIn) { diff --git a/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch b/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch index c27eab907..0cd7c7fb2 100644 --- a/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch +++ b/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java +++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java -@@ -72,7 +72,7 @@ +@@ -71,7 +71,7 @@ } } @@ -9,7 +9,7 @@ { this.closeConnection("Took too long to log in"); } -@@ -132,7 +132,7 @@ +@@ -130,7 +130,7 @@ } else { diff --git a/patches/minecraft/net/minecraft/stats/StatList.java.patch b/patches/minecraft/net/minecraft/stats/StatList.java.patch index 12e4a29dc..2f739108b 100644 --- a/patches/minecraft/net/minecraft/stats/StatList.java.patch +++ b/patches/minecraft/net/minecraft/stats/StatList.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/stats/StatList.java +++ ../src-work/minecraft/net/minecraft/stats/StatList.java -@@ -110,7 +110,7 @@ +@@ -109,7 +109,7 @@ { if (item != null) { @@ -9,7 +9,7 @@ String s = func_180204_a(item); if (s != null) -@@ -127,11 +127,11 @@ +@@ -126,11 +126,11 @@ { for (Block block : Block.blockRegistry) { @@ -23,7 +23,7 @@ String s = func_180204_a(item); if (s != null && block.getEnableStats()) -@@ -151,7 +151,7 @@ +@@ -150,7 +150,7 @@ { if (item != null) { @@ -32,7 +32,7 @@ String s = func_180204_a(item); if (s != null) -@@ -175,7 +175,7 @@ +@@ -174,7 +174,7 @@ { if (item != null) { diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch index 6eb02f833..1c1448fa8 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java -@@ -60,6 +60,7 @@ +@@ -59,6 +59,7 @@ public void readFromNBT(NBTTagCompound compound) { this.pos = new BlockPos(compound.getInteger("x"), compound.getInteger("y"), compound.getInteger("z")); @@ -8,7 +8,7 @@ } public void writeToNBT(NBTTagCompound compound) -@@ -76,6 +77,7 @@ +@@ -75,6 +76,7 @@ compound.setInteger("x", this.pos.getX()); compound.setInteger("y", this.pos.getY()); compound.setInteger("z", this.pos.getZ()); @@ -16,7 +16,7 @@ } } -@@ -83,9 +85,10 @@ +@@ -82,9 +84,10 @@ { TileEntity tileentity = null; @@ -28,7 +28,7 @@ if (oclass != null) { -@@ -103,7 +106,17 @@ +@@ -102,7 +105,17 @@ } else { @@ -46,7 +46,7 @@ } return tileentity; -@@ -135,7 +148,6 @@ +@@ -134,7 +147,6 @@ } } @@ -54,7 +54,7 @@ public double getDistanceSq(double x, double y, double z) { double d0 = (double)this.pos.getX() + 0.5D - x; -@@ -283,4 +295,135 @@ +@@ -279,4 +291,135 @@ addMapping(TileEntityFlowerPot.class, "FlowerPot"); addMapping(TileEntityBanner.class, "Banner"); } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch index 094394193..0f930a555 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBeacon.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBeacon.java -@@ -170,7 +170,7 @@ +@@ -169,7 +169,7 @@ { Block block = this.worldObj.getBlockState(new BlockPos(j1, i2, k1)).getBlock(); @@ -9,7 +9,7 @@ { flag1 = false; break; -@@ -369,7 +369,7 @@ +@@ -368,7 +368,7 @@ public boolean isItemValidForSlot(int index, ItemStack stack) { diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch index 4792a1dd6..caa7e492f 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java -@@ -105,7 +105,7 @@ +@@ -104,7 +104,7 @@ private boolean canBrew() { @@ -9,7 +9,7 @@ { ItemStack itemstack = this.brewingItemStacks[3]; -@@ -119,7 +119,7 @@ +@@ -118,7 +118,7 @@ for (int i = 0; i < 3; ++i) { @@ -18,7 +18,7 @@ { int j = this.brewingItemStacks[i].getMetadata(); int k = this.func_145936_c(j, itemstack); -@@ -146,19 +146,22 @@ +@@ -145,19 +145,22 @@ } else { @@ -43,7 +43,7 @@ { int j = this.brewingItemStacks[i].getMetadata(); int k = this.func_145936_c(j, itemstack); -@@ -178,10 +181,11 @@ +@@ -177,10 +180,11 @@ } } } @@ -57,7 +57,7 @@ } else { -@@ -192,6 +196,7 @@ +@@ -191,6 +195,7 @@ this.brewingItemStacks[3] = null; } } @@ -65,7 +65,7 @@ } } -@@ -311,7 +316,9 @@ +@@ -310,7 +315,9 @@ public boolean isItemValidForSlot(int index, ItemStack stack) { diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch index 57b5373ee..72def73ca 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityFurnace.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityFurnace.java -@@ -224,8 +224,7 @@ +@@ -223,8 +223,7 @@ if (this.furnaceItemStacks[1].stackSize == 0) { @@ -10,7 +10,7 @@ } } } -@@ -280,7 +279,11 @@ +@@ -279,7 +278,11 @@ else { ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.furnaceItemStacks[0]); @@ -23,7 +23,7 @@ } } -@@ -296,7 +299,7 @@ +@@ -295,7 +298,7 @@ } else if (this.furnaceItemStacks[2].getItem() == itemstack.getItem()) { @@ -32,7 +32,7 @@ } if (this.furnaceItemStacks[0].getItem() == Item.getItemFromBlock(Blocks.sponge) && this.furnaceItemStacks[0].getMetadata() == 1 && this.furnaceItemStacks[1] != null && this.furnaceItemStacks[1].getItem() == Items.bucket) -@@ -343,7 +346,15 @@ +@@ -342,7 +345,15 @@ } } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch index c8e28eb85..a5cd00655 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityHopper.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityHopper.java -@@ -516,17 +516,31 @@ +@@ -515,17 +515,31 @@ if (itemstack == null) { diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch index 51de36d50..01099d450 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityNote.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityNote.java -@@ -28,7 +28,9 @@ +@@ -27,7 +27,9 @@ public void changePitch() { diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch index 396abd4cf..4595567a7 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityPiston.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityPiston.java -@@ -149,7 +149,8 @@ +@@ -148,7 +148,8 @@ if (this.worldObj.getBlockState(this.pos).getBlock() == Blocks.piston_extension) { this.worldObj.setBlockState(this.pos, this.pistonState, 3); @@ -10,7 +10,7 @@ } } } -@@ -167,7 +168,8 @@ +@@ -166,7 +167,8 @@ if (this.worldObj.getBlockState(this.pos).getBlock() == Blocks.piston_extension) { this.worldObj.setBlockState(this.pos, this.pistonState, 3); diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch index 8ffd40ff6..ee33a8d35 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntitySign.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntitySign.java -@@ -63,7 +63,7 @@ +@@ -61,7 +61,7 @@ } public boolean canUseCommand(int permLevel, String commandName) { diff --git a/patches/minecraft/net/minecraft/util/EnumFacing.java.patch b/patches/minecraft/net/minecraft/util/EnumFacing.java.patch index 732263cef..5f5717bf9 100644 --- a/patches/minecraft/net/minecraft/util/EnumFacing.java.patch +++ b/patches/minecraft/net/minecraft/util/EnumFacing.java.patch @@ -9,7 +9,7 @@ public enum EnumFacing implements IStringSerializable { -@@ -61,7 +59,6 @@ +@@ -60,7 +58,6 @@ return getFront(this.opposite); } @@ -17,7 +17,7 @@ public EnumFacing rotateAround(EnumFacing.Axis axis) { switch (axis) -@@ -112,7 +109,6 @@ +@@ -111,7 +108,6 @@ } } @@ -25,7 +25,7 @@ private EnumFacing rotateX() { switch (this) -@@ -132,7 +128,6 @@ +@@ -131,7 +127,6 @@ } } @@ -33,7 +33,7 @@ private EnumFacing rotateZ() { switch (this) -@@ -193,7 +188,6 @@ +@@ -192,7 +187,6 @@ return this.axis; } @@ -41,7 +41,7 @@ public static EnumFacing byName(String name) { return name == null ? null : (EnumFacing)NAME_LOOKUP.get(name.toLowerCase()); -@@ -219,7 +213,6 @@ +@@ -218,7 +212,6 @@ return values()[rand.nextInt(values().length)]; } @@ -49,7 +49,7 @@ public static EnumFacing getFacingFromVector(float p_176737_0_, float p_176737_1_, float p_176737_2_) { EnumFacing enumfacing = NORTH; -@@ -262,7 +255,6 @@ +@@ -261,7 +254,6 @@ throw new IllegalArgumentException("No such direction: " + p_181076_0_ + " " + p_181076_1_); } @@ -57,7 +57,7 @@ public Vec3i getDirectionVec() { return this.directionVec; -@@ -299,7 +291,6 @@ +@@ -297,7 +289,6 @@ this.plane = plane; } diff --git a/patches/minecraft/net/minecraft/util/MessageSerializer.java.patch b/patches/minecraft/net/minecraft/util/MessageSerializer.java.patch deleted file mode 100644 index ea204cead..000000000 --- a/patches/minecraft/net/minecraft/util/MessageSerializer.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/MessageSerializer.java -+++ ../src-work/minecraft/net/minecraft/util/MessageSerializer.java -@@ -49,7 +49,7 @@ - { - if (p_encode_2_ instanceof S0CPacketSpawnPlayer) - { -- p_encode_2_ = p_encode_2_; -+ //p_encode_2_ = p_encode_2_; FML: Kill warning - } - - p_encode_2_.writePacketData(packetbuffer); diff --git a/patches/minecraft/net/minecraft/util/MouseHelper.java.patch b/patches/minecraft/net/minecraft/util/MouseHelper.java.patch index a027a060e..7c04c7919 100644 --- a/patches/minecraft/net/minecraft/util/MouseHelper.java.patch +++ b/patches/minecraft/net/minecraft/util/MouseHelper.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/util/MouseHelper.java +++ ../src-work/minecraft/net/minecraft/util/MouseHelper.java -@@ -14,6 +14,7 @@ +@@ -13,6 +13,7 @@ public void grabMouseCursor() { diff --git a/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch b/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch index 4dce21e9b..4de3bec00 100644 --- a/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch +++ b/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/util/MovingObjectPosition.java +++ ../src-work/minecraft/net/minecraft/util/MovingObjectPosition.java -@@ -11,6 +11,12 @@ +@@ -10,6 +10,12 @@ + public Vec3 hitVec; public Entity entityHit; - private static final String __OBFID = "CL_00000610"; + /** Used to determine what sub-segment is hit */ + public int subHit = -1; diff --git a/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch b/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch index 6cb2dd79b..be604e68e 100644 --- a/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch +++ b/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch @@ -8,7 +8,7 @@ import org.apache.commons.lang3.Validate; public class ResourceLocation -@@ -22,7 +20,6 @@ +@@ -21,7 +19,6 @@ this(0, func_177516_a(p_i1293_1_)); } @@ -16,7 +16,7 @@ public ResourceLocation(String p_i1292_1_, String p_i1292_2_) { this(0, new String[] {p_i1292_1_, p_i1292_2_}); -@@ -51,7 +48,6 @@ +@@ -50,7 +47,6 @@ return this.resourcePath; } diff --git a/patches/minecraft/net/minecraft/util/Session.java.patch b/patches/minecraft/net/minecraft/util/Session.java.patch index dfb470818..48492d58d 100644 --- a/patches/minecraft/net/minecraft/util/Session.java.patch +++ b/patches/minecraft/net/minecraft/util/Session.java.patch @@ -1,9 +1,18 @@ --- ../src-base/minecraft/net/minecraft/util/Session.java +++ ../src-work/minecraft/net/minecraft/util/Session.java -@@ -16,9 +16,24 @@ +@@ -5,6 +5,8 @@ + import com.mojang.util.UUIDTypeAdapter; + import java.util.Map; + import java.util.UUID; ++ ++import net.minecraftforge.fml.common.FMLLog; + import net.minecraftforge.fml.relauncher.Side; + import net.minecraftforge.fml.relauncher.SideOnly; + +@@ -15,9 +17,24 @@ + private final String playerID; private final String token; private final Session.Type sessionType; - private static final String __OBFID = "CL_00000659"; + /** Forge: Cache of the local session's GameProfile properties. */ + private com.mojang.authlib.properties.PropertyMap properties; @@ -13,19 +22,19 @@ + { + usernameIn = "MissingName"; + playerIDIn = tokenIn = "NotValid"; -+ System.out.println("========================================================="); -+ System.out.println("Warning the username was not set for this session, typically"); -+ System.out.println("this means you installed Forge incorrectly. We have set your"); -+ System.out.println("name to \"MissingName\" and your session to nothing. Please"); -+ System.out.println("check your instllation and post a console log from the launcher"); -+ System.out.println("when asking for help!"); -+ System.out.println("========================================================="); ++ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "========================================================="); ++ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "WARNING!! the username was not set for this session, typically"); ++ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "this means you installed Forge incorrectly. We have set your"); ++ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "name to \"MissingName\" and your session to nothing. Please"); ++ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "check your installation and post a console log from the launcher"); ++ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "when asking for help!"); ++ FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "========================================================="); + } + this.username = usernameIn; this.playerID = playerIDIn; this.token = tokenIn; -@@ -50,11 +65,13 @@ +@@ -49,11 +66,13 @@ try { UUID uuid = UUIDTypeAdapter.fromString(this.getPlayerID()); @@ -41,7 +50,7 @@ } } -@@ -63,6 +80,19 @@ +@@ -62,6 +81,19 @@ return this.sessionType; } diff --git a/patches/minecraft/net/minecraft/util/StringTranslate.java.patch b/patches/minecraft/net/minecraft/util/StringTranslate.java.patch index c5464bc1e..f6d51a843 100644 --- a/patches/minecraft/net/minecraft/util/StringTranslate.java.patch +++ b/patches/minecraft/net/minecraft/util/StringTranslate.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/util/StringTranslate.java +++ ../src-work/minecraft/net/minecraft/util/StringTranslate.java -@@ -24,9 +24,29 @@ +@@ -23,9 +23,29 @@ public StringTranslate() { @@ -31,7 +31,7 @@ for (String s : IOUtils.readLines(inputstream, Charsets.UTF_8)) { -@@ -38,17 +58,17 @@ +@@ -37,17 +57,17 @@ { String s1 = astring[0]; String s2 = numericVariablePattern.matcher(astring[1]).replaceAll("%$1s"); diff --git a/patches/minecraft/net/minecraft/util/Vec3.java.patch b/patches/minecraft/net/minecraft/util/Vec3.java.patch index 96c890b92..43a23f3c8 100644 --- a/patches/minecraft/net/minecraft/util/Vec3.java.patch +++ b/patches/minecraft/net/minecraft/util/Vec3.java.patch @@ -9,7 +9,7 @@ public class Vec3 { public final double xCoord; -@@ -37,7 +34,6 @@ +@@ -36,7 +33,6 @@ this((double)p_i46377_1_.getX(), (double)p_i46377_1_.getY(), (double)p_i46377_1_.getZ()); } @@ -17,7 +17,7 @@ public Vec3 subtractReverse(Vec3 vec) { return new Vec3(vec.xCoord - this.xCoord, vec.yCoord - this.yCoord, vec.zCoord - this.zCoord); -@@ -54,7 +50,6 @@ +@@ -53,7 +49,6 @@ return this.xCoord * vec.xCoord + this.yCoord * vec.yCoord + this.zCoord * vec.zCoord; } @@ -25,7 +25,7 @@ public Vec3 crossProduct(Vec3 vec) { return new Vec3(this.yCoord * vec.zCoord - this.zCoord * vec.yCoord, this.zCoord * vec.xCoord - this.xCoord * vec.zCoord, this.xCoord * vec.yCoord - this.yCoord * vec.xCoord); -@@ -80,7 +75,6 @@ +@@ -79,7 +74,6 @@ return new Vec3(this.xCoord + x, this.yCoord + y, this.zCoord + z); } diff --git a/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch b/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch index aaba98a5c..8ddd08aa9 100644 --- a/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch +++ b/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/util/WeightedRandomChestContent.java +++ ../src-work/minecraft/net/minecraft/util/WeightedRandomChestContent.java -@@ -37,48 +37,39 @@ +@@ -36,48 +36,39 @@ for (int i = 0; i < p_177630_3_; ++i) { WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, p_177630_1_); diff --git a/patches/minecraft/net/minecraft/world/ChunkCache.java.patch b/patches/minecraft/net/minecraft/world/ChunkCache.java.patch index 88dced0fd..34f859075 100644 --- a/patches/minecraft/net/minecraft/world/ChunkCache.java.patch +++ b/patches/minecraft/net/minecraft/world/ChunkCache.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/ChunkCache.java +++ ../src-work/minecraft/net/minecraft/world/ChunkCache.java -@@ -62,6 +62,8 @@ +@@ -61,6 +61,8 @@ { int i = (pos.getX() >> 4) - this.chunkX; int j = (pos.getZ() >> 4) - this.chunkZ; @@ -9,7 +9,7 @@ return this.chunkArray[i][j].getTileEntity(pos, Chunk.EnumCreateEntityType.IMMEDIATE); } -@@ -85,6 +87,7 @@ +@@ -84,6 +86,7 @@ { int i = (pos.getX() >> 4) - this.chunkX; int j = (pos.getZ() >> 4) - this.chunkZ; @@ -17,7 +17,7 @@ if (i >= 0 && i < this.chunkArray.length && j >= 0 && j < this.chunkArray[i].length) { -@@ -140,6 +143,8 @@ +@@ -139,6 +142,8 @@ { int i = (pos.getX() >> 4) - this.chunkX; int j = (pos.getZ() >> 4) - this.chunkZ; @@ -26,7 +26,7 @@ return this.chunkArray[i][j].getLightFor(p_175629_1_, pos); } } -@@ -151,7 +156,7 @@ +@@ -150,7 +155,7 @@ public boolean isAirBlock(BlockPos pos) { @@ -35,7 +35,7 @@ } @SideOnly(Side.CLIENT) -@@ -161,6 +166,7 @@ +@@ -160,6 +165,7 @@ { int i = (pos.getX() >> 4) - this.chunkX; int j = (pos.getZ() >> 4) - this.chunkZ; @@ -43,7 +43,7 @@ return this.chunkArray[i][j].getLightFor(p_175628_1_, pos); } else -@@ -180,4 +186,15 @@ +@@ -179,4 +185,15 @@ { return this.worldObj.getWorldType(); } diff --git a/patches/minecraft/net/minecraft/world/Explosion.java.patch b/patches/minecraft/net/minecraft/world/Explosion.java.patch index e3ee43bba..71627e229 100644 --- a/patches/minecraft/net/minecraft/world/Explosion.java.patch +++ b/patches/minecraft/net/minecraft/world/Explosion.java.patch @@ -1,14 +1,14 @@ --- ../src-base/minecraft/net/minecraft/world/Explosion.java +++ ../src-work/minecraft/net/minecraft/world/Explosion.java -@@ -39,6 +39,7 @@ +@@ -38,6 +38,7 @@ + private final float explosionSize; private final List affectedBlockPositions; private final Map field_77288_k; - private static final String __OBFID = "CL_00000134"; + private final Vec3 position; @SideOnly(Side.CLIENT) public Explosion(World worldIn, Entity p_i45752_2_, double p_i45752_3_, double p_i45752_5_, double p_i45752_7_, float p_i45752_9_, List p_i45752_10_) -@@ -66,6 +67,7 @@ +@@ -65,6 +66,7 @@ this.explosionZ = p_i45754_7_; this.isFlaming = p_i45754_10_; this.isSmoking = p_i45754_11_; @@ -16,7 +16,7 @@ } public void doExplosionA() -@@ -100,7 +102,7 @@ +@@ -99,7 +101,7 @@ if (iblockstate.getBlock().getMaterial() != Material.air) { @@ -25,7 +25,7 @@ f -= (f2 + 0.3F) * 0.3F; } -@@ -127,6 +129,7 @@ +@@ -126,6 +128,7 @@ int j2 = MathHelper.floor_double(this.explosionZ - (double)f3 - 1.0D); int j1 = MathHelper.floor_double(this.explosionZ + (double)f3 + 1.0D); List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, new AxisAlignedBB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1)); @@ -33,7 +33,7 @@ Vec3 vec3 = new Vec3(this.explosionX, this.explosionY, this.explosionZ); for (int k2 = 0; k2 < list.size(); ++k2) -@@ -214,8 +217,7 @@ +@@ -213,8 +216,7 @@ block.dropBlockAsItemWithChance(this.worldObj, blockpos, this.worldObj.getBlockState(blockpos), 1.0F / this.explosionSize, 0); } @@ -43,7 +43,7 @@ } } } -@@ -251,4 +253,6 @@ +@@ -250,4 +252,6 @@ { return this.affectedBlockPositions; } diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch index d12e541c9..56d15eeac 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -14,9 +14,9 @@ private int field_181546_a = 63; protected boolean scheduledUpdatesAreImmediate; public final List loadedEntityList = Lists.newArrayList(); -@@ -99,6 +106,10 @@ +@@ -98,6 +105,10 @@ + private final WorldBorder worldBorder; int[] lightUpdateBlockList; - private static final String __OBFID = "CL_00000140"; + public boolean restoringBlockSnapshots = false; + public boolean captureBlockSnapshots = false; @@ -25,7 +25,7 @@ protected World(ISaveHandler saveHandlerIn, WorldInfo info, WorldProvider providerIn, Profiler profilerIn, boolean client) { this.ambientTickCountdown = this.rand.nextInt(12000); -@@ -111,6 +122,7 @@ +@@ -110,6 +121,7 @@ this.provider = providerIn; this.isRemote = client; this.worldBorder = providerIn.getWorldBorder(); @@ -33,7 +33,7 @@ } public World init() -@@ -120,6 +132,11 @@ +@@ -119,6 +131,11 @@ public BiomeGenBase getBiomeGenForCoords(final BlockPos pos) { @@ -45,7 +45,7 @@ if (this.isBlockLoaded(pos)) { Chunk chunk = this.getChunkFromBlockCoords(pos); -@@ -186,7 +203,7 @@ +@@ -184,7 +201,7 @@ public boolean isAirBlock(BlockPos pos) { @@ -54,7 +54,7 @@ } public boolean isBlockLoaded(BlockPos pos) -@@ -286,39 +303,61 @@ +@@ -284,39 +301,61 @@ { Chunk chunk = this.getChunkFromBlockCoords(pos); Block block = newState.getBlock(); @@ -124,7 +124,7 @@ } } } -@@ -406,6 +445,9 @@ +@@ -404,6 +443,9 @@ public void notifyNeighborsOfStateChange(BlockPos pos, Block blockType) { @@ -134,7 +134,7 @@ this.notifyBlockOfStateChange(pos.west(), blockType); this.notifyBlockOfStateChange(pos.east(), blockType); this.notifyBlockOfStateChange(pos.down(), blockType); -@@ -416,6 +458,11 @@ +@@ -414,6 +456,11 @@ public void notifyNeighborsOfStateExcept(BlockPos pos, Block blockType, EnumFacing skipSide) { @@ -146,7 +146,7 @@ if (skipSide != EnumFacing.WEST) { this.notifyBlockOfStateChange(pos.west(), blockType); -@@ -780,7 +827,7 @@ +@@ -777,7 +824,7 @@ public boolean isDaytime() { @@ -155,7 +155,7 @@ } public MovingObjectPosition rayTraceBlocks(Vec3 p_72933_1_, Vec3 p_72933_2_) -@@ -975,6 +1022,12 @@ +@@ -972,6 +1019,12 @@ public void playSoundAtEntity(Entity p_72956_1_, String p_72956_2_, float p_72956_3_, float p_72956_4_) { @@ -168,7 +168,7 @@ for (int i = 0; i < this.worldAccesses.size(); ++i) { ((IWorldAccess)this.worldAccesses.get(i)).playSound(p_72956_2_, p_72956_1_.posX, p_72956_1_.posY, p_72956_1_.posZ, p_72956_3_, p_72956_4_); -@@ -983,6 +1036,12 @@ +@@ -980,6 +1033,12 @@ public void playSoundToNearExcept(EntityPlayer p_85173_1_, String p_85173_2_, float p_85173_3_, float p_85173_4_) { @@ -181,7 +181,7 @@ for (int i = 0; i < this.worldAccesses.size(); ++i) { ((IWorldAccess)this.worldAccesses.get(i)).playSoundToNearExcept(p_85173_1_, p_85173_2_, p_85173_1_.posX, p_85173_1_.posY, p_85173_1_.posZ, p_85173_3_, p_85173_4_); -@@ -1036,6 +1095,9 @@ +@@ -1033,6 +1092,9 @@ public boolean spawnEntityInWorld(Entity p_72838_1_) { @@ -191,7 +191,7 @@ int i = MathHelper.floor_double(p_72838_1_.posX / 16.0D); int j = MathHelper.floor_double(p_72838_1_.posZ / 16.0D); boolean flag = p_72838_1_.forceSpawn; -@@ -1058,6 +1120,8 @@ +@@ -1055,6 +1117,8 @@ this.updateAllPlayersSleepingFlag(); } @@ -200,7 +200,7 @@ this.getChunkFromChunkCoords(i, j).addEntity(p_72838_1_); this.loadedEntityList.add(p_72838_1_); this.onEntityAdded(p_72838_1_); -@@ -1270,17 +1334,29 @@ +@@ -1267,17 +1331,29 @@ public int calculateSkylightSubtracted(float p_72967_1_) { @@ -233,7 +233,7 @@ public void removeWorldAccess(IWorldAccess p_72848_1_) { this.worldAccesses.remove(p_72848_1_); -@@ -1289,6 +1365,12 @@ +@@ -1286,6 +1362,12 @@ @SideOnly(Side.CLIENT) public float getSunBrightness(float p_72971_1_) { @@ -246,7 +246,7 @@ float f = this.getCelestialAngle(p_72971_1_); float f1 = 1.0F - (MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.2F); f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); -@@ -1301,6 +1383,12 @@ +@@ -1298,6 +1380,12 @@ @SideOnly(Side.CLIENT) public Vec3 getSkyColor(Entity p_72833_1_, float p_72833_2_) { @@ -259,7 +259,7 @@ float f = this.getCelestialAngle(p_72833_2_); float f1 = MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F; f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); -@@ -1308,9 +1396,7 @@ +@@ -1305,9 +1393,7 @@ int j = MathHelper.floor_double(p_72833_1_.posY); int k = MathHelper.floor_double(p_72833_1_.posZ); BlockPos blockpos = new BlockPos(i, j, k); @@ -270,7 +270,7 @@ float f3 = (float)(l >> 16 & 255) / 255.0F; float f4 = (float)(l >> 8 & 255) / 255.0F; float f5 = (float)(l & 255) / 255.0F; -@@ -1370,6 +1456,11 @@ +@@ -1367,6 +1453,11 @@ public float getCurrentMoonPhaseFactor() { @@ -282,7 +282,7 @@ return WorldProvider.moonPhaseFactors[this.provider.getMoonPhase(this.worldInfo.getWorldTime())]; } -@@ -1382,6 +1473,12 @@ +@@ -1379,6 +1470,12 @@ @SideOnly(Side.CLIENT) public Vec3 getCloudColour(float p_72824_1_) { @@ -295,7 +295,7 @@ float f = this.getCelestialAngle(p_72824_1_); float f1 = MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F; f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); -@@ -1437,9 +1534,9 @@ +@@ -1434,9 +1531,9 @@ for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1) { blockpos1 = blockpos.down(); @@ -307,7 +307,7 @@ { break; } -@@ -1451,6 +1548,12 @@ +@@ -1448,6 +1545,12 @@ @SideOnly(Side.CLIENT) public float getStarBrightness(float p_72880_1_) { @@ -320,7 +320,7 @@ float f = this.getCelestialAngle(p_72880_1_); float f1 = 1.0F - (MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.25F); f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); -@@ -1497,7 +1600,15 @@ +@@ -1494,7 +1597,15 @@ entity.addEntityCrashInfo(crashreportcategory); } @@ -337,7 +337,7 @@ } if (entity.isDead) -@@ -1557,7 +1668,15 @@ +@@ -1554,7 +1665,15 @@ CrashReport crashreport1 = CrashReport.makeCrashReport(throwable1, "Ticking entity"); CrashReportCategory crashreportcategory2 = crashreport1.makeCategory("Entity being ticked"); entity2.addEntityCrashInfo(crashreportcategory2); @@ -354,7 +354,7 @@ } } -@@ -1604,7 +1723,16 @@ +@@ -1601,7 +1720,16 @@ CrashReport crashreport2 = CrashReport.makeCrashReport(throwable, "Ticking block entity"); CrashReportCategory crashreportcategory1 = crashreport2.makeCategory("Block entity being ticked"); tileentity.addInfoToCrashReport(crashreportcategory1); @@ -372,7 +372,7 @@ } } } -@@ -1621,15 +1749,20 @@ +@@ -1618,15 +1746,20 @@ } } @@ -395,7 +395,7 @@ this.theProfiler.endStartSection("pendingBlockEntities"); if (!this.addedTileEntityList.isEmpty()) -@@ -1663,7 +1796,8 @@ +@@ -1660,7 +1793,8 @@ public boolean addTileEntity(TileEntity tile) { @@ -405,7 +405,7 @@ if (flag && tile instanceof ITickable) { -@@ -1702,9 +1836,13 @@ +@@ -1699,9 +1833,13 @@ { int i = MathHelper.floor_double(p_72866_1_.posX); int j = MathHelper.floor_double(p_72866_1_.posZ); @@ -421,7 +421,7 @@ { p_72866_1_.lastTickPosX = p_72866_1_.posX; p_72866_1_.lastTickPosY = p_72866_1_.posY; -@@ -1832,7 +1970,7 @@ +@@ -1829,7 +1967,7 @@ { Block block = this.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, l1, i2)).getBlock(); @@ -430,7 +430,7 @@ { return true; } -@@ -1897,6 +2035,10 @@ +@@ -1894,6 +2032,10 @@ { return true; } @@ -441,7 +441,7 @@ } } } -@@ -2037,6 +2179,7 @@ +@@ -2034,6 +2176,7 @@ public Explosion newExplosion(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) { Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_); @@ -449,7 +449,7 @@ explosion.doExplosionA(); explosion.doExplosionB(true); return explosion; -@@ -2183,19 +2326,27 @@ +@@ -2180,19 +2323,27 @@ else { this.addTileEntity(tileEntityIn); @@ -478,7 +478,7 @@ } else { -@@ -2208,6 +2359,7 @@ +@@ -2205,6 +2356,7 @@ this.getChunkFromBlockCoords(pos).removeTileEntity(pos); } @@ -486,7 +486,7 @@ } public void markTileEntityForRemoval(TileEntity tileEntityIn) -@@ -2226,7 +2378,7 @@ +@@ -2223,7 +2375,7 @@ { IBlockState iblockstate = p_175683_0_.getBlockState(p_175683_1_); Block block = iblockstate.getBlock(); @@ -495,7 +495,7 @@ } public boolean isBlockNormalCube(BlockPos p_175677_1_, boolean p_175677_2_) -@@ -2246,7 +2398,7 @@ +@@ -2243,7 +2395,7 @@ else { Block block = this.getBlockState(p_175677_1_).getBlock(); @@ -504,7 +504,7 @@ } } } -@@ -2265,6 +2417,7 @@ +@@ -2262,6 +2414,7 @@ { this.spawnHostileMobs = hostile; this.spawnPeacefulMobs = peaceful; @@ -512,7 +512,7 @@ } public void tick() -@@ -2274,6 +2427,11 @@ +@@ -2271,6 +2424,11 @@ protected void calculateInitialWeather() { @@ -524,7 +524,7 @@ if (this.worldInfo.isRaining()) { this.rainingStrength = 1.0F; -@@ -2287,6 +2445,11 @@ +@@ -2284,6 +2442,11 @@ protected void updateWeather() { @@ -536,7 +536,7 @@ if (!this.provider.getHasNoSky()) { if (!this.isRemote) -@@ -2381,6 +2544,7 @@ +@@ -2378,6 +2541,7 @@ { this.activeChunkSet.clear(); this.theProfiler.startSection("buildList"); @@ -544,7 +544,7 @@ for (int i = 0; i < this.playerEntities.size(); ++i) { -@@ -2438,7 +2602,7 @@ +@@ -2435,7 +2599,7 @@ j = j + p_147467_1_; k = k + p_147467_2_; @@ -553,7 +553,7 @@ { EntityPlayer entityplayer = this.getClosestPlayer((double)j + 0.5D, (double)l + 0.5D, (double)k + 0.5D, 8.0D); -@@ -2478,6 +2642,11 @@ +@@ -2475,6 +2639,11 @@ public boolean canBlockFreeze(BlockPos pos, boolean noWaterAdj) { @@ -565,7 +565,7 @@ BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); float f = biomegenbase.getFloatTemperature(pos); -@@ -2519,6 +2688,11 @@ +@@ -2516,6 +2685,11 @@ public boolean canSnowAt(BlockPos pos, boolean checkLight) { @@ -577,7 +577,7 @@ BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); float f = biomegenbase.getFloatTemperature(pos); -@@ -2536,7 +2710,7 @@ +@@ -2533,7 +2707,7 @@ { Block block = this.getBlockState(pos).getBlock(); @@ -586,7 +586,7 @@ { return true; } -@@ -2568,10 +2742,11 @@ +@@ -2565,10 +2739,11 @@ else { Block block = this.getBlockState(pos).getBlock(); @@ -601,7 +601,7 @@ { j = 1; } -@@ -2771,10 +2946,10 @@ +@@ -2768,10 +2943,10 @@ public List func_175674_a(Entity entityIn, AxisAlignedBB p_175674_2_, Predicate p_175674_3_) { List list = Lists.newArrayList(); @@ -616,7 +616,7 @@ for (int i1 = i; i1 <= j; ++i1) { -@@ -2827,10 +3002,10 @@ +@@ -2824,10 +2999,10 @@ public List getEntitiesWithinAABB(Class clazz, AxisAlignedBB aabb, Predicate filter) { @@ -631,7 +631,7 @@ List list = Lists.newArrayList(); for (int i1 = i; i1 <= j; ++i1) -@@ -2908,11 +3083,13 @@ +@@ -2905,11 +3080,13 @@ public void loadEntities(Collection entityCollection) { @@ -648,7 +648,7 @@ } } -@@ -2925,7 +3102,9 @@ +@@ -2922,7 +3099,9 @@ { Block block = this.getBlockState(p_175716_2_).getBlock(); AxisAlignedBB axisalignedbb = p_175716_3_ ? null : p_175716_1_.getCollisionBoundingBox(this, p_175716_2_, p_175716_1_.getDefaultState()); @@ -659,7 +659,7 @@ } public int func_181545_F() -@@ -3010,7 +3189,7 @@ +@@ -3007,7 +3186,7 @@ { IBlockState iblockstate = this.getBlockState(pos); Block block = iblockstate.getBlock(); @@ -668,7 +668,7 @@ } public boolean isBlockPowered(BlockPos pos) -@@ -3137,7 +3316,7 @@ +@@ -3134,7 +3313,7 @@ public long getSeed() { @@ -677,7 +677,7 @@ } public long getTotalWorldTime() -@@ -3147,17 +3326,17 @@ +@@ -3144,17 +3323,17 @@ public long getWorldTime() { @@ -698,7 +698,7 @@ if (!this.getWorldBorder().contains(blockpos)) { -@@ -3169,7 +3348,7 @@ +@@ -3166,7 +3345,7 @@ public void setSpawnPoint(BlockPos pos) { @@ -707,7 +707,7 @@ } @SideOnly(Side.CLIENT) -@@ -3189,12 +3368,18 @@ +@@ -3186,12 +3365,18 @@ if (!this.loadedEntityList.contains(entityIn)) { @@ -726,7 +726,7 @@ return true; } -@@ -3288,8 +3473,7 @@ +@@ -3285,8 +3470,7 @@ public boolean isBlockinHighHumidity(BlockPos pos) { @@ -736,7 +736,7 @@ } public MapStorage getMapStorage() -@@ -3348,12 +3532,12 @@ +@@ -3345,12 +3529,12 @@ public int getHeight() { @@ -751,7 +751,7 @@ } public Random setRandomSeed(int p_72843_1_, int p_72843_2_, int p_72843_3_) -@@ -3410,7 +3594,7 @@ +@@ -3405,7 +3589,7 @@ @SideOnly(Side.CLIENT) public double getHorizon() { @@ -760,7 +760,7 @@ } public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress) -@@ -3452,18 +3636,14 @@ +@@ -3447,18 +3631,14 @@ { IBlockState iblockstate = this.getBlockState(blockpos); @@ -785,7 +785,7 @@ } } } -@@ -3533,4 +3713,81 @@ +@@ -3528,4 +3708,81 @@ int k = 128; return i >= -k && i <= k && j >= -k && j <= k; } diff --git a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch index cae3f92a9..e87006bf0 100644 --- a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/WorldProvider.java +++ ../src-work/minecraft/net/minecraft/world/WorldProvider.java -@@ -52,26 +52,12 @@ +@@ -51,26 +51,12 @@ protected void registerWorldChunkManager() { @@ -29,7 +29,7 @@ } public boolean canCoordinateBeSpawn(int x, int z) -@@ -154,13 +140,13 @@ +@@ -153,13 +139,13 @@ public static WorldProvider getProviderForDimension(int dimension) { @@ -45,7 +45,7 @@ } @SideOnly(Side.CLIENT) -@@ -176,13 +162,13 @@ +@@ -175,13 +161,13 @@ public int getAverageGroundLevel() { @@ -61,7 +61,7 @@ } @SideOnly(Side.CLIENT) -@@ -224,4 +210,319 @@ +@@ -223,4 +209,319 @@ { return new WorldBorder(); } diff --git a/patches/minecraft/net/minecraft/world/WorldServer.java.patch b/patches/minecraft/net/minecraft/world/WorldServer.java.patch index 25fb5d87c..200079885 100644 --- a/patches/minecraft/net/minecraft/world/WorldServer.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldServer.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/world/WorldServer.java +++ ../src-work/minecraft/net/minecraft/world/WorldServer.java -@@ -95,30 +95,46 @@ +@@ -94,30 +94,46 @@ + private static final List bonusChestContent = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.stick, 0, 1, 3, 10), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.planks), 0, 1, 3, 10), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.log), 0, 1, 3, 10), new WeightedRandomChestContent(Items.stone_axe, 0, 1, 1, 3), new WeightedRandomChestContent(Items.wooden_axe, 0, 1, 1, 5), new WeightedRandomChestContent(Items.stone_pickaxe, 0, 1, 1, 3), new WeightedRandomChestContent(Items.wooden_pickaxe, 0, 1, 1, 5), new WeightedRandomChestContent(Items.apple, 0, 2, 3, 5), new WeightedRandomChestContent(Items.bread, 0, 2, 3, 3), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.log2), 0, 1, 3, 10)}); private List pendingTickListEntriesThisTick = Lists.newArrayList(); - private static final String __OBFID = "CL_00001437"; + /** Stores the recently processed (lighting) chunks */ + protected Set doneChunks = new java.util.HashSet(); @@ -49,7 +49,7 @@ } else { -@@ -211,6 +227,10 @@ +@@ -210,6 +226,10 @@ this.villageSiege.tick(); this.theProfiler.endStartSection("portalForcer"); this.worldTeleporter.removeStalePortalLocations(this.getTotalWorldTime()); @@ -60,7 +60,7 @@ this.theProfiler.endSection(); this.sendQueuedBlockEvents(); } -@@ -218,6 +238,7 @@ +@@ -217,6 +237,7 @@ public BiomeGenBase.SpawnListEntry func_175734_a(EnumCreatureType p_175734_1_, BlockPos p_175734_2_) { List list = this.getChunkProvider().func_177458_a(p_175734_1_, p_175734_2_); @@ -68,7 +68,7 @@ return list != null && !list.isEmpty() ? (BiomeGenBase.SpawnListEntry)WeightedRandom.getRandomItem(this.rand, list) : null; } -@@ -269,10 +290,7 @@ +@@ -268,10 +289,7 @@ private void resetRainAndThunder() { @@ -80,7 +80,7 @@ } public boolean areAllPlayersAsleep() -@@ -350,7 +368,7 @@ +@@ -349,7 +367,7 @@ chunk.func_150804_b(false); this.theProfiler.endStartSection("thunder"); @@ -89,7 +89,7 @@ { this.updateLCG = this.updateLCG * 3 + 1013904223; int i1 = this.updateLCG >> 2; -@@ -364,7 +382,7 @@ +@@ -363,7 +381,7 @@ this.theProfiler.endStartSection("iceandsnow"); @@ -98,7 +98,7 @@ { this.updateLCG = this.updateLCG * 3 + 1013904223; int k2 = this.updateLCG >> 2; -@@ -458,6 +476,9 @@ +@@ -456,6 +474,9 @@ if (p_175654_2_.requiresUpdates()) { i = 8; @@ -108,7 +108,7 @@ if (this.isAreaLoaded(nextticklistentry.position.add(-i, -i, -i), nextticklistentry.position.add(i, i, i))) { -@@ -510,7 +531,7 @@ +@@ -508,7 +529,7 @@ public void updateEntities() { @@ -117,7 +117,7 @@ { if (this.updateEntityTick++ >= 1200) { -@@ -575,6 +596,9 @@ +@@ -573,6 +594,9 @@ { NextTickListEntry nextticklistentry1 = (NextTickListEntry)iterator.next(); iterator.remove(); @@ -127,7 +127,7 @@ int k = 0; if (this.isAreaLoaded(nextticklistentry1.position.add(-k, -k, -k), nextticklistentry1.position.add(k, k, k))) -@@ -698,22 +722,39 @@ +@@ -696,22 +720,39 @@ { List list = Lists.newArrayList(); @@ -174,7 +174,7 @@ return !this.mcServer.isBlockProtected(this, pos, player) && this.getWorldBorder().contains(pos); } -@@ -779,6 +820,7 @@ +@@ -777,6 +818,7 @@ } else { @@ -182,7 +182,7 @@ this.findingSpawnPoint = true; WorldChunkManager worldchunkmanager = this.provider.getWorldChunkManager(); List list = worldchunkmanager.getBiomesToSpawnIn(); -@@ -824,7 +866,7 @@ +@@ -822,7 +864,7 @@ protected void createBonusChest() { @@ -191,7 +191,7 @@ for (int i = 0; i < 10; ++i) { -@@ -861,6 +903,7 @@ +@@ -859,6 +901,7 @@ } this.chunkProvider.saveChunks(p_73044_1_, p_73044_2_); @@ -199,7 +199,7 @@ for (Chunk chunk : Lists.newArrayList(this.theChunkProviderServer.func_152380_a())) { -@@ -894,6 +937,7 @@ +@@ -892,6 +935,7 @@ this.worldInfo.setBorderLerpTime(this.getWorldBorder().getTimeUntilTarget()); this.saveHandler.saveWorldInfoWithPlayer(this.worldInfo, this.mcServer.getConfigurationManager().getHostPlayerData()); this.mapStorage.saveAllData(); @@ -207,7 +207,7 @@ } public void onEntityAdded(Entity p_72923_1_) -@@ -949,6 +993,7 @@ +@@ -947,6 +991,7 @@ public Explosion newExplosion(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) { Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_); @@ -215,7 +215,7 @@ explosion.doExplosionA(); explosion.doExplosionB(false); -@@ -1028,19 +1073,23 @@ +@@ -1026,19 +1071,23 @@ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.getDimensionId()); } @@ -243,7 +243,7 @@ } } -@@ -1106,6 +1155,11 @@ +@@ -1104,6 +1153,11 @@ return this.mcServer.isCallingFromMinecraftThread(); } @@ -254,4 +254,4 @@ + static class ServerBlockEventList extends ArrayList { - private static final String __OBFID = "CL_00001439"; + private ServerBlockEventList() diff --git a/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch b/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch index ee4637dac..92ad1ae53 100644 --- a/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch @@ -1,11 +1,10 @@ --- ../src-base/minecraft/net/minecraft/world/WorldServerMulti.java +++ ../src-work/minecraft/net/minecraft/world/WorldServerMulti.java -@@ -11,13 +11,14 @@ +@@ -11,12 +11,13 @@ public class WorldServerMulti extends WorldServer { private WorldServer delegate; + private IBorderListener borderListener; - private static final String __OBFID = "CL_00001430"; public WorldServerMulti(MinecraftServer server, ISaveHandler saveHandlerIn, int dimensionId, WorldServer delegate, Profiler profilerIn) { @@ -14,9 +13,9 @@ - delegate.getWorldBorder().addListener(new IBorderListener() + this.borderListener = new IBorderListener() { - private static final String __OBFID = "CL_00002273"; public void onSizeChanged(WorldBorder border, double newSize) -@@ -48,11 +49,13 @@ + { +@@ -46,11 +47,13 @@ { WorldServerMulti.this.getWorldBorder().setDamageBuffer(newSize); } @@ -31,7 +30,7 @@ } public World init() -@@ -60,12 +63,12 @@ +@@ -58,12 +61,12 @@ this.mapStorage = this.delegate.getMapStorage(); this.worldScoreboard = this.delegate.getScoreboard(); String s = VillageCollection.fileNameForProvider(this.provider); @@ -46,7 +45,7 @@ } else { -@@ -75,4 +78,12 @@ +@@ -73,4 +76,12 @@ return this; } diff --git a/patches/minecraft/net/minecraft/world/WorldType.java.patch b/patches/minecraft/net/minecraft/world/WorldType.java.patch index 9ab71dae1..39573c29f 100644 --- a/patches/minecraft/net/minecraft/world/WorldType.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldType.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/WorldType.java +++ ../src-work/minecraft/net/minecraft/world/WorldType.java -@@ -28,6 +28,7 @@ +@@ -27,6 +27,7 @@ private WorldType(int id, String name, int version) { @@ -8,7 +8,7 @@ this.worldType = name; this.generatorVersion = version; this.canBeCreated = true; -@@ -114,4 +115,144 @@ +@@ -113,4 +114,144 @@ this.hasNotificationData = true; return this; } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch index e76667c78..87ff307bc 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeColorHelper.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeColorHelper.java -@@ -29,7 +29,7 @@ - private static final String __OBFID = "CL_00002146"; +@@ -26,7 +26,7 @@ + { public int getColorAtPos(BiomeGenBase p_180283_1_, BlockPos blockPosition) { - return p_180283_1_.waterColorMultiplier; + return p_180283_1_.getWaterColorMultiplier(); } }; - private static final String __OBFID = "CL_00002149"; + diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch index c0e91d25d..dcb280f9b 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeDecorator.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeDecorator.java -@@ -106,8 +106,10 @@ +@@ -105,8 +105,10 @@ protected void genDecorations(BiomeGenBase p_150513_1_) { @@ -11,7 +11,7 @@ for (int i = 0; i < this.sandPerChunk2; ++i) { int j = this.randomGenerator.nextInt(16) + 8; -@@ -115,6 +117,7 @@ +@@ -114,6 +116,7 @@ this.sandGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getTopSolidOrLiquidBlock(this.field_180294_c.add(j, 0, k))); } @@ -19,7 +19,7 @@ for (int i1 = 0; i1 < this.clayPerChunk; ++i1) { int l1 = this.randomGenerator.nextInt(16) + 8; -@@ -122,6 +125,7 @@ +@@ -121,6 +124,7 @@ this.clayGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getTopSolidOrLiquidBlock(this.field_180294_c.add(l1, 0, i6))); } @@ -27,7 +27,7 @@ for (int j1 = 0; j1 < this.sandPerChunk; ++j1) { int i2 = this.randomGenerator.nextInt(16) + 8; -@@ -136,6 +140,7 @@ +@@ -135,6 +139,7 @@ ++k1; } @@ -35,7 +35,7 @@ for (int j2 = 0; j2 < k1; ++j2) { int k6 = this.randomGenerator.nextInt(16) + 8; -@@ -150,6 +155,7 @@ +@@ -149,6 +154,7 @@ } } @@ -43,7 +43,7 @@ for (int k2 = 0; k2 < this.bigMushroomsPerChunk; ++k2) { int l6 = this.randomGenerator.nextInt(16) + 8; -@@ -157,6 +163,7 @@ +@@ -156,6 +162,7 @@ this.bigMushroomGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getHorizon(this.field_180294_c.add(l6, 0, k10))); } @@ -51,7 +51,7 @@ for (int l2 = 0; l2 < this.flowersPerChunk; ++l2) { int i7 = this.randomGenerator.nextInt(16) + 8; -@@ -178,6 +185,7 @@ +@@ -177,6 +184,7 @@ } } @@ -59,7 +59,7 @@ for (int i3 = 0; i3 < this.grassPerChunk; ++i3) { int j7 = this.randomGenerator.nextInt(16) + 8; -@@ -191,6 +199,7 @@ +@@ -190,6 +198,7 @@ } } @@ -67,7 +67,7 @@ for (int j3 = 0; j3 < this.deadBushPerChunk; ++j3) { int k7 = this.randomGenerator.nextInt(16) + 8; -@@ -204,6 +213,7 @@ +@@ -203,6 +212,7 @@ } } @@ -75,7 +75,7 @@ for (int k3 = 0; k3 < this.waterlilyPerChunk; ++k3) { int l7 = this.randomGenerator.nextInt(16) + 8; -@@ -230,6 +240,8 @@ +@@ -229,6 +239,8 @@ } } @@ -84,7 +84,7 @@ for (int l3 = 0; l3 < this.mushroomsPerChunk; ++l3) { if (this.randomGenerator.nextInt(4) == 0) -@@ -280,7 +292,9 @@ +@@ -279,7 +291,9 @@ this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(j4, l15, l8)); } } @@ -95,7 +95,7 @@ for (int k4 = 0; k4 < this.reedsPerChunk; ++k4) { int i9 = this.randomGenerator.nextInt(16) + 8; -@@ -306,7 +320,8 @@ +@@ -305,7 +319,8 @@ this.reedGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(j9, i19, i13)); } } @@ -105,7 +105,7 @@ if (this.randomGenerator.nextInt(32) == 0) { int i5 = this.randomGenerator.nextInt(16) + 8; -@@ -320,6 +335,7 @@ +@@ -319,6 +334,7 @@ } } @@ -113,7 +113,7 @@ for (int j5 = 0; j5 < this.cactiPerChunk; ++j5) { int l9 = this.randomGenerator.nextInt(16) + 8; -@@ -335,6 +351,7 @@ +@@ -334,6 +350,7 @@ if (this.generateLakes) { @@ -121,7 +121,7 @@ for (int k5 = 0; k5 < 50; ++k5) { int i10 = this.randomGenerator.nextInt(16) + 8; -@@ -349,6 +366,7 @@ +@@ -348,6 +365,7 @@ } } @@ -129,7 +129,7 @@ for (int l5 = 0; l5 < 20; ++l5) { int j10 = this.randomGenerator.nextInt(16) + 8; -@@ -358,6 +376,7 @@ +@@ -357,6 +375,7 @@ (new WorldGenLiquids(Blocks.flowing_lava)).generate(this.currentWorld, this.randomGenerator, blockpos3); } } @@ -137,7 +137,7 @@ } protected void genStandardOre1(int p_76795_1_, WorldGenerator p_76795_2_, int p_76795_3_, int p_76795_4_) -@@ -398,16 +417,29 @@ +@@ -397,16 +416,29 @@ protected void generateOres() { diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch index ad6f56998..5eb0e6287 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenBase.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenBase.java -@@ -139,6 +139,10 @@ +@@ -138,6 +138,10 @@ public BiomeGenBase(int p_i1971_1_) { @@ -11,7 +11,7 @@ this.minHeight = height_Default.rootHeight; this.maxHeight = height_Default.variation; this.temperature = 0.5F; -@@ -153,6 +157,7 @@ +@@ -152,6 +156,7 @@ this.worldGeneratorBigTree = new WorldGenBigTree(false); this.worldGeneratorSwamp = new WorldGenSwamp(); this.biomeID = p_i1971_1_; @@ -19,7 +19,7 @@ biomeList[p_i1971_1_] = this; this.theBiomeDecorator = this.createBiomeDecorator(); this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySheep.class, 12, 4, 4)); -@@ -169,11 +174,12 @@ +@@ -168,11 +173,12 @@ this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityWitch.class, 5, 1, 1)); this.spawnableWaterCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySquid.class, 10, 4, 4)); this.spawnableCaveCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 10, 8, 8)); @@ -33,7 +33,7 @@ } public BiomeGenBase setTemperatureRainfall(float p_76732_1_, float p_76732_2_) -@@ -343,7 +349,7 @@ +@@ -342,7 +348,7 @@ { double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(p_180627_1_), 0.0F, 1.0F); double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); @@ -42,7 +42,7 @@ } @SideOnly(Side.CLIENT) -@@ -351,7 +357,7 @@ +@@ -350,7 +356,7 @@ { double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(p_180625_1_), 0.0F, 1.0F); double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); @@ -51,7 +51,7 @@ } public boolean isSnowyBiome() -@@ -498,6 +504,84 @@ +@@ -497,6 +503,84 @@ } } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch index 663692f46..4ec3410dc 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenForest.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenForest.java -@@ -204,4 +204,20 @@ +@@ -201,4 +201,20 @@ }; } } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch index 69830eb5b..43bbe8c36 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenHills.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenHills.java -@@ -50,7 +50,7 @@ +@@ -49,7 +49,7 @@ int i1 = p_180624_2_.nextInt(16); BlockPos blockpos = p_180624_3_.add(k, l, i1); diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch index 8bda59fbb..0b3e60e87 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenJungle.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenJungle.java -@@ -69,7 +69,9 @@ +@@ -68,7 +68,9 @@ super.decorate(worldIn, p_180624_2_, p_180624_3_); int i = p_180624_2_.nextInt(16) + 8; int j = p_180624_2_.nextInt(16) + 8; diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch index 08d52f9bf..db3f9dfa0 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenPlains.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenPlains.java -@@ -104,4 +104,19 @@ +@@ -103,4 +103,19 @@ biomegenplains.field_150609_ah = 14273354; return biomegenplains; } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch index c4cea2dc1..298d372c2 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java -@@ -86,4 +86,10 @@ +@@ -84,4 +84,10 @@ { return 6975545; } diff --git a/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch b/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch index 6ce27c9c8..1eeff6ed9 100644 --- a/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch @@ -8,7 +8,7 @@ private GenLayer genBiomes; private GenLayer biomeIndexLayer; private BiomeCache biomeCache; -@@ -28,13 +29,7 @@ +@@ -27,13 +28,7 @@ this.biomeCache = new BiomeCache(this); this.field_180301_f = ""; this.biomesToSpawnIn = Lists.newArrayList(); @@ -23,7 +23,7 @@ } public WorldChunkManager(long p_i45744_1_, WorldType p_i45744_3_, String p_i45744_4_) -@@ -42,6 +37,7 @@ +@@ -41,6 +36,7 @@ this(); this.field_180301_f = p_i45744_4_; GenLayer[] agenlayer = GenLayer.initializeAllBiomeGenerators(p_i45744_1_, p_i45744_3_, p_i45744_4_); @@ -31,7 +31,7 @@ this.genBiomes = agenlayer[0]; this.biomeIndexLayer = agenlayer[1]; } -@@ -250,4 +246,11 @@ +@@ -249,4 +245,11 @@ { this.biomeCache.cleanupCache(); } diff --git a/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch b/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch index 7e8a99b80..154d87191 100644 --- a/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch +++ b/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/border/WorldBorder.java +++ ../src-work/minecraft/net/minecraft/world/border/WorldBorder.java -@@ -278,4 +278,9 @@ +@@ -277,4 +277,9 @@ iborderlistener.onWarningDistanceChanged(this, warningDistance); } } diff --git a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch index 51f17e070..4c6fe00bf 100644 --- a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/chunk/Chunk.java +++ ../src-work/minecraft/net/minecraft/world/chunk/Chunk.java -@@ -168,7 +168,7 @@ +@@ -167,7 +167,7 @@ { Block block = this.getBlock0(j, l - 1, k); @@ -9,7 +9,7 @@ { this.heightMap[k << 4 | j] = l; -@@ -441,12 +441,12 @@ +@@ -440,12 +440,12 @@ public int getBlockLightOpacity(BlockPos pos) { @@ -24,7 +24,7 @@ } private Block getBlock0(int x, int y, int z) -@@ -627,14 +627,19 @@ +@@ -623,14 +623,19 @@ extendedblockstorage.set(i, j & 15, k, state); @@ -46,7 +46,7 @@ this.worldObj.removeTileEntity(pos); } } -@@ -651,8 +656,8 @@ +@@ -647,8 +652,8 @@ } else { @@ -57,7 +57,7 @@ if (j1 > 0) { -@@ -672,28 +677,18 @@ +@@ -668,28 +673,18 @@ } } @@ -88,7 +88,7 @@ this.worldObj.setTileEntity(pos, tileentity1); } -@@ -796,6 +791,7 @@ +@@ -792,6 +787,7 @@ k = this.entityLists.length - 1; } @@ -96,7 +96,7 @@ entityIn.addedToChunk = true; entityIn.chunkCoordX = this.xPosition; entityIn.chunkCoordY = k; -@@ -834,13 +830,20 @@ +@@ -830,13 +826,20 @@ private TileEntity createNewTileEntity(BlockPos pos) { Block block = this.getBlock(pos); @@ -118,7 +118,7 @@ if (tileentity == null) { if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE) -@@ -853,11 +856,6 @@ +@@ -849,11 +852,6 @@ this.field_177447_w.add(pos); } } @@ -130,7 +130,7 @@ return tileentity; } -@@ -877,7 +875,7 @@ +@@ -873,7 +871,7 @@ tileEntityIn.setWorldObj(this.worldObj); tileEntityIn.setPos(pos); @@ -139,7 +139,7 @@ { if (this.chunkTileEntityMap.containsKey(pos)) { -@@ -914,8 +912,9 @@ +@@ -910,8 +908,9 @@ entity.onChunkLoad(); } @@ -150,7 +150,7 @@ } public void onChunkUnload() -@@ -931,6 +930,7 @@ +@@ -927,6 +926,7 @@ { this.worldObj.unloadEntities(this.entityLists[i]); } @@ -158,7 +158,7 @@ } public void setChunkModified() -@@ -940,8 +940,8 @@ +@@ -936,8 +936,8 @@ public void getEntitiesWithinAABBForEntity(Entity entityIn, AxisAlignedBB aabb, List listToFill, Predicate p_177414_4_) { @@ -169,7 +169,7 @@ i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); -@@ -980,8 +980,8 @@ +@@ -976,8 +976,8 @@ public void getEntitiesOfTypeWithinAAAB(Class entityClass, AxisAlignedBB aabb, List listToFill, Predicate p_177430_4_) { @@ -180,7 +180,7 @@ i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); -@@ -1141,8 +1141,10 @@ +@@ -1137,8 +1137,10 @@ while (!this.field_177447_w.isEmpty()) { BlockPos blockpos = (BlockPos)this.field_177447_w.poll(); @@ -192,7 +192,7 @@ { TileEntity tileentity = this.createNewTileEntity(blockpos); this.worldObj.setTileEntity(blockpos, tileentity); -@@ -1204,6 +1206,13 @@ +@@ -1200,6 +1202,13 @@ @SideOnly(Side.CLIENT) public void fillChunk(byte[] p_177439_1_, int p_177439_2_, boolean p_177439_3_) { @@ -206,7 +206,7 @@ int i = 0; boolean flag = !this.worldObj.provider.getHasNoSky(); -@@ -1271,10 +1280,16 @@ +@@ -1267,10 +1276,16 @@ this.isTerrainPopulated = true; this.generateHeightMap(); @@ -223,9 +223,9 @@ } public BiomeGenBase getBiome(BlockPos pos, WorldChunkManager chunkManager) -@@ -1589,4 +1604,20 @@ - - private static final String __OBFID = "CL_00002009"; +@@ -1583,4 +1598,20 @@ + QUEUED, + CHECK; } + + /** diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch index 3ed1e56b3..2be4b4a6a 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java +++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java -@@ -43,8 +43,41 @@ +@@ -42,8 +42,41 @@ this.chunkSaveLocation = chunkSaveLocationIn; } @@ -42,7 +42,7 @@ ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(x, z); NBTTagCompound nbttagcompound = (NBTTagCompound)this.chunksToRemove.get(chunkcoordintpair); -@@ -60,11 +93,17 @@ +@@ -59,11 +92,17 @@ nbttagcompound = CompressedStreamTools.read(datainputstream); } @@ -61,7 +61,7 @@ if (!p_75822_4_.hasKey("Level", 10)) { logger.error("Chunk file at " + x + "," + z + " is missing level data, skipping"); -@@ -88,10 +127,29 @@ +@@ -87,10 +126,29 @@ logger.error("Chunk file at " + x + "," + z + " is in the wrong location; relocating. (Expected " + x + ", " + z + ", got " + chunk.xPosition + ", " + chunk.zPosition + ")"); nbttagcompound.setInteger("xPos", x); nbttagcompound.setInteger("zPos", z); @@ -92,7 +92,7 @@ } } } -@@ -106,6 +164,7 @@ +@@ -105,6 +163,7 @@ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound.setTag("Level", nbttagcompound1); this.writeChunkToNBT(chunkIn, worldIn, nbttagcompound1); @@ -100,7 +100,7 @@ this.addChunkToPending(chunkIn.getChunkCoordIntPair(), nbttagcompound); } catch (Exception exception) -@@ -282,11 +341,20 @@ +@@ -281,11 +340,20 @@ { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); @@ -121,7 +121,7 @@ } } -@@ -296,8 +364,17 @@ +@@ -295,8 +363,17 @@ for (TileEntity tileentity : chunkIn.getTileEntityMap().values()) { NBTTagCompound nbttagcompound2 = new NBTTagCompound(); @@ -139,7 +139,7 @@ } p_75820_3_.setTag("TileEntities", nbttaglist2); -@@ -377,6 +454,12 @@ +@@ -376,6 +453,12 @@ chunk.setBiomeArray(p_75823_2_.getByteArray("Biomes")); } @@ -152,7 +152,7 @@ NBTTagList nbttaglist1 = p_75823_2_.getTagList("Entities", 10); if (nbttaglist1 != null) -@@ -448,7 +531,5 @@ +@@ -447,7 +530,5 @@ } } } diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch index be3f87839..8252f4549 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java +++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java -@@ -22,18 +22,12 @@ +@@ -20,18 +20,12 @@ { File file1 = this.getWorldDirectory(); diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch index 8533e65ff..62b0bdc26 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java +++ ../src-work/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java -@@ -35,6 +35,8 @@ +@@ -34,6 +34,8 @@ public void set(int x, int y, int z, IBlockState state) { diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch index 706046539..01c861ed3 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/chunk/storage/RegionFile.java +++ ../src-work/minecraft/net/minecraft/world/chunk/storage/RegionFile.java -@@ -102,6 +102,39 @@ +@@ -101,6 +101,39 @@ } } diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch index 284195ebf..a26c456fc 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch @@ -5,10 +5,10 @@ public List loadedChunks = Lists.newArrayList(); public WorldServer worldObj; + private Set loadingChunks = com.google.common.collect.Sets.newHashSet(); - private static final String __OBFID = "CL_00001436"; public ChunkProviderServer(WorldServer p_i1520_1_, IChunkLoader p_i1520_2_, IChunkProvider p_i1520_3_) -@@ -58,7 +59,7 @@ + { +@@ -57,7 +58,7 @@ public void dropChunk(int p_73241_1_, int p_73241_2_) { @@ -17,7 +17,7 @@ { if (!this.worldObj.isSpawnChunk(p_73241_1_, p_73241_2_)) { -@@ -81,12 +82,64 @@ +@@ -80,12 +81,64 @@ public Chunk loadChunk(int p_73158_1_, int p_73158_2_) { @@ -82,7 +82,7 @@ chunk = this.loadChunkFromFile(p_73158_1_, p_73158_2_); if (chunk == null) -@@ -115,6 +168,7 @@ +@@ -114,6 +167,7 @@ this.id2ChunkMap.add(i, chunk); this.loadedChunks.add(chunk); @@ -90,7 +90,7 @@ chunk.onChunkLoad(); chunk.populateChunk(this, this, p_73158_1_, p_73158_2_); } -@@ -206,6 +260,7 @@ +@@ -205,6 +259,7 @@ if (this.serverChunkGenerator != null) { this.serverChunkGenerator.populate(p_73153_1_, p_73153_2_, p_73153_3_); @@ -98,7 +98,7 @@ chunk.setChunkModified(); } } -@@ -267,6 +322,11 @@ +@@ -266,6 +321,11 @@ { if (!this.worldObj.disableLevelSaving) { @@ -110,7 +110,7 @@ for (int i = 0; i < 100; ++i) { if (!this.droppedChunksSet.isEmpty()) -@@ -281,6 +341,12 @@ +@@ -280,6 +340,12 @@ this.saveChunkExtraData(chunk); this.id2ChunkMap.remove(olong.longValue()); this.loadedChunks.remove(chunk); diff --git a/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch b/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch index 48e386ee6..9c89eb5b3 100644 --- a/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/MapGenRavine.java +++ ../src-work/minecraft/net/minecraft/world/gen/MapGenRavine.java -@@ -129,7 +129,7 @@ +@@ -128,7 +128,7 @@ { IBlockState iblockstate = p_180707_5_.getBlockState(j1, l1, k1); @@ -9,7 +9,7 @@ { flag2 = true; } -@@ -166,28 +166,12 @@ +@@ -165,28 +165,12 @@ { IBlockState iblockstate1 = p_180707_5_.getBlockState(j3, j2, i2); @@ -40,7 +40,7 @@ } } } -@@ -222,4 +206,68 @@ +@@ -221,4 +205,68 @@ } } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch index c17ab4e67..1b9ac00c1 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java -@@ -33,4 +33,10 @@ +@@ -31,4 +31,10 @@ this.func_175903_a(worldIn, p_175921_2_, Blocks.dirt.getDefaultState()); } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch index dd5301bd2..a7d6dc424 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java -@@ -55,7 +55,7 @@ +@@ -54,7 +54,7 @@ { Block block = worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(l, j, i1)).getBlock(); @@ -9,7 +9,7 @@ { flag = false; } -@@ -191,7 +191,7 @@ +@@ -190,7 +190,7 @@ { BlockPos blockpos = new BlockPos(l1, l2, i2); @@ -18,7 +18,7 @@ { this.func_175903_a(worldIn, blockpos, this.mushroomType.getDefaultState().withProperty(BlockHugeMushroom.VARIANT, blockhugemushroom$enumtype)); } -@@ -202,9 +202,10 @@ +@@ -201,9 +201,10 @@ for (int i3 = 0; i3 < i; ++i3) { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch index d44de7d8f..e4bc6f945 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java -@@ -100,9 +100,9 @@ +@@ -99,9 +99,9 @@ if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_181631_2_ * p_181631_2_)) { BlockPos blockpos = p_181631_1_.add(j, 0, k); @@ -12,7 +12,7 @@ { this.func_175903_a(this.world, blockpos, p_181631_3_); } -@@ -255,7 +255,7 @@ +@@ -254,7 +254,7 @@ { BlockPos blockpos1 = p_175936_1_.add((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2)); @@ -21,7 +21,7 @@ { return j; } -@@ -283,6 +283,7 @@ +@@ -282,6 +282,7 @@ if (!this.validTreeLocation()) { @@ -29,7 +29,7 @@ return false; } else -@@ -291,15 +292,18 @@ +@@ -290,15 +291,18 @@ this.func_175941_b(); this.func_175942_c(); this.func_175939_d(); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch index 6a5cb5826..c471dd264 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java -@@ -34,9 +34,10 @@ +@@ -33,9 +33,10 @@ if (k >= 1 && k + i + 1 < 256) { BlockPos blockpos = p_180709_3_.down(); @@ -13,7 +13,7 @@ { return false; } -@@ -46,10 +47,10 @@ +@@ -45,10 +46,10 @@ } else { @@ -28,7 +28,7 @@ EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(p_180709_2_); int i1 = i - p_180709_2_.nextInt(4); int j1 = 2 - p_180709_2_.nextInt(3); -@@ -68,9 +69,9 @@ +@@ -67,9 +68,9 @@ int k2 = k + j2; BlockPos blockpos1 = new BlockPos(k1, k2, l1); @@ -40,7 +40,7 @@ { this.func_181639_b(worldIn, blockpos1); this.func_181639_b(worldIn, blockpos1.east()); -@@ -188,7 +189,7 @@ +@@ -187,7 +188,7 @@ { for (int k1 = -i1; k1 <= i1; ++k1) { @@ -49,7 +49,7 @@ { return false; } -@@ -210,11 +211,17 @@ +@@ -209,11 +210,17 @@ private void func_150526_a(World worldIn, int p_150526_2_, int p_150526_3_, int p_150526_4_) { BlockPos blockpos = new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch index f831c5456..7a7cd9a52 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java -@@ -15,10 +15,12 @@ +@@ -13,10 +13,12 @@ { Block block; diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch index 17e83e43e..af707653c 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java -@@ -59,7 +59,7 @@ +@@ -58,7 +58,7 @@ { if (j >= 0 && j < 256) { @@ -9,7 +9,7 @@ { flag = false; } -@@ -78,11 +78,13 @@ +@@ -77,11 +77,13 @@ } else { @@ -26,7 +26,7 @@ for (int i2 = p_180709_3_.getY() - 3 + i; i2 <= p_180709_3_.getY() + i; ++i2) { -@@ -102,7 +104,7 @@ +@@ -101,7 +103,7 @@ BlockPos blockpos = new BlockPos(i3, i2, k1); Block block = worldIn.getBlockState(blockpos).getBlock(); @@ -35,7 +35,7 @@ { this.func_175903_a(worldIn, blockpos, field_181630_b); } -@@ -113,9 +115,9 @@ +@@ -112,9 +114,9 @@ for (int j2 = 0; j2 < i; ++j2) { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch index 27dae21c4..4cfafd4f6 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java -@@ -60,7 +60,7 @@ +@@ -59,7 +59,7 @@ { for (int l = -j; l <= j && flag; ++l) { @@ -9,7 +9,7 @@ { flag = false; } -@@ -80,13 +80,14 @@ +@@ -79,13 +79,14 @@ { BlockPos blockpos = p_175927_1_.down(); Block block = worldIn.getBlockState(blockpos).getBlock(); @@ -29,7 +29,7 @@ return true; } else -@@ -114,9 +115,9 @@ +@@ -113,9 +114,9 @@ if (j * j + k * k <= i || l * l + i1 * i1 <= i || j * j + i1 * i1 <= i || l * l + k * k <= i) { BlockPos blockpos = p_175925_2_.add(j, 0, k); @@ -41,7 +41,7 @@ { this.func_175903_a(worldIn, blockpos, this.leavesMetadata); } -@@ -136,9 +137,9 @@ +@@ -135,9 +136,9 @@ if (j * j + k * k <= i) { BlockPos blockpos = p_175928_2_.add(j, 0, k); @@ -53,7 +53,7 @@ { this.func_175903_a(worldIn, blockpos, this.leavesMetadata); } -@@ -146,4 +147,10 @@ +@@ -145,4 +146,10 @@ } } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch index 6a5d20fe9..4857ef044 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java -@@ -57,7 +57,7 @@ +@@ -55,7 +55,7 @@ { BlockPos blockpos = p_180709_3_.up(i2); @@ -9,7 +9,7 @@ { this.func_175903_a(worldIn, blockpos, this.woodMetadata); -@@ -72,7 +72,7 @@ +@@ -70,7 +70,7 @@ { BlockPos blockpos1 = blockpos.east(); @@ -18,7 +18,7 @@ { this.func_175903_a(worldIn, blockpos1, this.woodMetadata); -@@ -85,7 +85,7 @@ +@@ -83,7 +83,7 @@ BlockPos blockpos2 = blockpos.south().east(); @@ -27,7 +27,7 @@ { this.func_175903_a(worldIn, blockpos2, this.woodMetadata); -@@ -98,7 +98,7 @@ +@@ -96,7 +96,7 @@ BlockPos blockpos3 = blockpos.south(); @@ -36,7 +36,7 @@ { this.func_175903_a(worldIn, blockpos3, this.woodMetadata); -@@ -132,4 +132,11 @@ +@@ -130,4 +130,11 @@ this.func_175925_a(worldIn, p_175930_2_.up(j), p_175930_3_ + 1 - j); } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch index 4159f4282..e4b20bc16 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java -@@ -44,30 +44,24 @@ +@@ -43,30 +43,24 @@ { Block block = worldIn.getBlockState(p_180709_3_.up(j)).getBlock(); @@ -35,7 +35,7 @@ { this.func_175903_a(worldIn, p_180709_3_.add(0, j, 1), this.woodMetadata); } -@@ -133,16 +127,23 @@ +@@ -132,16 +126,23 @@ BlockPos blockpos = p_175934_2_.up(i); Block block = worldIn.getBlockState(blockpos).getBlock(); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch index e8ae4f03e..dd22281dd 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java -@@ -74,7 +74,7 @@ +@@ -73,7 +73,7 @@ { BlockPos blockpos = new BlockPos(l1, i2, j2); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch index 3d16c0867..2e8a83dcd 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java -@@ -53,7 +53,7 @@ +@@ -52,7 +52,7 @@ { if (j >= 0 && j < 256) { @@ -9,7 +9,7 @@ { flag = false; } -@@ -72,11 +72,13 @@ +@@ -71,11 +71,13 @@ } else { @@ -26,7 +26,7 @@ EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(p_180709_2_); int k2 = i - p_180709_2_.nextInt(4) - 1; int l2 = 3 - p_180709_2_.nextInt(3); -@@ -96,9 +98,9 @@ +@@ -95,9 +97,9 @@ } BlockPos blockpos = new BlockPos(i3, i2, j1); @@ -38,7 +38,7 @@ { this.func_181642_b(worldIn, blockpos); k1 = i2; -@@ -150,9 +152,9 @@ +@@ -149,9 +151,9 @@ i3 += enumfacing1.getFrontOffsetX(); j1 += enumfacing1.getFrontOffsetZ(); BlockPos blockpos1 = new BlockPos(i3, j2, j1); @@ -50,7 +50,7 @@ { this.func_181642_b(worldIn, blockpos1); k1 = j2; -@@ -210,9 +212,9 @@ +@@ -209,9 +211,9 @@ private void func_175924_b(World worldIn, BlockPos p_175924_2_) { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch index 24a18af07..30cd89004 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java -@@ -25,14 +25,16 @@ +@@ -24,14 +24,16 @@ { Block block; @@ -20,7 +20,7 @@ { p_180709_3_ = p_180709_3_.up(); this.func_175903_a(worldIn, p_180709_3_, this.field_150527_b); -@@ -54,7 +56,7 @@ +@@ -53,7 +55,7 @@ { BlockPos blockpos = new BlockPos(l, i, j1); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch index ad4f76817..746094c2a 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java -@@ -61,7 +61,7 @@ +@@ -60,7 +60,7 @@ { Block block = worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(l, j, i1)).getBlock(); @@ -9,7 +9,7 @@ { if (block != Blocks.water && block != Blocks.flowing_water) { -@@ -87,11 +87,13 @@ +@@ -86,11 +86,13 @@ } else { @@ -26,7 +26,7 @@ for (int l1 = p_180709_3_.getY() - 3 + i; l1 <= p_180709_3_.getY() + i; ++l1) { -@@ -110,7 +112,7 @@ +@@ -109,7 +111,7 @@ { BlockPos blockpos = new BlockPos(k3, l1, j1); @@ -35,7 +35,7 @@ { this.func_175903_a(worldIn, blockpos, field_181649_b); } -@@ -121,9 +123,10 @@ +@@ -120,9 +122,10 @@ for (int i2 = 0; i2 < i; ++i2) { @@ -48,7 +48,7 @@ { this.func_175903_a(worldIn, p_180709_3_.up(i2), field_181648_a); } -@@ -141,29 +144,29 @@ +@@ -140,29 +143,29 @@ { blockpos$mutableblockpos1.func_181079_c(i4, j2, j4); @@ -83,7 +83,7 @@ { this.func_181647_a(worldIn, blockpos2, BlockVine.NORTH); } -@@ -192,7 +195,7 @@ +@@ -191,7 +194,7 @@ this.func_175903_a(p_181647_1_, p_181647_2_, iblockstate); int i = 4; diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch index dadf0ec27..22900fea0 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java -@@ -54,7 +54,7 @@ +@@ -53,7 +53,7 @@ { if (i1 >= 0 && i1 < 256) { @@ -9,7 +9,7 @@ { flag = false; } -@@ -73,11 +73,13 @@ +@@ -72,11 +72,13 @@ } else { @@ -26,7 +26,7 @@ int k2 = 0; for (int l2 = p_180709_3_.getY() + i; l2 >= p_180709_3_.getY() + j; --l2) -@@ -94,7 +96,7 @@ +@@ -93,7 +95,7 @@ { BlockPos blockpos = new BlockPos(j3, l2, i2); @@ -35,7 +35,7 @@ { this.func_175903_a(worldIn, blockpos, field_181637_b); } -@@ -114,9 +116,10 @@ +@@ -113,9 +115,10 @@ for (int i3 = 0; i3 < i - 1; ++i3) { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch index 2f98ff9d8..d52f8a4e0 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java -@@ -56,7 +56,7 @@ +@@ -55,7 +55,7 @@ { Block block = worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, i1, l1)).getBlock(); @@ -9,7 +9,7 @@ { flag = false; } -@@ -75,11 +75,13 @@ +@@ -74,11 +74,13 @@ } else { @@ -26,7 +26,7 @@ int i3 = p_180709_2_.nextInt(2); int j3 = 1; int k3 = 0; -@@ -100,7 +102,7 @@ +@@ -99,7 +101,7 @@ { BlockPos blockpos = new BlockPos(i2, j4, k2); @@ -35,7 +35,7 @@ { this.func_175903_a(worldIn, blockpos, field_181646_b); } -@@ -129,9 +131,10 @@ +@@ -128,9 +130,10 @@ for (int k4 = 0; k4 < i - i4; ++k4) { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch index b4a3e7320..11a61b3ab 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java -@@ -23,10 +23,12 @@ +@@ -22,10 +22,12 @@ { Block block; diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch index bcb74f72a..50df160cc 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java -@@ -69,7 +69,7 @@ +@@ -68,7 +68,7 @@ { if (j >= 0 && j < 256) { @@ -9,7 +9,7 @@ { flag = false; } -@@ -88,11 +88,13 @@ +@@ -87,11 +87,13 @@ } else { @@ -26,7 +26,7 @@ int k2 = 3; int l2 = 0; -@@ -114,7 +116,7 @@ +@@ -113,7 +115,7 @@ BlockPos blockpos = new BlockPos(k1, i3, i2); Block block = worldIn.getBlockState(blockpos).getBlock(); @@ -35,7 +35,7 @@ { this.func_175903_a(worldIn, blockpos, this.metaLeaves); } -@@ -125,9 +127,10 @@ +@@ -124,9 +126,10 @@ for (int j3 = 0; j3 < i; ++j3) { @@ -48,7 +48,7 @@ { this.func_175903_a(worldIn, p_180709_3_.up(j3), this.metaWood); -@@ -170,29 +173,29 @@ +@@ -169,29 +172,29 @@ { blockpos$mutableblockpos1.func_181079_c(l4, k3, i5); @@ -83,7 +83,7 @@ { this.func_181650_b(worldIn, blockpos1, BlockVine.NORTH); } -@@ -246,7 +249,7 @@ +@@ -245,7 +248,7 @@ this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); int i = 4; diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch index e46096942..3eba1fe80 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java -@@ -27,10 +27,12 @@ +@@ -26,10 +26,12 @@ { Block block; diff --git a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch index f29f9f475..d64cd4400 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java -@@ -29,11 +29,18 @@ +@@ -28,11 +28,18 @@ for (BiomeGenBase biomegenbase : BiomeGenBase.getBiomeGenArray()) { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch index 9c8ed27ef..c2d5ed167 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java -@@ -221,12 +221,12 @@ +@@ -217,12 +217,12 @@ { if (this.field_143029_e == null) { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch index f1ec9e600..9f41e1cad 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureComponent.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureComponent.java -@@ -36,6 +36,10 @@ +@@ -35,6 +35,10 @@ public NBTTagCompound func_143010_b() { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch index 93dc9905c..b4b94753a 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java -@@ -156,7 +156,7 @@ +@@ -154,7 +154,7 @@ if (this.field_111021_b && p_74875_3_.func_175898_b(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) { this.field_111021_b = false; @@ -9,7 +9,7 @@ } this.func_175804_a(worldIn, p_74875_3_, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); -@@ -228,7 +228,7 @@ +@@ -225,7 +225,7 @@ if (this.field_111020_b && p_74875_3_.func_175898_b(new BlockPos(this.getXWithOffset(1, 3), this.getYWithOffset(2), this.getZWithOffset(1, 3)))) { this.field_111020_b = false; @@ -18,11 +18,11 @@ } this.func_175804_a(worldIn, p_74875_3_, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); -@@ -963,6 +963,7 @@ +@@ -943,6 +943,7 @@ abstract static class Piece extends StructureComponent { protected static final List field_111019_a = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.diamond, 0, 1, 3, 5), new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 5), new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 15), new WeightedRandomChestContent(Items.golden_sword, 0, 1, 1, 5), new WeightedRandomChestContent(Items.golden_chestplate, 0, 1, 1, 5), new WeightedRandomChestContent(Items.flint_and_steel, 0, 1, 1, 5), new WeightedRandomChestContent(Items.nether_wart, 0, 3, 7, 5), new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 10), new WeightedRandomChestContent(Items.golden_horse_armor, 0, 1, 1, 8), new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 5), new WeightedRandomChestContent(Items.diamond_horse_armor, 0, 1, 1, 3), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.obsidian), 0, 2, 4, 2)}); + static { net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, field_111019_a, 2, 5); } - private static final String __OBFID = "CL_00000466"; public Piece() + { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch index 1dd1abc4d..da767fef7 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureStart.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureStart.java -@@ -63,6 +63,10 @@ +@@ -62,6 +62,10 @@ public NBTTagCompound func_143021_a(int p_143021_1_, int p_143021_2_) { @@ -11,7 +11,7 @@ NBTTagCompound nbttagcompound = new NBTTagCompound(); nbttagcompound.setString("id", MapGenStructureIO.func_143033_a(this)); nbttagcompound.setInteger("ChunkX", p_143021_1_); -@@ -98,7 +102,8 @@ +@@ -97,7 +101,8 @@ for (int i = 0; i < nbttaglist.tagCount(); ++i) { diff --git a/patches/minecraft/net/minecraft/world/storage/MapData.java.patch b/patches/minecraft/net/minecraft/world/storage/MapData.java.patch index 734f0896c..ab579d3d1 100644 --- a/patches/minecraft/net/minecraft/world/storage/MapData.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/MapData.java.patch @@ -9,7 +9,7 @@ public byte scale; public byte[] colors = new byte[16384]; public List playersArrayList = Lists.newArrayList(); -@@ -45,7 +45,17 @@ +@@ -44,7 +44,17 @@ public void readFromNBT(NBTTagCompound nbt) { @@ -28,7 +28,7 @@ this.xCenter = nbt.getInteger("xCenter"); this.zCenter = nbt.getInteger("zCenter"); this.scale = nbt.getByte("scale"); -@@ -86,7 +96,7 @@ +@@ -85,7 +95,7 @@ public void writeToNBT(NBTTagCompound nbt) { @@ -37,7 +37,7 @@ nbt.setInteger("xCenter", this.xCenter); nbt.setInteger("zCenter", this.zCenter); nbt.setByte("scale", this.scale); -@@ -165,7 +175,7 @@ +@@ -164,7 +174,7 @@ p_82567_8_ = p_82567_8_ + (p_82567_8_ < 0.0D ? -8.0D : 8.0D); b2 = (byte)((int)(p_82567_8_ * 16.0D / 360.0D)); diff --git a/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch b/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch index a8c83b6be..e8fb0c830 100644 --- a/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/storage/SaveHandler.java +++ ../src-work/minecraft/net/minecraft/world/storage/SaveHandler.java -@@ -105,13 +105,17 @@ +@@ -104,13 +104,17 @@ { File file1 = new File(this.worldDirectory, "level.dat"); @@ -19,7 +19,7 @@ } catch (Exception exception1) { -@@ -119,6 +123,7 @@ +@@ -118,6 +122,7 @@ } } @@ -27,7 +27,7 @@ file1 = new File(this.worldDirectory, "level.dat_old"); if (file1.exists()) -@@ -127,7 +132,13 @@ +@@ -126,7 +131,13 @@ { NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1)); NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Data"); @@ -42,7 +42,7 @@ } catch (Exception exception) { -@@ -144,6 +155,8 @@ +@@ -143,6 +154,8 @@ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setTag("Data", nbttagcompound); @@ -51,7 +51,7 @@ try { File file1 = new File(this.worldDirectory, "level.dat_new"); -@@ -182,6 +195,8 @@ +@@ -181,6 +194,8 @@ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setTag("Data", nbttagcompound); @@ -60,7 +60,7 @@ try { File file1 = new File(this.worldDirectory, "level.dat_new"); -@@ -230,6 +245,7 @@ +@@ -229,6 +244,7 @@ } file1.renameTo(file2); @@ -68,7 +68,7 @@ } catch (Exception var5) { -@@ -260,6 +276,7 @@ +@@ -259,6 +275,7 @@ p_75752_1_.readFromNBT(nbttagcompound); } @@ -76,7 +76,7 @@ return nbttagcompound; } -@@ -301,4 +318,22 @@ +@@ -300,4 +317,22 @@ { return this.saveDirectoryName; } diff --git a/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch b/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch index 7f2a2a393..a95b7f74e 100644 --- a/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch @@ -1,14 +1,14 @@ --- ../src-base/minecraft/net/minecraft/world/storage/WorldInfo.java +++ ../src-work/minecraft/net/minecraft/world/storage/WorldInfo.java -@@ -52,6 +52,7 @@ +@@ -51,6 +51,7 @@ + private int borderWarningDistance = 5; private int borderWarningTime = 15; private GameRules theGameRules = new GameRules(); - private static final String __OBFID = "CL_00000587"; + private java.util.Map additionalProperties; protected WorldInfo() { -@@ -755,4 +756,24 @@ +@@ -745,4 +746,24 @@ } }); } diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index 8d4974c81..754ae072b 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -222,3 +222,7 @@ protected net.minecraft.client.gui.FontRenderer field_78295_j # posX protected net.minecraft.client.gui.FontRenderer field_78296_k # posY protected net.minecraft.client.gui.FontRenderer func_78266_a(IZ)F # renderDefaultChar protected net.minecraft.client.gui.FontRenderer func_78277_a(CZ)F # renderUnicodeChar + +# ServerConfigurationManager +public net.minecraft.server.management.ServerConfigurationManager field_72404_b #playerEntityList - private in 1.8.8 +public net.minecraft.server.management.ServerConfigurationManager field_177454_f #uuidToPlayerMap - private in 1.8.8 From da03639bd7530db57ec95e5f375a3789378064ba Mon Sep 17 00:00:00 2001 From: cpw Date: Fri, 13 Nov 2015 02:32:08 -0500 Subject: [PATCH 030/133] All the patches done? Some code fixups.. It begins. --- .../network/NetHandlerPlayServer.java.patch | 121 +++++++++++++++ .../network/NetHandlerLoginServer.java.patch | 8 +- .../minecraft/world/SpawnerAnimals.java.patch | 51 +++++++ .../world/gen/ChunkProviderEnd.java.patch | 67 +++++++++ .../gen/ChunkProviderGenerate.java.patch | 110 ++++++++++++++ .../world/gen/ChunkProviderHell.java.patch | 141 ++++++++++++++++++ .../world/gen/MapGenCaves.java.patch | 119 +++++++++++++++ .../gen/feature/WorldGenDungeons.java.patch | 30 ++++ .../world/gen/layer/GenLayer.java.patch | 55 +++++++ .../world/gen/layer/GenLayerBiome.java.patch | 94 ++++++++++++ ...ComponentScatteredFeaturePieces.java.patch | 79 ++++++++++ .../StructureMineshaftPieces.java.patch | 33 ++++ .../StructureStrongholdPieces.java.patch | 75 ++++++++++ .../StructureVillagePieces.java.patch | 84 +++++++++++ .../fml/common/launcher/FMLDeobfTweaker.java | 2 +- .../common/network/PacketLoggingHandler.java | 4 +- .../network/handshake/NetworkDispatcher.java | 6 +- .../network/internal/EntitySpawnHandler.java | 4 +- .../common/network/internal/FMLMessage.java | 3 +- .../fml/common/registry/VillagerRegistry.java | 12 +- 20 files changed, 1081 insertions(+), 17 deletions(-) create mode 100644 patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch create mode 100644 patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch diff --git a/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch b/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch new file mode 100644 index 000000000..dbd27862d --- /dev/null +++ b/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch @@ -0,0 +1,121 @@ +--- ../src-base/minecraft/net/minecraft/network/NetHandlerPlayServer.java ++++ ../src-work/minecraft/net/minecraft/network/NetHandlerPlayServer.java +@@ -254,6 +254,8 @@ + this.playerEntity.ridingEntity.updateRiderPosition(); + } + ++ if (!this.hasMoved) return; //Fixes teleportation kick while riding entities ++ + this.serverController.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); + + if (this.playerEntity.ridingEntity != null) +@@ -350,6 +352,8 @@ + this.playerEntity.jump(); + } + ++ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving ++ + this.playerEntity.moveEntity(d11, d12, d13); + this.playerEntity.onGround = packetIn.isOnGround(); + d11 = d8 - this.playerEntity.posX; +@@ -370,6 +374,8 @@ + logger.warn(this.playerEntity.getName() + " moved wrongly!"); + } + ++ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving ++ + this.playerEntity.setPositionAndRotation(d8, d9, d10, f1, f2); + this.playerEntity.addMovementStat(this.playerEntity.posX - d0, this.playerEntity.posY - d1, this.playerEntity.posZ - d2); + +@@ -377,7 +383,7 @@ + { + boolean flag2 = worldserver.getCollidingBoundingBoxes(this.playerEntity, this.playerEntity.getEntityBoundingBox().contract((double)f3, (double)f3, (double)f3)).isEmpty(); + +- if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping()) ++ if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping() && !this.playerEntity.noClip) + { + this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, f1, f2); + return; +@@ -405,6 +411,8 @@ + this.floatingTickCount = 0; + } + ++ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving ++ + this.playerEntity.onGround = packetIn.isOnGround(); + this.serverController.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); + this.playerEntity.handleFalling(this.playerEntity.posY - d7, packetIn.isOnGround()); +@@ -497,7 +505,10 @@ + double d2 = this.playerEntity.posZ - ((double)blockpos.getZ() + 0.5D); + double d3 = d0 * d0 + d1 * d1 + d2 * d2; + +- if (d3 > 36.0D) ++ double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 1; ++ dist *= dist; ++ ++ if (d3 > dist) + { + return; + } +@@ -549,6 +560,7 @@ + WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); + ItemStack itemstack = this.playerEntity.inventory.getCurrentItem(); + boolean flag = false; ++ boolean placeResult = true; + BlockPos blockpos = packetIn.getPosition(); + EnumFacing enumfacing = EnumFacing.getFront(packetIn.getPlacedBlockDirection()); + this.playerEntity.markPlayerActive(); +@@ -560,13 +572,20 @@ + return; + } + ++ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(playerEntity, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, worldserver, new BlockPos(0, 0, 0), null); ++ if (event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ { + this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, worldserver, itemstack); ++ } + } + else if (blockpos.getY() < this.serverController.getBuildLimit() - 1 || enumfacing != EnumFacing.UP && blockpos.getY() < this.serverController.getBuildLimit()) + { +- if (this.hasMoved && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < 64.0D && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) ++ double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 3; ++ dist *= dist; ++ if (this.hasMoved && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < dist && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) + { +- this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, blockpos, enumfacing, packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ()); ++ // record block place result so we can update client itemstack size if place event was cancelled. ++ placeResult = this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, blockpos, enumfacing, packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ()); + } + + flag = true; +@@ -601,7 +620,7 @@ + this.playerEntity.openContainer.detectAndSendChanges(); + this.playerEntity.isChangingQuantityOnly = false; + +- if (!ItemStack.areItemStacksEqual(this.playerEntity.inventory.getCurrentItem(), packetIn.getStack())) ++ if (!ItemStack.areItemStacksEqual(this.playerEntity.inventory.getCurrentItem(), packetIn.getStack()) || !placeResult) // force client itemstack update if place event was cancelled + { + this.sendPacket(new S2FPacketSetSlot(this.playerEntity.openContainer.windowId, slot.slotNumber, this.playerEntity.inventory.getCurrentItem())); + } +@@ -770,8 +789,10 @@ + } + else + { +- IChatComponent ichatcomponent = new ChatComponentTranslation("chat.type.text", new Object[] {this.playerEntity.getDisplayName(), s}); +- this.serverController.getConfigurationManager().sendChatMsgImpl(ichatcomponent, false); ++ ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("chat.type.text", this.playerEntity.getDisplayName(), net.minecraftforge.common.ForgeHooks.newChatWithLinks(s)); ++ IChatComponent chat = net.minecraftforge.common.ForgeHooks.onServerChatEvent(this, s, chatcomponenttranslation1); ++ if (chat == null) return; ++ this.serverController.getConfigurationManager().sendChatMsgImpl(chat, false); + } + + this.chatSpamThresholdCount += 20; +@@ -916,7 +937,7 @@ + return; + } + +- this.playerEntity = this.serverController.getConfigurationManager().recreatePlayerEntity(this.playerEntity, 0, false); ++ this.playerEntity = this.serverController.getConfigurationManager().recreatePlayerEntity(this.playerEntity, playerEntity.dimension, false); + } + + break; diff --git a/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch b/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch index 0cd7c7fb2..207663b90 100644 --- a/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch +++ b/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch @@ -1,6 +1,12 @@ --- ../src-base/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java +++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java -@@ -71,7 +71,7 @@ +@@ -66,12 +66,12 @@ + if (entityplayermp == null) + { + this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT; +- this.server.getConfigurationManager().initializeConnectionToPlayer(this.networkManager, this.field_181025_l); ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.getConfigurationManager(), this.networkManager, this.field_181025_l); + this.field_181025_l = null; } } diff --git a/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch b/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch new file mode 100644 index 000000000..01632c7d2 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch @@ -0,0 +1,51 @@ +--- ../src-base/minecraft/net/minecraft/world/SpawnerAnimals.java ++++ ../src-work/minecraft/net/minecraft/world/SpawnerAnimals.java +@@ -69,14 +69,15 @@ + { + if ((!enumcreaturetype.getPeacefulCreature() || p_77192_3_) && (enumcreaturetype.getPeacefulCreature() || p_77192_2_) && (!enumcreaturetype.getAnimal() || p_77192_4_)) + { +- int j4 = p_77192_1_.countEntities(enumcreaturetype.getCreatureClass()); ++ int j4 = p_77192_1_.countEntities(enumcreaturetype, true); + int k4 = enumcreaturetype.getMaxNumberOfCreature() * i / MOB_COUNT_DIV; + + if (j4 <= k4) + { ++ java.util.ArrayList shuffled = com.google.common.collect.Lists.newArrayList(this.eligibleChunksForSpawning); ++ java.util.Collections.shuffle(shuffled); + label374: +- +- for (ChunkCoordIntPair chunkcoordintpair1 : this.eligibleChunksForSpawning) ++ for (ChunkCoordIntPair chunkcoordintpair1 : shuffled) + { + BlockPos blockpos = getRandomChunkPosition(p_77192_1_, chunkcoordintpair1.chunkXPos, chunkcoordintpair1.chunkZPos); + int k1 = blockpos.getX(); +@@ -134,8 +135,10 @@ + + entityliving.setLocationAndAngles((double)f, (double)i3, (double)f1, p_77192_1_.rand.nextFloat() * 360.0F, 0.0F); + +- if (entityliving.getCanSpawnHere() && entityliving.handleLavaMovement()) ++ net.minecraftforge.fml.common.eventhandler.Event.Result canSpawn = net.minecraftforge.event.ForgeEventFactory.canEntitySpawn(entityliving, p_77192_1_, f, l2, f1); ++ if (canSpawn == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || (canSpawn == net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT && (entityliving.getCanSpawnHere() && entityliving.handleLavaMovement()))) + { ++ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(entityliving, p_77192_1_, f1, l2, f1)) + ientitylivingdata = entityliving.func_180482_a(p_77192_1_.getDifficultyForLocation(new BlockPos(entityliving)), ientitylivingdata); + + if (entityliving.handleLavaMovement()) +@@ -144,7 +147,7 @@ + p_77192_1_.spawnEntityInWorld(entityliving); + } + +- if (j2 >= entityliving.getMaxSpawnedInChunk()) ++ if (i2 >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(entityliving)) + { + continue label374; + } +@@ -193,7 +196,7 @@ + { + BlockPos blockpos = pos.down(); + +- if (!World.doesBlockHaveSolidTopSurface(worldIn, blockpos)) ++ if (!worldIn.getBlockState(blockpos).getBlock().canCreatureSpawn(worldIn, blockpos, p_180267_0_)) + { + return false; + } diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch new file mode 100644 index 000000000..45b2a8d71 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch @@ -0,0 +1,67 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java ++++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java +@@ -32,6 +32,9 @@ + double[] noiseData3; + double[] noiseData4; + double[] noiseData5; ++ // temporary variables used during event handling ++ private int chunkX = 0; ++ private int chunkZ = 0; + + public ChunkProviderEnd(World worldIn, long p_i2007_2_) + { +@@ -42,6 +45,14 @@ + this.noiseGen3 = new NoiseGeneratorOctaves(this.endRNG, 8); + this.noiseGen4 = new NoiseGeneratorOctaves(this.endRNG, 10); + this.noiseGen5 = new NoiseGeneratorOctaves(this.endRNG, 16); ++ ++ NoiseGenerator[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5}; ++ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(worldIn, this.endRNG, noiseGens); ++ this.noiseGen1 = (NoiseGeneratorOctaves)noiseGens[0]; ++ this.noiseGen2 = (NoiseGeneratorOctaves)noiseGens[1]; ++ this.noiseGen3 = (NoiseGeneratorOctaves)noiseGens[2]; ++ this.noiseGen4 = (NoiseGeneratorOctaves)noiseGens[3]; ++ this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4]; + } + + public void func_180520_a(int p_180520_1_, int p_180520_2_, ChunkPrimer p_180520_3_) +@@ -114,6 +125,9 @@ + + public void func_180519_a(ChunkPrimer p_180519_1_) + { ++ net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks(this, chunkX, chunkZ, p_180519_1_, this.endWorld); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return; + for (int i = 0; i < 16; ++i) + { + for (int j = 0; j < 16; ++j) +@@ -165,6 +179,7 @@ + + public Chunk provideChunk(int x, int z) + { ++ chunkX = x; chunkZ = z; + this.endRNG.setSeed((long)x * 341873128712L + (long)z * 132897987541L); + ChunkPrimer chunkprimer = new ChunkPrimer(); + this.biomesForGeneration = this.endWorld.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16); +@@ -184,6 +199,10 @@ + + private double[] initializeNoiseField(double[] p_73187_1_, int p_73187_2_, int p_73187_3_, int p_73187_4_, int p_73187_5_, int p_73187_6_, int p_73187_7_) + { ++ net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField(this, p_73187_1_, p_73187_2_, p_73187_3_, p_73187_4_, p_73187_5_, p_73187_6_, p_73187_7_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.noisefield; ++ + if (p_73187_1_ == null) + { + p_73187_1_ = new double[p_73187_5_ * p_73187_6_ * p_73187_7_]; +@@ -273,8 +292,10 @@ + public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) + { + BlockFalling.fallInstantly = true; ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, endWorld, endWorld.rand, p_73153_2_, p_73153_3_, false)); + BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); + this.endWorld.getBiomeGenForCoords(blockpos.add(16, 0, 16)).decorate(this.endWorld, this.endWorld.rand, blockpos); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, endWorld, endWorld.rand, p_73153_2_, p_73153_3_, false)); + BlockFalling.fallInstantly = false; + } + diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch new file mode 100644 index 000000000..12ffaf777 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch @@ -0,0 +1,110 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java ++++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java +@@ -58,6 +58,15 @@ + + public ChunkProviderGenerate(World worldIn, long p_i45636_2_, boolean p_i45636_4_, String p_i45636_5_) + { ++ { ++ caveGenerator = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(caveGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE); ++ strongholdGenerator = (MapGenStronghold)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(strongholdGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.STRONGHOLD); ++ villageGenerator = (MapGenVillage)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(villageGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE); ++ mineshaftGenerator = (MapGenMineshaft)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(mineshaftGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.MINESHAFT); ++ scatteredFeatureGenerator = (MapGenScatteredFeature)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(scatteredFeatureGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.SCATTERED_FEATURE); ++ ravineGenerator = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(ravineGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.RAVINE); ++ oceanMonumentGenerator = (StructureOceanMonument)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(oceanMonumentGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.OCEAN_MONUMENT); ++ } + this.worldObj = worldIn; + this.mapFeaturesEnabled = p_i45636_4_; + this.field_177475_o = worldIn.getWorldInfo().getTerrainType(); +@@ -87,6 +96,16 @@ + this.field_177476_s = this.settings.useLavaOceans ? Blocks.lava : Blocks.water; + worldIn.func_181544_b(this.settings.seaLevel); + } ++ ++ NoiseGenerator[] noiseGens = {field_147431_j, field_147432_k, field_147429_l, field_147430_m, noiseGen5, noiseGen6, mobSpawnerNoise}; ++ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(worldIn, this.rand, noiseGens); ++ this.field_147431_j = (NoiseGeneratorOctaves)noiseGens[0]; ++ this.field_147432_k = (NoiseGeneratorOctaves)noiseGens[1]; ++ this.field_147429_l = (NoiseGeneratorOctaves)noiseGens[2]; ++ this.field_147430_m = (NoiseGeneratorPerlin)noiseGens[3]; ++ this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4]; ++ this.noiseGen6 = (NoiseGeneratorOctaves)noiseGens[5]; ++ this.mobSpawnerNoise = (NoiseGeneratorOctaves)noiseGens[6]; + } + + public void setBlocksInChunk(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_) +@@ -160,6 +179,10 @@ + + public void func_180517_a(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_) + { ++ net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180517_1_, p_180517_2_, p_180517_3_, this.worldObj); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return; ++ + double d0 = 0.03125D; + this.stoneNoise = this.field_147430_m.func_151599_a(this.stoneNoise, (double)(p_180517_1_ * 16), (double)(p_180517_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); + +@@ -366,6 +389,8 @@ + boolean flag = false; + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); + ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag)); ++ + if (this.settings.useMineShafts && this.mapFeaturesEnabled) + { + this.mineshaftGenerator.func_175794_a(this.worldObj, this.rand, chunkcoordintpair); +@@ -391,7 +416,8 @@ + this.oceanMonumentGenerator.func_175794_a(this.worldObj, this.rand, chunkcoordintpair); + } + +- if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && this.settings.useWaterLakes && !flag && this.rand.nextInt(this.settings.waterLakeChance) == 0) ++ if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && this.settings.useWaterLakes && !flag && this.rand.nextInt(this.settings.waterLakeChance) == 0 ++ && net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE)) + { + int i1 = this.rand.nextInt(16) + 8; + int j1 = this.rand.nextInt(256); +@@ -399,7 +425,8 @@ + (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, blockpos.add(i1, j1, k1)); + } + +- if (!flag && this.rand.nextInt(this.settings.lavaLakeChance / 10) == 0 && this.settings.useLavaLakes) ++ if (!flag && this.rand.nextInt(this.settings.lavaLakeChance / 10) == 0 && this.settings.useLavaLakes ++ && net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA)) + { + int i2 = this.rand.nextInt(16) + 8; + int l2 = this.rand.nextInt(this.rand.nextInt(248) + 8); +@@ -413,7 +440,8 @@ + + if (this.settings.useDungeons) + { +- for (int j2 = 0; j2 < this.settings.dungeonChance; ++j2) ++ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON); ++ for (int j2 = 0; doGen && j2 < this.settings.dungeonChance; ++j2) + { + int i3 = this.rand.nextInt(16) + 8; + int l3 = this.rand.nextInt(256); +@@ -423,10 +451,14 @@ + } + + biomegenbase.decorate(this.worldObj, this.rand, new BlockPos(i, 0, j)); ++ if (net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ANIMALS)) ++ { + SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, i + 8, j + 8, 16, 16, this.rand); ++ } + blockpos = blockpos.add(8, 0, 8); + +- for (int k2 = 0; k2 < 16; ++k2) ++ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE); ++ for (int k2 = 0; doGen && k2 < 16; ++k2) + { + for (int j3 = 0; j3 < 16; ++j3) + { +@@ -445,6 +477,8 @@ + } + } + ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag)); ++ + BlockFalling.fallInstantly = false; + } + diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch new file mode 100644 index 000000000..a1e6412b4 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch @@ -0,0 +1,141 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderHell.java ++++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderHell.java +@@ -49,8 +49,8 @@ + private final WorldGenHellLava field_177472_y = new WorldGenHellLava(Blocks.flowing_lava, false); + private final GeneratorBushFeature field_177471_z = new GeneratorBushFeature(Blocks.brown_mushroom); + private final GeneratorBushFeature field_177465_A = new GeneratorBushFeature(Blocks.red_mushroom); +- private final MapGenNetherBridge genNetherBridge = new MapGenNetherBridge(); +- private final MapGenBase netherCaveGenerator = new MapGenCavesHell(); ++ private final MapGenNetherBridge genNetherBridge; ++ private final MapGenBase netherCaveGenerator; + double[] noiseData1; + double[] noiseData2; + double[] noiseData3; +@@ -59,16 +59,29 @@ + + public ChunkProviderHell(World worldIn, boolean p_i45637_2_, long p_i45637_3_) + { ++ this.genNetherBridge = (MapGenNetherBridge) net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(new MapGenNetherBridge(), net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_BRIDGE); ++ this.netherCaveGenerator = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(new MapGenCavesHell(), net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_CAVE); + this.worldObj = worldIn; + this.field_177466_i = p_i45637_2_; + this.hellRNG = new Random(p_i45637_3_); +- this.netherNoiseGen1 = new NoiseGeneratorOctaves(this.hellRNG, 16); +- this.netherNoiseGen2 = new NoiseGeneratorOctaves(this.hellRNG, 16); +- this.netherNoiseGen3 = new NoiseGeneratorOctaves(this.hellRNG, 8); +- this.slowsandGravelNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); +- this.netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); +- this.netherNoiseGen6 = new NoiseGeneratorOctaves(this.hellRNG, 10); +- this.netherNoiseGen7 = new NoiseGeneratorOctaves(this.hellRNG, 16); ++ NoiseGeneratorOctaves netherNoiseGen1 = new NoiseGeneratorOctaves(this.hellRNG, 16); ++ NoiseGeneratorOctaves netherNoiseGen2 = new NoiseGeneratorOctaves(this.hellRNG, 16); ++ NoiseGeneratorOctaves netherNoiseGen3 = new NoiseGeneratorOctaves(this.hellRNG, 8); ++ NoiseGeneratorOctaves slowsandGravelNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); ++ NoiseGeneratorOctaves netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); ++ NoiseGeneratorOctaves netherNoiseGen6 = new NoiseGeneratorOctaves(this.hellRNG, 10); ++ NoiseGeneratorOctaves netherNoiseGen7 = new NoiseGeneratorOctaves(this.hellRNG, 16); ++ NoiseGenerator[] noiseGens = new NoiseGenerator[] { ++ netherNoiseGen1, netherNoiseGen2, netherNoiseGen3, slowsandGravelNoiseGen, netherrackExculsivityNoiseGen, netherNoiseGen6, netherNoiseGen7 ++ }; ++ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(worldIn, this.hellRNG, noiseGens); ++ this.netherNoiseGen1 = (NoiseGeneratorOctaves)noiseGens[0]; ++ this.netherNoiseGen2 = (NoiseGeneratorOctaves)noiseGens[1]; ++ this.netherNoiseGen3 = (NoiseGeneratorOctaves)noiseGens[2]; ++ this.slowsandGravelNoiseGen = (NoiseGeneratorOctaves)noiseGens[3]; ++ this.netherrackExculsivityNoiseGen = (NoiseGeneratorOctaves)noiseGens[4]; ++ this.netherNoiseGen6 = (NoiseGeneratorOctaves)noiseGens[5]; ++ this.netherNoiseGen7 = (NoiseGeneratorOctaves)noiseGens[6]; + worldIn.func_181544_b(63); + } + +@@ -148,6 +161,10 @@ + + public void func_180516_b(int p_180516_1_, int p_180516_2_, ChunkPrimer p_180516_3_) + { ++ net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180516_1_, p_180516_2_, p_180516_3_, this.worldObj); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return; ++ + int i = this.worldObj.func_181545_F() + 1; + double d0 = 0.03125D; + this.slowsandNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.slowsandNoise, p_180516_1_ * 16, p_180516_2_ * 16, 0, 16, 16, 1, d0, d0, 1.0D); +@@ -265,6 +282,10 @@ + + private double[] initializeNoiseField(double[] p_73164_1_, int p_73164_2_, int p_73164_3_, int p_73164_4_, int p_73164_5_, int p_73164_6_, int p_73164_7_) + { ++ net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField(this, p_73164_1_, p_73164_2_, p_73164_3_, p_73164_4_, p_73164_5_, p_73164_6_, p_73164_7_); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.noisefield; ++ + if (p_73164_1_ == null) + { + p_73164_1_ = new double[p_73164_5_ * p_73164_6_ * p_73164_7_]; +@@ -356,50 +377,60 @@ + public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) + { + BlockFalling.fallInstantly = true; ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false)); + BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); + this.genNetherBridge.func_175794_a(this.worldObj, this.hellRNG, chunkcoordintpair); + +- for (int i = 0; i < 8; ++i) ++ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA); ++ for (int i = 0; doGen && i < 8; ++i) + { + this.field_177472_y.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); + } + +- for (int j = 0; j < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1; ++j) ++ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.FIRE); ++ for (int j = 0; doGen && j < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1; ++j) + { + this.field_177470_t.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); + } + +- for (int k = 0; k < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1); ++k) ++ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.GLOWSTONE); ++ for (int k = 0; doGen && k < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1); ++k) + { + this.field_177469_u.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); + } + +- for (int l = 0; l < 10; ++l) ++ for (int l = 0; doGen && l < 10; ++l) + { + this.field_177468_v.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); + } + +- if (this.hellRNG.nextBoolean()) ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(worldObj, hellRNG, blockpos)); ++ ++ doGen = net.minecraftforge.event.terraingen.TerrainGen.decorate(worldObj, hellRNG, blockpos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM); ++ if (doGen && this.hellRNG.nextBoolean()) + { + this.field_177471_z.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); + } + +- if (this.hellRNG.nextBoolean()) ++ if (doGen && this.hellRNG.nextBoolean()) + { + this.field_177465_A.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); + } + +- for (int i1 = 0; i1 < 16; ++i1) ++ doGen = net.minecraftforge.event.terraingen.TerrainGen.generateOre(worldObj, hellRNG, field_177467_w, blockpos, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.QUARTZ); ++ for (int i1 = 0; doGen && i1 < 16; ++i1) + { + this.field_177467_w.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16), this.hellRNG.nextInt(108) + 10, this.hellRNG.nextInt(16))); + } + +- for (int j1 = 0; j1 < 16; ++j1) ++ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA2); ++ for (int j1 = 0; doGen && j1 < 16; ++j1) + { + this.field_177473_x.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16), this.hellRNG.nextInt(108) + 10, this.hellRNG.nextInt(16))); + } + ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false)); + BlockFalling.fallInstantly = false; + } + diff --git a/patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch b/patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch new file mode 100644 index 000000000..8d6cd118c --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch @@ -0,0 +1,119 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/MapGenCaves.java ++++ ../src-work/minecraft/net/minecraft/world/gen/MapGenCaves.java +@@ -138,7 +138,7 @@ + { + IBlockState iblockstate = p_180702_5_.getBlockState(j1, l1, k1); + +- if (iblockstate.getBlock() == Blocks.flowing_water || iblockstate.getBlock() == Blocks.water) ++ if (isOceanBlock(p_180702_5_, j1, l1, k1, p_180702_3_, p_180702_4_)) + { + flag3 = true; + } +@@ -176,33 +176,12 @@ + IBlockState iblockstate1 = p_180702_5_.getBlockState(j3, j2, i2); + IBlockState iblockstate2 = (IBlockState)Objects.firstNonNull(p_180702_5_.getBlockState(j3, j2 + 1, i2), Blocks.air.getDefaultState()); + +- if (iblockstate1.getBlock() == Blocks.grass || iblockstate1.getBlock() == Blocks.mycelium) ++ if (isTopBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_)) + { + flag1 = true; + } + +- if (this.func_175793_a(iblockstate1, iblockstate2)) +- { +- if (j2 - 1 < 10) +- { +- p_180702_5_.setBlockState(j3, j2, i2, Blocks.lava.getDefaultState()); +- } +- else +- { +- p_180702_5_.setBlockState(j3, j2, i2, Blocks.air.getDefaultState()); +- +- if (iblockstate2.getBlock() == Blocks.sand) +- { +- p_180702_5_.setBlockState(j3, j2 + 1, i2, iblockstate2.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? Blocks.red_sandstone.getDefaultState() : Blocks.sandstone.getDefaultState()); +- } +- +- if (flag1 && p_180702_5_.getBlockState(j3, j2 - 1, i2).getBlock() == Blocks.dirt) +- { +- blockpos$mutableblockpos.func_181079_c(j3 + p_180702_3_ * 16, 0, i2 + p_180702_4_ * 16); +- p_180702_5_.setBlockState(j3, j2 - 1, i2, this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).topBlock.getBlock().getDefaultState()); +- } +- } +- } ++ digBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_, flag1, iblockstate1, iblockstate2); + } + } + } +@@ -261,4 +240,71 @@ + } + } + } ++ ++ protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) ++ { ++ net.minecraft.block.Block block = data.getBlockState(x, y, z).getBlock(); ++ return block== Blocks.flowing_water || block == Blocks.water; ++ } ++ ++ //Exception biomes to make sure we generate like vanilla ++ private boolean isExceptionBiome(net.minecraft.world.biome.BiomeGenBase biome) ++ { ++ if (biome == net.minecraft.world.biome.BiomeGenBase.beach) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.desert) return true; ++ return false; ++ } ++ ++ //Determine if the block at the specified location is the top block for the biome, we take into account ++ //Vanilla bugs to make sure that we generate the map the same way vanilla does. ++ private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) ++ { ++ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); ++ IBlockState state = data.getBlockState(x, y, z); ++ return (isExceptionBiome(biome) ? state.getBlock() == Blocks.grass : state.getBlock() == biome.topBlock); ++ } ++ ++ /** ++ * Digs out the current block, default implementation removes stone, filler, and top block ++ * Sets the block to lava if y is less then 10, and air other wise. ++ * If setting to air, it also checks to see if we've broken the surface and if so ++ * tries to make the floor the biome's top block ++ * ++ * @param data Block data array ++ * @param index Pre-calculated index into block data ++ * @param x local X position ++ * @param y local Y position ++ * @param z local Z position ++ * @param chunkX Chunk X position ++ * @param chunkZ Chunk Y position ++ * @param foundTop True if we've encountered the biome's top block. Ideally if we've broken the surface. ++ */ ++ protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop, IBlockState state, IBlockState up) ++ { ++ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); ++ IBlockState top = biome.topBlock; ++ IBlockState filler = biome.fillerBlock; ++ ++ if (this.func_175793_a(state, up) || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock()) ++ { ++ if (y < 10) ++ { ++ data.setBlockState(x, y, z, Blocks.lava.getDefaultState()); ++ } ++ else ++ { ++ data.setBlockState(x, y, z, Blocks.air.getDefaultState()); ++ ++ if (up.getBlock() == Blocks.sand) ++ { ++ data.setBlockState(x, y + 1, z, up.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? Blocks.red_sandstone.getDefaultState() : Blocks.sandstone.getDefaultState()); ++ } ++ ++ if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock()) ++ { ++ data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState()); ++ } ++ } ++ } ++ } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch new file mode 100644 index 000000000..fe5d8f922 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch @@ -0,0 +1,30 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java ++++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java +@@ -123,12 +123,11 @@ + if (j3 == 1) + { + worldIn.setBlockState(blockpos2, Blocks.chest.correctFacing(worldIn, blockpos2, Blocks.chest.getDefaultState()), 2); +- List list = WeightedRandomChestContent.func_177629_a(CHESTCONTENT, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_180709_2_)}); + TileEntity tileentity1 = worldIn.getTileEntity(blockpos2); + + if (tileentity1 instanceof TileEntityChest) + { +- WeightedRandomChestContent.generateChestContents(p_180709_2_, list, (TileEntityChest)tileentity1, 8); ++ WeightedRandomChestContent.generateChestContents(p_180709_2_, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST, p_180709_2_), (TileEntityChest)tileentity1, 8); + } + + break; +@@ -159,6 +158,12 @@ + + private String pickMobSpawner(Random p_76543_1_) + { +- return SPAWNERTYPES[p_76543_1_.nextInt(SPAWNERTYPES.length)]; ++ return net.minecraftforge.common.DungeonHooks.getRandomDungeonMob(p_76543_1_); + } ++ ++ static ++ { ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST, CHESTCONTENT, 8, 8); ++ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch b/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch new file mode 100644 index 000000000..e3a76dd0b --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch @@ -0,0 +1,55 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/layer/GenLayer.java ++++ ../src-work/minecraft/net/minecraft/world/gen/layer/GenLayer.java +@@ -52,12 +52,12 @@ + i = 6; + } + ++ i = getModdedBiomeSize(p_180781_2_, j); ++ + GenLayer lvt_8_1_ = GenLayerZoom.magnify(1000L, genlayer4, 0); + GenLayerRiverInit genlayerriverinit = new GenLayerRiverInit(100L, lvt_8_1_); +- GenLayerBiome lvt_9_1_ = new GenLayerBiome(200L, genlayer4, p_180781_2_, p_180781_3_); +- GenLayer genlayer6 = GenLayerZoom.magnify(1000L, lvt_9_1_, 2); +- GenLayerBiomeEdge genlayerbiomeedge = new GenLayerBiomeEdge(1000L, genlayer6); + GenLayer lvt_10_1_ = GenLayerZoom.magnify(1000L, genlayerriverinit, 2); ++ GenLayer genlayerbiomeedge = p_180781_2_.getBiomeLayer(p_180781_0_, genlayer4, p_180781_3_); + GenLayer genlayerhills = new GenLayerHills(1000L, genlayerbiomeedge, lvt_10_1_); + GenLayer genlayer5 = GenLayerZoom.magnify(1000L, genlayerriverinit, 2); + genlayer5 = GenLayerZoom.magnify(1000L, genlayer5, j); +@@ -191,7 +191,7 @@ + + protected static boolean isBiomeOceanic(int p_151618_0_) + { +- return p_151618_0_ == BiomeGenBase.ocean.biomeID || p_151618_0_ == BiomeGenBase.deepOcean.biomeID || p_151618_0_ == BiomeGenBase.frozenOcean.biomeID; ++ return net.minecraftforge.common.BiomeManager.oceanBiomes.contains(BiomeGenBase.getBiome(p_151618_0_)); + } + + protected int selectRandom(int... p_151619_1_) +@@ -203,4 +203,27 @@ + { + return p_151617_2_ == p_151617_3_ && p_151617_3_ == p_151617_4_ ? p_151617_2_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_3_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_3_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_2_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_4_ && p_151617_2_ != p_151617_3_ ? p_151617_1_ : (p_151617_2_ == p_151617_3_ && p_151617_1_ != p_151617_4_ ? p_151617_2_ : (p_151617_2_ == p_151617_4_ && p_151617_1_ != p_151617_3_ ? p_151617_2_ : (p_151617_3_ == p_151617_4_ && p_151617_1_ != p_151617_2_ ? p_151617_3_ : this.selectRandom(new int[] {p_151617_1_, p_151617_2_, p_151617_3_, p_151617_4_})))))))))); + } ++ ++ /* ======================================== FORGE START =====================================*/ ++ protected long nextLong(long par1) ++ { ++ long j = (this.chunkSeed >> 24) % par1; ++ ++ if (j < 0) ++ { ++ j += par1; ++ } ++ ++ this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; ++ this.chunkSeed += this.worldGenSeed; ++ return j; ++ } ++ ++ public static int getModdedBiomeSize(WorldType worldType, int original) ++ { ++ net.minecraftforge.event.terraingen.WorldTypeEvent.BiomeSize event = new net.minecraftforge.event.terraingen.WorldTypeEvent.BiomeSize(worldType, original); ++ net.minecraftforge.common.MinecraftForge.TERRAIN_GEN_BUS.post(event); ++ return event.newSize; ++ } ++ /* ========================================= FORGE END ======================================*/ + } diff --git a/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch b/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch new file mode 100644 index 000000000..28a968bdd --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch @@ -0,0 +1,94 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java ++++ ../src-work/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java +@@ -6,10 +6,9 @@ + + public class GenLayerBiome extends GenLayer + { +- private BiomeGenBase[] field_151623_c = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.desert, BiomeGenBase.desert, BiomeGenBase.savanna, BiomeGenBase.savanna, BiomeGenBase.plains}; +- private BiomeGenBase[] field_151621_d = new BiomeGenBase[] {BiomeGenBase.forest, BiomeGenBase.roofedForest, BiomeGenBase.extremeHills, BiomeGenBase.plains, BiomeGenBase.birchForest, BiomeGenBase.swampland}; +- private BiomeGenBase[] field_151622_e = new BiomeGenBase[] {BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.taiga, BiomeGenBase.plains}; +- private BiomeGenBase[] field_151620_f = new BiomeGenBase[] {BiomeGenBase.icePlains, BiomeGenBase.icePlains, BiomeGenBase.icePlains, BiomeGenBase.coldTaiga}; ++ @SuppressWarnings("unchecked") ++ private java.util.List[] biomes = new java.util.ArrayList[net.minecraftforge.common.BiomeManager.BiomeType.values().length]; ++ + private final ChunkProviderSettings field_175973_g; + + public GenLayerBiome(long p_i45560_1_, GenLayer p_i45560_3_, WorldType p_i45560_4_, String p_i45560_5_) +@@ -17,9 +16,30 @@ + super(p_i45560_1_); + this.parent = p_i45560_3_; + ++ for (net.minecraftforge.common.BiomeManager.BiomeType type : net.minecraftforge.common.BiomeManager.BiomeType.values()) ++ { ++ com.google.common.collect.ImmutableList biomesToAdd = net.minecraftforge.common.BiomeManager.getBiomes(type); ++ int idx = type.ordinal(); ++ ++ if (biomes[idx] == null) biomes[idx] = new java.util.ArrayList(); ++ if (biomesToAdd != null) biomes[idx].addAll(biomesToAdd); ++ } ++ ++ int desertIdx = net.minecraftforge.common.BiomeManager.BiomeType.DESERT.ordinal(); ++ ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.desert, 30)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.savanna, 20)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.plains, 10)); ++ + if (p_i45560_4_ == WorldType.DEFAULT_1_1) + { +- this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.swampland, BiomeGenBase.plains, BiomeGenBase.taiga}; ++ biomes[desertIdx].clear(); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.desert, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.forest, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.extremeHills, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.swampland, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.plains, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.taiga, 10)); + this.field_175973_g = null; + } + else if (p_i45560_4_ == WorldType.CUSTOMIZED) +@@ -73,7 +93,7 @@ + } + else + { +- aint1[j + i * areaWidth] = this.field_151623_c[this.nextInt(this.field_151623_c.length)].biomeID; ++ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.DESERT).biome.biomeID; + } + } + else if (k == 2) +@@ -84,7 +104,7 @@ + } + else + { +- aint1[j + i * areaWidth] = this.field_151621_d[this.nextInt(this.field_151621_d.length)].biomeID; ++ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.WARM).biome.biomeID; + } + } + else if (k == 3) +@@ -95,12 +115,12 @@ + } + else + { +- aint1[j + i * areaWidth] = this.field_151622_e[this.nextInt(this.field_151622_e.length)].biomeID; ++ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.COOL).biome.biomeID; + } + } + else if (k == 4) + { +- aint1[j + i * areaWidth] = this.field_151620_f[this.nextInt(this.field_151620_f.length)].biomeID; ++ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.ICY).biome.biomeID; + } + else + { +@@ -111,4 +131,12 @@ + + return aint1; + } ++ ++ protected net.minecraftforge.common.BiomeManager.BiomeEntry getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType type) ++ { ++ java.util.List biomeList = biomes[type.ordinal()]; ++ int totalWeight = net.minecraft.util.WeightedRandom.getTotalWeight(biomeList); ++ int weight = net.minecraftforge.common.BiomeManager.isTypeListModded(type)?nextInt(totalWeight):nextInt(totalWeight / 10) * 10; ++ return (net.minecraftforge.common.BiomeManager.BiomeEntry)net.minecraft.util.WeightedRandom.getRandomItem(biomeList, weight); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch new file mode 100644 index 000000000..8d5ce18f2 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch @@ -0,0 +1,79 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java +@@ -40,6 +40,12 @@ + { + } + ++ static ++ { ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, itemsToGenerateInTemple, 2, 7); ++ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); ++ } ++ + public DesertPyramid(Random p_i2062_1_, int p_i2062_2_, int p_i2062_3_) + { + super(p_i2062_1_, p_i2062_2_, 64, p_i2062_3_, 21, 15, 21); +@@ -258,7 +264,7 @@ + { + int l1 = enumfacing.getFrontOffsetX() * 2; + int i2 = enumfacing.getFrontOffsetZ() * 2; +- this.field_74940_h[enumfacing.getHorizontalIndex()] = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 10 + l1, -11, 10 + i2, WeightedRandomChestContent.func_177629_a(itemsToGenerateInTemple, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); ++ this.field_74940_h[enumfacing.getHorizontalIndex()] = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 10 + l1, -11, 10 + i2, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, p_74875_2_)); + } + } + +@@ -362,6 +368,13 @@ + private static final List field_175815_j = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.arrow, 0, 2, 7, 30)}); + private static ComponentScatteredFeaturePieces.JunglePyramid.Stones junglePyramidsRandomScatteredStones = new ComponentScatteredFeaturePieces.JunglePyramid.Stones(); + ++ static ++ { ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_DISPENSER, field_175815_j, 2, 2); ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_CHEST, field_175816_i, 2, 7); ++ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); ++ } ++ + public JunglePyramid() + { + } +@@ -518,9 +531,12 @@ + this.func_175811_a(worldIn, Blocks.redstone_wire.getDefaultState(), 4, -3, 1, p_74875_3_); + this.func_175811_a(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 3, -3, 1, p_74875_3_); + ++ net.minecraftforge.common.ChestGenHooks dispenser = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_DISPENSER); ++ net.minecraftforge.common.ChestGenHooks chest = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_CHEST); ++ + if (!this.field_74945_j) + { +- this.field_74945_j = this.func_175806_a(worldIn, p_74875_3_, p_74875_2_, 3, -2, 1, EnumFacing.NORTH.getIndex(), field_175815_j, 2); ++ this.field_74945_j = this.func_175806_a(worldIn, p_74875_3_, p_74875_2_, 3, -2, 1, EnumFacing.NORTH.getIndex(), dispenser.getItems(p_74875_2_), dispenser.getCount(p_74875_2_)); + } + + this.func_175811_a(worldIn, Blocks.vine.getStateFromMeta(15), 3, -2, 2, p_74875_3_); +@@ -537,7 +553,7 @@ + + if (!this.field_74946_k) + { +- this.field_74946_k = this.func_175806_a(worldIn, p_74875_3_, p_74875_2_, 9, -2, 3, EnumFacing.WEST.getIndex(), field_175815_j, 2); ++ this.field_74946_k = this.func_175806_a(worldIn, p_74875_3_, p_74875_2_, 9, -2, 3, EnumFacing.WEST.getIndex(), dispenser.getItems(p_74875_2_), dispenser.getCount(p_74875_2_)); + } + + this.func_175811_a(worldIn, Blocks.vine.getStateFromMeta(15), 8, -1, 3, p_74875_3_); +@@ -545,7 +561,7 @@ + + if (!this.field_74947_h) + { +- this.field_74947_h = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 8, -3, 3, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); ++ this.field_74947_h = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 8, -3, 3, chest.getItems(p_74875_2_), chest.getCount(p_74875_2_)); + } + + this.func_175811_a(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 9, -3, 2, p_74875_3_); +@@ -578,7 +594,7 @@ + + if (!this.field_74948_i) + { +- this.field_74948_i = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 9, -3, 10, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); ++ this.field_74948_i = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 9, -3, 10, chest.getItems(p_74875_2_), chest.getCount(p_74875_2_)); + } + + return true; diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch new file mode 100644 index 000000000..0c563bb50 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch @@ -0,0 +1,33 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java +@@ -32,6 +32,12 @@ + MapGenStructureIO.registerStructureComponent(StructureMineshaftPieces.Stairs.class, "MSStairs"); + } + ++ static ++ { ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.MINESHAFT_CORRIDOR, field_175893_a, 8, 8); ++ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.MINESHAFT_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); ++ } ++ + private static StructureComponent func_175892_a(List p_175892_0_, Random p_175892_1_, int p_175892_2_, int p_175892_3_, int p_175892_4_, EnumFacing p_175892_5_, int p_175892_6_) + { + int i = p_175892_1_.nextInt(100); +@@ -351,14 +357,15 @@ + this.func_175809_a(worldIn, p_74875_3_, p_74875_2_, 0.05F, 1, 2, k1 - 1, Blocks.torch.getStateFromMeta(EnumFacing.UP.getIndex())); + this.func_175809_a(worldIn, p_74875_3_, p_74875_2_, 0.05F, 1, 2, k1 + 1, Blocks.torch.getStateFromMeta(EnumFacing.UP.getIndex())); + ++ net.minecraftforge.common.ChestGenHooks info = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.MINESHAFT_CORRIDOR); + if (p_74875_2_.nextInt(100) == 0) + { +- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 2, 0, k1 - 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.field_175893_a, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 3 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 2, 0, k1 - 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); + } + + if (p_74875_2_.nextInt(100) == 0) + { +- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 0, 0, k1 + 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.field_175893_a, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 3 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 0, 0, k1 + 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); + } + + if (this.hasSpiders && !this.spawnerPlaced) diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch new file mode 100644 index 000000000..83e88c9b3 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch @@ -0,0 +1,75 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java +@@ -240,6 +240,12 @@ + { + } + ++ static ++ { ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, strongholdChestContents, 2, 4); ++ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); ++ } ++ + public ChestCorridor(int p_i45582_1_, Random p_i45582_2_, StructureBoundingBox p_i45582_3_, EnumFacing p_i45582_4_) + { + super(p_i45582_1_); +@@ -296,7 +302,7 @@ + if (!this.hasMadeChest && p_74875_3_.func_175898_b(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) + { + this.hasMadeChest = true; +- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 2, 3, WeightedRandomChestContent.func_177629_a(strongholdChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 2 + p_74875_2_.nextInt(2)); ++ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, p_74875_2_)); + } + + return true; +@@ -592,6 +598,12 @@ + private static final List strongholdLibraryChestContents = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.book, 0, 1, 3, 20), new WeightedRandomChestContent(Items.paper, 0, 2, 7, 20), new WeightedRandomChestContent(Items.map, 0, 1, 1, 1), new WeightedRandomChestContent(Items.compass, 0, 1, 1, 1)}); + private boolean isLargeRoom; + ++ static ++ { ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_LIBRARY, strongholdLibraryChestContents, 1, 5); ++ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_LIBRARY, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 5, 2)); ++ } ++ + public Library() + { + } +@@ -736,12 +748,13 @@ + this.func_175811_a(worldIn, Blocks.torch.getDefaultState(), i1, 8, j1 + 1, p_74875_3_); + } + +- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 3, 5, WeightedRandomChestContent.func_177629_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_, 1, 5, 2)}), 1 + p_74875_2_.nextInt(4)); ++ net.minecraftforge.common.ChestGenHooks info = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_LIBRARY); ++ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 3, 5, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); + + if (this.isLargeRoom) + { + this.func_175811_a(worldIn, Blocks.air.getDefaultState(), 12, 9, 1, p_74875_3_); +- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 12, 8, 1, WeightedRandomChestContent.func_177629_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_, 1, 5, 2)}), 1 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 12, 8, 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); + } + + return true; +@@ -1013,6 +1026,12 @@ + private static final List strongholdRoomCrossingChestContents = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 10), new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 5), new WeightedRandomChestContent(Items.redstone, 0, 4, 9, 5), new WeightedRandomChestContent(Items.coal, 0, 3, 8, 10), new WeightedRandomChestContent(Items.bread, 0, 1, 3, 15), new WeightedRandomChestContent(Items.apple, 0, 1, 3, 15), new WeightedRandomChestContent(Items.iron_pickaxe, 0, 1, 1, 1)}); + protected int roomType; + ++ static ++ { ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, strongholdRoomCrossingChestContents, 1, 5); ++ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); ++ } ++ + public RoomCrossing() + { + } +@@ -1151,7 +1170,7 @@ + this.func_175811_a(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 1, 3, p_74875_3_); + this.func_175811_a(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 2, 3, p_74875_3_); + this.func_175811_a(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 3, 3, p_74875_3_); +- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 4, 8, WeightedRandomChestContent.func_177629_a(strongholdRoomCrossingChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 1 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 4, 8, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, p_74875_2_)); + } + + return true; diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch new file mode 100644 index 000000000..7e6bfd221 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch @@ -0,0 +1,84 @@ +--- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java ++++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java +@@ -57,6 +57,7 @@ + list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Field2.class, 3, MathHelper.getRandomIntegerInRange(p_75084_0_, 2 + p_75084_1_, 4 + p_75084_1_ * 2))); + list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House2.class, 15, MathHelper.getRandomIntegerInRange(p_75084_0_, 0, 1 + p_75084_1_))); + list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House3.class, 8, MathHelper.getRandomIntegerInRange(p_75084_0_, 0 + p_75084_1_, 3 + p_75084_1_ * 2))); ++ net.minecraftforge.fml.common.registry.VillagerRegistry.addExtraVillageComponents(list, p_75084_0_, p_75084_1_); + Iterator iterator = list.iterator(); + + while (iterator.hasNext()) +@@ -129,6 +130,10 @@ + { + structurevillagepieces$village = StructureVillagePieces.House3.func_175849_a(p_176065_0_, p_176065_2_, p_176065_3_, p_176065_4_, p_176065_5_, p_176065_6_, p_176065_7_, p_176065_8_); + } ++ else ++ { ++ structurevillagepieces$village = net.minecraftforge.fml.common.registry.VillagerRegistry.getVillageComponent(p_176065_1_, p_176065_0_ , p_176065_2_, p_176065_3_, p_176065_4_, p_176065_5_, p_176065_6_, p_176065_7_, p_176065_8_); ++ } + + return structurevillagepieces$village; + } +@@ -833,6 +838,11 @@ + { + } + ++ static ++ { ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.VILLAGE_BLACKSMITH, villageBlacksmithChestContents, 3, 8); ++ } ++ + public House2(StructureVillagePieces.Start p_i45563_1_, int p_i45563_2_, Random p_i45563_3_, StructureBoundingBox p_i45563_4_, EnumFacing p_i45563_5_) + { + super(p_i45563_1_, p_i45563_2_); +@@ -911,7 +921,7 @@ + if (!this.hasMadeChest && p_74875_3_.func_175898_b(new BlockPos(this.getXWithOffset(5, 5), this.getYWithOffset(1), this.getZWithOffset(5, 5)))) + { + this.hasMadeChest = true; +- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 5, 1, 5, villageBlacksmithChestContents, 3 + p_74875_2_.nextInt(6)); ++ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 5, 1, 5, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.VILLAGE_BLACKSMITH, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.VILLAGE_BLACKSMITH, p_74875_2_)); + } + + for (int i = 6; i <= 8; ++i) +@@ -1403,6 +1413,7 @@ + public List structureVillageWeightedPieceList; + public List field_74932_i = Lists.newArrayList(); + public List field_74930_j = Lists.newArrayList(); ++ public BiomeGenBase biome; + + public Start() + { +@@ -1416,6 +1427,7 @@ + this.terrainType = p_i2104_7_; + BiomeGenBase biomegenbase = p_i2104_1_.func_180300_a(new BlockPos(p_i2104_4_, 0, p_i2104_5_), BiomeGenBase.field_180279_ad); + this.inDesert = biomegenbase == BiomeGenBase.desert || biomegenbase == BiomeGenBase.desertHills; ++ this.biome = biomegenbase; + this.func_175846_a(this.inDesert); + } + +@@ -1477,6 +1489,7 @@ + protected int field_143015_k = -1; + private int villagersSpawned; + private boolean field_143014_b; ++ private StructureVillagePieces.Start startPiece; + + public Village() + { +@@ -1489,6 +1502,7 @@ + if (p_i2107_1_ != null) + { + this.field_143014_b = p_i2107_1_.inDesert; ++ startPiece = p_i2107_1_; + } + } + +@@ -1613,6 +1627,9 @@ + + protected IBlockState func_175847_a(IBlockState p_175847_1_) + { ++ net.minecraftforge.event.terraingen.BiomeEvent.GetVillageBlockID event = new net.minecraftforge.event.terraingen.BiomeEvent.GetVillageBlockID(startPiece == null ? null : startPiece.biome, p_175847_1_); ++ net.minecraftforge.common.MinecraftForge.TERRAIN_GEN_BUS.post(event); ++ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.replacement; + if (this.field_143014_b) + { + if (p_175847_1_.getBlock() == Blocks.log || p_175847_1_.getBlock() == Blocks.log2) diff --git a/src/main/java/net/minecraftforge/fml/common/launcher/FMLDeobfTweaker.java b/src/main/java/net/minecraftforge/fml/common/launcher/FMLDeobfTweaker.java index 8079fe4c8..e8fa78753 100644 --- a/src/main/java/net/minecraftforge/fml/common/launcher/FMLDeobfTweaker.java +++ b/src/main/java/net/minecraftforge/fml/common/launcher/FMLDeobfTweaker.java @@ -31,7 +31,7 @@ public class FMLDeobfTweaker implements ITweaker { classLoader.registerTransformer(transformer); } classLoader.registerTransformer("net.minecraftforge.fml.common.asm.transformers.ModAccessTransformer"); -// classLoader.registerTransformer("net.minecraftforge.fml.common.asm.transformers.ItemStackTransformer"); + classLoader.registerTransformer("net.minecraftforge.fml.common.asm.transformers.ItemStackTransformer"); try { FMLRelaunchLog.fine("Validating minecraft"); diff --git a/src/main/java/net/minecraftforge/fml/common/network/PacketLoggingHandler.java b/src/main/java/net/minecraftforge/fml/common/network/PacketLoggingHandler.java index 64146631c..1cea65cb7 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/PacketLoggingHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/network/PacketLoggingHandler.java @@ -62,7 +62,7 @@ public class PacketLoggingHandler { String prefix = (direction == EnumPacketDirection.SERVERBOUND ? "SERVER: C->S" : "CLIENT: S->C"); @Override - protected void decode(ChannelHandlerContext context, ByteBuf input, List output) + protected void decode(ChannelHandlerContext context, ByteBuf input, List output) throws Exception { super.decode(context, input, output); for (ByteBuf pkt : (List)output) @@ -77,7 +77,7 @@ public class PacketLoggingHandler { String prefix = (direction == EnumPacketDirection.SERVERBOUND ? "SERVER: S->C" : "CLIENT: C->S"); @Override - protected void encode(ChannelHandlerContext context, ByteBuf input, ByteBuf output) + protected void encode(ChannelHandlerContext context, ByteBuf input, ByteBuf output) throws Exception { input.markReaderIndex(); FMLLog.log(Level.DEBUG, "%s:\n%s", prefix, ByteBufUtils.getContentDump(input)); diff --git a/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java b/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java index aa9412512..e4bcfc6a6 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java +++ b/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java @@ -306,14 +306,14 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple } else { - manager.sendPacket(new S40PacketDisconnect(chatcomponenttext), new GenericFutureListener>() + manager.sendPacket(new S40PacketDisconnect(chatcomponenttext), new GenericFutureListener>() { @Override - public void operationComplete(Future result) + public void operationComplete(Future result) { manager.closeChannel(chatcomponenttext); } - }); + }, new GenericFutureListener[0]); } manager.channel().config().setAutoRead(false); } diff --git a/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java b/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java index 88370df78..00c1f7079 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/network/internal/EntitySpawnHandler.java @@ -3,8 +3,6 @@ package net.minecraftforge.fml.common.network.internal; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; -import java.util.List; - import org.apache.logging.log4j.Level; import net.minecraft.client.entity.EntityPlayerSP; @@ -128,7 +126,7 @@ public class EntitySpawnHandler extends SimpleChannelInboundHandler) spawnMsg.dataWatcherList); + entity.getDataWatcher().updateWatchedObjectsFromList(spawnMsg.dataWatcherList); } if (spawnMsg.throwerId > 0) diff --git a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLMessage.java b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLMessage.java index 534dc8bed..bc1178dd6 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLMessage.java +++ b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLMessage.java @@ -157,8 +157,7 @@ public abstract class FMLMessage { double speedScaledX; double speedScaledY; double speedScaledZ; - @SuppressWarnings("rawtypes") - List dataWatcherList; + List dataWatcherList; ByteBuf dataStream; public EntitySpawnMessage() {} diff --git a/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java index b4af63763..8ef615362 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java @@ -38,7 +38,10 @@ import net.minecraft.util.RegistryNamespacedDefaultedByKey; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Tuple; import net.minecraft.village.MerchantRecipeList; +import net.minecraft.world.gen.structure.StructureComponent; import net.minecraft.world.gen.structure.StructureVillagePieces; +import net.minecraft.world.gen.structure.StructureVillagePieces.PieceWeight; +import net.minecraft.world.gen.structure.StructureVillagePieces.Village; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -103,7 +106,7 @@ public class VillagerRegistry * @param facing * @param p5 */ - Object buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, @SuppressWarnings("rawtypes") List pieces, Random random, int p1, + Village buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List pieces, Random random, int p1, int p2, int p3, EnumFacing facing, int p5); } @@ -181,17 +184,16 @@ public class VillagerRegistry return Collections.unmodifiableCollection(instance().newVillagerIds); } - public static void addExtraVillageComponents(@SuppressWarnings("rawtypes") ArrayList components, Random random, int i) + public static void addExtraVillageComponents(List list, Random random, int i) { - @SuppressWarnings("unchecked") - List parts = components; + List parts = list; for (IVillageCreationHandler handler : instance().villageCreationHandlers.values()) { parts.add(handler.getVillagePieceWeight(random, i)); } } - public static Object getVillageComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, @SuppressWarnings("rawtypes") List pieces, Random random, + public static Village getVillageComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List pieces, Random random, int p1, int p2, int p3, EnumFacing facing, int p5) { return instance().villageCreationHandlers.get(villagePiece.villagePieceClass).buildComponent(villagePiece, startPiece, pieces, random, p1, p2, p3, facing, p5); From fe7f713b67c5ac6035adfb59e53d94e5192aa52f Mon Sep 17 00:00:00 2001 From: cpw Date: Fri, 13 Nov 2015 02:59:43 -0500 Subject: [PATCH 031/133] A few tweaks, things are starting to work now.. --- .../client/gui/GuiMainMenu.java.patch | 2 +- .../renderer/texture/TextureMap.java.patch | 11 ++--- .../common/ForgeModContainer.java | 8 ++-- .../minecraftforge/common/ForgeVersion.java | 4 +- .../minecraftforge/common/MinecraftForge.java | 5 --- .../fml/common/FMLCommonHandler.java | 43 +++---------------- .../net/minecraftforge/fml/common/Loader.java | 4 +- src/main/resources/mcpmod.info | 4 +- 8 files changed, 22 insertions(+), 59 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch index 0eec18b3f..35d380457 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch @@ -30,7 +30,7 @@ - this.drawString(this.fontRendererObj, s, 2, this.height - 10, -1); + java.util.List brandings = com.google.common.collect.Lists.reverse(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(true)); -+ for (int brdline = 0; i < brandings.size(); i++) ++ for (int brdline = 0; brdline < brandings.size(); brdline++) + { + String brd = brandings.get(brdline); + if (!com.google.common.base.Strings.isNullOrEmpty(brd)) diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index 340072044..a73196716 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -94,18 +94,19 @@ int j1 = Math.min(j, k); int k1 = MathHelper.calculateLogBaseTwo(j1); -@@ -175,8 +207,10 @@ +@@ -175,8 +207,11 @@ this.mipmapLevels = k1; } + bar = net.minecraftforge.fml.common.ProgressManager.push("Mipmap generation", skipFirst ? 0 : this.mapRegisteredSprites.size()); for (final TextureAtlasSprite textureatlassprite1 : this.mapRegisteredSprites.values()) { ++ if (skipFirst) break; + bar.step(textureatlassprite1.getIconName()); try { textureatlassprite1.generateMipmaps(this.mipmapLevels); -@@ -213,9 +247,13 @@ +@@ -213,9 +248,13 @@ this.missingImage.generateMipmaps(this.mipmapLevels); stitcher.addSprite(this.missingImage); @@ -119,7 +120,7 @@ stitcher.doStitch(); } catch (StitcherException stitcherexception) -@@ -224,9 +262,11 @@ +@@ -224,9 +263,11 @@ } logger.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.getCurrentWidth()), Integer.valueOf(stitcher.getCurrentHeight()), this.basePath}); @@ -131,7 +132,7 @@ for (TextureAtlasSprite textureatlassprite2 : stitcher.getStichSlots()) { String s = textureatlassprite2.getIconName(); -@@ -256,6 +296,13 @@ +@@ -256,6 +297,13 @@ { textureatlassprite3.copyFrom(this.missingImage); } @@ -145,7 +146,7 @@ } private ResourceLocation completeResourceLocation(ResourceLocation location, int p_147634_2_) -@@ -319,4 +366,37 @@ +@@ -319,4 +367,37 @@ { return this.missingImage; } diff --git a/src/main/java/net/minecraftforge/common/ForgeModContainer.java b/src/main/java/net/minecraftforge/common/ForgeModContainer.java index 3805d49f7..b55dbad10 100644 --- a/src/main/java/net/minecraftforge/common/ForgeModContainer.java +++ b/src/main/java/net/minecraftforge/common/ForgeModContainer.java @@ -89,14 +89,14 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC ModMetadata meta = getMetadata(); meta.modId = "Forge"; meta.name = "Minecraft Forge"; - meta.version = String.format("%d.%d.%d.%d", majorVersion, minorVersion, revisionVersion, buildVersion); + meta.version = ForgeVersion.getVersion(); meta.credits = "Made possible with help from many people"; - meta.authorList = Arrays.asList("LexManos", "Cpw"); + meta.authorList = Arrays.asList("LexManos", "cpw"); meta.description = "Minecraft Forge is a common open source API allowing a broad range of mods " + "to work cooperatively together. It allows many mods to be created without " + "them editing the main Minecraft code."; - meta.url = "http://MinecraftForge.net"; - meta.updateUrl = "http://MinecraftForge.net/forum/index.php/topic,5.0.html"; + meta.url = "http://minecraftforge.net"; + meta.updateUrl = "http://minecraftforge.net/forum/index.php/topic,5.0.html"; meta.screenshots = new String[0]; meta.logoFile = "/forge_logo.png"; try { diff --git a/src/main/java/net/minecraftforge/common/ForgeVersion.java b/src/main/java/net/minecraftforge/common/ForgeVersion.java index fcc8796b2..cb621ac3d 100644 --- a/src/main/java/net/minecraftforge/common/ForgeVersion.java +++ b/src/main/java/net/minecraftforge/common/ForgeVersion.java @@ -39,9 +39,9 @@ public class ForgeVersion //This number is incremented every time Jenkins builds Forge, and never reset. Should always be 0 in the repo code. public static final int buildVersion = 0; // This is the minecraft version we're building for - used in various places in Forge/FML code - public static final String mcVersion = "1.8"; + public static final String mcVersion = "1.8.8"; // This is the MCP data version we're using - public static final String mcpVersion = "9.10"; + public static final String mcpVersion = "9.18"; private static Status status = PENDING; private static String target = null; diff --git a/src/main/java/net/minecraftforge/common/MinecraftForge.java b/src/main/java/net/minecraftforge/common/MinecraftForge.java index 508390569..16218014d 100644 --- a/src/main/java/net/minecraftforge/common/MinecraftForge.java +++ b/src/main/java/net/minecraftforge/common/MinecraftForge.java @@ -166,9 +166,4 @@ public class MinecraftForge // Load before all the mods, so MC owns the MC fluids FluidRegistry.validateFluidRegistry(); } - - public static String getBrandingVersion() - { - return "Minecraft Forge "+ ForgeVersion.getVersion(); - } } diff --git a/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java b/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java index d8ee59c93..a5015ac27 100644 --- a/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java @@ -49,6 +49,8 @@ import net.minecraft.util.IThreadListener; import net.minecraft.world.World; import net.minecraft.world.storage.SaveHandler; import net.minecraft.world.storage.WorldInfo; +import net.minecraftforge.common.ForgeVersion; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.eventhandler.EventBus; import net.minecraftforge.fml.common.gameevent.InputEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent; @@ -143,10 +145,8 @@ public class FMLCommonHandler public void beginLoading(IFMLSidedHandler handler) { sidedDelegate = handler; - FMLLog.log("MinecraftForge", Level.INFO, "Attempting early MinecraftForge initialization"); - callForgeMethod("initialize"); - callForgeMethod("registerCrashCallable"); - FMLLog.log("MinecraftForge", Level.INFO, "Completed early MinecraftForge initialization"); + MinecraftForge.initialize(); +// MinecraftForge.registerCrashCallable(); } /** @@ -213,34 +213,6 @@ public class FMLCommonHandler } - private Class findMinecraftForge() - { - if (forge==null && !noForge) - { - try { - forge = Class.forName("net.minecraftforge.common.MinecraftForge"); - } catch (Exception ex) { - noForge = true; - } - } - return forge; - } - - private Object callForgeMethod(String method) - { - if (noForge) - return null; - try - { - return findMinecraftForge().getMethod(method).invoke(null); - } - catch (Exception e) - { - // No Forge installation - return null; - } - } - public void computeBranding() { if (brandings == null) @@ -248,12 +220,7 @@ public class FMLCommonHandler Builder brd = ImmutableList.builder(); brd.add(Loader.instance().getMCVersionString()); brd.add(Loader.instance().getMCPVersionString()); - brd.add("FML v"+Loader.instance().getFMLVersionString()); - String forgeBranding = (String) callForgeMethod("getBrandingVersion"); - if (!Strings.isNullOrEmpty(forgeBranding)) - { - brd.add(forgeBranding); - } + brd.add("Powered by Forge " + ForgeVersion.getVersion()); if (sidedDelegate!=null) { brd.addAll(sidedDelegate.getAdditionalBrandingInformation()); diff --git a/src/main/java/net/minecraftforge/fml/common/Loader.java b/src/main/java/net/minecraftforge/fml/common/Loader.java index 55efa62e8..3d19c14b8 100644 --- a/src/main/java/net/minecraftforge/fml/common/Loader.java +++ b/src/main/java/net/minecraftforge/fml/common/Loader.java @@ -114,7 +114,7 @@ import com.google.gson.JsonParser; */ public class Loader { - public static final String MC_VERSION = "1.8"; + public static final String MC_VERSION = "1.8.8"; private static final Splitter DEPENDENCYPARTSPLITTER = Splitter.on(":").omitEmptyStrings().trimResults(); private static final Splitter DEPENDENCYSPLITTER = Splitter.on(";").omitEmptyStrings().trimResults(); /** @@ -833,7 +833,7 @@ public class Loader public String getMCPVersionString() { - return String.format("MCP v%s", mcpversion); + return String.format("MCP %s", mcpversion); } public void serverStopped() diff --git a/src/main/resources/mcpmod.info b/src/main/resources/mcpmod.info index 7f044fb7b..f74589508 100644 --- a/src/main/resources/mcpmod.info +++ b/src/main/resources/mcpmod.info @@ -3,8 +3,8 @@ "modid": "mcp", "name": "Minecraft Coder Pack", "description": "Modding toolkit to decompile and deobfuscate the Minecraft client and server files.", - "version": "9.05", - "mcversion": "1.8.0", + "version": "9.18", + "mcversion": "1.8.8", "logoFile": "/mcplogo.png", "url": "http://www.modcoderpack.com/website/", "updateUrl": "", From c5ee4e6451bad3bfc936a7cb211dc6af18cd83db Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Fri, 13 Nov 2015 17:23:37 +0300 Subject: [PATCH 032/133] Model stuff: updated to generics, fixed various warnings, added handling of new perspective types. --- .../resources/model/IBakedModel.java.patch | 14 +------------ .../client/ForgeHooksClient.java | 4 +++- .../client/model/BlockStateLoader.java | 3 +-- .../client/model/ForgeBlockStateV1.java | 20 +++++++++++++++---- .../client/model/IFlexibleBakedModel.java | 5 ----- .../client/model/IPerspectiveAwareModel.java | 1 - .../client/model/IPerspectiveState.java | 9 ++++----- .../client/model/ItemLayerModel.java | 1 - .../client/model/ModelLoader.java | 9 +++++---- .../client/model/b3d/B3DModel.java | 9 ++++----- 10 files changed, 34 insertions(+), 41 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch b/patches/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch index 94444e80c..d032f72eb 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch @@ -1,18 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/resources/model/IBakedModel.java +++ ../src-work/minecraft/net/minecraft/client/resources/model/IBakedModel.java -@@ -8,7 +8,11 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - -+/* -+ * @deprecated use {@link net.minecraftforge.client.model.IFlexibleBakedModel}, {@link net.minecraftforge.client.model.IPerspectiveAwareModel} -+ */ - @SideOnly(Side.CLIENT) -+@Deprecated - public interface IBakedModel - { - List getFaceQuads(EnumFacing p_177551_1_); -@@ -23,5 +27,6 @@ +@@ -23,5 +23,6 @@ TextureAtlasSprite getTexture(); diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 2fc962352..2b58deec7 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -42,6 +42,7 @@ import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.model.IBakedModel; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelManager; +import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.client.resources.model.ModelRotation; import net.minecraft.client.settings.GameSettings; import net.minecraft.entity.Entity; @@ -90,6 +91,7 @@ import org.lwjgl.opengl.GL11; + import com.google.common.collect.Maps; public class ForgeHooksClient @@ -510,7 +512,7 @@ public class ForgeHooksClient } */ - public static void onModelBake(ModelManager modelManager, IRegistry modelRegistry, ModelBakery modelBakery) + public static void onModelBake(ModelManager modelManager, IRegistry modelRegistry, ModelBakery modelBakery) { ModelLoader loader = (ModelLoader)modelBakery; MinecraftForge.EVENT_BUS.post(new ModelBakeEvent(modelManager, modelRegistry, loader)); diff --git a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java index cd3e1d221..007fefc38 100644 --- a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java +++ b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java @@ -43,7 +43,6 @@ public class BlockStateLoader * * @return Model definition including variants for all known combinations. */ - @SuppressWarnings("rawtypes") public static ModelBlockDefinition load(Reader reader, final Gson vanillaGSON) { try @@ -75,7 +74,7 @@ public class BlockStateLoader variants.add(new ModelBlockDefinition.Variants(entry.getKey(), mcVars)); } - return new ModelBlockDefinition((Collection)variants); //Damn lists being collections! + return new ModelBlockDefinition(variants); default: //Unknown version.. try loading it as normal. return vanillaGSON.fromJson(reader, ModelBlockDefinition.class); diff --git a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java index 59598c289..b5ced65a6 100644 --- a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java +++ b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java @@ -534,17 +534,29 @@ public class ForgeBlockStateV1 extends Marker transform.remove("firstperson"); transforms.put(TransformType.FIRST_PERSON, TRSRTransformation.blockCenterToCorner(t)); } + if(transform.has("head")) + { + TRSRTransformation t = context.deserialize(transform.get("head"), TRSRTransformation.class); + transform.remove("head"); + transforms.put(TransformType.HEAD, TRSRTransformation.blockCenterToCorner(t)); + } if(transform.has("gui")) { TRSRTransformation t = context.deserialize(transform.get("gui"), TRSRTransformation.class); transform.remove("gui"); transforms.put(TransformType.GUI, TRSRTransformation.blockCenterToCorner(t)); } - if(transform.has("head")) + if(transform.has("ground")) { - TRSRTransformation t = context.deserialize(transform.get("head"), TRSRTransformation.class); - transform.remove("head"); - transforms.put(TransformType.HEAD, TRSRTransformation.blockCenterToCorner(t)); + TRSRTransformation t = context.deserialize(transform.get("ground"), TRSRTransformation.class); + transform.remove("ground"); + transforms.put(TransformType.GROUND, TRSRTransformation.blockCenterToCorner(t)); + } + if(transform.has("fixed")) + { + TRSRTransformation t = context.deserialize(transform.get("fixed"), TRSRTransformation.class); + transform.remove("fixed"); + transforms.put(TransformType.FIXED, TRSRTransformation.blockCenterToCorner(t)); } int k = transform.entrySet().size(); if(transform.has("matrix")) k--; diff --git a/src/main/java/net/minecraftforge/client/model/IFlexibleBakedModel.java b/src/main/java/net/minecraftforge/client/model/IFlexibleBakedModel.java index e01989a56..4d921fa0c 100644 --- a/src/main/java/net/minecraftforge/client/model/IFlexibleBakedModel.java +++ b/src/main/java/net/minecraftforge/client/model/IFlexibleBakedModel.java @@ -14,9 +14,6 @@ import net.minecraft.util.EnumFacing; */ public interface IFlexibleBakedModel extends IBakedModel { - // non-erased versions of the IBakedModel methods - List getFaceQuads(EnumFacing side); - List getGeneralQuads(); /* * Specifies the format which BakedQuads' getVertexData will have. */ @@ -36,13 +33,11 @@ public interface IFlexibleBakedModel extends IBakedModel this.format = format; } - @SuppressWarnings("unchecked") public List getFaceQuads(EnumFacing side) { return parent.getFaceQuads(side); } - @SuppressWarnings("unchecked") public List getGeneralQuads() { return parent.getGeneralQuads(); diff --git a/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java b/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java index be4a2ad33..d78326724 100644 --- a/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java +++ b/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java @@ -14,7 +14,6 @@ import net.minecraft.util.EnumFacing; import org.apache.commons.lang3.tuple.Pair; -import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; /* diff --git a/src/main/java/net/minecraftforge/client/model/IPerspectiveState.java b/src/main/java/net/minecraftforge/client/model/IPerspectiveState.java index 1dbeb77f2..838090f6c 100644 --- a/src/main/java/net/minecraftforge/client/model/IPerspectiveState.java +++ b/src/main/java/net/minecraftforge/client/model/IPerspectiveState.java @@ -38,11 +38,10 @@ public interface IPerspectiveState extends IModelState private static ImmutableMap getMap(ItemCameraTransforms transforms) { Map map = Maps.newHashMap(); - map.put(TransformType.NONE, TRSRTransformation.identity()); - map.put(TransformType.THIRD_PERSON, transforms.thirdPerson); - map.put(TransformType.FIRST_PERSON, transforms.firstPerson); - map.put(TransformType.GUI, transforms.gui); - map.put(TransformType.HEAD, transforms.head); + for(TransformType type : TransformType.values()) + { + map.put(type, transforms.func_181688_b(type)); + } return Maps.immutableEnumMap(map); } diff --git a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java index 89301016f..396c4e659 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java @@ -3,7 +3,6 @@ package net.minecraftforge.client.model; import java.util.Arrays; import java.util.Collection; import java.util.List; -import java.util.Map; import javax.vecmath.Matrix4f; import javax.vecmath.Vector4f; diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index fda396881..4e0fdef2c 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -38,6 +38,7 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.resources.IResourceManager; import net.minecraft.client.resources.model.BuiltInModel; +import net.minecraft.client.resources.model.IBakedModel; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.client.resources.model.ModelRotation; @@ -85,7 +86,7 @@ public class ModelLoader extends ModelBakery } @Override - public IRegistry setupModelRegistry() + public IRegistry setupModelRegistry() { isLoading = true; loadBlocks(); @@ -717,12 +718,12 @@ public class ModelLoader extends ModelBakery } } - public void onPostBakeEvent(IRegistry modelRegistry) + public void onPostBakeEvent(IRegistry modelRegistry) { - Object missingModel = modelRegistry.getObject(MODEL_MISSING); + IBakedModel missingModel = modelRegistry.getObject(MODEL_MISSING); for(ModelResourceLocation missing : missingVariants) { - Object model = modelRegistry.getObject(missing); + IBakedModel model = modelRegistry.getObject(missing); if(model == null || model == missingModel) { FMLLog.severe("Model definition for location %s not found", missing); diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java index c9b889a34..60af64849 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java @@ -185,12 +185,12 @@ public class B3DModel { chunk("BB3D"); int version = buf.getInt(); - if(version / 100 > this.version / 100) + if(version / 100 > Parser.version / 100) throw new IOException("Unsupported major model version: " + ((float)version / 100)); - if(version % 100 > this.version % 100) + if(version % 100 > Parser.version % 100) logger.warn(String.format("Minor version differnce in model: ", ((float)version / 100))); - List textures = Collections.EMPTY_LIST; - List brushes = Collections.EMPTY_LIST; + List textures = Collections.emptyList(); + List brushes = Collections.emptyList(); Node root = null; while(buf.hasRemaining()) { @@ -400,7 +400,6 @@ public class B3DModel chunk("NODE"); animations.push(HashBasedTable.>, Key>create()); Triple animData = null; - Animation animation = null; Pair> mesh = null; List> bone = null; Map keys = new HashMap(); From 41c3846c517eb7b562f1c6b79eea979ac96a6ba1 Mon Sep 17 00:00:00 2001 From: cpw Date: Fri, 13 Nov 2015 10:13:47 -0500 Subject: [PATCH 033/133] Some generic and other warning cleanups --- .../minecraftforge/common/BiomeManager.java | 25 +- .../minecraftforge/common/ChestGenHooks.java | 25 +- .../common/DimensionManager.java | 5 +- .../minecraftforge/common/FishingHooks.java | 5 +- .../common/ForgeChunkManager.java | 3 +- .../net/minecraftforge/common/ForgeHooks.java | 13 +- .../common/ForgeModContainer.java | 7 +- .../minecraftforge/common/ForgeVersion.java | 5 + .../net/minecraftforge/common/IPlantable.java | 1 - .../net/minecraftforge/common/IShearable.java | 2 +- .../minecraftforge/common/MinecraftForge.java | 3 +- .../minecraftforge/common/UsernameCache.java | 14 +- .../common/brewing/VanillaBrewingRecipe.java | 11 +- .../common/config/ConfigCategory.java | 2 +- .../common/config/ConfigElement.java | 2 +- .../common/config/Configuration.java | 267 +++++++++--------- 16 files changed, 190 insertions(+), 200 deletions(-) diff --git a/src/main/java/net/minecraftforge/common/BiomeManager.java b/src/main/java/net/minecraftforge/common/BiomeManager.java index 1b4517603..63953e90c 100644 --- a/src/main/java/net/minecraftforge/common/BiomeManager.java +++ b/src/main/java/net/minecraftforge/common/BiomeManager.java @@ -3,25 +3,20 @@ package net.minecraftforge.common; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.Iterator; import java.util.List; import com.google.common.collect.ImmutableList; import net.minecraft.util.WeightedRandom; -import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeGenBase; -import net.minecraft.world.gen.structure.MapGenVillage; import net.minecraft.world.biome.WorldChunkManager; -import net.minecraftforge.common.BiomeDictionary.Type; +import net.minecraft.world.gen.structure.MapGenVillage; import net.minecraftforge.common.util.EnumHelper; public class BiomeManager { private static TrackedList[] biomes = setupBiomes(); - private static boolean isModded = false; - public static List oceanBiomes = new ArrayList(); public static ArrayList strongHoldBiomes = new ArrayList(); @@ -36,8 +31,9 @@ public class BiomeManager private static TrackedList[] setupBiomes() { + @SuppressWarnings("unchecked") TrackedList[] currentBiomes = new TrackedList[BiomeType.values().length]; - List list = new ArrayList(); + List list = new ArrayList(); list.add(new BiomeEntry(BiomeGenBase.forest, 10)); list.add(new BiomeEntry(BiomeGenBase.roofedForest, 10)); @@ -46,7 +42,7 @@ public class BiomeManager list.add(new BiomeEntry(BiomeGenBase.birchForest, 10)); list.add(new BiomeEntry(BiomeGenBase.swampland, 10)); - currentBiomes[BiomeType.WARM.ordinal()] = new TrackedList(list); + currentBiomes[BiomeType.WARM.ordinal()] = new TrackedList(list); list.clear(); list.add(new BiomeEntry(BiomeGenBase.forest, 10)); @@ -54,21 +50,20 @@ public class BiomeManager list.add(new BiomeEntry(BiomeGenBase.taiga, 10)); list.add(new BiomeEntry(BiomeGenBase.plains, 10)); - currentBiomes[BiomeType.COOL.ordinal()] = new TrackedList(list); + currentBiomes[BiomeType.COOL.ordinal()] = new TrackedList(list); list.clear(); list.add(new BiomeEntry(BiomeGenBase.icePlains, 30)); list.add(new BiomeEntry(BiomeGenBase.coldTaiga, 10)); - currentBiomes[BiomeType.ICY.ordinal()] = new TrackedList(list); + currentBiomes[BiomeType.ICY.ordinal()] = new TrackedList(list); list.clear(); - currentBiomes[BiomeType.DESERT.ordinal()] = new TrackedList(list); + currentBiomes[BiomeType.DESERT.ordinal()] = new TrackedList(list); return currentBiomes; } - @SuppressWarnings("unchecked") public static void addVillageBiome(BiomeGenBase biome, boolean canSpawn) { if (!MapGenVillage.villageSpawnBiomes.contains(biome)) @@ -79,7 +74,6 @@ public class BiomeManager } } - @SuppressWarnings("unchecked") public static void removeVillageBiome(BiomeGenBase biome) { if (MapGenVillage.villageSpawnBiomes.contains(biome)) @@ -124,8 +118,6 @@ public class BiomeManager public static void addBiome(BiomeType type, BiomeEntry entry) { - isModded = true; - int idx = type.ordinal(); List list = idx > biomes.length ? null : biomes[idx]; if (list != null) list.add(entry); @@ -133,8 +125,6 @@ public class BiomeManager public static void removeBiome(BiomeType type, BiomeEntry entry) { - isModded = true; - int idx = type.ordinal(); List list = idx > biomes.length ? null : biomes[idx]; @@ -200,6 +190,7 @@ public class BiomeManager private static class TrackedList extends ArrayList { + private static final long serialVersionUID = 1L; private boolean isModded = false; public TrackedList(Collection c) diff --git a/src/main/java/net/minecraftforge/common/ChestGenHooks.java b/src/main/java/net/minecraftforge/common/ChestGenHooks.java index aea3b2a99..55fd8e029 100644 --- a/src/main/java/net/minecraftforge/common/ChestGenHooks.java +++ b/src/main/java/net/minecraftforge/common/ChestGenHooks.java @@ -1,22 +1,24 @@ package net.minecraftforge.common; -import java.util.*; -import com.google.common.collect.ImmutableList; -import net.minecraft.init.Items; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Random; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.WeightedRandom; import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.WorldServer; import net.minecraft.world.gen.feature.WorldGenDungeons; -import net.minecraft.world.gen.structure.*; import net.minecraft.world.gen.structure.ComponentScatteredFeaturePieces.DesertPyramid; import net.minecraft.world.gen.structure.ComponentScatteredFeaturePieces.JunglePyramid; -import net.minecraft.world.gen.structure.StructureStrongholdPieces.ChestCorridor; -import net.minecraft.world.gen.structure.StructureStrongholdPieces.Library; -import net.minecraft.world.gen.structure.StructureStrongholdPieces.RoomCrossing; -import net.minecraft.world.gen.structure.StructureVillagePieces.House2; -import net.minecraft.world.gen.structure.StructureNetherBridgePieces.Corridor; +import net.minecraft.world.gen.structure.StructureMineshaftPieces; +import net.minecraft.world.gen.structure.StructureNetherBridgePieces; +import net.minecraft.world.gen.structure.StructureOceanMonument; +import net.minecraft.world.gen.structure.StructureStrongholdPieces; +import net.minecraft.world.gen.structure.StructureVillagePieces; import net.minecraftforge.oredict.OreDictionary; public class ChestGenHooks @@ -64,9 +66,9 @@ public class ChestGenHooks } // INTERNAL DO NO USE - public static void init(String category, List items, int min, int max) + public static void init(String category, List items, int min, int max) { - chestInfo.put(category, new ChestGenHooks(category, (List)items, min, max)); + chestInfo.put(category, new ChestGenHooks(category, items, min, max)); } static void addDungeonLoot(ChestGenHooks dungeon, ItemStack item, int weight, int min, int max) @@ -134,6 +136,7 @@ public class ChestGenHooks public static void removeItem(String category, ItemStack item){ getInfo(category).removeItem(item); } public static ItemStack getOneItem(String category, Random rand){ return getInfo(category).getOneItem(rand); } + @SuppressWarnings("unused") private String category; private int countMin = 0; private int countMax = 0; diff --git a/src/main/java/net/minecraftforge/common/DimensionManager.java b/src/main/java/net/minecraftforge/common/DimensionManager.java index a5a11566a..b522920b6 100644 --- a/src/main/java/net/minecraftforge/common/DimensionManager.java +++ b/src/main/java/net/minecraftforge/common/DimensionManager.java @@ -17,8 +17,7 @@ import com.google.common.collect.HashMultiset; import com.google.common.collect.Lists; import com.google.common.collect.MapMaker; import com.google.common.collect.Multiset; -import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.common.FMLLog; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; import net.minecraft.world.MinecraftException; @@ -34,6 +33,8 @@ import net.minecraft.world.WorldSettings; import net.minecraft.world.storage.ISaveHandler; import net.minecraft.world.storage.SaveHandler; import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.FMLLog; public class DimensionManager { diff --git a/src/main/java/net/minecraftforge/common/FishingHooks.java b/src/main/java/net/minecraftforge/common/FishingHooks.java index 547ec9dd2..70c10185a 100644 --- a/src/main/java/net/minecraftforge/common/FishingHooks.java +++ b/src/main/java/net/minecraftforge/common/FishingHooks.java @@ -1,12 +1,11 @@ package net.minecraftforge.common; -import com.google.common.base.Predicate; - import java.util.ArrayList; import java.util.Iterator; -import java.util.List; import java.util.Random; +import com.google.common.base.Predicate; + import net.minecraft.entity.projectile.EntityFishHook; import net.minecraft.item.ItemStack; import net.minecraft.stats.StatBase; diff --git a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java index 2ceb506d4..e60af5ed2 100644 --- a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java +++ b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java @@ -901,7 +901,6 @@ public class ForgeChunkManager } } - @SuppressWarnings("unchecked") public static Chunk fetchDormantChunk(long coords, World world) { Cache cache = dormantChunkCache.get(world); @@ -912,7 +911,7 @@ public class ForgeChunkManager Chunk chunk = cache.getIfPresent(coords); if (chunk != null) { - for (ClassInheritanceMultiMap eList : chunk.getEntityLists()) + for (ClassInheritanceMultiMap eList : chunk.getEntityLists()) { Iterator itr = (Iterator)eList.iterator(); while (itr.hasNext()) diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index 896c83e4c..429a85966 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -24,18 +24,10 @@ import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLeashKnot; -import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityArmorStand; -import net.minecraft.entity.item.EntityBoat; import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.item.EntityItemFrame; -import net.minecraft.entity.item.EntityMinecart; -import net.minecraft.entity.item.EntityPainting; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.event.ClickEvent; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -46,7 +38,6 @@ import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemAxe; -import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBucket; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemSpade; @@ -556,6 +547,7 @@ public class ForgeHooks return world.getBlockState(pos).getBlock().getEnchantPowerBonus(world, pos); } + @SuppressWarnings("deprecation") public static ChatComponentTranslation onServerChatEvent(NetHandlerPlayServer net, String raw, ChatComponentTranslation comp) { ServerChatEvent event = new ServerChatEvent(net.playerEntity, raw, comp); @@ -698,7 +690,7 @@ public class ForgeHooks TileEntity tileentity = world.getTileEntity(pos); if (tileentity != null) { - Packet pkt = tileentity.getDescriptionPacket(); + Packet pkt = tileentity.getDescriptionPacket(); if (pkt != null) { entityPlayer.playerNetServerHandler.sendPacket(pkt); @@ -738,6 +730,7 @@ public class ForgeHooks newNBT = (NBTTagCompound)itemstack.getTagCompound().copy(); } net.minecraftforge.event.world.BlockEvent.PlaceEvent placeEvent = null; + @SuppressWarnings("unchecked") List blockSnapshots = (List)world.capturedBlockSnapshots.clone(); world.capturedBlockSnapshots.clear(); diff --git a/src/main/java/net/minecraftforge/common/ForgeModContainer.java b/src/main/java/net/minecraftforge/common/ForgeModContainer.java index b55dbad10..832842d3f 100644 --- a/src/main/java/net/minecraftforge/common/ForgeModContainer.java +++ b/src/main/java/net/minecraftforge/common/ForgeModContainer.java @@ -5,10 +5,6 @@ package net.minecraftforge.common; -import static net.minecraftforge.common.ForgeVersion.buildVersion; -import static net.minecraftforge.common.ForgeVersion.majorVersion; -import static net.minecraftforge.common.ForgeVersion.minorVersion; -import static net.minecraftforge.common.ForgeVersion.revisionVersion; import static net.minecraftforge.common.config.Configuration.CATEGORY_GENERAL; import java.io.File; @@ -83,6 +79,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC private URL updateJSONUrl = null; + @SuppressWarnings("deprecation") public ForgeModContainer() { super(new ModMetadata()); @@ -91,7 +88,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC meta.name = "Minecraft Forge"; meta.version = ForgeVersion.getVersion(); meta.credits = "Made possible with help from many people"; - meta.authorList = Arrays.asList("LexManos", "cpw"); + meta.authorList = Arrays.asList("LexManos", "cpw", "fry"); meta.description = "Minecraft Forge is a common open source API allowing a broad range of mods " + "to work cooperatively together. It allows many mods to be created without " + "them editing the main Minecraft code."; diff --git a/src/main/java/net/minecraftforge/common/ForgeVersion.java b/src/main/java/net/minecraftforge/common/ForgeVersion.java index 7069bcecb..e40202feb 100644 --- a/src/main/java/net/minecraftforge/common/ForgeVersion.java +++ b/src/main/java/net/minecraftforge/common/ForgeVersion.java @@ -42,7 +42,9 @@ public class ForgeVersion public static final String mcVersion = "1.8.8"; // This is the MCP data version we're using public static final String mcpVersion = "9.18"; + @SuppressWarnings("unused") private static Status status = PENDING; + @SuppressWarnings("unused") private static String target = null; public static int getMajorVersion() @@ -150,7 +152,9 @@ public class ForgeVersion FMLLog.log("ForgeVersionCheck", Level.DEBUG, "[%s] Received version check data:\n%s", mod.getModId(), data); + @SuppressWarnings("unchecked") Map json = new Gson().fromJson(data, Map.class); + @SuppressWarnings("unchecked") Map promos = (Map)json.get("promos"); String display_url = (String)json.get("homepage"); @@ -201,6 +205,7 @@ public class ForgeVersion FMLLog.log("ForgeVersionCheck", Level.INFO, "[%s] Found status: %s Target: %s", mod.getModId(), status, target); Map changes = new LinkedHashMap(); + @SuppressWarnings("unchecked") Map tmp = (Map)json.get(MinecraftForge.MC_VERSION); if (tmp != null) { diff --git a/src/main/java/net/minecraftforge/common/IPlantable.java b/src/main/java/net/minecraftforge/common/IPlantable.java index a01630606..d3e40d451 100644 --- a/src/main/java/net/minecraftforge/common/IPlantable.java +++ b/src/main/java/net/minecraftforge/common/IPlantable.java @@ -1,6 +1,5 @@ package net.minecraftforge.common; -import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.util.BlockPos; import net.minecraft.world.IBlockAccess; diff --git a/src/main/java/net/minecraftforge/common/IShearable.java b/src/main/java/net/minecraftforge/common/IShearable.java index 6b31ca790..acd0be858 100644 --- a/src/main/java/net/minecraftforge/common/IShearable.java +++ b/src/main/java/net/minecraftforge/common/IShearable.java @@ -1,7 +1,7 @@ package net.minecraftforge.common; -import java.util.ArrayList; import java.util.List; + import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.world.IBlockAccess; diff --git a/src/main/java/net/minecraftforge/common/MinecraftForge.java b/src/main/java/net/minecraftforge/common/MinecraftForge.java index 16218014d..ee5bc8d75 100644 --- a/src/main/java/net/minecraftforge/common/MinecraftForge.java +++ b/src/main/java/net/minecraftforge/common/MinecraftForge.java @@ -54,6 +54,7 @@ public class MinecraftForge OreDictionary.getOreName(0); //Force these classes to be defined, Should prevent derp error hiding. + @SuppressWarnings("unused") CrashReport fake = new CrashReport("ThisIsFake", new Exception("Not real")); //Lets init World's crash report inner classes to prevent them from hiding errors. String[] handlers = { @@ -153,7 +154,7 @@ public class MinecraftForge //FMLLog.info("\t" + s); try { - Class cls = Class.forName(s, false, MinecraftForge.class.getClassLoader()); + Class cls = Class.forName(s, false, MinecraftForge.class.getClassLoader()); if (cls != null && !Callable.class.isAssignableFrom(cls)) { //FMLLog.info("\t% s is not a instance of callable!", s); diff --git a/src/main/java/net/minecraftforge/common/UsernameCache.java b/src/main/java/net/minecraftforge/common/UsernameCache.java index 68772c0fa..2587220e9 100644 --- a/src/main/java/net/minecraftforge/common/UsernameCache.java +++ b/src/main/java/net/minecraftforge/common/UsernameCache.java @@ -48,7 +48,7 @@ public final class UsernameCache { /** * Set a player's current username - * + * * @param uuid * the player's {@link java.util.UUID UUID} * @param username @@ -67,7 +67,7 @@ public final class UsernameCache { /** * Remove a player's username from the cache - * + * * @param uuid * the player's {@link java.util.UUID UUID} * @return if the cache contained the user @@ -81,7 +81,7 @@ public final class UsernameCache { save(); return true; } - + return false; } @@ -89,7 +89,7 @@ public final class UsernameCache { * Get the player's last known username *

* May be null - * + * * @param uuid * the player's {@link java.util.UUID UUID} * @return the player's last known username, or null if the @@ -104,7 +104,7 @@ public final class UsernameCache { /** * Check if the cache contains the given player's username - * + * * @param uuid * the player's {@link java.util.UUID UUID} * @return if the cache contains a username for the given player @@ -117,7 +117,7 @@ public final class UsernameCache { /** * Get an immutable copy of the cache's underlying map - * + * * @return the map */ public static Map getMap() @@ -144,7 +144,7 @@ public final class UsernameCache { { String json = Files.toString(saveFile, charset); - Type type = new TypeToken>() {}.getType(); + Type type = new TypeToken>() { private static final long serialVersionUID = 1L; }.getType(); map = gson.fromJson(json, type); } diff --git a/src/main/java/net/minecraftforge/common/brewing/VanillaBrewingRecipe.java b/src/main/java/net/minecraftforge/common/brewing/VanillaBrewingRecipe.java index ead5c93b2..bf00b6fe3 100644 --- a/src/main/java/net/minecraftforge/common/brewing/VanillaBrewingRecipe.java +++ b/src/main/java/net/minecraftforge/common/brewing/VanillaBrewingRecipe.java @@ -5,12 +5,13 @@ import java.util.List; import net.minecraft.init.Items; import net.minecraft.item.ItemPotion; import net.minecraft.item.ItemStack; +import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionHelper; /** - * Used in BrewingRecipeRegistry to maintain the vanilla behaviour. - * - * Most of the code was simply adapted from net.minecraft.tileentity.TileEntityBrewingStand + * Used in BrewingRecipeRegistry to maintain the vanilla behaviour. + * + * Most of the code was simply adapted from net.minecraft.tileentity.TileEntityBrewingStand */ public class VanillaBrewingRecipe implements IBrewingRecipe { @@ -49,8 +50,8 @@ public class VanillaBrewingRecipe implements IBrewingRecipe { return null; } - List oldEffects = Items.potionitem.getEffects(inputMeta); - List newEffects = Items.potionitem.getEffects(outputMeta); + List oldEffects = Items.potionitem.getEffects(inputMeta); + List newEffects = Items.potionitem.getEffects(outputMeta); boolean hasResult = false; if ((inputMeta <= 0 || oldEffects != newEffects) && (oldEffects == null || !oldEffects.equals(newEffects) && newEffects != null)) diff --git a/src/main/java/net/minecraftforge/common/config/ConfigCategory.java b/src/main/java/net/minecraftforge/common/config/ConfigCategory.java index 212b75ea0..f90938a10 100644 --- a/src/main/java/net/minecraftforge/common/config/ConfigCategory.java +++ b/src/main/java/net/minecraftforge/common/config/ConfigCategory.java @@ -13,7 +13,6 @@ import java.io.BufferedWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; -import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -33,6 +32,7 @@ public class ConfigCategory implements Map private String languagekey; private ArrayList children = new ArrayList(); private Map properties = new TreeMap(); + @SuppressWarnings("unused") private int propNumber = 0; public final ConfigCategory parent; private boolean changed = false; diff --git a/src/main/java/net/minecraftforge/common/config/ConfigElement.java b/src/main/java/net/minecraftforge/common/config/ConfigElement.java index c3ddf14be..77b4155ff 100644 --- a/src/main/java/net/minecraftforge/common/config/ConfigElement.java +++ b/src/main/java/net/minecraftforge/common/config/ConfigElement.java @@ -6,7 +6,6 @@ package net.minecraftforge.common.config; import java.util.ArrayList; -import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.regex.Pattern; @@ -54,6 +53,7 @@ public class ConfigElement implements IConfigElement List elements = new ArrayList(); Iterator ccI = ctgy.getChildren().iterator(); Iterator pI = ctgy.getOrderedValues().iterator(); + @SuppressWarnings("unused") int index = 0; if (categoriesFirst) diff --git a/src/main/java/net/minecraftforge/common/config/Configuration.java b/src/main/java/net/minecraftforge/common/config/Configuration.java index 3fd9bcad7..09733b49b 100644 --- a/src/main/java/net/minecraftforge/common/config/Configuration.java +++ b/src/main/java/net/minecraftforge/common/config/Configuration.java @@ -86,7 +86,7 @@ public class Configuration { this(file, null); } - + /** * Create a configuration file for the file given in parameter with the provided config version number. */ @@ -110,12 +110,12 @@ public class Configuration } catch (Throwable e) { - File fileBak = new File(file.getAbsolutePath() + "_" + + File fileBak = new File(file.getAbsolutePath() + "_" + new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()) + ".errored"); FMLLog.severe("An exception occurred while loading config file %s. This file will be renamed to %s " + "and a new config file will be generated.", file.getName(), fileBak.getName()); e.printStackTrace(); - + file.renameTo(fileBak); load(); } @@ -132,7 +132,7 @@ public class Configuration { this(file, null, caseSensitiveCustomCategories); } - + @Override public String toString() { @@ -148,16 +148,16 @@ public class Configuration { return this.loadedConfigVersion; } - + /****************************************************************************************************************** - * + * * BOOLEAN gets - * + * *****************************************************************************************************************/ - + /** * Gets a boolean Property object without a comment using the default settings. - * + * * @param category the config category * @param key the Property key value * @param defaultValue the default value @@ -170,7 +170,7 @@ public class Configuration /** * Gets a boolean Property object with a comment using the default settings. - * + * * @param category the config category * @param key the Property key value * @param defaultValue the default value @@ -181,18 +181,18 @@ public class Configuration { Property prop = get(category, key, Boolean.toString(defaultValue), comment, BOOLEAN); prop.setDefaultValue(Boolean.toString(defaultValue)); - + if (!prop.isBooleanValue()) { prop.setValue(defaultValue); } return prop; - + } /** * Gets a boolean array Property without a comment using the default settings. - * + * * @param category the config category * @param key the Property key value * @param defaultValues an array containing the default values @@ -205,7 +205,7 @@ public class Configuration /** * Gets a boolean array Property with a comment using the default settings. - * + * * @param category the config category * @param key the Property key value * @param defaultValues an array containing the default values @@ -216,10 +216,10 @@ public class Configuration { return get(category, key, defaultValues, comment, false, -1); } - + /** * Gets a boolean array Property with all settings defined. - * + * * @param category the config category * @param key the Property key value * @param defaultValues an array containing the default values @@ -237,29 +237,29 @@ public class Configuration { values[i] = Boolean.toString(defaultValues[i]); } - + Property prop = get(category, key, values, comment, BOOLEAN); prop.setDefaultValues(values); prop.setIsListLengthFixed(isListLengthFixed); prop.setMaxListLength(maxListLength); - + if (!prop.isBooleanList()) { prop.setValues(values); } - + return prop; } /* **************************************************************************************************************** - * + * * INTEGER gets - * + * *****************************************************************************************************************/ - + /** * Gets an integer Property object without a comment using default settings. - * + * * @param category the config category * @param key the Property key value * @param defaultValue the default value @@ -272,7 +272,7 @@ public class Configuration /** * Gets an integer Property object with a comment using default settings. - * + * * @param category the config category * @param key the Property key value * @param defaultValue the default value @@ -286,7 +286,7 @@ public class Configuration /** * Gets an integer Property object with the defined comment, minimum and maximum bounds. - * + * * @param category the config category * @param key the Property key value * @param defaultValue the default value @@ -301,7 +301,7 @@ public class Configuration prop.setDefaultValue(Integer.toString(defaultValue)); prop.setMinValue(minValue); prop.setMaxValue(maxValue); - + if (!prop.isIntValue()) { prop.setValue(defaultValue); @@ -311,7 +311,7 @@ public class Configuration /** * Gets an integer array Property object without a comment using default settings. - * + * * @param category the config category * @param key the Property key value * @param defaultValues an array containing the default values @@ -325,7 +325,7 @@ public class Configuration /** * Gets an integer array Property object with a comment using default settings. - * + * * @param category the config category * @param key the Property key value * @param defaultValues an array containing the default values @@ -340,7 +340,7 @@ public class Configuration /** * Gets an integer array Property object with the defined comment, minimum and maximum bounds. - * + * * @param category the config category * @param key the Property key value * @param defaultValues an array containing the default values @@ -354,10 +354,10 @@ public class Configuration { return get(category, key, defaultValues, comment, minValue, maxValue, false, -1); } - + /** * Gets an integer array Property object with all settings defined. - * + * * @param category the config category * @param key the Property key value * @param defaultValues an array containing the default values @@ -384,7 +384,7 @@ public class Configuration prop.setMaxValue(maxValue); prop.setIsListLengthFixed(isListLengthFixed); prop.setMaxListLength(maxListLength); - + if (!prop.isIntList()) { prop.setValues(values); @@ -394,14 +394,14 @@ public class Configuration } /* **************************************************************************************************************** - * + * * DOUBLE gets - * + * *****************************************************************************************************************/ - + /** * Gets a double Property object without a comment using default settings. - * + * * @param category the config category * @param key the Property key value * @param defaultValue the default value @@ -414,7 +414,7 @@ public class Configuration /** * Gets a double Property object with a comment using default settings. - * + * * @param category the config category * @param key the Property key value * @param defaultValue the default value @@ -425,10 +425,10 @@ public class Configuration { return get(category, key, defaultValue, comment, -Double.MAX_VALUE, Double.MAX_VALUE); } - + /** * Gets a double Property object with the defined comment, minimum and maximum bounds - * + * * @param category the config category * @param key the Property key value * @param defaultValue the default value @@ -443,7 +443,7 @@ public class Configuration prop.setDefaultValue(Double.toString(defaultValue)); prop.setMinValue(minValue); prop.setMaxValue(maxValue); - + if (!prop.isDoubleValue()) { prop.setValue(defaultValue); @@ -453,7 +453,7 @@ public class Configuration /** * Gets a double array Property object without a comment using default settings. - * + * * @param category the config category * @param key the Property key value * @param defaultValues an array containing the default values @@ -467,7 +467,7 @@ public class Configuration /** * Gets a double array Property object without a comment using default settings. - * + * * @param category the config category * @param key the Property key value * @param defaultValues an array containing the default values @@ -479,10 +479,10 @@ public class Configuration { return get(category, key, defaultValues, comment, -Double.MAX_VALUE, Double.MAX_VALUE, false, -1); } - + /** * Gets a double array Property object with the defined comment, minimum and maximum bounds. - * + * * @param category the config category * @param key the Property key value * @param defaultValues an array containing the default values @@ -496,10 +496,10 @@ public class Configuration { return get(category, key, defaultValues, comment, minValue, maxValue, false, -1); } - + /** * Gets a double array Property object with all settings defined. - * + * * @param category the config category * @param key the Property key value * @param defaultValues an array containing the default values @@ -520,14 +520,14 @@ public class Configuration values[i] = Double.toString(defaultValues[i]); } - + Property prop = get(category, key, values, comment, DOUBLE); prop.setDefaultValues(values); prop.setMinValue(minValue); prop.setMaxValue(maxValue); prop.setIsListLengthFixed(isListLengthFixed); prop.setMaxListLength(maxListLength); - + if (!prop.isDoubleList()) { prop.setValues(values); @@ -537,14 +537,14 @@ public class Configuration } /* **************************************************************************************************************** - * + * * STRING gets - * + * *****************************************************************************************************************/ - + /** * Gets a string Property without a comment using the default settings. - * + * * @param category the config category * @param key the Property key value * @param defaultValue the default value @@ -554,10 +554,10 @@ public class Configuration { return get(category, key, defaultValue, (String) null); } - + /** * Gets a string Property with a comment using the default settings. - * + * * @param category the config category * @param key the Property key value * @param defaultValue the default value @@ -568,10 +568,10 @@ public class Configuration { return get(category, key, defaultValue, comment, STRING); } - + /** * Gets a string Property with a comment using the defined validationPattern and otherwise default settings. - * + * * @param category the config category * @param key the Property key value * @param defaultValue the default value @@ -585,10 +585,10 @@ public class Configuration prop.setValidationPattern(validationPattern); return prop; } - + /** * Gets a string Property with a comment using the defined validValues array and otherwise default settings. - * + * * @param category the config category * @param key the Property key value * @param defaultValue the default value @@ -603,10 +603,10 @@ public class Configuration prop.setValidValues(validValues); return prop; } - + /** * Gets a string array Property without a comment using the default settings. - * + * * @param category the config category * @param key the Property key value * @param defaultValues an array containing the default values @@ -616,10 +616,10 @@ public class Configuration { return get(category, key, defaultValues, (String) null, false, -1, (Pattern) null); } - + /** * Gets a string array Property with a comment using the default settings. - * + * * @param category the config category * @param key the Property key value * @param defaultValues an array containing the default values @@ -630,10 +630,10 @@ public class Configuration { return get(category, key, defaultValues, comment, false, -1, (Pattern) null); } - + /** * Gets a string array Property with a comment using the defined validationPattern and otherwise default settings. - * + * * @param category the config category * @param key the Property key value * @param defaultValues an array containing the default values @@ -645,10 +645,10 @@ public class Configuration { return get(category, key, defaultValues, comment, false, -1, validationPattern); } - + /** * Gets a string array Property with a comment with all settings defined. - * + * * @param category the config category * @param key the Property key value * @param defaultValues an array containing the default values @@ -668,16 +668,16 @@ public class Configuration prop.setValidationPattern(validationPattern); return prop; } - + /* **************************************************************************************************************** - * + * * GENERIC gets - * + * *****************************************************************************************************************/ - + /** * Gets a Property object of the specified type using default settings. - * + * * @param category the config category * @param key the Property key value * @param defaultValue the default value @@ -711,7 +711,7 @@ public class Configuration else if (defaultValue != null) { Property prop = new Property(key, defaultValue, type); - prop.setValue(defaultValue); //Set and mark as dirty to signify it should save + prop.setValue(defaultValue); //Set and mark as dirty to signify it should save cat.put(key, prop); prop.setDefaultValue(defaultValue); prop.comment = comment; @@ -725,7 +725,7 @@ public class Configuration /** * Gets a list (array) Property object of the specified type using default settings. - * + * * @param category the config category * @param key the Property key value * @param defaultValues an array containing the default values @@ -772,11 +772,11 @@ public class Configuration } /* **************************************************************************************************************** - * + * * Other methods - * + * *************************************************************************************************************** */ - + public boolean hasCategory(String category) { return categories.get(category) != null; @@ -963,17 +963,17 @@ public class Configuration else if (i + 1 == line.length()) { name = line.substring(nameStart, nameEnd + 1); - + if (currentCat == null) { throw new RuntimeException(String.format("'%s' has no scope in '%s:%d'", name, fileName, lineNum)); } - + tmpList = new ArrayList(); - + skip = true; } - + break; case '>': @@ -994,17 +994,17 @@ public class Configuration case '~': if (tmpList != null) // allow special characters as part of string lists break; - + if (line.startsWith(CONFIG_VERSION_MARKER)) { int colon = line.indexOf(':'); if (colon != -1) loadedConfigVersion = line.substring(colon + 1).trim(); - + skip = true; } break; - + default: if (tmpList != null) // allow special characters as part of string lists break; @@ -1079,7 +1079,7 @@ public class Configuration if (this.definedConfigVersion != null) buffer.write(CONFIG_VERSION_MARKER + ": " + this.definedConfigVersion + NEW_LINE + NEW_LINE); - + if (children.isEmpty()) { save(buffer); @@ -1105,7 +1105,7 @@ public class Configuration } private void save(BufferedWriter out) throws IOException - { + { for (ConfigCategory cat : categories.values()) { if (!cat.isChild()) @@ -1181,7 +1181,7 @@ public class Configuration /** * Adds a comment to the specified ConfigCategory object - * + * * @param category the config category * @param comment a String comment */ @@ -1197,10 +1197,10 @@ public class Configuration { this.setCategoryComment(category, comment); } - + /** * Adds a language key to the specified ConfigCategory object - * + * * @param category the config category * @param langKey a language key string such as configcategory.general */ @@ -1211,7 +1211,7 @@ public class Configuration getCategory(category).setLanguageKey(langKey); return this; } - + /** * Sets the custom IConfigEntry class that should be used in place of the standard entry class (which is just a button that * navigates into the category). This class MUST provide a constructor with the following parameter types: {@code GuiConfig} (the parent @@ -1220,16 +1220,16 @@ public class Configuration */ public Configuration setCategoryConfigEntryClass(String category, Class clazz) { - + if (!caseSensitiveCustomCategories) category = category.toLowerCase(Locale.ENGLISH); getCategory(category).setConfigEntryClass(clazz); return this; } - + /** * Sets the flag for whether or not this category can be edited while a world is running. Care should be taken to ensure - * that only properties that are truly dynamic can be changed from the in-game options menu. Only set this flag to + * that only properties that are truly dynamic can be changed from the in-game options menu. Only set this flag to * true if all child properties/categories are unable to be modified while a world is running. */ public Configuration setCategoryRequiresWorldRestart(String category, boolean requiresWorldRestart) @@ -1239,7 +1239,7 @@ public class Configuration getCategory(category).setRequiresWorldRestart(requiresWorldRestart); return this; } - + /** * Sets whether or not this ConfigCategory requires Minecraft to be restarted when changed. * Defaults to false. Only set this flag to true if ALL child properties/categories require @@ -1253,7 +1253,7 @@ public class Configuration getCategory(category).setRequiresMcRestart(requiresMcRestart); return this; } - + /** * Sets the order that direct child properties of this config category will be written to the config file and will be displayed in * config GUIs. @@ -1265,7 +1265,7 @@ public class Configuration getCategory(category).setPropertyOrder(propOrder); return this; } - + private void setChild(String name, Configuration child) { if (!children.containsKey(name)) @@ -1291,6 +1291,7 @@ public class Configuration public static class UnicodeInputStreamReader extends Reader { private final InputStreamReader input; + @SuppressWarnings("unused") private final String defaultEnc; public UnicodeInputStreamReader(InputStream source, String encoding) throws IOException @@ -1362,7 +1363,7 @@ public class Configuration public boolean hasChanged() { if (changed) return true; - + for (ConfigCategory cat : categories.values()) { if (cat.hasChanged()) return true; @@ -1394,10 +1395,10 @@ public class Configuration { return ImmutableSet.copyOf(categories.keySet()); } - + /** * Renames a property in a given category. - * + * * @param category the category in which the property resides * @param oldPropName the existing property name * @param newPropName the new property name @@ -1416,10 +1417,10 @@ public class Configuration } return false; } - + /** * Moves a property from one category to another. - * + * * @param oldCategory the category the property currently resides in * @param propName the name of the property to move * @param newCategory the category the property should be moved to @@ -1436,7 +1437,7 @@ public class Configuration } return false; } - + /** * Copies property objects from another Configuration object to this one using the list of category names. Properties that only exist in the * "from" object are ignored. Pass null for the ctgys array to include all categories. @@ -1445,7 +1446,7 @@ public class Configuration { if (ctgys == null) ctgys = this.getCategoryNames().toArray(new String[this.getCategoryNames().size()]); - + for (String ctgy : ctgys) if (fromConfig.hasCategory(ctgy) && this.hasCategory(ctgy)) { @@ -1456,10 +1457,10 @@ public class Configuration thiscc.put(entry.getKey(), fromcc.get(entry.getKey())); } } - + /** * Creates a string property. - * + * * @param name Name of the property. * @param category Category of the property. * @param defaultValue Default value of the property. @@ -1470,10 +1471,10 @@ public class Configuration { return getString(name, category, defaultValue, comment, name, null); } - + /** * Creates a string property. - * + * * @param name Name of the property. * @param category Category of the property. * @param defaultValue Default value of the property. @@ -1485,10 +1486,10 @@ public class Configuration { return getString(name, category, defaultValue, comment, langKey, null); } - + /** * Creates a string property. - * + * * @param name Name of the property. * @param category Category of the property. * @param defaultValue Default value of the property. @@ -1499,10 +1500,10 @@ public class Configuration { return getString(name, category, defaultValue, comment, name, pattern); } - + /** * Creates a string property. - * + * * @param name Name of the property. * @param category Category of the property. * @param defaultValue Default value of the property. @@ -1518,10 +1519,10 @@ public class Configuration prop.comment = comment + " [default: " + defaultValue + "]"; return prop.getString(); } - + /** * Creates a string property. - * + * * @param name Name of the property. * @param category Category of the property. * @param defaultValue Default value of the property. @@ -1533,10 +1534,10 @@ public class Configuration { return getString(name, category, defaultValue, comment, validValues, name); } - + /** * Creates a string property. - * + * * @param name Name of the property. * @param category Category of the property. * @param defaultValue Default value of the property. @@ -1553,10 +1554,10 @@ public class Configuration prop.comment = comment + " [default: " + defaultValue + "]"; return prop.getString(); } - + /** * Creates a string list property. - * + * * @param name Name of the property. * @param category Category of the property. * @param defaultValue Default value of the property. @@ -1567,10 +1568,10 @@ public class Configuration { return getStringList(name, category, defaultValues, comment, (String[]) null, name); } - + /** * Creates a string list property. - * + * * @param name Name of the property. * @param category Category of the property. * @param defaultValue Default value of the property. @@ -1581,10 +1582,10 @@ public class Configuration { return getStringList(name, category, defaultValue, comment, validValues, name); } - + /** * Creates a string list property. - * + * * @param name Name of the property. * @param category Category of the property. * @param defaultValue Default value of the property. @@ -1599,10 +1600,10 @@ public class Configuration prop.comment = comment + " [default: " + prop.getDefault() + "]"; return prop.getStringList(); } - + /** * Creates a boolean property. - * + * * @param name Name of the property. * @param category Category of the property. * @param defaultValue Default value of the property. @@ -1613,10 +1614,10 @@ public class Configuration { return getBoolean(name, category, defaultValue, comment, name); } - + /** * Creates a boolean property. - * + * * @param name Name of the property. * @param category Category of the property. * @param defaultValue Default value of the property. @@ -1631,10 +1632,10 @@ public class Configuration prop.comment = comment + " [default: " + defaultValue + "]"; return prop.getBoolean(defaultValue); } - + /** * Creates a integer property. - * + * * @param name Name of the property. * @param category Category of the property. * @param defaultValue Default value of the property. @@ -1647,10 +1648,10 @@ public class Configuration { return getInt(name, category, defaultValue, minValue, maxValue, comment, name); } - + /** * Creates a integer property. - * + * * @param name Name of the property. * @param category Category of the property. * @param defaultValue Default value of the property. @@ -1669,10 +1670,10 @@ public class Configuration prop.setMaxValue(maxValue); return prop.getInt(defaultValue) < minValue ? minValue : (prop.getInt(defaultValue) > maxValue ? maxValue : prop.getInt(defaultValue)); } - + /** * Creates a float property. - * + * * @param name Name of the property. * @param category Category of the property. * @param defaultValue Default value of the property. @@ -1685,10 +1686,10 @@ public class Configuration { return getFloat(name, category, defaultValue, minValue, maxValue, comment, name); } - + /** * Creates a float property. - * + * * @param name Name of the property. * @param category Category of the property. * @param defaultValue Default value of the property. @@ -1715,7 +1716,7 @@ public class Configuration } return defaultValue; } - + public File getConfigFile() { return file; From deb26f5c803c998169e41f8afb791b7cb3e98ba1 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Fri, 13 Nov 2015 19:29:44 +0300 Subject: [PATCH 034/133] ExtendedBlockState, Properties generic updates. --- .../common/property/ExtendedBlockState.java | 20 ++++++++++--------- .../common/property/Properties.java | 14 +++++-------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java b/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java index a0b5a318f..7711273e8 100644 --- a/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java +++ b/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java @@ -8,22 +8,21 @@ import java.util.Map; import net.minecraft.block.Block; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.BlockState; -import net.minecraft.block.state.BlockState.StateImplementation; import net.minecraft.block.state.IBlockState; import com.google.common.base.Optional; import com.google.common.base.Predicates; -import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableTable; import com.google.common.collect.Iterables; +import com.google.common.collect.Maps; public class ExtendedBlockState extends BlockState { private final ImmutableSet> unlistedProperties; - public ExtendedBlockState(Block blockIn, IProperty[] properties, IUnlistedProperty[] unlistedProperties) + public ExtendedBlockState(Block blockIn, @SuppressWarnings("rawtypes") IProperty[] properties, IUnlistedProperty[] unlistedProperties) { super(blockIn, properties, buildUnlistedMap(unlistedProperties)); ImmutableSet.Builder> builder = ImmutableSet.>builder(); @@ -45,7 +44,7 @@ public class ExtendedBlockState extends BlockState } @Override - protected StateImplementation createState(Block block, ImmutableMap properties, ImmutableMap unlistedProperties) + protected StateImplementation createState(Block block, @SuppressWarnings("rawtypes") ImmutableMap properties, ImmutableMap, Optional> unlistedProperties) { if (unlistedProperties == null || unlistedProperties.isEmpty()) return super.createState(block, properties, unlistedProperties); return new ExtendedStateImplementation(block, properties, unlistedProperties, null); @@ -54,9 +53,10 @@ public class ExtendedBlockState extends BlockState protected static class ExtendedStateImplementation extends StateImplementation implements IExtendedBlockState { private final ImmutableMap, Optional> unlistedProperties; - private Map, IBlockState> normalMap; + @SuppressWarnings("rawtypes") + private Map, BlockState.StateImplementation> normalMap; - protected ExtendedStateImplementation(Block block, ImmutableMap properties, ImmutableMap, Optional> unlistedProperties, ImmutableTable table) + protected ExtendedStateImplementation(Block block, @SuppressWarnings("rawtypes") ImmutableMap properties, ImmutableMap, Optional> unlistedProperties, @SuppressWarnings("rawtypes") ImmutableTable table) { super(block, properties); this.unlistedProperties = unlistedProperties; @@ -80,12 +80,14 @@ public class ExtendedBlockState extends BlockState { return this; } - Map map = new HashMap(getProperties()); + @SuppressWarnings("rawtypes") + Map map = Maps.newHashMap(getProperties()); map.put(property, value); if(Iterables.all(unlistedProperties.values(), Predicates.>equalTo(Optional.absent()))) { // no dynamic properties present, looking up in the normal table return (IExtendedBlockState) normalMap.get(map); } + @SuppressWarnings("rawtypes") ImmutableTable table = propertyValueTable; table = ((StateImplementation)table.get(property, value)).getPropertyValueTable(); return new ExtendedStateImplementation(getBlock(), ImmutableMap.copyOf(map), unlistedProperties, table).setMap(this.normalMap); @@ -131,13 +133,13 @@ public class ExtendedBlockState extends BlockState } @Override - public void buildPropertyValueTable(Map map) + public void buildPropertyValueTable(@SuppressWarnings("rawtypes") Map, BlockState.StateImplementation> map) { this.normalMap = map; super.buildPropertyValueTable(map); } - private ExtendedStateImplementation setMap(Map, IBlockState> map) + private ExtendedStateImplementation setMap(@SuppressWarnings("rawtypes") Map, BlockState.StateImplementation> map) { this.normalMap = map; return this; diff --git a/src/main/java/net/minecraftforge/common/property/Properties.java b/src/main/java/net/minecraftforge/common/property/Properties.java index b24e6beea..5063da273 100644 --- a/src/main/java/net/minecraftforge/common/property/Properties.java +++ b/src/main/java/net/minecraftforge/common/property/Properties.java @@ -1,23 +1,19 @@ package net.minecraftforge.common.property; -import java.lang.reflect.InvocationTargetException; - import net.minecraft.block.properties.IProperty; -import org.apache.commons.lang3.reflect.ConstructorUtils; - public class Properties { - public static

IUnlistedProperty toUnlisted(P property) + public static > IUnlistedProperty toUnlisted(IProperty property) { - return new PropertyAdapter(property); + return new PropertyAdapter(property); } - public static class PropertyAdapter implements IUnlistedProperty + public static class PropertyAdapter> implements IUnlistedProperty { - private final IProperty parent; + private final IProperty parent; - public PropertyAdapter(IProperty parent) + public PropertyAdapter(IProperty parent) { this.parent = parent; } From f4c59a3a5dd70b67defd5aee692b67f63425c3da Mon Sep 17 00:00:00 2001 From: cpw Date: Fri, 13 Nov 2015 14:06:05 -0500 Subject: [PATCH 035/133] Remove a suppression --- .../net/minecraftforge/fml/common/registry/GameRegistry.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java index 352dd7990..f222b1b67 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java @@ -247,7 +247,6 @@ public class GameRegistry CraftingManager.getInstance().addShapelessRecipe(output, params); } - @SuppressWarnings("unchecked") public static void addRecipe(IRecipe recipe) { CraftingManager.getInstance().getRecipeList().add(recipe); From eb73c30b28596bceec93dbae8b1628e8022f752e Mon Sep 17 00:00:00 2001 From: cpw Date: Sat, 14 Nov 2015 10:52:03 -0500 Subject: [PATCH 036/133] This should be everything needed to separate blocks and items completely. --- .../gui/achievement/GuiStats.java.patch | 53 +++++++- .../net/minecraft/stats/StatList.java.patch | 125 ++++++++++++------ 2 files changed, 138 insertions(+), 40 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch b/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch index fd6bcf0ba..6363f6f74 100644 --- a/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch @@ -1,6 +1,55 @@ --- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiStats.java +++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiStats.java -@@ -748,7 +748,7 @@ +@@ -5,6 +5,8 @@ + import java.util.Collections; + import java.util.Comparator; + import java.util.List; ++ ++import net.minecraft.block.Block; + import net.minecraft.client.Minecraft; + import net.minecraft.client.audio.PositionedSoundRecord; + import net.minecraft.client.gui.GuiButton; +@@ -443,17 +445,18 @@ + for (StatCrafting statcrafting : StatList.objectMineStats) + { + boolean flag = false; +- int i = Item.getIdFromItem(statcrafting.func_150959_a()); ++ int i = Block.getIdFromBlock(Block.getBlockFromItem(statcrafting.func_150959_a())); ++ int itemId = Item.getIdFromItem(statcrafting.func_150959_a()); + + if (GuiStats.this.field_146546_t.readStat(statcrafting) > 0) + { + flag = true; + } +- else if (StatList.objectUseStats[i] != null && GuiStats.this.field_146546_t.readStat(StatList.objectUseStats[i]) > 0) ++ else if (StatList.objectUseStats[itemId] != null && GuiStats.this.field_146546_t.readStat(StatList.objectUseStats[itemId]) > 0) + { + flag = true; + } +- else if (StatList.objectCraftStats[i] != null && GuiStats.this.field_146546_t.readStat(StatList.objectCraftStats[i]) > 0) ++ else if (StatList.objectCraftStats[itemId] != null && GuiStats.this.field_146546_t.readStat(StatList.objectCraftStats[itemId]) > 0) + { + flag = true; + } +@@ -468,8 +471,15 @@ + { + public int compare(StatCrafting p_compare_1_, StatCrafting p_compare_2_) + { +- int j = Item.getIdFromItem(p_compare_1_.func_150959_a()); +- int k = Item.getIdFromItem(p_compare_2_.func_150959_a()); ++ int j; ++ int k; ++ if (StatsBlock.this.field_148217_o == 2) { ++ j = Block.getIdFromBlock(Block.getBlockFromItem(p_compare_1_.func_150959_a())); ++ k = Block.getIdFromBlock(Block.getBlockFromItem(p_compare_2_.func_150959_a())); ++ } else { ++ j = Item.getIdFromItem(p_compare_1_.func_150959_a()); ++ k = Item.getIdFromItem(p_compare_2_.func_150959_a()); ++ } + StatBase statbase = null; + StatBase statbase1 = null; + +@@ -748,7 +758,7 @@ super(mcIn, GuiStats.this.width, GuiStats.this.height, 32, GuiStats.this.height - 64, GuiStats.this.fontRendererObj.FONT_HEIGHT * 4); this.setShowSelectionBox(false); @@ -9,7 +58,7 @@ { if (GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151512_d) > 0 || GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151513_e) > 0) { -@@ -784,7 +784,7 @@ +@@ -784,7 +794,7 @@ protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int p_180791_5_, int p_180791_6_) { EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)this.field_148222_l.get(entryID); diff --git a/patches/minecraft/net/minecraft/stats/StatList.java.patch b/patches/minecraft/net/minecraft/stats/StatList.java.patch index 2f739108b..1ebd7b50f 100644 --- a/patches/minecraft/net/minecraft/stats/StatList.java.patch +++ b/patches/minecraft/net/minecraft/stats/StatList.java.patch @@ -1,43 +1,92 @@ --- ../src-base/minecraft/net/minecraft/stats/StatList.java +++ ../src-work/minecraft/net/minecraft/stats/StatList.java -@@ -109,7 +109,7 @@ - { - if (item != null) - { -- int i = Item.getIdFromItem(item); -+ int i = Item.getIdFromItem(item); //TODO: Hook FML's stat change event and re-assign these - String s = func_180204_a(item); +@@ -119,7 +119,7 @@ + } + } - if (s != null) -@@ -126,11 +126,11 @@ +- replaceAllSimilarBlocks(objectCraftStats); ++ replaceAllSimilarBlocks(objectCraftStats, true); + } + + private static void initMiningStats() +@@ -141,7 +141,7 @@ + } + } + +- replaceAllSimilarBlocks(mineBlockStatArray); ++ replaceAllSimilarBlocks(mineBlockStatArray, false); + } + + private static void initStats() +@@ -165,7 +165,7 @@ + } + } + +- replaceAllSimilarBlocks(objectUseStats); ++ replaceAllSimilarBlocks(objectUseStats, true); + } + + private static void initItemDepleteStats() +@@ -184,7 +184,7 @@ + } + } + +- replaceAllSimilarBlocks(objectBreakStats); ++ replaceAllSimilarBlocks(objectBreakStats, true); + } + + private static String func_180204_a(Item p_180204_0_) +@@ -193,28 +193,35 @@ + return resourcelocation != null ? resourcelocation.toString().replace(':', '.') : null; + } + +- private static void replaceAllSimilarBlocks(StatBase[] p_75924_0_) ++ private static void replaceAllSimilarBlocks(StatBase[] p_75924_0_, boolean useItemIds) { - for (Block block : Block.blockRegistry) +- func_151180_a(p_75924_0_, Blocks.water, Blocks.flowing_water); +- func_151180_a(p_75924_0_, Blocks.lava, Blocks.flowing_lava); +- func_151180_a(p_75924_0_, Blocks.lit_pumpkin, Blocks.pumpkin); +- func_151180_a(p_75924_0_, Blocks.lit_furnace, Blocks.furnace); +- func_151180_a(p_75924_0_, Blocks.lit_redstone_ore, Blocks.redstone_ore); +- func_151180_a(p_75924_0_, Blocks.powered_repeater, Blocks.unpowered_repeater); +- func_151180_a(p_75924_0_, Blocks.powered_comparator, Blocks.unpowered_comparator); +- func_151180_a(p_75924_0_, Blocks.redstone_torch, Blocks.unlit_redstone_torch); +- func_151180_a(p_75924_0_, Blocks.lit_redstone_lamp, Blocks.redstone_lamp); +- func_151180_a(p_75924_0_, Blocks.double_stone_slab, Blocks.stone_slab); +- func_151180_a(p_75924_0_, Blocks.double_wooden_slab, Blocks.wooden_slab); +- func_151180_a(p_75924_0_, Blocks.double_stone_slab2, Blocks.stone_slab2); +- func_151180_a(p_75924_0_, Blocks.grass, Blocks.dirt); +- func_151180_a(p_75924_0_, Blocks.farmland, Blocks.dirt); ++ func_151180_a(p_75924_0_, Blocks.water, Blocks.flowing_water, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.lava, Blocks.flowing_lava, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.lit_pumpkin, Blocks.pumpkin, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.lit_furnace, Blocks.furnace, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.lit_redstone_ore, Blocks.redstone_ore, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.powered_repeater, Blocks.unpowered_repeater, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.powered_comparator, Blocks.unpowered_comparator, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.redstone_torch, Blocks.unlit_redstone_torch, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.lit_redstone_lamp, Blocks.redstone_lamp, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.double_stone_slab, Blocks.stone_slab, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.double_wooden_slab, Blocks.wooden_slab, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.double_stone_slab2, Blocks.stone_slab2, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.grass, Blocks.dirt, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.farmland, Blocks.dirt, useItemIds); + } + +- private static void func_151180_a(StatBase[] p_151180_0_, Block p_151180_1_, Block p_151180_2_) ++ private static void func_151180_a(StatBase[] p_151180_0_, Block p_151180_1_, Block p_151180_2_, boolean useItemIds) + { +- int i = Block.getIdFromBlock(p_151180_1_); +- int j = Block.getIdFromBlock(p_151180_2_); ++ int i; ++ int j; ++ if (useItemIds) { ++ i = Item.getIdFromItem(Item.getItemFromBlock(p_151180_1_)); ++ j = Item.getIdFromItem(Item.getItemFromBlock(p_151180_2_)); ++ } else { ++ i = Block.getIdFromBlock(p_151180_1_); ++ j = Block.getIdFromBlock(p_151180_2_); ++ } + + if (p_151180_0_[i] != null && p_151180_0_[j] == null) { -- Item item = Item.getItemFromBlock(block); -+ Item item = Item.getItemFromBlock(block); //TODO: Hook FML's stat change event and re-assign these - - if (item != null) - { -- int i = Block.getIdFromBlock(block); -+ int i = Block.getIdFromBlock(block); //TODO: Hook FML's stat change event and re-assign these - String s = func_180204_a(item); - - if (s != null && block.getEnableStats()) -@@ -150,7 +150,7 @@ - { - if (item != null) - { -- int i = Item.getIdFromItem(item); -+ int i = Item.getIdFromItem(item); //TODO: Hook FML's stat change event and re-assign these - String s = func_180204_a(item); - - if (s != null) -@@ -174,7 +174,7 @@ - { - if (item != null) - { -- int i = Item.getIdFromItem(item); -+ int i = Item.getIdFromItem(item); //TODO: Hook FML's stat change event and re-assign these - String s = func_180204_a(item); - - if (s != null && item.isDamageable()) From 13d7530e437648a68dc96f46164c59a7be4fc5d3 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Mon, 16 Nov 2015 06:50:54 +0300 Subject: [PATCH 037/133] Implemented interpolation of TRSR transformations; B3D: added interpolation capabilities to B3DState, animated TESR example in ModelAnimationTest (pure TESR right now, no separation inside the example model between the static and dynamic parts right now). --- .../client/model/TRSRTransformation.java | 133 +++--- .../client/model/b3d/B3DLoader.java | 378 +++++++++++++++--- .../debug/ModelAnimationDebug.java | 285 +++++++++++++ .../blockstates/test_animation_block.json | 26 ++ 4 files changed, 716 insertions(+), 106 deletions(-) create mode 100644 src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java create mode 100644 src/test/resources/assets/forgedebugmodelanimation/blockstates/test_animation_block.json diff --git a/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java b/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java index 189069c6d..3aed561b0 100644 --- a/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java +++ b/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java @@ -3,6 +3,8 @@ package net.minecraftforge.client.model; import javax.vecmath.Matrix3f; import javax.vecmath.Matrix4f; import javax.vecmath.Quat4f; +import javax.vecmath.Tuple3f; +import javax.vecmath.Tuple4f; import javax.vecmath.Vector3f; import javax.vecmath.Vector4f; @@ -181,7 +183,6 @@ public class TRSRTransformation implements IModelState, ITransformation { Matrix4f res = new Matrix4f(), t = new Matrix4f(); res.setIdentity(); - if(translation != null) res.setTranslation(translation); if(leftRot != null) { t.set(leftRot); @@ -200,6 +201,7 @@ public class TRSRTransformation implements IModelState, ITransformation t.set(rightRot); res.mul(t); } + if(translation != null) res.setTranslation(translation); return res; } @@ -221,7 +223,8 @@ public class TRSRTransformation implements IModelState, ITransformation b.set(m); b.mul(t); - sortSingularValues(b, v); + // FIXME: this doesn't work correctly for some reason; not crucial, so disabling for now; investigate in the future. + //sortSingularValues(b, v); Pair p; @@ -281,7 +284,7 @@ public class TRSRTransformation implements IModelState, ITransformation return f; } - private static final float eps = 1e-7f; + private static final float eps = 1e-6f; private static final float g = 3f + 2f * (float)Math.sqrt(2); private static final float cs = (float)Math.cos(Math.PI / 8); private static final float ss = (float)Math.sin(Math.PI / 8); @@ -365,50 +368,59 @@ public class TRSRTransformation implements IModelState, ITransformation Quat4f qt = new Quat4f(), ret = new Quat4f(0, 0, 0, 1); Pair p; // 01 - p = approxGivensQuat(m.m00, .5f * (m.m01 + m.m10), m.m11); - qt.set(0, 0, p.getLeft(), p.getRight()); - //qt.normalize(); - ret.mul(qt); - //t.set(qt); - t.setIdentity(); - t.m00 = qt.w * qt.w - qt.z * qt.z; - t.m11 = t.m00; - t.m10 = 2 * qt.z * qt.w; - t.m01 = -t.m10; - t.m22 = qt.w * qt.w + qt.z * qt.z; - m.mul(m, t); - t.transpose(); - m.mul(t, m); + if(m.m01 * m.m01 + m.m10 * m.m10 > eps) + { + p = approxGivensQuat(m.m00, .5f * (m.m01 + m.m10), m.m11); + qt.set(0, 0, p.getLeft(), p.getRight()); + //qt.normalize(); + ret.mul(qt); + //t.set(qt); + t.setIdentity(); + t.m00 = qt.w * qt.w - qt.z * qt.z; + t.m11 = t.m00; + t.m10 = 2 * qt.z * qt.w; + t.m01 = -t.m10; + t.m22 = qt.w * qt.w + qt.z * qt.z; + m.mul(m, t); + t.transpose(); + m.mul(t, m); + } // 02 - p = approxGivensQuat(m.m00, .5f * (m.m02 + m.m20), m.m22); - qt.set(0, -p.getLeft(), 0, p.getRight()); - //qt.normalize(); - ret.mul(qt); - //t.set(qt); - t.setIdentity(); - t.m00 = qt.w * qt.w - qt.y * qt.y; - t.m22 = t.m00; - t.m20 = -2 * qt.y * qt.w; - t.m02 = -t.m20; - t.m11 = qt.w * qt.w + qt.y * qt.y; - m.mul(m, t); - t.transpose(); - m.mul(t, m); + if(m.m02 * m.m02 + m.m20 * m.m20 > eps) + { + p = approxGivensQuat(m.m00, .5f * (m.m02 + m.m20), m.m22); + qt.set(0, -p.getLeft(), 0, p.getRight()); + //qt.normalize(); + ret.mul(qt); + //t.set(qt); + t.setIdentity(); + t.m00 = qt.w * qt.w - qt.y * qt.y; + t.m22 = t.m00; + t.m20 = -2 * qt.y * qt.w; + t.m02 = -t.m20; + t.m11 = qt.w * qt.w + qt.y * qt.y; + m.mul(m, t); + t.transpose(); + m.mul(t, m); + } // 12 - p = approxGivensQuat(m.m11, .5f * (m.m12 + m.m21), m.m22); - qt.set(p.getLeft(), 0, 0, p.getRight()); - //qt.normalize(); - ret.mul(qt); - //t.set(qt); - t.setIdentity(); - t.m11 = qt.w * qt.w - qt.x * qt.x; - t.m22 = t.m11; - t.m21 = 2 * qt.x * qt.w; - t.m12 = -t.m21; - t.m00 = qt.w * qt.w + qt.x * qt.x; - m.mul(m, t); - t.transpose(); - m.mul(t, m); + if(m.m12 * m.m12 + m.m21 * m.m21 > eps) + { + p = approxGivensQuat(m.m11, .5f * (m.m12 + m.m21), m.m22); + qt.set(p.getLeft(), 0, 0, p.getRight()); + //qt.normalize(); + ret.mul(qt); + //t.set(qt); + t.setIdentity(); + t.m11 = qt.w * qt.w - qt.x * qt.x; + t.m22 = t.m11; + t.m21 = 2 * qt.x * qt.w; + t.m12 = -t.m21; + t.m00 = qt.w * qt.w + qt.x * qt.x; + m.mul(m, t); + t.transpose(); + m.mul(t, m); + } return ret; } @@ -617,4 +629,35 @@ public class TRSRTransformation implements IModelState, ITransformation r.m33 = m.m33; return r; } + + public static Vector3f lerp(Tuple3f from, Tuple3f to, float progress) + { + Vector3f res = new Vector3f(from); + res.interpolate(from, to, progress); + return res; + } + + public static Vector4f lerp(Tuple4f from, Tuple4f to, float progress) + { + Vector4f res = new Vector4f(from); + res.interpolate(from, to, progress); + return res; + } + + public static Quat4f slerp(Quat4f from, Quat4f to, float progress) + { + Quat4f res = new Quat4f(); + res.interpolate(from, to, progress); + return res; + } + + public TRSRTransformation slerp(TRSRTransformation that, float progress) + { + return new TRSRTransformation( + lerp(this.getTranslation(), that.getTranslation(), progress), + slerp(this.getLeftRot(), that.getLeftRot(), progress), + lerp(this.getScale(), that.getScale(), progress), + slerp(this.getRightRot(), that.getRightRot(), progress) + ); + } } diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java index d75ab37da..5cfad738d 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java @@ -25,6 +25,7 @@ import net.minecraft.client.resources.IResourceManager; import net.minecraft.client.resources.model.IBakedModel; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ICustomModelLoader; import net.minecraftforge.client.model.IFlexibleBakedModel; @@ -65,6 +66,9 @@ import com.google.common.cache.LoadingCache; import com.google.common.collect.Collections2; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; /* * Loader for Blitz3D models. @@ -138,16 +142,19 @@ public class B3DLoader implements ICustomModelLoader FMLLog.severe("No mesh named %s in model %s, skipping", mesh, modelLocation); return ModelLoaderRegistry.getMissingModel(); } - return new Wrapper(modelLocation, model.getTextures(), model.getMeshes().get(mesh)); + return new ModelWrapper(modelLocation, model, ImmutableSet.of(mesh), 1); } if(!(model.getRoot().getKind() instanceof Mesh)) { - FMLLog.severe("No root mesh in model %s and no mesh name in location, skipping", modelLocation); - return ModelLoaderRegistry.getMissingModel(); + return new ModelWrapper(modelLocation, model, ImmutableSet.of(), 1); } - return new Wrapper(modelLocation, model.getTextures(), (Node)model.getRoot()); + return new ModelWrapper(modelLocation, model, ImmutableSet.of(((Node)model.getRoot()).getName()), 1); } + /** + * @deprecated Use json or IModelCustomData.process + */ + @Deprecated public static class B3DMeshLocation extends ResourceLocation { public final String mesh; @@ -192,17 +199,31 @@ public class B3DLoader implements ICustomModelLoader { private final Animation animation; private final int frame; + private final int nextFrame; + private final float progress; private final IModelState parent; public B3DState(Animation animation, int frame) { - this(animation, frame, null); + this(animation, frame, frame, 0); } public B3DState(Animation animation, int frame, IModelState parent) + { + this(animation, frame, frame, 0, parent); + } + + public B3DState(Animation animation, int frame, int nextFrame, float progress) + { + this(animation, frame, nextFrame, progress, null); + } + + public B3DState(Animation animation, int frame, int nextFrame, float progress, IModelState parent) { this.animation = animation; this.frame = frame; + this.nextFrame = nextFrame; + this.progress = MathHelper.clamp_float(progress, 0, 1); this.parent = getParent(parent); } @@ -223,17 +244,47 @@ public class B3DLoader implements ICustomModelLoader return frame; } + public int getNextFrame() + { + return nextFrame; + } + + public float getProgress() + { + return progress; + } + + public IModelState getParent() + { + return parent; + } + public TRSRTransformation apply(IModelPart part) { if(!(part instanceof PartWrapper)) { throw new IllegalArgumentException("B3DState can only be applied to b3d models"); } + Node node = ((PartWrapper)part).getNode(); + TRSRTransformation nodeTransform; + if(progress < 1e-5 || frame == nextFrame) + { + nodeTransform = getNodeMatrix(node, frame); + } + else if(progress > 1 - 1e-5) + { + nodeTransform = getNodeMatrix(node, nextFrame); + } + else + { + nodeTransform = getNodeMatrix(node, frame); + nodeTransform = nodeTransform.slerp(getNodeMatrix(node, nextFrame), progress); + } if(parent != null) { - return parent.apply(part).compose(getNodeMatrix(((PartWrapper)part).getNode())); + return parent.apply(part).compose(nodeTransform); } - return getNodeMatrix(((PartWrapper)part).getNode()); + return nodeTransform; } private static LoadingCache, Integer>, TRSRTransformation> cache = CacheBuilder.newBuilder() @@ -252,6 +303,11 @@ public class B3DLoader implements ICustomModelLoader return cache.getUnchecked(Triple., Integer>of(animation, node, frame)); } + public TRSRTransformation getNodeMatrix(Node node, int frame) + { + return cache.getUnchecked(Triple., Integer>of(animation, node, frame)); + } + public static TRSRTransformation getNodeMatrix(Animation animation, Node node, int frame) { TRSRTransformation ret = TRSRTransformation.identity(); @@ -326,20 +382,36 @@ public class B3DLoader implements ICustomModelLoader } } + /** + * @deprecated Use ModelWrapper, this will be removed in 1.9 + */ + @Deprecated public static class Wrapper extends PartWrapper implements IRetexturableModel, IModelCustomData { private final ResourceLocation location; + private final ImmutableSet meshes; private final ImmutableMap textures; public Wrapper(ResourceLocation location, List textures, B3DModel.Node mesh) { - this(location, buildTextures(textures), mesh); + this(location, ImmutableSet.of(), buildTextures(textures), mesh); } public Wrapper(ResourceLocation location, ImmutableMap textures, B3DModel.Node mesh) + { + this(location, ImmutableSet.of(), textures, mesh); + } + + public Wrapper(ResourceLocation location, ImmutableSet meshes, List textures, B3DModel.Node mesh) + { + this(location, meshes, buildTextures(textures), mesh); + } + + public Wrapper(ResourceLocation location, ImmutableSet meshes, ImmutableMap textures, B3DModel.Node mesh) { super(mesh); this.location = location; + this.meshes = meshes; this.textures = textures; } @@ -398,7 +470,7 @@ public class B3DLoader implements ICustomModelLoader } } builder.put("missingno", missing); - return new BakedWrapper(this, state, format, builder.build()); + return new BakedWrapper(getNode(), state, format, meshes, builder.build()); } public B3DState getDefaultState() @@ -465,29 +537,211 @@ public class B3DLoader implements ICustomModelLoader @Override public IModel process(ImmutableMap customData) { - // TODO keyframe - return null; + return this; + } + } + public static class ModelWrapper implements IRetexturableModel, IModelCustomData + { + private final ResourceLocation modelLocation; + private final B3DModel model; + private final ImmutableSet meshes; + private final ImmutableMap textures; + private final int defaultKey; + + public ModelWrapper(ResourceLocation modelLocation, B3DModel model, ImmutableSet meshes, int defaultKey) + { + this(modelLocation, model, meshes, defaultKey, buildTextures(model.getTextures())); + } + + public ModelWrapper(ResourceLocation modelLocation, B3DModel model, ImmutableSet meshes, int defaultKey, ImmutableMap textures) + { + this.modelLocation = modelLocation; + this.model = model; + this.meshes = meshes; + this.textures = textures; + this.defaultKey = defaultKey; + } + + private static ImmutableMap buildTextures(List textures) + { + ImmutableMap.Builder builder = ImmutableMap.builder(); + + for(Texture t : textures) + { + String path = t.getPath(); + String location = getLocation(path); + if(!location.startsWith("#")) location = "#" + location; + builder.put(path, new ResourceLocation(location)); + } + return builder.build(); + } + + private static String getLocation(String path) + { + if(path.endsWith(".png")) path = path.substring(0, path.length() - ".png".length()); + return path; + } + + @Override + public Collection getDependencies() + { + return Collections.emptyList(); + } + + @Override + public Collection getTextures() + { + return Collections2.filter(textures.values(), new Predicate() + { + public boolean apply(ResourceLocation loc) + { + return !loc.getResourcePath().startsWith("#"); + } + }); + } + + @Override + public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) + { + ImmutableMap.Builder builder = ImmutableMap.builder(); + TextureAtlasSprite missing = bakedTextureGetter.apply(new ResourceLocation("missingno")); + for(Map.Entry e : textures.entrySet()) + { + if(e.getValue().getResourcePath().startsWith("#")) + { + FMLLog.severe("unresolved texture '%s' for b3d model '%s'", e.getValue().getResourcePath(), modelLocation); + builder.put(e.getKey(), missing); + } + else + { + builder.put(e.getKey(), bakedTextureGetter.apply(e.getValue())); + } + } + builder.put("missingno", missing); + return new BakedWrapper(model.getRoot(), state, format, meshes, builder.build()); + } + + @Override + public IModelState getDefaultState() + { + return new B3DState(model.getRoot().getAnimation(), defaultKey, defaultKey, 0); + } + + @Override + public IModel retexture(ImmutableMap textures) + { + ImmutableMap.Builder builder = ImmutableMap.builder(); + for(Map.Entry e : this.textures.entrySet()) + { + String path = e.getKey(); + String loc = getLocation(path); + if(textures.containsKey(loc)) + { + String newLoc = textures.get(loc); + if(newLoc == null) newLoc = getLocation(path); + builder.put(e.getKey(), new ResourceLocation(newLoc)); + } + else + { + builder.put(e); + } + } + return new ModelWrapper(modelLocation, model, meshes, defaultKey, builder.build()); + } + + @Override + public IModel process(ImmutableMap data) + { + if(data.containsKey("mesh")) + { + JsonElement e = new JsonParser().parse(data.get("mesh")); + if(e.isJsonPrimitive() && e.getAsJsonPrimitive().isString()) + { + return new ModelWrapper(modelLocation, model, ImmutableSet.of(e.getAsString()), defaultKey, textures); + } + else if (e.isJsonArray()) + { + ImmutableSet.Builder builder = ImmutableSet.builder(); + for(JsonElement s : e.getAsJsonArray()) + { + if(s.isJsonPrimitive() && s.getAsJsonPrimitive().isString()) + { + builder.add(s.getAsString()); + } + else + { + FMLLog.severe("unknown mesh definition '%s' in array for b3d model '%s'", s.toString(), modelLocation); + return this; + } + } + return new ModelWrapper(modelLocation, model, builder.build(), defaultKey, textures); + } + else + { + FMLLog.severe("unknown mesh definition '%s' for b3d model '%s'", e.toString(), modelLocation); + return this; + } + } + if(data.containsKey("key")) + { + JsonElement e = new JsonParser().parse(data.get("key")); + if(e.isJsonPrimitive() && e.getAsJsonPrimitive().isNumber()) + { + return new ModelWrapper(modelLocation, model, meshes, e.getAsNumber().intValue(), textures); + } + else + { + FMLLog.severe("unknown keyframe definition '%s' for b3d model '%s'", e.toString(), modelLocation); + return this; + } + } + return this; } } private static class BakedWrapper implements IFlexibleBakedModel, ISmartBlockModel, ISmartItemModel, IPerspectiveAwareModel { - private final B3DLoader.Wrapper model; + private final Node node; private final IModelState state; private final VertexFormat format; + private final ImmutableSet meshes; private final ImmutableMap textures; + private final LoadingCache cache; private ImmutableList quads; - private static final int BYTES_IN_INT = Integer.SIZE / Byte.SIZE; - private static final int VERTICES_IN_QUAD = 4; - - public BakedWrapper(B3DLoader.Wrapper model, IModelState state, VertexFormat format, ImmutableMap textures) + public BakedWrapper(Node node, IModelState state, VertexFormat format, ImmutableSet meshes, ImmutableMap textures) { - this.model = model; + this(node, state, format, meshes, textures, CacheBuilder.newBuilder() + .maximumSize(128) + .expireAfterAccess(2, TimeUnit.MINUTES) + .build(new CacheLoader() + { + public BakedWrapper load(Integer frame) throws Exception + { + IModelState parent = state; + Animation newAnimation = null; + if(parent instanceof B3DState) + { + B3DState ps = (B3DState)parent; + parent = ps.getParent(); + } + if(newAnimation == null) + { + newAnimation = node.getAnimation(); + } + return new BakedWrapper(node, new B3DState(newAnimation, frame, frame, 0, parent), format, meshes, textures); + } + })); + } + public BakedWrapper(Node node, IModelState state, VertexFormat format, ImmutableSet meshes, ImmutableMap textures, LoadingCache cache) + { + this.node = node; this.state = state; this.format = format; + this.meshes = meshes; this.textures = textures; + this.cache = cache; } public List getFaceQuads(EnumFacing side) @@ -495,47 +749,43 @@ public class B3DLoader implements ICustomModelLoader return Collections.emptyList(); } - @SuppressWarnings("unchecked") public List getGeneralQuads() { if(quads == null) { - Node mesh = model.getNode(); ImmutableList.Builder builder = ImmutableList.builder(); - for(Node child : mesh.getNodes().values()) + for(Node child : node.getNodes().values()) { - if(child.getKind() instanceof Mesh) - { - Node childMesh = (Node)child; - builder.addAll(new BakedWrapper(new B3DLoader.Wrapper(model.getLocation(), model.getTextureMap(), childMesh), state, format, textures).getGeneralQuads()); - } + builder.addAll(new BakedWrapper(child, state, format, meshes, textures).getGeneralQuads()); } - mesh.getKind().getWeightMap(); - Collection faces = mesh.getKind().getFaces(); - faces = mesh.getKind().bake(new Function, Matrix4f>() + if(node.getKind() instanceof Mesh && meshes.contains(node.getName())) { - // gets transformation in global space - public Matrix4f apply(Node node) + Mesh mesh = (Mesh)node.getKind(); + Collection faces = mesh.bake(new Function, Matrix4f>() { - return state.apply(PartWrapper.create(node)).getMatrix(); + // gets transformation in global space + public Matrix4f apply(Node node) + { + return state.apply(PartWrapper.create(node)).getMatrix(); + } + }); + for(Face f : faces) + { + UnpackedBakedQuad.Builder quadBuilder = new UnpackedBakedQuad.Builder(format); + quadBuilder.setQuadOrientation(EnumFacing.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z)); + quadBuilder.setQuadColored(); + List textures = null; + if(f.getBrush() != null) textures = f.getBrush().getTextures(); + TextureAtlasSprite sprite; + if(textures == null || textures.isEmpty()) sprite = this.textures.get("missingno"); + else if(textures.get(0) == B3DModel.Texture.White) sprite = ModelLoader.White.instance; + else sprite = this.textures.get(textures.get(0).getPath()); + putVertexData(quadBuilder, f.getV1(), f.getNormal(), sprite); + putVertexData(quadBuilder, f.getV2(), f.getNormal(), sprite); + putVertexData(quadBuilder, f.getV3(), f.getNormal(), sprite); + putVertexData(quadBuilder, f.getV3(), f.getNormal(), sprite); + builder.add(quadBuilder.build()); } - }); - for(Face f : faces) - { - UnpackedBakedQuad.Builder quadBuilder = new UnpackedBakedQuad.Builder(format); - quadBuilder.setQuadOrientation(EnumFacing.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z)); - quadBuilder.setQuadColored(); - List textures = null; - if(f.getBrush() != null) textures = f.getBrush().getTextures(); - TextureAtlasSprite sprite; - if(textures == null || textures.isEmpty()) sprite = this.textures.get("missingno"); - else if(textures.get(0) == B3DModel.Texture.White) sprite = ModelLoader.White.instance; - else sprite = this.textures.get(textures.get(0).getPath()); - putVertexData(quadBuilder, f.getV1(), f.getNormal(), sprite); - putVertexData(quadBuilder, f.getV2(), f.getNormal(), sprite); - putVertexData(quadBuilder, f.getV3(), f.getNormal(), sprite); - putVertexData(quadBuilder, f.getV3(), f.getNormal(), sprite); - builder.add(quadBuilder.build()); } quads = builder.build(); } @@ -632,24 +882,30 @@ public class B3DLoader implements ICustomModelLoader B3DState s = exState.getValue(B3DFrameProperty.instance); if(s != null) { - return getCachedModel(s.getFrame()); + //return getCachedModel(s.getFrame()); + IModelState parent = this.state; + Animation newAnimation = s.getAnimation(); + if(parent instanceof B3DState) + { + B3DState ps = (B3DState)parent; + parent = ps.getParent(); + } + if(newAnimation == null) + { + newAnimation = node.getAnimation(); + } + if(s.getFrame() == s.getNextFrame()) + { + return cache.getUnchecked(s.getFrame()); + } + B3DState newState = new B3DState(newAnimation, s.getFrame(), s.getNextFrame(), s.getProgress(), parent); + return new BakedWrapper(node, newState, format, meshes, textures); } } } return this; } - private final Map cache = new HashMap(); - - public BakedWrapper getCachedModel(int frame) - { - if(!cache.containsKey(frame)) - { - cache.put(frame, new BakedWrapper(model, new B3DState(model.getNode().getAnimation(), frame, state), format, textures)); - } - return cache.get(frame); - } - public VertexFormat getFormat() { return format; @@ -665,7 +921,7 @@ public class B3DLoader implements ICustomModelLoader { if(state instanceof IPerspectiveState) { - return Pair.of((IBakedModel)this, TRSRTransformation.blockCornerToCenter(((IPerspectiveState)state).forPerspective(cameraTransformType).apply(model)).getMatrix()); + return Pair.of((IBakedModel)this, TRSRTransformation.blockCornerToCenter(((IPerspectiveState)state).forPerspective(cameraTransformType).apply(PartWrapper.create(node))).getMatrix()); } return Pair.of((IBakedModel)this, null); } diff --git a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java new file mode 100644 index 000000000..48b8ec2a1 --- /dev/null +++ b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java @@ -0,0 +1,285 @@ +package net.minecraftforge.debug; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockPistonBase; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ITickable; +import net.minecraft.world.World; +import net.minecraftforge.client.model.ISmartBlockModel; +import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.client.model.b3d.B3DLoader; +import net.minecraftforge.client.model.b3d.B3DLoader.B3DFrameProperty; +import net.minecraftforge.client.model.b3d.B3DLoader.B3DState; +import net.minecraftforge.common.property.ExtendedBlockState; +import net.minecraftforge.common.property.IExtendedBlockState; +import net.minecraftforge.common.property.IUnlistedProperty; +import net.minecraftforge.fml.client.registry.ClientRegistry; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.Mod.EventHandler; +import net.minecraftforge.fml.common.SidedProxy; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.registry.GameRegistry; + +import org.lwjgl.opengl.GL11; + +@Mod(modid = ModelAnimationDebug.MODID, version = ModelAnimationDebug.VERSION) +public class ModelAnimationDebug +{ + public static final String MODID = "forgedebugmodelanimation"; + public static final String VERSION = "0.0"; + + public static String blockName = "test_animation_block"; + public static final PropertyDirection FACING = PropertyDirection.create("facing"); + + @SidedProxy(serverSide = "net.minecraftforge.debug.ModelAnimationDebug$CommonProxy", clientSide = "net.minecraftforge.debug.ModelAnimationDebug$ClientProxy") + public static CommonProxy proxy; + + public static class CommonProxy + { + public void preInit(FMLPreInitializationEvent event) + { + B3DLoader.instance.addDomain(MODID); + GameRegistry.registerBlock(new Block(Material.wood) + { + { + setCreativeTab(CreativeTabs.tabBlock); + setUnlocalizedName(MODID + "." + blockName); + } + + @Override + public ExtendedBlockState createBlockState() + { + return new ExtendedBlockState(this, new IProperty[]{ FACING }, new IUnlistedProperty[]{ B3DFrameProperty.instance }); + } + + @Override + public int getRenderType() { return -1; } + + @Override + public boolean isOpaqueCube() { return false; } + + @Override + public boolean isFullCube() { return false; } + + @Override + public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + return this.getDefaultState().withProperty(FACING, BlockPistonBase.getFacingFromEntity(world, pos, placer)); + } + + @Override + public IBlockState getStateFromMeta(int meta) { + return getDefaultState().withProperty(FACING, EnumFacing.getFront(meta)); + } + + @Override + public int getMetaFromState(IBlockState state) { + return ((EnumFacing)state.getValue(FACING)).getIndex(); + } + + @Override + public boolean hasTileEntity(IBlockState state) { + return true; + } + + @Override + public TileEntity createTileEntity(World world, IBlockState state) { + return new Chest(state); + } + + /*@Override + public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { + TileEntity te = world.getTileEntity(pos); + if(te instanceof Chest && state instanceof IExtendedBlockState) + { + return ((Chest)te).getState((IExtendedBlockState)state); + } + return super.getExtendedState(state, world, pos); + }*/ + + @Override + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) + { + if(world.isRemote) + { + TileEntity te = world.getTileEntity(pos); + if(te instanceof Chest) + { + ((Chest)te).click(); + } + } + return false; + } + }, blockName); + } + + public void init(FMLInitializationEvent event) {} + } + + public static class ClientProxy extends CommonProxy + { + @Override + public void preInit(FMLPreInitializationEvent event) + { + super.preInit(event); + ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(GameRegistry.findBlock(MODID, blockName)), 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + blockName, "inventory")); + } + + @Override + public void init(FMLInitializationEvent event) + { + super.init(event); + ClientRegistry.bindTileEntitySpecialRenderer(Chest.class, ChestRenderer.instance); + } + } + + @EventHandler + public void preInit(FMLPreInitializationEvent event) { proxy.preInit(event); } + + @EventHandler + public void init(FMLInitializationEvent event) { proxy.init(event); } + + private static class Chest extends TileEntity implements ITickable + { + private final int minFrame = 1; + private final int maxFrame = 10; + private int tick = minFrame; + private boolean opening = false; + private boolean closing = false; + + public Chest(IBlockState state) { + } + + /*public IExtendedBlockState getState(IExtendedBlockState state) { + return state.withProperty(B3DFrameProperty.instance, curState); + }*/ + + public void click() + { + if(opening || tick == maxFrame) + { + opening = false; + closing = true; + return; + } + if(closing || tick == minFrame) + { + closing = false; + opening = true; + return; + } + opening = true; + } + + @Override + public void update() + { + if(opening) + { + tick++; + if(tick >= maxFrame) + { + tick = maxFrame; + opening = false; + } + } + if(closing) + { + tick--; + if(tick <= minFrame) + { + tick = minFrame; + closing = false; + } + } + } + + public int getCurFrame() + { + return tick; + } + + public int getNextFrame() + { + if(opening) return Math.min(tick + 1, maxFrame); + if(closing) return Math.max(tick - 1, minFrame); + return tick; + } + } + + private static class ChestRenderer extends TileEntitySpecialRenderer + { + public static ChestRenderer instance = new ChestRenderer(); + private ChestRenderer() {} + + private final BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); + + public void renderTileEntityAt(Chest te, double x, double y, double z, float partialTick, int breakStage) + { + IBlockState state = te.getWorld().getBlockState(te.getPos()); + IBakedModel model = this.blockRenderer.getModelFromBlockState(state, te.getWorld(), te.getPos()); + if(state instanceof IExtendedBlockState) + { + IExtendedBlockState exState = (IExtendedBlockState)state; + if(exState.getUnlistedNames().contains(B3DFrameProperty.instance)) + { + exState = exState.withProperty(B3DFrameProperty.instance, new B3DState(null, te.getCurFrame(), te.getNextFrame(), partialTick)); + if(model instanceof ISmartBlockModel) + { + model = ((ISmartBlockModel)model).handleBlockState(exState); + } + } + } + + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + this.bindTexture(TextureMap.locationBlocksTexture); + RenderHelper.disableStandardItemLighting(); + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.enableBlend(); + GlStateManager.disableCull(); + + if (Minecraft.isAmbientOcclusionEnabled()) + { + GlStateManager.shadeModel(GL11.GL_SMOOTH); + } + else + { + GlStateManager.shadeModel(GL11.GL_FLAT); + } + + worldrenderer.func_181668_a(7, DefaultVertexFormats.BLOCK); + worldrenderer.setTranslation(x - te.getPos().getX(), y - te.getPos().getY(), z - te.getPos().getZ()); + + this.blockRenderer.getBlockModelRenderer().renderModel(te.getWorld(), model, state, te.getPos(), worldrenderer, false); + + worldrenderer.setTranslation(0, 0, 0); + tessellator.draw(); + + RenderHelper.enableStandardItemLighting(); + } + } +} + diff --git a/src/test/resources/assets/forgedebugmodelanimation/blockstates/test_animation_block.json b/src/test/resources/assets/forgedebugmodelanimation/blockstates/test_animation_block.json new file mode 100644 index 000000000..b12b0913d --- /dev/null +++ b/src/test/resources/assets/forgedebugmodelanimation/blockstates/test_animation_block.json @@ -0,0 +1,26 @@ +{ + "forge_marker": 1, + "defaults": { + "textures": { + "#chest": "entity/chest/normal" + }, + "model": "forgedebugmodelloaderregistry:chest.b3d", + "custom": { + "mesh": ["Cube.001"] + } + }, + "variants": { + "normal": [{}], + "inventory": [{ + "transform": "forge:default-block" + }], + "facing": { + "down": { "transform": { "rotation": { "x": 90 } } }, + "up": { "transform": { "rotation": { "x": 270 } } }, + "north": { "transform": { "rotation": { "y": 180 } } }, + "south": { "transform": "identity" }, + "west": { "transform": { "rotation": { "y": 90 } } }, + "east": { "transform": { "rotation": { "y": 270 } } } + } + } +} From 7689ea4f28c1ae63c2bca0ef8111e02234ebedb4 Mon Sep 17 00:00:00 2001 From: kashike Date: Fri, 7 Aug 2015 13:46:02 -0700 Subject: [PATCH 038/133] Use the FMLSecurityManager checkPermission(Permission) method for context-based permission checks. Fixes #2067 --- .../minecraftforge/fml/relauncher/FMLSecurityManager.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/net/minecraftforge/fml/relauncher/FMLSecurityManager.java b/src/main/java/net/minecraftforge/fml/relauncher/FMLSecurityManager.java index 127a94a7f..41f158777 100644 --- a/src/main/java/net/minecraftforge/fml/relauncher/FMLSecurityManager.java +++ b/src/main/java/net/minecraftforge/fml/relauncher/FMLSecurityManager.java @@ -37,6 +37,12 @@ public class FMLSecurityManager extends SecurityManager { return; } + @Override + public void checkPermission(Permission perm, Object context) + { + this.checkPermission(perm); + } + public static class ExitTrappedException extends SecurityException { private static final long serialVersionUID = 1L; } From 07ccf667e4d17add7fb99a59c3cf4efdd85b2e33 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Thu, 19 Nov 2015 23:40:44 +0300 Subject: [PATCH 039/133] B3D loader: removed 2 redundand null checks, changed constructor args to final to fix (java6?) inner arg error. --- .../net/minecraftforge/client/model/b3d/B3DLoader.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java index 5cfad738d..91130d2d4 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java @@ -313,7 +313,7 @@ public class B3DLoader implements ICustomModelLoader TRSRTransformation ret = TRSRTransformation.identity(); Key key = null; if(animation != null) key = animation.getKeys().get(frame, node); - else if(key == null && node.getAnimation() != null && node.getAnimation() != animation) key = node.getAnimation().getKeys().get(frame, node); + else if(node.getAnimation() != null && node.getAnimation() != animation) key = node.getAnimation().getKeys().get(frame, node); if(key != null) { Node parent = node.getParent(); @@ -710,7 +710,7 @@ public class B3DLoader implements ICustomModelLoader private ImmutableList quads; - public BakedWrapper(Node node, IModelState state, VertexFormat format, ImmutableSet meshes, ImmutableMap textures) + public BakedWrapper(final Node node, final IModelState state, final VertexFormat format, final ImmutableSet meshes, final ImmutableMap textures) { this(node, state, format, meshes, textures, CacheBuilder.newBuilder() .maximumSize(128) @@ -720,16 +720,12 @@ public class B3DLoader implements ICustomModelLoader public BakedWrapper load(Integer frame) throws Exception { IModelState parent = state; - Animation newAnimation = null; + Animation newAnimation = node.getAnimation(); if(parent instanceof B3DState) { B3DState ps = (B3DState)parent; parent = ps.getParent(); } - if(newAnimation == null) - { - newAnimation = node.getAnimation(); - } return new BakedWrapper(node, new B3DState(newAnimation, frame, frame, 0, parent), format, meshes, textures); } })); From 62d0f012361a05e9a6a5bf71f58fe4d5b1b1df59 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sat, 21 Nov 2015 07:45:56 +0300 Subject: [PATCH 040/133] Fix holes in generated item models. --- .../client/model/ItemLayerModel.java | 62 ++++++++++++++++--- 1 file changed, 53 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java index 396c4e659..6c405c9b6 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java @@ -214,31 +214,75 @@ public class ItemLayerModel implements IRetexturableModel { private static BakedQuad buildSideQuad(VertexFormat format, TRSRTransformation transform, EnumFacing side, int tint, TextureAtlasSprite sprite, int u, int v) { + final float eps0 = 30e-5f; + final float eps1 = 45e-5f; + final float eps2 = .5f; + final float eps3 = .5f; float x0 = (float)u / sprite.getIconWidth(); float y0 = (float)v / sprite.getIconHeight(); float x1 = x0, y1 = y0; - float z1 = 7.5f / 16f, z2 = 8.5f / 16f; + float z1 = 7.5f / 16f - eps1, z2 = 8.5f / 16f + eps1; switch(side) { case WEST: - z1 = 8.5f / 16f; - z2 = 7.5f / 16f; + z1 = 8.5f / 16f + eps1; + z2 = 7.5f / 16f - eps1; case EAST: y1 = (v + 1f) / sprite.getIconHeight(); break; case DOWN: - z1 = 8.5f / 16f; - z2 = 7.5f / 16f; + z1 = 8.5f / 16f + eps1; + z2 = 7.5f / 16f - eps1; case UP: x1 = (u + 1f) / sprite.getIconWidth(); break; default: throw new IllegalArgumentException("can't handle z-oriented side"); } - float u0 = 16f * (x0 - side.getDirectionVec().getX() * 1e-2f / sprite.getIconWidth()); - float u1 = 16f * (x1 - side.getDirectionVec().getX() * 1e-2f / sprite.getIconWidth()); - float v0 = 16f * (1f - y0 - side.getDirectionVec().getY() * 1e-2f / sprite.getIconHeight()); - float v1 = 16f * (1f - y1 - side.getDirectionVec().getY() * 1e-2f / sprite.getIconHeight()); + float u0 = 16f * (x0 - side.getDirectionVec().getX() * eps3 / sprite.getIconWidth()); + float u1 = 16f * (x1 - side.getDirectionVec().getX() * eps3 / sprite.getIconWidth()); + float v0 = 16f * (1f - y0 - side.getDirectionVec().getY() * eps3 / sprite.getIconHeight()); + float v1 = 16f * (1f - y1 - side.getDirectionVec().getY() * eps3 / sprite.getIconHeight()); + switch(side) + { + case WEST: + case EAST: + y0 -= eps1; + y1 += eps1; + v0 -= eps2 / sprite.getIconHeight(); + v1 += eps2 / sprite.getIconHeight(); + break; + case DOWN: + case UP: + x0 -= eps1; + x1 += eps1; + u0 += eps2 / sprite.getIconWidth(); + u1 -= eps2 / sprite.getIconWidth(); + break; + default: + throw new IllegalArgumentException("can't handle z-oriented side"); + } + switch(side) + { + case WEST: + x0 += eps0; + x1 += eps0; + break; + case EAST: + x0 -= eps0; + x1 -= eps0; + break; + case DOWN: + y0 -= eps0; + y1 -= eps0; + break; + case UP: + y0 += eps0; + y1 += eps0; + break; + default: + throw new IllegalArgumentException("can't handle z-oriented side"); + } return buildQuad( format, transform, side.getOpposite(), tint, // getOpposite is related either to the swapping of V direction, or something else x0, y0, z1, sprite.getInterpolatedU(u0), sprite.getInterpolatedV(v0), From c4742aadbc576999851c732e73d86f06cb94751f Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sat, 21 Nov 2015 08:09:38 +0300 Subject: [PATCH 041/133] Removed face doubles from item models. --- .../client/model/ItemLayerModel.java | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java index 6c405c9b6..feade2917 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java @@ -1,6 +1,7 @@ package net.minecraftforge.client.model; import java.util.Arrays; +import java.util.BitSet; import java.util.Collection; import java.util.List; @@ -145,6 +146,7 @@ public class ItemLayerModel implements IRetexturableModel { int uMax = sprite.getIconWidth(); int vMax = sprite.getIconHeight(); + BitSet faces = new BitSet((uMax + 1) * (vMax + 1) * 4); for(int f = 0; f < sprite.getFrameCount(); f++) { int[] pixels = sprite.getFrameTextureData(f)[0]; @@ -159,26 +161,26 @@ public class ItemLayerModel implements IRetexturableModel { boolean t = isTransparent(pixels, uMax, vMax, u, v); if(ptu && !t) // left - transparent, right - opaque { - builder.add(buildSideQuad(format, transform, EnumFacing.WEST, tint, sprite, u, v)); + addSideQuad(builder, faces, format, transform, EnumFacing.WEST, tint, sprite, uMax, vMax, u, v); } if(!ptu && t) // left - opaque, right - transparent { - builder.add(buildSideQuad(format, transform, EnumFacing.EAST, tint, sprite, u, v)); + addSideQuad(builder, faces, format, transform, EnumFacing.EAST, tint, sprite, uMax, vMax, u, v); } if(ptv[u] && !t) // up - transparent, down - opaque { - builder.add(buildSideQuad(format, transform, EnumFacing.UP, tint, sprite, u, v)); + addSideQuad(builder, faces, format, transform, EnumFacing.UP, tint, sprite, uMax, vMax, u, v); } if(!ptv[u] && t) // up - opaque, down - transparent { - builder.add(buildSideQuad(format, transform, EnumFacing.DOWN, tint, sprite, u, v)); + addSideQuad(builder, faces, format, transform, EnumFacing.DOWN, tint, sprite, uMax, vMax, u, v); } ptu = t; ptv[u] = t; } if(!ptu) // last - opaque { - builder.add(buildSideQuad(format, transform, EnumFacing.EAST, tint, sprite, uMax, v)); + addSideQuad(builder, faces, format, transform, EnumFacing.EAST, tint, sprite, uMax, vMax, uMax, v); } } // last line @@ -186,7 +188,7 @@ public class ItemLayerModel implements IRetexturableModel { { if(!ptv[u]) { - builder.add(buildSideQuad(format, transform, EnumFacing.DOWN, tint, sprite, u, vMax)); + addSideQuad(builder, faces, format, transform, EnumFacing.DOWN, tint, sprite, uMax, vMax, u, vMax); } } } @@ -212,6 +214,18 @@ public class ItemLayerModel implements IRetexturableModel { return (pixels[u + (vMax - 1 - v) * uMax] >> 24 & 0xFF) == 0; } + private static void addSideQuad(ImmutableList.Builder builder, BitSet faces, VertexFormat format, TRSRTransformation transform, EnumFacing side, int tint, TextureAtlasSprite sprite, int uMax, int vMax, int u, int v) + { + int si = side.ordinal(); + if(si > 4) si -= 2; + int index = (vMax + 1) * ((uMax + 1) * si + u) + v; + if(!faces.get(index)) + { + faces.set(index); + builder.add(buildSideQuad(format, transform, side, tint, sprite, u, v)); + } + } + private static BakedQuad buildSideQuad(VertexFormat format, TRSRTransformation transform, EnumFacing side, int tint, TextureAtlasSprite sprite, int u, int v) { final float eps0 = 30e-5f; From e24c38bbb095255a8371fc1108a41bf51c1863ae Mon Sep 17 00:00:00 2001 From: Minecrell Date: Sat, 21 Nov 2015 09:35:27 +0100 Subject: [PATCH 042/133] Add jline-based console with colors and tab-completion --- jsons/1.8-dev.json | 5 + jsons/1.8-rel.json | 9 +- .../dedicated/DedicatedServer.java.patch | 20 ++- .../util/ChatComponentStyle.java.patch | 10 ++ .../net/minecraft/util/ChatStyle.java.patch | 10 ++ .../minecraft/util/IChatComponent.java.patch | 10 ++ .../fml/common/launcher/FMLServerTweaker.java | 24 +++ .../console/ConsoleCommandCompleter.java | 96 ++++++++++ .../server/console/ConsoleFormatter.java | 63 +++++++ .../console/TerminalConsoleAppender.java | 168 ++++++++++++++++++ .../server/console/TerminalHandler.java | 70 ++++++++ src/main/resources/log4j2_server.xml | 61 +++++++ 12 files changed, 541 insertions(+), 5 deletions(-) create mode 100644 patches/minecraft/net/minecraft/util/ChatComponentStyle.java.patch create mode 100644 patches/minecraft/net/minecraft/util/ChatStyle.java.patch create mode 100644 patches/minecraft/net/minecraft/util/IChatComponent.java.patch create mode 100644 src/main/java/net/minecraftforge/server/console/ConsoleCommandCompleter.java create mode 100644 src/main/java/net/minecraftforge/server/console/ConsoleFormatter.java create mode 100644 src/main/java/net/minecraftforge/server/console/TerminalConsoleAppender.java create mode 100644 src/main/java/net/minecraftforge/server/console/TerminalHandler.java create mode 100644 src/main/resources/log4j2_server.xml diff --git a/jsons/1.8-dev.json b/jsons/1.8-dev.json index 97f9b7fde..bd8984dfe 100644 --- a/jsons/1.8-dev.json +++ b/jsons/1.8-dev.json @@ -8,6 +8,11 @@ { "name": "net.minecraft:launchwrapper:1.12" }, + { + "name": "jline:jline:2.13", + "children": ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, { "name": "com.google.code.findbugs:jsr305:1.3.9", "children": ["sources"], diff --git a/jsons/1.8-rel.json b/jsons/1.8-rel.json index debf80a6c..266f76805 100644 --- a/jsons/1.8-rel.json +++ b/jsons/1.8-rel.json @@ -39,6 +39,13 @@ "name": "org.ow2.asm:asm-all:5.0.3", "serverreq":true }, + { + "name": "jline:jline:2.13", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "TODO", "TODO" ], + "serverreq":true, + "clientreq":false + }, { "name": "com.typesafe.akka:akka-actor_2.11:2.3.3", "url" : "http://files.minecraftforge.net/maven/", @@ -126,4 +133,4 @@ } ] } -} \ No newline at end of file +} diff --git a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch index 1af800c17..dd0510592 100644 --- a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -8,7 +8,15 @@ private static final String __OBFID = "CL_00001784"; public DedicatedServer(File p_i1508_1_) -@@ -113,6 +114,8 @@ +@@ -88,6 +89,7 @@ + private static final String __OBFID = "CL_00001786"; + public void run() + { ++ if (net.minecraftforge.server.console.TerminalHandler.handleCommands(DedicatedServer.this)) return; + BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in)); + String s4; + +@@ -113,6 +115,8 @@ field_155771_h.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); } @@ -17,7 +25,7 @@ field_155771_h.info("Loading properties"); this.field_71340_o = new PropertyManager(new File("server.properties")); this.field_154332_n = new ServerEula(new File("eula.txt")); -@@ -204,6 +207,7 @@ +@@ -204,6 +208,7 @@ } else { @@ -25,7 +33,7 @@ this.func_152361_a(new DedicatedPlayerList(this)); long j = System.nanoTime(); -@@ -250,6 +254,7 @@ +@@ -250,6 +255,7 @@ this.func_71191_d((this.func_71207_Z() + 8) / 16 * 16); this.func_71191_d(MathHelper.func_76125_a(this.func_71207_Z(), 64, 256)); this.field_71340_o.func_73667_a("max-build-height", Integer.valueOf(this.func_71207_Z())); @@ -33,7 +41,7 @@ field_155771_h.info("Preparing level \"" + this.func_71270_I() + "\""); this.func_71247_a(this.func_71270_I(), this.func_71270_I(), k, worldtype, s2); long i1 = System.nanoTime() - j; -@@ -278,7 +283,7 @@ +@@ -278,10 +284,11 @@ thread1.start(); } @@ -42,3 +50,7 @@ } } } ++ public void func_145747_a(net.minecraft.util.IChatComponent message) { field_155771_h.info(message.func_150254_d()); } + + public void func_71235_a(WorldSettings.GameType p_71235_1_) + { diff --git a/patches/minecraft/net/minecraft/util/ChatComponentStyle.java.patch b/patches/minecraft/net/minecraft/util/ChatComponentStyle.java.patch new file mode 100644 index 000000000..c8a5e732d --- /dev/null +++ b/patches/minecraft/net/minecraft/util/ChatComponentStyle.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/util/ChatComponentStyle.java ++++ ../src-work/minecraft/net/minecraft/util/ChatComponentStyle.java +@@ -81,7 +81,6 @@ + return stringbuilder.toString(); + } + +- @SideOnly(Side.CLIENT) + public final String func_150254_d() + { + StringBuilder stringbuilder = new StringBuilder(); diff --git a/patches/minecraft/net/minecraft/util/ChatStyle.java.patch b/patches/minecraft/net/minecraft/util/ChatStyle.java.patch new file mode 100644 index 000000000..2622b5ec4 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/ChatStyle.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/util/ChatStyle.java ++++ ../src-work/minecraft/net/minecraft/util/ChatStyle.java +@@ -230,7 +230,6 @@ + return this; + } + +- @SideOnly(Side.CLIENT) + public String func_150218_j() + { + if (this.func_150229_g()) diff --git a/patches/minecraft/net/minecraft/util/IChatComponent.java.patch b/patches/minecraft/net/minecraft/util/IChatComponent.java.patch new file mode 100644 index 000000000..2605247ba --- /dev/null +++ b/patches/minecraft/net/minecraft/util/IChatComponent.java.patch @@ -0,0 +1,10 @@ +--- ../src-base/minecraft/net/minecraft/util/IChatComponent.java ++++ ../src-work/minecraft/net/minecraft/util/IChatComponent.java +@@ -32,7 +32,6 @@ + + String func_150260_c(); + +- @SideOnly(Side.CLIENT) + String func_150254_d(); + + List func_150253_a(); diff --git a/src/main/java/net/minecraftforge/fml/common/launcher/FMLServerTweaker.java b/src/main/java/net/minecraftforge/fml/common/launcher/FMLServerTweaker.java index 7eeed4352..359b190bb 100644 --- a/src/main/java/net/minecraftforge/fml/common/launcher/FMLServerTweaker.java +++ b/src/main/java/net/minecraftforge/fml/common/launcher/FMLServerTweaker.java @@ -1,9 +1,28 @@ package net.minecraftforge.fml.common.launcher; +import java.io.File; +import java.util.List; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.core.LoggerContext; + import net.minecraft.launchwrapper.LaunchClassLoader; import net.minecraftforge.fml.relauncher.FMLLaunchHandler; public class FMLServerTweaker extends FMLTweaker { + + @Override + public void acceptOptions(List args, File gameDir, File assetsDir, String profile) + { + super.acceptOptions(args, gameDir, assetsDir, profile); + + if (System.getProperty("log4j.configurationFile") == null) + { + System.setProperty("log4j.configurationFile", "log4j2_server.xml"); + ((LoggerContext) LogManager.getContext(false)).reconfigure(); + } + } + @Override public String getLaunchTarget() { @@ -16,6 +35,11 @@ public class FMLServerTweaker extends FMLTweaker { // The log4j2 queue is excluded so it is correctly visible from the obfuscated // and deobfuscated parts of the code. Without, the UI won't show anything classLoader.addClassLoaderExclusion("com.mojang.util.QueueLogAppender"); + + classLoader.addClassLoaderExclusion("jline."); + classLoader.addClassLoaderExclusion("org.fusesource."); + classLoader.addClassLoaderExclusion("net.minecraftforge.server.console.TerminalConsoleAppender"); + FMLLaunchHandler.configureForServerLaunch(classLoader, this); FMLLaunchHandler.appendCoreMods(); } diff --git a/src/main/java/net/minecraftforge/server/console/ConsoleCommandCompleter.java b/src/main/java/net/minecraftforge/server/console/ConsoleCommandCompleter.java new file mode 100644 index 000000000..af0216edb --- /dev/null +++ b/src/main/java/net/minecraftforge/server/console/ConsoleCommandCompleter.java @@ -0,0 +1,96 @@ +package net.minecraftforge.server.console; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.util.List; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import jline.console.completer.Completer; +import net.minecraft.server.dedicated.DedicatedServer; + +public final class ConsoleCommandCompleter implements Completer +{ + + private static final Logger logger = LogManager.getLogger(); + private final DedicatedServer server; + + public ConsoleCommandCompleter(DedicatedServer server) + { + this.server = checkNotNull(server, "server"); + } + + @Override + public int complete(String buffer, int cursor, List candidates) + { + int len = buffer.length(); + buffer = buffer.trim(); + if (buffer.isEmpty()) + { + return cursor; + } + + boolean prefix; + if (buffer.charAt(0) != '/') + { + buffer = '/' + buffer; + prefix = false; + } + else + { + prefix = true; + } + + final String input = buffer; + @SuppressWarnings("unchecked") + Future> tabComplete = this.server.callFromMainThread(new Callable>() { + + @Override + public List call() throws Exception + { + return ConsoleCommandCompleter.this.server.getTabCompletions(ConsoleCommandCompleter.this.server, input, + ConsoleCommandCompleter.this.server.getPosition()); + } + }); + try + { + List completions = tabComplete.get(); + if (prefix) + { + candidates.addAll(completions); + } + else + { + for (String completion : completions) + { + candidates.add(completion.charAt(0) == '/' ? completion.substring(1) : completion); + } + } + + int pos = buffer.lastIndexOf(' '); + if (pos == -1) + { + return cursor - len; + } + else + { + return cursor - len + pos; + } + } + catch (InterruptedException e) + { + Thread.currentThread().interrupt(); + } + catch (ExecutionException e) + { + logger.error("Failed to tab complete", e); + } + + return cursor; + } + +} diff --git a/src/main/java/net/minecraftforge/server/console/ConsoleFormatter.java b/src/main/java/net/minecraftforge/server/console/ConsoleFormatter.java new file mode 100644 index 000000000..51719e087 --- /dev/null +++ b/src/main/java/net/minecraftforge/server/console/ConsoleFormatter.java @@ -0,0 +1,63 @@ +package net.minecraftforge.server.console; + +import java.util.Map; +import java.util.regex.Pattern; + +import org.fusesource.jansi.Ansi; + +import com.google.common.base.Function; +import com.google.common.collect.ImmutableMap; + +import net.minecraft.util.EnumChatFormatting; + +public final class ConsoleFormatter implements Function +{ + + public ConsoleFormatter() + { + } + + private static final String RESET = Ansi.ansi().reset().toString(); + + private static final ImmutableMap REPLACEMENTS = ImmutableMap. builder() + .put(compile(EnumChatFormatting.BLACK), Ansi.ansi().reset().fg(Ansi.Color.BLACK).boldOff().toString()) + .put(compile(EnumChatFormatting.DARK_BLUE), Ansi.ansi().reset().fg(Ansi.Color.BLUE).boldOff().toString()) + .put(compile(EnumChatFormatting.DARK_GREEN), Ansi.ansi().reset().fg(Ansi.Color.GREEN).boldOff().toString()) + .put(compile(EnumChatFormatting.DARK_AQUA), Ansi.ansi().reset().fg(Ansi.Color.CYAN).boldOff().toString()) + .put(compile(EnumChatFormatting.DARK_RED), Ansi.ansi().reset().fg(Ansi.Color.RED).boldOff().toString()) + .put(compile(EnumChatFormatting.DARK_PURPLE), Ansi.ansi().reset().fg(Ansi.Color.MAGENTA).boldOff().toString()) + .put(compile(EnumChatFormatting.GOLD), Ansi.ansi().reset().fg(Ansi.Color.YELLOW).boldOff().toString()) + .put(compile(EnumChatFormatting.GRAY), Ansi.ansi().reset().fg(Ansi.Color.WHITE).boldOff().toString()) + .put(compile(EnumChatFormatting.DARK_GRAY), Ansi.ansi().reset().fg(Ansi.Color.BLACK).bold().toString()) + .put(compile(EnumChatFormatting.BLUE), Ansi.ansi().reset().fg(Ansi.Color.BLUE).bold().toString()) + .put(compile(EnumChatFormatting.GREEN), Ansi.ansi().reset().fg(Ansi.Color.GREEN).bold().toString()) + .put(compile(EnumChatFormatting.AQUA), Ansi.ansi().reset().fg(Ansi.Color.CYAN).bold().toString()) + .put(compile(EnumChatFormatting.RED), Ansi.ansi().reset().fg(Ansi.Color.RED).bold().toString()) + .put(compile(EnumChatFormatting.LIGHT_PURPLE), Ansi.ansi().reset().fg(Ansi.Color.MAGENTA).bold().toString()) + .put(compile(EnumChatFormatting.YELLOW), Ansi.ansi().reset().fg(Ansi.Color.YELLOW).bold().toString()) + .put(compile(EnumChatFormatting.WHITE), Ansi.ansi().reset().fg(Ansi.Color.WHITE).bold().toString()) + .put(compile(EnumChatFormatting.OBFUSCATED), Ansi.ansi().a(Ansi.Attribute.BLINK_SLOW).toString()) + .put(compile(EnumChatFormatting.BOLD), Ansi.ansi().a(Ansi.Attribute.UNDERLINE_DOUBLE).toString()) + .put(compile(EnumChatFormatting.STRIKETHROUGH), Ansi.ansi().a(Ansi.Attribute.STRIKETHROUGH_ON).toString()) + .put(compile(EnumChatFormatting.UNDERLINE), Ansi.ansi().a(Ansi.Attribute.UNDERLINE).toString()) + .put(compile(EnumChatFormatting.ITALIC), Ansi.ansi().a(Ansi.Attribute.ITALIC).toString()) + .put(compile(EnumChatFormatting.RESET), RESET) + .build(); + + private static Pattern compile(EnumChatFormatting formatting) + { + return Pattern.compile(formatting.toString(), Pattern.LITERAL | Pattern.CASE_INSENSITIVE); + } + + @Override + public String apply(String text) + { + for (Map.Entry entry : REPLACEMENTS.entrySet()) + { + text = entry.getKey().matcher(text).replaceAll(entry.getValue()); + } + + return text + RESET; + } + +} diff --git a/src/main/java/net/minecraftforge/server/console/TerminalConsoleAppender.java b/src/main/java/net/minecraftforge/server/console/TerminalConsoleAppender.java new file mode 100644 index 000000000..d32f25f13 --- /dev/null +++ b/src/main/java/net/minecraftforge/server/console/TerminalConsoleAppender.java @@ -0,0 +1,168 @@ +package net.minecraftforge.server.console; + +import static jline.TerminalFactory.OFF; +import static jline.console.ConsoleReader.RESET_LINE; +import static org.apache.logging.log4j.core.helpers.Booleans.parseBoolean; + +import java.io.IOException; +import java.io.PrintStream; +import java.io.Serializable; +import java.io.Writer; + +import org.apache.logging.log4j.core.Filter; +import org.apache.logging.log4j.core.Layout; +import org.apache.logging.log4j.core.LogEvent; +import org.apache.logging.log4j.core.appender.AbstractAppender; +import org.apache.logging.log4j.core.config.plugins.Plugin; +import org.apache.logging.log4j.core.config.plugins.PluginAttribute; +import org.apache.logging.log4j.core.config.plugins.PluginElement; +import org.apache.logging.log4j.core.config.plugins.PluginFactory; +import org.apache.logging.log4j.core.layout.PatternLayout; +import org.apache.logging.log4j.util.PropertiesUtil; +import org.fusesource.jansi.AnsiConsole; + +import com.google.common.base.Function; +import com.google.common.base.Functions; + +import jline.TerminalFactory; +import jline.console.ConsoleReader; + +@Plugin(name = "TerminalConsole", category = "Core", elementType = "appender", printObject = true) +public class TerminalConsoleAppender extends AbstractAppender +{ + + private static final boolean ENABLE_JLINE = PropertiesUtil.getProperties().getBooleanProperty("jline.enable", true); + + private static final PrintStream out = System.out; + + private static boolean initialized; + private static ConsoleReader reader; + + public static ConsoleReader getReader() + { + return reader; + } + + private static Function formatter = Functions.identity(); + + public static void setFormatter(Function format) + { + formatter = format != null ? format : Functions. identity(); + } + + protected TerminalConsoleAppender(String name, Filter filter, Layout layout, boolean ignoreExceptions) + { + super(name, filter, layout, ignoreExceptions); + } + + @PluginFactory + public static TerminalConsoleAppender createAppender(@PluginAttribute("name") String name, @PluginElement("Filters") Filter filter, + @PluginElement("Layout") Layout layout, @PluginAttribute("ignoreExceptions") String ignore) + { + + if (name == null) + { + LOGGER.error("No name provided for TerminalConsoleAppender"); + return null; + } + if (layout == null) + { + layout = PatternLayout.createLayout(null, null, null, null, null); + } + + boolean ignoreExceptions = parseBoolean(ignore, true); + + // This is handled by jline + System.setProperty("log4j.skipJansi", "true"); + return new TerminalConsoleAppender(name, filter, layout, ignoreExceptions); + } + + @Override + public void start() + { + // Initialize the reader if that hasn't happened yet + if (!initialized && reader == null) + { + initialized = true; + + if (ENABLE_JLINE) + { + final boolean hasConsole = System.console() != null; + if (hasConsole) + { + try + { + AnsiConsole.systemInstall(); + reader = new ConsoleReader(); + reader.setExpandEvents(false); + } + catch (Exception e) + { + LOGGER.warn("Failed to initialize terminal. Falling back to default.", e); + } + } + + if (reader == null) + { + // Eclipse doesn't support colors and characters like \r so enabling jline2 on it will + // just cause a lot of issues with empty lines and weird characters. + // Enable jline2 only on IntelliJ IDEA to prevent that. + // Also see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=76936 + + if (hasConsole || System.getProperty("java.class.path").contains("idea_rt.jar")) + { + // Disable advanced jline features + TerminalFactory.configure(OFF); + TerminalFactory.reset(); + + try + { + reader = new ConsoleReader(); + reader.setExpandEvents(false); + } + catch (Exception e) + { + LOGGER.warn("Failed to initialize fallback terminal. Falling back to standard output console.", e); + } + } + else + { + LOGGER.warn("Disabling terminal, you're running in an unsupported environment."); + } + } + } + } + + super.start(); + } + + @Override + public void append(LogEvent event) + { + if (reader != null) + { + try + { + Writer out = reader.getOutput(); + out.write(RESET_LINE); + out.write(formatEvent(event)); + + reader.drawLine(); + reader.flush(); + } + catch (IOException ignored) + { + } + } + else + { + out.print(formatEvent(event)); + } + } + + protected String formatEvent(LogEvent event) + { + return formatter.apply(getLayout().toSerializable(event).toString()); + } + +} diff --git a/src/main/java/net/minecraftforge/server/console/TerminalHandler.java b/src/main/java/net/minecraftforge/server/console/TerminalHandler.java new file mode 100644 index 000000000..3c9f6af28 --- /dev/null +++ b/src/main/java/net/minecraftforge/server/console/TerminalHandler.java @@ -0,0 +1,70 @@ +package net.minecraftforge.server.console; + +import java.io.IOException; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import com.google.common.base.Function; + +import jline.console.ConsoleReader; +import net.minecraft.server.dedicated.DedicatedServer; +import net.minecraft.util.EnumChatFormatting; + +public final class TerminalHandler +{ + + private static final Logger logger = LogManager.getLogger(); + + private TerminalHandler() + { + } + + public static boolean handleCommands(DedicatedServer server) + { + final ConsoleReader reader = TerminalConsoleAppender.getReader(); + if (reader != null) + { + TerminalConsoleAppender.setFormatter(new ConsoleFormatter()); + reader.addCompleter(new ConsoleCommandCompleter(server)); + + String line; + while (!server.isServerStopped() && server.isServerRunning()) + { + try + { + line = reader.readLine("> "); + + if (line != null) + { + line = line.trim(); + if (!line.isEmpty()) + { + server.addPendingCommand(line, server); + } + } + } + catch (IOException e) + { + logger.error("Exception handling console input", e); + } + } + + return true; + } + else + { + TerminalConsoleAppender.setFormatter(new Function() { + + @Override + public String apply(String text) + { + return EnumChatFormatting.getTextWithoutFormattingCodes(text); + } + + }); + return false; + } + } + +} diff --git a/src/main/resources/log4j2_server.xml b/src/main/resources/log4j2_server.xml new file mode 100644 index 000000000..49f8f3d04 --- /dev/null +++ b/src/main/resources/log4j2_server.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 059ba15b5a430d5959eb8a6309716b6124889e5b Mon Sep 17 00:00:00 2001 From: cpw Date: Sat, 21 Nov 2015 13:23:20 -0500 Subject: [PATCH 043/133] Fix a typesig that was broken --- patches/minecraft/net/minecraft/entity/EntityTracker.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch b/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch index 95c893a22..d3e15e11d 100644 --- a/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch @@ -22,7 +22,7 @@ + * @param entity the Entity + * @return all players tracking the Entity + */ -+ public Set getTrackingPlayers(Entity entity) ++ public Set getTrackingPlayers(Entity entity) + { + EntityTrackerEntry entry = (EntityTrackerEntry) trackedEntityHashTable.lookup(entity.getEntityId()); + if (entry == null) From aeff5272f3253a63c4e0703198e269830b2bb418 Mon Sep 17 00:00:00 2001 From: cpw Date: Sat, 21 Nov 2015 13:23:39 -0500 Subject: [PATCH 044/133] Re-add trove and vecmath. Mojang no longer ship them. --- jsons/1.8.8-rel.json | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/jsons/1.8.8-rel.json b/jsons/1.8.8-rel.json index 4a5a0de11..2f71ce7ac 100644 --- a/jsons/1.8.8-rel.json +++ b/jsons/1.8.8-rel.json @@ -20,7 +20,7 @@ "minimumLauncherVersion": 14, "assets": "1.8", "inheritsFrom": "1.8.8", - "jar": "1.8", + "jar": "1.8.8", "libraries": [ { "name": "@artifact@", @@ -123,7 +123,17 @@ { "name": "net.sf.jopt-simple:jopt-simple:4.6", "serverreq":true + }, + { + "name": "java3d:vecmath:1.5.2", + "clientreq":true, + "serverreq":true + }, + { + "name": "net.sf.trove4j:trove4j:3.0.3", + "clientreq":true, + "serverreq":true } ] } -} \ No newline at end of file +} From b5815a3b8dc38b514e9f3b427c030b3a762e286a Mon Sep 17 00:00:00 2001 From: cpw Date: Sat, 21 Nov 2015 13:24:02 -0500 Subject: [PATCH 045/133] Use the 2.1 snapshot for FG --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 162d318f9..7c924c382 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ buildscript { } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.0-SNAPSHOT' + classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT' } } From 82d83feab117853b73c0d385a041ed575199f621 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sun, 22 Nov 2015 02:10:30 +0300 Subject: [PATCH 046/133] Fixed forge lighting working incorrectly outside 0x1000000 coordinates. --- .../model/pipeline/ForgeBlockModelRenderer.java | 13 +++++++++++-- .../client/model/pipeline/VertexLighterFlat.java | 7 ++++--- .../model/pipeline/WorldRendererConsumer.java | 9 ++++++++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java b/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java index 7c8e63893..f7c7cf196 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java @@ -22,6 +22,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer return new VertexLighterFlat(); } }; + private final ThreadLocal lighterSmooth = new ThreadLocal() { @Override @@ -31,6 +32,8 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer } }; + private final ThreadLocal wrFlat = new ThreadLocal(); + private final ThreadLocal wrSmooth = new ThreadLocal(); private final ThreadLocal lastRendererFlat = new ThreadLocal(); private final ThreadLocal lastRendererSmooth = new ThreadLocal(); @@ -42,8 +45,11 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer if(wr != lastRendererFlat.get()) { lastRendererFlat.set(wr); - lighterFlat.get().setParent(new WorldRendererConsumer(wr)); + WorldRendererConsumer newCons = new WorldRendererConsumer(wr); + wrFlat.set(newCons); + lighterFlat.get().setParent(newCons); } + wrFlat.get().setOffset(pos); return render(lighterFlat.get(), world, model, block, pos, wr, checkSides); } else @@ -60,8 +66,11 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer if(wr != lastRendererSmooth.get()) { lastRendererSmooth.set(wr); - lighterSmooth.get().setParent(new WorldRendererConsumer(wr)); + WorldRendererConsumer newCons = new WorldRendererConsumer(wr); + wrSmooth.set(newCons); + lighterSmooth.get().setParent(newCons); } + wrSmooth.get().setOffset(pos); return render(lighterSmooth.get(), world, model, block, pos, wr, checkSides); } else diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java index 72d005aa3..954215f9f 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java @@ -144,12 +144,13 @@ public class VertexLighterFlat extends QuadGatheringTransformer switch(parent.getVertexFormat().getElement(e).getUsage()) { case POSITION: - float[] pos = new float[4]; + // position adding moved to WorldRendererConsumer due to x and z not fitting completely into a float + /*float[] pos = new float[4]; System.arraycopy(position[v], 0, pos, 0, position[v].length); pos[0] += blockInfo.getBlockPos().getX(); pos[1] += blockInfo.getBlockPos().getY(); - pos[2] += blockInfo.getBlockPos().getZ(); - parent.put(e, pos); + pos[2] += blockInfo.getBlockPos().getZ();*/ + parent.put(e, position[v]); break; case NORMAL: if(normalIndex != -1) { diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/WorldRendererConsumer.java b/src/main/java/net/minecraftforge/client/model/pipeline/WorldRendererConsumer.java index 2e9ee09aa..fea7dff22 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/WorldRendererConsumer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/WorldRendererConsumer.java @@ -4,6 +4,7 @@ import java.util.Arrays; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; /** @@ -14,6 +15,7 @@ public class WorldRendererConsumer implements IVertexConsumer private final WorldRenderer renderer; private final int[] quadData; private int v = 0; + private BlockPos offset = BlockPos.ORIGIN; public WorldRendererConsumer(WorldRenderer renderer) { @@ -36,13 +38,18 @@ public class WorldRendererConsumer implements IVertexConsumer if(v == 4) { renderer.addVertexData(quadData); - renderer.putPosition(0, 0, 0); + renderer.putPosition(offset.getX(), offset.getY(), offset.getZ()); Arrays.fill(quadData, 0); v = 0; } } } + public void setOffset(BlockPos offset) + { + this.offset = new BlockPos(offset); + } + public void setQuadTint(int tint) {} public void setQuadOrientation(EnumFacing orientation) {} public void setQuadColored() {} From e70fb50b51da3c7faf83e463ccf48a407c0594e9 Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 22 Nov 2015 00:46:26 -0500 Subject: [PATCH 047/133] Back to srgnames for patches. We should be starting to look OK now. --- build.gradle | 4 +- .../net/minecraft/block/Block.java.patch | 346 +++++----- .../net/minecraft/block/BlockBush.java.patch | 56 +- .../minecraft/block/BlockButton.java.patch | 8 +- .../minecraft/block/BlockCactus.java.patch | 14 +- .../net/minecraft/block/BlockChest.java.patch | 8 +- .../net/minecraft/block/BlockCocoa.java.patch | 14 +- .../net/minecraft/block/BlockCrops.java.patch | 42 +- .../minecraft/block/BlockDeadBush.java.patch | 12 +- .../net/minecraft/block/BlockDoor.java.patch | 10 +- .../block/BlockDoublePlant.java.patch | 56 +- .../minecraft/block/BlockFalling.java.patch | 10 +- .../minecraft/block/BlockFarmland.java.patch | 8 +- .../net/minecraft/block/BlockFire.java.patch | 146 ++-- .../minecraft/block/BlockFlowerPot.java.patch | 22 +- .../net/minecraft/block/BlockGrass.java.patch | 24 +- .../block/BlockHugeMushroom.java.patch | 10 +- .../net/minecraft/block/BlockIce.java.patch | 26 +- .../minecraft/block/BlockLadder.java.patch | 24 +- .../minecraft/block/BlockLeaves.java.patch | 70 +- .../net/minecraft/block/BlockLever.java.patch | 2 +- .../net/minecraft/block/BlockLog.java.patch | 12 +- .../block/BlockMobSpawner.java.patch | 10 +- .../minecraft/block/BlockMushroom.java.patch | 8 +- .../minecraft/block/BlockMycelium.java.patch | 18 +- .../block/BlockNetherWart.java.patch | 26 +- .../minecraft/block/BlockNewLeaf.java.patch | 14 +- .../net/minecraft/block/BlockNote.java.patch | 24 +- .../minecraft/block/BlockOldLeaf.java.patch | 12 +- .../net/minecraft/block/BlockOre.java.patch | 46 +- .../net/minecraft/block/BlockPane.java.patch | 40 +- .../block/BlockPistonBase.java.patch | 18 +- .../block/BlockPistonMoving.java.patch | 22 +- .../minecraft/block/BlockPotato.java.patch | 16 +- .../minecraft/block/BlockPumpkin.java.patch | 8 +- .../minecraft/block/BlockQuartz.java.patch | 12 +- .../minecraft/block/BlockRailBase.java.patch | 46 +- .../block/BlockRedstoneComparator.java.patch | 6 +- .../block/BlockRedstoneDiode.java.patch | 10 +- .../block/BlockRedstoneOre.java.patch | 12 +- .../block/BlockRedstoneWire.java.patch | 58 +- .../net/minecraft/block/BlockReed.java.patch | 12 +- .../block/BlockRotatedPillar.java.patch | 8 +- .../minecraft/block/BlockSapling.java.patch | 6 +- .../net/minecraft/block/BlockSkull.java.patch | 40 +- .../net/minecraft/block/BlockSnow.java.patch | 42 +- .../net/minecraft/block/BlockStem.java.patch | 31 +- .../minecraft/block/BlockTallGrass.java.patch | 28 +- .../net/minecraft/block/BlockTorch.java.patch | 28 +- .../minecraft/block/BlockTrapDoor.java.patch | 36 +- .../block/BlockTripWireHook.java.patch | 22 +- .../net/minecraft/block/BlockVine.java.patch | 14 +- .../BlockPistonStructureHelper.java.patch | 20 +- .../block/state/BlockState.java.patch | 32 +- .../client/LoadingScreenRenderer.java.patch | 18 +- .../net/minecraft/client/Minecraft.java.patch | 392 ++++++----- .../client/audio/SoundManager.java.patch | 24 +- .../client/entity/EntityPlayerSP.java.patch | 44 +- .../client/gui/FontRenderer.java.patch | 108 +-- .../minecraft/client/gui/GuiButton.java.patch | 12 +- .../minecraft/client/gui/GuiChat.java.patch | 14 +- .../client/gui/GuiCreateWorld.java.patch | 28 +- .../client/gui/GuiIngameMenu.java.patch | 28 +- .../client/gui/GuiMainMenu.java.patch | 36 +- .../client/gui/GuiMultiplayer.java.patch | 14 +- .../client/gui/GuiOverlayDebug.java.patch | 4 +- .../minecraft/client/gui/GuiScreen.java.patch | 76 +- .../client/gui/GuiSelectWorld.java.patch | 4 +- .../client/gui/GuiSleepMP.java.patch | 6 +- .../minecraft/client/gui/GuiSlot.java.patch | 42 +- .../gui/ServerListEntryNormal.java.patch | 16 +- .../achievement/GuiAchievements.java.patch | 100 +-- .../gui/achievement/GuiStats.java.patch | 54 +- .../gui/inventory/GuiContainer.java.patch | 50 +- .../inventory/GuiContainerCreative.java.patch | 198 +++--- .../client/model/ModelBase.java.patch | 2 +- .../client/model/ModelBox.java.patch | 6 +- .../client/model/ModelRenderer.java.patch | 20 +- .../model/PositionTextureVertex.java.patch | 2 +- .../client/model/TexturedQuad.java.patch | 2 +- .../ChunkProviderClient.java.patch | 8 +- .../multiplayer/GuiConnecting.java.patch | 12 +- .../multiplayer/PlayerControllerMP.java.patch | 44 +- .../client/multiplayer/WorldClient.java.patch | 22 +- .../NetHandlerHandshakeMemory.java.patch | 8 +- .../network/NetHandlerLoginClient.java.patch | 14 +- .../network/NetHandlerPlayClient.java.patch | 56 +- .../client/network/OldServerPinger.java.patch | 8 +- .../client/particle/EffectRenderer.java.patch | 16 +- .../BlockRendererDispatcher.java.patch | 26 +- .../client/renderer/EntityRenderer.java.patch | 162 ++--- .../InventoryEffectRenderer.java.patch | 8 +- .../renderer/ItemModelMesher.java.patch | 4 +- .../client/renderer/ItemRenderer.java.patch | 42 +- .../client/renderer/OpenGlHelper.java.patch | 10 +- .../client/renderer/RenderGlobal.java.patch | 106 +-- .../client/renderer/WorldRenderer.java.patch | 2 +- .../WorldVertexBufferUploader.java.patch | 32 +- .../renderer/block/model/BakedQuad.java.patch | 6 +- .../block/model/FaceBakery.java.patch | 70 +- .../model/ItemCameraTransforms.java.patch | 2 +- .../block/model/ItemTransformVec3f.java.patch | 6 +- .../model/ModelBlockDefinition.java.patch | 18 +- .../block/statemap/StateMap.java.patch | 6 +- .../renderer/chunk/RenderChunk.java.patch | 20 +- .../entity/RenderEntityItem.java.patch | 12 +- .../renderer/entity/RenderItem.java.patch | 94 +-- .../renderer/entity/RenderManager.java.patch | 24 +- .../renderer/entity/RenderPlayer.java.patch | 14 +- .../renderer/entity/RenderVillager.java.patch | 6 +- .../entity/RendererLivingEntity.java.patch | 34 +- .../entity/layers/LayerArmorBase.java.patch | 38 +- .../entity/layers/LayerBipedArmor.java.patch | 2 +- .../renderer/texture/Stitcher.java.patch | 18 +- .../texture/TextureAtlasSprite.java.patch | 2 +- .../texture/TextureManager.java.patch | 8 +- .../renderer/texture/TextureMap.java.patch | 99 +-- .../renderer/texture/TextureUtil.java.patch | 6 +- .../tileentity/RenderItemFrame.java.patch | 20 +- .../TileEntityItemStackRenderer.java.patch | 6 +- .../vertex/VertexFormatElement.java.patch | 2 +- .../resources/AbstractResourcePack.java.patch | 8 +- .../FallbackResourceManager.java.patch | 4 +- .../resources/LanguageManager.java.patch | 6 +- .../client/resources/Locale.java.patch | 4 +- ...SimpleReloadableResourceManager.java.patch | 26 +- .../resources/model/IBakedModel.java.patch | 4 +- .../resources/model/ModelBakery.java.patch | 71 +- .../resources/model/ModelManager.java.patch | 14 +- .../resources/model/ModelRotation.java.patch | 6 +- .../client/settings/GameSettings.java.patch | 4 +- .../client/shader/Framebuffer.java.patch | 24 +- .../command/CommandEnchant.java.patch | 8 +- .../minecraft/command/CommandFill.java.patch | 20 +- .../command/CommandHandler.java.patch | 6 +- .../command/server/CommandSetBlock.java.patch | 14 +- .../server/CommandTestForBlock.java.patch | 6 +- .../minecraft/crash/CrashReport.java.patch | 8 +- .../crash/CrashReportCategory.java.patch | 12 +- .../creativetab/CreativeTabs.java.patch | 54 +- .../enchantment/Enchantment.java.patch | 16 +- .../enchantment/EnchantmentHelper.java.patch | 26 +- .../net/minecraft/entity/Entity.java.patch | 120 ++-- .../minecraft/entity/EntityHanging.java.patch | 8 +- .../minecraft/entity/EntityList.java.patch | 38 +- .../minecraft/entity/EntityLiving.java.patch | 24 +- .../entity/EntityLivingBase.java.patch | 154 ++--- .../EntityMinecartCommandBlock.java.patch | 6 +- .../minecraft/entity/EntityTracker.java.patch | 8 +- .../entity/EntityTrackerEntry.java.patch | 38 +- .../ai/EntityAIAttackOnCollide.java.patch | 20 +- .../entity/boss/EntityDragon.java.patch | 12 +- .../entity/boss/EntityWither.java.patch | 8 +- .../entity/boss/IBossDisplayData.java.patch | 2 +- .../effect/EntityLightningBolt.java.patch | 4 +- .../entity/item/EntityEnderPearl.java.patch | 20 +- .../entity/item/EntityItem.java.patch | 88 +-- .../entity/item/EntityItemFrame.java.patch | 8 +- .../entity/item/EntityMinecart.java.patch | 216 +++--- .../item/EntityMinecartContainer.java.patch | 8 +- .../item/EntityMinecartEmpty.java.patch | 6 +- .../item/EntityMinecartFurnace.java.patch | 8 +- .../item/EntityMinecartHopper.java.patch | 8 +- .../entity/item/EntityXPOrb.java.patch | 10 +- .../entity/monster/EntityEnderman.java.patch | 32 +- .../entity/monster/EntityMagmaCube.java.patch | 4 +- .../entity/monster/EntitySlime.java.patch | 8 +- .../entity/monster/EntityZombie.java.patch | 54 +- .../entity/passive/EntityHorse.java.patch | 4 +- .../entity/passive/EntityMooshroom.java.patch | 42 +- .../entity/passive/EntityOcelot.java.patch | 6 +- .../entity/passive/EntitySheep.java.patch | 22 +- .../entity/passive/EntityVillager.java.patch | 28 +- .../entity/player/EntityPlayer.java.patch | 424 ++++++------ .../entity/player/EntityPlayerMP.java.patch | 74 +- .../entity/player/InventoryPlayer.java.patch | 10 +- .../projectile/EntityFishHook.java.patch | 14 +- .../net/minecraft/init/Bootstrap.java.patch | 264 ++++++- .../minecraft/inventory/Container.java.patch | 10 +- .../inventory/ContainerBeacon.java.patch | 8 +- .../ContainerBrewingStand.java.patch | 20 +- .../inventory/ContainerEnchantment.java.patch | 42 +- .../inventory/ContainerPlayer.java.patch | 10 +- .../inventory/ContainerRepair.java.patch | 36 +- .../net/minecraft/inventory/Slot.java.patch | 14 +- .../inventory/SlotCrafting.java.patch | 10 +- .../inventory/SlotFurnaceOutput.java.patch | 6 +- .../net/minecraft/item/Item.java.patch | 136 ++-- .../net/minecraft/item/ItemArmor.java.patch | 34 +- .../net/minecraft/item/ItemBlock.java.patch | 32 +- .../net/minecraft/item/ItemBow.java.patch | 14 +- .../net/minecraft/item/ItemBucket.java.patch | 6 +- .../minecraft/item/ItemBucketMilk.java.patch | 8 +- .../net/minecraft/item/ItemDye.java.patch | 44 +- .../minecraft/item/ItemEmptyMap.java.patch | 14 +- .../item/ItemFlintAndSteel.java.patch | 8 +- .../net/minecraft/item/ItemHoe.java.patch | 12 +- .../net/minecraft/item/ItemLilyPad.java.patch | 12 +- .../net/minecraft/item/ItemMap.java.patch | 12 +- .../item/ItemMonsterPlacer.java.patch | 72 +- .../net/minecraft/item/ItemRecord.java.patch | 2 +- .../minecraft/item/ItemSeedFood.java.patch | 14 +- .../net/minecraft/item/ItemSeeds.java.patch | 16 +- .../net/minecraft/item/ItemShears.java.patch | 54 +- .../net/minecraft/item/ItemSkull.java.patch | 20 +- .../net/minecraft/item/ItemSnow.java.patch | 8 +- .../net/minecraft/item/ItemStack.java.patch | 124 ++-- .../net/minecraft/item/ItemSword.java.patch | 12 +- .../net/minecraft/item/ItemTool.java.patch | 28 +- .../item/crafting/FurnaceRecipes.java.patch | 16 +- .../item/crafting/RecipeFireworks.java.patch | 18 +- .../item/crafting/RecipeRepairItem.java.patch | 22 +- .../item/crafting/RecipesArmorDyes.java.patch | 6 +- .../item/crafting/RecipesBanners.java.patch | 14 +- .../crafting/RecipesMapCloning.java.patch | 6 +- .../item/crafting/ShapedRecipes.java.patch | 6 +- .../item/crafting/ShapelessRecipes.java.patch | 6 +- .../nbt/CompressedStreamTools.java.patch | 12 +- .../minecraft/nbt/NBTSizeTracker.java.patch | 6 +- .../minecraft/nbt/NBTTagCompound.java.patch | 12 +- .../net/minecraft/nbt/NBTTagString.java.patch | 10 +- .../network/NetHandlerPlayServer.java.patch | 98 +-- .../network/NetworkManager.java.patch | 28 +- .../network/NetworkSystem.java.patch | 2 +- .../network/ServerStatusResponse.java.patch | 28 +- .../handshake/client/C00Handshake.java.patch | 36 +- .../client/C17PacketCustomPayload.java.patch | 14 +- .../server/S3FPacketCustomPayload.java.patch | 14 +- .../server/S00PacketServerInfo.java.patch | 8 +- .../net/minecraft/potion/Potion.java.patch | 2 +- .../minecraft/potion/PotionEffect.java.patch | 40 +- .../minecraft/realms/RealmsConnect.java.patch | 4 +- .../server/MinecraftServer.java.patch | 206 +++--- .../dedicated/DedicatedServer.java.patch | 28 +- .../server/gui/MinecraftServerGui.java.patch | 2 +- .../integrated/IntegratedServer.java.patch | 72 +- .../management/ItemInWorldManager.java.patch | 186 ++--- .../management/PlayerManager.java.patch | 140 ++-- .../ServerConfigurationManager.java.patch | 244 +++---- .../network/NetHandlerHandshakeTCP.java.patch | 6 +- .../network/NetHandlerLoginServer.java.patch | 16 +- .../net/minecraft/stats/StatList.java.patch | 92 +-- .../tileentity/TileEntity.java.patch | 52 +- .../tileentity/TileEntityBeacon.java.patch | 14 +- .../TileEntityBrewingStand.java.patch | 52 +- .../tileentity/TileEntityFurnace.java.patch | 46 +- .../tileentity/TileEntityHopper.java.patch | 24 +- .../tileentity/TileEntityNote.java.patch | 8 +- .../tileentity/TileEntityPiston.java.patch | 20 +- .../tileentity/TileEntitySign.java.patch | 6 +- .../net/minecraft/util/EnumFacing.java.patch | 30 +- .../net/minecraft/util/MouseHelper.java.patch | 6 +- .../util/MovingObjectPosition.java.patch | 4 +- .../util/ResourceLocation.java.patch | 6 +- .../net/minecraft/util/Session.java.patch | 32 +- .../minecraft/util/StringTranslate.java.patch | 14 +- .../net/minecraft/util/Vec3.java.patch | 20 +- .../WeightedRandomChestContent.java.patch | 44 +- .../net/minecraft/world/ChunkCache.java.patch | 54 +- .../net/minecraft/world/Explosion.java.patch | 42 +- .../minecraft/world/IBlockAccess.java.patch | 2 +- .../minecraft/world/SpawnerAnimals.java.patch | 34 +- .../net/minecraft/world/World.java.patch | 649 +++++++++--------- .../minecraft/world/WorldProvider.java.patch | 122 ++-- .../minecraft/world/WorldServer.java.patch | 202 +++--- .../world/WorldServerMulti.java.patch | 44 +- .../net/minecraft/world/WorldType.java.patch | 58 +- .../world/biome/BiomeColorHelper.java.patch | 4 +- .../world/biome/BiomeDecorator.java.patch | 158 ++--- .../world/biome/BiomeGenBase.java.patch | 62 +- .../world/biome/BiomeGenForest.java.patch | 16 +- .../world/biome/BiomeGenHills.java.patch | 8 +- .../world/biome/BiomeGenJungle.java.patch | 8 +- .../world/biome/BiomeGenPlains.java.patch | 20 +- .../world/biome/BiomeGenSwamp.java.patch | 2 +- .../world/biome/WorldChunkManager.java.patch | 36 +- .../world/border/WorldBorder.java.patch | 4 +- .../minecraft/world/chunk/Chunk.java.patch | 194 +++--- .../chunk/storage/AnvilChunkLoader.java.patch | 82 +-- .../chunk/storage/AnvilSaveHandler.java.patch | 10 +- .../storage/ExtendedBlockStorage.java.patch | 12 +- .../world/chunk/storage/RegionFile.java.patch | 16 +- .../world/gen/ChunkProviderEnd.java.patch | 52 +- .../gen/ChunkProviderGenerate.java.patch | 98 +-- .../world/gen/ChunkProviderHell.java.patch | 142 ++-- .../world/gen/ChunkProviderServer.java.patch | 84 +-- .../world/gen/MapGenCaves.java.patch | 56 +- .../world/gen/MapGenRavine.java.patch | 54 +- .../feature/WorldGenAbstractTree.java.patch | 6 +- .../feature/WorldGenBigMushroom.java.patch | 24 +- .../gen/feature/WorldGenBigTree.java.patch | 36 +- .../gen/feature/WorldGenCanopyTree.java.patch | 58 +- .../gen/feature/WorldGenDeadBush.java.patch | 10 +- .../gen/feature/WorldGenDungeons.java.patch | 18 +- .../gen/feature/WorldGenForest.java.patch | 42 +- .../gen/feature/WorldGenHugeTrees.java.patch | 56 +- .../gen/feature/WorldGenMegaJungle.java.patch | 36 +- .../feature/WorldGenMegaPineTree.java.patch | 48 +- .../gen/feature/WorldGenMinable.java.patch | 6 +- .../feature/WorldGenSavannaTree.java.patch | 58 +- .../gen/feature/WorldGenShrub.java.patch | 26 +- .../gen/feature/WorldGenSwamp.java.patch | 86 +-- .../gen/feature/WorldGenTaiga1.java.patch | 40 +- .../gen/feature/WorldGenTaiga2.java.patch | 40 +- .../gen/feature/WorldGenTallGrass.java.patch | 10 +- .../gen/feature/WorldGenTrees.java.patch | 82 +-- .../WorldGeneratorBonusChest.java.patch | 12 +- .../world/gen/layer/GenLayer.java.patch | 26 +- .../world/gen/layer/GenLayerBiome.java.patch | 56 +- ...ComponentScatteredFeaturePieces.java.patch | 44 +- .../gen/structure/MapGenStronghold.java.patch | 6 +- .../gen/structure/MapGenStructure.java.patch | 10 +- .../structure/StructureComponent.java.patch | 4 +- .../StructureMineshaftPieces.java.patch | 18 +- .../StructureNetherBridgePieces.java.patch | 18 +- .../gen/structure/StructureStart.java.patch | 12 +- .../StructureStrongholdPieces.java.patch | 52 +- .../StructureVillagePieces.java.patch | 30 +- .../world/storage/MapData.java.patch | 48 +- .../world/storage/SaveHandler.java.patch | 38 +- .../world/storage/WorldInfo.java.patch | 6 +- 321 files changed, 6253 insertions(+), 5933 deletions(-) diff --git a/build.gradle b/build.gradle index 7c924c382..f6acdc606 100644 --- a/build.gradle +++ b/build.gradle @@ -50,8 +50,8 @@ minecraft { patchDir "patches/minecraft" patchAfter "clean" genPatchesFrom "clean" - genMcpPatches = true - applyMcpPatches = true + genMcpPatches = false + applyMcpPatches = false with common } } diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index e15a21353..4585774b7 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -3,184 +3,184 @@ @@ -38,8 +38,9 @@ public class Block { - private static final ResourceLocation AIR_ID = new ResourceLocation("air"); -- public static final RegistryNamespacedDefaultedByKey blockRegistry = new RegistryNamespacedDefaultedByKey(AIR_ID); -- public static final ObjectIntIdentityMap BLOCK_STATE_IDS = new ObjectIntIdentityMap(); -+ public static final RegistryNamespacedDefaultedByKey blockRegistry = net.minecraftforge.fml.common.registry.GameData.getBlockRegistry(); + private static final ResourceLocation field_176230_a = new ResourceLocation("air"); +- public static final RegistryNamespacedDefaultedByKey field_149771_c = new RegistryNamespacedDefaultedByKey(field_176230_a); +- public static final ObjectIntIdentityMap field_176229_d = new ObjectIntIdentityMap(); ++ public static final RegistryNamespacedDefaultedByKey field_149771_c = net.minecraftforge.fml.common.registry.GameData.getBlockRegistry(); + @Deprecated //Modders: DO NOT use this! Use GameRegistry -+ public static final ObjectIntIdentityMap BLOCK_STATE_IDS = net.minecraftforge.fml.common.registry.GameData.getBlockStateIDMap(); - private CreativeTabs displayOnCreativeTab; - public static final Block.SoundType soundTypeStone = new Block.SoundType("stone", 1.0F, 1.0F); - public static final Block.SoundType soundTypeWood = new Block.SoundType("wood", 1.0F, 1.0F); ++ public static final ObjectIntIdentityMap field_176229_d = net.minecraftforge.fml.common.registry.GameData.getBlockStateIDMap(); + private CreativeTabs field_149772_a; + public static final Block.SoundType field_149769_e = new Block.SoundType("stone", 1.0F, 1.0F); + public static final Block.SoundType field_149766_f = new Block.SoundType("wood", 1.0F, 1.0F); @@ -119,6 +120,9 @@ - private IBlockState defaultBlockState; - private String unlocalizedName; + private IBlockState field_176228_M; + private String field_149770_b; + public final net.minecraftforge.fml.common.registry.RegistryDelegate delegate = -+ ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)blockRegistry).getDelegate(this, Block.class); ++ ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)field_149771_c).getDelegate(this, Block.class); + - public static int getIdFromBlock(Block blockIn) + public static int func_149682_b(Block p_149682_0_) { - return blockRegistry.getIDForObject(blockIn); + return field_149771_c.func_148757_b(p_149682_0_); @@ -132,7 +136,8 @@ - public static Block getBlockById(int id) + public static Block func_149729_e(int p_149729_0_) { -- return (Block)blockRegistry.getObjectById(id); -+ Block ret = (Block)blockRegistry.getObjectById(id); -+ return ret == null ? net.minecraft.init.Blocks.air : ret; +- return (Block)field_149771_c.func_148754_a(p_149729_0_); ++ Block ret = (Block)field_149771_c.func_148754_a(p_149729_0_); ++ return ret == null ? net.minecraft.init.Blocks.field_150350_a : ret; } - public static IBlockState getStateById(int id) + public static IBlockState func_176220_d(int p_176220_0_) @@ -303,7 +308,7 @@ - public boolean isReplaceable(World worldIn, BlockPos pos) + public boolean func_176200_f(World p_176200_1_, BlockPos p_176200_2_) { - return false; -+ return getMaterial().isReplaceable(); ++ return func_149688_o().func_76222_j(); } - public Block setHardness(float hardness) + public Block func_149711_c(float p_149711_1_) @@ -340,9 +345,10 @@ - return this.needsRandomTick; + return this.field_149789_z; } + @Deprecated //Forge: New State sensitive version. - public boolean hasTileEntity() + public boolean func_149716_u() { -- return this.isBlockContainer; -+ return hasTileEntity(getDefaultState()); +- return this.field_149758_A; ++ return hasTileEntity(func_176223_P()); } - public final void setBlockBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ) + public final void func_149676_a(float p_149676_1_, float p_149676_2_, float p_149676_3_, float p_149676_4_, float p_149676_5_, float p_149676_6_) @@ -359,13 +365,13 @@ - public int getMixedBrightnessForBlock(IBlockAccess worldIn, BlockPos pos) + public int func_176207_c(IBlockAccess p_176207_1_, BlockPos p_176207_2_) { - Block block = worldIn.getBlockState(pos).getBlock(); -- int i = worldIn.getCombinedLight(pos, block.getLightValue()); -+ int i = worldIn.getCombinedLight(pos, block.getLightValue(worldIn, pos)); + Block block = p_176207_1_.func_180495_p(p_176207_2_).func_177230_c(); +- int i = p_176207_1_.func_175626_b(p_176207_2_, block.func_149750_m()); ++ int i = p_176207_1_.func_175626_b(p_176207_2_, block.getLightValue(p_176207_1_, p_176207_2_)); if (i == 0 && block instanceof BlockSlab) { - pos = pos.down(); - block = worldIn.getBlockState(pos).getBlock(); -- return worldIn.getCombinedLight(pos, block.getLightValue()); -+ return worldIn.getCombinedLight(pos, block.getLightValue(worldIn, pos)); + p_176207_2_ = p_176207_2_.func_177977_b(); + block = p_176207_1_.func_180495_p(p_176207_2_).func_177230_c(); +- return p_176207_1_.func_175626_b(p_176207_2_, block.func_149750_m()); ++ return p_176207_1_.func_175626_b(p_176207_2_, block.getLightValue(p_176207_1_, p_176207_2_)); } else { @@ -453,6 +459,10 @@ - public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_) { -+ if (hasTileEntity(state) && !(this instanceof BlockContainer)) ++ if (hasTileEntity(p_180663_3_) && !(this instanceof BlockContainer)) + { -+ worldIn.removeTileEntity(pos); ++ p_180663_1_.func_175713_t(p_180663_2_); + } } - public int quantityDropped(Random random) + public int func_149745_a(Random p_149745_1_) @@ -467,8 +477,7 @@ - public float getPlayerRelativeBlockHardness(EntityPlayer playerIn, World worldIn, BlockPos pos) + public float func_180647_a(EntityPlayer p_180647_1_, World p_180647_2_, BlockPos p_180647_3_) { -- float f = this.getBlockHardness(worldIn, pos); -- return f < 0.0F ? 0.0F : (!playerIn.canHarvestBlock(this) ? playerIn.getToolDigEfficiency(this) / f / 100.0F : playerIn.getToolDigEfficiency(this) / f / 30.0F); -+ return net.minecraftforge.common.ForgeHooks.blockStrength(worldIn.getBlockState(pos), playerIn, worldIn, pos); +- float f = this.func_176195_g(p_180647_2_, p_180647_3_); +- return f < 0.0F ? 0.0F : (!p_180647_1_.func_146099_a(this) ? p_180647_1_.func_180471_a(this) / f / 100.0F : p_180647_1_.func_180471_a(this) / f / 30.0F); ++ return net.minecraftforge.common.ForgeHooks.blockStrength(p_180647_2_.func_180495_p(p_180647_3_), p_180647_1_, p_180647_2_, p_180647_3_); } - public final void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int forture) + public final void func_176226_b(World p_176226_1_, BlockPos p_176226_2_, IBlockState p_176226_3_, int p_176226_4_) @@ -478,20 +487,16 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { -- if (!worldIn.isRemote) -+ if (!worldIn.isRemote && !worldIn.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe +- if (!p_180653_1_.field_72995_K) ++ if (!p_180653_1_.field_72995_K && !p_180653_1_.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe { -- int i = this.quantityDroppedWithBonus(fortune, worldIn.rand); -+ java.util.List items = getDrops(worldIn, pos, state, fortune); -+ chance = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, fortune, chance, false, harvesters.get()); +- int i = this.func_149679_a(p_180653_5_, p_180653_1_.field_73012_v); ++ java.util.List items = getDrops(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_5_); ++ p_180653_4_ = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180653_1_, p_180653_2_, p_180653_3_, p_180653_5_, p_180653_4_, false, harvesters.get()); - for (int j = 0; j < i; ++j) + for (ItemStack item : items) { - if (worldIn.rand.nextFloat() <= chance) + if (p_180653_1_.field_73012_v.nextFloat() <= p_180653_4_) { -- Item item = this.getItemDropped(state, worldIn.rand, fortune); +- Item item = this.func_180660_a(p_180653_3_, p_180653_1_.field_73012_v, p_180653_5_); - - if (item != null) - { -- spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); +- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(item, 1, this.func_180651_a(p_180653_3_))); - } -+ spawnAsEntity(worldIn, pos, item); ++ func_180635_a(p_180653_1_, p_180653_2_, item); } } } @@ -499,8 +504,13 @@ - public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack) + public static void func_180635_a(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_) { -- if (!worldIn.isRemote && worldIn.getGameRules().getGameRuleBooleanValue("doTileDrops")) -+ if (!worldIn.isRemote && worldIn.getGameRules().getGameRuleBooleanValue("doTileDrops") && !worldIn.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe +- if (!p_180635_0_.field_72995_K && p_180635_0_.func_82736_K().func_82766_b("doTileDrops")) ++ if (!p_180635_0_.field_72995_K && p_180635_0_.func_82736_K().func_82766_b("doTileDrops") && !p_180635_0_.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe { + if (captureDrops.get()) + { -+ capturedDrops.get().add(stack); ++ capturedDrops.get().add(p_180635_2_); + return; + } float f = 0.5F; - double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; - double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + double d0 = (double)(p_180635_0_.field_73012_v.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + double d1 = (double)(p_180635_0_.field_73012_v.nextFloat() * f) + (double)(1.0F - f) * 0.5D; @@ -687,7 +697,7 @@ - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { -- return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable(); -+ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos); +- return p_176196_1_.func_180495_p(p_176196_2_).func_177230_c().field_149764_J.func_76222_j(); ++ return p_176196_1_.func_180495_p(p_176196_2_).func_177230_c().func_176200_f(p_176196_1_, p_176196_2_); } - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean func_180639_a(World p_180639_1_, BlockPos p_180639_2_, IBlockState p_180639_3_, EntityPlayer p_180639_4_, EnumFacing p_180639_5_, float p_180639_6_, float p_180639_7_, float p_180639_8_) @@ -799,25 +809,35 @@ - player.triggerAchievement(StatList.mineBlockStatArray[getIdFromBlock(this)]); - player.addExhaustion(0.025F); + p_180657_2_.func_71029_a(StatList.field_75934_C[func_149682_b(this)]); + p_180657_2_.func_71020_j(0.025F); -- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) -+ if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player)) +- if (this.func_149700_E() && EnchantmentHelper.func_77502_d(p_180657_2_)) ++ if (this.canSilkHarvest(p_180657_1_, p_180657_3_, p_180657_1_.func_180495_p(p_180657_3_), p_180657_2_) && EnchantmentHelper.func_77502_d(p_180657_2_)) { + java.util.ArrayList items = new java.util.ArrayList(); - ItemStack itemstack = this.createStackedBlock(state); + ItemStack itemstack = this.func_180643_i(p_180657_4_); if (itemstack != null) { -- spawnAsEntity(worldIn, pos, itemstack); +- func_180635_a(p_180657_1_, p_180657_3_, itemstack); + items.add(itemstack); } + -+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, worldIn.getBlockState(pos), 0, 1.0f, true, player); ++ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_1_.func_180495_p(p_180657_3_), 0, 1.0f, true, p_180657_2_); + for (ItemStack stack : items) + { -+ spawnAsEntity(worldIn, pos, stack); ++ func_180635_a(p_180657_1_, p_180657_3_, stack); + } } else { -+ harvesters.set(player); - int i = EnchantmentHelper.getFortuneModifier(player); - this.dropBlockAsItem(worldIn, pos, state, i); ++ harvesters.set(p_180657_2_); + int i = EnchantmentHelper.func_77517_e(p_180657_2_); + this.func_176226_b(p_180657_1_, p_180657_3_, p_180657_4_, i); + harvesters.set(null); } } + @Deprecated //Forge: State sensitive version - protected boolean canSilkHarvest() + protected boolean func_149700_E() { -- return this.isFullCube() && !this.isBlockContainer; -+ return this.isFullCube() && !this.hasTileEntity(silk_check_state.get()); +- return this.func_149686_d() && !this.field_149758_A; ++ return this.func_149686_d() && !this.hasTileEntity(silk_check_state.get()); } - protected ItemStack createStackedBlock(IBlockState state) + protected ItemStack func_180643_i(IBlockState p_180643_1_) @@ -1010,6 +1030,1029 @@ - return "Block{" + blockRegistry.getNameForObject(this) + "}"; + return "Block{" + field_149771_c.func_177774_c(this) + "}"; } + /* ======================================== FORGE START =====================================*/ @@ -197,12 +197,12 @@ + */ + public int getLightValue(IBlockAccess world, BlockPos pos) + { -+ Block block = world.getBlockState(pos).getBlock(); ++ Block block = world.func_180495_p(pos).func_177230_c(); + if (block != this) + { + return block.getLightValue(world, pos); + } -+ return getLightValue(); ++ return func_149750_m(); + } + + /** @@ -226,7 +226,7 @@ + */ + public boolean isNormalCube(IBlockAccess world, BlockPos pos) + { -+ return getMaterial().isOpaque() && isFullCube() && !canProvidePower(); ++ return func_149688_o().func_76218_k() && func_149686_d() && !func_149744_f(); + } + + /** @@ -239,11 +239,11 @@ + */ + public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side) + { -+ IBlockState state = this.getActualState(world.getBlockState(pos), world, pos); ++ IBlockState state = this.func_176221_a(world.func_180495_p(pos), world, pos); + + if (this instanceof BlockSlab) + { -+ return isFullBlock() || (state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP && side == EnumFacing.UP); ++ return func_149730_j() || (state.func_177229_b(BlockSlab.field_176554_a) == BlockSlab.EnumBlockHalf.TOP && side == EnumFacing.UP); + } + else if (this instanceof BlockFarmland) + { @@ -251,26 +251,26 @@ + } + else if (this instanceof BlockStairs) + { -+ boolean flipped = state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP; -+ BlockStairs.EnumShape shape = (BlockStairs.EnumShape)state.getValue(BlockStairs.SHAPE); -+ EnumFacing facing = (EnumFacing)state.getValue(BlockStairs.FACING); ++ boolean flipped = state.func_177229_b(BlockStairs.field_176308_b) == BlockStairs.EnumHalf.TOP; ++ BlockStairs.EnumShape shape = (BlockStairs.EnumShape)state.func_177229_b(BlockStairs.field_176310_M); ++ EnumFacing facing = (EnumFacing)state.func_177229_b(BlockStairs.field_176309_a); + if (side == EnumFacing.UP) return flipped; + if (facing == side) return true; + if (flipped) + { -+ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.rotateYCCW(); -+ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.rotateY(); ++ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.func_176735_f(); ++ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.func_176746_e(); + } + else + { -+ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.rotateY(); -+ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.rotateYCCW(); ++ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.func_176746_e(); ++ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.func_176735_f(); + } + return false; + } + else if (this instanceof BlockSnow) + { -+ return ((Integer)state.getValue(BlockSnow.LAYERS)) >= 8; ++ return ((Integer)state.func_177229_b(BlockSnow.field_176315_a)) >= 8; + } + else if (this instanceof BlockHopper && side == EnumFacing.UP) + { @@ -308,7 +308,7 @@ + */ + public boolean isAir(IBlockAccess world, BlockPos pos) + { -+ return getMaterial() == Material.air; ++ return func_149688_o() == Material.field_151579_a; + } + + /** @@ -343,7 +343,7 @@ + */ + public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) + { -+ return world.setBlockToAir(pos); ++ return world.func_175698_g(pos); + } + + /** @@ -357,7 +357,7 @@ + */ + public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) + { -+ return net.minecraft.init.Blocks.fire.getFlammability(this); ++ return net.minecraft.init.Blocks.field_150480_ab.func_176532_c(this); + } + + /** @@ -385,7 +385,7 @@ + */ + public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) + { -+ return net.minecraft.init.Blocks.fire.getEncouragement(this); ++ return net.minecraft.init.Blocks.field_150480_ab.func_176534_d(this); + } + + /** @@ -401,11 +401,11 @@ + */ + public boolean isFireSource(World world, BlockPos pos, EnumFacing side) + { -+ if (this == net.minecraft.init.Blocks.netherrack && side == EnumFacing.UP) ++ if (this == net.minecraft.init.Blocks.field_150424_aL && side == EnumFacing.UP) + { + return true; + } -+ if ((world.provider instanceof net.minecraft.world.WorldProviderEnd) && this == net.minecraft.init.Blocks.bedrock && side == EnumFacing.UP) ++ if ((world.field_73011_w instanceof net.minecraft.world.WorldProviderEnd) && this == net.minecraft.init.Blocks.field_150357_h && side == EnumFacing.UP) + { + return true; + } @@ -440,7 +440,7 @@ + { + if (isTileProvider) + { -+ return ((ITileEntityProvider)this).createNewTileEntity(world, getMetaFromState(state)); ++ return ((ITileEntityProvider)this).func_149915_a(world, func_176201_c(state)); + } + return null; + } @@ -456,7 +456,7 @@ + */ + public int quantityDropped(IBlockState state, int fortune, Random random) + { -+ return quantityDroppedWithBonus(fortune, random); ++ return func_149679_a(fortune, random); + } + + /** @@ -472,15 +472,15 @@ + { + List ret = new java.util.ArrayList(); + -+ Random rand = world instanceof World ? ((World)world).rand : RANDOM; ++ Random rand = world instanceof World ? ((World)world).field_73012_v : RANDOM; + + int count = quantityDropped(state, fortune, rand); + for(int i = 0; i < count; i++) + { -+ Item item = this.getItemDropped(state, rand, fortune); ++ Item item = this.func_180660_a(state, rand, fortune); + if (item != null) + { -+ ret.add(new ItemStack(item, 1, this.damageDropped(state))); ++ ret.add(new ItemStack(item, 1, this.func_180651_a(state))); + } + } + return ret; @@ -498,7 +498,7 @@ + public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) + { + silk_check_state.set(state);; -+ boolean ret = this.canSilkHarvest(); ++ boolean ret = this.func_149700_E(); + silk_check_state.set(null); + return ret; + } @@ -514,14 +514,14 @@ + */ + public boolean canCreatureSpawn(IBlockAccess world, BlockPos pos, net.minecraft.entity.EntityLiving.SpawnPlacementType type) + { -+ IBlockState state = world.getBlockState(pos); ++ IBlockState state = world.func_180495_p(pos); + if (this instanceof BlockSlab) + { -+ return (isFullBlock() || state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP); ++ return (func_149730_j() || state.func_177229_b(BlockSlab.field_176554_a) == BlockSlab.EnumBlockHalf.TOP); + } + else if (this instanceof BlockStairs) + { -+ return state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP; ++ return state.func_177229_b(BlockStairs.field_176308_b) == BlockStairs.EnumHalf.TOP; + } + return isSideSolid(world, pos, EnumFacing.UP); + } @@ -538,7 +538,7 @@ + */ + public boolean isBed(IBlockAccess world, BlockPos pos, Entity player) + { -+ return this == net.minecraft.init.Blocks.bed; ++ return this == net.minecraft.init.Blocks.field_150324_C; + } + + /** @@ -553,7 +553,7 @@ + public BlockPos getBedSpawnPosition(IBlockAccess world, BlockPos pos, EntityPlayer player) + { + if (world instanceof World) -+ return BlockBed.getSafeExitLocation((World)world, pos, 0); ++ return BlockBed.func_176468_a((World)world, pos, 0); + return null; + } + @@ -569,10 +569,10 @@ + { + if (world instanceof World) + { -+ IBlockState state = world.getBlockState(pos); -+ state = state.getBlock().getActualState(state, world, pos); -+ state = state.withProperty(BlockBed.OCCUPIED, true); -+ ((World)world).setBlockState(pos, state, 4); ++ IBlockState state = world.func_180495_p(pos); ++ state = state.func_177230_c().func_176221_a(state, world, pos); ++ state = state.func_177226_a(BlockBed.field_176471_b, true); ++ ((World)world).func_180501_a(pos, state, 4); + } + } + @@ -586,7 +586,7 @@ + */ + public EnumFacing getBedDirection(IBlockAccess world, BlockPos pos) + { -+ return (EnumFacing)getActualState(world.getBlockState(pos), world, pos).getValue(BlockDirectional.FACING); ++ return (EnumFacing)func_176221_a(world.func_180495_p(pos), world, pos).func_177229_b(BlockDirectional.field_176387_N); + } + + /** @@ -598,7 +598,7 @@ + */ + public boolean isBedFoot(IBlockAccess world, BlockPos pos) + { -+ return getActualState(world.getBlockState(pos), world, pos).getValue(BlockBed.PART) == BlockBed.EnumPartType.FOOT; ++ return func_176221_a(world.func_180495_p(pos), world, pos).func_177229_b(BlockBed.field_176472_a) == BlockBed.EnumPartType.FOOT; + } + + /** @@ -630,7 +630,7 @@ + */ + public boolean isLeaves(IBlockAccess world, BlockPos pos) + { -+ return getMaterial() == Material.leaves; ++ return func_149688_o() == Material.field_151584_j; + } + + /** @@ -642,7 +642,7 @@ + */ + public boolean canBeReplacedByLeaves(IBlockAccess world, BlockPos pos) + { -+ return !isFullBlock(); ++ return !func_149730_j(); + } + + /** @@ -667,7 +667,7 @@ + */ + public boolean isReplaceableOreGen(World world, BlockPos pos, com.google.common.base.Predicate target) + { -+ return target.apply(world.getBlockState(pos)); ++ return target.apply(world.func_180495_p(pos)); + } + + /** @@ -681,7 +681,7 @@ + */ + public float getExplosionResistance(World world, BlockPos pos, Entity exploder, Explosion explosion) + { -+ return getExplosionResistance(exploder); ++ return func_149638_a(exploder); + } + + /** @@ -695,8 +695,8 @@ + */ + public void onBlockExploded(World world, BlockPos pos, Explosion explosion) + { -+ world.setBlockToAir(pos); -+ onBlockDestroyedByExplosion(world, pos, explosion); ++ world.func_175698_g(pos); ++ func_180652_a(world, pos, explosion); + } + + /** @@ -710,7 +710,7 @@ + */ + public boolean canConnectRedstone(IBlockAccess world, BlockPos pos, EnumFacing side) + { -+ return canProvidePower() && side != null; ++ return func_149744_f() && side != null; + } + + /** @@ -729,7 +729,7 @@ + } + else + { -+ return this instanceof BlockFence || this == net.minecraft.init.Blocks.glass || this == net.minecraft.init.Blocks.cobblestone_wall || this == net.minecraft.init.Blocks.stained_glass; ++ return this instanceof BlockFence || this == net.minecraft.init.Blocks.field_150359_w || this == net.minecraft.init.Blocks.field_150463_bK || this == net.minecraft.init.Blocks.field_150399_cn; + } + } + @@ -759,15 +759,15 @@ + @Deprecated + public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos) + { -+ Item item = getItem(world, pos); ++ Item item = func_180665_b(world, pos); + + if (item == null) + { + return null; + } + -+ Block block = item instanceof ItemBlock && !isFlowerPot() ? Block.getBlockFromItem(item) : this; -+ return new ItemStack(item, 1, block.getDamageValue(world, pos)); ++ Block block = item instanceof ItemBlock && !func_149648_K() ? Block.func_149634_a(item) : this; ++ return new ItemStack(item, 1, block.func_176222_j(world, pos)); + } + + /** @@ -834,39 +834,39 @@ + */ + public boolean canSustainPlant(IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable) + { -+ IBlockState state = world.getBlockState(pos); -+ IBlockState plant = plantable.getPlant(world, pos.offset(direction)); -+ net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction)); ++ IBlockState state = world.func_180495_p(pos); ++ IBlockState plant = plantable.getPlant(world, pos.func_177972_a(direction)); ++ net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.func_177972_a(direction)); + -+ if (plant.getBlock() == net.minecraft.init.Blocks.cactus && this == net.minecraft.init.Blocks.cactus) ++ if (plant.func_177230_c() == net.minecraft.init.Blocks.field_150434_aF && this == net.minecraft.init.Blocks.field_150434_aF) + { + return true; + } + -+ if (plant.getBlock() == net.minecraft.init.Blocks.reeds && this == net.minecraft.init.Blocks.reeds) ++ if (plant.func_177230_c() == net.minecraft.init.Blocks.field_150436_aH && this == net.minecraft.init.Blocks.field_150436_aH) + { + return true; + } + -+ if (plantable instanceof BlockBush && ((BlockBush)plantable).canPlaceBlockOn(this)) ++ if (plantable instanceof BlockBush && ((BlockBush)plantable).func_149854_a(this)) + { + return true; + } + + switch (plantType) + { -+ case Desert: return this == net.minecraft.init.Blocks.sand || this == net.minecraft.init.Blocks.hardened_clay || this == net.minecraft.init.Blocks.stained_hardened_clay || this == net.minecraft.init.Blocks.dirt; -+ case Nether: return this == net.minecraft.init.Blocks.soul_sand; -+ case Crop: return this == net.minecraft.init.Blocks.farmland; ++ case Desert: return this == net.minecraft.init.Blocks.field_150354_m || this == net.minecraft.init.Blocks.field_150405_ch || this == net.minecraft.init.Blocks.field_150406_ce || this == net.minecraft.init.Blocks.field_150346_d; ++ case Nether: return this == net.minecraft.init.Blocks.field_150425_aM; ++ case Crop: return this == net.minecraft.init.Blocks.field_150458_ak; + case Cave: return isSideSolid(world, pos, EnumFacing.UP); -+ case Plains: return this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.dirt || this == net.minecraft.init.Blocks.farmland; -+ case Water: return getMaterial() == Material.water && ((Integer)state.getValue(BlockLiquid.LEVEL)) == 0; ++ case Plains: return this == net.minecraft.init.Blocks.field_150349_c || this == net.minecraft.init.Blocks.field_150346_d || this == net.minecraft.init.Blocks.field_150458_ak; ++ case Water: return func_149688_o() == Material.field_151586_h && ((Integer)state.func_177229_b(BlockLiquid.field_176367_b)) == 0; + case Beach: -+ boolean isBeach = this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.dirt || this == net.minecraft.init.Blocks.sand; -+ boolean hasWater = (world.getBlockState(pos.east()).getBlock().getMaterial() == Material.water || -+ world.getBlockState(pos.west()).getBlock().getMaterial() == Material.water || -+ world.getBlockState(pos.north()).getBlock().getMaterial() == Material.water || -+ world.getBlockState(pos.south()).getBlock().getMaterial() == Material.water); ++ boolean isBeach = this == net.minecraft.init.Blocks.field_150349_c || this == net.minecraft.init.Blocks.field_150346_d || this == net.minecraft.init.Blocks.field_150354_m; ++ boolean hasWater = (world.func_180495_p(pos.func_177974_f()).func_177230_c().func_149688_o() == Material.field_151586_h || ++ world.func_180495_p(pos.func_177976_e()).func_177230_c().func_149688_o() == Material.field_151586_h || ++ world.func_180495_p(pos.func_177978_c()).func_177230_c().func_149688_o() == Material.field_151586_h || ++ world.func_180495_p(pos.func_177968_d()).func_177230_c().func_149688_o() == Material.field_151586_h); + return isBeach && hasWater; + } + @@ -888,9 +888,9 @@ + */ + public void onPlantGrow(World world, BlockPos pos, BlockPos source) + { -+ if (this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.farmland) ++ if (this == net.minecraft.init.Blocks.field_150349_c || this == net.minecraft.init.Blocks.field_150458_ak) + { -+ world.setBlockState(pos, net.minecraft.init.Blocks.dirt.getDefaultState(), 2); ++ world.func_180501_a(pos, net.minecraft.init.Blocks.field_150346_d.func_176223_P(), 2); + } + } + @@ -905,9 +905,9 @@ + */ + public boolean isFertile(World world, BlockPos pos) + { -+ if (this == net.minecraft.init.Blocks.farmland) ++ if (this == net.minecraft.init.Blocks.field_150458_ak) + { -+ return ((Integer)world.getBlockState(pos).getValue(BlockFarmland.MOISTURE)) > 0; ++ return ((Integer)world.func_180495_p(pos).func_177229_b(BlockFarmland.field_176531_a)) > 0; + } + + return false; @@ -927,7 +927,7 @@ + */ + public int getLightOpacity(IBlockAccess world, BlockPos pos) + { -+ return getLightOpacity(); ++ return func_149717_k(); + } + + /** @@ -941,7 +941,7 @@ + { + if (entity instanceof net.minecraft.entity.boss.EntityDragon) + { -+ return this != net.minecraft.init.Blocks.barrier && this != net.minecraft.init.Blocks.obsidian && this != net.minecraft.init.Blocks.end_stone && this != net.minecraft.init.Blocks.bedrock && this != net.minecraft.init.Blocks.command_block; ++ return this != net.minecraft.init.Blocks.field_180401_cv && this != net.minecraft.init.Blocks.field_150343_Z && this != net.minecraft.init.Blocks.field_150377_bs && this != net.minecraft.init.Blocks.field_150357_h && this != net.minecraft.init.Blocks.field_150483_bI; + } + + return true; @@ -957,7 +957,7 @@ + */ + public boolean isBeaconBase(IBlockAccess worldObj, BlockPos pos, BlockPos beacon) + { -+ return this == net.minecraft.init.Blocks.emerald_block || this == net.minecraft.init.Blocks.gold_block || this == net.minecraft.init.Blocks.diamond_block || this == net.minecraft.init.Blocks.iron_block; ++ return this == net.minecraft.init.Blocks.field_150475_bE || this == net.minecraft.init.Blocks.field_150340_R || this == net.minecraft.init.Blocks.field_150484_ah || this == net.minecraft.init.Blocks.field_150339_S; + } + + /** @@ -973,12 +973,12 @@ + */ + public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) + { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ IBlockState state = world.func_180495_p(pos); ++ for (IProperty prop : (java.util.Set)state.func_177228_b().keySet()) + { -+ if (prop.getName().equals("facing") || prop.getName().equals("rotation")) ++ if (prop.func_177701_a().equals("facing") || prop.func_177701_a().equals("rotation")) + { -+ world.setBlockState(pos, state.cycleProperty(prop)); ++ world.func_175656_a(pos, state.func_177231_a(prop)); + return true; + } + } @@ -994,12 +994,12 @@ + */ + public EnumFacing[] getValidRotations(World world, BlockPos pos) + { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ IBlockState state = world.func_180495_p(pos); ++ for (IProperty prop : (java.util.Set)state.func_177228_b().keySet()) + { -+ if (prop.getName().equals("facing") && prop.getValueClass() == EnumFacing.class) ++ if (prop.func_177701_a().equals("facing") && prop.func_177699_b() == EnumFacing.class) + { -+ java.util.Collection values = ((java.util.Collection)prop.getAllowedValues()); ++ java.util.Collection values = ((java.util.Collection)prop.func_177700_c()); + return values.toArray(new EnumFacing[values.size()]); + } + } @@ -1014,7 +1014,7 @@ + */ + public float getEnchantPowerBonus(World world, BlockPos pos) + { -+ return this == net.minecraft.init.Blocks.bookshelf ? 1 : 0; ++ return this == net.minecraft.init.Blocks.field_150342_X ? 1 : 0; + } + + /** @@ -1027,15 +1027,15 @@ + */ + public boolean recolorBlock(World world, BlockPos pos, EnumFacing side, net.minecraft.item.EnumDyeColor color) + { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ IBlockState state = world.func_180495_p(pos); ++ for (IProperty prop : (java.util.Set)state.func_177228_b().keySet()) + { -+ if (prop.getName().equals("color") && prop.getValueClass() == net.minecraft.item.EnumDyeColor.class) ++ if (prop.func_177701_a().equals("color") && prop.func_177699_b() == net.minecraft.item.EnumDyeColor.class) + { -+ net.minecraft.item.EnumDyeColor current = (net.minecraft.item.EnumDyeColor)state.getValue(prop); ++ net.minecraft.item.EnumDyeColor current = (net.minecraft.item.EnumDyeColor)state.func_177229_b(prop); + if (current != color) + { -+ world.setBlockState(pos, state.withProperty(prop, color)); ++ world.func_175656_a(pos, state.func_177226_a(prop, color)); + return true; + } + } @@ -1073,7 +1073,7 @@ + */ + public boolean shouldCheckWeakPower(IBlockAccess world, BlockPos pos, EnumFacing side) + { -+ return isNormalCube(); ++ return func_149721_r(); + } + + /** @@ -1106,7 +1106,7 @@ + */ + public void setHarvestLevel(String toolClass, int level) + { -+ java.util.Iterator itr = getBlockState().getValidStates().iterator(); ++ java.util.Iterator itr = func_176194_O().func_177619_a().iterator(); + while (itr.hasNext()) + { + setHarvestLevel(toolClass, level, itr.next()); @@ -1127,7 +1127,7 @@ + */ + public void setHarvestLevel(String toolClass, int level, IBlockState state) + { -+ int idx = this.getMetaFromState(state); ++ int idx = this.func_176201_c(state); + this.harvestTool[idx] = toolClass; + this.harvestLevel[idx] = level; + } @@ -1138,7 +1138,7 @@ + */ + public String getHarvestTool(IBlockState state) + { -+ return harvestTool[getMetaFromState(state)]; ++ return harvestTool[func_176201_c(state)]; + } + + /** @@ -1150,7 +1150,7 @@ + */ + public int getHarvestLevel(IBlockState state) + { -+ return harvestLevel[getMetaFromState(state)]; ++ return harvestLevel[func_176201_c(state)]; + } + + /** @@ -1159,7 +1159,7 @@ + */ + public boolean isToolEffective(String type, IBlockState state) + { -+ if ("pickaxe".equals(type) && (this == net.minecraft.init.Blocks.redstone_ore || this == net.minecraft.init.Blocks.lit_redstone_ore || this == net.minecraft.init.Blocks.obsidian)) ++ if ("pickaxe".equals(type) && (this == net.minecraft.init.Blocks.field_150450_ax || this == net.minecraft.init.Blocks.field_150439_ay || this == net.minecraft.init.Blocks.field_150343_Z)) + return false; + return type != null && type.equals(getHarvestTool(state)); + } @@ -1169,7 +1169,7 @@ + */ + public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) + { -+ return getActualState(state, world, pos); ++ return func_176221_a(state, world, pos); + } + + /** @@ -1178,7 +1178,7 @@ + */ + public boolean canRenderInLayer(EnumWorldBlockLayer layer) + { -+ return getBlockLayer() == layer; ++ return func_180664_k() == layer; + } + + // For Internal use only to capture droped items inside getDrops @@ -1206,6 +1206,6 @@ + } + /* ========================================= FORGE END ======================================*/ + - public static void registerBlocks() + public static void func_149671_p() { - registerBlock(0, AIR_ID, (new BlockAir()).setUnlocalizedName("air")); + func_176215_a(0, field_176230_a, (new BlockAir()).func_149663_c("air")); diff --git a/patches/minecraft/net/minecraft/block/BlockBush.java.patch b/patches/minecraft/net/minecraft/block/BlockBush.java.patch index 26af27af2..c8c22a6eb 100644 --- a/patches/minecraft/net/minecraft/block/BlockBush.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockBush.java.patch @@ -11,25 +11,25 @@ { @@ -36,7 +36,7 @@ - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { -- return super.canPlaceBlockAt(worldIn, pos) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); -+ return super.canPlaceBlockAt(worldIn, pos) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); +- return super.func_176196_c(p_176196_1_, p_176196_2_) && this.func_149854_a(p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_177230_c()); ++ return super.func_176196_c(p_176196_1_, p_176196_2_) && p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_177230_c().canSustainPlant(p_176196_1_, p_176196_2_.func_177977_b(), net.minecraft.util.EnumFacing.UP, this); } - protected boolean canPlaceBlockOn(Block ground) + protected boolean func_149854_a(Block p_149854_1_) @@ -66,7 +66,10 @@ - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_) { -- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); -+ BlockPos down = pos.down(); -+ Block soil = worldIn.getBlockState(down).getBlock(); -+ if (state.getBlock() != this) return this.canPlaceBlockOn(soil); //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 soil.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, this); +- return this.func_149854_a(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c()); ++ BlockPos down = p_180671_2_.func_177977_b(); ++ Block soil = p_180671_1_.func_180495_p(down).func_177230_c(); ++ if (p_180671_3_.func_177230_c() != this) return this.func_149854_a(soil); //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 soil.canSustainPlant(p_180671_1_, down, net.minecraft.util.EnumFacing.UP, this); } - public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + public AxisAlignedBB func_180640_a(World p_180640_1_, BlockPos p_180640_2_, IBlockState p_180640_3_) @@ -89,4 +92,33 @@ { return EnumWorldBlockLayer.CUTOUT; @@ -38,29 +38,29 @@ + @Override + public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) + { -+ if (this == Blocks.wheat) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.carrots) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.potatoes) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.melon_stem) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.pumpkin_stem) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.deadbush) return net.minecraftforge.common.EnumPlantType.Desert; -+ if (this == Blocks.waterlily) return net.minecraftforge.common.EnumPlantType.Water; -+ if (this == Blocks.red_mushroom) return net.minecraftforge.common.EnumPlantType.Cave; -+ if (this == Blocks.brown_mushroom) return net.minecraftforge.common.EnumPlantType.Cave; -+ if (this == Blocks.nether_wart) return net.minecraftforge.common.EnumPlantType.Nether; -+ if (this == Blocks.sapling) return net.minecraftforge.common.EnumPlantType.Plains; -+ if (this == Blocks.tallgrass) return net.minecraftforge.common.EnumPlantType.Plains; -+ if (this == Blocks.double_plant) return net.minecraftforge.common.EnumPlantType.Plains; -+ if (this == Blocks.red_flower) return net.minecraftforge.common.EnumPlantType.Plains; -+ if (this == Blocks.yellow_flower) return net.minecraftforge.common.EnumPlantType.Plains; ++ if (this == Blocks.field_150464_aj) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.field_150459_bM) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.field_150469_bN) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.field_150394_bc) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.field_150393_bb) return net.minecraftforge.common.EnumPlantType.Crop; ++ if (this == Blocks.field_150330_I) return net.minecraftforge.common.EnumPlantType.Desert; ++ if (this == Blocks.field_150392_bi) return net.minecraftforge.common.EnumPlantType.Water; ++ if (this == Blocks.field_150337_Q) return net.minecraftforge.common.EnumPlantType.Cave; ++ if (this == Blocks.field_150338_P) return net.minecraftforge.common.EnumPlantType.Cave; ++ if (this == Blocks.field_150388_bm) return net.minecraftforge.common.EnumPlantType.Nether; ++ if (this == Blocks.field_150345_g) return net.minecraftforge.common.EnumPlantType.Plains; ++ if (this == Blocks.field_150329_H) return net.minecraftforge.common.EnumPlantType.Plains; ++ if (this == Blocks.field_150398_cm) return net.minecraftforge.common.EnumPlantType.Plains; ++ if (this == Blocks.field_150328_O) return net.minecraftforge.common.EnumPlantType.Plains; ++ if (this == Blocks.field_150327_N) return net.minecraftforge.common.EnumPlantType.Plains; + return net.minecraftforge.common.EnumPlantType.Plains; + } + + @Override + public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) + { -+ IBlockState state = world.getBlockState(pos); -+ if (state.getBlock() != this) return getDefaultState(); ++ IBlockState state = world.func_180495_p(pos); ++ if (state.func_177230_c() != this) return func_176223_P(); + return state; + } } diff --git a/patches/minecraft/net/minecraft/block/BlockButton.java.patch b/patches/minecraft/net/minecraft/block/BlockButton.java.patch index c5bfc5fa7..c4ca0f384 100644 --- a/patches/minecraft/net/minecraft/block/BlockButton.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockButton.java.patch @@ -4,9 +4,9 @@ protected static boolean func_181088_a(World p_181088_0_, BlockPos p_181088_1_, EnumFacing p_181088_2_) { -- BlockPos blockpos = p_181088_1_.offset(p_181088_2_); -- return p_181088_2_ == EnumFacing.DOWN ? World.doesBlockHaveSolidTopSurface(p_181088_0_, blockpos) : p_181088_0_.getBlockState(blockpos).getBlock().isNormalCube(); -+ return p_181088_2_ == EnumFacing.UP && World.doesBlockHaveSolidTopSurface(p_181088_0_, p_181088_1_.down()) ? true : p_181088_0_.isSideSolid(p_181088_1_.offset(p_181088_2_.getOpposite()), p_181088_2_); +- BlockPos blockpos = p_181088_1_.func_177972_a(p_181088_2_); +- return p_181088_2_ == EnumFacing.DOWN ? World.func_175683_a(p_181088_0_, blockpos) : p_181088_0_.func_180495_p(blockpos).func_177230_c().func_149721_r(); ++ return p_181088_2_ == EnumFacing.UP && World.func_175683_a(p_181088_0_, p_181088_1_.func_177977_b()) ? true : p_181088_0_.isSideSolid(p_181088_1_.func_177972_a(p_181088_2_.func_176734_d()), p_181088_2_); } - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) diff --git a/patches/minecraft/net/minecraft/block/BlockCactus.java.patch b/patches/minecraft/net/minecraft/block/BlockCactus.java.patch index 04f56d217..17dfb0356 100644 --- a/patches/minecraft/net/minecraft/block/BlockCactus.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCactus.java.patch @@ -7,20 +7,20 @@ -public class BlockCactus extends Block +public class BlockCactus extends Block implements net.minecraftforge.common.IPlantable { - public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15); + public static final PropertyInteger field_176587_a = PropertyInteger.func_177719_a("age", 0, 15); @@ -109,7 +109,7 @@ } - Block block = worldIn.getBlockState(pos.down()).getBlock(); -- return block == Blocks.cactus || block == Blocks.sand; -+ return block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this); + Block block = p_176586_1_.func_180495_p(p_176586_2_.func_177977_b()).func_177230_c(); +- return block == Blocks.field_150434_aF || block == Blocks.field_150354_m; ++ return block.canSustainPlant(p_176586_1_, p_176586_2_.func_177977_b(), EnumFacing.UP, this); } - public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) + public void func_180634_a(World p_180634_1_, BlockPos p_180634_2_, IBlockState p_180634_3_, Entity p_180634_4_) @@ -137,4 +137,16 @@ { - return new BlockState(this, new IProperty[] {AGE}); + return new BlockState(this, new IProperty[] {field_176587_a}); } + + @Override @@ -32,6 +32,6 @@ + @Override + public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) + { -+ return getDefaultState(); ++ return func_176223_P(); + } } diff --git a/patches/minecraft/net/minecraft/block/BlockChest.java.patch b/patches/minecraft/net/minecraft/block/BlockChest.java.patch index af3911451..90f209e19 100644 --- a/patches/minecraft/net/minecraft/block/BlockChest.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockChest.java.patch @@ -2,10 +2,10 @@ +++ ../src-work/minecraft/net/minecraft/block/BlockChest.java @@ -527,7 +527,7 @@ - private boolean isBelowSolidBlock(World worldIn, BlockPos pos) + private boolean func_176456_n(World p_176456_1_, BlockPos p_176456_2_) { -- return worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); -+ return worldIn.isSideSolid(pos.up(), EnumFacing.DOWN, false); +- return p_176456_1_.func_180495_p(p_176456_2_.func_177984_a()).func_177230_c().func_149721_r(); ++ return p_176456_1_.isSideSolid(p_176456_2_.func_177984_a(), EnumFacing.DOWN, false); } - private boolean isOcelotSittingOnChest(World worldIn, BlockPos pos) + private boolean func_176453_o(World p_176453_1_, BlockPos p_176453_2_) diff --git a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch index e5f3922b4..5ecbf9a68 100644 --- a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch @@ -1,25 +1,27 @@ --- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java +++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java -@@ -137,6 +137,13 @@ +@@ -137,7 +137,14 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { -+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); +- int i = ((Integer)p_180653_3_.func_177229_b(field_176501_a)).intValue(); ++ super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); + } + + @Override + public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { + java.util.List dropped = super.getDrops(world, pos, state, fortune); - int i = ((Integer)state.getValue(AGE)).intValue(); ++ int i = ((Integer)state.func_177229_b(field_176501_a)).intValue(); int j = 1; + if (i >= 2) @@ -147,8 +154,9 @@ for (int k = 0; k < j; ++k) { -- spawnAsEntity(worldIn, pos, new ItemStack(Items.dye, 1, EnumDyeColor.BROWN.getDyeDamage())); -+ dropped.add(new ItemStack(Items.dye, 1, EnumDyeColor.BROWN.getDyeDamage())); +- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(Items.field_151100_aR, 1, EnumDyeColor.BROWN.func_176767_b())); ++ dropped.add(new ItemStack(Items.field_151100_aR, 1, EnumDyeColor.BROWN.func_176767_b())); } + return dropped; } diff --git a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch index 3d2a7232a..ed9298153 100644 --- a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch @@ -2,63 +2,63 @@ +++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java @@ -81,11 +81,11 @@ float f1 = 0.0F; - IBlockState iblockstate = worldIn.getBlockState(blockpos.add(i, 0, j)); + IBlockState iblockstate = p_180672_1_.func_180495_p(blockpos.func_177982_a(i, 0, j)); -- if (iblockstate.getBlock() == Blocks.farmland) -+ if (iblockstate.getBlock().canSustainPlant(worldIn, blockpos.add(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)blockIn)) +- if (iblockstate.func_177230_c() == Blocks.field_150458_ak) ++ if (iblockstate.func_177230_c().canSustainPlant(p_180672_1_, blockpos.func_177982_a(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)p_180672_0_)) { f1 = 1.0F; -- if (((Integer)iblockstate.getValue(BlockFarmland.MOISTURE)).intValue() > 0) -+ if (iblockstate.getBlock().isFertile(worldIn, blockpos.add(i, 0, j))) +- if (((Integer)iblockstate.func_177229_b(BlockFarmland.field_176531_a)).intValue() > 0) ++ if (iblockstate.func_177230_c().isFertile(p_180672_1_, blockpos.func_177982_a(i, 0, j))) { f1 = 3.0F; } @@ -126,7 +126,7 @@ - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_) { -- return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); -+ return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); +- return (p_180671_1_.func_175699_k(p_180671_2_) >= 8 || p_180671_1_.func_175678_i(p_180671_2_)) && this.func_149854_a(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c()); ++ return (p_180671_1_.func_175699_k(p_180671_2_) >= 8 || p_180671_1_.func_175678_i(p_180671_2_)) && p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c().canSustainPlant(p_180671_1_, p_180671_2_.func_177977_b(), net.minecraft.util.EnumFacing.UP, this); } - protected Item getSeed() + protected Item func_149866_i() @@ -142,24 +142,6 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); + super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, 0); - -- if (!worldIn.isRemote) +- if (!p_180653_1_.field_72995_K) - { -- int i = ((Integer)state.getValue(AGE)).intValue(); +- int i = ((Integer)p_180653_3_.func_177229_b(field_176488_a)).intValue(); - - if (i >= 7) - { -- int j = 3 + fortune; +- int j = 3 + p_180653_5_; - - for (int k = 0; k < j; ++k) - { -- if (worldIn.rand.nextInt(15) <= i) +- if (p_180653_1_.field_73012_v.nextInt(15) <= i) - { -- spawnAsEntity(worldIn, pos, new ItemStack(this.getSeed(), 1, 0)); +- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(this.func_149866_i(), 1, 0)); - } - } - } - } } - public Item getItemDropped(IBlockState state, Random rand, int fortune) + public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) @@ -202,4 +184,26 @@ { - return new BlockState(this, new IProperty[] {AGE}); + return new BlockState(this, new IProperty[] {field_176488_a}); } + + @Override + public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { + java.util.List ret = super.getDrops(world, pos, state, fortune); -+ int age = ((Integer)state.getValue(AGE)).intValue(); -+ Random rand = world instanceof World ? ((World)world).rand : new Random(); ++ int age = ((Integer)state.func_177229_b(field_176488_a)).intValue(); ++ Random rand = world instanceof World ? ((World)world).field_73012_v : new Random(); + + if (age >= 7) + { @@ -68,7 +68,7 @@ + { + if (rand.nextInt(15) <= age) + { -+ ret.add(new ItemStack(this.getSeed(), 1, 0)); ++ ret.add(new ItemStack(this.func_149866_i(), 1, 0)); + } + } + } diff --git a/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch b/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch index c0c9491c9..a350513b4 100644 --- a/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch @@ -11,16 +11,16 @@ { @@ -45,14 +45,15 @@ - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) { -- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) +- if (!p_180657_1_.field_72995_K && p_180657_2_.func_71045_bC() != null && p_180657_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ) { -- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0)); +- p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); +- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Blocks.field_150330_I, 1, 0)); - } - else - { - super.harvestBlock(worldIn, player, pos, state, te); + super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); } } + @@ -28,6 +28,6 @@ + @Override + public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { -+ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(Blocks.deadbush))); ++ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(Blocks.field_150330_I))); + } } diff --git a/patches/minecraft/net/minecraft/block/BlockDoor.java.patch b/patches/minecraft/net/minecraft/block/BlockDoor.java.patch index ec621d11f..de31efb01 100644 --- a/patches/minecraft/net/minecraft/block/BlockDoor.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockDoor.java.patch @@ -2,7 +2,7 @@ +++ ../src-work/minecraft/net/minecraft/block/BlockDoor.java @@ -154,7 +154,7 @@ { - if (this.blockMaterial == Material.iron) + if (this.field_149764_J == Material.field_151573_f) { - return true; + return false; //Allow items to interact with the door @@ -11,10 +11,10 @@ { @@ -272,7 +272,7 @@ - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { -- return pos.getY() >= 255 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); -+ return pos.getY() >= worldIn.getHeight() - 1 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); +- return p_176196_2_.func_177956_o() >= 255 ? false : World.func_175683_a(p_176196_1_, p_176196_2_.func_177977_b()) && super.func_176196_c(p_176196_1_, p_176196_2_) && super.func_176196_c(p_176196_1_, p_176196_2_.func_177984_a()); ++ return p_176196_2_.func_177956_o() >= p_176196_1_.func_72800_K() - 1 ? false : World.func_175683_a(p_176196_1_, p_176196_2_.func_177977_b()) && super.func_176196_c(p_176196_1_, p_176196_2_) && super.func_176196_c(p_176196_1_, p_176196_2_.func_177984_a()); } - public int getMobilityFlag() + public int func_149656_h() diff --git a/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch b/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch index 8cbc62e73..2218435af 100644 --- a/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch @@ -7,50 +7,50 @@ -public class BlockDoublePlant extends BlockBush implements IGrowable +public class BlockDoublePlant extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable { - public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockDoublePlant.EnumPlantType.class); - public static final PropertyEnum HALF = PropertyEnum.create("half", BlockDoublePlant.EnumBlockHalf.class); + public static final PropertyEnum field_176493_a = PropertyEnum.func_177709_a("variant", BlockDoublePlant.EnumPlantType.class); + public static final PropertyEnum field_176492_b = PropertyEnum.func_177709_a("half", BlockDoublePlant.EnumBlockHalf.class); @@ -90,6 +90,8 @@ - Block block = (Block)(flag ? this : worldIn.getBlockState(blockpos).getBlock()); - Block block1 = (Block)(flag ? worldIn.getBlockState(blockpos1).getBlock() : this); + Block block = (Block)(flag ? this : p_176475_1_.func_180495_p(blockpos).func_177230_c()); + Block block1 = (Block)(flag ? p_176475_1_.func_180495_p(blockpos1).func_177230_c() : this); -+ if (!flag) this.dropBlockAsItem(worldIn, pos, state, 0); //Forge move above the setting to air. ++ if (!flag) this.func_176226_b(p_176475_1_, p_176475_2_, p_176475_3_, 0); //Forge move above the setting to air. + if (block == this) { - worldIn.setBlockState(blockpos, Blocks.air.getDefaultState(), 2); + p_176475_1_.func_180501_a(blockpos, Blocks.field_150350_a.func_176223_P(), 2); @@ -98,17 +100,13 @@ if (block1 == this) { - worldIn.setBlockState(blockpos1, Blocks.air.getDefaultState(), 3); + p_176475_1_.func_180501_a(blockpos1, Blocks.field_150350_a.func_176223_P(), 3); - - if (!flag) - { -- this.dropBlockAsItem(worldIn, blockpos1, state, 0); +- this.func_176226_b(p_176475_1_, blockpos1, p_176475_3_, 0); - } } } } - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_) { -+ if (state.getBlock() != this) return super.canBlockStay(worldIn, pos, state); //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. - if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) ++ if (p_180671_3_.func_177230_c() != this) return super.func_180671_f(p_180671_1_, p_180671_2_, p_180671_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. + if (p_180671_3_.func_177229_b(field_176492_b) == BlockDoublePlant.EnumBlockHalf.UPPER) { - return worldIn.getBlockState(pos.down()).getBlock() == this; + return p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c() == this; @@ -158,7 +156,6 @@ - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) { -- if (worldIn.isRemote || player.getCurrentEquippedItem() == null || player.getCurrentEquippedItem().getItem() != Items.shears || state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.onHarvest(worldIn, pos, state, player)) +- if (p_180657_1_.field_72995_K || p_180657_2_.func_71045_bC() == null || p_180657_2_.func_71045_bC().func_77973_b() != Items.field_151097_aZ || p_180657_4_.func_177229_b(field_176492_b) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.func_176489_b(p_180657_1_, p_180657_3_, p_180657_4_, p_180657_2_)) { - super.harvestBlock(worldIn, player, pos, state, te); + super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); } @@ -221,8 +218,6 @@ else { - player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- int i = (blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).getMeta(); -- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 2, i)); + p_176489_4_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); +- int i = (blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).func_177044_a(); +- func_180635_a(p_176489_1_, p_176489_2_, new ItemStack(Blocks.field_150329_H, 2, i)); return true; } } @@ -61,27 +61,27 @@ + @Override + public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos) + { -+ IBlockState state = world.getBlockState(pos); -+ EnumPlantType type = (EnumPlantType)state.getValue(VARIANT); -+ return state.getValue(HALF) == EnumBlockHalf.LOWER && (type == EnumPlantType.FERN || type == EnumPlantType.GRASS); ++ IBlockState state = world.func_180495_p(pos); ++ EnumPlantType type = (EnumPlantType)state.func_177229_b(field_176493_a); ++ return state.func_177229_b(field_176492_b) == EnumBlockHalf.LOWER && (type == EnumPlantType.FERN || type == EnumPlantType.GRASS); + } + @Override + public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { + java.util.List ret = new java.util.ArrayList(); -+ EnumPlantType type = (EnumPlantType)world.getBlockState(pos).getValue(VARIANT); -+ if (type == EnumPlantType.FERN) ret.add(new ItemStack(Blocks.tallgrass, 2, BlockTallGrass.EnumType.FERN.getMeta())); -+ if (type == EnumPlantType.GRASS) ret.add(new ItemStack(Blocks.tallgrass, 2, BlockTallGrass.EnumType.GRASS.getMeta())); ++ EnumPlantType type = (EnumPlantType)world.func_180495_p(pos).func_177229_b(field_176493_a); ++ if (type == EnumPlantType.FERN) ret.add(new ItemStack(Blocks.field_150329_H, 2, BlockTallGrass.EnumType.FERN.func_177044_a())); ++ if (type == EnumPlantType.GRASS) ret.add(new ItemStack(Blocks.field_150329_H, 2, BlockTallGrass.EnumType.GRASS.func_177044_a())); + return ret; + } + @Override + public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) + { + //Forge: Break both parts on the client to prevent the top part flickering as default type for a few frames. -+ IBlockState state = world.getBlockState(pos); -+ if (state.getBlock() == this && state.getValue(HALF) == EnumBlockHalf.LOWER && world.getBlockState(pos.up()).getBlock() == this) -+ world.setBlockToAir(pos.up()); -+ return world.setBlockToAir(pos); ++ IBlockState state = world.func_180495_p(pos); ++ if (state.func_177230_c() == this && state.func_177229_b(field_176492_b) == EnumBlockHalf.LOWER && world.func_180495_p(pos.func_177984_a()).func_177230_c() == this) ++ world.func_175698_g(pos.func_177984_a()); ++ return world.func_175698_g(pos); + } + public static enum EnumBlockHalf implements IStringSerializable diff --git a/patches/minecraft/net/minecraft/block/BlockFalling.java.patch b/patches/minecraft/net/minecraft/block/BlockFalling.java.patch index 4ac1d2847..811cb1a2c 100644 --- a/patches/minecraft/net/minecraft/block/BlockFalling.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFalling.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/block/BlockFalling.java @@ -86,6 +86,7 @@ - public static boolean canFallInto(World worldIn, BlockPos pos) + public static boolean func_180685_d(World p_180685_0_, BlockPos p_180685_1_) { -+ if (worldIn.isAirBlock(pos)) return true; - Block block = worldIn.getBlockState(pos).getBlock(); - Material material = block.blockMaterial; - return block == Blocks.fire || material == Material.air || material == Material.water || material == Material.lava; ++ if (p_180685_0_.func_175623_d(p_180685_1_)) return true; + Block block = p_180685_0_.func_180495_p(p_180685_1_).func_177230_c(); + Material material = block.field_149764_J; + return block == Blocks.field_150480_ab || material == Material.field_151579_a || material == Material.field_151586_h || material == Material.field_151587_i; diff --git a/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch b/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch index b94b5429e..7547658d3 100644 --- a/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFarmland.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/block/BlockFarmland.java +++ ../src-work/minecraft/net/minecraft/block/BlockFarmland.java @@ -89,7 +89,7 @@ - private boolean hasCrops(World worldIn, BlockPos pos) + private boolean func_176529_d(World p_176529_1_, BlockPos p_176529_2_) { - Block block = worldIn.getBlockState(pos.up()).getBlock(); + Block block = p_176529_1_.func_180495_p(p_176529_2_.func_177984_a()).func_177230_c(); - return block instanceof BlockCrops || block instanceof BlockStem; -+ return block instanceof net.minecraftforge.common.IPlantable && canSustainPlant(worldIn, pos, net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)block); ++ return block instanceof net.minecraftforge.common.IPlantable && canSustainPlant(p_176529_1_, p_176529_2_, net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)block); } - private boolean hasWater(World worldIn, BlockPos pos) + private boolean func_176530_e(World p_176530_1_, BlockPos p_176530_2_) diff --git a/patches/minecraft/net/minecraft/block/BlockFire.java.patch b/patches/minecraft/net/minecraft/block/BlockFire.java.patch index 287e8d5dd..05ab962bc 100644 --- a/patches/minecraft/net/minecraft/block/BlockFire.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFire.java.patch @@ -1,81 +1,81 @@ --- ../src-base/minecraft/net/minecraft/block/BlockFire.java +++ ../src-work/minecraft/net/minecraft/block/BlockFire.java @@ -41,18 +41,24 @@ - int j = pos.getY(); - int k = pos.getZ(); + int j = p_176221_3_.func_177956_o(); + int k = p_176221_3_.func_177952_p(); -- if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down())) -+ if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP)) +- if (!World.func_175683_a(p_176221_2_, p_176221_3_.func_177977_b()) && !Blocks.field_150480_ab.func_176535_e(p_176221_2_, p_176221_3_.func_177977_b())) ++ if (!World.func_175683_a(p_176221_2_, p_176221_3_.func_177977_b()) && !Blocks.field_150480_ab.canCatchFire(p_176221_2_, p_176221_3_.func_177977_b(), EnumFacing.UP)) { boolean flag = (i + j + k & 1) == 1; boolean flag1 = (i / 2 + j / 2 + k / 2 & 1) == 1; int l = 0; -- if (this.canCatchFire(worldIn, pos.up())) -+ if (this.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN)) +- if (this.func_176535_e(p_176221_2_, p_176221_3_.func_177984_a())) ++ if (this.canCatchFire(p_176221_2_, p_176221_3_.func_177984_a(), EnumFacing.DOWN)) { l = flag ? 1 : 2; } -- return state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west()))).withProperty(UPPER, Integer.valueOf(l)).withProperty(FLIP, Boolean.valueOf(flag1)).withProperty(ALT, Boolean.valueOf(flag)); -+ return state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH))) -+ .withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east(), EnumFacing.EAST ))) -+ .withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH))) -+ .withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west(), EnumFacing.EAST ))) -+ .withProperty(UPPER, Integer.valueOf(l)) -+ .withProperty(FLIP, Boolean.valueOf(flag1)) -+ .withProperty(ALT, Boolean.valueOf(flag)); +- return p_176221_1_.func_177226_a(field_176545_N, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177978_c()))).func_177226_a(field_176546_O, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177974_f()))).func_177226_a(field_176541_P, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177968_d()))).func_177226_a(field_176539_Q, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177976_e()))).func_177226_a(field_176542_R, Integer.valueOf(l)).func_177226_a(field_176540_b, Boolean.valueOf(flag1)).func_177226_a(field_176544_M, Boolean.valueOf(flag)); ++ return p_176221_1_.func_177226_a(field_176545_N, Boolean.valueOf(this.canCatchFire(p_176221_2_, p_176221_3_.func_177978_c(), EnumFacing.SOUTH))) ++ .func_177226_a(field_176546_O, Boolean.valueOf(this.canCatchFire(p_176221_2_, p_176221_3_.func_177974_f(), EnumFacing.EAST ))) ++ .func_177226_a(field_176541_P, Boolean.valueOf(this.canCatchFire(p_176221_2_, p_176221_3_.func_177968_d(), EnumFacing.NORTH))) ++ .func_177226_a(field_176539_Q, Boolean.valueOf(this.canCatchFire(p_176221_2_, p_176221_3_.func_177976_e(), EnumFacing.EAST ))) ++ .func_177226_a(field_176542_R, Integer.valueOf(l)) ++ .func_177226_a(field_176540_b, Boolean.valueOf(flag1)) ++ .func_177226_a(field_176544_M, Boolean.valueOf(flag)); } else { @@ -108,6 +114,7 @@ - public void setFireInfo(Block blockIn, int encouragement, int flammability) + public void func_180686_a(Block p_180686_1_, int p_180686_2_, int p_180686_3_) { -+ if (blockIn == Blocks.air) throw new IllegalArgumentException("Tried to set air on fire... This is bad."); - this.encouragements.put(blockIn, Integer.valueOf(encouragement)); - this.flammabilities.put(blockIn, Integer.valueOf(flammability)); ++ 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_, Integer.valueOf(p_180686_2_)); + this.field_149848_b.put(p_180686_1_, Integer.valueOf(p_180686_3_)); } @@ -147,13 +154,8 @@ } - Block block = worldIn.getBlockState(pos.down()).getBlock(); -- boolean flag = block == Blocks.netherrack; -+ boolean flag = block.isFireSource(worldIn, pos.down(), EnumFacing.UP); + Block block = p_180650_1_.func_180495_p(p_180650_2_.func_177977_b()).func_177230_c(); +- boolean flag = block == Blocks.field_150424_aL; ++ boolean flag = block.isFireSource(p_180650_1_, p_180650_2_.func_177977_b(), EnumFacing.UP); -- if (worldIn.provider instanceof WorldProviderEnd && block == Blocks.bedrock) +- if (p_180650_1_.field_73011_w instanceof WorldProviderEnd && block == Blocks.field_150357_h) - { - flag = true; - } - - if (!flag && worldIn.isRaining() && this.canDie(worldIn, pos)) + if (!flag && p_180650_1_.func_72896_J() && this.func_176537_d(p_180650_1_, p_180650_2_)) { - worldIn.setBlockToAir(pos); + p_180650_1_.func_175698_g(p_180650_2_); @@ -182,7 +184,7 @@ return; } -- if (!this.canCatchFire(worldIn, pos.down()) && i == 15 && rand.nextInt(4) == 0) -+ if (!this.canCatchFire(worldIn, pos.down(), EnumFacing.UP) && i == 15 && rand.nextInt(4) == 0) +- if (!this.func_176535_e(p_180650_1_, p_180650_2_.func_177977_b()) && i == 15 && p_180650_4_.nextInt(4) == 0) ++ if (!this.canCatchFire(p_180650_1_, p_180650_2_.func_177977_b(), EnumFacing.UP) && i == 15 && p_180650_4_.nextInt(4) == 0) { - worldIn.setBlockToAir(pos); + p_180650_1_.func_175698_g(p_180650_2_); return; @@ -197,12 +199,12 @@ j = -50; } -- this.catchOnFire(worldIn, pos.east(), 300 + j, rand, i); -- this.catchOnFire(worldIn, pos.west(), 300 + j, rand, i); -- this.catchOnFire(worldIn, pos.down(), 250 + j, rand, i); -- this.catchOnFire(worldIn, pos.up(), 250 + j, rand, i); -- this.catchOnFire(worldIn, pos.north(), 300 + j, rand, i); -- this.catchOnFire(worldIn, pos.south(), 300 + j, rand, i); -+ this.tryCatchFire(worldIn, pos.east(), 300 + j, rand, i, EnumFacing.WEST); -+ this.tryCatchFire(worldIn, pos.west(), 300 + j, rand, i, EnumFacing.EAST); -+ this.tryCatchFire(worldIn, pos.down(), 250 + j, rand, i, EnumFacing.UP); -+ this.tryCatchFire(worldIn, pos.up(), 250 + j, rand, i, EnumFacing.DOWN); -+ this.tryCatchFire(worldIn, pos.north(), 300 + j, rand, i, EnumFacing.SOUTH); -+ this.tryCatchFire(worldIn, pos.south(), 300 + j, rand, i, EnumFacing.NORTH); +- this.func_176536_a(p_180650_1_, p_180650_2_.func_177974_f(), 300 + j, p_180650_4_, i); +- this.func_176536_a(p_180650_1_, p_180650_2_.func_177976_e(), 300 + j, p_180650_4_, i); +- this.func_176536_a(p_180650_1_, p_180650_2_.func_177977_b(), 250 + j, p_180650_4_, i); +- this.func_176536_a(p_180650_1_, p_180650_2_.func_177984_a(), 250 + j, p_180650_4_, i); +- this.func_176536_a(p_180650_1_, p_180650_2_.func_177978_c(), 300 + j, p_180650_4_, i); +- this.func_176536_a(p_180650_1_, p_180650_2_.func_177968_d(), 300 + j, p_180650_4_, i); ++ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177974_f(), 300 + j, p_180650_4_, i, EnumFacing.WEST); ++ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177976_e(), 300 + j, p_180650_4_, i, EnumFacing.EAST); ++ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177977_b(), 250 + j, p_180650_4_, i, EnumFacing.UP); ++ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177984_a(), 250 + j, p_180650_4_, i, EnumFacing.DOWN); ++ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177978_c(), 300 + j, p_180650_4_, i, EnumFacing.SOUTH); ++ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177968_d(), 300 + j, p_180650_4_, i, EnumFacing.NORTH); for (int k = -1; k <= 1; ++k) { @@ -84,39 +84,39 @@ } + @Deprecated // Use Block.getFlammability - public int getFlammability(Block blockIn) + public int func_176532_c(Block p_176532_1_) { - Integer integer = (Integer)this.flammabilities.get(blockIn); + Integer integer = (Integer)this.field_149848_b.get(p_176532_1_); return integer == null ? 0 : integer.intValue(); } + @Deprecated // Use Block.getFlammability - public int getEncouragement(Block blockIn) + public int func_176534_d(Block p_176534_1_) { - Integer integer = (Integer)this.encouragements.get(blockIn); + Integer integer = (Integer)this.field_149849_a.get(p_176534_1_); return integer == null ? 0 : integer.intValue(); } + @Deprecated // Use tryCatchFire with face below - private void catchOnFire(World worldIn, BlockPos pos, int chance, Random random, int age) + 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.getFlammability(worldIn.getBlockState(pos).getBlock()); -+ this.tryCatchFire(worldIn, pos, chance, random, age, EnumFacing.UP); +- int i = this.func_176532_c(p_176536_1_.func_180495_p(p_176536_2_).func_177230_c()); ++ this.tryCatchFire(p_176536_1_, p_176536_2_, p_176536_3_, p_176536_4_, p_176536_5_, EnumFacing.UP); + } -+ private void tryCatchFire(World worldIn, BlockPos pos, int chance, Random random, int age, EnumFacing face) ++ private void tryCatchFire(World p_176536_1_, BlockPos p_176536_2_, int p_176536_3_, Random p_176536_4_, int p_176536_5_, EnumFacing face) + { -+ int i = worldIn.getBlockState(pos).getBlock().getFlammability(worldIn, pos, face); ++ int i = p_176536_1_.func_180495_p(p_176536_2_).func_177230_c().getFlammability(p_176536_1_, p_176536_2_, face); + - if (random.nextInt(chance) < i) + if (p_176536_4_.nextInt(p_176536_3_) < i) { - IBlockState iblockstate = worldIn.getBlockState(pos); + IBlockState iblockstate = p_176536_1_.func_180495_p(p_176536_2_); @@ -308,7 +318,7 @@ { for (EnumFacing enumfacing : EnumFacing.values()) { -- if (this.canCatchFire(worldIn, pos.offset(enumfacing))) -+ if (this.canCatchFire(worldIn, pos.offset(enumfacing), enumfacing.getOpposite())) +- if (this.func_176535_e(p_176533_1_, p_176533_2_.func_177972_a(enumfacing))) ++ if (this.canCatchFire(p_176533_1_, p_176533_2_.func_177972_a(enumfacing), enumfacing.func_176734_d())) { return true; } @@ -124,8 +124,8 @@ for (EnumFacing enumfacing : EnumFacing.values()) { -- i = Math.max(this.getEncouragement(worldIn.getBlockState(pos.offset(enumfacing)).getBlock()), i); -+ i = Math.max(worldIn.getBlockState(pos.offset(enumfacing)).getBlock().getFlammability(worldIn, pos.offset(enumfacing), enumfacing.getOpposite()), i); +- i = Math.max(this.func_176534_d(p_176538_1_.func_180495_p(p_176538_2_.func_177972_a(enumfacing)).func_177230_c()), i); ++ i = Math.max(p_176538_1_.func_180495_p(p_176538_2_.func_177972_a(enumfacing)).func_177230_c().getFlammability(p_176538_1_, p_176538_2_.func_177972_a(enumfacing), enumfacing.func_176734_d()), i); } return i; @@ -134,22 +134,22 @@ } + @Deprecated // Use canCatchFire with face sensitive version below - public boolean canCatchFire(IBlockAccess worldIn, BlockPos pos) + public boolean func_176535_e(IBlockAccess p_176535_1_, BlockPos p_176535_2_) { -- return this.getEncouragement(worldIn.getBlockState(pos).getBlock()) > 0; -+ return canCatchFire(worldIn, pos, EnumFacing.UP); +- return this.func_176534_d(p_176535_1_.func_180495_p(p_176535_2_).func_177230_c()) > 0; ++ return canCatchFire(p_176535_1_, p_176535_2_, EnumFacing.UP); } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) @@ -382,9 +393,9 @@ - worldIn.playSound((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), "fire.fire", 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F, false); + p_180655_1_.func_72980_b((double)((float)p_180655_2_.func_177958_n() + 0.5F), (double)((float)p_180655_2_.func_177956_o() + 0.5F), (double)((float)p_180655_2_.func_177952_p() + 0.5F), "fire.fire", 1.0F + p_180655_4_.nextFloat(), p_180655_4_.nextFloat() * 0.7F + 0.3F, false); } -- if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down())) -+ if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP)) +- if (!World.func_175683_a(p_180655_1_, p_180655_2_.func_177977_b()) && !Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177977_b())) ++ if (!World.func_175683_a(p_180655_1_, p_180655_2_.func_177977_b()) && !Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177977_b(), EnumFacing.UP)) { -- if (Blocks.fire.canCatchFire(worldIn, pos.west())) -+ if (Blocks.fire.canCatchFire(worldIn, pos.west(), EnumFacing.EAST)) +- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177976_e())) ++ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177976_e(), EnumFacing.EAST)) { for (int j = 0; j < 2; ++j) { @@ -157,8 +157,8 @@ } } -- if (Blocks.fire.canCatchFire(worldIn, pos.east())) -+ if (Blocks.fire.canCatchFire(worldIn, pos.east(), EnumFacing.WEST)) +- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177974_f())) ++ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177974_f(), EnumFacing.WEST)) { for (int k = 0; k < 2; ++k) { @@ -166,8 +166,8 @@ } } -- if (Blocks.fire.canCatchFire(worldIn, pos.north())) -+ if (Blocks.fire.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH)) +- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177978_c())) ++ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177978_c(), EnumFacing.SOUTH)) { for (int l = 0; l < 2; ++l) { @@ -175,8 +175,8 @@ } } -- if (Blocks.fire.canCatchFire(worldIn, pos.south())) -+ if (Blocks.fire.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH)) +- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177968_d())) ++ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177968_d(), EnumFacing.NORTH)) { for (int i1 = 0; i1 < 2; ++i1) { @@ -184,14 +184,14 @@ } } -- if (Blocks.fire.canCatchFire(worldIn, pos.up())) -+ if (Blocks.fire.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN)) +- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177984_a())) ++ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177984_a(), EnumFacing.DOWN)) { for (int j1 = 0; j1 < 2; ++j1) { @@ -476,4 +487,19 @@ { - return new BlockState(this, new IProperty[] {AGE, NORTH, EAST, SOUTH, WEST, UPPER, FLIP, ALT}); + return new BlockState(this, new IProperty[] {field_176543_a, field_176545_N, field_176546_O, field_176541_P, field_176539_Q, field_176542_R, field_176540_b, field_176544_M}); } + + /*================================= Forge Start ======================================*/ @@ -205,7 +205,7 @@ + */ + public boolean canCatchFire(IBlockAccess world, BlockPos pos, EnumFacing face) + { -+ return world.getBlockState(pos).getBlock().isFlammable(world, pos, face); ++ return world.func_180495_p(pos).func_177230_c().isFlammable(world, pos, face); + } + /*================================= Forge Start ======================================*/ } diff --git a/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch b/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch index d4e12c92c..24229b07b 100644 --- a/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch @@ -2,16 +2,16 @@ +++ ../src-work/minecraft/net/minecraft/block/BlockFlowerPot.java @@ -169,13 +169,6 @@ - public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_) { -- TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos); +- TileEntityFlowerPot tileentityflowerpot = this.func_176442_d(p_180663_1_, p_180663_2_); - -- if (tileentityflowerpot != null && tileentityflowerpot.getFlowerPotItem() != null) +- if (tileentityflowerpot != null && tileentityflowerpot.func_145965_a() != null) - { -- spawnAsEntity(worldIn, pos, new ItemStack(tileentityflowerpot.getFlowerPotItem(), 1, tileentityflowerpot.getFlowerPotData())); +- func_180635_a(p_180663_1_, p_180663_2_, new ItemStack(tileentityflowerpot.func_145965_a(), 1, tileentityflowerpot.func_145966_b())); - } - - super.breakBlock(worldIn, pos, state); + super.func_180663_b(p_180663_1_, p_180663_2_, p_180663_3_); } @@ -395,6 +388,31 @@ @@ -24,9 +24,9 @@ + public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { + java.util.List ret = super.getDrops(world, pos, state, fortune); -+ TileEntityFlowerPot te = world.getTileEntity(pos) instanceof TileEntityFlowerPot ? (TileEntityFlowerPot)world.getTileEntity(pos) : null; -+ if (te != null && te.getFlowerPotItem() != null) -+ ret.add(new ItemStack(te.getFlowerPotItem(), 1, te.getFlowerPotData())); ++ TileEntityFlowerPot te = world.func_175625_s(pos) instanceof TileEntityFlowerPot ? (TileEntityFlowerPot)world.func_175625_s(pos) : null; ++ if (te != null && te.func_145965_a() != null) ++ ret.add(new ItemStack(te.func_145965_a(), 1, te.func_145966_b())); + return ret; + } + @Override @@ -36,10 +36,10 @@ + return super.removedByPlayer(world, pos, player, willHarvest); + } + @Override -+ public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) ++ public void func_180657_a(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { -+ super.harvestBlock(world, player, pos, state, te); -+ world.setBlockToAir(pos); ++ super.func_180657_a(world, player, pos, state, te); ++ world.func_175698_g(pos); + } + /*===========================FORGE END==========================================*/ + diff --git a/patches/minecraft/net/minecraft/block/BlockGrass.java.patch b/patches/minecraft/net/minecraft/block/BlockGrass.java.patch index b373fbe3a..7f957e591 100644 --- a/patches/minecraft/net/minecraft/block/BlockGrass.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockGrass.java.patch @@ -2,28 +2,28 @@ +++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java @@ -58,7 +58,7 @@ { - if (!worldIn.isRemote) + if (!p_180650_1_.field_72995_K) { -- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2) -+ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity(worldIn, pos.up()) > 2) +- if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).func_177230_c().func_149717_k() > 2) ++ if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).func_177230_c().getLightOpacity(p_180650_1_, p_180650_2_.func_177984_a()) > 2) { - worldIn.setBlockState(pos, Blocks.dirt.getDefaultState()); + p_180650_1_.func_175656_a(p_180650_2_, Blocks.field_150346_d.func_176223_P()); } @@ -72,7 +72,7 @@ - Block block = worldIn.getBlockState(blockpos.up()).getBlock(); - IBlockState iblockstate = worldIn.getBlockState(blockpos); + Block block = p_180650_1_.func_180495_p(blockpos.func_177984_a()).func_177230_c(); + IBlockState iblockstate = p_180650_1_.func_180495_p(blockpos); -- if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) -+ if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity(worldIn, blockpos.up()) <= 2) +- if (iblockstate.func_177230_c() == Blocks.field_150346_d && iblockstate.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos.func_177984_a()) >= 4 && block.func_149717_k() <= 2) ++ if (iblockstate.func_177230_c() == Blocks.field_150346_d && iblockstate.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos.func_177984_a()) >= 4 && block.getLightOpacity(p_180650_1_, blockpos.func_177984_a()) <= 2) { - worldIn.setBlockState(blockpos, Blocks.grass.getDefaultState()); + p_180650_1_.func_175656_a(blockpos, Blocks.field_150349_c.func_176223_P()); } @@ -110,7 +110,7 @@ { if (j >= i / 16) { -- if (worldIn.getBlockState(blockpos1).getBlock().blockMaterial == Material.air) -+ if (worldIn.isAirBlock(blockpos1)) +- if (p_176474_1_.func_180495_p(blockpos1).func_177230_c().field_149764_J == Material.field_151579_a) ++ if (p_176474_1_.func_175623_d(blockpos1)) { - if (rand.nextInt(8) == 0) + if (p_176474_2_.nextInt(8) == 0) { diff --git a/patches/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch b/patches/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch index 4034822ae..cfc4d531f 100644 --- a/patches/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch @@ -1,17 +1,17 @@ --- ../src-base/minecraft/net/minecraft/block/BlockHugeMushroom.java +++ ../src-work/minecraft/net/minecraft/block/BlockHugeMushroom.java @@ -79,6 +79,20 @@ - return new BlockState(this, new IProperty[] {VARIANT}); + return new BlockState(this, new IProperty[] {field_176380_a}); } + public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) + { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ IBlockState state = world.func_180495_p(pos); ++ for (IProperty prop : (java.util.Set)state.func_177228_b().keySet()) + { -+ if (prop.getName().equals("variant")) ++ if (prop.func_177701_a().equals("variant")) + { -+ world.setBlockState(pos, state.cycleProperty(prop)); ++ world.func_175656_a(pos, state.func_177231_a(prop)); + return true; + } + } diff --git a/patches/minecraft/net/minecraft/block/BlockIce.java.patch b/patches/minecraft/net/minecraft/block/BlockIce.java.patch index c1631128c..b2ff04fe6 100644 --- a/patches/minecraft/net/minecraft/block/BlockIce.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockIce.java.patch @@ -1,35 +1,35 @@ --- ../src-base/minecraft/net/minecraft/block/BlockIce.java +++ ../src-work/minecraft/net/minecraft/block/BlockIce.java @@ -38,14 +38,17 @@ - player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); - player.addExhaustion(0.025F); + p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); + p_180657_2_.func_71020_j(0.025F); -- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) -+ if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player)) +- if (this.func_149700_E() && EnchantmentHelper.func_77502_d(p_180657_2_)) ++ if (this.canSilkHarvest(p_180657_1_, p_180657_3_, p_180657_1_.func_180495_p(p_180657_3_), p_180657_2_) && EnchantmentHelper.func_77502_d(p_180657_2_)) { + java.util.List items = new java.util.ArrayList(); - ItemStack itemstack = this.createStackedBlock(state); + ItemStack itemstack = this.func_180643_i(p_180657_4_); - if (itemstack != null) - { -- spawnAsEntity(worldIn, pos, itemstack); +- func_180635_a(p_180657_1_, p_180657_3_, itemstack); - } + if (itemstack != null) items.add(itemstack); + -+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, worldIn.getBlockState(pos), 0, 1.0f, true, player); ++ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_1_.func_180495_p(p_180657_3_), 0, 1.0f, true, p_180657_2_); + + for (ItemStack is : items) -+ spawnAsEntity(worldIn, pos, is); ++ func_180635_a(p_180657_1_, p_180657_3_, is); } else { @@ -56,7 +59,9 @@ } - int i = EnchantmentHelper.getFortuneModifier(player); -+ harvesters.set(player); - this.dropBlockAsItem(worldIn, pos, state, i); + int i = EnchantmentHelper.func_77517_e(p_180657_2_); ++ harvesters.set(p_180657_2_); + this.func_176226_b(p_180657_1_, p_180657_3_, p_180657_4_, i); + harvesters.set(null); - Material material = worldIn.getBlockState(pos.down()).getBlock().getMaterial(); + Material material = p_180657_1_.func_180495_p(p_180657_3_.func_177977_b()).func_177230_c().func_149688_o(); - if (material.blocksMovement() || material.isLiquid()) + if (material.func_76230_c() || material.func_76224_d()) diff --git a/patches/minecraft/net/minecraft/block/BlockLadder.java.patch b/patches/minecraft/net/minecraft/block/BlockLadder.java.patch index a6e678065..84fa2d3db 100644 --- a/patches/minecraft/net/minecraft/block/BlockLadder.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLadder.java.patch @@ -2,28 +2,28 @@ +++ ../src-work/minecraft/net/minecraft/block/BlockLadder.java @@ -78,7 +78,10 @@ - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { -- return worldIn.getBlockState(pos.west()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.east()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.north()).getBlock().isNormalCube() ? true : worldIn.getBlockState(pos.south()).getBlock().isNormalCube())); -+ return worldIn.isSideSolid(pos.west(), EnumFacing.EAST, true) || -+ worldIn.isSideSolid(pos.east(), EnumFacing.WEST, true) || -+ worldIn.isSideSolid(pos.north(), EnumFacing.SOUTH, true) || -+ worldIn.isSideSolid(pos.south(), EnumFacing.NORTH, true); +- return p_176196_1_.func_180495_p(p_176196_2_.func_177976_e()).func_177230_c().func_149721_r() ? true : (p_176196_1_.func_180495_p(p_176196_2_.func_177974_f()).func_177230_c().func_149721_r() ? true : (p_176196_1_.func_180495_p(p_176196_2_.func_177978_c()).func_177230_c().func_149721_r() ? true : p_176196_1_.func_180495_p(p_176196_2_.func_177968_d()).func_177230_c().func_149721_r())); ++ return p_176196_1_.isSideSolid(p_176196_2_.func_177976_e(), EnumFacing.EAST, true) || ++ p_176196_1_.isSideSolid(p_176196_2_.func_177974_f(), EnumFacing.WEST, true) || ++ p_176196_1_.isSideSolid(p_176196_2_.func_177978_c(), EnumFacing.SOUTH, true) || ++ p_176196_1_.isSideSolid(p_176196_2_.func_177968_d(), EnumFacing.NORTH, true); } - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) @@ -116,7 +119,7 @@ - protected boolean canBlockStay(World worldIn, BlockPos pos, EnumFacing facing) + protected boolean func_176381_b(World p_176381_1_, BlockPos p_176381_2_, EnumFacing p_176381_3_) { -- return worldIn.getBlockState(pos.offset(facing.getOpposite())).getBlock().isNormalCube(); -+ return worldIn.isSideSolid(pos.offset(facing.getOpposite()), facing, true); +- return p_176381_1_.func_180495_p(p_176381_2_.func_177972_a(p_176381_3_.func_176734_d())).func_177230_c().func_149721_r(); ++ return p_176381_1_.isSideSolid(p_176381_2_.func_177972_a(p_176381_3_.func_176734_d()), p_176381_3_, true); } - public IBlockState getStateFromMeta(int meta) + public IBlockState func_176203_a(int p_176203_1_) @@ -146,4 +149,6 @@ { - return new BlockState(this, new IProperty[] {FACING}); + return new BlockState(this, new IProperty[] {field_176382_a}); } + + @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; } diff --git a/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch b/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch index a736fd6bb..4dcb42a4d 100644 --- a/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch @@ -7,43 +7,43 @@ -public abstract class BlockLeaves extends BlockLeavesBase +public abstract class BlockLeaves extends BlockLeavesBase implements net.minecraftforge.common.IShearable { - public static final PropertyBool DECAYABLE = PropertyBool.create("decayable"); - public static final PropertyBool CHECK_DECAY = PropertyBool.create("check_decay"); + public static final PropertyBool field_176237_a = PropertyBool.func_177716_a("decayable"); + public static final PropertyBool field_176236_b = PropertyBool.func_177716_a("check_decay"); @@ -75,9 +75,9 @@ - BlockPos blockpos = pos.add(j1, k1, l1); - IBlockState iblockstate = worldIn.getBlockState(blockpos); + BlockPos blockpos = p_180663_2_.func_177982_a(j1, k1, l1); + IBlockState iblockstate = p_180663_1_.func_180495_p(blockpos); -- if (iblockstate.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate.getValue(CHECK_DECAY)).booleanValue()) -+ if (iblockstate.getBlock().isLeaves(worldIn, blockpos)) +- if (iblockstate.func_177230_c().func_149688_o() == Material.field_151584_j && !((Boolean)iblockstate.func_177229_b(field_176236_b)).booleanValue()) ++ if (iblockstate.func_177230_c().isLeaves(p_180663_1_, blockpos)) { -- worldIn.setBlockState(blockpos, iblockstate.withProperty(CHECK_DECAY, Boolean.valueOf(true)), 4); -+ iblockstate.getBlock().beginLeavesDecay(worldIn, blockpos); +- p_180663_1_.func_180501_a(blockpos, iblockstate.func_177226_a(field_176236_b, Boolean.valueOf(true)), 4); ++ iblockstate.func_177230_c().beginLeavesDecay(p_180663_1_, blockpos); } } } @@ -117,9 +117,9 @@ { - Block block = worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2)).getBlock(); + Block block = p_180650_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2)).func_177230_c(); -- if (block != Blocks.log && block != Blocks.log2) -+ if (!block.canSustainLeaves(worldIn, blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2))) +- if (block != Blocks.field_150364_r && block != Blocks.field_150363_s) ++ if (!block.canSustainLeaves(p_180650_1_, blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2))) { -- if (block.getMaterial() == Material.leaves) -+ if (block.isLeaves(worldIn, blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2))) +- if (block.func_149688_o() == Material.field_151584_j) ++ if (block.isLeaves(p_180650_1_, blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2))) { - this.surroundings[(i2 + l1) * k1 + (j2 + l1) * j1 + k2 + l1] = -2; + this.field_150128_a[(i2 + l1) * k1 + (j2 + l1) * j1 + k2 + l1] = -2; } @@ -226,40 +226,7 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { -- if (!worldIn.isRemote) +- if (!p_180653_1_.field_72995_K) - { -- int i = this.getSaplingDropChance(state); +- int i = this.func_176232_d(p_180653_3_); - -- if (fortune > 0) +- if (p_180653_5_ > 0) - { -- i -= 2 << fortune; +- i -= 2 << p_180653_5_; - - if (i < 10) - { @@ -51,17 +51,17 @@ - } - } - -- if (worldIn.rand.nextInt(i) == 0) +- if (p_180653_1_.field_73012_v.nextInt(i) == 0) - { -- Item item = this.getItemDropped(state, worldIn.rand, fortune); -- spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); +- Item item = this.func_180660_a(p_180653_3_, p_180653_1_.field_73012_v, p_180653_5_); +- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(item, 1, this.func_180651_a(p_180653_3_))); - } - - i = 200; - -- if (fortune > 0) +- if (p_180653_5_ > 0) - { -- i -= 10 << fortune; +- i -= 10 << p_180653_5_; - - if (i < 40) - { @@ -69,16 +69,16 @@ - } - } - -- this.dropApple(worldIn, pos, state, i); +- this.func_176234_a(p_180653_1_, p_180653_2_, p_180653_3_, i); - } -+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); ++ super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); } - protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance) + protected void func_176234_a(World p_176234_1_, BlockPos p_176234_2_, IBlockState p_176234_3_, int p_176234_4_) @@ -296,4 +263,48 @@ } - public abstract BlockPlanks.EnumType getWoodType(int meta); + public abstract BlockPlanks.EnumType func_176233_b(int p_176233_1_); + + @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } + @Override public boolean isLeaves(IBlockAccess world, BlockPos pos){ return true; } @@ -86,10 +86,10 @@ + @Override + public void beginLeavesDecay(World world, BlockPos pos) + { -+ IBlockState state = world.getBlockState(pos); -+ if (!(Boolean)state.getValue(CHECK_DECAY)) ++ IBlockState state = world.func_180495_p(pos); ++ if (!(Boolean)state.func_177229_b(field_176236_b)) + { -+ world.setBlockState(pos, state.withProperty(CHECK_DECAY, true), 4); ++ world.func_180501_a(pos, state.func_177226_a(field_176236_b, true), 4); + } + } + @@ -97,8 +97,8 @@ + public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { + java.util.List ret = new java.util.ArrayList(); -+ Random rand = world instanceof World ? ((World)world).rand : new Random(); -+ int chance = this.getSaplingDropChance(state); ++ Random rand = world instanceof World ? ((World)world).field_73012_v : new Random(); ++ int chance = this.func_176232_d(state); + + if (fortune > 0) + { @@ -107,7 +107,7 @@ + } + + if (rand.nextInt(chance) == 0) -+ ret.add(new ItemStack(getItemDropped(state, rand, fortune), 1, damageDropped(state))); ++ ret.add(new ItemStack(func_180660_a(state, rand, fortune), 1, func_180651_a(state))); + + chance = 200; + if (fortune > 0) @@ -118,7 +118,7 @@ + + this.captureDrops(true); + if (world instanceof World) -+ this.dropApple((World)world, pos, state, chance); // Dammet mojang ++ this.func_176234_a((World)world, pos, state, chance); // Dammet mojang + ret.addAll(this.captureDrops(false)); + return ret; + } diff --git a/patches/minecraft/net/minecraft/block/BlockLever.java.patch b/patches/minecraft/net/minecraft/block/BlockLever.java.patch index 21869253d..7bee93321 100644 --- a/patches/minecraft/net/minecraft/block/BlockLever.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLever.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/block/BlockLever.java +++ ../src-work/minecraft/net/minecraft/block/BlockLever.java @@ -237,6 +237,12 @@ - return new BlockState(this, new IProperty[] {FACING, POWERED}); + return new BlockState(this, new IProperty[] {field_176360_a, field_176359_b}); } + diff --git a/patches/minecraft/net/minecraft/block/BlockLog.java.patch b/patches/minecraft/net/minecraft/block/BlockLog.java.patch index e1ad4d6e7..a6247c0c2 100644 --- a/patches/minecraft/net/minecraft/block/BlockLog.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLog.java.patch @@ -2,18 +2,18 @@ +++ ../src-work/minecraft/net/minecraft/block/BlockLog.java @@ -33,9 +33,9 @@ { - IBlockState iblockstate = worldIn.getBlockState(blockpos); + IBlockState iblockstate = p_180663_1_.func_180495_p(blockpos); -- if (iblockstate.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate.getValue(BlockLeaves.CHECK_DECAY)).booleanValue()) -+ if (iblockstate.getBlock().isLeaves(worldIn, blockpos)) +- if (iblockstate.func_177230_c().func_149688_o() == Material.field_151584_j && !((Boolean)iblockstate.func_177229_b(BlockLeaves.field_176236_b)).booleanValue()) ++ if (iblockstate.func_177230_c().isLeaves(p_180663_1_, blockpos)) { -- worldIn.setBlockState(blockpos, iblockstate.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(true)), 4); -+ iblockstate.getBlock().beginLeavesDecay(worldIn, blockpos); +- p_180663_1_.func_180501_a(blockpos, iblockstate.func_177226_a(BlockLeaves.field_176236_b, Boolean.valueOf(true)), 4); ++ iblockstate.func_177230_c().beginLeavesDecay(p_180663_1_, blockpos); } } } @@ -46,6 +46,9 @@ - return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(LOG_AXIS, BlockLog.EnumAxis.fromFacingAxis(facing.getAxis())); + return super.func_180642_a(p_180642_1_, p_180642_2_, p_180642_3_, p_180642_4_, p_180642_5_, p_180642_6_, p_180642_7_, p_180642_8_).func_177226_a(field_176299_a, BlockLog.EnumAxis.func_176870_a(p_180642_3_.func_176740_k())); } + @Override public boolean canSustainLeaves(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } diff --git a/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch b/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch index 1ea021a24..89062cf38 100644 --- a/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/block/BlockMobSpawner.java +++ ../src-work/minecraft/net/minecraft/block/BlockMobSpawner.java @@ -37,10 +37,14 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -- int i = 15 + worldIn.rand.nextInt(15) + worldIn.rand.nextInt(15); -- this.dropXpOnBlockBreak(worldIn, pos, i); + super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); +- int i = 15 + p_180653_1_.field_73012_v.nextInt(15) + p_180653_1_.field_73012_v.nextInt(15); +- this.func_180637_b(p_180653_1_, p_180653_2_, i); } + @Override @@ -14,6 +14,6 @@ + return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15); + } + - public boolean isOpaqueCube() + public boolean func_149662_c() { return false; diff --git a/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch b/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch index c8f6e6acd..c78e7fc1d 100644 --- a/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java +++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java @@ -71,7 +71,7 @@ - if (pos.getY() >= 0 && pos.getY() < 256) + if (p_180671_2_.func_177956_o() >= 0 && p_180671_2_.func_177956_o() < 256) { - IBlockState iblockstate = worldIn.getBlockState(pos.down()); -- return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.canPlaceBlockOn(iblockstate.getBlock())); -+ return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && iblockstate.getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this)); + IBlockState iblockstate = p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()); +- return iblockstate.func_177230_c() == Blocks.field_150391_bh ? true : (iblockstate.func_177230_c() == Blocks.field_150346_d && iblockstate.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.PODZOL ? true : p_180671_1_.func_175699_k(p_180671_2_) < 13 && this.func_149854_a(iblockstate.func_177230_c())); ++ return iblockstate.func_177230_c() == Blocks.field_150391_bh ? true : (iblockstate.func_177230_c() == Blocks.field_150346_d && iblockstate.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.PODZOL ? true : p_180671_1_.func_175699_k(p_180671_2_) < 13 && iblockstate.func_177230_c().canSustainPlant(p_180671_1_, p_180671_2_.func_177977_b(), net.minecraft.util.EnumFacing.UP, this)); } else { diff --git a/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch b/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch index 774ac7079..c7bd1a280 100644 --- a/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch @@ -2,19 +2,19 @@ +++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java @@ -39,7 +39,7 @@ { - if (!worldIn.isRemote) + if (!p_180650_1_.field_72995_K) { -- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2) -+ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity(worldIn, pos.up()) > 2) +- if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).func_177230_c().func_149717_k() > 2) ++ if (p_180650_1_.func_175671_l(p_180650_2_.func_177984_a()) < 4 && p_180650_1_.func_180495_p(p_180650_2_.func_177984_a()).func_177230_c().getLightOpacity(p_180650_1_, p_180650_2_.func_177984_a()) > 2) { - worldIn.setBlockState(pos, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); + p_180650_1_.func_175656_a(p_180650_2_, Blocks.field_150346_d.func_176223_P().func_177226_a(BlockDirt.field_176386_a, BlockDirt.DirtType.DIRT)); } @@ -53,7 +53,7 @@ - IBlockState iblockstate = worldIn.getBlockState(blockpos); - Block block = worldIn.getBlockState(blockpos.up()).getBlock(); + IBlockState iblockstate = p_180650_1_.func_180495_p(blockpos); + Block block = p_180650_1_.func_180495_p(blockpos.func_177984_a()).func_177230_c(); -- if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) -+ if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity(worldIn, blockpos.up()) <= 2) +- if (iblockstate.func_177230_c() == Blocks.field_150346_d && iblockstate.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos.func_177984_a()) >= 4 && block.func_149717_k() <= 2) ++ if (iblockstate.func_177230_c() == Blocks.field_150346_d && iblockstate.func_177229_b(BlockDirt.field_176386_a) == BlockDirt.DirtType.DIRT && p_180650_1_.func_175671_l(blockpos.func_177984_a()) >= 4 && block.getLightOpacity(p_180650_1_, blockpos.func_177984_a()) <= 2) { - worldIn.setBlockState(blockpos, this.getDefaultState()); + p_180650_1_.func_175656_a(blockpos, this.func_176223_P()); } diff --git a/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch b/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch index 1640b0ea1..959b41a0b 100644 --- a/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockNetherWart.java.patch @@ -2,46 +2,46 @@ +++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java @@ -38,7 +38,7 @@ - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_) { -- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); -+ return super.canBlockStay(worldIn, pos, state); +- return this.func_149854_a(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c()); ++ return super.func_180671_f(p_180671_1_, p_180671_2_, p_180671_3_); } - public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + public void func_180650_b(World p_180650_1_, BlockPos p_180650_2_, IBlockState p_180650_3_, Random p_180650_4_) @@ -54,9 +54,11 @@ - super.updateTick(worldIn, pos, state, rand); + super.func_180650_b(p_180650_1_, p_180650_2_, p_180650_3_, p_180650_4_); } + @SuppressWarnings("unused") - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { -- if (!worldIn.isRemote) -+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -+ if (false && !worldIn.isRemote) +- if (!p_180653_1_.field_72995_K) ++ super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); ++ if (false && !p_180653_1_.field_72995_K) { int i = 1; @@ -107,4 +109,24 @@ { - return new BlockState(this, new IProperty[] {AGE}); + return new BlockState(this, new IProperty[] {field_176486_a}); } + + @Override + public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { + java.util.List ret = new java.util.ArrayList(); -+ Random rand = world instanceof World ? ((World)world).rand : new Random(); ++ Random rand = world instanceof World ? ((World)world).field_73012_v : new Random(); + int count = 1; + -+ if (((Integer)state.getValue(AGE)) >= 3) ++ if (((Integer)state.func_177229_b(field_176486_a)) >= 3) + { + count = 2 + rand.nextInt(3) + (fortune > 0 ? rand.nextInt(fortune + 1) : 0); + } + + for (int i = 0; i < count; i++) + { -+ ret.add(new ItemStack(Items.nether_wart)); ++ ret.add(new ItemStack(Items.field_151075_bm)); + } + + return ret; diff --git a/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch b/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch index 4696ecb98..9cfc32668 100644 --- a/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch @@ -2,23 +2,23 @@ +++ ../src-work/minecraft/net/minecraft/block/BlockNewLeaf.java @@ -99,14 +99,15 @@ - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) { -- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) +- if (!p_180657_1_.field_72995_K && p_180657_2_.func_71045_bC() != null && p_180657_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ) { -- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4)); +- p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); +- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Item.func_150898_a(this), 1, ((BlockPlanks.EnumType)p_180657_4_.func_177229_b(field_176240_P)).func_176839_a() - 4)); - } - else - { - super.harvestBlock(worldIn, player, pos, state, te); + super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); } } + + @Override + public List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { -+ IBlockState state = world.getBlockState(pos); -+ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4))); ++ IBlockState state = world.func_180495_p(pos); ++ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.func_177229_b(field_176240_P)).func_176839_a() - 4))); + } } diff --git a/patches/minecraft/net/minecraft/block/BlockNote.java.patch b/patches/minecraft/net/minecraft/block/BlockNote.java.patch index f93eeb428..6899eb877 100644 --- a/patches/minecraft/net/minecraft/block/BlockNote.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockNote.java.patch @@ -4,20 +4,20 @@ if (tileentity instanceof TileEntityNote) { TileEntityNote tileentitynote = (TileEntityNote)tileentity; -+ int old = tileentitynote.note; - tileentitynote.changePitch(); -+ if (old == tileentitynote.note) return false; - tileentitynote.triggerNote(worldIn, pos); - playerIn.triggerAchievement(StatList.field_181735_S); ++ int old = tileentitynote.field_145879_a; + tileentitynote.func_145877_a(); ++ if (old == tileentitynote.field_145879_a) return false; + tileentitynote.func_175108_a(p_180639_1_, p_180639_2_); + p_180639_4_.func_71029_a(StatList.field_181735_S); } @@ -98,6 +100,10 @@ - public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam) + public boolean func_180648_a(World p_180648_1_, BlockPos p_180648_2_, IBlockState p_180648_3_, int p_180648_4_, int p_180648_5_) { -+ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(worldIn, pos, state, eventParam, eventID); ++ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(p_180648_1_, p_180648_2_, p_180648_3_, p_180648_5_, p_180648_4_); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e)) return false; -+ eventID = e.instrument.ordinal(); -+ eventParam = e.getVanillaNoteId(); - float f = (float)Math.pow(2.0D, (double)(eventParam - 12) / 12.0D); - worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "note." + this.getInstrument(eventID), 3.0F, f); - worldIn.spawnParticle(EnumParticleTypes.NOTE, (double)pos.getX() + 0.5D, (double)pos.getY() + 1.2D, (double)pos.getZ() + 0.5D, (double)eventParam / 24.0D, 0.0D, 0.0D, new int[0]); ++ p_180648_4_ = e.instrument.ordinal(); ++ p_180648_5_ = e.getVanillaNoteId(); + float f = (float)Math.pow(2.0D, (double)(p_180648_5_ - 12) / 12.0D); + p_180648_1_.func_72908_a((double)p_180648_2_.func_177958_n() + 0.5D, (double)p_180648_2_.func_177956_o() + 0.5D, (double)p_180648_2_.func_177952_p() + 0.5D, "note." + this.func_176433_b(p_180648_4_), 3.0F, f); + p_180648_1_.func_175688_a(EnumParticleTypes.NOTE, (double)p_180648_2_.func_177958_n() + 0.5D, (double)p_180648_2_.func_177956_o() + 1.2D, (double)p_180648_2_.func_177952_p() + 0.5D, (double)p_180648_5_ / 24.0D, 0.0D, 0.0D, new int[0]); diff --git a/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch b/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch index efca433f4..c81ddd561 100644 --- a/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch @@ -1,21 +1,21 @@ --- ../src-base/minecraft/net/minecraft/block/BlockOldLeaf.java +++ ../src-work/minecraft/net/minecraft/block/BlockOldLeaf.java @@ -142,11 +142,17 @@ - if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + if (!p_180657_1_.field_72995_K && p_180657_2_.func_71045_bC() != null && p_180657_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ) { - player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata())); + p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); +- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Item.func_150898_a(this), 1, ((BlockPlanks.EnumType)p_180657_4_.func_177229_b(field_176239_P)).func_176839_a())); } else { - super.harvestBlock(worldIn, player, pos, state, te); + super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); } } + + @Override + public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) + { -+ IBlockState state = world.getBlockState(pos); -+ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata()))); ++ IBlockState state = world.func_180495_p(pos); ++ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.func_177229_b(field_176239_P)).func_176839_a()))); + } } diff --git a/patches/minecraft/net/minecraft/block/BlockOre.java.patch b/patches/minecraft/net/minecraft/block/BlockOre.java.patch index 28763cd3c..a08f33dec 100644 --- a/patches/minecraft/net/minecraft/block/BlockOre.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockOre.java.patch @@ -1,51 +1,51 @@ --- ../src-base/minecraft/net/minecraft/block/BlockOre.java +++ ../src-work/minecraft/net/minecraft/block/BlockOre.java @@ -58,34 +58,40 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); - -- if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this)) +- if (this.func_180660_a(p_180653_3_, p_180653_1_.field_73012_v, p_180653_5_) != Item.func_150898_a(this)) + } + @Override + public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { -+ IBlockState state = world.getBlockState(pos); -+ Random rand = world instanceof World ? ((World)world).rand : new Random(); -+ if (this.getItemDropped(state, rand, fortune) != Item.getItemFromBlock(this)) ++ IBlockState state = world.func_180495_p(pos); ++ Random rand = world instanceof World ? ((World)world).field_73012_v : new Random(); ++ if (this.func_180660_a(state, rand, fortune) != Item.func_150898_a(this)) { int i = 0; - if (this == Blocks.coal_ore) + if (this == Blocks.field_150365_q) { -- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 0, 2); -+ i = MathHelper.getRandomIntegerInRange(rand, 0, 2); +- i = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 0, 2); ++ i = MathHelper.func_76136_a(rand, 0, 2); } - else if (this == Blocks.diamond_ore) + else if (this == Blocks.field_150482_ag) { -- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 3, 7); -+ i = MathHelper.getRandomIntegerInRange(rand, 3, 7); +- i = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 3, 7); ++ i = MathHelper.func_76136_a(rand, 3, 7); } - else if (this == Blocks.emerald_ore) + else if (this == Blocks.field_150412_bA) { -- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 3, 7); -+ i = MathHelper.getRandomIntegerInRange(rand, 3, 7); +- i = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 3, 7); ++ i = MathHelper.func_76136_a(rand, 3, 7); } - else if (this == Blocks.lapis_ore) + else if (this == Blocks.field_150369_x) { -- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); -+ i = MathHelper.getRandomIntegerInRange(rand, 2, 5); +- i = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 2, 5); ++ i = MathHelper.func_76136_a(rand, 2, 5); } - else if (this == Blocks.quartz_ore) + else if (this == Blocks.field_150449_bY) { -- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); -+ i = MathHelper.getRandomIntegerInRange(rand, 2, 5); +- i = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 2, 5); ++ i = MathHelper.func_76136_a(rand, 2, 5); } -- this.dropXpOnBlockBreak(worldIn, pos, i); +- this.func_180637_b(p_180653_1_, p_180653_2_, i); + return i; } + return 0; } - public int getDamageValue(World worldIn, BlockPos pos) + public int func_176222_j(World p_176222_1_, BlockPos p_176222_2_) diff --git a/patches/minecraft/net/minecraft/block/BlockPane.java.patch b/patches/minecraft/net/minecraft/block/BlockPane.java.patch index c5061c08f..bf26e9faf 100644 --- a/patches/minecraft/net/minecraft/block/BlockPane.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPane.java.patch @@ -2,40 +2,40 @@ +++ ../src-work/minecraft/net/minecraft/block/BlockPane.java @@ -38,7 +38,10 @@ - public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + public IBlockState func_176221_a(IBlockState p_176221_1_, IBlockAccess p_176221_2_, BlockPos p_176221_3_) { -- return state.withProperty(NORTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.north()).getBlock()))).withProperty(SOUTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.south()).getBlock()))).withProperty(WEST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.west()).getBlock()))).withProperty(EAST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.east()).getBlock()))); -+ return state.withProperty(NORTH, canPaneConnectTo(worldIn, pos, EnumFacing.NORTH)) -+ .withProperty(SOUTH, canPaneConnectTo(worldIn, pos, EnumFacing.SOUTH)) -+ .withProperty(WEST, canPaneConnectTo(worldIn, pos, EnumFacing.WEST)) -+ .withProperty(EAST, canPaneConnectTo(worldIn, pos, EnumFacing.EAST)); +- return p_176221_1_.func_177226_a(field_176241_b, Boolean.valueOf(this.func_150098_a(p_176221_2_.func_180495_p(p_176221_3_.func_177978_c()).func_177230_c()))).func_177226_a(field_176243_N, Boolean.valueOf(this.func_150098_a(p_176221_2_.func_180495_p(p_176221_3_.func_177968_d()).func_177230_c()))).func_177226_a(field_176244_O, Boolean.valueOf(this.func_150098_a(p_176221_2_.func_180495_p(p_176221_3_.func_177976_e()).func_177230_c()))).func_177226_a(field_176242_M, Boolean.valueOf(this.func_150098_a(p_176221_2_.func_180495_p(p_176221_3_.func_177974_f()).func_177230_c()))); ++ return p_176221_1_.func_177226_a(field_176241_b, canPaneConnectTo(p_176221_2_, p_176221_3_, EnumFacing.NORTH)) ++ .func_177226_a(field_176243_N, canPaneConnectTo(p_176221_2_, p_176221_3_, EnumFacing.SOUTH)) ++ .func_177226_a(field_176244_O, canPaneConnectTo(p_176221_2_, p_176221_3_, EnumFacing.WEST)) ++ .func_177226_a(field_176242_M, canPaneConnectTo(p_176221_2_, p_176221_3_, EnumFacing.EAST)); } - public Item getItemDropped(IBlockState state, Random rand, int fortune) + public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) @@ -64,10 +67,10 @@ - public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) + public void func_180638_a(World p_180638_1_, BlockPos p_180638_2_, IBlockState p_180638_3_, AxisAlignedBB p_180638_4_, List p_180638_5_, Entity p_180638_6_) { -- boolean flag = this.canPaneConnectToBlock(worldIn.getBlockState(pos.north()).getBlock()); -- boolean flag1 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.south()).getBlock()); -- boolean flag2 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.west()).getBlock()); -- boolean flag3 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.east()).getBlock()); -+ boolean flag = this.canPaneConnectTo(worldIn, pos, EnumFacing.NORTH); -+ boolean flag1 = this.canPaneConnectTo(worldIn, pos, EnumFacing.SOUTH); -+ boolean flag2 = this.canPaneConnectTo(worldIn, pos, EnumFacing.WEST); -+ boolean flag3 = this.canPaneConnectTo(worldIn, pos, EnumFacing.EAST); +- boolean flag = this.func_150098_a(p_180638_1_.func_180495_p(p_180638_2_.func_177978_c()).func_177230_c()); +- boolean flag1 = this.func_150098_a(p_180638_1_.func_180495_p(p_180638_2_.func_177968_d()).func_177230_c()); +- boolean flag2 = this.func_150098_a(p_180638_1_.func_180495_p(p_180638_2_.func_177976_e()).func_177230_c()); +- boolean flag3 = this.func_150098_a(p_180638_1_.func_180495_p(p_180638_2_.func_177974_f()).func_177230_c()); ++ boolean flag = this.canPaneConnectTo(p_180638_1_, p_180638_2_, EnumFacing.NORTH); ++ boolean flag1 = this.canPaneConnectTo(p_180638_1_, p_180638_2_, EnumFacing.SOUTH); ++ boolean flag2 = this.canPaneConnectTo(p_180638_1_, p_180638_2_, EnumFacing.WEST); ++ boolean flag3 = this.canPaneConnectTo(p_180638_1_, p_180638_2_, EnumFacing.EAST); if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) { @@ -186,4 +189,11 @@ { - return new BlockState(this, new IProperty[] {NORTH, EAST, WEST, SOUTH}); + return new BlockState(this, new IProperty[] {field_176241_b, field_176242_M, field_176244_O, field_176243_N}); } + + public boolean canPaneConnectTo(IBlockAccess world, BlockPos pos, EnumFacing dir) + { -+ BlockPos off = pos.offset(dir); -+ Block block = world.getBlockState(off).getBlock(); -+ return canPaneConnectToBlock(block) || block.isSideSolid(world, off, dir.getOpposite()); ++ BlockPos off = pos.func_177972_a(dir); ++ Block block = world.func_180495_p(off).func_177230_c(); ++ return func_150098_a(block) || block.isSideSolid(world, off, dir.func_176734_d()); + } } diff --git a/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch b/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch index c696444af..db2e7cfae 100644 --- a/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch @@ -4,28 +4,28 @@ } } -- if (!flag1 && block.getMaterial() != Material.air && canPush(block, worldIn, blockpos, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) -+ if (!flag1 && !block.isAir(worldIn, blockpos) && canPush(block, worldIn, blockpos, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) +- if (!flag1 && block.func_149688_o() != Material.field_151579_a && func_180696_a(block, p_180648_1_, blockpos, enumfacing.func_176734_d(), false) && (block.func_149656_h() == 0 || block == Blocks.field_150331_J || block == Blocks.field_150320_F)) ++ if (!flag1 && !block.isAir(p_180648_1_, blockpos) && func_180696_a(block, p_180648_1_, blockpos, enumfacing.func_176734_d(), false) && (block.func_149656_h() == 0 || block == Blocks.field_150331_J || block == Blocks.field_150320_F)) { - this.doMove(worldIn, pos, enumfacing, false); + this.func_176319_a(p_180648_1_, p_180648_2_, enumfacing, false); } @@ -333,7 +333,7 @@ return false; } -- return !(blockIn instanceof ITileEntityProvider); -+ return !(blockIn.hasTileEntity(worldIn.getBlockState(pos))); +- return !(p_180696_0_ instanceof ITileEntityProvider); ++ return !(p_180696_0_.hasTileEntity(p_180696_1_.func_180495_p(p_180696_2_))); } else { @@ -371,7 +371,9 @@ { BlockPos blockpos = (BlockPos)list1.get(j); - Block block = worldIn.getBlockState(blockpos).getBlock(); -- block.dropBlockAsItem(worldIn, blockpos, worldIn.getBlockState(blockpos), 0); + Block block = p_176319_1_.func_180495_p(blockpos).func_177230_c(); +- block.func_176226_b(p_176319_1_, blockpos, p_176319_1_.func_180495_p(blockpos), 0); + //With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. + float chance = block instanceof BlockSnow ? -1.0f : 1.0f; -+ block.dropBlockAsItemWithChance(worldIn, blockpos, worldIn.getBlockState(blockpos), chance, 0); - worldIn.setBlockToAir(blockpos); ++ block.func_180653_a(p_176319_1_, blockpos, p_176319_1_.func_180495_p(blockpos), chance, 0); + p_176319_1_.func_175698_g(blockpos); --i; ablock[i] = block; diff --git a/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch b/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch index c1bf64fbd..3ba28b443 100644 --- a/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPistonMoving.java.patch @@ -2,35 +2,35 @@ +++ ../src-work/minecraft/net/minecraft/block/BlockPistonMoving.java @@ -109,16 +109,7 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { -- if (!worldIn.isRemote) +- if (!p_180653_1_.field_72995_K) - { -- TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos); +- TileEntityPiston tileentitypiston = this.func_176422_e(p_180653_1_, p_180653_2_); - - if (tileentitypiston != null) - { -- IBlockState iblockstate = tileentitypiston.getPistonState(); -- iblockstate.getBlock().dropBlockAsItem(worldIn, pos, iblockstate, 0); +- IBlockState iblockstate = tileentitypiston.func_174927_b(); +- iblockstate.func_177230_c().func_176226_b(p_180653_1_, p_180653_2_, iblockstate, 0); - } - } -+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); ++ super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); } - public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) + public MovingObjectPosition func_180636_a(World p_180636_1_, BlockPos p_180636_2_, Vec3 p_180636_3_, Vec3 p_180636_4_) @@ -282,4 +273,16 @@ { - return new BlockState(this, new IProperty[] {FACING, TYPE}); + return new BlockState(this, new IProperty[] {field_176426_a, field_176425_b}); } + + @Override + public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { -+ TileEntityPiston tileentitypiston = this.getTileEntity(world, pos); ++ TileEntityPiston tileentitypiston = this.func_176422_e(world, pos); + if (tileentitypiston != null) + { -+ IBlockState pushed = tileentitypiston.getPistonState(); -+ return pushed.getBlock().getDrops(world, pos, pushed, fortune); ++ IBlockState pushed = tileentitypiston.func_174927_b(); ++ return pushed.func_177230_c().getDrops(world, pos, pushed, fortune); + } + return new java.util.ArrayList(); + } diff --git a/patches/minecraft/net/minecraft/block/BlockPotato.java.patch b/patches/minecraft/net/minecraft/block/BlockPotato.java.patch index 7c4e2d199..f507e3336 100644 --- a/patches/minecraft/net/minecraft/block/BlockPotato.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPotato.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/block/BlockPotato.java +++ ../src-work/minecraft/net/minecraft/block/BlockPotato.java @@ -22,13 +22,14 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); - -- if (!worldIn.isRemote) +- if (!p_180653_1_.field_72995_K) - { -- if (((Integer)state.getValue(AGE)).intValue() >= 7 && worldIn.rand.nextInt(50) == 0) +- if (((Integer)p_180653_3_.func_177229_b(field_176488_a)).intValue() >= 7 && p_180653_1_.field_73012_v.nextInt(50) == 0) - { -- spawnAsEntity(worldIn, pos, new ItemStack(Items.poisonous_potato)); +- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(Items.field_151170_bI)); - } - } } @@ -17,9 +17,9 @@ + public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { + java.util.List ret = super.getDrops(world, pos, state, fortune); -+ java.util.Random rand = world instanceof World ? ((World)world).rand : new java.util.Random(); -+ if (((Integer)state.getValue(AGE)) >= 7 && rand.nextInt(50) == 0) -+ ret.add(new ItemStack(Items.poisonous_potato)); ++ java.util.Random rand = world instanceof World ? ((World)world).field_73012_v : new java.util.Random(); ++ if (((Integer)state.func_177229_b(field_176488_a)) >= 7 && rand.nextInt(50) == 0) ++ ret.add(new ItemStack(Items.field_151170_bI)); + return ret; + } } diff --git a/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch b/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch index 6d75c0f94..256bace07 100644 --- a/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch @@ -2,10 +2,10 @@ +++ ../src-work/minecraft/net/minecraft/block/BlockPumpkin.java @@ -115,7 +115,7 @@ - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { -- return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable() && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); -+ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); +- return p_176196_1_.func_180495_p(p_176196_2_).func_177230_c().field_149764_J.func_76222_j() && World.func_175683_a(p_176196_1_, p_176196_2_.func_177977_b()); ++ return p_176196_1_.func_180495_p(p_176196_2_).func_177230_c().func_176200_f(p_176196_1_, p_176196_2_) && World.func_175683_a(p_176196_1_, p_176196_2_.func_177977_b()); } - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) diff --git a/patches/minecraft/net/minecraft/block/BlockQuartz.java.patch b/patches/minecraft/net/minecraft/block/BlockQuartz.java.patch index 413d42a6f..b78be41ea 100644 --- a/patches/minecraft/net/minecraft/block/BlockQuartz.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockQuartz.java.patch @@ -1,23 +1,23 @@ --- ../src-base/minecraft/net/minecraft/block/BlockQuartz.java +++ ../src-work/minecraft/net/minecraft/block/BlockQuartz.java @@ -90,6 +90,26 @@ - return new BlockState(this, new IProperty[] {VARIANT}); + return new BlockState(this, new IProperty[] {field_176335_a}); } + public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) + { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ IBlockState state = world.func_180495_p(pos); ++ for (IProperty prop : (java.util.Set)state.func_177228_b().keySet()) + { -+ if (prop.getName().equals("variant") && prop.getValueClass() == EnumType.class) ++ if (prop.func_177701_a().equals("variant") && prop.func_177699_b() == EnumType.class) + { -+ EnumType current = (EnumType)state.getValue(prop); ++ EnumType current = (EnumType)state.func_177229_b(prop); + EnumType next = current == EnumType.LINES_X ? EnumType.LINES_Y : + current == EnumType.LINES_Y ? EnumType.LINES_Z : + current == EnumType.LINES_Z ? EnumType.LINES_X : current; + if (next == current) + return false; -+ world.setBlockState(pos, state.withProperty(prop, next)); ++ world.func_175656_a(pos, state.func_177226_a(prop, next)); + return true; + } + } diff --git a/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch b/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch index 8dea2624e..9f7a36165 100644 --- a/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch @@ -1,17 +1,17 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRailBase.java +++ ../src-work/minecraft/net/minecraft/block/BlockRailBase.java @@ -31,7 +31,7 @@ - public static boolean isRailBlock(IBlockState state) + public static boolean func_176563_d(IBlockState p_176563_0_) { - Block block = state.getBlock(); -- return block == Blocks.rail || block == Blocks.golden_rail || block == Blocks.detector_rail || block == Blocks.activator_rail; + Block block = p_176563_0_.func_177230_c(); +- return block == Blocks.field_150448_aq || block == Blocks.field_150318_D || block == Blocks.field_150319_E || block == Blocks.field_150408_cc; + return block instanceof BlockRailBase; } - protected BlockRailBase(boolean isPowered) + protected BlockRailBase(boolean p_i45389_1_) @@ -175,6 +175,81 @@ - public abstract IProperty getShapeProperty(); + public abstract IProperty func_176560_l(); + /* ======================================== FORGE START =====================================*/ + /** @@ -23,7 +23,7 @@ + */ + public boolean isFlexibleRail(IBlockAccess world, BlockPos pos) + { -+ return !this.isPowered; ++ return !this.field_150053_a; + } + + /** @@ -74,12 +74,12 @@ + */ + public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) + { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) ++ IBlockState state = world.func_180495_p(pos); ++ for (IProperty prop : (java.util.Set)state.func_177228_b().keySet()) + { -+ if (prop.getName().equals("shape")) ++ if (prop.func_177701_a().equals("shape")) + { -+ world.setBlockState(pos, state.cycleProperty(prop)); ++ world.func_175656_a(pos, state.func_177231_a(prop)); + return true; + } + } @@ -92,20 +92,20 @@ { NORTH_SOUTH(0, "north_south"), @@ -245,6 +320,7 @@ - private IBlockState state; - private final boolean isPowered; + private IBlockState field_180366_e; + private final boolean field_150656_f; private final List field_150657_g = Lists.newArrayList(); + private final boolean canMakeSlopes; - public Rail(World worldIn, BlockPos pos, IBlockState state) + public Rail(World p_i45739_2_, BlockPos p_i45739_3_, IBlockState p_i45739_4_) { @@ -253,7 +329,8 @@ - this.state = state; - this.block = (BlockRailBase)state.getBlock(); - BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(BlockRailBase.this.getShapeProperty()); -- this.isPowered = this.block.isPowered; -+ this.isPowered = !this.block.isFlexibleRail(worldIn, pos); -+ canMakeSlopes = this.block.canMakeSlopes(worldIn, pos); + this.field_180366_e = p_i45739_4_; + this.field_180365_d = (BlockRailBase)p_i45739_4_.func_177230_c(); + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)p_i45739_4_.func_177229_b(BlockRailBase.this.func_176560_l()); +- this.field_150656_f = this.field_180365_d.field_150053_a; ++ this.field_150656_f = !this.field_180365_d.isFlexibleRail(p_i45739_2_, p_i45739_3_); ++ canMakeSlopes = this.field_180365_d.canMakeSlopes(p_i45739_2_, p_i45739_3_); this.func_180360_a(blockrailbase$enumraildirection); } @@ -116,7 +116,7 @@ - if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) + if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) { - if (BlockRailBase.isRailBlock(this.world, blockpos.up())) + if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos.func_177984_a())) { @@ -452,7 +529,7 @@ } @@ -125,7 +125,7 @@ - if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) + if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) { - if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) + if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos3.func_177984_a())) { @@ -595,7 +672,7 @@ } @@ -134,7 +134,7 @@ - if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) + if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) { - if (BlockRailBase.isRailBlock(this.world, blockpos.up())) + if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos.func_177984_a())) { @@ -608,7 +685,7 @@ } @@ -143,5 +143,5 @@ - if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) + if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) { - if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) + if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos3.func_177984_a())) { diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch index 6799d4271..1ad9b4abf 100644 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRedstoneComparator.java +++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneComparator.java @@ -295,6 +295,21 @@ - return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(POWERED, Boolean.valueOf(false)).withProperty(MODE, BlockRedstoneComparator.Mode.COMPARE); + return this.func_176223_P().func_177226_a(field_176387_N, p_180642_8_.func_174811_aO().func_176734_d()).func_177226_a(field_176464_a, Boolean.valueOf(false)).func_177226_a(field_176463_b, BlockRedstoneComparator.Mode.COMPARE); } + @Override + public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) + { -+ if (pos.getY() == neighbor.getY() && world instanceof World) ++ if (pos.func_177956_o() == neighbor.func_177956_o() && world instanceof World) + { -+ onNeighborBlockChange((World)world, pos, world.getBlockState(pos), world.getBlockState(neighbor).getBlock()); ++ func_176204_a((World)world, pos, world.func_180495_p(pos), world.func_180495_p(neighbor).func_177230_c()); + } + } + diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch index f165b66c8..fe20ed8f6 100644 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch @@ -2,10 +2,10 @@ +++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneDiode.java @@ -198,6 +198,8 @@ { - EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); - BlockPos blockpos = pos.offset(enumfacing.getOpposite()); -+ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldIn, pos, worldIn.getBlockState(pos), java.util.EnumSet.of(enumfacing.getOpposite())).isCanceled()) + EnumFacing enumfacing = (EnumFacing)p_176400_3_.func_177229_b(field_176387_N); + BlockPos blockpos = p_176400_2_.func_177972_a(enumfacing.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(enumfacing.func_176734_d())).isCanceled()) + return; - worldIn.notifyBlockOfStateChange(blockpos, this); - worldIn.notifyNeighborsOfStateExcept(blockpos, this, enumfacing); + p_176400_1_.func_180496_d(blockpos, this); + p_176400_1_.func_175695_a(blockpos, this, enumfacing); } diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch index 61ff6434e..daefa904e 100644 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch @@ -1,19 +1,19 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRedstoneOre.java +++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneOre.java @@ -91,12 +91,16 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); + } -- if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this)) +- if (this.func_180660_a(p_180653_3_, p_180653_1_.field_73012_v, p_180653_5_) != Item.func_150898_a(this)) + @Override + public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { -+ if (this.getItemDropped(world.getBlockState(pos), RANDOM, fortune) != Item.getItemFromBlock(this)) ++ if (this.func_180660_a(world.func_180495_p(pos), RANDOM, fortune) != Item.func_150898_a(this)) { -- int i = 1 + worldIn.rand.nextInt(5); -- this.dropXpOnBlockBreak(worldIn, pos, i); +- int i = 1 + p_180653_1_.field_73012_v.nextInt(5); +- this.func_180637_b(p_180653_1_, p_180653_2_, i); + return 1 + RANDOM.nextInt(5); } + return 0; diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch index 8fc040e78..69aa76b4d 100644 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch @@ -1,59 +1,59 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java +++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java @@ -58,10 +58,10 @@ - BlockPos blockpos = pos.offset(direction); - Block block = worldIn.getBlockState(pos.offset(direction)).getBlock(); + BlockPos blockpos = p_176341_2_.func_177972_a(p_176341_3_); + Block block = p_176341_1_.func_180495_p(p_176341_2_.func_177972_a(p_176341_3_)).func_177230_c(); -- if (!canConnectTo(worldIn.getBlockState(blockpos), direction) && (block.isSolidFullCube() || !canConnectUpwardsTo(worldIn.getBlockState(blockpos.down())))) -+ if (!canRestoneConnect(worldIn, blockpos, direction) && (block.isSolidFullCube() || !canRestoneConnect(worldIn, blockpos.down(), null))) +- if (!func_176343_a(p_176341_1_.func_180495_p(blockpos), p_176341_3_) && (block.func_149637_q() || !func_176346_d(p_176341_1_.func_180495_p(blockpos.func_177977_b())))) ++ if (!canRestoneConnect(p_176341_1_, blockpos, p_176341_3_) && (block.func_149637_q() || !canRestoneConnect(p_176341_1_, blockpos.func_177977_b(), null))) { - Block block1 = worldIn.getBlockState(pos.up()).getBlock(); -- return !block1.isSolidFullCube() && block.isSolidFullCube() && canConnectUpwardsTo(worldIn.getBlockState(blockpos.up())) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; -+ return !block1.isSolidFullCube() && block.isSolidFullCube() && canRestoneConnect(worldIn, blockpos.up(), null) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; + Block block1 = p_176341_1_.func_180495_p(p_176341_2_.func_177984_a()).func_177230_c(); +- return !block1.func_149637_q() && block.func_149637_q() && func_176346_d(p_176341_1_.func_180495_p(blockpos.func_177984_a())) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; ++ return !block1.func_149637_q() && block.func_149637_q() && canRestoneConnect(p_176341_1_, blockpos.func_177984_a(), null) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; } else { @@ -359,35 +359,24 @@ - Block block = iblockstate.getBlock(); - boolean flag = block.isNormalCube(); - boolean flag1 = worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); -- return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos.up()) ? true : (canConnectTo(iblockstate, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos.down()))); -+ return !flag1 && flag && canRestoneConnect(worldIn, blockpos.up(), null) ? true : (canRestoneConnect(worldIn, blockpos, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canRestoneConnect(worldIn, blockpos.down(), null))); + Block block = iblockstate.func_177230_c(); + boolean flag = block.func_149721_r(); + boolean flag1 = p_176339_1_.func_180495_p(p_176339_2_.func_177984_a()).func_177230_c().func_149721_r(); +- return !flag1 && flag && func_176340_e(p_176339_1_, blockpos.func_177984_a()) ? true : (func_176343_a(iblockstate, p_176339_3_) ? true : (block == Blocks.field_150416_aS && iblockstate.func_177229_b(BlockRedstoneDiode.field_176387_N) == p_176339_3_ ? true : !flag && func_176340_e(p_176339_1_, blockpos.func_177977_b()))); ++ return !flag1 && flag && canRestoneConnect(p_176339_1_, blockpos.func_177984_a(), null) ? true : (canRestoneConnect(p_176339_1_, blockpos, p_176339_3_) ? true : (block == Blocks.field_150416_aS && iblockstate.func_177229_b(BlockRedstoneDiode.field_176387_N) == p_176339_3_ ? true : !flag && canRestoneConnect(p_176339_1_, blockpos.func_177977_b(), null))); } -- protected static boolean canConnectUpwardsTo(IBlockAccess worldIn, BlockPos pos) +- protected static boolean func_176340_e(IBlockAccess p_176340_0_, BlockPos p_176340_1_) + protected static boolean canRestoneConnect(IBlockAccess world, BlockPos pos, EnumFacing side) { -- return canConnectUpwardsTo(worldIn.getBlockState(pos)); +- return func_176346_d(p_176340_0_.func_180495_p(p_176340_1_)); - } - -- protected static boolean canConnectUpwardsTo(IBlockState state) +- protected static boolean func_176346_d(IBlockState p_176346_0_) - { -- return canConnectTo(state, (EnumFacing)null); +- return func_176343_a(p_176346_0_, (EnumFacing)null); - } - -- protected static boolean canConnectTo(IBlockState blockState, EnumFacing side) +- protected static boolean func_176343_a(IBlockState p_176343_0_, EnumFacing p_176343_1_) - { -- Block block = blockState.getBlock(); +- Block block = p_176343_0_.func_177230_c(); - -- if (block == Blocks.redstone_wire) -+ IBlockState state = world.getBlockState(pos); -+ if (state.getBlock() == Blocks.redstone_wire) +- if (block == Blocks.field_150488_af) ++ IBlockState state = world.func_180495_p(pos); ++ if (state.func_177230_c() == Blocks.field_150488_af) { return true; } -- else if (Blocks.unpowered_repeater.isAssociated(block)) -+ else if (Blocks.unpowered_repeater.isAssociated(state.getBlock())) +- else if (Blocks.field_150413_aR.func_149907_e(block)) ++ else if (Blocks.field_150413_aR.func_149907_e(state.func_177230_c())) { -- EnumFacing enumfacing = (EnumFacing)blockState.getValue(BlockRedstoneRepeater.FACING); -- return enumfacing == side || enumfacing.getOpposite() == side; -+ EnumFacing direction = (EnumFacing)state.getValue(BlockRedstoneRepeater.FACING); -+ return direction == side || direction.getOpposite() == side; +- EnumFacing enumfacing = (EnumFacing)p_176343_0_.func_177229_b(BlockRedstoneRepeater.field_176387_N); +- return enumfacing == p_176343_1_ || enumfacing.func_176734_d() == p_176343_1_; ++ EnumFacing direction = (EnumFacing)state.func_177229_b(BlockRedstoneRepeater.field_176387_N); ++ return direction == side || direction.func_176734_d() == side; } else { -- return block.canProvidePower() && side != null; -+ return state.getBlock().canConnectRedstone(world, pos, side); +- return block.func_149744_f() && p_176343_1_ != null; ++ return state.func_177230_c().canConnectRedstone(world, pos, side); } } diff --git a/patches/minecraft/net/minecraft/block/BlockReed.java.patch b/patches/minecraft/net/minecraft/block/BlockReed.java.patch index a6e2c2ae8..95f05667f 100644 --- a/patches/minecraft/net/minecraft/block/BlockReed.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockReed.java.patch @@ -7,19 +7,19 @@ -public class BlockReed extends Block +public class BlockReed extends Block implements net.minecraftforge.common.IPlantable { - public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15); + public static final PropertyInteger field_176355_a = PropertyInteger.func_177719_a("age", 0, 15); @@ -65,6 +65,7 @@ - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { - Block block = worldIn.getBlockState(pos.down()).getBlock(); -+ if (block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this)) return true; + Block block = p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_177230_c(); ++ if (block.canSustainPlant(p_176196_1_, p_176196_2_.func_177977_b(), EnumFacing.UP, this)) return true; if (block == this) { @@ -164,4 +165,15 @@ { - return new BlockState(this, new IProperty[] {AGE}); + return new BlockState(this, new IProperty[] {field_176355_a}); } + + @Override @@ -30,6 +30,6 @@ + @Override + public IBlockState getPlant(IBlockAccess world, BlockPos pos) + { -+ return this.getDefaultState(); ++ return this.func_176223_P(); + } } diff --git a/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch b/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch index e450bf907..bd3714927 100644 --- a/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch @@ -7,12 +7,12 @@ + + public boolean rotateBlock(net.minecraft.world.World world, net.minecraft.util.BlockPos pos, EnumFacing axis) + { -+ net.minecraft.block.state.IBlockState state = world.getBlockState(pos); -+ for (net.minecraft.block.properties.IProperty prop : state.getProperties().keySet()) ++ net.minecraft.block.state.IBlockState state = world.func_180495_p(pos); ++ for (net.minecraft.block.properties.IProperty prop : state.func_177228_b().keySet()) + { -+ if (prop.getName().equals("axis")) ++ if (prop.func_177701_a().equals("axis")) + { -+ world.setBlockState(pos, state.cycleProperty(prop)); ++ world.func_175656_a(pos, state.func_177231_a(prop)); + return true; + } + } diff --git a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch b/patches/minecraft/net/minecraft/block/BlockSapling.java.patch index ce119c1ba..1bef67eb0 100644 --- a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSapling.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/block/BlockSapling.java @@ -71,6 +71,7 @@ - public void generateTree(World worldIn, BlockPos pos, IBlockState state, Random rand) + public void func_176476_e(World p_176476_1_, BlockPos p_176476_2_, IBlockState p_176476_3_, Random p_176476_4_) { -+ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(worldIn, rand, pos)) return; - WorldGenerator worldgenerator = (WorldGenerator)(rand.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true)); ++ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(p_176476_1_, p_176476_4_, p_176476_2_)) return; + WorldGenerator worldgenerator = (WorldGenerator)(p_176476_4_.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true)); int i = 0; int j = 0; diff --git a/patches/minecraft/net/minecraft/block/BlockSkull.java.patch b/patches/minecraft/net/minecraft/block/BlockSkull.java.patch index abe2893df..3ec9807b9 100644 --- a/patches/minecraft/net/minecraft/block/BlockSkull.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSkull.java.patch @@ -1,57 +1,57 @@ --- ../src-base/minecraft/net/minecraft/block/BlockSkull.java +++ ../src-work/minecraft/net/minecraft/block/BlockSkull.java @@ -121,10 +121,6 @@ - return tileentity instanceof TileEntitySkull ? ((TileEntitySkull)tileentity).getSkullType() : super.getDamageValue(worldIn, pos); + return tileentity instanceof TileEntitySkull ? ((TileEntitySkull)tileentity).func_145904_a() : super.func_176222_j(p_176222_1_, p_176222_2_); } -- public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) +- public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) - { - } - - public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) + public void func_176208_a(World p_176208_1_, BlockPos p_176208_2_, IBlockState p_176208_3_, EntityPlayer p_176208_4_) { - if (player.capabilities.isCreativeMode) + if (p_176208_4_.field_71075_bZ.field_75098_d) @@ -132,13 +128,18 @@ - state = state.withProperty(NODROP, Boolean.valueOf(true)); - worldIn.setBlockState(pos, state, 4); + p_176208_3_ = p_176208_3_.func_177226_a(field_176417_b, Boolean.valueOf(true)); + p_176208_1_.func_180501_a(p_176208_2_, p_176208_3_, 4); } -+ this.dropBlockAsItem(worldIn, pos, state, 0); ++ this.func_176226_b(p_176208_1_, p_176208_2_, p_176208_3_, 0); - super.onBlockHarvested(worldIn, pos, state, player); + super.func_176208_a(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_); } - public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_) { -- if (!worldIn.isRemote) -+ super.breakBlock(worldIn, pos, state); +- if (!p_180663_1_.field_72995_K) ++ super.func_180663_b(p_180663_1_, p_180663_2_, p_180663_3_); + } -+ public java.util.List getDrops(IBlockAccess worldIn, BlockPos pos, IBlockState state, int fortune) ++ public java.util.List getDrops(IBlockAccess p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_, int fortune) + { + java.util.List ret = new java.util.ArrayList(); { - if (!((Boolean)state.getValue(NODROP)).booleanValue()) + if (!((Boolean)p_180663_3_.func_177229_b(field_176417_b)).booleanValue()) { @@ -147,7 +148,7 @@ if (tileentity instanceof TileEntitySkull) { TileEntitySkull tileentityskull = (TileEntitySkull)tileentity; -- ItemStack itemstack = new ItemStack(Items.skull, 1, this.getDamageValue(worldIn, pos)); -+ ItemStack itemstack = new ItemStack(Items.skull, 1, tileentityskull.getSkullType()); +- ItemStack itemstack = new ItemStack(Items.field_151144_bL, 1, this.func_176222_j(p_180663_1_, p_180663_2_)); ++ ItemStack itemstack = new ItemStack(Items.field_151144_bL, 1, tileentityskull.func_145904_a()); - if (tileentityskull.getSkullType() == 3 && tileentityskull.getPlayerProfile() != null) + if (tileentityskull.func_145904_a() == 3 && tileentityskull.func_152108_a() != null) { @@ -157,12 +158,11 @@ - itemstack.getTagCompound().setTag("SkullOwner", nbttagcompound); + itemstack.func_77978_p().func_74782_a("SkullOwner", nbttagcompound); } -- spawnAsEntity(worldIn, pos, itemstack); +- func_180635_a(p_180663_1_, p_180663_2_, itemstack); + ret.add(itemstack); } } - -- super.breakBlock(worldIn, pos, state); +- super.func_180663_b(p_180663_1_, p_180663_2_, p_180663_3_); } + return ret; } - public Item getItemDropped(IBlockState state, Random rand, int fortune) + public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) diff --git a/patches/minecraft/net/minecraft/block/BlockSnow.java.patch b/patches/minecraft/net/minecraft/block/BlockSnow.java.patch index 0e607c12d..78104241b 100644 --- a/patches/minecraft/net/minecraft/block/BlockSnow.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSnow.java.patch @@ -2,52 +2,52 @@ +++ ../src-work/minecraft/net/minecraft/block/BlockSnow.java @@ -79,7 +79,7 @@ { - IBlockState iblockstate = worldIn.getBlockState(pos.down()); - Block block = iblockstate.getBlock(); -- return block != Blocks.ice && block != Blocks.packed_ice ? (block.getMaterial() == Material.leaves ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; -+ return block != Blocks.ice && block != Blocks.packed_ice ? (block.isLeaves(worldIn, pos.down()) ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() == 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; + IBlockState iblockstate = p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()); + Block block = iblockstate.func_177230_c(); +- return block != Blocks.field_150432_aD && block != Blocks.field_150403_cj ? (block.func_149688_o() == Material.field_151584_j ? true : (block == this && ((Integer)iblockstate.func_177229_b(field_176315_a)).intValue() >= 7 ? true : block.func_149662_c() && block.field_149764_J.func_76230_c())) : false; ++ return block != Blocks.field_150432_aD && block != Blocks.field_150403_cj ? (block.isLeaves(p_176196_1_, p_176196_2_.func_177977_b()) ? true : (block == this && ((Integer)iblockstate.func_177229_b(field_176315_a)).intValue() == 7 ? true : block.func_149662_c() && block.field_149764_J.func_76230_c())) : false; } - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void func_176204_a(World p_176204_1_, BlockPos p_176204_2_, IBlockState p_176204_3_, Block p_176204_4_) @@ -91,7 +91,6 @@ { - if (!this.canPlaceBlockAt(worldIn, p_176314_2_)) + if (!this.func_176196_c(p_176314_1_, p_176314_2_)) { -- this.dropBlockAsItem(worldIn, p_176314_2_, p_176314_3_, 0); - worldIn.setBlockToAir(p_176314_2_); +- this.func_176226_b(p_176314_1_, p_176314_2_, p_176314_3_, 0); + p_176314_1_.func_175698_g(p_176314_2_); return false; } @@ -103,9 +102,8 @@ - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) { -- spawnAsEntity(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1, 0)); -+ super.harvestBlock(worldIn, player, pos, state, te); - worldIn.setBlockToAir(pos); -- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); +- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Items.field_151126_ay, ((Integer)p_180657_4_.func_177229_b(field_176315_a)).intValue() + 1, 0)); ++ super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); + p_180657_1_.func_175698_g(p_180657_3_); +- p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); } - public Item getItemDropped(IBlockState state, Random rand, int fortune) + public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) @@ -115,14 +113,13 @@ - public int quantityDropped(Random random) + public int func_149745_a(Random p_149745_1_) { - return 0; + return 1; } - public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + public void func_180650_b(World p_180650_1_, BlockPos p_180650_2_, IBlockState p_180650_3_, Random p_180650_4_) { - if (worldIn.getLightFor(EnumSkyBlock.BLOCK, pos) > 11) + if (p_180650_1_.func_175642_b(EnumSkyBlock.BLOCK, p_180650_2_) > 11) { -- this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0); - worldIn.setBlockToAir(pos); +- this.func_176226_b(p_180650_1_, p_180650_2_, p_180650_1_.func_180495_p(p_180650_2_), 0); + p_180650_1_.func_175698_g(p_180650_2_); } } @@ -152,4 +149,6 @@ { - return new BlockState(this, new IProperty[] {LAYERS}); + return new BlockState(this, new IProperty[] {field_176315_a}); } + -+ @Override public int quantityDropped(IBlockState state, int fortune, Random random){ return ((Integer)state.getValue(LAYERS)) + 1; } ++ @Override public int quantityDropped(IBlockState state, int fortune, Random random){ return ((Integer)state.func_177229_b(field_176315_a)) + 1; } } diff --git a/patches/minecraft/net/minecraft/block/BlockStem.java.patch b/patches/minecraft/net/minecraft/block/BlockStem.java.patch index 41d70ce17..90fd806ba 100644 --- a/patches/minecraft/net/minecraft/block/BlockStem.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockStem.java.patch @@ -1,36 +1,39 @@ --- ../src-base/minecraft/net/minecraft/block/BlockStem.java +++ ../src-work/minecraft/net/minecraft/block/BlockStem.java @@ -94,7 +94,7 @@ - pos = pos.offset(EnumFacing.Plane.HORIZONTAL.random(rand)); - Block block = worldIn.getBlockState(pos.down()).getBlock(); + p_180650_2_ = p_180650_2_.func_177972_a(EnumFacing.Plane.HORIZONTAL.func_179518_a(p_180650_4_)); + Block block = p_180650_1_.func_180495_p(p_180650_2_.func_177977_b()).func_177230_c(); -- if (worldIn.getBlockState(pos).getBlock().blockMaterial == Material.air && (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass)) -+ if (worldIn.isAirBlock(pos) && (block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this) || block == Blocks.dirt || block == Blocks.grass)) +- if (p_180650_1_.func_180495_p(p_180650_2_).func_177230_c().field_149764_J == Material.field_151579_a && (block == Blocks.field_150458_ak || block == Blocks.field_150346_d || block == Blocks.field_150349_c)) ++ if (p_180650_1_.func_175623_d(p_180650_2_) && (block.canSustainPlant(p_180650_1_, p_180650_2_.func_177977_b(), EnumFacing.UP, this) || block == Blocks.field_150346_d || block == Blocks.field_150349_c)) { - worldIn.setBlockState(pos, this.crop.getDefaultState()); + p_180650_1_.func_175656_a(p_180650_2_, this.field_149877_a.func_176223_P()); } -@@ -148,8 +148,12 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) +@@ -148,24 +148,29 @@ + public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + super.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); + } -- if (!worldIn.isRemote) +- if (!p_180653_1_.field_72995_K) + @Override + public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { + java.util.List ret = new java.util.ArrayList(); { - Item item = this.getSeedItem(); + Item item = this.func_176481_j(); -@@ -159,13 +163,14 @@ + if (item != null) + { +- int i = ((Integer)p_180653_3_.func_177229_b(field_176484_a)).intValue(); ++ int i = ((Integer)state.func_177229_b(field_176484_a)).intValue(); for (int j = 0; j < 3; ++j) { -- if (worldIn.rand.nextInt(15) <= i) +- if (p_180653_1_.field_73012_v.nextInt(15) <= i) + if (RANDOM.nextInt(15) <= i) { -- spawnAsEntity(worldIn, pos, new ItemStack(item)); +- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(item)); + ret.add(new ItemStack(item)); } } @@ -39,4 +42,4 @@ + return ret; } - protected Item getSeedItem() + protected Item func_176481_j() diff --git a/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch b/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch index d0a3b75f3..e9629da02 100644 --- a/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch @@ -7,38 +7,38 @@ -public class BlockTallGrass extends BlockBush implements IGrowable +public class BlockTallGrass extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable { - public static final PropertyEnum TYPE = PropertyEnum.create("type", BlockTallGrass.EnumType.class); + public static final PropertyEnum field_176497_a = PropertyEnum.func_177709_a("type", BlockTallGrass.EnumType.class); @@ -43,7 +43,7 @@ - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_) { -- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); -+ return super.canBlockStay(worldIn, pos, state); +- return this.func_149854_a(p_180671_1_.func_180495_p(p_180671_2_.func_177977_b()).func_177230_c()); ++ return super.func_180671_f(p_180671_1_, p_180671_2_, p_180671_3_); } - public boolean isReplaceable(World worldIn, BlockPos pos) + public boolean func_176200_f(World p_176200_1_, BlockPos p_176200_2_) @@ -53,7 +53,7 @@ - public Item getItemDropped(IBlockState state, Random rand, int fortune) + public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) { -- return rand.nextInt(8) == 0 ? Items.wheat_seeds : null; +- return p_180660_2_.nextInt(8) == 0 ? Items.field_151014_N : null; + return null; } - public int quantityDroppedWithBonus(int fortune, Random random) + public int func_149679_a(int p_149679_1_, Random p_149679_2_) @@ -63,13 +63,7 @@ - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) { -- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) +- if (!p_180657_1_.field_72995_K && p_180657_2_.func_71045_bC() != null && p_180657_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ) { -- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)state.getValue(TYPE)).getMeta())); +- p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); +- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Blocks.field_150329_H, 1, ((BlockTallGrass.EnumType)p_180657_4_.func_177229_b(field_176497_a)).func_177044_a())); - } - else - { - super.harvestBlock(worldIn, player, pos, state, te); + super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); } } @@ -204,4 +198,22 @@ @@ -51,7 +51,7 @@ + public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) + { + List ret = new java.util.ArrayList(); -+ ret.add(new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)world.getBlockState(pos).getValue(TYPE)).getMeta())); ++ ret.add(new ItemStack(Blocks.field_150329_H, 1, ((BlockTallGrass.EnumType)world.func_180495_p(pos).func_177229_b(field_176497_a)).func_177044_a())); + return ret; + } + @Override diff --git a/patches/minecraft/net/minecraft/block/BlockTorch.java.patch b/patches/minecraft/net/minecraft/block/BlockTorch.java.patch index ca42046b1..8a44d448a 100644 --- a/patches/minecraft/net/minecraft/block/BlockTorch.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTorch.java.patch @@ -3,36 +3,36 @@ @@ -63,7 +63,7 @@ else { - Block block = worldIn.getBlockState(pos).getBlock(); -- return block instanceof BlockFence || block == Blocks.glass || block == Blocks.cobblestone_wall || block == Blocks.stained_glass; -+ return block.canPlaceTorchOnTop(worldIn, pos); + Block block = p_176594_1_.func_180495_p(p_176594_2_).func_177230_c(); +- return block instanceof BlockFence || block == Blocks.field_150359_w || block == Blocks.field_150463_bK || block == Blocks.field_150399_cn; ++ return block.canPlaceTorchOnTop(p_176594_1_, p_176594_2_); } } @@ -84,7 +84,7 @@ { - BlockPos blockpos = pos.offset(facing.getOpposite()); - boolean flag = facing.getAxis().isHorizontal(); -- return flag && worldIn.isBlockNormalCube(blockpos, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos); -+ return flag && worldIn.isSideSolid(blockpos, facing, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos); + BlockPos blockpos = p_176595_2_.func_177972_a(p_176595_3_.func_176734_d()); + boolean flag = p_176595_3_.func_176740_k().func_176722_c(); +- return flag && p_176595_1_.func_175677_d(blockpos, true) || p_176595_3_.equals(EnumFacing.UP) && this.func_176594_d(p_176595_1_, blockpos); ++ return flag && p_176595_1_.isSideSolid(blockpos, p_176595_3_, true) || p_176595_3_.equals(EnumFacing.UP) && this.func_176594_d(p_176595_1_, blockpos); } - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) @@ -97,7 +97,7 @@ { for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) { -- if (worldIn.isBlockNormalCube(pos.offset(enumfacing.getOpposite()), true)) -+ if (worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) +- if (p_180642_1_.func_175677_d(p_180642_2_.func_177972_a(enumfacing.func_176734_d()), true)) ++ if (p_180642_1_.isSideSolid(p_180642_2_.func_177972_a(enumfacing.func_176734_d()), enumfacing, true)) { - return this.getDefaultState().withProperty(FACING, enumfacing); + return this.func_176223_P().func_177226_a(field_176596_a, enumfacing); } @@ -130,7 +130,7 @@ - EnumFacing enumfacing1 = enumfacing.getOpposite(); + EnumFacing enumfacing1 = enumfacing.func_176734_d(); boolean flag = false; -- if (enumfacing$axis.isHorizontal() && !worldIn.isBlockNormalCube(pos.offset(enumfacing1), true)) -+ if (enumfacing$axis.isHorizontal() && !worldIn.isSideSolid(pos.offset(enumfacing1), enumfacing1, true)) +- if (enumfacing$axis.func_176722_c() && !p_176592_1_.func_175677_d(p_176592_2_.func_177972_a(enumfacing1), true)) ++ if (enumfacing$axis.func_176722_c() && !p_176592_1_.isSideSolid(p_176592_2_.func_177972_a(enumfacing1), enumfacing1, true)) { flag = true; } diff --git a/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch b/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch index 7de11cc75..0eb19ae31 100644 --- a/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch @@ -6,38 +6,38 @@ { + /** Set this to allow trapdoors to remain free-floating */ + public static boolean disableValidation = false; - public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); - public static final PropertyBool OPEN = PropertyBool.create("open"); - public static final PropertyEnum HALF = PropertyEnum.create("half", BlockTrapDoor.DoorHalf.class); + public static final PropertyDirection field_176284_a = PropertyDirection.func_177712_a("facing", EnumFacing.Plane.HORIZONTAL); + public static final PropertyBool field_176283_b = PropertyBool.func_177716_a("open"); + public static final PropertyEnum field_176285_M = PropertyEnum.func_177709_a("half", BlockTrapDoor.DoorHalf.class); @@ -140,9 +142,10 @@ { - if (!worldIn.isRemote) + if (!p_176204_1_.field_72995_K) { -+ EnumFacing direction = (EnumFacing)state.getValue(FACING); - BlockPos blockpos = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite()); ++ EnumFacing direction = (EnumFacing)p_176204_3_.func_177229_b(field_176284_a); + BlockPos blockpos = p_176204_2_.func_177972_a(((EnumFacing)p_176204_3_.func_177229_b(field_176284_a)).func_176734_d()); -- if (!isValidSupportBlock(worldIn.getBlockState(blockpos).getBlock())) -+ if (!(isValidSupportBlock(worldIn.getBlockState(blockpos).getBlock()) || worldIn.isSideSolid(blockpos, direction, true))) +- if (!func_150119_a(p_176204_1_.func_180495_p(blockpos).func_177230_c())) ++ if (!(func_150119_a(p_176204_1_.func_180495_p(blockpos).func_177230_c()) || p_176204_1_.isSideSolid(blockpos, direction, true))) { - worldIn.setBlockToAir(pos); - this.dropBlockAsItem(worldIn, pos, state, 0); + p_176204_1_.func_175698_g(p_176204_2_); + this.func_176226_b(p_176204_1_, p_176204_2_, p_176204_3_, 0); @@ -186,7 +189,10 @@ - public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + public boolean func_176198_a(World p_176198_1_, BlockPos p_176198_2_, EnumFacing p_176198_3_) { -- return !side.getAxis().isVertical() && isValidSupportBlock(worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock()); +- return !p_176198_3_.func_176740_k().func_176720_b() && func_150119_a(p_176198_1_.func_180495_p(p_176198_2_.func_177972_a(p_176198_3_.func_176734_d())).func_177230_c()); + if (disableValidation) return true; -+ EnumFacing dir = side.getOpposite(); -+ pos = pos.offset(dir); -+ return !side.getAxis().isVertical() && (isValidSupportBlock(worldIn.getBlockState(pos).getBlock()) || worldIn.isSideSolid(pos, side, true)); ++ EnumFacing dir = p_176198_3_.func_176734_d(); ++ p_176198_2_ = p_176198_2_.func_177972_a(dir); ++ return !p_176198_3_.func_176740_k().func_176720_b() && (func_150119_a(p_176198_1_.func_180495_p(p_176198_2_).func_177230_c()) || p_176198_1_.isSideSolid(p_176198_2_, p_176198_3_, true)); } - protected static EnumFacing getFacing(int meta) + protected static EnumFacing func_176281_b(int p_176281_0_) @@ -223,6 +229,7 @@ - private static boolean isValidSupportBlock(Block blockIn) + private static boolean func_150119_a(Block p_150119_0_) { + if (disableValidation) return true; - return blockIn.blockMaterial.isOpaque() && blockIn.isFullCube() || blockIn == Blocks.glowstone || blockIn instanceof BlockSlab || blockIn instanceof BlockStairs; + return p_150119_0_.field_149764_J.func_76218_k() && p_150119_0_.func_149686_d() || p_150119_0_ == Blocks.field_150426_aN || p_150119_0_ instanceof BlockSlab || p_150119_0_ instanceof BlockStairs; } diff --git a/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch b/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch index a8de6b96f..6a6ba2054 100644 --- a/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch @@ -2,27 +2,27 @@ +++ ../src-work/minecraft/net/minecraft/block/BlockTripWireHook.java @@ -58,14 +58,14 @@ - public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + public boolean func_176198_a(World p_176198_1_, BlockPos p_176198_2_, EnumFacing p_176198_3_) { -- return side.getAxis().isHorizontal() && worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock().isNormalCube(); -+ return side.getAxis().isHorizontal() && worldIn.isSideSolid(pos.offset(side.getOpposite()), side, true); +- return p_176198_3_.func_176740_k().func_176722_c() && p_176198_1_.func_180495_p(p_176198_2_.func_177972_a(p_176198_3_.func_176734_d())).func_177230_c().func_149721_r(); ++ return p_176198_3_.func_176740_k().func_176722_c() && p_176198_1_.isSideSolid(p_176198_2_.func_177972_a(p_176198_3_.func_176734_d()), p_176198_3_, true); } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) { -- if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock().isNormalCube()) -+ if (worldIn.isSideSolid(pos.offset(enumfacing), enumfacing.getOpposite(), true)) +- if (p_176196_1_.func_180495_p(p_176196_2_.func_177972_a(enumfacing)).func_177230_c().func_149721_r()) ++ if (p_176196_1_.isSideSolid(p_176196_2_.func_177972_a(enumfacing), enumfacing.func_176734_d(), true)) { return true; } @@ -99,7 +99,7 @@ { - EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + EnumFacing enumfacing = (EnumFacing)p_176204_3_.func_177229_b(field_176264_a); -- if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).getBlock().isNormalCube()) -+ if (!worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) +- if (!p_176204_1_.func_180495_p(p_176204_2_.func_177972_a(enumfacing.func_176734_d())).func_177230_c().func_149721_r()) ++ if (!p_176204_1_.isSideSolid(p_176204_2_.func_177972_a(enumfacing.func_176734_d()), enumfacing, true)) { - this.dropBlockAsItem(worldIn, pos, state, 0); - worldIn.setBlockToAir(pos); + this.func_176226_b(p_176204_1_, p_176204_2_, p_176204_3_, 0); + p_176204_1_.func_175698_g(p_176204_2_); diff --git a/patches/minecraft/net/minecraft/block/BlockVine.java.patch b/patches/minecraft/net/minecraft/block/BlockVine.java.patch index a3536a850..e64d0dd18 100644 --- a/patches/minecraft/net/minecraft/block/BlockVine.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockVine.java.patch @@ -7,20 +7,20 @@ -public class BlockVine extends Block +public class BlockVine extends Block implements net.minecraftforge.common.IShearable { - public static final PropertyBool UP = PropertyBool.create("up"); - public static final PropertyBool NORTH = PropertyBool.create("north"); + public static final PropertyBool field_176277_a = PropertyBool.func_177716_a("up"); + public static final PropertyBool field_176273_b = PropertyBool.func_177716_a("north"); @@ -387,13 +387,7 @@ - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_) { -- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) +- if (!p_180657_1_.field_72995_K && p_180657_2_.func_71045_bC() != null && p_180657_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ) { -- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.vine, 1, 0)); +- p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); +- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Blocks.field_150395_bd, 1, 0)); - } - else - { - super.harvestBlock(worldIn, player, pos, state, te); + super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); } } @@ -474,4 +468,14 @@ diff --git a/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch b/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch index a9bcee491..9b66c108c 100644 --- a/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch +++ b/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch @@ -2,28 +2,28 @@ +++ ../src-work/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java @@ -78,7 +78,7 @@ { - Block block = this.world.getBlockState(origin).getBlock(); + Block block = this.field_177261_a.func_180495_p(p_177251_1_).func_177230_c(); -- if (block.getMaterial() == Material.air) -+ if (block.isAir(world, origin)) +- if (block.func_149688_o() == Material.field_151579_a) ++ if (block.isAir(field_177261_a, p_177251_1_)) { return true; } @@ -109,7 +109,7 @@ - BlockPos blockpos = origin.offset(this.moveDirection.getOpposite(), i); - block = this.world.getBlockState(blockpos).getBlock(); + BlockPos blockpos = p_177251_1_.func_177967_a(this.field_177257_d.func_176734_d(), i); + block = this.field_177261_a.func_180495_p(blockpos).func_177230_c(); -- if (block.getMaterial() == Material.air || !BlockPistonBase.canPush(block, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos)) -+ if (block.isAir(world, blockpos)|| !BlockPistonBase.canPush(block, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos)) +- if (block.func_149688_o() == Material.field_151579_a || !BlockPistonBase.func_180696_a(block, this.field_177261_a, blockpos, this.field_177257_d, false) || blockpos.equals(this.field_177259_b)) ++ if (block.isAir(field_177261_a, blockpos)|| !BlockPistonBase.func_180696_a(block, this.field_177261_a, blockpos, this.field_177257_d, false) || blockpos.equals(this.field_177259_b)) { break; } @@ -156,7 +156,7 @@ - block = this.world.getBlockState(blockpos1).getBlock(); + block = this.field_177261_a.func_180495_p(blockpos1).func_177230_c(); -- if (block.getMaterial() == Material.air) -+ if (block.isAir(world, blockpos1)) +- if (block.func_149688_o() == Material.field_151579_a) ++ if (block.isAir(field_177261_a, blockpos1)) { return true; } diff --git a/patches/minecraft/net/minecraft/block/state/BlockState.java.patch b/patches/minecraft/net/minecraft/block/state/BlockState.java.patch index 357204736..8d775ed11 100644 --- a/patches/minecraft/net/minecraft/block/state/BlockState.java.patch +++ b/patches/minecraft/net/minecraft/block/state/BlockState.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/block/state/BlockState.java @@ -38,6 +38,16 @@ - public BlockState(Block blockIn, IProperty... properties) + public BlockState(Block p_i45663_1_, IProperty... p_i45663_2_) { -+ this(blockIn, properties, null); ++ this(p_i45663_1_, p_i45663_2_, null); + } + + protected StateImplementation createState(Block block, ImmutableMap properties, ImmutableMap, com.google.common.base.Optional> unlistedProperties) @@ -12,17 +12,17 @@ + return new StateImplementation(block, properties); + } + -+ protected BlockState(Block blockIn, IProperty[] properties, ImmutableMap, com.google.common.base.Optional> unlistedProperties) ++ protected BlockState(Block p_i45663_1_, IProperty[] p_i45663_2_, ImmutableMap, com.google.common.base.Optional> unlistedProperties) + { - this.block = blockIn; - Arrays.sort(properties, new Comparator() + this.field_177627_c = p_i45663_1_; + Arrays.sort(p_i45663_2_, new Comparator() { @@ -53,7 +63,7 @@ - for (List list1 : Cartesian.cartesianProduct(this.getAllowedValues())) + for (List list1 : Cartesian.func_179321_a(this.func_177620_e())) { - Map map1 = MapPopulator.createMap(this.properties, list1); -- BlockState.StateImplementation blockstate$stateimplementation = new BlockState.StateImplementation(blockIn, ImmutableMap.copyOf(map1)); -+ BlockState.StateImplementation blockstate$stateimplementation = createState(blockIn, ImmutableMap.copyOf(map1), unlistedProperties); + Map map1 = MapPopulator.func_179400_b(this.field_177624_d, list1); +- BlockState.StateImplementation blockstate$stateimplementation = new BlockState.StateImplementation(p_i45663_1_, ImmutableMap.copyOf(map1)); ++ BlockState.StateImplementation blockstate$stateimplementation = createState(p_i45663_1_, ImmutableMap.copyOf(map1), unlistedProperties); map.put(map1, blockstate$stateimplementation); list.add(blockstate$stateimplementation); } @@ -32,22 +32,22 @@ + protected StateImplementation(Block blockIn, ImmutableMap propertiesIn, ImmutableTable propertyValueTable) + { -+ this.block = blockIn; -+ this.properties = propertiesIn; -+ this.propertyValueTable = propertyValueTable; ++ this.field_177239_a = blockIn; ++ this.field_177237_b = propertiesIn; ++ this.field_177238_c = propertyValueTable; + } + - public , V extends T> IBlockState withProperty(IProperty property, V value) + public , V extends T> IBlockState func_177226_a(IProperty p_177226_1_, V p_177226_2_) { - if (!this.properties.containsKey(property)) + if (!this.field_177237_b.containsKey(p_177226_1_)) @@ -199,5 +216,10 @@ - map.put(property, value); + map.put(p_177236_1_, p_177236_2_); return map; } + + public ImmutableTable getPropertyValueTable() + { -+ return propertyValueTable; ++ return field_177238_c; + } } } diff --git a/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch b/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch index 093758d5b..2d8b6e47e 100644 --- a/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch @@ -1,26 +1,26 @@ --- ../src-base/minecraft/net/minecraft/client/LoadingScreenRenderer.java +++ ../src-work/minecraft/net/minecraft/client/LoadingScreenRenderer.java @@ -139,6 +139,10 @@ - GlStateManager.clear(16640); + GlStateManager.func_179086_m(16640); } + try + { + if (!net.minecraftforge.fml.client.FMLClientHandler.instance().handleLoadingScreen(scaledresolution)) //FML Don't render while FML's pre-screen is rendering + { - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - this.mc.getTextureManager().bindTexture(Gui.optionsBackground); + Tessellator tessellator = Tessellator.func_178181_a(); + WorldRenderer worldrenderer = tessellator.func_178180_c(); + this.field_73725_b.func_110434_K().func_110577_a(Gui.field_110325_k); @@ -174,6 +178,12 @@ - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - this.mc.fontRendererObj.drawStringWithShadow(this.currentlyDisplayedText, (float)((k - this.mc.fontRendererObj.getStringWidth(this.currentlyDisplayedText)) / 2), (float)(l / 2 - 4 - 16), 16777215); - this.mc.fontRendererObj.drawStringWithShadow(this.message, (float)((k - this.mc.fontRendererObj.getStringWidth(this.message)) / 2), (float)(l / 2 - 4 + 8), 16777215); + GlStateManager.func_179120_a(770, 771, 1, 0); + this.field_73725_b.field_71466_p.func_175063_a(this.field_73726_c, (float)((k - this.field_73725_b.field_71466_p.func_78256_a(this.field_73726_c)) / 2), (float)(l / 2 - 4 - 16), 16777215); + this.field_73725_b.field_71466_p.func_175063_a(this.field_73727_a, (float)((k - this.field_73725_b.field_71466_p.func_78256_a(this.field_73727_a)) / 2), (float)(l / 2 - 4 + 8), 16777215); + } + } + catch (java.io.IOException e) + { + com.google.common.base.Throwables.propagate(e); + } //FML End - this.framebuffer.unbindFramebuffer(); + this.field_146588_g.func_147609_e(); - if (OpenGlHelper.isFramebufferEnabled()) + if (OpenGlHelper.func_148822_b()) diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index d1f5d382a..15098b70c 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -1,181 +1,181 @@ --- ../src-base/minecraft/net/minecraft/client/Minecraft.java +++ ../src-work/minecraft/net/minecraft/client/Minecraft.java @@ -301,7 +301,6 @@ - this.sessionService = (new YggdrasilAuthenticationService(gameConfig.userInfo.proxy, UUID.randomUUID().toString())).createMinecraftSessionService(); - this.session = gameConfig.userInfo.session; - logger.info("Setting user: " + this.session.getUsername()); -- logger.info("(Session ID is " + this.session.getSessionID() + ")"); - this.isDemo = gameConfig.gameInfo.isDemo; - this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1; - this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1; + this.field_152355_az = (new YggdrasilAuthenticationService(p_i45547_1_.field_178745_a.field_178751_c, UUID.randomUUID().toString())).createMinecraftSessionService(); + this.field_71449_j = p_i45547_1_.field_178745_a.field_178752_a; + field_147123_G.info("Setting user: " + this.field_71449_j.func_111285_a()); +- field_147123_G.info("(Session ID is " + this.field_71449_j.func_111286_b() + ")"); + this.field_71459_aj = p_i45547_1_.field_178741_d.field_178756_a; + this.field_71443_c = p_i45547_1_.field_178743_b.field_178764_a > 0 ? p_i45547_1_.field_178743_b.field_178764_a : 1; + this.field_71440_d = p_i45547_1_.field_178743_b.field_178762_b > 0 ? p_i45547_1_.field_178743_b.field_178762_b : 1; @@ -415,10 +414,10 @@ - this.mcResourceManager = new SimpleReloadableResourceManager(this.metadataSerializer_); - this.mcLanguageManager = new LanguageManager(this.metadataSerializer_, this.gameSettings.language); - this.mcResourceManager.registerReloadListener(this.mcLanguageManager); -- this.refreshResources(); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().beginMinecraftLoading(this, this.defaultResourcePacks, this.mcResourceManager); - this.renderEngine = new TextureManager(this.mcResourceManager); - this.mcResourceManager.registerReloadListener(this.renderEngine); -- this.drawSplashScreen(this.renderEngine); -+ net.minecraftforge.fml.client.SplashProgress.drawVanillaScreen(this.renderEngine); - this.initStream(); - this.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService); - this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves")); + this.field_110451_am = new SimpleReloadableResourceManager(this.field_110452_an); + this.field_135017_as = new LanguageManager(this.field_110452_an, this.field_71474_y.field_74363_ab); + this.field_110451_am.func_110542_a(this.field_135017_as); +- this.func_110436_a(); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().beginMinecraftLoading(this, this.field_110449_ao, this.field_110451_am); + this.field_71446_o = new TextureManager(this.field_110451_am); + this.field_110451_am.func_110542_a(this.field_71446_o); +- this.func_180510_a(this.field_71446_o); ++ net.minecraftforge.fml.client.SplashProgress.drawVanillaScreen(this.field_71446_o); + this.func_175595_al(); + this.field_152350_aA = new SkinManager(this.field_71446_o, new File(this.field_110446_Y, "skins"), this.field_152355_az); + this.field_71469_aa = new AnvilSaveConverter(new File(this.field_71412_D, "saves")); @@ -453,6 +452,8 @@ } }); - this.mouseHelper = new MouseHelper(); + this.field_71417_B = new MouseHelper(); + net.minecraftforge.fml.common.ProgressManager.ProgressBar bar= net.minecraftforge.fml.common.ProgressManager.push("Rendering Setup", 5, true); + bar.step("GL Setup"); - this.checkGLError("Pre startup"); - GlStateManager.enableTexture2D(); - GlStateManager.shadeModel(7425); + this.func_71361_d("Pre startup"); + GlStateManager.func_179098_w(); + GlStateManager.func_179103_j(7425); @@ -466,17 +467,21 @@ - GlStateManager.loadIdentity(); - GlStateManager.matrixMode(5888); - this.checkGLError("Startup"); -- this.textureMapBlocks = new TextureMap("textures"); + GlStateManager.func_179096_D(); + GlStateManager.func_179128_n(5888); + this.func_71361_d("Startup"); +- this.field_147128_au = new TextureMap("textures"); + bar.step("Loading Texture Map"); -+ this.textureMapBlocks = new TextureMap("textures",true); - this.textureMapBlocks.setMipmapLevels(this.gameSettings.mipmapLevels); - this.renderEngine.loadTickableTexture(TextureMap.locationBlocksTexture, this.textureMapBlocks); - this.renderEngine.bindTexture(TextureMap.locationBlocksTexture); - this.textureMapBlocks.setBlurMipmapDirect(false, this.gameSettings.mipmapLevels > 0); ++ this.field_147128_au = new TextureMap("textures",true); + this.field_147128_au.func_147633_a(this.field_71474_y.field_151442_I); + this.field_71446_o.func_110580_a(TextureMap.field_110575_b, this.field_147128_au); + this.field_71446_o.func_110577_a(TextureMap.field_110575_b); + this.field_147128_au.func_174937_a(false, this.field_71474_y.field_151442_I > 0); + bar.step("Loading Model Manager"); - this.modelManager = new ModelManager(this.textureMapBlocks); - this.mcResourceManager.registerReloadListener(this.modelManager); + this.field_175617_aL = new ModelManager(this.field_147128_au); + this.field_110451_am.func_110542_a(this.field_175617_aL); + bar.step("Loading Item Renderer"); - this.renderItem = new RenderItem(this.renderEngine, this.modelManager); - this.renderManager = new RenderManager(this.renderEngine, this.renderItem); - this.itemRenderer = new ItemRenderer(this); - this.mcResourceManager.registerReloadListener(this.renderItem); + this.field_175621_X = new RenderItem(this.field_71446_o, this.field_175617_aL); + this.field_175616_W = new RenderManager(this.field_71446_o, this.field_175621_X); + this.field_175620_Y = new ItemRenderer(this); + this.field_110451_am.func_110542_a(this.field_175621_X); + bar.step("Loading Entity Renderer"); - this.entityRenderer = new EntityRenderer(this, this.mcResourceManager); - this.mcResourceManager.registerReloadListener(this.entityRenderer); - this.blockRenderDispatcher = new BlockRendererDispatcher(this.modelManager.getBlockModelShapes(), this.gameSettings); + this.field_71460_t = new EntityRenderer(this, this.field_110451_am); + this.field_110451_am.func_110542_a(this.field_71460_t); + this.field_175618_aM = new BlockRendererDispatcher(this.field_175617_aL.func_174954_c(), this.field_71474_y); @@ -486,22 +491,25 @@ - this.guiAchievement = new GuiAchievement(this); - GlStateManager.viewport(0, 0, this.displayWidth, this.displayHeight); - this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine); + this.field_71458_u = new GuiAchievement(this); + GlStateManager.func_179083_b(0, 0, this.field_71443_c, this.field_71440_d); + this.field_71452_i = new EffectRenderer(this.field_71441_e, this.field_71446_o); + net.minecraftforge.fml.common.ProgressManager.pop(bar); + net.minecraftforge.fml.client.FMLClientHandler.instance().finishMinecraftLoading(); - this.checkGLError("Post startup"); -- this.ingameGUI = new GuiIngame(this); -+ this.ingameGUI = new net.minecraftforge.client.GuiIngameForge(this); + this.func_71361_d("Post startup"); +- this.field_71456_v = new GuiIngame(this); ++ this.field_71456_v = new net.minecraftforge.client.GuiIngameForge(this); - if (this.serverName != null) + if (this.field_71475_ae != null) { -- this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort)); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServerAtStartup(this.serverName, this.serverPort); +- this.func_147108_a(new GuiConnecting(new GuiMainMenu(), this, this.field_71475_ae, this.field_71477_af)); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServerAtStartup(this.field_71475_ae, this.field_71477_af); } else { - this.displayGuiScreen(new GuiMainMenu()); + this.func_147108_a(new GuiMainMenu()); } -- this.renderEngine.deleteTexture(this.mojangLogo); -+ net.minecraftforge.fml.client.SplashProgress.clearVanillaResources(renderEngine, mojangLogo); - this.mojangLogo = null; - this.loadingScreen = new LoadingScreenRenderer(this); +- this.field_71446_o.func_147645_c(this.field_152354_ay); ++ net.minecraftforge.fml.client.SplashProgress.clearVanillaResources(field_71446_o, field_152354_ay); + this.field_152354_ay = null; + this.field_71461_s = new LoadingScreenRenderer(this); + net.minecraftforge.fml.client.FMLClientHandler.instance().onInitializationComplete(); - if (this.gameSettings.fullScreen && !this.fullscreen) + if (this.field_71474_y.field_74353_u && !this.field_71431_Q) { - this.toggleFullscreen(); + this.func_71352_k(); @@ -681,21 +689,23 @@ File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt"); - Bootstrap.printToSYSOUT(crashReportIn.getCompleteReport()); + Bootstrap.func_179870_a(p_71377_1_.func_71502_e()); + int retVal; - if (crashReportIn.getFile() != null) + if (p_71377_1_.func_71497_f() != null) { - Bootstrap.printToSYSOUT("#@!@# Game crashed! Crash report saved to: #@!@# " + crashReportIn.getFile()); + Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + p_71377_1_.func_71497_f()); - System.exit(-1); + retVal = -1; } - else if (crashReportIn.saveToFile(file2)) + else if (p_71377_1_.func_147149_a(file2)) { - Bootstrap.printToSYSOUT("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath()); + Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath()); - System.exit(-1); + retVal = -1; } else { - Bootstrap.printToSYSOUT("#@?@# Game crashed! Crash report could not be saved. #@?@#"); + Bootstrap.func_179870_a("#@?@# Game crashed! Crash report could not be saved. #@?@#"); - System.exit(-2); + retVal = -2; } + net.minecraftforge.fml.common.FMLCommonHandler.instance().handleExit(retVal); } - public boolean isUnicode() + public boolean func_152349_b() @@ -883,11 +893,6 @@ - public void displayGuiScreen(GuiScreen guiScreenIn) + public void func_147108_a(GuiScreen p_147108_1_) { -- if (this.currentScreen != null) +- if (this.field_71462_r != null) - { -- this.currentScreen.onGuiClosed(); +- this.field_71462_r.func_146281_b(); - } - - if (guiScreenIn == null && this.theWorld == null) + if (p_147108_1_ == null && this.field_71441_e == null) { - guiScreenIn = new GuiMainMenu(); + p_147108_1_ = new GuiMainMenu(); @@ -897,6 +902,17 @@ - guiScreenIn = new GuiGameOver(); + p_147108_1_ = new GuiGameOver(); } -+ GuiScreen old = this.currentScreen; -+ net.minecraftforge.client.event.GuiOpenEvent event = new net.minecraftforge.client.event.GuiOpenEvent(guiScreenIn); ++ GuiScreen old = this.field_71462_r; ++ 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; + -+ guiScreenIn = event.gui; -+ if (old != null && guiScreenIn != old) ++ p_147108_1_ = event.gui; ++ if (old != null && p_147108_1_ != old) + { -+ old.onGuiClosed(); ++ old.func_146281_b(); + } + - if (guiScreenIn instanceof GuiMainMenu) + if (p_147108_1_ instanceof GuiMainMenu) { - this.gameSettings.showDebugInfo = false; + this.field_71474_y.field_74330_P = false; @@ -1030,9 +1046,11 @@ - if (!this.skipRenderWorld) + if (!this.field_71454_w) { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickStart(this.timer.renderPartialTicks); - this.mcProfiler.endStartSection("gameRenderer"); - this.entityRenderer.func_181560_a(this.timer.renderPartialTicks, i); - this.mcProfiler.endSection(); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickEnd(this.timer.renderPartialTicks); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickStart(this.field_71428_T.field_74281_c); + this.field_71424_I.func_76318_c("gameRenderer"); + this.field_71460_t.func_181560_a(this.field_71428_T.field_74281_c, i); + this.field_71424_I.func_76319_b(); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickEnd(this.field_71428_T.field_74281_c); } - this.mcProfiler.endSection(); + this.field_71424_I.func_76319_b(); @@ -1377,7 +1395,7 @@ - if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air && this.playerController.func_180512_c(blockpos, this.objectMouseOver.sideHit)) + if (this.field_71441_e.func_180495_p(blockpos).func_177230_c().func_149688_o() != Material.field_151579_a && this.field_71442_b.func_180512_c(blockpos, this.field_71476_x.field_178784_b)) { -- this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver.sideHit); -+ this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver); - this.thePlayer.swingItem(); +- this.field_71452_i.func_180532_a(blockpos, this.field_71476_x.field_178784_b); ++ this.field_71452_i.addBlockHitEffects(blockpos, this.field_71476_x); + this.field_71439_g.func_71038_i(); } } @@ -1463,15 +1481,19 @@ case BLOCK: - BlockPos blockpos = this.objectMouseOver.getBlockPos(); + BlockPos blockpos = this.field_71476_x.func_178782_a(); -- if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air) -+ if (!this.theWorld.isAirBlock(blockpos)) +- if (this.field_71441_e.func_180495_p(blockpos).func_177230_c().func_149688_o() != Material.field_151579_a) ++ if (!this.field_71441_e.func_175623_d(blockpos)) { - int i = itemstack != null ? itemstack.stackSize : 0; + int i = itemstack != null ? itemstack.field_77994_a : 0; + -+ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, this.theWorld, blockpos, this.objectMouseOver.sideHit).isCanceled(); ++ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_71439_g, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, this.field_71441_e, blockpos, this.field_71476_x.field_178784_b).isCanceled(); + if (result) { //Forge: Kept separate to simplify patch - if (this.playerController.func_178890_a(this.thePlayer, this.theWorld, itemstack, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec)) + if (this.field_71442_b.func_178890_a(this.field_71439_g, this.field_71441_e, itemstack, blockpos, this.field_71476_x.field_178784_b, this.field_71476_x.field_72307_f)) { flag = false; - this.thePlayer.swingItem(); + this.field_71439_g.func_71038_i(); } + } @@ -183,23 +183,23 @@ { @@ -1494,7 +1516,8 @@ { - ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem(); + ItemStack itemstack1 = this.field_71439_g.field_71071_by.func_70448_g(); -- if (itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) -+ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, theWorld, null, null).isCanceled(); -+ if (result && itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) +- if (itemstack1 != null && this.field_71442_b.func_78769_a(this.field_71439_g, this.field_71441_e, itemstack1)) ++ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_71439_g, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, field_71441_e, null, null).isCanceled(); ++ if (result && itemstack1 != null && this.field_71442_b.func_78769_a(this.field_71439_g, this.field_71441_e, itemstack1)) { - this.entityRenderer.itemRenderer.resetEquippedProgress2(); + this.field_71460_t.field_78516_c.func_78445_c(); } @@ -1598,6 +1621,8 @@ - --this.rightClickDelayTimer; + --this.field_71467_ac; } + net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreClientTick(); + - this.mcProfiler.startSection("gui"); + this.field_71424_I.func_76320_a("gui"); - if (!this.isGamePaused) + if (!this.field_71445_n) @@ -1690,6 +1715,8 @@ while (Mouse.next()) @@ -207,16 +207,16 @@ + if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue; + int i = Mouse.getEventButton(); - KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState()); + KeyBinding.func_74510_a(i - 100, Mouse.getEventButtonState()); @@ -1745,6 +1772,7 @@ - this.currentScreen.handleMouseInput(); + this.field_71462_r.func_146274_d(); } } + net.minecraftforge.fml.common.FMLCommonHandler.instance().fireMouseInput(); } - if (this.leftClickCounter > 0) + if (this.field_71429_W > 0) @@ -1923,6 +1951,7 @@ } } @@ -226,69 +226,69 @@ for (int l = 0; l < 9; ++l) @@ -2119,12 +2148,15 @@ - this.myNetworkManager.processReceivedPackets(); + this.field_71453_ak.func_74428_b(); } + net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostClientTick(); + - this.mcProfiler.endSection(); - this.systemTime = getSystemTime(); + this.field_71424_I.func_76319_b(); + this.field_71423_H = func_71386_F(); } - public void launchIntegratedServer(String folderName, String worldName, WorldSettings worldSettingsIn) + public void func_71371_a(String p_71371_1_, String p_71371_2_, WorldSettings p_71371_3_) { -+ net.minecraftforge.fml.client.FMLClientHandler.instance().startIntegratedServer(folderName, worldName, worldSettingsIn); - this.loadWorld((WorldClient)null); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().startIntegratedServer(p_71371_1_, p_71371_2_, p_71371_3_); + this.func_71403_a((WorldClient)null); System.gc(); - ISaveHandler isavehandler = this.saveLoader.getSaveLoader(folderName, false); + ISaveHandler isavehandler = this.field_71469_aa.func_75804_a(p_71371_1_, false); @@ -2160,6 +2192,12 @@ - while (!this.theIntegratedServer.serverIsInRunLoop()) + while (!this.field_71437_Z.func_71200_ad()) { + if (!net.minecraftforge.fml.common.StartupQuery.check()) + { -+ loadWorld(null); -+ displayGuiScreen(null); ++ func_71403_a(null); ++ func_147108_a(null); + return; + } - String s = this.theIntegratedServer.getUserMessage(); + String s = this.field_71437_Z.func_71195_b_(); if (s != null) @@ -2185,8 +2223,14 @@ - SocketAddress socketaddress = this.theIntegratedServer.getNetworkSystem().addLocalEndpoint(); - NetworkManager networkmanager = NetworkManager.provideLocalClient(socketaddress); - networkmanager.setNetHandler(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null)); -- networkmanager.sendPacket(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN)); -- networkmanager.sendPacket(new C00PacketLoginStart(this.getSession().getProfile())); -+ networkmanager.sendPacket(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN, true)); -+ com.mojang.authlib.GameProfile gameProfile = this.getSession().getProfile(); -+ if (!this.getSession().hasCachedProperties()) + SocketAddress socketaddress = this.field_71437_Z.func_147137_ag().func_151270_a(); + NetworkManager networkmanager = NetworkManager.func_150722_a(socketaddress); + networkmanager.func_150719_a(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null)); +- networkmanager.func_179290_a(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN)); +- networkmanager.func_179290_a(new C00PacketLoginStart(this.func_110432_I().func_148256_e())); ++ networkmanager.func_179290_a(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN, true)); ++ com.mojang.authlib.GameProfile gameProfile = this.func_110432_I().func_148256_e(); ++ if (!this.func_110432_I().hasCachedProperties()) + { -+ gameProfile = sessionService.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974. -+ this.getSession().setProperties(gameProfile.getProperties()); ++ 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.sendPacket(new C00PacketLoginStart(gameProfile)); - this.myNetworkManager = networkmanager; ++ networkmanager.func_179290_a(new C00PacketLoginStart(gameProfile)); + this.field_71453_ak = networkmanager; } @@ -2197,6 +2241,8 @@ - public void loadWorld(WorldClient worldClientIn, String loadingMessage) + public void func_71353_a(WorldClient p_71353_1_, String p_71353_2_) { -+ if (theWorld != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(theWorld)); ++ if (field_71441_e != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(field_71441_e)); + - if (worldClientIn == null) + if (p_71353_1_ == null) { - NetHandlerPlayClient nethandlerplayclient = this.getNetHandler(); + NetHandlerPlayClient nethandlerplayclient = this.func_147114_u(); @@ -2210,6 +2256,18 @@ { - this.theIntegratedServer.initiateShutdown(); - this.theIntegratedServer.setStaticInstance(); -+ if (loadingScreen != null) + this.field_71437_Z.func_71263_m(); + this.field_71437_Z.func_175592_a(); ++ if (field_71461_s != null) + { -+ this.loadingScreen.displayLoadingString(I18n.format("forge.client.shutdown.internal")); ++ this.field_71461_s.func_73719_c(I18n.func_135052_a("forge.client.shutdown.internal")); + } -+ while (!theIntegratedServer.isServerStopped()) ++ while (!field_71437_Z.func_71241_aa()) + { + try + { @@ -298,147 +298,147 @@ + } } - this.theIntegratedServer = null; + this.field_71437_Z = null; @@ -2232,6 +2290,7 @@ - this.ingameGUI.func_181029_i(); - this.setServerData((ServerData)null); - this.integratedServerIsRunning = false; -+ net.minecraftforge.fml.client.FMLClientHandler.instance().handleClientWorldClosing(this.theWorld); + this.field_71456_v.func_181029_i(); + this.func_71351_a((ServerData)null); + this.field_71455_al = false; ++ net.minecraftforge.fml.client.FMLClientHandler.instance().handleClientWorldClosing(this.field_71441_e); } - this.mcSoundHandler.stopSounds(); + this.field_147127_av.func_147690_c(); @@ -2336,126 +2395,10 @@ - if (this.objectMouseOver != null) + if (this.field_71476_x != null) { - boolean flag = this.thePlayer.capabilities.isCreativeMode; + boolean flag = this.field_71439_g.field_71075_bZ.field_75098_d; - int i = 0; - boolean flag1 = false; - TileEntity tileentity = null; - Item item; - -- if (this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) +- if (this.field_71476_x.field_72313_a == MovingObjectPosition.MovingObjectType.BLOCK) - { -- BlockPos blockpos = this.objectMouseOver.getBlockPos(); -- Block block = this.theWorld.getBlockState(blockpos).getBlock(); +- BlockPos blockpos = this.field_71476_x.func_178782_a(); +- Block block = this.field_71441_e.func_180495_p(blockpos).func_177230_c(); - -- if (block.getMaterial() == Material.air) +- if (block.func_149688_o() == Material.field_151579_a) - { - return; - } - -- item = block.getItem(this.theWorld, blockpos); +- item = block.func_180665_b(this.field_71441_e, blockpos); - - if (item == null) - { - return; - } - -- if (flag && GuiScreen.isCtrlKeyDown()) +- if (flag && GuiScreen.func_146271_m()) - { -- tileentity = this.theWorld.getTileEntity(blockpos); +- tileentity = this.field_71441_e.func_175625_s(blockpos); - } - -- Block block1 = item instanceof ItemBlock && !block.isFlowerPot() ? Block.getBlockFromItem(item) : block; -- i = block1.getDamageValue(this.theWorld, blockpos); -- flag1 = item.getHasSubtypes(); +- Block block1 = item instanceof ItemBlock && !block.func_149648_K() ? Block.func_149634_a(item) : block; +- i = block1.func_176222_j(this.field_71441_e, blockpos); +- flag1 = item.func_77614_k(); - } - else - { -- if (this.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !flag) +- if (this.field_71476_x.field_72313_a != MovingObjectPosition.MovingObjectType.ENTITY || this.field_71476_x.field_72308_g == null || !flag) - { - return; - } - -- if (this.objectMouseOver.entityHit instanceof EntityPainting) +- if (this.field_71476_x.field_72308_g instanceof EntityPainting) - { -- item = Items.painting; +- item = Items.field_151159_an; - } -- else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot) +- else if (this.field_71476_x.field_72308_g instanceof EntityLeashKnot) - { -- item = Items.lead; +- item = Items.field_151058_ca; - } -- else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) +- else if (this.field_71476_x.field_72308_g instanceof EntityItemFrame) - { -- EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit; -- ItemStack itemstack = entityitemframe.getDisplayedItem(); +- EntityItemFrame entityitemframe = (EntityItemFrame)this.field_71476_x.field_72308_g; +- ItemStack itemstack = entityitemframe.func_82335_i(); - - if (itemstack == null) - { -- item = Items.item_frame; +- item = Items.field_151160_bD; - } - else - { -- item = itemstack.getItem(); -- i = itemstack.getMetadata(); +- item = itemstack.func_77973_b(); +- i = itemstack.func_77960_j(); - flag1 = true; - } - } -- else if (this.objectMouseOver.entityHit instanceof EntityMinecart) +- else if (this.field_71476_x.field_72308_g instanceof EntityMinecart) - { -- EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit; +- EntityMinecart entityminecart = (EntityMinecart)this.field_71476_x.field_72308_g; - -- switch (entityminecart.getMinecartType()) +- switch (entityminecart.func_180456_s()) - { - case FURNACE: -- item = Items.furnace_minecart; +- item = Items.field_151109_aJ; - break; - case CHEST: -- item = Items.chest_minecart; +- item = Items.field_151108_aI; - break; - case TNT: -- item = Items.tnt_minecart; +- item = Items.field_151142_bV; - break; - case HOPPER: -- item = Items.hopper_minecart; +- item = Items.field_151140_bW; - break; - case COMMAND_BLOCK: -- item = Items.command_block_minecart; +- item = Items.field_151095_cc; - break; - default: -- item = Items.minecart; +- item = Items.field_151143_au; - } - } -- else if (this.objectMouseOver.entityHit instanceof EntityBoat) +- else if (this.field_71476_x.field_72308_g instanceof EntityBoat) - { -- item = Items.boat; +- item = Items.field_151124_az; - } -- else if (this.objectMouseOver.entityHit instanceof EntityArmorStand) +- else if (this.field_71476_x.field_72308_g instanceof EntityArmorStand) - { -- item = Items.armor_stand; +- item = Items.field_179565_cj; - } - else - { -- item = Items.spawn_egg; -- i = EntityList.getEntityID(this.objectMouseOver.entityHit); +- item = Items.field_151063_bx; +- i = EntityList.func_75619_a(this.field_71476_x.field_72308_g); - flag1 = true; - -- if (!EntityList.entityEggs.containsKey(Integer.valueOf(i))) +- if (!EntityList.field_75627_a.containsKey(Integer.valueOf(i))) - { - return; - } - } - } - - InventoryPlayer inventoryplayer = this.thePlayer.inventory; + InventoryPlayer inventoryplayer = this.field_71439_g.field_71071_by; - if (tileentity == null) - { -- inventoryplayer.setCurrentItem(item, i, flag1, flag); +- inventoryplayer.func_146030_a(item, i, flag1, flag); - } - else - { - ItemStack itemstack1 = this.func_181036_a(item, i, tileentity); -- inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, itemstack1); +- inventoryplayer.func_70299_a(inventoryplayer.field_70461_c, itemstack1); - } - -+ if (!net.minecraftforge.common.ForgeHooks.onPickBlock(this.objectMouseOver, this.thePlayer, this.theWorld)) return; ++ if (!net.minecraftforge.common.ForgeHooks.onPickBlock(this.field_71476_x, this.field_71439_g, this.field_71441_e)) return; + // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions if (flag) { - int j = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + inventoryplayer.currentItem; + int j = this.field_71439_g.field_71069_bz.field_75151_b.size() - 9 + inventoryplayer.field_70461_c; @@ -2756,18 +2699,8 @@ - public static int getGLMaximumTextureSize() + public static int func_71369_N() { - for (int i = 16384; i > 0; i >>= 1) - { @@ -456,4 +456,16 @@ + return net.minecraftforge.fml.client.SplashProgress.getMaxTextureSize(); } - public boolean isSnooperEnabled() + public boolean func_70002_Q() +@@ -2924,9 +2857,9 @@ + { + this.func_147108_a(new GuiYesNo(new GuiYesNoCallback() + { +- public void func_73878_a(boolean p_73878_1_, int p_73878_2_) ++ public void func_73878_a(boolean result, int id) + { +- if (p_73878_1_) ++ if (result) + { + Minecraft.this.func_152346_Z().func_152930_t(); + } diff --git a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch index 3d4c13816..90c31e791 100644 --- a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch +++ b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch @@ -10,32 +10,32 @@ { @@ -80,6 +81,7 @@ { - this.unloadSoundSystem(); - this.loadSoundSystem(); + this.func_148613_b(); + this.func_148608_i(); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundLoadEvent(this)); } - private synchronized void loadSoundSystem() + private synchronized void func_148608_i() @@ -316,6 +318,9 @@ } else { -+ sound = net.minecraftforge.client.ForgeHooksClient.playSound(this, sound); -+ if (sound == null) return; ++ p_148611_1_ = net.minecraftforge.client.ForgeHooksClient.playSound(this, p_148611_1_); ++ if (p_148611_1_ == null) return; + - SoundEventAccessorComposite soundeventaccessorcomposite = this.sndHandler.getSound(sound.getSoundLocation()); + SoundEventAccessorComposite soundeventaccessorcomposite = this.field_148622_c.func_147680_a(p_148611_1_.func_147650_b()); if (soundeventaccessorcomposite == null) @@ -357,10 +362,12 @@ - if (soundpoolentry.isStreamingSound()) + if (soundpoolentry.func_148648_d()) { - this.sndSystem.newStreamingSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlayStreamingSourceEvent(this, sound, s)); + this.field_148620_e.newStreamingSource(false, s, func_148612_a(resourcelocation), resourcelocation.toString(), flag, p_148611_1_.func_147649_g(), p_148611_1_.func_147654_h(), p_148611_1_.func_147651_i(), p_148611_1_.func_147656_j().func_148586_a(), f1); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlayStreamingSourceEvent(this, p_148611_1_, s)); } else { - this.sndSystem.newSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlaySoundSourceEvent(this, sound, s)); + this.field_148620_e.newSource(false, s, func_148612_a(resourcelocation), resourcelocation.toString(), flag, p_148611_1_.func_147649_g(), p_148611_1_.func_147654_h(), p_148611_1_.func_147651_i(), p_148611_1_.func_147656_j().func_148586_a(), f1); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlaySoundSourceEvent(this, p_148611_1_, s)); } - logger.debug(LOG_MARKER, "Playing sound {} for event {} as channel {}", new Object[] {soundpoolentry.getSoundPoolEntryLocation(), soundeventaccessorcomposite.getSoundEventLocation(), s}); + field_148621_b.debug(field_148623_a, "Playing sound {} for event {} as channel {}", new Object[] {soundpoolentry.func_148652_a(), soundeventaccessorcomposite.func_148729_c(), s}); diff --git a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch index 42c1d4605..8182064b7 100644 --- a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch +++ b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch @@ -1,27 +1,27 @@ --- ../src-base/minecraft/net/minecraft/client/entity/EntityPlayerSP.java +++ ../src-work/minecraft/net/minecraft/client/entity/EntityPlayerSP.java @@ -345,6 +345,15 @@ - this.mc.ingameGUI.getChatGUI().printChatMessage(chatComponent); + this.field_71159_c.field_71456_v.func_146158_b().func_146227_a(p_146105_1_); } + private boolean isHeadspaceFree(BlockPos pos, int height) + { + for (int y = 0; y < height; y++) + { -+ if (isOpenBlockSpace(pos.add(0, y, 0))) return false; ++ if (func_175162_d(pos.func_177982_a(0, y, 0))) return false; + } + return true; + } + - protected boolean pushOutOfBlocks(double x, double y, double z) + protected boolean func_145771_j(double p_145771_1_, double p_145771_3_, double p_145771_5_) { - if (this.noClip) + if (this.field_70145_X) @@ -357,30 +366,34 @@ - double d0 = x - (double)blockpos.getX(); - double d1 = z - (double)blockpos.getZ(); + double d0 = p_145771_1_ - (double)blockpos.func_177958_n(); + double d1 = p_145771_5_ - (double)blockpos.func_177952_p(); -- if (!this.isOpenBlockSpace(blockpos)) -+ int entHeight = Math.max(Math.round(this.height), 1); +- if (!this.func_175162_d(blockpos)) ++ int entHeight = Math.max(Math.round(this.field_70131_O), 1); + + boolean inTranslucentBlock = this.isHeadspaceFree(blockpos, entHeight); + @@ -30,42 +30,42 @@ int i = -1; double d2 = 9999.0D; -- if (this.isOpenBlockSpace(blockpos.west()) && d0 < d2) -+ if (!this.isHeadspaceFree(blockpos.west(), entHeight) && d0 < d2) +- if (this.func_175162_d(blockpos.func_177976_e()) && d0 < d2) ++ if (!this.isHeadspaceFree(blockpos.func_177976_e(), entHeight) && d0 < d2) { d2 = d0; i = 0; } -- if (this.isOpenBlockSpace(blockpos.east()) && 1.0D - d0 < d2) -+ if (!this.isHeadspaceFree(blockpos.east(), entHeight) && 1.0D - d0 < d2) +- if (this.func_175162_d(blockpos.func_177974_f()) && 1.0D - d0 < d2) ++ if (!this.isHeadspaceFree(blockpos.func_177974_f(), entHeight) && 1.0D - d0 < d2) { d2 = 1.0D - d0; i = 1; } -- if (this.isOpenBlockSpace(blockpos.north()) && d1 < d2) -+ if (!this.isHeadspaceFree(blockpos.north(), entHeight) && d1 < d2) +- if (this.func_175162_d(blockpos.func_177978_c()) && d1 < d2) ++ if (!this.isHeadspaceFree(blockpos.func_177978_c(), entHeight) && d1 < d2) { d2 = d1; i = 4; } -- if (this.isOpenBlockSpace(blockpos.south()) && 1.0D - d1 < d2) -+ if (!this.isHeadspaceFree(blockpos.south(), entHeight) && 1.0D - d1 < d2) +- if (this.func_175162_d(blockpos.func_177968_d()) && 1.0D - d1 < d2) ++ if (!this.isHeadspaceFree(blockpos.func_177968_d(), entHeight) && 1.0D - d1 < d2) { d2 = 1.0D - d1; i = 5; @@ -448,6 +461,12 @@ - public void playSound(String name, float volume, float pitch) + public void func_85030_a(String p_85030_1_, float p_85030_2_, float p_85030_3_) { -+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, name, volume, pitch); ++ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_85030_1_, p_85030_2_, p_85030_3_); + if (event.isCanceled() || event.name == null) return; -+ name = event.name; -+ volume = event.newVolume; -+ pitch = event.newPitch; ++ p_85030_1_ = event.name; ++ p_85030_2_ = event.newVolume; ++ p_85030_3_ = event.newPitch; + - this.worldObj.playSound(this.posX, this.posY, this.posZ, name, volume, pitch, false); + this.field_70170_p.func_72980_b(this.field_70165_t, this.field_70163_u, this.field_70161_v, p_85030_1_, p_85030_2_, p_85030_3_, false); } diff --git a/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch b/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch index 04062e634..7fc54e8f0 100644 --- a/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch @@ -1,28 +1,28 @@ --- ../src-base/minecraft/net/minecraft/client/gui/FontRenderer.java +++ ../src-work/minecraft/net/minecraft/client/gui/FontRenderer.java @@ -57,7 +57,7 @@ - this.locationFontTexture = p_i1035_2_; - this.renderEngine = p_i1035_3_; - this.unicodeFlag = p_i1035_4_; -- p_i1035_3_.bindTexture(this.locationFontTexture); -+ bindTexture(this.locationFontTexture); + this.field_111273_g = p_i1035_2_; + this.field_78298_i = p_i1035_3_; + this.field_78293_l = p_i1035_4_; +- p_i1035_3_.func_110577_a(this.field_111273_g); ++ bindTexture(this.field_111273_g); for (int i = 0; i < 32; ++i) { @@ -97,6 +97,7 @@ - public void onResourceManagerReload(IResourceManager resourceManager) + public void func_110549_a(IResourceManager p_110549_1_) { - this.readFontTexture(); -+ this.readGlyphSizes(); + this.func_111272_d(); ++ this.func_98306_d(); } - private void readFontTexture() + private void func_111272_d() @@ -105,7 +106,7 @@ try { -- bufferedimage = TextureUtil.readBufferedImage(Minecraft.getMinecraft().getResourceManager().getResource(this.locationFontTexture).getInputStream()); -+ bufferedimage = TextureUtil.readBufferedImage(getResourceInputStream(this.locationFontTexture)); +- bufferedimage = TextureUtil.func_177053_a(Minecraft.func_71410_x().func_110442_L().func_110536_a(this.field_111273_g).func_110527_b()); ++ bufferedimage = TextureUtil.func_177053_a(getResourceInputStream(this.field_111273_g)); } catch (IOException ioexception) { @@ -30,53 +30,53 @@ try { -- inputstream = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("font/glyph_sizes.bin")).getInputStream(); +- inputstream = Minecraft.func_71410_x().func_110442_L().func_110536_a(new ResourceLocation("font/glyph_sizes.bin")).func_110527_b(); + inputstream = getResourceInputStream(new ResourceLocation("font/glyph_sizes.bin")); - inputstream.read(this.glyphWidth); + inputstream.read(this.field_78287_e); } catch (IOException ioexception) @@ -196,7 +197,7 @@ int i = p_78266_1_ % 16 * 8; int j = p_78266_1_ / 16 * 8; int k = p_78266_2_ ? 1 : 0; -- this.renderEngine.bindTexture(this.locationFontTexture); -+ bindTexture(this.locationFontTexture); - int l = this.charWidth[p_78266_1_]; +- this.field_78298_i.func_110577_a(this.field_111273_g); ++ bindTexture(this.field_111273_g); + int l = this.field_78286_d[p_78266_1_]; float f = (float)l - 0.01F; GL11.glBegin(GL11.GL_TRIANGLE_STRIP); @@ -224,7 +225,7 @@ - private void loadGlyphTexture(int p_78257_1_) + private void func_78257_a(int p_78257_1_) { -- this.renderEngine.bindTexture(this.getUnicodePageLocation(p_78257_1_)); -+ bindTexture(this.getUnicodePageLocation(p_78257_1_)); +- this.field_78298_i.func_110577_a(this.func_111271_a(p_78257_1_)); ++ bindTexture(this.func_111271_a(p_78257_1_)); } - protected float renderUnicodeChar(char p_78277_1_, boolean p_78277_2_) + protected float func_78277_a(char p_78277_1_, boolean p_78277_2_) @@ -271,7 +272,7 @@ - public int drawString(String p_175065_1_, float p_175065_2_, float p_175065_3_, int p_175065_4_, boolean p_175065_5_) + public int func_175065_a(String p_175065_1_, float p_175065_2_, float p_175065_3_, int p_175065_4_, boolean p_175065_5_) { -- GlStateManager.enableAlpha(); +- GlStateManager.func_179141_d(); + enableAlpha(); - this.resetStyles(); + this.func_78265_b(); int i; @@ -341,7 +342,7 @@ - int j1 = this.colorCode[i1]; - this.textColor = j1; -- GlStateManager.color((float)(j1 >> 16) / 255.0F, (float)(j1 >> 8 & 255) / 255.0F, (float)(j1 & 255) / 255.0F, this.alpha); -+ setColor((float)(j1 >> 16) / 255.0F, (float)(j1 >> 8 & 255) / 255.0F, (float)(j1 & 255) / 255.0F, this.alpha); + int j1 = this.field_78285_g[i1]; + this.field_78304_r = j1; +- GlStateManager.func_179131_c((float)(j1 >> 16) / 255.0F, (float)(j1 >> 8 & 255) / 255.0F, (float)(j1 & 255) / 255.0F, this.field_78305_q); ++ setColor((float)(j1 >> 16) / 255.0F, (float)(j1 >> 8 & 255) / 255.0F, (float)(j1 & 255) / 255.0F, this.field_78305_q); } else if (i1 == 16) { @@ -370,7 +371,7 @@ - this.strikethroughStyle = false; - this.underlineStyle = false; - this.italicStyle = false; -- GlStateManager.color(this.red, this.blue, this.green, this.alpha); -+ setColor(this.red, this.blue, this.green, this.alpha); + this.field_78299_w = false; + this.field_78300_v = false; + this.field_78301_u = false; +- GlStateManager.func_179131_c(this.field_78291_n, this.field_78292_o, this.field_78306_p, this.field_78305_q); ++ setColor(this.field_78291_n, this.field_78292_o, this.field_78306_p, this.field_78305_q); } ++i; @@ -84,9 +84,9 @@ c0 = c1; } -- float f1 = this.unicodeFlag ? 0.5F : 1.0F; -+ float f1 = getCharWidth(c0) / 32f; - boolean flag = (c0 == 0 || j == -1 || this.unicodeFlag) && p_78255_2_; +- float f1 = this.field_78293_l ? 0.5F : 1.0F; ++ float f1 = func_78263_a(c0) / 32f; + boolean flag = (c0 == 0 || j == -1 || this.field_78293_l) && p_78255_2_; if (flag) @@ -436,7 +437,16 @@ @@ -103,21 +103,21 @@ + { + { + - if (this.strikethroughStyle) + if (this.field_78299_w) { - Tessellator tessellator = Tessellator.getInstance(); + Tessellator tessellator = Tessellator.func_178181_a(); @@ -509,7 +519,7 @@ - this.blue = (float)(p_180455_4_ >> 8 & 255) / 255.0F; - this.green = (float)(p_180455_4_ & 255) / 255.0F; - this.alpha = (float)(p_180455_4_ >> 24 & 255) / 255.0F; -- GlStateManager.color(this.red, this.blue, this.green, this.alpha); -+ setColor(this.red, this.blue, this.green, this.alpha); - this.posX = p_180455_2_; - this.posY = p_180455_3_; - this.renderStringAtPos(p_180455_1_, p_180455_5_); + this.field_78292_o = (float)(p_180455_4_ >> 8 & 255) / 255.0F; + this.field_78306_p = (float)(p_180455_4_ & 255) / 255.0F; + this.field_78305_q = (float)(p_180455_4_ >> 24 & 255) / 255.0F; +- GlStateManager.func_179131_c(this.field_78291_n, this.field_78292_o, this.field_78306_p, this.field_78305_q); ++ setColor(this.field_78291_n, this.field_78292_o, this.field_78306_p, this.field_78305_q); + this.field_78295_j = p_180455_2_; + this.field_78296_k = p_180455_3_; + this.func_78255_a(p_180455_1_, p_180455_5_); @@ -588,11 +598,6 @@ - int j = this.glyphWidth[p_78263_1_] >>> 4; - int k = this.glyphWidth[p_78263_1_] & 15; + int j = this.field_78287_e[p_78263_1_] >>> 4; + int k = this.field_78287_e[p_78263_1_] & 15; - if (k > 7) - { @@ -128,29 +128,29 @@ ++k; return (k - j) / 2 + 1; @@ -846,6 +851,26 @@ - return this.bidiFlag; + return this.field_78294_m; } + protected void setColor(float r, float g, float b, float a) + { -+ GlStateManager.color(r,g,b,a); ++ GlStateManager.func_179131_c(r,g,b,a); + } + + protected void enableAlpha() + { -+ GlStateManager.enableAlpha(); ++ GlStateManager.func_179141_d(); + } + + protected void bindTexture(ResourceLocation location) + { -+ renderEngine.bindTexture(location); ++ field_78298_i.func_110577_a(location); + } + + protected InputStream getResourceInputStream(ResourceLocation location) throws IOException + { -+ return Minecraft.getMinecraft().getResourceManager().getResource(location).getInputStream(); ++ return Minecraft.func_71410_x().func_110442_L().func_110536_a(location).func_110527_b(); + } + - public int getColorCode(char p_175064_1_) + public int func_175064_b(char p_175064_1_) { - return this.colorCode["0123456789abcdef".indexOf(p_175064_1_)]; + return this.field_78285_g["0123456789abcdef".indexOf(p_175064_1_)]; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch index ee9c09180..b212709d6 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiButton.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiButton.java @@ -21,6 +21,7 @@ - public boolean enabled; - public boolean visible; - protected boolean hovered; + public boolean field_146124_l; + public boolean field_146125_m; + protected boolean field_146123_n; + public int packedFGColour; //FML - public GuiButton(int buttonId, int x, int y, String buttonText) + public GuiButton(int p_i1020_1_, int p_i1020_2_, int p_i1020_3_, String p_i1020_4_) { @@ -74,6 +75,11 @@ - this.mouseDragged(mc, mouseX, mouseY); + this.func_146119_b(p_146112_1_, p_146112_2_, p_146112_3_); int j = 14737632; + if (packedFGColour != 0) @@ -17,6 +17,6 @@ + j = packedFGColour; + } + else - if (!this.enabled) + if (!this.field_146124_l) { j = 10526880; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch index 3b956b4e3..8b16ab92b 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch @@ -1,24 +1,24 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiChat.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiChat.java @@ -215,13 +215,14 @@ - this.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(stringbuilder.toString()), 1); + this.field_146297_k.field_71456_v.func_146158_b().func_146234_a(new ChatComponentText(stringbuilder.toString()), 1); } -- this.inputField.writeText((String)this.foundPlayerNames.get(this.autocompleteIndex++)); -+ this.inputField.writeText(net.minecraft.util.EnumChatFormatting.getTextWithoutFormattingCodes((String)this.foundPlayerNames.get(this.autocompleteIndex++))); +- this.field_146415_a.func_146191_b((String)this.field_146412_t.get(this.field_146413_s++)); ++ this.field_146415_a.func_146191_b(net.minecraft.util.EnumChatFormatting.func_110646_a((String)this.field_146412_t.get(this.field_146413_s++))); } - private void sendAutocompleteRequest(String p_146405_1_, String p_146405_2_) + private void func_146405_a(String p_146405_1_, String p_146405_2_) { if (p_146405_1_.length() >= 1) { + net.minecraftforge.client.ClientCommandHandler.instance.autoComplete(p_146405_1_, p_146405_2_); BlockPos blockpos = null; - if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + if (this.field_146297_k.field_71476_x != null && this.field_146297_k.field_71476_x.field_72313_a == MovingObjectPosition.MovingObjectType.BLOCK) @@ -281,6 +282,12 @@ - this.playerNamesFound = false; - this.foundPlayerNames.clear(); + this.field_146417_i = false; + this.field_146412_t.clear(); + String[] complete = net.minecraftforge.client.ClientCommandHandler.instance.latestAutoComplete; + if (complete != null) diff --git a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch index 2555e2a26..4f9d297f4 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch @@ -4,33 +4,33 @@ } } -+ WorldType.worldTypes[this.selectedIndex].onGUICreateWorldPress(); ++ WorldType.field_77139_a[this.field_146331_K].onGUICreateWorldPress(); + - WorldSettings.GameType worldsettings$gametype = WorldSettings.GameType.getByName(this.field_146342_r); - WorldSettings worldsettings = new WorldSettings(i, worldsettings$gametype, this.field_146341_s, this.field_146337_w, WorldType.worldTypes[this.selectedIndex]); - worldsettings.setWorldName(this.chunkProviderSettingsJson); + WorldSettings.GameType worldsettings$gametype = WorldSettings.GameType.func_77142_a(this.field_146342_r); + WorldSettings worldsettings = new WorldSettings(i, worldsettings$gametype, this.field_146341_s, this.field_146337_w, WorldType.field_77139_a[this.field_146331_K]); + worldsettings.func_82750_a(this.field_146334_a); @@ -312,14 +314,7 @@ } - else if (button.id == 8) + else if (p_146284_1_.field_146127_k == 8) { -- if (WorldType.worldTypes[this.selectedIndex] == WorldType.FLAT) +- if (WorldType.field_77139_a[this.field_146331_K] == WorldType.field_77138_c) - { -- this.mc.displayGuiScreen(new GuiCreateFlatWorld(this, this.chunkProviderSettingsJson)); +- this.field_146297_k.func_147108_a(new GuiCreateFlatWorld(this, this.field_146334_a)); - } - else - { -- this.mc.displayGuiScreen(new GuiCustomizeWorldScreen(this, this.chunkProviderSettingsJson)); +- this.field_146297_k.func_147108_a(new GuiCustomizeWorldScreen(this, this.field_146334_a)); - } -+ WorldType.worldTypes[this.selectedIndex].onCustomizeButton(mc, this); ++ WorldType.field_77139_a[this.field_146331_K].onCustomizeButton(field_146297_k, this); } } } @@ -371,7 +366,7 @@ - this.btnBonusItems.visible = this.field_146344_y; - this.btnMapType.visible = this.field_146344_y; - this.btnAllowCommands.visible = this.field_146344_y; -- this.btnCustomizeType.visible = this.field_146344_y && (WorldType.worldTypes[this.selectedIndex] == WorldType.FLAT || WorldType.worldTypes[this.selectedIndex] == WorldType.CUSTOMIZED); -+ this.btnCustomizeType.visible = this.field_146344_y && WorldType.worldTypes[this.selectedIndex].isCustomizable(); + this.field_146326_C.field_146125_m = this.field_146344_y; + this.field_146320_D.field_146125_m = this.field_146344_y; + this.field_146321_E.field_146125_m = this.field_146344_y; +- this.field_146322_F.field_146125_m = this.field_146344_y && (WorldType.field_77139_a[this.field_146331_K] == WorldType.field_77138_c || WorldType.field_77139_a[this.field_146331_K] == WorldType.field_180271_f); ++ this.field_146322_F.field_146125_m = this.field_146344_y && WorldType.field_77139_a[this.field_146331_K].isCustomizable(); } this.func_146319_h(); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch index aef607d2c..492f39e3e 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch @@ -2,28 +2,28 @@ +++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngameMenu.java @@ -30,8 +30,9 @@ - this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 24 + i, I18n.format("menu.returnToGame", new Object[0]))); - this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + i, 98, 20, I18n.format("menu.options", new Object[0]))); -+ this.buttonList.add(new GuiButton(12, this.width / 2 + 2, this.height / 4 + 96 + i, 98, 20, I18n.format("fml.menu.modoptions"))); + this.field_146292_n.add(new GuiButton(4, this.field_146294_l / 2 - 100, this.field_146295_m / 4 + 24 + i, I18n.func_135052_a("menu.returnToGame", new Object[0]))); + this.field_146292_n.add(new GuiButton(0, this.field_146294_l / 2 - 100, this.field_146295_m / 4 + 96 + i, 98, 20, I18n.func_135052_a("menu.options", new Object[0]))); ++ this.field_146292_n.add(new GuiButton(12, this.field_146294_l / 2 + 2, this.field_146295_m / 4 + 96 + i, 98, 20, I18n.func_135052_a("fml.menu.modoptions"))); GuiButton guibutton; -- this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 + 2, this.height / 4 + 96 + i, 98, 20, I18n.format("menu.shareToLan", new Object[0]))); -+ this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 - 100, this.height / 4 + 72 + i, 200, 20, I18n.format("menu.shareToLan", new Object[0]))); - this.buttonList.add(new GuiButton(5, this.width / 2 - 100, this.height / 4 + 48 + i, 98, 20, I18n.format("gui.achievements", new Object[0]))); - this.buttonList.add(new GuiButton(6, this.width / 2 + 2, this.height / 4 + 48 + i, 98, 20, I18n.format("gui.stats", new Object[0]))); - guibutton.enabled = this.mc.isSingleplayer() && !this.mc.getIntegratedServer().getPublic(); +- this.field_146292_n.add(guibutton = new GuiButton(7, this.field_146294_l / 2 + 2, this.field_146295_m / 4 + 96 + i, 98, 20, I18n.func_135052_a("menu.shareToLan", new Object[0]))); ++ this.field_146292_n.add(guibutton = new GuiButton(7, this.field_146294_l / 2 - 100, this.field_146295_m / 4 + 72 + i, 200, 20, I18n.func_135052_a("menu.shareToLan", new Object[0]))); + this.field_146292_n.add(new GuiButton(5, this.field_146294_l / 2 - 100, this.field_146295_m / 4 + 48 + i, 98, 20, I18n.func_135052_a("gui.achievements", new Object[0]))); + this.field_146292_n.add(new GuiButton(6, this.field_146294_l / 2 + 2, this.field_146295_m / 4 + 48 + i, 98, 20, I18n.func_135052_a("gui.stats", new Object[0]))); + guibutton.field_146124_l = this.field_146297_k.func_71356_B() && !this.field_146297_k.func_71401_C().func_71344_c(); @@ -74,13 +75,19 @@ - this.mc.setIngameFocus(); + this.field_146297_k.func_71381_h(); break; case 5: -+ if (this.mc.thePlayer != null) - this.mc.displayGuiScreen(new GuiAchievements(this, this.mc.thePlayer.getStatFileWriter())); ++ if (this.field_146297_k.field_71439_g != null) + this.field_146297_k.func_147108_a(new GuiAchievements(this, this.field_146297_k.field_71439_g.func_146107_m())); break; case 6: -+ if (this.mc.thePlayer != null) - this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter())); ++ if (this.field_146297_k.field_71439_g != null) + this.field_146297_k.func_147108_a(new GuiStats(this, this.field_146297_k.field_71439_g.func_146107_m())); break; case 7: - this.mc.displayGuiScreen(new GuiShareToLan(this)); + this.field_146297_k.func_147108_a(new GuiShareToLan(this)); + break; + case 12: + net.minecraftforge.fml.client.FMLClientHandler.instance().showInGameModOptions(this); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch index 35d380457..cad9873e2 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch @@ -1,44 +1,44 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiMainMenu.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiMainMenu.java @@ -197,6 +197,11 @@ - this.buttonList.add(new GuiButton(1, this.width / 2 - 100, p_73969_1_, I18n.format("menu.singleplayer", new Object[0]))); - this.buttonList.add(new GuiButton(2, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.format("menu.multiplayer", new Object[0]))); - this.buttonList.add(this.realmsButton = new GuiButton(14, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.format("menu.online", new Object[0]))); -+ GuiButton fmlModButton = new GuiButton(6, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.format("fml.menu.mods")); -+ fmlModButton.xPosition = this.width / 2 + 2; -+ realmsButton.width = 98; -+ fmlModButton.width = 98; -+ this.buttonList.add(fmlModButton); + this.field_146292_n.add(new GuiButton(1, this.field_146294_l / 2 - 100, p_73969_1_, I18n.func_135052_a("menu.singleplayer", new Object[0]))); + this.field_146292_n.add(new GuiButton(2, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.func_135052_a("menu.multiplayer", new Object[0]))); + this.field_146292_n.add(this.field_175372_K = new GuiButton(14, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.func_135052_a("menu.online", new Object[0]))); ++ GuiButton fmlModButton = new GuiButton(6, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.func_135052_a("fml.menu.mods")); ++ fmlModButton.field_146128_h = this.field_146294_l / 2 + 2; ++ field_175372_K.field_146120_f = 98; ++ fmlModButton.field_146120_f = 98; ++ this.field_146292_n.add(fmlModButton); } - private void addDemoButtons(int p_73972_1_, int p_73972_2_) + private void func_73972_b(int p_73972_1_, int p_73972_2_) @@ -244,6 +249,11 @@ - this.mc.shutdown(); + this.field_146297_k.func_71400_g(); } -+ if (button.id == 6) ++ if (p_146284_1_.field_146127_k == 6) + { -+ this.mc.displayGuiScreen(new net.minecraftforge.fml.client.GuiModList(this)); ++ this.field_146297_k.func_147108_a(new net.minecraftforge.fml.client.GuiModList(this)); + } + - if (button.id == 11) + if (p_146284_1_.field_146127_k == 11) { - this.mc.launchIntegratedServer("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings); + this.field_146297_k.func_71371_a("Demo_World", "Demo_World", DemoWorldServer.field_73071_a); @@ -489,7 +499,16 @@ s = s + " Demo"; } -- this.drawString(this.fontRendererObj, s, 2, this.height - 10, -1); +- this.func_73731_b(this.field_146289_q, s, 2, this.field_146295_m - 10, -1); + java.util.List brandings = com.google.common.collect.Lists.reverse(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(true)); + for (int brdline = 0; brdline < brandings.size(); brdline++) + { + String brd = brandings.get(brdline); + if (!com.google.common.base.Strings.isNullOrEmpty(brd)) + { -+ this.drawString(this.fontRendererObj, brd, 2, this.height - ( 10 + brdline * (this.fontRendererObj.FONT_HEIGHT + 1)), 16777215); ++ this.func_73731_b(this.field_146289_q, brd, 2, this.field_146295_m - ( 10 + brdline * (this.field_146289_q.field_78288_b + 1)), 16777215); + } + } -+ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, this.fontRendererObj, this.width, this.height); ++ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, this.field_146289_q, this.field_146294_l, this.field_146295_m); String s1 = "Copyright Mojang AB. Do not distribute!"; - this.drawString(this.fontRendererObj, s1, this.width - this.fontRendererObj.getStringWidth(s1) - 2, this.height - 10, -1); + this.func_73731_b(this.field_146289_q, s1, this.field_146294_l - this.field_146289_q.func_78256_a(s1) - 2, this.field_146295_m - 10, -1); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch index 4e8b2f3eb..fadee0c78 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch @@ -1,19 +1,19 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiMultiplayer.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiMultiplayer.java @@ -40,6 +40,7 @@ - public GuiMultiplayer(GuiScreen parentScreen) + public GuiMultiplayer(GuiScreen p_i1040_1_) { - this.parentScreen = parentScreen; + this.field_146798_g = p_i1040_1_; + net.minecraftforge.fml.client.FMLClientHandler.instance().setupServerList(); } - public void initGui() + public void func_73866_w_() @@ -372,7 +373,7 @@ - private void connectToServer(ServerData server) + private void func_146791_a(ServerData p_146791_1_) { -- this.mc.displayGuiScreen(new GuiConnecting(this, this.mc, server)); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServer(this, server); +- this.field_146297_k.func_147108_a(new GuiConnecting(this, this.field_146297_k, p_146791_1_)); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServer(this, p_146791_1_); } - public void selectServer(int index) + public void func_146790_a(int p_146790_1_) diff --git a/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch index 73cf65cef..0841e6d3c 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch @@ -2,11 +2,11 @@ +++ ../src-work/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java @@ -176,6 +176,9 @@ long l = j - k; - List list = Lists.newArrayList(new String[] {String.format("Java: %s %dbit", new Object[]{System.getProperty("java.version"), Integer.valueOf(this.mc.isJava64bit() ? 64 : 32)}), String.format("Mem: % 2d%% %03d/%03dMB", new Object[]{Long.valueOf(l * 100L / i), Long.valueOf(bytesToMb(l)), Long.valueOf(bytesToMb(i))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(j * 100L / i), Long.valueOf(bytesToMb(j))}), "", String.format("CPU: %s", new Object[]{OpenGlHelper.func_183029_j()}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GL11.glGetString(GL11.GL_VENDOR)}), GL11.glGetString(GL11.GL_RENDERER), GL11.glGetString(GL11.GL_VERSION)}); + List list = Lists.newArrayList(new String[] {String.format("Java: %s %dbit", new Object[]{System.getProperty("java.version"), Integer.valueOf(this.field_175242_a.func_147111_S() ? 64 : 32)}), String.format("Mem: % 2d%% %03d/%03dMB", new Object[]{Long.valueOf(l * 100L / i), Long.valueOf(func_175240_a(l)), Long.valueOf(func_175240_a(i))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(j * 100L / i), Long.valueOf(func_175240_a(j))}), "", String.format("CPU: %s", new Object[]{OpenGlHelper.func_183029_j()}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GL11.glGetString(GL11.GL_VENDOR)}), GL11.glGetString(GL11.GL_RENDERER), GL11.glGetString(GL11.GL_VERSION)}); + list.add(""); + list.addAll(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(false)); + - if (this.isReducedDebug()) + if (this.func_175236_d()) { return list; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch index f97ed83fd..4496af75e 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch @@ -4,86 +4,86 @@ } } -- this.drawHoveringText(list, x, y); -+ FontRenderer font = stack.getItem().getFontRenderer(stack); -+ this.drawHoveringText(list, x, y, (font == null ? fontRendererObj : font)); +- this.func_146283_a(list, p_146285_2_, p_146285_3_); ++ FontRenderer font = p_146285_1_.func_77973_b().getFontRenderer(p_146285_1_); ++ this.drawHoveringText(list, p_146285_2_, p_146285_3_, (font == null ? field_146289_q : font)); } - protected void drawCreativeTabHoveringText(String tabName, int mouseX, int mouseY) + protected void func_146279_a(String p_146279_1_, int p_146279_2_, int p_146279_3_) @@ -153,6 +154,11 @@ - protected void drawHoveringText(List textLines, int x, int y) + protected void func_146283_a(List p_146283_1_, int p_146283_2_, int p_146283_3_) { -+ drawHoveringText(textLines, x, y, fontRendererObj); ++ drawHoveringText(p_146283_1_, p_146283_2_, p_146283_3_, field_146289_q); + } + -+ protected void drawHoveringText(List textLines, int x, int y, FontRenderer font) ++ protected void drawHoveringText(List p_146283_1_, int p_146283_2_, int p_146283_3_, FontRenderer font) + { - if (!textLines.isEmpty()) + if (!p_146283_1_.isEmpty()) { - GlStateManager.disableRescaleNormal(); + GlStateManager.func_179101_C(); @@ -163,7 +169,7 @@ - for (String s : textLines) + for (String s : p_146283_1_) { -- int j = this.fontRendererObj.getStringWidth(s); -+ int j = font.getStringWidth(s); +- int j = this.field_146289_q.func_78256_a(s); ++ int j = font.func_78256_a(s); if (j > i) { @@ -208,7 +214,7 @@ - for (int k1 = 0; k1 < textLines.size(); ++k1) + for (int k1 = 0; k1 < p_146283_1_.size(); ++k1) { - String s1 = (String)textLines.get(k1); -- this.fontRendererObj.drawStringWithShadow(s1, (float)l1, (float)i2, -1); -+ font.drawStringWithShadow(s1, (float)l1, (float)i2, -1); + String s1 = (String)p_146283_1_.get(k1); +- this.field_146289_q.func_175063_a(s1, (float)l1, (float)i2, -1); ++ font.func_175063_a(s1, (float)l1, (float)i2, -1); if (k1 == 0) { @@ -436,6 +442,7 @@ { - this.mc.ingameGUI.getChatGUI().addToSentMessages(msg); + this.field_146297_k.field_71456_v.func_146158_b().func_146239_a(p_175281_1_); } -+ if (net.minecraftforge.client.ClientCommandHandler.instance.executeCommand(mc.thePlayer, msg) != 0) return; ++ if (net.minecraftforge.client.ClientCommandHandler.instance.func_71556_a(field_146297_k.field_71439_g, p_175281_1_) != 0) return; - this.mc.thePlayer.sendChatMessage(msg); + this.field_146297_k.field_71439_g.func_71165_d(p_175281_1_); } @@ -450,9 +457,15 @@ - if (guibutton.mousePressed(this.mc, mouseX, mouseY)) + if (guibutton.func_146116_c(this.field_146297_k, p_73864_1_, p_73864_2_)) { -+ net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Pre event = new net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Pre(this, guibutton, this.buttonList); ++ net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Pre event = new net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Pre(this, guibutton, this.field_146292_n); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) + break; + guibutton = event.button; - this.selectedButton = guibutton; - guibutton.playPressSound(this.mc.getSoundHandler()); - this.actionPerformed(guibutton); -+ if (this.equals(this.mc.currentScreen)) -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Post(this, event.button, this.buttonList)); + this.field_146290_a = guibutton; + guibutton.func_146113_a(this.field_146297_k.func_147118_V()); + this.func_146284_a(guibutton); ++ if (this.equals(this.field_146297_k.field_71462_r)) ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Post(this, event.button, this.field_146292_n)); } } } @@ -482,8 +495,12 @@ - this.fontRendererObj = mc.fontRendererObj; - this.width = width; - this.height = height; -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Pre(this, this.buttonList))) + this.field_146289_q = p_146280_1_.field_71466_p; + this.field_146294_l = p_146280_2_; + this.field_146295_m = p_146280_3_; ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Pre(this, this.field_146292_n))) + { - this.buttonList.clear(); - this.initGui(); + this.field_146292_n.clear(); + this.func_73866_w_(); + } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Post(this, this.buttonList)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Post(this, this.field_146292_n)); } - public void initGui() + public void func_73866_w_() @@ -496,7 +513,9 @@ { while (Mouse.next()) { + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Pre(this))) continue; - this.handleMouseInput(); -+ if (this.equals(this.mc.currentScreen)) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Post(this)); + this.func_146274_d(); ++ if (this.equals(this.field_146297_k.field_71462_r)) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Post(this)); } } @@ -92,8 +92,8 @@ while (Keyboard.next()) { + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Pre(this))) continue; - this.handleKeyboardInput(); -+ if (this.equals(this.mc.currentScreen)) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Post(this)); + this.func_146282_l(); ++ if (this.equals(this.field_146297_k.field_71462_r)) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Post(this)); } } } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch index 8327deb5f..d1ee63656 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/client/gui/GuiSelectWorld.java @@ -186,7 +186,7 @@ - if (this.mc.getSaveLoader().canLoadWorld(s)) + if (this.field_146297_k.func_71359_d().func_90033_f(s)) { -- this.mc.launchIntegratedServer(s, s1, (WorldSettings)null); +- this.field_146297_k.func_71371_a(s, s1, (WorldSettings)null); + net.minecraftforge.fml.client.FMLClientHandler.instance().tryLoadExistingWorld(this, s, s1); } } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch index a179369e2..11a0b4f04 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch @@ -4,8 +4,8 @@ if (!s.isEmpty()) { -- this.mc.thePlayer.sendChatMessage(s); -+ this.sendChatMessage(s); // Forge: fix vanilla not adding messages to the sent list while sleeping +- this.field_146297_k.field_71439_g.func_71165_d(s); ++ this.func_175275_f(s); // Forge: fix vanilla not adding messages to the sent list while sleeping } - this.inputField.setText(""); + this.field_146415_a.func_146180_a(""); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch index 726608794..d4b2b22e5 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch @@ -1,39 +1,39 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiSlot.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiSlot.java @@ -181,15 +181,8 @@ - GlStateManager.disableFog(); - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); -- this.mc.getTextureManager().bindTexture(Gui.optionsBackground); -- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.func_179106_n(); + Tessellator tessellator = Tessellator.func_178181_a(); + WorldRenderer worldrenderer = tessellator.func_178180_c(); +- this.field_148161_k.func_110434_K().func_110577_a(Gui.field_110325_k); +- GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); - float f = 32.0F; - worldrenderer.func_181668_a(7, DefaultVertexFormats.field_181709_i); -- worldrenderer.func_181662_b((double)this.left, (double)this.bottom, 0.0D).func_181673_a((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); -- worldrenderer.func_181662_b((double)this.right, (double)this.bottom, 0.0D).func_181673_a((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); -- worldrenderer.func_181662_b((double)this.right, (double)this.top, 0.0D).func_181673_a((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); -- worldrenderer.func_181662_b((double)this.left, (double)this.top, 0.0D).func_181673_a((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); -- tessellator.draw(); +- worldrenderer.func_181662_b((double)this.field_148152_e, (double)this.field_148154_c, 0.0D).func_181673_a((double)((float)this.field_148152_e / f), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); +- worldrenderer.func_181662_b((double)this.field_148151_d, (double)this.field_148154_c, 0.0D).func_181673_a((double)((float)this.field_148151_d / f), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); +- worldrenderer.func_181662_b((double)this.field_148151_d, (double)this.field_148153_b, 0.0D).func_181673_a((double)((float)this.field_148151_d / f), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); +- worldrenderer.func_181662_b((double)this.field_148152_e, (double)this.field_148153_b, 0.0D).func_181673_a((double)((float)this.field_148152_e / f), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); +- tessellator.func_78381_a(); + // Forge: background rendering moved into separate method. + this.drawContainerBackground(tessellator); - int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2; - int l = this.top + 4 - (int)this.amountScrolled; + int k = this.field_148152_e + this.field_148155_a / 2 - this.func_148139_c() / 2 + 2; + int l = this.field_148153_b + 4 - (int)this.field_148169_q; @@ -458,4 +451,18 @@ { - return this.slotHeight; + return this.field_148149_f; } + + protected void drawContainerBackground(Tessellator tessellator) + { -+ WorldRenderer worldrenderer = tessellator.getWorldRenderer(); -+ this.mc.getTextureManager().bindTexture(Gui.optionsBackground); -+ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); ++ WorldRenderer worldrenderer = tessellator.func_178180_c(); ++ this.field_148161_k.func_110434_K().func_110577_a(Gui.field_110325_k); ++ GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + float f = 32.0F; + worldrenderer.func_181668_a(7, DefaultVertexFormats.field_181709_i); -+ worldrenderer.func_181662_b((double)this.left, (double)this.bottom, 0.0D).func_181673_a((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); -+ worldrenderer.func_181662_b((double)this.right, (double)this.bottom, 0.0D).func_181673_a((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); -+ worldrenderer.func_181662_b((double)this.right, (double)this.top, 0.0D).func_181673_a((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); -+ worldrenderer.func_181662_b((double)this.left, (double)this.top, 0.0D).func_181673_a((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); -+ tessellator.draw(); ++ worldrenderer.func_181662_b((double)this.field_148152_e, (double)this.field_148154_c, 0.0D).func_181673_a((double)((float)this.field_148152_e / f), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); ++ worldrenderer.func_181662_b((double)this.field_148151_d, (double)this.field_148154_c, 0.0D).func_181673_a((double)((float)this.field_148151_d / f), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); ++ worldrenderer.func_181662_b((double)this.field_148151_d, (double)this.field_148153_b, 0.0D).func_181673_a((double)((float)this.field_148151_d / f), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); ++ worldrenderer.func_181662_b((double)this.field_148152_e, (double)this.field_148153_b, 0.0D).func_181673_a((double)((float)this.field_148152_e / f), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f)).func_181669_b(32, 32, 32, 255).func_181675_d(); ++ tessellator.func_78381_a(); + } } diff --git a/patches/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch b/patches/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch index 658585c9c..a79cd9dd2 100644 --- a/patches/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch @@ -1,23 +1,23 @@ --- ../src-base/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java +++ ../src-work/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java @@ -82,7 +82,7 @@ - boolean flag1 = this.field_148301_e.version < 47; + boolean flag1 = this.field_148301_e.field_82821_f < 47; boolean flag2 = flag || flag1; - this.field_148300_d.fontRendererObj.drawString(this.field_148301_e.serverName, x + 32 + 3, y + 1, 16777215); -- List list = this.field_148300_d.fontRendererObj.listFormattedStringToWidth(this.field_148301_e.serverMOTD, listWidth - 32 - 2); -+ List list = this.field_148300_d.fontRendererObj.listFormattedStringToWidth(net.minecraftforge.fml.client.FMLClientHandler.instance().fixDescription(this.field_148301_e.serverMOTD), listWidth - 48 - 2); + this.field_148300_d.field_71466_p.func_78276_b(this.field_148301_e.field_78847_a, p_180790_2_ + 32 + 3, p_180790_3_ + 1, 16777215); +- List list = this.field_148300_d.field_71466_p.func_78271_c(this.field_148301_e.field_78843_d, p_180790_4_ - 32 - 2); ++ List list = this.field_148300_d.field_71466_p.func_78271_c(net.minecraftforge.fml.client.FMLClientHandler.instance().fixDescription(this.field_148301_e.field_78843_d), p_180790_4_ - 48 - 2); for (int i = 0; i < Math.min(list.size(), 2); ++i) { @@ -176,6 +176,11 @@ - int i1 = mouseX - x; - int j1 = mouseY - y; + int i1 = p_180790_6_ - p_180790_2_; + int j1 = p_180790_7_ - p_180790_3_; -+ String tooltip = net.minecraftforge.fml.client.FMLClientHandler.instance().enhanceServerListEntry(this, this.field_148301_e, x, listWidth, y, i1, j1); ++ String tooltip = net.minecraftforge.fml.client.FMLClientHandler.instance().enhanceServerListEntry(this, this.field_148301_e, p_180790_2_, p_180790_4_, p_180790_3_, i1, j1); + if (tooltip != null) + { + this.field_148303_c.func_146793_a(tooltip); + } else - if (i1 >= listWidth - 15 && i1 <= listWidth - 5 && j1 >= 0 && j1 <= 8) + if (i1 >= p_180790_4_ - 15 && i1 <= p_180790_4_ - 5 && j1 >= 0 && j1 <= 8) { this.field_148303_c.func_146793_a(s1); diff --git a/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch b/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch index 44c399134..5512b3cdc 100644 --- a/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java +++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java @@ -49,6 +49,10 @@ - private StatFileWriter statFileWriter; - private boolean loadingAchievements = true; + private StatFileWriter field_146556_E; + private boolean field_146558_F = true; + private int currentPage = -1; + private GuiButton button; @@ -10,13 +10,13 @@ + public GuiAchievements(GuiScreen p_i45026_1_, StatFileWriter p_i45026_2_) { - this.parentScreen = p_i45026_1_; + this.field_146562_a = p_i45026_1_; @@ -57,6 +61,14 @@ int j = 141; - this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.openInventory.displayColumn * 24 - i / 2 - 12); - this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.openInventory.displayRow * 24 - j / 2); + this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.field_76004_f.field_75993_a * 24 - i / 2 - 12); + this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.field_76004_f.field_75991_b * 24 - j / 2); + minecraftAchievements.clear(); -+ for (Achievement achievement : AchievementList.achievementList) ++ for (Achievement achievement : AchievementList.field_76007_e) + { + if (!net.minecraftforge.common.AchievementPage.isAchievementInPages(achievement)) + { @@ -25,93 +25,93 @@ + } } - public void initGui() + public void func_73866_w_() @@ -64,6 +76,7 @@ - this.mc.getNetHandler().addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.REQUEST_STATS)); - this.buttonList.clear(); - this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, I18n.format("gui.done", new Object[0]))); -+ this.buttonList.add(button = new GuiButton(2, (width - field_146555_f) / 2 + 24, height / 2 + 74, 125, 20, net.minecraftforge.common.AchievementPage.getTitle(currentPage))); + this.field_146297_k.func_147114_u().func_147297_a(new C16PacketClientStatus(C16PacketClientStatus.EnumState.REQUEST_STATS)); + this.field_146292_n.clear(); + this.field_146292_n.add(new GuiOptionButton(1, this.field_146294_l / 2 + 24, this.field_146295_m / 2 + 74, 80, 20, I18n.func_135052_a("gui.done", new Object[0]))); ++ this.field_146292_n.add(button = new GuiButton(2, (field_146294_l - field_146555_f) / 2 + 24, field_146295_m / 2 + 74, 125, 20, net.minecraftforge.common.AchievementPage.getTitle(currentPage))); } - protected void actionPerformed(GuiButton button) throws IOException + protected void func_146284_a(GuiButton p_146284_1_) throws IOException @@ -74,6 +87,16 @@ { - this.mc.displayGuiScreen(this.parentScreen); + this.field_146297_k.func_147108_a(this.field_146562_a); } + -+ if (button.id == 2) ++ if (p_146284_1_.field_146127_k == 2) + { + currentPage++; + if (currentPage >= net.minecraftforge.common.AchievementPage.getAchievementPages().size()) + { + currentPage = -1; + } -+ this.button.displayString = net.minecraftforge.common.AchievementPage.getTitle(currentPage); ++ this.button.field_146126_j = net.minecraftforge.common.AchievementPage.getTitle(currentPage); + } } } @@ -257,7 +280,9 @@ - GlStateManager.depthFunc(518); - GlStateManager.pushMatrix(); - GlStateManager.translate((float)i1, (float)j1, -200.0F); -- GlStateManager.scale(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 0.0F); + GlStateManager.func_179143_c(518); + GlStateManager.func_179094_E(); + GlStateManager.func_179109_b((float)i1, (float)j1, -200.0F); +- GlStateManager.func_179152_a(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 0.0F); + // FIXES models rendering weirdly in the acheivements pane + // see https://github.com/MinecraftForge/MinecraftForge/commit/1b7ce7592caafb760ec93066184182ae0711e793#commitcomment-10512284 -+ GlStateManager.scale(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 1.0F); - GlStateManager.enableTexture2D(); - GlStateManager.disableLighting(); - GlStateManager.enableRescaleNormal(); ++ GlStateManager.func_179152_a(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 1.0F); + GlStateManager.func_179098_w(); + GlStateManager.func_179140_f(); + GlStateManager.func_179091_B(); @@ -331,11 +356,12 @@ - GlStateManager.depthFunc(515); - this.mc.getTextureManager().bindTexture(field_146561_C); + GlStateManager.func_179143_c(515); + this.field_146297_k.func_110434_K().func_110577_a(field_146561_C); -- for (int j5 = 0; j5 < AchievementList.achievementList.size(); ++j5) +- for (int j5 = 0; j5 < AchievementList.field_76007_e.size(); ++j5) + java.util.List achievementList = (currentPage == -1 ? minecraftAchievements : net.minecraftforge.common.AchievementPage.getAchievementPage(currentPage).getAchievements()); + for (int j5 = 0; j5 < achievementList.size(); ++j5) { -- Achievement achievement1 = (Achievement)AchievementList.achievementList.get(j5); +- Achievement achievement1 = (Achievement)AchievementList.field_76007_e.get(j5); + Achievement achievement1 = achievementList.get(j5); -- if (achievement1.parentAchievement != null) -+ if (achievement1.parentAchievement != null && achievementList.contains(achievement1.parentAchievement)) +- if (achievement1.field_75992_c != null) ++ if (achievement1.field_75992_c != null && achievementList.contains(achievement1.field_75992_c)) { - int k5 = achievement1.displayColumn * 24 - i + 11; - int l5 = achievement1.displayRow * 24 - j + 11; + int k5 = achievement1.field_75993_a * 24 - i + 11; + int l5 = achievement1.field_75991_b * 24 - j + 11; @@ -389,9 +415,9 @@ - GlStateManager.enableRescaleNormal(); - GlStateManager.enableColorMaterial(); + GlStateManager.func_179091_B(); + GlStateManager.func_179142_g(); -- for (int i6 = 0; i6 < AchievementList.achievementList.size(); ++i6) +- for (int i6 = 0; i6 < AchievementList.field_76007_e.size(); ++i6) + for (int i6 = 0; i6 < achievementList.size(); ++i6) { -- Achievement achievement2 = (Achievement)AchievementList.achievementList.get(i6); +- Achievement achievement2 = (Achievement)AchievementList.field_76007_e.get(i6); + Achievement achievement2 = achievementList.get(i6); - int l6 = achievement2.displayColumn * 24 - i; - int j7 = achievement2.displayRow * 24 - j; + int l6 = achievement2.field_75993_a * 24 - i; + int j7 = achievement2.field_75991_b * 24 - j; @@ -432,6 +458,7 @@ - this.mc.getTextureManager().bindTexture(field_146561_C); + this.field_146297_k.func_110434_K().func_110577_a(field_146561_C); -+ GlStateManager.enableBlend(); // Forge: Specifically enable blend because it is needed here. And we fix Generic RenderItem's leakage of it. - if (achievement2.getSpecial()) ++ GlStateManager.func_179147_l(); // Forge: Specifically enable blend because it is needed here. And we fix Generic RenderItem's leakage of it. + if (achievement2.func_75984_f()) { - this.drawTexturedModalRect(l6 - 2, j7 - 2, 26, 202, 26, 26); + this.func_73729_b(l6 - 2, j7 - 2, 26, 202, 26, 26); @@ -440,6 +467,7 @@ { - this.drawTexturedModalRect(l6 - 2, j7 - 2, 0, 202, 26, 26); + this.func_73729_b(l6 - 2, j7 - 2, 0, 202, 26, 26); } -+ GlStateManager.disableBlend(); //Forge: Cleanup states we set. ++ GlStateManager.func_179084_k(); //Forge: Cleanup states we set. - if (!this.statFileWriter.canUnlockAchievement(achievement2)) + if (!this.field_146556_E.func_77442_b(achievement2)) { @@ -448,7 +476,7 @@ - this.itemRender.func_175039_a(false); + this.field_146296_j.func_175039_a(false); } -- GlStateManager.enableLighting(); -+ GlStateManager.disableLighting(); //Forge: Make sure Lighting is disabled. Fixes MC-33065 - GlStateManager.enableCull(); - this.itemRender.renderItemAndEffectIntoGUI(achievement2.theItemStack, l6 + 3, j7 + 3); - GlStateManager.blendFunc(770, 771); +- GlStateManager.func_179145_e(); ++ GlStateManager.func_179140_f(); //Forge: Make sure Lighting is disabled. Fixes MC-33065 + GlStateManager.func_179089_o(); + this.field_146296_j.func_180450_b(achievement2.field_75990_d, l6 + 3, j7 + 3); + GlStateManager.func_179112_b(770, 771); diff --git a/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch b/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch index 6363f6f74..f2890750d 100644 --- a/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch @@ -10,24 +10,24 @@ import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.gui.GuiButton; @@ -443,17 +445,18 @@ - for (StatCrafting statcrafting : StatList.objectMineStats) + for (StatCrafting statcrafting : StatList.field_75939_e) { boolean flag = false; -- int i = Item.getIdFromItem(statcrafting.func_150959_a()); -+ int i = Block.getIdFromBlock(Block.getBlockFromItem(statcrafting.func_150959_a())); -+ int itemId = Item.getIdFromItem(statcrafting.func_150959_a()); +- int i = Item.func_150891_b(statcrafting.func_150959_a()); ++ int i = Block.func_149682_b(Block.func_149634_a(statcrafting.func_150959_a())); ++ int itemId = Item.func_150891_b(statcrafting.func_150959_a()); - if (GuiStats.this.field_146546_t.readStat(statcrafting) > 0) + if (GuiStats.this.field_146546_t.func_77444_a(statcrafting) > 0) { flag = true; } -- else if (StatList.objectUseStats[i] != null && GuiStats.this.field_146546_t.readStat(StatList.objectUseStats[i]) > 0) -+ else if (StatList.objectUseStats[itemId] != null && GuiStats.this.field_146546_t.readStat(StatList.objectUseStats[itemId]) > 0) +- else if (StatList.field_75929_E[i] != null && GuiStats.this.field_146546_t.func_77444_a(StatList.field_75929_E[i]) > 0) ++ else if (StatList.field_75929_E[itemId] != null && GuiStats.this.field_146546_t.func_77444_a(StatList.field_75929_E[itemId]) > 0) { flag = true; } -- else if (StatList.objectCraftStats[i] != null && GuiStats.this.field_146546_t.readStat(StatList.objectCraftStats[i]) > 0) -+ else if (StatList.objectCraftStats[itemId] != null && GuiStats.this.field_146546_t.readStat(StatList.objectCraftStats[itemId]) > 0) +- else if (StatList.field_75928_D[i] != null && GuiStats.this.field_146546_t.func_77444_a(StatList.field_75928_D[i]) > 0) ++ else if (StatList.field_75928_D[itemId] != null && GuiStats.this.field_146546_t.func_77444_a(StatList.field_75928_D[itemId]) > 0) { flag = true; } @@ -35,35 +35,35 @@ { public int compare(StatCrafting p_compare_1_, StatCrafting p_compare_2_) { -- int j = Item.getIdFromItem(p_compare_1_.func_150959_a()); -- int k = Item.getIdFromItem(p_compare_2_.func_150959_a()); +- int j = Item.func_150891_b(p_compare_1_.func_150959_a()); +- int k = Item.func_150891_b(p_compare_2_.func_150959_a()); + int j; + int k; + if (StatsBlock.this.field_148217_o == 2) { -+ j = Block.getIdFromBlock(Block.getBlockFromItem(p_compare_1_.func_150959_a())); -+ k = Block.getIdFromBlock(Block.getBlockFromItem(p_compare_2_.func_150959_a())); ++ j = Block.func_149682_b(Block.func_149634_a(p_compare_1_.func_150959_a())); ++ k = Block.func_149682_b(Block.func_149634_a(p_compare_2_.func_150959_a())); + } else { -+ j = Item.getIdFromItem(p_compare_1_.func_150959_a()); -+ k = Item.getIdFromItem(p_compare_2_.func_150959_a()); ++ j = Item.func_150891_b(p_compare_1_.func_150959_a()); ++ k = Item.func_150891_b(p_compare_2_.func_150959_a()); + } StatBase statbase = null; StatBase statbase1 = null; @@ -748,7 +758,7 @@ - super(mcIn, GuiStats.this.width, GuiStats.this.height, 32, GuiStats.this.height - 64, GuiStats.this.fontRendererObj.FONT_HEIGHT * 4); - this.setShowSelectionBox(false); + super(p_i45510_2_, GuiStats.this.field_146294_l, GuiStats.this.field_146295_m, 32, GuiStats.this.field_146295_m - 64, GuiStats.this.field_146289_q.field_78288_b * 4); + this.func_148130_a(false); -- for (EntityList.EntityEggInfo entitylist$entityegginfo : EntityList.entityEggs.values()) -+ for (EntityList.EntityEggInfo entitylist$entityegginfo : com.google.common.collect.Iterables.concat(EntityList.entityEggs.values(), net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().values())) +- for (EntityList.EntityEggInfo entitylist$entityegginfo : EntityList.field_75627_a.values()) ++ for (EntityList.EntityEggInfo entitylist$entityegginfo : com.google.common.collect.Iterables.concat(EntityList.field_75627_a.values(), net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().values())) { - if (GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151512_d) > 0 || GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151513_e) > 0) + if (GuiStats.this.field_146546_t.func_77444_a(entitylist$entityegginfo.field_151512_d) > 0 || GuiStats.this.field_146546_t.func_77444_a(entitylist$entityegginfo.field_151513_e) > 0) { @@ -784,7 +794,7 @@ - protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int p_180791_5_, int p_180791_6_) + protected void func_180791_a(int p_180791_1_, int p_180791_2_, int p_180791_3_, int p_180791_4_, int p_180791_5_, int p_180791_6_) { - EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)this.field_148222_l.get(entryID); -- String s = I18n.format("entity." + EntityList.getStringFromID(entitylist$entityegginfo.spawnedID) + ".name", new Object[0]); -+ String s = I18n.format("entity." + entitylist$entityegginfo.name + ".name", new Object[0]); - int i = GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151512_d); - int j = GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151513_e); - String s1 = I18n.format("stat.entityKills", new Object[] {Integer.valueOf(i), s}); + EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)this.field_148222_l.get(p_180791_1_); +- String s = I18n.func_135052_a("entity." + EntityList.func_75617_a(entitylist$entityegginfo.field_75613_a) + ".name", new Object[0]); ++ String s = I18n.func_135052_a("entity." + entitylist$entityegginfo.name + ".name", new Object[0]); + int i = GuiStats.this.field_146546_t.func_77444_a(entitylist$entityegginfo.field_151512_d); + int j = GuiStats.this.field_146546_t.func_77444_a(entitylist$entityegginfo.field_151513_e); + String s1 = I18n.func_135052_a("stat.entityKills", new Object[] {Integer.valueOf(i), s}); diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch index 52bb89b7e..2f9a3929a 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch @@ -1,45 +1,45 @@ --- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java +++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java @@ -175,8 +175,11 @@ - GlStateManager.translate(0.0F, 0.0F, 32.0F); - this.zLevel = 200.0F; - this.itemRender.zLevel = 200.0F; + GlStateManager.func_179109_b(0.0F, 0.0F, 32.0F); + this.field_73735_i = 200.0F; + this.field_146296_j.field_77023_b = 200.0F; + net.minecraft.client.gui.FontRenderer font = null; -+ if (stack != null) font = stack.getItem().getFontRenderer(stack); -+ if (font == null) font = fontRendererObj; - this.itemRender.renderItemAndEffectIntoGUI(stack, x, y); -- this.itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, stack, x, y - (this.draggedStack == null ? 0 : 8), altText); -+ this.itemRender.renderItemOverlayIntoGUI(font, stack, x, y - (this.draggedStack == null ? 0 : 8), altText); - this.zLevel = 0.0F; - this.itemRender.zLevel = 0.0F; ++ if (p_146982_1_ != null) font = p_146982_1_.func_77973_b().getFontRenderer(p_146982_1_); ++ if (font == null) font = field_146289_q; + this.field_146296_j.func_180450_b(p_146982_1_, p_146982_2_, p_146982_3_); +- this.field_146296_j.func_180453_a(this.field_146289_q, p_146982_1_, p_146982_2_, p_146982_3_ - (this.field_147012_x == null ? 0 : 8), p_146982_4_); ++ this.field_146296_j.func_180453_a(font, p_146982_1_, p_146982_2_, p_146982_3_ - (this.field_147012_x == null ? 0 : 8), p_146982_4_); + this.field_73735_i = 0.0F; + this.field_146296_j.field_77023_b = 0.0F; } @@ -239,13 +242,12 @@ if (itemstack == null) { -- String s1 = slotIn.getSlotTexture(); -+ TextureAtlasSprite textureatlassprite = slotIn.getBackgroundSprite(); +- String s1 = p_146977_1_.func_178171_c(); ++ TextureAtlasSprite textureatlassprite = p_146977_1_.getBackgroundSprite(); - if (s1 != null) + if (textureatlassprite != null) { -- TextureAtlasSprite textureatlassprite = this.mc.getTextureMapBlocks().getAtlasSprite(s1); - GlStateManager.disableLighting(); -- this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); -+ this.mc.getTextureManager().bindTexture(slotIn.getBackgroundLocation()); - this.drawTexturedModalRect(i, j, textureatlassprite, 16, 16); - GlStateManager.enableLighting(); +- TextureAtlasSprite textureatlassprite = this.field_146297_k.func_147117_R().func_110572_b(s1); + GlStateManager.func_179140_f(); +- this.field_146297_k.func_110434_K().func_110577_a(TextureMap.field_110575_b); ++ this.field_146297_k.func_110434_K().func_110577_a(p_146977_1_.getBackgroundLocation()); + this.func_175175_a(i, j, textureatlassprite, 16, 16); + GlStateManager.func_179145_e(); flag1 = true; @@ -463,6 +465,7 @@ - protected void mouseReleased(int mouseX, int mouseY, int state) + protected void func_146286_b(int p_146286_1_, int p_146286_2_, int p_146286_3_) { -+ super.mouseReleased(mouseX, mouseY, state); //Forge, Call parent to release buttons - Slot slot = this.getSlotAtPosition(mouseX, mouseY); - int i = this.guiLeft; - int j = this.guiTop; ++ super.func_146286_b(p_146286_1_, p_146286_2_, p_146286_3_); //Forge, Call parent to release buttons + Slot slot = this.func_146975_c(p_146286_1_, p_146286_2_); + int i = this.field_147003_i; + int j = this.field_147009_r; @@ -685,4 +688,16 @@ - this.mc.thePlayer.closeScreen(); + this.field_146297_k.field_71439_g.func_71053_j(); } } + @@ -50,7 +50,7 @@ + */ + public Slot getSlotUnderMouse() + { -+ return this.theSlot; ++ return this.field_147006_u; + } + + /* ======================================== FORGE END =====================================*/ diff --git a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch index 6ae29806b..671aff30b 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch @@ -13,20 +13,20 @@ return; } -- if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2)) -+ if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2) && ItemStack.areItemStackTagsEqual(itemstack1, itemstack2)) //Forge: Bugfix, Compare NBT data, allow for deletion of enchanted books, MC-12770 +- if (itemstack1 != null && itemstack2 != null && itemstack1.func_77969_a(itemstack2)) ++ if (itemstack1 != null && itemstack2 != null && itemstack1.func_77969_a(itemstack2) && ItemStack.func_77970_a(itemstack1, itemstack2)) //Forge: Bugfix, Compare NBT data, allow for deletion of enchanted books, MC-12770 { - if (clickedButton == 0) + if (p_146984_3_ == 0) { @@ -259,6 +261,13 @@ - this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[i]); - this.field_147059_E = new CreativeCrafting(this.mc); - this.mc.thePlayer.inventoryContainer.addCraftingToCrafters(this.field_147059_E); -+ int tabCount = CreativeTabs.creativeTabArray.length; + this.func_147050_b(CreativeTabs.field_78032_a[i]); + this.field_147059_E = new CreativeCrafting(this.field_146297_k); + this.field_146297_k.field_71439_g.field_71069_bz.func_75132_a(this.field_147059_E); ++ int tabCount = CreativeTabs.field_78032_a.length; + if (tabCount > 12) + { -+ buttonList.add(new GuiButton(101, guiLeft, guiTop - 50, 20, 20, "<")); -+ buttonList.add(new GuiButton(102, guiLeft + xSize - 20, guiTop - 50, 20, 20, ">")); ++ field_146292_n.add(new GuiButton(101, field_147003_i, field_147009_r - 50, 20, 20, "<")); ++ field_146292_n.add(new GuiButton(102, field_147003_i + field_146999_f - 20, field_147009_r - 50, 20, 20, ">")); + maxPages = ((tabCount - 12) / 10) + 1; + } } @@ -34,30 +34,30 @@ { @@ -280,7 +289,7 @@ - protected void keyTyped(char typedChar, int keyCode) throws IOException + protected void func_73869_a(char p_73869_1_, int p_73869_2_) throws IOException { -- if (selectedTabIndex != CreativeTabs.tabAllSearch.getTabIndex()) -+ if (!CreativeTabs.creativeTabArray[selectedTabIndex].hasSearchBar()) +- if (field_147058_w != CreativeTabs.field_78027_g.func_78021_a()) ++ if (!CreativeTabs.field_78032_a[field_147058_w].hasSearchBar()) { - if (GameSettings.isKeyDown(this.mc.gameSettings.keyBindChat)) + if (GameSettings.func_100015_a(this.field_146297_k.field_71474_y.field_74310_D)) { @@ -318,6 +327,14 @@ - GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; - guicontainercreative$containercreative.itemList.clear(); + GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.field_147002_h; + guicontainercreative$containercreative.field_148330_a.clear(); -+ CreativeTabs tab = CreativeTabs.creativeTabArray[selectedTabIndex]; -+ if (tab.hasSearchBar() && tab != CreativeTabs.tabAllSearch) ++ CreativeTabs tab = CreativeTabs.field_78032_a[field_147058_w]; ++ if (tab.hasSearchBar() && tab != CreativeTabs.field_78027_g) + { -+ tab.displayAllReleventItems(guicontainercreative$containercreative.itemList); ++ tab.func_78018_a(guicontainercreative$containercreative.field_148330_a); + updateFilteredItems(guicontainercreative$containercreative); + return; + } + - for (Item item : Item.itemRegistry) + for (Item item : Item.field_150901_e) { - if (item != null && item.getCreativeTab() != null) + if (item != null && item.func_77640_w() != null) @@ -325,7 +342,13 @@ - item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList); + item.func_150895_a(item, (CreativeTabs)null, guicontainercreative$containercreative.field_148330_a); } } + updateFilteredItems(guicontainercreative$containercreative); @@ -66,126 +66,126 @@ + //split from above for custom search tabs + private void updateFilteredItems(GuiContainerCreative.ContainerCreative guicontainercreative$containercreative) + { -+ if (CreativeTabs.creativeTabArray[selectedTabIndex] == CreativeTabs.tabAllSearch) // FORGE: Only add enchanted books to the regular search - for (Enchantment enchantment : Enchantment.enchantmentsBookList) ++ if (CreativeTabs.field_78032_a[field_147058_w] == CreativeTabs.field_78027_g) // FORGE: Only add enchanted books to the regular search + for (Enchantment enchantment : Enchantment.field_77331_b) { - if (enchantment != null && enchantment.type != null) + if (enchantment != null && enchantment.field_77351_y != null) @@ -333,7 +356,6 @@ - Items.enchanted_book.getAll(enchantment, guicontainercreative$containercreative.itemList); + Items.field_151134_bR.func_92113_a(enchantment, guicontainercreative$containercreative.field_148330_a); } } - - Iterator iterator = guicontainercreative$containercreative.itemList.iterator(); - String s1 = this.searchField.getText().toLowerCase(); + Iterator iterator = guicontainercreative$containercreative.field_148330_a.iterator(); + String s1 = this.field_147062_A.func_146179_b().toLowerCase(); @@ -365,7 +387,7 @@ { - CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; + CreativeTabs creativetabs = CreativeTabs.field_78032_a[field_147058_w]; -- if (creativetabs.drawInForegroundOfTab()) -+ if (creativetabs != null && creativetabs.drawInForegroundOfTab()) +- if (creativetabs.func_78019_g()) ++ if (creativetabs != null && creativetabs.func_78019_g()) { - GlStateManager.disableBlend(); - this.fontRendererObj.drawString(I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]), 8, 6, 4210752); + GlStateManager.func_179084_k(); + this.field_146289_q.func_78276_b(I18n.func_135052_a(creativetabs.func_78024_c(), new Object[0]), 8, 6, 4210752); @@ -400,7 +422,7 @@ - for (CreativeTabs creativetabs : CreativeTabs.creativeTabArray) + for (CreativeTabs creativetabs : CreativeTabs.field_78032_a) { - if (this.func_147049_a(creativetabs, i, j)) + if (creativetabs != null && this.func_147049_a(creativetabs, i, j)) { - this.setCurrentCreativeTab(creativetabs); + this.func_147050_b(creativetabs); return; @@ -413,11 +435,13 @@ - private boolean needsScrollBars() + private boolean func_147055_p() { -+ if (CreativeTabs.creativeTabArray[selectedTabIndex] == null) return false; - return selectedTabIndex != CreativeTabs.tabInventory.getTabIndex() && CreativeTabs.creativeTabArray[selectedTabIndex].shouldHidePlayerInventory() && ((GuiContainerCreative.ContainerCreative)this.inventorySlots).func_148328_e(); ++ if (CreativeTabs.field_78032_a[field_147058_w] == null) return false; + return field_147058_w != CreativeTabs.field_78036_m.func_78021_a() && CreativeTabs.field_78032_a[field_147058_w].func_78017_i() && ((GuiContainerCreative.ContainerCreative)this.field_147002_h).func_148328_e(); } - private void setCurrentCreativeTab(CreativeTabs p_147050_1_) + private void func_147050_b(CreativeTabs p_147050_1_) { + if (p_147050_1_ == null) return; - int i = selectedTabIndex; - selectedTabIndex = p_147050_1_.getTabIndex(); - GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; + int i = field_147058_w; + field_147058_w = p_147050_1_.func_78021_a(); + GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.field_147002_h; @@ -483,12 +507,14 @@ - if (this.searchField != null) + if (this.field_147062_A != null) { -- if (p_147050_1_ == CreativeTabs.tabAllSearch) +- if (p_147050_1_ == CreativeTabs.field_78027_g) + if (p_147050_1_.hasSearchBar()) { - this.searchField.setVisible(true); - this.searchField.setCanLoseFocus(false); - this.searchField.setFocused(true); - this.searchField.setText(""); -+ this.searchField.width = p_147050_1_.getSearchbarWidth(); -+ this.searchField.xPosition = this.guiLeft + (82 /*default left*/ + 89 /*default width*/) - this.searchField.width; - this.updateCreativeSearch(); + this.field_147062_A.func_146189_e(true); + this.field_147062_A.func_146205_d(false); + this.field_147062_A.func_146195_b(true); + this.field_147062_A.func_146180_a(""); ++ this.field_147062_A.field_146218_h = p_147050_1_.getSearchbarWidth(); ++ this.field_147062_A.field_146209_f = this.field_147003_i + (82 /*default left*/ + 89 /*default width*/) - this.field_147062_A.field_146218_h; + this.func_147053_i(); } else @@ -558,20 +584,43 @@ } - super.drawScreen(mouseX, mouseY, partialTicks); + super.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_); + int start = tabPage * 10; -+ int end = Math.min(CreativeTabs.creativeTabArray.length, ((tabPage + 1) * 10) + 2); ++ int end = Math.min(CreativeTabs.field_78032_a.length, ((tabPage + 1) * 10) + 2); + if (tabPage != 0) start += 2; + boolean rendered = false; -- for (CreativeTabs creativetabs : CreativeTabs.creativeTabArray) -+ for (CreativeTabs creativetabs : java.util.Arrays.copyOfRange(CreativeTabs.creativeTabArray,start,end)) +- for (CreativeTabs creativetabs : CreativeTabs.field_78032_a) ++ for (CreativeTabs creativetabs : java.util.Arrays.copyOfRange(CreativeTabs.field_78032_a,start,end)) { + if (creativetabs == null) continue; - if (this.renderCreativeInventoryHoveringText(creativetabs, mouseX, mouseY)) + if (this.func_147052_b(creativetabs, p_73863_1_, p_73863_2_)) { + rendered = true; break; } } -+ if (!rendered && renderCreativeInventoryHoveringText(CreativeTabs.tabAllSearch, mouseX, mouseY)) ++ if (!rendered && func_147052_b(CreativeTabs.field_78027_g, p_73863_1_, p_73863_2_)) + { -+ renderCreativeInventoryHoveringText(CreativeTabs.tabInventory, mouseX, mouseY); ++ func_147052_b(CreativeTabs.field_78036_m, p_73863_1_, p_73863_2_); + } + - if (this.field_147064_C != null && selectedTabIndex == CreativeTabs.tabInventory.getTabIndex() && this.isPointInRegion(this.field_147064_C.xDisplayPosition, this.field_147064_C.yDisplayPosition, 16, 16, mouseX, mouseY)) + if (this.field_147064_C != null && field_147058_w == CreativeTabs.field_78036_m.func_78021_a() && this.func_146978_c(this.field_147064_C.field_75223_e, this.field_147064_C.field_75221_f, 16, 16, p_73863_1_, p_73863_2_)) { - this.drawCreativeTabHoveringText(I18n.format("inventory.binSlot", new Object[0]), mouseX, mouseY); + this.func_146279_a(I18n.func_135052_a("inventory.binSlot", new Object[0]), p_73863_1_, p_73863_2_); } + if (maxPages != 0) + { + String page = String.format("%d / %d", tabPage + 1, maxPages + 1); -+ int width = fontRendererObj.getStringWidth(page); -+ GlStateManager.disableLighting(); -+ this.zLevel = 300.0F; -+ itemRender.zLevel = 300.0F; -+ fontRendererObj.drawString(page, guiLeft + (xSize / 2) - (width / 2), guiTop - 44, -1); -+ this.zLevel = 0.0F; -+ itemRender.zLevel = 0.0F; ++ int width = field_146289_q.func_78256_a(page); ++ GlStateManager.func_179140_f(); ++ this.field_73735_i = 300.0F; ++ field_146296_j.field_77023_b = 300.0F; ++ field_146289_q.func_78276_b(page, field_147003_i + (field_146999_f / 2) - (width / 2), field_147009_r - 44, -1); ++ this.field_73735_i = 0.0F; ++ field_146296_j.field_77023_b = 0.0F; + } + - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.disableLighting(); + GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.func_179140_f(); } @@ -633,16 +682,35 @@ - RenderHelper.enableGUIStandardItemLighting(); - CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; + RenderHelper.func_74520_c(); + CreativeTabs creativetabs = CreativeTabs.field_78032_a[field_147058_w]; -- for (CreativeTabs creativetabs1 : CreativeTabs.creativeTabArray) +- for (CreativeTabs creativetabs1 : CreativeTabs.field_78032_a) + int start = tabPage * 10; -+ int end = Math.min(CreativeTabs.creativeTabArray.length, ((tabPage + 1) * 10 + 2)); ++ int end = Math.min(CreativeTabs.field_78032_a.length, ((tabPage + 1) * 10 + 2)); + if (tabPage != 0) start += 2; + -+ for (CreativeTabs creativetabs1 : java.util.Arrays.copyOfRange(CreativeTabs.creativeTabArray,start,end)) ++ for (CreativeTabs creativetabs1 : java.util.Arrays.copyOfRange(CreativeTabs.field_78032_a,start,end)) { - this.mc.getTextureManager().bindTexture(creativeInventoryTabs); + this.field_146297_k.func_110434_K().func_110577_a(field_147061_u); + if (creativetabs1 == null) continue; - if (creativetabs1.getTabIndex() != selectedTabIndex) + if (creativetabs1.func_78021_a() != field_147058_w) { this.func_147051_a(creativetabs1); } @@ -193,28 +193,28 @@ + if (tabPage != 0) + { -+ if (creativetabs != CreativeTabs.tabAllSearch) ++ if (creativetabs != CreativeTabs.field_78027_g) + { -+ this.mc.getTextureManager().bindTexture(creativeInventoryTabs); -+ func_147051_a(CreativeTabs.tabAllSearch); ++ this.field_146297_k.func_110434_K().func_110577_a(field_147061_u); ++ func_147051_a(CreativeTabs.field_78027_g); + } -+ if (creativetabs != CreativeTabs.tabInventory) ++ if (creativetabs != CreativeTabs.field_78036_m) + { -+ this.mc.getTextureManager().bindTexture(creativeInventoryTabs); -+ func_147051_a(CreativeTabs.tabInventory); ++ this.field_146297_k.func_110434_K().func_110577_a(field_147061_u); ++ func_147051_a(CreativeTabs.field_78036_m); + } + } + - this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.getBackgroundImageName())); - this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); - this.searchField.drawTextBox(); + this.field_146297_k.func_110434_K().func_110577_a(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.func_78015_f())); + this.func_73729_b(this.field_147003_i, this.field_147009_r, 0, 0, this.field_146999_f, this.field_147000_g); + this.field_147062_A.func_146194_f(); @@ -657,6 +725,14 @@ - this.drawTexturedModalRect(i, j + (int)((float)(k - j - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15); + this.func_73729_b(i, j + (int)((float)(k - j - 17) * this.field_147067_x), 232 + (this.func_147055_p() ? 0 : 12), 0, 12, 15); } + if (creativetabs == null || creativetabs.getTabPage() != tabPage) + { -+ if (creativetabs != CreativeTabs.tabAllSearch && creativetabs != CreativeTabs.tabInventory) ++ if (creativetabs != CreativeTabs.field_78027_g && creativetabs != CreativeTabs.field_78036_m) + { + return; + } @@ -222,44 +222,44 @@ + this.func_147051_a(creativetabs); - if (creativetabs == CreativeTabs.tabInventory) + if (creativetabs == CreativeTabs.field_78036_m) @@ -667,6 +743,14 @@ protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_) { + if (p_147049_1_.getTabPage() != tabPage) + { -+ if (p_147049_1_ != CreativeTabs.tabAllSearch && p_147049_1_ != CreativeTabs.tabInventory) ++ if (p_147049_1_ != CreativeTabs.field_78027_g && p_147049_1_ != CreativeTabs.field_78036_m) + { + return false; + } + } + - int i = p_147049_1_.getTabColumn(); + int i = p_147049_1_.func_78020_k(); int j = 28 * i; int k = 0; @@ -763,6 +847,8 @@ } - GlStateManager.disableLighting(); -+ GlStateManager.color(1F, 1F, 1F); //Forge: Reset color in case Items change it. -+ GlStateManager.enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border. - this.drawTexturedModalRect(l, i1, j, k, 28, j1); - this.zLevel = 100.0F; - this.itemRender.zLevel = 100.0F; + GlStateManager.func_179140_f(); ++ GlStateManager.func_179124_c(1F, 1F, 1F); //Forge: Reset color in case Items change it. ++ GlStateManager.func_179147_l(); //Forge: Make sure blend is enabled else tabs show a white border. + this.func_73729_b(l, i1, j, k, 28, j1); + this.field_73735_i = 100.0F; + this.field_146296_j.field_77023_b = 100.0F; @@ -789,6 +875,15 @@ { - this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter())); + this.field_146297_k.func_147108_a(new GuiStats(this, this.field_146297_k.field_71439_g.func_146107_m())); } + -+ if (button.id == 101) ++ if (p_146284_1_.field_146127_k == 101) + { + tabPage = Math.max(tabPage - 1, 0); + } -+ else if (button.id == 102) ++ else if (p_146284_1_.field_146127_k == 102) + { + tabPage = Math.min(tabPage + 1, maxPages); + } } - public int getSelectedTabIndex() + public int func_147056_g() diff --git a/patches/minecraft/net/minecraft/client/model/ModelBase.java.patch b/patches/minecraft/net/minecraft/client/model/ModelBase.java.patch index 4f3c8aede..04667710a 100644 --- a/patches/minecraft/net/minecraft/client/model/ModelBase.java.patch +++ b/patches/minecraft/net/minecraft/client/model/ModelBase.java.patch @@ -7,4 +7,4 @@ -@SideOnly(Side.CLIENT) public abstract class ModelBase { - public float swingProgress; + public float field_78095_p; diff --git a/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch b/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch index 5b0a3f1d0..d91355e16 100644 --- a/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch +++ b/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch @@ -7,12 +7,12 @@ -@SideOnly(Side.CLIENT) public class ModelBox { - private PositionTextureVertex[] vertexPositions; + private PositionTextureVertex[] field_78253_h; @@ -81,6 +80,7 @@ } } + @SideOnly(Side.CLIENT) - public void render(WorldRenderer p_178780_1_, float p_178780_2_) + public void func_178780_a(WorldRenderer p_178780_1_, float p_178780_2_) { - for (int i = 0; i < this.quadList.length; ++i) + for (int i = 0; i < this.field_78254_i.length; ++i) diff --git a/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch b/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch index 2e3e1f197..77e0a42cb 100644 --- a/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/model/ModelRenderer.java.patch @@ -7,36 +7,36 @@ -@SideOnly(Side.CLIENT) public class ModelRenderer { - public float textureWidth; + public float field_78801_a; @@ -109,6 +108,7 @@ - this.rotationPointZ = p_78793_3_; + this.field_78798_e = p_78793_3_; } + @SideOnly(Side.CLIENT) - public void render(float p_78785_1_) + public void func_78785_a(float p_78785_1_) { - if (!this.isHidden) + if (!this.field_78807_k) @@ -190,6 +190,7 @@ } } + @SideOnly(Side.CLIENT) - public void renderWithRotation(float p_78791_1_) + public void func_78791_b(float p_78791_1_) { - if (!this.isHidden) + if (!this.field_78807_k) @@ -225,6 +226,7 @@ } } + @SideOnly(Side.CLIENT) - public void postRender(float p_78794_1_) + public void func_78794_c(float p_78794_1_) { - if (!this.isHidden) + if (!this.field_78807_k) @@ -266,6 +268,7 @@ } } + @SideOnly(Side.CLIENT) - private void compileDisplayList(float p_78788_1_) + private void func_78788_d(float p_78788_1_) { - this.displayList = GLAllocation.generateDisplayLists(1); + this.field_78811_r = GLAllocation.func_74526_a(1); diff --git a/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch b/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch index c3d2571d6..dbe66e303 100644 --- a/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch +++ b/patches/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch @@ -10,4 +10,4 @@ -@SideOnly(Side.CLIENT) public class PositionTextureVertex { - public Vec3 vector3D; + public Vec3 field_78243_a; diff --git a/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch b/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch index 321941a6b..ea7d9cd31 100644 --- a/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch +++ b/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch @@ -10,4 +10,4 @@ -@SideOnly(Side.CLIENT) public class TexturedQuad { - public PositionTextureVertex[] vertexPositions; + public PositionTextureVertex[] field_78239_a; diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch index dd87a5fdd..feb70661e 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch @@ -1,10 +1,10 @@ --- ../src-base/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java +++ ../src-work/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java @@ -55,6 +55,7 @@ - Chunk chunk = new Chunk(this.worldObj, p_73158_1_, p_73158_2_); - this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_), chunk); - this.chunkListing.add(chunk); + Chunk chunk = new Chunk(this.field_73235_d, p_73158_1_, p_73158_2_); + this.field_73236_b.func_76163_a(ChunkCoordIntPair.func_77272_a(p_73158_1_, p_73158_2_), chunk); + this.field_73237_c.add(chunk); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk)); - chunk.setChunkLoaded(true); + chunk.func_177417_c(true); return chunk; } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch index d19712b43..fbd519d25 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java +++ ../src-work/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java @@ -67,7 +67,7 @@ - inetaddress = InetAddress.getByName(ip); - GuiConnecting.this.networkManager = NetworkManager.func_181124_a(inetaddress, port, GuiConnecting.this.mc.gameSettings.func_181148_f()); - GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen)); -- GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN)); -+ GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN, true)); - GuiConnecting.this.networkManager.sendPacket(new C00PacketLoginStart(GuiConnecting.this.mc.getSession().getProfile())); + inetaddress = InetAddress.getByName(p_146367_1_); + GuiConnecting.this.field_146371_g = NetworkManager.func_181124_a(inetaddress, p_146367_2_, GuiConnecting.this.field_146297_k.field_71474_y.func_181148_f()); + GuiConnecting.this.field_146371_g.func_150719_a(new NetHandlerLoginClient(GuiConnecting.this.field_146371_g, GuiConnecting.this.field_146297_k, GuiConnecting.this.field_146374_i)); +- GuiConnecting.this.field_146371_g.func_179290_a(new C00Handshake(47, p_146367_1_, p_146367_2_, EnumConnectionState.LOGIN)); ++ GuiConnecting.this.field_146371_g.func_179290_a(new C00Handshake(47, p_146367_1_, p_146367_2_, EnumConnectionState.LOGIN, true)); + GuiConnecting.this.field_146371_g.func_179290_a(new C00PacketLoginStart(GuiConnecting.this.field_146297_k.func_110432_I().func_148256_e())); } catch (UnknownHostException unknownhostexception) diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch index 4193c9878..d571ffad0 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch @@ -4,66 +4,66 @@ } } -+ ItemStack stack = mc.thePlayer.getCurrentEquippedItem(); -+ if (stack != null && stack.getItem() != null && stack.getItem().onBlockStartBreak(stack, pos, mc.thePlayer)) ++ ItemStack stack = field_78776_a.field_71439_g.func_71045_bC(); ++ if (stack != null && stack.func_77973_b() != null && stack.func_77973_b().onBlockStartBreak(stack, p_178888_1_, field_78776_a.field_71439_g)) + { + return false; + } + - if (this.currentGameType.isCreative() && this.mc.thePlayer.getHeldItem() != null && this.mc.thePlayer.getHeldItem().getItem() instanceof ItemSword) + if (this.field_78779_k.func_77145_d() && this.field_78776_a.field_71439_g.func_70694_bm() != null && this.field_78776_a.field_71439_g.func_70694_bm().func_77973_b() instanceof ItemSword) { return false; @@ -128,7 +134,7 @@ else { - world.playAuxSFX(2001, pos, Block.getStateId(iblockstate)); -- boolean flag = world.setBlockToAir(pos); -+ boolean flag = block1.removedByPlayer(world, pos, mc.thePlayer, false); + world.func_175718_b(2001, p_178888_1_, Block.func_176210_f(iblockstate)); +- boolean flag = world.func_175698_g(p_178888_1_); ++ boolean flag = block1.removedByPlayer(world, p_178888_1_, field_78776_a.field_71439_g, false); if (flag) { @@ -356,11 +362,19 @@ { - if (this.currentGameType != WorldSettings.GameType.SPECTATOR) + if (this.field_78779_k != WorldSettings.GameType.SPECTATOR) { + + if (p_178890_3_ != null && -+ p_178890_3_.getItem() != null && -+ p_178890_3_.getItem().onItemUseFirst(p_178890_3_, p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2)) ++ p_178890_3_.func_77973_b() != null && ++ p_178890_3_.func_77973_b().onItemUseFirst(p_178890_3_, p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2)) + { + return true; + } + - IBlockState iblockstate = p_178890_2_.getBlockState(p_178890_4_); + IBlockState iblockstate = p_178890_2_.func_180495_p(p_178890_4_); -- if ((!p_178890_1_.isSneaking() || p_178890_1_.getHeldItem() == null) && iblockstate.getBlock().onBlockActivated(p_178890_2_, p_178890_4_, iblockstate, p_178890_1_, p_178890_5_, f, f1, f2)) -+ if ((!p_178890_1_.isSneaking() || p_178890_1_.getHeldItem() == null || p_178890_1_.getHeldItem().getItem().doesSneakBypassUse(p_178890_2_, p_178890_4_, p_178890_1_))) +- if ((!p_178890_1_.func_70093_af() || p_178890_1_.func_70694_bm() == null) && iblockstate.func_177230_c().func_180639_a(p_178890_2_, p_178890_4_, iblockstate, p_178890_1_, p_178890_5_, f, f1, f2)) ++ if ((!p_178890_1_.func_70093_af() || p_178890_1_.func_70694_bm() == null || p_178890_1_.func_70694_bm().func_77973_b().doesSneakBypassUse(p_178890_2_, p_178890_4_, p_178890_1_))) { - flag = true; -+ flag = iblockstate.getBlock().onBlockActivated(p_178890_2_, p_178890_4_, iblockstate, p_178890_1_, p_178890_5_, f, f1, f2); ++ flag = iblockstate.func_177230_c().func_180639_a(p_178890_2_, p_178890_4_, iblockstate, p_178890_1_, p_178890_5_, f, f1, f2); } - if (!flag && p_178890_3_ != null && p_178890_3_.getItem() instanceof ItemBlock) + if (!flag && p_178890_3_ != null && p_178890_3_.func_77973_b() instanceof ItemBlock) @@ -393,7 +407,9 @@ } else { -- return p_178890_3_.onItemUse(p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2); -+ if (!p_178890_3_.onItemUse(p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2)) return false; -+ if (p_178890_3_.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_178890_1_, p_178890_3_); +- return p_178890_3_.func_179546_a(p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2); ++ if (!p_178890_3_.func_179546_a(p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2)) return false; ++ if (p_178890_3_.field_77994_a <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_178890_1_, p_178890_3_); + return true; } } else @@ -420,9 +436,10 @@ { - playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = itemstack; + p_78769_1_.field_71071_by.field_70462_a[p_78769_1_.field_71071_by.field_70461_c] = itemstack; -- if (itemstack.stackSize == 0) -+ if (itemstack.stackSize <= 0) +- if (itemstack.field_77994_a == 0) ++ if (itemstack.field_77994_a <= 0) { - playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = null; -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(playerIn, itemstack); + p_78769_1_.field_71071_by.field_70462_a[p_78769_1_.field_71071_by.field_70461_c] = null; ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_78769_1_, itemstack); } return true; diff --git a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch index a0e81d054..0996e6ecd 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch @@ -1,17 +1,17 @@ --- ../src-base/minecraft/net/minecraft/client/multiplayer/WorldClient.java +++ ../src-work/minecraft/net/minecraft/client/multiplayer/WorldClient.java @@ -52,12 +52,13 @@ - super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), WorldProvider.getProviderForDimension(p_i45063_3_), p_i45063_5_, true); - this.sendQueue = p_i45063_1_; - this.getWorldInfo().setDifficulty(p_i45063_4_); -- this.setSpawnPoint(new BlockPos(8, 64, 8)); - this.provider.registerWorld(this); -+ this.setSpawnPoint(new BlockPos(8, 64, 8)); //Forge: Moved below registerWorld to prevent NPE in our redirect. - this.chunkProvider = this.createChunkProvider(); - this.mapStorage = new SaveDataMemoryStorage(); - this.calculateInitialSkylight(); - this.calculateInitialWeather(); + super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), WorldProvider.func_76570_a(p_i45063_3_), p_i45063_5_, true); + this.field_73035_a = p_i45063_1_; + this.func_72912_H().func_176144_a(p_i45063_4_); +- this.func_175652_B(new BlockPos(8, 64, 8)); + this.field_73011_w.func_76558_a(this); ++ this.func_175652_B(new BlockPos(8, 64, 8)); //Forge: Moved below registerWorld to prevent NPE in our redirect. + this.field_73020_y = this.func_72970_h(); + this.field_72988_C = new SaveDataMemoryStorage(); + this.func_72966_v(); + this.func_72947_a(); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(this)); } - public void tick() + public void func_72835_b() diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch index e1acbc07d..a09e9fe7b 100644 --- a/patches/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch +++ b/patches/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java @@ -23,6 +23,7 @@ - public void processHandshake(C00Handshake packetIn) + public void func_147383_a(C00Handshake p_147383_1_) { -+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return; - this.networkManager.setConnectionState(packetIn.getRequestedState()); - this.networkManager.setNetHandler(new NetHandlerLoginServer(this.mcServer, this.networkManager)); ++ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(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 NetHandlerLoginServer(this.field_147385_a, this.field_147384_b)); } diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch index 2c10876e5..445652888 100644 --- a/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch +++ b/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch @@ -2,13 +2,13 @@ +++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java @@ -104,7 +104,10 @@ { - this.gameProfile = packetIn.getProfile(); - this.networkManager.setConnectionState(EnumConnectionState.PLAY); -- this.networkManager.setNetHandler(new NetHandlerPlayClient(this.mc, this.previousGuiScreen, this.networkManager, this.gameProfile)); -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlClientHandshake(this.networkManager); -+ NetHandlerPlayClient nhpc = new NetHandlerPlayClient(this.mc, this.previousGuiScreen, this.networkManager, this.gameProfile); -+ this.networkManager.setNetHandler(nhpc); + this.field_175091_e = p_147390_1_.func_179730_a(); + this.field_147393_d.func_150723_a(EnumConnectionState.PLAY); +- this.field_147393_d.func_150719_a(new NetHandlerPlayClient(this.field_147394_b, this.field_147395_c, this.field_147393_d, this.field_175091_e)); ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlClientHandshake(this.field_147393_d); ++ NetHandlerPlayClient nhpc = new NetHandlerPlayClient(this.field_147394_b, this.field_147395_c, this.field_147393_d, this.field_175091_e); ++ this.field_147393_d.func_150719_a(nhpc); + net.minecraftforge.fml.client.FMLClientHandler.instance().setPlayClient(nhpc); } - public void onDisconnect(IChatComponent reason) + public void func_147231_a(IChatComponent p_147231_1_) diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch index 6a68a7639..4fa630f5f 100644 --- a/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch +++ b/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch @@ -2,51 +2,51 @@ +++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java @@ -246,7 +246,7 @@ { - PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); - this.gameController.playerController = new PlayerControllerMP(this.gameController, this); -- this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler); -+ this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.get(getNetworkManager()).getOverrideDimension(packetIn), packetIn.getDifficulty(), this.gameController.mcProfiler); - this.gameController.gameSettings.difficulty = packetIn.getDifficulty(); - this.gameController.loadWorld(this.clientWorldController); - this.gameController.thePlayer.dimension = packetIn.getDimension(); + PacketThreadUtil.func_180031_a(p_147282_1_, this, this.field_147299_f); + this.field_147299_f.field_71442_b = new PlayerControllerMP(this.field_147299_f, this); +- this.field_147300_g = new WorldClient(this, new WorldSettings(0L, p_147282_1_.func_149198_e(), false, p_147282_1_.func_149195_d(), p_147282_1_.func_149196_i()), p_147282_1_.func_149194_f(), p_147282_1_.func_149192_g(), this.field_147299_f.field_71424_I); ++ this.field_147300_g = new WorldClient(this, new WorldSettings(0L, p_147282_1_.func_149198_e(), false, p_147282_1_.func_149195_d(), p_147282_1_.func_149196_i()), net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.get(func_147298_b()).getOverrideDimension(p_147282_1_), p_147282_1_.func_149192_g(), this.field_147299_f.field_71424_I); + this.field_147299_f.field_71474_y.field_74318_M = p_147282_1_.func_149192_g(); + this.field_147299_f.func_71403_a(this.field_147300_g); + this.field_147299_f.field_71439_g.field_71093_bK = p_147282_1_.func_149194_f(); @@ -750,14 +750,16 @@ - public void handleChat(S02PacketChat packetIn) + public void func_147251_a(S02PacketChat p_147251_1_) { - PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); -+ net.minecraft.util.IChatComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(packetIn.func_179841_c(), packetIn.func_148915_c()); + PacketThreadUtil.func_180031_a(p_147251_1_, this, this.field_147299_f); ++ net.minecraft.util.IChatComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(p_147251_1_.func_179841_c(), p_147251_1_.func_148915_c()); + if (message == null) return; - if (packetIn.func_179841_c() == 2) + if (p_147251_1_.func_179841_c() == 2) { -- this.gameController.ingameGUI.func_175188_a(packetIn.func_148915_c(), false); -+ this.gameController.ingameGUI.func_175188_a(message, false); +- this.field_147299_f.field_71456_v.func_175188_a(p_147251_1_.func_148915_c(), false); ++ this.field_147299_f.field_71456_v.func_175188_a(message, false); } else { -- this.gameController.ingameGUI.getChatGUI().printChatMessage(packetIn.func_148915_c()); -+ this.gameController.ingameGUI.getChatGUI().printChatMessage(message); +- this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(p_147251_1_.func_148915_c()); ++ this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(message); } } @@ -808,6 +810,11 @@ - float f = (float)(packetIn.func_149028_l() * 360) / 256.0F; - float f1 = (float)(packetIn.func_149030_m() * 360) / 256.0F; - EntityLivingBase entitylivingbase = (EntityLivingBase)EntityList.createEntityByID(packetIn.func_149025_e(), this.gameController.theWorld); + float f = (float)(p_147281_1_.func_149028_l() * 360) / 256.0F; + float f1 = (float)(p_147281_1_.func_149030_m() * 360) / 256.0F; + EntityLivingBase entitylivingbase = (EntityLivingBase)EntityList.func_75616_a(p_147281_1_.func_149025_e(), this.field_147299_f.field_71441_e); + if (entitylivingbase == null) + { -+ net.minecraftforge.fml.common.FMLLog.info("Server attempted to spawn an unknown entity using ID: {0} at ({1}, {2}, {3}) Skipping!", packetIn.func_149025_e(), d0, d1, d2); ++ net.minecraftforge.fml.common.FMLLog.info("Server attempted to spawn an unknown entity using ID: {0} at ({1}, {2}, {3}) Skipping!", p_147281_1_.func_149025_e(), d0, d1, d2); + return; + } - entitylivingbase.serverPosX = packetIn.func_149023_f(); - entitylivingbase.serverPosY = packetIn.func_149034_g(); - entitylivingbase.serverPosZ = packetIn.func_149029_h(); + entitylivingbase.field_70118_ct = p_147281_1_.func_149023_f(); + entitylivingbase.field_70117_cu = p_147281_1_.func_149034_g(); + entitylivingbase.field_70116_cv = p_147281_1_.func_149029_h(); @@ -1133,6 +1140,10 @@ { - tileentity.readFromNBT(packetIn.getNbtCompound()); + tileentity.func_145839_a(p_147273_1_.func_148857_g()); } + else + { -+ tileentity.onDataPacket(netManager, packetIn); ++ tileentity.onDataPacket(field_147302_e, p_147273_1_); + } } } @@ -55,8 +55,8 @@ if (entity instanceof EntityLivingBase) { -- PotionEffect potioneffect = new PotionEffect(packetIn.func_149427_e(), packetIn.func_180755_e(), packetIn.func_149428_f(), false, packetIn.func_179707_f()); -+ PotionEffect potioneffect = new PotionEffect(packetIn.func_149427_e() & 0xff, packetIn.func_180755_e(), packetIn.func_149428_f(), false, packetIn.func_179707_f()); - potioneffect.setPotionDurationMax(packetIn.func_149429_c()); - ((EntityLivingBase)entity).addPotionEffect(potioneffect); +- PotionEffect potioneffect = new PotionEffect(p_147260_1_.func_149427_e(), p_147260_1_.func_180755_e(), p_147260_1_.func_149428_f(), false, p_147260_1_.func_179707_f()); ++ PotionEffect potioneffect = new PotionEffect(p_147260_1_.func_149427_e() & 0xff, p_147260_1_.func_180755_e(), p_147260_1_.func_149428_f(), false, p_147260_1_.func_179707_f()); + potioneffect.func_100012_b(p_147260_1_.func_149429_c()); + ((EntityLivingBase)entity).func_70690_d(potioneffect); } diff --git a/patches/minecraft/net/minecraft/client/network/OldServerPinger.java.patch b/patches/minecraft/net/minecraft/client/network/OldServerPinger.java.patch index 5631206e3..d7aad9ec1 100644 --- a/patches/minecraft/net/minecraft/client/network/OldServerPinger.java.patch +++ b/patches/minecraft/net/minecraft/client/network/OldServerPinger.java.patch @@ -1,10 +1,10 @@ --- ../src-base/minecraft/net/minecraft/client/network/OldServerPinger.java +++ ../src-work/minecraft/net/minecraft/client/network/OldServerPinger.java @@ -150,6 +150,7 @@ - server.setBase64EncodedIconData((String)null); + p_147224_1_.func_147407_a((String)null); } -+ net.minecraftforge.fml.client.FMLClientHandler.instance().bindServerListData(server, serverstatusresponse); - this.field_175092_e = Minecraft.getSystemTime(); - networkmanager.sendPacket(new C01PacketPing(this.field_175092_e)); ++ net.minecraftforge.fml.client.FMLClientHandler.instance().bindServerListData(p_147224_1_, serverstatusresponse); + this.field_175092_e = Minecraft.func_71386_F(); + networkmanager.func_179290_a(new C01PacketPing(this.field_175092_e)); this.field_147403_d = true; diff --git a/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch index 3acadd6a8..08e6f7261 100644 --- a/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch @@ -2,20 +2,20 @@ +++ ../src-work/minecraft/net/minecraft/client/particle/EffectRenderer.java @@ -133,6 +133,7 @@ - public void addEffect(EntityFX p_78873_1_) + public void func_78873_a(EntityFX p_78873_1_) { + if (p_78873_1_ == null) return; //Forge: Prevent modders from being bad and adding nulls causing untraceable NPEs. - int i = p_78873_1_.getFXLayer(); + int i = p_78873_1_.func_70537_b(); int j = p_78873_1_.func_174838_j() != 1.0F ? 0 : 1; @@ -351,7 +352,7 @@ public void func_180533_a(BlockPos p_180533_1_, IBlockState p_180533_2_) { -- if (p_180533_2_.getBlock().getMaterial() != Material.air) -+ if (!p_180533_2_.getBlock().isAir(worldObj, p_180533_1_) && !p_180533_2_.getBlock().addDestroyEffects(worldObj, p_180533_1_, this)) +- if (p_180533_2_.func_177230_c().func_149688_o() != Material.field_151579_a) ++ if (!p_180533_2_.func_177230_c().isAir(field_78878_a, p_180533_1_) && !p_180533_2_.func_177230_c().addDestroyEffects(field_78878_a, p_180533_1_, this)) { - p_180533_2_ = p_180533_2_.getBlock().getActualState(p_180533_2_, this.worldObj, p_180533_1_); + p_180533_2_ = p_180533_2_.func_177230_c().func_176221_a(p_180533_2_, this.field_78878_a, p_180533_1_); int i = 4; @@ -457,4 +458,13 @@ @@ -24,10 +24,10 @@ + + public void addBlockHitEffects(BlockPos pos, net.minecraft.util.MovingObjectPosition target) + { -+ Block block = worldObj.getBlockState(pos).getBlock(); -+ if (block != null && !block.addHitEffects(worldObj, target, this)) ++ Block block = field_78878_a.func_180495_p(pos).func_177230_c(); ++ if (block != null && !block.addHitEffects(field_78878_a, target, this)) + { -+ addBlockHitEffects(pos, target.sideHit); ++ func_180532_a(pos, target.field_178784_b); + } + } } diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch index ab5266c3f..72ea50b40 100644 --- a/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch @@ -2,17 +2,17 @@ +++ ../src-work/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java @@ -24,7 +24,7 @@ { - private BlockModelShapes blockModelShapes; - private final GameSettings gameSettings; -- private final BlockModelRenderer blockModelRenderer = new BlockModelRenderer(); -+ private final BlockModelRenderer blockModelRenderer = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(); - private final ChestRenderer chestRenderer = new ChestRenderer(); - private final BlockFluidRenderer fluidRenderer = new BlockFluidRenderer(); + private BlockModelShapes field_175028_a; + private final GameSettings field_175026_b; +- private final BlockModelRenderer field_175027_c = new BlockModelRenderer(); ++ private final BlockModelRenderer field_175027_c = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(); + private final ChestRenderer field_175024_d = new ChestRenderer(); + private final BlockFluidRenderer field_175025_e = new BlockFluidRenderer(); @@ -48,6 +48,24 @@ { - p_175020_1_ = block.getActualState(p_175020_1_, p_175020_4_, p_175020_2_); - IBakedModel ibakedmodel = this.blockModelShapes.getModelForState(p_175020_1_); + p_175020_1_ = block.func_176221_a(p_175020_1_, p_175020_4_, p_175020_2_); + IBakedModel ibakedmodel = this.field_175028_a.func_178125_b(p_175020_1_); + + if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartBlockModel) + { @@ -24,18 +24,18 @@ + net.minecraftforge.client.ForgeHooksClient.setRenderLayer(layer); + + IBakedModel targetLayer = ((net.minecraftforge.client.model.ISmartBlockModel)ibakedmodel).handleBlockState(extendedState); -+ IBakedModel damageModel = (new SimpleBakedModel.Builder(targetLayer, p_175020_3_)).makeBakedModel(); -+ this.blockModelRenderer.renderModel(p_175020_4_, damageModel, p_175020_1_, p_175020_2_, Tessellator.getInstance().getWorldRenderer()); ++ IBakedModel damageModel = (new SimpleBakedModel.Builder(targetLayer, p_175020_3_)).func_177645_b(); ++ this.field_175027_c.func_178259_a(p_175020_4_, damageModel, p_175020_1_, p_175020_2_, Tessellator.func_178181_a().func_178180_c()); + } + } + return; + } + - IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(ibakedmodel, p_175020_3_)).makeBakedModel(); - this.blockModelRenderer.renderModel(p_175020_4_, ibakedmodel1, p_175020_1_, p_175020_2_, Tessellator.getInstance().getWorldRenderer()); + IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(ibakedmodel, p_175020_3_)).func_177645_b(); + this.field_175027_c.func_178259_a(p_175020_4_, ibakedmodel1, p_175020_1_, p_175020_2_, Tessellator.func_178181_a().func_178180_c()); } @@ -128,6 +146,12 @@ - ibakedmodel = ((WeightedBakedModel)ibakedmodel).getAlternativeModel(MathHelper.getPositionRandom(p_175022_3_)); + ibakedmodel = ((WeightedBakedModel)ibakedmodel).func_177564_a(MathHelper.func_180186_a(p_175022_3_)); } + if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartBlockModel) diff --git a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch index 6195c804c..ea7e48861 100644 --- a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -4,172 +4,172 @@ if (d3 < d2 || d2 == 0.0D) { -- if (entity1 == entity.ridingEntity) -+ if (entity1 == entity.ridingEntity && !entity.canRiderInteract()) +- if (entity1 == entity.field_70154_o) ++ if (entity1 == entity.field_70154_o && !entity.canRiderInteract()) { if (d2 == 0.0D) { @@ -576,14 +576,8 @@ { BlockPos blockpos = new BlockPos(entity); - IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); -- Block block = iblockstate.getBlock(); -+ net.minecraftforge.client.ForgeHooksClient.orientBedCamera(this.mc.theWorld, blockpos, iblockstate, entity); + IBlockState iblockstate = this.field_78531_r.field_71441_e.func_180495_p(blockpos); +- Block block = iblockstate.func_177230_c(); ++ net.minecraftforge.client.ForgeHooksClient.orientBedCamera(this.field_78531_r.field_71441_e, blockpos, iblockstate, entity); -- if (block == Blocks.bed) +- if (block == Blocks.field_150324_C) - { -- int j = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex(); -- GlStateManager.rotate((float)(j * 90), 0.0F, 1.0F, 0.0F); +- int j = ((EnumFacing)iblockstate.func_177229_b(BlockBed.field_176387_N)).func_176736_b(); +- GlStateManager.func_179114_b((float)(j * 90), 0.0F, 1.0F, 0.0F); - } - - GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_78467_1_ + 180.0F, 0.0F, -1.0F, 0.0F); - GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_78467_1_, -1.0F, 0.0F, 0.0F); + GlStateManager.func_179114_b(entity.field_70126_B + (entity.field_70177_z - entity.field_70126_B) * p_78467_1_ + 180.0F, 0.0F, -1.0F, 0.0F); + GlStateManager.func_179114_b(entity.field_70127_C + (entity.field_70125_A - entity.field_70127_C) * p_78467_1_, -1.0F, 0.0F, 0.0F); } @@ -650,17 +644,20 @@ - if (!this.mc.gameSettings.debugCamEnable) + if (!this.field_78531_r.field_71474_y.field_74325_U) { -- GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_78467_1_, 1.0F, 0.0F, 0.0F); +- GlStateManager.func_179114_b(entity.field_70127_C + (entity.field_70125_A - entity.field_70127_C) * p_78467_1_, 1.0F, 0.0F, 0.0F); - -+ float yaw = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_78467_1_ + 180.0F; -+ float pitch = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_78467_1_; ++ float yaw = entity.field_70126_B + (entity.field_70177_z - entity.field_70126_B) * p_78467_1_ + 180.0F; ++ float pitch = entity.field_70127_C + (entity.field_70125_A - entity.field_70127_C) * p_78467_1_; + float roll = 0.0F; if (entity instanceof EntityAnimal) { EntityAnimal entityanimal = (EntityAnimal)entity; -- GlStateManager.rotate(entityanimal.prevRotationYawHead + (entityanimal.rotationYawHead - entityanimal.prevRotationYawHead) * p_78467_1_ + 180.0F, 0.0F, 1.0F, 0.0F); -+ yaw = entityanimal.prevRotationYawHead + (entityanimal.rotationYawHead - entityanimal.prevRotationYawHead) * p_78467_1_ + 180.0F; +- GlStateManager.func_179114_b(entityanimal.field_70758_at + (entityanimal.field_70759_as - entityanimal.field_70758_at) * p_78467_1_ + 180.0F, 0.0F, 1.0F, 0.0F); ++ yaw = entityanimal.field_70758_at + (entityanimal.field_70759_as - entityanimal.field_70758_at) * p_78467_1_ + 180.0F; } - else - { -- GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_78467_1_ + 180.0F, 0.0F, 1.0F, 0.0F); +- GlStateManager.func_179114_b(entity.field_70126_B + (entity.field_70177_z - entity.field_70126_B) * p_78467_1_ + 180.0F, 0.0F, 1.0F, 0.0F); - } -+ Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, p_78467_1_); ++ Block block = ActiveRenderInfo.func_180786_a(this.field_78531_r.field_71441_e, entity, p_78467_1_); + net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup event = new net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup(this, entity, block, p_78467_1_, yaw, pitch, roll); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ GlStateManager.rotate(event.roll, 0.0F, 0.0F, 1.0F); -+ GlStateManager.rotate(event.pitch, 1.0F, 0.0F, 0.0F); -+ GlStateManager.rotate(event.yaw, 0.0F, 1.0F, 0.0F); ++ GlStateManager.func_179114_b(event.roll, 0.0F, 0.0F, 1.0F); ++ GlStateManager.func_179114_b(event.pitch, 1.0F, 0.0F, 0.0F); ++ GlStateManager.func_179114_b(event.yaw, 0.0F, 1.0F, 0.0F); } - GlStateManager.translate(0.0F, -f, 0.0F); + GlStateManager.func_179109_b(0.0F, -f, 0.0F); @@ -1103,7 +1100,7 @@ try { -- this.mc.currentScreen.drawScreen(k1, l1, p_181560_1_); -+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.mc.currentScreen, k1, l1, p_181560_1_); +- this.field_78531_r.field_71462_r.func_73863_a(k1, l1, p_181560_1_); ++ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.field_78531_r.field_71462_r, k1, l1, p_181560_1_); } catch (Throwable throwable) { @@ -1164,7 +1161,7 @@ - if (this.mc.playerController.getCurrentGameType() == WorldSettings.GameType.SPECTATOR) + if (this.field_78531_r.field_71442_b.func_178889_l() == WorldSettings.GameType.SPECTATOR) { -- flag = block.hasTileEntity() && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory; -+ flag = block.hasTileEntity(this.mc.theWorld.getBlockState(blockpos)) && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory; +- flag = block.func_149716_u() && this.field_78531_r.field_71441_e.func_175625_s(blockpos) instanceof IInventory; ++ flag = block.hasTileEntity(this.field_78531_r.field_71441_e.func_180495_p(blockpos)) && this.field_78531_r.field_71441_e.func_175625_s(blockpos) instanceof IInventory; } else { @@ -1314,7 +1311,9 @@ - GlStateManager.pushMatrix(); - RenderHelper.enableStandardItemLighting(); - this.mc.mcProfiler.endStartSection("entities"); + GlStateManager.func_179094_E(); + RenderHelper.func_74519_b(); + this.field_78531_r.field_71424_I.func_76318_c("entities"); + net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); - renderglobal.renderEntities(entity, icamera, partialTicks); + renderglobal.func_180446_a(entity, icamera, p_175068_2_); + net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); - RenderHelper.disableStandardItemLighting(); - this.disableLightmap(); - GlStateManager.matrixMode(5888); + RenderHelper.func_74518_a(); + this.func_175072_h(); + GlStateManager.func_179128_n(5888); @@ -1326,6 +1325,7 @@ EntityPlayer entityplayer = (EntityPlayer)entity; - GlStateManager.disableAlpha(); - this.mc.mcProfiler.endStartSection("outline"); -+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, entityplayer.getHeldItem(), partialTicks)) - renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); - GlStateManager.enableAlpha(); + GlStateManager.func_179118_c(); + this.field_78531_r.field_71424_I.func_76318_c("outline"); ++ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, field_78531_r.field_71476_x, 0, entityplayer.func_70694_bm(), p_175068_2_)) + renderglobal.func_72731_b(entityplayer, this.field_78531_r.field_71476_x, 0, p_175068_2_); + GlStateManager.func_179141_d(); } @@ -1339,6 +1339,7 @@ EntityPlayer entityplayer1 = (EntityPlayer)entity; - GlStateManager.disableAlpha(); - this.mc.mcProfiler.endStartSection("outline"); -+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer1, mc.objectMouseOver, 0, entityplayer1.getHeldItem(), partialTicks)) - renderglobal.drawSelectionBox(entityplayer1, this.mc.objectMouseOver, 0, partialTicks); - GlStateManager.enableAlpha(); + GlStateManager.func_179118_c(); + this.field_78531_r.field_71424_I.func_76318_c("outline"); ++ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer1, field_78531_r.field_71476_x, 0, entityplayer1.func_70694_bm(), p_175068_2_)) + renderglobal.func_72731_b(entityplayer1, this.field_78531_r.field_71476_x, 0, p_175068_2_); + GlStateManager.func_179141_d(); } @@ -1380,6 +1381,15 @@ - GlStateManager.shadeModel(7425); - this.mc.mcProfiler.endStartSection("translucent"); - renderglobal.renderBlockLayer(EnumWorldBlockLayer.TRANSLUCENT, (double)partialTicks, pass, entity); -+ if (!this.debugView) //Only render if render pass 0 happens as well. + GlStateManager.func_179103_j(7425); + this.field_78531_r.field_71424_I.func_76318_c("translucent"); + renderglobal.func_174977_a(EnumWorldBlockLayer.TRANSLUCENT, (double)p_175068_2_, p_175068_1_, entity); ++ if (!this.field_175078_W) //Only render if render pass 0 happens as well. + { -+ RenderHelper.enableStandardItemLighting(); -+ this.mc.mcProfiler.endStartSection("entities"); ++ RenderHelper.func_74519_b(); ++ this.field_78531_r.field_71424_I.func_76318_c("entities"); + net.minecraftforge.client.ForgeHooksClient.setRenderPass(1); -+ renderglobal.renderEntities(entity, icamera, partialTicks); ++ renderglobal.func_180446_a(entity, icamera, p_175068_2_); + net.minecraftforge.client.ForgeHooksClient.setRenderPass(-1); -+ RenderHelper.disableStandardItemLighting(); ++ RenderHelper.func_74518_a(); + } - GlStateManager.shadeModel(7424); - GlStateManager.depthMask(true); - GlStateManager.enableCull(); + GlStateManager.func_179103_j(7424); + GlStateManager.func_179132_a(true); + GlStateManager.func_179089_o(); @@ -1392,8 +1402,12 @@ - this.renderCloudsCheck(renderglobal, partialTicks, pass); + this.func_180437_a(renderglobal, p_175068_2_, p_175068_1_); } -+ this.mc.mcProfiler.endStartSection("forge_render_last"); -+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(renderglobal, partialTicks); ++ this.field_78531_r.field_71424_I.func_76318_c("forge_render_last"); ++ net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(renderglobal, p_175068_2_); + - this.mc.mcProfiler.endStartSection("hand"); + this.field_78531_r.field_71424_I.func_76318_c("hand"); -+ if (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(renderglobal, partialTicks, pass)) - if (this.renderHand) ++ if (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(renderglobal, p_175068_2_, p_175068_1_)) + if (this.field_175074_C) { - GlStateManager.clear(256); + GlStateManager.func_179086_m(256); @@ -1505,6 +1519,13 @@ - protected void renderRainSnow(float partialTicks) + protected void func_78474_d(float p_78474_1_) { -+ net.minecraftforge.client.IRenderHandler renderer = this.mc.theWorld.provider.getWeatherRenderer(); ++ net.minecraftforge.client.IRenderHandler renderer = this.field_78531_r.field_71441_e.field_73011_w.getWeatherRenderer(); + if (renderer != null) + { -+ renderer.render(partialTicks, this.mc.theWorld, mc); ++ renderer.render(p_78474_1_, this.field_78531_r.field_71441_e, field_78531_r); + return; + } + - float f = this.mc.theWorld.getRainStrength(partialTicks); + float f = this.field_78531_r.field_71441_e.func_72867_j(p_78474_1_); if (f > 0.0F) @@ -1830,6 +1851,13 @@ - this.fogColorBlue = f7; + this.field_175081_S = f7; } -+ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, entity, block, partialTicks, this.fogColorRed, this.fogColorGreen, this.fogColorBlue); ++ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, entity, block, p_78466_1_, this.field_175080_Q, this.field_175082_R, this.field_175081_S); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + -+ this.fogColorRed = event.red; -+ this.fogColorGreen = event.green; -+ this.fogColorBlue = event.blue; ++ this.field_175080_Q = event.red; ++ this.field_175082_R = event.green; ++ this.field_175081_S = event.blue; + - GlStateManager.clearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F); + GlStateManager.func_179082_a(this.field_175080_Q, this.field_175082_R, this.field_175081_S, 0.0F); } @@ -1848,6 +1876,10 @@ - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); + GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + Block block = ActiveRenderInfo.func_180786_a(this.field_78531_r.field_71441_e, entity, p_78468_2_); -+ float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, entity, block, partialTicks, 0.1F); ++ float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, entity, block, p_78468_2_, 0.1F); + if (hook >= 0) -+ GlStateManager.setFogDensity(hook); ++ GlStateManager.func_179095_a(hook); + else - if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.blindness)) + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).func_70644_a(Potion.field_76440_q)) { float f1 = 5.0F; @@ -1925,6 +1957,7 @@ - GlStateManager.setFogStart(f * 0.05F); - GlStateManager.setFogEnd(Math.min(f, 192.0F) * 0.5F); + GlStateManager.func_179102_b(f * 0.05F); + GlStateManager.func_179153_c(Math.min(f, 192.0F) * 0.5F); } -+ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, entity, block, partialTicks, p_78468_1_, f); ++ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, entity, block, p_78468_2_, p_78468_1_, f); } - GlStateManager.enableColorMaterial(); + GlStateManager.func_179142_g(); diff --git a/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch index 54170de87..fd3e46ca8 100644 --- a/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java @@ -80,6 +80,8 @@ - this.drawTexturedModalRect(i + 6, j + 7, 0 + i1 % 8 * 18, 198 + i1 / 8 * 18, 18, 18); + this.func_73729_b(i + 6, j + 7, 0 + i1 % 8 * 18, 198 + i1 / 8 * 18, 18, 18); } -+ potion.renderInventoryEffect(i, j, potioneffect, mc); ++ potion.renderInventoryEffect(i, j, potioneffect, field_146297_k); + if (!potion.shouldRenderInvText(potioneffect)) continue; - String s1 = I18n.format(potion.getName(), new Object[0]); + String s1 = I18n.func_135052_a(potion.func_76393_a(), new Object[0]); - if (potioneffect.getAmplifier() == 1) + if (potioneffect.func_76458_c() == 1) diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch index deb8b5987..09c4a9878 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch @@ -6,9 +6,9 @@ + if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartItemModel) + { -+ ibakedmodel = ((net.minecraftforge.client.model.ISmartItemModel)ibakedmodel).handleItemState(stack); ++ ibakedmodel = ((net.minecraftforge.client.model.ISmartItemModel)ibakedmodel).handleItemState(p_178089_1_); + } + if (ibakedmodel == null) { - ibakedmodel = this.modelManager.getMissingModel(); + ibakedmodel = this.field_178090_d.func_174951_a(); diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch index 601dcb350..9e4e3ebcd 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -2,57 +2,57 @@ +++ ../src-work/minecraft/net/minecraft/client/renderer/ItemRenderer.java @@ -313,7 +313,7 @@ - if (this.itemToRender != null) + if (this.field_78453_b != null) { -- if (this.itemToRender.getItem() == Items.filled_map) -+ if (this.itemToRender.getItem() instanceof net.minecraft.item.ItemMap) +- if (this.field_78453_b.func_77973_b() == Items.field_151098_aY) ++ if (this.field_78453_b.func_77973_b() instanceof net.minecraft.item.ItemMap) { this.func_178097_a(abstractclientplayer, f2, f, f1); } @@ -365,6 +365,7 @@ - if (this.mc.thePlayer.isEntityInsideOpaqueBlock()) + if (this.field_78455_a.field_71439_g.func_70094_T()) { - IBlockState iblockstate = this.mc.theWorld.getBlockState(new BlockPos(this.mc.thePlayer)); -+ BlockPos overlayPos = new BlockPos(this.mc.thePlayer); - EntityPlayer entityplayer = this.mc.thePlayer; + IBlockState iblockstate = this.field_78455_a.field_71441_e.func_180495_p(new BlockPos(this.field_78455_a.field_71439_g)); ++ BlockPos overlayPos = new BlockPos(this.field_78455_a.field_71439_g); + EntityPlayer entityplayer = this.field_78455_a.field_71439_g; for (int i = 0; i < 8; ++i) @@ -378,11 +379,13 @@ - if (iblockstate1.getBlock().isVisuallyOpaque()) + if (iblockstate1.func_177230_c().func_176214_u()) { iblockstate = iblockstate1; + overlayPos = blockpos; } } - if (iblockstate.getBlock().getRenderType() != -1) + if (iblockstate.func_177230_c().func_149645_b() != -1) { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(mc.thePlayer, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, overlayPos)) - this.func_178108_a(p_78447_1_, this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate)); ++ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(field_78455_a.field_71439_g, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, overlayPos)) + this.func_178108_a(p_78447_1_, this.field_78455_a.func_175602_ab().func_175023_a().func_178122_a(iblockstate)); } } @@ -391,11 +394,13 @@ { - if (this.mc.thePlayer.isInsideOfMaterial(Material.water)) + if (this.field_78455_a.field_71439_g.func_70055_a(Material.field_151586_h)) { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderWaterOverlay(mc.thePlayer, p_78447_1_)) - this.renderWaterOverlayTexture(p_78447_1_); ++ if (!net.minecraftforge.event.ForgeEventFactory.renderWaterOverlay(field_78455_a.field_71439_g, p_78447_1_)) + this.func_78448_c(p_78447_1_); } - if (this.mc.thePlayer.isBurning()) + if (this.field_78455_a.field_71439_g.func_70027_ad()) { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderFireOverlay(mc.thePlayer, p_78447_1_)) - this.renderFireInFirstPerson(p_78447_1_); ++ if (!net.minecraftforge.event.ForgeEventFactory.renderFireOverlay(field_78455_a.field_71439_g, p_78447_1_)) + this.func_78442_d(p_78447_1_); } } @@ -512,6 +517,12 @@ { - if (!this.itemToRender.getIsItemStackEqual(itemstack)) + if (!this.field_78453_b.func_179549_c(itemstack)) { -+ if (!this.itemToRender.getItem().shouldCauseReequipAnimation(this.itemToRender, itemstack, equippedItemSlot != entityplayer.inventory.currentItem)) ++ if (!this.field_78453_b.func_77973_b().shouldCauseReequipAnimation(this.field_78453_b, itemstack, field_78450_g != entityplayer.field_71071_by.field_70461_c)) + { -+ this.itemToRender = itemstack; -+ this.equippedItemSlot = entityplayer.inventory.currentItem; ++ this.field_78453_b = itemstack; ++ this.field_78450_g = entityplayer.field_71071_by.field_70461_c; + return; + } flag = true; diff --git a/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch b/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch index 385023ab0..98273ca48 100644 --- a/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch @@ -1,14 +1,14 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/OpenGlHelper.java +++ ../src-work/minecraft/net/minecraft/client/renderer/OpenGlHelper.java @@ -83,6 +83,10 @@ - public static int GL_ARRAY_BUFFER; - public static int GL_STATIC_DRAW; + public static int field_176089_P; + public static int field_148826_e; + /* Stores the last values sent into setLightmapTextureCoords */ + public static float lastBrightnessX = 0.0f; + public static float lastBrightnessY = 0.0f; + - public static void initializeTextures() + public static void func_77474_a() { ContextCapabilities contextcapabilities = GLContext.getCapabilities(); @@ -843,6 +847,12 @@ @@ -16,11 +16,11 @@ GL13.glMultiTexCoord2f(p_77475_0_, p_77475_1_, p_77475_2_); } + -+ if (p_77475_0_ == lightmapTexUnit) ++ if (p_77475_0_ == field_77476_b) + { + lastBrightnessX = p_77475_1_; + lastBrightnessY = p_77475_2_; + } } - public static void glBlendFunc(int p_148821_0_, int p_148821_1_, int p_148821_2_, int p_148821_3_) + public static void func_148821_a(int p_148821_0_, int p_148821_1_, int p_148821_2_, int p_148821_3_) diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch index b16266d6c..395aa5466 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch @@ -2,116 +2,116 @@ +++ ../src-work/minecraft/net/minecraft/client/renderer/RenderGlobal.java @@ -525,8 +525,10 @@ - public void renderEntities(Entity p_180446_1_, ICamera p_180446_2_, float partialTicks) + public void func_180446_a(Entity p_180446_1_, ICamera p_180446_2_, float p_180446_3_) { + int pass = net.minecraftforge.client.MinecraftForgeClient.getRenderPass(); - if (this.renderEntitiesStartupCounter > 0) + if (this.field_72740_G > 0) { + if (pass > 0) return; - --this.renderEntitiesStartupCounter; + --this.field_72740_G; } else @@ -537,9 +539,12 @@ - this.theWorld.theProfiler.startSection("prepare"); - TileEntityRendererDispatcher.instance.cacheActiveRenderInfo(this.theWorld, this.mc.getTextureManager(), this.mc.fontRendererObj, this.mc.getRenderViewEntity(), partialTicks); - this.renderManager.cacheActiveRenderInfo(this.theWorld, this.mc.fontRendererObj, this.mc.getRenderViewEntity(), this.mc.pointedEntity, this.mc.gameSettings, partialTicks); + this.field_72769_h.field_72984_F.func_76320_a("prepare"); + TileEntityRendererDispatcher.field_147556_a.func_178470_a(this.field_72769_h, this.field_72777_q.func_110434_K(), this.field_72777_q.field_71466_p, this.field_72777_q.func_175606_aa(), p_180446_3_); + this.field_175010_j.func_180597_a(this.field_72769_h, this.field_72777_q.field_71466_p, this.field_72777_q.func_175606_aa(), this.field_72777_q.field_147125_j, this.field_72777_q.field_71474_y, p_180446_3_); + if(pass == 0) + { - this.countEntitiesTotal = 0; - this.countEntitiesRendered = 0; - this.countEntitiesHidden = 0; + this.field_72748_H = 0; + this.field_72749_I = 0; + this.field_72750_J = 0; + } - Entity entity = this.mc.getRenderViewEntity(); - double d3 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; - double d4 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; + Entity entity = this.field_72777_q.func_175606_aa(); + double d3 = entity.field_70142_S + (entity.field_70165_t - entity.field_70142_S) * (double)p_180446_3_; + double d4 = entity.field_70137_T + (entity.field_70163_u - entity.field_70137_T) * (double)p_180446_3_; @@ -551,11 +556,15 @@ - this.mc.entityRenderer.enableLightmap(); - this.theWorld.theProfiler.endStartSection("global"); - List list = this.theWorld.getLoadedEntityList(); + this.field_72777_q.field_71460_t.func_180436_i(); + this.field_72769_h.field_72984_F.func_76318_c("global"); + List list = this.field_72769_h.func_72910_y(); + if (pass == 0) + { - this.countEntitiesTotal = list.size(); + this.field_72748_H = list.size(); + } - for (int i = 0; i < this.theWorld.weatherEffects.size(); ++i) + for (int i = 0; i < this.field_72769_h.field_73007_j.size(); ++i) { - Entity entity1 = (Entity)this.theWorld.weatherEffects.get(i); + Entity entity1 = (Entity)this.field_72769_h.field_73007_j.get(i); + if (!entity1.shouldRenderInPass(pass)) continue; - ++this.countEntitiesRendered; + ++this.field_72749_I; - if (entity1.isInRangeToRender3d(d0, d1, d2)) + if (entity1.func_145770_h(d0, d1, d2)) @@ -577,6 +586,7 @@ for (int j = 0; j < list.size(); ++j) { Entity entity3 = (Entity)list.get(j); + if (!entity3.shouldRenderInPass(pass)) continue; - boolean flag = this.mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping(); - boolean flag1 = entity3.isInRangeToRender3d(d0, d1, d2) && (entity3.ignoreFrustumCheck || p_180446_2_.isBoundingBoxInFrustum(entity3.getEntityBoundingBox()) || entity3.riddenByEntity == this.mc.thePlayer) && entity3 instanceof EntityPlayer; + boolean flag = this.field_72777_q.func_175606_aa() instanceof EntityLivingBase && ((EntityLivingBase)this.field_72777_q.func_175606_aa()).func_70608_bn(); + boolean flag1 = entity3.func_145770_h(d0, d1, d2) && (entity3.field_70158_ak || p_180446_2_.func_78546_a(entity3.func_174813_aQ()) || entity3.field_70153_n == this.field_72777_q.field_71439_g) && entity3 instanceof EntityPlayer; @@ -626,6 +636,7 @@ } entity2 = (Entity)iterator.next(); + if (!entity2.shouldRenderInPass(pass)) continue; - flag2 = this.renderManager.shouldRender(entity2, p_180446_2_, d0, d1, d2) || entity2.riddenByEntity == this.mc.thePlayer; + flag2 = this.field_175010_j.func_178635_a(entity2, p_180446_2_, d0, d1, d2) || entity2.field_70153_n == this.field_72777_q.field_71439_g; if (!flag2) @@ -662,6 +673,7 @@ { for (TileEntity tileentity2 : list1) { -+ if (!tileentity2.shouldRenderInPass(pass) || !p_180446_2_.isBoundingBoxInFrustum(tileentity2.getRenderBoundingBox())) continue; - TileEntityRendererDispatcher.instance.renderTileEntity(tileentity2, partialTicks, -1); ++ if (!tileentity2.shouldRenderInPass(pass) || !p_180446_2_.func_78546_a(tileentity2.getRenderBoundingBox())) continue; + TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity2, p_180446_3_, -1); } } @@ -671,6 +683,7 @@ { for (TileEntity tileentity : this.field_181024_n) { -+ if (!tileentity.shouldRenderInPass(pass) || !p_180446_2_.isBoundingBoxInFrustum(tileentity.getRenderBoundingBox())) continue; - TileEntityRendererDispatcher.instance.renderTileEntity(tileentity, partialTicks, -1); ++ if (!tileentity.shouldRenderInPass(pass) || !p_180446_2_.func_78546_a(tileentity.getRenderBoundingBox())) continue; + TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity, p_180446_3_, -1); } } @@ -700,7 +713,7 @@ - Block block = this.theWorld.getBlockState(blockpos).getBlock(); + Block block = this.field_72769_h.func_180495_p(blockpos).func_177230_c(); - if (tileentity1 != null && (block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull)) -+ if (tileentity1 != null && tileentity1.shouldRenderInPass(pass) && tileentity1.canRenderBreaking() && p_180446_2_.isBoundingBoxInFrustum(tileentity1.getRenderBoundingBox())) ++ if (tileentity1 != null && tileentity1.shouldRenderInPass(pass) && tileentity1.canRenderBreaking() && p_180446_2_.func_78546_a(tileentity1.getRenderBoundingBox())) { - TileEntityRendererDispatcher.instance.renderTileEntity(tileentity1, partialTicks, destroyblockprogress.getPartialBlockDamage()); + TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity1, p_180446_3_, destroyblockprogress.func_73106_e()); } @@ -1161,6 +1174,12 @@ - public void renderSky(float partialTicks, int pass) + public void func_174976_a(float p_174976_1_, int p_174976_2_) { -+ net.minecraftforge.client.IRenderHandler renderer = this.theWorld.provider.getSkyRenderer(); ++ net.minecraftforge.client.IRenderHandler renderer = this.field_72769_h.field_73011_w.getSkyRenderer(); + if (renderer != null) + { -+ renderer.render(partialTicks, theWorld, mc); ++ renderer.render(p_174976_1_, field_72769_h, field_72777_q); + return; + } - if (this.mc.theWorld.provider.getDimensionId() == 1) + if (this.field_72777_q.field_71441_e.field_73011_w.func_177502_q() == 1) { - this.renderSkyEnd(); + this.func_180448_r(); @@ -1378,6 +1397,12 @@ - public void renderClouds(float p_180447_1_, int p_180447_2_) + public void func_180447_b(float p_180447_1_, int p_180447_2_) { -+ net.minecraftforge.client.IRenderHandler renderer = this.mc.theWorld.provider.getCloudRenderer(); ++ net.minecraftforge.client.IRenderHandler renderer = this.field_72777_q.field_71441_e.field_73011_w.getCloudRenderer(); + if (renderer != null) + { -+ renderer.render(p_180447_1_, this.mc.theWorld, mc); ++ renderer.render(p_180447_1_, this.field_72777_q.field_71441_e, field_72777_q); + return; + } - if (this.mc.theWorld.provider.isSurfaceWorld()) + if (this.field_72777_q.field_71441_e.field_73011_w.func_76569_d()) { - if (this.mc.gameSettings.func_181147_e() == 2) + if (this.field_72777_q.field_71474_y.func_181147_e() == 2) @@ -1793,8 +1818,11 @@ - double d4 = (double)blockpos.getY() - d1; - double d5 = (double)blockpos.getZ() - d2; - Block block = this.theWorld.getBlockState(blockpos).getBlock(); -+ TileEntity te = this.theWorld.getTileEntity(blockpos); + double d4 = (double)blockpos.func_177956_o() - d1; + double d5 = (double)blockpos.func_177952_p() - d2; + Block block = this.field_72769_h.func_180495_p(blockpos).func_177230_c(); ++ TileEntity te = this.field_72769_h.func_175625_s(blockpos); + boolean hasBreak = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull; + if (!hasBreak) hasBreak = te != null && te.canRenderBreaking(); @@ -121,20 +121,20 @@ if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) { @@ -1949,13 +1977,16 @@ - if (recordName != null) + if (p_174961_1_ != null) { - ItemRecord itemrecord = ItemRecord.getRecord(recordName); + ItemRecord itemrecord = ItemRecord.func_150926_b(p_174961_1_); + ResourceLocation resource = null; if (itemrecord != null) { - this.mc.ingameGUI.setRecordPlayingMessage(itemrecord.getRecordNameLocal()); -+ resource = itemrecord.getRecordResource(recordName); + this.field_72777_q.field_71456_v.func_73833_a(itemrecord.func_150927_i()); ++ resource = itemrecord.getRecordResource(p_174961_1_); } -- PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(new ResourceLocation(recordName), (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ()); -+ if (resource == null) resource = new ResourceLocation(recordName); -+ PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(resource, (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ()); - this.mapSoundPositions.put(blockPosIn, positionedsoundrecord); - this.mc.getSoundHandler().playSound(positionedsoundrecord); +- PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.func_147675_a(new ResourceLocation(p_174961_1_), (float)p_174961_2_.func_177958_n(), (float)p_174961_2_.func_177956_o(), (float)p_174961_2_.func_177952_p()); ++ if (resource == null) resource = new ResourceLocation(p_174961_1_); ++ PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.func_147675_a(resource, (float)p_174961_2_.func_177958_n(), (float)p_174961_2_.func_177956_o(), (float)p_174961_2_.func_177952_p()); + this.field_147593_P.put(p_174961_2_, positionedsoundrecord); + this.field_72777_q.func_147118_V().func_147682_a(positionedsoundrecord); } diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch index 4e597ab6f..4b2f9e3c2 100644 --- a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch @@ -6,7 +6,7 @@ + public void checkAndGrow() + { -+ this.func_181670_b(vertexFormat.getNextOffset()/* / 4 * 4 */); ++ this.func_181670_b(field_179011_q.func_177338_f()/* / 4 * 4 */); + } + @SideOnly(Side.CLIENT) diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch b/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch index 2551f52b9..3102b6d98 100644 --- a/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch @@ -6,41 +6,41 @@ { + // moved to VertexFormatElement.preDraw VertexFormatElement vertexformatelement = (VertexFormatElement)list.get(j); -- VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.getUsage(); -- int k = vertexformatelement.getType().getGlConstant(); -- int l = vertexformatelement.getIndex(); +- VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.func_177375_c(); +- int k = vertexformatelement.func_177367_b().func_177397_c(); +- int l = vertexformatelement.func_177369_e(); - bytebuffer.position(vertexformat.func_181720_d(j)); - - switch (vertexformatelement$enumusage) - { - case POSITION: -- GL11.glVertexPointer(vertexformatelement.getElementCount(), k, i, bytebuffer); +- GL11.glVertexPointer(vertexformatelement.func_177370_d(), k, i, bytebuffer); - GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); - break; - case UV: -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + l); -- GL11.glTexCoordPointer(vertexformatelement.getElementCount(), k, i, bytebuffer); +- OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a + l); +- GL11.glTexCoordPointer(vertexformatelement.func_177370_d(), k, i, bytebuffer); - GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); +- OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a); - break; - case COLOR: -- GL11.glColorPointer(vertexformatelement.getElementCount(), k, i, bytebuffer); +- GL11.glColorPointer(vertexformatelement.func_177370_d(), k, i, bytebuffer); - GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); - break; - case NORMAL: - GL11.glNormalPointer(k, i, bytebuffer); - GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY); - } -+ vertexformatelement.getUsage().preDraw(vertexformat, j, i, bytebuffer); ++ vertexformatelement.func_177375_c().preDraw(vertexformat, j, i, bytebuffer); } - GL11.glDrawArrays(p_181679_1_.getDrawMode(), 0, p_181679_1_.getVertexCount()); + GL11.glDrawArrays(p_181679_1_.func_178979_i(), 0, p_181679_1_.func_178989_h()); @@ -57,26 +34,8 @@ for (int j1 = list.size(); i1 < j1; ++i1) { VertexFormatElement vertexformatelement1 = (VertexFormatElement)list.get(i1); -- VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.getUsage(); -- int k1 = vertexformatelement1.getIndex(); +- VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.func_177375_c(); +- int k1 = vertexformatelement1.func_177369_e(); - - switch (vertexformatelement$enumusage1) - { @@ -48,19 +48,19 @@ - GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); - break; - case UV: -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + k1); +- OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a + k1); - GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); +- OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a); - break; - case COLOR: - GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); -- GlStateManager.resetColor(); +- GlStateManager.func_179117_G(); - break; - case NORMAL: - GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); - } + // moved to VertexFormatElement.postDraw -+ vertexformatelement1.getUsage().postDraw(vertexformat, i1, i, bytebuffer); ++ vertexformatelement1.func_177375_c().postDraw(vertexformat, i1, i, bytebuffer); } } diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch index 97dc4cd38..656fce0df 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch @@ -8,6 +8,6 @@ +public class BakedQuad implements net.minecraftforge.client.model.pipeline.IVertexProducer { + @Override public void pipe(net.minecraftforge.client.model.pipeline.IVertexConsumer consumer) { net.minecraftforge.client.model.pipeline.LightUtil.putBakedQuad(consumer, this); } - protected final int[] vertexData; - protected final int tintIndex; - protected final EnumFacing face; + protected final int[] field_178215_a; + protected final int field_178213_b; + protected final EnumFacing field_178214_c; diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch index a26f6c4b9..fb28a524d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch @@ -1,68 +1,82 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java -@@ -20,6 +20,11 @@ +@@ -20,7 +20,12 @@ - public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) + public BakedQuad func_178414_a(Vector3f p_178414_1_, Vector3f p_178414_2_, BlockPartFace p_178414_3_, TextureAtlasSprite p_178414_4_, EnumFacing p_178414_5_, ModelRotation p_178414_6_, BlockPartRotation p_178414_7_, boolean p_178414_8_, boolean p_178414_9_) { -+ return makeBakedQuad(posFrom, posTo, face, sprite, facing, (net.minecraftforge.client.model.ITransformation)modelRotationIn, partRotation, uvLocked, shade); +- int[] aint = this.func_178405_a(p_178414_3_, p_178414_4_, p_178414_5_, this.func_178403_a(p_178414_1_, p_178414_2_), p_178414_6_, p_178414_7_, p_178414_8_, p_178414_9_); ++ return makeBakedQuad(p_178414_1_, p_178414_2_, p_178414_3_, p_178414_4_, p_178414_5_, (net.minecraftforge.client.model.ITransformation)p_178414_6_, p_178414_7_, p_178414_8_, p_178414_9_); + } + -+ public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) ++ public BakedQuad makeBakedQuad(Vector3f p_178414_1_, Vector3f p_178414_2_, BlockPartFace p_178414_3_, TextureAtlasSprite p_178414_4_, EnumFacing p_178414_5_, net.minecraftforge.client.model.ITransformation p_178414_6_, BlockPartRotation p_178414_7_, boolean p_178414_8_, boolean p_178414_9_) + { - int[] aint = this.makeQuadVertexData(face, sprite, facing, this.getPositionsDiv16(posFrom, posTo), modelRotationIn, partRotation, uvLocked, shade); - EnumFacing enumfacing = getFacingFromVertexData(aint); ++ int[] aint = this.makeQuadVertexData(p_178414_3_, p_178414_4_, p_178414_5_, this.func_178403_a(p_178414_1_, p_178414_2_), p_178414_6_, p_178414_7_, p_178414_8_, p_178414_9_); + EnumFacing enumfacing = func_178410_a(aint); -@@ -33,11 +38,17 @@ + if (p_178414_8_) +@@ -33,16 +38,22 @@ this.func_178408_a(aint, enumfacing); } + net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing); - return new BakedQuad(aint, face.tintIndex, enumfacing); + return new BakedQuad(aint, p_178414_3_.field_178245_c, enumfacing); } - private int[] makeQuadVertexData(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, ModelRotation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean shade) + private int[] func_178405_a(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, ModelRotation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean p_178405_8_) { -+ return makeQuadVertexData(p_178405_1_, p_178405_2_, p_178405_3_, p_178405_4_, p_178405_5_, p_178405_6_, p_178405_7_, shade); ++ return func_178405_a(p_178405_1_, p_178405_2_, p_178405_3_, p_178405_4_, p_178405_5_, p_178405_6_, p_178405_7_, p_178405_8_); + } + -+ private int[] makeQuadVertexData(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, net.minecraftforge.client.model.ITransformation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean shade) ++ private int[] makeQuadVertexData(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, net.minecraftforge.client.model.ITransformation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean p_178405_8_) + { int[] aint = new int[28]; for (int i = 0; i < 4; ++i) -@@ -88,7 +99,12 @@ + { +- this.func_178402_a(aint, i, p_178405_3_, p_178405_1_, p_178405_4_, p_178405_2_, p_178405_5_, p_178405_6_, p_178405_7_, p_178405_8_); ++ this.fillVertexData(aint, i, p_178405_3_, p_178405_1_, p_178405_4_, p_178405_2_, p_178405_5_, p_178405_6_, p_178405_7_, p_178405_8_); + } - private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) + return aint; +@@ -88,12 +99,17 @@ + + private void func_178402_a(int[] p_178402_1_, int p_178402_2_, EnumFacing p_178402_3_, BlockPartFace p_178402_4_, float[] p_178402_5_, TextureAtlasSprite p_178402_6_, ModelRotation p_178402_7_, BlockPartRotation p_178402_8_, boolean p_178402_9_, boolean p_178402_10_) { -- EnumFacing enumfacing = modelRotationIn.rotateFace(facing); -+ fillVertexData(faceData, vertexIndex, facing, partFace, p_178402_5_, sprite, modelRotationIn, partRotation, uvLocked, shade); +- EnumFacing enumfacing = p_178402_7_.func_177523_a(p_178402_3_); ++ func_178402_a(p_178402_1_, p_178402_2_, p_178402_3_, p_178402_4_, p_178402_5_, p_178402_6_, p_178402_7_, p_178402_8_, p_178402_9_, p_178402_10_); + } + -+ private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) ++ private void fillVertexData(int[] p_178402_1_, int p_178402_2_, EnumFacing p_178402_3_, BlockPartFace p_178402_4_, float[] p_178402_5_, TextureAtlasSprite p_178402_6_, net.minecraftforge.client.model.ITransformation p_178402_7_, BlockPartRotation p_178402_8_, boolean p_178402_9_, boolean p_178402_10_) + { -+ EnumFacing enumfacing = modelRotationIn.rotate(facing); - int i = shade ? this.getFaceShadeColor(enumfacing) : -1; - EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = EnumFaceDirection.getFacing(facing).func_179025_a(vertexIndex); ++ EnumFacing enumfacing = p_178402_7_.rotate(p_178402_3_); + int i = p_178402_10_ ? this.func_178413_a(enumfacing) : -1; + EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = EnumFaceDirection.func_179027_a(p_178402_3_).func_179025_a(p_178402_2_); Vector3f vector3f = new Vector3f(p_178402_5_[enumfacedirection$vertexinformation.field_179184_a], p_178402_5_[enumfacedirection$vertexinformation.field_179182_b], p_178402_5_[enumfacedirection$vertexinformation.field_179183_c]); + this.func_178407_a(vector3f, p_178402_8_); +- int j = this.func_178415_a(vector3f, p_178402_3_, p_178402_2_, p_178402_7_, p_178402_9_); ++ int j = this.rotateVertex(vector3f, p_178402_3_, p_178402_2_, p_178402_7_, p_178402_9_); + this.func_178404_a(p_178402_1_, j, p_178402_2_, vector3f, i, p_178402_6_, p_178402_4_.field_178243_e); + } + @@ -154,14 +170,19 @@ - public int rotateVertex(Vector3f position, EnumFacing facing, int vertexIndex, ModelRotation modelRotationIn, boolean uvLocked) + public int func_178415_a(Vector3f p_178415_1_, EnumFacing p_178415_2_, int p_178415_3_, ModelRotation p_178415_4_, boolean p_178415_5_) { -+ return rotateVertex(position, facing, vertexIndex, modelRotationIn, uvLocked); ++ return func_178415_a(p_178415_1_, p_178415_2_, p_178415_3_, p_178415_4_, p_178415_5_); + } + -+ public int rotateVertex(Vector3f position, EnumFacing facing, int vertexIndex, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) ++ public int rotateVertex(Vector3f p_178415_1_, EnumFacing p_178415_2_, int p_178415_3_, net.minecraftforge.client.model.ITransformation p_178415_4_, boolean p_178415_5_) + { - if (modelRotationIn == ModelRotation.X0_Y0) + if (p_178415_4_ == ModelRotation.X0_Y0) { - return vertexIndex; + return p_178415_3_; } else { -- this.rotateScale(position, new Vector3f(0.5F, 0.5F, 0.5F), modelRotationIn.getMatrix4d(), new Vector3f(1.0F, 1.0F, 1.0F)); -- return modelRotationIn.rotateVertex(facing, vertexIndex); -+ net.minecraftforge.client.ForgeHooksClient.transform(position, modelRotationIn.getMatrix()); -+ return modelRotationIn.rotate(facing, vertexIndex); +- this.func_178406_a(p_178415_1_, new Vector3f(0.5F, 0.5F, 0.5F), p_178415_4_.func_177525_a(), new Vector3f(1.0F, 1.0F, 1.0F)); +- return p_178415_4_.func_177520_a(p_178415_2_, p_178415_3_); ++ net.minecraftforge.client.ForgeHooksClient.transform(p_178415_1_, p_178415_4_.getMatrix()); ++ return p_178415_4_.rotate(p_178415_2_, p_178415_3_); } } diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch index f38fed84c..2226f0b87 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch @@ -11,4 +11,4 @@ +@Deprecated public class ItemCameraTransforms { - public static final ItemCameraTransforms DEFAULT = new ItemCameraTransforms(); + public static final ItemCameraTransforms field_178357_a = new ItemCameraTransforms(); diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch index fc01e17a3..e0fa743a5 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch @@ -13,6 +13,6 @@ +public class ItemTransformVec3f implements net.minecraftforge.client.model.IModelState { + public net.minecraftforge.client.model.TRSRTransformation apply(net.minecraftforge.client.model.IModelPart part) { return new net.minecraftforge.client.model.TRSRTransformation(this); } - public static final ItemTransformVec3f DEFAULT = new ItemTransformVec3f(new Vector3f(), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F)); - public final Vector3f rotation; - public final Vector3f translation; + 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 final Vector3f field_178365_c; diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch index f336ff667..30299b290 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch @@ -2,28 +2,28 @@ +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java @@ -29,7 +29,7 @@ - public static ModelBlockDefinition parseFromReader(Reader p_178331_0_) + public static ModelBlockDefinition func_178331_a(Reader p_178331_0_) { -- return (ModelBlockDefinition)GSON.fromJson(p_178331_0_, ModelBlockDefinition.class); -+ return net.minecraftforge.client.model.BlockStateLoader.load(p_178331_0_, GSON); +- return (ModelBlockDefinition)field_178333_a.fromJson(p_178331_0_, ModelBlockDefinition.class); ++ return net.minecraftforge.client.model.BlockStateLoader.load(p_178331_0_, field_178333_a); } public ModelBlockDefinition(Collection p_i46221_1_) @@ -155,11 +155,17 @@ - return this.modelLocation; + return this.field_178437_a; } + @Deprecated - public ModelRotation getRotation() + public ModelRotation func_178432_b() { - return this.modelRotation; + return this.field_178435_b; } + public net.minecraftforge.client.model.IModelState getState() + { -+ return this.modelRotation; ++ return this.field_178435_b; + } + - public boolean isUvLocked() + public boolean func_178433_c() { - return this.uvLock; + return this.field_178436_c; diff --git a/patches/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch index 8bc0885c1..035810033 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch @@ -4,8 +4,8 @@ } else { -- s = ((IProperty)this.property).getName((Comparable)map.remove(this.property)); -+ s = String.format("%s:%s", ((ResourceLocation)Block.blockRegistry.getNameForObject(p_178132_1_.getBlock())).getResourceDomain(), ((IProperty)this.property).getName((Comparable)map.remove(this.property))); +- s = ((IProperty)this.field_178142_a).func_177702_a((Comparable)map.remove(this.field_178142_a)); ++ s = String.format("%s:%s", ((ResourceLocation)Block.field_149771_c.func_177774_c(p_178132_1_.func_177230_c())).func_110624_b(), ((IProperty)this.field_178142_a).func_177702_a((Comparable)map.remove(this.field_178142_a))); } - if (this.suffix != null) + if (this.field_178141_c != null) diff --git a/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch b/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch index 2703427da..f88c6b175 100644 --- a/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch @@ -4,41 +4,41 @@ return; } -- iblockaccess = new RegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1); -+ iblockaccess = createRegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1); - p_178581_4_.setCompiledChunk(compiledchunk); +- iblockaccess = new RegionRenderCache(this.field_178588_d, blockpos.func_177982_a(-1, -1, -1), blockpos1.func_177982_a(1, 1, 1), 1); ++ iblockaccess = createRegionRenderCache(this.field_178588_d, blockpos.func_177982_a(-1, -1, -1), blockpos1.func_177982_a(1, 1, 1), 1); + p_178581_4_.func_178543_a(compiledchunk); } finally @@ -158,7 +158,7 @@ lvt_10_1_.func_178606_a(blockpos$mutableblockpos); } -- if (block.hasTileEntity()) +- if (block.func_149716_u()) + if (block.hasTileEntity(iblockstate)) { - TileEntity tileentity = iblockaccess.getTileEntity(new BlockPos(blockpos$mutableblockpos)); - TileEntitySpecialRenderer tileentityspecialrenderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(tileentity); + TileEntity tileentity = iblockaccess.func_175625_s(new BlockPos(blockpos$mutableblockpos)); + TileEntitySpecialRenderer tileentityspecialrenderer = TileEntityRendererDispatcher.field_147556_a.func_147547_b(tileentity); @@ -174,7 +174,9 @@ } } -- EnumWorldBlockLayer enumworldblocklayer1 = block.getBlockLayer(); +- EnumWorldBlockLayer enumworldblocklayer1 = block.func_180664_k(); + for(EnumWorldBlockLayer enumworldblocklayer1 : EnumWorldBlockLayer.values()) { + if(!block.canRenderInLayer(enumworldblocklayer1)) continue; + net.minecraftforge.client.ForgeHooksClient.setRenderLayer(enumworldblocklayer1); int j = enumworldblocklayer1.ordinal(); - if (block.getRenderType() != -1) + if (block.func_149645_b() != -1) @@ -189,6 +191,7 @@ - aboolean[j] |= blockrendererdispatcher.renderBlock(iblockstate, blockpos$mutableblockpos, iblockaccess, worldrenderer); + aboolean[j] |= blockrendererdispatcher.func_175018_a(iblockstate, blockpos$mutableblockpos, iblockaccess, worldrenderer); } + } } for (EnumWorldBlockLayer enumworldblocklayer : EnumWorldBlockLayer.values()) @@ -385,6 +388,26 @@ - return this.needsUpdate; + return this.field_178593_n; } + /* ======================================== FORGE START =====================================*/ diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch index 2025f1404..ce01adce8 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch @@ -1,17 +1,17 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java @@ -41,7 +41,7 @@ - boolean flag = p_177077_9_.isGui3d(); + boolean flag = p_177077_9_.func_177556_c(); int i = this.func_177078_a(itemstack); float f = 0.25F; -- float f1 = MathHelper.sin(((float)p_177077_1_.getAge() + p_177077_8_) / 10.0F + p_177077_1_.hoverStart) * 0.1F + 0.1F; -+ float f1 = shouldBob() ? MathHelper.sin(((float)p_177077_1_.getAge() + p_177077_8_) / 10.0F + p_177077_1_.hoverStart) * 0.1F + 0.1F : 0; - float f2 = p_177077_9_.getItemCameraTransforms().func_181688_b(ItemCameraTransforms.TransformType.GROUND).scale.y; - GlStateManager.translate((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_); +- float f1 = MathHelper.func_76126_a(((float)p_177077_1_.func_174872_o() + p_177077_8_) / 10.0F + p_177077_1_.field_70290_d) * 0.1F + 0.1F; ++ float f1 = shouldBob() ? MathHelper.func_76126_a(((float)p_177077_1_.func_174872_o() + p_177077_8_) / 10.0F + p_177077_1_.field_70290_d) * 0.1F + 0.1F : 0; + float f2 = p_177077_9_.func_177552_f().func_181688_b(ItemCameraTransforms.TransformType.GROUND).field_178363_d.y; + GlStateManager.func_179109_b((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_); @@ -157,4 +157,25 @@ { - return TextureMap.locationBlocksTexture; + return TextureMap.field_110575_b; } + + /*==================================== FORGE START ===========================================*/ diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch index 79fc448ff..253b492fc 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch @@ -1,20 +1,20 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderItem.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderItem.java @@ -72,7 +72,7 @@ - public RenderItem(TextureManager textureManager, ModelManager modelManager) + public RenderItem(TextureManager p_i46165_1_, ModelManager p_i46165_2_) { - this.textureManager = textureManager; -- this.itemModelMesher = new ItemModelMesher(modelManager); -+ this.itemModelMesher = new net.minecraftforge.client.ItemModelMesherForge(modelManager); - this.registerItems(); + this.field_175057_n = p_i46165_1_; +- this.field_175059_m = new ItemModelMesher(p_i46165_2_); ++ this.field_175059_m = new net.minecraftforge.client.ItemModelMesherForge(p_i46165_2_); + this.func_175041_b(); } @@ -226,7 +226,7 @@ k = k | -16777216; } -- this.renderQuad(renderer, bakedquad, k); -+ net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(renderer, bakedquad, k); +- this.func_175033_a(p_175032_1_, bakedquad, k); ++ net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(p_175032_1_, bakedquad, k); } } @@ -25,66 +25,66 @@ + else + { + // TODO: maybe switch to the smart player model / normal smart item model? -+ modelresourcelocation = item.getModel(stack, entityplayer, entityplayer.getItemInUseCount()); ++ modelresourcelocation = item.getModel(p_175049_1_, entityplayer, entityplayer.func_71052_bv()); + } if (modelresourcelocation != null) { @@ -317,14 +322,9 @@ - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - GlStateManager.pushMatrix(); -- ItemCameraTransforms itemcameratransforms = model.getItemCameraTransforms(); -- itemcameratransforms.func_181689_a(cameraTransformType); + GlStateManager.func_179147_l(); + GlStateManager.func_179120_a(770, 771, 1, 0); + GlStateManager.func_179094_E(); +- ItemCameraTransforms itemcameratransforms = p_175040_2_.func_177552_f(); +- itemcameratransforms.func_181689_a(p_175040_3_); + // TODO: check if negative scale is a thing -+ model = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(model, cameraTransformType); ++ p_175040_2_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_175040_2_, p_175040_3_); -- if (this.func_183005_a(itemcameratransforms.func_181688_b(cameraTransformType))) +- if (this.func_183005_a(itemcameratransforms.func_181688_b(p_175040_3_))) - { -- GlStateManager.cullFace(1028); +- GlStateManager.func_179107_e(1028); - } - - this.renderItem(stack, model); - GlStateManager.cullFace(1029); - GlStateManager.popMatrix(); + this.func_180454_a(p_175040_1_, p_175040_2_); + GlStateManager.func_179107_e(1029); + GlStateManager.func_179121_F(); @@ -352,7 +352,7 @@ - GlStateManager.blendFunc(770, 771); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - this.setupGuiTransform(x, y, ibakedmodel.isGui3d()); -- ibakedmodel.getItemCameraTransforms().func_181689_a(ItemCameraTransforms.TransformType.GUI); + GlStateManager.func_179112_b(770, 771); + GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + this.func_180452_a(p_175042_2_, p_175042_3_, ibakedmodel.func_177556_c()); +- ibakedmodel.func_177552_f().func_181689_a(ItemCameraTransforms.TransformType.GUI); + ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GUI); - this.renderItem(stack, ibakedmodel); - GlStateManager.disableAlpha(); - GlStateManager.disableRescaleNormal(); + this.func_180454_a(p_175042_1_, ibakedmodel); + GlStateManager.func_179118_c(); + GlStateManager.func_179101_C(); @@ -459,10 +459,11 @@ - GlStateManager.enableDepth(); + GlStateManager.func_179126_j(); } -- if (stack.isItemDamaged()) -+ if (stack.getItem().showDurabilityBar(stack)) +- if (p_180453_2_.func_77951_h()) ++ if (p_180453_2_.func_77973_b().showDurabilityBar(p_180453_2_)) { -- int j = (int)Math.round(13.0D - (double)stack.getItemDamage() * 13.0D / (double)stack.getMaxDamage()); -- int i = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage()); -+ double health = stack.getItem().getDurabilityForDisplay(stack); +- int j = (int)Math.round(13.0D - (double)p_180453_2_.func_77952_i() * 13.0D / (double)p_180453_2_.func_77958_k()); +- int i = (int)Math.round(255.0D - (double)p_180453_2_.func_77952_i() * 255.0D / (double)p_180453_2_.func_77958_k()); ++ double health = p_180453_2_.func_77973_b().getDurabilityForDisplay(p_180453_2_); + int j = (int)Math.round(13.0D - health * 13.0D); + int i = (int)Math.round(255.0D - health * 255.0D); - GlStateManager.disableLighting(); - GlStateManager.disableDepth(); - GlStateManager.disableTexture2D(); + GlStateManager.func_179140_f(); + GlStateManager.func_179097_i(); + GlStateManager.func_179090_x(); @@ -473,7 +474,7 @@ - this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255); - this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 12, 1, (255 - i) / 4, 64, 0, 255); - this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, j, 1, 255 - i, i, 0, 255); -- GlStateManager.enableBlend(); + this.func_181565_a(worldrenderer, p_180453_3_ + 2, p_180453_4_ + 13, 13, 2, 0, 0, 0, 255); + this.func_181565_a(worldrenderer, p_180453_3_ + 2, p_180453_4_ + 13, 12, 1, (255 - i) / 4, 64, 0, 255); + this.func_181565_a(worldrenderer, p_180453_3_ + 2, p_180453_4_ + 13, j, 1, 255 - i, i, 0, 255); +- GlStateManager.func_179147_l(); + //GlStateManager.enableBlend(); // Forge: Disable Blend because it screws with a lot of things down the line. - GlStateManager.enableAlpha(); - GlStateManager.enableTexture2D(); - GlStateManager.enableLighting(); + GlStateManager.func_179141_d(); + GlStateManager.func_179098_w(); + GlStateManager.func_179145_e(); @@ -1038,6 +1039,7 @@ - this.registerBlock(Blocks.brown_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "brown_mushroom_block"); - this.registerBlock(Blocks.red_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "red_mushroom_block"); - this.registerBlock(Blocks.dragon_egg, "dragon_egg"); -+ net.minecraftforge.client.model.ModelLoader.onRegisterItems(this.itemModelMesher); + this.func_175029_a(Blocks.field_150420_aW, BlockHugeMushroom.EnumType.ALL_INSIDE.func_176896_a(), "brown_mushroom_block"); + this.func_175029_a(Blocks.field_150419_aX, BlockHugeMushroom.EnumType.ALL_INSIDE.func_176896_a(), "red_mushroom_block"); + this.func_175031_a(Blocks.field_150380_bt, "dragon_egg"); ++ net.minecraftforge.client.model.ModelLoader.onRegisterItems(this.field_175059_m); } - public void onResourceManagerReload(IResourceManager resourceManager) + public void func_110549_a(IResourceManager p_110549_1_) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch index 7513d3e08..7b9014d93 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch @@ -1,25 +1,25 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java @@ -193,6 +193,10 @@ - this.skinMap.put("default", this.field_178637_m); - this.skinMap.put("slim", new RenderPlayer(this, true)); + this.field_178636_l.put("default", this.field_178637_m); + this.field_178636_l.put("slim", new RenderPlayer(this, true)); } + + public Map getSkinMap() { -+ return (Map) java.util.Collections.unmodifiableMap(skinMap); ++ return (Map) java.util.Collections.unmodifiableMap(field_178636_l); + } - public void setRenderPosition(double p_178628_1_, double p_178628_3_, double p_178628_5_) + public void func_178628_a(double p_178628_1_, double p_178628_3_, double p_178628_5_) { @@ -241,9 +245,9 @@ - IBlockState iblockstate = worldIn.getBlockState(new BlockPos(p_180597_3_)); - Block block = iblockstate.getBlock(); + IBlockState iblockstate = p_180597_1_.func_180495_p(new BlockPos(p_180597_3_)); + Block block = iblockstate.func_177230_c(); -- if (block == Blocks.bed) -+ if (block.isBed(worldIn, new BlockPos(p_180597_3_), (EntityLivingBase)p_180597_3_)) +- if (block == Blocks.field_150324_C) ++ if (block.isBed(p_180597_1_, new BlockPos(p_180597_3_), (EntityLivingBase)p_180597_3_)) { -- int i = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex(); -+ int i = block.getBedDirection(worldIn, new BlockPos(p_180597_3_)).getHorizontalIndex(); - this.playerViewY = (float)(i * 90 + 180); - this.playerViewX = 0.0F; +- int i = ((EnumFacing)iblockstate.func_177229_b(BlockBed.field_176387_N)).func_176736_b(); ++ int i = block.getBedDirection(p_180597_1_, new BlockPos(p_180597_3_)).func_176736_b(); + this.field_78735_i = (float)(i * 90 + 180); + this.field_78732_j = 0.0F; } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch index af5f1e424..984365594 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch @@ -2,17 +2,17 @@ +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java @@ -49,6 +49,7 @@ - public void doRender(AbstractClientPlayer entity, double x, double y, double z, float p_76986_8_, float partialTicks) + public void func_76986_a(AbstractClientPlayer p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(entity, this, partialTicks, x, y, z))) return; - if (!entity.isUser() || this.renderManager.livingPlayer == entity) ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(p_76986_1_, this, p_76986_9_, p_76986_2_, p_76986_4_, p_76986_6_))) return; + if (!p_76986_1_.func_175144_cb() || this.field_76990_c.field_78734_h == p_76986_1_) { - double d0 = y; + double d0 = p_76986_4_; @@ -61,6 +62,7 @@ - this.func_177137_d(entity); - super.doRender(entity, x, d0, z, p_76986_8_, partialTicks); + this.func_177137_d(p_76986_1_); + super.func_76986_a(p_76986_1_, p_76986_2_, d0, p_76986_6_, p_76986_8_, p_76986_9_); } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(entity, this, partialTicks, x, y, z)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(p_76986_1_, this, p_76986_9_, p_76986_2_, p_76986_4_, p_76986_6_)); } private void func_177137_d(AbstractClientPlayer p_177137_1_) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch index e4a92b81b..75cae2f1b 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch @@ -2,10 +2,10 @@ +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java @@ -44,7 +44,7 @@ case 4: - return butcherVillagerTextures; + return field_110906_m; default: -- return villagerTextures; -+ return net.minecraftforge.fml.common.registry.VillagerRegistry.getVillagerSkin(entity.getProfession(), villagerTextures); +- return field_110903_f; ++ return net.minecraftforge.fml.common.registry.VillagerRegistry.getVillagerSkin(p_110775_1_.func_70946_n(), field_110903_f); } } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch index e45eb4648..d92c907a6 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java @@ -38,6 +38,9 @@ - protected List> layerRenderers = Lists.>newArrayList(); - protected boolean renderOutlines = false; + protected List> field_177097_h = Lists.>newArrayList(); + protected boolean field_177098_i = false; + public static float NAME_TAG_RANGE = 64.0f; + public static float NAME_TAG_RANGE_SNEAK = 32.0f; @@ -12,30 +12,30 @@ super(p_i46156_1_); @@ -83,6 +86,7 @@ - public void doRender(T entity, double x, double y, double z, float p_76986_8_, float partialTicks) + public void func_76986_a(T p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(entity, this, x, y, z))) return; - GlStateManager.pushMatrix(); - GlStateManager.disableCull(); - this.mainModel.swingProgress = this.getSwingProgress(entity, partialTicks); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(p_76986_1_, this, p_76986_2_, p_76986_4_, p_76986_6_))) return; + GlStateManager.func_179094_E(); + GlStateManager.func_179129_p(); + this.field_77045_g.field_78095_p = this.func_77040_d(p_76986_1_, p_76986_9_); @@ -191,6 +195,7 @@ { - super.doRender(entity, x, y, z, p_76986_8_, partialTicks); + super.func_76986_a(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post(entity, this, x, y, z)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post(p_76986_1_, this, p_76986_2_, p_76986_4_, p_76986_6_)); } protected boolean func_177088_c(T p_177088_1_) @@ -469,10 +474,11 @@ - public void renderName(T entity, double x, double y, double z) + public void func_177067_a(T p_177067_1_, double p_177067_2_, double p_177067_4_, double p_177067_6_) { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre(entity, this, x, y, z))) return; - if (this.canRenderName(entity)) ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre(p_177067_1_, this, p_177067_2_, p_177067_4_, p_177067_6_))) return; + if (this.func_177070_b(p_177067_1_)) { - double d0 = entity.getDistanceSqToEntity(this.renderManager.livingPlayer); -- float f = entity.isSneaking() ? 32.0F : 64.0F; -+ float f = entity.isSneaking() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE; + double d0 = p_177067_1_.func_70068_e(this.field_76990_c.field_78734_h); +- float f = p_177067_1_.func_70093_af() ? 32.0F : 64.0F; ++ float f = p_177067_1_.func_70093_af() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE; if (d0 < (double)(f * f)) { @@ -43,7 +43,7 @@ } } } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Post(entity, this, x, y, z)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Post(p_177067_1_, this, p_177067_2_, p_177067_4_, p_177067_6_)); } - protected boolean canRenderName(T entity) + protected boolean func_177070_b(T p_177070_1_) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch index b87eb4a6c..4c6befc54 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch @@ -2,57 +2,57 @@ +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java @@ -55,28 +55,28 @@ T t = this.func_177175_a(p_177182_9_); - t.setModelAttributes(this.field_177190_a.getMainModel()); - t.setLivingAnimations(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_4_); + t.func_178686_a(this.field_177190_a.func_177087_b()); + t.func_78086_a(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_4_); + t = getArmorModelHook(p_177182_1_, itemstack, p_177182_9_, t); this.func_177179_a(t, p_177182_9_); boolean flag = this.func_177180_b(p_177182_9_); - this.field_177190_a.bindTexture(this.getArmorResource(itemarmor, flag)); + this.field_177190_a.func_110776_a(this.func_177181_a(itemarmor, flag)); -- switch (itemarmor.getArmorMaterial()) +- switch (itemarmor.func_82812_d()) - { - case LEATHER: - int i = itemarmor.getColor(itemstack); + int i = itemarmor.func_82814_b(itemstack); + { + if (i != -1) // Allow this for anything, not only cloth. + { float f = (float)(i >> 16 & 255) / 255.0F; float f1 = (float)(i >> 8 & 255) / 255.0F; float f2 = (float)(i & 255) / 255.0F; - GlStateManager.color(this.field_177184_f * f, this.field_177185_g * f1, this.field_177192_h * f2, this.field_177187_e); - t.render(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); -- this.field_177190_a.bindTexture(this.getArmorResource(itemarmor, flag, "overlay")); + GlStateManager.func_179131_c(this.field_177184_f * f, this.field_177185_g * f1, this.field_177192_h * f2, this.field_177187_e); + t.func_78088_a(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); +- this.field_177190_a.func_110776_a(this.func_177178_a(itemarmor, flag, "overlay")); - case CHAIN: - case IRON: - case GOLD: - case DIAMOND: -+ this.field_177190_a.bindTexture(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, "overlay")); ++ this.field_177190_a.func_110776_a(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, "overlay")); + } + else // Non-colored + { - GlStateManager.color(this.field_177184_f, this.field_177185_g, this.field_177192_h, this.field_177187_e); - t.render(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); + GlStateManager.func_179131_c(this.field_177184_f, this.field_177185_g, this.field_177192_h, this.field_177187_e); + t.func_78088_a(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); - default: - + } + // Default - if (!this.field_177193_i && itemstack.isItemEnchanted()) + if (!this.field_177193_i && itemstack.func_77948_v()) { this.func_177183_a(p_177182_1_, t, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); @@ -135,11 +135,13 @@ - GlStateManager.disableBlend(); + GlStateManager.func_179084_k(); } + @Deprecated //Use the more sensitive version getArmorResource below - private ResourceLocation getArmorResource(ItemArmor p_177181_1_, boolean p_177181_2_) + private ResourceLocation func_177181_a(ItemArmor p_177181_1_, boolean p_177181_2_) { - return this.getArmorResource(p_177181_1_, p_177181_2_, (String)null); + return this.func_177178_a(p_177181_1_, p_177181_2_, (String)null); } + @Deprecated //Use the more sensitive version getArmorResource below - private ResourceLocation getArmorResource(ItemArmor p_177178_1_, boolean p_177178_2_, String p_177178_3_) + private ResourceLocation func_177178_a(ItemArmor p_177178_1_, boolean p_177178_2_, String p_177178_3_) { - String s = String.format("textures/models/armor/%s_layer_%d%s.png", new Object[] {p_177178_1_.getArmorMaterial().getName(), Integer.valueOf(p_177178_2_ ? 2 : 1), p_177178_3_ == null ? "" : String.format("_%s", new Object[]{p_177178_3_})}); + String s = String.format("textures/models/armor/%s_layer_%d%s.png", new Object[] {p_177178_1_.func_82812_d().func_179242_c(), Integer.valueOf(p_177178_2_ ? 2 : 1), p_177178_3_ == null ? "" : String.format("_%s", new Object[]{p_177178_3_})}); @@ -157,4 +159,49 @@ protected abstract void func_177177_a(); @@ -79,8 +79,8 @@ + */ + public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, int slot, String type) + { -+ ItemArmor item = (ItemArmor)stack.getItem(); -+ String texture = item.getArmorMaterial().getName(); ++ ItemArmor item = (ItemArmor)stack.func_77973_b(); ++ String texture = item.func_82812_d().func_179242_c(); + String domain = "minecraft"; + int idx = texture.indexOf(':'); + if (idx != -1) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch index 50001b770..e391d61ac 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java.patch @@ -2,7 +2,7 @@ +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java @@ -49,4 +49,10 @@ { - p_177194_1_.setInvisible(false); + p_177194_1_.func_178719_a(false); } + + @Override 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 fdbf34c9e..1dbb9630a 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch @@ -2,16 +2,16 @@ +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/Stitcher.java @@ -58,12 +58,17 @@ { - Stitcher.Holder[] astitcher$holder = (Stitcher.Holder[])this.setStitchHolders.toArray(new Stitcher.Holder[this.setStitchHolders.size()]); + Stitcher.Holder[] astitcher$holder = (Stitcher.Holder[])this.field_94319_a.toArray(new Stitcher.Holder[this.field_94319_a.size()]); Arrays.sort((Object[])astitcher$holder); + net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", astitcher$holder.length); for (Stitcher.Holder stitcher$holder : astitcher$holder) { -+ bar.step(stitcher$holder.getAtlasSprite().getIconName()); - if (!this.allocateSlot(stitcher$holder)) ++ bar.step(stitcher$holder.func_98150_a().func_94215_i()); + if (!this.func_94310_b(stitcher$holder)) { - String s = String.format("Unable to fit: %s - size: %dx%d - Maybe try a lowerresolution resourcepack?", new Object[] {stitcher$holder.getAtlasSprite().getIconName(), Integer.valueOf(stitcher$holder.getAtlasSprite().getIconWidth()), Integer.valueOf(stitcher$holder.getAtlasSprite().getIconHeight())}); + String s = String.format("Unable to fit: %s - size: %dx%d - Maybe try a lowerresolution resourcepack?", new Object[] {stitcher$holder.func_98150_a().func_94215_i(), Integer.valueOf(stitcher$holder.func_98150_a().func_94211_a()), Integer.valueOf(stitcher$holder.func_98150_a().func_94216_b())}); + net.minecraftforge.fml.common.FMLLog.info(s); + for (Stitcher.Holder h : astitcher$holder) + net.minecraftforge.fml.common.FMLLog.info(" %s", h); @@ -19,19 +19,19 @@ } } @@ -73,6 +78,7 @@ - this.currentWidth = MathHelper.roundUpToPowerOfTwo(this.currentWidth); - this.currentHeight = MathHelper.roundUpToPowerOfTwo(this.currentHeight); + this.field_94318_c = MathHelper.func_151236_b(this.field_94318_c); + this.field_94315_d = MathHelper.func_151236_b(this.field_94315_d); } + net.minecraftforge.fml.common.ProgressManager.pop(bar); } - public List getStichSlots() + public List func_94309_g() @@ -260,7 +266,7 @@ public String toString() { -- return "Holder{width=" + this.width + ", height=" + this.height + '}'; -+ return "Holder{width=" + this.width + ", height=" + this.height + ", name=" + this.theTexture.getIconName() + '}'; +- 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_98151_a.func_94215_i() + '}'; } public int compareTo(Stitcher.Holder p_compareTo_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 fb734bf69..7d8895248 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch @@ -2,7 +2,7 @@ +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java @@ -402,4 +402,30 @@ { - return "TextureAtlasSprite{name=\'" + this.iconName + '\'' + ", frameCount=" + this.framesTextureData.size() + ", rotated=" + this.rotated + ", x=" + this.originX + ", y=" + this.originY + ", height=" + this.height + ", width=" + this.width + ", u0=" + this.minU + ", u1=" + this.maxU + ", v0=" + this.minV + ", v1=" + this.maxV + '}'; + return "TextureAtlasSprite{name=\'" + this.field_110984_i + '\'' + ", frameCount=" + this.field_110976_a.size() + ", rotated=" + this.field_130222_e + ", x=" + this.field_110975_c + ", y=" + this.field_110974_d + ", height=" + this.field_130224_d + ", width=" + this.field_130223_c + ", u0=" + this.field_110979_l + ", u1=" + this.field_110980_m + ", v0=" + this.field_110977_n + ", v1=" + this.field_110978_o + '}'; } + + /*===================================== FORGE START =====================================*/ 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 62022a2a2..796c37a03 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch @@ -2,13 +2,13 @@ +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureManager.java @@ -137,9 +137,12 @@ - public void onResourceManagerReload(IResourceManager resourceManager) + public void func_110549_a(IResourceManager p_110549_1_) { -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Reloading Texture Manager", this.mapTextureObjects.keySet().size(), true); - for (Entry entry : this.mapTextureObjects.entrySet()) ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Reloading Texture Manager", this.field_110585_a.keySet().size(), true); + for (Entry entry : this.field_110585_a.entrySet()) { + bar.step(entry.getKey().toString()); - this.loadTexture((ResourceLocation)entry.getKey(), (ITextureObject)entry.getValue()); + this.func_110579_a((ResourceLocation)entry.getKey(), (ITextureObject)entry.getValue()); } + net.minecraftforge.fml.common.ProgressManager.pop(bar); } diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index a73196716..133b68b97 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -5,22 +5,22 @@ public class TextureMap extends AbstractTexture implements ITickableTextureObject { + private static final boolean ENABLE_SKIP = Boolean.parseBoolean(System.getProperty("fml.skipFirstTextureLoad", "true")); - private static final Logger logger = LogManager.getLogger(); - public static final ResourceLocation LOCATION_MISSING_TEXTURE = new ResourceLocation("missingno"); - public static final ResourceLocation locationBlocksTexture = new ResourceLocation("textures/atlas/blocks.png"); + private static final Logger field_147635_d = LogManager.getLogger(); + public static final ResourceLocation field_174945_f = new ResourceLocation("missingno"); + public static final ResourceLocation field_110575_b = new ResourceLocation("textures/atlas/blocks.png"); @@ -38,6 +39,7 @@ - private final IIconCreator iconCreator; - private int mipmapLevels; - private final TextureAtlasSprite missingImage; + private final IIconCreator field_174946_m; + private int field_147636_j; + private final TextureAtlasSprite field_94249_f; + private boolean skipFirst = false; public TextureMap(String p_i46099_1_) { @@ -46,12 +48,23 @@ - public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn) + public TextureMap(String p_i46100_1_, IIconCreator p_i46100_2_) { -+ this(p_i46100_1_, iconCreatorIn, false); ++ this(p_i46100_1_, p_i46100_2_, false); + } + + public TextureMap(String p_i46100_1_, boolean skipFirst) @@ -30,86 +30,87 @@ + + public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn, boolean skipFirst) + { - this.listAnimatedSprites = Lists.newArrayList(); - this.mapRegisteredSprites = Maps.newHashMap(); - this.mapUploadedSprites = Maps.newHashMap(); - this.missingImage = new TextureAtlasSprite("missingno"); - this.basePath = p_i46100_1_; - this.iconCreator = iconCreatorIn; + this.field_94258_i = Lists.newArrayList(); + this.field_110574_e = Maps.newHashMap(); + this.field_94252_e = Maps.newHashMap(); + this.field_94249_f = new TextureAtlasSprite("missingno"); + this.field_94254_c = p_i46100_1_; +- this.field_174946_m = p_i46100_2_; ++ this.field_174946_m = iconCreatorIn; + this.skipFirst = skipFirst && ENABLE_SKIP; } - private void initMissingImage() + private void func_110569_e() @@ -90,12 +103,28 @@ int j = Integer.MAX_VALUE; - int k = 1 << this.mipmapLevels; + int k = 1 << this.field_147636_j; + net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(this); + net.minecraftforge.fml.common.FMLLog.info("Max texture size: %d", i); -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", skipFirst ? 0 : this.mapRegisteredSprites.size()); ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", skipFirst ? 0 : this.field_110574_e.size()); + + if(!skipFirst) - for (Entry entry : this.mapRegisteredSprites.entrySet()) + for (Entry entry : this.field_110574_e.entrySet()) { TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue(); - ResourceLocation resourcelocation = new ResourceLocation(textureatlassprite.getIconName()); - ResourceLocation resourcelocation1 = this.completeResourceLocation(resourcelocation, 0); -+ bar.step(resourcelocation1.getResourcePath()); + ResourceLocation resourcelocation = new ResourceLocation(textureatlassprite.func_94215_i()); + ResourceLocation resourcelocation1 = this.func_147634_a(resourcelocation, 0); ++ bar.step(resourcelocation1.func_110623_a()); -+ if (textureatlassprite.hasCustomLoader(resourceManager, resourcelocation)) ++ if (textureatlassprite.hasCustomLoader(p_110571_1_, resourcelocation)) + { -+ if (!textureatlassprite.load(resourceManager, resourcelocation)) ++ if (!textureatlassprite.load(p_110571_1_, resourcelocation)) + { -+ j = Math.min(j, Math.min(textureatlassprite.getIconWidth(), textureatlassprite.getIconHeight())); -+ stitcher.addSprite(textureatlassprite); ++ j = Math.min(j, Math.min(textureatlassprite.func_94211_a(), textureatlassprite.func_94216_b())); ++ stitcher.func_110934_a(textureatlassprite); + } + continue; + } + try { - IResource iresource = resourceManager.getResource(resourcelocation1); + IResource iresource = p_110571_1_.func_110536_a(resourcelocation1); @@ -145,12 +174,14 @@ } catch (RuntimeException runtimeexception) { -- logger.error((String)("Unable to parse metadata from " + resourcelocation1), (Throwable)runtimeexception); +- field_147635_d.error((String)("Unable to parse metadata from " + resourcelocation1), (Throwable)runtimeexception); + //logger.error((String)("Unable to parse metadata from " + resourcelocation1), (Throwable)runtimeexception); + net.minecraftforge.fml.client.FMLClientHandler.instance().trackBrokenTexture(resourcelocation1, runtimeexception.getMessage()); continue; } catch (IOException ioexception1) { -- logger.error((String)("Using missing texture, unable to load " + resourcelocation1), (Throwable)ioexception1); +- field_147635_d.error((String)("Using missing texture, unable to load " + resourcelocation1), (Throwable)ioexception1); + //logger.error((String)("Using missing texture, unable to load " + resourcelocation1), (Throwable)ioexception1); + net.minecraftforge.fml.client.FMLClientHandler.instance().trackMissingTexture(resourcelocation1); continue; } @@ -166,6 +197,7 @@ - stitcher.addSprite(textureatlassprite); + stitcher.func_110934_a(textureatlassprite); } + net.minecraftforge.fml.common.ProgressManager.pop(bar); int j1 = Math.min(j, k); - int k1 = MathHelper.calculateLogBaseTwo(j1); + int k1 = MathHelper.func_151239_c(j1); @@ -175,8 +207,11 @@ - this.mipmapLevels = k1; + this.field_147636_j = k1; } -+ bar = net.minecraftforge.fml.common.ProgressManager.push("Mipmap generation", skipFirst ? 0 : this.mapRegisteredSprites.size()); - for (final TextureAtlasSprite textureatlassprite1 : this.mapRegisteredSprites.values()) ++ bar = net.minecraftforge.fml.common.ProgressManager.push("Mipmap generation", skipFirst ? 0 : this.field_110574_e.size()); + for (final TextureAtlasSprite textureatlassprite1 : this.field_110574_e.values()) { + if (skipFirst) break; -+ bar.step(textureatlassprite1.getIconName()); ++ bar.step(textureatlassprite1.func_94215_i()); try { - textureatlassprite1.generateMipmaps(this.mipmapLevels); + textureatlassprite1.func_147963_d(this.field_147636_j); @@ -213,9 +248,13 @@ - this.missingImage.generateMipmaps(this.mipmapLevels); - stitcher.addSprite(this.missingImage); + this.field_94249_f.func_147963_d(this.field_147636_j); + stitcher.func_110934_a(this.field_94249_f); + net.minecraftforge.fml.common.ProgressManager.pop(bar); + skipFirst = false; + bar = net.minecraftforge.fml.common.ProgressManager.push("Texture creation", 3); @@ -117,24 +118,24 @@ try { + bar.step("Stitching"); - stitcher.doStitch(); + stitcher.func_94305_f(); } catch (StitcherException stitcherexception) @@ -224,9 +263,11 @@ } - logger.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.getCurrentWidth()), Integer.valueOf(stitcher.getCurrentHeight()), this.basePath}); + field_147635_d.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.func_110935_a()), Integer.valueOf(stitcher.func_110936_b()), this.field_94254_c}); + bar.step("Allocating GL texture"); - TextureUtil.allocateTextureImpl(this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); - Map map = Maps.newHashMap(this.mapRegisteredSprites); + TextureUtil.func_180600_a(this.func_110552_b(), this.field_147636_j, stitcher.func_110935_a(), stitcher.func_110936_b()); + Map map = Maps.newHashMap(this.field_110574_e); + bar.step("Uploading GL texture"); - for (TextureAtlasSprite textureatlassprite2 : stitcher.getStichSlots()) + for (TextureAtlasSprite textureatlassprite2 : stitcher.func_94309_g()) { - String s = textureatlassprite2.getIconName(); + String s = textureatlassprite2.func_94215_i(); @@ -256,6 +297,13 @@ { - textureatlassprite3.copyFrom(this.missingImage); + textureatlassprite3.func_94217_a(this.field_94249_f); } + + net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this); @@ -145,10 +146,10 @@ + net.minecraftforge.fml.common.ProgressManager.pop(bar); } - private ResourceLocation completeResourceLocation(ResourceLocation location, int p_147634_2_) + private ResourceLocation func_147634_a(ResourceLocation p_147634_1_, int p_147634_2_) @@ -319,4 +367,37 @@ { - return this.missingImage; + return this.field_94249_f; } + + //=================================================================================================== @@ -163,7 +164,7 @@ + */ + public TextureAtlasSprite getTextureExtry(String name) + { -+ return (TextureAtlasSprite)mapRegisteredSprites.get(name); ++ return (TextureAtlasSprite)field_110574_e.get(name); + } + + /** @@ -176,9 +177,9 @@ + */ + public boolean setTextureEntry(String name, TextureAtlasSprite entry) + { -+ if (!mapRegisteredSprites.containsKey(name)) ++ if (!field_110574_e.containsKey(name)) + { -+ mapRegisteredSprites.put(name, entry); ++ field_110574_e.put(name, entry); + return true; + } + return false; diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch index d067a7ffb..a9d758ece 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch @@ -2,12 +2,12 @@ +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java @@ -197,9 +197,11 @@ - public static void allocateTextureImpl(int p_180600_0_, int p_180600_1_, int p_180600_2_, int p_180600_3_) + public static void func_180600_a(int p_180600_0_, int p_180600_1_, int p_180600_2_, int p_180600_3_) { + synchronized (net.minecraftforge.fml.client.SplashProgress.class) + { - deleteTexture(p_180600_0_); - bindTexture(p_180600_0_); + func_147942_a(p_180600_0_); + func_94277_a(p_180600_0_); - + } if (p_180600_1_ >= 0) diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch index d05ff8ac8..d0ec3a7d9 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch @@ -1,31 +1,31 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java +++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java @@ -99,15 +99,18 @@ - GlStateManager.disableLighting(); - int i = p_82402_1_.getRotation(); + GlStateManager.func_179140_f(); + int i = p_82402_1_.func_82333_j(); -- if (item == Items.filled_map) +- if (item == Items.field_151098_aY) + if (item instanceof net.minecraft.item.ItemMap) { i = i % 4 * 2; } - GlStateManager.rotate((float)i * 360.0F / 8.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.func_179114_b((float)i * 360.0F / 8.0F, 0.0F, 0.0F, 1.0F); -- if (item == Items.filled_map) +- if (item == Items.field_151098_aY) + net.minecraftforge.client.event.RenderItemInFrameEvent event = new net.minecraftforge.client.event.RenderItemInFrameEvent(p_82402_1_, this); + if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) { + if (item instanceof net.minecraft.item.ItemMap) + { - this.renderManager.renderEngine.bindTexture(mapBackgroundTextures); - GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); + this.field_76990_c.field_78724_e.func_110577_a(field_110789_a); + GlStateManager.func_179114_b(180.0F, 0.0F, 0.0F, 1.0F); float f = 0.0078125F; @@ -165,6 +168,7 @@ - textureatlassprite.updateAnimation(); + textureatlassprite.func_94219_l(); } } + } - GlStateManager.enableLighting(); - GlStateManager.popMatrix(); + GlStateManager.func_179145_e(); + GlStateManager.func_179121_F(); diff --git a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch index 9de0c31ca..22634cf06 100644 --- a/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java @@ -78,6 +78,7 @@ { - TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147718_c, 0.0D, 0.0D, 0.0D, 0.0F); + TileEntityRendererDispatcher.field_147556_a.func_147549_a(this.field_147718_c, 0.0D, 0.0D, 0.0D, 0.0F); } -+ else if (block != Blocks.chest) net.minecraftforge.client.ForgeHooksClient.renderTileItem(p_179022_1_.getItem(), p_179022_1_.getMetadata()); ++ else if (block != Blocks.field_150486_ae) net.minecraftforge.client.ForgeHooksClient.renderTileItem(p_179022_1_.func_77973_b(), p_179022_1_.func_77960_j()); else { - TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147717_b, 0.0D, 0.0D, 0.0D, 0.0F); + TileEntityRendererDispatcher.field_147556_a.func_147549_a(this.field_147717_b, 0.0D, 0.0D, 0.0D, 0.0F); 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 c51b7af57..9faa76e8f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch @@ -16,6 +16,6 @@ + public void preDraw(VertexFormat format, int element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.preDraw(this, format, element, stride, buffer); } + public void postDraw(VertexFormat format, int element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.postDraw(this, format, element, stride, buffer); } + - private final String displayName; + private final String field_177392_h; private EnumUsage(String p_i46094_3_) diff --git a/patches/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch b/patches/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch index 2e4117099..375865cd4 100644 --- a/patches/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch @@ -2,10 +2,10 @@ +++ ../src-work/minecraft/net/minecraft/client/resources/AbstractResourcePack.java @@ -58,7 +58,7 @@ - protected void logNameNotLowercase(String p_110594_1_) + protected void func_110594_c(String p_110594_1_) { -- resourceLog.warn("ResourcePack: ignored non-lowercase namespace: %s in %s", new Object[] {p_110594_1_, this.resourcePackFile}); -+ resourceLog.warn("ResourcePack: ignored non-lowercase namespace: {} in {}", new Object[] {p_110594_1_, this.resourcePackFile}); +- field_110598_a.warn("ResourcePack: ignored non-lowercase namespace: %s in %s", new Object[] {p_110594_1_, this.field_110597_b}); ++ field_110598_a.warn("ResourcePack: ignored non-lowercase namespace: {} in {}", new Object[] {p_110594_1_, this.field_110597_b}); } - public T getPackMetadata(IMetadataSerializer p_135058_1_, String p_135058_2_) throws IOException + public T func_135058_a(IMetadataSerializer p_135058_1_, String p_135058_2_) throws IOException diff --git a/patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch b/patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch index f80172ba7..fa5296e39 100644 --- a/patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch @@ -5,6 +5,6 @@ } + @SuppressWarnings("resource") - protected InputStream getInputStream(ResourceLocation p_177245_1_, IResourcePack p_177245_2_) throws IOException + protected InputStream func_177245_a(ResourceLocation p_177245_1_, IResourcePack p_177245_2_) throws IOException { - InputStream inputstream = p_177245_2_.getInputStream(p_177245_1_); + InputStream inputstream = p_177245_2_.func_110590_a(p_177245_1_); diff --git a/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch b/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch index fa44d5f1b..4bc3d483c 100644 --- a/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch @@ -3,8 +3,8 @@ @@ -73,6 +73,7 @@ } - currentLocale.loadLocaleDataFiles(resourceManager, list); -+ net.minecraftforge.fml.common.registry.LanguageRegistry.instance().mergeLanguageTable(currentLocale.properties, this.currentLanguage); - StringTranslate.replaceWith(currentLocale.properties); + field_135049_a.func_135022_a(p_110549_1_, list); ++ net.minecraftforge.fml.common.registry.LanguageRegistry.instance().mergeLanguageTable(field_135049_a.field_135032_a, this.field_135048_c); + StringTranslate.func_135063_a(field_135049_a.field_135032_a); } diff --git a/patches/minecraft/net/minecraft/client/resources/Locale.java.patch b/patches/minecraft/net/minecraft/client/resources/Locale.java.patch index c6fcea8cd..95dc701db 100644 --- a/patches/minecraft/net/minecraft/client/resources/Locale.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/Locale.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/client/resources/Locale.java @@ -95,6 +95,8 @@ - private void loadLocaleData(InputStream p_135021_1_) throws IOException + private void func_135021_a(InputStream p_135021_1_) throws IOException { -+ p_135021_1_ = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(properties, p_135021_1_); ++ p_135021_1_ = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(field_135032_a, p_135021_1_); + if (p_135021_1_ == null) return; for (String s : IOUtils.readLines(p_135021_1_, Charsets.UTF_8)) { diff --git a/patches/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch b/patches/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch index 9859bbc84..5dd733b35 100644 --- a/patches/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch @@ -1,42 +1,42 @@ --- ../src-base/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java +++ ../src-work/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java @@ -92,6 +92,7 @@ - public void reloadResources(List p_110541_1_) + public void func_110541_a(List p_110541_1_) { - this.clearResources(); + this.func_110543_a(); + net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Loading Resources", p_110541_1_.size()+1, true); - logger.info("Reloading ResourceManager: " + joinerResourcePacks.join(Iterables.transform(p_110541_1_, new Function() + field_147967_a.info("Reloading ResourceManager: " + field_130074_a.join(Iterables.transform(p_110541_1_, new Function() { public String apply(IResourcePack p_apply_1_) @@ -102,23 +103,32 @@ for (IResourcePack iresourcepack : p_110541_1_) { -+ resReload.step(iresourcepack.getPackName()); - this.reloadResourcePack(iresourcepack); ++ resReload.step(iresourcepack.func_130077_b()); + this.func_110545_a(iresourcepack); } + resReload.step("Reloading listeners"); - this.notifyReloadListeners(); + this.func_110544_b(); + net.minecraftforge.fml.common.ProgressManager.pop(resReload); } - public void registerReloadListener(IResourceManagerReloadListener p_110542_1_) + public void func_110542_a(IResourceManagerReloadListener p_110542_1_) { + net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Loading Resource", 1); + resReload.step(p_110542_1_.getClass()); - this.reloadListeners.add(p_110542_1_); - p_110542_1_.onResourceManagerReload(this); + this.field_110546_b.add(p_110542_1_); + p_110542_1_.func_110549_a(this); + net.minecraftforge.fml.common.ProgressManager.pop(resReload); } - private void notifyReloadListeners() + private void func_110544_b() { -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Reloading", this.reloadListeners.size()); - for (IResourceManagerReloadListener iresourcemanagerreloadlistener : this.reloadListeners) ++ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Reloading", this.field_110546_b.size()); + for (IResourceManagerReloadListener iresourcemanagerreloadlistener : this.field_110546_b) { + resReload.step(iresourcemanagerreloadlistener.getClass()); - iresourcemanagerreloadlistener.onResourceManagerReload(this); + iresourcemanagerreloadlistener.func_110549_a(this); } + net.minecraftforge.fml.common.ProgressManager.pop(resReload); } diff --git a/patches/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch b/patches/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch index d032f72eb..d792aea1b 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch @@ -2,8 +2,8 @@ +++ ../src-work/minecraft/net/minecraft/client/resources/model/IBakedModel.java @@ -23,5 +23,6 @@ - TextureAtlasSprite getTexture(); + TextureAtlasSprite func_177554_e(); + @Deprecated - ItemCameraTransforms getItemCameraTransforms(); + ItemCameraTransforms func_177552_f(); } diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch index 16b116a9f..35547cd4e 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch @@ -4,8 +4,8 @@ } catch (Exception var6) { -- LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation); -+ LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation, var6); +- field_177603_c.warn("Unable to load variant: " + modelresourcelocation.func_177518_c() + " from " + modelresourcelocation); ++ field_177603_c.warn("Unable to load variant: " + modelresourcelocation.func_177518_c() + " from " + modelresourcelocation, var6); } } catch (Exception exception) @@ -19,66 +19,71 @@ throw new RuntimeException("Encountered an exception when loading model definition of model " + resourcelocation.toString(), ioexception); @@ -294,6 +295,7 @@ - protected void registerVariantNames() + protected void func_177592_e() { -+ this.variantNames.clear(); //FML clear this to prevent double ups. - this.variantNames.put(Item.getItemFromBlock(Blocks.stone), Lists.newArrayList(new String[] {"stone", "granite", "granite_smooth", "diorite", "diorite_smooth", "andesite", "andesite_smooth"})); - this.variantNames.put(Item.getItemFromBlock(Blocks.dirt), Lists.newArrayList(new String[] {"dirt", "coarse_dirt", "podzol"})); - this.variantNames.put(Item.getItemFromBlock(Blocks.planks), Lists.newArrayList(new String[] {"oak_planks", "spruce_planks", "birch_planks", "jungle_planks", "acacia_planks", "dark_oak_planks"})); ++ this.field_177613_u.clear(); //FML clear this to prevent double ups. + this.field_177613_u.put(Item.func_150898_a(Blocks.field_150348_b), Lists.newArrayList(new String[] {"stone", "granite", "granite_smooth", "diorite", "diorite_smooth", "andesite", "andesite_smooth"})); + this.field_177613_u.put(Item.func_150898_a(Blocks.field_150346_d), Lists.newArrayList(new String[] {"dirt", "coarse_dirt", "podzol"})); + this.field_177613_u.put(Item.func_150898_a(Blocks.field_150344_f), Lists.newArrayList(new String[] {"oak_planks", "spruce_planks", "birch_planks", "jungle_planks", "acacia_planks", "dark_oak_planks"})); @@ -336,6 +338,10 @@ - this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence_gate), Lists.newArrayList(new String[] {"oak_fence_gate"})); - this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence), Lists.newArrayList(new String[] {"oak_fence"})); - this.variantNames.put(Items.oak_door, Lists.newArrayList(new String[] {"oak_door"})); + this.field_177613_u.put(Item.func_150898_a(Blocks.field_180390_bo), Lists.newArrayList(new String[] {"oak_fence_gate"})); + this.field_177613_u.put(Item.func_150898_a(Blocks.field_180407_aO), Lists.newArrayList(new String[] {"oak_fence"})); + this.field_177613_u.put(Items.field_179570_aq, Lists.newArrayList(new String[] {"oak_door"})); + for (Entry, Set> e : customVariantNames.entrySet()) + { -+ this.variantNames.put(e.getKey().get(), Lists.newArrayList(e.getValue().iterator())); ++ this.field_177613_u.put(e.getKey().get(), Lists.newArrayList(e.getValue().iterator())); + } } - protected List getVariantNames(Item p_177596_1_) + protected List func_177596_a(Item p_177596_1_) @@ -453,6 +459,11 @@ - private IBakedModel bakeModel(ModelBlock modelBlockIn, ModelRotation modelRotationIn, boolean uvLocked) + private IBakedModel func_177578_a(ModelBlock p_177578_1_, ModelRotation p_177578_2_, boolean p_177578_3_) { -+ return bakeModel(modelBlockIn, (net.minecraftforge.client.model.ITransformation)modelRotationIn, uvLocked); ++ return bakeModel(p_177578_1_, (net.minecraftforge.client.model.ITransformation)p_177578_2_, p_177578_3_); + } + -+ protected IBakedModel bakeModel(ModelBlock modelBlockIn, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) ++ protected IBakedModel bakeModel(ModelBlock p_177578_1_, net.minecraftforge.client.model.ITransformation p_177578_2_, boolean p_177578_3_) + { - TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName("particle"))); - SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(modelBlockIn)).setTexture(textureatlassprite); + TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.field_177599_g.get(new ResourceLocation(p_177578_1_.func_178308_c("particle"))); + SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(p_177578_1_)).func_177646_a(textureatlassprite); @@ -463,13 +474,13 @@ - BlockPartFace blockpartface = (BlockPartFace)blockpart.mapFaces.get(enumfacing); - TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName(blockpartface.texture))); + BlockPartFace blockpartface = (BlockPartFace)blockpart.field_178240_c.get(enumfacing); + TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.field_177599_g.get(new ResourceLocation(p_177578_1_.func_178308_c(blockpartface.field_178242_d))); -- if (blockpartface.cullFace == null) -+ if (blockpartface.cullFace == null || !net.minecraftforge.client.model.TRSRTransformation.isInteger(modelRotationIn.getMatrix())) +- if (blockpartface.field_178244_b == null) ++ if (blockpartface.field_178244_b == null || !net.minecraftforge.client.model.TRSRTransformation.isInteger(p_177578_2_.getMatrix())) { - simplebakedmodel$builder.addGeneralQuad(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); +- simplebakedmodel$builder.func_177648_a(this.func_177589_a(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_)); ++ simplebakedmodel$builder.func_177648_a(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_)); } else { -- simplebakedmodel$builder.addFaceQuad(modelRotationIn.rotateFace(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); -+ simplebakedmodel$builder.addFaceQuad(modelRotationIn.rotate(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); +- simplebakedmodel$builder.func_177650_a(p_177578_2_.func_177523_a(blockpartface.field_178244_b), this.func_177589_a(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_)); ++ simplebakedmodel$builder.func_177650_a(p_177578_2_.rotate(blockpartface.field_178244_b), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_)); } } } -@@ -479,6 +490,11 @@ +@@ -479,9 +490,14 @@ - private BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_) + private BakedQuad func_177589_a(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_) { +- return this.field_177607_l.func_178414_a(p_177589_1_.field_178241_a, p_177589_1_.field_178239_b, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.field_178237_d, p_177589_6_, p_177589_1_.field_178238_e); + return makeBakedQuad(p_177589_1_, p_177589_2_, p_177589_3_, p_177589_4_, (net.minecraftforge.client.model.ITransformation)p_177589_5_, p_177589_6_); -+ } -+ -+ protected BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, net.minecraftforge.client.model.ITransformation p_177589_5_, boolean p_177589_6_) -+ { - return this.faceBakery.makeBakedQuad(p_177589_1_.positionFrom, p_177589_1_.positionTo, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.partRotation, p_177589_6_, p_177589_1_.shade); } ++ protected BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, net.minecraftforge.client.model.ITransformation p_177589_5_, boolean p_177589_6_) ++ { ++ return this.field_177607_l.makeBakedQuad(p_177589_1_.field_178241_a, p_177589_1_.field_178239_b, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.field_178237_d, p_177589_6_, p_177589_1_.field_178238_e); ++ } ++ + private void func_177597_h() + { + this.func_177574_i(); @@ -722,4 +738,19 @@ - MODEL_CLOCK.name = "class generation marker"; - MODEL_ENTITY.name = "block entity marker"; + field_177617_q.field_178317_b = "class generation marker"; + field_177616_r.field_178317_b = "block entity marker"; } + + /*********************************************************** diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch index 62b6e2b6e..9b92db76e 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch @@ -2,13 +2,13 @@ +++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelManager.java @@ -24,9 +24,10 @@ - public void onResourceManagerReload(IResourceManager resourceManager) + public void func_110549_a(IResourceManager p_110549_1_) { -- ModelBakery modelbakery = new ModelBakery(resourceManager, this.texMap, this.modelProvider); -+ ModelBakery modelbakery = new net.minecraftforge.client.model.ModelLoader(resourceManager, this.texMap, this.modelProvider); - this.modelRegistry = modelbakery.setupModelRegistry(); - this.defaultModel = (IBakedModel)this.modelRegistry.getObject(ModelBakery.MODEL_MISSING); -+ net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.modelRegistry, modelbakery); - this.modelProvider.reloadModels(); +- ModelBakery modelbakery = new ModelBakery(p_110549_1_, this.field_174956_b, this.field_174957_c); ++ ModelBakery modelbakery = new net.minecraftforge.client.model.ModelLoader(p_110549_1_, this.field_174956_b, this.field_174957_c); + this.field_174958_a = modelbakery.func_177570_a(); + this.field_174955_d = (IBakedModel)this.field_174958_a.func_82594_a(ModelBakery.field_177604_a); ++ net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.field_174958_a, modelbakery); + this.field_174957_c.func_178124_c(); } diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch index 33a8da83d..f7b079566 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch @@ -10,12 +10,12 @@ X0_Y0(0, 0), X0_Y90(0, 90), @@ -116,4 +116,9 @@ - mapRotations.put(Integer.valueOf(modelrotation.combinedXY), modelrotation); + field_177546_q.put(Integer.valueOf(modelrotation.field_177545_r), modelrotation); } } + + public net.minecraftforge.client.model.TRSRTransformation apply(net.minecraftforge.client.model.IModelPart part) { return new net.minecraftforge.client.model.TRSRTransformation(getMatrix()); } + public javax.vecmath.Matrix4f getMatrix() { return net.minecraftforge.client.ForgeHooksClient.getMatrix(this); } -+ public EnumFacing rotate(EnumFacing facing) { return rotateFace(facing); } -+ public int rotate(EnumFacing facing, int vertexIndex) { return rotateVertex(facing, vertexIndex); } ++ public EnumFacing rotate(EnumFacing facing) { return func_177523_a(facing); } ++ public int rotate(EnumFacing facing, int vertexIndex) { return func_177520_a(facing, vertexIndex); } } diff --git a/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch b/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch index 1b0f54267..72506bbfa 100644 --- a/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch +++ b/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/client/settings/GameSettings.java @@ -981,6 +981,7 @@ - public void saveOptions() + public void func_74303_b() { + if (net.minecraftforge.fml.client.FMLClientHandler.instance().isLoading()) return; try { - PrintWriter printwriter = new PrintWriter(new FileWriter(this.optionsFile)); + PrintWriter printwriter = new PrintWriter(new FileWriter(this.field_74354_ai)); diff --git a/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch b/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch index ec5e56034..5c9c777d2 100644 --- a/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch +++ b/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch @@ -1,26 +1,26 @@ --- ../src-base/minecraft/net/minecraft/client/shader/Framebuffer.java +++ ../src-work/minecraft/net/minecraft/client/shader/Framebuffer.java @@ -119,8 +119,17 @@ - if (this.useDepth) + if (this.field_147619_e) { - OpenGlHelper.glBindRenderbuffer(OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); + OpenGlHelper.func_153176_h(OpenGlHelper.field_153199_f, this.field_147624_h); + if (!this.stencilEnabled) + { - OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, 33190, this.framebufferTextureWidth, this.framebufferTextureHeight); - OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_DEPTH_ATTACHMENT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); + OpenGlHelper.func_153186_a(OpenGlHelper.field_153199_f, 33190, this.field_147622_a, this.field_147620_b); + OpenGlHelper.func_153190_b(OpenGlHelper.field_153198_e, OpenGlHelper.field_153201_h, OpenGlHelper.field_153199_f, this.field_147624_h); + } + else + { -+ OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, org.lwjgl.opengl.EXTPackedDepthStencil.GL_DEPTH24_STENCIL8_EXT, this.framebufferTextureWidth, this.framebufferTextureHeight); -+ OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, org.lwjgl.opengl.EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); -+ OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, org.lwjgl.opengl.EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); ++ OpenGlHelper.func_153186_a(OpenGlHelper.field_153199_f, org.lwjgl.opengl.EXTPackedDepthStencil.GL_DEPTH24_STENCIL8_EXT, this.field_147622_a, this.field_147620_b); ++ OpenGlHelper.func_153190_b(OpenGlHelper.field_153198_e, org.lwjgl.opengl.EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, OpenGlHelper.field_153199_f, this.field_147624_h); ++ OpenGlHelper.func_153190_b(OpenGlHelper.field_153198_e, org.lwjgl.opengl.EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, OpenGlHelper.field_153199_f, this.field_147624_h); + } } - this.framebufferClear(); + this.func_147614_f(); @@ -280,4 +289,36 @@ - GlStateManager.clear(i); - this.unbindFramebuffer(); + GlStateManager.func_179086_m(i); + this.func_147609_e(); } + + /*================================ FORGE START ================================================*/ @@ -39,9 +39,9 @@ + */ + public boolean enableStencil() + { -+ if (!OpenGlHelper.isFramebufferEnabled()) return false; ++ if (!OpenGlHelper.func_148822_b()) return false; + stencilEnabled = true; -+ this.createBindFramebuffer(framebufferWidth, framebufferHeight); ++ this.func_147613_a(field_147621_c, field_147618_d); + return true; //TODO: Find a way to detect if this failed? + } + diff --git a/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch b/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch index 630385eaa..361b3dc03 100644 --- a/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch +++ b/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch @@ -2,10 +2,10 @@ +++ ../src-work/minecraft/net/minecraft/command/CommandEnchant.java @@ -93,7 +93,7 @@ { - Enchantment enchantment2 = Enchantment.getEnchantmentById(l); + Enchantment enchantment2 = Enchantment.func_180306_c(l); -- if (!enchantment2.canApplyTogether(enchantment1)) -+ if (!enchantment2.canApplyTogether(enchantment1) || !enchantment1.canApplyTogether(enchantment2)) //Forge BugFix: Let Both enchantments veto being together +- if (!enchantment2.func_77326_a(enchantment1)) ++ if (!enchantment2.func_77326_a(enchantment1) || !enchantment1.func_77326_a(enchantment2)) //Forge BugFix: Let Both enchantments veto being together { - throw new CommandException("commands.enchant.cantCombine", new Object[] {enchantment1.getTranslatedName(j), enchantment2.getTranslatedName(nbttaglist.getCompoundTagAt(k).getShort("lvl"))}); + throw new CommandException("commands.enchant.cantCombine", new Object[] {enchantment1.func_77316_c(j), enchantment2.func_77316_c(nbttaglist.func_150305_b(k).func_74765_d("lvl"))}); } diff --git a/patches/minecraft/net/minecraft/command/CommandFill.java.patch b/patches/minecraft/net/minecraft/command/CommandFill.java.patch index 777a3d061..c9950fe71 100644 --- a/patches/minecraft/net/minecraft/command/CommandFill.java.patch +++ b/patches/minecraft/net/minecraft/command/CommandFill.java.patch @@ -2,27 +2,27 @@ +++ ../src-work/minecraft/net/minecraft/command/CommandFill.java @@ -48,6 +48,7 @@ { - i = parseInt(args[7], 0, 15); + i = func_175764_a(p_71515_2_[7], 0, 15); } -+ IBlockState state = block.getStateFromMeta(i); ++ IBlockState state = block.func_176203_a(i); - BlockPos blockpos2 = new BlockPos(Math.min(blockpos.getX(), blockpos1.getX()), Math.min(blockpos.getY(), blockpos1.getY()), Math.min(blockpos.getZ(), blockpos1.getZ())); - BlockPos blockpos3 = new BlockPos(Math.max(blockpos.getX(), blockpos1.getX()), Math.max(blockpos.getY(), blockpos1.getY()), Math.max(blockpos.getZ(), blockpos1.getZ())); + BlockPos blockpos2 = new BlockPos(Math.min(blockpos.func_177958_n(), blockpos1.func_177958_n()), Math.min(blockpos.func_177956_o(), blockpos1.func_177956_o()), Math.min(blockpos.func_177952_p(), blockpos1.func_177952_p())); + BlockPos blockpos3 = new BlockPos(Math.max(blockpos.func_177958_n(), blockpos1.func_177958_n()), Math.max(blockpos.func_177956_o(), blockpos1.func_177956_o()), Math.max(blockpos.func_177952_p(), blockpos1.func_177952_p())); @@ -75,7 +76,7 @@ NBTTagCompound nbttagcompound = new NBTTagCompound(); boolean flag = false; -- if (args.length >= 10 && block.hasTileEntity()) -+ if (args.length >= 10 && block.hasTileEntity(state)) +- if (p_71515_2_.length >= 10 && block.func_149716_u()) ++ if (p_71515_2_.length >= 10 && block.hasTileEntity(state)) { - String s = getChatComponentFromNthArg(sender, args, 9).getUnformattedText(); + String s = func_147178_a(p_71515_1_, p_71515_2_, 9).func_150260_c(); @@ -116,7 +117,7 @@ continue; } } -- else if (args[8].equals("replace") && !block.hasTileEntity()) -+ else if (args[8].equals("replace") && !block.hasTileEntity(state)) +- else if (p_71515_2_[8].equals("replace") && !block.func_149716_u()) ++ else if (p_71515_2_[8].equals("replace") && !block.hasTileEntity(state)) { - if (args.length > 9) + if (p_71515_2_.length > 9) { diff --git a/patches/minecraft/net/minecraft/command/CommandHandler.java.patch b/patches/minecraft/net/minecraft/command/CommandHandler.java.patch index 3d877eba8..1bc893d80 100644 --- a/patches/minecraft/net/minecraft/command/CommandHandler.java.patch +++ b/patches/minecraft/net/minecraft/command/CommandHandler.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/command/CommandHandler.java @@ -44,6 +44,16 @@ } - else if (icommand.canCommandSenderUse(sender)) + else if (icommand.func_71519_b(p_71556_1_)) { -+ net.minecraftforge.event.CommandEvent event = new net.minecraftforge.event.CommandEvent(icommand, sender, astring); ++ net.minecraftforge.event.CommandEvent event = new net.minecraftforge.event.CommandEvent(icommand, p_71556_1_, astring); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) + { + if (event.exception != null) @@ -16,4 +16,4 @@ + if (i > -1) { - List list = PlayerSelector.matchEntities(sender, astring[i], Entity.class); + List list = PlayerSelector.func_179656_b(p_71556_1_, astring[i], Entity.class); diff --git a/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch b/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch index b67266339..e5ef73f0b 100644 --- a/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch +++ b/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch @@ -1,20 +1,20 @@ --- ../src-base/minecraft/net/minecraft/command/server/CommandSetBlock.java +++ ../src-work/minecraft/net/minecraft/command/server/CommandSetBlock.java @@ -52,6 +52,8 @@ - i = parseInt(args[4], 0, 15); + i = func_175764_a(p_71515_2_[4], 0, 15); } -+ IBlockState state = block.getStateFromMeta(i); ++ IBlockState state = block.func_176203_a(i); + - World world = sender.getEntityWorld(); + World world = p_71515_1_.func_130014_f_(); - if (!world.isBlockLoaded(blockpos)) + if (!world.func_175667_e(blockpos)) @@ -63,7 +65,7 @@ NBTTagCompound nbttagcompound = new NBTTagCompound(); boolean flag = false; -- if (args.length >= 7 && block.hasTileEntity()) -+ if (args.length >= 7 && block.hasTileEntity(state)) +- if (p_71515_2_.length >= 7 && block.func_149716_u()) ++ if (p_71515_2_.length >= 7 && block.hasTileEntity(state)) { - String s = getChatComponentFromNthArg(sender, args, 6).getUnformattedText(); + String s = func_147178_a(p_71515_1_, p_71515_2_, 6).func_150260_c(); diff --git a/patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch b/patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch index be6dce538..a9dae5314 100644 --- a/patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch +++ b/patches/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch @@ -4,8 +4,8 @@ NBTTagCompound nbttagcompound = new NBTTagCompound(); boolean flag = false; -- if (args.length >= 6 && block.hasTileEntity()) -+ if (args.length >= 6 && block.hasTileEntity(block.getStateFromMeta(i))) +- if (p_71515_2_.length >= 6 && block.func_149716_u()) ++ if (p_71515_2_.length >= 6 && block.hasTileEntity(block.func_176203_a(i))) { - String s = getChatComponentFromNthArg(sender, args, 5).getUnformattedText(); + String s = func_147178_a(p_71515_1_, p_71515_2_, 5).func_150260_c(); diff --git a/patches/minecraft/net/minecraft/crash/CrashReport.java.patch b/patches/minecraft/net/minecraft/crash/CrashReport.java.patch index 2ad18820d..7b4d498c8 100644 --- a/patches/minecraft/net/minecraft/crash/CrashReport.java.patch +++ b/patches/minecraft/net/minecraft/crash/CrashReport.java.patch @@ -1,13 +1,13 @@ --- ../src-base/minecraft/net/minecraft/crash/CrashReport.java +++ ../src-work/minecraft/net/minecraft/crash/CrashReport.java @@ -115,6 +115,7 @@ - return IntCache.getCacheSizes(); + return IntCache.func_85144_b(); } }); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().enhanceCrashReport(this, this.theReportCategory); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().enhanceCrashReport(this, this.field_85061_c); } - public String getDescription() + public String func_71501_a() @@ -203,6 +204,8 @@ { StringBuilder stringbuilder = new StringBuilder(); @@ -15,5 +15,5 @@ + net.minecraftforge.fml.common.asm.transformers.BlamingTransformer.onCrash(stringbuilder); + net.minecraftforge.fml.relauncher.CoreModManager.onCrash(stringbuilder); stringbuilder.append("// "); - stringbuilder.append(getWittyComment()); + stringbuilder.append(func_71503_h()); 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 3918b6866..6af34573d 100644 --- a/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch +++ b/patches/minecraft/net/minecraft/crash/CrashReportCategory.java.patch @@ -4,13 +4,13 @@ } else { -- this.stackTrace = new StackTraceElement[astacktraceelement.length - 3 - size]; -- System.arraycopy(astacktraceelement, 3 + size, this.stackTrace, 0, this.stackTrace.length); -+ int len = astacktraceelement.length - 3 - size; +- 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); ++ int len = astacktraceelement.length - 3 - p_85073_1_; + // Really Mojang, Still, god damn... + if (len <= 0) len = astacktraceelement.length; -+ this.stackTrace = new StackTraceElement[len]; -+ System.arraycopy(astacktraceelement, astacktraceelement.length - len, this.stackTrace, 0, this.stackTrace.length); - return this.stackTrace.length; ++ 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; } } diff --git a/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch b/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch index 83ecfbcea..d8d07737b 100644 --- a/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch +++ b/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch @@ -2,68 +2,68 @@ +++ ../src-work/minecraft/net/minecraft/creativetab/CreativeTabs.java @@ -125,8 +125,22 @@ @SideOnly(Side.CLIENT) - private ItemStack iconItemStack; + private ItemStack field_151245_t; + public CreativeTabs(String label) + { + this(getNextID(), label); + } + - public CreativeTabs(int index, String label) + public CreativeTabs(int p_i1853_1_, String p_i1853_2_) { -+ if (index >= creativeTabArray.length) ++ if (p_i1853_1_ >= field_78032_a.length) + { -+ CreativeTabs[] tmp = new CreativeTabs[index + 1]; -+ for (int x = 0; x < creativeTabArray.length; x++) ++ CreativeTabs[] tmp = new CreativeTabs[p_i1853_1_ + 1]; ++ for (int x = 0; x < field_78032_a.length; x++) + { -+ tmp[x] = creativeTabArray[x]; ++ tmp[x] = field_78032_a[x]; + } -+ creativeTabArray = tmp; ++ field_78032_a = tmp; + } - this.tabIndex = index; - this.tabLabel = label; - creativeTabArray[index] = this; + this.field_78033_n = p_i1853_1_; + this.field_78034_o = p_i1853_2_; + field_78032_a[p_i1853_1_] = this; @@ -209,12 +223,20 @@ @SideOnly(Side.CLIENT) - public int getTabColumn() + public int func_78020_k() { -+ if (tabIndex > 11) ++ if (field_78033_n > 11) + { -+ return ((tabIndex - 12) % 10) % 5; ++ return ((field_78033_n - 12) % 10) % 5; + } - return this.tabIndex % 6; + return this.field_78033_n % 6; } @SideOnly(Side.CLIENT) - public boolean isTabInFirstRow() + public boolean func_78023_l() { -+ if (tabIndex > 11) ++ if (field_78033_n > 11) + { -+ return ((tabIndex - 12) % 10) < 5; ++ return ((field_78033_n - 12) % 10) < 5; + } - return this.tabIndex < 6; + return this.field_78033_n < 6; } @@ -256,10 +278,17 @@ { - for (Item item : Item.itemRegistry) + for (Item item : Item.field_150901_e) { -- if (item != null && item.getCreativeTab() == this) +- if (item != null && item.func_77640_w() == this) + if (item == null) { -- item.getSubItems(item, this, p_78018_1_); +- item.func_150895_a(item, this, p_78018_1_); + continue; } + for (CreativeTabs tab : item.getCreativeTabs()) + { + if (tab == this) + { -+ item.getSubItems(item, this, p_78018_1_); ++ item.func_150895_a(item, this, p_78018_1_); + } + } } - if (this.getRelevantEnchantmentTypes() != null) + if (this.func_111225_m() != null) @@ -292,4 +321,39 @@ } } @@ -71,16 +71,16 @@ + + public int getTabPage() + { -+ if (tabIndex > 11) ++ if (field_78033_n > 11) + { -+ return ((tabIndex - 12) / 10) + 1; ++ return ((field_78033_n - 12) / 10) + 1; + } + return 0; + } + + public static int getNextID() + { -+ return creativeTabArray.length; ++ return field_78032_a.length; + } + + /** @@ -90,7 +90,7 @@ + */ + public boolean hasSearchBar() + { -+ return tabIndex == CreativeTabs.tabAllSearch.tabIndex; ++ return field_78033_n == CreativeTabs.field_78027_g.field_78033_n; + } + + /** diff --git a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch index f3dc07bd2..92f2bc57b 100644 --- a/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/Enchantment.java.patch @@ -2,22 +2,22 @@ +++ ../src-work/minecraft/net/minecraft/enchantment/Enchantment.java @@ -61,7 +61,7 @@ - if (enchantmentsList[enchID] != null) + if (field_180311_a[p_i45771_1_] != null) { - throw new IllegalArgumentException("Duplicate enchantment id!"); -+ throw new IllegalArgumentException("Duplicate enchantment id! " + this.getClass() + " and " + enchantmentsList[enchID].getClass() + " Enchantment ID:" + enchID); ++ throw new IllegalArgumentException("Duplicate enchantment id! " + this.getClass() + " and " + field_180311_a[p_i45771_1_].getClass() + " Enchantment ID:" + p_i45771_1_); } else { @@ -139,7 +139,7 @@ - public boolean canApply(ItemStack stack) + public boolean func_92089_a(ItemStack p_92089_1_) { -- return this.type.canEnchantItem(stack.getItem()); -+ return canApplyAtEnchantingTable(stack); +- return this.field_77351_y.func_77557_a(p_92089_1_.func_77973_b()); ++ return canApplyAtEnchantingTable(p_92089_1_); } - public void onEntityDamaged(EntityLivingBase user, Entity target, int level) + public void func_151368_a(EntityLivingBase p_151368_1_, Entity p_151368_2_, int p_151368_3_) @@ -150,6 +150,45 @@ { } @@ -30,7 +30,7 @@ + */ + public boolean canApplyAtEnchantingTable(ItemStack stack) + { -+ return this.type.canEnchantItem(stack.getItem()); ++ return this.field_77351_y.func_77557_a(stack.func_77973_b()); + } + + private static final java.lang.reflect.Field bookSetter = Enchantment.class.getDeclaredFields()[1]; @@ -44,7 +44,7 @@ + try + { + net.minecraftforge.common.util.EnumHelper.setFailsafeFieldValue(bookSetter, null, -+ com.google.common.collect.ObjectArrays.concat(enchantmentsBookList, enchantment)); ++ com.google.common.collect.ObjectArrays.concat(field_77331_b, enchantment)); + } + catch (Exception e) + { diff --git a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch index 7632c6c5d..fe2ae4132 100644 --- a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch @@ -1,19 +1,19 @@ --- ../src-base/minecraft/net/minecraft/enchantment/EnchantmentHelper.java +++ ../src-work/minecraft/net/minecraft/enchantment/EnchantmentHelper.java @@ -296,7 +296,7 @@ - public static int calcItemStackEnchantability(Random p_77514_0_, int p_77514_1_, int p_77514_2_, ItemStack p_77514_3_) + 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_.getItem(); -- int i = item.getItemEnchantability(); + Item item = p_77514_3_.func_77973_b(); +- int i = item.func_77619_b(); + int i = item.getItemEnchantability(p_77514_3_); if (i <= 0) { @@ -345,7 +345,7 @@ - public static List buildEnchantmentList(Random p_77513_0_, ItemStack p_77513_1_, int p_77513_2_) + public static List func_77513_b(Random p_77513_0_, ItemStack p_77513_1_, int p_77513_2_) { - Item item = p_77513_1_.getItem(); -- int i = item.getItemEnchantability(); + Item item = p_77513_1_.func_77973_b(); +- int i = item.func_77619_b(); + int i = item.getItemEnchantability(p_77513_1_); if (i <= 0) @@ -22,20 +22,20 @@ for (EnchantmentData enchantmentdata1 : list) { -- if (!enchantmentdata1.enchantmentobj.canApplyTogether(Enchantment.getEnchantmentById(integer.intValue()))) -+ Enchantment e1 = enchantmentdata1.enchantmentobj; -+ Enchantment e2 = Enchantment.getEnchantmentById(integer.intValue()); -+ if (e1.canApplyTogether(e2) && e2.canApplyTogether(e1)) //Forge BugFix: Let Both enchantments veto being together +- if (!enchantmentdata1.field_76302_b.func_77326_a(Enchantment.func_180306_c(integer.intValue()))) ++ Enchantment e1 = enchantmentdata1.field_76302_b; ++ Enchantment e2 = Enchantment.func_180306_c(integer.intValue()); ++ if (e1.func_77326_a(e2) && e2.func_77326_a(e1)) //Forge BugFix: Let Both enchantments veto being together { flag = false; break; @@ -421,7 +423,8 @@ - for (Enchantment enchantment : Enchantment.enchantmentsBookList) + for (Enchantment enchantment : Enchantment.field_77331_b) { -- if (enchantment != null && (enchantment.type.canEnchantItem(item) || flag)) +- if (enchantment != null && (enchantment.field_77351_y.func_77557_a(item) || flag)) + if (enchantment == null) continue; + if (enchantment.canApplyAtEnchantingTable(p_77505_1_) || (flag && enchantment.isAllowedOnBooks())) { - for (int i = enchantment.getMinLevel(); i <= enchantment.getMaxLevel(); ++i) + for (int i = enchantment.func_77319_d(); i <= enchantment.func_77325_b(); ++i) { diff --git a/patches/minecraft/net/minecraft/entity/Entity.java.patch b/patches/minecraft/net/minecraft/entity/Entity.java.patch index e19b11f4d..2b356e922 100644 --- a/patches/minecraft/net/minecraft/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/entity/Entity.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/entity/Entity.java +++ ../src-work/minecraft/net/minecraft/entity/Entity.java @@ -129,6 +129,14 @@ - protected UUID entityUniqueID; - private final CommandResultStats cmdResultStats; + protected UUID field_96093_i; + private final CommandResultStats field_174837_as; + /** Forge: Used to store custom data for each entity. */ + private NBTTagCompound customEntityData; @@ -12,41 +12,41 @@ + + protected java.util.HashMap extendedProperties = new java.util.HashMap(); + - public int getEntityId() + public int func_145782_y() { - return this.entityId; + return this.field_145783_c; @@ -172,6 +180,8 @@ - this.dataWatcher.addObject(2, ""); - this.dataWatcher.addObject(4, Byte.valueOf((byte)0)); - this.entityInit(); + this.field_70180_af.func_75682_a(2, ""); + this.field_70180_af.func_75682_a(4, Byte.valueOf((byte)0)); + this.func_70088_a(); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this)); -+ for (net.minecraftforge.common.IExtendedEntityProperties props : extendedProperties.values()) props.init(this, worldIn); ++ for (net.minecraftforge.common.IExtendedEntityProperties props : extendedProperties.values()) props.init(this, p_i1582_1_); } - protected abstract void entityInit(); + protected abstract void func_70088_a(); @@ -998,10 +1008,7 @@ - if (block.getMaterial() == materialIn) + if (block.func_149688_o() == p_70055_1_) { -- float f = BlockLiquid.getLiquidHeightPercent(iblockstate.getBlock().getMetaFromState(iblockstate)) - 0.11111111F; -- float f1 = (float)(blockpos.getY() + 1) - f; +- float f = BlockLiquid.func_149801_b(iblockstate.func_177230_c().func_176201_c(iblockstate)) - 0.11111111F; +- float f1 = (float)(blockpos.func_177956_o() + 1) - f; - boolean flag = d0 < (double)f1; - return !flag && this instanceof EntityPlayer ? false : flag; -+ return net.minecraftforge.common.ForgeHooks.isInsideOfMaterial(materialIn, this, blockpos); ++ return net.minecraftforge.common.ForgeHooks.isInsideOfMaterial(p_70055_1_, this, blockpos); } else { @@ -1356,6 +1363,21 @@ - tagCompund.setBoolean("Silent", this.isSilent()); + p_70109_1_.func_74757_a("Silent", this.func_174814_R()); } -+ if (customEntityData != null) tagCompund.setTag("ForgeData", customEntityData); ++ if (customEntityData != null) p_70109_1_.func_74782_a("ForgeData", customEntityData); + for (String identifier : this.extendedProperties.keySet()) + { + try + { + net.minecraftforge.common.IExtendedEntityProperties props = this.extendedProperties.get(identifier); -+ props.saveNBTData(tagCompund); ++ props.saveNBTData(p_70109_1_); + } + catch (Throwable t) + { @@ -55,21 +55,21 @@ + } + } + - this.writeEntityToNBT(tagCompund); + this.func_70014_b(p_70109_1_); - if (this.ridingEntity != null) + if (this.field_70154_o != null) @@ -1438,6 +1460,28 @@ - this.setAlwaysRenderNameTag(tagCompund.getBoolean("CustomNameVisible")); - this.cmdResultStats.func_179668_a(tagCompund); - this.setSilent(tagCompund.getBoolean("Silent")); + this.func_174805_g(p_70020_1_.func_74767_n("CustomNameVisible")); + this.field_174837_as.func_179668_a(p_70020_1_); + this.func_174810_b(p_70020_1_.func_74767_n("Silent")); + -+ if (tagCompund.hasKey("ForgeData")) customEntityData = tagCompund.getCompoundTag("ForgeData"); ++ if (p_70020_1_.func_74764_b("ForgeData")) customEntityData = p_70020_1_.func_74775_l("ForgeData"); + for (String identifier : this.extendedProperties.keySet()) + { + try + { + net.minecraftforge.common.IExtendedEntityProperties props = this.extendedProperties.get(identifier); -+ props.loadNBTData(tagCompund); ++ props.loadNBTData(p_70020_1_); + } + catch (Throwable t) + { @@ -79,52 +79,52 @@ + } + + //Rawr, legacy code, Vanilla added a UUID, keep this so older maps will convert properly -+ if (tagCompund.hasKey("PersistentIDMSB") && tagCompund.hasKey("PersistentIDLSB")) ++ if (p_70020_1_.func_74764_b("PersistentIDMSB") && p_70020_1_.func_74764_b("PersistentIDLSB")) + { -+ this.entityUniqueID = new UUID(tagCompund.getLong("PersistentIDMSB"), tagCompund.getLong("PersistentIDLSB")); ++ this.field_96093_i = new UUID(p_70020_1_.func_74763_f("PersistentIDMSB"), p_70020_1_.func_74763_f("PersistentIDLSB")); + } + - this.readEntityFromNBT(tagCompund); + this.func_70037_a(p_70020_1_); - if (this.shouldSetPosAfterLoading()) + if (this.func_142008_O()) @@ -1512,7 +1556,10 @@ { - EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)offsetY, this.posZ, itemStackIn); - entityitem.setDefaultPickupDelay(); -- this.worldObj.spawnEntityInWorld(entityitem); + EntityItem entityitem = new EntityItem(this.field_70170_p, this.field_70165_t, this.field_70163_u + (double)p_70099_2_, this.field_70161_v, p_70099_1_); + entityitem.func_174869_p(); +- this.field_70170_p.func_72838_d(entityitem); + if (captureDrops) + this.capturedDrops.add(entityitem); + else -+ this.worldObj.spawnEntityInWorld(entityitem); ++ this.field_70170_p.func_72838_d(entityitem); return entityitem; } else @@ -1655,6 +1702,7 @@ - public void mountEntity(Entity entityIn) + public void func_70078_a(Entity p_70078_1_) { -+ if(!(this instanceof EntityLivingBase) && !net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entityIn, true)){ return; } - this.entityRiderPitchDelta = 0.0D; - this.entityRiderYawDelta = 0.0D; ++ if(!(this instanceof EntityLivingBase) && !net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_70078_1_, true)){ return; } + this.field_70149_e = 0.0D; + this.field_70147_f = 0.0D; @@ -1789,7 +1837,7 @@ - public boolean isRiding() + public boolean func_70115_ae() { -- return this.ridingEntity != null; -+ return this.ridingEntity != null && ridingEntity.shouldRiderSit(); +- return this.field_70154_o != null; ++ return this.field_70154_o != null && field_70154_o.shouldRiderSit(); } - public boolean isSneaking() + public boolean func_70093_af() @@ -2092,7 +2140,7 @@ - public float getExplosionResistance(Explosion p_180428_1_, World worldIn, BlockPos p_180428_3_, IBlockState p_180428_4_) + public float func_180428_a(Explosion p_180428_1_, World p_180428_2_, BlockPos p_180428_3_, IBlockState p_180428_4_) { -- return p_180428_4_.getBlock().getExplosionResistance(this); -+ return p_180428_4_.getBlock().getExplosionResistance(worldIn, p_180428_3_.add(0, getEyeHeight(), 0), this, p_180428_1_); +- return p_180428_4_.func_177230_c().func_149638_a(this); ++ return p_180428_4_.func_177230_c().getExplosionResistance(p_180428_2_, p_180428_3_.func_177963_a(0, func_70047_e(), 0), this, p_180428_1_); } - public boolean func_174816_a(Explosion p_174816_1_, World worldIn, BlockPos p_174816_3_, IBlockState p_174816_4_, float p_174816_5_) + public boolean func_174816_a(Explosion p_174816_1_, World p_174816_2_, BlockPos p_174816_3_, IBlockState p_174816_4_, float p_174816_5_) @@ -2353,4 +2401,184 @@ EnchantmentHelper.func_151385_b(p_174815_1_, p_174815_2_); @@ -164,22 +164,22 @@ + { + if (this instanceof net.minecraft.entity.item.EntityPainting) + { -+ return new ItemStack(net.minecraft.init.Items.painting); ++ return new ItemStack(net.minecraft.init.Items.field_151159_an); + } + else if (this instanceof EntityLeashKnot) + { -+ return new ItemStack(net.minecraft.init.Items.lead); ++ return new ItemStack(net.minecraft.init.Items.field_151058_ca); + } + else if (this instanceof net.minecraft.entity.item.EntityItemFrame) + { -+ ItemStack held = ((net.minecraft.entity.item.EntityItemFrame)this).getDisplayedItem(); ++ ItemStack held = ((net.minecraft.entity.item.EntityItemFrame)this).func_82335_i(); + if (held == null) + { -+ return new ItemStack(net.minecraft.init.Items.item_frame); ++ return new ItemStack(net.minecraft.init.Items.field_151160_bD); + } + else + { -+ return held.copy(); ++ return held.func_77946_l(); + } + } + else if (this instanceof net.minecraft.entity.item.EntityMinecart) @@ -188,24 +188,24 @@ + } + else if (this instanceof net.minecraft.entity.item.EntityBoat) + { -+ return new ItemStack(net.minecraft.init.Items.boat); ++ return new ItemStack(net.minecraft.init.Items.field_151124_az); + } + else if (this instanceof net.minecraft.entity.item.EntityArmorStand) + { -+ return new ItemStack(net.minecraft.init.Items.armor_stand); ++ return new ItemStack(net.minecraft.init.Items.field_179565_cj); + } + else + { -+ int id = EntityList.getEntityID(this); -+ if (id > 0 && EntityList.entityEggs.containsKey(id)) ++ int id = EntityList.func_75619_a(this); ++ if (id > 0 && EntityList.field_75627_a.containsKey(id)) + { -+ return new ItemStack(net.minecraft.init.Items.spawn_egg, 1, id); ++ return new ItemStack(net.minecraft.init.Items.field_151063_bx, 1, id); + } -+ String name = EntityList.getEntityString(this); ++ String name = EntityList.func_75621_b(this); + if (name != null && net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().containsKey(name)) + { -+ ItemStack stack = new ItemStack(net.minecraft.init.Items.spawn_egg); -+ stack.setTagInfo("entity_name", new net.minecraft.nbt.NBTTagString(name)); ++ ItemStack stack = new ItemStack(net.minecraft.init.Items.field_151063_bx); ++ stack.func_77983_a("entity_name", new net.minecraft.nbt.NBTTagString(name)); + return stack; + } + } @@ -214,7 +214,7 @@ + + public UUID getPersistentID() + { -+ return entityUniqueID; ++ return field_96093_i; + } + + /** @@ -222,7 +222,7 @@ + */ + public final void resetEntityId() + { -+ this.entityId = nextEntityID++; ++ this.field_145783_c = field_70152_a++; + } + + public boolean shouldRenderInPass(int pass) @@ -238,8 +238,8 @@ + */ + public boolean isCreatureType(EnumCreatureType type, boolean forSpawnCount) + { -+ if (forSpawnCount && (this instanceof EntityLiving) && ((EntityLiving)this).isNoDespawnRequired()) return false; -+ return type.getCreatureClass().isAssignableFrom(this.getClass()); ++ if (forSpawnCount && (this instanceof EntityLiving) && ((EntityLiving)this).func_104002_bU()) return false; ++ return type.func_75598_a().isAssignableFrom(this.getClass()); + } + + /** diff --git a/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch b/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch index e064546a1..29d340d07 100644 --- a/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch @@ -2,11 +2,11 @@ +++ ../src-work/minecraft/net/minecraft/entity/EntityHanging.java @@ -123,6 +123,9 @@ { - BlockPos blockpos1 = blockpos.offset(enumfacing, k).up(l); - Block block = this.worldObj.getBlockState(blockpos1).getBlock(); + BlockPos blockpos1 = blockpos.func_177967_a(enumfacing, k).func_177981_b(l); + Block block = this.field_70170_p.func_180495_p(blockpos1).func_177230_c(); + -+ if ( block.isSideSolid( this.worldObj, blockpos1, this.field_174860_b )) ++ if ( block.isSideSolid( this.field_70170_p, blockpos1, this.field_174860_b )) + continue; - if (!block.getMaterial().isSolid() && !BlockRedstoneDiode.isRedstoneRepeaterBlockID(block)) + if (!block.func_149688_o().func_76220_a() && !BlockRedstoneDiode.func_149909_d(block)) { diff --git a/patches/minecraft/net/minecraft/entity/EntityList.java.patch b/patches/minecraft/net/minecraft/entity/EntityList.java.patch index ed5935e63..0a51ed53e 100644 --- a/patches/minecraft/net/minecraft/entity/EntityList.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityList.java.patch @@ -2,21 +2,21 @@ +++ ../src-work/minecraft/net/minecraft/entity/EntityList.java @@ -88,6 +88,7 @@ - public static void addMapping(Class p_75618_0_, String p_75618_1_, int p_75618_2_) + public static void func_75618_a(Class p_75618_0_, String p_75618_1_, int p_75618_2_) { + if (p_75618_2_ < 0 || p_75618_2_ > 255) throw new IllegalArgumentException("Attempted to register a entity with invalid ID: " + p_75618_2_ + " Name: " + p_75618_1_ + " Class: " + p_75618_0_); - if (stringToClassMapping.containsKey(p_75618_1_)) + if (field_75625_b.containsKey(p_75618_1_)) { throw new IllegalArgumentException("ID is already registered: " + p_75618_1_); @@ -151,9 +152,10 @@ - p_75615_0_.removeTag("Type"); + p_75615_0_.func_82580_o("Type"); } + Class oclass = null; try { -- Class oclass = (Class)stringToClassMapping.get(p_75615_0_.getString("id")); -+ oclass = stringToClassMapping.get(p_75615_0_.getString("id")); +- Class oclass = (Class)field_75625_b.get(p_75615_0_.func_74779_i("id")); ++ oclass = field_75625_b.get(p_75615_0_.func_74779_i("id")); if (oclass != null) { @@ -26,13 +26,13 @@ { + try + { - entity.readFromNBT(p_75615_0_); + entity.func_70020_e(p_75615_0_); + } + catch (Exception e) + { + net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, + "An Entity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", -+ p_75615_0_.getString("id"), oclass.getName()); ++ p_75615_0_.func_74779_i("id"), oclass.getName()); + entity = null; + } } @@ -43,26 +43,26 @@ public static class EntityEggInfo { + @Deprecated // This is not always a valid number in the global ID list. - public final int spawnedID; + public final int field_75613_a; + public final String name; - public final int primaryColor; - public final int secondaryColor; + public final int field_75611_b; + public final int field_75612_c; public final StatBase field_151512_d; @@ -356,6 +370,17 @@ - this.secondaryColor = p_i1583_3_; - this.field_151512_d = StatList.getStatKillEntity(this); - this.field_151513_e = StatList.getStatEntityKilledBy(this); -+ this.name = EntityList.getStringFromID(p_i1583_1_); + this.field_75612_c = p_i1583_3_; + this.field_151512_d = StatList.func_151182_a(this); + this.field_151513_e = StatList.func_151176_b(this); ++ this.name = EntityList.func_75617_a(p_i1583_1_); } + + public EntityEggInfo(String name, int primaryColor, int secondaryColor) + { -+ this.spawnedID = -1; ++ this.field_75613_a = -1; + this.name = name; -+ this.primaryColor = primaryColor; -+ this.secondaryColor = secondaryColor; -+ this.field_151512_d = (new StatBase("stat.killEntity." + name, new net.minecraft.util.ChatComponentTranslation("stat.entityKill", new net.minecraft.util.ChatComponentTranslation("entity." + name + ".name")))).registerStat(); -+ this.field_151513_e = (new StatBase("stat.entityKilledBy." + name, new net.minecraft.util.ChatComponentTranslation("stat.entityKilledBy", new net.minecraft.util.ChatComponentTranslation("entity." + name + ".name")))).registerStat(); ++ this.field_75611_b = primaryColor; ++ this.field_75612_c = secondaryColor; ++ this.field_151512_d = (new StatBase("stat.killEntity." + name, new net.minecraft.util.ChatComponentTranslation("stat.entityKill", new net.minecraft.util.ChatComponentTranslation("entity." + name + ".name")))).func_75971_g(); ++ this.field_151513_e = (new StatBase("stat.entityKilledBy." + name, new net.minecraft.util.ChatComponentTranslation("stat.entityKilledBy", new net.minecraft.util.ChatComponentTranslation("entity." + name + ".name")))).func_75971_g(); + } } } diff --git a/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch b/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch index c5577637a..915de5e84 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch @@ -1,41 +1,41 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityLiving.java +++ ../src-work/minecraft/net/minecraft/entity/EntityLiving.java @@ -121,6 +121,7 @@ - public void setAttackTarget(EntityLivingBase p_70624_1_) + public void func_70624_b(EntityLivingBase p_70624_1_) { - this.attackTarget = p_70624_1_; + this.field_70696_bz = p_70624_1_; + net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, p_70624_1_); } - public boolean canAttackClass(Class p_70686_1_) + public boolean func_70686_a(Class p_70686_1_) @@ -498,10 +499,22 @@ - protected void despawnEntity() + protected void func_70623_bb() { + net.minecraftforge.fml.common.eventhandler.Event.Result result = null; - if (this.persistenceRequired) + if (this.field_82179_bU) { - this.entityAge = 0; + this.field_70708_bq = 0; } -+ else if ((this.entityAge & 0x1F) == 0x1F && (result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this)) != net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT) ++ else if ((this.field_70708_bq & 0x1F) == 0x1F && (result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this)) != net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT) + { + if (result == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) + { -+ this.entityAge = 0; ++ this.field_70708_bq = 0; + } + else + { -+ this.setDead(); ++ this.func_70106_y(); + } + } else { - Entity entity = this.worldObj.getClosestPlayerToEntity(this, -1.0D); + Entity entity = this.field_70170_p.func_72890_a(this, -1.0D); @@ -621,7 +634,6 @@ - return this.worldObj.checkNoEntityCollision(this.getEntityBoundingBox(), this) && this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(this.getEntityBoundingBox()); + return this.field_70170_p.func_72917_a(this.func_174813_aQ(), this) && this.field_70170_p.func_72945_a(this, this.func_174813_aQ()).isEmpty() && !this.field_70170_p.func_72953_d(this.func_174813_aQ()); } - @SideOnly(Side.CLIENT) - public float getRenderSizeModifier() + public float func_70603_bj() { return 1.0F; diff --git a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch index c528bd8cd..945d7ebcc 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -4,56 +4,56 @@ } } -- if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity instanceof EntityLivingBase) -+ if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity != null && ridingEntity.shouldDismountInWater(this)) +- if (!this.field_70170_p.field_72995_K && this.func_70115_ae() && this.field_70154_o instanceof EntityLivingBase) ++ if (!this.field_70170_p.field_72995_K && this.func_70115_ae() && this.field_70154_o != null && field_70154_o.shouldDismountInWater(this)) { - this.mountEntity((Entity)null); + this.func_70078_a((Entity)null); } @@ -319,7 +319,7 @@ - if (!this.worldObj.isRemote && (this.recentlyHit > 0 || this.isPlayer()) && this.func_146066_aG() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) + if (!this.field_70170_p.field_72995_K && (this.field_70718_bc > 0 || this.func_70684_aJ()) && this.func_146066_aG() && this.field_70170_p.func_82736_K().func_82766_b("doMobLoot")) { - int i = this.getExperiencePoints(this.attackingPlayer); + int i = this.func_70693_a(this.field_70717_bb); - -+ i = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.attackingPlayer, i); ++ i = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.field_70717_bb, i); while (i > 0) { - int j = EntityXPOrb.getXPSplit(i); + int j = EntityXPOrb.func_70527_a(i); @@ -380,6 +380,7 @@ { - this.entityLivingToAttack = livingBase; - this.revengeTimer = this.ticksExisted; -+ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, livingBase); + this.field_70755_b = p_70604_1_; + this.field_70756_c = this.field_70173_aa; ++ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, p_70604_1_); } - public EntityLivingBase getLastAttacker() + public EntityLivingBase func_110144_aD() @@ -663,7 +664,6 @@ - return this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD; + return this.func_70668_bt() == EnumCreatureAttribute.UNDEAD; } - @SideOnly(Side.CLIENT) - public void removePotionEffectClient(int p_70618_1_) + public void func_70618_n(int p_70618_1_) { - this.activePotionsMap.remove(Integer.valueOf(p_70618_1_)); + this.field_70713_bf.remove(Integer.valueOf(p_70618_1_)); @@ -712,6 +712,8 @@ - public void heal(float healAmount) + public void func_70691_i(float p_70691_1_) { -+ healAmount = net.minecraftforge.event.ForgeEventFactory.onLivingHeal(this, healAmount); -+ if (healAmount <= 0) return; - float f = this.getHealth(); ++ p_70691_1_ = net.minecraftforge.event.ForgeEventFactory.onLivingHeal(this, p_70691_1_); ++ if (p_70691_1_ <= 0) return; + float f = this.func_110143_aJ(); if (f > 0.0F) @@ -732,6 +734,7 @@ - public boolean attackEntityFrom(DamageSource source, float amount) + public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { -+ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, source, amount)) return false; - if (this.isEntityInvulnerable(source)) ++ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, p_70097_1_, p_70097_2_)) return false; + if (this.func_180431_b(p_70097_1_)) { return false; @@ -797,9 +800,9 @@ - this.recentlyHit = 100; - this.attackingPlayer = (EntityPlayer)entity; + this.field_70718_bc = 100; + this.field_70717_bb = (EntityPlayer)entity; } - else if (entity instanceof EntityWolf) + else if (entity instanceof net.minecraft.entity.passive.EntityTameable) @@ -61,118 +61,118 @@ - EntityWolf entitywolf = (EntityWolf)entity; + net.minecraft.entity.passive.EntityTameable entitywolf = (net.minecraft.entity.passive.EntityTameable)entity; - if (entitywolf.isTamed()) + if (entitywolf.func_70909_n()) { @@ -883,6 +886,7 @@ - public void onDeath(DamageSource cause) + public void func_70645_a(DamageSource p_70645_1_) { -+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; - Entity entity = cause.getEntity(); ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return; + Entity entity = p_70645_1_.func_76346_g(); EntityLivingBase entitylivingbase = this.func_94060_bK(); @@ -908,6 +912,9 @@ - i = EnchantmentHelper.getLootingModifier((EntityLivingBase)entity); + i = EnchantmentHelper.func_77519_f((EntityLivingBase)entity); } + captureDrops = true; + capturedDrops.clear(); + - if (this.func_146066_aG() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) + if (this.func_146066_aG() && this.field_70170_p.func_82736_K().func_82766_b("doMobLoot")) { - this.dropFewItems(this.recentlyHit > 0, i); + this.func_70628_a(this.field_70718_bc > 0, i); @@ -918,6 +925,16 @@ - this.addRandomArmor(); + this.func_82164_bB(); } } + + captureDrops = false; + -+ if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, cause, capturedDrops, i, recentlyHit > 0)) ++ if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, p_70645_1_, capturedDrops, i, field_70718_bc > 0)) + { + for (EntityItem item : capturedDrops) + { -+ worldObj.spawnEntityInWorld(item); ++ field_70170_p.func_72838_d(item); + } + } } - this.worldObj.setEntityState(this, (byte)3); + this.field_70170_p.func_72960_a(this, (byte)3); @@ -972,7 +989,7 @@ - int j = MathHelper.floor_double(this.getEntityBoundingBox().minY); - int k = MathHelper.floor_double(this.posZ); - Block block = this.worldObj.getBlockState(new BlockPos(i, j, k)).getBlock(); -- return (block == Blocks.ladder || block == Blocks.vine) && (!(this instanceof EntityPlayer) || !((EntityPlayer)this).isSpectator()); -+ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(block, worldObj, new BlockPos(i, j, k), this); + int j = MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b); + int k = MathHelper.func_76128_c(this.field_70161_v); + Block block = this.field_70170_p.func_180495_p(new BlockPos(i, j, k)).func_177230_c(); +- return (block == Blocks.field_150468_ap || block == Blocks.field_150395_bd) && (!(this instanceof EntityPlayer) || !((EntityPlayer)this).func_175149_v()); ++ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(block, field_70170_p, new BlockPos(i, j, k), this); } - public boolean isEntityAlive() + public boolean func_70089_S() @@ -982,6 +999,9 @@ - public void fall(float distance, float damageMultiplier) + public void func_180430_e(float p_180430_1_, float p_180430_2_) { -+ float[] ret = net.minecraftforge.common.ForgeHooks.onLivingFall(this, distance, damageMultiplier); ++ float[] ret = net.minecraftforge.common.ForgeHooks.onLivingFall(this, p_180430_1_, p_180430_2_); + if (ret == null) return; -+ distance = ret[0]; damageMultiplier = ret[1]; - super.fall(distance, damageMultiplier); - PotionEffect potioneffect = this.getActivePotionEffect(Potion.jump); - float f = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F; ++ p_180430_1_ = ret[0]; p_180430_2_ = ret[1]; + super.func_180430_e(p_180430_1_, p_180430_2_); + PotionEffect potioneffect = this.func_70660_b(Potion.field_76430_j); + float f = potioneffect != null ? (float)(potioneffect.func_76458_c() + 1) : 0.0F; @@ -1094,6 +1114,8 @@ { - if (!this.isEntityInvulnerable(damageSrc)) + if (!this.func_180431_b(p_70665_1_)) { -+ damageAmount = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, damageSrc, damageAmount); -+ if (damageAmount <= 0) return; - damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); - damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); - float f = damageAmount; ++ 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 f = p_70665_2_; @@ -1142,6 +1164,11 @@ - public void swingItem() + public void func_71038_i() { -+ ItemStack stack = this.getHeldItem(); -+ if (stack != null && stack.getItem() != null) ++ ItemStack stack = this.func_70694_bm(); ++ if (stack != null && stack.func_77973_b() != null) + { -+ if (stack.getItem().onEntitySwing(this, stack)) return; ++ if (stack.func_77973_b().onEntitySwing(this, stack)) return; + } - if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0) + if (!this.field_82175_bq || this.field_110158_av >= this.func_82166_i() / 2 || this.field_110158_av < 0) { - this.swingProgressInt = -1; + this.field_110158_av = -1; @@ -1281,6 +1308,7 @@ - public void dismountEntity(Entity p_110145_1_) + public void func_110145_l(Entity p_110145_1_) { + if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_110145_1_, false)){ return; } - double d0 = p_110145_1_.posX; - double d1 = p_110145_1_.getEntityBoundingBox().minY + (double)p_110145_1_.height; - double d2 = p_110145_1_.posZ; + double d0 = p_110145_1_.field_70165_t; + double d1 = p_110145_1_.func_174813_aQ().field_72338_b + (double)p_110145_1_.field_70131_O; + double d2 = p_110145_1_.field_70161_v; @@ -1346,6 +1374,7 @@ } - this.isAirBorne = true; + this.field_70160_al = true; + net.minecraftforge.common.ForgeHooks.onLivingJump(this); } - protected void updateAITick() + protected void func_70629_bd() @@ -1530,6 +1559,7 @@ - public void onUpdate() + public void func_70071_h_() { + if (net.minecraftforge.common.ForgeHooks.onLivingUpdate(this)) return; - super.onUpdate(); + super.func_70071_h_(); - if (!this.worldObj.isRemote) + if (!this.field_70170_p.field_72995_K) @@ -1817,6 +1847,7 @@ - public void mountEntity(Entity entityIn) + public void func_70078_a(Entity p_70078_1_) { -+ if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entityIn, true)){ return; } - if (this.ridingEntity != null && entityIn == null) ++ if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_70078_1_, true)){ return; } + if (this.field_70154_o != null && p_70078_1_ == null) { - if (!this.worldObj.isRemote) + if (!this.field_70170_p.field_72995_K) @@ -1998,4 +2029,39 @@ { - this.potionsNeedUpdate = true; + this.field_70752_e = true; } + + /*** @@ -181,19 +181,19 @@ + */ + public void curePotionEffects(ItemStack curativeItem) + { -+ Iterator potionKey = activePotionsMap.keySet().iterator(); -+ if (worldObj.isRemote) return; ++ Iterator potionKey = field_70713_bf.keySet().iterator(); ++ if (field_70170_p.field_72995_K) return; + + while (potionKey.hasNext()) + { + Integer key = potionKey.next(); -+ PotionEffect effect = (PotionEffect)activePotionsMap.get(key); ++ PotionEffect effect = (PotionEffect)field_70713_bf.get(key); + + if (effect.isCurativeItem(curativeItem)) + { + potionKey.remove(); -+ onFinishedPotionEffect(effect); -+ this.potionsNeedUpdate = true; ++ func_70688_c(effect); ++ this.field_70752_e = true; + } + } + } diff --git a/patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch b/patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch index c7d458160..9f22ee7e1 100644 --- a/patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java @@ -109,6 +109,7 @@ - public boolean interactFirst(EntityPlayer playerIn) + public boolean func_130002_c(EntityPlayer p_130002_1_) { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; - this.commandBlockLogic.func_175574_a(playerIn); ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_130002_1_))) return true; + this.field_145824_a.func_175574_a(p_130002_1_); return false; } diff --git a/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch b/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch index d3e15e11d..ba155b961 100644 --- a/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityTracker.java.patch @@ -2,13 +2,13 @@ +++ ../src-work/minecraft/net/minecraft/entity/EntityTracker.java @@ -56,6 +56,8 @@ - public void trackEntity(Entity p_72786_1_) + public void func_72786_a(Entity p_72786_1_) { + if (net.minecraftforge.fml.common.registry.EntityRegistry.instance().tryTrackingEntity(this, p_72786_1_)) return; + if (p_72786_1_ instanceof EntityPlayerMP) { - this.trackEntity(p_72786_1_, 512, 2); + this.func_72791_a(p_72786_1_, 512, 2); @@ -331,4 +333,23 @@ } } @@ -24,11 +24,11 @@ + */ + public Set getTrackingPlayers(Entity entity) + { -+ EntityTrackerEntry entry = (EntityTrackerEntry) trackedEntityHashTable.lookup(entity.getEntityId()); ++ EntityTrackerEntry entry = (EntityTrackerEntry) field_72794_c.func_76041_a(entity.func_145782_y()); + if (entry == null) + return java.util.Collections.emptySet(); + else -+ return java.util.Collections.unmodifiableSet(entry.trackingPlayers); ++ return java.util.Collections.unmodifiableSet(entry.field_73134_o); + } + + /* ======================================== FORGE END =====================================*/ diff --git a/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch b/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch index 324f26799..20e203ef1 100644 --- a/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch @@ -1,42 +1,42 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityTrackerEntry.java +++ ../src-work/minecraft/net/minecraft/entity/EntityTrackerEntry.java @@ -379,6 +379,14 @@ - this.lastTrackedEntityMotionY = this.trackedEntity.motionY; - this.motionZ = this.trackedEntity.motionZ; + this.field_73138_k = this.field_73132_a.field_70181_x; + this.field_73135_l = this.field_73132_a.field_70179_y; -+ int posX = MathHelper.floor_double(this.trackedEntity.posX * 32.0D); -+ int posY = MathHelper.floor_double(this.trackedEntity.posY * 32.0D); -+ int posZ = MathHelper.floor_double(this.trackedEntity.posZ * 32.0D); -+ if (posX != this.encodedPosX || posY != this.encodedPosY || posZ != this.encodedPosZ) ++ int posX = MathHelper.func_76128_c(this.field_73132_a.field_70165_t * 32.0D); ++ int posY = MathHelper.func_76128_c(this.field_73132_a.field_70163_u * 32.0D); ++ int posZ = MathHelper.func_76128_c(this.field_73132_a.field_70161_v * 32.0D); ++ if (posX != this.field_73128_d || posY != this.field_73129_e || posZ != this.field_73126_f) + { -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.makeEntitySpawnAdjustment(this.trackedEntity, p_73117_1_, this.encodedPosX, this.encodedPosY, this.encodedPosZ); ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.makeEntitySpawnAdjustment(this.field_73132_a, p_73117_1_, this.field_73128_d, this.field_73129_e, this.field_73126_f); + } + - if (this.sendVelocityUpdates && !(packet instanceof S0FPacketSpawnMob)) + if (this.field_73143_t && !(packet instanceof S0FPacketSpawnMob)) { - p_73117_1_.playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(this.trackedEntity.getEntityId(), this.trackedEntity.motionX, this.trackedEntity.motionY, this.trackedEntity.motionZ)); + p_73117_1_.field_71135_a.func_147359_a(new S12PacketEntityVelocity(this.field_73132_a.func_145782_y(), this.field_73132_a.field_70159_w, this.field_73132_a.field_70181_x, this.field_73132_a.field_70179_y)); @@ -426,12 +434,14 @@ - p_73117_1_.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(this.trackedEntity.getEntityId(), potioneffect)); + p_73117_1_.field_71135_a.func_147359_a(new S1DPacketEntityEffect(this.field_73132_a.func_145782_y(), potioneffect)); } } -+ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(trackedEntity, p_73117_1_); ++ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(field_73132_a, p_73117_1_); } } - else if (this.trackingPlayers.contains(p_73117_1_)) + else if (this.field_73134_o.contains(p_73117_1_)) { - this.trackingPlayers.remove(p_73117_1_); - p_73117_1_.func_152339_d(this.trackedEntity); -+ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(trackedEntity, p_73117_1_); + this.field_73134_o.remove(p_73117_1_); + p_73117_1_.func_152339_d(this.field_73132_a); ++ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(field_73132_a, p_73117_1_); } } } @@ -463,6 +473,9 @@ - logger.warn("Fetching addPacket for removed entity"); + field_151262_p.warn("Fetching addPacket for removed entity"); } -+ Packet pkt = net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.getEntitySpawningPacket(this.trackedEntity); ++ Packet pkt = net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.getEntitySpawningPacket(this.field_73132_a); + if (pkt != null) return pkt; + - if (this.trackedEntity instanceof EntityItem) + if (this.field_73132_a instanceof EntityItem) { - return new S0EPacketSpawnObject(this.trackedEntity, 2, 1); + return new S0EPacketSpawnObject(this.field_73132_a, 2, 1); diff --git a/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch b/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch index 85d012159..d869b3547 100644 --- a/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch +++ b/patches/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch @@ -17,29 +17,29 @@ + { + if (--this.field_75445_i <= 0) + { -+ this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); -+ this.field_151497_i = 4 + this.attacker.getRNG().nextInt(7); -+ return this.entityPathEntity != null; ++ this.field_75438_g = this.field_75441_b.func_70661_as().func_75494_a(entitylivingbase); ++ this.field_151497_i = 4 + this.field_75441_b.func_70681_au().nextInt(7); ++ return this.field_75438_g != null; + } + else + { + return true; + } + } - this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); - return this.entityPathEntity != null; + this.field_75438_g = this.field_75441_b.func_70661_as().func_75494_a(entitylivingbase); + return this.field_75438_g != null; } @@ -91,6 +106,23 @@ - this.field_151496_k = entitylivingbase.posZ; - this.field_75445_i = 4 + this.attacker.getRNG().nextInt(7); + this.field_151496_k = entitylivingbase.field_70161_v; + this.field_75445_i = 4 + this.field_75441_b.func_70681_au().nextInt(7); + if (this.canPenalize) + { + this.field_151497_i += failedPathFindingPenalty; -+ if (this.attacker.getNavigator().getPath() != null) ++ if (this.field_75441_b.func_70661_as().func_75505_d() != null) + { -+ net.minecraft.pathfinding.PathPoint finalPathPoint = this.attacker.getNavigator().getPath().getFinalPathPoint(); -+ if (finalPathPoint != null && entitylivingbase.getDistanceSq(finalPathPoint.xCoord, finalPathPoint.yCoord, finalPathPoint.zCoord) < 1) ++ net.minecraft.pathfinding.PathPoint finalPathPoint = this.field_75441_b.func_70661_as().func_75505_d().func_75870_c(); ++ if (finalPathPoint != null && entitylivingbase.func_70092_e(finalPathPoint.field_75839_a, finalPathPoint.field_75837_b, finalPathPoint.field_75838_c) < 1) + failedPathFindingPenalty = 0; + else + failedPathFindingPenalty += 10; diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch index dc04cfb26..2ccf20bdd 100644 --- a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch @@ -2,13 +2,13 @@ +++ ../src-work/minecraft/net/minecraft/entity/boss/EntityDragon.java @@ -479,9 +479,9 @@ BlockPos blockpos = new BlockPos(k1, l1, i2); - Block block = this.worldObj.getBlockState(blockpos).getBlock(); + Block block = this.field_70170_p.func_180495_p(blockpos).func_177230_c(); -- if (block.getMaterial() != Material.air) -+ if (!block.isAir(worldObj, new BlockPos(k1, l1, i2))) +- if (block.func_149688_o() != Material.field_151579_a) ++ if (!block.isAir(field_70170_p, new BlockPos(k1, l1, i2))) { -- if (block != Blocks.barrier && block != Blocks.obsidian && block != Blocks.end_stone && block != Blocks.bedrock && block != Blocks.command_block && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) -+ if (block.canEntityDestroy(worldObj, new BlockPos(k1, l1, i2), this) && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) +- if (block != Blocks.field_180401_cv && block != Blocks.field_150343_Z && block != Blocks.field_150377_bs && block != Blocks.field_150357_h && block != Blocks.field_150483_bI && this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) ++ if (block.canEntityDestroy(field_70170_p, new BlockPos(k1, l1, i2), this) && this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) { - flag1 = this.worldObj.setBlockToAir(blockpos) || flag1; + flag1 = this.field_70170_p.func_175698_g(blockpos) || flag1; } diff --git a/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch b/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch index c999b9d32..38dc16d7a 100644 --- a/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch @@ -2,10 +2,10 @@ +++ ../src-work/minecraft/net/minecraft/entity/boss/EntityWither.java @@ -343,7 +343,7 @@ BlockPos blockpos = new BlockPos(i3, k, l); - Block block = this.worldObj.getBlockState(blockpos).getBlock(); + Block block = this.field_70170_p.func_180495_p(blockpos).func_177230_c(); -- if (block.getMaterial() != Material.air && func_181033_a(block)) -+ if (!block.isAir(worldObj,blockpos) && func_181033_a(block) && block.canEntityDestroy(worldObj, blockpos, this)) +- if (block.func_149688_o() != Material.field_151579_a && func_181033_a(block)) ++ if (!block.isAir(field_70170_p,blockpos) && func_181033_a(block) && block.canEntityDestroy(field_70170_p, blockpos, this)) { - flag = this.worldObj.destroyBlock(blockpos, true) || flag; + flag = this.field_70170_p.func_175655_b(blockpos, true) || flag; } diff --git a/patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch b/patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch index 98bf84269..ee9c56e4c 100644 --- a/patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch @@ -7,4 +7,4 @@ -@SideOnly(Side.CLIENT) public interface IBossDisplayData { - float getMaxHealth(); + float func_110138_aP(); diff --git a/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch b/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch index 662a54e4d..4778abec5 100644 --- a/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch +++ b/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch @@ -4,9 +4,9 @@ for (int i = 0; i < list.size(); ++i) { Entity entity = (Entity)list.get(i); -- entity.onStruckByLightning(this); +- entity.func_70077_a(this); + if (!net.minecraftforge.event.ForgeEventFactory.onEntityStruckByLightning(entity, this)) -+ entity.onStruckByLightning(this); ++ entity.func_70077_a(this); } } } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch index 2e2f47cd3..4a8b020c5 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch @@ -2,23 +2,23 @@ +++ ../src-work/minecraft/net/minecraft/entity/item/EntityEnderPearl.java @@ -61,6 +61,9 @@ - if (entityplayermp.playerNetServerHandler.getNetworkManager().isChannelOpen() && entityplayermp.worldObj == this.worldObj && !entityplayermp.isPlayerSleeping()) + if (entityplayermp.field_71135_a.func_147362_b().func_150724_d() && entityplayermp.field_70170_p == this.field_70170_p && !entityplayermp.func_70608_bn()) { -+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ, 5.0F); ++ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(entityplayermp, this.field_70165_t, this.field_70163_u, this.field_70161_v, 5.0F); + if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) + { // Don't indent to lower patch size - if (this.rand.nextFloat() < 0.05F && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobSpawning")) + if (this.field_70146_Z.nextFloat() < 0.05F && this.field_70170_p.func_82736_K().func_82766_b("doMobSpawning")) { - EntityEndermite entityendermite = new EntityEndermite(this.worldObj); + EntityEndermite entityendermite = new EntityEndermite(this.field_70170_p); @@ -74,9 +77,10 @@ - entitylivingbase.mountEntity((Entity)null); + entitylivingbase.func_70078_a((Entity)null); } -- entitylivingbase.setPositionAndUpdate(this.posX, this.posY, this.posZ); -+ entitylivingbase.setPositionAndUpdate(event.targetX, event.targetY, event.targetZ); - entitylivingbase.fallDistance = 0.0F; -- entitylivingbase.attackEntityFrom(DamageSource.fall, 5.0F); -+ entitylivingbase.attackEntityFrom(DamageSource.fall, event.attackDamage); +- entitylivingbase.func_70634_a(this.field_70165_t, this.field_70163_u, this.field_70161_v); ++ entitylivingbase.func_70634_a(event.targetX, event.targetY, event.targetZ); + entitylivingbase.field_70143_R = 0.0F; +- entitylivingbase.func_70097_a(DamageSource.field_76379_h, 5.0F); ++ entitylivingbase.func_70097_a(DamageSource.field_76379_h, event.attackDamage); + } } } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch index a2c16df04..85b198887 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch @@ -1,94 +1,94 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityItem.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityItem.java @@ -29,6 +29,11 @@ - private String owner; - public float hoverStart; + private String field_145802_g; + public float field_70290_d; + /** + * The maximum age of this EntityItem. The item is expired once this is reached. + */ + public int lifespan = 6000; + - public EntityItem(World worldIn, double x, double y, double z) + public EntityItem(World p_i1709_1_, double p_i1709_2_, double p_i1709_4_, double p_i1709_6_) { - super(worldIn); + super(p_i1709_1_); @@ -46,6 +51,7 @@ { - this(worldIn, x, y, z); - this.setEntityItemStack(stack); -+ this.lifespan = (stack.getItem() == null ? 6000 : stack.getItem().getEntityLifespan(stack, worldIn)); + 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_.func_77973_b().getEntityLifespan(p_i1710_8_, p_i1710_1_)); } - protected boolean canTriggerWalking() + protected boolean func_70041_e_() @@ -69,6 +75,8 @@ - public void onUpdate() + public void func_70071_h_() { -+ ItemStack stack = this.getDataWatcher().getWatchableObjectItemStack(10); -+ if (stack != null && stack.getItem() != null && stack.getItem().onEntityItemUpdate(this)) return; - if (this.getEntityItem() == null) ++ ItemStack stack = this.func_70096_w().func_82710_f(10); ++ if (stack != null && stack.func_77973_b() != null && stack.func_77973_b().onEntityItemUpdate(this)) return; + if (this.func_92059_d() == null) { - this.setDead(); + this.func_70106_y(); @@ -129,8 +137,16 @@ - this.handleWaterMovement(); + this.func_70072_I(); -- if (!this.worldObj.isRemote && this.age >= 6000) -+ ItemStack item = getDataWatcher().getWatchableObjectItemStack(10); +- if (!this.field_70170_p.field_72995_K && this.field_70292_b >= 6000) ++ ItemStack item = func_70096_w().func_82710_f(10); + -+ if (!this.worldObj.isRemote && this.age >= lifespan) ++ if (!this.field_70170_p.field_72995_K && this.field_70292_b >= lifespan) { + int hook = net.minecraftforge.event.ForgeEventFactory.onItemExpire(this, item); -+ if (hook < 0) this.setDead(); ++ if (hook < 0) this.func_70106_y(); + else this.lifespan += hook; + } -+ if (item != null && item.stackSize <= 0) ++ if (item != null && item.field_77994_a <= 0) + { - this.setDead(); + this.func_70106_y(); } } @@ -271,6 +287,7 @@ - tagCompound.setShort("Health", (short)((byte)this.health)); - tagCompound.setShort("Age", (short)this.age); - tagCompound.setShort("PickupDelay", (short)this.delayBeforeCanPickup); -+ tagCompound.setInteger("Lifespan", lifespan); + p_70014_1_.func_74777_a("Health", (short)((byte)this.field_70291_e)); + p_70014_1_.func_74777_a("Age", (short)this.field_70292_b); + p_70014_1_.func_74777_a("PickupDelay", (short)this.field_145804_b); ++ p_70014_1_.func_74768_a("Lifespan", lifespan); - if (this.getThrower() != null) + if (this.func_145800_j() != null) { @@ -311,20 +328,23 @@ - NBTTagCompound nbttagcompound = tagCompund.getCompoundTag("Item"); - this.setEntityItemStack(ItemStack.loadItemStackFromNBT(nbttagcompound)); + NBTTagCompound nbttagcompound = p_70037_1_.func_74775_l("Item"); + this.func_92058_a(ItemStack.func_77949_a(nbttagcompound)); -- if (this.getEntityItem() == null) +- if (this.func_92059_d() == null) - { -- this.setDead(); +- this.func_70106_y(); - } -+ ItemStack item = getDataWatcher().getWatchableObjectItemStack(10); -+ if (item == null || item.stackSize <= 0) this.setDead(); -+ if (tagCompund.hasKey("Lifespan")) lifespan = tagCompund.getInteger("Lifespan"); ++ ItemStack item = func_70096_w().func_82710_f(10); ++ if (item == null || item.field_77994_a <= 0) this.func_70106_y(); ++ if (p_70037_1_.func_74764_b("Lifespan")) lifespan = p_70037_1_.func_74762_e("Lifespan"); } - public void onCollideWithPlayer(EntityPlayer entityIn) + public void func_70100_b_(EntityPlayer p_70100_1_) { - if (!this.worldObj.isRemote) + if (!this.field_70170_p.field_72995_K) { -+ if (this.delayBeforeCanPickup > 0) return; - ItemStack itemstack = this.getEntityItem(); - int i = itemstack.stackSize; ++ if (this.field_145804_b > 0) return; + ItemStack itemstack = this.func_92059_d(); + int i = itemstack.field_77994_a; -- if (this.delayBeforeCanPickup == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack)) -+ int hook = net.minecraftforge.event.ForgeEventFactory.onItemPickup(this, entityIn, itemstack); +- if (this.field_145804_b == 0 && (this.field_145802_g == null || 6000 - this.field_70292_b <= 200 || this.field_145802_g.equals(p_70100_1_.func_70005_c_())) && p_70100_1_.field_71071_by.func_70441_a(itemstack)) ++ int hook = net.minecraftforge.event.ForgeEventFactory.onItemPickup(this, p_70100_1_, itemstack); + if (hook < 0) return; + -+ if (this.delayBeforeCanPickup <= 0 && (this.owner == null || lifespan - this.age <= 200 || this.owner.equals(entityIn.getName())) && (hook == 1 || i <= 0 || entityIn.inventory.addItemStackToInventory(itemstack))) ++ 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_70005_c_())) && (hook == 1 || i <= 0 || p_70100_1_.field_71071_by.func_70441_a(itemstack))) { - if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log)) + if (itemstack.func_77973_b() == Item.func_150898_a(Blocks.field_150364_r)) { @@ -361,6 +381,7 @@ } } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerItemPickupEvent(entityIn, this); - if (!this.isSilent()) ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerItemPickupEvent(p_70100_1_, this); + if (!this.func_174814_R()) { - this.worldObj.playSoundAtEntity(entityIn, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + this.field_70170_p.func_72956_a(p_70100_1_, "random.pop", 0.2F, ((this.field_70146_Z.nextFloat() - this.field_70146_Z.nextFloat()) * 0.7F + 1.0F) * 2.0F); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch index 6a6f26cf8..dfb0cf0e5 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch @@ -4,8 +4,8 @@ { if (p_110131_1_ != null) { -- if (p_110131_1_.getItem() == Items.filled_map) -+ if (p_110131_1_.getItem() instanceof net.minecraft.item.ItemMap) +- if (p_110131_1_.func_77973_b() == Items.field_151098_aY) ++ if (p_110131_1_.func_77973_b() instanceof net.minecraft.item.ItemMap) { - MapData mapdata = ((ItemMap)p_110131_1_.getItem()).getMapData(p_110131_1_, this.worldObj); - mapdata.playersVisibleOnMap.remove("frame-" + this.getEntityId()); + MapData mapdata = ((ItemMap)p_110131_1_.func_77973_b()).func_77873_a(p_110131_1_, this.field_70170_p); + mapdata.field_76203_h.remove("frame-" + this.func_145782_y()); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch index 48be61e48..da822bd07 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch @@ -2,7 +2,7 @@ +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecart.java @@ -50,6 +50,20 @@ @SideOnly(Side.CLIENT) - private double velocityZ; + private double field_70506_as; + /* Forge: Minecart Compatibility Layer Integration. */ + public static float defaultMaxSpeedAirLateral = 0.4f; @@ -18,97 +18,97 @@ + protected float maxSpeedAirVertical = defaultMaxSpeedAirVertical; + protected double dragAir = defaultDragAir; + - public EntityMinecart(World worldIn) + public EntityMinecart(World p_i1712_1_) { - super(worldIn); + super(p_i1712_1_); @@ -95,17 +109,19 @@ - public AxisAlignedBB getCollisionBox(Entity entityIn) + public AxisAlignedBB func_70114_g(Entity p_70114_1_) { -+ if (getCollisionHandler() != null) return getCollisionHandler().getCollisionBox(this, entityIn); - return entityIn.canBePushed() ? entityIn.getEntityBoundingBox() : null; ++ if (getCollisionHandler() != null) return getCollisionHandler().getCollisionBox(this, p_70114_1_); + return p_70114_1_.func_70104_M() ? p_70114_1_.func_174813_aQ() : null; } - public AxisAlignedBB getBoundingBox() + public AxisAlignedBB func_70046_E() { + if (getCollisionHandler() != null) return getCollisionHandler().getBoundingBox(this); return null; } - public boolean canBePushed() + public boolean func_70104_M() { - return true; + return canBePushed; } - public EntityMinecart(World worldIn, double p_i1713_2_, double p_i1713_4_, double p_i1713_6_) + public EntityMinecart(World p_i1713_1_, double p_i1713_2_, double p_i1713_4_, double p_i1713_6_) @@ -309,7 +325,7 @@ BlockPos blockpos = new BlockPos(k, l, i1); - IBlockState iblockstate = this.worldObj.getBlockState(blockpos); + IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); -- if (BlockRailBase.isRailBlock(iblockstate)) -+ if (canUseRail() && BlockRailBase.isRailBlock(iblockstate)) +- if (BlockRailBase.func_176563_d(iblockstate)) ++ if (canUseRail() && BlockRailBase.func_176563_d(iblockstate)) { this.func_180460_a(blockpos, iblockstate); @@ -348,7 +364,10 @@ - this.setRotation(this.rotationYaw, this.rotationPitch); + this.func_70101_b(this.field_70177_z, this.field_70125_A); -- for (Entity entity : this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D))) +- for (Entity entity : this.field_70170_p.func_72839_b(this, this.func_174813_aQ().func_72314_b(0.20000000298023224D, 0.0D, 0.20000000298023224D))) + AxisAlignedBB box; + if (getCollisionHandler() != null) box = getCollisionHandler().getMinecartCollisionBox(this); -+ else box = this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D); -+ for (Entity entity : this.worldObj.getEntitiesWithinAABBExcludingEntity(this, box)) ++ else box = this.func_174813_aQ().func_72314_b(0.20000000298023224D, 0.0D, 0.20000000298023224D); ++ for (Entity entity : this.field_70170_p.func_72839_b(this, box)) { - if (entity != this.riddenByEntity && entity.canBePushed() && entity instanceof EntityMinecart) + if (entity != this.field_70153_n && entity.func_70104_M() && entity instanceof EntityMinecart) { @@ -367,6 +386,7 @@ } - this.handleWaterMovement(); + this.func_70072_I(); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartUpdateEvent(this, this.getCurrentRailPosition())); } } @@ -381,10 +401,21 @@ - protected void moveDerailedMinecart() + protected void func_180459_n() { - double d0 = this.func_174898_m(); -+ double d0 = onGround ? this.func_174898_m() : getMaxSpeedAirLateral(); - this.motionX = MathHelper.clamp_double(this.motionX, -d0, d0); - this.motionZ = MathHelper.clamp_double(this.motionZ, -d0, d0); ++ double d0 = field_70122_E ? this.func_174898_m() : getMaxSpeedAirLateral(); + this.field_70159_w = MathHelper.func_151237_a(this.field_70159_w, -d0, d0); + this.field_70179_y = MathHelper.func_151237_a(this.field_70179_y, -d0, d0); -+ double moveY = motionY; -+ if(getMaxSpeedAirVertical() > 0 && motionY > getMaxSpeedAirVertical()) ++ double moveY = field_70181_x; ++ if(getMaxSpeedAirVertical() > 0 && field_70181_x > getMaxSpeedAirVertical()) + { + moveY = getMaxSpeedAirVertical(); -+ if(Math.abs(motionX) < 0.3f && Math.abs(motionZ) < 0.3f) ++ if(Math.abs(field_70159_w) < 0.3f && Math.abs(field_70179_y) < 0.3f) + { + moveY = 0.15f; -+ motionY = moveY; ++ field_70181_x = moveY; + } + } + - if (this.onGround) + if (this.field_70122_E) { - this.motionX *= 0.5D; + this.field_70159_w *= 0.5D; @@ -392,13 +423,13 @@ - this.motionZ *= 0.5D; + this.field_70179_y *= 0.5D; } -- this.moveEntity(this.motionX, this.motionY, this.motionZ); -+ this.moveEntity(this.motionX, moveY, this.motionZ); +- this.func_70091_d(this.field_70159_w, this.field_70181_x, this.field_70179_y); ++ this.func_70091_d(this.field_70159_w, moveY, this.field_70179_y); - if (!this.onGround) + if (!this.field_70122_E) { -- this.motionX *= 0.949999988079071D; -- this.motionY *= 0.949999988079071D; -- this.motionZ *= 0.949999988079071D; -+ this.motionX *= getDragAir(); -+ this.motionY *= getDragAir(); -+ this.motionZ *= getDragAir(); +- this.field_70159_w *= 0.949999988079071D; +- this.field_70181_x *= 0.949999988079071D; +- this.field_70179_y *= 0.949999988079071D; ++ this.field_70159_w *= getDragAir(); ++ this.field_70181_x *= getDragAir(); ++ this.field_70179_y *= getDragAir(); } } @@ -118,29 +118,29 @@ - double d0 = 0.0078125D; + double slopeAdjustment = getSlopeAdjustment(); - BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)p_180460_2_.getValue(blockrailbase.getShapeProperty()); + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)p_180460_2_.func_177229_b(blockrailbase.func_176560_l()); switch (blockrailbase$enumraildirection) { case ASCENDING_EAST: -- this.motionX -= 0.0078125D; -+ this.motionX -= slopeAdjustment; - ++this.posY; +- this.field_70159_w -= 0.0078125D; ++ this.field_70159_w -= slopeAdjustment; + ++this.field_70163_u; break; case ASCENDING_WEST: -- this.motionX += 0.0078125D; -+ this.motionX += slopeAdjustment; - ++this.posY; +- this.field_70159_w += 0.0078125D; ++ this.field_70159_w += slopeAdjustment; + ++this.field_70163_u; break; case ASCENDING_NORTH: -- this.motionZ += 0.0078125D; -+ this.motionZ += slopeAdjustment; - ++this.posY; +- this.field_70179_y += 0.0078125D; ++ this.field_70179_y += slopeAdjustment; + ++this.field_70163_u; break; case ASCENDING_SOUTH: -- this.motionZ -= 0.0078125D; -+ this.motionZ -= slopeAdjustment; - ++this.posY; +- this.field_70179_y -= 0.0078125D; ++ this.field_70179_y -= slopeAdjustment; + ++this.field_70163_u; } @@ -481,7 +512,7 @@ @@ -150,86 +150,86 @@ - if (flag1) + if (flag1 && shouldDoRailFunctions()) { - double d17 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + double d17 = Math.sqrt(this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y); @@ -527,20 +558,8 @@ - this.posX = d19 + d1 * d18; - this.posZ = d20 + d2 * d18; - this.setPosition(this.posX, this.posY, this.posZ); -- double d22 = this.motionX; -- double d23 = this.motionZ; + this.field_70165_t = d19 + d1 * d18; + this.field_70161_v = d20 + d2 * d18; + this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v); +- double d22 = this.field_70159_w; +- double d23 = this.field_70179_y; + this.moveMinecartOnRail(p_180460_1_); -- if (this.riddenByEntity != null) +- if (this.field_70153_n != null) - { - d22 *= 0.75D; - d23 *= 0.75D; - } - - double d13 = this.func_174898_m(); -- d22 = MathHelper.clamp_double(d22, -d13, d13); -- d23 = MathHelper.clamp_double(d23, -d13, d13); -- this.moveEntity(d22, 0.0D, d23); +- d22 = MathHelper.func_151237_a(d22, -d13, d13); +- d23 = MathHelper.func_151237_a(d23, -d13, d13); +- this.func_70091_d(d22, 0.0D, d23); - - if (aint[0][1] != 0 && MathHelper.floor_double(this.posX) - p_180460_1_.getX() == aint[0][0] && MathHelper.floor_double(this.posZ) - p_180460_1_.getZ() == aint[0][2]) + if (aint[0][1] != 0 && MathHelper.func_76128_c(this.field_70165_t) - p_180460_1_.func_177958_n() == aint[0][0] && MathHelper.func_76128_c(this.field_70161_v) - p_180460_1_.func_177952_p() == aint[0][2]) { - this.setPosition(this.posX, this.posY + (double)aint[0][1], this.posZ); + this.func_70107_b(this.field_70165_t, this.field_70163_u + (double)aint[0][1], this.field_70161_v); @@ -577,8 +596,14 @@ - this.motionZ = d5 * (double)(i - p_180460_1_.getZ()); + this.field_70179_y = d5 * (double)(i - p_180460_1_.func_177952_p()); } - if (flag) + + if(shouldDoRailFunctions()) { -+ ((BlockRailBase)p_180460_2_.getBlock()).onMinecartPass(worldObj, this, p_180460_1_); ++ ((BlockRailBase)p_180460_2_.func_177230_c()).onMinecartPass(field_70170_p, this, p_180460_1_); + } + + if (flag && shouldDoRailFunctions()) + { - double d15 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + double d15 = Math.sqrt(this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y); if (d15 > 0.01D) @@ -817,13 +842,20 @@ - public void applyEntityCollision(Entity entityIn) + public void func_70108_f(Entity p_70108_1_) { + -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartCollisionEvent(this, entityIn)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartCollisionEvent(this, p_70108_1_)); + if (getCollisionHandler() != null) + { -+ getCollisionHandler().onEntityCollision(this, entityIn); ++ getCollisionHandler().onEntityCollision(this, p_70108_1_); + return; + } - if (!this.worldObj.isRemote) + if (!this.field_70170_p.field_72995_K) { - if (!entityIn.noClip && !this.noClip) + if (!p_70108_1_.field_70145_X && !this.field_70145_X) { - if (entityIn != this.riddenByEntity) + if (p_70108_1_ != this.field_70153_n) { -- if (entityIn instanceof EntityLivingBase && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && this.getMinecartType() == EntityMinecart.EnumMinecartType.RIDEABLE && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && entityIn.ridingEntity == null) -+ if (entityIn instanceof EntityLivingBase && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && canBeRidden() && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && entityIn.ridingEntity == null) +- if (p_70108_1_ instanceof EntityLivingBase && !(p_70108_1_ instanceof EntityPlayer) && !(p_70108_1_ instanceof EntityIronGolem) && this.func_180456_s() == EntityMinecart.EnumMinecartType.RIDEABLE && this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y > 0.01D && this.field_70153_n == null && p_70108_1_.field_70154_o == null) ++ if (p_70108_1_ instanceof EntityLivingBase && !(p_70108_1_ instanceof EntityPlayer) && !(p_70108_1_ instanceof EntityIronGolem) && canBeRidden() && this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y > 0.01D && this.field_70153_n == null && p_70108_1_.field_70154_o == null) { - entityIn.mountEntity(this); + p_70108_1_.func_70078_a(this); } @@ -869,7 +901,7 @@ - double d7 = entityIn.motionX + this.motionX; - double d8 = entityIn.motionZ + this.motionZ; + double d7 = p_70108_1_.field_70159_w + this.field_70159_w; + double d8 = p_70108_1_.field_70179_y + this.field_70179_y; -- if (((EntityMinecart)entityIn).getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE && this.getMinecartType() != EntityMinecart.EnumMinecartType.FURNACE) -+ if (((EntityMinecart)entityIn).isPoweredCart() && !isPoweredCart()) +- if (((EntityMinecart)p_70108_1_).func_180456_s() == EntityMinecart.EnumMinecartType.FURNACE && this.func_180456_s() != EntityMinecart.EnumMinecartType.FURNACE) ++ if (((EntityMinecart)p_70108_1_).isPoweredCart() && !isPoweredCart()) { - this.motionX *= 0.20000000298023224D; - this.motionZ *= 0.20000000298023224D; + this.field_70159_w *= 0.20000000298023224D; + this.field_70179_y *= 0.20000000298023224D; @@ -877,7 +909,7 @@ - entityIn.motionX *= 0.949999988079071D; - entityIn.motionZ *= 0.949999988079071D; + p_70108_1_.field_70159_w *= 0.949999988079071D; + p_70108_1_.field_70179_y *= 0.949999988079071D; } -- else if (((EntityMinecart)entityIn).getMinecartType() != EntityMinecart.EnumMinecartType.FURNACE && this.getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE) -+ else if (((EntityMinecart)entityIn).isPoweredCart() && isPoweredCart()) +- else if (((EntityMinecart)p_70108_1_).func_180456_s() != EntityMinecart.EnumMinecartType.FURNACE && this.func_180456_s() == EntityMinecart.EnumMinecartType.FURNACE) ++ else if (((EntityMinecart)p_70108_1_).isPoweredCart() && isPoweredCart()) { - entityIn.motionX *= 0.20000000298023224D; - entityIn.motionZ *= 0.20000000298023224D; + p_70108_1_.field_70159_w *= 0.20000000298023224D; + p_70108_1_.field_70179_y *= 0.20000000298023224D; @@ -1042,6 +1074,221 @@ } } @@ -237,11 +237,11 @@ + /* =================================== FORGE START ===========================================*/ + private BlockPos getCurrentRailPosition() + { -+ int x = MathHelper.floor_double(this.posX); -+ int y = MathHelper.floor_double(this.posY); -+ int z = MathHelper.floor_double(this.posZ); ++ int x = MathHelper.func_76128_c(this.field_70165_t); ++ int y = MathHelper.func_76128_c(this.field_70163_u); ++ int z = MathHelper.func_76128_c(this.field_70161_v); + -+ if (BlockRailBase.isRailBlock(this.worldObj, new BlockPos(x, y - 1, z))) y--; ++ if (BlockRailBase.func_176562_d(this.field_70170_p, new BlockPos(x, y - 1, z))) y--; + return new BlockPos(x, y, z); + } + @@ -249,10 +249,10 @@ + { + if (!canUseRail()) return func_174898_m(); + BlockPos pos = this.getCurrentRailPosition(); -+ IBlockState state = this.worldObj.getBlockState(pos); -+ if (!BlockRailBase.isRailBlock(state)) return func_174898_m(); ++ IBlockState state = this.field_70170_p.func_180495_p(pos); ++ if (!BlockRailBase.func_176563_d(state)) return func_174898_m(); + -+ float railMaxSpeed = ((BlockRailBase)state.getBlock()).getRailMaxSpeed(worldObj, this, pos); ++ float railMaxSpeed = ((BlockRailBase)state.func_177230_c()).getRailMaxSpeed(field_70170_p, this, pos); + return Math.min(railMaxSpeed, getCurrentCartSpeedCapOnRail()); + } + @@ -262,19 +262,19 @@ + */ + public void moveMinecartOnRail(BlockPos pos) + { -+ double mX = this.motionX; -+ double mZ = this.motionZ; ++ double mX = this.field_70159_w; ++ double mZ = this.field_70179_y; + -+ if (this.riddenByEntity != null) ++ if (this.field_70153_n != null) + { + mX *= 0.75D; + mZ *= 0.75D; + } + + double max = this.getMaxSpeed(); -+ mX = MathHelper.clamp_double(mX, -max, max); -+ mZ = MathHelper.clamp_double(mZ, -max, max); -+ this.moveEntity(mX, 0.0D, mZ); ++ mX = MathHelper.func_151237_a(mX, -max, max); ++ mZ = MathHelper.func_151237_a(mZ, -max, max); ++ this.func_70091_d(mX, 0.0D, mZ); + } + + /** @@ -307,25 +307,25 @@ + { + if (this instanceof EntityMinecartFurnace) + { -+ return new ItemStack(Items.furnace_minecart); ++ return new ItemStack(Items.field_151109_aJ); + } + else if (this instanceof EntityMinecartChest) + { -+ return new ItemStack(Items.chest_minecart); ++ return new ItemStack(Items.field_151108_aI); + } + else if (this instanceof EntityMinecartTNT) + { -+ return new ItemStack(Items.tnt_minecart); ++ return new ItemStack(Items.field_151142_bV); + } + else if (this instanceof EntityMinecartHopper) + { -+ return new ItemStack(Items.hopper_minecart); ++ return new ItemStack(Items.field_151140_bW); + } + else if (this instanceof EntityMinecartCommandBlock) + { -+ return new ItemStack(Items.command_block_minecart); ++ return new ItemStack(Items.field_151095_cc); + } -+ return new ItemStack(Items.minecart); ++ return new ItemStack(Items.field_151143_au); + } + + /** @@ -363,7 +363,7 @@ + */ + public boolean isPoweredCart() + { -+ return getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE; ++ return func_180456_s() == EntityMinecart.EnumMinecartType.FURNACE; + } + + /** @@ -372,7 +372,7 @@ + */ + public boolean canBeRidden() + { -+ return this.getMinecartType() == EntityMinecart.EnumMinecartType.RIDEABLE; ++ return this.func_180456_s() == EntityMinecart.EnumMinecartType.RIDEABLE; + } + + /** diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch index fcac570fb..e9ce1fedd 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java @@ -180,6 +180,7 @@ - public boolean interactFirst(EntityPlayer playerIn) + public boolean func_130002_c(EntityPlayer p_130002_1_) { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; - if (!this.worldObj.isRemote) ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_130002_1_))) return true; + if (!this.field_70170_p.field_72995_K) { - playerIn.displayGUIChest(this); + p_130002_1_.func_71007_a(this); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch index e262844ee..807d5622e 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java @@ -18,6 +18,7 @@ - public boolean interactFirst(EntityPlayer playerIn) + public boolean func_130002_c(EntityPlayer p_130002_1_) { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; - if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn) ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_130002_1_))) return true; + if (this.field_70153_n != null && this.field_70153_n instanceof EntityPlayer && this.field_70153_n != p_130002_1_) { return true; diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch index 6c351329f..a051aba6b 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java @@ -131,6 +131,7 @@ - public boolean interactFirst(EntityPlayer playerIn) + public boolean func_130002_c(EntityPlayer p_130002_1_) { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; - ItemStack itemstack = playerIn.inventory.getCurrentItem(); ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_130002_1_))) return true; + ItemStack itemstack = p_130002_1_.field_71071_by.func_70448_g(); - if (itemstack != null && itemstack.getItem() == Items.coal) + if (itemstack != null && itemstack.func_77973_b() == Items.field_151044_h) diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch index 79d7a4a27..7fc5668b9 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java @@ -54,6 +54,7 @@ - public boolean interactFirst(EntityPlayer playerIn) + public boolean func_130002_c(EntityPlayer p_130002_1_) { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; - if (!this.worldObj.isRemote) ++ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, p_130002_1_))) return true; + if (!this.field_70170_p.field_72995_K) { - playerIn.displayGUIChest(this); + p_130002_1_.func_71007_a(this); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch index c10781a8d..f0c991f61 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/entity/item/EntityXPOrb.java @@ -199,6 +199,7 @@ { - if (this.field_70532_c == 0 && entityIn.xpCooldown == 0) + if (this.field_70532_c == 0 && p_70100_1_.field_71090_bL == 0) { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerPickupXpEvent(entityIn, this))) return; - entityIn.xpCooldown = 2; - this.worldObj.playSoundAtEntity(entityIn, "random.orb", 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F)); - entityIn.onItemPickup(this, 1); ++ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerPickupXpEvent(p_70100_1_, this))) return; + p_70100_1_.field_71090_bL = 2; + this.field_70170_p.func_72956_a(p_70100_1_, "random.orb", 0.1F, 0.5F * ((this.field_70146_Z.nextFloat() - this.field_70146_Z.nextFloat()) * 0.7F + 1.8F)); + p_70100_1_.func_71001_a(this, 1); diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch index 8946e7b58..3f5db488a 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch @@ -2,21 +2,21 @@ +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityEnderman.java @@ -198,12 +198,14 @@ - protected boolean teleportTo(double p_70825_1_, double p_70825_3_, double p_70825_5_) + protected boolean func_70825_j(double p_70825_1_, double p_70825_3_, double p_70825_5_) { + net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, p_70825_1_, p_70825_3_, p_70825_5_, 0); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false; - double d0 = this.posX; - double d1 = this.posY; - double d2 = this.posZ; -- this.posX = p_70825_1_; -- this.posY = p_70825_3_; -- this.posZ = p_70825_5_; -+ this.posX = event.targetX; -+ this.posY = event.targetY; -+ this.posZ = event.targetZ; + double d0 = this.field_70165_t; + double d1 = this.field_70163_u; + double d2 = this.field_70161_v; +- this.field_70165_t = p_70825_1_; +- this.field_70163_u = p_70825_3_; +- this.field_70161_v = p_70825_5_; ++ this.field_70165_t = event.targetX; ++ this.field_70163_u = event.targetY; ++ this.field_70161_v = event.targetZ; boolean flag = false; - BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ); + BlockPos blockpos = new BlockPos(this.field_70165_t, this.field_70163_u, this.field_70161_v); @@ -364,6 +366,18 @@ } @@ -25,15 +25,15 @@ + /*===================================== Forge Start ==============================*/ + public static void setCarriable(Block block, boolean canCarry) + { -+ if (canCarry) carriableBlocks.add(block); -+ else carriableBlocks.remove(block); ++ if (canCarry) field_70827_d.add(block); ++ else field_70827_d.remove(block); + } + public static boolean getCarriable(Block block) + { -+ return carriableBlocks.contains(block); ++ return field_70827_d.contains(block); + } + /*===================================== Forge End ==============================*/ + - public boolean isScreaming() + public boolean func_70823_r() { - return this.dataWatcher.getWatchableObjectByte(18) > 0; + return this.field_70180_af.func_75683_a(18) > 0; diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch index 87582d358..72690ba3f 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch @@ -2,8 +2,8 @@ +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java @@ -103,6 +103,7 @@ { - this.motionY = (double)(0.42F + (float)this.getSlimeSize() * 0.1F); - this.isAirBorne = true; + this.field_70181_x = (double)(0.42F + (float)this.func_70809_q() * 0.1F); + this.field_70160_al = true; + net.minecraftforge.common.ForgeHooks.onLivingJump(this); } diff --git a/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch index bb6fe2bf7..351ba4598 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntitySlime.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySlime.java @@ -271,7 +271,7 @@ - BlockPos blockpos = new BlockPos(MathHelper.floor_double(this.posX), 0, MathHelper.floor_double(this.posZ)); - Chunk chunk = this.worldObj.getChunkFromBlockCoords(blockpos); + BlockPos blockpos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), 0, MathHelper.func_76128_c(this.field_70161_v)); + Chunk chunk = this.field_70170_p.func_175726_f(blockpos); -- if (this.worldObj.getWorldInfo().getTerrainType() == WorldType.FLAT && this.rand.nextInt(4) != 1) -+ if (this.worldObj.getWorldInfo().getTerrainType().handleSlimeSpawnReduction(rand, worldObj)) +- if (this.field_70170_p.func_72912_H().func_76067_t() == WorldType.field_77138_c && this.field_70146_Z.nextInt(4) != 1) ++ if (this.field_70170_p.func_72912_H().func_76067_t().handleSlimeSpawnReduction(field_70146_Z, field_70170_p)) { return false; } diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch index 085d75e65..5e5a32c79 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch @@ -1,33 +1,33 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntityZombie.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityZombie.java @@ -87,7 +87,7 @@ - this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(35.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); -- this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * 0.10000000149011612D); -+ this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * net.minecraftforge.common.ForgeModContainer.zombieSummonBaseChance); + this.func_110148_a(SharedMonsterAttributes.field_111265_b).func_111128_a(35.0D); + this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a(0.23000000417232513D); + this.func_110148_a(SharedMonsterAttributes.field_111264_e).func_111128_a(3.0D); +- this.func_110140_aT().func_111150_b(field_110186_bp).func_111128_a(this.field_70146_Z.nextDouble() * 0.10000000149011612D); ++ this.func_110140_aT().func_111150_b(field_110186_bp).func_111128_a(this.field_70146_Z.nextDouble() * net.minecraftforge.common.ForgeModContainer.zombieSummonBaseChance); } - protected void entityInit() + protected void func_70088_a() @@ -229,12 +229,25 @@ - entitylivingbase = (EntityLivingBase)source.getEntity(); + entitylivingbase = (EntityLivingBase)p_70097_1_.func_76346_g(); } -- if (entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue()) -+ int i = MathHelper.floor_double(this.posX); -+ int j = MathHelper.floor_double(this.posY); -+ int k = MathHelper.floor_double(this.posZ); +- if (entitylivingbase != null && this.field_70170_p.func_175659_aa() == EnumDifficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(field_110186_bp).func_111126_e()) ++ int i = MathHelper.func_76128_c(this.field_70165_t); ++ int j = MathHelper.func_76128_c(this.field_70163_u); ++ int k = MathHelper.func_76128_c(this.field_70161_v); + -+ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent summonAid = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, worldObj, i, j, k, entitylivingbase, this.getEntityAttribute(reinforcementChance).getAttributeValue()); ++ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent summonAid = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, field_70170_p, i, j, k, entitylivingbase, this.func_110148_a(field_110186_bp).func_111126_e()); + if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return true; + + if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || -+ entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue()) ++ entitylivingbase != null && this.field_70170_p.func_175659_aa() == EnumDifficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(field_110186_bp).func_111126_e()) { -- int i = MathHelper.floor_double(this.posX); -- int j = MathHelper.floor_double(this.posY); -- int k = MathHelper.floor_double(this.posZ); -- EntityZombie entityzombie = new EntityZombie(this.worldObj); +- int i = MathHelper.func_76128_c(this.field_70165_t); +- int j = MathHelper.func_76128_c(this.field_70163_u); +- int k = MathHelper.func_76128_c(this.field_70161_v); +- EntityZombie entityzombie = new EntityZombie(this.field_70170_p); + EntityZombie entityzombie; + if (summonAid.customSummonedAid != null && summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW) + { @@ -35,26 +35,26 @@ + } + else + { -+ entityzombie = new EntityZombie(this.worldObj); ++ entityzombie = new EntityZombie(this.field_70170_p); + } for (int l = 0; l < 50; ++l) { @@ -249,7 +262,7 @@ - if (!this.worldObj.func_175636_b((double)i1, (double)j1, (double)k1, 7.0D) && this.worldObj.checkNoEntityCollision(entityzombie.getEntityBoundingBox(), entityzombie) && this.worldObj.getCollidingBoundingBoxes(entityzombie, entityzombie.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(entityzombie.getEntityBoundingBox())) + if (!this.field_70170_p.func_175636_b((double)i1, (double)j1, (double)k1, 7.0D) && this.field_70170_p.func_72917_a(entityzombie.func_174813_aQ(), entityzombie) && this.field_70170_p.func_72945_a(entityzombie, entityzombie.func_174813_aQ()).isEmpty() && !this.field_70170_p.func_72953_d(entityzombie.func_174813_aQ())) { - this.worldObj.spawnEntityInWorld(entityzombie); -- entityzombie.setAttackTarget(entitylivingbase); -+ if (entitylivingbase != null) entityzombie.setAttackTarget(entitylivingbase); - entityzombie.func_180482_a(this.worldObj.getDifficultyForLocation(new BlockPos(entityzombie)), (IEntityLivingData)null); - this.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0)); - entityzombie.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0)); + this.field_70170_p.func_72838_d(entityzombie); +- entityzombie.func_70624_b(entitylivingbase); ++ if (entitylivingbase != null) entityzombie.func_70624_b(entitylivingbase); + entityzombie.func_180482_a(this.field_70170_p.func_175649_E(new BlockPos(entityzombie)), (IEntityLivingData)null); + this.func_110148_a(field_110186_bp).func_111121_a(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0)); + entityzombie.func_110148_a(field_110186_bp).func_111121_a(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0)); @@ -465,7 +478,7 @@ if (p_180482_2_ == null) { -- p_180482_2_ = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < 0.05F, this.worldObj.rand.nextFloat() < 0.05F); -+ p_180482_2_ = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < net.minecraftforge.common.ForgeModContainer.zombieBabyChance, this.worldObj.rand.nextFloat() < 0.05F); +- p_180482_2_ = new EntityZombie.GroupData(this.field_70170_p.field_73012_v.nextFloat() < 0.05F, this.field_70170_p.field_73012_v.nextFloat() < 0.05F); ++ p_180482_2_ = new EntityZombie.GroupData(this.field_70170_p.field_73012_v.nextFloat() < net.minecraftforge.common.ForgeModContainer.zombieBabyChance, this.field_70170_p.field_73012_v.nextFloat() < 0.05F); } if (p_180482_2_ instanceof EntityZombie.GroupData) diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch index 172f84a75..988e8b587 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch @@ -3,8 +3,8 @@ @@ -1247,6 +1247,7 @@ } - this.jumpPower = 0.0F; + this.field_110277_bt = 0.0F; + net.minecraftforge.common.ForgeHooks.onLivingJump(this); } - this.stepHeight = 1.0F; + this.field_70138_W = 1.0F; diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch index 17b3f0256..e996a2886 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch @@ -7,56 +7,56 @@ -public class EntityMooshroom extends EntityCow +public class EntityMooshroom extends EntityCow implements net.minecraftforge.common.IShearable { - public EntityMooshroom(World worldIn) + public EntityMooshroom(World p_i1687_1_) { @@ -18,6 +18,7 @@ - this.field_175506_bl = Blocks.mycelium; + this.field_175506_bl = Blocks.field_150391_bh; } + @SuppressWarnings("unused") - public boolean interact(EntityPlayer player) + public boolean func_70085_c(EntityPlayer p_70085_1_) { - ItemStack itemstack = player.inventory.getCurrentItem(); + ItemStack itemstack = p_70085_1_.field_71071_by.func_70448_g(); @@ -37,7 +38,7 @@ } } -- if (itemstack != null && itemstack.getItem() == Items.shears && this.getGrowingAge() >= 0) -+ if (false && itemstack != null && itemstack.getItem() == Items.shears && this.getGrowingAge() >= 0) //Forge Disable, Moved to onSheared +- if (itemstack != null && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_70874_b() >= 0) ++ if (false && itemstack != null && itemstack.func_77973_b() == Items.field_151097_aZ && this.func_70874_b() >= 0) //Forge Disable, Moved to onSheared { - this.setDead(); - this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); + this.func_70106_y(); + this.field_70170_p.func_175688_a(EnumParticleTypes.EXPLOSION_LARGE, this.field_70165_t, this.field_70163_u + (double)(this.field_70131_O / 2.0F), this.field_70161_v, 0.0D, 0.0D, 0.0D, new int[0]); @@ -77,4 +78,33 @@ { - return new EntityMooshroom(this.worldObj); + return new EntityMooshroom(this.field_70170_p); } + -+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos){ return getGrowingAge() >= 0; } ++ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos){ return func_70874_b() >= 0; } + @Override + public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos, int fortune) + { -+ this.setDead(); -+ this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); ++ this.func_70106_y(); ++ this.field_70170_p.func_175688_a(EnumParticleTypes.EXPLOSION_LARGE, this.field_70165_t, this.field_70163_u + (double)(this.field_70131_O / 2.0F), this.field_70161_v, 0.0D, 0.0D, 0.0D, new int[0]); + -+ EntityCow entitycow = new EntityCow(this.worldObj); -+ entitycow.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); -+ entitycow.setHealth(this.getHealth()); -+ entitycow.renderYawOffset = this.renderYawOffset; ++ EntityCow entitycow = new EntityCow(this.field_70170_p); ++ entitycow.func_70012_b(this.field_70165_t, this.field_70163_u, this.field_70161_v, this.field_70177_z, this.field_70125_A); ++ entitycow.func_70606_j(this.func_110143_aJ()); ++ entitycow.field_70761_aq = this.field_70761_aq; + -+ if (this.hasCustomName()) ++ if (this.func_145818_k_()) + { -+ entitycow.setCustomNameTag(this.getCustomNameTag()); ++ entitycow.func_96094_a(this.func_95999_t()); + } + -+ this.worldObj.spawnEntityInWorld(entitycow); ++ this.field_70170_p.func_72838_d(entitycow); + + java.util.List ret = new java.util.ArrayList(); + for (int i = 0; i < 5; ++i) + { -+ ret.add(new ItemStack(Blocks.red_mushroom)); ++ ret.add(new ItemStack(Blocks.field_150337_Q)); + } + -+ this.playSound("mob.sheep.shear", 1.0F, 1.0F); ++ this.func_85030_a("mob.sheep.shear", 1.0F, 1.0F); + return ret; + } } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch index 247ecdbad..ec6eaae58 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch @@ -2,10 +2,10 @@ +++ ../src-work/minecraft/net/minecraft/entity/passive/EntityOcelot.java @@ -279,7 +279,7 @@ - Block block = this.worldObj.getBlockState(blockpos.down()).getBlock(); + Block block = this.field_70170_p.func_180495_p(blockpos.func_177977_b()).func_177230_c(); -- if (block == Blocks.grass || block.getMaterial() == Material.leaves) -+ if (block == Blocks.grass || block.isLeaves(worldObj, blockpos.down())) +- if (block == Blocks.field_150349_c || block.func_149688_o() == Material.field_151584_j) ++ if (block == Blocks.field_150349_c || block.isLeaves(field_70170_p, blockpos.func_177977_b())) { return true; } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch index 5252358ed..7d9799ce8 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch @@ -7,39 +7,39 @@ -public class EntitySheep extends EntityAnimal +public class EntitySheep extends EntityAnimal implements net.minecraftforge.common.IShearable { - private final InventoryCrafting inventoryCrafting = new InventoryCrafting(new Container() + private final InventoryCrafting field_90016_e = new InventoryCrafting(new Container() { @@ -140,11 +140,12 @@ } } + @SuppressWarnings("unused") - public boolean interact(EntityPlayer player) + public boolean func_70085_c(EntityPlayer p_70085_1_) { - ItemStack itemstack = player.inventory.getCurrentItem(); + ItemStack itemstack = p_70085_1_.field_71071_by.func_70448_g(); -- if (itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared() && !this.isChild()) -+ if (false && itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared() && !this.isChild()) //Forge: Moved to onSheared +- if (itemstack != null && itemstack.func_77973_b() == Items.field_151097_aZ && !this.func_70892_o() && !this.func_70631_g_()) ++ if (false && itemstack != null && itemstack.func_77973_b() == Items.field_151097_aZ && !this.func_70892_o() && !this.func_70631_g_()) //Forge: Moved to onSheared { - if (!this.worldObj.isRemote) + if (!this.field_70170_p.field_72995_K) { @@ -327,4 +328,19 @@ field_175514_bm.put(EnumDyeColor.RED, new float[] {0.6F, 0.2F, 0.2F}); field_175514_bm.put(EnumDyeColor.BLACK, new float[] {0.1F, 0.1F, 0.1F}); } + -+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return !this.getSheared() && !this.isChild(); } ++ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return !this.func_70892_o() && !this.func_70631_g_(); } + @Override + public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + { -+ this.setSheared(true); -+ int i = 1 + this.rand.nextInt(3); ++ this.func_70893_e(true); ++ int i = 1 + this.field_70146_Z.nextInt(3); + + java.util.List ret = new java.util.ArrayList(); + for (int j = 0; j < i; ++j) -+ ret.add(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, this.getFleeceColor().getMetadata())); ++ ret.add(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, this.func_175509_cj().func_176765_a())); + -+ this.playSound("mob.sheep.shear", 1.0F, 1.0F); ++ this.func_85030_a("mob.sheep.shear", 1.0F, 1.0F); + return ret; + } } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch index 980be12b6..9648a8f59 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch @@ -1,30 +1,30 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntityVillager.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntityVillager.java @@ -81,6 +81,7 @@ - private boolean isLookingForHome; + private boolean field_82190_bM; private boolean field_175564_by; - private InventoryBasic villagerInventory; + private InventoryBasic field_175560_bz; + @Deprecated //Use VillagerRegistry - private static final EntityVillager.ITradeList[][][][] DEFAULT_TRADE_LIST_MAP = new EntityVillager.ITradeList[][][][] {{{{new EntityVillager.EmeraldForItems(Items.wheat, new EntityVillager.PriceInfo(18, 22)), new EntityVillager.EmeraldForItems(Items.potato, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.EmeraldForItems(Items.carrot, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.ListItemForEmeralds(Items.bread, new EntityVillager.PriceInfo(-4, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.pumpkin), new EntityVillager.PriceInfo(8, 13)), new EntityVillager.ListItemForEmeralds(Items.pumpkin_pie, new EntityVillager.PriceInfo(-3, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.melon_block), new EntityVillager.PriceInfo(7, 12)), new EntityVillager.ListItemForEmeralds(Items.apple, new EntityVillager.PriceInfo(-5, -7))}, {new EntityVillager.ListItemForEmeralds(Items.cookie, new EntityVillager.PriceInfo(-6, -10)), new EntityVillager.ListItemForEmeralds(Items.cake, new EntityVillager.PriceInfo(1, 1))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ItemAndEmeraldToItem(Items.fish, new EntityVillager.PriceInfo(6, 6), Items.cooked_fish, new EntityVillager.PriceInfo(6, 6))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.fishing_rod, new EntityVillager.PriceInfo(7, 8))}}, {{new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.wool), new EntityVillager.PriceInfo(16, 22)), new EntityVillager.ListItemForEmeralds(Items.shears, new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 0), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 1), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 2), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 3), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 4), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 5), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 6), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 7), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 8), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 9), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 10), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 11), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 12), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 13), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 14), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 15), new EntityVillager.PriceInfo(1, 2))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.ListItemForEmeralds(Items.arrow, new EntityVillager.PriceInfo(-12, -8))}, {new EntityVillager.ListItemForEmeralds(Items.bow, new EntityVillager.PriceInfo(2, 3)), new EntityVillager.ItemAndEmeraldToItem(Item.getItemFromBlock(Blocks.gravel), new EntityVillager.PriceInfo(10, 10), Items.flint, new EntityVillager.PriceInfo(6, 10))}}}, {{{new EntityVillager.EmeraldForItems(Items.paper, new EntityVillager.PriceInfo(24, 36)), new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.EmeraldForItems(Items.book, new EntityVillager.PriceInfo(8, 10)), new EntityVillager.ListItemForEmeralds(Items.compass, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.bookshelf), new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.EmeraldForItems(Items.written_book, new EntityVillager.PriceInfo(2, 2)), new EntityVillager.ListItemForEmeralds(Items.clock, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glass), new EntityVillager.PriceInfo(-5, -3))}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListItemForEmeralds(Items.name_tag, new EntityVillager.PriceInfo(20, 22))}}}, {{{new EntityVillager.EmeraldForItems(Items.rotten_flesh, new EntityVillager.PriceInfo(36, 40)), new EntityVillager.EmeraldForItems(Items.gold_ingot, new EntityVillager.PriceInfo(8, 10))}, {new EntityVillager.ListItemForEmeralds(Items.redstone, new EntityVillager.PriceInfo(-4, -1)), new EntityVillager.ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new EntityVillager.PriceInfo(-2, -1))}, {new EntityVillager.ListItemForEmeralds(Items.ender_eye, new EntityVillager.PriceInfo(7, 11)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glowstone), new EntityVillager.PriceInfo(-3, -1))}, {new EntityVillager.ListItemForEmeralds(Items.experience_bottle, new EntityVillager.PriceInfo(3, 11))}}}, {{{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_helmet, new EntityVillager.PriceInfo(4, 6))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListItemForEmeralds(Items.iron_chestplate, new EntityVillager.PriceInfo(10, 14))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_chestplate, new EntityVillager.PriceInfo(16, 19))}, {new EntityVillager.ListItemForEmeralds(Items.chainmail_boots, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_leggings, new EntityVillager.PriceInfo(9, 11)), new EntityVillager.ListItemForEmeralds(Items.chainmail_helmet, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_chestplate, new EntityVillager.PriceInfo(11, 15))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_axe, new EntityVillager.PriceInfo(6, 8))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_sword, new EntityVillager.PriceInfo(9, 10))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_sword, new EntityVillager.PriceInfo(12, 15)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_axe, new EntityVillager.PriceInfo(9, 12))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_shovel, new EntityVillager.PriceInfo(5, 7))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_pickaxe, new EntityVillager.PriceInfo(9, 11))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_pickaxe, new EntityVillager.PriceInfo(12, 15))}}}, {{{new EntityVillager.EmeraldForItems(Items.porkchop, new EntityVillager.PriceInfo(14, 18)), new EntityVillager.EmeraldForItems(Items.chicken, new EntityVillager.PriceInfo(14, 18))}, {new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.cooked_porkchop, new EntityVillager.PriceInfo(-7, -5)), new EntityVillager.ListItemForEmeralds(Items.cooked_chicken, new EntityVillager.PriceInfo(-8, -6))}}, {{new EntityVillager.EmeraldForItems(Items.leather, new EntityVillager.PriceInfo(9, 12)), new EntityVillager.ListItemForEmeralds(Items.leather_leggings, new EntityVillager.PriceInfo(2, 4))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.leather_chestplate, new EntityVillager.PriceInfo(7, 12))}, {new EntityVillager.ListItemForEmeralds(Items.saddle, new EntityVillager.PriceInfo(8, 10))}}}}; + private static final EntityVillager.ITradeList[][][][] field_175561_bA = new EntityVillager.ITradeList[][][][] {{{{new EntityVillager.EmeraldForItems(Items.field_151015_O, new EntityVillager.PriceInfo(18, 22)), new EntityVillager.EmeraldForItems(Items.field_151174_bG, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.EmeraldForItems(Items.field_151172_bF, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.ListItemForEmeralds(Items.field_151025_P, new EntityVillager.PriceInfo(-4, -2))}, {new EntityVillager.EmeraldForItems(Item.func_150898_a(Blocks.field_150423_aK), new EntityVillager.PriceInfo(8, 13)), new EntityVillager.ListItemForEmeralds(Items.field_151158_bO, new EntityVillager.PriceInfo(-3, -2))}, {new EntityVillager.EmeraldForItems(Item.func_150898_a(Blocks.field_150440_ba), new EntityVillager.PriceInfo(7, 12)), new EntityVillager.ListItemForEmeralds(Items.field_151034_e, new EntityVillager.PriceInfo(-5, -7))}, {new EntityVillager.ListItemForEmeralds(Items.field_151106_aX, new EntityVillager.PriceInfo(-6, -10)), new EntityVillager.ListItemForEmeralds(Items.field_151105_aU, new EntityVillager.PriceInfo(1, 1))}}, {{new EntityVillager.EmeraldForItems(Items.field_151007_F, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ItemAndEmeraldToItem(Items.field_151115_aP, new EntityVillager.PriceInfo(6, 6), Items.field_179566_aV, new EntityVillager.PriceInfo(6, 6))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151112_aM, new EntityVillager.PriceInfo(7, 8))}}, {{new EntityVillager.EmeraldForItems(Item.func_150898_a(Blocks.field_150325_L), new EntityVillager.PriceInfo(16, 22)), new EntityVillager.ListItemForEmeralds(Items.field_151097_aZ, new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 0), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 1), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 2), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 3), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 4), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 5), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 6), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 7), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 8), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 9), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 10), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 11), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 12), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 13), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 14), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.func_150898_a(Blocks.field_150325_L), 1, 15), new EntityVillager.PriceInfo(1, 2))}}, {{new EntityVillager.EmeraldForItems(Items.field_151007_F, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.ListItemForEmeralds(Items.field_151032_g, new EntityVillager.PriceInfo(-12, -8))}, {new EntityVillager.ListItemForEmeralds(Items.field_151031_f, new EntityVillager.PriceInfo(2, 3)), new EntityVillager.ItemAndEmeraldToItem(Item.func_150898_a(Blocks.field_150351_n), new EntityVillager.PriceInfo(10, 10), Items.field_151145_ak, new EntityVillager.PriceInfo(6, 10))}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151121_aF, new EntityVillager.PriceInfo(24, 36)), new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.EmeraldForItems(Items.field_151122_aG, new EntityVillager.PriceInfo(8, 10)), new EntityVillager.ListItemForEmeralds(Items.field_151111_aL, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.func_150898_a(Blocks.field_150342_X), new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.EmeraldForItems(Items.field_151164_bB, new EntityVillager.PriceInfo(2, 2)), new EntityVillager.ListItemForEmeralds(Items.field_151113_aN, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.func_150898_a(Blocks.field_150359_w), new EntityVillager.PriceInfo(-5, -3))}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListItemForEmeralds(Items.field_151057_cb, new EntityVillager.PriceInfo(20, 22))}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151078_bh, new EntityVillager.PriceInfo(36, 40)), new EntityVillager.EmeraldForItems(Items.field_151043_k, new EntityVillager.PriceInfo(8, 10))}, {new EntityVillager.ListItemForEmeralds(Items.field_151137_ax, new EntityVillager.PriceInfo(-4, -1)), new EntityVillager.ListItemForEmeralds(new ItemStack(Items.field_151100_aR, 1, EnumDyeColor.BLUE.func_176767_b()), new EntityVillager.PriceInfo(-2, -1))}, {new EntityVillager.ListItemForEmeralds(Items.field_151061_bv, new EntityVillager.PriceInfo(7, 11)), new EntityVillager.ListItemForEmeralds(Item.func_150898_a(Blocks.field_150426_aN), new EntityVillager.PriceInfo(-3, -1))}, {new EntityVillager.ListItemForEmeralds(Items.field_151062_by, new EntityVillager.PriceInfo(3, 11))}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.field_151028_Y, new EntityVillager.PriceInfo(4, 6))}, {new EntityVillager.EmeraldForItems(Items.field_151042_j, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListItemForEmeralds(Items.field_151030_Z, new EntityVillager.PriceInfo(10, 14))}, {new EntityVillager.EmeraldForItems(Items.field_151045_i, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151163_ad, new EntityVillager.PriceInfo(16, 19))}, {new EntityVillager.ListItemForEmeralds(Items.field_151029_X, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.field_151022_W, new EntityVillager.PriceInfo(9, 11)), new EntityVillager.ListItemForEmeralds(Items.field_151020_U, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.field_151023_V, new EntityVillager.PriceInfo(11, 15))}}, {{new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.field_151036_c, new EntityVillager.PriceInfo(6, 8))}, {new EntityVillager.EmeraldForItems(Items.field_151042_j, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151040_l, new EntityVillager.PriceInfo(9, 10))}, {new EntityVillager.EmeraldForItems(Items.field_151045_i, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151048_u, new EntityVillager.PriceInfo(12, 15)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151056_x, new EntityVillager.PriceInfo(9, 12))}}, {{new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151037_a, new EntityVillager.PriceInfo(5, 7))}, {new EntityVillager.EmeraldForItems(Items.field_151042_j, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151035_b, new EntityVillager.PriceInfo(9, 11))}, {new EntityVillager.EmeraldForItems(Items.field_151045_i, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151046_w, new EntityVillager.PriceInfo(12, 15))}}}, {{{new EntityVillager.EmeraldForItems(Items.field_151147_al, new EntityVillager.PriceInfo(14, 18)), new EntityVillager.EmeraldForItems(Items.field_151076_bf, new EntityVillager.PriceInfo(14, 18))}, {new EntityVillager.EmeraldForItems(Items.field_151044_h, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.field_151157_am, new EntityVillager.PriceInfo(-7, -5)), new EntityVillager.ListItemForEmeralds(Items.field_151077_bg, new EntityVillager.PriceInfo(-8, -6))}}, {{new EntityVillager.EmeraldForItems(Items.field_151116_aA, new EntityVillager.PriceInfo(9, 12)), new EntityVillager.ListItemForEmeralds(Items.field_151026_S, new EntityVillager.PriceInfo(2, 4))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.field_151027_R, new EntityVillager.PriceInfo(7, 12))}, {new EntityVillager.ListItemForEmeralds(Items.field_151141_av, new EntityVillager.PriceInfo(8, 10))}}}}; - public EntityVillager(World worldIn) + public EntityVillager(World p_i1747_1_) @@ -210,7 +211,7 @@ - ItemStack itemstack = player.inventory.getCurrentItem(); - boolean flag = itemstack != null && itemstack.getItem() == Items.spawn_egg; + ItemStack itemstack = p_70085_1_.field_71071_by.func_70448_g(); + boolean flag = itemstack != null && itemstack.func_77973_b() == Items.field_151063_bx; -- if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild()) -+ if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild() && !player.isSneaking()) +- if (!flag && this.func_70089_S() && !this.func_70940_q() && !this.func_70631_g_()) ++ if (!flag && this.func_70089_S() && !this.func_70940_q() && !this.func_70631_g_() && !p_70085_1_.func_70093_af()) { - if (!this.worldObj.isRemote && (this.buyingList == null || this.buyingList.size() > 0)) + if (!this.field_70170_p.field_72995_K && (this.field_70963_i == null || this.field_70963_i.size() > 0)) { @@ -522,6 +523,7 @@ - private void populateBuyingList() + private void func_175554_cu() { + //TODO: Hook into VillagerRegistry - EntityVillager.ITradeList[][][] aentityvillager$itradelist = DEFAULT_TRADE_LIST_MAP[this.getProfession()]; + EntityVillager.ITradeList[][][] aentityvillager$itradelist = field_175561_bA[this.func_70946_n()]; - if (this.careerId != 0 && this.careerLevel != 0) + if (this.field_175563_bv != 0 && this.field_175562_bw != 0) @@ -635,6 +637,7 @@ } } @@ -37,8 +37,8 @@ public IEntityLivingData func_180482_a(DifficultyInstance p_180482_1_, IEntityLivingData p_180482_2_) { p_180482_2_ = super.func_180482_a(p_180482_1_, p_180482_2_); -- this.setProfession(this.worldObj.rand.nextInt(5)); -+ net.minecraftforge.fml.common.registry.VillagerRegistry.setRandomProfession(this, this.worldObj.rand); +- this.func_70938_b(this.field_70170_p.field_73012_v.nextInt(5)); ++ net.minecraftforge.fml.common.registry.VillagerRegistry.setRandomProfession(this, this.field_70170_p.field_73012_v); this.func_175552_ct(); return p_180482_2_; } diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index c37cc423d..cdf492a0c 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -9,45 +9,45 @@ + private java.util.HashMap spawnForcedMap = new java.util.HashMap(); + public float eyeHeight = this.getDefaultEyeHeight(); + - public InventoryPlayer inventory = new InventoryPlayer(this); - private InventoryEnderChest theInventoryEnderChest = new InventoryEnderChest(); - public Container inventoryContainer; + public InventoryPlayer field_71071_by = new InventoryPlayer(this); + private InventoryEnderChest field_71078_a = new InventoryEnderChest(); + public Container field_71069_bz; @@ -175,7 +180,8 @@ { - if (this.itemInUse != null) + if (this.field_71074_e != null) { -- this.itemInUse.onPlayerStoppedUsing(this.worldObj, this, this.itemInUseCount); -+ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, itemInUse, this.itemInUseCount)) -+ this.itemInUse.onPlayerStoppedUsing(this.worldObj, this, this.itemInUseCount); +- this.field_71074_e.func_77974_b(this.field_70170_p, this, this.field_71072_f); ++ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, field_71074_e, this.field_71072_f)) ++ this.field_71074_e.func_77974_b(this.field_70170_p, this, this.field_71072_f); } - this.clearItemInUse(); + this.func_71041_bz(); @@ -199,6 +205,7 @@ - public void onUpdate() + public void func_70071_h_() { + net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPreTick(this); - this.noClip = this.isSpectator(); + this.field_70145_X = this.func_175149_v(); - if (this.isSpectator()) + if (this.func_175149_v()) @@ -212,6 +219,14 @@ - if (itemstack == this.itemInUse) + if (itemstack == this.field_71074_e) { -+ itemInUseCount = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, itemInUse, itemInUseCount); -+ if (itemInUseCount <= 0) ++ field_71072_f = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, field_71074_e, field_71072_f); ++ if (field_71072_f <= 0) + { -+ this.onItemUseFinish(); ++ this.func_71036_o(); + } + else + { // Forge Keep unindented to lower patch -+ itemInUse.getItem().onUsingTick(itemInUse, this, itemInUseCount); //Forge Added - if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0) ++ field_71074_e.func_77973_b().onUsingTick(field_71074_e, this, field_71072_f); //Forge Added + if (this.field_71072_f <= 25 && this.field_71072_f % 4 == 0) { - this.updateItemUse(itemstack, 5); + this.func_71010_c(itemstack, 5); @@ -221,6 +236,7 @@ { - this.onItemUseFinish(); + this.func_71036_o(); } + } } @@ -55,106 +55,106 @@ { @@ -266,7 +282,7 @@ - super.onUpdate(); + super.func_70071_h_(); -- if (!this.worldObj.isRemote && this.openContainer != null && !this.openContainer.canInteractWith(this)) -+ if (!this.worldObj.isRemote && this.openContainer != null && !net.minecraftforge.common.ForgeHooks.canInteractWith(this, this.openContainer)) +- if (!this.field_70170_p.field_72995_K && this.field_71070_bA != null && !this.field_71070_bA.func_75145_c(this)) ++ if (!this.field_70170_p.field_72995_K && this.field_71070_bA != null && !net.minecraftforge.common.ForgeHooks.canInteractWith(this, this.field_71070_bA)) { - this.closeScreen(); - this.openContainer = this.inventoryContainer; + this.func_71053_j(); + this.field_71070_bA = this.field_71069_bz; @@ -343,6 +359,7 @@ { - this.setPosition(d3, this.posY, d4); + this.func_70107_b(d3, this.field_70163_u, d4); } + net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPostTick(this); } - public int getMaxInPortalTime() + public int func_82145_z() @@ -412,11 +429,12 @@ - int i = this.itemInUse.stackSize; - ItemStack itemstack = this.itemInUse.onItemUseFinish(this.worldObj, this); + int i = this.field_71074_e.field_77994_a; + ItemStack itemstack = this.field_71074_e.func_77950_b(this.field_70170_p, this); -+ itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, itemInUse, itemInUseCount, itemstack); - if (itemstack != this.itemInUse || itemstack != null && itemstack.stackSize != i) ++ itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, field_71074_e, field_71072_f, itemstack); + if (itemstack != this.field_71074_e || itemstack != null && itemstack.field_77994_a != i) { - this.inventory.mainInventory[this.inventory.currentItem] = itemstack; + this.field_71071_by.field_70462_a[this.field_71071_by.field_70461_c] = itemstack; -- if (itemstack.stackSize == 0) -+ if (itemstack != null && itemstack.stackSize == 0) +- if (itemstack.field_77994_a == 0) ++ if (itemstack != null && itemstack.field_77994_a == 0) { - this.inventory.mainInventory[this.inventory.currentItem] = null; + this.field_71071_by.field_70462_a[this.field_71071_by.field_70461_c] = null; } @@ -476,11 +494,11 @@ - this.cameraYaw = 0.0F; - this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2); + this.field_71109_bG = 0.0F; + this.func_71015_k(this.field_70165_t - d0, this.field_70163_u - d1, this.field_70161_v - d2); -- if (this.ridingEntity instanceof EntityPig) -+ if (this.ridingEntity instanceof EntityLivingBase && ((EntityLivingBase)ridingEntity).shouldRiderFaceForward(this)) +- if (this.field_70154_o instanceof EntityPig) ++ if (this.field_70154_o instanceof EntityLivingBase && ((EntityLivingBase)field_70154_o).shouldRiderFaceForward(this)) { - this.rotationPitch = f1; - this.rotationYaw = f; -- this.renderYawOffset = ((EntityPig)this.ridingEntity).renderYawOffset; -+ this.renderYawOffset = ((EntityLivingBase)this.ridingEntity).renderYawOffset; + this.field_70125_A = f1; + this.field_70177_z = f; +- this.field_70761_aq = ((EntityPig)this.field_70154_o).field_70761_aq; ++ this.field_70761_aq = ((EntityLivingBase)this.field_70154_o).field_70761_aq; } } } @@ -610,11 +628,15 @@ - public void onDeath(DamageSource cause) + public void func_70645_a(DamageSource p_70645_1_) { -+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; - super.onDeath(cause); - this.setSize(0.2F, 0.2F); - this.setPosition(this.posX, this.posY, this.posZ); - this.motionY = 0.10000000149011612D; ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return; + super.func_70645_a(p_70645_1_); + this.func_70105_a(0.2F, 0.2F); + this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v); + this.field_70181_x = 0.10000000149011612D; + captureDrops = true; + capturedDrops.clear(); + - if (this.getName().equals("Notch")) + if (this.func_70005_c_().equals("Notch")) { - this.dropItem(new ItemStack(Items.apple, 1), true, false); + this.func_146097_a(new ItemStack(Items.field_151034_e, 1), true, false); @@ -625,6 +647,9 @@ - this.inventory.dropAllItems(); + this.field_71071_by.func_70436_m(); } + captureDrops = false; -+ if (!worldObj.isRemote) net.minecraftforge.event.ForgeEventFactory.onPlayerDrops(this, cause, capturedDrops, recentlyHit > 0); ++ if (!field_70170_p.field_72995_K) net.minecraftforge.event.ForgeEventFactory.onPlayerDrops(this, p_70645_1_, capturedDrops, field_70718_bc > 0); + - if (cause != null) + if (p_70645_1_ != null) { - this.motionX = (double)(-MathHelper.cos((this.attackedAtYaw + this.rotationYaw) * (float)Math.PI / 180.0F) * 0.1F); + this.field_70159_w = (double)(-MathHelper.func_76134_b((this.field_70739_aP + this.field_70177_z) * (float)Math.PI / 180.0F) * 0.1F); @@ -707,12 +732,25 @@ - public EntityItem dropOneItem(boolean p_71040_1_) + public EntityItem func_71040_bB(boolean p_71040_1_) { -- return this.dropItem(this.inventory.decrStackSize(this.inventory.currentItem, p_71040_1_ && this.inventory.getCurrentItem() != null ? this.inventory.getCurrentItem().stackSize : 1), false, true); -+ ItemStack stack = inventory.getCurrentItem(); +- return this.func_146097_a(this.field_71071_by.func_70298_a(this.field_71071_by.field_70461_c, p_71040_1_ && this.field_71071_by.func_70448_g() != null ? this.field_71071_by.func_70448_g().field_77994_a : 1), false, true); ++ ItemStack stack = field_71071_by.func_70448_g(); + + if (stack == null) + { + return null; + } + -+ if (stack.getItem().onDroppedByPlayer(stack, this)) ++ if (stack.func_77973_b().onDroppedByPlayer(stack, this)) + { -+ int count = p_71040_1_ && this.inventory.getCurrentItem() != null ? this.inventory.getCurrentItem().stackSize : 1; -+ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, inventory.decrStackSize(inventory.currentItem, count), true); ++ int count = p_71040_1_ && this.field_71071_by.func_70448_g() != null ? this.field_71071_by.func_70448_g().field_77994_a : 1; ++ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, field_71071_by.func_70298_a(field_71071_by.field_70461_c, count), true); + } + + return null; } - public EntityItem dropPlayerItemWithRandomChoice(ItemStack itemStackIn, boolean unused) + public EntityItem func_71019_a(ItemStack p_71019_1_, boolean p_71019_2_) { -- return this.dropItem(itemStackIn, false, false); -+ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, itemStackIn, false); +- return this.func_146097_a(p_71019_1_, false, false); ++ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, p_71019_1_, false); } - public EntityItem dropItem(ItemStack droppedItem, boolean dropAround, boolean traceItem) + public EntityItem func_146097_a(ItemStack p_146097_1_, boolean p_146097_2_, boolean p_146097_3_) @@ -770,13 +808,25 @@ - public void joinEntityItemWithWorld(EntityItem p_71012_1_) + public void func_71012_a(EntityItem p_71012_1_) { + if (captureDrops) + { @@ -162,23 +162,23 @@ + return; + } + - this.worldObj.spawnEntityInWorld(p_71012_1_); + this.field_70170_p.func_72838_d(p_71012_1_); } + @Deprecated //Use location sensitive version below - public float getToolDigEfficiency(Block p_180471_1_) + public float func_180471_a(Block p_180471_1_) { -- float f = this.inventory.getStrVsBlock(p_180471_1_); -+ return getBreakSpeed(p_180471_1_.getDefaultState(), new BlockPos(0, -1, 0)); +- float f = this.field_71071_by.func_146023_a(p_180471_1_); ++ return getBreakSpeed(p_180471_1_.func_176223_P(), new BlockPos(0, -1, 0)); + } + public float getBreakSpeed(IBlockState state, BlockPos pos) + { -+ ItemStack stack = inventory.getCurrentItem(); -+ float f = (stack == null ? 1.0F : stack.getItem().getDigSpeed(stack, state)); ++ ItemStack stack = field_71071_by.func_70448_g(); ++ float f = (stack == null ? 1.0F : stack.func_77973_b().getDigSpeed(stack, state)); if (f > 1.0F) { - int i = EnchantmentHelper.getEfficiencyModifier(this); + int i = EnchantmentHelper.func_77509_b(this); @@ -826,12 +876,13 @@ f /= 5.0F; } @@ -188,32 +188,32 @@ + return (f < 0 ? 0 : f); } - public boolean canHarvestBlock(Block p_146099_1_) + public boolean func_146099_a(Block p_146099_1_) { -- return this.inventory.func_146025_b(p_146099_1_); -+ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, p_146099_1_, this.inventory.func_146025_b(p_146099_1_)); +- return this.field_71071_by.func_146025_b(p_146099_1_); ++ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, p_146099_1_, this.field_71071_by.func_146025_b(p_146099_1_)); } - public void readEntityFromNBT(NBTTagCompound tagCompund) + public void func_70037_a(NBTTagCompound p_70037_1_) @@ -867,6 +918,16 @@ - this.spawnForced = tagCompund.getBoolean("SpawnForced"); + this.field_82248_d = p_70037_1_.func_74767_n("SpawnForced"); } + NBTTagList spawnlist = null; -+ spawnlist = tagCompund.getTagList("Spawns", 10); -+ for (int i = 0; i < spawnlist.tagCount(); i++) ++ spawnlist = p_70037_1_.func_150295_c("Spawns", 10); ++ for (int i = 0; i < spawnlist.func_74745_c(); i++) + { -+ NBTTagCompound spawndata = (NBTTagCompound)spawnlist.getCompoundTagAt(i); -+ int spawndim = spawndata.getInteger("Dim"); -+ this.spawnChunkMap.put(spawndim, new BlockPos(spawndata.getInteger("SpawnX"), spawndata.getInteger("SpawnY"), spawndata.getInteger("SpawnZ"))); -+ this.spawnForcedMap.put(spawndim, spawndata.getBoolean("SpawnForced")); ++ NBTTagCompound spawndata = (NBTTagCompound)spawnlist.func_150305_b(i); ++ int spawndim = spawndata.func_74762_e("Dim"); ++ this.spawnChunkMap.put(spawndim, new BlockPos(spawndata.func_74762_e("SpawnX"), spawndata.func_74762_e("SpawnY"), spawndata.func_74762_e("SpawnZ"))); ++ this.spawnForcedMap.put(spawndim, spawndata.func_74767_n("SpawnForced")); + } + - this.foodStats.readNBT(tagCompund); - this.capabilities.readCapabilitiesFromNBT(tagCompund); + this.field_71100_bB.func_75112_a(p_70037_1_); + this.field_71075_bZ.func_75095_b(p_70037_1_); @@ -898,6 +959,23 @@ - tagCompound.setBoolean("SpawnForced", this.spawnForced); + p_70014_1_.func_74757_a("SpawnForced", this.field_82248_d); } + NBTTagList spawnlist = new NBTTagList(); @@ -224,264 +224,264 @@ + Boolean forced = spawnForcedMap.get(entry.getKey()); + if (forced == null) forced = false; + NBTTagCompound spawndata = new NBTTagCompound(); -+ spawndata.setInteger("Dim", entry.getKey()); -+ spawndata.setInteger("SpawnX", spawn.getX()); -+ spawndata.setInteger("SpawnY", spawn.getY()); -+ spawndata.setInteger("SpawnZ", spawn.getZ()); -+ spawndata.setBoolean("SpawnForced", forced); -+ spawnlist.appendTag(spawndata); ++ spawndata.func_74768_a("Dim", entry.getKey()); ++ spawndata.func_74768_a("SpawnX", spawn.func_177958_n()); ++ spawndata.func_74768_a("SpawnY", spawn.func_177956_o()); ++ spawndata.func_74768_a("SpawnZ", spawn.func_177952_p()); ++ spawndata.func_74757_a("SpawnForced", forced); ++ spawnlist.func_74742_a(spawndata); + } -+ tagCompound.setTag("Spawns", spawnlist); ++ p_70014_1_.func_74782_a("Spawns", spawnlist); + - this.foodStats.writeNBT(tagCompound); - this.capabilities.writeCapabilitiesToNBT(tagCompound); - tagCompound.setTag("EnderItems", this.theInventoryEnderChest.saveInventoryToNBT()); + this.field_71100_bB.func_75117_b(p_70014_1_); + this.field_71075_bZ.func_75091_a(p_70014_1_); + p_70014_1_.func_74782_a("EnderItems", this.field_71078_a.func_70487_g()); @@ -911,6 +989,7 @@ - public boolean attackEntityFrom(DamageSource source, float amount) + public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { -+ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, source, amount)) return false; - if (this.isEntityInvulnerable(source)) ++ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, p_70097_1_, p_70097_2_)) return false; + if (this.func_180431_b(p_70097_1_)) { return false; @@ -1007,12 +1086,15 @@ { - if (!this.isEntityInvulnerable(damageSrc)) + if (!this.func_180431_b(p_70665_1_)) { -+ damageAmount = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, damageSrc, damageAmount); -+ if (damageAmount <= 0) return; - if (!damageSrc.isUnblockable() && this.isBlocking() && damageAmount > 0.0F) ++ p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, p_70665_1_, p_70665_2_); ++ if (p_70665_2_ <= 0) return; + if (!p_70665_1_.func_76363_c() && this.func_70632_aY() && p_70665_2_ > 0.0F) { - damageAmount = (1.0F + damageAmount) * 0.5F; + p_70665_2_ = (1.0F + p_70665_2_) * 0.5F; } -- damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); -+ damageAmount = net.minecraftforge.common.ISpecialArmor.ArmorProperties.applyArmor(this, inventory.armorInventory, damageSrc, damageAmount); -+ if (damageAmount <= 0) return; - damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); - float f = damageAmount; - damageAmount = Math.max(damageAmount - this.getAbsorptionAmount(), 0.0F); +- p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_); ++ p_70665_2_ = net.minecraftforge.common.ISpecialArmor.ArmorProperties.applyArmor(this, field_71071_by.field_70460_b, p_70665_1_, p_70665_2_); ++ if (p_70665_2_ <= 0) return; + p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_); + float f = p_70665_2_; + p_70665_2_ = Math.max(p_70665_2_ - this.func_110139_bj(), 0.0F); @@ -1074,6 +1156,7 @@ } else { + if (!net.minecraftforge.event.ForgeEventFactory.canInteractWith(this, p_70998_1_)) return false; - ItemStack itemstack = this.getCurrentEquippedItem(); - ItemStack itemstack1 = itemstack != null ? itemstack.copy() : null; + ItemStack itemstack = this.func_71045_bC(); + ItemStack itemstack1 = itemstack != null ? itemstack.func_77946_l() : null; @@ -1125,7 +1208,9 @@ - public void destroyCurrentEquippedItem() + public void func_71028_bD() { -+ ItemStack orig = getCurrentEquippedItem(); - this.inventory.setInventorySlotContents(this.inventory.currentItem, (ItemStack)null); ++ ItemStack orig = func_71045_bC(); + this.field_71071_by.func_70299_a(this.field_71071_by.field_70461_c, (ItemStack)null); + net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, orig); } - public double getYOffset() + public double func_70033_W() @@ -1135,6 +1220,7 @@ - public void attackTargetEntityWithCurrentItem(Entity targetEntity) + public void func_71059_n(Entity p_71059_1_) { -+ if (!net.minecraftforge.common.ForgeHooks.onPlayerAttackTarget(this, targetEntity)) return; - if (targetEntity.canAttackWithItem()) ++ if (!net.minecraftforge.common.ForgeHooks.onPlayerAttackTarget(this, p_71059_1_)) return; + if (p_71059_1_.func_70075_an()) { - if (!targetEntity.hitByEntity(this)) + if (!p_71059_1_.func_85031_j(this)) @@ -1311,6 +1397,8 @@ - public EntityPlayer.EnumStatus trySleep(BlockPos bedLocation) + public EntityPlayer.EnumStatus func_180469_a(BlockPos p_180469_1_) { -+ EntityPlayer.EnumStatus ret = net.minecraftforge.event.ForgeEventFactory.onPlayerSleepInBed(this, bedLocation); ++ EntityPlayer.EnumStatus ret = net.minecraftforge.event.ForgeEventFactory.onPlayerSleepInBed(this, p_180469_1_); + if (ret != null) return ret; - if (!this.worldObj.isRemote) + if (!this.field_70170_p.field_72995_K) { - if (this.isPlayerSleeping() || !this.isEntityAlive()) + if (this.func_70608_bn() || !this.func_70089_S()) @@ -1352,7 +1440,7 @@ - if (this.worldObj.isBlockLoaded(bedLocation)) + if (this.field_70170_p.func_175667_e(p_180469_1_)) { -- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(bedLocation).getValue(BlockDirectional.FACING); -+ EnumFacing enumfacing = this.worldObj.getBlockState(bedLocation).getBlock().getBedDirection(worldObj, bedLocation); +- EnumFacing enumfacing = (EnumFacing)this.field_70170_p.func_180495_p(p_180469_1_).func_177229_b(BlockDirectional.field_176387_N); ++ EnumFacing enumfacing = this.field_70170_p.func_180495_p(p_180469_1_).func_177230_c().getBedDirection(field_70170_p, p_180469_1_); float f = 0.5F; float f1 = 0.5F; @@ -1415,13 +1503,14 @@ - public void wakeUpPlayer(boolean p_70999_1_, boolean updateWorldFlag, boolean setSpawn) + public void func_70999_a(boolean p_70999_1_, boolean p_70999_2_, boolean p_70999_3_) { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this, p_70999_1_, updateWorldFlag, setSpawn); - this.setSize(0.6F, 1.8F); - IBlockState iblockstate = this.worldObj.getBlockState(this.playerLocation); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this, p_70999_1_, p_70999_2_, p_70999_3_); + this.func_70105_a(0.6F, 1.8F); + IBlockState iblockstate = this.field_70170_p.func_180495_p(this.field_71081_bT); -- if (this.playerLocation != null && iblockstate.getBlock() == Blocks.bed) -+ if (this.playerLocation != null && iblockstate.getBlock().isBed(worldObj, playerLocation, this)) +- if (this.field_71081_bT != null && iblockstate.func_177230_c() == Blocks.field_150324_C) ++ if (this.field_71081_bT != null && iblockstate.func_177230_c().isBed(field_70170_p, field_71081_bT, this)) { -- this.worldObj.setBlockState(this.playerLocation, iblockstate.withProperty(BlockBed.OCCUPIED, Boolean.valueOf(false)), 4); -- BlockPos blockpos = BlockBed.getSafeExitLocation(this.worldObj, this.playerLocation, 0); -+ iblockstate.getBlock().setBedOccupied(worldObj, playerLocation, this, false); -+ BlockPos blockpos = iblockstate.getBlock().getBedSpawnPosition(worldObj, playerLocation, this); +- this.field_70170_p.func_180501_a(this.field_71081_bT, iblockstate.func_177226_a(BlockBed.field_176471_b, Boolean.valueOf(false)), 4); +- BlockPos blockpos = BlockBed.func_176468_a(this.field_70170_p, this.field_71081_bT, 0); ++ iblockstate.func_177230_c().setBedOccupied(field_70170_p, field_71081_bT, this, false); ++ BlockPos blockpos = iblockstate.func_177230_c().getBedSpawnPosition(field_70170_p, field_71081_bT, this); if (blockpos == null) { @@ -1448,14 +1537,14 @@ - private boolean isInBed() + private boolean func_175143_p() { -- return this.worldObj.getBlockState(this.playerLocation).getBlock() == Blocks.bed; -+ return this.worldObj.getBlockState(this.playerLocation).getBlock().isBed(worldObj, playerLocation, this); +- return this.field_70170_p.func_180495_p(this.field_71081_bT).func_177230_c() == Blocks.field_150324_C; ++ return this.field_70170_p.func_180495_p(this.field_71081_bT).func_177230_c().isBed(field_70170_p, field_71081_bT, this); } - public static BlockPos getBedSpawnLocation(World worldIn, BlockPos bedLocation, boolean forceSpawn) + public static BlockPos func_180467_a(World p_180467_0_, BlockPos p_180467_1_, boolean p_180467_2_) { - Block block = worldIn.getBlockState(bedLocation).getBlock(); + Block block = p_180467_0_.func_180495_p(p_180467_1_).func_177230_c(); -- if (block != Blocks.bed) -+ if (!block.isBed(worldIn, bedLocation, null)) +- if (block != Blocks.field_150324_C) ++ if (!block.isBed(p_180467_0_, p_180467_1_, null)) { - if (!forceSpawn) + if (!p_180467_2_) { @@ -1470,7 +1559,7 @@ } else { -- return BlockBed.getSafeExitLocation(worldIn, bedLocation, 0); -+ return worldIn.getBlockState(bedLocation).getBlock().getBedSpawnPosition(worldIn, bedLocation, null); +- return BlockBed.func_176468_a(p_180467_0_, p_180467_1_, 0); ++ return p_180467_0_.func_180495_p(p_180467_1_).func_177230_c().getBedSpawnPosition(p_180467_0_, p_180467_1_, null); } } @@ -1479,7 +1568,7 @@ { - if (this.playerLocation != null) + if (this.field_71081_bT != null) { -- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(this.playerLocation).getValue(BlockDirectional.FACING); -+ EnumFacing enumfacing = this.worldObj.getBlockState(this.playerLocation).getBlock().getBedDirection(worldObj, playerLocation); +- EnumFacing enumfacing = (EnumFacing)this.field_70170_p.func_180495_p(this.field_71081_bT).func_177229_b(BlockDirectional.field_176387_N); ++ EnumFacing enumfacing = this.field_70170_p.func_180495_p(this.field_71081_bT).func_177230_c().getBedDirection(field_70170_p, field_71081_bT); switch (enumfacing) { @@ -1519,16 +1608,24 @@ - public BlockPos getBedLocation() + public BlockPos func_180470_cg() { -- return this.spawnChunk; -+ return getBedLocation(this.dimension); +- return this.field_71077_c; ++ return getBedLocation(this.field_71093_bK); } + @Deprecated // Use dimension-sensitive version. - public boolean isSpawnForced() + public boolean func_82245_bX() { -- return this.spawnForced; -+ return isSpawnForced(this.dimension); +- return this.field_82248_d; ++ return isSpawnForced(this.field_71093_bK); } - public void setSpawnPoint(BlockPos pos, boolean forced) + public void func_180473_a(BlockPos p_180473_1_, boolean p_180473_2_) { -+ if(net.minecraftforge.event.ForgeEventFactory.onPlayerSpawnSet(this, pos, forced)) return; -+ if (this.dimension != 0) ++ if(net.minecraftforge.event.ForgeEventFactory.onPlayerSpawnSet(this, p_180473_1_, p_180473_2_)) return; ++ if (this.field_71093_bK != 0) + { -+ setSpawnChunk(pos, forced, this.dimension); ++ setSpawnChunk(p_180473_1_, p_180473_2_, this.field_71093_bK); + return; + } + - if (pos != null) + if (p_180473_1_ != null) { - this.spawnChunk = pos; + this.field_71077_c = p_180473_1_; @@ -1712,6 +1809,10 @@ - super.fall(distance, damageMultiplier); + super.func_180430_e(p_180430_1_, p_180430_2_); } + else + { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerFall(this, distance, damageMultiplier); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerFall(this, p_180430_1_, p_180430_2_); + } } - protected void resetHeight() + protected void func_71061_d_() @@ -1735,6 +1836,7 @@ } - EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entityLivingIn))); -+ if (entitylist$entityegginfo == null) entitylist$entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.getEntityString(entityLivingIn)); + EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.field_75627_a.get(Integer.valueOf(EntityList.func_75619_a(p_70074_1_))); ++ if (entitylist$entityegginfo == null) entitylist$entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.func_75621_b(p_70074_1_)); if (entitylist$entityegginfo != null) { @@ -1847,6 +1949,8 @@ { - if (stack != this.itemInUse) + if (p_71008_1_ != this.field_71074_e) { -+ duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, stack, duration); -+ if (duration <= 0) return; - this.itemInUse = stack; - this.itemInUseCount = duration; ++ p_71008_2_ = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, p_71008_1_, p_71008_2_); ++ if (p_71008_2_ <= 0) return; + this.field_71074_e = p_71008_1_; + this.field_71072_f = p_71008_2_; @@ -1918,6 +2022,10 @@ - this.field_181016_an = oldPlayer.field_181016_an; - this.field_181017_ao = oldPlayer.field_181017_ao; - this.field_181018_ap = oldPlayer.field_181018_ap; + this.field_181016_an = p_71049_1_.field_181016_an; + this.field_181017_ao = p_71049_1_.field_181017_ao; + this.field_181018_ap = p_71049_1_.field_181018_ap; + //Copy and re-init ExtendedProperties when switching dimensions. -+ this.extendedProperties = oldPlayer.extendedProperties; ++ this.extendedProperties = p_71049_1_.extendedProperties; + for (net.minecraftforge.common.IExtendedEntityProperties p : this.extendedProperties.values()) -+ p.init(this, this.worldObj); ++ p.init(this, this.field_70170_p); } - else if (this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) + else if (this.field_70170_p.func_82736_K().func_82766_b("keepInventory")) { @@ -1931,6 +2039,18 @@ - this.xpSeed = oldPlayer.xpSeed; - this.theInventoryEnderChest = oldPlayer.theInventoryEnderChest; - this.getDataWatcher().updateObject(10, Byte.valueOf(oldPlayer.getDataWatcher().getWatchableObjectByte(10))); + this.field_175152_f = p_71049_1_.field_175152_f; + this.field_71078_a = p_71049_1_.field_71078_a; + this.func_70096_w().func_75692_b(10, Byte.valueOf(p_71049_1_.func_70096_w().func_75683_a(10))); + -+ this.spawnChunkMap = oldPlayer.spawnChunkMap; -+ this.spawnForcedMap = oldPlayer.spawnForcedMap; ++ this.spawnChunkMap = p_71049_1_.spawnChunkMap; ++ this.spawnForcedMap = p_71049_1_.spawnForcedMap; + + //Copy over a section of the Entity Data from the old player. + //Allows mods to specify data that persists after players respawn. -+ NBTTagCompound old = oldPlayer.getEntityData(); -+ if (old.hasKey(PERSISTED_NBT_TAG)) ++ NBTTagCompound old = p_71049_1_.getEntityData(); ++ if (old.func_74764_b(PERSISTED_NBT_TAG)) + { -+ getEntityData().setTag(PERSISTED_NBT_TAG, old.getCompoundTag(PERSISTED_NBT_TAG)); ++ getEntityData().func_74782_a(PERSISTED_NBT_TAG, old.func_74775_l(PERSISTED_NBT_TAG)); + } -+ net.minecraftforge.event.ForgeEventFactory.onPlayerClone(this, oldPlayer, !respawnFromEnd); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerClone(this, p_71049_1_, !p_71049_2_); } - protected boolean canTriggerWalking() + protected boolean func_70041_e_() @@ -1968,7 +2088,14 @@ - public void setCurrentItemOrArmor(int slotIn, ItemStack stack) + public void func_70062_b(int p_70062_1_, ItemStack p_70062_2_) { -- this.inventory.armorInventory[slotIn] = stack; -+ if (slotIn == 0) //Forge: Fix issue in Player where it doen't take into account selected item +- this.field_71071_by.field_70460_b[p_70062_1_] = p_70062_2_; ++ if (p_70062_1_ == 0) //Forge: Fix issue in Player where it doen't take into account selected item + { -+ this.inventory.mainInventory[this.inventory.currentItem] = stack; ++ this.field_71071_by.field_70462_a[this.field_71071_by.field_70461_c] = p_70062_2_; + } + else + { -+ this.inventory.armorInventory[slotIn - 1] = stack; ++ this.field_71071_by.field_70460_b[p_70062_1_ - 1] = p_70062_2_; + } } @SideOnly(Side.CLIENT) @@ -2013,7 +2140,10 @@ - public IChatComponent getDisplayName() + public IChatComponent func_145748_c_() { -- IChatComponent ichatcomponent = new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getName())); +- IChatComponent ichatcomponent = new ChatComponentText(ScorePlayerTeam.func_96667_a(this.func_96124_cp(), this.func_70005_c_())); + IChatComponent ichatcomponent = new ChatComponentText(""); -+ if (!prefixes.isEmpty()) for (net.minecraft.util.IChatComponent prefix : prefixes) ichatcomponent.appendSibling(prefix); -+ ichatcomponent.appendSibling(new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getDisplayNameString()))); -+ if (!suffixes.isEmpty()) for (net.minecraft.util.IChatComponent suffix : suffixes) ichatcomponent.appendSibling(suffix); - ichatcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.getName() + " ")); - ichatcomponent.getChatStyle().setChatHoverEvent(this.func_174823_aP()); - ichatcomponent.getChatStyle().setInsertion(this.getName()); ++ if (!prefixes.isEmpty()) for (net.minecraft.util.IChatComponent prefix : prefixes) ichatcomponent.func_150257_a(prefix); ++ ichatcomponent.func_150257_a(new ChatComponentText(ScorePlayerTeam.func_96667_a(this.func_96124_cp(), this.getDisplayNameString()))); ++ if (!suffixes.isEmpty()) for (net.minecraft.util.IChatComponent suffix : suffixes) ichatcomponent.func_150257_a(suffix); + ichatcomponent.func_150256_b().func_150241_a(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.func_70005_c_() + " ")); + ichatcomponent.func_150256_b().func_150209_a(this.func_174823_aP()); + ichatcomponent.func_150256_b().func_179989_a(this.func_70005_c_()); @@ -2022,7 +2152,7 @@ - public float getEyeHeight() + public float func_70047_e() { - float f = 1.62F; + float f = eyeHeight; - if (this.isPlayerSleeping()) + if (this.func_70608_bn()) { @@ -2155,6 +2285,136 @@ - this.hasReducedDebug = reducedDebug; + this.field_175153_bG = p_175150_1_; } + /** @@ -509,7 +509,7 @@ + */ + public BlockPos getBedLocation(int dimension) + { -+ return dimension == 0 ? spawnChunk : spawnChunkMap.get(dimension); ++ return dimension == 0 ? field_71077_c : spawnChunkMap.get(dimension); + } + + /** @@ -521,7 +521,7 @@ + */ + public boolean isSpawnForced(int dimension) + { -+ if (dimension == 0) return this.spawnForced; ++ if (dimension == 0) return this.field_82248_d; + Boolean forced = this.spawnForcedMap.get(dimension); + return forced == null ? false : forced; + } @@ -539,13 +539,13 @@ + { + if (pos != null) + { -+ spawnChunk = pos; -+ spawnForced = forced; ++ field_71077_c = pos; ++ field_82248_d = forced; + } + else + { -+ spawnChunk = null; -+ spawnForced = false; ++ field_71077_c = null; ++ field_82248_d = false; + } + return; + } @@ -581,7 +581,7 @@ + { + if(this.displayname == null) + { -+ this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.getName()); ++ this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.func_70005_c_()); + } + return this.displayname; + } @@ -591,7 +591,7 @@ + */ + public void refreshDisplayName() + { -+ this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.getName()); ++ this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.func_70005_c_()); + } + + private final java.util.Collection prefixes = new java.util.LinkedList(); diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch index 13520054c..91bf0b3df 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch @@ -1,38 +1,38 @@ --- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayerMP.java +++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayerMP.java @@ -123,14 +123,15 @@ - public int ping; - public boolean playerConqueredTheEnd; + public int field_71138_i; + public boolean field_71136_j; + @SuppressWarnings("unused") - public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, ItemInWorldManager interactionManager) + public EntityPlayerMP(MinecraftServer p_i45285_1_, WorldServer p_i45285_2_, GameProfile p_i45285_3_, ItemInWorldManager p_i45285_4_) { - super(worldIn, profile); - interactionManager.thisPlayerMP = this; - this.theItemInWorldManager = interactionManager; -- BlockPos blockpos = worldIn.getSpawnPoint(); -+ BlockPos blockpos = worldIn.provider.getRandomizedSpawnPoint(); + super(p_i45285_2_, p_i45285_3_); + p_i45285_4_.field_73090_b = this; + this.field_71134_c = p_i45285_4_; +- BlockPos blockpos = p_i45285_2_.func_175694_M(); ++ BlockPos blockpos = p_i45285_2_.field_73011_w.getRandomizedSpawnPoint(); -- if (!worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) -+ if (false && !worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) +- if (!p_i45285_2_.field_73011_w.func_177495_o() && p_i45285_2_.func_72912_H().func_76077_q() != WorldSettings.GameType.ADVENTURE) ++ if (false && !p_i45285_2_.field_73011_w.func_177495_o() && p_i45285_2_.func_72912_H().func_76077_q() != WorldSettings.GameType.ADVENTURE) { - int i = Math.max(5, server.getSpawnProtectionSize() - 6); - int j = MathHelper.floor_double(worldIn.getWorldBorder().getClosestDistance((double)blockpos.getX(), (double)blockpos.getZ())); + int i = Math.max(5, p_i45285_1_.func_82357_ak() - 6); + int j = MathHelper.func_76128_c(p_i45285_2_.func_175723_af().func_177729_b((double)blockpos.func_177958_n(), (double)blockpos.func_177952_p())); @@ -223,7 +224,7 @@ - this.openContainer.detectAndSendChanges(); + this.field_71070_bA.func_75142_b(); -- if (!this.worldObj.isRemote && !this.openContainer.canInteractWith(this)) -+ if (!this.worldObj.isRemote && !net.minecraftforge.common.ForgeHooks.canInteractWith(this, this.openContainer)) +- if (!this.field_70170_p.field_72995_K && !this.field_71070_bA.func_75145_c(this)) ++ if (!this.field_70170_p.field_72995_K && !net.minecraftforge.common.ForgeHooks.canInteractWith(this, this.field_71070_bA)) { - this.closeScreen(); - this.openContainer = this.inventoryContainer; + this.func_71053_j(); + this.field_71070_bA = this.field_71069_bz; @@ -264,7 +265,8 @@ - if (chunk.isPopulated()) + if (chunk.func_150802_k()) { list.add(chunk); -- list1.addAll(((WorldServer)this.worldObj).func_147486_a(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 16, 256, chunkcoordintpair.chunkZPos * 16 + 16)); -+ list1.addAll(((WorldServer)this.worldObj).func_147486_a(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 16, 256, chunkcoordintpair.chunkZPos * 16 + 15)); +- list1.addAll(((WorldServer)this.field_70170_p).func_147486_a(chunkcoordintpair.field_77276_a * 16, 0, chunkcoordintpair.field_77275_b * 16, chunkcoordintpair.field_77276_a * 16 + 16, 256, chunkcoordintpair.field_77275_b * 16 + 16)); ++ list1.addAll(((WorldServer)this.field_70170_p).func_147486_a(chunkcoordintpair.field_77276_a * 16, 0, chunkcoordintpair.field_77275_b * 16, chunkcoordintpair.field_77276_a * 16 + 16, 256, chunkcoordintpair.field_77275_b * 16 + 15)); + //BugFix: 16 makes it load an extra chunk, which isn't associated with a player, which makes it not unload unless a player walks near it. iterator1.remove(); } @@ -40,53 +40,53 @@ @@ -294,6 +296,7 @@ for (Chunk chunk1 : list) { - this.getServerForPlayer().getEntityTracker().func_85172_a(this, chunk1); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(chunk1.getChunkCoordIntPair(), this)); + this.func_71121_q().func_73039_n().func_85172_a(this, chunk1); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(chunk1.func_76632_l(), this)); } } } @@ -424,6 +427,7 @@ - public void onDeath(DamageSource cause) + public void func_70645_a(DamageSource p_70645_1_) { -+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; - if (this.worldObj.getGameRules().getGameRuleBooleanValue("showDeathMessages")) ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return; + if (this.field_70170_p.func_82736_K().func_82766_b("showDeathMessages")) { - Team team = this.getTeam(); + Team team = this.func_96124_cp(); @@ -447,7 +451,20 @@ - if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) + if (!this.field_70170_p.func_82736_K().func_82766_b("keepInventory")) { + captureDrops = true; + capturedDrops.clear(); + - this.inventory.dropAllItems(); + this.field_71071_by.func_70436_m(); + + captureDrops = false; -+ net.minecraftforge.event.entity.player.PlayerDropsEvent event = new net.minecraftforge.event.entity.player.PlayerDropsEvent(this, cause, capturedDrops, recentlyHit > 0); ++ net.minecraftforge.event.entity.player.PlayerDropsEvent event = new net.minecraftforge.event.entity.player.PlayerDropsEvent(this, p_70645_1_, capturedDrops, field_70718_bc > 0); + if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) + { + for (net.minecraft.entity.item.EntityItem item : capturedDrops) + { -+ joinEntityItemWithWorld(item); ++ func_71012_a(item); + } + } } - for (ScoreObjective scoreobjective : this.worldObj.getScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.deathCount)) + for (ScoreObjective scoreobjective : this.field_70170_p.func_96441_U().func_96520_a(IScoreObjectiveCriteria.field_96642_c)) @@ -461,6 +478,7 @@ if (entitylivingbase != null) { - EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entitylivingbase))); -+ if (entitylist$entityegginfo == null) entitylist$entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.getEntityString(entitylivingbase)); + EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.field_75627_a.get(Integer.valueOf(EntityList.func_75619_a(entitylivingbase))); ++ if (entitylist$entityegginfo == null) entitylist$entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.func_75621_b(entitylivingbase)); if (entitylist$entityegginfo != null) { @@ -831,6 +849,7 @@ { - if (stat != null) + if (p_71064_1_ != null) { -+ if (stat.isAchievement() && net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.AchievementEvent(this, (net.minecraft.stats.Achievement) stat))) return; - this.statsFile.func_150871_b(this, stat, amount); ++ if (p_71064_1_.func_75967_d() && net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.AchievementEvent(this, (net.minecraft.stats.Achievement) p_71064_1_))) return; + this.field_147103_bO.func_150871_b(this, p_71064_1_, p_71064_2_); - for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(stat.func_150952_k())) + for (ScoreObjective scoreobjective : this.func_96123_co().func_96520_a(p_71064_1_.func_150952_k())) diff --git a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch index 9cf5fa6e4..ed4ba1122 100644 --- a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch @@ -1,17 +1,17 @@ --- ../src-base/minecraft/net/minecraft/entity/player/InventoryPlayer.java +++ ../src-work/minecraft/net/minecraft/entity/player/InventoryPlayer.java @@ -315,6 +315,14 @@ - this.mainInventory[i].updateAnimation(this.player.worldObj, this.player, i, this.currentItem == i); + this.field_70462_a[i].func_77945_a(this.field_70458_d.field_70170_p, this.field_70458_d, i, this.field_70461_c == i); } } + -+ for (int i = 0; i < armorInventory.length; i++) ++ for (int i = 0; i < field_70460_b.length; i++) + { -+ if (armorInventory[i] != null) ++ if (field_70460_b[i] != null) + { -+ armorInventory[i].getItem().onArmorTick(player.worldObj, player, armorInventory[i]); ++ field_70460_b[i].func_77973_b().onArmorTick(field_70458_d.field_70170_p, field_70458_d, field_70460_b[i]); + } + } } - public boolean consumeInventoryItem(Item p_146026_1_) + public boolean func_146026_a(Item p_146026_1_) diff --git a/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch b/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch index fa1e0f4b7..b859938da 100644 --- a/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch +++ b/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch @@ -5,18 +5,18 @@ } + @SuppressWarnings("unused") - private ItemStack getFishingResult() + private ItemStack func_146033_f() { - float f = this.worldObj.rand.nextFloat(); - int i = EnchantmentHelper.getLuckOfSeaModifier(this.angler); - int j = EnchantmentHelper.getLureModifier(this.angler); + float f = this.field_70170_p.field_73012_v.nextFloat(); + int i = EnchantmentHelper.func_151386_g(this.field_146042_b); + int j = EnchantmentHelper.func_151387_h(this.field_146042_b); + + if (true) + { -+ this.angler.addStat(net.minecraftforge.common.FishingHooks.getFishableCategory(f, i, j).stat, 1); -+ return net.minecraftforge.common.FishingHooks.getRandomFishable(this.rand, f, i, j); ++ this.field_146042_b.func_71064_a(net.minecraftforge.common.FishingHooks.getFishableCategory(f, i, j).stat, 1); ++ return net.minecraftforge.common.FishingHooks.getRandomFishable(this.field_70146_Z, f, i, j); + } + float f1 = 0.1F - (float)i * 0.025F - (float)j * 0.01F; float f2 = 0.05F + (float)i * 0.01F - (float)j * 0.01F; - f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); + f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); diff --git a/patches/minecraft/net/minecraft/init/Bootstrap.java.patch b/patches/minecraft/net/minecraft/init/Bootstrap.java.patch index c1ce77797..4b2ed93f3 100644 --- a/patches/minecraft/net/minecraft/init/Bootstrap.java.patch +++ b/patches/minecraft/net/minecraft/init/Bootstrap.java.patch @@ -1,19 +1,261 @@ --- ../src-base/minecraft/net/minecraft/init/Bootstrap.java +++ ../src-work/minecraft/net/minecraft/init/Bootstrap.java @@ -65,6 +65,7 @@ - return alreadyRegistered; + return field_151355_a; } + @SuppressWarnings("unused") - static void registerDispenserBehaviors() + static void func_151353_a() { - BlockDispenser.dispenseBehaviorRegistry.putObject(Items.arrow, new BehaviorProjectileDispense() -@@ -135,7 +136,7 @@ - double d0 = source.getX() + (double)enumfacing.getFrontOffsetX(); - double d1 = (double)((float)source.getBlockPos().getY() + 0.2F); - double d2 = source.getZ() + (double)enumfacing.getFrontOffsetZ(); -- Entity entity = ItemMonsterPlacer.spawnCreature(source.getWorld(), stack.getMetadata(), d0, d1, d2); -+ Entity entity = ItemMonsterPlacer.spawnCreature(source.getWorld(), ItemMonsterPlacer.getEntityName(stack), d0, d1, d2); - - if (entity instanceof EntityLivingBase && stack.hasDisplayName()) + BlockDispenser.field_149943_a.func_82595_a(Items.field_151032_g, new BehaviorProjectileDispense() +@@ -78,23 +79,23 @@ + }); + BlockDispenser.field_149943_a.func_82595_a(Items.field_151110_aK, new BehaviorProjectileDispense() + { +- protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_) ++ protected IProjectile func_82499_a(World worldIn, IPosition position) + { +- return new EntityEgg(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c()); ++ return new EntityEgg(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c()); + } + }); + BlockDispenser.field_149943_a.func_82595_a(Items.field_151126_ay, new BehaviorProjectileDispense() + { +- protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_) ++ protected IProjectile func_82499_a(World worldIn, IPosition position) + { +- return new EntitySnowball(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c()); ++ return new EntitySnowball(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c()); + } + }); + BlockDispenser.field_149943_a.func_82595_a(Items.field_151062_by, new BehaviorProjectileDispense() + { +- protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_) ++ protected IProjectile func_82499_a(World worldIn, IPosition position) + { +- return new EntityExpBottle(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c()); ++ return new EntityExpBottle(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c()); + } + protected float func_82498_a() + { +@@ -108,13 +109,13 @@ + BlockDispenser.field_149943_a.func_82595_a(Items.field_151068_bn, new IBehaviorDispenseItem() + { + private final BehaviorDefaultDispenseItem field_150843_b = new BehaviorDefaultDispenseItem(); +- public ItemStack func_82482_a(IBlockSource p_82482_1_, final ItemStack p_82482_2_) ++ public ItemStack func_82482_a(IBlockSource source, final ItemStack stack) + { +- return ItemPotion.func_77831_g(p_82482_2_.func_77960_j()) ? (new BehaviorProjectileDispense() ++ return ItemPotion.func_77831_g(stack.func_77960_j()) ? (new BehaviorProjectileDispense() { +- protected IProjectile func_82499_a(World p_82499_1_, IPosition p_82499_2_) ++ protected IProjectile func_82499_a(World worldIn, IPosition position) + { +- return new EntityPotion(p_82499_1_, p_82499_2_.func_82615_a(), p_82499_2_.func_82617_b(), p_82499_2_.func_82616_c(), p_82482_2_.func_77946_l()); ++ return new EntityPotion(worldIn, position.func_82615_a(), position.func_82617_b(), position.func_82616_c(), stack.func_77946_l()); + } + protected float func_82498_a() + { +@@ -124,7 +125,7 @@ + { + return super.func_82500_b() * 1.25F; + } +- }).func_82482_a(p_82482_1_, p_82482_2_): this.field_150843_b.func_82482_a(p_82482_1_, p_82482_2_); ++ }).func_82482_a(source, stack): this.field_150843_b.func_82482_a(source, stack); + } + }); + BlockDispenser.field_149943_a.func_82595_a(Items.field_151063_bx, new BehaviorDefaultDispenseItem() +@@ -135,7 +136,7 @@ + double d0 = p_82487_1_.func_82615_a() + (double)enumfacing.func_82601_c(); + double d1 = (double)((float)p_82487_1_.func_180699_d().func_177956_o() + 0.2F); + double d2 = p_82487_1_.func_82616_c() + (double)enumfacing.func_82599_e(); +- Entity entity = ItemMonsterPlacer.func_77840_a(p_82487_1_.func_82618_k(), p_82487_2_.func_77960_j(), d0, d1, d2); ++ Entity entity = ItemMonsterPlacer.spawnCreature(p_82487_1_.func_82618_k(), ItemMonsterPlacer.getEntityName(p_82487_2_), d0, d1, d2); + + if (entity instanceof EntityLivingBase && p_82487_2_.func_82837_s()) + { +@@ -190,14 +191,14 @@ + BlockDispenser.field_149943_a.func_82595_a(Items.field_151124_az, new BehaviorDefaultDispenseItem() + { + private final BehaviorDefaultDispenseItem field_150842_b = new BehaviorDefaultDispenseItem(); +- public ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) ++ public ItemStack func_82487_b(IBlockSource source, ItemStack stack) + { +- EnumFacing enumfacing = BlockDispenser.func_149937_b(p_82487_1_.func_82620_h()); +- World world = p_82487_1_.func_82618_k(); +- double d0 = p_82487_1_.func_82615_a() + (double)((float)enumfacing.func_82601_c() * 1.125F); +- double d1 = p_82487_1_.func_82617_b() + (double)((float)enumfacing.func_96559_d() * 1.125F); +- double d2 = p_82487_1_.func_82616_c() + (double)((float)enumfacing.func_82599_e() * 1.125F); +- BlockPos blockpos = p_82487_1_.func_180699_d().func_177972_a(enumfacing); ++ EnumFacing enumfacing = BlockDispenser.func_149937_b(source.func_82620_h()); ++ World world = source.func_82618_k(); ++ double d0 = source.func_82615_a() + (double)((float)enumfacing.func_82601_c() * 1.125F); ++ double d1 = source.func_82617_b() + (double)((float)enumfacing.func_96559_d() * 1.125F); ++ double d2 = source.func_82616_c() + (double)((float)enumfacing.func_82599_e() * 1.125F); ++ BlockPos blockpos = source.func_180699_d().func_177972_a(enumfacing); + Material material = world.func_180495_p(blockpos).func_177230_c().func_149688_o(); + double d3; + +@@ -209,7 +210,7 @@ + { + if (!Material.field_151579_a.equals(material) || !Material.field_151586_h.equals(world.func_180495_p(blockpos.func_177977_b()).func_177230_c().func_149688_o())) + { +- return this.field_150842_b.func_82482_a(p_82487_1_, p_82487_2_); ++ return this.field_150842_b.func_82482_a(source, stack); + } + + d3 = 0.0D; +@@ -217,31 +218,31 @@ + + EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2); + world.func_72838_d(entityboat); +- p_82487_2_.func_77979_a(1); +- return p_82487_2_; ++ stack.func_77979_a(1); ++ return stack; + } +- protected void func_82485_a(IBlockSource p_82485_1_) ++ protected void func_82485_a(IBlockSource source) + { +- p_82485_1_.func_82618_k().func_175718_b(1000, p_82485_1_.func_180699_d(), 0); ++ source.func_82618_k().func_175718_b(1000, source.func_180699_d(), 0); + } + }); + IBehaviorDispenseItem ibehaviordispenseitem = new BehaviorDefaultDispenseItem() + { + private final BehaviorDefaultDispenseItem field_150841_b = new BehaviorDefaultDispenseItem(); +- public ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) ++ public ItemStack func_82487_b(IBlockSource source, ItemStack stack) + { +- ItemBucket itembucket = (ItemBucket)p_82487_2_.func_77973_b(); +- BlockPos blockpos = p_82487_1_.func_180699_d().func_177972_a(BlockDispenser.func_149937_b(p_82487_1_.func_82620_h())); ++ ItemBucket itembucket = (ItemBucket)stack.func_77973_b(); ++ BlockPos blockpos = source.func_180699_d().func_177972_a(BlockDispenser.func_149937_b(source.func_82620_h())); + +- if (itembucket.func_180616_a(p_82487_1_.func_82618_k(), blockpos)) ++ if (itembucket.func_180616_a(source.func_82618_k(), blockpos)) + { +- p_82487_2_.func_150996_a(Items.field_151133_ar); +- p_82487_2_.field_77994_a = 1; +- return p_82487_2_; ++ stack.func_150996_a(Items.field_151133_ar); ++ stack.field_77994_a = 1; ++ return stack; + } + else + { +- return this.field_150841_b.func_82482_a(p_82487_1_, p_82487_2_); ++ return this.field_150841_b.func_82482_a(source, stack); + } + } + }; +@@ -250,10 +251,10 @@ + BlockDispenser.field_149943_a.func_82595_a(Items.field_151133_ar, new BehaviorDefaultDispenseItem() + { + private final BehaviorDefaultDispenseItem field_150840_b = new BehaviorDefaultDispenseItem(); +- public ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) ++ public ItemStack func_82487_b(IBlockSource source, ItemStack stack) + { +- World world = p_82487_1_.func_82618_k(); +- BlockPos blockpos = p_82487_1_.func_180699_d().func_177972_a(BlockDispenser.func_149937_b(p_82487_1_.func_82620_h())); ++ World world = source.func_82618_k(); ++ BlockPos blockpos = source.func_180699_d().func_177972_a(BlockDispenser.func_149937_b(source.func_82620_h())); + IBlockState iblockstate = world.func_180495_p(blockpos); + Block block = iblockstate.func_177230_c(); + Material material = block.func_149688_o(); +@@ -267,7 +268,7 @@ + { + if (!Material.field_151587_i.equals(material) || !(block instanceof BlockLiquid) || ((Integer)iblockstate.func_177229_b(BlockLiquid.field_176367_b)).intValue() != 0) + { +- return super.func_82487_b(p_82487_1_, p_82487_2_); ++ return super.func_82487_b(source, stack); + } + + item = Items.field_151129_at; +@@ -275,34 +276,34 @@ + + world.func_175698_g(blockpos); + +- if (--p_82487_2_.field_77994_a == 0) ++ if (--stack.field_77994_a == 0) + { +- p_82487_2_.func_150996_a(item); +- p_82487_2_.field_77994_a = 1; ++ stack.func_150996_a(item); ++ stack.field_77994_a = 1; + } +- else if (((TileEntityDispenser)p_82487_1_.func_150835_j()).func_146019_a(new ItemStack(item)) < 0) ++ else if (((TileEntityDispenser)source.func_150835_j()).func_146019_a(new ItemStack(item)) < 0) + { +- this.field_150840_b.func_82482_a(p_82487_1_, new ItemStack(item)); ++ this.field_150840_b.func_82482_a(source, new ItemStack(item)); + } + +- return p_82487_2_; ++ return stack; + } + }); + BlockDispenser.field_149943_a.func_82595_a(Items.field_151033_d, new BehaviorDefaultDispenseItem() + { + private boolean field_150839_b = true; +- protected ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) ++ protected ItemStack func_82487_b(IBlockSource source, ItemStack stack) + { +- World world = p_82487_1_.func_82618_k(); +- BlockPos blockpos = p_82487_1_.func_180699_d().func_177972_a(BlockDispenser.func_149937_b(p_82487_1_.func_82620_h())); ++ World world = source.func_82618_k(); ++ BlockPos blockpos = source.func_180699_d().func_177972_a(BlockDispenser.func_149937_b(source.func_82620_h())); + + if (world.func_175623_d(blockpos)) + { + world.func_175656_a(blockpos, Blocks.field_150480_ab.func_176223_P()); + +- if (p_82487_2_.func_96631_a(1, world.field_73012_v)) ++ if (stack.func_96631_a(1, world.field_73012_v)) + { +- p_82487_2_.field_77994_a = 0; ++ stack.field_77994_a = 0; + } + } + else if (world.func_180495_p(blockpos).func_177230_c() == Blocks.field_150335_W) +@@ -315,17 +316,17 @@ + this.field_150839_b = false; + } + +- return p_82487_2_; ++ return stack; + } +- protected void func_82485_a(IBlockSource p_82485_1_) ++ protected void func_82485_a(IBlockSource source) + { + if (this.field_150839_b) + { +- p_82485_1_.func_82618_k().func_175718_b(1000, p_82485_1_.func_180699_d(), 0); ++ source.func_82618_k().func_175718_b(1000, source.func_180699_d(), 0); + } + else + { +- p_82485_1_.func_82618_k().func_175718_b(1001, p_82485_1_.func_180699_d(), 0); ++ source.func_82618_k().func_175718_b(1001, source.func_180699_d(), 0); + } + } + }); +@@ -358,15 +359,15 @@ + return super.func_82487_b(p_82487_1_, p_82487_2_); + } + } +- protected void func_82485_a(IBlockSource p_82485_1_) ++ protected void func_82485_a(IBlockSource source) + { + if (this.field_150838_b) + { +- p_82485_1_.func_82618_k().func_175718_b(1000, p_82485_1_.func_180699_d(), 0); ++ source.func_82618_k().func_175718_b(1000, source.func_180699_d(), 0); + } + else + { +- p_82485_1_.func_82618_k().func_175718_b(1001, p_82485_1_.func_180699_d(), 0); ++ source.func_82618_k().func_175718_b(1001, source.func_180699_d(), 0); + } + } + }); diff --git a/patches/minecraft/net/minecraft/inventory/Container.java.patch b/patches/minecraft/net/minecraft/inventory/Container.java.patch index 84a24da4d..0fdc592c4 100644 --- a/patches/minecraft/net/minecraft/inventory/Container.java.patch +++ b/patches/minecraft/net/minecraft/inventory/Container.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/inventory/Container.java +++ ../src-work/minecraft/net/minecraft/inventory/Container.java @@ -608,7 +608,7 @@ - Slot slot1 = (Slot)this.inventorySlots.get(i); - ItemStack itemstack1 = slot1.getStack(); + Slot slot1 = (Slot)this.field_75151_b.get(i); + ItemStack itemstack1 = slot1.func_75211_c(); - if (itemstack1 == null) -+ if (itemstack1 == null && slot1.isItemValid(stack)) // Forge: Make sure to respect isItemValid in the slot. ++ if (itemstack1 == null && slot1.func_75214_a(p_75135_1_)) // Forge: Make sure to respect isItemValid in the slot. { - slot1.putStack(stack.copy()); - slot1.onSlotChanged(); + slot1.func_75215_d(p_75135_1_.func_77946_l()); + slot1.func_75218_e(); diff --git a/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch index d8b6bd0eb..ae5dae8dd 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch @@ -2,10 +2,10 @@ +++ ../src-work/minecraft/net/minecraft/inventory/ContainerBeacon.java @@ -143,7 +143,7 @@ - public boolean isItemValid(ItemStack stack) + public boolean func_75214_a(ItemStack p_75214_1_) { -- return stack == null ? false : stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot; -+ return stack == null ? false : stack.getItem().isBeaconPayment(stack); +- return p_75214_1_ == null ? false : p_75214_1_.func_77973_b() == Items.field_151166_bC || p_75214_1_.func_77973_b() == Items.field_151045_i || p_75214_1_.func_77973_b() == Items.field_151043_k || p_75214_1_.func_77973_b() == Items.field_151042_j; ++ return p_75214_1_ == null ? false : p_75214_1_.func_77973_b().isBeaconPayment(p_75214_1_); } - public int getSlotStackLimit() + public int func_75219_a() diff --git a/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch index a6984df04..4e3f446a3 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch @@ -2,27 +2,27 @@ +++ ../src-work/minecraft/net/minecraft/inventory/ContainerBrewingStand.java @@ -154,7 +154,7 @@ - public boolean isItemValid(ItemStack stack) + public boolean func_75214_a(ItemStack p_75214_1_) { -- return stack != null ? stack.getItem().isPotionIngredient(stack) : false; -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack); +- return p_75214_1_ != null ? p_75214_1_.func_77973_b().func_150892_m(p_75214_1_) : false; ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(p_75214_1_); } - public int getSlotStackLimit() + public int func_75219_a() @@ -185,7 +185,7 @@ - public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) + public void func_82870_a(EntityPlayer p_82870_1_, ItemStack p_82870_2_) { -- if (stack.getItem() == Items.potionitem && stack.getMetadata() > 0) -+ if (stack.getItem() instanceof net.minecraft.item.ItemPotion && stack.getMetadata() > 0) +- if (p_82870_2_.func_77973_b() == Items.field_151068_bn && p_82870_2_.func_77960_j() > 0) ++ if (p_82870_2_.func_77973_b() instanceof net.minecraft.item.ItemPotion && p_82870_2_.func_77960_j() > 0) { - this.player.triggerAchievement(AchievementList.potion); + this.field_75244_a.func_71029_a(AchievementList.field_76001_A); } @@ -195,7 +195,7 @@ - public static boolean canHoldPotion(ItemStack p_75243_0_) + public static boolean func_75243_a_(ItemStack p_75243_0_) { -- return p_75243_0_ != null && (p_75243_0_.getItem() == Items.potionitem || p_75243_0_.getItem() == Items.glass_bottle); +- return p_75243_0_ != null && (p_75243_0_.func_77973_b() == Items.field_151068_bn || p_75243_0_.func_77973_b() == Items.field_151069_bo); + return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_75243_0_); } } diff --git a/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch index 292d16a78..79534c19d 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch @@ -2,20 +2,20 @@ +++ ../src-work/minecraft/net/minecraft/inventory/ContainerEnchantment.java @@ -65,9 +65,12 @@ }); - this.addSlotToContainer(new Slot(this.tableInventory, 1, 35, 47) + this.func_75146_a(new Slot(this.field_75168_e, 1, 35, 47) { + java.util.List ores = net.minecraftforge.oredict.OreDictionary.getOres("gemLapis"); - public boolean isItemValid(ItemStack stack) + public boolean func_75214_a(ItemStack p_75214_1_) { -- return stack.getItem() == Items.dye && EnumDyeColor.byDyeDamage(stack.getMetadata()) == EnumDyeColor.BLUE; +- return p_75214_1_.func_77973_b() == Items.field_151100_aR && EnumDyeColor.func_176766_a(p_75214_1_.func_77960_j()) == EnumDyeColor.BLUE; + for (ItemStack ore : ores) -+ if (net.minecraftforge.oredict.OreDictionary.itemMatches(ore, stack, false)) return true; ++ if (net.minecraftforge.oredict.OreDictionary.itemMatches(ore, p_75214_1_, false)) return true; + return false; } }); @@ -146,6 +149,7 @@ - if (!this.worldPointer.isRemote) + if (!this.field_75172_h.field_72995_K) { int l = 0; + float power = 0; @@ -24,45 +24,45 @@ { @@ -153,37 +157,14 @@ { - if ((j != 0 || k != 0) && this.worldPointer.isAirBlock(this.position.add(k, 0, j)) && this.worldPointer.isAirBlock(this.position.add(k, 1, j))) + if ((j != 0 || k != 0) && this.field_75172_h.func_175623_d(this.field_178150_j.func_177982_a(k, 0, j)) && this.field_75172_h.func_175623_d(this.field_178150_j.func_177982_a(k, 1, j))) { -- if (this.worldPointer.getBlockState(this.position.add(k * 2, 0, j * 2)).getBlock() == Blocks.bookshelf) +- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 0, j * 2)).func_177230_c() == Blocks.field_150342_X) - { - ++l; - } - -- if (this.worldPointer.getBlockState(this.position.add(k * 2, 1, j * 2)).getBlock() == Blocks.bookshelf) +- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 1, j * 2)).func_177230_c() == Blocks.field_150342_X) - { - ++l; - } - -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 0, j * 2)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 1, j * 2)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k * 2, 0, j * 2)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k * 2, 1, j * 2)); if (k != 0 && j != 0) { -- if (this.worldPointer.getBlockState(this.position.add(k * 2, 0, j)).getBlock() == Blocks.bookshelf) +- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 0, j)).func_177230_c() == Blocks.field_150342_X) - { - ++l; - } - -- if (this.worldPointer.getBlockState(this.position.add(k * 2, 1, j)).getBlock() == Blocks.bookshelf) +- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 1, j)).func_177230_c() == Blocks.field_150342_X) - { - ++l; - } - -- if (this.worldPointer.getBlockState(this.position.add(k, 0, j * 2)).getBlock() == Blocks.bookshelf) +- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k, 0, j * 2)).func_177230_c() == Blocks.field_150342_X) - { - ++l; - } - -- if (this.worldPointer.getBlockState(this.position.add(k, 1, j * 2)).getBlock() == Blocks.bookshelf) +- if (this.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k, 1, j * 2)).func_177230_c() == Blocks.field_150342_X) - { - ++l; - } -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 0, j)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 1, j)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k, 0, j * 2)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k, 1, j * 2)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k * 2, 0, j)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k * 2, 1, j)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k, 0, j * 2)); ++ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(field_75172_h, field_178150_j.func_177982_a(k, 1, j * 2)); } } } @@ -70,8 +70,8 @@ for (int i1 = 0; i1 < 3; ++i1) { -- this.enchantLevels[i1] = EnchantmentHelper.calcItemStackEnchantability(this.rand, i1, l, itemstack); -+ this.enchantLevels[i1] = EnchantmentHelper.calcItemStackEnchantability(this.rand, i1, (int)power, itemstack); +- this.field_75167_g[i1] = EnchantmentHelper.func_77514_a(this.field_75169_l, i1, l, itemstack); ++ this.field_75167_g[i1] = EnchantmentHelper.func_77514_a(this.field_75169_l, i1, (int)power, itemstack); this.field_178151_h[i1] = -1; - if (this.enchantLevels[i1] < i1 + 1) + if (this.field_75167_g[i1] < i1 + 1) diff --git a/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch index 2b87f8433..b34ce8231 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch @@ -2,11 +2,11 @@ +++ ../src-work/minecraft/net/minecraft/inventory/ContainerPlayer.java @@ -43,7 +43,8 @@ } - public boolean isItemValid(ItemStack stack) + public boolean func_75214_a(ItemStack p_75214_1_) { -- return stack == null ? false : (stack.getItem() instanceof ItemArmor ? ((ItemArmor)stack.getItem()).armorType == k_f : (stack.getItem() != Item.getItemFromBlock(Blocks.pumpkin) && stack.getItem() != Items.skull ? false : k_f == 0)); -+ if (stack == null) return false; -+ return stack.getItem().isValidArmor(stack, k_f, thePlayer); +- return p_75214_1_ == null ? false : (p_75214_1_.func_77973_b() instanceof ItemArmor ? ((ItemArmor)p_75214_1_.func_77973_b()).field_77881_a == k_f : (p_75214_1_.func_77973_b() != Item.func_150898_a(Blocks.field_150423_aK) && p_75214_1_.func_77973_b() != Items.field_151144_bL ? false : k_f == 0)); ++ if (p_75214_1_ == null) return false; ++ return p_75214_1_.func_77973_b().isValidArmor(p_75214_1_, k_f, field_82862_h); } @SideOnly(Side.CLIENT) - public String getSlotTexture() + public String func_178171_c() diff --git a/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch index 8ca672062..aad74b86d 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerRepair.java.patch @@ -1,38 +1,38 @@ --- ../src-base/minecraft/net/minecraft/inventory/ContainerRepair.java +++ ../src-work/minecraft/net/minecraft/inventory/ContainerRepair.java @@ -70,6 +70,8 @@ - playerIn.addExperienceLevel(-ContainerRepair.this.maximumCost); + p_82870_1_.func_82242_a(-ContainerRepair.this.field_82854_e); } -+ float breakChance = net.minecraftforge.common.ForgeHooks.onAnvilRepair(playerIn, stack, ContainerRepair.this.inputSlots.getStackInSlot(0), ContainerRepair.this.inputSlots.getStackInSlot(1)); ++ float breakChance = net.minecraftforge.common.ForgeHooks.onAnvilRepair(p_82870_1_, p_82870_2_, ContainerRepair.this.field_82853_g.func_70301_a(0), ContainerRepair.this.field_82853_g.func_70301_a(1)); + - ContainerRepair.this.inputSlots.setInventorySlotContents(0, (ItemStack)null); + ContainerRepair.this.field_82853_g.func_70299_a(0, (ItemStack)null); - if (ContainerRepair.this.materialCost > 0) + if (ContainerRepair.this.field_82856_l > 0) @@ -94,7 +96,7 @@ - ContainerRepair.this.maximumCost = 0; - IBlockState iblockstate = worldIn.getBlockState(blockPosIn); + ContainerRepair.this.field_82854_e = 0; + IBlockState iblockstate = p_i45807_2_.func_180495_p(p_i45807_3_); -- if (!playerIn.capabilities.isCreativeMode && !worldIn.isRemote && iblockstate.getBlock() == Blocks.anvil && playerIn.getRNG().nextFloat() < 0.12F) -+ if (!playerIn.capabilities.isCreativeMode && !worldIn.isRemote && iblockstate.getBlock() == Blocks.anvil && playerIn.getRNG().nextFloat() < breakChance) +- if (!p_82870_1_.field_71075_bZ.field_75098_d && !p_i45807_2_.field_72995_K && iblockstate.func_177230_c() == Blocks.field_150467_bQ && p_82870_1_.func_70681_au().nextFloat() < 0.12F) ++ if (!p_82870_1_.field_71075_bZ.field_75098_d && !p_i45807_2_.field_72995_K && iblockstate.func_177230_c() == Blocks.field_150467_bQ && p_82870_1_.func_70681_au().nextFloat() < breakChance) { - int l = ((Integer)iblockstate.getValue(BlockAnvil.DAMAGE)).intValue(); + int l = ((Integer)iblockstate.func_177229_b(BlockAnvil.field_176505_b)).intValue(); ++l; @@ -172,6 +174,7 @@ if (itemstack2 != null) { -+ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, outputSlot, repairedItemName, i2)) return; - flag = itemstack2.getItem() == Items.enchanted_book && Items.enchanted_book.getEnchantments(itemstack2).tagCount() > 0; ++ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, field_82852_f, field_82857_m, i2)) return; + flag = itemstack2.func_77973_b() == Items.field_151134_bR && Items.field_151134_bR.func_92110_g(itemstack2).func_74745_c() > 0; - if (itemstack1.isItemStackDamageable() && itemstack1.getItem().getIsRepairable(itemstack, itemstack2)) + if (itemstack1.func_77984_f() && itemstack1.func_77973_b().func_82789_a(itemstack, itemstack2)) @@ -264,7 +267,8 @@ { int i4 = ((Integer)iterator.next()).intValue(); -- if (i4 != i5 && !enchantment.canApplyTogether(Enchantment.getEnchantmentById(i4))) -+ Enchantment e2 = Enchantment.getEnchantmentById(i4); -+ if (i4 != i5 && !(enchantment.canApplyTogether(e2) && e2.canApplyTogether(enchantment))) //Forge BugFix: Let Both enchantments veto being together +- if (i4 != i5 && !enchantment.func_77326_a(Enchantment.func_180306_c(i4))) ++ Enchantment e2 = Enchantment.func_180306_c(i4); ++ if (i4 != i5 && !(enchantment.func_77326_a(e2) && e2.func_77326_a(enchantment))) //Forge BugFix: Let Both enchantments veto being together { flag1 = false; ++l1; @@ -40,8 +40,8 @@ } } -+ if (flag && !itemstack1.getItem().isBookEnchantable(itemstack1, itemstack2)) itemstack1 = null; ++ if (flag && !itemstack1.func_77973_b().isBookEnchantable(itemstack1, itemstack2)) itemstack1 = null; + - if (StringUtils.isBlank(this.repairedItemName)) + if (StringUtils.isBlank(this.field_82857_m)) { - if (itemstack.hasDisplayName()) + if (itemstack.func_82837_s()) diff --git a/patches/minecraft/net/minecraft/inventory/Slot.java.patch b/patches/minecraft/net/minecraft/inventory/Slot.java.patch index c2d09be0f..3b5a76863 100644 --- a/patches/minecraft/net/minecraft/inventory/Slot.java.patch +++ b/patches/minecraft/net/minecraft/inventory/Slot.java.patch @@ -2,13 +2,13 @@ +++ ../src-work/minecraft/net/minecraft/inventory/Slot.java @@ -89,7 +89,7 @@ @SideOnly(Side.CLIENT) - public String getSlotTexture() + public String func_178171_c() { - return null; + return backgroundName; } - public ItemStack decrStackSize(int amount) + public ItemStack func_75209_a(int p_75209_1_) @@ -112,4 +112,64 @@ { return true; @@ -25,7 +25,7 @@ + @SideOnly(Side.CLIENT) + public net.minecraft.util.ResourceLocation getBackgroundLocation() + { -+ return (backgroundLocation == null ? net.minecraft.client.renderer.texture.TextureMap.locationBlocksTexture : backgroundLocation); ++ return (backgroundLocation == null ? net.minecraft.client.renderer.texture.TextureMap.field_110575_b : backgroundLocation); + } + + /** @@ -51,14 +51,14 @@ + @SideOnly(Side.CLIENT) + public net.minecraft.client.renderer.texture.TextureAtlasSprite getBackgroundSprite() + { -+ String name = getSlotTexture(); -+ return name == null ? null : getBackgroundMap().getAtlasSprite(name); ++ String name = func_178171_c(); ++ return name == null ? null : getBackgroundMap().func_110572_b(name); + } + + @SideOnly(Side.CLIENT) + protected net.minecraft.client.renderer.texture.TextureMap getBackgroundMap() + { -+ if (backgroundMap == null) backgroundMap = net.minecraft.client.Minecraft.getMinecraft().getTextureMapBlocks(); ++ if (backgroundMap == null) backgroundMap = net.minecraft.client.Minecraft.func_71410_x().func_147117_R(); + return (net.minecraft.client.renderer.texture.TextureMap)backgroundMap; + } + @@ -70,7 +70,7 @@ + */ + public int getSlotIndex() + { -+ return slotIndex; ++ return field_75225_a; + } + /*========================================= FORGE END =====================================*/ } diff --git a/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch b/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch index 59cf4f617..58adc5a1a 100644 --- a/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch +++ b/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch @@ -2,12 +2,12 @@ +++ ../src-work/minecraft/net/minecraft/inventory/SlotCrafting.java @@ -112,8 +112,11 @@ - public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) + public void func_82870_a(EntityPlayer p_82870_1_, ItemStack p_82870_2_) { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, craftMatrix); - this.onCrafting(stack); -+ net.minecraftforge.common.ForgeHooks.setCraftingPlayer(playerIn); - ItemStack[] aitemstack = CraftingManager.getInstance().func_180303_b(this.craftMatrix, playerIn.worldObj); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(p_82870_1_, p_82870_2_, field_75239_a); + this.func_75208_c(p_82870_2_); ++ net.minecraftforge.common.ForgeHooks.setCraftingPlayer(p_82870_1_); + ItemStack[] aitemstack = CraftingManager.func_77594_a().func_180303_b(this.field_75239_a, p_82870_1_.field_70170_p); + net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null); for (int i = 0; i < aitemstack.length; ++i) diff --git a/patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch b/patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch index 5de127a2d..33dcc7b7e 100644 --- a/patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch +++ b/patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch @@ -4,8 +4,8 @@ this.field_75228_b = 0; -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerSmeltedEvent(thePlayer, stack); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerSmeltedEvent(field_75229_a, p_75208_1_); + - if (stack.getItem() == Items.iron_ingot) + if (p_75208_1_.func_77973_b() == Items.field_151042_j) { - this.thePlayer.triggerAchievement(AchievementList.acquireIron); + this.field_75229_a.func_71029_a(AchievementList.field_76016_k); diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index b44a7ee96..095c78806 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -4,65 +4,65 @@ public class Item { -- public static final RegistryNamespaced itemRegistry = new RegistryNamespaced(); -- private static final Map BLOCK_TO_ITEM = Maps.newHashMap(); -+ public static final RegistryNamespaced itemRegistry = net.minecraftforge.fml.common.registry.GameData.getItemRegistry(); -+ private static final Map BLOCK_TO_ITEM = net.minecraftforge.fml.common.registry.GameData.getBlockItemMap(); - protected static final UUID itemModifierUUID = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); - private CreativeTabs tabToDisplayOn; - protected static Random itemRand = new Random(); +- public static final RegistryNamespaced field_150901_e = new RegistryNamespaced(); +- private static final Map field_179220_a = Maps.newHashMap(); ++ public static final RegistryNamespaced field_150901_e = net.minecraftforge.fml.common.registry.GameData.getItemRegistry(); ++ private static final Map field_179220_a = net.minecraftforge.fml.common.registry.GameData.getBlockItemMap(); + protected static final UUID field_111210_e = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); + private CreativeTabs field_77701_a; + protected static Random field_77697_d = new Random(); @@ -61,6 +61,9 @@ - private String potionEffect; - private String unlocalizedName; + private String field_77785_bY; + private String field_77774_bZ; + public final net.minecraftforge.fml.common.registry.RegistryDelegate delegate = -+ ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)itemRegistry).getDelegate(this, Item.class); ++ ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)field_150901_e).getDelegate(this, Item.class); + - public static int getIdFromItem(Item itemIn) + public static int func_150891_b(Item p_150891_0_) { - return itemIn == null ? 0 : itemRegistry.getIDForObject(itemIn); + return p_150891_0_ == null ? 0 : field_150901_e.func_148757_b(p_150891_0_); @@ -126,6 +129,7 @@ - return stack; + return p_77654_1_; } + @Deprecated // Use ItemStack sensitive version below. - public int getItemStackLimit() + public int func_77639_j() { - return this.maxStackSize; + return this.field_77777_bU; @@ -239,6 +243,7 @@ - return this.containerItem; + return this.field_77700_c; } + @Deprecated // Use ItemStack sensitive version below. - public boolean hasContainerItem() + public boolean func_77634_r() { - return this.containerItem != null; + return this.field_77700_c != null; @@ -316,7 +321,7 @@ - public boolean isItemTool(ItemStack stack) + public boolean func_77616_k(ItemStack p_77616_1_) { -- return this.getItemStackLimit() == 1 && this.isDamageable(); -+ return this.getItemStackLimit(stack) == 1 && this.isDamageable(); +- return this.func_77639_j() == 1 && this.func_77645_m(); ++ return this.getItemStackLimit(p_77616_1_) == 1 && this.func_77645_m(); } - protected MovingObjectPosition getMovingObjectPositionFromPlayer(World worldIn, EntityPlayer playerIn, boolean useLiquids) + protected MovingObjectPosition func_77621_a(World p_77621_1_, EntityPlayer p_77621_2_, boolean p_77621_3_) @@ -334,6 +339,10 @@ float f6 = f3 * f4; float f7 = f2 * f4; double d3 = 5.0D; -+ if (playerIn instanceof net.minecraft.entity.player.EntityPlayerMP) ++ if (p_77621_2_ instanceof net.minecraft.entity.player.EntityPlayerMP) + { -+ d3 = ((net.minecraft.entity.player.EntityPlayerMP)playerIn).theItemInWorldManager.getBlockReachDistance(); ++ d3 = ((net.minecraft.entity.player.EntityPlayerMP)p_77621_2_).field_71134_c.getBlockReachDistance(); + } - Vec3 vec31 = vec3.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); - return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false); + Vec3 vec31 = vec3.func_72441_c((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); + return p_77621_1_.func_147447_a(vec3, vec31, p_77621_3_, !p_77621_3_, false); } @@ -371,11 +380,578 @@ return false; } + @Deprecated // Use ItemStack sensitive version below. - public Multimap getItemAttributeModifiers() + public Multimap func_111205_h() { return HashMultimap.create(); } @@ -73,7 +73,7 @@ + */ + public Multimap getAttributeModifiers(ItemStack stack) + { -+ return this.getItemAttributeModifiers(); ++ return this.func_111205_h(); + } + + /** @@ -112,7 +112,7 @@ + */ + public float getDigSpeed(ItemStack itemstack, net.minecraft.block.state.IBlockState state) + { -+ return getStrVsBlock(itemstack, state.getBlock()); ++ return func_150893_a(itemstack, state.func_177230_c()); + } + + @@ -123,7 +123,7 @@ + */ + public boolean isRepairable() + { -+ return canRepair && isDamageable(); ++ return canRepair && func_77645_m(); + } + + /** @@ -203,7 +203,7 @@ + { + return null; + } -+ return new ItemStack(getContainerItem()); ++ return new ItemStack(func_77668_q()); + } + + /** @@ -213,7 +213,7 @@ + */ + public boolean hasContainerItem(ItemStack stack) + { -+ return hasContainerItem(); ++ return func_77634_r(); + } + + /** @@ -278,7 +278,7 @@ + */ + public CreativeTabs[] getCreativeTabs() + { -+ return new CreativeTabs[]{ getCreativeTab() }; ++ return new CreativeTabs[]{ func_77640_w() }; + } + + /** @@ -321,9 +321,9 @@ + { + if (this instanceof ItemEnchantedBook) + { -+ return ((ItemEnchantedBook)this).getRandom(rnd, -+ original.theMinimumChanceToGenerateItem, -+ original.theMaximumChanceToGenerateItem, original.itemWeight); ++ return ((ItemEnchantedBook)this).func_92112_a(rnd, ++ original.field_76295_d, ++ original.field_76296_e, original.field_76292_a); + } + return original; + } @@ -359,12 +359,12 @@ + { + if (this instanceof ItemArmor) + { -+ return ((ItemArmor)this).armorType == armorType; ++ return ((ItemArmor)this).field_77881_a == armorType; + } + + if (armorType == 0) + { -+ return this == Item.getItemFromBlock(Blocks.pumpkin) || this == Items.skull; ++ return this == Item.func_150898_a(Blocks.field_150423_aK) || this == Items.field_151144_bL; + } + + return false; @@ -460,7 +460,7 @@ + */ + public int getDamage(ItemStack stack) + { -+ return stack.itemDamage; ++ return stack.field_77991_e; + } + + /** @@ -470,7 +470,7 @@ + */ + public int getMetadata(ItemStack stack) + { -+ return stack.itemDamage; ++ return stack.field_77991_e; + } + + /** @@ -483,7 +483,7 @@ + */ + public boolean showDurabilityBar(ItemStack stack) + { -+ return stack.isItemDamaged(); ++ return stack.func_77951_h(); + } + + /** @@ -494,7 +494,7 @@ + */ + public double getDurabilityForDisplay(ItemStack stack) + { -+ return (double)stack.getItemDamage() / (double)stack.getMaxDamage(); ++ return (double)stack.func_77952_i() / (double)stack.func_77958_k(); + } + + /** @@ -506,7 +506,7 @@ + */ + public int getMaxDamage(ItemStack stack) + { -+ return getMaxDamage(); ++ return func_77612_l(); + } + + /** @@ -516,7 +516,7 @@ + */ + public boolean isDamaged(ItemStack stack) + { -+ return stack.itemDamage > 0; ++ return stack.field_77991_e > 0; + } + + /** @@ -526,11 +526,11 @@ + */ + public void setDamage(ItemStack stack, int damage) + { -+ stack.itemDamage = damage; ++ stack.field_77991_e = damage; + -+ if (stack.itemDamage < 0) ++ if (stack.field_77991_e < 0) + { -+ stack.itemDamage = 0; ++ stack.field_77991_e = 0; + } + } + @@ -542,7 +542,7 @@ + */ + public boolean canHarvestBlock(Block par1Block, ItemStack itemStack) + { -+ return canHarvestBlock(par1Block); ++ return func_150897_b(par1Block); + } + + /** @@ -554,7 +554,7 @@ + */ + public int getItemStackLimit(ItemStack stack) + { -+ return this.getItemStackLimit(); ++ return this.func_77639_j(); + } + + private java.util.Map toolClasses = new java.util.HashMap(); @@ -604,7 +604,7 @@ + */ + public int getItemEnchantability(ItemStack stack) + { -+ return getItemEnchantability(); ++ return func_77619_b(); + } + + /** @@ -614,7 +614,7 @@ + */ + public boolean isBeaconPayment(ItemStack stack) + { -+ return this == Items.emerald || this == Items.diamond || this == Items.gold_ingot || this == Items.iron_ingot; ++ return this == Items.field_151166_bC || this == Items.field_151045_i || this == Items.field_151043_k || this == Items.field_151042_j; + } + + @@ -629,39 +629,39 @@ + */ + public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) + { -+ return !ItemStack.areItemStacksEqual(oldStack, newStack); ++ return !ItemStack.func_77989_b(oldStack, newStack); + } + /* ======================================== FORGE END =====================================*/ + - public static void registerItems() + public static void func_150900_l() { - registerItemBlock(Blocks.stone, (new ItemMultiTexture(Blocks.stone, Blocks.stone, new Function() + func_179214_a(Blocks.field_150348_b, (new ItemMultiTexture(Blocks.field_150348_b, Blocks.field_150348_b, new Function() @@ -855,6 +1431,10 @@ - private final float damageVsEntity; - private final int enchantability; + private final float field_78011_i; + private final int field_78008_j; + //Added by forge for custom Tool materials. + @Deprecated public Item customCraftingMaterial = null; // Remote in 1.8.1 + private ItemStack repairMaterial = null; + - private ToolMaterial(int harvestLevel, int maxUses, float efficiency, float damageVsEntity, int enchantability) + private ToolMaterial(int p_i1874_3_, int p_i1874_4_, float p_i1874_5_, float p_i1874_6_, int p_i1874_7_) { - this.harvestLevel = harvestLevel; + this.field_78001_f = p_i1874_3_; @@ -889,9 +1469,36 @@ - return this.enchantability; + return this.field_78008_j; } + @Deprecated // Use getRepairItemStack below - public Item getRepairItem() + public Item func_150995_f() { -- return this == WOOD ? Item.getItemFromBlock(Blocks.planks) : (this == STONE ? Item.getItemFromBlock(Blocks.cobblestone) : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == EMERALD ? Items.diamond : null)))); +- return this == WOOD ? Item.func_150898_a(Blocks.field_150344_f) : (this == STONE ? Item.func_150898_a(Blocks.field_150347_e) : (this == GOLD ? Items.field_151043_k : (this == IRON ? Items.field_151042_j : (this == EMERALD ? Items.field_151045_i : null)))); + switch (this) + { -+ case WOOD: return Item.getItemFromBlock(Blocks.planks); -+ case STONE: return Item.getItemFromBlock(Blocks.cobblestone); -+ case GOLD: return Items.gold_ingot; -+ case IRON: return Items.iron_ingot; -+ case EMERALD: return Items.diamond; ++ case WOOD: return Item.func_150898_a(Blocks.field_150344_f); ++ case STONE: return Item.func_150898_a(Blocks.field_150347_e); ++ case GOLD: return Items.field_151043_k; ++ case IRON: return Items.field_151042_j; ++ case EMERALD: return Items.field_151045_i; + default: return customCraftingMaterial; + } } @@ -671,14 +671,14 @@ + if (this.repairMaterial != null || customCraftingMaterial != null) throw new RuntimeException("Can not change already set repair material"); + if (this == WOOD || this == STONE || this == GOLD || this == IRON || this == EMERALD) throw new RuntimeException("Can not change vanilla tool repair materials"); + this.repairMaterial = stack; -+ this.customCraftingMaterial = stack.getItem(); ++ this.customCraftingMaterial = stack.func_77973_b(); + return this; + } + + public ItemStack getRepairItemStack() + { + if (repairMaterial != null) return repairMaterial; -+ Item ret = this.getRepairItem(); ++ Item ret = this.func_150995_f(); + if (ret == null) return null; + repairMaterial = new ItemStack(ret, 1, net.minecraftforge.oredict.OreDictionary.WILDCARD_VALUE); + return repairMaterial; diff --git a/patches/minecraft/net/minecraft/item/ItemArmor.java.patch b/patches/minecraft/net/minecraft/item/ItemArmor.java.patch index de61a14ac..c81e15e77 100644 --- a/patches/minecraft/net/minecraft/item/ItemArmor.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemArmor.java.patch @@ -6,40 +6,40 @@ EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0); - int l = entitylivingbase instanceof EntityPlayer ? 1 : 0; + int l = 0;// Forge: We fix the indexes. Mojang Stop hard coding this! - int i1 = EntityLiving.getArmorPosition(stack); - ItemStack itemstack = stack.copy(); - itemstack.stackSize = 1; + int i1 = EntityLiving.func_82159_b(p_82487_2_); + ItemStack itemstack = p_82487_2_.func_77946_l(); + itemstack.field_77994_a = 1; @@ -190,7 +190,7 @@ if (itemstack == null) { -- playerIn.setCurrentItemOrArmor(i, itemStackIn.copy()); -+ playerIn.setCurrentItemOrArmor(i + 1, itemStackIn.copy()); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. - itemStackIn.stackSize = 0; +- p_77659_3_.func_70062_b(i, p_77659_1_.func_77946_l()); ++ p_77659_3_.func_70062_b(i + 1, p_77659_1_.func_77946_l()); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. + p_77659_1_.field_77994_a = 0; } @@ -210,6 +210,9 @@ - private final int[] damageReductionAmountArray; - private final int enchantability; + private final int[] field_78049_g; + private final int field_78055_h; + //Added by forge for custom Armor materials. + public Item customCraftingMaterial = null; + - private ArmorMaterial(String name, int p_i45789_4_, int[] reductionAmounts, int enchantability) + private ArmorMaterial(String p_i45789_3_, int p_i45789_4_, int[] p_i45789_5_, int p_i45789_6_) { - this.name = name; + this.field_179243_f = p_i45789_3_; @@ -235,7 +238,15 @@ - public Item getRepairItem() + public Item func_151685_b() { -- return this == LEATHER ? Items.leather : (this == CHAIN ? Items.iron_ingot : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == DIAMOND ? Items.diamond : null)))); +- return this == LEATHER ? Items.field_151116_aA : (this == CHAIN ? Items.field_151042_j : (this == GOLD ? Items.field_151043_k : (this == IRON ? Items.field_151042_j : (this == DIAMOND ? Items.field_151045_i : null)))); + switch (this) + { -+ case LEATHER: return Items.leather; -+ case CHAIN: return Items.iron_ingot; -+ case GOLD: return Items.gold_ingot; -+ case IRON: return Items.iron_ingot; -+ case DIAMOND: return Items.diamond; ++ case LEATHER: return Items.field_151116_aA; ++ case CHAIN: return Items.field_151042_j; ++ case GOLD: return Items.field_151043_k; ++ case IRON: return Items.field_151042_j; ++ case DIAMOND: return Items.field_151045_i; + default: return customCraftingMaterial; + } } diff --git a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch index cf8cc6de1..88d2705ae 100644 --- a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch @@ -1,26 +1,26 @@ --- ../src-base/minecraft/net/minecraft/item/ItemBlock.java +++ ../src-work/minecraft/net/minecraft/item/ItemBlock.java @@ -54,16 +54,8 @@ - int i = this.getMetadata(stack.getMetadata()); - IBlockState iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, i, playerIn); + int i = this.func_77647_b(p_180614_1_.func_77960_j()); + IBlockState iblockstate1 = this.field_150939_a.func_180642_a(p_180614_3_, p_180614_4_, p_180614_5_, p_180614_6_, p_180614_7_, p_180614_8_, i, p_180614_2_); -- if (worldIn.setBlockState(pos, iblockstate1, 3)) -+ if (placeBlockAt(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ, iblockstate1)) +- if (p_180614_3_.func_180501_a(p_180614_4_, iblockstate1, 3)) ++ if (placeBlockAt(p_180614_1_, p_180614_2_, p_180614_3_, p_180614_4_, p_180614_5_, p_180614_6_, p_180614_7_, p_180614_8_, iblockstate1)) { -- iblockstate1 = worldIn.getBlockState(pos); +- iblockstate1 = p_180614_3_.func_180495_p(p_180614_4_); - -- if (iblockstate1.getBlock() == this.block) +- if (iblockstate1.func_177230_c() == this.field_150939_a) - { -- setTileEntityNBT(worldIn, playerIn, pos, stack); -- this.block.onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack); +- func_179224_a(p_180614_3_, p_180614_2_, p_180614_4_, p_180614_1_); +- this.field_150939_a.func_180633_a(p_180614_3_, p_180614_4_, iblockstate1, p_180614_2_, p_180614_1_); - } - - worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), this.block.stepSound.getPlaceSound(), (this.block.stepSound.getVolume() + 1.0F) / 2.0F, this.block.stepSound.getFrequency() * 0.8F); - --stack.stackSize; + p_180614_3_.func_72908_a((double)((float)p_180614_4_.func_177958_n() + 0.5F), (double)((float)p_180614_4_.func_177956_o() + 0.5F), (double)((float)p_180614_4_.func_177952_p() + 0.5F), this.field_150939_a.field_149762_H.func_150496_b(), (this.field_150939_a.field_149762_H.func_150497_c() + 1.0F) / 2.0F, this.field_150939_a.field_149762_H.func_150494_d() * 0.8F); + --p_180614_1_.field_77994_a; } @@ -162,4 +154,26 @@ { - return this.block; + return this.field_150939_a; } + + /** @@ -33,13 +33,13 @@ + */ + public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) + { -+ if (!world.setBlockState(pos, newState, 3)) return false; ++ if (!world.func_180501_a(pos, newState, 3)) return false; + -+ IBlockState state = world.getBlockState(pos); -+ if (state.getBlock() == this.block) ++ IBlockState state = world.func_180495_p(pos); ++ if (state.func_177230_c() == this.field_150939_a) + { -+ setTileEntityNBT(world, player, pos, stack); -+ this.block.onBlockPlacedBy(world, pos, state, player, stack); ++ func_179224_a(world, player, pos, stack); ++ this.field_150939_a.func_180633_a(world, pos, state, player, stack); + } + + return true; diff --git a/patches/minecraft/net/minecraft/item/ItemBow.java.patch b/patches/minecraft/net/minecraft/item/ItemBow.java.patch index 751ab8367..098450a80 100644 --- a/patches/minecraft/net/minecraft/item/ItemBow.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBow.java.patch @@ -1,10 +1,10 @@ --- ../src-base/minecraft/net/minecraft/item/ItemBow.java +++ ../src-work/minecraft/net/minecraft/item/ItemBow.java @@ -27,6 +27,9 @@ - if (flag || playerIn.inventory.hasItem(Items.arrow)) + if (flag || p_77615_3_.field_71071_by.func_146028_b(Items.field_151032_g)) { - int i = this.getMaxItemUseDuration(stack) - timeLeft; -+ net.minecraftforge.event.entity.player.ArrowLooseEvent event = new net.minecraftforge.event.entity.player.ArrowLooseEvent(playerIn, stack, i); + int i = this.func_77626_a(p_77615_1_) - p_77615_4_; ++ net.minecraftforge.event.entity.player.ArrowLooseEvent event = new net.minecraftforge.event.entity.player.ArrowLooseEvent(p_77615_3_, p_77615_1_, i); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; + i = event.charge; float f = (float)i / 20.0F; @@ -12,11 +12,11 @@ @@ -104,6 +107,9 @@ - public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + public ItemStack func_77659_a(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) { -+ net.minecraftforge.event.entity.player.ArrowNockEvent event = new net.minecraftforge.event.entity.player.ArrowNockEvent(playerIn, itemStackIn); ++ net.minecraftforge.event.entity.player.ArrowNockEvent event = new net.minecraftforge.event.entity.player.ArrowNockEvent(p_77659_3_, p_77659_1_); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return event.result; + - if (playerIn.capabilities.isCreativeMode || playerIn.inventory.hasItem(Items.arrow)) + if (p_77659_3_.field_71075_bZ.field_75098_d || p_77659_3_.field_71071_by.func_146028_b(Items.field_151032_g)) { - playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn)); + p_77659_3_.func_71008_a(p_77659_1_, this.func_77626_a(p_77659_1_)); diff --git a/patches/minecraft/net/minecraft/item/ItemBucket.java.patch b/patches/minecraft/net/minecraft/item/ItemBucket.java.patch index 490b21677..b2f98aa45 100644 --- a/patches/minecraft/net/minecraft/item/ItemBucket.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBucket.java.patch @@ -4,9 +4,9 @@ } else { -+ ItemStack ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(playerIn, worldIn, itemStackIn, movingobjectposition); ++ ItemStack ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(p_77659_3_, p_77659_2_, p_77659_1_, movingobjectposition); + if (ret != null) return ret; + - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + if (movingobjectposition.field_72313_a == MovingObjectPosition.MovingObjectType.BLOCK) { - BlockPos blockpos = movingobjectposition.getBlockPos(); + BlockPos blockpos = movingobjectposition.func_178782_a(); diff --git a/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch b/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch index e1b1013f4..a14a80107 100644 --- a/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBucketMilk.java.patch @@ -2,10 +2,10 @@ +++ ../src-work/minecraft/net/minecraft/item/ItemBucketMilk.java @@ -23,7 +23,7 @@ - if (!worldIn.isRemote) + if (!p_77654_2_.field_72995_K) { -- playerIn.clearActivePotions(); -+ playerIn.curePotionEffects(stack); +- p_77654_3_.func_70674_bp(); ++ p_77654_3_.curePotionEffects(p_77654_1_); } - playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + p_77654_3_.func_71029_a(StatList.field_75929_E[Item.func_150891_b(this)]); diff --git a/patches/minecraft/net/minecraft/item/ItemDye.java.patch b/patches/minecraft/net/minecraft/item/ItemDye.java.patch index fa9033555..a698baa69 100644 --- a/patches/minecraft/net/minecraft/item/ItemDye.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemDye.java.patch @@ -4,53 +4,53 @@ if (enumdyecolor == EnumDyeColor.WHITE) { -- if (applyBonemeal(stack, worldIn, pos)) -+ if (applyBonemeal(stack, worldIn, pos, playerIn)) +- if (func_179234_a(p_180614_1_, p_180614_3_, p_180614_4_)) ++ if (applyBonemeal(p_180614_1_, p_180614_3_, p_180614_4_, p_180614_2_)) { - if (!worldIn.isRemote) + if (!p_180614_3_.field_72995_K) { @@ -97,8 +97,18 @@ - public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target) + public static boolean func_179234_a(ItemStack p_179234_0_, World p_179234_1_, BlockPos p_179234_2_) { -+ if (worldIn instanceof net.minecraft.world.WorldServer) -+ return applyBonemeal(stack, worldIn, target, net.minecraftforge.common.util.FakePlayerFactory.getMinecraft((net.minecraft.world.WorldServer)worldIn)); ++ if (p_179234_1_ instanceof net.minecraft.world.WorldServer) ++ return applyBonemeal(p_179234_0_, p_179234_1_, p_179234_2_, net.minecraftforge.common.util.FakePlayerFactory.getMinecraft((net.minecraft.world.WorldServer)p_179234_1_)); + return false; + } + -+ public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target, EntityPlayer player) ++ public static boolean applyBonemeal(ItemStack p_179234_0_, World p_179234_1_, BlockPos p_179234_2_, EntityPlayer player) + { - IBlockState iblockstate = worldIn.getBlockState(target); + IBlockState iblockstate = p_179234_1_.func_180495_p(p_179234_2_); -+ int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, worldIn, target, iblockstate, stack); ++ int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, p_179234_1_, p_179234_2_, iblockstate, p_179234_0_); + if (hook != 0) return hook > 0; + - if (iblockstate.getBlock() instanceof IGrowable) + if (iblockstate.func_177230_c() instanceof IGrowable) { - IGrowable igrowable = (IGrowable)iblockstate.getBlock(); + IGrowable igrowable = (IGrowable)iblockstate.func_177230_c(); @@ -132,7 +142,7 @@ - Block block = worldIn.getBlockState(pos).getBlock(); + Block block = p_180617_0_.func_180495_p(p_180617_1_).func_177230_c(); -- if (block.getMaterial() != Material.air) -+ if (block.isAir(worldIn, pos)) +- if (block.func_149688_o() != Material.field_151579_a) ++ if (block.isAir(p_180617_0_, p_180617_1_)) { - block.setBlockBoundsBasedOnState(worldIn, pos); + block.func_180654_a(p_180617_0_, p_180617_1_); @@ -144,6 +154,16 @@ - worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)pos.getX() + itemRand.nextFloat()), (double)pos.getY() + (double)itemRand.nextFloat() * block.getBlockBoundsMaxY(), (double)((float)pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]); + p_180617_0_.func_175688_a(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)p_180617_1_.func_177958_n() + field_77697_d.nextFloat()), (double)p_180617_1_.func_177956_o() + (double)field_77697_d.nextFloat() * block.func_149669_A(), (double)((float)p_180617_1_.func_177952_p() + field_77697_d.nextFloat()), d0, d1, d2, new int[0]); } } + else + { -+ for (int i1 = 0; i1 < amount; ++i1) ++ for (int i1 = 0; i1 < p_180617_2_; ++i1) + { -+ double d0 = itemRand.nextGaussian() * 0.02D; -+ double d1 = itemRand.nextGaussian() * 0.02D; -+ double d2 = itemRand.nextGaussian() * 0.02D; -+ worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)pos.getX() + itemRand.nextFloat()), (double)pos.getY() + (double)itemRand.nextFloat() * 1.0f, (double)((float)pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]); ++ double d0 = field_77697_d.nextGaussian() * 0.02D; ++ double d1 = field_77697_d.nextGaussian() * 0.02D; ++ double d2 = field_77697_d.nextGaussian() * 0.02D; ++ p_180617_0_.func_175688_a(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)p_180617_1_.func_177958_n() + field_77697_d.nextFloat()), (double)p_180617_1_.func_177956_o() + (double)field_77697_d.nextFloat() * 1.0f, (double)((float)p_180617_1_.func_177952_p() + field_77697_d.nextFloat()), d0, d1, d2, new int[0]); + } + } } - public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target) + public boolean func_111207_a(ItemStack p_111207_1_, EntityPlayer p_111207_2_, EntityLivingBase p_111207_3_) diff --git a/patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch b/patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch index 2707df433..aaf05d09d 100644 --- a/patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/item/ItemEmptyMap.java +++ ../src-work/minecraft/net/minecraft/item/ItemEmptyMap.java @@ -22,7 +22,7 @@ - worldIn.setItemData(s, mapdata); - mapdata.scale = 0; - mapdata.func_176054_a(playerIn.posX, playerIn.posZ, mapdata.scale); -- mapdata.dimension = (byte)worldIn.provider.getDimensionId(); -+ mapdata.dimension = worldIn.provider.getDimensionId(); - mapdata.markDirty(); - --itemStackIn.stackSize; + p_77659_2_.func_72823_a(s, mapdata); + mapdata.field_76197_d = 0; + mapdata.func_176054_a(p_77659_3_.field_70165_t, p_77659_3_.field_70161_v, mapdata.field_76197_d); +- mapdata.field_76200_c = (byte)p_77659_2_.field_73011_w.func_177502_q(); ++ mapdata.field_76200_c = p_77659_2_.field_73011_w.func_177502_q(); + mapdata.func_76185_a(); + --p_77659_1_.field_77994_a; diff --git a/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch b/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch index 17bd77146..624bf5ffc 100644 --- a/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch @@ -4,8 +4,8 @@ } else { -- if (worldIn.getBlockState(pos).getBlock().getMaterial() == Material.air) -+ if (worldIn.isAirBlock(pos)) +- if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().func_149688_o() == Material.field_151579_a) ++ if (p_180614_3_.func_175623_d(p_180614_4_)) { - worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); - worldIn.setBlockState(pos, Blocks.fire.getDefaultState()); + p_180614_3_.func_72908_a((double)p_180614_4_.func_177958_n() + 0.5D, (double)p_180614_4_.func_177956_o() + 0.5D, (double)p_180614_4_.func_177952_p() + 0.5D, "fire.ignite", 1.0F, field_77697_d.nextFloat() * 0.4F + 0.8F); + p_180614_3_.func_175656_a(p_180614_4_, Blocks.field_150480_ab.func_176223_P()); diff --git a/patches/minecraft/net/minecraft/item/ItemHoe.java.patch b/patches/minecraft/net/minecraft/item/ItemHoe.java.patch index 28920005f..3d3e201ef 100644 --- a/patches/minecraft/net/minecraft/item/ItemHoe.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemHoe.java.patch @@ -4,14 +4,14 @@ } else { -+ int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(stack, playerIn, worldIn, pos); ++ int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(p_180614_1_, p_180614_2_, p_180614_3_, p_180614_4_); + if (hook != 0) return hook > 0; + - IBlockState iblockstate = worldIn.getBlockState(pos); - Block block = iblockstate.getBlock(); + IBlockState iblockstate = p_180614_3_.func_180495_p(p_180614_4_); + Block block = iblockstate.func_177230_c(); -- if (side != EnumFacing.DOWN && worldIn.getBlockState(pos.up()).getBlock().getMaterial() == Material.air) -+ if (side != EnumFacing.DOWN && worldIn.isAirBlock(pos.up())) +- if (p_180614_5_ != EnumFacing.DOWN && p_180614_3_.func_180495_p(p_180614_4_.func_177984_a()).func_177230_c().func_149688_o() == Material.field_151579_a) ++ if (p_180614_5_ != EnumFacing.DOWN && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) { - if (block == Blocks.grass) + if (block == Blocks.field_150349_c) { diff --git a/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch b/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch index 86d27a443..e0bd7c80c 100644 --- a/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch @@ -2,16 +2,16 @@ +++ ../src-work/minecraft/net/minecraft/item/ItemLilyPad.java @@ -49,7 +49,14 @@ - if (iblockstate.getBlock().getMaterial() == Material.water && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.isAirBlock(blockpos1)) + if (iblockstate.func_177230_c().func_149688_o() == Material.field_151586_h && ((Integer)iblockstate.func_177229_b(BlockLiquid.field_176367_b)).intValue() == 0 && p_77659_2_.func_175623_d(blockpos1)) { + // special case for handling block placement with water lilies -+ net.minecraftforge.common.util.BlockSnapshot blocksnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(worldIn, blockpos1); - worldIn.setBlockState(blockpos1, Blocks.waterlily.getDefaultState()); -+ if (net.minecraftforge.event.ForgeEventFactory.onPlayerBlockPlace(playerIn, blocksnapshot, net.minecraft.util.EnumFacing.UP).isCanceled()) ++ net.minecraftforge.common.util.BlockSnapshot blocksnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(p_77659_2_, blockpos1); + p_77659_2_.func_175656_a(blockpos1, Blocks.field_150392_bi.func_176223_P()); ++ if (net.minecraftforge.event.ForgeEventFactory.onPlayerBlockPlace(p_77659_3_, blocksnapshot, net.minecraft.util.EnumFacing.UP).isCanceled()) + { + blocksnapshot.restore(true, false); -+ return itemStackIn; ++ return p_77659_1_; + } - if (!playerIn.capabilities.isCreativeMode) + if (!p_77659_3_.field_71075_bZ.field_75098_d) { diff --git a/patches/minecraft/net/minecraft/item/ItemMap.java.patch b/patches/minecraft/net/minecraft/item/ItemMap.java.patch index bd169ec19..c8f63dba2 100644 --- a/patches/minecraft/net/minecraft/item/ItemMap.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemMap.java.patch @@ -2,10 +2,10 @@ +++ ../src-work/minecraft/net/minecraft/item/ItemMap.java @@ -57,7 +57,7 @@ mapdata = new MapData(s); - mapdata.scale = 3; - mapdata.func_176054_a((double)worldIn.getWorldInfo().getSpawnX(), (double)worldIn.getWorldInfo().getSpawnZ(), mapdata.scale); -- mapdata.dimension = (byte)worldIn.provider.getDimensionId(); -+ mapdata.dimension = worldIn.provider.getDimensionId(); - mapdata.markDirty(); - worldIn.setItemData(s, mapdata); + mapdata.field_76197_d = 3; + mapdata.func_176054_a((double)p_77873_2_.func_72912_H().func_76079_c(), (double)p_77873_2_.func_72912_H().func_76074_e(), mapdata.field_76197_d); +- mapdata.field_76200_c = (byte)p_77873_2_.field_73011_w.func_177502_q(); ++ mapdata.field_76200_c = p_77873_2_.field_73011_w.func_177502_q(); + mapdata.func_76185_a(); + p_77873_2_.func_72823_a(s, mapdata); } diff --git a/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch b/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch index 1af20c125..a376bad96 100644 --- a/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch @@ -1,47 +1,47 @@ --- ../src-base/minecraft/net/minecraft/item/ItemMonsterPlacer.java +++ ../src-work/minecraft/net/minecraft/item/ItemMonsterPlacer.java @@ -36,7 +36,7 @@ - public String getItemStackDisplayName(ItemStack stack) + public String func_77653_i(ItemStack p_77653_1_) { - String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim(); -- String s1 = EntityList.getStringFromID(stack.getMetadata()); -+ String s1 = ItemMonsterPlacer.getEntityName(stack); + String s = ("" + StatCollector.func_74838_a(this.func_77658_a() + ".name")).trim(); +- String s1 = EntityList.func_75617_a(p_77653_1_.func_77960_j()); ++ String s1 = ItemMonsterPlacer.getEntityName(p_77653_1_); if (s1 != null) { @@ -49,7 +49,7 @@ @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack stack, int renderPass) + public int func_82790_a(ItemStack p_82790_1_, int p_82790_2_) { -- EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(stack.getMetadata())); -+ EntityList.EntityEggInfo entitylist$entityegginfo = ItemMonsterPlacer.getEggInfo(stack); - return entitylist$entityegginfo != null ? (renderPass == 0 ? entitylist$entityegginfo.primaryColor : entitylist$entityegginfo.secondaryColor) : 16777215; +- EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.field_75627_a.get(Integer.valueOf(p_82790_1_.func_77960_j())); ++ EntityList.EntityEggInfo entitylist$entityegginfo = ItemMonsterPlacer.getEggInfo(p_82790_1_); + return entitylist$entityegginfo != null ? (p_82790_2_ == 0 ? entitylist$entityegginfo.field_75611_b : entitylist$entityegginfo.field_75612_c) : 16777215; } @@ -74,7 +74,7 @@ if (tileentity instanceof TileEntityMobSpawner) { - MobSpawnerBaseLogic mobspawnerbaselogic = ((TileEntityMobSpawner)tileentity).getSpawnerBaseLogic(); -- mobspawnerbaselogic.setEntityName(EntityList.getStringFromID(stack.getMetadata())); -+ mobspawnerbaselogic.setEntityName(ItemMonsterPlacer.getEntityName(stack)); - tileentity.markDirty(); - worldIn.markBlockForUpdate(pos); + MobSpawnerBaseLogic mobspawnerbaselogic = ((TileEntityMobSpawner)tileentity).func_145881_a(); +- mobspawnerbaselogic.func_98272_a(EntityList.func_75617_a(p_180614_1_.func_77960_j())); ++ mobspawnerbaselogic.func_98272_a(ItemMonsterPlacer.getEntityName(p_180614_1_)); + tileentity.func_70296_d(); + p_180614_3_.func_175689_h(p_180614_4_); @@ -95,7 +95,7 @@ d0 = 0.5D; } -- Entity entity = spawnCreature(worldIn, stack.getMetadata(), (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D); -+ Entity entity = spawnCreature(worldIn, ItemMonsterPlacer.getEntityName(stack), (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D); +- Entity entity = func_77840_a(p_180614_3_, p_180614_1_.func_77960_j(), (double)p_180614_4_.func_177958_n() + 0.5D, (double)p_180614_4_.func_177956_o() + d0, (double)p_180614_4_.func_177952_p() + 0.5D); ++ Entity entity = spawnCreature(p_180614_3_, ItemMonsterPlacer.getEntityName(p_180614_1_), (double)p_180614_4_.func_177958_n() + 0.5D, (double)p_180614_4_.func_177956_o() + d0, (double)p_180614_4_.func_177952_p() + 0.5D); if (entity != null) { @@ -146,7 +146,7 @@ - if (worldIn.getBlockState(blockpos).getBlock() instanceof BlockLiquid) + if (p_77659_2_.func_180495_p(blockpos).func_177230_c() instanceof BlockLiquid) { -- Entity entity = spawnCreature(worldIn, itemStackIn.getMetadata(), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D); -+ Entity entity = spawnCreature(worldIn, ItemMonsterPlacer.getEntityName(itemStackIn), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D); +- Entity entity = func_77840_a(p_77659_2_, p_77659_1_.func_77960_j(), (double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D); ++ Entity entity = spawnCreature(p_77659_2_, ItemMonsterPlacer.getEntityName(p_77659_1_), (double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.5D, (double)blockpos.func_177952_p() + 0.5D); if (entity != null) { @@ -50,18 +50,18 @@ } + @Deprecated // Use string version below. - public static Entity spawnCreature(World worldIn, int entityID, double x, double y, double z) + public static Entity func_77840_a(World p_77840_0_, int p_77840_1_, double p_77840_2_, double p_77840_4_, double p_77840_6_) { - if (!EntityList.entityEggs.containsKey(Integer.valueOf(entityID))) + if (!EntityList.field_75627_a.containsKey(Integer.valueOf(p_77840_1_))) { return null; } -+ return spawnCreature(worldIn, EntityList.getStringFromID(entityID), x, y, z); ++ return spawnCreature(p_77840_0_, EntityList.func_75617_a(p_77840_1_), p_77840_2_, p_77840_4_, p_77840_6_); + } + -+ public static Entity spawnCreature(World worldIn, String name, double x, double y, double z) ++ public static Entity spawnCreature(World p_77840_0_, String name, double p_77840_2_, double p_77840_4_, double p_77840_6_) + { -+ if (!EntityList.stringToClassMapping.containsKey(name)) ++ if (!EntityList.field_75625_b.containsKey(name)) + { + return null; + } @@ -71,37 +71,37 @@ for (int i = 0; i < 1; ++i) { -- entity = EntityList.createEntityByID(entityID, worldIn); -+ entity = EntityList.createEntityByName(name, worldIn); +- entity = EntityList.func_75616_a(p_77840_1_, p_77840_0_); ++ entity = EntityList.func_75620_a(name, p_77840_0_); if (entity instanceof EntityLivingBase) { @@ -207,5 +217,28 @@ { - subItems.add(new ItemStack(itemIn, 1, entitylist$entityegginfo.spawnedID)); + p_150895_3_.add(new ItemStack(p_150895_1_, 1, entitylist$entityegginfo.field_75613_a)); } + + for (String name : net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().keySet()) + { -+ ItemStack stack = new ItemStack(itemIn); ++ ItemStack stack = new ItemStack(p_150895_1_); + net.minecraft.nbt.NBTTagCompound nbt = new net.minecraft.nbt.NBTTagCompound(); -+ nbt.setString("entity_name", name); -+ stack.setTagCompound(nbt); -+ subItems.add(stack); ++ nbt.func_74778_a("entity_name", name); ++ stack.func_77982_d(nbt); ++ p_150895_3_.add(stack); + } } + + public static String getEntityName(ItemStack stack) + { -+ if (stack.hasTagCompound() && stack.getTagCompound().hasKey("entity_name", 8)) -+ return stack.getTagCompound().getString("entity_name"); -+ return EntityList.getStringFromID(stack.getMetadata()); ++ if (stack.func_77942_o() && stack.func_77978_p().func_150297_b("entity_name", 8)) ++ return stack.func_77978_p().func_74779_i("entity_name"); ++ return EntityList.func_75617_a(stack.func_77960_j()); + } + + private static EntityList.EntityEggInfo getEggInfo(ItemStack stack) + { -+ if (stack.hasTagCompound() && stack.getTagCompound().hasKey("entity_name", 8)) -+ return net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(stack.getTagCompound().getString("entity_name")); -+ return (EntityList.EntityEggInfo)EntityList.entityEggs.get(stack.getMetadata()); ++ if (stack.func_77942_o() && stack.func_77978_p().func_150297_b("entity_name", 8)) ++ return net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(stack.func_77978_p().func_74779_i("entity_name")); ++ return (EntityList.EntityEggInfo)EntityList.field_75627_a.get(stack.func_77960_j()); + } } diff --git a/patches/minecraft/net/minecraft/item/ItemRecord.java.patch b/patches/minecraft/net/minecraft/item/ItemRecord.java.patch index e6bf3bf5d..dcafa7df7 100644 --- a/patches/minecraft/net/minecraft/item/ItemRecord.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemRecord.java.patch @@ -2,7 +2,7 @@ +++ ../src-work/minecraft/net/minecraft/item/ItemRecord.java @@ -76,4 +76,15 @@ { - return (ItemRecord)RECORDS.get(name); + return (ItemRecord)field_150928_b.get(p_150926_0_); } + + /** diff --git a/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch b/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch index 53391bf0b..1d4182528 100644 --- a/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch @@ -7,17 +7,17 @@ -public class ItemSeedFood extends ItemFood +public class ItemSeedFood extends ItemFood implements net.minecraftforge.common.IPlantable { - private Block crops; - private Block soilId; + private Block field_150908_b; + private Block field_82809_c; @@ -28,7 +28,7 @@ { return false; } -- else if (worldIn.getBlockState(pos).getBlock() == this.soilId && worldIn.isAirBlock(pos.up())) -+ else if (worldIn.getBlockState(pos).getBlock().canSustainPlant(worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) +- else if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c() == this.field_82809_c && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) ++ else if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().canSustainPlant(p_180614_3_, p_180614_4_, EnumFacing.UP, this) && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) { - worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); - --stack.stackSize; + p_180614_3_.func_175656_a(p_180614_4_.func_177984_a(), this.field_150908_b.func_176223_P()); + --p_180614_1_.field_77994_a; @@ -39,4 +39,16 @@ return false; } @@ -32,6 +32,6 @@ + @Override + public net.minecraft.block.state.IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) + { -+ return this.crops.getDefaultState(); ++ return this.field_150908_b.func_176223_P(); + } } diff --git a/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch b/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch index 053649392..08fd7261b 100644 --- a/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemSeeds.java.patch @@ -7,17 +7,17 @@ -public class ItemSeeds extends Item +public class ItemSeeds extends Item implements net.minecraftforge.common.IPlantable { - private Block crops; - private Block soilBlockID; + private Block field_150925_a; + private Block field_77838_b; @@ -29,7 +29,7 @@ { return false; } -- else if (worldIn.getBlockState(pos).getBlock() == this.soilBlockID && worldIn.isAirBlock(pos.up())) -+ else if (worldIn.getBlockState(pos).getBlock().canSustainPlant(worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) +- else if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c() == this.field_77838_b && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) ++ else if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().canSustainPlant(p_180614_3_, p_180614_4_, EnumFacing.UP, this) && p_180614_3_.func_175623_d(p_180614_4_.func_177984_a())) { - worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); - --stack.stackSize; + p_180614_3_.func_175656_a(p_180614_4_.func_177984_a(), this.field_150925_a.func_176223_P()); + --p_180614_1_.field_77994_a; @@ -40,4 +40,16 @@ return false; } @@ -26,12 +26,12 @@ + @Override + public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) + { -+ return this.crops == net.minecraft.init.Blocks.nether_wart ? net.minecraftforge.common.EnumPlantType.Nether : net.minecraftforge.common.EnumPlantType.Crop; ++ return this.field_150925_a == net.minecraft.init.Blocks.field_150388_bm ? net.minecraftforge.common.EnumPlantType.Nether : net.minecraftforge.common.EnumPlantType.Crop; + } + + @Override + public net.minecraft.block.state.IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) + { -+ return this.crops.getDefaultState(); ++ return this.field_150925_a.func_176223_P(); + } } diff --git a/patches/minecraft/net/minecraft/item/ItemShears.java.patch b/patches/minecraft/net/minecraft/item/ItemShears.java.patch index 6c0e83931..3f6119ca8 100644 --- a/patches/minecraft/net/minecraft/item/ItemShears.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemShears.java.patch @@ -2,50 +2,50 @@ +++ ../src-work/minecraft/net/minecraft/item/ItemShears.java @@ -19,13 +19,12 @@ - public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) + public boolean func_179218_a(ItemStack p_179218_1_, World p_179218_2_, Block p_179218_3_, BlockPos p_179218_4_, EntityLivingBase p_179218_5_) { -- if (blockIn.getMaterial() != Material.leaves && blockIn != Blocks.web && blockIn != Blocks.tallgrass && blockIn != Blocks.vine && blockIn != Blocks.tripwire && blockIn != Blocks.wool) -+ if (blockIn.getMaterial() != Material.leaves && blockIn != Blocks.web && blockIn != Blocks.tallgrass && blockIn != Blocks.vine && blockIn != Blocks.tripwire && blockIn != Blocks.wool && !(blockIn instanceof net.minecraftforge.common.IShearable)) +- if (p_179218_3_.func_149688_o() != Material.field_151584_j && p_179218_3_ != Blocks.field_150321_G && p_179218_3_ != Blocks.field_150329_H && p_179218_3_ != Blocks.field_150395_bd && p_179218_3_ != Blocks.field_150473_bD && p_179218_3_ != Blocks.field_150325_L) ++ if (p_179218_3_.func_149688_o() != Material.field_151584_j && p_179218_3_ != Blocks.field_150321_G && p_179218_3_ != Blocks.field_150329_H && p_179218_3_ != Blocks.field_150395_bd && p_179218_3_ != Blocks.field_150473_bD && p_179218_3_ != Blocks.field_150325_L && !(p_179218_3_ instanceof net.minecraftforge.common.IShearable)) { - return super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn); + return super.func_179218_a(p_179218_1_, p_179218_2_, p_179218_3_, p_179218_4_, p_179218_5_); } else { -- stack.damageItem(1, playerIn); +- p_179218_1_.func_77972_a(1, p_179218_5_); return true; } } @@ -39,4 +38,71 @@ { - return block != Blocks.web && block.getMaterial() != Material.leaves ? (block == Blocks.wool ? 5.0F : super.getStrVsBlock(stack, block)) : 15.0F; + return p_150893_2_ != Blocks.field_150321_G && p_150893_2_.func_149688_o() != Material.field_151584_j ? (p_150893_2_ == Blocks.field_150325_L ? 5.0F : super.func_150893_a(p_150893_1_, p_150893_2_)) : 15.0F; } + + + @Override -+ public boolean itemInteractionForEntity(ItemStack itemstack, net.minecraft.entity.player.EntityPlayer player, EntityLivingBase entity) ++ public boolean func_111207_a(ItemStack itemstack, net.minecraft.entity.player.EntityPlayer player, EntityLivingBase entity) + { -+ if (entity.worldObj.isRemote) ++ if (entity.field_70170_p.field_72995_K) + { + return false; + } + if (entity instanceof net.minecraftforge.common.IShearable) + { + net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)entity; -+ BlockPos pos = new BlockPos(entity.posX, entity.posY, entity.posZ); -+ if (target.isShearable(itemstack, entity.worldObj, pos)) ++ BlockPos pos = new BlockPos(entity.field_70165_t, entity.field_70163_u, entity.field_70161_v); ++ if (target.isShearable(itemstack, entity.field_70170_p, pos)) + { -+ java.util.List drops = target.onSheared(itemstack, entity.worldObj, pos, -+ net.minecraft.enchantment.EnchantmentHelper.getEnchantmentLevel(net.minecraft.enchantment.Enchantment.fortune.effectId, itemstack)); ++ java.util.List drops = target.onSheared(itemstack, entity.field_70170_p, pos, ++ net.minecraft.enchantment.EnchantmentHelper.func_77506_a(net.minecraft.enchantment.Enchantment.field_77346_s.field_77352_x, itemstack)); + + java.util.Random rand = new java.util.Random(); + for(ItemStack stack : drops) + { -+ net.minecraft.entity.item.EntityItem ent = entity.entityDropItem(stack, 1.0F); -+ ent.motionY += rand.nextFloat() * 0.05F; -+ ent.motionX += (rand.nextFloat() - rand.nextFloat()) * 0.1F; -+ ent.motionZ += (rand.nextFloat() - rand.nextFloat()) * 0.1F; ++ net.minecraft.entity.item.EntityItem ent = entity.func_70099_a(stack, 1.0F); ++ ent.field_70181_x += rand.nextFloat() * 0.05F; ++ ent.field_70159_w += (rand.nextFloat() - rand.nextFloat()) * 0.1F; ++ ent.field_70179_y += (rand.nextFloat() - rand.nextFloat()) * 0.1F; + } -+ itemstack.damageItem(1, entity); ++ itemstack.func_77972_a(1, entity); + } + return true; + } @@ -55,18 +55,18 @@ + @Override + public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, net.minecraft.entity.player.EntityPlayer player) + { -+ if (player.worldObj.isRemote || player.capabilities.isCreativeMode) ++ if (player.field_70170_p.field_72995_K || player.field_71075_bZ.field_75098_d) + { + return false; + } -+ Block block = player.worldObj.getBlockState(pos).getBlock(); ++ Block block = player.field_70170_p.func_180495_p(pos).func_177230_c(); + if (block instanceof net.minecraftforge.common.IShearable) + { + net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)block; -+ if (target.isShearable(itemstack, player.worldObj, pos)) ++ if (target.isShearable(itemstack, player.field_70170_p, pos)) + { -+ java.util.List drops = target.onSheared(itemstack, player.worldObj, pos, -+ net.minecraft.enchantment.EnchantmentHelper.getEnchantmentLevel(net.minecraft.enchantment.Enchantment.fortune.effectId, itemstack)); ++ java.util.List drops = target.onSheared(itemstack, player.field_70170_p, pos, ++ net.minecraft.enchantment.EnchantmentHelper.func_77506_a(net.minecraft.enchantment.Enchantment.field_77346_s.field_77352_x, itemstack)); + java.util.Random rand = new java.util.Random(); + + for(ItemStack stack : drops) @@ -75,13 +75,13 @@ + double d = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + double d1 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + double d2 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -+ net.minecraft.entity.item.EntityItem entityitem = new net.minecraft.entity.item.EntityItem(player.worldObj, (double)pos.getX() + d, (double)pos.getY() + d1, (double)pos.getZ() + d2, stack); -+ entityitem.setDefaultPickupDelay(); -+ player.worldObj.spawnEntityInWorld(entityitem); ++ net.minecraft.entity.item.EntityItem entityitem = new net.minecraft.entity.item.EntityItem(player.field_70170_p, (double)pos.func_177958_n() + d, (double)pos.func_177956_o() + d1, (double)pos.func_177952_p() + d2, stack); ++ entityitem.func_174869_p(); ++ player.field_70170_p.func_72838_d(entityitem); + } + -+ itemstack.damageItem(1, player); -+ player.addStat(net.minecraft.stats.StatList.mineBlockStatArray[Block.getIdFromBlock(block)], 1); ++ itemstack.func_77972_a(1, player); ++ player.func_71064_a(net.minecraft.stats.StatList.field_75934_C[Block.func_149682_b(block)], 1); + } + } + return false; diff --git a/patches/minecraft/net/minecraft/item/ItemSkull.java.patch b/patches/minecraft/net/minecraft/item/ItemSkull.java.patch index 4e8acb4a5..0e97068ef 100644 --- a/patches/minecraft/net/minecraft/item/ItemSkull.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemSkull.java.patch @@ -2,30 +2,30 @@ +++ ../src-work/minecraft/net/minecraft/item/ItemSkull.java @@ -34,6 +34,11 @@ - public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean func_180614_a(ItemStack p_180614_1_, EntityPlayer p_180614_2_, World p_180614_3_, BlockPos p_180614_4_, EnumFacing p_180614_5_, float p_180614_6_, float p_180614_7_, float p_180614_8_) { -+ if (worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && side != EnumFacing.DOWN) ++ if (p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().func_176200_f(p_180614_3_, p_180614_4_) && p_180614_5_ != EnumFacing.DOWN) + { -+ side = EnumFacing.UP; -+ pos = pos.down(); ++ p_180614_5_ = EnumFacing.UP; ++ p_180614_4_ = p_180614_4_.func_177977_b(); + } - if (side == EnumFacing.DOWN) + if (p_180614_5_ == EnumFacing.DOWN) { return false; @@ -46,7 +51,7 @@ if (!flag) { -- if (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid()) -+ if (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid() && !worldIn.isSideSolid(pos, side, true)) +- if (!p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().func_149688_o().func_76220_a()) ++ if (!p_180614_3_.func_180495_p(p_180614_4_).func_177230_c().func_149688_o().func_76220_a() && !p_180614_3_.isSideSolid(p_180614_4_, p_180614_5_, true)) { return false; } @@ -66,6 +71,7 @@ { - if (!worldIn.isRemote) + if (!p_180614_3_.field_72995_K) { -+ if (!Blocks.skull.canPlaceBlockOnSide(worldIn, pos, side)) return false; - worldIn.setBlockState(pos, Blocks.skull.getDefaultState().withProperty(BlockSkull.FACING, side), 3); ++ if (!Blocks.field_150465_bP.func_176198_a(p_180614_3_, p_180614_4_, p_180614_5_)) return false; + p_180614_3_.func_180501_a(p_180614_4_, Blocks.field_150465_bP.func_176223_P().func_177226_a(BlockSkull.field_176418_a, p_180614_5_), 3); int i = 0; diff --git a/patches/minecraft/net/minecraft/item/ItemSnow.java.patch b/patches/minecraft/net/minecraft/item/ItemSnow.java.patch index 3d986ba7b..984fba4ed 100644 --- a/patches/minecraft/net/minecraft/item/ItemSnow.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemSnow.java.patch @@ -2,12 +2,12 @@ +++ ../src-work/minecraft/net/minecraft/item/ItemSnow.java @@ -67,4 +67,10 @@ { - return damage; + return p_77647_1_; } + -+ public boolean canPlaceBlockOnSide(World world, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) ++ public boolean func_179222_a(World world, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) + { -+ IBlockState state = world.getBlockState(pos); -+ return (state.getBlock() != net.minecraft.init.Blocks.snow_layer || ((Integer)state.getValue(BlockSnow.LAYERS)) > 7) ? super.canPlaceBlockOnSide(world, pos, side, player, stack) : true; ++ IBlockState state = world.func_180495_p(pos); ++ return (state.func_177230_c() != net.minecraft.init.Blocks.field_150431_aC || ((Integer)state.func_177229_b(BlockSnow.field_176315_a)) > 7) ? super.func_179222_a(world, pos, side, player, stack) : true; + } } diff --git a/patches/minecraft/net/minecraft/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/item/ItemStack.java.patch index 448854d90..8dd896471 100644 --- a/patches/minecraft/net/minecraft/item/ItemStack.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemStack.java.patch @@ -1,131 +1,131 @@ --- ../src-base/minecraft/net/minecraft/item/ItemStack.java +++ ../src-work/minecraft/net/minecraft/item/ItemStack.java @@ -49,6 +49,7 @@ - private Block canPlaceOnCacheBlock; - private boolean canPlaceOnCacheResult; + private Block field_179550_j; + private boolean field_179551_k; + private net.minecraftforge.fml.common.registry.RegistryDelegate delegate; - public ItemStack(Block blockIn) + public ItemStack(Block p_i1876_1_) { - this((Block)blockIn, 1); + this((Block)p_i1876_1_, 1); @@ -80,7 +81,7 @@ - this.canDestroyCacheResult = false; - this.canPlaceOnCacheBlock = null; - this.canPlaceOnCacheResult = false; -- this.item = itemIn; -+ this.setItem(itemIn); - this.stackSize = amount; - this.itemDamage = meta; + this.field_179553_i = false; + this.field_179550_j = null; + this.field_179551_k = false; +- this.field_151002_e = p_i1881_1_; ++ this.func_150996_a(p_i1881_1_); + this.field_77994_a = p_i1881_2_; + this.field_77991_e = p_i1881_3_; @@ -120,11 +121,12 @@ - public Item getItem() + public Item func_77973_b() { -- return this.item; +- return this.field_151002_e; + return this.delegate != null ? this.delegate.get() : null; } - public boolean onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean func_179546_a(EntityPlayer p_179546_1_, World p_179546_2_, BlockPos p_179546_3_, EnumFacing p_179546_4_, float p_179546_5_, float p_179546_6_, float p_179546_7_) { -+ if (!worldIn.isRemote) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ); - boolean flag = this.getItem().onItemUse(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ); ++ if (!p_179546_2_.field_72995_K) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(this, p_179546_1_, p_179546_2_, p_179546_3_, p_179546_4_, p_179546_5_, p_179546_6_, p_179546_7_); + boolean flag = this.func_77973_b().func_180614_a(this, p_179546_1_, p_179546_2_, p_179546_3_, p_179546_4_, p_179546_5_, p_179546_6_, p_179546_7_); if (flag) @@ -169,11 +171,11 @@ { - if (nbt.hasKey("id", 8)) + if (p_77963_1_.func_150297_b("id", 8)) { -- this.item = Item.getByNameOrId(nbt.getString("id")); -+ this.setItem(Item.getByNameOrId(nbt.getString("id"))); +- this.field_151002_e = Item.func_111206_d(p_77963_1_.func_74779_i("id")); ++ this.func_150996_a(Item.func_111206_d(p_77963_1_.func_74779_i("id"))); } else { -- this.item = Item.getItemById(nbt.getShort("id")); -+ this.setItem(Item.getItemById(nbt.getShort("id"))); +- this.field_151002_e = Item.func_150899_d(p_77963_1_.func_74765_d("id")); ++ this.func_150996_a(Item.func_150899_d(p_77963_1_.func_74765_d("id"))); } - this.stackSize = nbt.getByte("Count"); + this.field_77994_a = p_77963_1_.func_74771_c("Count"); @@ -197,7 +199,7 @@ - public int getMaxStackSize() + public int func_77976_d() { -- return this.getItem().getItemStackLimit(); -+ return this.getItem().getItemStackLimit(this); +- return this.func_77973_b().func_77639_j(); ++ return this.func_77973_b().getItemStackLimit(this); } - public boolean isStackable() + public boolean func_77985_e() @@ -207,7 +209,7 @@ - public boolean isItemStackDamageable() + public boolean func_77984_f() { -- return this.item == null ? false : (this.item.getMaxDamage() <= 0 ? false : !this.hasTagCompound() || !this.getTagCompound().getBoolean("Unbreakable")); -+ return this.item == null ? false : (this.item.getMaxDamage(this) <= 0 ? false : !this.hasTagCompound() || !this.getTagCompound().getBoolean("Unbreakable")); +- return this.field_151002_e == null ? false : (this.field_151002_e.func_77612_l() <= 0 ? false : !this.func_77942_o() || !this.func_77978_p().func_74767_n("Unbreakable")); ++ return this.field_151002_e == null ? false : (this.field_151002_e.getMaxDamage(this) <= 0 ? false : !this.func_77942_o() || !this.func_77978_p().func_74767_n("Unbreakable")); } - public boolean getHasSubtypes() + public boolean func_77981_g() @@ -217,32 +219,27 @@ - public boolean isItemDamaged() + public boolean func_77951_h() { -- return this.isItemStackDamageable() && this.itemDamage > 0; -+ return this.isItemStackDamageable() && getItem().isDamaged(this); +- return this.func_77984_f() && this.field_77991_e > 0; ++ return this.func_77984_f() && func_77973_b().isDamaged(this); } - public int getItemDamage() + public int func_77952_i() { -- return this.itemDamage; -+ return getItem().getDamage(this); +- return this.field_77991_e; ++ return func_77973_b().getDamage(this); } - public int getMetadata() + public int func_77960_j() { -- return this.itemDamage; -+ return getItem().getMetadata(this); +- return this.field_77991_e; ++ return func_77973_b().getMetadata(this); } - public void setItemDamage(int meta) + public void func_77964_b(int p_77964_1_) { -- this.itemDamage = meta; +- this.field_77991_e = p_77964_1_; - -- if (this.itemDamage < 0) +- if (this.field_77991_e < 0) - { -- this.itemDamage = 0; +- this.field_77991_e = 0; - } -+ getItem().setDamage(this, meta); ++ func_77973_b().setDamage(this, p_77964_1_); } - public int getMaxDamage() + public int func_77958_k() { -- return this.item.getMaxDamage(); -+ return this.item.getMaxDamage(this); +- return this.field_151002_e.func_77612_l(); ++ return this.field_151002_e.getMaxDamage(this); } - public boolean attemptDamageItem(int amount, Random rand) + public boolean func_96631_a(int p_96631_1_, Random p_96631_2_) @@ -274,8 +271,8 @@ } } -- this.itemDamage += amount; -- return this.itemDamage > this.getMaxDamage(); -+ setItemDamage(getItemDamage() + amount); //Redirect through Item's callback if applicable. -+ return getItemDamage() > getMaxDamage(); +- this.field_77991_e += p_96631_1_; +- return this.field_77991_e > this.func_77958_k(); ++ func_77964_b(func_77952_i() + p_96631_1_); //Redirect through Item's callback if applicable. ++ return func_77952_i() > func_77958_k(); } } @@ -334,7 +331,7 @@ - public boolean canHarvestBlock(Block blockIn) + public boolean func_150998_b(Block p_150998_1_) { -- return this.item.canHarvestBlock(blockIn); -+ return getItem().canHarvestBlock(blockIn, this); +- return this.field_151002_e.func_150897_b(p_150998_1_); ++ return func_77973_b().canHarvestBlock(p_150998_1_, this); } - public boolean interactWithEntity(EntityPlayer playerIn, EntityLivingBase entityIn) + public boolean func_111282_a(EntityPlayer p_111282_1_, EntityLivingBase p_111282_2_) @@ -742,6 +739,7 @@ } } -+ net.minecraftforge.event.ForgeEventFactory.onItemTooltip(this, playerIn, list, advanced); ++ net.minecraftforge.event.ForgeEventFactory.onItemTooltip(this, p_82840_1_, list, p_82840_2_); return list; } @@ -133,16 +133,16 @@ } else { -- multimap = this.getItem().getItemAttributeModifiers(); -+ multimap = this.getItem().getAttributeModifiers(this); +- multimap = this.func_77973_b().func_111205_h(); ++ multimap = this.func_77973_b().getAttributeModifiers(this); } return multimap; @@ -860,6 +858,7 @@ - public void setItem(Item newItem) + public void func_150996_a(Item p_150996_1_) { -+ this.delegate = newItem != null ? newItem.delegate : null; - this.item = newItem; ++ this.delegate = p_150996_1_ != null ? p_150996_1_.delegate : null; + this.field_151002_e = p_150996_1_; } diff --git a/patches/minecraft/net/minecraft/item/ItemSword.java.patch b/patches/minecraft/net/minecraft/item/ItemSword.java.patch index 3b7d5e0e0..2b99d22f1 100644 --- a/patches/minecraft/net/minecraft/item/ItemSword.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemSword.java.patch @@ -2,12 +2,12 @@ +++ ../src-work/minecraft/net/minecraft/item/ItemSword.java @@ -101,7 +101,9 @@ - public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) + public boolean func_82789_a(ItemStack p_82789_1_, ItemStack p_82789_2_) { -- return this.material.getRepairItem() == repair.getItem() ? true : super.getIsRepairable(toRepair, repair); -+ ItemStack mat = this.material.getRepairItemStack(); -+ if (mat != null && net.minecraftforge.oredict.OreDictionary.itemMatches(mat, repair, false)) return true; -+ return super.getIsRepairable(toRepair, repair); +- return this.field_150933_b.func_150995_f() == p_82789_2_.func_77973_b() ? true : super.func_82789_a(p_82789_1_, p_82789_2_); ++ ItemStack mat = this.field_150933_b.getRepairItemStack(); ++ if (mat != null && net.minecraftforge.oredict.OreDictionary.itemMatches(mat, p_82789_2_, false)) return true; ++ return super.func_82789_a(p_82789_1_, p_82789_2_); } - public Multimap getItemAttributeModifiers() + public Multimap func_111205_h() diff --git a/patches/minecraft/net/minecraft/item/ItemTool.java.patch b/patches/minecraft/net/minecraft/item/ItemTool.java.patch index cb9392232..2a0e7450b 100644 --- a/patches/minecraft/net/minecraft/item/ItemTool.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemTool.java.patch @@ -1,9 +1,9 @@ --- ../src-base/minecraft/net/minecraft/item/ItemTool.java +++ ../src-work/minecraft/net/minecraft/item/ItemTool.java @@ -28,6 +28,18 @@ - this.efficiencyOnProperMaterial = material.getEfficiencyOnProperMaterial(); - this.damageVsEntity = attackDamage + material.getDamageVsEntity(); - this.setCreativeTab(CreativeTabs.tabTools); + this.field_77864_a = p_i45333_2_.func_77998_b(); + this.field_77865_bY = p_i45333_1_ + p_i45333_2_.func_78000_c(); + this.func_77637_a(CreativeTabs.field_78040_i); + if (this instanceof ItemPickaxe) + { + toolClass = "pickaxe"; @@ -18,20 +18,20 @@ + } } - public float getStrVsBlock(ItemStack stack, Block block) + public float func_150893_a(ItemStack p_150893_1_, Block p_150893_2_) @@ -74,7 +86,9 @@ - public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) + public boolean func_82789_a(ItemStack p_82789_1_, ItemStack p_82789_2_) { -- return this.toolMaterial.getRepairItem() == repair.getItem() ? true : super.getIsRepairable(toRepair, repair); -+ ItemStack mat = this.toolMaterial.getRepairItemStack(); -+ if (mat != null && net.minecraftforge.oredict.OreDictionary.itemMatches(mat, repair, false)) return true; -+ return super.getIsRepairable(toRepair, repair); +- return this.field_77862_b.func_150995_f() == p_82789_2_.func_77973_b() ? true : super.func_82789_a(p_82789_1_, p_82789_2_); ++ ItemStack mat = this.field_77862_b.getRepairItemStack(); ++ if (mat != null && net.minecraftforge.oredict.OreDictionary.itemMatches(mat, p_82789_2_, false)) return true; ++ return super.func_82789_a(p_82789_1_, p_82789_2_); } - public Multimap getItemAttributeModifiers() + public Multimap func_111205_h() @@ -83,4 +97,38 @@ - multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(itemModifierUUID, "Tool modifier", (double)this.damageVsEntity, 0)); + multimap.put(SharedMonsterAttributes.field_111264_e.func_111108_a(), new AttributeModifier(field_111210_e, "Tool modifier", (double)this.field_77865_bY, 0)); return multimap; } + @@ -43,7 +43,7 @@ + int level = super.getHarvestLevel(stack, toolClass); + if (level == -1 && toolClass != null && toolClass.equals(this.toolClass)) + { -+ return this.toolMaterial.getHarvestLevel(); ++ return this.field_77862_b.func_77996_d(); + } + else + { @@ -62,8 +62,8 @@ + { + for (String type : getToolClasses(stack)) + { -+ if (state.getBlock().isToolEffective(type, state)) -+ return efficiencyOnProperMaterial; ++ if (state.func_177230_c().isToolEffective(type, state)) ++ return field_77864_a; + } + return super.getDigSpeed(stack, state); + } diff --git a/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch index 727558622..cd73ea934 100644 --- a/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch @@ -2,19 +2,19 @@ +++ ../src-work/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java @@ -72,6 +72,7 @@ - public void addSmeltingRecipe(ItemStack input, ItemStack stack, float experience) + public void func_151394_a(ItemStack p_151394_1_, ItemStack p_151394_2_, float p_151394_3_) { -+ if (getSmeltingResult(input) != null) { net.minecraftforge.fml.common.FMLLog.info("Ignored smelting recipe with conflicting input: " + input + " = " + stack); return; } - this.smeltingList.put(input, stack); - this.experienceList.put(stack, Float.valueOf(experience)); ++ if (func_151395_a(p_151394_1_) != null) { net.minecraftforge.fml.common.FMLLog.info("Ignored smelting recipe with conflicting input: " + p_151394_1_ + " = " + p_151394_2_); return; } + this.field_77604_b.put(p_151394_1_, p_151394_2_); + this.field_77605_c.put(p_151394_2_, Float.valueOf(p_151394_3_)); } @@ -101,6 +102,9 @@ - public float getSmeltingExperience(ItemStack stack) + public float func_151398_b(ItemStack p_151398_1_) { -+ float ret = stack.getItem().getSmeltingExperience(stack); ++ float ret = p_151398_1_.func_77973_b().getSmeltingExperience(p_151398_1_); + if (ret != -1) return ret; + - for (Entry entry : this.experienceList.entrySet()) + for (Entry entry : this.field_77605_c.entrySet()) { - if (this.compareItemStacks(stack, (ItemStack)entry.getKey())) + if (this.func_151397_a(p_151398_1_, (ItemStack)entry.getKey())) diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch index f35700bf9..4db989adf 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch @@ -2,7 +2,7 @@ +++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeFireworks.java @@ -86,9 +86,9 @@ { - this.field_92102_a = new ItemStack(Items.fireworks); + this.field_92102_a = new ItemStack(Items.field_151152_bP); + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); if (l > 0) @@ -12,24 +12,24 @@ NBTTagList nbttaglist = new NBTTagList(); @@ -105,9 +105,9 @@ - nbttagcompound3.setTag("Explosions", nbttaglist); - nbttagcompound3.setByte("Flight", (byte)j); - nbttagcompound1.setTag("Fireworks", nbttagcompound3); -- this.field_92102_a.setTagCompound(nbttagcompound1); + nbttagcompound3.func_74782_a("Explosions", nbttaglist); + nbttagcompound3.func_74774_a("Flight", (byte)j); + nbttagcompound1.func_74782_a("Fireworks", nbttagcompound3); +- this.field_92102_a.func_77982_d(nbttagcompound1); } -+ this.field_92102_a.setTagCompound(nbttagcompound1); //Forge BugFix: NPE Protection ++ this.field_92102_a.func_77982_d(nbttagcompound1); //Forge BugFix: NPE Protection return true; } else if (j == 1 && i == 0 && l == 0 && k > 0 && j1 <= 1) @@ -249,11 +249,7 @@ for (int i = 0; i < aitemstack.length; ++i) { - ItemStack itemstack = p_179532_1_.getStackInSlot(i); + ItemStack itemstack = p_179532_1_.func_70301_a(i); - -- if (itemstack != null && itemstack.getItem().hasContainerItem()) +- if (itemstack != null && itemstack.func_77973_b().func_77634_r()) - { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); +- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); - } + aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); } diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch index cf7479b97..bda702d1b 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch @@ -4,8 +4,8 @@ { ItemStack itemstack1 = (ItemStack)list.get(0); -- if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isDamageable()) -+ if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isRepairable()) +- if (itemstack.func_77973_b() != itemstack1.func_77973_b() || itemstack1.field_77994_a != 1 || itemstack.field_77994_a != 1 || !itemstack1.func_77973_b().func_77645_m()) ++ if (itemstack.func_77973_b() != itemstack1.func_77973_b() || itemstack1.field_77994_a != 1 || itemstack.field_77994_a != 1 || !itemstack1.func_77973_b().isRepairable()) { return false; } @@ -13,8 +13,8 @@ { ItemStack itemstack1 = (ItemStack)list.get(0); -- if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isDamageable()) -+ if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isRepairable()) +- if (itemstack.func_77973_b() != itemstack1.func_77973_b() || itemstack1.field_77994_a != 1 || itemstack.field_77994_a != 1 || !itemstack1.func_77973_b().func_77645_m()) ++ if (itemstack.func_77973_b() != itemstack1.func_77973_b() || itemstack1.field_77994_a != 1 || itemstack.field_77994_a != 1 || !itemstack1.func_77973_b().isRepairable()) { return null; } @@ -22,19 +22,19 @@ ItemStack itemstack2 = (ItemStack)list.get(0); ItemStack itemstack3 = (ItemStack)list.get(1); -- if (itemstack2.getItem() == itemstack3.getItem() && itemstack2.stackSize == 1 && itemstack3.stackSize == 1 && itemstack2.getItem().isDamageable()) -+ if (itemstack2.getItem() == itemstack3.getItem() && itemstack2.stackSize == 1 && itemstack3.stackSize == 1 && itemstack2.getItem().isRepairable()) +- if (itemstack2.func_77973_b() == itemstack3.func_77973_b() && itemstack2.field_77994_a == 1 && itemstack3.field_77994_a == 1 && itemstack2.func_77973_b().func_77645_m()) ++ if (itemstack2.func_77973_b() == itemstack3.func_77973_b() && itemstack2.field_77994_a == 1 && itemstack3.field_77994_a == 1 && itemstack2.func_77973_b().isRepairable()) { - Item item = itemstack2.getItem(); - int j = item.getMaxDamage() - itemstack2.getItemDamage(); + Item item = itemstack2.func_77973_b(); + int j = item.func_77612_l() - itemstack2.func_77952_i(); @@ -102,11 +102,7 @@ for (int i = 0; i < aitemstack.length; ++i) { - ItemStack itemstack = p_179532_1_.getStackInSlot(i); + ItemStack itemstack = p_179532_1_.func_70301_a(i); - -- if (itemstack != null && itemstack.getItem().hasContainerItem()) +- if (itemstack != null && itemstack.func_77973_b().func_77634_r()) - { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); +- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); - } + aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); } diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch index 24a99a368..15ed231ae 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch @@ -3,11 +3,11 @@ @@ -146,11 +146,7 @@ for (int i = 0; i < aitemstack.length; ++i) { - ItemStack itemstack = p_179532_1_.getStackInSlot(i); + ItemStack itemstack = p_179532_1_.func_70301_a(i); - -- if (itemstack != null && itemstack.getItem().hasContainerItem()) +- if (itemstack != null && itemstack.func_77973_b().func_77634_r()) - { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); +- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); - } + aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); } diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch index 90f95d3d2..bddf21f35 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch @@ -3,11 +3,11 @@ @@ -135,11 +135,7 @@ for (int i = 0; i < aitemstack.length; ++i) { - ItemStack itemstack = p_179532_1_.getStackInSlot(i); + ItemStack itemstack = p_179532_1_.func_70301_a(i); - -- if (itemstack != null && itemstack.getItem().hasContainerItem()) +- if (itemstack != null && itemstack.func_77973_b().func_77634_r()) - { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); +- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); - } + aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); } @@ -17,11 +17,11 @@ if (itemstack != null) { -- if (itemstack.getItem().hasContainerItem()) -+ if (itemstack.getItem().hasContainerItem(itemstack)) +- if (itemstack.func_77973_b().func_77634_r()) ++ if (itemstack.func_77973_b().hasContainerItem(itemstack)) { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); +- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); + aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); } - else if (itemstack.hasTagCompound() && TileEntityBanner.getPatterns(itemstack) > 0) + else if (itemstack.func_77942_o() && TileEntityBanner.func_175113_c(itemstack) > 0) { diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch index ea8e4e664..b67dc5759 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch @@ -3,11 +3,11 @@ @@ -108,11 +108,7 @@ for (int i = 0; i < aitemstack.length; ++i) { - ItemStack itemstack = p_179532_1_.getStackInSlot(i); + ItemStack itemstack = p_179532_1_.func_70301_a(i); - -- if (itemstack != null && itemstack.getItem().hasContainerItem()) +- if (itemstack != null && itemstack.func_77973_b().func_77634_r()) - { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); +- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); - } + aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); } diff --git a/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch index 601a4a1cb..1db66a297 100644 --- a/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch @@ -3,11 +3,11 @@ @@ -33,11 +33,7 @@ for (int i = 0; i < aitemstack.length; ++i) { - ItemStack itemstack = p_179532_1_.getStackInSlot(i); + ItemStack itemstack = p_179532_1_.func_70301_a(i); - -- if (itemstack != null && itemstack.getItem().hasContainerItem()) +- if (itemstack != null && itemstack.func_77973_b().func_77634_r()) - { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); +- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); - } + aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); } diff --git a/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch index 640ed7648..e2155f198 100644 --- a/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch @@ -3,11 +3,11 @@ @@ -29,11 +29,7 @@ for (int i = 0; i < aitemstack.length; ++i) { - ItemStack itemstack = p_179532_1_.getStackInSlot(i); + ItemStack itemstack = p_179532_1_.func_70301_a(i); - -- if (itemstack != null && itemstack.getItem().hasContainerItem()) +- if (itemstack != null && itemstack.func_77973_b().func_77634_r()) - { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); +- aitemstack[i] = new ItemStack(itemstack.func_77973_b().func_77668_q()); - } + aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); } diff --git a/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch index 76f2e6739..400efd0fd 100644 --- a/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch +++ b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch @@ -14,14 +14,14 @@ } - @SideOnly(Side.CLIENT) - public static void safeWrite(NBTTagCompound p_74793_0_, File p_74793_1_) throws IOException + public static void func_74793_a(NBTTagCompound p_74793_0_, File p_74793_1_) throws IOException { File file1 = new File(p_74793_1_.getAbsolutePath() + "_tmp"); @@ -118,6 +115,7 @@ private static NBTBase func_152455_a(DataInput p_152455_0_, int p_152455_1_, NBTSizeTracker p_152455_2_) throws IOException { byte b0 = p_152455_0_.readByte(); -+ p_152455_2_.read(8); // Forge: Count everything! ++ p_152455_2_.func_152450_a(8); // Forge: Count everything! if (b0 == 0) { @@ -31,8 +31,8 @@ { - p_152455_0_.readUTF(); + NBTSizeTracker.readUTF(p_152455_2_, p_152455_0_.readUTF()); //Forge: Count this string. -+ p_152455_2_.read(32); //Forge: 4 extra bytes for the object allocation. - NBTBase nbtbase = NBTBase.createNewByType(b0); ++ p_152455_2_.func_152450_a(32); //Forge: 4 extra bytes for the object allocation. + NBTBase nbtbase = NBTBase.func_150284_a(b0); try @@ -144,7 +143,6 @@ @@ -40,7 +40,7 @@ } - @SideOnly(Side.CLIENT) - public static void write(NBTTagCompound p_74795_0_, File p_74795_1_) throws IOException + public static void func_74795_b(NBTTagCompound p_74795_0_, File p_74795_1_) throws IOException { DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(p_74795_1_)); @@ -159,7 +157,6 @@ @@ -48,6 +48,6 @@ } - @SideOnly(Side.CLIENT) - public static NBTTagCompound read(File p_74797_0_) throws IOException + public static NBTTagCompound func_74797_a(File p_74797_0_) throws IOException { if (!p_74797_0_.exists()) diff --git a/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch b/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch index 078cb5b16..c7720b745 100644 --- a/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch +++ b/patches/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch @@ -1,7 +1,7 @@ --- ../src-base/minecraft/net/minecraft/nbt/NBTSizeTracker.java +++ ../src-work/minecraft/net/minecraft/nbt/NBTSizeTracker.java @@ -25,4 +25,34 @@ - throw new RuntimeException("Tried to read NBT tag that was too big; tried to allocate: " + this.read + "bytes where max allowed: " + this.max); + 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); } } + @@ -18,7 +18,7 @@ + */ + public static void readUTF(NBTSizeTracker tracker, String data) + { -+ tracker.read(16); //Header length ++ tracker.func_152450_a(16); //Header length + if (data == null) + return; + @@ -32,6 +32,6 @@ + else if (c > 0x07FF) utflen += 3; + else utflen += 2; + } -+ tracker.read(8 * utflen); ++ tracker.func_152450_a(8 * utflen); + } } diff --git a/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch b/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch index a5014d15a..8a494fdfb 100644 --- a/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch +++ b/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch @@ -2,17 +2,17 @@ +++ ../src-work/minecraft/net/minecraft/nbt/NBTTagCompound.java @@ -395,6 +395,7 @@ - private static byte readType(DataInput input, NBTSizeTracker sizeTracker) throws IOException + private static byte func_152447_a(DataInput p_152447_0_, NBTSizeTracker p_152447_1_) throws IOException { -+ sizeTracker.read(8); - return input.readByte(); ++ p_152447_1_.func_152450_a(8); + return p_152447_0_.readByte(); } @@ -405,6 +406,7 @@ - static NBTBase readNBT(byte id, String key, DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException + static NBTBase func_152449_a(byte p_152449_0_, String p_152449_1_, DataInput p_152449_2_, int p_152449_3_, NBTSizeTracker p_152449_4_) throws IOException { -+ sizeTracker.read(32); //Forge: 4 extra bytes for the object allocation. - NBTBase nbtbase = NBTBase.createNewByType(id); ++ p_152449_4_.func_152450_a(32); //Forge: 4 extra bytes for the object allocation. + NBTBase nbtbase = NBTBase.func_150284_a(p_152449_0_); try diff --git a/patches/minecraft/net/minecraft/nbt/NBTTagString.java.patch b/patches/minecraft/net/minecraft/nbt/NBTTagString.java.patch index c8ca6ca1a..178a0151b 100644 --- a/patches/minecraft/net/minecraft/nbt/NBTTagString.java.patch +++ b/patches/minecraft/net/minecraft/nbt/NBTTagString.java.patch @@ -2,10 +2,10 @@ +++ ../src-work/minecraft/net/minecraft/nbt/NBTTagString.java @@ -32,7 +32,7 @@ { - sizeTracker.read(288L); - this.data = input.readUTF(); -- sizeTracker.read((long)(16 * this.data.length())); -+ NBTSizeTracker.readUTF(sizeTracker, data); // Forge: Correctly read String length including header. + p_152446_3_.func_152450_a(288L); + this.field_74751_a = p_152446_1_.readUTF(); +- p_152446_3_.func_152450_a((long)(16 * this.field_74751_a.length())); ++ NBTSizeTracker.readUTF(p_152446_3_, field_74751_a); // Forge: Correctly read String length including header. } - public byte getId() + public byte func_74732_a() diff --git a/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch b/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch index dbd27862d..111358910 100644 --- a/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch +++ b/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch @@ -1,56 +1,56 @@ --- ../src-base/minecraft/net/minecraft/network/NetHandlerPlayServer.java +++ ../src-work/minecraft/net/minecraft/network/NetHandlerPlayServer.java @@ -254,6 +254,8 @@ - this.playerEntity.ridingEntity.updateRiderPosition(); + this.field_147369_b.field_70154_o.func_70043_V(); } -+ if (!this.hasMoved) return; //Fixes teleportation kick while riding entities ++ if (!this.field_147380_r) return; //Fixes teleportation kick while riding entities + - this.serverController.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); + this.field_147367_d.func_71203_ab().func_72358_d(this.field_147369_b); - if (this.playerEntity.ridingEntity != null) + if (this.field_147369_b.field_70154_o != null) @@ -350,6 +352,8 @@ - this.playerEntity.jump(); + this.field_147369_b.func_70664_aZ(); } -+ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving ++ if (!this.field_147380_r) return; //Fixes "Moved Too Fast" kick when being teleported while moving + - this.playerEntity.moveEntity(d11, d12, d13); - this.playerEntity.onGround = packetIn.isOnGround(); - d11 = d8 - this.playerEntity.posX; + this.field_147369_b.func_70091_d(d11, d12, d13); + this.field_147369_b.field_70122_E = p_147347_1_.func_149465_i(); + d11 = d8 - this.field_147369_b.field_70165_t; @@ -370,6 +374,8 @@ - logger.warn(this.playerEntity.getName() + " moved wrongly!"); + field_147370_c.warn(this.field_147369_b.func_70005_c_() + " moved wrongly!"); } -+ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving ++ if (!this.field_147380_r) return; //Fixes "Moved Too Fast" kick when being teleported while moving + - this.playerEntity.setPositionAndRotation(d8, d9, d10, f1, f2); - this.playerEntity.addMovementStat(this.playerEntity.posX - d0, this.playerEntity.posY - d1, this.playerEntity.posZ - d2); + this.field_147369_b.func_70080_a(d8, d9, d10, f1, f2); + this.field_147369_b.func_71000_j(this.field_147369_b.field_70165_t - d0, this.field_147369_b.field_70163_u - d1, this.field_147369_b.field_70161_v - d2); @@ -377,7 +383,7 @@ { - boolean flag2 = worldserver.getCollidingBoundingBoxes(this.playerEntity, this.playerEntity.getEntityBoundingBox().contract((double)f3, (double)f3, (double)f3)).isEmpty(); + boolean flag2 = worldserver.func_72945_a(this.field_147369_b, this.field_147369_b.func_174813_aQ().func_72331_e((double)f3, (double)f3, (double)f3)).isEmpty(); -- if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping()) -+ if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping() && !this.playerEntity.noClip) +- if (flag && (flag1 || !flag2) && !this.field_147369_b.func_70608_bn()) ++ if (flag && (flag1 || !flag2) && !this.field_147369_b.func_70608_bn() && !this.field_147369_b.field_70145_X) { - this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, f1, f2); + this.func_147364_a(this.field_147373_o, this.field_147382_p, this.field_147381_q, f1, f2); return; @@ -405,6 +411,8 @@ - this.floatingTickCount = 0; + this.field_147365_f = 0; } -+ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving ++ if (!this.field_147380_r) return; //Fixes "Moved Too Fast" kick when being teleported while moving + - this.playerEntity.onGround = packetIn.isOnGround(); - this.serverController.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); - this.playerEntity.handleFalling(this.playerEntity.posY - d7, packetIn.isOnGround()); + this.field_147369_b.field_70122_E = p_147347_1_.func_149465_i(); + this.field_147367_d.func_71203_ab().func_72358_d(this.field_147369_b); + this.field_147369_b.func_71122_b(this.field_147369_b.field_70163_u - d7, p_147347_1_.func_149465_i()); @@ -497,7 +505,10 @@ - double d2 = this.playerEntity.posZ - ((double)blockpos.getZ() + 0.5D); + double d2 = this.field_147369_b.field_70161_v - ((double)blockpos.func_177952_p() + 0.5D); double d3 = d0 * d0 + d1 * d1 + d2 * d2; - if (d3 > 36.0D) -+ double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 1; ++ double dist = field_147369_b.field_71134_c.getBlockReachDistance() + 1; + dist *= dist; + + if (d3 > dist) @@ -58,64 +58,64 @@ return; } @@ -549,6 +560,7 @@ - WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); - ItemStack itemstack = this.playerEntity.inventory.getCurrentItem(); + WorldServer worldserver = this.field_147367_d.func_71218_a(this.field_147369_b.field_71093_bK); + ItemStack itemstack = this.field_147369_b.field_71071_by.func_70448_g(); boolean flag = false; + boolean placeResult = true; - BlockPos blockpos = packetIn.getPosition(); - EnumFacing enumfacing = EnumFacing.getFront(packetIn.getPlacedBlockDirection()); - this.playerEntity.markPlayerActive(); + BlockPos blockpos = p_147346_1_.func_179724_a(); + EnumFacing enumfacing = EnumFacing.func_82600_a(p_147346_1_.func_149568_f()); + this.field_147369_b.func_143004_u(); @@ -560,13 +572,20 @@ return; } -+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(playerEntity, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, worldserver, new BlockPos(0, 0, 0), null); ++ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_147369_b, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, worldserver, new BlockPos(0, 0, 0), null); + if (event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) + { - this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, worldserver, itemstack); + this.field_147369_b.field_71134_c.func_73085_a(this.field_147369_b, worldserver, itemstack); + } } - else if (blockpos.getY() < this.serverController.getBuildLimit() - 1 || enumfacing != EnumFacing.UP && blockpos.getY() < this.serverController.getBuildLimit()) + else if (blockpos.func_177956_o() < this.field_147367_d.func_71207_Z() - 1 || enumfacing != EnumFacing.UP && blockpos.func_177956_o() < this.field_147367_d.func_71207_Z()) { -- if (this.hasMoved && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < 64.0D && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) -+ double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 3; +- if (this.field_147380_r && 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 && !this.field_147367_d.func_175579_a(worldserver, blockpos, this.field_147369_b) && worldserver.func_175723_af().func_177746_a(blockpos)) ++ double dist = field_147369_b.field_71134_c.getBlockReachDistance() + 3; + dist *= dist; -+ if (this.hasMoved && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < dist && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) ++ if (this.field_147380_r && 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 && !this.field_147367_d.func_175579_a(worldserver, blockpos, this.field_147369_b) && worldserver.func_175723_af().func_177746_a(blockpos)) { -- this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, blockpos, enumfacing, packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ()); +- this.field_147369_b.field_71134_c.func_180236_a(this.field_147369_b, worldserver, itemstack, blockpos, enumfacing, p_147346_1_.func_149573_h(), p_147346_1_.func_149569_i(), p_147346_1_.func_149575_j()); + // record block place result so we can update client itemstack size if place event was cancelled. -+ placeResult = this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, blockpos, enumfacing, packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ()); ++ placeResult = this.field_147369_b.field_71134_c.func_180236_a(this.field_147369_b, worldserver, itemstack, blockpos, enumfacing, p_147346_1_.func_149573_h(), p_147346_1_.func_149569_i(), p_147346_1_.func_149575_j()); } flag = true; @@ -601,7 +620,7 @@ - this.playerEntity.openContainer.detectAndSendChanges(); - this.playerEntity.isChangingQuantityOnly = false; + this.field_147369_b.field_71070_bA.func_75142_b(); + this.field_147369_b.field_71137_h = false; -- if (!ItemStack.areItemStacksEqual(this.playerEntity.inventory.getCurrentItem(), packetIn.getStack())) -+ if (!ItemStack.areItemStacksEqual(this.playerEntity.inventory.getCurrentItem(), packetIn.getStack()) || !placeResult) // force client itemstack update if place event was cancelled +- if (!ItemStack.func_77989_b(this.field_147369_b.field_71071_by.func_70448_g(), p_147346_1_.func_149574_g())) ++ if (!ItemStack.func_77989_b(this.field_147369_b.field_71071_by.func_70448_g(), p_147346_1_.func_149574_g()) || !placeResult) // force client itemstack update if place event was cancelled { - this.sendPacket(new S2FPacketSetSlot(this.playerEntity.openContainer.windowId, slot.slotNumber, this.playerEntity.inventory.getCurrentItem())); + this.func_147359_a(new S2FPacketSetSlot(this.field_147369_b.field_71070_bA.field_75152_c, slot.field_75222_d, this.field_147369_b.field_71071_by.func_70448_g())); } @@ -770,8 +789,10 @@ } else { -- IChatComponent ichatcomponent = new ChatComponentTranslation("chat.type.text", new Object[] {this.playerEntity.getDisplayName(), s}); -- this.serverController.getConfigurationManager().sendChatMsgImpl(ichatcomponent, false); -+ ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("chat.type.text", this.playerEntity.getDisplayName(), net.minecraftforge.common.ForgeHooks.newChatWithLinks(s)); +- IChatComponent ichatcomponent = new ChatComponentTranslation("chat.type.text", new Object[] {this.field_147369_b.func_145748_c_(), s}); +- this.field_147367_d.func_71203_ab().func_148544_a(ichatcomponent, false); ++ ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("chat.type.text", this.field_147369_b.func_145748_c_(), net.minecraftforge.common.ForgeHooks.newChatWithLinks(s)); + IChatComponent chat = net.minecraftforge.common.ForgeHooks.onServerChatEvent(this, s, chatcomponenttranslation1); + if (chat == null) return; -+ this.serverController.getConfigurationManager().sendChatMsgImpl(chat, false); ++ this.field_147367_d.func_71203_ab().func_148544_a(chat, false); } - this.chatSpamThresholdCount += 20; + this.field_147374_l += 20; @@ -916,7 +937,7 @@ return; } -- this.playerEntity = this.serverController.getConfigurationManager().recreatePlayerEntity(this.playerEntity, 0, false); -+ this.playerEntity = this.serverController.getConfigurationManager().recreatePlayerEntity(this.playerEntity, playerEntity.dimension, false); +- this.field_147369_b = this.field_147367_d.func_71203_ab().func_72368_a(this.field_147369_b, 0, false); ++ this.field_147369_b = this.field_147367_d.func_71203_ab().func_72368_a(this.field_147369_b, field_147369_b.field_71093_bK, false); } break; diff --git a/patches/minecraft/net/minecraft/network/NetworkManager.java.patch b/patches/minecraft/net/minecraft/network/NetworkManager.java.patch index 6578510e0..d86528608 100644 --- a/patches/minecraft/net/minecraft/network/NetworkManager.java.patch +++ b/patches/minecraft/net/minecraft/network/NetworkManager.java.patch @@ -1,43 +1,43 @@ --- ../src-base/minecraft/net/minecraft/network/NetworkManager.java +++ ../src-work/minecraft/net/minecraft/network/NetworkManager.java @@ -93,6 +93,11 @@ - this.direction = packetDirection; + this.field_179294_g = p_i46004_1_; } + public EnumPacketDirection getDirection() + { -+ return this.direction; ++ return this.field_179294_g; + } + public void channelActive(ChannelHandlerContext p_channelActive_1_) throws Exception { super.channelActive(p_channelActive_1_); @@ -208,7 +213,7 @@ - final EnumConnectionState enumconnectionstate = EnumConnectionState.getFromPacket(inPacket); - final EnumConnectionState enumconnectionstate1 = (EnumConnectionState)this.channel.attr(attrKeyConnectionState).get(); + final EnumConnectionState enumconnectionstate = EnumConnectionState.func_150752_a(p_150732_1_); + final EnumConnectionState enumconnectionstate1 = (EnumConnectionState)this.field_150746_k.attr(field_150739_c).get(); - if (enumconnectionstate1 != enumconnectionstate) -+ if (enumconnectionstate1 != enumconnectionstate && !( inPacket instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) ++ if (enumconnectionstate1 != enumconnectionstate && !( p_150732_1_ instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) { - logger.debug("Disabled auto read"); - this.channel.config().setAutoRead(false); + field_150735_g.debug("Disabled auto read"); + this.field_150746_k.config().setAutoRead(false); @@ -216,7 +221,7 @@ - if (this.channel.eventLoop().inEventLoop()) + if (this.field_150746_k.eventLoop().inEventLoop()) { - if (enumconnectionstate != enumconnectionstate1) -+ if (enumconnectionstate != enumconnectionstate1 && !( inPacket instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) ++ if (enumconnectionstate != enumconnectionstate1 && !( p_150732_1_ instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) { - this.setConnectionState(enumconnectionstate); + this.func_150723_a(enumconnectionstate); } @@ -236,7 +241,7 @@ { public void run() { - if (enumconnectionstate != enumconnectionstate1) -+ if (enumconnectionstate != enumconnectionstate1 && !( inPacket instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) ++ if (enumconnectionstate != enumconnectionstate1 && !( p_150732_1_ instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) { - NetworkManager.this.setConnectionState(enumconnectionstate); + NetworkManager.this.func_150723_a(enumconnectionstate); } @@ -455,6 +460,11 @@ } @@ -45,9 +45,9 @@ + public Channel channel() + { -+ return channel; ++ return field_150746_k; + } + static class InboundHandlerTuplePacketListener { - private final Packet packet; + private final Packet field_150774_a; diff --git a/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch b/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch index 218327728..e31f320e9 100644 --- a/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch +++ b/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch @@ -7,5 +7,5 @@ - p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(30))).addLast((String)"legacy_query", (ChannelHandler)(new PingResponseHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new MessageDeserializer2())).addLast((String)"decoder", (ChannelHandler)(new MessageDeserializer(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new MessageSerializer2())).addLast((String)"encoder", (ChannelHandler)(new MessageSerializer(EnumPacketDirection.CLIENTBOUND))); + p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.READ_TIMEOUT))).addLast((String)"legacy_query", (ChannelHandler)(new PingResponseHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new MessageDeserializer2())).addLast((String)"decoder", (ChannelHandler)(new MessageDeserializer(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new MessageSerializer2())).addLast((String)"encoder", (ChannelHandler)(new MessageSerializer(EnumPacketDirection.CLIENTBOUND))); NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND); - NetworkSystem.this.networkManagers.add(networkmanager); + NetworkSystem.this.field_151272_f.add(networkmanager); p_initChannel_1_.pipeline().addLast((String)"packet_handler", (ChannelHandler)networkmanager); diff --git a/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch b/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch index 4b12b60e0..856c5c869 100644 --- a/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch +++ b/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch @@ -1,37 +1,37 @@ --- ../src-base/minecraft/net/minecraft/network/ServerStatusResponse.java +++ ../src-work/minecraft/net/minecraft/network/ServerStatusResponse.java @@ -29,6 +29,7 @@ - public void setServerDescription(IChatComponent motd) + public void func_151315_a(IChatComponent p_151315_1_) { - this.serverMotd = motd; + this.field_151326_a = p_151315_1_; + invalidateJson(); } - public ServerStatusResponse.PlayerCountData getPlayerCountData() + public ServerStatusResponse.PlayerCountData func_151318_b() @@ -39,6 +40,7 @@ - public void setPlayerCountData(ServerStatusResponse.PlayerCountData countData) + public void func_151319_a(ServerStatusResponse.PlayerCountData p_151319_1_) { - this.playerCount = countData; + this.field_151324_b = p_151319_1_; + invalidateJson(); } - public ServerStatusResponse.MinecraftProtocolVersionIdentifier getProtocolVersionInfo() + public ServerStatusResponse.MinecraftProtocolVersionIdentifier func_151322_c() @@ -49,11 +51,13 @@ - public void setProtocolVersionInfo(ServerStatusResponse.MinecraftProtocolVersionIdentifier protocolVersionData) + public void func_151321_a(ServerStatusResponse.MinecraftProtocolVersionIdentifier p_151321_1_) { - this.protocolVersion = protocolVersionData; + this.field_151325_c = p_151321_1_; + invalidateJson(); } - public void setFavicon(String faviconBlob) + public void func_151320_a(String p_151320_1_) { - this.favicon = faviconBlob; + this.field_151323_d = p_151320_1_; + invalidateJson(); } - public String getFavicon() + public String func_151316_d() @@ -215,6 +219,7 @@ - serverstatusresponse.setFavicon(JsonUtils.getJsonObjectStringFieldValue(jsonobject, "favicon")); + serverstatusresponse.func_151320_a(JsonUtils.func_151200_h(jsonobject, "favicon")); } + net.minecraftforge.fml.client.FMLClientHandler.instance().captureAdditionalData(serverstatusresponse, jsonobject); @@ -39,7 +39,7 @@ } @@ -242,7 +247,47 @@ - jsonobject.addProperty("favicon", p_serialize_1_.getFavicon()); + jsonobject.addProperty("favicon", p_serialize_1_.func_151316_d()); } + net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.enhanceStatusQuery(jsonobject); @@ -69,7 +69,7 @@ + ret = this.json; + if (ret == null) + { -+ ret = net.minecraft.network.status.server.S00PacketServerInfo.GSON.toJson(this); ++ ret = net.minecraft.network.status.server.S00PacketServerInfo.field_149297_a.toJson(this); + this.json = ret; + } + mutex.release(); diff --git a/patches/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch b/patches/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch index dbeee89f6..4e936ed70 100644 --- a/patches/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch +++ b/patches/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/network/handshake/client/C00Handshake.java +++ ../src-work/minecraft/net/minecraft/network/handshake/client/C00Handshake.java @@ -14,6 +14,7 @@ - private String ip; - private int port; - private EnumConnectionState requestedState; + private String field_149598_b; + private int field_149599_c; + private EnumConnectionState field_149597_d; + private boolean hasFMLMarker = false; public C00Handshake() { @@ -28,18 +29,26 @@ - this.requestedState = requestedState; + this.field_149597_d = p_i45266_4_; } + public C00Handshake(int protocol, String address, int port, EnumConnectionState state, boolean addFMLMarker) @@ -18,27 +18,27 @@ + this.hasFMLMarker = addFMLMarker; + } + - public void readPacketData(PacketBuffer buf) throws IOException + public void func_148837_a(PacketBuffer p_148837_1_) throws IOException { - this.protocolVersion = buf.readVarIntFromBuffer(); - this.ip = buf.readStringFromBuffer(255); - this.port = buf.readUnsignedShort(); - this.requestedState = EnumConnectionState.getById(buf.readVarIntFromBuffer()); -+ this.hasFMLMarker = this.ip.contains("\0FML\0"); -+ this.ip = this.ip.split("\0")[0]; + this.field_149600_a = p_148837_1_.func_150792_a(); + this.field_149598_b = p_148837_1_.func_150789_c(255); + this.field_149599_c = p_148837_1_.readUnsignedShort(); + this.field_149597_d = EnumConnectionState.func_150760_a(p_148837_1_.func_150792_a()); ++ this.hasFMLMarker = this.field_149598_b.contains("\0FML\0"); ++ this.field_149598_b = this.field_149598_b.split("\0")[0]; } - public void writePacketData(PacketBuffer buf) throws IOException + public void func_148840_b(PacketBuffer p_148840_1_) throws IOException { - buf.writeVarIntToBuffer(this.protocolVersion); -- buf.writeString(this.ip); -+ buf.writeString(this.ip + "\0FML\0"); - buf.writeShort(this.port); - buf.writeVarIntToBuffer(this.requestedState.getId()); + 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 + "\0FML\0"); + p_148840_1_.writeShort(this.field_149599_c); + p_148840_1_.func_150787_b(this.field_149597_d.func_150759_c()); } @@ -58,4 +67,9 @@ { - return this.protocolVersion; + return this.field_149600_a; } + + public boolean hasFMLMarker() diff --git a/patches/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch b/patches/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch index 331306c78..1345ee125 100644 --- a/patches/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch +++ b/patches/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch @@ -1,14 +1,14 @@ --- ../src-base/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java +++ ../src-work/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java @@ -47,7 +47,11 @@ - public void writePacketData(PacketBuffer buf) throws IOException + public void func_148840_b(PacketBuffer p_148840_1_) throws IOException { - buf.writeString(this.channel); -+ synchronized(this.data) { //This may be access multiple times, from multiple threads, lets be safe. -+ this.data.markReaderIndex(); - buf.writeBytes((ByteBuf)this.data); -+ this.data.resetReaderIndex(); + p_148840_1_.func_180714_a(this.field_149562_a); ++ synchronized(this.field_149561_c) { //This may be access multiple times, from multiple threads, lets be safe. ++ this.field_149561_c.markReaderIndex(); + p_148840_1_.writeBytes((ByteBuf)this.field_149561_c); ++ this.field_149561_c.resetReaderIndex(); + } } - public void processPacket(INetHandlerPlayServer handler) + public void func_148833_a(INetHandlerPlayServer p_148833_1_) diff --git a/patches/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch b/patches/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch index 8218d2cac..9604b555a 100644 --- a/patches/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch +++ b/patches/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch @@ -1,14 +1,14 @@ --- ../src-base/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java +++ ../src-work/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java @@ -46,7 +46,11 @@ - public void writePacketData(PacketBuffer buf) throws IOException + public void func_148840_b(PacketBuffer p_148840_1_) throws IOException { - buf.writeString(this.channel); -+ synchronized(this.data) { //This may be access multiple times, from multiple threads, lets be safe. -+ this.data.markReaderIndex(); - buf.writeBytes((ByteBuf)this.data); -+ this.data.resetReaderIndex(); + p_148840_1_.func_180714_a(this.field_149172_a); ++ synchronized(this.field_149171_b) { //This may be access multiple times, from multiple threads, lets be safe. ++ this.field_149171_b.markReaderIndex(); + p_148840_1_.writeBytes((ByteBuf)this.field_149171_b); ++ this.field_149171_b.resetReaderIndex(); + } } - public void processPacket(INetHandlerPlayClient handler) + public void func_148833_a(INetHandlerPlayClient p_148833_1_) diff --git a/patches/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch b/patches/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch index 086221d57..6e9d12a15 100644 --- a/patches/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch +++ b/patches/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch @@ -2,10 +2,10 @@ +++ ../src-work/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java @@ -34,7 +34,7 @@ - public void writePacketData(PacketBuffer buf) throws IOException + public void func_148840_b(PacketBuffer p_148840_1_) throws IOException { -- buf.writeString(GSON.toJson((Object)this.response)); -+ buf.writeString(this.response.getJson()); +- p_148840_1_.func_180714_a(field_149297_a.toJson((Object)this.field_149296_b)); ++ p_148840_1_.func_180714_a(this.field_149296_b.getJson()); } - public void processPacket(INetHandlerStatusClient handler) + public void func_148833_a(INetHandlerStatusClient p_148833_1_) diff --git a/patches/minecraft/net/minecraft/potion/Potion.java.patch b/patches/minecraft/net/minecraft/potion/Potion.java.patch index 0e3c45bb3..8b374f8a0 100644 --- a/patches/minecraft/net/minecraft/potion/Potion.java.patch +++ b/patches/minecraft/net/minecraft/potion/Potion.java.patch @@ -2,7 +2,7 @@ +++ ../src-work/minecraft/net/minecraft/potion/Potion.java @@ -310,4 +310,27 @@ { - return p_111183_2_.getAmount() * (double)(p_111183_1_ + 1); + return p_111183_2_.func_111164_d() * (double)(p_111183_1_ + 1); } + + /* ======================================== FORGE START =====================================*/ diff --git a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch b/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch index 913aaeb06..6a272c37b 100644 --- a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch +++ b/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch @@ -2,42 +2,42 @@ +++ ../src-work/minecraft/net/minecraft/potion/PotionEffect.java @@ -18,6 +18,8 @@ @SideOnly(Side.CLIENT) - private boolean isPotionDurationMax; - private boolean showParticles; + private boolean field_100013_f; + private boolean field_180156_h; + /** List of ItemStack that can cure the potion effect **/ + private java.util.List curativeItems; - public PotionEffect(int id, int effectDuration) + public PotionEffect(int p_i1574_1_, int p_i1574_2_) { @@ -36,6 +38,8 @@ - this.amplifier = effectAmplifier; - this.isAmbient = ambient; - this.showParticles = showParticles; + this.field_76461_c = p_i45896_3_; + this.field_82724_e = p_i45896_4_; + this.field_180156_h = p_i45896_5_; + this.curativeItems = new java.util.ArrayList(); -+ this.curativeItems.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.milk_bucket)); ++ this.curativeItems.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.field_151117_aB)); } - public PotionEffect(PotionEffect other) + public PotionEffect(PotionEffect p_i1577_1_) @@ -45,6 +49,7 @@ - this.amplifier = other.amplifier; - this.isAmbient = other.isAmbient; - this.showParticles = other.showParticles; -+ this.curativeItems = other.curativeItems; + this.field_76461_c = p_i1577_1_.field_76461_c; + this.field_82724_e = p_i1577_1_.field_82724_e; + this.field_180156_h = p_i1577_1_.field_180156_h; ++ this.curativeItems = p_i1577_1_.curativeItems; } - public void combine(PotionEffect other) + public void func_76452_a(PotionEffect p_76452_1_) @@ -190,7 +195,7 @@ - public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt) + public static PotionEffect func_82722_b(NBTTagCompound p_82722_0_) { -- int i = nbt.getByte("Id"); -+ int i = nbt.getByte("Id") & 0xff; +- int i = p_82722_0_.func_74771_c("Id"); ++ int i = p_82722_0_.func_74771_c("Id") & 0xff; - if (i >= 0 && i < Potion.potionTypes.length && Potion.potionTypes[i] != null) + if (i >= 0 && i < Potion.field_76425_a.length && Potion.field_76425_a[i] != null) { @@ -223,4 +228,62 @@ { - return this.isPotionDurationMax; + return this.field_100013_f; } + + /* ======================================== FORGE START =====================================*/ @@ -60,7 +60,7 @@ + boolean found = false; + for (net.minecraft.item.ItemStack curativeItem : this.curativeItems) + { -+ if (curativeItem.isItemEqual(stack)) ++ if (curativeItem.func_77969_a(stack)) + { + found = true; + } @@ -87,7 +87,7 @@ + boolean found = false; + for (net.minecraft.item.ItemStack curativeItem : this.curativeItems) + { -+ if (curativeItem.isItemEqual(stack)) ++ if (curativeItem.func_77969_a(stack)) + { + found = true; + } diff --git a/patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch b/patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch index 2aab40a37..485a416d0 100644 --- a/patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch +++ b/patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch @@ -12,8 +12,8 @@ return; } -- RealmsConnect.this.connection.sendPacket(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN)); -+ RealmsConnect.this.connection.sendPacket(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN, true)); +- RealmsConnect.this.connection.func_179290_a(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN)); ++ RealmsConnect.this.connection.func_179290_a(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN, true)); if (RealmsConnect.this.aborted) { diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch index e03c919c1..d72ce626f 100644 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -2,44 +2,44 @@ +++ ../src-work/minecraft/net/minecraft/server/MinecraftServer.java @@ -98,7 +98,7 @@ @SideOnly(Side.SERVER) - private String hostname; - private int serverPort = -1; -- public WorldServer[] worldServers; -+ public WorldServer[] worldServers = new WorldServer[0]; - private ServerConfigurationManager serverConfigManager; - private boolean serverRunning = true; - private boolean serverStopped; + private String field_71320_r; + private int field_71319_s = -1; +- public WorldServer[] field_71305_c; ++ public WorldServer[] field_71305_c = new WorldServer[0]; + private ServerConfigurationManager field_71318_t; + private boolean field_71317_u = true; + private boolean field_71316_v; @@ -115,7 +115,8 @@ - private int buildLimit; - private int maxPlayerIdleMinutes = 0; - public final long[] tickTimeArray = new long[100]; -- public long[][] timeOfLastDimensionTick; + private int field_71280_D; + private int field_143008_E = 0; + public final long[] field_71311_j = new long[100]; +- public long[][] field_71312_k; + //public long[][] timeOfLastDimensionTick; + public java.util.Hashtable worldTickTimes = new java.util.Hashtable(); - private KeyPair serverKeyPair; - private String serverOwner; - private String folderName; + private KeyPair field_71292_I; + private String field_71293_J; + private String field_71294_K; @@ -227,8 +228,6 @@ { - this.convertMapIfNeeded(p_71247_1_); - this.setUserMessage("menu.loadingLevel"); -- this.worldServers = new WorldServer[3]; -- this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; - ISaveHandler isavehandler = this.anvilConverterForAnvilFile.getSaveLoader(p_71247_1_, true); - this.setResourcePackFromWorld(this.getFolderName(), isavehandler); - WorldInfo worldinfo = isavehandler.loadWorldInfo(); + this.func_71237_c(p_71247_1_); + this.func_71192_d("menu.loadingLevel"); +- this.field_71305_c = new WorldServer[3]; +- this.field_71312_k = new long[this.field_71305_c.length][100]; + ISaveHandler isavehandler = this.field_71310_m.func_75804_a(p_71247_1_, true); + this.func_175584_a(this.func_71270_I(), isavehandler); + WorldInfo worldinfo = isavehandler.func_75757_d(); @@ -259,47 +258,21 @@ worldsettings = new WorldSettings(worldinfo); } -- for (int i = 0; i < this.worldServers.length; ++i) -+ WorldServer overWorld = (WorldServer)(isDemo() ? new DemoWorldServer(this, isavehandler, worldinfo, 0, theProfiler).init() : new WorldServer(this, isavehandler, worldinfo, 0, theProfiler).init()); -+ overWorld.initialize(worldsettings); +- for (int i = 0; i < this.field_71305_c.length; ++i) ++ WorldServer overWorld = (WorldServer)(func_71242_L() ? new DemoWorldServer(this, isavehandler, worldinfo, 0, field_71304_b).func_175643_b() : new WorldServer(this, isavehandler, worldinfo, 0, field_71304_b).func_175643_b()); ++ overWorld.func_72963_a(worldsettings); + for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) { - int j = 0; -+ WorldServer world = (dim == 0 ? overWorld : (WorldServer)new WorldServerMulti(this, isavehandler, dim, overWorld, theProfiler).init()); -+ world.addWorldAccess(new WorldManager(this, world)); ++ WorldServer world = (dim == 0 ? overWorld : (WorldServer)new WorldServerMulti(this, isavehandler, dim, overWorld, field_71304_b).func_175643_b()); ++ world.func_72954_a(new WorldManager(this, world)); - if (i == 1) - { @@ -53,82 +53,82 @@ - - if (i == 0) - { -- if (this.isDemo()) +- if (this.func_71242_L()) - { -- this.worldServers[i] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); +- this.field_71305_c[i] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, j, this.field_71304_b)).func_175643_b(); - } - else - { -- this.worldServers[i] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); +- this.field_71305_c[i] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, j, this.field_71304_b)).func_175643_b(); - } - -- this.worldServers[i].initialize(worldsettings); +- this.field_71305_c[i].func_72963_a(worldsettings); - } - else - { -- this.worldServers[i] = (WorldServer)(new WorldServerMulti(this, isavehandler, j, this.worldServers[0], this.theProfiler)).init(); +- this.field_71305_c[i] = (WorldServer)(new WorldServerMulti(this, isavehandler, j, this.field_71305_c[0], this.field_71304_b)).func_175643_b(); - } - -- this.worldServers[i].addWorldAccess(new WorldManager(this, this.worldServers[i])); +- this.field_71305_c[i].func_72954_a(new WorldManager(this, this.field_71305_c[i])); - - if (!this.isSinglePlayer()) + if (!this.func_71264_H()) { -- this.worldServers[i].getWorldInfo().setGameType(this.getGameType()); -+ world.getWorldInfo().setGameType(this.getGameType()); +- this.field_71305_c[i].func_72912_H().func_76060_a(this.func_71265_f()); ++ world.func_72912_H().func_76060_a(this.func_71265_f()); } + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); } -- this.serverConfigManager.setPlayerManager(this.worldServers); -+ this.serverConfigManager.setPlayerManager(new WorldServer[]{ overWorld }); - this.setDifficultyForAllWorlds(this.getDifficulty()); - this.initialWorldChunkLoad(); +- this.field_71318_t.func_72364_a(this.field_71305_c); ++ this.field_71318_t.func_72364_a(new WorldServer[]{ overWorld }); + this.func_147139_a(this.func_147135_j()); + this.func_71222_d(); } @@ -314,7 +287,7 @@ - this.setUserMessage("menu.generatingTerrain"); + this.func_71192_d("menu.generatingTerrain"); int j1 = 0; - logger.info("Preparing start region for level " + j1); -- WorldServer worldserver = this.worldServers[j1]; + field_147145_h.info("Preparing start region for level " + j1); +- WorldServer worldserver = this.field_71305_c[j1]; + WorldServer worldserver = net.minecraftforge.common.DimensionManager.getWorld(j1); - BlockPos blockpos = worldserver.getSpawnPoint(); - long k1 = getCurrentTimeMillis(); + BlockPos blockpos = worldserver.func_175694_M(); + long k1 = func_130071_aq(); @@ -403,7 +376,7 @@ - public void stopServer() + public void func_71260_j() { -- if (!this.worldIsBeingDeleted) -+ if (!this.worldIsBeingDeleted && net.minecraftforge.fml.common.Loader.instance().hasReachedState(net.minecraftforge.fml.common.LoaderState.SERVER_STARTED) && !serverStopped) // make sure the save is valid and we don't save twice +- if (!this.field_71290_O) ++ if (!this.field_71290_O && net.minecraftforge.fml.common.Loader.instance().hasReachedState(net.minecraftforge.fml.common.LoaderState.SERVER_STARTED) && !field_71316_v) // make sure the save is valid and we don't save twice { - logger.info("Stopping server"); + field_147145_h.info("Stopping server"); @@ -427,8 +400,15 @@ - for (int i = 0; i < this.worldServers.length; ++i) + for (int i = 0; i < this.field_71305_c.length; ++i) { - WorldServer worldserver = this.worldServers[i]; + WorldServer worldserver = this.field_71305_c[i]; + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); - worldserver.flush(); + worldserver.func_73041_k(); } + -+ WorldServer[] tmp = worldServers; ++ WorldServer[] tmp = field_71305_c; + for (WorldServer world : tmp) + { -+ net.minecraftforge.common.DimensionManager.setWorld(world.provider.getDimensionId(), null); ++ net.minecraftforge.common.DimensionManager.setWorld(world.field_73011_w.func_177502_q(), null); + } } - if (this.usageSnooper.isSnooperRunning()) + if (this.field_71307_n.func_76468_d()) @@ -460,6 +440,7 @@ { - if (this.startServer()) + if (this.func_71197_b()) { + net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarted(); - this.currentTime = getCurrentTimeMillis(); + this.field_175591_ab = func_130071_aq(); long i = 0L; - this.statusResponse.setServerDescription(new ChatComponentText(this.motd)); + this.field_147147_p.func_151315_a(new ChatComponentText(this.field_71286_C)); @@ -504,12 +485,20 @@ Thread.sleep(Math.max(1L, 50L - i)); - this.serverIsRunning = true; + this.field_71296_Q = true; } + net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStopping(); + net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions @@ -136,7 +136,7 @@ else { + net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions - this.finalTick((CrashReport)null); + this.func_71228_a((CrashReport)null); } } + catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) @@ -146,13 +146,13 @@ + } catch (Throwable throwable1) { - logger.error("Encountered an unexpected exception", throwable1); + field_147145_h.error("Encountered an unexpected exception", throwable1); @@ -535,6 +524,7 @@ - logger.error("We were unable to save this crash report to disk."); + field_147145_h.error("We were unable to save this crash report to disk."); } + net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions - this.finalTick(crashreport); + this.func_71228_a(crashreport); } finally @@ -550,6 +540,8 @@ @@ -160,59 +160,59 @@ finally { + net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStopped(); -+ this.serverStopped = true; - this.systemExitNow(); ++ this.field_71316_v = true; + this.func_71240_o(); } } @@ -599,6 +591,7 @@ - public void tick() + public void func_71217_p() { long i = System.nanoTime(); + net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreServerTick(); - ++this.tickCounter; + ++this.field_71315_w; - if (this.startProfiling) + if (this.field_71295_T) @@ -625,6 +618,7 @@ Collections.shuffle(Arrays.asList(agameprofile)); - this.statusResponse.getPlayerCountData().setPlayers(agameprofile); -+ this.statusResponse.invalidateJson(); + this.field_147147_p.func_151318_b().func_151330_a(agameprofile); ++ this.field_147147_p.invalidateJson(); } - if (this.tickCounter % 900 == 0) + if (this.field_71315_w % 900 == 0) @@ -652,6 +646,7 @@ - this.theProfiler.endSection(); - this.theProfiler.endSection(); + this.field_71304_b.func_76319_b(); + this.field_71304_b.func_76319_b(); + net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostServerTick(); } - public void updateTimeLightAndEntities() + public void func_71190_q() @@ -667,14 +662,17 @@ } - this.theProfiler.endStartSection("levels"); + this.field_71304_b.func_76318_c("levels"); + net.minecraftforge.common.chunkio.ChunkIOExecutor.tick(); -- for (int j = 0; j < this.worldServers.length; ++j) -+ Integer[] ids = net.minecraftforge.common.DimensionManager.getIDs(this.tickCounter % 200 == 0); +- for (int j = 0; j < this.field_71305_c.length; ++j) ++ Integer[] ids = net.minecraftforge.common.DimensionManager.getIDs(this.field_71315_w % 200 == 0); + for (int x = 0; x < ids.length; x++) { + int id = ids[x]; long i = System.nanoTime(); -- if (j == 0 || this.getAllowNether()) -+ if (id == 0 || this.getAllowNether()) +- if (j == 0 || this.func_71255_r()) ++ if (id == 0 || this.func_71255_r()) { -- WorldServer worldserver = this.worldServers[j]; +- WorldServer worldserver = this.field_71305_c[j]; + WorldServer worldserver = net.minecraftforge.common.DimensionManager.getWorld(id); - this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName()); + this.field_71304_b.func_76320_a(worldserver.func_72912_H().func_76065_j()); - if (this.tickCounter % 20 == 0) + if (this.field_71315_w % 20 == 0) @@ -685,6 +683,7 @@ } - this.theProfiler.startSection("tick"); + this.field_71304_b.func_76320_a("tick"); + net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreWorldTick(worldserver); try @@ -222,45 +222,45 @@ } + net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostWorldTick(worldserver); - this.theProfiler.endSection(); - this.theProfiler.startSection("tracker"); - worldserver.getEntityTracker().updateTrackedEntities(); + this.field_71304_b.func_76319_b(); + this.field_71304_b.func_76320_a("tracker"); + worldserver.func_73039_n().func_72788_a(); @@ -715,9 +715,11 @@ - this.theProfiler.endSection(); + this.field_71304_b.func_76319_b(); } -- this.timeOfLastDimensionTick[j][this.tickCounter % 100] = System.nanoTime() - i; -+ worldTickTimes.get(id)[this.tickCounter % 100] = System.nanoTime() - i; +- this.field_71312_k[j][this.field_71315_w % 100] = System.nanoTime() - i; ++ worldTickTimes.get(id)[this.field_71315_w % 100] = System.nanoTime() - i; } -+ this.theProfiler.endStartSection("dim_unloading"); ++ this.field_71304_b.func_76318_c("dim_unloading"); + net.minecraftforge.common.DimensionManager.unloadWorlds(worldTickTimes); - this.theProfiler.endStartSection("connection"); - this.getNetworkSystem().networkTick(); - this.theProfiler.endStartSection("players"); + this.field_71304_b.func_76318_c("connection"); + this.func_147137_ag().func_151269_c(); + this.field_71304_b.func_76318_c("players"); @@ -739,6 +741,7 @@ - public void startServerThread() + public void func_71256_s() { + net.minecraftforge.fml.common.StartupQuery.reset(); - this.serverThread = new Thread(this, "Server thread"); - this.serverThread.start(); + this.field_175590_aa = new Thread(this, "Server thread"); + this.field_175590_aa.start(); } @@ -755,7 +758,13 @@ - public WorldServer worldServerForDimension(int dimension) + public WorldServer func_71218_a(int p_71218_1_) { -- return dimension == -1 ? this.worldServers[1] : (dimension == 1 ? this.worldServers[2] : this.worldServers[0]); -+ WorldServer ret = net.minecraftforge.common.DimensionManager.getWorld(dimension); +- return p_71218_1_ == -1 ? this.field_71305_c[1] : (p_71218_1_ == 1 ? this.field_71305_c[2] : this.field_71305_c[0]); ++ WorldServer ret = net.minecraftforge.common.DimensionManager.getWorld(p_71218_1_); + if (ret == null) + { -+ net.minecraftforge.common.DimensionManager.initDimension(dimension); -+ ret = net.minecraftforge.common.DimensionManager.getWorld(dimension); ++ net.minecraftforge.common.DimensionManager.initDimension(p_71218_1_); ++ ret = net.minecraftforge.common.DimensionManager.getWorld(p_71218_1_); + } + return ret; } - public String getMinecraftVersion() + public String func_71249_w() @@ -785,7 +794,7 @@ public String getServerModName() @@ -269,12 +269,12 @@ + return net.minecraftforge.fml.common.FMLCommonHandler.instance().getModName(); } - public CrashReport addServerInfoToCrashReport(CrashReport report) + public CrashReport func_71230_b(CrashReport p_71230_1_) @@ -996,6 +1005,7 @@ if (worldserver != null) { + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); - worldserver.flush(); + worldserver.func_73041_k(); } } diff --git a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch index 05d5aafc1..6517ba2d2 100644 --- a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -1,37 +1,37 @@ --- ../src-base/minecraft/net/minecraft/server/dedicated/DedicatedServer.java +++ ../src-work/minecraft/net/minecraft/server/dedicated/DedicatedServer.java @@ -49,6 +49,7 @@ - private boolean canSpawnStructures; - private WorldSettings.GameType gameType; - private boolean guiIsEnabled; + private boolean field_71338_p; + private WorldSettings.GameType field_71337_q; + private boolean field_71335_s; + public static boolean allowPlayerLogins = false; - public DedicatedServer(File workDir) + public DedicatedServer(File p_i1508_1_) { @@ -107,6 +108,8 @@ - logger.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); + field_155771_h.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); } + net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStart(this); + - logger.info("Loading properties"); - this.settings = new PropertyManager(new File("server.properties")); - this.eula = new ServerEula(new File("eula.txt")); + field_155771_h.info("Loading properties"); + this.field_71340_o = new PropertyManager(new File("server.properties")); + this.field_154332_n = new ServerEula(new File("eula.txt")); @@ -198,6 +201,7 @@ } else { + net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStarted(); - this.setConfigManager(new DedicatedPlayerList(this)); + this.func_152361_a(new DedicatedPlayerList(this)); long j = System.nanoTime(); @@ -244,6 +248,7 @@ - this.setBuildLimit((this.getBuildLimit() + 8) / 16 * 16); - this.setBuildLimit(MathHelper.clamp_int(this.getBuildLimit(), 64, 256)); - this.settings.setProperty("max-build-height", Integer.valueOf(this.getBuildLimit())); + this.func_71191_d((this.func_71207_Z() + 8) / 16 * 16); + this.func_71191_d(MathHelper.func_76125_a(this.func_71207_Z(), 64, 256)); + this.field_71340_o.func_73667_a("max-build-height", Integer.valueOf(this.func_71207_Z())); + if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; - logger.info("Preparing level \"" + this.getFolderName() + "\""); - this.loadAllWorlds(this.getFolderName(), this.getFolderName(), k, worldtype, s2); + field_155771_h.info("Preparing level \"" + this.func_71270_I() + "\""); + this.func_71247_a(this.func_71270_I(), this.func_71270_I(), k, worldtype, s2); long i1 = System.nanoTime() - j; @@ -272,7 +277,7 @@ thread1.start(); diff --git a/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch b/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch index 1aca6a5bc..06a26df6e 100644 --- a/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch +++ b/patches/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch @@ -7,7 +7,7 @@ + minecraftservergui.latch.countDown(); } - public MinecraftServerGui(DedicatedServer serverIn) + public MinecraftServerGui(DedicatedServer p_i2362_1_) @@ -162,8 +163,13 @@ return jpanel; } diff --git a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch index 6b4e353d1..7962cb7ac 100644 --- a/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch @@ -1,34 +1,34 @@ --- ../src-base/minecraft/net/minecraft/server/integrated/IntegratedServer.java +++ ../src-work/minecraft/net/minecraft/server/integrated/IntegratedServer.java @@ -71,8 +71,6 @@ - protected void loadAllWorlds(String p_71247_1_, String p_71247_2_, long seed, WorldType type, String p_71247_6_) + protected void func_71247_a(String p_71247_1_, String p_71247_2_, long p_71247_3_, WorldType p_71247_5_, String p_71247_6_) { - this.convertMapIfNeeded(p_71247_1_); -- this.worldServers = new WorldServer[3]; -- this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; - ISaveHandler isavehandler = this.getActiveAnvilConverter().getSaveLoader(p_71247_1_, true); - this.setResourcePackFromWorld(this.getFolderName(), isavehandler); - WorldInfo worldinfo = isavehandler.loadWorldInfo(); + this.func_71237_c(p_71247_1_); +- this.field_71305_c = new WorldServer[3]; +- this.field_71312_k = new long[this.field_71305_c.length][100]; + ISaveHandler isavehandler = this.func_71254_M().func_75804_a(p_71247_1_, true); + this.func_175584_a(this.func_71270_I(), isavehandler); + WorldInfo worldinfo = isavehandler.func_75757_d(); @@ -86,44 +84,24 @@ - worldinfo.setWorldName(p_71247_2_); + worldinfo.func_76062_a(p_71247_2_); } -- for (int i = 0; i < this.worldServers.length; ++i) +- for (int i = 0; i < this.field_71305_c.length; ++i) - { - int j = 0; -+ WorldServer overWorld = (isDemo() ? (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init() : -+ (WorldServer)(new WorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init()); -+ overWorld.initialize(this.theWorldSettings); ++ WorldServer overWorld = (func_71242_L() ? (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, 0, this.field_71304_b)).func_175643_b() : ++ (WorldServer)(new WorldServer(this, isavehandler, worldinfo, 0, this.field_71304_b)).func_175643_b()); ++ overWorld.func_72963_a(this.field_71350_m); - if (i == 1) + for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) + { -+ WorldServer world = (dim == 0 ? overWorld : (WorldServer)(new WorldServerMulti(this, isavehandler, dim, overWorld, this.theProfiler)).init()); -+ world.addWorldAccess(new WorldManager(this, world)); -+ if (!this.isSinglePlayer()) ++ WorldServer world = (dim == 0 ? overWorld : (WorldServer)(new WorldServerMulti(this, isavehandler, dim, overWorld, this.field_71304_b)).func_175643_b()); ++ world.func_72954_a(new WorldManager(this, world)); ++ if (!this.func_71264_H()) { - j = -1; -+ world.getWorldInfo().setGameType(getGameType()); ++ world.func_72912_H().func_76060_a(func_71265_f()); } - - if (i == 2) @@ -38,51 +38,51 @@ - - if (i == 0) - { -- if (this.isDemo()) +- if (this.func_71242_L()) - { -- this.worldServers[i] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); +- this.field_71305_c[i] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, j, this.field_71304_b)).func_175643_b(); - } - else - { -- this.worldServers[i] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); +- this.field_71305_c[i] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, j, this.field_71304_b)).func_175643_b(); - } - -- this.worldServers[i].initialize(this.theWorldSettings); +- this.field_71305_c[i].func_72963_a(this.field_71350_m); - } - else - { -- this.worldServers[i] = (WorldServer)(new WorldServerMulti(this, isavehandler, j, this.worldServers[0], this.theProfiler)).init(); +- this.field_71305_c[i] = (WorldServer)(new WorldServerMulti(this, isavehandler, j, this.field_71305_c[0], this.field_71304_b)).func_175643_b(); - } - -- this.worldServers[i].addWorldAccess(new WorldManager(this, this.worldServers[i])); +- this.field_71305_c[i].func_72954_a(new WorldManager(this, this.field_71305_c[i])); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); } -- this.getConfigurationManager().setPlayerManager(this.worldServers); -+ this.getConfigurationManager().setPlayerManager(new WorldServer[]{ overWorld }); +- this.func_71203_ab().func_72364_a(this.field_71305_c); ++ this.func_71203_ab().func_72364_a(new WorldServer[]{ overWorld }); -- if (this.worldServers[0].getWorldInfo().getDifficulty() == null) -+ if (overWorld.getWorldInfo().getDifficulty() == null) +- if (this.field_71305_c[0].func_72912_H().func_176130_y() == null) ++ if (overWorld.func_72912_H().func_176130_y() == null) { - this.setDifficultyForAllWorlds(this.mc.gameSettings.difficulty); + this.func_147139_a(this.field_71349_l.field_71474_y.field_74318_M); } @@ -141,9 +119,10 @@ - this.setAllowFlight(true); - logger.info("Generating keypair"); - this.setKeyPair(CryptManager.generateKeyPair()); + this.func_71245_h(true); + field_147148_h.info("Generating keypair"); + this.func_71253_a(CryptManager.func_75891_b()); + if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; - this.loadAllWorlds(this.getFolderName(), this.getWorldName(), this.theWorldSettings.getSeed(), this.theWorldSettings.getTerrainType(), this.theWorldSettings.getWorldName()); - this.setMOTD(this.getServerOwner() + " - " + this.worldServers[0].getWorldInfo().getWorldName()); + this.func_71247_a(this.func_71270_I(), this.func_71221_J(), this.field_71350_m.func_77160_d(), this.field_71350_m.func_77165_h(), this.field_71350_m.func_82749_j()); + this.func_71205_p(this.func_71214_G() + " - " + this.field_71305_c[0].func_72912_H().func_76065_j()); - return true; + return net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarting(this); } - public void tick() + public void func_71217_p() @@ -216,6 +195,7 @@ - public EnumDifficulty getDifficulty() + public EnumDifficulty func_147135_j() { -+ if (this.mc.theWorld == null) return this.mc.gameSettings.difficulty; // Fix NPE just in case. - return this.mc.theWorld.getWorldInfo().getDifficulty(); ++ if (this.field_71349_l.field_71441_e == null) return this.field_71349_l.field_71474_y.field_74318_M; // Fix NPE just in case. + return this.field_71349_l.field_71441_e.func_72912_H().func_176130_y(); } diff --git a/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch b/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch index 7ec3ff397..e9e80922d 100644 --- a/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch @@ -6,141 +6,141 @@ { + /** Forge reach distance */ + private double blockReachDistance = 5.0d; - public World theWorld; - public EntityPlayerMP thisPlayerMP; - private WorldSettings.GameType gameType = WorldSettings.GameType.NOT_SET; + public World field_73092_a; + public EntityPlayerMP field_73090_b; + private WorldSettings.GameType field_73091_c = WorldSettings.GameType.NOT_SET; @@ -130,6 +132,14 @@ - public void onBlockClicked(BlockPos pos, EnumFacing side) + public void func_180784_a(BlockPos p_180784_1_, EnumFacing p_180784_2_) { -+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thisPlayerMP, -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, theWorld, pos, side); ++ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_73090_b, ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, field_73092_a, p_180784_1_, p_180784_2_); + if (event.isCanceled()) + { -+ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(field_73092_a, p_180784_1_)); + return; + } + - if (this.isCreative()) + if (this.func_73083_d()) { - if (!this.theWorld.extinguishFire((EntityPlayer)null, pos, side)) + if (!this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_)) @@ -164,18 +174,35 @@ } } -- this.theWorld.extinguishFire((EntityPlayer)null, pos, side); +- this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_); + // - this.initialDamage = this.curblockDamage; + this.field_73089_e = this.field_73100_i; float f = 1.0F; -- if (block.getMaterial() != Material.air) -+ if (!block.isAir(theWorld, pos)) +- if (block.func_149688_o() != Material.field_151579_a) ++ if (!block.isAir(field_73092_a, p_180784_1_)) { -- block.onBlockClicked(this.theWorld, pos, this.thisPlayerMP); +- block.func_180649_a(this.field_73092_a, p_180784_1_, this.field_73090_b); + if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) + { -+ block.onBlockClicked(this.theWorld, pos, this.thisPlayerMP); -+ this.theWorld.extinguishFire((EntityPlayer)null, pos, side); ++ block.func_180649_a(this.field_73092_a, p_180784_1_, this.field_73090_b); ++ this.field_73092_a.func_175719_a((EntityPlayer)null, p_180784_1_, p_180784_2_); + } + else + { -+ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(field_73092_a, p_180784_1_)); + } - f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos); + f = block.func_180647_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180784_1_); } -- if (block.getMaterial() != Material.air && f >= 1.0F) +- if (block.func_149688_o() != Material.field_151579_a && f >= 1.0F) + if (event.useItem == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) { + if (f >= 1.0F) + { -+ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(field_73092_a, p_180784_1_)); + } + return; + } + -+ if (!block.isAir(theWorld, pos) && f >= 1.0F) ++ if (!block.isAir(field_73092_a, p_180784_1_) && f >= 1.0F) + { - this.tryHarvestBlock(pos); + this.func_180237_b(p_180784_1_); } else @@ -196,7 +223,7 @@ - int i = this.curblockDamage - this.initialDamage; - Block block = this.theWorld.getBlockState(pos).getBlock(); + int i = this.field_73100_i - this.field_73089_e; + Block block = this.field_73092_a.func_180495_p(p_180785_1_).func_177230_c(); -- if (block.getMaterial() != Material.air) -+ if (!block.isAir(theWorld, pos)) +- if (block.func_149688_o() != Material.field_151579_a) ++ if (!block.isAir(field_73092_a, p_180785_1_)) { - float f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos) * (float)(i + 1); + float f = block.func_180647_a(this.field_73090_b, this.field_73090_b.field_70170_p, p_180785_1_) * (float)(i + 1); @@ -225,9 +252,13 @@ - private boolean removeBlock(BlockPos pos) + private boolean func_180235_c(BlockPos p_180235_1_) { -+ return removeBlock(pos, false); ++ return removeBlock(p_180235_1_, false); + } -+ private boolean removeBlock(BlockPos pos, boolean canHarvest) ++ private boolean removeBlock(BlockPos p_180235_1_, boolean canHarvest) + { - IBlockState iblockstate = this.theWorld.getBlockState(pos); - iblockstate.getBlock().onBlockHarvested(this.theWorld, pos, iblockstate, this.thisPlayerMP); -- boolean flag = this.theWorld.setBlockToAir(pos); -+ boolean flag = iblockstate.getBlock().removedByPlayer(theWorld, pos, thisPlayerMP, canHarvest); + IBlockState iblockstate = this.field_73092_a.func_180495_p(p_180235_1_); + iblockstate.func_177230_c().func_176208_a(this.field_73092_a, p_180235_1_, iblockstate, this.field_73090_b); +- boolean flag = this.field_73092_a.func_175698_g(p_180235_1_); ++ boolean flag = iblockstate.func_177230_c().removedByPlayer(field_73092_a, p_180235_1_, field_73090_b, canHarvest); if (flag) { @@ -239,7 +270,8 @@ - public boolean tryHarvestBlock(BlockPos pos) + public boolean func_180237_b(BlockPos p_180237_1_) { -- if (this.gameType.isCreative() && this.thisPlayerMP.getHeldItem() != null && this.thisPlayerMP.getHeldItem().getItem() instanceof ItemSword) -+ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(theWorld, gameType, thisPlayerMP, pos); +- if (this.field_73091_c.func_77145_d() && this.field_73090_b.func_70694_bm() != null && this.field_73090_b.func_70694_bm().func_77973_b() instanceof ItemSword) ++ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(field_73092_a, field_73091_c, field_73090_b, p_180237_1_); + if (exp == -1) { return false; } @@ -248,40 +280,21 @@ - IBlockState iblockstate = this.theWorld.getBlockState(pos); - TileEntity tileentity = this.theWorld.getTileEntity(pos); + IBlockState iblockstate = this.field_73092_a.func_180495_p(p_180237_1_); + TileEntity tileentity = this.field_73092_a.func_175625_s(p_180237_1_); -- if (this.gameType.isAdventure()) +- if (this.field_73091_c.func_82752_c()) - { -- if (this.gameType == WorldSettings.GameType.SPECTATOR) +- if (this.field_73091_c == WorldSettings.GameType.SPECTATOR) - { - return false; - } -+ ItemStack stack = thisPlayerMP.getCurrentEquippedItem(); -+ if (stack != null && stack.getItem().onBlockStartBreak(stack, pos, thisPlayerMP)) return false; ++ ItemStack stack = field_73090_b.func_71045_bC(); ++ if (stack != null && stack.func_77973_b().onBlockStartBreak(stack, p_180237_1_, field_73090_b)) return false; -- if (!this.thisPlayerMP.isAllowEdit()) +- if (!this.field_73090_b.func_175142_cm()) - { -- ItemStack itemstack = this.thisPlayerMP.getCurrentEquippedItem(); +- ItemStack itemstack = this.field_73090_b.func_71045_bC(); - - if (itemstack == null) - { - return false; - } - -- if (!itemstack.canDestroy(iblockstate.getBlock())) +- if (!itemstack.func_179544_c(iblockstate.func_177230_c())) - { - return false; - } - } - } - - this.theWorld.playAuxSFXAtEntity(this.thisPlayerMP, 2001, pos, Block.getStateId(iblockstate)); -- boolean flag1 = this.removeBlock(pos); + this.field_73092_a.func_180498_a(this.field_73090_b, 2001, p_180237_1_, Block.func_176210_f(iblockstate)); +- boolean flag1 = this.func_180235_c(p_180237_1_); + boolean flag1 = false; - if (this.isCreative()) + if (this.func_73083_d()) { -+ flag1 = this.removeBlock(pos); - this.thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(this.theWorld, pos)); ++ flag1 = this.func_180235_c(p_180237_1_); + this.field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(this.field_73092_a, p_180237_1_)); } else { - ItemStack itemstack1 = this.thisPlayerMP.getCurrentEquippedItem(); -- boolean flag = this.thisPlayerMP.canHarvestBlock(iblockstate.getBlock()); -+ boolean flag = iblockstate.getBlock().canHarvestBlock(theWorld, pos, thisPlayerMP); + ItemStack itemstack1 = this.field_73090_b.func_71045_bC(); +- boolean flag = this.field_73090_b.func_146099_a(iblockstate.func_177230_c()); ++ boolean flag = iblockstate.func_177230_c().canHarvestBlock(field_73092_a, p_180237_1_, field_73090_b); if (itemstack1 != null) { @@ -148,94 +148,94 @@ } } -+ flag1 = this.removeBlock(pos, flag); ++ flag1 = this.removeBlock(p_180237_1_, flag); if (flag1 && flag) { - iblockstate.getBlock().harvestBlock(this.theWorld, this.thisPlayerMP, pos, iblockstate, tileentity); + iblockstate.func_177230_c().func_180657_a(this.field_73092_a, this.field_73090_b, p_180237_1_, iblockstate, tileentity); } } + // Drop experiance -+ if (!this.isCreative() && flag1 && exp > 0) ++ if (!this.func_73083_d() && flag1 && exp > 0) + { -+ iblockstate.getBlock().dropXpOnBlockBreak(theWorld, pos, exp); ++ iblockstate.func_177230_c().func_180637_b(field_73092_a, p_180237_1_, exp); + } return flag1; } } @@ -332,6 +351,7 @@ - if (itemstack.stackSize == 0) + if (itemstack.field_77994_a == 0) { - player.inventory.mainInventory[player.inventory.currentItem] = null; -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, itemstack); + p_73085_1_.field_71071_by.field_70462_a[p_73085_1_.field_71071_by.field_70461_c] = null; ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_73085_1_, itemstack); } - if (!player.isUsingItem()) + if (!p_73085_1_.func_71039_bw()) @@ -380,33 +400,51 @@ } else { -- if (!player.isSneaking() || player.getHeldItem() == null) -+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(player, -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, worldIn, pos, side); +- if (!p_180236_1_.func_70093_af() || p_180236_1_.func_70694_bm() == null) ++ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(p_180236_1_, ++ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, p_180236_2_, p_180236_4_, p_180236_5_); + if (event.isCanceled()) { -- IBlockState iblockstate = worldIn.getBlockState(pos); +- IBlockState iblockstate = p_180236_2_.func_180495_p(p_180236_4_); - -- if (iblockstate.getBlock().onBlockActivated(worldIn, pos, iblockstate, player, side, p_180236_6_, p_180236_7_, p_180236_8_)) +- if (iblockstate.func_177230_c().func_180639_a(p_180236_2_, p_180236_4_, iblockstate, p_180236_1_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_)) - { - return true; - } -+ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(field_73092_a, p_180236_4_)); + return false; } -- if (stack == null) -+ if (stack != null && stack.getItem().onItemUseFirst(stack, player, worldIn, pos, side, p_180236_6_, p_180236_7_, p_180236_8_)) +- if (p_180236_3_ == null) ++ if (p_180236_3_ != null && p_180236_3_.func_77973_b().onItemUseFirst(p_180236_3_, p_180236_1_, p_180236_2_, p_180236_4_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_)) { - return false; -+ if (stack.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(thisPlayerMP, stack); ++ if (p_180236_3_.field_77994_a <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(field_73090_b, p_180236_3_); + return true; } -- else if (this.isCreative()) +- else if (this.func_73083_d()) + -+ IBlockState iblockstate = worldIn.getBlockState(pos); -+ boolean isAir = worldIn.isAirBlock(pos); -+ boolean useBlock = !player.isSneaking() || player.getHeldItem() == null; -+ if (!useBlock) useBlock = player.getHeldItem().getItem().doesSneakBypassUse(worldIn, pos, player); ++ IBlockState iblockstate = p_180236_2_.func_180495_p(p_180236_4_); ++ boolean isAir = p_180236_2_.func_175623_d(p_180236_4_); ++ boolean useBlock = !p_180236_1_.func_70093_af() || p_180236_1_.func_70694_bm() == null; ++ if (!useBlock) useBlock = p_180236_1_.func_70694_bm().func_77973_b().doesSneakBypassUse(p_180236_2_, p_180236_4_, p_180236_1_); + boolean result = false; + + if (useBlock) { -- int j = stack.getMetadata(); -- int i = stack.stackSize; -- boolean flag = stack.onItemUse(player, worldIn, pos, side, p_180236_6_, p_180236_7_, p_180236_8_); -- stack.setItemDamage(j); -- stack.stackSize = i; +- int j = p_180236_3_.func_77960_j(); +- int i = p_180236_3_.field_77994_a; +- boolean flag = p_180236_3_.func_179546_a(p_180236_1_, p_180236_2_, p_180236_4_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_); +- p_180236_3_.func_77964_b(j); +- p_180236_3_.field_77994_a = i; - return flag; + if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) + { -+ result = iblockstate.getBlock().onBlockActivated(worldIn, pos, iblockstate, player, side, p_180236_6_, p_180236_7_, p_180236_8_); ++ result = iblockstate.func_177230_c().func_180639_a(p_180236_2_, p_180236_4_, iblockstate, p_180236_1_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_); + } + else + { -+ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); ++ field_73090_b.field_71135_a.func_147359_a(new S23PacketBlockChange(field_73092_a, p_180236_4_)); + result = event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW; + } } - else -+ if (stack != null && !result && event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) ++ if (p_180236_3_ != null && !result && event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) { -- return stack.onItemUse(player, worldIn, pos, side, p_180236_6_, p_180236_7_, p_180236_8_); -+ int meta = stack.getMetadata(); -+ int size = stack.stackSize; -+ result = stack.onItemUse(player, worldIn, pos, side, p_180236_6_, p_180236_7_, p_180236_8_); -+ if (isCreative()) +- return p_180236_3_.func_179546_a(p_180236_1_, p_180236_2_, p_180236_4_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_); ++ int meta = p_180236_3_.func_77960_j(); ++ int size = p_180236_3_.field_77994_a; ++ result = p_180236_3_.func_179546_a(p_180236_1_, p_180236_2_, p_180236_4_, p_180236_5_, p_180236_6_, p_180236_7_, p_180236_8_); ++ if (func_73083_d()) + { -+ stack.setItemDamage(meta); -+ stack.stackSize = size; ++ p_180236_3_.func_77964_b(meta); ++ p_180236_3_.field_77994_a = size; + } -+ if (stack.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(thisPlayerMP, stack); ++ if (p_180236_3_.field_77994_a <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(field_73090_b, p_180236_3_); } + return result; } @@ -243,7 +243,7 @@ @@ -414,4 +452,13 @@ { - this.theWorld = serverWorld; + this.field_73092_a = p_73080_1_; } + + public double getBlockReachDistance() diff --git a/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch index 87dfd5295..e0c026df7 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch @@ -1,17 +1,17 @@ --- ../src-base/minecraft/net/minecraft/server/management/PlayerManager.java +++ ../src-work/minecraft/net/minecraft/server/management/PlayerManager.java @@ -117,15 +117,24 @@ - int j = (int)p_72683_1_.posZ >> 4; - p_72683_1_.managedPosX = p_72683_1_.posX; - p_72683_1_.managedPosZ = p_72683_1_.posZ; + int j = (int)p_72683_1_.field_70161_v >> 4; + p_72683_1_.field_71131_d = p_72683_1_.field_70165_t; + p_72683_1_.field_71132_e = p_72683_1_.field_70161_v; + // Load nearby chunks first + List chunkList = Lists.newArrayList(); - for (int k = i - this.playerViewRadius; k <= i + this.playerViewRadius; ++k) + for (int k = i - this.field_72698_e; k <= i + this.field_72698_e; ++k) { - for (int l = j - this.playerViewRadius; l <= j + this.playerViewRadius; ++l) + for (int l = j - this.field_72698_e; l <= j + this.field_72698_e; ++l) { -- this.getPlayerInstance(k, l, true).addPlayer(p_72683_1_); +- this.func_72690_a(k, l, true).func_73255_a(p_72683_1_); + chunkList.add(new ChunkCoordIntPair(k, l)); } } @@ -20,14 +20,14 @@ + + for (ChunkCoordIntPair pair : chunkList) + { -+ this.getPlayerInstance(pair.chunkXPos, pair.chunkZPos, true).addPlayer(p_72683_1_); ++ this.func_72690_a(pair.field_77276_a, pair.field_77275_b, true).func_73255_a(p_72683_1_); + } + - this.players.add(p_72683_1_); - this.filterChunkLoadQueue(p_72683_1_); + this.field_72699_b.add(p_72683_1_); + this.func_72691_b(p_72683_1_); } @@ -225,6 +234,7 @@ - int i1 = this.playerViewRadius; + int i1 = this.field_72698_e; int j1 = i - k; int k1 = j - l; + List chunksToLoad = Lists.newArrayList(); @@ -36,36 +36,36 @@ { @@ -234,7 +244,7 @@ { - if (!this.overlaps(l1, i2, k, l, i1)) + if (!this.func_72684_a(l1, i2, k, l, i1)) { -- this.getPlayerInstance(l1, i2, true).addPlayer(p_72685_1_); +- this.func_72690_a(l1, i2, true).func_73255_a(p_72685_1_); + chunksToLoad.add(new ChunkCoordIntPair(l1, i2)); } - if (!this.overlaps(l1 - j1, i2 - k1, i, j, i1)) + if (!this.func_72684_a(l1 - j1, i2 - k1, i, j, i1)) @@ -252,6 +262,18 @@ - this.filterChunkLoadQueue(p_72685_1_); - p_72685_1_.managedPosX = p_72685_1_.posX; - p_72685_1_.managedPosZ = p_72685_1_.posZ; + this.func_72691_b(p_72685_1_); + p_72685_1_.field_71131_d = p_72685_1_.field_70165_t; + p_72685_1_.field_71132_e = p_72685_1_.field_70161_v; + // send nearest chunks first + java.util.Collections.sort(chunksToLoad, new net.minecraftforge.common.util.ChunkCoordComparator(p_72685_1_)); + + for (ChunkCoordIntPair pair : chunksToLoad) + { -+ this.getPlayerInstance(pair.chunkXPos, pair.chunkZPos, true).addPlayer(p_72685_1_); ++ this.func_72690_a(pair.field_77276_a, pair.field_77275_b, true).func_73255_a(p_72685_1_); + } + + if (i1 > 1 || i1 < -1 || j1 > 1 || j1 < -1) + { -+ java.util.Collections.sort(p_72685_1_.loadedChunks, new net.minecraftforge.common.util.ChunkCoordComparator(p_72685_1_)); ++ java.util.Collections.sort(p_72685_1_.field_71129_f, new net.minecraftforge.common.util.ChunkCoordComparator(p_72685_1_)); + } } } } @@ -322,11 +344,20 @@ - private int numBlocksToUpdate; - private int flagsYAreasToUpdate; - private long previousWorldTime; + private int field_73262_e; + private int field_73260_f; + private long field_111198_g; + private final java.util.HashMap players = new java.util.HashMap(); + private boolean loaded = false; + private Runnable loadedRunnable = new Runnable() @@ -78,20 +78,20 @@ public PlayerInstance(int p_i1518_2_, int p_i1518_3_) { - this.chunkCoords = new ChunkCoordIntPair(p_i1518_2_, p_i1518_3_); -- PlayerManager.this.getMinecraftServer().theChunkProviderServer.loadChunk(p_i1518_2_, p_i1518_3_); -+ PlayerManager.this.getMinecraftServer().theChunkProviderServer.loadChunk(p_i1518_2_, p_i1518_3_, this.loadedRunnable); + this.field_73264_c = new ChunkCoordIntPair(p_i1518_2_, p_i1518_3_); +- PlayerManager.this.func_72688_a().field_73059_b.func_73158_c(p_i1518_2_, p_i1518_3_); ++ PlayerManager.this.func_72688_a().field_73059_b.loadChunk(p_i1518_2_, p_i1518_3_, this.loadedRunnable); } - public void addPlayer(EntityPlayerMP p_73255_1_) + public void func_73255_a(EntityPlayerMP p_73255_1_) @@ -343,7 +374,24 @@ } - this.playersWatchingChunk.add(p_73255_1_); + this.field_73263_b.add(p_73255_1_); + Runnable playerRunnable = null; + if (this.loaded) + { - p_73255_1_.loadedChunks.add(this.chunkCoords); + p_73255_1_.field_71129_f.add(this.field_73264_c); + } + else + { @@ -100,10 +100,10 @@ + { + public void run() + { -+ tmp.loadedChunks.add(PlayerInstance.this.chunkCoords); ++ tmp.field_71129_f.add(PlayerInstance.this.field_73264_c); + } + }; -+ PlayerManager.this.getMinecraftServer().theChunkProviderServer.loadChunk(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, playerRunnable); ++ PlayerManager.this.func_72688_a().field_73059_b.loadChunk(this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b, playerRunnable); + } + this.players.put(p_73255_1_, playerRunnable); } @@ -111,47 +111,47 @@ @@ -351,6 +399,24 @@ { - if (this.playersWatchingChunk.contains(p_73252_1_)) + if (this.field_73263_b.contains(p_73252_1_)) { + // If we haven't loaded yet don't load the chunk just so we can clean it up + if (!this.loaded) + { -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.getMinecraftServer(), this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, this.players.get(p_73252_1_)); -+ this.playersWatchingChunk.remove(p_73252_1_); ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.func_72688_a(), this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b, this.players.get(p_73252_1_)); ++ this.field_73263_b.remove(p_73252_1_); + this.players.remove(p_73252_1_); + -+ if (this.playersWatchingChunk.isEmpty()) ++ if (this.field_73263_b.isEmpty()) + { -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.getMinecraftServer(), this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, this.loadedRunnable); -+ long i = (long) this.chunkCoords.chunkXPos + 2147483647L | (long) this.chunkCoords.chunkZPos + 2147483647L << 32; -+ PlayerManager.this.playerInstances.remove(i); -+ PlayerManager.this.playerInstanceList.remove(this); ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.func_72688_a(), this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b, this.loadedRunnable); ++ long i = (long) this.field_73264_c.field_77276_a + 2147483647L | (long) this.field_73264_c.field_77275_b + 2147483647L << 32; ++ PlayerManager.this.field_72700_c.func_76159_d(i); ++ PlayerManager.this.field_111193_e.remove(this); + } + + return; + } + - Chunk chunk = PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos); + Chunk chunk = PlayerManager.this.field_72701_a.func_72964_e(this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b); - if (chunk.isPopulated()) + if (chunk.func_150802_k()) @@ -358,9 +424,12 @@ - p_73252_1_.playerNetServerHandler.sendPacket(new S21PacketChunkData(chunk, true, 0)); + p_73252_1_.field_71135_a.func_147359_a(new S21PacketChunkData(chunk, true, 0)); } + this.players.remove(p_73252_1_); - this.playersWatchingChunk.remove(p_73252_1_); - p_73252_1_.loadedChunks.remove(this.chunkCoords); + this.field_73263_b.remove(p_73252_1_); + p_73252_1_.field_71129_f.remove(this.field_73264_c); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.UnWatch(chunkCoords, p_73252_1_)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.UnWatch(field_73264_c, p_73252_1_)); + - if (this.playersWatchingChunk.isEmpty()) + if (this.field_73263_b.isEmpty()) { - long i = (long)this.chunkCoords.chunkXPos + 2147483647L | (long)this.chunkCoords.chunkZPos + 2147483647L << 32; + long i = (long)this.field_73264_c.field_77276_a + 2147483647L | (long)this.field_73264_c.field_77275_b + 2147483647L << 32; @@ -398,7 +467,7 @@ - this.flagsYAreasToUpdate |= 1 << (p_151253_2_ >> 4); + this.field_73260_f |= 1 << (p_151253_2_ >> 4); -- if (this.numBlocksToUpdate < 64) +- if (this.field_73262_e < 64) + //Forge; Cache everything, so always run { short short1 = (short)(p_151253_1_ << 12 | p_151253_3_ << 8 | p_151253_2_); @@ -160,11 +160,11 @@ } } -+ if (numBlocksToUpdate == locationOfBlockChange.length) ++ if (field_73262_e == field_151254_d.length) + { -+ locationOfBlockChange = java.util.Arrays.copyOf(locationOfBlockChange, locationOfBlockChange.length << 1); ++ field_151254_d = java.util.Arrays.copyOf(field_151254_d, field_151254_d.length << 1); + } - this.locationOfBlockChange[this.numBlocksToUpdate++] = short1; + this.field_151254_d[this.field_73262_e++] = short1; } } @@ -427,6 +500,7 @@ @@ -172,49 +172,49 @@ } + @SuppressWarnings("unused") - public void onUpdate() + public void func_73254_a() { - if (this.numBlocksToUpdate != 0) + if (this.field_73262_e != 0) @@ -439,18 +513,19 @@ BlockPos blockpos = new BlockPos(i, j, k); - this.sendToAllPlayersWatchingChunk(new S23PacketBlockChange(PlayerManager.this.theWorldServer, blockpos)); + this.func_151251_a(new S23PacketBlockChange(PlayerManager.this.field_72701_a, blockpos)); -- if (PlayerManager.this.theWorldServer.getBlockState(blockpos).getBlock().hasTileEntity()) -+ if (PlayerManager.this.theWorldServer.getBlockState(blockpos).getBlock().hasTileEntity(PlayerManager.this.theWorldServer.getBlockState(blockpos))) +- if (PlayerManager.this.field_72701_a.func_180495_p(blockpos).func_177230_c().func_149716_u()) ++ if (PlayerManager.this.field_72701_a.func_180495_p(blockpos).func_177230_c().hasTileEntity(PlayerManager.this.field_72701_a.func_180495_p(blockpos))) { - this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos)); + this.func_151252_a(PlayerManager.this.field_72701_a.func_175625_s(blockpos)); } } -- else if (this.numBlocksToUpdate == 64) -+ else if (this.numBlocksToUpdate >= net.minecraftforge.common.ForgeModContainer.clumpingThreshold) +- else if (this.field_73262_e == 64) ++ else if (this.field_73262_e >= net.minecraftforge.common.ForgeModContainer.clumpingThreshold) { - int i1 = this.chunkCoords.chunkXPos * 16; - int k1 = this.chunkCoords.chunkZPos * 16; - this.sendToAllPlayersWatchingChunk(new S21PacketChunkData(PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos), false, this.flagsYAreasToUpdate)); + int i1 = this.field_73264_c.field_77276_a * 16; + int k1 = this.field_73264_c.field_77275_b * 16; + this.func_151251_a(new S21PacketChunkData(PlayerManager.this.field_72701_a.func_72964_e(this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b), false, this.field_73260_f)); - for (int i2 = 0; i2 < 16; ++i2) + // Forge: Grabs ALL tile entities is costly on a modded server, only send needed ones + for (int i2 = 0; false && i2 < 16; ++i2) { - if ((this.flagsYAreasToUpdate & 1 << i2) != 0) + if ((this.field_73260_f & 1 << i2) != 0) { @@ -467,7 +542,9 @@ else { - this.sendToAllPlayersWatchingChunk(new S22PacketMultiBlockChange(this.numBlocksToUpdate, this.locationOfBlockChange, PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos))); + this.func_151251_a(new S22PacketMultiBlockChange(this.field_73262_e, this.field_151254_d, PlayerManager.this.field_72701_a.func_72964_e(this.field_73264_c.field_77276_a, this.field_73264_c.field_77275_b))); - + } + { // Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small -+ WorldServer world = PlayerManager.this.theWorldServer; - for (int j1 = 0; j1 < this.numBlocksToUpdate; ++j1) ++ WorldServer world = PlayerManager.this.field_72701_a; + for (int j1 = 0; j1 < this.field_73262_e; ++j1) { - int l1 = (this.locationOfBlockChange[j1] >> 12 & 15) + this.chunkCoords.chunkXPos * 16; + int l1 = (this.field_151254_d[j1] >> 12 & 15) + this.field_73264_c.field_77276_a * 16; @@ -475,7 +552,7 @@ - int l2 = (this.locationOfBlockChange[j1] >> 8 & 15) + this.chunkCoords.chunkZPos * 16; + int l2 = (this.field_151254_d[j1] >> 8 & 15) + this.field_73264_c.field_77275_b * 16; BlockPos blockpos1 = new BlockPos(l1, j2, l2); -- if (PlayerManager.this.theWorldServer.getBlockState(blockpos1).getBlock().hasTileEntity()) -+ if (world.getBlockState(blockpos1).getBlock().hasTileEntity(world.getBlockState(blockpos1))) +- if (PlayerManager.this.field_72701_a.func_180495_p(blockpos1).func_177230_c().func_149716_u()) ++ if (world.func_180495_p(blockpos1).func_177230_c().hasTileEntity(world.func_180495_p(blockpos1))) { - this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos1)); + this.func_151252_a(PlayerManager.this.field_72701_a.func_175625_s(blockpos1)); } diff --git a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch index 49fa524a5..2f7ace96d 100644 --- a/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch @@ -1,54 +1,54 @@ --- ../src-base/minecraft/net/minecraft/server/management/ServerConfigurationManager.java +++ ../src-work/minecraft/net/minecraft/server/management/ServerConfigurationManager.java @@ -99,7 +99,7 @@ - this.maxPlayers = 8; + this.field_72405_c = 8; } -- public void initializeConnectionToPlayer(NetworkManager netManager, EntityPlayerMP playerIn) -+ public void initializeConnectionToPlayer(NetworkManager netManager, EntityPlayerMP playerIn, NetHandlerPlayServer nethandlerplayserver) +- public void func_72355_a(NetworkManager p_72355_1_, EntityPlayerMP p_72355_2_) ++ public void func_72355_a(NetworkManager p_72355_1_, EntityPlayerMP p_72355_2_, NetHandlerPlayServer nethandlerplayserver) { - GameProfile gameprofile = playerIn.getGameProfile(); - PlayerProfileCache playerprofilecache = this.mcServer.getPlayerProfileCache(); + GameProfile gameprofile = p_72355_2_.func_146103_bH(); + PlayerProfileCache playerprofilecache = this.field_72400_f.func_152358_ax(); @@ -108,6 +108,17 @@ playerprofilecache.func_152649_a(gameprofile); - NBTTagCompound nbttagcompound = this.readPlayerDataFromFile(playerIn); - playerIn.setWorld(this.mcServer.worldServerForDimension(playerIn.dimension)); + NBTTagCompound nbttagcompound = this.func_72380_a(p_72355_2_); + p_72355_2_.func_70029_a(this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK)); + -+ World playerWorld = this.mcServer.worldServerForDimension(playerIn.dimension); ++ World playerWorld = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK); + if (playerWorld == null) + { -+ playerIn.dimension=0; -+ playerWorld=this.mcServer.worldServerForDimension(0); -+ BlockPos spawnPoint = playerWorld.provider.getRandomizedSpawnPoint(); -+ playerIn.setPosition(spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ()); ++ p_72355_2_.field_71093_bK=0; ++ playerWorld=this.field_72400_f.func_71218_a(0); ++ BlockPos spawnPoint = playerWorld.field_73011_w.getRandomizedSpawnPoint(); ++ p_72355_2_.func_70107_b(spawnPoint.func_177958_n(), spawnPoint.func_177956_o(), spawnPoint.func_177952_p()); + } + -+ playerIn.setWorld(playerWorld); - playerIn.theItemInWorldManager.setWorld((WorldServer)playerIn.worldObj); ++ p_72355_2_.func_70029_a(playerWorld); + p_72355_2_.field_71134_c.func_73080_a((WorldServer)p_72355_2_.field_70170_p); String s1 = "local"; @@ -121,7 +132,7 @@ - WorldInfo worldinfo = worldserver.getWorldInfo(); - BlockPos blockpos = worldserver.getSpawnPoint(); - this.func_72381_a(playerIn, (EntityPlayerMP)null, worldserver); -- NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.mcServer, netManager, playerIn); -+ playerIn.playerNetServerHandler = nethandlerplayserver; - nethandlerplayserver.sendPacket(new S01PacketJoinGame(playerIn.getEntityId(), playerIn.theItemInWorldManager.getGameType(), worldinfo.isHardcoreModeEnabled(), worldserver.provider.getDimensionId(), worldserver.getDifficulty(), this.getMaxPlayers(), worldinfo.getTerrainType(), worldserver.getGameRules().getGameRuleBooleanValue("reducedDebugInfo"))); - nethandlerplayserver.sendPacket(new S3FPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(this.getServerInstance().getServerModName()))); - nethandlerplayserver.sendPacket(new S41PacketServerDifficulty(worldinfo.getDifficulty(), worldinfo.isDifficultyLocked())); + WorldInfo worldinfo = worldserver.func_72912_H(); + BlockPos blockpos = worldserver.func_175694_M(); + this.func_72381_a(p_72355_2_, (EntityPlayerMP)null, worldserver); +- NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.field_72400_f, p_72355_1_, p_72355_2_); ++ p_72355_2_.field_71135_a = nethandlerplayserver; + nethandlerplayserver.func_147359_a(new S01PacketJoinGame(p_72355_2_.func_145782_y(), p_72355_2_.field_71134_c.func_73081_b(), worldinfo.func_76093_s(), worldserver.field_73011_w.func_177502_q(), worldserver.func_175659_aa(), this.func_72352_l(), worldinfo.func_76067_t(), worldserver.func_82736_K().func_82766_b("reducedDebugInfo"))); + nethandlerplayserver.func_147359_a(new S3FPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).func_180714_a(this.func_72365_p().getServerModName()))); + nethandlerplayserver.func_147359_a(new S41PacketServerDifficulty(worldinfo.func_176130_y(), worldinfo.func_176123_z())); @@ -161,6 +172,7 @@ - playerIn.addSelfToInternalCraftingInventory(); + p_72355_2_.func_71116_b(); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedIn(playerIn); - if (nbttagcompound != null && nbttagcompound.hasKey("Riding", 10)) ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedIn(p_72355_2_); + if (nbttagcompound != null && nbttagcompound.func_150297_b("Riding", 10)) { - Entity entity = EntityList.createEntityFromNBT(nbttagcompound.getCompoundTag("Riding"), worldserver); + Entity entity = EntityList.func_75615_a(nbttagcompound.func_74775_l("Riding"), worldserver); @@ -262,6 +274,7 @@ - playerIn.readFromNBT(nbttagcompound); + p_72380_1_.func_70020_e(nbttagcompound); nbttagcompound1 = nbttagcompound; - logger.debug("loading single player"); -+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(playerIn, this.playerNBTManagerObj, playerIn.getUniqueID().toString()); + 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()); } else { @@ -59,165 +59,165 @@ + public NBTTagCompound getPlayerNBT(EntityPlayerMP player) + { + // Hacky method to allow loading the NBT for a player prior to login -+ NBTTagCompound nbttagcompound = this.mcServer.worldServers[0].getWorldInfo().getPlayerNBTTagCompound(); -+ if (player.getName().equals(this.mcServer.getServerOwner()) && nbttagcompound != null) ++ NBTTagCompound nbttagcompound = this.field_72400_f.field_71305_c[0].func_72912_H().func_76072_h(); ++ if (player.func_70005_c_().equals(this.field_72400_f.func_71214_G()) && nbttagcompound != null) + { + return nbttagcompound; + } + else + { -+ return ((net.minecraft.world.storage.SaveHandler)this.playerNBTManagerObj).getPlayerNBT(player); ++ return ((net.minecraft.world.storage.SaveHandler)this.field_72412_k).getPlayerNBT(player); + } + } - protected void writePlayerData(EntityPlayerMP playerIn) + protected void func_72391_b(EntityPlayerMP p_72391_1_) { -+ if (playerIn.playerNetServerHandler == null) return; ++ if (p_72391_1_.field_71135_a == null) return; + - this.playerNBTManagerObj.writePlayerData(playerIn); - StatisticsFile statisticsfile = (StatisticsFile)this.playerStatFiles.get(playerIn.getUniqueID()); + this.field_72412_k.func_75753_a(p_72391_1_); + StatisticsFile statisticsfile = (StatisticsFile)this.field_148547_k.get(p_72391_1_.func_110124_au()); @@ -288,6 +316,7 @@ - this.uuidToPlayerMap.put(playerIn.getUniqueID(), playerIn); - this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {playerIn})); - WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); - worldserver.spawnEntityInWorld(playerIn); - this.func_72375_a(playerIn, (WorldServer)null); + this.field_177454_f.put(p_72377_1_.func_110124_au(), p_72377_1_); + this.func_148540_a(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {p_72377_1_})); + WorldServer worldserver = this.field_72400_f.func_71218_a(p_72377_1_.field_71093_bK); ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.func_72394_k()); + worldserver.func_72838_d(p_72377_1_); + this.func_72375_a(p_72377_1_, (WorldServer)null); @@ -305,6 +334,7 @@ - public void playerLoggedOut(EntityPlayerMP playerIn) + public void func_72367_e(EntityPlayerMP p_72367_1_) { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedOut(playerIn); - playerIn.triggerAchievement(StatList.leaveGameStat); - this.writePlayerData(playerIn); - WorldServer worldserver = playerIn.getServerForPlayer(); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedOut(p_72367_1_); + p_72367_1_.func_71029_a(StatList.field_75947_j); + this.func_72391_b(p_72367_1_); + WorldServer worldserver = p_72367_1_.func_71121_q(); @@ -326,6 +356,7 @@ - this.uuidToPlayerMap.remove(uuid); - this.playerStatFiles.remove(uuid); + this.field_177454_f.remove(uuid); + this.field_148547_k.remove(uuid); } -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.func_72394_k()); - this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn})); + this.func_148540_a(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {p_72367_1_})); } @@ -409,13 +440,23 @@ - public EntityPlayerMP recreatePlayerEntity(EntityPlayerMP playerIn, int dimension, boolean conqueredEnd) + public EntityPlayerMP func_72368_a(EntityPlayerMP p_72368_1_, int p_72368_2_, boolean p_72368_3_) { -+ World world = mcServer.worldServerForDimension(dimension); ++ World world = field_72400_f.func_71218_a(p_72368_2_); + if (world == null) + { -+ dimension = 0; ++ p_72368_2_ = 0; + } -+ else if (!world.provider.canRespawnHere()) ++ else if (!world.field_73011_w.func_76567_e()) + { -+ dimension = world.provider.getRespawnDimension(playerIn); ++ p_72368_2_ = world.field_73011_w.getRespawnDimension(p_72368_1_); + } + - playerIn.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(playerIn); - playerIn.getServerForPlayer().getEntityTracker().untrackEntity(playerIn); - playerIn.getServerForPlayer().getPlayerManager().removePlayer(playerIn); - this.playerEntityList.remove(playerIn); - this.mcServer.worldServerForDimension(playerIn.dimension).removePlayerEntityDangerously(playerIn); -- BlockPos blockpos = playerIn.getBedLocation(); -- boolean flag = playerIn.isSpawnForced(); -+ BlockPos blockpos = playerIn.getBedLocation(dimension); -+ boolean flag = playerIn.isSpawnForced(dimension); - playerIn.dimension = dimension; + p_72368_1_.func_71121_q().func_73039_n().func_72787_a(p_72368_1_); + p_72368_1_.func_71121_q().func_73039_n().func_72790_b(p_72368_1_); + p_72368_1_.func_71121_q().func_73040_p().func_72695_c(p_72368_1_); + this.field_72404_b.remove(p_72368_1_); + this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK).func_72973_f(p_72368_1_); +- BlockPos blockpos = p_72368_1_.func_180470_cg(); +- boolean flag = p_72368_1_.func_82245_bX(); ++ BlockPos blockpos = p_72368_1_.getBedLocation(p_72368_2_); ++ boolean flag = p_72368_1_.isSpawnForced(p_72368_2_); + p_72368_1_.field_71093_bK = p_72368_2_; ItemInWorldManager iteminworldmanager; @@ -431,6 +472,7 @@ - EntityPlayerMP entityplayermp = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(playerIn.dimension), playerIn.getGameProfile(), iteminworldmanager); - entityplayermp.playerNetServerHandler = playerIn.playerNetServerHandler; - entityplayermp.clonePlayer(playerIn, conqueredEnd); -+ entityplayermp.dimension = dimension; - entityplayermp.setEntityId(playerIn.getEntityId()); - entityplayermp.func_174817_o(playerIn); - WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); + EntityPlayerMP entityplayermp = new EntityPlayerMP(this.field_72400_f, this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK), p_72368_1_.func_146103_bH(), iteminworldmanager); + entityplayermp.field_71135_a = p_72368_1_.field_71135_a; + entityplayermp.func_71049_a(p_72368_1_, p_72368_3_); ++ entityplayermp.field_71093_bK = p_72368_2_; + entityplayermp.func_145769_d(p_72368_1_.func_145782_y()); + entityplayermp.func_174817_o(p_72368_1_); + WorldServer worldserver = this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK); @@ -470,19 +512,25 @@ - this.uuidToPlayerMap.put(entityplayermp.getUniqueID(), entityplayermp); - entityplayermp.addSelfToInternalCraftingInventory(); - entityplayermp.setHealth(entityplayermp.getHealth()); + this.field_177454_f.put(entityplayermp.func_110124_au(), entityplayermp); + entityplayermp.func_71116_b(); + entityplayermp.func_70606_j(entityplayermp.func_110143_aJ()); + net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp); return entityplayermp; } - public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension) + public void func_72356_a(EntityPlayerMP p_72356_1_, int p_72356_2_) { -+ transferPlayerToDimension(playerIn, dimension, mcServer.worldServerForDimension(dimension).getDefaultTeleporter()); ++ transferPlayerToDimension(p_72356_1_, p_72356_2_, field_72400_f.func_71218_a(p_72356_2_).func_85176_s()); + } + -+ public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension, net.minecraft.world.Teleporter teleporter) ++ public void transferPlayerToDimension(EntityPlayerMP p_72356_1_, int p_72356_2_, net.minecraft.world.Teleporter teleporter) + { - int i = playerIn.dimension; - WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); - playerIn.dimension = dimension; - WorldServer worldserver1 = this.mcServer.worldServerForDimension(playerIn.dimension); -- playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, playerIn.worldObj.getDifficulty(), playerIn.worldObj.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); -+ playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); - worldserver.removePlayerEntityDangerously(playerIn); - playerIn.isDead = false; -- this.transferEntityToWorld(playerIn, i, worldserver, worldserver1); -+ this.transferEntityToWorld(playerIn, i, worldserver, worldserver1, teleporter); - this.func_72375_a(playerIn, worldserver); - playerIn.playerNetServerHandler.setPlayerLocation(playerIn.posX, playerIn.posY, playerIn.posZ, playerIn.rotationYaw, playerIn.rotationPitch); - playerIn.theItemInWorldManager.setWorld(worldserver1); + int i = p_72356_1_.field_71093_bK; + WorldServer worldserver = this.field_72400_f.func_71218_a(p_72356_1_.field_71093_bK); + p_72356_1_.field_71093_bK = p_72356_2_; + WorldServer worldserver1 = this.field_72400_f.func_71218_a(p_72356_1_.field_71093_bK); +- p_72356_1_.field_71135_a.func_147359_a(new S07PacketRespawn(p_72356_1_.field_71093_bK, p_72356_1_.field_70170_p.func_175659_aa(), p_72356_1_.field_70170_p.func_72912_H().func_76067_t(), p_72356_1_.field_71134_c.func_73081_b())); ++ p_72356_1_.field_71135_a.func_147359_a(new S07PacketRespawn(p_72356_1_.field_71093_bK, worldserver1.func_175659_aa(), worldserver1.func_72912_H().func_76067_t(), p_72356_1_.field_71134_c.func_73081_b())); + worldserver.func_72973_f(p_72356_1_); + p_72356_1_.field_70128_L = false; +- this.func_82448_a(p_72356_1_, i, worldserver, worldserver1); ++ this.transferEntityToWorld(p_72356_1_, i, worldserver, worldserver1, teleporter); + this.func_72375_a(p_72356_1_, worldserver); + p_72356_1_.field_71135_a.func_147364_a(p_72356_1_.field_70165_t, p_72356_1_.field_70163_u, p_72356_1_.field_70161_v, p_72356_1_.field_70177_z, p_72356_1_.field_70125_A); + p_72356_1_.field_71134_c.func_73080_a(worldserver1); @@ -493,17 +541,27 @@ { - playerIn.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(playerIn.getEntityId(), potioneffect)); + p_72356_1_.field_71135_a.func_147359_a(new S1DPacketEntityEffect(p_72356_1_.func_145782_y(), potioneffect)); } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(playerIn, i, dimension); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(p_72356_1_, i, p_72356_2_); } - public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_) + public void func_82448_a(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_) { -- double d0 = entityIn.posX; -- double d1 = entityIn.posZ; -+ transferEntityToWorld(entityIn, p_82448_2_, p_82448_3_, p_82448_4_, p_82448_4_.getDefaultTeleporter()); +- double d0 = p_82448_1_.field_70165_t; +- double d1 = p_82448_1_.field_70161_v; ++ transferEntityToWorld(p_82448_1_, p_82448_2_, p_82448_3_, p_82448_4_, p_82448_4_.func_85176_s()); + } + + @SuppressWarnings("unused") -+ public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, net.minecraft.world.Teleporter teleporter) ++ public void transferEntityToWorld(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, net.minecraft.world.Teleporter teleporter) + { -+ net.minecraft.world.WorldProvider pOld = p_82448_3_.provider; -+ net.minecraft.world.WorldProvider pNew = p_82448_4_.provider; ++ net.minecraft.world.WorldProvider pOld = p_82448_3_.field_73011_w; ++ net.minecraft.world.WorldProvider pNew = p_82448_4_.field_73011_w; + double moveFactor = pOld.getMovementFactor() / pNew.getMovementFactor(); -+ double d0 = entityIn.posX * moveFactor; -+ double d1 = entityIn.posZ * moveFactor; ++ double d0 = p_82448_1_.field_70165_t * moveFactor; ++ double d1 = p_82448_1_.field_70161_v * moveFactor; double d2 = 8.0D; - float f = entityIn.rotationYaw; - p_82448_3_.theProfiler.startSection("moving"); + float f = p_82448_1_.field_70177_z; + p_82448_3_.field_72984_F.func_76320_a("moving"); -- if (entityIn.dimension == -1) -+ if (false && entityIn.dimension == -1) //Forge Kill it but dont comment out so we can rename it. +- if (p_82448_1_.field_71093_bK == -1) ++ if (false && p_82448_1_.field_71093_bK == -1) //Forge Kill it but dont comment out so we can rename it. { - d0 = MathHelper.clamp_double(d0 / d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); - d1 = MathHelper.clamp_double(d1 / d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); + d0 = MathHelper.func_151237_a(d0 / d2, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D); + d1 = MathHelper.func_151237_a(d1 / d2, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D); @@ -514,7 +572,7 @@ - p_82448_3_.updateEntityWithOptionalForce(entityIn, false); + p_82448_3_.func_72866_a(p_82448_1_, false); } } -- else if (entityIn.dimension == 0) -+ else if (false && entityIn.dimension == 0) //Forge Kill it but dont comment out so we can rename it. +- else if (p_82448_1_.field_71093_bK == 0) ++ else if (false && p_82448_1_.field_71093_bK == 0) //Forge Kill it but dont comment out so we can rename it. { - d0 = MathHelper.clamp_double(d0 * d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); - d1 = MathHelper.clamp_double(d1 * d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); + d0 = MathHelper.func_151237_a(d0 * d2, p_82448_4_.func_175723_af().func_177726_b() + 16.0D, p_82448_4_.func_175723_af().func_177728_d() - 16.0D); + d1 = MathHelper.func_151237_a(d1 * d2, p_82448_4_.func_175723_af().func_177736_c() + 16.0D, p_82448_4_.func_175723_af().func_177733_e() - 16.0D); @@ -525,7 +583,8 @@ - p_82448_3_.updateEntityWithOptionalForce(entityIn, false); + p_82448_3_.func_72866_a(p_82448_1_, false); } } - else + -+ if (entityIn.dimension == 1) ++ if (p_82448_1_.field_71093_bK == 1) { BlockPos blockpos; @@ -560,7 +619,7 @@ - if (entityIn.isEntityAlive()) + if (p_82448_1_.func_70089_S()) { - entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch); -- p_82448_4_.getDefaultTeleporter().placeInPortal(entityIn, f); -+ teleporter.placeInPortal(entityIn, f); - p_82448_4_.spawnEntityInWorld(entityIn); - p_82448_4_.updateEntityWithOptionalForce(entityIn, false); + p_82448_1_.func_70012_b(d0, p_82448_1_.field_70163_u, d1, p_82448_1_.field_70177_z, p_82448_1_.field_70125_A); +- p_82448_4_.func_85176_s().func_180266_a(p_82448_1_, f); ++ teleporter.func_180266_a(p_82448_1_, f); + p_82448_4_.func_72838_d(p_82448_1_); + p_82448_4_.func_72866_a(p_82448_1_, false); } diff --git a/patches/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch b/patches/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch index 6c4b46942..876f48a73 100644 --- a/patches/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch +++ b/patches/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch @@ -2,10 +2,10 @@ +++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java @@ -22,6 +22,8 @@ - public void processHandshake(C00Handshake packetIn) + public void func_147383_a(C00Handshake p_147383_1_) { -+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return; ++ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(p_147383_1_, this.field_147386_b)) return; + - switch (packetIn.getRequestedState()) + switch (p_147383_1_.func_149594_c()) { case LOGIN: diff --git a/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch b/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch index 207663b90..ad1cf3005 100644 --- a/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch +++ b/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch @@ -3,24 +3,24 @@ @@ -66,12 +66,12 @@ if (entityplayermp == null) { - this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT; -- this.server.getConfigurationManager().initializeConnectionToPlayer(this.networkManager, this.field_181025_l); -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.getConfigurationManager(), this.networkManager, this.field_181025_l); + this.field_147328_g = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT; +- this.field_147327_f.func_71203_ab().func_72355_a(this.field_147333_a, this.field_181025_l); ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.field_147327_f.func_71203_ab(), this.field_147333_a, this.field_181025_l); this.field_181025_l = null; } } -- if (this.connectionTimer++ == 600) -+ if (this.connectionTimer++ == net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.LOGIN_TIMEOUT) +- if (this.field_147336_h++ == 600) ++ if (this.field_147336_h++ == net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.LOGIN_TIMEOUT) { - this.closeConnection("Took too long to log in"); + this.func_147322_a("Took too long to log in"); } @@ -130,7 +130,7 @@ } else { -- this.server.getConfigurationManager().initializeConnectionToPlayer(this.networkManager, this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile)); -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.getConfigurationManager(), this.networkManager, this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile)); +- this.field_147327_f.func_71203_ab().func_72355_a(this.field_147333_a, this.field_147327_f.func_71203_ab().func_148545_a(this.field_147337_i)); ++ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.field_147327_f.func_71203_ab(), this.field_147333_a, this.field_147327_f.func_71203_ab().func_148545_a(this.field_147337_i)); } } } diff --git a/patches/minecraft/net/minecraft/stats/StatList.java.patch b/patches/minecraft/net/minecraft/stats/StatList.java.patch index 1ebd7b50f..08c48aaf6 100644 --- a/patches/minecraft/net/minecraft/stats/StatList.java.patch +++ b/patches/minecraft/net/minecraft/stats/StatList.java.patch @@ -4,35 +4,35 @@ } } -- replaceAllSimilarBlocks(objectCraftStats); -+ replaceAllSimilarBlocks(objectCraftStats, true); +- func_75924_a(field_75928_D); ++ replaceAllSimilarBlocks(field_75928_D, true); } - private static void initMiningStats() + private static void func_151181_c() @@ -141,7 +141,7 @@ } } -- replaceAllSimilarBlocks(mineBlockStatArray); -+ replaceAllSimilarBlocks(mineBlockStatArray, false); +- func_75924_a(field_75934_C); ++ replaceAllSimilarBlocks(field_75934_C, false); } - private static void initStats() + private static void func_75925_c() @@ -165,7 +165,7 @@ } } -- replaceAllSimilarBlocks(objectUseStats); -+ replaceAllSimilarBlocks(objectUseStats, true); +- func_75924_a(field_75929_E); ++ replaceAllSimilarBlocks(field_75929_E, true); } - private static void initItemDepleteStats() + private static void func_151179_e() @@ -184,7 +184,7 @@ } } -- replaceAllSimilarBlocks(objectBreakStats); -+ replaceAllSimilarBlocks(objectBreakStats, true); +- func_75924_a(field_75930_F); ++ replaceAllSimilarBlocks(field_75930_F, true); } private static String func_180204_a(Item p_180204_0_) @@ -40,52 +40,52 @@ return resourcelocation != null ? resourcelocation.toString().replace(':', '.') : null; } -- private static void replaceAllSimilarBlocks(StatBase[] p_75924_0_) +- private static void func_75924_a(StatBase[] p_75924_0_) + private static void replaceAllSimilarBlocks(StatBase[] p_75924_0_, boolean useItemIds) { -- func_151180_a(p_75924_0_, Blocks.water, Blocks.flowing_water); -- func_151180_a(p_75924_0_, Blocks.lava, Blocks.flowing_lava); -- func_151180_a(p_75924_0_, Blocks.lit_pumpkin, Blocks.pumpkin); -- func_151180_a(p_75924_0_, Blocks.lit_furnace, Blocks.furnace); -- func_151180_a(p_75924_0_, Blocks.lit_redstone_ore, Blocks.redstone_ore); -- func_151180_a(p_75924_0_, Blocks.powered_repeater, Blocks.unpowered_repeater); -- func_151180_a(p_75924_0_, Blocks.powered_comparator, Blocks.unpowered_comparator); -- func_151180_a(p_75924_0_, Blocks.redstone_torch, Blocks.unlit_redstone_torch); -- func_151180_a(p_75924_0_, Blocks.lit_redstone_lamp, Blocks.redstone_lamp); -- func_151180_a(p_75924_0_, Blocks.double_stone_slab, Blocks.stone_slab); -- func_151180_a(p_75924_0_, Blocks.double_wooden_slab, Blocks.wooden_slab); -- func_151180_a(p_75924_0_, Blocks.double_stone_slab2, Blocks.stone_slab2); -- func_151180_a(p_75924_0_, Blocks.grass, Blocks.dirt); -- func_151180_a(p_75924_0_, Blocks.farmland, Blocks.dirt); -+ func_151180_a(p_75924_0_, Blocks.water, Blocks.flowing_water, useItemIds); -+ func_151180_a(p_75924_0_, Blocks.lava, Blocks.flowing_lava, useItemIds); -+ func_151180_a(p_75924_0_, Blocks.lit_pumpkin, Blocks.pumpkin, useItemIds); -+ func_151180_a(p_75924_0_, Blocks.lit_furnace, Blocks.furnace, useItemIds); -+ func_151180_a(p_75924_0_, Blocks.lit_redstone_ore, Blocks.redstone_ore, useItemIds); -+ func_151180_a(p_75924_0_, Blocks.powered_repeater, Blocks.unpowered_repeater, useItemIds); -+ func_151180_a(p_75924_0_, Blocks.powered_comparator, Blocks.unpowered_comparator, useItemIds); -+ func_151180_a(p_75924_0_, Blocks.redstone_torch, Blocks.unlit_redstone_torch, useItemIds); -+ func_151180_a(p_75924_0_, Blocks.lit_redstone_lamp, Blocks.redstone_lamp, useItemIds); -+ func_151180_a(p_75924_0_, Blocks.double_stone_slab, Blocks.stone_slab, useItemIds); -+ func_151180_a(p_75924_0_, Blocks.double_wooden_slab, Blocks.wooden_slab, useItemIds); -+ func_151180_a(p_75924_0_, Blocks.double_stone_slab2, Blocks.stone_slab2, useItemIds); -+ func_151180_a(p_75924_0_, Blocks.grass, Blocks.dirt, useItemIds); -+ func_151180_a(p_75924_0_, Blocks.farmland, Blocks.dirt, useItemIds); +- func_151180_a(p_75924_0_, Blocks.field_150355_j, Blocks.field_150358_i); +- func_151180_a(p_75924_0_, Blocks.field_150353_l, Blocks.field_150356_k); +- func_151180_a(p_75924_0_, Blocks.field_150428_aP, Blocks.field_150423_aK); +- func_151180_a(p_75924_0_, Blocks.field_150470_am, Blocks.field_150460_al); +- func_151180_a(p_75924_0_, Blocks.field_150439_ay, Blocks.field_150450_ax); +- func_151180_a(p_75924_0_, Blocks.field_150416_aS, Blocks.field_150413_aR); +- func_151180_a(p_75924_0_, Blocks.field_150455_bV, Blocks.field_150441_bU); +- func_151180_a(p_75924_0_, Blocks.field_150429_aA, Blocks.field_150437_az); +- func_151180_a(p_75924_0_, Blocks.field_150374_bv, Blocks.field_150379_bu); +- func_151180_a(p_75924_0_, Blocks.field_150334_T, Blocks.field_150333_U); +- func_151180_a(p_75924_0_, Blocks.field_150373_bw, Blocks.field_150376_bx); +- func_151180_a(p_75924_0_, Blocks.field_180388_cO, Blocks.field_180389_cP); +- func_151180_a(p_75924_0_, Blocks.field_150349_c, Blocks.field_150346_d); +- func_151180_a(p_75924_0_, Blocks.field_150458_ak, Blocks.field_150346_d); ++ func_151180_a(p_75924_0_, Blocks.field_150355_j, Blocks.field_150358_i, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.field_150353_l, Blocks.field_150356_k, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.field_150428_aP, Blocks.field_150423_aK, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.field_150470_am, Blocks.field_150460_al, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.field_150439_ay, Blocks.field_150450_ax, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.field_150416_aS, Blocks.field_150413_aR, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.field_150455_bV, Blocks.field_150441_bU, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.field_150429_aA, Blocks.field_150437_az, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.field_150374_bv, Blocks.field_150379_bu, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.field_150334_T, Blocks.field_150333_U, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.field_150373_bw, Blocks.field_150376_bx, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.field_180388_cO, Blocks.field_180389_cP, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.field_150349_c, Blocks.field_150346_d, useItemIds); ++ func_151180_a(p_75924_0_, Blocks.field_150458_ak, Blocks.field_150346_d, useItemIds); } - private static void func_151180_a(StatBase[] p_151180_0_, Block p_151180_1_, Block p_151180_2_) + private static void func_151180_a(StatBase[] p_151180_0_, Block p_151180_1_, Block p_151180_2_, boolean useItemIds) { -- int i = Block.getIdFromBlock(p_151180_1_); -- int j = Block.getIdFromBlock(p_151180_2_); +- int i = Block.func_149682_b(p_151180_1_); +- int j = Block.func_149682_b(p_151180_2_); + int i; + int j; + if (useItemIds) { -+ i = Item.getIdFromItem(Item.getItemFromBlock(p_151180_1_)); -+ j = Item.getIdFromItem(Item.getItemFromBlock(p_151180_2_)); ++ i = Item.func_150891_b(Item.func_150898_a(p_151180_1_)); ++ j = Item.func_150891_b(Item.func_150898_a(p_151180_2_)); + } else { -+ i = Block.getIdFromBlock(p_151180_1_); -+ j = Block.getIdFromBlock(p_151180_2_); ++ i = Block.func_149682_b(p_151180_1_); ++ j = Block.func_149682_b(p_151180_2_); + } if (p_151180_0_[i] != null && p_151180_0_[j] == null) diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch index 1c1448fa8..5e2a3c357 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -1,18 +1,18 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java @@ -59,6 +59,7 @@ - public void readFromNBT(NBTTagCompound compound) + public void func_145839_a(NBTTagCompound p_145839_1_) { - this.pos = new BlockPos(compound.getInteger("x"), compound.getInteger("y"), compound.getInteger("z")); -+ if (compound.hasKey("ForgeData")) this.customTileData = compound.getCompoundTag("ForgeData"); + this.field_174879_c = new BlockPos(p_145839_1_.func_74762_e("x"), p_145839_1_.func_74762_e("y"), p_145839_1_.func_74762_e("z")); ++ if (p_145839_1_.func_74764_b("ForgeData")) this.customTileData = p_145839_1_.func_74775_l("ForgeData"); } - public void writeToNBT(NBTTagCompound compound) + public void func_145841_b(NBTTagCompound p_145841_1_) @@ -75,6 +76,7 @@ - compound.setInteger("x", this.pos.getX()); - compound.setInteger("y", this.pos.getY()); - compound.setInteger("z", this.pos.getZ()); -+ if (this.customTileData != null) compound.setTag("ForgeData", this.customTileData); + p_145841_1_.func_74768_a("x", this.field_174879_c.func_177958_n()); + p_145841_1_.func_74768_a("y", this.field_174879_c.func_177956_o()); + p_145841_1_.func_74768_a("z", this.field_174879_c.func_177952_p()); ++ if (this.customTileData != null) p_145841_1_.func_74782_a("ForgeData", this.customTileData); } } @@ -23,8 +23,8 @@ + Class oclass = null; try { -- Class oclass = (Class)nameToClassMap.get(nbt.getString("id")); -+ oclass = (Class)nameToClassMap.get(nbt.getString("id")); +- Class oclass = (Class)field_145855_i.get(p_145827_0_.func_74779_i("id")); ++ oclass = (Class)field_145855_i.get(p_145827_0_.func_74779_i("id")); if (oclass != null) { @@ -34,13 +34,13 @@ { + try + { - logger.warn("Skipping BlockEntity with id " + nbt.getString("id")); + field_145852_a.warn("Skipping BlockEntity with id " + p_145827_0_.func_74779_i("id")); + } + catch (Exception ex) + { + net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, ex, + "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", -+ nbt.getString("id"), oclass.getName()); ++ p_145827_0_.func_74779_i("id"), oclass.getName()); + tileentity = null; + } } @@ -51,12 +51,12 @@ } - @SideOnly(Side.CLIENT) - public double getDistanceSq(double x, double y, double z) + public double func_145835_a(double p_145835_1_, double p_145835_3_, double p_145835_5_) { - double d0 = (double)this.pos.getX() + 0.5D - x; + double d0 = (double)this.field_174879_c.func_177958_n() + 0.5D - p_145835_1_; @@ -279,4 +291,135 @@ - addMapping(TileEntityFlowerPot.class, "FlowerPot"); - addMapping(TileEntityBanner.class, "Banner"); + func_145826_a(TileEntityFlowerPot.class, "FlowerPot"); + func_145826_a(TileEntityBanner.class, "Banner"); } + + // -- BEGIN FORGE PATCHES -- @@ -93,7 +93,7 @@ + */ + public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate) + { -+ return !isVanilla || (oldState.getBlock() != newSate.getBlock()); ++ return !isVanilla || (oldState.func_177230_c() != newSate.func_177230_c()); + } + + public boolean shouldRenderInPass(int pass) @@ -116,21 +116,21 @@ + public net.minecraft.util.AxisAlignedBB getRenderBoundingBox() + { + net.minecraft.util.AxisAlignedBB bb = INFINITE_EXTENT_AABB; -+ Block type = getBlockType(); -+ if (type == Blocks.enchanting_table) ++ Block type = func_145838_q(); ++ if (type == Blocks.field_150381_bn) + { -+ bb = new net.minecraft.util.AxisAlignedBB(getPos(), getPos().add(1, 1, 1)); ++ bb = new net.minecraft.util.AxisAlignedBB(func_174877_v(), func_174877_v().func_177982_a(1, 1, 1)); + } -+ else if (type == Blocks.chest || type == Blocks.trapped_chest) ++ else if (type == Blocks.field_150486_ae || type == Blocks.field_150447_bR) + { -+ bb = new net.minecraft.util.AxisAlignedBB(getPos().add(-1, 0, -1), getPos().add(2, 2, 2)); ++ bb = new net.minecraft.util.AxisAlignedBB(func_174877_v().func_177982_a(-1, 0, -1), func_174877_v().func_177982_a(2, 2, 2)); + } -+ else if (type != null && type != Blocks.beacon) ++ else if (type != null && type != Blocks.field_150461_bJ) + { + net.minecraft.util.AxisAlignedBB cbb = null; + try + { -+ cbb = type.getCollisionBoundingBox(worldObj, getPos(), worldObj.getBlockState(getPos())); ++ cbb = type.func_180640_a(field_145850_b, func_174877_v(), field_145850_b.func_180495_p(func_174877_v())); + } + catch (Exception e) + { @@ -140,7 +140,7 @@ + // So, once again in the long line of US having to accommodate BUKKIT breaking things, + // here it is, assume that the TE is only 1 cubic block. Problem with this is that it may + // cause the TileEntity renderer to error further down the line! But alas, nothing we can do. -+ cbb = new net.minecraft.util.AxisAlignedBB(getPos().add(-1, 0, -1), getPos().add(1, 1, 1)); ++ cbb = new net.minecraft.util.AxisAlignedBB(func_174877_v().func_177982_a(-1, 0, -1), func_174877_v().func_177982_a(1, 1, 1)); + } + if (cbb != null) bb = cbb; + } @@ -154,7 +154,7 @@ + */ + public boolean canRenderBreaking() + { -+ Block block = this.getBlockType(); ++ Block block = this.func_145838_q(); + return (block instanceof net.minecraft.block.BlockChest || + block instanceof net.minecraft.block.BlockEnderChest || + block instanceof net.minecraft.block.BlockSign || diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch index 0f930a555..ad9881182 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch @@ -2,19 +2,19 @@ +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBeacon.java @@ -169,7 +169,7 @@ { - Block block = this.worldObj.getBlockState(new BlockPos(j1, i2, k1)).getBlock(); + Block block = this.field_145850_b.func_180495_p(new BlockPos(j1, i2, k1)).func_177230_c(); -- if (block != Blocks.emerald_block && block != Blocks.gold_block && block != Blocks.diamond_block && block != Blocks.iron_block) -+ if (!block.isBeaconBase(this.worldObj, new BlockPos(l1, k1, j1), getPos())) +- if (block != Blocks.field_150475_bE && block != Blocks.field_150340_R && block != Blocks.field_150484_ah && block != Blocks.field_150339_S) ++ if (!block.isBeaconBase(this.field_145850_b, new BlockPos(l1, k1, j1), func_174877_v())) { flag1 = false; break; @@ -368,7 +368,7 @@ - public boolean isItemValidForSlot(int index, ItemStack stack) + public boolean func_94041_b(int p_94041_1_, ItemStack p_94041_2_) { -- return stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot; -+ return stack.getItem() != null && stack.getItem().isBeaconPayment(stack); +- return p_94041_2_.func_77973_b() == Items.field_151166_bC || p_94041_2_.func_77973_b() == Items.field_151045_i || p_94041_2_.func_77973_b() == Items.field_151043_k || p_94041_2_.func_77973_b() == Items.field_151042_j; ++ return p_94041_2_.func_77973_b() != null && p_94041_2_.func_77973_b().isBeaconPayment(p_94041_2_); } - public String getGuiID() + public String func_174875_k() diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch index caa7e492f..2dc57eff9 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch @@ -2,46 +2,46 @@ +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java @@ -104,7 +104,7 @@ - private boolean canBrew() + private boolean func_145934_k() { -- if (this.brewingItemStacks[3] != null && this.brewingItemStacks[3].stackSize > 0) -+ if (this.brewingItemStacks[3] != null && this.brewingItemStacks[3].stackSize > 0 && false) // Code moved to net.minecraftforge.common.brewing.VanillaBrewingRecipe +- if (this.field_145945_j[3] != null && this.field_145945_j[3].field_77994_a > 0) ++ if (this.field_145945_j[3] != null && this.field_145945_j[3].field_77994_a > 0 && false) // Code moved to net.minecraftforge.common.brewing.VanillaBrewingRecipe { - ItemStack itemstack = this.brewingItemStacks[3]; + ItemStack itemstack = this.field_145945_j[3]; @@ -118,7 +118,7 @@ for (int i = 0; i < 3; ++i) { -- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem) -+ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion) +- if (this.field_145945_j[i] != null && this.field_145945_j[i].func_77973_b() == Items.field_151068_bn) ++ if (this.field_145945_j[i] != null && this.field_145945_j[i].func_77973_b() instanceof ItemPotion) { - int j = this.brewingItemStacks[i].getMetadata(); + int j = this.field_145945_j[i].func_77960_j(); int k = this.func_145936_c(j, itemstack); @@ -145,19 +145,22 @@ } else { - return false; -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.canBrew(brewingItemStacks, brewingItemStacks[3], outputSlots); ++ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.canBrew(field_145945_j, field_145945_j[3], field_145947_i); } } - private void brewPotions() + private void func_145940_l() { -+ if (net.minecraftforge.event.ForgeEventFactory.onPotionAttemptBreaw(brewingItemStacks)) return; - if (this.canBrew()) ++ if (net.minecraftforge.event.ForgeEventFactory.onPotionAttemptBreaw(field_145945_j)) return; + if (this.func_145934_k()) { -+ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(brewingItemStacks, brewingItemStacks[3], outputSlots); - ItemStack itemstack = this.brewingItemStacks[3]; ++ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(field_145945_j, field_145945_j[3], field_145947_i); + ItemStack itemstack = this.field_145945_j[3]; + if (false) { // Code moved to net.minecraftforge.common.brewing.VanillaBrewingRecipe for (int i = 0; i < 3; ++i) { -- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem) -+ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion) +- if (this.field_145945_j[i] != null && this.field_145945_j[i].func_77973_b() == Items.field_151068_bn) ++ if (this.field_145945_j[i] != null && this.field_145945_j[i].func_77973_b() instanceof ItemPotion) { - int j = this.brewingItemStacks[i].getMetadata(); + int j = this.field_145945_j[i].func_77960_j(); int k = this.func_145936_c(j, itemstack); @@ -177,10 +180,11 @@ } @@ -49,29 +49,29 @@ } + } -- if (itemstack.getItem().hasContainerItem()) -+ if (itemstack.getItem().hasContainerItem(itemstack)) +- if (itemstack.func_77973_b().func_77634_r()) ++ if (itemstack.func_77973_b().hasContainerItem(itemstack)) { -- this.brewingItemStacks[3] = new ItemStack(itemstack.getItem().getContainerItem()); -+ this.brewingItemStacks[3] = itemstack.getItem().getContainerItem(itemstack); +- this.field_145945_j[3] = new ItemStack(itemstack.func_77973_b().func_77668_q()); ++ this.field_145945_j[3] = itemstack.func_77973_b().getContainerItem(itemstack); } else { @@ -191,6 +195,7 @@ - this.brewingItemStacks[3] = null; + this.field_145945_j[3] = null; } } -+ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(brewingItemStacks); ++ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(field_145945_j); } } @@ -310,7 +315,9 @@ - public boolean isItemValidForSlot(int index, ItemStack stack) + public boolean func_94041_b(int p_94041_1_, ItemStack p_94041_2_) { -- return index == 3 ? stack.getItem().isPotionIngredient(stack) : stack.getItem() == Items.potionitem || stack.getItem() == Items.glass_bottle; -+ if (index == 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack)) return true; -+ else if (index != 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(stack)) return true; +- return p_94041_1_ == 3 ? p_94041_2_.func_77973_b().func_150892_m(p_94041_2_) : p_94041_2_.func_77973_b() == Items.field_151068_bn || p_94041_2_.func_77973_b() == Items.field_151069_bo; ++ if (p_94041_1_ == 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(p_94041_2_)) return true; ++ else if (p_94041_1_ != 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_94041_2_)) return true; + return false; } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch index 72def73ca..4966ed5e8 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch @@ -2,49 +2,49 @@ +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityFurnace.java @@ -223,8 +223,7 @@ - if (this.furnaceItemStacks[1].stackSize == 0) + if (this.field_145957_n[1].field_77994_a == 0) { -- Item item = this.furnaceItemStacks[1].getItem().getContainerItem(); -- this.furnaceItemStacks[1] = item != null ? new ItemStack(item) : null; -+ this.furnaceItemStacks[1] = furnaceItemStacks[1].getItem().getContainerItem(furnaceItemStacks[1]); +- Item item = this.field_145957_n[1].func_77973_b().func_77668_q(); +- this.field_145957_n[1] = item != null ? new ItemStack(item) : null; ++ this.field_145957_n[1] = field_145957_n[1].func_77973_b().getContainerItem(field_145957_n[1]); } } } @@ -279,7 +278,11 @@ else { - ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.furnaceItemStacks[0]); -- return itemstack == null ? false : (this.furnaceItemStacks[2] == null ? true : (!this.furnaceItemStacks[2].isItemEqual(itemstack) ? false : (this.furnaceItemStacks[2].stackSize < this.getInventoryStackLimit() && this.furnaceItemStacks[2].stackSize < this.furnaceItemStacks[2].getMaxStackSize() ? true : this.furnaceItemStacks[2].stackSize < itemstack.getMaxStackSize()))); + ItemStack itemstack = FurnaceRecipes.func_77602_a().func_151395_a(this.field_145957_n[0]); +- return itemstack == null ? false : (this.field_145957_n[2] == null ? true : (!this.field_145957_n[2].func_77969_a(itemstack) ? false : (this.field_145957_n[2].field_77994_a < this.func_70297_j_() && this.field_145957_n[2].field_77994_a < this.field_145957_n[2].func_77976_d() ? true : this.field_145957_n[2].field_77994_a < itemstack.func_77976_d()))); + if (itemstack == null) return false; -+ if (this.furnaceItemStacks[2] == null) return true; -+ if (!this.furnaceItemStacks[2].isItemEqual(itemstack)) return false; -+ int result = furnaceItemStacks[2].stackSize + itemstack.stackSize; -+ return result <= getInventoryStackLimit() && result <= this.furnaceItemStacks[2].getMaxStackSize(); //Forge BugFix: Make it respect stack sizes properly. ++ if (this.field_145957_n[2] == null) return true; ++ if (!this.field_145957_n[2].func_77969_a(itemstack)) return false; ++ int result = field_145957_n[2].field_77994_a + itemstack.field_77994_a; ++ return result <= func_70297_j_() && result <= this.field_145957_n[2].func_77976_d(); //Forge BugFix: Make it respect stack sizes properly. } } @@ -295,7 +298,7 @@ } - else if (this.furnaceItemStacks[2].getItem() == itemstack.getItem()) + else if (this.field_145957_n[2].func_77973_b() == itemstack.func_77973_b()) { -- ++this.furnaceItemStacks[2].stackSize; -+ this.furnaceItemStacks[2].stackSize += itemstack.stackSize; // Forge BugFix: Results may have multiple items +- ++this.field_145957_n[2].field_77994_a; ++ this.field_145957_n[2].field_77994_a += itemstack.field_77994_a; // Forge BugFix: Results may have multiple items } - if (this.furnaceItemStacks[0].getItem() == Item.getItemFromBlock(Blocks.sponge) && this.furnaceItemStacks[0].getMetadata() == 1 && this.furnaceItemStacks[1] != null && this.furnaceItemStacks[1].getItem() == Items.bucket) + if (this.field_145957_n[0].func_77973_b() == Item.func_150898_a(Blocks.field_150360_v) && this.field_145957_n[0].func_77960_j() == 1 && this.field_145957_n[1] != null && this.field_145957_n[1].func_77973_b() == Items.field_151133_ar) @@ -342,7 +345,15 @@ } } -- return item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD") ? 200 : (item == Items.stick ? 100 : (item == Items.coal ? 1600 : (item == Items.lava_bucket ? 20000 : (item == Item.getItemFromBlock(Blocks.sapling) ? 100 : (item == Items.blaze_rod ? 2400 : 0))))))); -+ if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200; -+ if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200; -+ if (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD")) return 200; -+ if (item == Items.stick) return 100; -+ if (item == Items.coal) return 1600; -+ if (item == Items.lava_bucket) return 20000; -+ if (item == Item.getItemFromBlock(Blocks.sapling)) return 100; -+ if (item == Items.blaze_rod) return 2400; +- return item instanceof ItemTool && ((ItemTool)item).func_77861_e().equals("WOOD") ? 200 : (item instanceof ItemSword && ((ItemSword)item).func_150932_j().equals("WOOD") ? 200 : (item instanceof ItemHoe && ((ItemHoe)item).func_77842_f().equals("WOOD") ? 200 : (item == Items.field_151055_y ? 100 : (item == Items.field_151044_h ? 1600 : (item == Items.field_151129_at ? 20000 : (item == Item.func_150898_a(Blocks.field_150345_g) ? 100 : (item == Items.field_151072_bj ? 2400 : 0))))))); ++ if (item instanceof ItemTool && ((ItemTool)item).func_77861_e().equals("WOOD")) return 200; ++ if (item instanceof ItemSword && ((ItemSword)item).func_150932_j().equals("WOOD")) return 200; ++ if (item instanceof ItemHoe && ((ItemHoe)item).func_77842_f().equals("WOOD")) return 200; ++ if (item == Items.field_151055_y) return 100; ++ if (item == Items.field_151044_h) return 1600; ++ if (item == Items.field_151129_at) return 20000; ++ if (item == Item.func_150898_a(Blocks.field_150345_g)) return 100; ++ if (item == Items.field_151072_bj) return 2400; + return net.minecraftforge.fml.common.registry.GameRegistry.getFuelValue(p_145952_0_); } } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch index a5cd00655..0f5f3b348 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch @@ -5,29 +5,29 @@ if (itemstack == null) { + //Forge: BUGFIX: Again, make things respect max stack sizes. -+ int max = Math.min(p_174916_1_.getMaxStackSize(), p_174916_0_.getInventoryStackLimit()); -+ if (max >= p_174916_1_.stackSize) ++ int max = Math.min(p_174916_1_.func_77976_d(), p_174916_0_.func_70297_j_()); ++ if (max >= p_174916_1_.field_77994_a) + { - p_174916_0_.setInventorySlotContents(p_174916_2_, p_174916_1_); + p_174916_0_.func_70299_a(p_174916_2_, p_174916_1_); p_174916_1_ = null; + } + else + { -+ p_174916_0_.setInventorySlotContents(p_174916_2_, p_174916_1_.splitStack(max)); ++ p_174916_0_.func_70299_a(p_174916_2_, p_174916_1_.func_77979_a(max)); + } flag = true; } - else if (canCombine(itemstack, p_174916_1_)) + else if (func_145894_a(itemstack, p_174916_1_)) { -- int i = p_174916_1_.getMaxStackSize() - itemstack.stackSize; +- int i = p_174916_1_.func_77976_d() - itemstack.field_77994_a; + //Forge: BUGFIX: Again, make things respect max stack sizes. -+ int max = Math.min(p_174916_1_.getMaxStackSize(), p_174916_0_.getInventoryStackLimit()); -+ if (max > itemstack.stackSize) ++ int max = Math.min(p_174916_1_.func_77976_d(), p_174916_0_.func_70297_j_()); ++ if (max > itemstack.field_77994_a) + { -+ int i = max - itemstack.stackSize; - int j = Math.min(p_174916_1_.stackSize, i); - p_174916_1_.stackSize -= j; - itemstack.stackSize += j; ++ int i = max - itemstack.field_77994_a; + int j = Math.min(p_174916_1_.field_77994_a, i); + p_174916_1_.field_77994_a -= j; + itemstack.field_77994_a += j; flag = j > 0; + } } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch index 01099d450..e3fef4d68 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch @@ -2,11 +2,11 @@ +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityNote.java @@ -27,7 +27,9 @@ - public void changePitch() + public void func_145877_a() { -+ byte old = note; - this.note = (byte)((this.note + 1) % 25); ++ byte old = field_145879_a; + this.field_145879_a = (byte)((this.field_145879_a + 1) % 25); + if (!net.minecraftforge.common.ForgeHooks.onNoteChange(this, old)) return; - this.markDirty(); + this.func_70296_d(); } diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch index 4595567a7..a1d1cc237 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch @@ -1,22 +1,22 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityPiston.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityPiston.java @@ -148,7 +148,8 @@ - if (this.worldObj.getBlockState(this.pos).getBlock() == Blocks.piston_extension) + if (this.field_145850_b.func_180495_p(this.field_174879_c).func_177230_c() == Blocks.field_180384_M) { - this.worldObj.setBlockState(this.pos, this.pistonState, 3); -- this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); -+ if(!net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldObj, pos, worldObj.getBlockState(pos), java.util.EnumSet.noneOf(EnumFacing.class)).isCanceled()) -+ this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); + this.field_145850_b.func_180501_a(this.field_174879_c, this.field_174932_a, 3); +- this.field_145850_b.func_180496_d(this.field_174879_c, this.field_174932_a.func_177230_c()); ++ if(!net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(field_145850_b, field_174879_c, field_145850_b.func_180495_p(field_174879_c), java.util.EnumSet.noneOf(EnumFacing.class)).isCanceled()) ++ this.field_145850_b.func_180496_d(this.field_174879_c, this.field_174932_a.func_177230_c()); } } } @@ -166,7 +167,8 @@ - if (this.worldObj.getBlockState(this.pos).getBlock() == Blocks.piston_extension) + if (this.field_145850_b.func_180495_p(this.field_174879_c).func_177230_c() == Blocks.field_180384_M) { - this.worldObj.setBlockState(this.pos, this.pistonState, 3); -- this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); -+ if(!net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldObj, pos, worldObj.getBlockState(pos), java.util.EnumSet.noneOf(EnumFacing.class)).isCanceled()) -+ this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); + this.field_145850_b.func_180501_a(this.field_174879_c, this.field_174932_a, 3); +- this.field_145850_b.func_180496_d(this.field_174879_c, this.field_174932_a.func_177230_c()); ++ if(!net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(field_145850_b, field_174879_c, field_145850_b.func_180495_p(field_174879_c), java.util.EnumSet.noneOf(EnumFacing.class)).isCanceled()) ++ this.field_145850_b.func_180496_d(this.field_174879_c, this.field_174932_a.func_177230_c()); } } else diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch index ee33a8d35..6b66af8ce 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch @@ -2,10 +2,10 @@ +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntitySign.java @@ -61,7 +61,7 @@ } - public boolean canUseCommand(int permLevel, String commandName) + public boolean func_70003_b(int p_70003_1_, String p_70003_2_) { - return true; -+ return permLevel <= 2; //Forge: Fixes MC-75630 - Exploit with signs and command blocks ++ return p_70003_1_ <= 2; //Forge: Fixes MC-75630 - Exploit with signs and command blocks } - public BlockPos getPosition() + public BlockPos func_180425_c() { diff --git a/patches/minecraft/net/minecraft/util/EnumFacing.java.patch b/patches/minecraft/net/minecraft/util/EnumFacing.java.patch index 5f5717bf9..a0fbc640d 100644 --- a/patches/minecraft/net/minecraft/util/EnumFacing.java.patch +++ b/patches/minecraft/net/minecraft/util/EnumFacing.java.patch @@ -10,19 +10,19 @@ public enum EnumFacing implements IStringSerializable { @@ -60,7 +58,6 @@ - return getFront(this.opposite); + return func_82600_a(this.field_176759_h); } - @SideOnly(Side.CLIENT) - public EnumFacing rotateAround(EnumFacing.Axis axis) + public EnumFacing func_176732_a(EnumFacing.Axis p_176732_1_) { - switch (axis) + switch (p_176732_1_) @@ -111,7 +108,6 @@ } } - @SideOnly(Side.CLIENT) - private EnumFacing rotateX() + private EnumFacing func_176744_n() { switch (this) @@ -131,7 +127,6 @@ @@ -30,23 +30,23 @@ } - @SideOnly(Side.CLIENT) - private EnumFacing rotateZ() + private EnumFacing func_176738_p() { switch (this) @@ -192,7 +187,6 @@ - return this.axis; + return this.field_176758_k; } - @SideOnly(Side.CLIENT) - public static EnumFacing byName(String name) + public static EnumFacing func_176739_a(String p_176739_0_) { - return name == null ? null : (EnumFacing)NAME_LOOKUP.get(name.toLowerCase()); + return p_176739_0_ == null ? null : (EnumFacing)field_176761_p.get(p_176739_0_.toLowerCase()); @@ -218,7 +212,6 @@ - return values()[rand.nextInt(values().length)]; + return values()[p_176741_0_.nextInt(values().length)]; } - @SideOnly(Side.CLIENT) - public static EnumFacing getFacingFromVector(float p_176737_0_, float p_176737_1_, float p_176737_2_) + public static EnumFacing func_176737_a(float p_176737_0_, float p_176737_1_, float p_176737_2_) { EnumFacing enumfacing = NORTH; @@ -261,7 +254,6 @@ @@ -54,14 +54,14 @@ } - @SideOnly(Side.CLIENT) - public Vec3i getDirectionVec() + public Vec3i func_176730_m() { - return this.directionVec; + return this.field_176756_m; @@ -297,7 +289,6 @@ - this.plane = plane; + this.field_176723_f = p_i46015_4_; } - @SideOnly(Side.CLIENT) - public static EnumFacing.Axis byName(String name) + public static EnumFacing.Axis func_176717_a(String p_176717_0_) { - return name == null ? null : (EnumFacing.Axis)NAME_LOOKUP.get(name.toLowerCase()); + return p_176717_0_ == null ? null : (EnumFacing.Axis)field_176725_d.get(p_176717_0_.toLowerCase()); diff --git a/patches/minecraft/net/minecraft/util/MouseHelper.java.patch b/patches/minecraft/net/minecraft/util/MouseHelper.java.patch index 7c04c7919..9a1be0ea4 100644 --- a/patches/minecraft/net/minecraft/util/MouseHelper.java.patch +++ b/patches/minecraft/net/minecraft/util/MouseHelper.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/util/MouseHelper.java @@ -13,6 +13,7 @@ - public void grabMouseCursor() + public void func_74372_a() { + if (Boolean.parseBoolean(System.getProperty("fml.noGrab","false"))) return; Mouse.setGrabbed(true); - this.deltaX = 0; - this.deltaY = 0; + this.field_74377_a = 0; + this.field_74375_b = 0; diff --git a/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch b/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch index 4de3bec00..f717cac15 100644 --- a/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch +++ b/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/util/MovingObjectPosition.java +++ ../src-work/minecraft/net/minecraft/util/MovingObjectPosition.java @@ -10,6 +10,12 @@ - public Vec3 hitVec; - public Entity entityHit; + public Vec3 field_72307_f; + public Entity field_72308_g; + /** Used to determine what sub-segment is hit */ + public int subHit = -1; diff --git a/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch b/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch index be604e68e..bef0586ad 100644 --- a/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch +++ b/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch @@ -17,10 +17,10 @@ { this(0, new String[] {p_i1292_1_, p_i1292_2_}); @@ -50,7 +47,6 @@ - return this.resourcePath; + return this.field_110625_b; } - @SideOnly(Side.CLIENT) - public String getResourceDomain() + public String func_110624_b() { - return this.resourceDomain; + return this.field_110626_a; diff --git a/patches/minecraft/net/minecraft/util/Session.java.patch b/patches/minecraft/net/minecraft/util/Session.java.patch index 48492d58d..19d55db7e 100644 --- a/patches/minecraft/net/minecraft/util/Session.java.patch +++ b/patches/minecraft/net/minecraft/util/Session.java.patch @@ -10,18 +10,18 @@ import net.minecraftforge.fml.relauncher.SideOnly; @@ -15,9 +17,24 @@ - private final String playerID; - private final String token; - private final Session.Type sessionType; + private final String field_148257_b; + private final String field_148258_c; + private final Session.Type field_152429_d; + /** Forge: Cache of the local session's GameProfile properties. */ + private com.mojang.authlib.properties.PropertyMap properties; - public Session(String usernameIn, String playerIDIn, String tokenIn, String sessionTypeIn) + public Session(String p_i1098_1_, String p_i1098_2_, String p_i1098_3_, String p_i1098_4_) { -+ if (usernameIn == null || usernameIn.isEmpty()) ++ if (p_i1098_1_ == null || p_i1098_1_.isEmpty()) + { -+ usernameIn = "MissingName"; -+ playerIDIn = tokenIn = "NotValid"; ++ p_i1098_1_ = "MissingName"; ++ p_i1098_2_ = p_i1098_3_ = "NotValid"; + FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "========================================================="); + FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "WARNING!! the username was not set for this session, typically"); + FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "this means you installed Forge incorrectly. We have set your"); @@ -31,27 +31,27 @@ + FMLLog.getLogger().log(org.apache.logging.log4j.Level.WARN, "========================================================="); + } + - this.username = usernameIn; - this.playerID = playerIDIn; - this.token = tokenIn; + this.field_74286_b = p_i1098_1_; + this.field_148257_b = p_i1098_2_; + this.field_148258_c = p_i1098_3_; @@ -49,11 +66,13 @@ try { - UUID uuid = UUIDTypeAdapter.fromString(this.getPlayerID()); -- return new GameProfile(uuid, this.getUsername()); -+ GameProfile ret = new GameProfile(uuid, this.getUsername()); //Forge: Adds cached GameProfile properties to returned GameProfile. + 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. + 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 var2) { -- return new GameProfile((UUID)null, this.getUsername()); -+ return new GameProfile(net.minecraft.entity.player.EntityPlayer.getUUID(new GameProfile((UUID)null, this.getUsername())), this.getUsername()); +- return new GameProfile((UUID)null, this.func_111285_a()); ++ return new GameProfile(net.minecraft.entity.player.EntityPlayer.func_146094_a(new GameProfile((UUID)null, this.func_111285_a())), this.func_111285_a()); } } @@ -62,6 +81,19 @@ - return this.sessionType; + return this.field_152429_d; } + /* ======================================== FORGE START ===================================== */ diff --git a/patches/minecraft/net/minecraft/util/StringTranslate.java.patch b/patches/minecraft/net/minecraft/util/StringTranslate.java.patch index f6d51a843..be6f42827 100644 --- a/patches/minecraft/net/minecraft/util/StringTranslate.java.patch +++ b/patches/minecraft/net/minecraft/util/StringTranslate.java.patch @@ -10,14 +10,14 @@ + + public static void inject(InputStream inputstream) + { -+ inject(instance, inputstream); ++ inject(field_74817_a, inputstream); + } + + private static void inject(StringTranslate inst, InputStream inputstream) + { + java.util.HashMap map = parseLangFile(inputstream); -+ inst.languageList.putAll(map); -+ inst.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); ++ inst.field_74816_c.putAll(map); ++ inst.field_150511_e = System.currentTimeMillis(); + } + + public static java.util.HashMap parseLangFile(InputStream inputstream) @@ -34,14 +34,14 @@ @@ -37,17 +57,17 @@ { String s1 = astring[0]; - String s2 = numericVariablePattern.matcher(astring[1]).replaceAll("%$1s"); -- this.languageList.put(s1, s2); + String s2 = field_111053_a.matcher(astring[1]).replaceAll("%$1s"); +- this.field_74816_c.put(s1, s2); + table.put(s1, s2); } } } -- this.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); +- this.field_150511_e = System.currentTimeMillis(); } - catch (IOException var7) + catch (Exception var7) @@ -51,4 +51,4 @@ + return table; } - static StringTranslate getInstance() + static StringTranslate func_74808_a() diff --git a/patches/minecraft/net/minecraft/util/Vec3.java.patch b/patches/minecraft/net/minecraft/util/Vec3.java.patch index 43a23f3c8..2cc1ac518 100644 --- a/patches/minecraft/net/minecraft/util/Vec3.java.patch +++ b/patches/minecraft/net/minecraft/util/Vec3.java.patch @@ -8,28 +8,28 @@ - public class Vec3 { - public final double xCoord; + public final double field_72450_a; @@ -36,7 +33,6 @@ - this((double)p_i46377_1_.getX(), (double)p_i46377_1_.getY(), (double)p_i46377_1_.getZ()); + this((double)p_i46377_1_.func_177958_n(), (double)p_i46377_1_.func_177956_o(), (double)p_i46377_1_.func_177952_p()); } - @SideOnly(Side.CLIENT) - public Vec3 subtractReverse(Vec3 vec) + public Vec3 func_72444_a(Vec3 p_72444_1_) { - return new Vec3(vec.xCoord - this.xCoord, vec.yCoord - this.yCoord, vec.zCoord - this.zCoord); + return new Vec3(p_72444_1_.field_72450_a - this.field_72450_a, p_72444_1_.field_72448_b - this.field_72448_b, p_72444_1_.field_72449_c - this.field_72449_c); @@ -53,7 +49,6 @@ - return this.xCoord * vec.xCoord + this.yCoord * vec.yCoord + this.zCoord * vec.zCoord; + return this.field_72450_a * p_72430_1_.field_72450_a + this.field_72448_b * p_72430_1_.field_72448_b + this.field_72449_c * p_72430_1_.field_72449_c; } - @SideOnly(Side.CLIENT) - public Vec3 crossProduct(Vec3 vec) + public Vec3 func_72431_c(Vec3 p_72431_1_) { - return new Vec3(this.yCoord * vec.zCoord - this.zCoord * vec.yCoord, this.zCoord * vec.xCoord - this.xCoord * vec.zCoord, this.xCoord * vec.yCoord - this.yCoord * vec.xCoord); + return new Vec3(this.field_72448_b * p_72431_1_.field_72449_c - this.field_72449_c * p_72431_1_.field_72448_b, this.field_72449_c * p_72431_1_.field_72450_a - this.field_72450_a * p_72431_1_.field_72449_c, this.field_72450_a * p_72431_1_.field_72448_b - this.field_72448_b * p_72431_1_.field_72450_a); @@ -79,7 +74,6 @@ - return new Vec3(this.xCoord + x, this.yCoord + y, this.zCoord + z); + return new Vec3(this.field_72450_a + p_72441_1_, this.field_72448_b + p_72441_3_, this.field_72449_c + p_72441_5_); } - @SideOnly(Side.CLIENT) - public double distanceTo(Vec3 vec) + public double func_72438_d(Vec3 p_72438_1_) { - double d0 = vec.xCoord - this.xCoord; + double d0 = p_72438_1_.field_72450_a - this.field_72450_a; diff --git a/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch b/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch index 8ddd08aa9..b8f7e3aa4 100644 --- a/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch +++ b/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch @@ -3,24 +3,24 @@ @@ -36,48 +36,39 @@ for (int i = 0; i < p_177630_3_; ++i) { - WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, p_177630_1_); -- int j = weightedrandomchestcontent.theMinimumChanceToGenerateItem + random.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1); -+ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, p_177630_2_); + WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.func_76271_a(p_177630_0_, p_177630_1_); +- int j = weightedrandomchestcontent.field_76295_d + p_177630_0_.nextInt(weightedrandomchestcontent.field_76296_e - weightedrandomchestcontent.field_76295_d + 1); ++ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(p_177630_0_, p_177630_2_); -- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= j) +- if (weightedrandomchestcontent.field_76297_b.func_77976_d() >= j) + for (ItemStack itemstack1 : stacks) { -- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); -- itemstack1.stackSize = j; - p_177630_2_.setInventorySlotContents(random.nextInt(p_177630_2_.getSizeInventory()), itemstack1); +- ItemStack itemstack1 = weightedrandomchestcontent.field_76297_b.func_77946_l(); +- itemstack1.field_77994_a = j; + p_177630_2_.func_70299_a(p_177630_0_.nextInt(p_177630_2_.func_70302_i_()), itemstack1); } - else - { - for (int k = 0; k < j; ++k) - { -- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); -- itemstack.stackSize = 1; -- p_177630_2_.setInventorySlotContents(random.nextInt(p_177630_2_.getSizeInventory()), itemstack); +- ItemStack itemstack = weightedrandomchestcontent.field_76297_b.func_77946_l(); +- itemstack.field_77994_a = 1; +- p_177630_2_.func_70299_a(p_177630_0_.nextInt(p_177630_2_.func_70302_i_()), itemstack); - } - } } @@ -36,31 +36,31 @@ + */ + protected ItemStack[] generateChestContent(Random random, IInventory newInventory) + { -+ return net.minecraftforge.common.ChestGenHooks.generateStacks(random, theItemId, theMinimumChanceToGenerateItem, theMaximumChanceToGenerateItem); ++ return net.minecraftforge.common.ChestGenHooks.generateStacks(random, field_76297_b, field_76295_d, field_76296_e); + } + - public static void generateDispenserContents(Random random, List p_177631_1_, TileEntityDispenser dispenser, int p_177631_3_) + public static void func_177631_a(Random p_177631_0_, List p_177631_1_, TileEntityDispenser p_177631_2_, int p_177631_3_) { for (int i = 0; i < p_177631_3_; ++i) { - WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, p_177631_1_); -- int j = weightedrandomchestcontent.theMinimumChanceToGenerateItem + random.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1); -+ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, dispenser); + WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.func_76271_a(p_177631_0_, p_177631_1_); +- int j = weightedrandomchestcontent.field_76295_d + p_177631_0_.nextInt(weightedrandomchestcontent.field_76296_e - weightedrandomchestcontent.field_76295_d + 1); ++ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(p_177631_0_, p_177631_2_); -- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= j) +- if (weightedrandomchestcontent.field_76297_b.func_77976_d() >= j) + for (ItemStack itemstack1 : stacks) { -- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); -- itemstack1.stackSize = j; - dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack1); +- ItemStack itemstack1 = weightedrandomchestcontent.field_76297_b.func_77946_l(); +- itemstack1.field_77994_a = j; + p_177631_2_.func_70299_a(p_177631_0_.nextInt(p_177631_2_.func_70302_i_()), itemstack1); } - else - { - for (int k = 0; k < j; ++k) - { -- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); -- itemstack.stackSize = 1; -- dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack); +- ItemStack itemstack = weightedrandomchestcontent.field_76297_b.func_77946_l(); +- itemstack.field_77994_a = 1; +- p_177631_2_.func_70299_a(p_177631_0_.nextInt(p_177631_2_.func_70302_i_()), itemstack); - } - } } diff --git a/patches/minecraft/net/minecraft/world/ChunkCache.java.patch b/patches/minecraft/net/minecraft/world/ChunkCache.java.patch index 34f859075..27f632f83 100644 --- a/patches/minecraft/net/minecraft/world/ChunkCache.java.patch +++ b/patches/minecraft/net/minecraft/world/ChunkCache.java.patch @@ -2,60 +2,60 @@ +++ ../src-work/minecraft/net/minecraft/world/ChunkCache.java @@ -61,6 +61,8 @@ { - int i = (pos.getX() >> 4) - this.chunkX; - int j = (pos.getZ() >> 4) - this.chunkZ; -+ if (i < 0 || i >= chunkArray.length || j < 0 || j >= chunkArray[i].length) return null; -+ if (chunkArray[i][j] == null) return null; - return this.chunkArray[i][j].getTileEntity(pos, Chunk.EnumCreateEntityType.IMMEDIATE); + int i = (p_175625_1_.func_177958_n() >> 4) - this.field_72818_a; + int j = (p_175625_1_.func_177952_p() >> 4) - this.field_72816_b; ++ if (i < 0 || i >= field_72817_c.length || j < 0 || j >= field_72817_c[i].length) return null; ++ if (field_72817_c[i][j] == null) return null; + return this.field_72817_c[i][j].func_177424_a(p_175625_1_, Chunk.EnumCreateEntityType.IMMEDIATE); } @@ -84,6 +86,7 @@ { - int i = (pos.getX() >> 4) - this.chunkX; - int j = (pos.getZ() >> 4) - this.chunkZ; -+ if (i < 0 || i >= chunkArray.length || j < 0 || i >= chunkArray[i].length) return Blocks.air.getDefaultState(); + int i = (p_180495_1_.func_177958_n() >> 4) - this.field_72818_a; + int j = (p_180495_1_.func_177952_p() >> 4) - this.field_72816_b; ++ if (i < 0 || i >= field_72817_c.length || j < 0 || i >= field_72817_c[i].length) return Blocks.field_150350_a.func_176223_P(); - if (i >= 0 && i < this.chunkArray.length && j >= 0 && j < this.chunkArray[i].length) + if (i >= 0 && i < this.field_72817_c.length && j >= 0 && j < this.field_72817_c[i].length) { @@ -139,6 +142,8 @@ { - int i = (pos.getX() >> 4) - this.chunkX; - int j = (pos.getZ() >> 4) - this.chunkZ; -+ if (i < 0 || i >= chunkArray.length || j < 0 || j >= chunkArray[i].length) return p_175629_1_.defaultLightValue; -+ if (chunkArray[i][j] == null) return p_175629_1_.defaultLightValue; - return this.chunkArray[i][j].getLightFor(p_175629_1_, pos); + int i = (p_175629_2_.func_177958_n() >> 4) - this.field_72818_a; + int j = (p_175629_2_.func_177952_p() >> 4) - this.field_72816_b; ++ if (i < 0 || i >= field_72817_c.length || j < 0 || j >= field_72817_c[i].length) return p_175629_1_.field_77198_c; ++ if (field_72817_c[i][j] == null) return p_175629_1_.field_77198_c; + return this.field_72817_c[i][j].func_177413_a(p_175629_1_, p_175629_2_); } } @@ -150,7 +155,7 @@ - public boolean isAirBlock(BlockPos pos) + public boolean func_175623_d(BlockPos p_175623_1_) { -- return this.getBlockState(pos).getBlock().getMaterial() == Material.air; -+ return this.getBlockState(pos).getBlock().isAir(this, pos); +- return this.func_180495_p(p_175623_1_).func_177230_c().func_149688_o() == Material.field_151579_a; ++ return this.func_180495_p(p_175623_1_).func_177230_c().isAir(this, p_175623_1_); } @SideOnly(Side.CLIENT) @@ -160,6 +165,7 @@ { - int i = (pos.getX() >> 4) - this.chunkX; - int j = (pos.getZ() >> 4) - this.chunkZ; -+ if (i < 0 || i >= chunkArray.length || j < 0 || i >= chunkArray[i].length) return p_175628_1_.defaultLightValue; - return this.chunkArray[i][j].getLightFor(p_175628_1_, pos); + int i = (p_175628_2_.func_177958_n() >> 4) - this.field_72818_a; + int j = (p_175628_2_.func_177952_p() >> 4) - this.field_72816_b; ++ if (i < 0 || i >= field_72817_c.length || j < 0 || i >= field_72817_c[i].length) return p_175628_1_.field_77198_c; + return this.field_72817_c[i][j].func_177413_a(p_175628_1_, p_175628_2_); } else @@ -179,4 +185,15 @@ { - return this.worldObj.getWorldType(); + return this.field_72815_e.func_175624_G(); } + + @Override + public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) + { -+ int x = (pos.getX() >> 4) - this.chunkX; -+ int z = (pos.getZ() >> 4) - this.chunkZ; -+ if (pos.getY() >= 0 && pos.getY() < 256) return _default; -+ if (x < 0 || x >= chunkArray.length || z < 0 || x >= chunkArray[x].length) return _default; ++ int x = (pos.func_177958_n() >> 4) - this.field_72818_a; ++ int z = (pos.func_177952_p() >> 4) - this.field_72816_b; ++ if (pos.func_177956_o() >= 0 && pos.func_177956_o() < 256) return _default; ++ if (x < 0 || x >= field_72817_c.length || z < 0 || x >= field_72817_c[x].length) return _default; + -+ return getBlockState(pos).getBlock().isSideSolid(this, pos, side); ++ return func_180495_p(pos).func_177230_c().isSideSolid(this, pos, side); + } } diff --git a/patches/minecraft/net/minecraft/world/Explosion.java.patch b/patches/minecraft/net/minecraft/world/Explosion.java.patch index 71627e229..a7cbd02cf 100644 --- a/patches/minecraft/net/minecraft/world/Explosion.java.patch +++ b/patches/minecraft/net/minecraft/world/Explosion.java.patch @@ -1,51 +1,51 @@ --- ../src-base/minecraft/net/minecraft/world/Explosion.java +++ ../src-work/minecraft/net/minecraft/world/Explosion.java @@ -38,6 +38,7 @@ - private final float explosionSize; - private final List affectedBlockPositions; + private final float field_77280_f; + private final List field_77281_g; private final Map field_77288_k; + private final Vec3 position; @SideOnly(Side.CLIENT) - public Explosion(World worldIn, Entity p_i45752_2_, double p_i45752_3_, double p_i45752_5_, double p_i45752_7_, float p_i45752_9_, List p_i45752_10_) + public Explosion(World p_i45752_1_, Entity p_i45752_2_, double p_i45752_3_, double p_i45752_5_, double p_i45752_7_, float p_i45752_9_, List p_i45752_10_) @@ -65,6 +66,7 @@ - this.explosionZ = p_i45754_7_; - this.isFlaming = p_i45754_10_; - this.isSmoking = p_i45754_11_; -+ this.position = new Vec3(explosionX, explosionY, explosionZ); + this.field_77282_d = p_i45754_7_; + this.field_77286_a = p_i45754_10_; + this.field_82755_b = p_i45754_11_; ++ this.position = new Vec3(field_77284_b, field_77285_c, field_77282_d); } - public void doExplosionA() + public void func_77278_a() @@ -99,7 +101,7 @@ - if (iblockstate.getBlock().getMaterial() != Material.air) + if (iblockstate.func_177230_c().func_149688_o() != Material.field_151579_a) { -- float f2 = this.exploder != null ? this.exploder.getExplosionResistance(this, this.worldObj, blockpos, iblockstate) : iblockstate.getBlock().getExplosionResistance((Entity)null); -+ float f2 = this.exploder != null ? this.exploder.getExplosionResistance(this, this.worldObj, blockpos, iblockstate) : iblockstate.getBlock().getExplosionResistance(worldObj, blockpos, (Entity)null, this); +- float f2 = this.field_77283_e != null ? this.field_77283_e.func_180428_a(this, this.field_77287_j, blockpos, iblockstate) : iblockstate.func_177230_c().func_149638_a((Entity)null); ++ float f2 = this.field_77283_e != null ? this.field_77283_e.func_180428_a(this, this.field_77287_j, blockpos, iblockstate) : iblockstate.func_177230_c().getExplosionResistance(field_77287_j, blockpos, (Entity)null, this); f -= (f2 + 0.3F) * 0.3F; } @@ -126,6 +128,7 @@ - int j2 = MathHelper.floor_double(this.explosionZ - (double)f3 - 1.0D); - int j1 = MathHelper.floor_double(this.explosionZ + (double)f3 + 1.0D); - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, new AxisAlignedBB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1)); -+ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.worldObj, this, list, f3); - Vec3 vec3 = new Vec3(this.explosionX, this.explosionY, this.explosionZ); + int j2 = MathHelper.func_76128_c(this.field_77282_d - (double)f3 - 1.0D); + int j1 = MathHelper.func_76128_c(this.field_77282_d + (double)f3 + 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, f3); + Vec3 vec3 = new Vec3(this.field_77284_b, this.field_77285_c, this.field_77282_d); for (int k2 = 0; k2 < list.size(); ++k2) @@ -213,8 +216,7 @@ - block.dropBlockAsItemWithChance(this.worldObj, blockpos, this.worldObj.getBlockState(blockpos), 1.0F / this.explosionSize, 0); + block.func_180653_a(this.field_77287_j, blockpos, this.field_77287_j.func_180495_p(blockpos), 1.0F / this.field_77280_f, 0); } -- this.worldObj.setBlockState(blockpos, Blocks.air.getDefaultState(), 3); -- block.onBlockDestroyedByExplosion(this.worldObj, blockpos, this); -+ block.onBlockExploded(this.worldObj, blockpos, this); +- 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); ++ block.onBlockExploded(this.field_77287_j, blockpos, this); } } } @@ -250,4 +252,6 @@ { - return this.affectedBlockPositions; + return this.field_77281_g; } + + public Vec3 getPosition(){ return this.position; } diff --git a/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch b/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch index 7fb64f305..e6b7d331d 100644 --- a/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch +++ b/patches/minecraft/net/minecraft/world/IBlockAccess.java.patch @@ -3,7 +3,7 @@ @@ -29,4 +29,14 @@ @SideOnly(Side.CLIENT) - WorldType getWorldType(); + WorldType func_175624_G(); + + /** + * FORGE: isSideSolid, pulled up from {@link World} diff --git a/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch b/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch index 01632c7d2..12456a583 100644 --- a/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch +++ b/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch @@ -2,50 +2,50 @@ +++ ../src-work/minecraft/net/minecraft/world/SpawnerAnimals.java @@ -69,14 +69,15 @@ { - if ((!enumcreaturetype.getPeacefulCreature() || p_77192_3_) && (enumcreaturetype.getPeacefulCreature() || p_77192_2_) && (!enumcreaturetype.getAnimal() || p_77192_4_)) + if ((!enumcreaturetype.func_75599_d() || p_77192_3_) && (enumcreaturetype.func_75599_d() || p_77192_2_) && (!enumcreaturetype.func_82705_e() || p_77192_4_)) { -- int j4 = p_77192_1_.countEntities(enumcreaturetype.getCreatureClass()); +- int j4 = p_77192_1_.func_72907_a(enumcreaturetype.func_75598_a()); + int j4 = p_77192_1_.countEntities(enumcreaturetype, true); - int k4 = enumcreaturetype.getMaxNumberOfCreature() * i / MOB_COUNT_DIV; + int k4 = enumcreaturetype.func_75601_b() * i / field_180268_a; if (j4 <= k4) { -+ java.util.ArrayList shuffled = com.google.common.collect.Lists.newArrayList(this.eligibleChunksForSpawning); ++ java.util.ArrayList shuffled = com.google.common.collect.Lists.newArrayList(this.field_77193_b); + java.util.Collections.shuffle(shuffled); label374: - -- for (ChunkCoordIntPair chunkcoordintpair1 : this.eligibleChunksForSpawning) +- for (ChunkCoordIntPair chunkcoordintpair1 : this.field_77193_b) + for (ChunkCoordIntPair chunkcoordintpair1 : shuffled) { - BlockPos blockpos = getRandomChunkPosition(p_77192_1_, chunkcoordintpair1.chunkXPos, chunkcoordintpair1.chunkZPos); - int k1 = blockpos.getX(); + BlockPos blockpos = func_180621_a(p_77192_1_, chunkcoordintpair1.field_77276_a, chunkcoordintpair1.field_77275_b); + int k1 = blockpos.func_177958_n(); @@ -134,8 +135,10 @@ - entityliving.setLocationAndAngles((double)f, (double)i3, (double)f1, p_77192_1_.rand.nextFloat() * 360.0F, 0.0F); + entityliving.func_70012_b((double)f, (double)i3, (double)f1, p_77192_1_.field_73012_v.nextFloat() * 360.0F, 0.0F); -- if (entityliving.getCanSpawnHere() && entityliving.handleLavaMovement()) +- if (entityliving.func_70601_bi() && entityliving.func_70058_J()) + net.minecraftforge.fml.common.eventhandler.Event.Result canSpawn = net.minecraftforge.event.ForgeEventFactory.canEntitySpawn(entityliving, p_77192_1_, f, l2, f1); -+ if (canSpawn == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || (canSpawn == net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT && (entityliving.getCanSpawnHere() && entityliving.handleLavaMovement()))) ++ if (canSpawn == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || (canSpawn == net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT && (entityliving.func_70601_bi() && entityliving.func_70058_J()))) { + if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(entityliving, p_77192_1_, f1, l2, f1)) - ientitylivingdata = entityliving.func_180482_a(p_77192_1_.getDifficultyForLocation(new BlockPos(entityliving)), ientitylivingdata); + ientitylivingdata = entityliving.func_180482_a(p_77192_1_.func_175649_E(new BlockPos(entityliving)), ientitylivingdata); - if (entityliving.handleLavaMovement()) + if (entityliving.func_70058_J()) @@ -144,7 +147,7 @@ - p_77192_1_.spawnEntityInWorld(entityliving); + p_77192_1_.func_72838_d(entityliving); } -- if (j2 >= entityliving.getMaxSpawnedInChunk()) +- if (j2 >= entityliving.func_70641_bl()) + if (i2 >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(entityliving)) { continue label374; } @@ -193,7 +196,7 @@ { - BlockPos blockpos = pos.down(); + BlockPos blockpos = p_180267_2_.func_177977_b(); -- if (!World.doesBlockHaveSolidTopSurface(worldIn, blockpos)) -+ if (!worldIn.getBlockState(blockpos).getBlock().canCreatureSpawn(worldIn, blockpos, p_180267_0_)) +- if (!World.func_175683_a(p_180267_1_, blockpos)) ++ if (!p_180267_1_.func_180495_p(blockpos).func_177230_c().canCreatureSpawn(p_180267_1_, blockpos, p_180267_0_)) { return false; } diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch index 56d15eeac..14bdc4683 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -12,62 +12,90 @@ + public static double MAX_ENTITY_RADIUS = 2.0D; + private int field_181546_a = 63; - protected boolean scheduledUpdatesAreImmediate; - public final List loadedEntityList = Lists.newArrayList(); + protected boolean field_72999_e; + public final List field_72996_f = Lists.newArrayList(); @@ -98,6 +105,10 @@ - private final WorldBorder worldBorder; - int[] lightUpdateBlockList; + private final WorldBorder field_175728_M; + int[] field_72994_J; + public boolean restoringBlockSnapshots = false; + public boolean captureBlockSnapshots = false; + public java.util.ArrayList capturedBlockSnapshots = new java.util.ArrayList(); + - protected World(ISaveHandler saveHandlerIn, WorldInfo info, WorldProvider providerIn, Profiler profilerIn, boolean client) + protected World(ISaveHandler p_i45749_1_, WorldInfo p_i45749_2_, WorldProvider p_i45749_3_, Profiler p_i45749_4_, boolean p_i45749_5_) { - this.ambientTickCountdown = this.rand.nextInt(12000); + this.field_72990_M = this.field_73012_v.nextInt(12000); @@ -110,6 +121,7 @@ - this.provider = providerIn; - this.isRemote = client; - this.worldBorder = providerIn.getWorldBorder(); + this.field_73011_w = p_i45749_3_; + this.field_72995_K = p_i45749_5_; + this.field_175728_M = p_i45749_3_.func_177501_r(); + perWorldStorage = new MapStorage((ISaveHandler)null); } - public World init() -@@ -119,6 +131,11 @@ + public World func_175643_b() +@@ -119,13 +131,18 @@ - public BiomeGenBase getBiomeGenForCoords(final BlockPos pos) + public BiomeGenBase func_180494_b(final BlockPos p_180494_1_) { -+ return this.provider.getBiomeGenForCoords(pos); +- if (this.func_175667_e(p_180494_1_)) ++ return this.field_73011_w.getBiomeGenForCoords(p_180494_1_); + } + + public BiomeGenBase getBiomeGenForCoordsBody(final BlockPos pos) + { - if (this.isBlockLoaded(pos)) ++ if (this.func_175667_e(pos)) { - Chunk chunk = this.getChunkFromBlockCoords(pos); -@@ -184,7 +201,7 @@ +- Chunk chunk = this.func_175726_f(p_180494_1_); ++ Chunk chunk = this.func_175726_f(pos); - public boolean isAirBlock(BlockPos pos) - { -- return this.getBlockState(pos).getBlock().getMaterial() == Material.air; -+ return this.getBlockState(pos).getBlock().isAir(this, pos); + try + { +- return chunk.func_177411_a(p_180494_1_, this.field_73011_w.func_177499_m()); ++ return chunk.func_177411_a(pos, this.field_73011_w.func_177499_m()); + } + catch (Throwable throwable) + { +@@ -135,7 +152,7 @@ + { + public String call() throws Exception + { +- return CrashReportCategory.func_180522_a(p_180494_1_); ++ return CrashReportCategory.func_180522_a(pos); + } + }); + throw new ReportedException(crashreport); +@@ -143,7 +160,7 @@ + } + else + { +- return this.field_73011_w.func_177499_m().func_180300_a(p_180494_1_, BiomeGenBase.field_76772_c); ++ return this.field_73011_w.func_177499_m().func_180300_a(pos, BiomeGenBase.field_76772_c); + } } - public boolean isBlockLoaded(BlockPos pos) +@@ -184,7 +201,7 @@ + + public boolean func_175623_d(BlockPos p_175623_1_) + { +- return this.func_180495_p(p_175623_1_).func_177230_c().func_149688_o() == Material.field_151579_a; ++ return this.func_180495_p(p_175623_1_).func_177230_c().isAir(this, p_175623_1_); + } + + public boolean func_175667_e(BlockPos p_175667_1_) @@ -284,39 +301,61 @@ { - Chunk chunk = this.getChunkFromBlockCoords(pos); - Block block = newState.getBlock(); + Chunk chunk = this.func_175726_f(p_180501_1_); + Block block = p_180501_2_.func_177230_c(); + + net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null; -+ if (this.captureBlockSnapshots && !this.isRemote) ++ if (this.captureBlockSnapshots && !this.field_72995_K) + { -+ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, pos, flags); ++ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, p_180501_1_, p_180501_3_); + this.capturedBlockSnapshots.add(blockSnapshot); + } -+ int oldLight = getBlockState(pos).getBlock().getLightValue(this, pos); ++ int oldLight = func_180495_p(p_180501_1_).func_177230_c().getLightValue(this, p_180501_1_); + - IBlockState iblockstate = chunk.setBlockState(pos, newState); + IBlockState iblockstate = chunk.func_177436_a(p_180501_1_, p_180501_2_); if (iblockstate == null) { @@ -76,23 +104,24 @@ } else { - Block block1 = iblockstate.getBlock(); + Block block1 = iblockstate.func_177230_c(); -- if (block.getLightOpacity() != block1.getLightOpacity() || block.getLightValue() != block1.getLightValue()) -+ if (block.getLightOpacity() != block1.getLightOpacity() || block.getLightValue(this, pos) != block1.getLightValue()) +- if (block.func_149717_k() != block1.func_149717_k() || block.func_149750_m() != block1.func_149750_m()) ++ if (block.func_149717_k() != block1.func_149717_k() || block.getLightValue(this, p_180501_1_) != block1.func_149750_m()) { - this.theProfiler.startSection("checkLight"); - this.checkLight(pos); - this.theProfiler.endSection(); + this.field_72984_F.func_76320_a("checkLight"); + this.func_175664_x(p_180501_1_); + this.field_72984_F.func_76319_b(); } -- if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && chunk.isPopulated()) +- if ((p_180501_3_ & 2) != 0 && (!this.field_72995_K || (p_180501_3_ & 4) == 0) && chunk.func_150802_k()) + if (blockSnapshot == null) // Don't notify clients or update physics while capturing blockstates { -- this.markBlockForUpdate(pos); -+ this.markAndNotifyBlock(pos, chunk, iblockstate, newState, flags); // Modularize client and physic updates +- this.func_175689_h(p_180501_1_); ++ this.markAndNotifyBlock(p_180501_1_, chunk, iblockstate, p_180501_2_, p_180501_3_); // Modularize client and physic updates } +- if (!this.field_72995_K && (p_180501_3_ & 1) != 0) + return true; + } + } @@ -101,22 +130,22 @@ + // Split off from original setBlockState(BlockPos, IBlockState Block p_147465_4_, int) method in order to directly send client and physic updates + public void markAndNotifyBlock(BlockPos pos, Chunk chunk, IBlockState old, IBlockState new_, int flags) + { -+ if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && (chunk == null || chunk.isPopulated())) ++ if ((flags & 2) != 0 && (!this.field_72995_K || (flags & 4) == 0) && (chunk == null || chunk.func_150802_k())) + { -+ this.markBlockForUpdate(pos); ++ this.func_175689_h(pos); + } + { + { - if (!this.isRemote && (flags & 1) != 0) ++ if (!this.field_72995_K && (flags & 1) != 0) { -- this.notifyNeighborsRespectDebug(pos, iblockstate.getBlock()); -+ this.notifyNeighborsRespectDebug(pos, new_.getBlock()); +- this.func_175722_b(p_180501_1_, iblockstate.func_177230_c()); ++ this.func_175722_b(pos, new_.func_177230_c()); -- if (block.hasComparatorInputOverride()) -+ if (new_.getBlock().hasComparatorInputOverride()) +- if (block.func_149740_M()) ++ if (new_.func_177230_c().func_149740_M()) { -- this.updateComparatorOutputLevel(pos, block); -+ this.updateComparatorOutputLevel(pos, new_.getBlock()); +- this.func_175666_e(p_180501_1_, block); ++ this.func_175666_e(pos, new_.func_177230_c()); } } - @@ -126,38 +155,38 @@ } @@ -404,6 +443,9 @@ - public void notifyNeighborsOfStateChange(BlockPos pos, Block blockType) + public void func_175685_c(BlockPos p_175685_1_, Block p_175685_2_) { -+ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, pos, this.getBlockState(pos), java.util.EnumSet.allOf(EnumFacing.class)).isCanceled()) ++ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_175685_1_, this.func_180495_p(p_175685_1_), java.util.EnumSet.allOf(EnumFacing.class)).isCanceled()) + return; + - this.notifyBlockOfStateChange(pos.west(), blockType); - this.notifyBlockOfStateChange(pos.east(), blockType); - this.notifyBlockOfStateChange(pos.down(), blockType); + this.func_180496_d(p_175685_1_.func_177976_e(), p_175685_2_); + this.func_180496_d(p_175685_1_.func_177974_f(), p_175685_2_); + this.func_180496_d(p_175685_1_.func_177977_b(), p_175685_2_); @@ -414,6 +456,11 @@ - public void notifyNeighborsOfStateExcept(BlockPos pos, Block blockType, EnumFacing skipSide) + public void func_175695_a(BlockPos p_175695_1_, Block p_175695_2_, EnumFacing p_175695_3_) { + java.util.EnumSet directions = java.util.EnumSet.allOf(EnumFacing.class); -+ directions.remove(skipSide); -+ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, pos, this.getBlockState(pos), directions).isCanceled()) ++ directions.remove(p_175695_3_); ++ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, p_175695_1_, this.func_180495_p(p_175695_1_), directions).isCanceled()) + return; + - if (skipSide != EnumFacing.WEST) + if (p_175695_3_ != EnumFacing.WEST) { - this.notifyBlockOfStateChange(pos.west(), blockType); + this.func_180496_d(p_175695_1_.func_177976_e(), p_175695_2_); @@ -777,7 +824,7 @@ - public boolean isDaytime() + public boolean func_72935_r() { -- return this.skylightSubtracted < 4; -+ return this.provider.isDaytime(); +- return this.field_73008_k < 4; ++ return this.field_73011_w.isDaytime(); } - public MovingObjectPosition rayTraceBlocks(Vec3 p_72933_1_, Vec3 p_72933_2_) + public MovingObjectPosition func_72933_a(Vec3 p_72933_1_, Vec3 p_72933_2_) @@ -972,6 +1019,12 @@ - public void playSoundAtEntity(Entity p_72956_1_, String p_72956_2_, float p_72956_3_, float p_72956_4_) + public void func_72956_a(Entity p_72956_1_, String p_72956_2_, float p_72956_3_, float p_72956_4_) { + net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_72956_1_, p_72956_2_, p_72956_3_, p_72956_4_); + if (event.isCanceled() || event.name == null) return; @@ -165,12 +194,12 @@ + p_72956_3_ = event.newVolume; + p_72956_4_ = event.newPitch; + - for (int i = 0; i < this.worldAccesses.size(); ++i) + for (int i = 0; i < this.field_73021_x.size(); ++i) { - ((IWorldAccess)this.worldAccesses.get(i)).playSound(p_72956_2_, p_72956_1_.posX, p_72956_1_.posY, p_72956_1_.posZ, p_72956_3_, p_72956_4_); + ((IWorldAccess)this.field_73021_x.get(i)).func_72704_a(p_72956_2_, p_72956_1_.field_70165_t, p_72956_1_.field_70163_u, p_72956_1_.field_70161_v, p_72956_3_, p_72956_4_); @@ -980,6 +1033,12 @@ - public void playSoundToNearExcept(EntityPlayer p_85173_1_, String p_85173_2_, float p_85173_3_, float p_85173_4_) + public void func_85173_a(EntityPlayer p_85173_1_, String p_85173_2_, float p_85173_3_, float p_85173_4_) { + net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_85173_1_, p_85173_2_, p_85173_3_, p_85173_4_); + if (event.isCanceled() || event.name == null) return; @@ -178,33 +207,33 @@ + p_85173_3_ = event.newVolume; + p_85173_4_ = event.newPitch; + - for (int i = 0; i < this.worldAccesses.size(); ++i) + for (int i = 0; i < this.field_73021_x.size(); ++i) { - ((IWorldAccess)this.worldAccesses.get(i)).playSoundToNearExcept(p_85173_1_, p_85173_2_, p_85173_1_.posX, p_85173_1_.posY, p_85173_1_.posZ, p_85173_3_, p_85173_4_); + ((IWorldAccess)this.field_73021_x.get(i)).func_85102_a(p_85173_1_, p_85173_2_, p_85173_1_.field_70165_t, p_85173_1_.field_70163_u, p_85173_1_.field_70161_v, p_85173_3_, p_85173_4_); @@ -1033,6 +1092,9 @@ - public boolean spawnEntityInWorld(Entity p_72838_1_) + public boolean func_72838_d(Entity p_72838_1_) { + // do not drop any items while restoring blocksnapshots. Prevents dupes -+ if (!this.isRemote && (p_72838_1_ == null || (p_72838_1_ instanceof net.minecraft.entity.item.EntityItem && this.restoringBlockSnapshots))) return false; ++ if (!this.field_72995_K && (p_72838_1_ == null || (p_72838_1_ instanceof net.minecraft.entity.item.EntityItem && this.restoringBlockSnapshots))) return false; + - int i = MathHelper.floor_double(p_72838_1_.posX / 16.0D); - int j = MathHelper.floor_double(p_72838_1_.posZ / 16.0D); - boolean flag = p_72838_1_.forceSpawn; + int i = MathHelper.func_76128_c(p_72838_1_.field_70165_t / 16.0D); + int j = MathHelper.func_76128_c(p_72838_1_.field_70161_v / 16.0D); + boolean flag = p_72838_1_.field_98038_p; @@ -1055,6 +1117,8 @@ - this.updateAllPlayersSleepingFlag(); + this.func_72854_c(); } + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_72838_1_, this)) && !flag) return false; + - this.getChunkFromChunkCoords(i, j).addEntity(p_72838_1_); - this.loadedEntityList.add(p_72838_1_); - this.onEntityAdded(p_72838_1_); + this.func_72964_e(i, j).func_76612_a(p_72838_1_); + this.field_72996_f.add(p_72838_1_); + this.func_72923_a(p_72838_1_); @@ -1267,17 +1331,29 @@ - public int calculateSkylightSubtracted(float p_72967_1_) + public int func_72967_a(float p_72967_1_) { -+ float f = provider.getSunBrightnessFactor(p_72967_1_); ++ float f = field_73011_w.getSunBrightnessFactor(p_72967_1_); + f = 1 - f; + return (int)(f * 11); + } @@ -218,117 +247,117 @@ + * */ + public float getSunBrightnessFactor(float p_72967_1_) + { - float f = this.getCelestialAngle(p_72967_1_); - float f1 = 1.0F - (MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F); - f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); + float f = this.func_72826_c(p_72967_1_); + float f1 = 1.0F - (MathHelper.func_76134_b(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F); + f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); f1 = 1.0F - f1; - f1 = (float)((double)f1 * (1.0D - (double)(this.getRainStrength(p_72967_1_) * 5.0F) / 16.0D)); - f1 = (float)((double)f1 * (1.0D - (double)(this.getThunderStrength(p_72967_1_) * 5.0F) / 16.0D)); + f1 = (float)((double)f1 * (1.0D - (double)(this.func_72867_j(p_72967_1_) * 5.0F) / 16.0D)); + f1 = (float)((double)f1 * (1.0D - (double)(this.func_72819_i(p_72967_1_) * 5.0F) / 16.0D)); - f1 = 1.0F - f1; - return (int)(f1 * 11.0F); + return f1; } - @SideOnly(Side.CLIENT) - public void removeWorldAccess(IWorldAccess p_72848_1_) + public void func_72848_b(IWorldAccess p_72848_1_) { - this.worldAccesses.remove(p_72848_1_); + this.field_73021_x.remove(p_72848_1_); @@ -1286,6 +1362,12 @@ @SideOnly(Side.CLIENT) - public float getSunBrightness(float p_72971_1_) + public float func_72971_b(float p_72971_1_) { -+ return this.provider.getSunBrightness(p_72971_1_); ++ return this.field_73011_w.getSunBrightness(p_72971_1_); + } + + @SideOnly(Side.CLIENT) + public float getSunBrightnessBody(float p_72971_1_) + { - float f = this.getCelestialAngle(p_72971_1_); - float f1 = 1.0F - (MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.2F); - f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); + float f = this.func_72826_c(p_72971_1_); + float f1 = 1.0F - (MathHelper.func_76134_b(f * (float)Math.PI * 2.0F) * 2.0F + 0.2F); + f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); @@ -1298,6 +1380,12 @@ @SideOnly(Side.CLIENT) - public Vec3 getSkyColor(Entity p_72833_1_, float p_72833_2_) + public Vec3 func_72833_a(Entity p_72833_1_, float p_72833_2_) { -+ return this.provider.getSkyColor(p_72833_1_, p_72833_2_); ++ return this.field_73011_w.getSkyColor(p_72833_1_, p_72833_2_); + } + + @SideOnly(Side.CLIENT) + public Vec3 getSkyColorBody(Entity p_72833_1_, float p_72833_2_) + { - float f = this.getCelestialAngle(p_72833_2_); - float f1 = MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F; - f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); + float f = this.func_72826_c(p_72833_2_); + float f1 = MathHelper.func_76134_b(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F; + f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); @@ -1305,9 +1393,7 @@ - int j = MathHelper.floor_double(p_72833_1_.posY); - int k = MathHelper.floor_double(p_72833_1_.posZ); + int j = MathHelper.func_76128_c(p_72833_1_.field_70163_u); + int k = MathHelper.func_76128_c(p_72833_1_.field_70161_v); BlockPos blockpos = new BlockPos(i, j, k); -- BiomeGenBase biomegenbase = this.getBiomeGenForCoords(blockpos); -- float f2 = biomegenbase.getFloatTemperature(blockpos); -- int l = biomegenbase.getSkyColorByTemp(f2); +- BiomeGenBase biomegenbase = this.func_180494_b(blockpos); +- float f2 = biomegenbase.func_180626_a(blockpos); +- int l = biomegenbase.func_76731_a(f2); + int l = net.minecraftforge.client.ForgeHooksClient.getSkyBlendColour(this, blockpos); float f3 = (float)(l >> 16 & 255) / 255.0F; float f4 = (float)(l >> 8 & 255) / 255.0F; float f5 = (float)(l & 255) / 255.0F; @@ -1367,6 +1453,11 @@ - public float getCurrentMoonPhaseFactor() + public float func_130001_d() { -+ return provider.getCurrentMoonPhaseFactor(); ++ return field_73011_w.getCurrentMoonPhaseFactor(); + } + + public float getCurrentMoonPhaseFactorBody() + { - return WorldProvider.moonPhaseFactors[this.provider.getMoonPhase(this.worldInfo.getWorldTime())]; + return WorldProvider.field_111203_a[this.field_73011_w.func_76559_b(this.field_72986_A.func_76073_f())]; } @@ -1379,6 +1470,12 @@ @SideOnly(Side.CLIENT) - public Vec3 getCloudColour(float p_72824_1_) + public Vec3 func_72824_f(float p_72824_1_) { -+ return this.provider.drawClouds(p_72824_1_); ++ return this.field_73011_w.drawClouds(p_72824_1_); + } + + @SideOnly(Side.CLIENT) + public Vec3 drawCloudsBody(float p_72824_1_) + { - float f = this.getCelestialAngle(p_72824_1_); - float f1 = MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F; - f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); + float f = this.func_72826_c(p_72824_1_); + float f1 = MathHelper.func_76134_b(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F; + f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); @@ -1434,9 +1531,9 @@ - for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1) + for (blockpos = new BlockPos(p_175672_1_.func_177958_n(), chunk.func_76625_h() + 16, p_175672_1_.func_177952_p()); blockpos.func_177956_o() >= 0; blockpos = blockpos1) { - blockpos1 = blockpos.down(); -- Material material = chunk.getBlock(blockpos1).getMaterial(); -+ Block block = chunk.getBlock(blockpos1); + blockpos1 = blockpos.func_177977_b(); +- Material material = chunk.func_177428_a(blockpos1).func_149688_o(); ++ Block block = chunk.func_177428_a(blockpos1); -- if (material.blocksMovement() && material != Material.leaves) -+ if (block.getMaterial().blocksMovement() && !block.isLeaves(this, blockpos1) && !block.isFoliage(this, blockpos1)) +- if (material.func_76230_c() && material != Material.field_151584_j) ++ if (block.func_149688_o().func_76230_c() && !block.isLeaves(this, blockpos1) && !block.isFoliage(this, blockpos1)) { break; } @@ -1448,6 +1545,12 @@ @SideOnly(Side.CLIENT) - public float getStarBrightness(float p_72880_1_) + public float func_72880_h(float p_72880_1_) { -+ return this.provider.getStarBrightness(p_72880_1_); ++ return this.field_73011_w.getStarBrightness(p_72880_1_); + } + + @SideOnly(Side.CLIENT) + public float getStarBrightnessBody(float p_72880_1_) + { - float f = this.getCelestialAngle(p_72880_1_); - float f1 = 1.0F - (MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.25F); - f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); + float f = this.func_72826_c(p_72880_1_); + float f1 = 1.0F - (MathHelper.func_76134_b(f * (float)Math.PI * 2.0F) * 2.0F + 0.25F); + f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); @@ -1494,7 +1597,15 @@ - entity.addEntityCrashInfo(crashreportcategory); + entity.func_85029_a(crashreportcategory); } - throw new ReportedException(crashreport); + if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities) + { -+ net.minecraftforge.fml.common.FMLLog.severe(crashreport.getCompleteReport()); -+ removeEntity(entity); ++ net.minecraftforge.fml.common.FMLLog.severe(crashreport.func_71502_e()); ++ func_72900_e(entity); + } + else + { @@ -336,16 +365,16 @@ + } } - if (entity.isDead) + if (entity.field_70128_L) @@ -1554,7 +1665,15 @@ - CrashReport crashreport1 = CrashReport.makeCrashReport(throwable1, "Ticking entity"); - CrashReportCategory crashreportcategory2 = crashreport1.makeCategory("Entity being ticked"); - entity2.addEntityCrashInfo(crashreportcategory2); + CrashReport crashreport1 = CrashReport.func_85055_a(throwable1, "Ticking entity"); + CrashReportCategory crashreportcategory2 = crashreport1.func_85058_a("Entity being ticked"); + entity2.func_85029_a(crashreportcategory2); - throw new ReportedException(crashreport1); + if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities) + { -+ net.minecraftforge.fml.common.FMLLog.severe(crashreport1.getCompleteReport()); -+ removeEntity(entity2); ++ net.minecraftforge.fml.common.FMLLog.severe(crashreport1.func_71502_e()); ++ func_72900_e(entity2); + } + else + { @@ -355,15 +384,15 @@ } @@ -1601,7 +1720,16 @@ - CrashReport crashreport2 = CrashReport.makeCrashReport(throwable, "Ticking block entity"); - CrashReportCategory crashreportcategory1 = crashreport2.makeCategory("Block entity being ticked"); - tileentity.addInfoToCrashReport(crashreportcategory1); + CrashReport crashreport2 = CrashReport.func_85055_a(throwable, "Ticking block entity"); + CrashReportCategory crashreportcategory1 = crashreport2.func_85058_a("Block entity being ticked"); + tileentity.func_145828_a(crashreportcategory1); - throw new ReportedException(crashreport2); + if (net.minecraftforge.common.ForgeModContainer.removeErroringTileEntities) + { -+ net.minecraftforge.fml.common.FMLLog.severe(crashreport2.getCompleteReport()); -+ tileentity.invalidate(); -+ this.removeTileEntity(tileentity.getPos()); ++ net.minecraftforge.fml.common.FMLLog.severe(crashreport2.func_71502_e()); ++ tileentity.func_145843_s(); ++ this.func_175713_t(tileentity.func_174877_v()); + } + else + { @@ -376,56 +405,56 @@ } } -- this.processingLoadedTiles = false; +- this.field_147481_N = false; - - if (!this.tileEntitiesToBeRemoved.isEmpty()) + if (!this.field_147483_b.isEmpty()) { -+ for (Object tile : tileEntitiesToBeRemoved) ++ for (Object tile : field_147483_b) + { + ((TileEntity)tile).onChunkUnload(); + } + - this.tickableTileEntities.removeAll(this.tileEntitiesToBeRemoved); - this.loadedTileEntityList.removeAll(this.tileEntitiesToBeRemoved); - this.tileEntitiesToBeRemoved.clear(); + this.field_175730_i.removeAll(this.field_147483_b); + this.field_147482_g.removeAll(this.field_147483_b); + this.field_147483_b.clear(); } -+ this.processingLoadedTiles = false; //FML Move below remove to prevent CMEs ++ this.field_147481_N = false; //FML Move below remove to prevent CMEs + - this.theProfiler.endStartSection("pendingBlockEntities"); + this.field_72984_F.func_76318_c("pendingBlockEntities"); - if (!this.addedTileEntityList.isEmpty()) + if (!this.field_147484_a.isEmpty()) @@ -1660,7 +1793,8 @@ - public boolean addTileEntity(TileEntity tile) + public boolean func_175700_a(TileEntity p_175700_1_) { -- boolean flag = this.loadedTileEntityList.add(tile); -+ List dest = processingLoadedTiles ? addedTileEntityList : loadedTileEntityList; -+ boolean flag = dest.add(tile); +- boolean flag = this.field_147482_g.add(p_175700_1_); ++ List dest = field_147481_N ? field_147484_a : field_147482_g; ++ boolean flag = dest.add(p_175700_1_); - if (flag && tile instanceof ITickable) + if (flag && p_175700_1_ instanceof ITickable) { @@ -1699,9 +1833,13 @@ { - int i = MathHelper.floor_double(p_72866_1_.posX); - int j = MathHelper.floor_double(p_72866_1_.posZ); + int i = MathHelper.func_76128_c(p_72866_1_.field_70165_t); + int j = MathHelper.func_76128_c(p_72866_1_.field_70161_v); - int k = 32; + boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(i >> 4, j >> 4)); + int k = isForced ? 0 : 32; -+ boolean canUpdate = !p_72866_2_ || this.isAreaLoaded(i - k, 0, j - k, i + k, 0, j + k, true); ++ boolean canUpdate = !p_72866_2_ || this.func_175663_a(i - k, 0, j - k, i + k, 0, j + k, true); -- if (!p_72866_2_ || this.isAreaLoaded(i - k, 0, j - k, i + k, 0, j + k, true)) +- if (!p_72866_2_ || this.func_175663_a(i - k, 0, j - k, i + k, 0, j + k, true)) + if (!canUpdate) canUpdate = net.minecraftforge.event.ForgeEventFactory.canEntityUpdate(p_72866_1_); + + if (canUpdate) { - p_72866_1_.lastTickPosX = p_72866_1_.posX; - p_72866_1_.lastTickPosY = p_72866_1_.posY; + p_72866_1_.field_70142_S = p_72866_1_.field_70165_t; + p_72866_1_.field_70137_T = p_72866_1_.field_70163_u; @@ -1829,7 +1967,7 @@ { - Block block = this.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, l1, i2)).getBlock(); + Block block = this.func_180495_p(blockpos$mutableblockpos.func_181079_c(k1, l1, i2)).func_177230_c(); -- if (block.getMaterial() != Material.air) +- if (block.func_149688_o() != Material.field_151579_a) + if (!block.isAir(this, new BlockPos(k1, l1, i2))) { return true; @@ -442,346 +471,346 @@ } } @@ -2034,6 +2176,7 @@ - public Explosion newExplosion(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) + public Explosion func_72885_a(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) { Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_); + if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; - explosion.doExplosionA(); - explosion.doExplosionB(true); + explosion.func_77278_a(); + explosion.func_77279_a(true); return explosion; @@ -2180,19 +2323,27 @@ else { - this.addTileEntity(tileEntityIn); -- this.getChunkFromBlockCoords(pos).addTileEntity(pos, tileEntityIn); -+ Chunk chunk = this.getChunkFromBlockCoords(pos); //Forge add NPE protection -+ if (chunk != null) chunk.addTileEntity(pos, tileEntityIn); + this.func_175700_a(p_175690_2_); +- 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_); //Forge add NPE protection ++ if (chunk != null) chunk.func_177426_a(p_175690_1_, p_175690_2_); } -+ this.updateComparatorOutputLevel(pos, getBlockState(pos).getBlock()); //Notify neighbors of changes ++ this.func_175666_e(p_175690_1_, func_180495_p(p_175690_1_).func_177230_c()); //Notify neighbors of changes } } - public void removeTileEntity(BlockPos pos) + public void func_175713_t(BlockPos p_175713_1_) { + //Chunk chunk = this.getChunkFromBlockCoords(pos); + //if (chunk != null) chunk.removeTileEntity(pos); + //Forge ToDO: Are these patches needed anymore? + - TileEntity tileentity = this.getTileEntity(pos); + TileEntity tileentity = this.func_175625_s(p_175713_1_); - if (tileentity != null && this.processingLoadedTiles) + if (tileentity != null && this.field_147481_N) { - tileentity.invalidate(); - this.addedTileEntityList.remove(tileentity); + tileentity.func_145843_s(); + this.field_147484_a.remove(tileentity); + if (!(tileentity instanceof ITickable)) //Forge: If they are not tickable they wont be removed in the update loop. -+ this.loadedTileEntityList.remove(tileentity); ++ this.field_147482_g.remove(tileentity); } else { @@ -2205,6 +2356,7 @@ - this.getChunkFromBlockCoords(pos).removeTileEntity(pos); + this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_); } -+ this.updateComparatorOutputLevel(pos, getBlockState(pos).getBlock()); //Notify neighbors of changes ++ this.func_175666_e(p_175713_1_, func_180495_p(p_175713_1_).func_177230_c()); //Notify neighbors of changes } - public void markTileEntityForRemoval(TileEntity tileEntityIn) + public void func_147457_a(TileEntity p_147457_1_) @@ -2223,7 +2375,7 @@ { - IBlockState iblockstate = p_175683_0_.getBlockState(p_175683_1_); - Block block = iblockstate.getBlock(); -- return block.getMaterial().isOpaque() && block.isFullCube() ? true : (block instanceof BlockStairs ? iblockstate.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP : (block instanceof BlockSlab ? iblockstate.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? ((Integer)iblockstate.getValue(BlockSnow.LAYERS)).intValue() == 7 : false)))); + IBlockState iblockstate = p_175683_0_.func_180495_p(p_175683_1_); + Block block = iblockstate.func_177230_c(); +- return block.func_149688_o().func_76218_k() && block.func_149686_d() ? true : (block instanceof BlockStairs ? iblockstate.func_177229_b(BlockStairs.field_176308_b) == BlockStairs.EnumHalf.TOP : (block instanceof BlockSlab ? iblockstate.func_177229_b(BlockSlab.field_176554_a) == BlockSlab.EnumBlockHalf.TOP : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? ((Integer)iblockstate.func_177229_b(BlockSnow.field_176315_a)).intValue() == 7 : false)))); + return block.isSideSolid(p_175683_0_, p_175683_1_, EnumFacing.UP); } - public boolean isBlockNormalCube(BlockPos p_175677_1_, boolean p_175677_2_) + public boolean func_175677_d(BlockPos p_175677_1_, boolean p_175677_2_) @@ -2243,7 +2395,7 @@ else { - Block block = this.getBlockState(p_175677_1_).getBlock(); -- return block.getMaterial().isOpaque() && block.isFullCube(); + Block block = this.func_180495_p(p_175677_1_).func_177230_c(); +- return block.func_149688_o().func_76218_k() && block.func_149686_d(); + return block.isNormalCube(this, p_175677_1_); } } } @@ -2262,6 +2414,7 @@ { - this.spawnHostileMobs = hostile; - this.spawnPeacefulMobs = peaceful; -+ this.provider.setAllowedSpawnTypes(hostile, peaceful); + this.field_72985_G = p_72891_1_; + this.field_72992_H = p_72891_2_; ++ this.field_73011_w.setAllowedSpawnTypes(p_72891_1_, p_72891_2_); } - public void tick() + public void func_72835_b() @@ -2271,6 +2424,11 @@ - protected void calculateInitialWeather() + protected void func_72947_a() { -+ this.provider.calculateInitialWeather(); ++ this.field_73011_w.calculateInitialWeather(); + } + + public void calculateInitialWeatherBody() + { - if (this.worldInfo.isRaining()) + if (this.field_72986_A.func_76059_o()) { - this.rainingStrength = 1.0F; + this.field_73004_o = 1.0F; @@ -2284,6 +2442,11 @@ - protected void updateWeather() + protected void func_72979_l() { -+ this.provider.updateWeather(); ++ this.field_73011_w.updateWeather(); + } + + public void updateWeatherBody() + { - if (!this.provider.getHasNoSky()) + if (!this.field_73011_w.func_177495_o()) { - if (!this.isRemote) + if (!this.field_72995_K) @@ -2378,6 +2541,7 @@ { - this.activeChunkSet.clear(); - this.theProfiler.startSection("buildList"); -+ this.activeChunkSet.addAll(getPersistentChunks().keySet()); + this.field_72993_I.clear(); + this.field_72984_F.func_76320_a("buildList"); ++ this.field_72993_I.addAll(getPersistentChunks().keySet()); - for (int i = 0; i < this.playerEntities.size(); ++i) + for (int i = 0; i < this.field_73010_i.size(); ++i) { @@ -2435,7 +2599,7 @@ j = j + p_147467_1_; k = k + p_147467_2_; -- if (block.getMaterial() == Material.air && this.getLight(blockpos) <= this.rand.nextInt(8) && this.getLightFor(EnumSkyBlock.SKY, blockpos) <= 0) -+ if (block.isAir(this, blockpos) && this.getLight(blockpos) <= this.rand.nextInt(8) && this.getLightFor(EnumSkyBlock.SKY, blockpos) <= 0) +- if (block.func_149688_o() == Material.field_151579_a && this.func_175699_k(blockpos) <= this.field_73012_v.nextInt(8) && this.func_175642_b(EnumSkyBlock.SKY, blockpos) <= 0) ++ if (block.isAir(this, blockpos) && this.func_175699_k(blockpos) <= this.field_73012_v.nextInt(8) && this.func_175642_b(EnumSkyBlock.SKY, blockpos) <= 0) { - EntityPlayer entityplayer = this.getClosestPlayer((double)j + 0.5D, (double)l + 0.5D, (double)k + 0.5D, 8.0D); + EntityPlayer entityplayer = this.func_72977_a((double)j + 0.5D, (double)l + 0.5D, (double)k + 0.5D, 8.0D); @@ -2475,6 +2639,11 @@ - public boolean canBlockFreeze(BlockPos pos, boolean noWaterAdj) + public boolean func_175670_e(BlockPos p_175670_1_, boolean p_175670_2_) { -+ return this.provider.canBlockFreeze(pos, noWaterAdj); ++ return this.field_73011_w.canBlockFreeze(p_175670_1_, p_175670_2_); + } + -+ public boolean canBlockFreezeBody(BlockPos pos, boolean noWaterAdj) ++ public boolean canBlockFreezeBody(BlockPos p_175670_1_, boolean p_175670_2_) + { - BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); - float f = biomegenbase.getFloatTemperature(pos); + BiomeGenBase biomegenbase = this.func_180494_b(p_175670_1_); + float f = biomegenbase.func_180626_a(p_175670_1_); @@ -2516,6 +2685,11 @@ - public boolean canSnowAt(BlockPos pos, boolean checkLight) + public boolean func_175708_f(BlockPos p_175708_1_, boolean p_175708_2_) { -+ return this.provider.canSnowAt(pos, checkLight); ++ return this.field_73011_w.canSnowAt(p_175708_1_, p_175708_2_); + } + -+ public boolean canSnowAtBody(BlockPos pos, boolean checkLight) ++ public boolean canSnowAtBody(BlockPos p_175708_1_, boolean p_175708_2_) + { - BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); - float f = biomegenbase.getFloatTemperature(pos); + BiomeGenBase biomegenbase = this.func_180494_b(p_175708_1_); + float f = biomegenbase.func_180626_a(p_175708_1_); @@ -2533,7 +2707,7 @@ { - Block block = this.getBlockState(pos).getBlock(); + Block block = this.func_180495_p(p_175708_1_).func_177230_c(); -- if (block.getMaterial() == Material.air && Blocks.snow_layer.canPlaceBlockAt(this, pos)) -+ if (block.isAir(this, pos) && Blocks.snow_layer.canPlaceBlockAt(this, pos)) +- if (block.func_149688_o() == Material.field_151579_a && Blocks.field_150431_aC.func_176196_c(this, p_175708_1_)) ++ if (block.isAir(this, p_175708_1_) && Blocks.field_150431_aC.func_176196_c(this, p_175708_1_)) { return true; } @@ -2565,10 +2739,11 @@ else { - Block block = this.getBlockState(pos).getBlock(); -- int i = lightType == EnumSkyBlock.SKY ? 0 : block.getLightValue(); -- int j = block.getLightOpacity(); -+ int blockLight = block.getLightValue(this, pos); -+ int i = lightType == EnumSkyBlock.SKY ? 0 : blockLight; -+ int j = block.getLightOpacity(this, pos); + Block block = this.func_180495_p(p_175638_1_).func_177230_c(); +- int i = p_175638_2_ == EnumSkyBlock.SKY ? 0 : block.func_149750_m(); +- int j = block.func_149717_k(); ++ int blockLight = block.getLightValue(this, p_175638_1_); ++ int i = p_175638_2_ == EnumSkyBlock.SKY ? 0 : blockLight; ++ int j = block.getLightOpacity(this, p_175638_1_); -- if (j >= 15 && block.getLightValue() > 0) +- if (j >= 15 && block.func_149750_m() > 0) + if (j >= 15 && blockLight > 0) { j = 1; } @@ -2768,10 +2943,10 @@ - public List func_175674_a(Entity entityIn, AxisAlignedBB p_175674_2_, Predicate p_175674_3_) + public List func_175674_a(Entity p_175674_1_, AxisAlignedBB p_175674_2_, Predicate p_175674_3_) { List list = Lists.newArrayList(); -- int i = MathHelper.floor_double((p_175674_2_.minX - 2.0D) / 16.0D); -- int j = MathHelper.floor_double((p_175674_2_.maxX + 2.0D) / 16.0D); -- int k = MathHelper.floor_double((p_175674_2_.minZ - 2.0D) / 16.0D); -- int l = MathHelper.floor_double((p_175674_2_.maxZ + 2.0D) / 16.0D); -+ int i = MathHelper.floor_double((p_175674_2_.minX - MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.floor_double((p_175674_2_.maxX + MAX_ENTITY_RADIUS) / 16.0D); -+ int k = MathHelper.floor_double((p_175674_2_.minZ - MAX_ENTITY_RADIUS) / 16.0D); -+ int l = MathHelper.floor_double((p_175674_2_.maxZ + MAX_ENTITY_RADIUS) / 16.0D); +- 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 - MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.func_76128_c((p_175674_2_.field_72336_d + MAX_ENTITY_RADIUS) / 16.0D); ++ int k = MathHelper.func_76128_c((p_175674_2_.field_72339_c - MAX_ENTITY_RADIUS) / 16.0D); ++ int l = MathHelper.func_76128_c((p_175674_2_.field_72334_f + MAX_ENTITY_RADIUS) / 16.0D); for (int i1 = i; i1 <= j; ++i1) { @@ -2824,10 +2999,10 @@ - public List getEntitiesWithinAABB(Class clazz, AxisAlignedBB aabb, Predicate filter) + public List func_175647_a(Class p_175647_1_, AxisAlignedBB p_175647_2_, Predicate p_175647_3_) { -- int i = MathHelper.floor_double((aabb.minX - 2.0D) / 16.0D); -- int j = MathHelper.floor_double((aabb.maxX + 2.0D) / 16.0D); -- int k = MathHelper.floor_double((aabb.minZ - 2.0D) / 16.0D); -- int l = MathHelper.floor_double((aabb.maxZ + 2.0D) / 16.0D); -+ int i = MathHelper.floor_double((aabb.minX - MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.floor_double((aabb.maxX + MAX_ENTITY_RADIUS) / 16.0D); -+ int k = MathHelper.floor_double((aabb.minZ - MAX_ENTITY_RADIUS) / 16.0D); -+ int l = MathHelper.floor_double((aabb.maxZ + MAX_ENTITY_RADIUS) / 16.0D); +- int i = MathHelper.func_76128_c((p_175647_2_.field_72340_a - 2.0D) / 16.0D); +- int j = MathHelper.func_76128_c((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_76128_c((p_175647_2_.field_72334_f + 2.0D) / 16.0D); ++ int i = MathHelper.func_76128_c((p_175647_2_.field_72340_a - MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.func_76128_c((p_175647_2_.field_72336_d + MAX_ENTITY_RADIUS) / 16.0D); ++ int k = MathHelper.func_76128_c((p_175647_2_.field_72339_c - MAX_ENTITY_RADIUS) / 16.0D); ++ int l = MathHelper.func_76128_c((p_175647_2_.field_72334_f + MAX_ENTITY_RADIUS) / 16.0D); List list = Lists.newArrayList(); for (int i1 = i; i1 <= j; ++i1) @@ -2905,11 +3080,13 @@ - public void loadEntities(Collection entityCollection) + public void func_175650_b(Collection p_175650_1_) { -- this.loadedEntityList.addAll(entityCollection); +- this.field_72996_f.addAll(p_175650_1_); - - for (Entity entity : entityCollection) + for (Entity entity : p_175650_1_) { -- this.onEntityAdded(entity); +- this.func_72923_a(entity); + if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entity, this))) + { -+ loadedEntityList.add(entity); -+ this.onEntityAdded(entity); ++ field_72996_f.add(entity); ++ this.func_72923_a(entity); + } } } @@ -2922,7 +3099,9 @@ { - Block block = this.getBlockState(p_175716_2_).getBlock(); - AxisAlignedBB axisalignedbb = p_175716_3_ ? null : p_175716_1_.getCollisionBoundingBox(this, p_175716_2_, p_175716_1_.getDefaultState()); -- return axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, p_175716_5_) ? false : (block.getMaterial() == Material.circuits && p_175716_1_ == Blocks.anvil ? true : block.getMaterial().isReplaceable() && p_175716_1_.canReplace(this, p_175716_2_, p_175716_4_, p_175716_6_)); -+ if (axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, p_175716_5_)) return false; -+ if (block.getMaterial() == Material.circuits && p_175716_1_ == Blocks.anvil) return true; -+ return block.isReplaceable(this, p_175716_2_) && p_175716_1_.canReplace(this, p_175716_2_, p_175716_4_, p_175716_6_); + Block block = this.func_180495_p(p_175716_2_).func_177230_c(); + AxisAlignedBB axisalignedbb = p_175716_3_ ? null : p_175716_1_.func_180640_a(this, p_175716_2_, p_175716_1_.func_176223_P()); +- return axisalignedbb != null && !this.func_72917_a(axisalignedbb, p_175716_5_) ? false : (block.func_149688_o() == Material.field_151594_q && p_175716_1_ == Blocks.field_150467_bQ ? true : block.func_149688_o().func_76222_j() && p_175716_1_.func_176193_a(this, p_175716_2_, p_175716_4_, p_175716_6_)); ++ if (axisalignedbb != null && !this.func_72917_a(axisalignedbb, p_175716_5_)) return false; ++ if (block.func_149688_o() == Material.field_151594_q && p_175716_1_ == Blocks.field_150467_bQ) return true; ++ return block.func_176200_f(this, p_175716_2_) && p_175716_1_.func_176193_a(this, p_175716_2_, p_175716_4_, p_175716_6_); } public int func_181545_F() @@ -3007,7 +3186,7 @@ { - IBlockState iblockstate = this.getBlockState(pos); - Block block = iblockstate.getBlock(); -- return block.isNormalCube() ? this.getStrongPower(pos) : block.isProvidingWeakPower(this, pos, iblockstate, facing); -+ return block.shouldCheckWeakPower(this, pos, facing) ? this.getStrongPower(pos) : block.isProvidingWeakPower(this, pos, iblockstate, facing); + IBlockState iblockstate = this.func_180495_p(p_175651_1_); + Block block = iblockstate.func_177230_c(); +- return block.func_149721_r() ? this.func_175676_y(p_175651_1_) : block.func_180656_a(this, p_175651_1_, iblockstate, p_175651_2_); ++ return block.shouldCheckWeakPower(this, p_175651_1_, p_175651_2_) ? this.func_175676_y(p_175651_1_) : block.func_180656_a(this, p_175651_1_, iblockstate, p_175651_2_); } - public boolean isBlockPowered(BlockPos pos) + public boolean func_175640_z(BlockPos p_175640_1_) @@ -3134,7 +3313,7 @@ - public long getSeed() + public long func_72905_C() { -- return this.worldInfo.getSeed(); -+ return this.provider.getSeed(); +- return this.field_72986_A.func_76063_b(); ++ return this.field_73011_w.getSeed(); } - public long getTotalWorldTime() + public long func_82737_E() @@ -3144,17 +3323,17 @@ - public long getWorldTime() + public long func_72820_D() { -- return this.worldInfo.getWorldTime(); -+ return this.provider.getWorldTime(); +- return this.field_72986_A.func_76073_f(); ++ return this.field_73011_w.getWorldTime(); } - public void setWorldTime(long time) + public void func_72877_b(long p_72877_1_) { -- this.worldInfo.setWorldTime(time); -+ this.provider.setWorldTime(time); +- this.field_72986_A.func_76068_b(p_72877_1_); ++ this.field_73011_w.setWorldTime(p_72877_1_); } - public BlockPos getSpawnPoint() + public BlockPos func_175694_M() { -- BlockPos blockpos = new BlockPos(this.worldInfo.getSpawnX(), this.worldInfo.getSpawnY(), this.worldInfo.getSpawnZ()); -+ BlockPos blockpos = this.provider.getSpawnPoint(); +- BlockPos blockpos = new BlockPos(this.field_72986_A.func_76079_c(), this.field_72986_A.func_76075_d(), this.field_72986_A.func_76074_e()); ++ BlockPos blockpos = this.field_73011_w.getSpawnPoint(); - if (!this.getWorldBorder().contains(blockpos)) + if (!this.func_175723_af().func_177746_a(blockpos)) { @@ -3166,7 +3345,7 @@ - public void setSpawnPoint(BlockPos pos) + public void func_175652_B(BlockPos p_175652_1_) { -- this.worldInfo.setSpawn(pos); -+ this.provider.setSpawnPoint(pos); +- this.field_72986_A.func_176143_a(p_175652_1_); ++ this.field_73011_w.setSpawnPoint(p_175652_1_); } @SideOnly(Side.CLIENT) @@ -3186,12 +3365,18 @@ - if (!this.loadedEntityList.contains(entityIn)) + if (!this.field_72996_f.contains(p_72897_1_)) { -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entityIn, this))) - this.loadedEntityList.add(entityIn); ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_72897_1_, this))) + this.field_72996_f.add(p_72897_1_); } } - public boolean isBlockModifiable(EntityPlayer player, BlockPos pos) + public boolean func_175660_a(EntityPlayer p_175660_1_, BlockPos p_175660_2_) { -+ return this.provider.canMineBlock(player, pos); ++ return this.field_73011_w.canMineBlock(p_175660_1_, p_175660_2_); + } + -+ public boolean canMineBlockBody(EntityPlayer player, BlockPos pos) ++ public boolean canMineBlockBody(EntityPlayer p_175660_1_, BlockPos p_175660_2_) + { return true; } @@ -3285,8 +3470,7 @@ - public boolean isBlockinHighHumidity(BlockPos pos) + public boolean func_180502_D(BlockPos p_180502_1_) { -- BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); -- return biomegenbase.isHighHumidity(); -+ return this.provider.isBlockHighHumidity(pos); +- BiomeGenBase biomegenbase = this.func_180494_b(p_180502_1_); +- return biomegenbase.func_76736_e(); ++ return this.field_73011_w.isBlockHighHumidity(p_180502_1_); } - public MapStorage getMapStorage() + public MapStorage func_175693_T() @@ -3345,12 +3529,12 @@ - public int getHeight() + public int func_72800_K() { - return 256; -+ return this.provider.getHeight(); ++ return this.field_73011_w.getHeight(); } - public int getActualHeight() + public int func_72940_L() { -- return this.provider.getHasNoSky() ? 128 : 256; -+ return this.provider.getActualHeight(); +- return this.field_73011_w.func_177495_o() ? 128 : 256; ++ return this.field_73011_w.getActualHeight(); } - public Random setRandomSeed(int p_72843_1_, int p_72843_2_, int p_72843_3_) + public Random func_72843_D(int p_72843_1_, int p_72843_2_, int p_72843_3_) @@ -3405,7 +3589,7 @@ @SideOnly(Side.CLIENT) - public double getHorizon() + public double func_72919_O() { -- return this.worldInfo.getTerrainType() == WorldType.FLAT ? 0.0D : 63.0D; -+ return provider.getHorizon(); +- return this.field_72986_A.func_76067_t() == WorldType.field_77138_c ? 0.0D : 63.0D; ++ return field_73011_w.getHorizon(); } - public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress) + public void func_175715_c(int p_175715_1_, BlockPos p_175715_2_, int p_175715_3_) @@ -3447,18 +3631,14 @@ { - IBlockState iblockstate = this.getBlockState(blockpos); + IBlockState iblockstate = this.func_180495_p(blockpos); -- if (Blocks.unpowered_comparator.isAssociated(iblockstate.getBlock())) -+ iblockstate.getBlock().onNeighborChange(this, blockpos, pos); -+ if (iblockstate.getBlock().isNormalCube(this, blockpos)) +- if (Blocks.field_150441_bU.func_149907_e(iblockstate.func_177230_c())) ++ iblockstate.func_177230_c().onNeighborChange(this, blockpos, p_175666_1_); ++ if (iblockstate.func_177230_c().isNormalCube(this, blockpos)) { -- iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn); +- iblockstate.func_177230_c().func_176204_a(this, blockpos, iblockstate, p_175666_2_); - } -- else if (iblockstate.getBlock().isNormalCube()) +- else if (iblockstate.func_177230_c().func_149721_r()) - { -- blockpos = blockpos.offset(enumfacing); -- iblockstate = this.getBlockState(blockpos); +- blockpos = blockpos.func_177972_a(enumfacing); +- iblockstate = this.func_180495_p(blockpos); - -- if (Blocks.unpowered_comparator.isAssociated(iblockstate.getBlock())) -+ BlockPos posOther = blockpos.offset(enumfacing); -+ Block other = getBlockState(posOther).getBlock(); +- if (Blocks.field_150441_bU.func_149907_e(iblockstate.func_177230_c())) ++ BlockPos posOther = blockpos.func_177972_a(enumfacing); ++ Block other = func_180495_p(posOther).func_177230_c(); + if (other.getWeakChanges(this, posOther)) { -- iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn); -+ other.onNeighborChange(this, posOther, pos); +- iblockstate.func_177230_c().func_176204_a(this, blockpos, iblockstate, p_175666_2_); ++ other.onNeighborChange(this, posOther, p_175666_1_); } } } @@ -816,11 +845,11 @@ + @Override + public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) + { -+ if (!this.isValid(pos)) return _default; ++ if (!this.func_175701_a(pos)) return _default; + -+ Chunk chunk = getChunkFromBlockCoords(pos); -+ if (chunk == null || chunk.isEmpty()) return _default; -+ return getBlockState(pos).getBlock().isSideSolid(this, pos, side); ++ Chunk chunk = func_175726_f(pos); ++ if (chunk == null || chunk.func_76621_g()) return _default; ++ return func_180495_p(pos).func_177230_c().isSideSolid(this, pos, side); + } + + /** @@ -841,8 +870,8 @@ + */ + public int getBlockLightOpacity(BlockPos pos) + { -+ if (!this.isValid(pos)) return 0; -+ return getChunkFromBlockCoords(pos).getBlockLightOpacity(pos); ++ if (!this.func_175701_a(pos)) return 0; ++ return func_175726_f(pos).func_177437_b(pos); + } + + /** @@ -851,9 +880,9 @@ + public int countEntities(net.minecraft.entity.EnumCreatureType type, boolean forSpawnCount) + { + int count = 0; -+ for (int x = 0; x < loadedEntityList.size(); x++) ++ for (int x = 0; x < field_72996_f.size(); x++) + { -+ if (((Entity)loadedEntityList.get(x)).isCreatureType(type, forSpawnCount)) ++ if (((Entity)field_72996_f.get(x)).isCreatureType(type, forSpawnCount)) + { + count++; + } diff --git a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch index e87006bf0..1bfabc7e5 100644 --- a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch @@ -2,62 +2,62 @@ +++ ../src-work/minecraft/net/minecraft/world/WorldProvider.java @@ -51,26 +51,12 @@ - protected void registerWorldChunkManager() + protected void func_76572_b() { -- WorldType worldtype = this.worldObj.getWorldInfo().getTerrainType(); +- WorldType worldtype = this.field_76579_a.func_72912_H().func_76067_t(); - -- if (worldtype == WorldType.FLAT) +- if (worldtype == WorldType.field_77138_c) - { -- FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.createFlatGeneratorFromString(this.worldObj.getWorldInfo().getGeneratorOptions()); -- this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), BiomeGenBase.field_180279_ad), 0.5F); +- FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.func_82651_a(this.field_76579_a.func_72912_H().func_82571_y()); +- this.field_76578_c = new WorldChunkManagerHell(BiomeGenBase.func_180276_a(flatgeneratorinfo.func_82648_a(), BiomeGenBase.field_180279_ad), 0.5F); - } -- else if (worldtype == WorldType.DEBUG_WORLD) +- else if (worldtype == WorldType.field_180272_g) - { -- this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.plains, 0.0F); +- this.field_76578_c = new WorldChunkManagerHell(BiomeGenBase.field_76772_c, 0.0F); - } - else - { -- this.worldChunkMgr = new WorldChunkManager(this.worldObj); +- this.field_76578_c = new WorldChunkManager(this.field_76579_a); - } -+ this.worldChunkMgr = terrainType.getChunkManager(worldObj); ++ this.field_76578_c = field_76577_b.getChunkManager(field_76579_a); } - public IChunkProvider createChunkGenerator() + public IChunkProvider func_76555_c() { -- return (IChunkProvider)(this.terrainType == WorldType.FLAT ? new ChunkProviderFlat(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : (this.terrainType == WorldType.DEBUG_WORLD ? new ChunkProviderDebug(this.worldObj) : (this.terrainType == WorldType.CUSTOMIZED ? new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings)))); -+ return terrainType.getChunkGenerator(worldObj, generatorSettings); +- return (IChunkProvider)(this.field_76577_b == WorldType.field_77138_c ? new ChunkProviderFlat(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c) : (this.field_76577_b == WorldType.field_180272_g ? new ChunkProviderDebug(this.field_76579_a) : (this.field_76577_b == WorldType.field_180271_f ? new ChunkProviderGenerate(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c) : new ChunkProviderGenerate(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c)))); ++ return field_76577_b.getChunkGenerator(field_76579_a, field_82913_c); } - public boolean canCoordinateBeSpawn(int x, int z) + public boolean func_76566_a(int p_76566_1_, int p_76566_2_) @@ -153,13 +139,13 @@ - public static WorldProvider getProviderForDimension(int dimension) + public static WorldProvider func_76570_a(int p_76570_0_) { -- return (WorldProvider)(dimension == -1 ? new WorldProviderHell() : (dimension == 0 ? new WorldProviderSurface() : (dimension == 1 ? new WorldProviderEnd() : null))); -+ return net.minecraftforge.common.DimensionManager.createProviderFor(dimension); +- return (WorldProvider)(p_76570_0_ == -1 ? new WorldProviderHell() : (p_76570_0_ == 0 ? new WorldProviderSurface() : (p_76570_0_ == 1 ? new WorldProviderEnd() : null))); ++ return net.minecraftforge.common.DimensionManager.createProviderFor(p_76570_0_); } @SideOnly(Side.CLIENT) - public float getCloudHeight() + public float func_76571_f() { - return 128.0F; -+ return this.terrainType.getCloudHeight(); ++ return this.field_76577_b.getCloudHeight(); } @SideOnly(Side.CLIENT) @@ -175,13 +161,13 @@ - public int getAverageGroundLevel() + public int func_76557_i() { -- return this.terrainType == WorldType.FLAT ? 4 : this.worldObj.func_181545_F() + 1; -+ return this.terrainType.getMinimumSpawnHeight(this.worldObj); +- return this.field_76577_b == WorldType.field_77138_c ? 4 : this.field_76579_a.func_181545_F() + 1; ++ return this.field_76577_b.getMinimumSpawnHeight(this.field_76579_a); } @SideOnly(Side.CLIENT) - public double getVoidFogYFactor() + public double func_76565_k() { -- return this.terrainType == WorldType.FLAT ? 1.0D : 0.03125D; -+ return this.terrainType.voidFadeMagnitude(); +- return this.field_76577_b == WorldType.field_77138_c ? 1.0D : 0.03125D; ++ return this.field_76577_b.voidFadeMagnitude(); } @SideOnly(Side.CLIENT) @@ -79,7 +79,7 @@ + */ + public void setDimension(int dim) + { -+ this.dimensionId = dim; ++ this.field_76574_g = dim; + } + + /** @@ -89,7 +89,7 @@ + */ + public String getSaveFolder() + { -+ return (dimensionId == 0 ? null : "DIM" + dimensionId); ++ return (field_76574_g == 0 ? null : "DIM" + field_76574_g); + } + + /** @@ -181,18 +181,18 @@ + + public BlockPos getRandomizedSpawnPoint() + { -+ BlockPos ret = this.worldObj.getSpawnPoint(); ++ BlockPos ret = this.field_76579_a.func_175694_M(); + -+ boolean isAdventure = worldObj.getWorldInfo().getGameType() == WorldSettings.GameType.ADVENTURE; -+ int spawnFuzz = terrainType.getSpawnFuzz(); -+ int border = MathHelper.floor_double(worldObj.getWorldBorder().getClosestDistance(ret.getX(), ret.getZ())); ++ boolean isAdventure = field_76579_a.func_72912_H().func_76077_q() == WorldSettings.GameType.ADVENTURE; ++ int spawnFuzz = field_76577_b.getSpawnFuzz(); ++ int border = MathHelper.func_76128_c(field_76579_a.func_175723_af().func_177729_b(ret.func_177958_n(), ret.func_177952_p())); + if (border < spawnFuzz) spawnFuzz = border; + if (spawnFuzz < 1) spawnFuzz = 1; + int spawnFuzzHalf = spawnFuzz / 2; + -+ if (!getHasNoSky() && !isAdventure) ++ if (!func_177495_o() && !isAdventure) + { -+ ret = worldObj.getTopSolidOrLiquidBlock(ret.add(worldObj.rand.nextInt(spawnFuzzHalf) - spawnFuzz, 0, worldObj.rand.nextInt(spawnFuzzHalf) - spawnFuzz)); ++ ret = field_76579_a.func_175672_r(ret.func_177982_a(field_76579_a.field_73012_v.nextInt(spawnFuzzHalf) - spawnFuzz, 0, field_76579_a.field_73012_v.nextInt(spawnFuzzHalf) - spawnFuzz)); + } + + return ret; @@ -208,7 +208,7 @@ + */ + public boolean shouldMapSpin(String entity, double x, double y, double z) + { -+ return dimensionId < 0; ++ return field_76574_g < 0; + } + + /** @@ -226,12 +226,12 @@ + + public BiomeGenBase getBiomeGenForCoords(BlockPos pos) + { -+ return worldObj.getBiomeGenForCoordsBody(pos); ++ return field_76579_a.getBiomeGenForCoordsBody(pos); + } + + public boolean isDaytime() + { -+ return worldObj.getSkylightSubtracted() < 4; ++ return field_76579_a.func_175657_ab() < 4; + } + + /** @@ -244,7 +244,7 @@ + * */ + public float getSunBrightnessFactor(float par1) + { -+ return worldObj.getSunBrightnessFactor(par1); ++ return field_76579_a.getSunBrightnessFactor(par1); + } + + /** @@ -254,19 +254,19 @@ + * */ + public float getCurrentMoonPhaseFactor() + { -+ return worldObj.getCurrentMoonPhaseFactorBody(); ++ return field_76579_a.getCurrentMoonPhaseFactorBody(); + } + + @SideOnly(Side.CLIENT) + public Vec3 getSkyColor(net.minecraft.entity.Entity cameraEntity, float partialTicks) + { -+ return worldObj.getSkyColorBody(cameraEntity, partialTicks); ++ return field_76579_a.getSkyColorBody(cameraEntity, partialTicks); + } + + @SideOnly(Side.CLIENT) + public Vec3 drawClouds(float partialTicks) + { -+ return worldObj.drawCloudsBody(partialTicks); ++ return field_76579_a.drawCloudsBody(partialTicks); + } + + /** @@ -275,7 +275,7 @@ + @SideOnly(Side.CLIENT) + public float getSunBrightness(float par1) + { -+ return worldObj.getSunBrightnessBody(par1); ++ return field_76579_a.getSunBrightnessBody(par1); + } + + /** @@ -284,68 +284,68 @@ + @SideOnly(Side.CLIENT) + public float getStarBrightness(float par1) + { -+ return worldObj.getStarBrightnessBody(par1); ++ return field_76579_a.getStarBrightnessBody(par1); + } + + public void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful) + { -+ worldObj.spawnHostileMobs = allowHostile; -+ worldObj.spawnPeacefulMobs = allowPeaceful; ++ field_76579_a.field_72985_G = allowHostile; ++ field_76579_a.field_72992_H = allowPeaceful; + } + + public void calculateInitialWeather() + { -+ worldObj.calculateInitialWeatherBody(); ++ field_76579_a.calculateInitialWeatherBody(); + } + + public void updateWeather() + { -+ worldObj.updateWeatherBody(); ++ field_76579_a.updateWeatherBody(); + } + + public boolean canBlockFreeze(BlockPos pos, boolean byWater) + { -+ return worldObj.canBlockFreezeBody(pos, byWater); ++ return field_76579_a.canBlockFreezeBody(pos, byWater); + } + + public boolean canSnowAt(BlockPos pos, boolean checkLight) + { -+ return worldObj.canSnowAtBody(pos, checkLight); ++ return field_76579_a.canSnowAtBody(pos, checkLight); + } + public void setWorldTime(long time) + { -+ worldObj.worldInfo.setWorldTime(time); ++ field_76579_a.field_72986_A.func_76068_b(time); + } + + public long getSeed() + { -+ return worldObj.worldInfo.getSeed(); ++ return field_76579_a.field_72986_A.func_76063_b(); + } + + public long getWorldTime() + { -+ return worldObj.worldInfo.getWorldTime(); ++ return field_76579_a.field_72986_A.func_76073_f(); + } + + public BlockPos getSpawnPoint() + { -+ net.minecraft.world.storage.WorldInfo info = worldObj.worldInfo; -+ return new BlockPos(info.getSpawnX(), info.getSpawnY(), info.getSpawnZ()); ++ net.minecraft.world.storage.WorldInfo info = field_76579_a.field_72986_A; ++ return new BlockPos(info.func_76079_c(), info.func_76075_d(), info.func_76074_e()); + } + + public void setSpawnPoint(BlockPos pos) + { -+ worldObj.worldInfo.setSpawn(pos); ++ field_76579_a.field_72986_A.func_176143_a(pos); + } + + public boolean canMineBlock(net.minecraft.entity.player.EntityPlayer player, BlockPos pos) + { -+ return worldObj.canMineBlockBody(player, pos); ++ return field_76579_a.canMineBlockBody(player, pos); + } + + public boolean isBlockHighHumidity(BlockPos pos) + { -+ return worldObj.getBiomeGenForCoords(pos).isHighHumidity(); ++ return field_76579_a.func_180494_b(pos).func_76736_e(); + } + + public int getHeight() @@ -355,20 +355,20 @@ + + public int getActualHeight() + { -+ return hasNoSky ? 128 : 256; ++ return field_76576_e ? 128 : 256; + } + + public double getHorizon() + { -+ return worldObj.worldInfo.getTerrainType().getHorizon(worldObj); ++ return field_76579_a.field_72986_A.func_76067_t().getHorizon(field_76579_a); + } + + public void resetRainAndThunder() + { -+ worldObj.worldInfo.setRainTime(0); -+ worldObj.worldInfo.setRaining(false); -+ worldObj.worldInfo.setThunderTime(0); -+ worldObj.worldInfo.setThundering(false); ++ field_76579_a.field_72986_A.func_76080_g(0); ++ field_76579_a.field_72986_A.func_76084_b(false); ++ field_76579_a.field_72986_A.func_76090_f(0); ++ field_76579_a.field_72986_A.func_76069_a(false); + } + + public boolean canDoLightning(net.minecraft.world.chunk.Chunk chunk) diff --git a/patches/minecraft/net/minecraft/world/WorldServer.java.patch b/patches/minecraft/net/minecraft/world/WorldServer.java.patch index 200079885..b8e52a8fc 100644 --- a/patches/minecraft/net/minecraft/world/WorldServer.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldServer.java.patch @@ -1,8 +1,8 @@ --- ../src-base/minecraft/net/minecraft/world/WorldServer.java +++ ../src-work/minecraft/net/minecraft/world/WorldServer.java @@ -94,30 +94,46 @@ - private static final List bonusChestContent = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.stick, 0, 1, 3, 10), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.planks), 0, 1, 3, 10), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.log), 0, 1, 3, 10), new WeightedRandomChestContent(Items.stone_axe, 0, 1, 1, 3), new WeightedRandomChestContent(Items.wooden_axe, 0, 1, 1, 5), new WeightedRandomChestContent(Items.stone_pickaxe, 0, 1, 1, 3), new WeightedRandomChestContent(Items.wooden_pickaxe, 0, 1, 1, 5), new WeightedRandomChestContent(Items.apple, 0, 2, 3, 5), new WeightedRandomChestContent(Items.bread, 0, 2, 3, 3), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.log2), 0, 1, 3, 10)}); - private List pendingTickListEntriesThisTick = Lists.newArrayList(); + private static final List field_73069_S = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.field_151055_y, 0, 1, 3, 10), new WeightedRandomChestContent(Item.func_150898_a(Blocks.field_150344_f), 0, 1, 3, 10), new WeightedRandomChestContent(Item.func_150898_a(Blocks.field_150364_r), 0, 1, 3, 10), new WeightedRandomChestContent(Items.field_151049_t, 0, 1, 1, 3), new WeightedRandomChestContent(Items.field_151053_p, 0, 1, 1, 5), new WeightedRandomChestContent(Items.field_151050_s, 0, 1, 1, 3), new WeightedRandomChestContent(Items.field_151039_o, 0, 1, 1, 5), new WeightedRandomChestContent(Items.field_151034_e, 0, 2, 3, 5), new WeightedRandomChestContent(Items.field_151025_P, 0, 2, 3, 3), new WeightedRandomChestContent(Item.func_150898_a(Blocks.field_150363_s), 0, 1, 3, 10)}); + private List field_94579_S = Lists.newArrayList(); + /** Stores the recently processed (lighting) chunks */ + protected Set doneChunks = new java.util.HashSet(); @@ -11,111 +11,111 @@ + public static void fillChestHook() + { + if (!initChest) -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.BONUS_CHEST, bonusChestContent, 10, 10); ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.BONUS_CHEST, field_73069_S, 10, 10); + initChest = true; + } + - public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn) + public WorldServer(MinecraftServer p_i45921_1_, ISaveHandler p_i45921_2_, WorldInfo p_i45921_3_, int p_i45921_4_, Profiler p_i45921_5_) { - super(saveHandlerIn, info, WorldProvider.getProviderForDimension(dimensionId), profilerIn, false); - this.mcServer = server; - this.theEntityTracker = new EntityTracker(this); - this.thePlayerManager = new PlayerManager(this); + super(p_i45921_2_, p_i45921_3_, WorldProvider.func_76570_a(p_i45921_4_), p_i45921_5_, false); + this.field_73061_a = p_i45921_1_; + this.field_73062_L = new EntityTracker(this); + this.field_73063_M = new PlayerManager(this); + // Guarantee the dimension ID was not reset by the provider -+ int providerDim = this.provider.dimensionId; - this.provider.registerWorld(this); -+ this.provider.dimensionId = providerDim; - this.chunkProvider = this.createChunkProvider(); -+ perWorldStorage = new MapStorage(new net.minecraftforge.common.WorldSpecificSaveHandler((WorldServer)this, saveHandlerIn)); - this.worldTeleporter = new Teleporter(this); - this.calculateInitialSkylight(); - this.calculateInitialWeather(); - this.getWorldBorder().setSize(server.getMaxWorldSize()); -+ net.minecraftforge.common.DimensionManager.setWorld(dimensionId, this); ++ int providerDim = this.field_73011_w.field_76574_g; + this.field_73011_w.func_76558_a(this); ++ this.field_73011_w.field_76574_g = providerDim; + this.field_73020_y = this.func_72970_h(); ++ perWorldStorage = new MapStorage(new net.minecraftforge.common.WorldSpecificSaveHandler((WorldServer)this, p_i45921_2_)); + this.field_85177_Q = new Teleporter(this); + this.func_72966_v(); + this.func_72947_a(); + this.func_175723_af().func_177725_a(p_i45921_1_.func_175580_aG()); ++ net.minecraftforge.common.DimensionManager.setWorld(p_i45921_4_, this); } - public World init() + public World func_175643_b() { - this.mapStorage = new MapStorage(this.saveHandler); - String s = VillageCollection.fileNameForProvider(this.provider); -- VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s); -+ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.loadData(VillageCollection.class, s); + this.field_72988_C = new MapStorage(this.field_73019_z); + String s = VillageCollection.func_176062_a(this.field_73011_w); +- VillageCollection villagecollection = (VillageCollection)this.field_72988_C.func_75742_a(VillageCollection.class, s); ++ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.func_75742_a(VillageCollection.class, s); if (villagecollection == null) { - this.villageCollectionObj = new VillageCollection(this); -- this.mapStorage.setData(s, this.villageCollectionObj); -+ this.perWorldStorage.setData(s, this.villageCollectionObj); + this.field_72982_D = new VillageCollection(this); +- this.field_72988_C.func_75745_a(s, this.field_72982_D); ++ this.perWorldStorage.func_75745_a(s, this.field_72982_D); } else { @@ -210,6 +226,10 @@ - this.villageSiege.tick(); - this.theProfiler.endStartSection("portalForcer"); - this.worldTeleporter.removeStalePortalLocations(this.getTotalWorldTime()); + this.field_175740_d.func_75528_a(); + this.field_72984_F.func_76318_c("portalForcer"); + this.field_85177_Q.func_85189_a(this.func_82737_E()); + for (Teleporter tele : customTeleporters) + { -+ tele.removeStalePortalLocations(getTotalWorldTime()); ++ tele.func_85189_a(func_82737_E()); + } - this.theProfiler.endSection(); - this.sendQueuedBlockEvents(); + this.field_72984_F.func_76319_b(); + this.func_147488_Z(); } @@ -217,6 +237,7 @@ public BiomeGenBase.SpawnListEntry func_175734_a(EnumCreatureType p_175734_1_, BlockPos p_175734_2_) { - List list = this.getChunkProvider().func_177458_a(p_175734_1_, p_175734_2_); + List list = this.func_72863_F().func_177458_a(p_175734_1_, p_175734_2_); + list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(this, p_175734_1_, p_175734_2_, list); - return list != null && !list.isEmpty() ? (BiomeGenBase.SpawnListEntry)WeightedRandom.getRandomItem(this.rand, list) : null; + return list != null && !list.isEmpty() ? (BiomeGenBase.SpawnListEntry)WeightedRandom.func_76271_a(this.field_73012_v, list) : null; } @@ -268,10 +289,7 @@ - private void resetRainAndThunder() + private void func_73051_P() { -- this.worldInfo.setRainTime(0); -- this.worldInfo.setRaining(false); -- this.worldInfo.setThunderTime(0); -- this.worldInfo.setThundering(false); -+ this.provider.resetRainAndThunder(); +- this.field_72986_A.func_76080_g(0); +- this.field_72986_A.func_76084_b(false); +- this.field_72986_A.func_76090_f(0); +- this.field_72986_A.func_76069_a(false); ++ this.field_73011_w.resetRainAndThunder(); } - public boolean areAllPlayersAsleep() + public boolean func_73056_e() @@ -349,7 +367,7 @@ chunk.func_150804_b(false); - this.theProfiler.endStartSection("thunder"); + this.field_72984_F.func_76318_c("thunder"); -- if (this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) -+ if (this.provider.canDoLightning(chunk) && this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) +- if (this.field_73012_v.nextInt(100000) == 0 && this.func_72896_J() && this.func_72911_I()) ++ if (this.field_73011_w.canDoLightning(chunk) && this.field_73012_v.nextInt(100000) == 0 && this.func_72896_J() && this.func_72911_I()) { - this.updateLCG = this.updateLCG * 3 + 1013904223; - int i1 = this.updateLCG >> 2; + this.field_73005_l = this.field_73005_l * 3 + 1013904223; + int i1 = this.field_73005_l >> 2; @@ -363,7 +381,7 @@ - this.theProfiler.endStartSection("iceandsnow"); + this.field_72984_F.func_76318_c("iceandsnow"); -- if (this.rand.nextInt(16) == 0) -+ if (this.provider.canDoRainSnowIce(chunk) && this.rand.nextInt(16) == 0) +- if (this.field_73012_v.nextInt(16) == 0) ++ if (this.field_73011_w.canDoRainSnowIce(chunk) && this.field_73012_v.nextInt(16) == 0) { - this.updateLCG = this.updateLCG * 3 + 1013904223; - int k2 = this.updateLCG >> 2; + this.field_73005_l = this.field_73005_l * 3 + 1013904223; + int k2 = this.field_73005_l >> 2; @@ -456,6 +474,9 @@ - if (p_175654_2_.requiresUpdates()) + if (p_175654_2_.func_149698_L()) { i = 8; + //Keeping here as a note for future when it may be restored. -+ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.position.getX() >> 4, nextticklistentry.position.getZ() >> 4)); ++ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.field_180282_a.func_177958_n() >> 4, nextticklistentry.field_180282_a.func_177952_p() >> 4)); + i = isForced ? 0 : 8; - if (this.isAreaLoaded(nextticklistentry.position.add(-i, -i, -i), nextticklistentry.position.add(i, i, i))) + if (this.func_175707_a(nextticklistentry.field_180282_a.func_177982_a(-i, -i, -i), nextticklistentry.field_180282_a.func_177982_a(i, i, i))) { @@ -508,7 +529,7 @@ - public void updateEntities() + public void func_72939_s() { -- if (this.playerEntities.isEmpty()) -+ if (this.playerEntities.isEmpty() && getPersistentChunks().isEmpty()) +- if (this.field_73010_i.isEmpty()) ++ if (this.field_73010_i.isEmpty() && getPersistentChunks().isEmpty()) { - if (this.updateEntityTick++ >= 1200) + if (this.field_80004_Q++ >= 1200) { @@ -573,6 +594,9 @@ { @@ -126,32 +126,32 @@ + //byte b0 = isForced ? 0 : 8; int k = 0; - if (this.isAreaLoaded(nextticklistentry1.position.add(-k, -k, -k), nextticklistentry1.position.add(k, k, k))) + if (this.func_175707_a(nextticklistentry1.field_180282_a.func_177982_a(-k, -k, -k), nextticklistentry1.field_180282_a.func_177982_a(k, k, k))) @@ -696,22 +720,39 @@ { List list = Lists.newArrayList(); -- for (int i = 0; i < this.loadedTileEntityList.size(); ++i) +- for (int i = 0; i < this.field_147482_g.size(); ++i) + //Forge: Optomize this loop to only grab from the chunks it needs + for (int x = (p_147486_1_ >> 4); x <= (p_147486_4_ >> 4); x++) { -- TileEntity tileentity = (TileEntity)this.loadedTileEntityList.get(i); -- BlockPos blockpos = tileentity.getPos(); +- TileEntity tileentity = (TileEntity)this.field_147482_g.get(i); +- BlockPos blockpos = tileentity.func_174877_v(); - -- if (blockpos.getX() >= p_147486_1_ && blockpos.getY() >= p_147486_2_ && blockpos.getZ() >= p_147486_3_ && blockpos.getX() < p_147486_4_ && blockpos.getY() < p_147486_5_ && blockpos.getZ() < p_147486_6_) +- if (blockpos.func_177958_n() >= p_147486_1_ && blockpos.func_177956_o() >= p_147486_2_ && blockpos.func_177952_p() >= p_147486_3_ && blockpos.func_177958_n() < p_147486_4_ && blockpos.func_177956_o() < p_147486_5_ && blockpos.func_177952_p() < p_147486_6_) + for (int z = (p_147486_3_ >> 4); z <= (p_147486_6_ >> 4); z++) { - list.add(tileentity); -+ Chunk chunk = this.getChunkFromChunkCoords(x, z); ++ Chunk chunk = this.func_72964_e(x, z); + if (chunk != null) + { -+ for (TileEntity entity : chunk.getTileEntityMap().values()) ++ for (TileEntity entity : chunk.func_177434_r().values()) + { -+ if (!entity.isInvalid()) ++ if (!entity.func_145837_r()) + { -+ BlockPos pos = entity.getPos(); -+ if (pos.getX() >= p_147486_1_ && pos.getY() >= p_147486_2_ && pos.getZ() >= p_147486_3_ && -+ pos.getX() <= p_147486_4_ && pos.getY() <= p_147486_5_ && pos.getZ() <= p_147486_6_) ++ BlockPos pos = entity.func_174877_v(); ++ if (pos.func_177958_n() >= p_147486_1_ && pos.func_177956_o() >= p_147486_2_ && pos.func_177952_p() >= p_147486_3_ && ++ pos.func_177958_n() <= p_147486_4_ && pos.func_177956_o() <= p_147486_5_ && pos.func_177952_p() <= p_147486_6_) + { + list.add(entity); + } @@ -165,13 +165,13 @@ return list; } - public boolean isBlockModifiable(EntityPlayer player, BlockPos pos) + public boolean func_175660_a(EntityPlayer p_175660_1_, BlockPos p_175660_2_) { -+ return super.isBlockModifiable(player, pos); ++ return super.func_175660_a(p_175660_1_, p_175660_2_); + } -+ public boolean canMineBlockBody(EntityPlayer player, BlockPos pos) ++ public boolean canMineBlockBody(EntityPlayer p_175660_1_, BlockPos p_175660_2_) + { - return !this.mcServer.isBlockProtected(this, pos, player) && this.getWorldBorder().contains(pos); + return !this.field_73061_a.func_175579_a(this, p_175660_2_, p_175660_1_) && this.func_175723_af().func_177746_a(p_175660_2_); } @@ -777,6 +818,7 @@ @@ -179,77 +179,77 @@ else { + if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(this, p_73052_1_)) return; - this.findingSpawnPoint = true; - WorldChunkManager worldchunkmanager = this.provider.getWorldChunkManager(); - List list = worldchunkmanager.getBiomesToSpawnIn(); + this.field_72987_B = true; + WorldChunkManager worldchunkmanager = this.field_73011_w.func_177499_m(); + List list = worldchunkmanager.func_76932_a(); @@ -822,7 +864,7 @@ - protected void createBonusChest() + protected void func_73047_i() { -- WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(bonusChestContent, 10); -+ WorldGeneratorBonusChest worldgeneratorbonuschest = net.minecraftforge.common.ForgeHooks.getBonusChest(rand); +- WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(field_73069_S, 10); ++ WorldGeneratorBonusChest worldgeneratorbonuschest = net.minecraftforge.common.ForgeHooks.getBonusChest(field_73012_v); for (int i = 0; i < 10; ++i) { @@ -859,6 +901,7 @@ } - this.chunkProvider.saveChunks(p_73044_1_, p_73044_2_); + this.field_73020_y.func_73151_a(p_73044_1_, p_73044_2_); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this)); - for (Chunk chunk : Lists.newArrayList(this.theChunkProviderServer.func_152380_a())) + for (Chunk chunk : Lists.newArrayList(this.field_73059_b.func_152380_a())) { @@ -892,6 +935,7 @@ - this.worldInfo.setBorderLerpTime(this.getWorldBorder().getTimeUntilTarget()); - this.saveHandler.saveWorldInfoWithPlayer(this.worldInfo, this.mcServer.getConfigurationManager().getHostPlayerData()); - this.mapStorage.saveAllData(); -+ this.perWorldStorage.saveAllData(); + this.field_72986_A.func_176135_e(this.func_175723_af().func_177732_i()); + this.field_73019_z.func_75755_a(this.field_72986_A, this.field_73061_a.func_71203_ab().func_72378_q()); + this.field_72988_C.func_75744_a(); ++ this.perWorldStorage.func_75744_a(); } - public void onEntityAdded(Entity p_72923_1_) + public void func_72923_a(Entity p_72923_1_) @@ -947,6 +991,7 @@ - public Explosion newExplosion(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) + public Explosion func_72885_a(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) { Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_); + if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; - explosion.doExplosionA(); - explosion.doExplosionB(false); + explosion.func_77278_a(); + explosion.func_77279_a(false); @@ -1026,19 +1071,23 @@ - this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.getDimensionId()); + this.field_73061_a.func_71203_ab().func_148537_a(new S2BPacketChangeGameState(8, this.field_73017_q), this.field_73011_w.func_177502_q()); } + /* 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.isRaining()) + if (flag != this.func_72896_J()) { if (flag) { -- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(2, 0.0F)); -+ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(2, 0.0F), this.provider.dimensionId); +- this.field_73061_a.func_71203_ab().func_148540_a(new S2BPacketChangeGameState(2, 0.0F)); ++ this.field_73061_a.func_71203_ab().func_148537_a(new S2BPacketChangeGameState(2, 0.0F), this.field_73011_w.field_76574_g); } else { -- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(1, 0.0F)); -+ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(1, 0.0F), this.provider.dimensionId); +- this.field_73061_a.func_71203_ab().func_148540_a(new S2BPacketChangeGameState(1, 0.0F)); ++ this.field_73061_a.func_71203_ab().func_148537_a(new S2BPacketChangeGameState(1, 0.0F), this.field_73011_w.field_76574_g); } -- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(7, this.rainingStrength)); -- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(8, this.thunderingStrength)); -+ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId); -+ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId); +- this.field_73061_a.func_71203_ab().func_148540_a(new S2BPacketChangeGameState(7, this.field_73004_o)); +- this.field_73061_a.func_71203_ab().func_148540_a(new S2BPacketChangeGameState(8, this.field_73017_q)); ++ this.field_73061_a.func_71203_ab().func_148537_a(new S2BPacketChangeGameState(7, this.field_73004_o), this.field_73011_w.field_76574_g); ++ this.field_73061_a.func_71203_ab().func_148537_a(new S2BPacketChangeGameState(8, this.field_73017_q), this.field_73011_w.field_76574_g); } } @@ -1104,6 +1153,11 @@ - return this.mcServer.isCallingFromMinecraftThread(); + return this.field_73061_a.func_152345_ab(); } + public java.io.File getChunkSaveLocation() + { -+ return ((net.minecraft.world.chunk.storage.AnvilChunkLoader)theChunkProviderServer.chunkLoader).chunkSaveLocation; ++ return ((net.minecraft.world.chunk.storage.AnvilChunkLoader)field_73059_b.field_73247_e).field_75825_d; + } + static class ServerBlockEventList extends ArrayList diff --git a/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch b/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch index 92ad1ae53..dc61a1c4d 100644 --- a/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldServerMulti.java.patch @@ -3,45 +3,45 @@ @@ -11,12 +11,13 @@ public class WorldServerMulti extends WorldServer { - private WorldServer delegate; + private WorldServer field_175743_a; + private IBorderListener borderListener; - public WorldServerMulti(MinecraftServer server, ISaveHandler saveHandlerIn, int dimensionId, WorldServer delegate, Profiler profilerIn) + public WorldServerMulti(MinecraftServer p_i45923_1_, ISaveHandler p_i45923_2_, int p_i45923_3_, WorldServer p_i45923_4_, Profiler p_i45923_5_) { - super(server, saveHandlerIn, new DerivedWorldInfo(delegate.getWorldInfo()), dimensionId, profilerIn); - this.delegate = delegate; -- delegate.getWorldBorder().addListener(new IBorderListener() + super(p_i45923_1_, p_i45923_2_, new DerivedWorldInfo(p_i45923_4_.func_72912_H()), p_i45923_3_, p_i45923_5_); + this.field_175743_a = p_i45923_4_; +- p_i45923_4_.func_175723_af().func_177737_a(new IBorderListener() + this.borderListener = new IBorderListener() { - public void onSizeChanged(WorldBorder border, double newSize) + public void func_177694_a(WorldBorder p_177694_1_, double p_177694_2_) { @@ -46,11 +47,13 @@ { - WorldServerMulti.this.getWorldBorder().setDamageBuffer(newSize); + WorldServerMulti.this.func_175723_af().func_177724_b(p_177695_2_); } - }); + }; -+ this.delegate.getWorldBorder().addListener(this.borderListener); ++ this.field_175743_a.func_175723_af().func_177737_a(this.borderListener); } - protected void saveLevel() throws MinecraftException + protected void func_73042_a() throws MinecraftException { -+ this.perWorldStorage.saveAllData(); ++ this.perWorldStorage.func_75744_a(); } - public World init() + public World func_175643_b() @@ -58,12 +61,12 @@ - this.mapStorage = this.delegate.getMapStorage(); - this.worldScoreboard = this.delegate.getScoreboard(); - String s = VillageCollection.fileNameForProvider(this.provider); -- VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s); -+ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.loadData(VillageCollection.class, s); + this.field_72988_C = this.field_175743_a.func_175693_T(); + this.field_96442_D = this.field_175743_a.func_96441_U(); + String s = VillageCollection.func_176062_a(this.field_73011_w); +- VillageCollection villagecollection = (VillageCollection)this.field_72988_C.func_75742_a(VillageCollection.class, s); ++ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.func_75742_a(VillageCollection.class, s); if (villagecollection == null) { - this.villageCollectionObj = new VillageCollection(this); -- this.mapStorage.setData(s, this.villageCollectionObj); -+ this.perWorldStorage.setData(s, this.villageCollectionObj); + this.field_72982_D = new VillageCollection(this); +- this.field_72988_C.func_75745_a(s, this.field_72982_D); ++ this.perWorldStorage.func_75745_a(s, this.field_72982_D); } else { @@ -52,9 +52,9 @@ + + + @Override -+ public void flush() ++ public void func_73041_k() + { -+ super.flush(); -+ this.delegate.getWorldBorder().removeListener(this.borderListener); // Unlink ourselves, to prevent world leak. ++ super.func_73041_k(); ++ this.field_175743_a.func_175723_af().removeListener(this.borderListener); // Unlink ourselves, to prevent world leak. + } } diff --git a/patches/minecraft/net/minecraft/world/WorldType.java.patch b/patches/minecraft/net/minecraft/world/WorldType.java.patch index 39573c29f..1f7e26efa 100644 --- a/patches/minecraft/net/minecraft/world/WorldType.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldType.java.patch @@ -2,27 +2,27 @@ +++ ../src-work/minecraft/net/minecraft/world/WorldType.java @@ -27,6 +27,7 @@ - private WorldType(int id, String name, int version) + private WorldType(int p_i1960_1_, String p_i1960_2_, int p_i1960_3_) { -+ if (name.length() > 16 && DEBUG_WORLD != null) throw new IllegalArgumentException("World type names must not be longer then 16: " + name); - this.worldType = name; - this.generatorVersion = version; - this.canBeCreated = true; ++ if (p_i1960_2_.length() > 16 && field_180272_g != null) throw new IllegalArgumentException("World type names must not be longer then 16: " + p_i1960_2_); + this.field_77133_f = p_i1960_2_; + this.field_77134_g = p_i1960_3_; + this.field_77140_h = true; @@ -113,4 +114,144 @@ - this.hasNotificationData = true; + this.field_151361_l = true; return this; } + + public net.minecraft.world.biome.WorldChunkManager getChunkManager(World world) + { -+ if (this == FLAT) ++ if (this == field_77138_c) + { -+ net.minecraft.world.gen.FlatGeneratorInfo flatgeneratorinfo = net.minecraft.world.gen.FlatGeneratorInfo.createFlatGeneratorFromString(world.getWorldInfo().getGeneratorOptions()); -+ return new net.minecraft.world.biome.WorldChunkManagerHell(net.minecraft.world.biome.BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), net.minecraft.world.biome.BiomeGenBase.field_180279_ad), 0.5F); ++ net.minecraft.world.gen.FlatGeneratorInfo flatgeneratorinfo = net.minecraft.world.gen.FlatGeneratorInfo.func_82651_a(world.func_72912_H().func_82571_y()); ++ return new net.minecraft.world.biome.WorldChunkManagerHell(net.minecraft.world.biome.BiomeGenBase.func_180276_a(flatgeneratorinfo.func_82648_a(), net.minecraft.world.biome.BiomeGenBase.field_180279_ad), 0.5F); + } -+ else if (this == DEBUG_WORLD) ++ else if (this == field_180272_g) + { -+ return new net.minecraft.world.biome.WorldChunkManagerHell(net.minecraft.world.biome.BiomeGenBase.plains, 0.0F); ++ return new net.minecraft.world.biome.WorldChunkManagerHell(net.minecraft.world.biome.BiomeGenBase.field_76772_c, 0.0F); + } + else + { @@ -32,44 +32,44 @@ + + public net.minecraft.world.chunk.IChunkProvider getChunkGenerator(World world, String generatorOptions) + { -+ if (this == FLAT) return new net.minecraft.world.gen.ChunkProviderFlat(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions); -+ if (this == DEBUG_WORLD) return new net.minecraft.world.gen.ChunkProviderDebug(world); -+ return new net.minecraft.world.gen.ChunkProviderGenerate(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions); ++ if (this == field_77138_c) return new net.minecraft.world.gen.ChunkProviderFlat(world, world.func_72905_C(), world.func_72912_H().func_76089_r(), generatorOptions); ++ if (this == field_180272_g) return new net.minecraft.world.gen.ChunkProviderDebug(world); ++ return new net.minecraft.world.gen.ChunkProviderGenerate(world, world.func_72905_C(), world.func_72912_H().func_76089_r(), generatorOptions); + } + + public int getMinimumSpawnHeight(World world) + { -+ return this == FLAT ? 4 : 64; ++ return this == field_77138_c ? 4 : 64; + } + + public double getHorizon(World world) + { -+ return this == FLAT ? 0.0D : 63.0D; ++ return this == field_77138_c ? 0.0D : 63.0D; + } + + public double voidFadeMagnitude() + { -+ return this == FLAT ? 1.0D : 0.03125D; ++ return this == field_77138_c ? 1.0D : 0.03125D; + } + + public boolean handleSlimeSpawnReduction(java.util.Random random, World world) + { -+ return this == FLAT ? random.nextInt(4) != 1 : false; ++ return this == field_77138_c ? random.nextInt(4) != 1 : false; + } + + /*=================================================== FORGE START ======================================*/ + private static int getNextID() + { -+ for (int x = 0; x < worldTypes.length; x++) ++ for (int x = 0; x < field_77139_a.length; x++) + { -+ if (worldTypes[x] == null) ++ if (field_77139_a[x] == null) + { + return x; + } + } + -+ int oldLen = worldTypes.length; -+ worldTypes = java.util.Arrays.copyOf(worldTypes, oldLen + 16); ++ int oldLen = field_77139_a.length; ++ field_77139_a = java.util.Arrays.copyOf(field_77139_a, oldLen + 16); + return oldLen; + } + @@ -95,7 +95,7 @@ + */ + public int getSpawnFuzz() + { -+ return Math.max(5, net.minecraft.server.MinecraftServer.getServer().getSpawnProtectionSize() - 6); ++ return Math.max(5, net.minecraft.server.MinecraftServer.func_71276_C().func_82357_ak() - 6); + } + + /** @@ -106,13 +106,13 @@ + @SideOnly(Side.CLIENT) + public void onCustomizeButton(net.minecraft.client.Minecraft mc, net.minecraft.client.gui.GuiCreateWorld guiCreateWorld) + { -+ if (this == WorldType.FLAT) ++ if (this == WorldType.field_77138_c) + { -+ mc.displayGuiScreen(new net.minecraft.client.gui.GuiCreateFlatWorld(guiCreateWorld, guiCreateWorld.chunkProviderSettingsJson)); ++ mc.func_147108_a(new net.minecraft.client.gui.GuiCreateFlatWorld(guiCreateWorld, guiCreateWorld.field_146334_a)); + } -+ else if (this == WorldType.CUSTOMIZED) ++ else if (this == WorldType.field_180271_f) + { -+ mc.displayGuiScreen(new net.minecraft.client.gui.GuiCustomizeWorldScreen(guiCreateWorld, guiCreateWorld.chunkProviderSettingsJson)); ++ mc.func_147108_a(new net.minecraft.client.gui.GuiCustomizeWorldScreen(guiCreateWorld, guiCreateWorld.field_146334_a)); + } + } + @@ -122,7 +122,7 @@ + */ + public boolean isCustomizable() + { -+ return this == FLAT || this == WorldType.CUSTOMIZED; ++ return this == field_77138_c || this == WorldType.field_180271_f; + } + + @@ -148,7 +148,7 @@ + public net.minecraft.world.gen.layer.GenLayer getBiomeLayer(long worldSeed, net.minecraft.world.gen.layer.GenLayer parentLayer, String chunkProviderSettingsJson) + { + net.minecraft.world.gen.layer.GenLayer ret = new net.minecraft.world.gen.layer.GenLayerBiome(200L, parentLayer, this, chunkProviderSettingsJson); -+ ret = net.minecraft.world.gen.layer.GenLayerZoom.magnify(1000L, ret, 2); ++ ret = net.minecraft.world.gen.layer.GenLayerZoom.func_75915_a(1000L, ret, 2); + ret = new net.minecraft.world.gen.layer.GenLayerBiomeEdge(1000L, ret); + return ret; + } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch index 87ff307bc..4c72cae17 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch @@ -2,9 +2,9 @@ +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeColorHelper.java @@ -26,7 +26,7 @@ { - public int getColorAtPos(BiomeGenBase p_180283_1_, BlockPos blockPosition) + public int func_180283_a(BiomeGenBase p_180283_1_, BlockPos p_180283_2_) { -- return p_180283_1_.waterColorMultiplier; +- return p_180283_1_.field_76759_H; + return p_180283_1_.getWaterColorMultiplier(); } }; diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch index dcb280f9b..c18d05315 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch @@ -2,168 +2,168 @@ +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeDecorator.java @@ -105,8 +105,10 @@ - protected void genDecorations(BiomeGenBase p_150513_1_) + protected void func_150513_a(BiomeGenBase p_150513_1_) { -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(currentWorld, randomGenerator, field_180294_c)); - this.generateOres(); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(field_76815_a, field_76813_b, field_180294_c)); + this.func_76797_b(); -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND)) - for (int i = 0; i < this.sandPerChunk2; ++i) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND)) + for (int i = 0; i < this.field_76805_H; ++i) { - int j = this.randomGenerator.nextInt(16) + 8; + int j = this.field_76813_b.nextInt(16) + 8; @@ -114,6 +116,7 @@ - this.sandGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getTopSolidOrLiquidBlock(this.field_180294_c.add(j, 0, k))); + this.field_76810_g.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_76815_a.func_175672_r(this.field_180294_c.func_177982_a(j, 0, k))); } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CLAY)) - for (int i1 = 0; i1 < this.clayPerChunk; ++i1) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CLAY)) + for (int i1 = 0; i1 < this.field_76806_I; ++i1) { - int l1 = this.randomGenerator.nextInt(16) + 8; + int l1 = this.field_76813_b.nextInt(16) + 8; @@ -121,6 +124,7 @@ - this.clayGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getTopSolidOrLiquidBlock(this.field_180294_c.add(l1, 0, i6))); + this.field_76809_f.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_76815_a.func_175672_r(this.field_180294_c.func_177982_a(l1, 0, i6))); } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND_PASS2)) - for (int j1 = 0; j1 < this.sandPerChunk; ++j1) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SAND_PASS2)) + for (int j1 = 0; j1 < this.field_76801_G; ++j1) { - int i2 = this.randomGenerator.nextInt(16) + 8; + int i2 = this.field_76813_b.nextInt(16) + 8; @@ -135,6 +139,7 @@ ++k1; } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.TREE)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.TREE)) for (int j2 = 0; j2 < k1; ++j2) { - int k6 = this.randomGenerator.nextInt(16) + 8; + int k6 = this.field_76813_b.nextInt(16) + 8; @@ -149,6 +154,7 @@ } } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.BIG_SHROOM)) - for (int k2 = 0; k2 < this.bigMushroomsPerChunk; ++k2) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.BIG_SHROOM)) + for (int k2 = 0; k2 < this.field_76807_J; ++k2) { - int l6 = this.randomGenerator.nextInt(16) + 8; + int l6 = this.field_76813_b.nextInt(16) + 8; @@ -156,6 +162,7 @@ - this.bigMushroomGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getHorizon(this.field_180294_c.add(l6, 0, k10))); + this.field_76826_u.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_76815_a.func_175645_m(this.field_180294_c.func_177982_a(l6, 0, k10))); } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.FLOWERS)) - for (int l2 = 0; l2 < this.flowersPerChunk; ++l2) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.FLOWERS)) + for (int l2 = 0; l2 < this.field_76802_A; ++l2) { - int i7 = this.randomGenerator.nextInt(16) + 8; + int i7 = this.field_76813_b.nextInt(16) + 8; @@ -177,6 +184,7 @@ } } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.GRASS)) - for (int i3 = 0; i3 < this.grassPerChunk; ++i3) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.GRASS)) + for (int i3 = 0; i3 < this.field_76803_B; ++i3) { - int j7 = this.randomGenerator.nextInt(16) + 8; + int j7 = this.field_76813_b.nextInt(16) + 8; @@ -190,6 +198,7 @@ } } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.DEAD_BUSH)) - for (int j3 = 0; j3 < this.deadBushPerChunk; ++j3) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.DEAD_BUSH)) + for (int j3 = 0; j3 < this.field_76804_C; ++j3) { - int k7 = this.randomGenerator.nextInt(16) + 8; + int k7 = this.field_76813_b.nextInt(16) + 8; @@ -203,6 +212,7 @@ } } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LILYPAD)) - for (int k3 = 0; k3 < this.waterlilyPerChunk; ++k3) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LILYPAD)) + for (int k3 = 0; k3 < this.field_76833_y; ++k3) { - int l7 = this.randomGenerator.nextInt(16) + 8; + int l7 = this.field_76813_b.nextInt(16) + 8; @@ -229,6 +239,8 @@ } } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM)) + { - for (int l3 = 0; l3 < this.mushroomsPerChunk; ++l3) + for (int l3 = 0; l3 < this.field_76798_D; ++l3) { - if (this.randomGenerator.nextInt(4) == 0) + if (this.field_76813_b.nextInt(4) == 0) @@ -279,7 +291,9 @@ - this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(j4, l15, l8)); + this.field_76827_t.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_180294_c.func_177982_a(j4, l15, l8)); } } - + } // End of Mushroom generation -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.REED)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.REED)) + { - for (int k4 = 0; k4 < this.reedsPerChunk; ++k4) + for (int k4 = 0; k4 < this.field_76799_E; ++k4) { - int i9 = this.randomGenerator.nextInt(16) + 8; + int i9 = this.field_76813_b.nextInt(16) + 8; @@ -305,7 +319,8 @@ - this.reedGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(j9, i19, i13)); + this.field_76825_v.func_180709_b(this.field_76815_a, this.field_76813_b, this.field_180294_c.func_177982_a(j9, i19, i13)); } } - + } // End of Reed generation -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.PUMPKIN)) - if (this.randomGenerator.nextInt(32) == 0) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.PUMPKIN)) + if (this.field_76813_b.nextInt(32) == 0) { - int i5 = this.randomGenerator.nextInt(16) + 8; + int i5 = this.field_76813_b.nextInt(16) + 8; @@ -319,6 +334,7 @@ } } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CACTUS)) - for (int j5 = 0; j5 < this.cactiPerChunk; ++j5) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.CACTUS)) + for (int j5 = 0; j5 < this.field_76800_F; ++j5) { - int l9 = this.randomGenerator.nextInt(16) + 8; + int l9 = this.field_76813_b.nextInt(16) + 8; @@ -334,6 +350,7 @@ - if (this.generateLakes) + if (this.field_76808_K) { -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_WATER)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_WATER)) for (int k5 = 0; k5 < 50; ++k5) { - int i10 = this.randomGenerator.nextInt(16) + 8; + int i10 = this.field_76813_b.nextInt(16) + 8; @@ -348,6 +365,7 @@ } } -+ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_LAVA)) ++ if(net.minecraftforge.event.terraingen.TerrainGen.decorate(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.LAKE_LAVA)) for (int l5 = 0; l5 < 20; ++l5) { - int j10 = this.randomGenerator.nextInt(16) + 8; + int j10 = this.field_76813_b.nextInt(16) + 8; @@ -357,6 +375,7 @@ - (new WorldGenLiquids(Blocks.flowing_lava)).generate(this.currentWorld, this.randomGenerator, blockpos3); + (new WorldGenLiquids(Blocks.field_150356_k)).func_180709_b(this.field_76815_a, this.field_76813_b, blockpos3); } } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Post(currentWorld, randomGenerator, field_180294_c)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Post(field_76815_a, field_76813_b, field_180294_c)); } - protected void genStandardOre1(int p_76795_1_, WorldGenerator p_76795_2_, int p_76795_3_, int p_76795_4_) + protected void func_76795_a(int p_76795_1_, WorldGenerator p_76795_2_, int p_76795_3_, int p_76795_4_) @@ -397,16 +416,29 @@ - protected void generateOres() + protected void func_76797_b() { -+ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Pre(currentWorld, randomGenerator, field_180294_c)); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, dirtGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIRT)) - this.genStandardOre1(this.chunkProviderSettings.dirtCount, this.dirtGen, this.chunkProviderSettings.dirtMinHeight, this.chunkProviderSettings.dirtMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, gravelGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRAVEL)) - this.genStandardOre1(this.chunkProviderSettings.gravelCount, this.gravelGen, this.chunkProviderSettings.gravelMinHeight, this.chunkProviderSettings.gravelMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, dioriteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIORITE)) - this.genStandardOre1(this.chunkProviderSettings.dioriteCount, this.dioriteGen, this.chunkProviderSettings.dioriteMinHeight, this.chunkProviderSettings.dioriteMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, graniteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRANITE)) - this.genStandardOre1(this.chunkProviderSettings.graniteCount, this.graniteGen, this.chunkProviderSettings.graniteMinHeight, this.chunkProviderSettings.graniteMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, andesiteGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.ANDESITE)) - this.genStandardOre1(this.chunkProviderSettings.andesiteCount, this.andesiteGen, this.chunkProviderSettings.andesiteMinHeight, this.chunkProviderSettings.andesiteMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, coalGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.COAL)) - this.genStandardOre1(this.chunkProviderSettings.coalCount, this.coalGen, this.chunkProviderSettings.coalMinHeight, this.chunkProviderSettings.coalMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, ironGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.IRON)) - this.genStandardOre1(this.chunkProviderSettings.ironCount, this.ironGen, this.chunkProviderSettings.ironMinHeight, this.chunkProviderSettings.ironMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, goldGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GOLD)) - this.genStandardOre1(this.chunkProviderSettings.goldCount, this.goldGen, this.chunkProviderSettings.goldMinHeight, this.chunkProviderSettings.goldMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, redstoneGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.REDSTONE)) - this.genStandardOre1(this.chunkProviderSettings.redstoneCount, this.redstoneGen, this.chunkProviderSettings.redstoneMinHeight, this.chunkProviderSettings.redstoneMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, diamondGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIAMOND)) - this.genStandardOre1(this.chunkProviderSettings.diamondCount, this.diamondGen, this.chunkProviderSettings.diamondMinHeight, this.chunkProviderSettings.diamondMaxHeight); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(currentWorld, randomGenerator, lapisGen, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.LAPIS)) - this.genStandardOre2(this.chunkProviderSettings.lapisCount, this.lapisGen, this.chunkProviderSettings.lapisCenterHeight, this.chunkProviderSettings.lapisSpread); -+ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Post(currentWorld, randomGenerator, field_180294_c)); ++ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Pre(field_76815_a, field_76813_b, field_180294_c)); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_76815_a, field_76813_b, field_76823_i, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIRT)) + this.func_76795_a(this.field_180293_d.field_177790_J, this.field_76823_i, this.field_180293_d.field_177791_K, this.field_180293_d.field_177784_L); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_76815_a, field_76813_b, field_76820_j, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRAVEL)) + this.func_76795_a(this.field_180293_d.field_177786_N, this.field_76820_j, this.field_180293_d.field_177787_O, this.field_180293_d.field_177797_P); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_76815_a, field_76813_b, field_180297_k, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIORITE)) + this.func_76795_a(this.field_180293_d.field_177795_V, this.field_180297_k, this.field_180293_d.field_177794_W, this.field_180293_d.field_177801_X); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_76815_a, field_76813_b, field_180296_j, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GRANITE)) + this.func_76795_a(this.field_180293_d.field_177799_R, this.field_180296_j, this.field_180293_d.field_177798_S, this.field_180293_d.field_177793_T); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_76815_a, field_76813_b, field_180295_l, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.ANDESITE)) + this.func_76795_a(this.field_180293_d.field_177802_Z, this.field_180295_l, this.field_180293_d.field_177846_aa, this.field_180293_d.field_177847_ab); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_76815_a, field_76813_b, field_76821_k, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.COAL)) + this.func_76795_a(this.field_180293_d.field_177845_ad, this.field_76821_k, this.field_180293_d.field_177851_ae, this.field_180293_d.field_177853_af); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_76815_a, field_76813_b, field_76818_l, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.IRON)) + this.func_76795_a(this.field_180293_d.field_177849_ah, this.field_76818_l, this.field_180293_d.field_177832_ai, this.field_180293_d.field_177834_aj); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_76815_a, field_76813_b, field_76819_m, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.GOLD)) + this.func_76795_a(this.field_180293_d.field_177830_al, this.field_76819_m, this.field_180293_d.field_177840_am, this.field_180293_d.field_177842_an); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_76815_a, field_76813_b, field_180299_p, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.REDSTONE)) + this.func_76795_a(this.field_180293_d.field_177838_ap, this.field_180299_p, this.field_180293_d.field_177818_aq, this.field_180293_d.field_177816_ar); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_76815_a, field_76813_b, field_180298_q, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.DIAMOND)) + this.func_76795_a(this.field_180293_d.field_177812_at, this.field_180298_q, this.field_180293_d.field_177826_au, this.field_180293_d.field_177824_av); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_76815_a, field_76813_b, field_76831_p, field_180294_c, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.LAPIS)) + this.func_76793_b(this.field_180293_d.field_177820_ax, this.field_76831_p, this.field_180293_d.field_177807_ay, this.field_180293_d.field_177805_az); ++ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Post(field_76815_a, field_76813_b, field_180294_c)); } } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch index 5eb0e6287..032589894 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch @@ -8,49 +8,49 @@ + } + public BiomeGenBase(int p_i1971_1_, boolean register) + { - this.minHeight = height_Default.rootHeight; - this.maxHeight = height_Default.variation; - this.temperature = 0.5F; + this.field_76748_D = field_150596_a.field_150777_a; + this.field_76749_E = field_150596_a.field_150776_b; + this.field_76750_F = 0.5F; @@ -152,6 +156,7 @@ - this.worldGeneratorBigTree = new WorldGenBigTree(false); - this.worldGeneratorSwamp = new WorldGenSwamp(); - this.biomeID = p_i1971_1_; + this.field_76758_O = new WorldGenBigTree(false); + this.field_76763_Q = new WorldGenSwamp(); + this.field_76756_M = p_i1971_1_; + if (register) - biomeList[p_i1971_1_] = this; - this.theBiomeDecorator = this.createBiomeDecorator(); - this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySheep.class, 12, 4, 4)); + field_76773_a[p_i1971_1_] = this; + this.field_76760_I = this.func_76729_a(); + this.field_76762_K.add(new BiomeGenBase.SpawnListEntry(EntitySheep.class, 12, 4, 4)); @@ -168,11 +173,12 @@ - this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityWitch.class, 5, 1, 1)); - this.spawnableWaterCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySquid.class, 10, 4, 4)); - this.spawnableCaveCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 10, 8, 8)); + this.field_76761_J.add(new BiomeGenBase.SpawnListEntry(EntityWitch.class, 5, 1, 1)); + this.field_76755_L.add(new BiomeGenBase.SpawnListEntry(EntitySquid.class, 10, 4, 4)); + this.field_82914_M.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 10, 8, 8)); + this.addDefaultFlowers(); } - public BiomeDecorator createBiomeDecorator() + public BiomeDecorator func_76729_a() { - return new BiomeDecorator(); + return getModdedBiomeDecorator(new BiomeDecorator()); } - public BiomeGenBase setTemperatureRainfall(float p_76732_1_, float p_76732_2_) + public BiomeGenBase func_76732_a(float p_76732_1_, float p_76732_2_) @@ -342,7 +348,7 @@ { - double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(p_180627_1_), 0.0F, 1.0F); - double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); -- return ColorizerGrass.getGrassColor(d0, d1); -+ return getModdedBiomeGrassColor(ColorizerGrass.getGrassColor(d0, d1)); + double d0 = (double)MathHelper.func_76131_a(this.func_180626_a(p_180627_1_), 0.0F, 1.0F); + double d1 = (double)MathHelper.func_76131_a(this.func_76727_i(), 0.0F, 1.0F); +- return ColorizerGrass.func_77480_a(d0, d1); ++ return getModdedBiomeGrassColor(ColorizerGrass.func_77480_a(d0, d1)); } @SideOnly(Side.CLIENT) @@ -350,7 +356,7 @@ { - double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(p_180625_1_), 0.0F, 1.0F); - double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); -- return ColorizerFoliage.getFoliageColor(d0, d1); -+ return getModdedBiomeFoliageColor(ColorizerFoliage.getFoliageColor(d0, d1)); + double d0 = (double)MathHelper.func_76131_a(this.func_180626_a(p_180625_1_), 0.0F, 1.0F); + double d1 = (double)MathHelper.func_76131_a(this.func_76727_i(), 0.0F, 1.0F); +- return ColorizerFoliage.func_77470_a(d0, d1); ++ return getModdedBiomeFoliageColor(ColorizerFoliage.func_77470_a(d0, d1)); } - public boolean isSnowyBiome() + public boolean func_150559_j() @@ -497,6 +503,84 @@ } } @@ -65,7 +65,7 @@ + + public int getWaterColorMultiplier() + { -+ net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor(this, waterColorMultiplier); ++ net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor event = new net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor(this, field_76759_H); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + return event.newColor; + } @@ -103,8 +103,8 @@ + */ + public void addDefaultFlowers() + { -+ addFlower(Blocks.yellow_flower.getDefaultState().withProperty(Blocks.yellow_flower.getTypeProperty(), BlockFlower.EnumFlowerType.DANDELION), 20); -+ addFlower(Blocks.red_flower.getDefaultState().withProperty(Blocks.red_flower.getTypeProperty(), BlockFlower.EnumFlowerType.POPPY), 20); ++ addFlower(Blocks.field_150327_N.func_176223_P().func_177226_a(Blocks.field_150327_N.func_176494_l(), BlockFlower.EnumFlowerType.DANDELION), 20); ++ addFlower(Blocks.field_150328_O.func_176223_P().func_177226_a(Blocks.field_150328_O.func_176494_l(), BlockFlower.EnumFlowerType.POPPY), 20); + } + + /** Register a new plant to be planted when bonemeal is used on grass. @@ -119,15 +119,15 @@ + + public void plantFlower(World world, Random rand, BlockPos pos) + { -+ FlowerEntry flower = (FlowerEntry)WeightedRandom.getRandomItem(rand, flowers); ++ FlowerEntry flower = (FlowerEntry)WeightedRandom.func_76271_a(rand, flowers); + if (flower == null || flower.state == null || -+ (flower.state.getBlock() instanceof net.minecraft.block.BlockBush && -+ !((net.minecraft.block.BlockBush)flower.state.getBlock()).canBlockStay(world, pos, flower.state))) ++ (flower.state.func_177230_c() instanceof net.minecraft.block.BlockBush && ++ !((net.minecraft.block.BlockBush)flower.state.func_177230_c()).func_180671_f(world, pos, flower.state))) + { + return; + } + -+ world.setBlockState(pos, flower.state, 3); ++ world.func_180501_a(pos, flower.state, 3); + } + + @@ -135,4 +135,4 @@ + static { - plains.createMutation(); + field_76772_c.func_150566_k(); diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch index 4ec3410dc..9a2aa4c10 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch @@ -1,5 +1,17 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenForest.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenForest.java +@@ -188,9 +188,9 @@ + { + return this.field_76756_M != BiomeGenBase.field_150583_P.field_76756_M && this.field_76756_M != BiomeGenBase.field_150582_Q.field_76756_M ? new BiomeGenMutated(p_180277_1_, this) + { +- public void func_180624_a(World p_180624_1_, Random p_180624_2_, BlockPos p_180624_3_) ++ public void func_180624_a(World worldIn, Random p_180624_2_, BlockPos p_180624_3_) + { +- this.field_150611_aD.func_180624_a(p_180624_1_, p_180624_2_, p_180624_3_); ++ this.field_150611_aD.func_180624_a(worldIn, p_180624_2_, p_180624_3_); + } + }: new BiomeGenMutated(p_180277_1_, this) + { @@ -201,4 +201,20 @@ }; } @@ -15,9 +27,9 @@ + } + for (BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) + { -+ if (type.getBlockType() == BlockFlower.EnumFlowerColor.YELLOW) continue; ++ if (type.func_176964_a() == BlockFlower.EnumFlowerColor.YELLOW) continue; + if (type == BlockFlower.EnumFlowerType.BLUE_ORCHID) type = BlockFlower.EnumFlowerType.POPPY; -+ addFlower(net.minecraft.init.Blocks.red_flower.getDefaultState().withProperty(net.minecraft.init.Blocks.red_flower.getTypeProperty(), type), 10); ++ addFlower(net.minecraft.init.Blocks.field_150328_O.func_176223_P().func_177226_a(net.minecraft.init.Blocks.field_150328_O.func_176494_l(), type), 10); + } + } } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch index 43bbe8c36..5d652e427 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch @@ -2,10 +2,10 @@ +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenHills.java @@ -49,7 +49,7 @@ int i1 = p_180624_2_.nextInt(16); - BlockPos blockpos = p_180624_3_.add(k, l, i1); + BlockPos blockpos = p_180624_3_.func_177982_a(k, l, i1); -- if (worldIn.getBlockState(blockpos).getBlock() == Blocks.stone) -+ if (worldIn.getBlockState(blockpos).getBlock().isReplaceableOreGen(worldIn, blockpos, net.minecraft.block.state.pattern.BlockHelper.forBlock(Blocks.stone))) +- if (p_180624_1_.func_180495_p(blockpos).func_177230_c() == Blocks.field_150348_b) ++ if (p_180624_1_.func_180495_p(blockpos).func_177230_c().isReplaceableOreGen(p_180624_1_, blockpos, net.minecraft.block.state.pattern.BlockHelper.func_177642_a(Blocks.field_150348_b))) { - worldIn.setBlockState(blockpos, Blocks.emerald_ore.getDefaultState(), 2); + p_180624_1_.func_180501_a(blockpos, Blocks.field_150412_bA.func_176223_P(), 2); } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch index 0b3e60e87..3c559c56a 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch @@ -1,13 +1,13 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenJungle.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenJungle.java @@ -68,7 +68,9 @@ - super.decorate(worldIn, p_180624_2_, p_180624_3_); + super.func_180624_a(p_180624_1_, p_180624_2_, p_180624_3_); int i = p_180624_2_.nextInt(16) + 8; int j = p_180624_2_.nextInt(16) + 8; -- int k = p_180624_2_.nextInt(worldIn.getHorizon(p_180624_3_.add(i, 0, j)).getY() * 2); -+ int height = worldIn.getHorizon(p_180624_3_.add(i, 0, j)).getY() * 2; // could == 0, which crashes nextInt +- int k = p_180624_2_.nextInt(p_180624_1_.func_175645_m(p_180624_3_.func_177982_a(i, 0, j)).func_177956_o() * 2); ++ int height = p_180624_1_.func_175645_m(p_180624_3_.func_177982_a(i, 0, j)).func_177956_o() * 2; // could == 0, which crashes nextInt + if (height < 1) height = 1; + int k = p_180624_2_.nextInt(height); - (new WorldGenMelon()).generate(worldIn, p_180624_2_, p_180624_3_.add(i, k, j)); + (new WorldGenMelon()).func_180709_b(p_180624_1_, p_180624_2_, p_180624_3_.func_177982_a(i, k, j)); WorldGenVines worldgenvines = new WorldGenVines(); diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch index db3f9dfa0..275d4491a 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch @@ -8,15 +8,15 @@ + @Override + public void addDefaultFlowers() + { -+ BlockFlower red = net.minecraft.init.Blocks.red_flower; -+ BlockFlower yel = net.minecraft.init.Blocks.yellow_flower; -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.ORANGE_TULIP), 3); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.RED_TULIP), 3); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.PINK_TULIP), 3); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.WHITE_TULIP), 3); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.POPPY), 20); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.HOUSTONIA), 20); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.OXEYE_DAISY), 20); -+ addFlower(yel.getDefaultState().withProperty(yel.getTypeProperty(), BlockFlower.EnumFlowerType.DANDELION), 30); ++ BlockFlower red = net.minecraft.init.Blocks.field_150328_O; ++ BlockFlower yel = net.minecraft.init.Blocks.field_150327_N; ++ addFlower(red.func_176223_P().func_177226_a(red.func_176494_l(), BlockFlower.EnumFlowerType.ORANGE_TULIP), 3); ++ addFlower(red.func_176223_P().func_177226_a(red.func_176494_l(), BlockFlower.EnumFlowerType.RED_TULIP), 3); ++ addFlower(red.func_176223_P().func_177226_a(red.func_176494_l(), BlockFlower.EnumFlowerType.PINK_TULIP), 3); ++ addFlower(red.func_176223_P().func_177226_a(red.func_176494_l(), BlockFlower.EnumFlowerType.WHITE_TULIP), 3); ++ addFlower(red.func_176223_P().func_177226_a(red.func_176494_l(), BlockFlower.EnumFlowerType.POPPY), 20); ++ addFlower(red.func_176223_P().func_177226_a(red.func_176494_l(), BlockFlower.EnumFlowerType.HOUSTONIA), 20); ++ addFlower(red.func_176223_P().func_177226_a(red.func_176494_l(), BlockFlower.EnumFlowerType.OXEYE_DAISY), 20); ++ addFlower(yel.func_176223_P().func_177226_a(yel.func_176494_l(), BlockFlower.EnumFlowerType.DANDELION), 30); + } } diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch index 298d372c2..2df358347 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch @@ -8,6 +8,6 @@ + @Override + public void addDefaultFlowers() + { -+ addFlower(Blocks.red_flower.getDefaultState().withProperty(Blocks.red_flower.getTypeProperty(), BlockFlower.EnumFlowerType.BLUE_ORCHID), 10); ++ addFlower(Blocks.field_150328_O.func_176223_P().func_177226_a(Blocks.field_150328_O.func_176494_l(), BlockFlower.EnumFlowerType.BLUE_ORCHID), 10); + } } diff --git a/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch b/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch index 1eeff6ed9..5378a0e20 100644 --- a/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch @@ -4,36 +4,36 @@ public class WorldChunkManager { -+ public static List allowedBiomes = Lists.newArrayList(BiomeGenBase.forest, BiomeGenBase.plains, BiomeGenBase.taiga, BiomeGenBase.taigaHills, BiomeGenBase.forestHills, BiomeGenBase.jungle, BiomeGenBase.jungleHills); - private GenLayer genBiomes; - private GenLayer biomeIndexLayer; - private BiomeCache biomeCache; ++ public static List allowedBiomes = Lists.newArrayList(BiomeGenBase.field_76767_f, BiomeGenBase.field_76772_c, BiomeGenBase.field_76768_g, BiomeGenBase.field_76784_u, BiomeGenBase.field_76785_t, BiomeGenBase.field_76782_w, BiomeGenBase.field_76792_x); + private GenLayer field_76944_d; + private GenLayer field_76945_e; + private BiomeCache field_76942_f; @@ -27,13 +28,7 @@ - this.biomeCache = new BiomeCache(this); + this.field_76942_f = new BiomeCache(this); this.field_180301_f = ""; - this.biomesToSpawnIn = Lists.newArrayList(); -- this.biomesToSpawnIn.add(BiomeGenBase.forest); -- this.biomesToSpawnIn.add(BiomeGenBase.plains); -- this.biomesToSpawnIn.add(BiomeGenBase.taiga); -- this.biomesToSpawnIn.add(BiomeGenBase.taigaHills); -- this.biomesToSpawnIn.add(BiomeGenBase.forestHills); -- this.biomesToSpawnIn.add(BiomeGenBase.jungle); -- this.biomesToSpawnIn.add(BiomeGenBase.jungleHills); -+ this.biomesToSpawnIn.addAll(allowedBiomes); + this.field_76943_g = Lists.newArrayList(); +- this.field_76943_g.add(BiomeGenBase.field_76767_f); +- this.field_76943_g.add(BiomeGenBase.field_76772_c); +- this.field_76943_g.add(BiomeGenBase.field_76768_g); +- this.field_76943_g.add(BiomeGenBase.field_76784_u); +- this.field_76943_g.add(BiomeGenBase.field_76785_t); +- this.field_76943_g.add(BiomeGenBase.field_76782_w); +- this.field_76943_g.add(BiomeGenBase.field_76792_x); ++ this.field_76943_g.addAll(allowedBiomes); } public WorldChunkManager(long p_i45744_1_, WorldType p_i45744_3_, String p_i45744_4_) @@ -41,6 +36,7 @@ this(); this.field_180301_f = p_i45744_4_; - GenLayer[] agenlayer = GenLayer.initializeAllBiomeGenerators(p_i45744_1_, p_i45744_3_, p_i45744_4_); + GenLayer[] agenlayer = GenLayer.func_180781_a(p_i45744_1_, p_i45744_3_, p_i45744_4_); + agenlayer = getModdedBiomeGenerators(p_i45744_3_, p_i45744_1_, agenlayer); - this.genBiomes = agenlayer[0]; - this.biomeIndexLayer = agenlayer[1]; + this.field_76944_d = agenlayer[0]; + this.field_76945_e = agenlayer[1]; } @@ -249,4 +245,11 @@ { - this.biomeCache.cleanupCache(); + this.field_76942_f.func_76838_a(); } + + public GenLayer[] getModdedBiomeGenerators(WorldType worldType, long seed, GenLayer[] original) diff --git a/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch b/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch index 154d87191..6c9214f8e 100644 --- a/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch +++ b/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch @@ -1,12 +1,12 @@ --- ../src-base/minecraft/net/minecraft/world/border/WorldBorder.java +++ ../src-work/minecraft/net/minecraft/world/border/WorldBorder.java @@ -277,4 +277,9 @@ - iborderlistener.onWarningDistanceChanged(this, warningDistance); + iborderlistener.func_177690_b(this, p_177747_1_); } } + + public void removeListener(IBorderListener listener) + { -+ this.listeners.remove(listener); ++ this.field_177758_a.remove(listener); + } } diff --git a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch index 4c6fe00bf..2c8ef5224 100644 --- a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -2,58 +2,58 @@ +++ ../src-work/minecraft/net/minecraft/world/chunk/Chunk.java @@ -167,7 +167,7 @@ { - Block block = this.getBlock0(j, l - 1, k); + Block block = this.func_150810_a(j, l - 1, k); -- if (block.getLightOpacity() != 0) -+ if (getBlockLightOpacity(j, l - 1, k) != 0) +- if (block.func_149717_k() != 0) ++ if (func_150808_b(j, l - 1, k) != 0) { - this.heightMap[k << 4 | j] = l; + this.field_76634_f[k << 4 | j] = l; @@ -440,12 +440,12 @@ - public int getBlockLightOpacity(BlockPos pos) + public int func_177437_b(BlockPos p_177437_1_) { -- return this.getBlock(pos).getLightOpacity(); -+ return this.getBlock(pos).getLightOpacity(worldObj, pos); +- return this.func_177428_a(p_177437_1_).func_149717_k(); ++ return this.func_177428_a(p_177437_1_).getLightOpacity(field_76637_e, p_177437_1_); } - private int getBlockLightOpacity(int x, int y, int z) + private int func_150808_b(int p_150808_1_, int p_150808_2_, int p_150808_3_) { -- return this.getBlock0(x, y, z).getLightOpacity(); -+ return getBlockLightOpacity(new BlockPos((xPosition << 4) + x, y, (zPosition << 4) + z)); +- return this.func_150810_a(p_150808_1_, p_150808_2_, p_150808_3_).func_149717_k(); ++ return func_177437_b(new BlockPos((field_76635_g << 4) + p_150808_1_, p_150808_2_, (field_76647_h << 4) + p_150808_3_)); } - private Block getBlock0(int x, int y, int z) + private Block func_150810_a(int p_150810_1_, int p_150810_2_, int p_150810_3_) @@ -623,14 +623,19 @@ - extendedblockstorage.set(i, j & 15, k, state); + extendedblockstorage.func_177484_a(i, j & 15, k, p_177436_2_); - if (block1 != block) + //if (block1 != block) { - if (!this.worldObj.isRemote) + if (!this.field_76637_e.field_72995_K) { + if (block1 != block) //Only fire block breaks when the block changes. - block1.breakBlock(this.worldObj, pos, iblockstate); -+ TileEntity te = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); -+ if (te != null && te.shouldRefresh(this.worldObj, pos, iblockstate, state)) this.worldObj.removeTileEntity(pos); + block1.func_180663_b(this.field_76637_e, p_177436_1_, iblockstate); ++ TileEntity te = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK); ++ if (te != null && te.shouldRefresh(this.field_76637_e, p_177436_1_, iblockstate, p_177436_2_)) this.field_76637_e.func_175713_t(p_177436_1_); } - else if (block1 instanceof ITileEntityProvider) + else if (block1.hasTileEntity(iblockstate)) { -+ TileEntity te = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); -+ if (te != null && te.shouldRefresh(this.worldObj, pos, iblockstate, state)) - this.worldObj.removeTileEntity(pos); ++ TileEntity te = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK); ++ if (te != null && te.shouldRefresh(this.field_76637_e, p_177436_1_, iblockstate, p_177436_2_)) + this.field_76637_e.func_175713_t(p_177436_1_); } } @@ -647,8 +652,8 @@ } else { -- int j1 = block.getLightOpacity(); -- int k1 = block1.getLightOpacity(); -+ int j1 = block.getLightOpacity(this.worldObj, pos); -+ int k1 = block1.getLightOpacity(this.worldObj, pos); +- int j1 = block.func_149717_k(); +- int k1 = block1.func_149717_k(); ++ int j1 = block.getLightOpacity(this.field_76637_e, p_177436_1_); ++ int k1 = block1.getLightOpacity(this.field_76637_e, p_177436_1_); if (j1 > 0) { @@ -63,55 +63,55 @@ - if (block1 instanceof ITileEntityProvider) - { -- TileEntity tileentity = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); +- TileEntity tileentity = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK); - - if (tileentity != null) - { -- tileentity.updateContainingBlockInfo(); +- tileentity.func_145836_u(); - } - } - - if (!this.worldObj.isRemote && block1 != block) + if (!this.field_76637_e.field_72995_K && block1 != block) { - block.onBlockAdded(this.worldObj, pos, state); + block.func_176213_c(this.field_76637_e, p_177436_1_, p_177436_2_); } - if (block instanceof ITileEntityProvider) -+ if (block.hasTileEntity(state)) ++ if (block.hasTileEntity(p_177436_2_)) { - TileEntity tileentity1 = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); + TileEntity tileentity1 = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK); if (tileentity1 == null) { -- tileentity1 = ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, block.getMetaFromState(state)); -+ tileentity1 = block.createTileEntity(this.worldObj, state); - this.worldObj.setTileEntity(pos, tileentity1); +- tileentity1 = ((ITileEntityProvider)block).func_149915_a(this.field_76637_e, block.func_176201_c(p_177436_2_)); ++ tileentity1 = block.createTileEntity(this.field_76637_e, p_177436_2_); + this.field_76637_e.func_175690_a(p_177436_1_, tileentity1); } @@ -792,6 +787,7 @@ - k = this.entityLists.length - 1; + k = this.field_76645_j.length - 1; } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EnteringChunk(entityIn, this.xPosition, this.zPosition, entityIn.chunkCoordX, entityIn.chunkCoordZ)); - entityIn.addedToChunk = true; - entityIn.chunkCoordX = this.xPosition; - entityIn.chunkCoordY = k; ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EnteringChunk(p_76612_1_, this.field_76635_g, this.field_76647_h, 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_76635_g; + p_76612_1_.field_70162_ai = k; @@ -830,13 +826,20 @@ - private TileEntity createNewTileEntity(BlockPos pos) + private TileEntity func_177422_i(BlockPos p_177422_1_) { - Block block = this.getBlock(pos); -- return !block.hasTileEntity() ? null : ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, this.getBlockMetadata(pos)); -+ IBlockState state = block.getStateFromMeta(this.getBlockMetadata(pos)); -+ return !block.hasTileEntity(state) ? null : block.createTileEntity(this.worldObj, state); + Block block = this.func_177428_a(p_177422_1_); +- return !block.func_149716_u() ? null : ((ITileEntityProvider)block).func_149915_a(this.field_76637_e, this.func_177418_c(p_177422_1_)); ++ IBlockState state = block.func_176203_a(this.func_177418_c(p_177422_1_)); ++ return !block.hasTileEntity(state) ? null : block.createTileEntity(this.field_76637_e, state); } - public TileEntity getTileEntity(BlockPos pos, Chunk.EnumCreateEntityType p_177424_2_) + public TileEntity func_177424_a(BlockPos p_177424_1_, Chunk.EnumCreateEntityType p_177424_2_) { - TileEntity tileentity = (TileEntity)this.chunkTileEntityMap.get(pos); + TileEntity tileentity = (TileEntity)this.field_150816_i.get(p_177424_1_); -+ if (tileentity != null && tileentity.isInvalid()) ++ if (tileentity != null && tileentity.func_145837_r()) + { -+ chunkTileEntityMap.remove(pos); ++ field_150816_i.remove(p_177424_1_); + tileentity = null; + } + @@ -119,110 +119,110 @@ { if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE) @@ -849,11 +852,6 @@ - this.field_177447_w.add(pos); + this.field_177447_w.add(p_177424_1_); } } -- else if (tileentity.isInvalid()) +- else if (tileentity.func_145837_r()) - { -- this.chunkTileEntityMap.remove(pos); +- this.field_150816_i.remove(p_177424_1_); - return null; - } return tileentity; } @@ -873,7 +871,7 @@ - tileEntityIn.setWorldObj(this.worldObj); - tileEntityIn.setPos(pos); + p_177426_2_.func_145834_a(this.field_76637_e); + p_177426_2_.func_174878_a(p_177426_1_); -- if (this.getBlock(pos) instanceof ITileEntityProvider) -+ if (this.getBlock(pos).hasTileEntity(getBlock(pos).getStateFromMeta(this.getBlockMetadata(pos)))) +- if (this.func_177428_a(p_177426_1_) instanceof ITileEntityProvider) ++ if (this.func_177428_a(p_177426_1_).hasTileEntity(func_177428_a(p_177426_1_).func_176203_a(this.func_177418_c(p_177426_1_)))) { - if (this.chunkTileEntityMap.containsKey(pos)) + if (this.field_150816_i.containsKey(p_177426_1_)) { @@ -910,8 +908,9 @@ - entity.onChunkLoad(); + entity.func_110123_P(); } -- this.worldObj.loadEntities(this.entityLists[i]); -+ this.worldObj.loadEntities(com.google.common.collect.ImmutableList.copyOf(this.entityLists[i])); +- this.field_76637_e.func_175650_b(this.field_76645_j[i]); ++ this.field_76637_e.func_175650_b(com.google.common.collect.ImmutableList.copyOf(this.field_76645_j[i])); } + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(this)); } - public void onChunkUnload() + public void func_76623_d() @@ -927,6 +926,7 @@ { - this.worldObj.unloadEntities(this.entityLists[i]); + this.field_76637_e.func_175681_c(this.field_76645_j[i]); } + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Unload(this)); } - public void setChunkModified() + public void func_76630_e() @@ -936,8 +936,8 @@ - public void getEntitiesWithinAABBForEntity(Entity entityIn, AxisAlignedBB aabb, List listToFill, Predicate p_177414_4_) + public void func_177414_a(Entity p_177414_1_, AxisAlignedBB p_177414_2_, List p_177414_3_, Predicate p_177414_4_) { -- int i = MathHelper.floor_double((aabb.minY - 2.0D) / 16.0D); -- int j = MathHelper.floor_double((aabb.maxY + 2.0D) / 16.0D); -+ int i = MathHelper.floor_double((aabb.minY - World.MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.floor_double((aabb.maxY + World.MAX_ENTITY_RADIUS) / 16.0D); - i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); - j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); +- 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 - World.MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.func_76128_c((p_177414_2_.field_72337_e + World.MAX_ENTITY_RADIUS) / 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); @@ -976,8 +976,8 @@ - public void getEntitiesOfTypeWithinAAAB(Class entityClass, AxisAlignedBB aabb, List listToFill, Predicate p_177430_4_) + public void func_177430_a(Class p_177430_1_, AxisAlignedBB p_177430_2_, List p_177430_3_, Predicate p_177430_4_) { -- int i = MathHelper.floor_double((aabb.minY - 2.0D) / 16.0D); -- int j = MathHelper.floor_double((aabb.maxY + 2.0D) / 16.0D); -+ int i = MathHelper.floor_double((aabb.minY - World.MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.floor_double((aabb.maxY + World.MAX_ENTITY_RADIUS) / 16.0D); - i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); - j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); +- 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 - World.MAX_ENTITY_RADIUS) / 16.0D); ++ int j = MathHelper.func_76128_c((p_177430_2_.field_72337_e + World.MAX_ENTITY_RADIUS) / 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); @@ -1137,8 +1137,10 @@ while (!this.field_177447_w.isEmpty()) { BlockPos blockpos = (BlockPos)this.field_177447_w.poll(); -+ Block block = this.getBlock(blockpos); -+ IBlockState state = block.getStateFromMeta(this.getBlockMetadata(blockpos)); ++ Block block = this.func_177428_a(blockpos); ++ IBlockState state = block.func_176203_a(this.func_177418_c(blockpos)); -- if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.getBlock(blockpos).hasTileEntity()) -+ if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && block.hasTileEntity(state)) +- if (this.func_177424_a(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.func_177428_a(blockpos).func_149716_u()) ++ if (this.func_177424_a(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && block.hasTileEntity(state)) { - TileEntity tileentity = this.createNewTileEntity(blockpos); - this.worldObj.setTileEntity(blockpos, tileentity); + TileEntity tileentity = this.func_177422_i(blockpos); + this.field_76637_e.func_175690_a(blockpos, tileentity); @@ -1200,6 +1202,13 @@ @SideOnly(Side.CLIENT) - public void fillChunk(byte[] p_177439_1_, int p_177439_2_, boolean p_177439_3_) + public void func_177439_a(byte[] p_177439_1_, int p_177439_2_, boolean p_177439_3_) { -+ for(TileEntity tileEntity : chunkTileEntityMap.values()) ++ for(TileEntity tileEntity : field_150816_i.values()) + { -+ tileEntity.updateContainingBlockInfo(); -+ tileEntity.getBlockMetadata(); -+ tileEntity.getBlockType(); ++ tileEntity.func_145836_u(); ++ tileEntity.func_145832_p(); ++ tileEntity.func_145838_q(); + } + int i = 0; - boolean flag = !this.worldObj.provider.getHasNoSky(); + boolean flag = !this.field_76637_e.field_73011_w.func_177495_o(); @@ -1267,10 +1276,16 @@ - this.isTerrainPopulated = true; - this.generateHeightMap(); + this.field_76646_k = true; + this.func_76590_a(); + List invalidList = new java.util.ArrayList(); + - for (TileEntity tileentity : this.chunkTileEntityMap.values()) + for (TileEntity tileentity : this.field_150816_i.values()) { -+ if (tileentity.shouldRefresh(this.worldObj, tileentity.getPos(), tileentity.getBlockType().getStateFromMeta(tileentity.getBlockMetadata()), getBlockState(tileentity.getPos()))) ++ if (tileentity.shouldRefresh(this.field_76637_e, tileentity.func_174877_v(), tileentity.func_145838_q().func_176203_a(tileentity.func_145832_p()), func_177435_g(tileentity.func_174877_v()))) + invalidList.add(tileentity); - tileentity.updateContainingBlockInfo(); + tileentity.func_145836_u(); } + -+ for (TileEntity te : invalidList) te.invalidate(); ++ for (TileEntity te : invalidList) te.func_145843_s(); } - public BiomeGenBase getBiome(BlockPos pos, WorldChunkManager chunkManager) + public BiomeGenBase func_177411_a(BlockPos p_177411_1_, WorldChunkManager p_177411_2_) @@ -1583,4 +1598,20 @@ QUEUED, CHECK; @@ -234,12 +234,12 @@ + */ + public void removeInvalidTileEntity(BlockPos pos) + { -+ if (isChunkLoaded) ++ if (field_76636_d) + { -+ TileEntity entity = (TileEntity)chunkTileEntityMap.get(pos); -+ if (entity != null && entity.isInvalid()) ++ TileEntity entity = (TileEntity)field_150816_i.get(pos); ++ if (entity != null && entity.func_145837_r()) + { -+ chunkTileEntityMap.remove(pos); ++ field_150816_i.remove(pos); + } + } + } diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch index 2be4b4a6a..cd92eee57 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch @@ -1,16 +1,16 @@ --- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java +++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java @@ -42,8 +42,41 @@ - this.chunkSaveLocation = chunkSaveLocationIn; + this.field_75825_d = p_i2003_1_; } + public boolean chunkExists(World world, int x, int z) + { + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(x, z); + -+ if (this.pendingAnvilChunksCoordinates.contains(chunkcoordintpair)) ++ if (this.field_75826_b.contains(chunkcoordintpair)) + { -+ for(ChunkCoordIntPair pendingChunkCoord : this.chunksToRemove.keySet()) ++ for(ChunkCoordIntPair pendingChunkCoord : this.field_75828_a.keySet()) + { + if (pendingChunkCoord.equals(chunkcoordintpair)) + { @@ -19,67 +19,67 @@ + } + } + -+ return RegionFileCache.createOrLoadRegionFile(this.chunkSaveLocation, x, z).chunkExists(x & 31, z & 31); ++ return RegionFileCache.func_76550_a(this.field_75825_d, x, z).chunkExists(x & 31, z & 31); + } + - public Chunk loadChunk(World worldIn, int x, int z) throws IOException + public Chunk func_75815_a(World p_75815_1_, int p_75815_2_, int p_75815_3_) throws IOException { -+ Object[] data = this.loadChunk__Async(worldIn, x, z); ++ Object[] data = this.loadChunk__Async(p_75815_1_, p_75815_2_, p_75815_3_); + + if (data != null) + { + Chunk chunk = (Chunk) data[0]; + NBTTagCompound nbttagcompound = (NBTTagCompound) data[1]; -+ this.loadEntities(worldIn, nbttagcompound.getCompoundTag("Level"), chunk); ++ this.loadEntities(p_75815_1_, nbttagcompound.func_74775_l("Level"), chunk); + return chunk; + } + + return null; + } + -+ public Object[] loadChunk__Async(World worldIn, int x, int z) throws IOException ++ public Object[] loadChunk__Async(World p_75815_1_, int p_75815_2_, int p_75815_3_) throws IOException + { - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(x, z); - NBTTagCompound nbttagcompound = (NBTTagCompound)this.chunksToRemove.get(chunkcoordintpair); + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_75815_2_, p_75815_3_); + NBTTagCompound nbttagcompound = (NBTTagCompound)this.field_75828_a.get(chunkcoordintpair); @@ -59,11 +92,17 @@ - nbttagcompound = CompressedStreamTools.read(datainputstream); + nbttagcompound = CompressedStreamTools.func_74794_a(datainputstream); } -- return this.checkedReadChunkFromNBT(worldIn, x, z, nbttagcompound); -+ return this.checkedReadChunkFromNBT__Async(worldIn, x, z, nbttagcompound); +- return this.func_75822_a(p_75815_1_, p_75815_2_, p_75815_3_, nbttagcompound); ++ return this.checkedReadChunkFromNBT__Async(p_75815_1_, p_75815_2_, p_75815_3_, nbttagcompound); } - protected Chunk checkedReadChunkFromNBT(World worldIn, int x, int z, NBTTagCompound p_75822_4_) + protected Chunk func_75822_a(World p_75822_1_, int p_75822_2_, int p_75822_3_, NBTTagCompound p_75822_4_) { -+ Object[] data = this.checkedReadChunkFromNBT__Async(worldIn, x, z, p_75822_4_); ++ Object[] data = this.checkedReadChunkFromNBT__Async(p_75822_1_, p_75822_2_, p_75822_3_, p_75822_4_); + return data != null ? (Chunk)data[0] : null; + } + -+ protected Object[] checkedReadChunkFromNBT__Async(World worldIn, int x, int z, NBTTagCompound p_75822_4_) ++ protected Object[] checkedReadChunkFromNBT__Async(World p_75822_1_, int p_75822_2_, int p_75822_3_, NBTTagCompound p_75822_4_) + { - if (!p_75822_4_.hasKey("Level", 10)) + if (!p_75822_4_.func_150297_b("Level", 10)) { - logger.error("Chunk file at " + x + "," + z + " is missing level data, skipping"); + field_151505_a.error("Chunk file at " + p_75822_2_ + "," + p_75822_3_ + " is missing level data, skipping"); @@ -87,10 +126,29 @@ - logger.error("Chunk file at " + x + "," + z + " is in the wrong location; relocating. (Expected " + x + ", " + z + ", got " + chunk.xPosition + ", " + chunk.zPosition + ")"); - nbttagcompound.setInteger("xPos", x); - nbttagcompound.setInteger("zPos", z); + field_151505_a.error("Chunk file at " + p_75822_2_ + "," + p_75822_3_ + " is in the wrong location; relocating. (Expected " + p_75822_2_ + ", " + p_75822_3_ + ", got " + chunk.field_76635_g + ", " + chunk.field_76647_h + ")"); + nbttagcompound.func_74768_a("xPos", p_75822_2_); + nbttagcompound.func_74768_a("zPos", p_75822_3_); + + // Have to move tile entities since we don't load them at this stage -+ NBTTagList _tileEntities = nbttagcompound.getTagList("TileEntities", 10); ++ NBTTagList _tileEntities = nbttagcompound.func_150295_c("TileEntities", 10); + + if (_tileEntities != null) + { -+ for (int te = 0; te < _tileEntities.tagCount(); te++) ++ for (int te = 0; te < _tileEntities.func_74745_c(); te++) + { -+ NBTTagCompound _nbt = (NBTTagCompound) _tileEntities.getCompoundTagAt(te); -+ _nbt.setInteger("x", x * 16 + (_nbt.getInteger("x") - chunk.xPosition * 16)); -+ _nbt.setInteger("z", z * 16 + (_nbt.getInteger("z") - chunk.zPosition * 16)); ++ NBTTagCompound _nbt = (NBTTagCompound) _tileEntities.func_150305_b(te); ++ _nbt.func_74768_a("x", p_75822_2_ * 16 + (_nbt.func_74762_e("x") - chunk.field_76635_g * 16)); ++ _nbt.func_74768_a("z", p_75822_3_ * 16 + (_nbt.func_74762_e("z") - chunk.field_76647_h * 16)); + } + } + - chunk = this.readChunkFromNBT(worldIn, nbttagcompound); + chunk = this.func_75823_a(p_75822_1_, nbttagcompound); } - return chunk; @@ -94,10 +94,10 @@ } @@ -105,6 +163,7 @@ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound.setTag("Level", nbttagcompound1); - this.writeChunkToNBT(chunkIn, worldIn, nbttagcompound1); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Save(chunkIn, nbttagcompound)); - this.addChunkToPending(chunkIn.getChunkCoordIntPair(), nbttagcompound); + nbttagcompound.func_74782_a("Level", nbttagcompound1); + this.func_75820_a(p_75816_2_, p_75816_1_, nbttagcompound1); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Save(p_75816_2_, nbttagcompound)); + this.func_75824_a(p_75816_2_.func_76632_l(), nbttagcompound); } catch (Exception exception) @@ -281,11 +340,20 @@ @@ -106,10 +106,10 @@ + try + { - if (entity.writeToNBTOptional(nbttagcompound1)) + if (entity.func_70039_c(nbttagcompound1)) { - chunkIn.setHasEntities(true); - nbttaglist1.appendTag(nbttagcompound1); + p_75820_1_.func_177409_g(true); + nbttaglist1.func_74742_a(nbttagcompound1); } + } + catch (Exception e) @@ -122,13 +122,13 @@ } @@ -295,8 +363,17 @@ - for (TileEntity tileentity : chunkIn.getTileEntityMap().values()) + for (TileEntity tileentity : p_75820_1_.func_177434_r().values()) { NBTTagCompound nbttagcompound2 = new NBTTagCompound(); + try + { - tileentity.writeToNBT(nbttagcompound2); - nbttaglist2.appendTag(nbttagcompound2); + tileentity.func_145841_b(nbttagcompound2); + nbttaglist2.func_74742_a(nbttagcompound2); + } + catch (Exception e) + { @@ -138,18 +138,18 @@ + } } - p_75820_3_.setTag("TileEntities", nbttaglist2); + p_75820_3_.func_74782_a("TileEntities", nbttaglist2); @@ -376,6 +453,12 @@ - chunk.setBiomeArray(p_75823_2_.getByteArray("Biomes")); + chunk.func_76616_a(p_75823_2_.func_74770_j("Biomes")); } + // End this method here and split off entity loading to another method + return chunk; + } + -+ public void loadEntities(World worldIn, NBTTagCompound p_75823_2_, Chunk chunk) ++ public void loadEntities(World p_75823_1_, NBTTagCompound p_75823_2_, Chunk chunk) + { - NBTTagList nbttaglist1 = p_75823_2_.getTagList("Entities", 10); + NBTTagList nbttaglist1 = p_75823_2_.func_150295_c("Entities", 10); if (nbttaglist1 != null) @@ -447,7 +530,5 @@ diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch index 8252f4549..9e563a70b 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch @@ -2,17 +2,17 @@ +++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java @@ -20,18 +20,12 @@ { - File file1 = this.getWorldDirectory(); + File file1 = this.func_75765_b(); -- if (provider instanceof WorldProviderHell) -+ if (provider.getSaveFolder() != null) +- if (p_75763_1_ instanceof WorldProviderHell) ++ if (p_75763_1_.getSaveFolder() != null) { - File file3 = new File(file1, "DIM-1"); -+ File file3 = new File(file1, provider.getSaveFolder()); ++ File file3 = new File(file1, p_75763_1_.getSaveFolder()); file3.mkdirs(); return new AnvilChunkLoader(file3); } -- else if (provider instanceof WorldProviderEnd) +- else if (p_75763_1_ instanceof WorldProviderEnd) - { - File file2 = new File(file1, "DIM1"); - file2.mkdirs(); diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch index 62b0bdc26..945276017 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch @@ -2,10 +2,10 @@ +++ ../src-work/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java @@ -34,6 +34,8 @@ - public void set(int x, int y, int z, IBlockState state) + public void func_177484_a(int p_177484_1_, int p_177484_2_, int p_177484_3_, IBlockState p_177484_4_) { -+ if (state instanceof net.minecraftforge.common.property.IExtendedBlockState) -+ state = ((net.minecraftforge.common.property.IExtendedBlockState) state).getClean(); - IBlockState iblockstate = this.get(x, y, z); - Block block = iblockstate.getBlock(); - Block block1 = state.getBlock(); ++ if (p_177484_4_ instanceof net.minecraftforge.common.property.IExtendedBlockState) ++ p_177484_4_ = ((net.minecraftforge.common.property.IExtendedBlockState) p_177484_4_).getClean(); + IBlockState iblockstate = this.func_177485_a(p_177484_1_, p_177484_2_, p_177484_3_); + Block block = iblockstate.func_177230_c(); + Block block1 = p_177484_4_.func_177230_c(); diff --git a/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch b/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch index 01c861ed3..1992d6dad 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch @@ -7,25 +7,25 @@ + // This is a copy (sort of) of the method below it, make sure they stay in sync + public synchronized boolean chunkExists(int x, int z) + { -+ if (this.outOfBounds(x, z)) return false; ++ if (this.func_76705_d(x, z)) return false; + + try + { -+ int offset = this.getOffset(x, z); ++ int offset = this.func_76707_e(x, z); + + if (offset == 0) return false; + + int sectorNumber = offset >> 8; + int numSectors = offset & 255; + -+ if (sectorNumber + numSectors > this.sectorFree.size()) return false; ++ if (sectorNumber + numSectors > this.field_76714_f.size()) return false; + -+ this.dataFile.seek((long)(sectorNumber * 4096)); -+ int length = this.dataFile.readInt(); ++ this.field_76719_c.seek((long)(sectorNumber * 4096)); ++ int length = this.field_76719_c.readInt(); + + if (length > 4096 * numSectors || length <= 0) return false; + -+ byte version = this.dataFile.readByte(); ++ byte version = this.field_76719_c.readByte(); + + if (version == 1 || version == 2) return true; + } @@ -37,6 +37,6 @@ + return false; + } + - public synchronized DataInputStream getChunkDataInputStream(int x, int z) + public synchronized DataInputStream func_76704_a(int p_76704_1_, int p_76704_2_) { - if (this.outOfBounds(x, z)) + if (this.func_76705_d(p_76704_1_, p_76704_2_)) diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch index 45b2a8d71..f4cec46a7 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch @@ -1,27 +1,27 @@ --- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java +++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java @@ -32,6 +32,9 @@ - double[] noiseData3; - double[] noiseData4; - double[] noiseData5; + double[] field_73193_e; + double[] field_73190_f; + double[] field_73191_g; + // temporary variables used during event handling + private int chunkX = 0; + private int chunkZ = 0; - public ChunkProviderEnd(World worldIn, long p_i2007_2_) + public ChunkProviderEnd(World p_i2007_1_, long p_i2007_2_) { @@ -42,6 +45,14 @@ - this.noiseGen3 = new NoiseGeneratorOctaves(this.endRNG, 8); - this.noiseGen4 = new NoiseGeneratorOctaves(this.endRNG, 10); - this.noiseGen5 = new NoiseGeneratorOctaves(this.endRNG, 16); + this.field_73199_l = new NoiseGeneratorOctaves(this.field_73204_i, 8); + this.field_73196_a = new NoiseGeneratorOctaves(this.field_73204_i, 10); + this.field_73194_b = new NoiseGeneratorOctaves(this.field_73204_i, 16); + -+ NoiseGenerator[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5}; -+ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(worldIn, this.endRNG, noiseGens); -+ this.noiseGen1 = (NoiseGeneratorOctaves)noiseGens[0]; -+ this.noiseGen2 = (NoiseGeneratorOctaves)noiseGens[1]; -+ this.noiseGen3 = (NoiseGeneratorOctaves)noiseGens[2]; -+ this.noiseGen4 = (NoiseGeneratorOctaves)noiseGens[3]; -+ this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4]; ++ NoiseGenerator[] noiseGens = {field_73201_j, field_73202_k, field_73199_l, field_73196_a, field_73194_b}; ++ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(p_i2007_1_, this.field_73204_i, noiseGens); ++ this.field_73201_j = (NoiseGeneratorOctaves)noiseGens[0]; ++ this.field_73202_k = (NoiseGeneratorOctaves)noiseGens[1]; ++ this.field_73199_l = (NoiseGeneratorOctaves)noiseGens[2]; ++ this.field_73196_a = (NoiseGeneratorOctaves)noiseGens[3]; ++ this.field_73194_b = (NoiseGeneratorOctaves)noiseGens[4]; } public void func_180520_a(int p_180520_1_, int p_180520_2_, ChunkPrimer p_180520_3_) @@ -29,7 +29,7 @@ public void func_180519_a(ChunkPrimer p_180519_1_) { -+ net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks(this, chunkX, chunkZ, p_180519_1_, this.endWorld); ++ net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks(this, chunkX, chunkZ, p_180519_1_, this.field_73200_m); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return; for (int i = 0; i < 16; ++i) @@ -37,15 +37,15 @@ for (int j = 0; j < 16; ++j) @@ -165,6 +179,7 @@ - public Chunk provideChunk(int x, int z) + public Chunk func_73154_d(int p_73154_1_, int p_73154_2_) { -+ chunkX = x; chunkZ = z; - this.endRNG.setSeed((long)x * 341873128712L + (long)z * 132897987541L); ++ chunkX = p_73154_1_; chunkZ = p_73154_2_; + this.field_73204_i.setSeed((long)p_73154_1_ * 341873128712L + (long)p_73154_2_ * 132897987541L); ChunkPrimer chunkprimer = new ChunkPrimer(); - this.biomesForGeneration = this.endWorld.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16); + this.field_73198_o = this.field_73200_m.func_72959_q().func_76933_b(this.field_73198_o, p_73154_1_ * 16, p_73154_2_ * 16, 16, 16); @@ -184,6 +199,10 @@ - private double[] initializeNoiseField(double[] p_73187_1_, int p_73187_2_, int p_73187_3_, int p_73187_4_, int p_73187_5_, int p_73187_6_, int p_73187_7_) + private double[] func_73187_a(double[] p_73187_1_, int p_73187_2_, int p_73187_3_, int p_73187_4_, int p_73187_5_, int p_73187_6_, int p_73187_7_) { + net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField(this, p_73187_1_, p_73187_2_, p_73187_3_, p_73187_4_, p_73187_5_, p_73187_6_, p_73187_7_); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); @@ -55,13 +55,13 @@ { p_73187_1_ = new double[p_73187_5_ * p_73187_6_ * p_73187_7_]; @@ -273,8 +292,10 @@ - public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) + public void func_73153_a(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) { - BlockFalling.fallInstantly = true; -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, endWorld, endWorld.rand, p_73153_2_, p_73153_3_, false)); + BlockFalling.field_149832_M = true; ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, field_73200_m, field_73200_m.field_73012_v, p_73153_2_, p_73153_3_, false)); BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); - this.endWorld.getBiomeGenForCoords(blockpos.add(16, 0, 16)).decorate(this.endWorld, this.endWorld.rand, blockpos); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, endWorld, endWorld.rand, p_73153_2_, p_73153_3_, false)); - BlockFalling.fallInstantly = false; + this.field_73200_m.func_180494_b(blockpos.func_177982_a(16, 0, 16)).func_180624_a(this.field_73200_m, this.field_73200_m.field_73012_v, blockpos); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, field_73200_m, field_73200_m.field_73012_v, p_73153_2_, p_73153_3_, false)); + BlockFalling.field_149832_M = false; } diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch index 12ffaf777..e147f9431 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch @@ -2,99 +2,99 @@ +++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java @@ -58,6 +58,15 @@ - public ChunkProviderGenerate(World worldIn, long p_i45636_2_, boolean p_i45636_4_, String p_i45636_5_) + public ChunkProviderGenerate(World p_i45636_1_, long p_i45636_2_, boolean p_i45636_4_, String p_i45636_5_) { + { -+ caveGenerator = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(caveGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE); -+ strongholdGenerator = (MapGenStronghold)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(strongholdGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.STRONGHOLD); -+ villageGenerator = (MapGenVillage)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(villageGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE); -+ mineshaftGenerator = (MapGenMineshaft)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(mineshaftGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.MINESHAFT); -+ scatteredFeatureGenerator = (MapGenScatteredFeature)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(scatteredFeatureGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.SCATTERED_FEATURE); -+ ravineGenerator = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(ravineGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.RAVINE); -+ oceanMonumentGenerator = (StructureOceanMonument)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(oceanMonumentGenerator, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.OCEAN_MONUMENT); ++ field_73226_t = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_73226_t, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE); ++ field_73225_u = (MapGenStronghold)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_73225_u, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.STRONGHOLD); ++ field_73224_v = (MapGenVillage)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_73224_v, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE); ++ field_73223_w = (MapGenMineshaft)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_73223_w, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.MINESHAFT); ++ field_73233_x = (MapGenScatteredFeature)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_73233_x, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.SCATTERED_FEATURE); ++ field_73232_y = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_73232_y, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.RAVINE); ++ field_177474_A = (StructureOceanMonument)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(field_177474_A, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.OCEAN_MONUMENT); + } - this.worldObj = worldIn; - this.mapFeaturesEnabled = p_i45636_4_; - this.field_177475_o = worldIn.getWorldInfo().getTerrainType(); + this.field_73230_p = p_i45636_1_; + this.field_73229_q = p_i45636_4_; + this.field_177475_o = p_i45636_1_.func_72912_H().func_76067_t(); @@ -87,6 +96,16 @@ - this.field_177476_s = this.settings.useLavaOceans ? Blocks.lava : Blocks.water; - worldIn.func_181544_b(this.settings.seaLevel); + this.field_177476_s = this.field_177477_r.field_177778_E ? Blocks.field_150353_l : Blocks.field_150355_j; + p_i45636_1_.func_181544_b(this.field_177477_r.field_177841_q); } + -+ NoiseGenerator[] noiseGens = {field_147431_j, field_147432_k, field_147429_l, field_147430_m, noiseGen5, noiseGen6, mobSpawnerNoise}; -+ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(worldIn, this.rand, noiseGens); ++ NoiseGenerator[] noiseGens = {field_147431_j, field_147432_k, field_147429_l, field_147430_m, field_73214_a, field_73212_b, field_73213_c}; ++ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(p_i45636_1_, this.field_73220_k, noiseGens); + this.field_147431_j = (NoiseGeneratorOctaves)noiseGens[0]; + this.field_147432_k = (NoiseGeneratorOctaves)noiseGens[1]; + this.field_147429_l = (NoiseGeneratorOctaves)noiseGens[2]; + this.field_147430_m = (NoiseGeneratorPerlin)noiseGens[3]; -+ this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4]; -+ this.noiseGen6 = (NoiseGeneratorOctaves)noiseGens[5]; -+ this.mobSpawnerNoise = (NoiseGeneratorOctaves)noiseGens[6]; ++ this.field_73214_a = (NoiseGeneratorOctaves)noiseGens[4]; ++ this.field_73212_b = (NoiseGeneratorOctaves)noiseGens[5]; ++ this.field_73213_c = (NoiseGeneratorOctaves)noiseGens[6]; } - public void setBlocksInChunk(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_) + public void func_180518_a(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_) @@ -160,6 +179,10 @@ public void func_180517_a(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_) { -+ net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180517_1_, p_180517_2_, p_180517_3_, this.worldObj); ++ net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180517_1_, p_180517_2_, p_180517_3_, this.field_73230_p); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return; + double d0 = 0.03125D; - this.stoneNoise = this.field_147430_m.func_151599_a(this.stoneNoise, (double)(p_180517_1_ * 16), (double)(p_180517_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); + this.field_73227_s = this.field_147430_m.func_151599_a(this.field_73227_s, (double)(p_180517_1_ * 16), (double)(p_180517_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); @@ -366,6 +389,8 @@ boolean flag = false; ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag)); + - if (this.settings.useMineShafts && this.mapFeaturesEnabled) + if (this.field_177477_r.field_177829_w && this.field_73229_q) { - this.mineshaftGenerator.func_175794_a(this.worldObj, this.rand, chunkcoordintpair); + this.field_73223_w.func_175794_a(this.field_73230_p, this.field_73220_k, chunkcoordintpair); @@ -391,7 +416,8 @@ - this.oceanMonumentGenerator.func_175794_a(this.worldObj, this.rand, chunkcoordintpair); + this.field_177474_A.func_175794_a(this.field_73230_p, this.field_73220_k, chunkcoordintpair); } -- if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && this.settings.useWaterLakes && !flag && this.rand.nextInt(this.settings.waterLakeChance) == 0) -+ if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && this.settings.useWaterLakes && !flag && this.rand.nextInt(this.settings.waterLakeChance) == 0 -+ && net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE)) +- if (biomegenbase != BiomeGenBase.field_76769_d && biomegenbase != BiomeGenBase.field_76786_s && this.field_177477_r.field_177781_A && !flag && this.field_73220_k.nextInt(this.field_177477_r.field_177782_B) == 0) ++ if (biomegenbase != BiomeGenBase.field_76769_d && biomegenbase != BiomeGenBase.field_76786_s && this.field_177477_r.field_177781_A && !flag && this.field_73220_k.nextInt(this.field_177477_r.field_177782_B) == 0 ++ && net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE)) { - int i1 = this.rand.nextInt(16) + 8; - int j1 = this.rand.nextInt(256); + int i1 = this.field_73220_k.nextInt(16) + 8; + int j1 = this.field_73220_k.nextInt(256); @@ -399,7 +425,8 @@ - (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, blockpos.add(i1, j1, k1)); + (new WorldGenLakes(Blocks.field_150355_j)).func_180709_b(this.field_73230_p, this.field_73220_k, blockpos.func_177982_a(i1, j1, k1)); } -- if (!flag && this.rand.nextInt(this.settings.lavaLakeChance / 10) == 0 && this.settings.useLavaLakes) -+ if (!flag && this.rand.nextInt(this.settings.lavaLakeChance / 10) == 0 && this.settings.useLavaLakes -+ && net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA)) +- if (!flag && this.field_73220_k.nextInt(this.field_177477_r.field_177777_D / 10) == 0 && this.field_177477_r.field_177783_C) ++ if (!flag && this.field_73220_k.nextInt(this.field_177477_r.field_177777_D / 10) == 0 && this.field_177477_r.field_177783_C ++ && net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA)) { - int i2 = this.rand.nextInt(16) + 8; - int l2 = this.rand.nextInt(this.rand.nextInt(248) + 8); + int i2 = this.field_73220_k.nextInt(16) + 8; + int l2 = this.field_73220_k.nextInt(this.field_73220_k.nextInt(248) + 8); @@ -413,7 +440,8 @@ - if (this.settings.useDungeons) + if (this.field_177477_r.field_177837_s) { -- for (int j2 = 0; j2 < this.settings.dungeonChance; ++j2) -+ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON); -+ for (int j2 = 0; doGen && j2 < this.settings.dungeonChance; ++j2) +- for (int j2 = 0; j2 < this.field_177477_r.field_177835_t; ++j2) ++ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON); ++ for (int j2 = 0; doGen && j2 < this.field_177477_r.field_177835_t; ++j2) { - int i3 = this.rand.nextInt(16) + 8; - int l3 = this.rand.nextInt(256); + int i3 = this.field_73220_k.nextInt(16) + 8; + int l3 = this.field_73220_k.nextInt(256); @@ -423,10 +451,14 @@ } - biomegenbase.decorate(this.worldObj, this.rand, new BlockPos(i, 0, j)); -+ if (net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ANIMALS)) + biomegenbase.func_180624_a(this.field_73230_p, this.field_73220_k, new BlockPos(i, 0, j)); ++ if (net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ANIMALS)) + { - SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, i + 8, j + 8, 16, 16, this.rand); + SpawnerAnimals.func_77191_a(this.field_73230_p, biomegenbase, i + 8, j + 8, 16, 16, this.field_73220_k); + } - blockpos = blockpos.add(8, 0, 8); + blockpos = blockpos.func_177982_a(8, 0, 8); - for (int k2 = 0; k2 < 16; ++k2) -+ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE); ++ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE); + for (int k2 = 0; doGen && k2 < 16; ++k2) { for (int j3 = 0; j3 < 16; ++j3) @@ -103,8 +103,8 @@ } } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag)); + - BlockFalling.fallInstantly = false; + BlockFalling.field_149832_M = false; } diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch index a1e6412b4..216df8267 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch @@ -1,67 +1,67 @@ --- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderHell.java +++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderHell.java @@ -49,8 +49,8 @@ - private final WorldGenHellLava field_177472_y = new WorldGenHellLava(Blocks.flowing_lava, false); - private final GeneratorBushFeature field_177471_z = new GeneratorBushFeature(Blocks.brown_mushroom); - private final GeneratorBushFeature field_177465_A = new GeneratorBushFeature(Blocks.red_mushroom); -- private final MapGenNetherBridge genNetherBridge = new MapGenNetherBridge(); -- private final MapGenBase netherCaveGenerator = new MapGenCavesHell(); -+ private final MapGenNetherBridge genNetherBridge; -+ private final MapGenBase netherCaveGenerator; - double[] noiseData1; - double[] noiseData2; - double[] noiseData3; + private final WorldGenHellLava field_177472_y = new WorldGenHellLava(Blocks.field_150356_k, false); + private final GeneratorBushFeature field_177471_z = new GeneratorBushFeature(Blocks.field_150338_P); + private final GeneratorBushFeature field_177465_A = new GeneratorBushFeature(Blocks.field_150337_Q); +- private final MapGenNetherBridge field_73172_c = new MapGenNetherBridge(); +- private final MapGenBase field_73182_t = new MapGenCavesHell(); ++ private final MapGenNetherBridge field_73172_c; ++ private final MapGenBase field_73182_t; + double[] field_73169_d; + double[] field_73170_e; + double[] field_73167_f; @@ -59,16 +59,29 @@ - public ChunkProviderHell(World worldIn, boolean p_i45637_2_, long p_i45637_3_) + public ChunkProviderHell(World p_i45637_1_, boolean p_i45637_2_, long p_i45637_3_) { -+ this.genNetherBridge = (MapGenNetherBridge) net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(new MapGenNetherBridge(), net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_BRIDGE); -+ this.netherCaveGenerator = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(new MapGenCavesHell(), net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_CAVE); - this.worldObj = worldIn; ++ this.field_73172_c = (MapGenNetherBridge) net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(new MapGenNetherBridge(), net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_BRIDGE); ++ this.field_73182_t = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(new MapGenCavesHell(), net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_CAVE); + this.field_73175_o = p_i45637_1_; this.field_177466_i = p_i45637_2_; - this.hellRNG = new Random(p_i45637_3_); -- this.netherNoiseGen1 = new NoiseGeneratorOctaves(this.hellRNG, 16); -- this.netherNoiseGen2 = new NoiseGeneratorOctaves(this.hellRNG, 16); -- this.netherNoiseGen3 = new NoiseGeneratorOctaves(this.hellRNG, 8); -- this.slowsandGravelNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); -- this.netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); -- this.netherNoiseGen6 = new NoiseGeneratorOctaves(this.hellRNG, 10); -- this.netherNoiseGen7 = new NoiseGeneratorOctaves(this.hellRNG, 16); -+ NoiseGeneratorOctaves netherNoiseGen1 = new NoiseGeneratorOctaves(this.hellRNG, 16); -+ NoiseGeneratorOctaves netherNoiseGen2 = new NoiseGeneratorOctaves(this.hellRNG, 16); -+ NoiseGeneratorOctaves netherNoiseGen3 = new NoiseGeneratorOctaves(this.hellRNG, 8); -+ NoiseGeneratorOctaves slowsandGravelNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); -+ NoiseGeneratorOctaves netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); -+ NoiseGeneratorOctaves netherNoiseGen6 = new NoiseGeneratorOctaves(this.hellRNG, 10); -+ NoiseGeneratorOctaves netherNoiseGen7 = new NoiseGeneratorOctaves(this.hellRNG, 16); + this.field_73181_i = new Random(p_i45637_3_); +- this.field_73178_j = new NoiseGeneratorOctaves(this.field_73181_i, 16); +- this.field_73179_k = new NoiseGeneratorOctaves(this.field_73181_i, 16); +- this.field_73176_l = new NoiseGeneratorOctaves(this.field_73181_i, 8); +- this.field_73177_m = new NoiseGeneratorOctaves(this.field_73181_i, 4); +- this.field_73174_n = new NoiseGeneratorOctaves(this.field_73181_i, 4); +- this.field_73173_a = new NoiseGeneratorOctaves(this.field_73181_i, 10); +- this.field_73171_b = new NoiseGeneratorOctaves(this.field_73181_i, 16); ++ NoiseGeneratorOctaves netherNoiseGen1 = new NoiseGeneratorOctaves(this.field_73181_i, 16); ++ NoiseGeneratorOctaves netherNoiseGen2 = new NoiseGeneratorOctaves(this.field_73181_i, 16); ++ NoiseGeneratorOctaves netherNoiseGen3 = new NoiseGeneratorOctaves(this.field_73181_i, 8); ++ NoiseGeneratorOctaves slowsandGravelNoiseGen = new NoiseGeneratorOctaves(this.field_73181_i, 4); ++ NoiseGeneratorOctaves netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.field_73181_i, 4); ++ NoiseGeneratorOctaves netherNoiseGen6 = new NoiseGeneratorOctaves(this.field_73181_i, 10); ++ NoiseGeneratorOctaves netherNoiseGen7 = new NoiseGeneratorOctaves(this.field_73181_i, 16); + NoiseGenerator[] noiseGens = new NoiseGenerator[] { + netherNoiseGen1, netherNoiseGen2, netherNoiseGen3, slowsandGravelNoiseGen, netherrackExculsivityNoiseGen, netherNoiseGen6, netherNoiseGen7 + }; -+ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(worldIn, this.hellRNG, noiseGens); -+ this.netherNoiseGen1 = (NoiseGeneratorOctaves)noiseGens[0]; -+ this.netherNoiseGen2 = (NoiseGeneratorOctaves)noiseGens[1]; -+ this.netherNoiseGen3 = (NoiseGeneratorOctaves)noiseGens[2]; -+ this.slowsandGravelNoiseGen = (NoiseGeneratorOctaves)noiseGens[3]; -+ this.netherrackExculsivityNoiseGen = (NoiseGeneratorOctaves)noiseGens[4]; -+ this.netherNoiseGen6 = (NoiseGeneratorOctaves)noiseGens[5]; -+ this.netherNoiseGen7 = (NoiseGeneratorOctaves)noiseGens[6]; - worldIn.func_181544_b(63); ++ noiseGens = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(p_i45637_1_, this.field_73181_i, noiseGens); ++ this.field_73178_j = (NoiseGeneratorOctaves)noiseGens[0]; ++ this.field_73179_k = (NoiseGeneratorOctaves)noiseGens[1]; ++ this.field_73176_l = (NoiseGeneratorOctaves)noiseGens[2]; ++ this.field_73177_m = (NoiseGeneratorOctaves)noiseGens[3]; ++ this.field_73174_n = (NoiseGeneratorOctaves)noiseGens[4]; ++ this.field_73173_a = (NoiseGeneratorOctaves)noiseGens[5]; ++ this.field_73171_b = (NoiseGeneratorOctaves)noiseGens[6]; + p_i45637_1_.func_181544_b(63); } @@ -148,6 +161,10 @@ public void func_180516_b(int p_180516_1_, int p_180516_2_, ChunkPrimer p_180516_3_) { -+ net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180516_1_, p_180516_2_, p_180516_3_, this.worldObj); ++ net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180516_1_, p_180516_2_, p_180516_3_, this.field_73175_o); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return; + - int i = this.worldObj.func_181545_F() + 1; + int i = this.field_73175_o.func_181545_F() + 1; double d0 = 0.03125D; - this.slowsandNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.slowsandNoise, p_180516_1_ * 16, p_180516_2_ * 16, 0, 16, 16, 1, d0, d0, 1.0D); + this.field_73185_q = this.field_73177_m.func_76304_a(this.field_73185_q, p_180516_1_ * 16, p_180516_2_ * 16, 0, 16, 16, 1, d0, d0, 1.0D); @@ -265,6 +282,10 @@ - private double[] initializeNoiseField(double[] p_73164_1_, int p_73164_2_, int p_73164_3_, int p_73164_4_, int p_73164_5_, int p_73164_6_, int p_73164_7_) + private double[] func_73164_a(double[] p_73164_1_, int p_73164_2_, int p_73164_3_, int p_73164_4_, int p_73164_5_, int p_73164_6_, int p_73164_7_) { + net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkProviderEvent.InitNoiseField(this, p_73164_1_, p_73164_2_, p_73164_3_, p_73164_4_, p_73164_5_, p_73164_6_, p_73164_7_); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); @@ -71,71 +71,71 @@ { p_73164_1_ = new double[p_73164_5_ * p_73164_6_ * p_73164_7_]; @@ -356,50 +377,60 @@ - public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) + public void func_73153_a(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) { - BlockFalling.fallInstantly = true; -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false)); + BlockFalling.field_149832_M = true; ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre(p_73153_1_, field_73175_o, field_73181_i, p_73153_2_, p_73153_3_, false)); BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); - this.genNetherBridge.func_175794_a(this.worldObj, this.hellRNG, chunkcoordintpair); + this.field_73172_c.func_175794_a(this.field_73175_o, this.field_73181_i, chunkcoordintpair); - for (int i = 0; i < 8; ++i) -+ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA); ++ boolean doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, field_73175_o, field_73181_i, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA); + for (int i = 0; doGen && i < 8; ++i) { - this.field_177472_y.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); + this.field_177472_y.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(120) + 4, this.field_73181_i.nextInt(16) + 8)); } -- for (int j = 0; j < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1; ++j) -+ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.FIRE); -+ for (int j = 0; doGen && j < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1; ++j) +- for (int j = 0; j < this.field_73181_i.nextInt(this.field_73181_i.nextInt(10) + 1) + 1; ++j) ++ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, field_73175_o, field_73181_i, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.FIRE); ++ for (int j = 0; doGen && j < this.field_73181_i.nextInt(this.field_73181_i.nextInt(10) + 1) + 1; ++j) { - this.field_177470_t.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); + this.field_177470_t.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(120) + 4, this.field_73181_i.nextInt(16) + 8)); } -- for (int k = 0; k < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1); ++k) -+ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.GLOWSTONE); -+ for (int k = 0; doGen && k < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1); ++k) +- for (int k = 0; k < this.field_73181_i.nextInt(this.field_73181_i.nextInt(10) + 1); ++k) ++ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, field_73175_o, field_73181_i, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.GLOWSTONE); ++ for (int k = 0; doGen && k < this.field_73181_i.nextInt(this.field_73181_i.nextInt(10) + 1); ++k) { - this.field_177469_u.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); + this.field_177469_u.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(120) + 4, this.field_73181_i.nextInt(16) + 8)); } - for (int l = 0; l < 10; ++l) + for (int l = 0; doGen && l < 10; ++l) { - this.field_177468_v.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); + this.field_177468_v.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(128), this.field_73181_i.nextInt(16) + 8)); } -- if (this.hellRNG.nextBoolean()) -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(worldObj, hellRNG, blockpos)); +- if (this.field_73181_i.nextBoolean()) ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(field_73175_o, field_73181_i, blockpos)); + -+ doGen = net.minecraftforge.event.terraingen.TerrainGen.decorate(worldObj, hellRNG, blockpos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM); -+ if (doGen && this.hellRNG.nextBoolean()) ++ doGen = net.minecraftforge.event.terraingen.TerrainGen.decorate(field_73175_o, field_73181_i, blockpos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM); ++ if (doGen && this.field_73181_i.nextBoolean()) { - this.field_177471_z.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); + this.field_177471_z.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(128), this.field_73181_i.nextInt(16) + 8)); } -- if (this.hellRNG.nextBoolean()) -+ if (doGen && this.hellRNG.nextBoolean()) +- if (this.field_73181_i.nextBoolean()) ++ if (doGen && this.field_73181_i.nextBoolean()) { - this.field_177465_A.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); + this.field_177465_A.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16) + 8, this.field_73181_i.nextInt(128), this.field_73181_i.nextInt(16) + 8)); } - for (int i1 = 0; i1 < 16; ++i1) -+ doGen = net.minecraftforge.event.terraingen.TerrainGen.generateOre(worldObj, hellRNG, field_177467_w, blockpos, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.QUARTZ); ++ doGen = net.minecraftforge.event.terraingen.TerrainGen.generateOre(field_73175_o, field_73181_i, field_177467_w, blockpos, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.QUARTZ); + for (int i1 = 0; doGen && i1 < 16; ++i1) { - this.field_177467_w.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16), this.hellRNG.nextInt(108) + 10, this.hellRNG.nextInt(16))); + this.field_177467_w.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16), this.field_73181_i.nextInt(108) + 10, this.field_73181_i.nextInt(16))); } - for (int j1 = 0; j1 < 16; ++j1) -+ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA2); ++ doGen = net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, field_73175_o, field_73181_i, p_73153_2_, p_73153_3_, false, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA2); + for (int j1 = 0; doGen && j1 < 16; ++j1) { - this.field_177473_x.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16), this.hellRNG.nextInt(108) + 10, this.hellRNG.nextInt(16))); + this.field_177473_x.func_180709_b(this.field_73175_o, this.field_73181_i, blockpos.func_177982_a(this.field_73181_i.nextInt(16), this.field_73181_i.nextInt(108) + 10, this.field_73181_i.nextInt(16))); } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false)); - BlockFalling.fallInstantly = false; ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.PopulateChunkEvent.Post(p_73153_1_, field_73175_o, field_73181_i, p_73153_2_, p_73153_3_, false)); + BlockFalling.field_149832_M = false; } diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch index a26c456fc..cd28c7ec7 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch @@ -1,52 +1,52 @@ --- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderServer.java +++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderServer.java @@ -36,6 +36,7 @@ - public LongHashMap id2ChunkMap = new LongHashMap(); - public List loadedChunks = Lists.newArrayList(); - public WorldServer worldObj; + public LongHashMap field_73244_f = new LongHashMap(); + public List field_73245_g = Lists.newArrayList(); + public WorldServer field_73251_h; + private Set loadingChunks = com.google.common.collect.Sets.newHashSet(); public ChunkProviderServer(WorldServer p_i1520_1_, IChunkLoader p_i1520_2_, IChunkProvider p_i1520_3_) { @@ -57,7 +58,7 @@ - public void dropChunk(int p_73241_1_, int p_73241_2_) + public void func_73241_b(int p_73241_1_, int p_73241_2_) { -- if (this.worldObj.provider.canRespawnHere()) -+ if (this.worldObj.provider.canRespawnHere() && net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.worldObj.provider.getDimensionId())) +- if (this.field_73251_h.field_73011_w.func_76567_e()) ++ if (this.field_73251_h.field_73011_w.func_76567_e() && net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.field_73251_h.field_73011_w.func_177502_q())) { - if (!this.worldObj.isSpawnChunk(p_73241_1_, p_73241_2_)) + if (!this.field_73251_h.func_72916_c(p_73241_1_, p_73241_2_)) { @@ -80,12 +81,64 @@ - public Chunk loadChunk(int p_73158_1_, int p_73158_2_) + public Chunk func_73158_c(int p_73158_1_, int p_73158_2_) { + return loadChunk(p_73158_1_, p_73158_2_, null); + } + + public Chunk loadChunk(int par1, int par2, Runnable runnable) + { -+ long k = ChunkCoordIntPair.chunkXZ2Int(par1, par2); -+ this.droppedChunksSet.remove(Long.valueOf(k)); -+ Chunk chunk = (Chunk)this.id2ChunkMap.getValueByKey(k); ++ long k = ChunkCoordIntPair.func_77272_a(par1, par2); ++ this.field_73248_b.remove(Long.valueOf(k)); ++ Chunk chunk = (Chunk)this.field_73244_f.func_76164_a(k); + net.minecraft.world.chunk.storage.AnvilChunkLoader loader = null; + -+ if (this.chunkLoader instanceof net.minecraft.world.chunk.storage.AnvilChunkLoader) ++ if (this.field_73247_e instanceof net.minecraft.world.chunk.storage.AnvilChunkLoader) + { -+ loader = (net.minecraft.world.chunk.storage.AnvilChunkLoader) this.chunkLoader; ++ loader = (net.minecraft.world.chunk.storage.AnvilChunkLoader) this.field_73247_e; + } + + // We can only use the queue for already generated chunks -+ if (chunk == null && loader != null && loader.chunkExists(this.worldObj, par1, par2)) ++ if (chunk == null && loader != null && loader.chunkExists(this.field_73251_h, par1, par2)) + { + if (runnable != null) + { -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.queueChunkLoad(this.worldObj, loader, this, par1, par2, runnable); ++ net.minecraftforge.common.chunkio.ChunkIOExecutor.queueChunkLoad(this.field_73251_h, loader, this, par1, par2, runnable); + return null; + } + else + { -+ chunk = net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(this.worldObj, loader, this, par1, par2); ++ chunk = net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(this.field_73251_h, loader, this, par1, par2); + } + } + else if (chunk == null) @@ -65,61 +65,61 @@ + + public Chunk originalLoadChunk(int p_73158_1_, int p_73158_2_) + { - long i = ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_); - this.droppedChunksSet.remove(Long.valueOf(i)); - Chunk chunk = (Chunk)this.id2ChunkMap.getValueByKey(i); + long i = ChunkCoordIntPair.func_77272_a(p_73158_1_, p_73158_2_); + this.field_73248_b.remove(Long.valueOf(i)); + Chunk chunk = (Chunk)this.field_73244_f.func_76164_a(i); if (chunk == null) { + boolean added = loadingChunks.add(i); + if (!added) + { -+ net.minecraftforge.fml.common.FMLLog.bigWarning("There is an attempt to load a chunk (%d,%d) in di >mension %d that is already being loaded. This will cause weird chunk breakages.", p_73158_1_, p_73158_2_, worldObj.provider.getDimensionId()); ++ net.minecraftforge.fml.common.FMLLog.bigWarning("There is an attempt to load a chunk (%d,%d) in di >mension %d that is already being loaded. This will cause weird chunk breakages.", p_73158_1_, p_73158_2_, field_73251_h.field_73011_w.func_177502_q()); + } -+ chunk = net.minecraftforge.common.ForgeChunkManager.fetchDormantChunk(i, this.worldObj); ++ chunk = net.minecraftforge.common.ForgeChunkManager.fetchDormantChunk(i, this.field_73251_h); + + if (chunk == null) - chunk = this.loadChunkFromFile(p_73158_1_, p_73158_2_); + chunk = this.func_73239_e(p_73158_1_, p_73158_2_); if (chunk == null) @@ -114,6 +167,7 @@ - this.id2ChunkMap.add(i, chunk); - this.loadedChunks.add(chunk); + this.field_73244_f.func_76163_a(i, chunk); + this.field_73245_g.add(chunk); + loadingChunks.remove(i); - chunk.onChunkLoad(); - chunk.populateChunk(this, this, p_73158_1_, p_73158_2_); + chunk.func_76631_c(); + chunk.func_76624_a(this, this, p_73158_1_, p_73158_2_); } @@ -205,6 +259,7 @@ - if (this.serverChunkGenerator != null) + if (this.field_73246_d != null) { - this.serverChunkGenerator.populate(p_73153_1_, p_73153_2_, p_73153_3_); -+ net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(p_73153_2_, p_73153_3_, worldObj, serverChunkGenerator, p_73153_1_); - chunk.setChunkModified(); + this.field_73246_d.func_73153_a(p_73153_1_, p_73153_2_, p_73153_3_); ++ net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(p_73153_2_, p_73153_3_, field_73251_h, field_73246_d, p_73153_1_); + chunk.func_76630_e(); } } @@ -266,6 +321,11 @@ { - if (!this.worldObj.disableLevelSaving) + if (!this.field_73251_h.field_73058_d) { -+ for (ChunkCoordIntPair forced : this.worldObj.getPersistentChunks().keySet()) ++ for (ChunkCoordIntPair forced : this.field_73251_h.getPersistentChunks().keySet()) + { -+ this.droppedChunksSet.remove(ChunkCoordIntPair.chunkXZ2Int(forced.chunkXPos, forced.chunkZPos)); ++ this.field_73248_b.remove(ChunkCoordIntPair.func_77272_a(forced.field_77276_a, forced.field_77275_b)); + } + for (int i = 0; i < 100; ++i) { - if (!this.droppedChunksSet.isEmpty()) + if (!this.field_73248_b.isEmpty()) @@ -280,6 +340,12 @@ - this.saveChunkExtraData(chunk); - this.id2ChunkMap.remove(olong.longValue()); - this.loadedChunks.remove(chunk); -+ net.minecraftforge.common.ForgeChunkManager.putDormantChunk(ChunkCoordIntPair.chunkXZ2Int(chunk.xPosition, chunk.zPosition), chunk); -+ if(loadedChunks.size() == 0 && net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this.worldObj).size() == 0 && !net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.worldObj.provider.getDimensionId())){ -+ net.minecraftforge.common.DimensionManager.unloadWorld(this.worldObj.provider.getDimensionId()); -+ return serverChunkGenerator.unloadQueuedChunks(); + this.func_73243_a(chunk); + this.field_73244_f.func_76159_d(olong.longValue()); + this.field_73245_g.remove(chunk); ++ net.minecraftforge.common.ForgeChunkManager.putDormantChunk(ChunkCoordIntPair.func_77272_a(chunk.field_76635_g, chunk.field_76647_h), chunk); ++ if(field_73245_g.size() == 0 && net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this.field_73251_h).size() == 0 && !net.minecraftforge.common.DimensionManager.shouldLoadSpawn(this.field_73251_h.field_73011_w.func_177502_q())){ ++ net.minecraftforge.common.DimensionManager.unloadWorld(this.field_73251_h.field_73011_w.func_177502_q()); ++ return field_73246_d.func_73156_b(); + } + } - this.droppedChunksSet.remove(olong); + this.field_73248_b.remove(olong); diff --git a/patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch b/patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch index 8d6cd118c..63fe3a7bb 100644 --- a/patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch @@ -2,18 +2,18 @@ +++ ../src-work/minecraft/net/minecraft/world/gen/MapGenCaves.java @@ -138,7 +138,7 @@ { - IBlockState iblockstate = p_180702_5_.getBlockState(j1, l1, k1); + IBlockState iblockstate = p_180702_5_.func_177856_a(j1, l1, k1); -- if (iblockstate.getBlock() == Blocks.flowing_water || iblockstate.getBlock() == Blocks.water) +- if (iblockstate.func_177230_c() == Blocks.field_150358_i || iblockstate.func_177230_c() == Blocks.field_150355_j) + if (isOceanBlock(p_180702_5_, j1, l1, k1, p_180702_3_, p_180702_4_)) { flag3 = true; } @@ -176,33 +176,12 @@ - IBlockState iblockstate1 = p_180702_5_.getBlockState(j3, j2, i2); - IBlockState iblockstate2 = (IBlockState)Objects.firstNonNull(p_180702_5_.getBlockState(j3, j2 + 1, i2), Blocks.air.getDefaultState()); + IBlockState iblockstate1 = p_180702_5_.func_177856_a(j3, j2, i2); + IBlockState iblockstate2 = (IBlockState)Objects.firstNonNull(p_180702_5_.func_177856_a(j3, j2 + 1, i2), Blocks.field_150350_a.func_176223_P()); -- if (iblockstate1.getBlock() == Blocks.grass || iblockstate1.getBlock() == Blocks.mycelium) +- if (iblockstate1.func_177230_c() == Blocks.field_150349_c || iblockstate1.func_177230_c() == Blocks.field_150391_bh) + if (isTopBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_)) { flag1 = true; @@ -23,21 +23,21 @@ - { - if (j2 - 1 < 10) - { -- p_180702_5_.setBlockState(j3, j2, i2, Blocks.lava.getDefaultState()); +- p_180702_5_.func_177855_a(j3, j2, i2, Blocks.field_150353_l.func_176223_P()); - } - else - { -- p_180702_5_.setBlockState(j3, j2, i2, Blocks.air.getDefaultState()); +- p_180702_5_.func_177855_a(j3, j2, i2, Blocks.field_150350_a.func_176223_P()); - -- if (iblockstate2.getBlock() == Blocks.sand) +- if (iblockstate2.func_177230_c() == Blocks.field_150354_m) - { -- p_180702_5_.setBlockState(j3, j2 + 1, i2, iblockstate2.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? Blocks.red_sandstone.getDefaultState() : Blocks.sandstone.getDefaultState()); +- p_180702_5_.func_177855_a(j3, j2 + 1, i2, iblockstate2.func_177229_b(BlockSand.field_176504_a) == BlockSand.EnumType.RED_SAND ? Blocks.field_180395_cM.func_176223_P() : Blocks.field_150322_A.func_176223_P()); - } - -- if (flag1 && p_180702_5_.getBlockState(j3, j2 - 1, i2).getBlock() == Blocks.dirt) +- if (flag1 && p_180702_5_.func_177856_a(j3, j2 - 1, i2).func_177230_c() == Blocks.field_150346_d) - { - blockpos$mutableblockpos.func_181079_c(j3 + p_180702_3_ * 16, 0, i2 + p_180702_4_ * 16); -- p_180702_5_.setBlockState(j3, j2 - 1, i2, this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).topBlock.getBlock().getDefaultState()); +- p_180702_5_.func_177855_a(j3, j2 - 1, i2, this.field_75039_c.func_180494_b(blockpos$mutableblockpos).field_76752_A.func_177230_c().func_176223_P()); - } - } - } @@ -52,15 +52,15 @@ + + protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) + { -+ net.minecraft.block.Block block = data.getBlockState(x, y, z).getBlock(); -+ return block== Blocks.flowing_water || block == Blocks.water; ++ net.minecraft.block.Block block = data.func_177856_a(x, y, z).func_177230_c(); ++ return block== Blocks.field_150358_i || block == Blocks.field_150355_j; + } + + //Exception biomes to make sure we generate like vanilla + private boolean isExceptionBiome(net.minecraft.world.biome.BiomeGenBase biome) + { -+ if (biome == net.minecraft.world.biome.BiomeGenBase.beach) return true; -+ if (biome == net.minecraft.world.biome.BiomeGenBase.desert) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76787_r) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76769_d) return true; + return false; + } + @@ -68,9 +68,9 @@ + //Vanilla bugs to make sure that we generate the map the same way vanilla does. + private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) + { -+ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); -+ IBlockState state = data.getBlockState(x, y, z); -+ return (isExceptionBiome(biome) ? state.getBlock() == Blocks.grass : state.getBlock() == biome.topBlock); ++ net.minecraft.world.biome.BiomeGenBase biome = field_75039_c.func_180494_b(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); ++ IBlockState state = data.func_177856_a(x, y, z); ++ return (isExceptionBiome(biome) ? state.func_177230_c() == Blocks.field_150349_c : state.func_177230_c() == biome.field_76752_A); + } + + /** @@ -90,28 +90,28 @@ + */ + protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop, IBlockState state, IBlockState up) + { -+ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); -+ IBlockState top = biome.topBlock; -+ IBlockState filler = biome.fillerBlock; ++ net.minecraft.world.biome.BiomeGenBase biome = field_75039_c.func_180494_b(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); ++ IBlockState top = biome.field_76752_A; ++ IBlockState filler = biome.field_76753_B; + -+ if (this.func_175793_a(state, up) || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock()) ++ if (this.func_175793_a(state, up) || state.func_177230_c() == top.func_177230_c() || state.func_177230_c() == filler.func_177230_c()) + { + if (y < 10) + { -+ data.setBlockState(x, y, z, Blocks.lava.getDefaultState()); ++ data.func_177855_a(x, y, z, Blocks.field_150353_l.func_176223_P()); + } + else + { -+ data.setBlockState(x, y, z, Blocks.air.getDefaultState()); ++ data.func_177855_a(x, y, z, Blocks.field_150350_a.func_176223_P()); + -+ if (up.getBlock() == Blocks.sand) ++ if (up.func_177230_c() == Blocks.field_150354_m) + { -+ data.setBlockState(x, y + 1, z, up.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? Blocks.red_sandstone.getDefaultState() : Blocks.sandstone.getDefaultState()); ++ data.func_177855_a(x, y + 1, z, up.func_177229_b(BlockSand.field_176504_a) == BlockSand.EnumType.RED_SAND ? Blocks.field_180395_cM.func_176223_P() : Blocks.field_150322_A.func_176223_P()); + } + -+ if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock()) ++ if (foundTop && data.func_177856_a(x, y - 1, z).func_177230_c() == filler.func_177230_c()) + { -+ data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState()); ++ data.func_177855_a(x, y - 1, z, top.func_177230_c().func_176223_P()); + } + } + } diff --git a/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch b/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch index 9c89eb5b3..b5fc50da7 100644 --- a/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch @@ -2,37 +2,37 @@ +++ ../src-work/minecraft/net/minecraft/world/gen/MapGenRavine.java @@ -128,7 +128,7 @@ { - IBlockState iblockstate = p_180707_5_.getBlockState(j1, l1, k1); + IBlockState iblockstate = p_180707_5_.func_177856_a(j1, l1, k1); -- if (iblockstate.getBlock() == Blocks.flowing_water || iblockstate.getBlock() == Blocks.water) +- if (iblockstate.func_177230_c() == Blocks.field_150358_i || iblockstate.func_177230_c() == Blocks.field_150355_j) + if (isOceanBlock(p_180707_5_, j1, l1, k1, p_180707_3_, p_180707_4_)) { flag2 = true; } @@ -165,28 +165,12 @@ { - IBlockState iblockstate1 = p_180707_5_.getBlockState(j3, j2, i2); + IBlockState iblockstate1 = p_180707_5_.func_177856_a(j3, j2, i2); -- if (iblockstate1.getBlock() == Blocks.grass) +- if (iblockstate1.func_177230_c() == Blocks.field_150349_c) + if (isTopBlock(p_180707_5_, j3, j2, i2, p_180707_3_, p_180707_4_)) { flag = true; } -- if (iblockstate1.getBlock() == Blocks.stone || iblockstate1.getBlock() == Blocks.dirt || iblockstate1.getBlock() == Blocks.grass) +- if (iblockstate1.func_177230_c() == Blocks.field_150348_b || iblockstate1.func_177230_c() == Blocks.field_150346_d || iblockstate1.func_177230_c() == Blocks.field_150349_c) - { - if (j2 - 1 < 10) - { -- p_180707_5_.setBlockState(j3, j2, i2, Blocks.flowing_lava.getDefaultState()); +- p_180707_5_.func_177855_a(j3, j2, i2, Blocks.field_150356_k.func_176223_P()); - } - else - { -- p_180707_5_.setBlockState(j3, j2, i2, Blocks.air.getDefaultState()); +- p_180707_5_.func_177855_a(j3, j2, i2, Blocks.field_150350_a.func_176223_P()); - -- if (flag && p_180707_5_.getBlockState(j3, j2 - 1, i2).getBlock() == Blocks.dirt) +- if (flag && p_180707_5_.func_177856_a(j3, j2 - 1, i2).func_177230_c() == Blocks.field_150346_d) - { - blockpos$mutableblockpos.func_181079_c(j3 + p_180707_3_ * 16, 0, i2 + p_180707_4_ * 16); -- p_180707_5_.setBlockState(j3, j2 - 1, i2, this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).topBlock); +- p_180707_5_.func_177855_a(j3, j2 - 1, i2, this.field_75039_c.func_180494_b(blockpos$mutableblockpos).field_76752_A); - } - } - } @@ -46,17 +46,17 @@ } + protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) + { -+ net.minecraft.block.Block block = data.getBlockState(x, y, z).getBlock(); -+ return block== Blocks.flowing_water || block == Blocks.water; ++ net.minecraft.block.Block block = data.func_177856_a(x, y, z).func_177230_c(); ++ return block== Blocks.field_150358_i || block == Blocks.field_150355_j; + } + + //Exception biomes to make sure we generate like vanilla + private boolean isExceptionBiome(net.minecraft.world.biome.BiomeGenBase biome) + { -+ if (biome == net.minecraft.world.biome.BiomeGenBase.beach) return true; -+ if (biome == net.minecraft.world.biome.BiomeGenBase.desert) return true; -+ if (biome == net.minecraft.world.biome.BiomeGenBase.mushroomIsland) return true; -+ if (biome == net.minecraft.world.biome.BiomeGenBase.mushroomIslandShore) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76787_r) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76769_d) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76789_p) return true; ++ if (biome == net.minecraft.world.biome.BiomeGenBase.field_76788_q) return true; + return false; + } + @@ -64,9 +64,9 @@ + //Vanilla bugs to make sure that we generate the map the same way vanilla does. + private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) + { -+ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); -+ IBlockState state = data.getBlockState(x, y, z); -+ return (isExceptionBiome(biome) ? state.getBlock() == Blocks.grass : state.getBlock() == biome.topBlock); ++ net.minecraft.world.biome.BiomeGenBase biome = field_75039_c.func_180494_b(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); ++ IBlockState state = data.func_177856_a(x, y, z); ++ return (isExceptionBiome(biome) ? state.func_177230_c() == Blocks.field_150349_c : state.func_177230_c() == biome.field_76752_A); + } + + /** @@ -86,24 +86,24 @@ + */ + protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop) + { -+ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); -+ IBlockState state = data.getBlockState(x, y, z); -+ IBlockState top = isExceptionBiome(biome) ? Blocks.grass.getDefaultState() : biome.topBlock; -+ IBlockState filler = isExceptionBiome(biome) ? Blocks.dirt.getDefaultState() : biome.fillerBlock; ++ net.minecraft.world.biome.BiomeGenBase biome = field_75039_c.func_180494_b(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); ++ IBlockState state = data.func_177856_a(x, y, z); ++ IBlockState top = isExceptionBiome(biome) ? Blocks.field_150349_c.func_176223_P() : biome.field_76752_A; ++ IBlockState filler = isExceptionBiome(biome) ? Blocks.field_150346_d.func_176223_P() : biome.field_76753_B; + -+ if (state.getBlock() == Blocks.stone || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock()) ++ if (state.func_177230_c() == Blocks.field_150348_b || state.func_177230_c() == top.func_177230_c() || state.func_177230_c() == filler.func_177230_c()) + { + if (y < 10) + { -+ data.setBlockState(x, y, z, Blocks.lava.getDefaultState()); ++ data.func_177855_a(x, y, z, Blocks.field_150353_l.func_176223_P()); + } + else + { -+ data.setBlockState(x, y, z, Blocks.air.getDefaultState()); ++ data.func_177855_a(x, y, z, Blocks.field_150350_a.func_176223_P()); + -+ if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock()) ++ if (foundTop && data.func_177856_a(x, y - 1, z).func_177230_c() == filler.func_177230_c()) + { -+ data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState()); ++ data.func_177855_a(x, y - 1, z, top.func_177230_c().func_176223_P()); + } + } + } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch index 1b9ac00c1..f23e6f318 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch @@ -1,13 +1,13 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java @@ -31,4 +31,10 @@ - this.func_175903_a(worldIn, p_175921_2_, Blocks.dirt.getDefaultState()); + this.func_175903_a(p_175921_1_, p_175921_2_, Blocks.field_150346_d.func_176223_P()); } } + + public boolean isReplaceable(World world, BlockPos pos) + { -+ net.minecraft.block.state.IBlockState state = world.getBlockState(pos); -+ return state.getBlock().isAir(world, pos) || state.getBlock().isLeaves(world, pos) || state.getBlock().isWood(world, pos) || func_150523_a(state.getBlock()); ++ net.minecraft.block.state.IBlockState state = world.func_180495_p(pos); ++ return state.func_177230_c().isAir(world, pos) || state.func_177230_c().isLeaves(world, pos) || state.func_177230_c().isWood(world, pos) || func_150523_a(state.func_177230_c()); + } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch index a7d6dc424..0aba92cfd 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch @@ -2,10 +2,10 @@ +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java @@ -54,7 +54,7 @@ { - Block block = worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(l, j, i1)).getBlock(); + Block block = p_180709_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(l, j, i1)).func_177230_c(); -- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) -+ if (!block.isAir(worldIn,blockpos$mutableblockpos) && !block.isLeaves(worldIn,blockpos$mutableblockpos)) +- if (block.func_149688_o() != Material.field_151579_a && block.func_149688_o() != Material.field_151584_j) ++ if (!block.isAir(p_180709_1_,blockpos$mutableblockpos) && !block.isLeaves(p_180709_1_,blockpos$mutableblockpos)) { flag = false; } @@ -13,21 +13,21 @@ { BlockPos blockpos = new BlockPos(l1, l2, i2); -- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) -+ if (!worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) +- if (!p_180709_1_.func_180495_p(blockpos).func_177230_c().func_149730_j()) ++ if (!p_180709_1_.func_180495_p(blockpos).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos)) { - this.func_175903_a(worldIn, blockpos, this.mushroomType.getDefaultState().withProperty(BlockHugeMushroom.VARIANT, blockhugemushroom$enumtype)); + this.func_175903_a(p_180709_1_, blockpos, this.field_76523_a.func_176223_P().func_177226_a(BlockHugeMushroom.field_176380_a, blockhugemushroom$enumtype)); } @@ -201,9 +201,10 @@ for (int i3 = 0; i3 < i; ++i3) { -- Block block2 = worldIn.getBlockState(p_180709_3_.up(i3)).getBlock(); -+ BlockPos upN = p_180709_3_.up(i3); -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(upN); +- Block block2 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(i3)).func_177230_c(); ++ BlockPos upN = p_180709_3_.func_177981_b(i3); ++ net.minecraft.block.state.IBlockState state = p_180709_1_.func_180495_p(upN); -- if (!block2.isFullBlock()) -+ if (state.getBlock().canBeReplacedByLeaves(worldIn, upN)) +- if (!block2.func_149730_j()) ++ if (state.func_177230_c().canBeReplacedByLeaves(p_180709_1_, upN)) { - this.func_175903_a(worldIn, p_180709_3_.up(i3), this.mushroomType.getDefaultState().withProperty(BlockHugeMushroom.VARIANT, BlockHugeMushroom.EnumType.STEM)); + this.func_175903_a(p_180709_1_, p_180709_3_.func_177981_b(i3), this.field_76523_a.func_176223_P().func_177226_a(BlockHugeMushroom.field_176380_a, BlockHugeMushroom.EnumType.STEM)); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch index e4bc6f945..7fb88e1b7 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch @@ -3,29 +3,29 @@ @@ -99,9 +99,9 @@ if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_181631_2_ * p_181631_2_)) { - BlockPos blockpos = p_181631_1_.add(j, 0, k); -- Material material = this.world.getBlockState(blockpos).getBlock().getMaterial(); -+ net.minecraft.block.state.IBlockState state = this.world.getBlockState(blockpos); + BlockPos blockpos = p_181631_1_.func_177982_a(j, 0, k); +- Material material = this.field_175946_l.func_180495_p(blockpos).func_177230_c().func_149688_o(); ++ net.minecraft.block.state.IBlockState state = this.field_175946_l.func_180495_p(blockpos); -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(this.world, blockpos) || state.getBlock().isLeaves(this.world, blockpos)) +- if (material == Material.field_151579_a || material == Material.field_151584_j) ++ if (state.func_177230_c().isAir(this.field_175946_l, blockpos) || state.func_177230_c().isLeaves(this.field_175946_l, blockpos)) { - this.func_175903_a(this.world, blockpos, p_181631_3_); + this.func_175903_a(this.field_175946_l, blockpos, p_181631_3_); } @@ -254,7 +254,7 @@ { - BlockPos blockpos1 = p_175936_1_.add((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2)); + BlockPos blockpos1 = p_175936_1_.func_177963_a((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2)); -- if (!this.func_150523_a(this.world.getBlockState(blockpos1).getBlock())) -+ if (!this.isReplaceable(world, blockpos1)) +- if (!this.func_150523_a(this.field_175946_l.func_180495_p(blockpos1).func_177230_c())) ++ if (!this.isReplaceable(field_175946_l, blockpos1)) { return j; } @@ -282,6 +282,7 @@ - if (!this.validTreeLocation()) + if (!this.func_76497_e()) { -+ this.world = null; //Fix vanilla Mem leak, holds latest world ++ this.field_175946_l = null; //Fix vanilla Mem leak, holds latest world return false; } else @@ -33,19 +33,19 @@ this.func_175941_b(); this.func_175942_c(); this.func_175939_d(); -+ this.world = null; //Fix vanilla Mem leak, holds latest world ++ this.field_175946_l = null; //Fix vanilla Mem leak, holds latest world return true; } } - private boolean validTreeLocation() + private boolean func_76497_e() { -- Block block = this.world.getBlockState(this.field_175947_m.down()).getBlock(); -+ BlockPos down = this.field_175947_m.down(); -+ net.minecraft.block.state.IBlockState state = this.world.getBlockState(down); -+ boolean isSoil = state.getBlock().canSustainPlant(this.world, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); +- Block block = this.field_175946_l.func_180495_p(this.field_175947_m.func_177977_b()).func_177230_c(); ++ BlockPos down = this.field_175947_m.func_177977_b(); ++ net.minecraft.block.state.IBlockState state = this.field_175946_l.func_180495_p(down); ++ boolean isSoil = state.func_177230_c().canSustainPlant(this.field_175946_l, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); -- if (block != Blocks.dirt && block != Blocks.grass && block != Blocks.farmland) +- if (block != Blocks.field_150346_d && block != Blocks.field_150349_c && block != Blocks.field_150458_ak) + if (!isSoil) { return false; diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch index c471dd264..6bc3eb814 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch @@ -3,13 +3,13 @@ @@ -33,9 +33,10 @@ if (k >= 1 && k + i + 1 < 256) { - BlockPos blockpos = p_180709_3_.down(); -- Block block = worldIn.getBlockState(blockpos).getBlock(); -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos); -+ boolean isSoil = state.getBlock().canSustainPlant(worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + BlockPos blockpos = p_180709_3_.func_177977_b(); +- Block block = p_180709_1_.func_180495_p(blockpos).func_177230_c(); ++ net.minecraft.block.state.IBlockState state = p_180709_1_.func_180495_p(blockpos); ++ boolean isSoil = state.func_177230_c().canSustainPlant(p_180709_1_, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); -- if (block != Blocks.grass && block != Blocks.dirt) -+ if (!(isSoil && p_180709_3_.getY() < 256 - i - 1)) +- if (block != Blocks.field_150349_c && block != Blocks.field_150346_d) ++ if (!(isSoil && p_180709_3_.func_177956_o() < 256 - i - 1)) { return false; } @@ -17,55 +17,55 @@ } else { -- this.func_175921_a(worldIn, blockpos); -- this.func_175921_a(worldIn, blockpos.east()); -- this.func_175921_a(worldIn, blockpos.south()); -- this.func_175921_a(worldIn, blockpos.south().east()); -+ this.onPlantGrow(worldIn, blockpos, p_180709_3_); -+ this.onPlantGrow(worldIn, blockpos.east(), p_180709_3_); -+ this.onPlantGrow(worldIn, blockpos.south(), p_180709_3_); -+ this.onPlantGrow(worldIn, blockpos.south().east(), p_180709_3_); - EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(p_180709_2_); +- this.func_175921_a(p_180709_1_, blockpos); +- this.func_175921_a(p_180709_1_, blockpos.func_177974_f()); +- this.func_175921_a(p_180709_1_, blockpos.func_177968_d()); +- this.func_175921_a(p_180709_1_, blockpos.func_177968_d().func_177974_f()); ++ this.onPlantGrow(p_180709_1_, blockpos, p_180709_3_); ++ this.onPlantGrow(p_180709_1_, blockpos.func_177974_f(), p_180709_3_); ++ this.onPlantGrow(p_180709_1_, blockpos.func_177968_d(), p_180709_3_); ++ this.onPlantGrow(p_180709_1_, blockpos.func_177968_d().func_177974_f(), p_180709_3_); + EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.func_179518_a(p_180709_2_); int i1 = i - p_180709_2_.nextInt(4); int j1 = 2 - p_180709_2_.nextInt(3); @@ -67,9 +68,9 @@ int k2 = k + j2; BlockPos blockpos1 = new BlockPos(k1, k2, l1); -- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); -+ state = worldIn.getBlockState(blockpos1); +- Material material = p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149688_o(); ++ state = p_180709_1_.func_180495_p(blockpos1); -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(worldIn, blockpos1) || state.getBlock().isLeaves(worldIn, blockpos1)) +- if (material == Material.field_151579_a || material == Material.field_151584_j) ++ if (state.func_177230_c().isAir(p_180709_1_, blockpos1) || state.func_177230_c().isLeaves(p_180709_1_, blockpos1)) { - this.func_181639_b(worldIn, blockpos1); - this.func_181639_b(worldIn, blockpos1.east()); + this.func_181639_b(p_180709_1_, blockpos1); + this.func_181639_b(p_180709_1_, blockpos1.func_177974_f()); @@ -187,7 +188,7 @@ { for (int k1 = -i1; k1 <= i1; ++k1) { -- if (!this.func_150523_a(p_181638_1_.getBlockState(blockpos$mutableblockpos.func_181079_c(i + j1, j + l, k + k1)).getBlock())) +- if (!this.func_150523_a(p_181638_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(i + j1, j + l, k + k1)).func_177230_c())) + if (!this.isReplaceable(p_181638_1_, blockpos$mutableblockpos.func_181079_c(i + j1, j + l, k + k1))) { return false; } @@ -209,11 +210,17 @@ - private void func_150526_a(World worldIn, int p_150526_2_, int p_150526_3_, int p_150526_4_) + private void func_150526_a(World p_150526_1_, int p_150526_2_, int p_150526_3_, int p_150526_4_) { BlockPos blockpos = new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_); -- Block block = worldIn.getBlockState(blockpos).getBlock(); -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos); +- Block block = p_150526_1_.func_180495_p(blockpos).func_177230_c(); ++ net.minecraft.block.state.IBlockState state = p_150526_1_.func_180495_p(blockpos); -- if (block.getMaterial() == Material.air) -+ if (state.getBlock().isAir(worldIn, blockpos)) +- if (block.func_149688_o() == Material.field_151579_a) ++ if (state.func_177230_c().isAir(p_150526_1_, blockpos)) { - this.func_175903_a(worldIn, blockpos, field_181641_b); + this.func_175903_a(p_150526_1_, blockpos, field_181641_b); } } + + //Just a helper macro + private void onPlantGrow(World world, BlockPos pos, BlockPos source) + { -+ world.getBlockState(pos).getBlock().onPlantGrow(world, pos, source); ++ world.func_180495_p(pos).func_177230_c().onPlantGrow(world, pos, source); + } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch index 7a7cd9a52..61253bc64 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch @@ -4,14 +4,14 @@ { Block block; -- while (((block = worldIn.getBlockState(p_180709_3_).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && p_180709_3_.getY() > 0) +- while (((block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c()).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && p_180709_3_.func_177956_o() > 0) + do { -+ block = worldIn.getBlockState(p_180709_3_).getBlock(); -+ if (!block.isLeaves(worldIn, p_180709_3_) && !block.isLeaves(worldIn, p_180709_3_)) break; - p_180709_3_ = p_180709_3_.down(); ++ block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c(); ++ if (!block.isLeaves(p_180709_1_, p_180709_3_) && !block.isLeaves(p_180709_1_, p_180709_3_)) break; + p_180709_3_ = p_180709_3_.func_177977_b(); - } -+ } while (p_180709_3_.getY() > 0); ++ } while (p_180709_3_.func_177956_o() > 0); for (int i = 0; i < 4; ++i) { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch index fe5d8f922..dd91af336 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch @@ -3,28 +3,28 @@ @@ -123,12 +123,11 @@ if (j3 == 1) { - worldIn.setBlockState(blockpos2, Blocks.chest.correctFacing(worldIn, blockpos2, Blocks.chest.getDefaultState()), 2); -- List list = WeightedRandomChestContent.func_177629_a(CHESTCONTENT, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_180709_2_)}); - TileEntity tileentity1 = worldIn.getTileEntity(blockpos2); + p_180709_1_.func_180501_a(blockpos2, Blocks.field_150486_ae.func_176458_f(p_180709_1_, blockpos2, Blocks.field_150486_ae.func_176223_P()), 2); +- List list = WeightedRandomChestContent.func_177629_a(field_175917_c, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_180709_2_)}); + TileEntity tileentity1 = p_180709_1_.func_175625_s(blockpos2); if (tileentity1 instanceof TileEntityChest) { -- WeightedRandomChestContent.generateChestContents(p_180709_2_, list, (TileEntityChest)tileentity1, 8); -+ WeightedRandomChestContent.generateChestContents(p_180709_2_, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST, p_180709_2_), (TileEntityChest)tileentity1, 8); +- WeightedRandomChestContent.func_177630_a(p_180709_2_, list, (TileEntityChest)tileentity1, 8); ++ WeightedRandomChestContent.func_177630_a(p_180709_2_, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST, p_180709_2_), (TileEntityChest)tileentity1, 8); } break; @@ -159,6 +158,12 @@ - private String pickMobSpawner(Random p_76543_1_) + private String func_76543_b(Random p_76543_1_) { -- return SPAWNERTYPES[p_76543_1_.nextInt(SPAWNERTYPES.length)]; +- return field_175916_b[p_76543_1_.nextInt(field_175916_b.length)]; + return net.minecraftforge.common.DungeonHooks.getRandomDungeonMob(p_76543_1_); } + + static + { -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST, CHESTCONTENT, 8, 8); -+ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST, field_175917_c, 8, 8); ++ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); + } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch index af707653c..9eca24df4 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch @@ -4,8 +4,8 @@ { if (j >= 0 && j < 256) { -- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(l, j, i1)).getBlock())) -+ if (!this.isReplaceable(worldIn, blockpos$mutableblockpos.func_181079_c(l, j, i1))) +- if (!this.func_150523_a(p_180709_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(l, j, i1)).func_177230_c())) ++ if (!this.isReplaceable(p_180709_1_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) { flag = false; } @@ -13,38 +13,38 @@ } else { -- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); -+ BlockPos down = p_180709_3_.down(); -+ Block block1 = worldIn.getBlockState(down).getBlock(); -+ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); +- Block block1 = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); ++ BlockPos down = p_180709_3_.func_177977_b(); ++ Block block1 = p_180709_1_.func_180495_p(down).func_177230_c(); ++ boolean isSoil = block1.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); -- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && p_180709_3_.getY() < 256 - i - 1) -+ if (isSoil && p_180709_3_.getY() < 256 - i - 1) +- if ((block1 == Blocks.field_150349_c || block1 == Blocks.field_150346_d || block1 == Blocks.field_150458_ak) && p_180709_3_.func_177956_o() < 256 - i - 1) ++ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) { -- this.func_175921_a(worldIn, p_180709_3_.down()); -+ block1.onPlantGrow(worldIn, down, p_180709_3_); +- this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); ++ block1.onPlantGrow(p_180709_1_, down, p_180709_3_); - for (int i2 = p_180709_3_.getY() - 3 + i; i2 <= p_180709_3_.getY() + i; ++i2) + for (int i2 = p_180709_3_.func_177956_o() - 3 + i; i2 <= p_180709_3_.func_177956_o() + i; ++i2) { @@ -101,7 +103,7 @@ BlockPos blockpos = new BlockPos(i3, i2, k1); - Block block = worldIn.getBlockState(blockpos).getBlock(); + Block block = p_180709_1_.func_180495_p(blockpos).func_177230_c(); -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos)) +- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) ++ if (block.isAir(p_180709_1_, blockpos) || block.isLeaves(p_180709_1_, blockpos)) { - this.func_175903_a(worldIn, blockpos, field_181630_b); + this.func_175903_a(p_180709_1_, blockpos, field_181630_b); } @@ -112,9 +114,9 @@ for (int j2 = 0; j2 < i; ++j2) { -- Block block2 = worldIn.getBlockState(p_180709_3_.up(j2)).getBlock(); +- Block block2 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(j2)).func_177230_c(); - -- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves) -+ BlockPos upN = p_180709_3_.up(j2); -+ Block block2 = worldIn.getBlockState(upN).getBlock(); -+ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN)) +- if (block2.func_149688_o() == Material.field_151579_a || block2.func_149688_o() == Material.field_151584_j) ++ BlockPos upN = p_180709_3_.func_177981_b(j2); ++ Block block2 = p_180709_1_.func_180495_p(upN).func_177230_c(); ++ if (block2.isAir(p_180709_1_, upN) || block2.isLeaves(p_180709_1_, upN)) { - this.func_175903_a(worldIn, p_180709_3_.up(j2), field_181629_a); + this.func_175903_a(p_180709_1_, p_180709_3_.func_177981_b(j2), field_181629_a); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch index 4cfafd4f6..16ea524eb 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch @@ -4,54 +4,54 @@ { for (int l = -j; l <= j && flag; ++l) { -- if (p_175926_2_.getY() + i < 0 || p_175926_2_.getY() + i >= 256 || !this.func_150523_a(worldIn.getBlockState(p_175926_2_.add(k, i, l)).getBlock())) -+ if (p_175926_2_.getY() + i < 0 || p_175926_2_.getY() + i >= 256 || !this.isReplaceable(worldIn,p_175926_2_.add(k, i, l))) +- if (p_175926_2_.func_177956_o() + i < 0 || p_175926_2_.func_177956_o() + i >= 256 || !this.func_150523_a(p_175926_1_.func_180495_p(p_175926_2_.func_177982_a(k, i, l)).func_177230_c())) ++ if (p_175926_2_.func_177956_o() + i < 0 || p_175926_2_.func_177956_o() + i >= 256 || !this.isReplaceable(p_175926_1_,p_175926_2_.func_177982_a(k, i, l))) { flag = false; } @@ -79,13 +79,14 @@ { - BlockPos blockpos = p_175927_1_.down(); - Block block = worldIn.getBlockState(blockpos).getBlock(); -+ boolean isSoil = block.canSustainPlant(worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); + BlockPos blockpos = p_175927_1_.func_177977_b(); + Block block = p_175927_2_.func_180495_p(blockpos).func_177230_c(); ++ boolean isSoil = block.canSustainPlant(p_175927_2_, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); -- if ((block == Blocks.grass || block == Blocks.dirt) && p_175927_1_.getY() >= 2) -+ if (isSoil && p_175927_1_.getY() >= 2) +- if ((block == Blocks.field_150349_c || block == Blocks.field_150346_d) && p_175927_1_.func_177956_o() >= 2) ++ if (isSoil && p_175927_1_.func_177956_o() >= 2) { -- this.func_175921_a(worldIn, blockpos); -- this.func_175921_a(worldIn, blockpos.east()); -- this.func_175921_a(worldIn, blockpos.south()); -- this.func_175921_a(worldIn, blockpos.south().east()); -+ this.onPlantGrow(worldIn, blockpos, p_175927_1_); -+ this.onPlantGrow(worldIn, blockpos.east(), p_175927_1_); -+ this.onPlantGrow(worldIn, blockpos.south(), p_175927_1_); -+ this.onPlantGrow(worldIn, blockpos.south().east(), p_175927_1_); +- this.func_175921_a(p_175927_2_, blockpos); +- this.func_175921_a(p_175927_2_, blockpos.func_177974_f()); +- this.func_175921_a(p_175927_2_, blockpos.func_177968_d()); +- this.func_175921_a(p_175927_2_, blockpos.func_177968_d().func_177974_f()); ++ this.onPlantGrow(p_175927_2_, blockpos, p_175927_1_); ++ this.onPlantGrow(p_175927_2_, blockpos.func_177974_f(), p_175927_1_); ++ this.onPlantGrow(p_175927_2_, blockpos.func_177968_d(), p_175927_1_); ++ this.onPlantGrow(p_175927_2_, blockpos.func_177968_d().func_177974_f(), p_175927_1_); return true; } else @@ -113,9 +114,9 @@ if (j * j + k * k <= i || l * l + i1 * i1 <= i || j * j + i1 * i1 <= i || l * l + k * k <= i) { - BlockPos blockpos = p_175925_2_.add(j, 0, k); -- Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial(); -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos); + BlockPos blockpos = p_175925_2_.func_177982_a(j, 0, k); +- Material material = p_175925_1_.func_180495_p(blockpos).func_177230_c().func_149688_o(); ++ net.minecraft.block.state.IBlockState state = p_175925_1_.func_180495_p(blockpos); -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(worldIn, blockpos) || state.getBlock().isLeaves(worldIn, blockpos)) +- if (material == Material.field_151579_a || material == Material.field_151584_j) ++ if (state.func_177230_c().isAir(p_175925_1_, blockpos) || state.func_177230_c().isLeaves(p_175925_1_, blockpos)) { - this.func_175903_a(worldIn, blockpos, this.leavesMetadata); + this.func_175903_a(p_175925_1_, blockpos, this.field_76521_c); } @@ -135,9 +136,9 @@ if (j * j + k * k <= i) { - BlockPos blockpos = p_175928_2_.add(j, 0, k); -- Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial(); -+ Block block = worldIn.getBlockState(blockpos).getBlock(); + BlockPos blockpos = p_175928_2_.func_177982_a(j, 0, k); +- Material material = p_175928_1_.func_180495_p(blockpos).func_177230_c().func_149688_o(); ++ Block block = p_175928_1_.func_180495_p(blockpos).func_177230_c(); -- if (material == Material.air || material == Material.leaves) -+ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos)) +- if (material == Material.field_151579_a || material == Material.field_151584_j) ++ if (block.isAir(p_175928_1_, blockpos) || block.isLeaves(p_175928_1_, blockpos)) { - this.func_175903_a(worldIn, blockpos, this.leavesMetadata); + this.func_175903_a(p_175928_1_, blockpos, this.field_76521_c); } @@ -145,4 +146,10 @@ } @@ -61,6 +61,6 @@ + //Just a helper macro + private void onPlantGrow(World world, BlockPos pos, BlockPos source) + { -+ world.getBlockState(pos).getBlock().onPlantGrow(world, pos, source); ++ world.func_180495_p(pos).func_177230_c().onPlantGrow(world, pos, source); + } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch index 4857ef044..6856a6cfc 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch @@ -2,49 +2,49 @@ +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java @@ -55,7 +55,7 @@ { - BlockPos blockpos = p_180709_3_.up(i2); + BlockPos blockpos = p_180709_3_.func_177981_b(i2); -- if (this.func_150523_a(worldIn.getBlockState(blockpos).getBlock())) -+ if (this.isAirLeaves(worldIn,blockpos)) +- if (this.func_150523_a(p_180709_1_.func_180495_p(blockpos).func_177230_c())) ++ if (this.isAirLeaves(p_180709_1_,blockpos)) { - this.func_175903_a(worldIn, blockpos, this.woodMetadata); + this.func_175903_a(p_180709_1_, blockpos, this.field_76520_b); @@ -70,7 +70,7 @@ { - BlockPos blockpos1 = blockpos.east(); + BlockPos blockpos1 = blockpos.func_177974_f(); -- if (this.func_150523_a(worldIn.getBlockState(blockpos1).getBlock())) -+ if (this.isAirLeaves(worldIn,blockpos1)) +- if (this.func_150523_a(p_180709_1_.func_180495_p(blockpos1).func_177230_c())) ++ if (this.isAirLeaves(p_180709_1_,blockpos1)) { - this.func_175903_a(worldIn, blockpos1, this.woodMetadata); + this.func_175903_a(p_180709_1_, blockpos1, this.field_76520_b); @@ -83,7 +83,7 @@ - BlockPos blockpos2 = blockpos.south().east(); + BlockPos blockpos2 = blockpos.func_177968_d().func_177974_f(); -- if (this.func_150523_a(worldIn.getBlockState(blockpos2).getBlock())) -+ if (this.isAirLeaves(worldIn,blockpos2)) +- if (this.func_150523_a(p_180709_1_.func_180495_p(blockpos2).func_177230_c())) ++ if (this.isAirLeaves(p_180709_1_,blockpos2)) { - this.func_175903_a(worldIn, blockpos2, this.woodMetadata); + this.func_175903_a(p_180709_1_, blockpos2, this.field_76520_b); @@ -96,7 +96,7 @@ - BlockPos blockpos3 = blockpos.south(); + BlockPos blockpos3 = blockpos.func_177968_d(); -- if (this.func_150523_a(worldIn.getBlockState(blockpos3).getBlock())) -+ if (this.isAirLeaves(worldIn,blockpos3)) +- if (this.func_150523_a(p_180709_1_.func_180495_p(blockpos3).func_177230_c())) ++ if (this.isAirLeaves(p_180709_1_,blockpos3)) { - this.func_175903_a(worldIn, blockpos3, this.woodMetadata); + this.func_175903_a(p_180709_1_, blockpos3, this.field_76520_b); @@ -130,4 +130,11 @@ - this.func_175925_a(worldIn, p_175930_2_.up(j), p_175930_3_ + 1 - j); + this.func_175925_a(p_175930_1_, p_175930_2_.func_177981_b(j), p_175930_3_ + 1 - j); } } + + //Helper macro + private boolean isAirLeaves(World world, BlockPos pos) + { -+ net.minecraft.block.Block block = world.getBlockState(pos).getBlock(); ++ net.minecraft.block.Block block = world.func_180495_p(pos).func_177230_c(); + return block.isAir(world, pos) || block.isLeaves(world, pos); + } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch index e4b20bc16..f658ebfe6 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch @@ -2,52 +2,52 @@ +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java @@ -43,30 +43,24 @@ { - Block block = worldIn.getBlockState(p_180709_3_.up(j)).getBlock(); + Block block = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(j)).func_177230_c(); -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (isAirLeaves(worldIn,p_180709_3_.up(j))) +- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) ++ if (isAirLeaves(p_180709_1_,p_180709_3_.func_177981_b(j))) { - this.func_175903_a(worldIn, p_180709_3_.up(j), this.woodMetadata); + this.func_175903_a(p_180709_1_, p_180709_3_.func_177981_b(j), this.field_76520_b); } if (j < i - 1) { -- block = worldIn.getBlockState(p_180709_3_.add(1, j, 0)).getBlock(); +- block = p_180709_1_.func_180495_p(p_180709_3_.func_177982_a(1, j, 0)).func_177230_c(); - -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (isAirLeaves(worldIn,p_180709_3_.add(1, j, 0))) +- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) ++ if (isAirLeaves(p_180709_1_,p_180709_3_.func_177982_a(1, j, 0))) { - this.func_175903_a(worldIn, p_180709_3_.add(1, j, 0), this.woodMetadata); + this.func_175903_a(p_180709_1_, p_180709_3_.func_177982_a(1, j, 0), this.field_76520_b); } -- block = worldIn.getBlockState(p_180709_3_.add(1, j, 1)).getBlock(); +- block = p_180709_1_.func_180495_p(p_180709_3_.func_177982_a(1, j, 1)).func_177230_c(); - -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (isAirLeaves(worldIn,p_180709_3_.add(1, j, 1))) +- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) ++ if (isAirLeaves(p_180709_1_,p_180709_3_.func_177982_a(1, j, 1))) { - this.func_175903_a(worldIn, p_180709_3_.add(1, j, 1), this.woodMetadata); + this.func_175903_a(p_180709_1_, p_180709_3_.func_177982_a(1, j, 1), this.field_76520_b); } -- block = worldIn.getBlockState(p_180709_3_.add(0, j, 1)).getBlock(); +- block = p_180709_1_.func_180495_p(p_180709_3_.func_177982_a(0, j, 1)).func_177230_c(); - -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (isAirLeaves(worldIn,p_180709_3_.add(0, j, 1))) +- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) ++ if (isAirLeaves(p_180709_1_,p_180709_3_.func_177982_a(0, j, 1))) { - this.func_175903_a(worldIn, p_180709_3_.add(0, j, 1), this.woodMetadata); + this.func_175903_a(p_180709_1_, p_180709_3_.func_177982_a(0, j, 1), this.field_76520_b); } @@ -132,16 +126,23 @@ - BlockPos blockpos = p_175934_2_.up(i); - Block block = worldIn.getBlockState(blockpos).getBlock(); + BlockPos blockpos = p_175934_2_.func_177981_b(i); + Block block = p_175934_1_.func_180495_p(blockpos).func_177230_c(); -- if (block == Blocks.grass || block == Blocks.dirt) -+ if (block.canSustainPlant(worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) +- if (block == Blocks.field_150349_c || block == Blocks.field_150346_d) ++ if (block.canSustainPlant(p_175934_1_, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g))) { - this.func_175903_a(worldIn, blockpos, field_181635_g); + this.func_175903_a(p_175934_1_, blockpos, field_181635_g); break; } -- if (block.getMaterial() != Material.air && i < 0) -+ if (!block.isAir(worldIn, blockpos) && i < 0) +- if (block.func_149688_o() != Material.field_151579_a && i < 0) ++ if (!block.isAir(p_175934_1_, blockpos) && i < 0) { break; } @@ -57,7 +57,7 @@ + //Helper macro + private boolean isAirLeaves(World world, BlockPos pos) + { -+ net.minecraft.block.Block block = world.getBlockState(pos).getBlock(); ++ net.minecraft.block.Block block = world.func_180495_p(pos).func_177230_c(); + return block.isAir(world, pos) || block.isLeaves(world, pos); + } } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch index dd22281dd..b3aef2aae 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch @@ -4,8 +4,8 @@ { BlockPos blockpos = new BlockPos(l1, i2, j2); -- if (this.field_175919_c.apply(worldIn.getBlockState(blockpos))) -+ if (worldIn.getBlockState(blockpos).getBlock().isReplaceableOreGen(worldIn, blockpos, this.field_175919_c)) +- if (this.field_175919_c.apply(p_180709_1_.func_180495_p(blockpos))) ++ if (p_180709_1_.func_180495_p(blockpos).func_177230_c().isReplaceableOreGen(p_180709_1_, blockpos, this.field_175919_c)) { - worldIn.setBlockState(blockpos, this.oreBlock, 2); + p_180709_1_.func_180501_a(blockpos, this.field_175920_a, 2); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch index 2e8a83dcd..105b15ca4 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch @@ -4,8 +4,8 @@ { if (j >= 0 && j < 256) { -- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(l, j, i1)).getBlock())) -+ if (!this.isReplaceable(worldIn,blockpos$mutableblockpos.func_181079_c(l, j, i1))) +- if (!this.func_150523_a(p_180709_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(l, j, i1)).func_177230_c())) ++ if (!this.isReplaceable(p_180709_1_,blockpos$mutableblockpos.func_181079_c(l, j, i1))) { flag = false; } @@ -13,52 +13,52 @@ } else { -- Block block = worldIn.getBlockState(p_180709_3_.down()).getBlock(); -+ BlockPos down = p_180709_3_.down(); -+ Block block = worldIn.getBlockState(down).getBlock(); -+ boolean isSoil = block.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); +- Block block = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); ++ BlockPos down = p_180709_3_.func_177977_b(); ++ Block block = p_180709_1_.func_180495_p(down).func_177230_c(); ++ boolean isSoil = block.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); -- if ((block == Blocks.grass || block == Blocks.dirt) && p_180709_3_.getY() < 256 - i - 1) -+ if (isSoil && p_180709_3_.getY() < 256 - i - 1) +- if ((block == Blocks.field_150349_c || block == Blocks.field_150346_d) && p_180709_3_.func_177956_o() < 256 - i - 1) ++ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) { -- this.func_175921_a(worldIn, p_180709_3_.down()); -+ block.onPlantGrow(worldIn, down, p_180709_3_); - EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(p_180709_2_); +- this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); ++ block.onPlantGrow(p_180709_1_, down, p_180709_3_); + EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.func_179518_a(p_180709_2_); int k2 = i - p_180709_2_.nextInt(4) - 1; int l2 = 3 - p_180709_2_.nextInt(3); @@ -95,9 +97,9 @@ } BlockPos blockpos = new BlockPos(i3, i2, j1); -- Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial(); -+ block = worldIn.getBlockState(blockpos).getBlock(); +- Material material = p_180709_1_.func_180495_p(blockpos).func_177230_c().func_149688_o(); ++ block = p_180709_1_.func_180495_p(blockpos).func_177230_c(); -- if (material == Material.air || material == Material.leaves) -+ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos)) +- if (material == Material.field_151579_a || material == Material.field_151584_j) ++ if (block.isAir(p_180709_1_, blockpos) || block.isLeaves(p_180709_1_, blockpos)) { - this.func_181642_b(worldIn, blockpos); + this.func_181642_b(p_180709_1_, blockpos); k1 = i2; @@ -149,9 +151,9 @@ - i3 += enumfacing1.getFrontOffsetX(); - j1 += enumfacing1.getFrontOffsetZ(); + i3 += enumfacing1.func_82601_c(); + j1 += enumfacing1.func_82599_e(); BlockPos blockpos1 = new BlockPos(i3, j2, j1); -- Material material1 = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); -+ block = worldIn.getBlockState(blockpos1).getBlock(); +- Material material1 = p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149688_o(); ++ block = p_180709_1_.func_180495_p(blockpos1).func_177230_c(); -- if (material1 == Material.air || material1 == Material.leaves) -+ if (block.isAir(worldIn, blockpos2) || block.isLeaves(worldIn, blockpos2)) +- if (material1 == Material.field_151579_a || material1 == Material.field_151584_j) ++ if (block.isAir(p_180709_1_, blockpos2) || block.isLeaves(p_180709_1_, blockpos2)) { - this.func_181642_b(worldIn, blockpos1); + this.func_181642_b(p_180709_1_, blockpos1); k1 = j2; @@ -209,9 +211,9 @@ - private void func_175924_b(World worldIn, BlockPos p_175924_2_) + private void func_175924_b(World p_175924_1_, BlockPos p_175924_2_) { -- Material material = worldIn.getBlockState(p_175924_2_).getBlock().getMaterial(); -+ Block block = worldIn.getBlockState(p_175924_2_).getBlock(); +- Material material = p_175924_1_.func_180495_p(p_175924_2_).func_177230_c().func_149688_o(); ++ Block block = p_175924_1_.func_180495_p(p_175924_2_).func_177230_c(); -- if (material == Material.air || material == Material.leaves) -+ if (block.isAir(worldIn, p_175924_2_) || block.isLeaves(worldIn, p_175924_2_)) +- if (material == Material.field_151579_a || material == Material.field_151584_j) ++ if (block.isAir(p_175924_1_, p_175924_2_) || block.isLeaves(p_175924_1_, p_175924_2_)) { - this.func_175903_a(worldIn, p_175924_2_, field_181644_b); + this.func_175903_a(p_175924_1_, p_175924_2_, field_181644_b); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch index 30cd89004..70f640f5f 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch @@ -4,28 +4,28 @@ { Block block; -- while (((block = worldIn.getBlockState(p_180709_3_).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && p_180709_3_.getY() > 0) +- while (((block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c()).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && p_180709_3_.func_177956_o() > 0) + do { -+ block = worldIn.getBlockState(p_180709_3_).getBlock(); -+ if (!block.isAir(worldIn, p_180709_3_) && !block.isLeaves(worldIn, p_180709_3_)) break; - p_180709_3_ = p_180709_3_.down(); ++ block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c(); ++ if (!block.isAir(p_180709_1_, p_180709_3_) && !block.isLeaves(p_180709_1_, p_180709_3_)) break; + p_180709_3_ = p_180709_3_.func_177977_b(); - } -+ } while (p_180709_3_.getY() > 0); ++ } while (p_180709_3_.func_177956_o() > 0); - Block block1 = worldIn.getBlockState(p_180709_3_).getBlock(); + Block block1 = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c(); -- if (block1 == Blocks.dirt || block1 == Blocks.grass) -+ if (block1.canSustainPlant(worldIn, p_180709_3_, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) +- if (block1 == Blocks.field_150346_d || block1 == Blocks.field_150349_c) ++ if (block1.canSustainPlant(p_180709_1_, p_180709_3_, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g))) { - p_180709_3_ = p_180709_3_.up(); - this.func_175903_a(worldIn, p_180709_3_, this.field_150527_b); + p_180709_3_ = p_180709_3_.func_177984_a(); + this.func_175903_a(p_180709_1_, p_180709_3_, this.field_150527_b); @@ -53,7 +55,7 @@ { BlockPos blockpos = new BlockPos(l, i, j1); -- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) -+ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) +- if (!p_180709_1_.func_180495_p(blockpos).func_177230_c().func_149730_j()) ++ if (p_180709_1_.func_180495_p(blockpos).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos)) { - this.func_175903_a(worldIn, blockpos, this.field_150528_a); + this.func_175903_a(p_180709_1_, blockpos, this.field_150528_a); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch index 746094c2a..03b98a6c0 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch @@ -2,93 +2,93 @@ +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java @@ -60,7 +60,7 @@ { - Block block = worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(l, j, i1)).getBlock(); + Block block = p_180709_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(l, j, i1)).func_177230_c(); -- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) -+ if (!block.isAir(worldIn, blockpos$mutableblockpos.func_181079_c(l, j, i1)) && !block.isLeaves(worldIn, blockpos$mutableblockpos.func_181079_c(l, j, i1))) +- if (block.func_149688_o() != Material.field_151579_a && block.func_149688_o() != Material.field_151584_j) ++ if (!block.isAir(p_180709_1_, blockpos$mutableblockpos.func_181079_c(l, j, i1)) && !block.isLeaves(p_180709_1_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) { - if (block != Blocks.water && block != Blocks.flowing_water) + if (block != Blocks.field_150355_j && block != Blocks.field_150358_i) { @@ -86,11 +86,13 @@ } else { -- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); -+ BlockPos down = p_180709_3_.down(); -+ Block block1 = worldIn.getBlockState(down).getBlock(); -+ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); +- Block block1 = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); ++ BlockPos down = p_180709_3_.func_177977_b(); ++ Block block1 = p_180709_1_.func_180495_p(down).func_177230_c(); ++ boolean isSoil = block1.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.field_150345_g)); -- if ((block1 == Blocks.grass || block1 == Blocks.dirt) && p_180709_3_.getY() < 256 - i - 1) -+ if (isSoil && p_180709_3_.getY() < 256 - i - 1) +- if ((block1 == Blocks.field_150349_c || block1 == Blocks.field_150346_d) && p_180709_3_.func_177956_o() < 256 - i - 1) ++ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) { -- this.func_175921_a(worldIn, p_180709_3_.down()); -+ block1.onPlantGrow(worldIn, p_180709_3_.down(),p_180709_3_); +- this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); ++ block1.onPlantGrow(p_180709_1_, p_180709_3_.func_177977_b(),p_180709_3_); - for (int l1 = p_180709_3_.getY() - 3 + i; l1 <= p_180709_3_.getY() + i; ++l1) + for (int l1 = p_180709_3_.func_177956_o() - 3 + i; l1 <= p_180709_3_.func_177956_o() + i; ++l1) { @@ -109,7 +111,7 @@ { BlockPos blockpos = new BlockPos(k3, l1, j1); -- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) -+ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) +- if (!p_180709_1_.func_180495_p(blockpos).func_177230_c().func_149730_j()) ++ if (p_180709_1_.func_180495_p(blockpos).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos)) { - this.func_175903_a(worldIn, blockpos, field_181649_b); + this.func_175903_a(p_180709_1_, blockpos, field_181649_b); } @@ -120,9 +122,10 @@ for (int i2 = 0; i2 < i; ++i2) { -- Block block2 = worldIn.getBlockState(p_180709_3_.up(i2)).getBlock(); -+ BlockPos upN = p_180709_3_.up(i2); -+ Block block2 = worldIn.getBlockState(upN).getBlock(); +- Block block2 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(i2)).func_177230_c(); ++ BlockPos upN = p_180709_3_.func_177981_b(i2); ++ Block block2 = p_180709_1_.func_180495_p(upN).func_177230_c(); -- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves || block2 == Blocks.flowing_water || block2 == Blocks.water) -+ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN) || block2 == Blocks.flowing_water || block2 == Blocks.water) +- if (block2.func_149688_o() == Material.field_151579_a || block2.func_149688_o() == Material.field_151584_j || block2 == Blocks.field_150358_i || block2 == Blocks.field_150355_j) ++ if (block2.isAir(p_180709_1_, upN) || block2.isLeaves(p_180709_1_, upN) || block2 == Blocks.field_150358_i || block2 == Blocks.field_150355_j) { - this.func_175903_a(worldIn, p_180709_3_.up(i2), field_181648_a); + this.func_175903_a(p_180709_1_, p_180709_3_.func_177981_b(i2), field_181648_a); } @@ -140,29 +143,29 @@ { blockpos$mutableblockpos1.func_181079_c(i4, j2, j4); -- if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().getMaterial() == Material.leaves) -+ if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().isLeaves(worldIn, blockpos$mutableblockpos1)) +- if (p_180709_1_.func_180495_p(blockpos$mutableblockpos1).func_177230_c().func_149688_o() == Material.field_151584_j) ++ if (p_180709_1_.func_180495_p(blockpos$mutableblockpos1).func_177230_c().isLeaves(p_180709_1_, blockpos$mutableblockpos1)) { - BlockPos blockpos3 = blockpos$mutableblockpos1.west(); - BlockPos blockpos4 = blockpos$mutableblockpos1.east(); - BlockPos blockpos1 = blockpos$mutableblockpos1.north(); - BlockPos blockpos2 = blockpos$mutableblockpos1.south(); + BlockPos blockpos3 = blockpos$mutableblockpos1.func_177976_e(); + BlockPos blockpos4 = blockpos$mutableblockpos1.func_177974_f(); + BlockPos blockpos1 = blockpos$mutableblockpos1.func_177978_c(); + BlockPos blockpos2 = blockpos$mutableblockpos1.func_177968_d(); -- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().isAir(worldIn,blockpos3)) +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos3).func_177230_c().func_149688_o() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos3).func_177230_c().isAir(p_180709_1_,blockpos3)) { - this.func_181647_a(worldIn, blockpos3, BlockVine.EAST); + this.func_181647_a(p_180709_1_, blockpos3, BlockVine.field_176278_M); } -- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().isAir(worldIn,blockpos4)) +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos4).func_177230_c().func_149688_o() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos4).func_177230_c().isAir(p_180709_1_,blockpos4)) { - this.func_181647_a(worldIn, blockpos4, BlockVine.WEST); + this.func_181647_a(p_180709_1_, blockpos4, BlockVine.field_176280_O); } -- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().isAir(worldIn,blockpos1)) +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149688_o() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos1).func_177230_c().isAir(p_180709_1_,blockpos1)) { - this.func_181647_a(worldIn, blockpos1, BlockVine.SOUTH); + this.func_181647_a(p_180709_1_, blockpos1, BlockVine.field_176279_N); } -- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().isAir(worldIn,blockpos2)) +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos2).func_177230_c().func_149688_o() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos2).func_177230_c().isAir(p_180709_1_,blockpos2)) { - this.func_181647_a(worldIn, blockpos2, BlockVine.NORTH); + this.func_181647_a(p_180709_1_, blockpos2, BlockVine.field_176273_b); } @@ -191,7 +194,7 @@ this.func_175903_a(p_181647_1_, p_181647_2_, iblockstate); int i = 4; -- for (p_181647_2_ = p_181647_2_.down(); p_181647_1_.getBlockState(p_181647_2_).getBlock().getMaterial() == Material.air && i > 0; --i) -+ for (p_181647_2_ = p_181647_2_.down(); p_181647_1_.getBlockState(p_181647_2_).getBlock().isAir(p_181647_1_,p_181647_2_) && i > 0; --i) +- for (p_181647_2_ = p_181647_2_.func_177977_b(); p_181647_1_.func_180495_p(p_181647_2_).func_177230_c().func_149688_o() == Material.field_151579_a && i > 0; --i) ++ for (p_181647_2_ = p_181647_2_.func_177977_b(); p_181647_1_.func_180495_p(p_181647_2_).func_177230_c().isAir(p_181647_1_,p_181647_2_) && i > 0; --i) { this.func_175903_a(p_181647_1_, p_181647_2_, iblockstate); - p_181647_2_ = p_181647_2_.down(); + p_181647_2_ = p_181647_2_.func_177977_b(); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch index 22900fea0..0303f2295 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch @@ -4,8 +4,8 @@ { if (i1 >= 0 && i1 < 256) { -- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, i1, l1)).getBlock())) -+ if (!this.isReplaceable(worldIn,blockpos$mutableblockpos.func_181079_c(k1, i1, l1))) +- if (!this.func_150523_a(p_180709_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(k1, i1, l1)).func_177230_c())) ++ if (!this.isReplaceable(p_180709_1_,blockpos$mutableblockpos.func_181079_c(k1, i1, l1))) { flag = false; } @@ -13,38 +13,38 @@ } else { -- Block block = worldIn.getBlockState(p_180709_3_.down()).getBlock(); -+ BlockPos down = p_180709_3_.down(); -+ Block block = worldIn.getBlockState(down).getBlock(); -+ boolean isSoil = block.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); +- Block block = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); ++ BlockPos down = p_180709_3_.func_177977_b(); ++ Block block = p_180709_1_.func_180495_p(down).func_177230_c(); ++ boolean isSoil = block.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_150345_g); -- if ((block == Blocks.grass || block == Blocks.dirt) && p_180709_3_.getY() < 256 - i - 1) -+ if (isSoil && p_180709_3_.getY() < 256 - i - 1) +- if ((block == Blocks.field_150349_c || block == Blocks.field_150346_d) && p_180709_3_.func_177956_o() < 256 - i - 1) ++ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) { -- this.func_175921_a(worldIn, p_180709_3_.down()); -+ block.onPlantGrow(worldIn, down, p_180709_3_); +- this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); ++ block.onPlantGrow(p_180709_1_, down, p_180709_3_); int k2 = 0; - for (int l2 = p_180709_3_.getY() + i; l2 >= p_180709_3_.getY() + j; --l2) + for (int l2 = p_180709_3_.func_177956_o() + i; l2 >= p_180709_3_.func_177956_o() + j; --l2) @@ -93,7 +95,7 @@ { BlockPos blockpos = new BlockPos(j3, l2, i2); -- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) -+ if (!worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) +- if (!p_180709_1_.func_180495_p(blockpos).func_177230_c().func_149730_j()) ++ if (!p_180709_1_.func_180495_p(blockpos).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos)) { - this.func_175903_a(worldIn, blockpos, field_181637_b); + this.func_175903_a(p_180709_1_, blockpos, field_181637_b); } @@ -113,9 +115,10 @@ for (int i3 = 0; i3 < i - 1; ++i3) { -- Block block1 = worldIn.getBlockState(p_180709_3_.up(i3)).getBlock(); -+ BlockPos upN = p_180709_3_.up(i3); -+ Block block1 = worldIn.getBlockState(upN).getBlock(); +- Block block1 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(i3)).func_177230_c(); ++ BlockPos upN = p_180709_3_.func_177981_b(i3); ++ Block block1 = p_180709_1_.func_180495_p(upN).func_177230_c(); -- if (block1.getMaterial() == Material.air || block1.getMaterial() == Material.leaves) -+ if (block1.isAir(worldIn, upN) || block1.isLeaves(worldIn, upN)) +- if (block1.func_149688_o() == Material.field_151579_a || block1.func_149688_o() == Material.field_151584_j) ++ if (block1.isAir(p_180709_1_, upN) || block1.isLeaves(p_180709_1_, upN)) { - this.func_175903_a(worldIn, p_180709_3_.up(i3), field_181636_a); + this.func_175903_a(p_180709_1_, p_180709_3_.func_177981_b(i3), field_181636_a); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch index d52f8a4e0..322b90715 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch @@ -2,10 +2,10 @@ +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java @@ -55,7 +55,7 @@ { - Block block = worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, i1, l1)).getBlock(); + Block block = p_180709_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(k1, i1, l1)).func_177230_c(); -- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) -+ if (block.isAir(worldIn, blockpos$mutableblockpos) && !block.isLeaves(worldIn, blockpos$mutableblockpos)) +- if (block.func_149688_o() != Material.field_151579_a && block.func_149688_o() != Material.field_151584_j) ++ if (block.isAir(p_180709_1_, blockpos$mutableblockpos) && !block.isLeaves(p_180709_1_, blockpos$mutableblockpos)) { flag = false; } @@ -13,16 +13,16 @@ } else { -- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); -+ BlockPos down = p_180709_3_.down(); -+ Block block1 = worldIn.getBlockState(down).getBlock(); -+ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); +- Block block1 = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); ++ BlockPos down = p_180709_3_.func_177977_b(); ++ Block block1 = p_180709_1_.func_180495_p(down).func_177230_c(); ++ boolean isSoil = block1.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_150345_g); -- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && p_180709_3_.getY() < 256 - i - 1) -+ if (isSoil && p_180709_3_.getY() < 256 - i - 1) +- if ((block1 == Blocks.field_150349_c || block1 == Blocks.field_150346_d || block1 == Blocks.field_150458_ak) && p_180709_3_.func_177956_o() < 256 - i - 1) ++ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) { -- this.func_175921_a(worldIn, p_180709_3_.down()); -+ block1.onPlantGrow(worldIn, down, p_180709_3_); +- this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); ++ block1.onPlantGrow(p_180709_1_, down, p_180709_3_); int i3 = p_180709_2_.nextInt(2); int j3 = 1; int k3 = 0; @@ -30,21 +30,21 @@ { BlockPos blockpos = new BlockPos(i2, j4, k2); -- if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) -+ if (worldIn.getBlockState(blockpos).getBlock().canBeReplacedByLeaves(worldIn, blockpos)) +- if (!p_180709_1_.func_180495_p(blockpos).func_177230_c().func_149730_j()) ++ if (p_180709_1_.func_180495_p(blockpos).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos)) { - this.func_175903_a(worldIn, blockpos, field_181646_b); + this.func_175903_a(p_180709_1_, blockpos, field_181646_b); } @@ -128,9 +130,10 @@ for (int k4 = 0; k4 < i - i4; ++k4) { -- Block block2 = worldIn.getBlockState(p_180709_3_.up(k4)).getBlock(); -+ BlockPos upN = p_180709_3_.up(k4); -+ Block block2 = worldIn.getBlockState(upN).getBlock(); +- Block block2 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(k4)).func_177230_c(); ++ BlockPos upN = p_180709_3_.func_177981_b(k4); ++ Block block2 = p_180709_1_.func_180495_p(upN).func_177230_c(); -- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves) -+ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN)) +- if (block2.func_149688_o() == Material.field_151579_a || block2.func_149688_o() == Material.field_151584_j) ++ if (block2.isAir(p_180709_1_, upN) || block2.isLeaves(p_180709_1_, upN)) { - this.func_175903_a(worldIn, p_180709_3_.up(k4), field_181645_a); + this.func_175903_a(p_180709_1_, p_180709_3_.func_177981_b(k4), field_181645_a); } diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch index 11a61b3ab..40233c4b2 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch @@ -4,14 +4,14 @@ { Block block; -- while (((block = worldIn.getBlockState(p_180709_3_).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && p_180709_3_.getY() > 0) +- while (((block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c()).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && p_180709_3_.func_177956_o() > 0) + do { -+ block = worldIn.getBlockState(p_180709_3_).getBlock(); -+ if (!block.isAir(worldIn, p_180709_3_) && !block.isLeaves(worldIn, p_180709_3_)) break; - p_180709_3_ = p_180709_3_.down(); ++ block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c(); ++ if (!block.isAir(p_180709_1_, p_180709_3_) && !block.isLeaves(p_180709_1_, p_180709_3_)) break; + p_180709_3_ = p_180709_3_.func_177977_b(); - } -+ } while (p_180709_3_.getY() > 0); ++ } while (p_180709_3_.func_177956_o() > 0); for (int i = 0; i < 128; ++i) { diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch index 50df160cc..74c9c1445 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch @@ -4,8 +4,8 @@ { if (j >= 0 && j < 256) { -- if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(l, j, i1)).getBlock())) -+ if (!this.isReplaceable(worldIn,blockpos$mutableblockpos.func_181079_c(l, j, i1))) +- if (!this.func_150523_a(p_180709_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(l, j, i1)).func_177230_c())) ++ if (!this.isReplaceable(p_180709_1_,blockpos$mutableblockpos.func_181079_c(l, j, i1))) { flag = false; } @@ -13,82 +13,82 @@ } else { -- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); -+ BlockPos down = p_180709_3_.down(); -+ Block block1 = worldIn.getBlockState(down).getBlock(); -+ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); +- Block block1 = p_180709_1_.func_180495_p(p_180709_3_.func_177977_b()).func_177230_c(); ++ BlockPos down = p_180709_3_.func_177977_b(); ++ Block block1 = p_180709_1_.func_180495_p(down).func_177230_c(); ++ boolean isSoil = block1.canSustainPlant(p_180709_1_, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.field_150345_g); -- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && p_180709_3_.getY() < 256 - i - 1) -+ if (isSoil && p_180709_3_.getY() < 256 - i - 1) +- if ((block1 == Blocks.field_150349_c || block1 == Blocks.field_150346_d || block1 == Blocks.field_150458_ak) && p_180709_3_.func_177956_o() < 256 - i - 1) ++ if (isSoil && p_180709_3_.func_177956_o() < 256 - i - 1) { -- this.func_175921_a(worldIn, p_180709_3_.down()); -+ block1.onPlantGrow(worldIn, down, p_180709_3_); +- this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); ++ block1.onPlantGrow(p_180709_1_, down, p_180709_3_); int k2 = 3; int l2 = 0; @@ -113,7 +115,7 @@ BlockPos blockpos = new BlockPos(k1, i3, i2); - Block block = worldIn.getBlockState(blockpos).getBlock(); + Block block = p_180709_1_.func_180495_p(blockpos).func_177230_c(); -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves || block.getMaterial() == Material.vine) -+ if (block.isAir(worldIn, blockpos) || block.isLeaves(worldIn, blockpos) || block.getMaterial() == Material.vine) +- if (block.func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j || block.func_149688_o() == Material.field_151582_l) ++ if (block.isAir(p_180709_1_, blockpos) || block.isLeaves(p_180709_1_, blockpos) || block.func_149688_o() == Material.field_151582_l) { - this.func_175903_a(worldIn, blockpos, this.metaLeaves); + this.func_175903_a(p_180709_1_, blockpos, this.field_76530_d); } @@ -124,9 +126,10 @@ for (int j3 = 0; j3 < i; ++j3) { -- Block block2 = worldIn.getBlockState(p_180709_3_.up(j3)).getBlock(); -+ BlockPos upN = p_180709_3_.up(j3); -+ Block block2 = worldIn.getBlockState(upN).getBlock(); +- Block block2 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(j3)).func_177230_c(); ++ BlockPos upN = p_180709_3_.func_177981_b(j3); ++ Block block2 = p_180709_1_.func_180495_p(upN).func_177230_c(); -- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves || block2.getMaterial() == Material.vine) -+ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN) || block2.getMaterial() == Material.vine) +- if (block2.func_149688_o() == Material.field_151579_a || block2.func_149688_o() == Material.field_151584_j || block2.func_149688_o() == Material.field_151582_l) ++ if (block2.isAir(p_180709_1_, upN) || block2.isLeaves(p_180709_1_, upN) || block2.func_149688_o() == Material.field_151582_l) { - this.func_175903_a(worldIn, p_180709_3_.up(j3), this.metaWood); + this.func_175903_a(p_180709_1_, p_180709_3_.func_177981_b(j3), this.field_76532_c); @@ -169,29 +172,29 @@ { blockpos$mutableblockpos1.func_181079_c(l4, k3, i5); -- if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().getMaterial() == Material.leaves) -+ if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().isLeaves(worldIn,blockpos$mutableblockpos1)) +- if (p_180709_1_.func_180495_p(blockpos$mutableblockpos1).func_177230_c().func_149688_o() == Material.field_151584_j) ++ if (p_180709_1_.func_180495_p(blockpos$mutableblockpos1).func_177230_c().isLeaves(p_180709_1_,blockpos$mutableblockpos1)) { - BlockPos blockpos2 = blockpos$mutableblockpos1.west(); - BlockPos blockpos3 = blockpos$mutableblockpos1.east(); - BlockPos blockpos4 = blockpos$mutableblockpos1.north(); - BlockPos blockpos1 = blockpos$mutableblockpos1.south(); + BlockPos blockpos2 = blockpos$mutableblockpos1.func_177976_e(); + BlockPos blockpos3 = blockpos$mutableblockpos1.func_177974_f(); + BlockPos blockpos4 = blockpos$mutableblockpos1.func_177978_c(); + BlockPos blockpos1 = blockpos$mutableblockpos1.func_177968_d(); -- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().isAir(worldIn,blockpos2)) +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos2).func_177230_c().func_149688_o() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos2).func_177230_c().isAir(p_180709_1_,blockpos2)) { - this.func_181650_b(worldIn, blockpos2, BlockVine.EAST); + this.func_181650_b(p_180709_1_, blockpos2, BlockVine.field_176278_M); } -- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().isAir(worldIn,blockpos3)) +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos3).func_177230_c().func_149688_o() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos3).func_177230_c().isAir(p_180709_1_,blockpos3)) { - this.func_181650_b(worldIn, blockpos3, BlockVine.WEST); + this.func_181650_b(p_180709_1_, blockpos3, BlockVine.field_176280_O); } -- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().isAir(worldIn,blockpos4)) +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos4).func_177230_c().func_149688_o() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos4).func_177230_c().isAir(p_180709_1_,blockpos4)) { - this.func_181650_b(worldIn, blockpos4, BlockVine.SOUTH); + this.func_181650_b(p_180709_1_, blockpos4, BlockVine.field_176279_N); } -- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().isAir(worldIn,blockpos1)) +- if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos1).func_177230_c().func_149688_o() == Material.field_151579_a) ++ if (p_180709_2_.nextInt(4) == 0 && p_180709_1_.func_180495_p(blockpos1).func_177230_c().isAir(p_180709_1_,blockpos1)) { - this.func_181650_b(worldIn, blockpos1, BlockVine.NORTH); + this.func_181650_b(p_180709_1_, blockpos1, BlockVine.field_176273_b); } @@ -245,7 +248,7 @@ this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); int i = 4; -- for (p_181650_2_ = p_181650_2_.down(); p_181650_1_.getBlockState(p_181650_2_).getBlock().getMaterial() == Material.air && i > 0; --i) -+ for (p_181650_2_ = p_181650_2_.down(); p_181650_1_.getBlockState(p_181650_2_).getBlock().isAir(p_181650_1_,p_181650_2_) && i > 0; --i) +- for (p_181650_2_ = p_181650_2_.func_177977_b(); p_181650_1_.func_180495_p(p_181650_2_).func_177230_c().func_149688_o() == Material.field_151579_a && i > 0; --i) ++ for (p_181650_2_ = p_181650_2_.func_177977_b(); p_181650_1_.func_180495_p(p_181650_2_).func_177230_c().isAir(p_181650_1_,p_181650_2_) && i > 0; --i) { this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); - p_181650_2_ = p_181650_2_.down(); + p_181650_2_ = p_181650_2_.func_177977_b(); diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch index 3eba1fe80..79027d1db 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch @@ -4,14 +4,14 @@ { Block block; -- while (((block = worldIn.getBlockState(p_180709_3_).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && p_180709_3_.getY() > 1) +- while (((block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c()).func_149688_o() == Material.field_151579_a || block.func_149688_o() == Material.field_151584_j) && p_180709_3_.func_177956_o() > 1) + do { -+ block = worldIn.getBlockState(p_180709_3_).getBlock(); -+ if (!block.isAir(worldIn, p_180709_3_) && !block.isLeaves(worldIn, p_180709_3_)) break; - p_180709_3_ = p_180709_3_.down(); ++ block = p_180709_1_.func_180495_p(p_180709_3_).func_177230_c(); ++ if (!block.isAir(p_180709_1_, p_180709_3_) && !block.isLeaves(p_180709_1_, p_180709_3_)) break; + p_180709_3_ = p_180709_3_.func_177977_b(); - } -+ } while (p_180709_3_.getY() > 0); ++ } while (p_180709_3_.func_177956_o() > 0); - if (p_180709_3_.getY() < 1) + if (p_180709_3_.func_177956_o() < 1) { diff --git a/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch b/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch index e3a76dd0b..39466c0ff 100644 --- a/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch @@ -6,42 +6,42 @@ + i = getModdedBiomeSize(p_180781_2_, j); + - GenLayer lvt_8_1_ = GenLayerZoom.magnify(1000L, genlayer4, 0); + GenLayer lvt_8_1_ = GenLayerZoom.func_75915_a(1000L, genlayer4, 0); GenLayerRiverInit genlayerriverinit = new GenLayerRiverInit(100L, lvt_8_1_); - GenLayerBiome lvt_9_1_ = new GenLayerBiome(200L, genlayer4, p_180781_2_, p_180781_3_); -- GenLayer genlayer6 = GenLayerZoom.magnify(1000L, lvt_9_1_, 2); +- GenLayer genlayer6 = GenLayerZoom.func_75915_a(1000L, lvt_9_1_, 2); - GenLayerBiomeEdge genlayerbiomeedge = new GenLayerBiomeEdge(1000L, genlayer6); - GenLayer lvt_10_1_ = GenLayerZoom.magnify(1000L, genlayerriverinit, 2); + GenLayer lvt_10_1_ = GenLayerZoom.func_75915_a(1000L, genlayerriverinit, 2); + GenLayer genlayerbiomeedge = p_180781_2_.getBiomeLayer(p_180781_0_, genlayer4, p_180781_3_); GenLayer genlayerhills = new GenLayerHills(1000L, genlayerbiomeedge, lvt_10_1_); - GenLayer genlayer5 = GenLayerZoom.magnify(1000L, genlayerriverinit, 2); - genlayer5 = GenLayerZoom.magnify(1000L, genlayer5, j); + GenLayer genlayer5 = GenLayerZoom.func_75915_a(1000L, genlayerriverinit, 2); + genlayer5 = GenLayerZoom.func_75915_a(1000L, genlayer5, j); @@ -191,7 +191,7 @@ - protected static boolean isBiomeOceanic(int p_151618_0_) + protected static boolean func_151618_b(int p_151618_0_) { -- return p_151618_0_ == BiomeGenBase.ocean.biomeID || p_151618_0_ == BiomeGenBase.deepOcean.biomeID || p_151618_0_ == BiomeGenBase.frozenOcean.biomeID; -+ return net.minecraftforge.common.BiomeManager.oceanBiomes.contains(BiomeGenBase.getBiome(p_151618_0_)); +- return p_151618_0_ == BiomeGenBase.field_76771_b.field_76756_M || p_151618_0_ == BiomeGenBase.field_150575_M.field_76756_M || p_151618_0_ == BiomeGenBase.field_76776_l.field_76756_M; ++ return net.minecraftforge.common.BiomeManager.oceanBiomes.contains(BiomeGenBase.func_150568_d(p_151618_0_)); } - protected int selectRandom(int... p_151619_1_) + protected int func_151619_a(int... p_151619_1_) @@ -203,4 +203,27 @@ { - return p_151617_2_ == p_151617_3_ && p_151617_3_ == p_151617_4_ ? p_151617_2_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_3_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_3_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_2_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_4_ && p_151617_2_ != p_151617_3_ ? p_151617_1_ : (p_151617_2_ == p_151617_3_ && p_151617_1_ != p_151617_4_ ? p_151617_2_ : (p_151617_2_ == p_151617_4_ && p_151617_1_ != p_151617_3_ ? p_151617_2_ : (p_151617_3_ == p_151617_4_ && p_151617_1_ != p_151617_2_ ? p_151617_3_ : this.selectRandom(new int[] {p_151617_1_, p_151617_2_, p_151617_3_, p_151617_4_})))))))))); + return p_151617_2_ == p_151617_3_ && p_151617_3_ == p_151617_4_ ? p_151617_2_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_3_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_3_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_2_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_4_ && p_151617_2_ != p_151617_3_ ? p_151617_1_ : (p_151617_2_ == p_151617_3_ && p_151617_1_ != p_151617_4_ ? p_151617_2_ : (p_151617_2_ == p_151617_4_ && p_151617_1_ != p_151617_3_ ? p_151617_2_ : (p_151617_3_ == p_151617_4_ && p_151617_1_ != p_151617_2_ ? p_151617_3_ : this.func_151619_a(new int[] {p_151617_1_, p_151617_2_, p_151617_3_, p_151617_4_})))))))))); } + + /* ======================================== FORGE START =====================================*/ + protected long nextLong(long par1) + { -+ long j = (this.chunkSeed >> 24) % par1; ++ long j = (this.field_75908_c >> 24) % par1; + + if (j < 0) + { + j += par1; + } + -+ this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; -+ this.chunkSeed += this.worldGenSeed; ++ this.field_75908_c *= this.field_75908_c * 6364136223846793005L + 1442695040888963407L; ++ this.field_75908_c += this.field_75907_b; + return j; + } + diff --git a/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch b/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch index 28a968bdd..5e2daee96 100644 --- a/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch @@ -4,10 +4,10 @@ public class GenLayerBiome extends GenLayer { -- private BiomeGenBase[] field_151623_c = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.desert, BiomeGenBase.desert, BiomeGenBase.savanna, BiomeGenBase.savanna, BiomeGenBase.plains}; -- private BiomeGenBase[] field_151621_d = new BiomeGenBase[] {BiomeGenBase.forest, BiomeGenBase.roofedForest, BiomeGenBase.extremeHills, BiomeGenBase.plains, BiomeGenBase.birchForest, BiomeGenBase.swampland}; -- private BiomeGenBase[] field_151622_e = new BiomeGenBase[] {BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.taiga, BiomeGenBase.plains}; -- private BiomeGenBase[] field_151620_f = new BiomeGenBase[] {BiomeGenBase.icePlains, BiomeGenBase.icePlains, BiomeGenBase.icePlains, BiomeGenBase.coldTaiga}; +- private BiomeGenBase[] field_151623_c = new BiomeGenBase[] {BiomeGenBase.field_76769_d, BiomeGenBase.field_76769_d, BiomeGenBase.field_76769_d, BiomeGenBase.field_150588_X, BiomeGenBase.field_150588_X, BiomeGenBase.field_76772_c}; +- private BiomeGenBase[] field_151621_d = new BiomeGenBase[] {BiomeGenBase.field_76767_f, BiomeGenBase.field_150585_R, BiomeGenBase.field_76770_e, BiomeGenBase.field_76772_c, BiomeGenBase.field_150583_P, BiomeGenBase.field_76780_h}; +- private BiomeGenBase[] field_151622_e = new BiomeGenBase[] {BiomeGenBase.field_76767_f, BiomeGenBase.field_76770_e, BiomeGenBase.field_76768_g, BiomeGenBase.field_76772_c}; +- private BiomeGenBase[] field_151620_f = new BiomeGenBase[] {BiomeGenBase.field_76774_n, BiomeGenBase.field_76774_n, BiomeGenBase.field_76774_n, BiomeGenBase.field_150584_S}; + @SuppressWarnings("unchecked") + private java.util.List[] biomes = new java.util.ArrayList[net.minecraftforge.common.BiomeManager.BiomeType.values().length]; + @@ -16,7 +16,7 @@ public GenLayerBiome(long p_i45560_1_, GenLayer p_i45560_3_, WorldType p_i45560_4_, String p_i45560_5_) @@ -17,9 +16,30 @@ super(p_i45560_1_); - this.parent = p_i45560_3_; + this.field_75909_a = p_i45560_3_; + for (net.minecraftforge.common.BiomeManager.BiomeType type : net.minecraftforge.common.BiomeManager.BiomeType.values()) + { @@ -29,29 +29,29 @@ + + int desertIdx = net.minecraftforge.common.BiomeManager.BiomeType.DESERT.ordinal(); + -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.desert, 30)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.savanna, 20)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.plains, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.field_76769_d, 30)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.field_150588_X, 20)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.field_76772_c, 10)); + - if (p_i45560_4_ == WorldType.DEFAULT_1_1) + if (p_i45560_4_ == WorldType.field_77136_e) { -- this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.swampland, BiomeGenBase.plains, BiomeGenBase.taiga}; +- this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.field_76769_d, BiomeGenBase.field_76767_f, BiomeGenBase.field_76770_e, BiomeGenBase.field_76780_h, BiomeGenBase.field_76772_c, BiomeGenBase.field_76768_g}; + biomes[desertIdx].clear(); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.desert, 10)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.forest, 10)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.extremeHills, 10)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.swampland, 10)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.plains, 10)); -+ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.taiga, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.field_76769_d, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.field_76767_f, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.field_76770_e, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.field_76780_h, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.field_76772_c, 10)); ++ biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.field_76768_g, 10)); this.field_175973_g = null; } - else if (p_i45560_4_ == WorldType.CUSTOMIZED) + else if (p_i45560_4_ == WorldType.field_180271_f) @@ -73,7 +93,7 @@ } else { -- aint1[j + i * areaWidth] = this.field_151623_c[this.nextInt(this.field_151623_c.length)].biomeID; -+ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.DESERT).biome.biomeID; +- aint1[j + i * p_75904_3_] = this.field_151623_c[this.func_75902_a(this.field_151623_c.length)].field_76756_M; ++ aint1[j + i * p_75904_3_] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.DESERT).biome.field_76756_M; } } else if (k == 2) @@ -59,8 +59,8 @@ } else { -- aint1[j + i * areaWidth] = this.field_151621_d[this.nextInt(this.field_151621_d.length)].biomeID; -+ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.WARM).biome.biomeID; +- aint1[j + i * p_75904_3_] = this.field_151621_d[this.func_75902_a(this.field_151621_d.length)].field_76756_M; ++ aint1[j + i * p_75904_3_] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.WARM).biome.field_76756_M; } } else if (k == 3) @@ -68,14 +68,14 @@ } else { -- aint1[j + i * areaWidth] = this.field_151622_e[this.nextInt(this.field_151622_e.length)].biomeID; -+ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.COOL).biome.biomeID; +- aint1[j + i * p_75904_3_] = this.field_151622_e[this.func_75902_a(this.field_151622_e.length)].field_76756_M; ++ aint1[j + i * p_75904_3_] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.COOL).biome.field_76756_M; } } else if (k == 4) { -- aint1[j + i * areaWidth] = this.field_151620_f[this.nextInt(this.field_151620_f.length)].biomeID; -+ aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.ICY).biome.biomeID; +- aint1[j + i * p_75904_3_] = this.field_151620_f[this.func_75902_a(this.field_151620_f.length)].field_76756_M; ++ aint1[j + i * p_75904_3_] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.ICY).biome.field_76756_M; } else { @@ -87,8 +87,8 @@ + protected net.minecraftforge.common.BiomeManager.BiomeEntry getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType type) + { + java.util.List biomeList = biomes[type.ordinal()]; -+ int totalWeight = net.minecraft.util.WeightedRandom.getTotalWeight(biomeList); -+ int weight = net.minecraftforge.common.BiomeManager.isTypeListModded(type)?nextInt(totalWeight):nextInt(totalWeight / 10) * 10; -+ return (net.minecraftforge.common.BiomeManager.BiomeEntry)net.minecraft.util.WeightedRandom.getRandomItem(biomeList, weight); ++ int totalWeight = net.minecraft.util.WeightedRandom.func_76272_a(biomeList); ++ int weight = net.minecraftforge.common.BiomeManager.isTypeListModded(type)?func_75902_a(totalWeight):func_75902_a(totalWeight / 10) * 10; ++ return (net.minecraftforge.common.BiomeManager.BiomeEntry)net.minecraft.util.WeightedRandom.func_180166_a(biomeList, weight); + } } diff --git a/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch index 8d5ce18f2..a1ba80289 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch @@ -6,8 +6,8 @@ + static + { -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, itemsToGenerateInTemple, 2, 7); -+ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, field_74941_i, 2, 7); ++ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); + } + public DesertPyramid(Random p_i2062_1_, int p_i2062_2_, int p_i2062_3_) @@ -15,65 +15,65 @@ super(p_i2062_1_, p_i2062_2_, 64, p_i2062_3_, 21, 15, 21); @@ -258,7 +264,7 @@ { - int l1 = enumfacing.getFrontOffsetX() * 2; - int i2 = enumfacing.getFrontOffsetZ() * 2; -- this.field_74940_h[enumfacing.getHorizontalIndex()] = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 10 + l1, -11, 10 + i2, WeightedRandomChestContent.func_177629_a(itemsToGenerateInTemple, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); -+ this.field_74940_h[enumfacing.getHorizontalIndex()] = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 10 + l1, -11, 10 + i2, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, p_74875_2_)); + int l1 = enumfacing.func_82601_c() * 2; + int i2 = enumfacing.func_82599_e() * 2; +- this.field_74940_h[enumfacing.func_176736_b()] = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 10 + l1, -11, 10 + i2, WeightedRandomChestContent.func_177629_a(field_74941_i, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); ++ this.field_74940_h[enumfacing.func_176736_b()] = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 10 + l1, -11, 10 + i2, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.PYRAMID_DESERT_CHEST, p_74875_2_)); } } @@ -362,6 +368,13 @@ - private static final List field_175815_j = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.arrow, 0, 2, 7, 30)}); - private static ComponentScatteredFeaturePieces.JunglePyramid.Stones junglePyramidsRandomScatteredStones = new ComponentScatteredFeaturePieces.JunglePyramid.Stones(); + private static final List field_175815_j = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.field_151032_g, 0, 2, 7, 30)}); + private static ComponentScatteredFeaturePieces.JunglePyramid.Stones field_74942_n = new ComponentScatteredFeaturePieces.JunglePyramid.Stones(); + static + { + net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_DISPENSER, field_175815_j, 2, 2); + net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_CHEST, field_175816_i, 2, 7); -+ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); ++ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); + } + public JunglePyramid() { } @@ -518,9 +531,12 @@ - this.func_175811_a(worldIn, Blocks.redstone_wire.getDefaultState(), 4, -3, 1, p_74875_3_); - this.func_175811_a(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 3, -3, 1, p_74875_3_); + this.func_175811_a(p_74875_1_, Blocks.field_150488_af.func_176223_P(), 4, -3, 1, p_74875_3_); + this.func_175811_a(p_74875_1_, Blocks.field_150341_Y.func_176223_P(), 3, -3, 1, p_74875_3_); + net.minecraftforge.common.ChestGenHooks dispenser = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_DISPENSER); + net.minecraftforge.common.ChestGenHooks chest = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.PYRAMID_JUNGLE_CHEST); + if (!this.field_74945_j) { -- this.field_74945_j = this.func_175806_a(worldIn, p_74875_3_, p_74875_2_, 3, -2, 1, EnumFacing.NORTH.getIndex(), field_175815_j, 2); -+ this.field_74945_j = this.func_175806_a(worldIn, p_74875_3_, p_74875_2_, 3, -2, 1, EnumFacing.NORTH.getIndex(), dispenser.getItems(p_74875_2_), dispenser.getCount(p_74875_2_)); +- this.field_74945_j = this.func_175806_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, -2, 1, EnumFacing.NORTH.func_176745_a(), field_175815_j, 2); ++ this.field_74945_j = this.func_175806_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, -2, 1, EnumFacing.NORTH.func_176745_a(), dispenser.getItems(p_74875_2_), dispenser.getCount(p_74875_2_)); } - this.func_175811_a(worldIn, Blocks.vine.getStateFromMeta(15), 3, -2, 2, p_74875_3_); + this.func_175811_a(p_74875_1_, Blocks.field_150395_bd.func_176203_a(15), 3, -2, 2, p_74875_3_); @@ -537,7 +553,7 @@ if (!this.field_74946_k) { -- this.field_74946_k = this.func_175806_a(worldIn, p_74875_3_, p_74875_2_, 9, -2, 3, EnumFacing.WEST.getIndex(), field_175815_j, 2); -+ this.field_74946_k = this.func_175806_a(worldIn, p_74875_3_, p_74875_2_, 9, -2, 3, EnumFacing.WEST.getIndex(), dispenser.getItems(p_74875_2_), dispenser.getCount(p_74875_2_)); +- this.field_74946_k = this.func_175806_a(p_74875_1_, p_74875_3_, p_74875_2_, 9, -2, 3, EnumFacing.WEST.func_176745_a(), field_175815_j, 2); ++ this.field_74946_k = this.func_175806_a(p_74875_1_, p_74875_3_, p_74875_2_, 9, -2, 3, EnumFacing.WEST.func_176745_a(), dispenser.getItems(p_74875_2_), dispenser.getCount(p_74875_2_)); } - this.func_175811_a(worldIn, Blocks.vine.getStateFromMeta(15), 8, -1, 3, p_74875_3_); + this.func_175811_a(p_74875_1_, Blocks.field_150395_bd.func_176203_a(15), 8, -1, 3, p_74875_3_); @@ -545,7 +561,7 @@ if (!this.field_74947_h) { -- this.field_74947_h = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 8, -3, 3, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); -+ this.field_74947_h = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 8, -3, 3, chest.getItems(p_74875_2_), chest.getCount(p_74875_2_)); +- this.field_74947_h = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 8, -3, 3, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); ++ this.field_74947_h = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 8, -3, 3, chest.getItems(p_74875_2_), chest.getCount(p_74875_2_)); } - this.func_175811_a(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 9, -3, 2, p_74875_3_); + this.func_175811_a(p_74875_1_, Blocks.field_150341_Y.func_176223_P(), 9, -3, 2, p_74875_3_); @@ -578,7 +594,7 @@ if (!this.field_74948_i) { -- this.field_74948_i = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 9, -3, 10, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); -+ this.field_74948_i = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 9, -3, 10, chest.getItems(p_74875_2_), chest.getCount(p_74875_2_)); +- this.field_74948_i = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 9, -3, 10, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); ++ this.field_74948_i = this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 9, -3, 10, chest.getItems(p_74875_2_), chest.getCount(p_74875_2_)); } return true; diff --git a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch index d64cd4400..a296c5436 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch @@ -2,10 +2,10 @@ +++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java @@ -28,11 +28,18 @@ - for (BiomeGenBase biomegenbase : BiomeGenBase.getBiomeGenArray()) + for (BiomeGenBase biomegenbase : BiomeGenBase.func_150565_n()) { -- if (biomegenbase != null && biomegenbase.minHeight > 0.0F) -+ if (biomegenbase != null && biomegenbase.minHeight > 0.0F && !net.minecraftforge.common.BiomeManager.strongHoldBiomesBlackList.contains(biomegenbase)) +- if (biomegenbase != null && biomegenbase.field_76748_D > 0.0F) ++ if (biomegenbase != null && biomegenbase.field_76748_D > 0.0F && !net.minecraftforge.common.BiomeManager.strongHoldBiomesBlackList.contains(biomegenbase)) { this.field_151546_e.add(biomegenbase); } diff --git a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch index c2d5ed167..f97b0ccc3 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch @@ -4,14 +4,14 @@ { if (this.field_143029_e == null) { -- this.field_143029_e = (MapGenStructureData)worldIn.loadItemData(MapGenStructureData.class, this.getStructureName()); -+ this.field_143029_e = (MapGenStructureData)worldIn.getPerWorldStorage().loadData(MapGenStructureData.class, this.getStructureName()); +- this.field_143029_e = (MapGenStructureData)p_143027_1_.func_72943_a(MapGenStructureData.class, this.func_143025_a()); ++ this.field_143029_e = (MapGenStructureData)p_143027_1_.getPerWorldStorage().func_75742_a(MapGenStructureData.class, this.func_143025_a()); if (this.field_143029_e == null) { - this.field_143029_e = new MapGenStructureData(this.getStructureName()); -- worldIn.setItemData(this.getStructureName(), this.field_143029_e); -+ worldIn.getPerWorldStorage().setData(this.getStructureName(), this.field_143029_e); + this.field_143029_e = new MapGenStructureData(this.func_143025_a()); +- p_143027_1_.func_72823_a(this.func_143025_a(), this.field_143029_e); ++ p_143027_1_.getPerWorldStorage().func_75745_a(this.func_143025_a(), this.field_143029_e); } else { diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch index 9f41e1cad..8c525a612 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch @@ -9,5 +9,5 @@ + throw new RuntimeException("StructureComponent \"" + this.getClass().getName() + "\" missing ID Mapping, Modder see MapGenStructureIO"); + } NBTTagCompound nbttagcompound = new NBTTagCompound(); - nbttagcompound.setString("id", MapGenStructureIO.func_143036_a(this)); - nbttagcompound.setTag("BB", this.boundingBox.func_151535_h()); + nbttagcompound.func_74778_a("id", MapGenStructureIO.func_143036_a(this)); + nbttagcompound.func_74782_a("BB", this.field_74887_e.func_151535_h()); diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch index 0c563bb50..3a37d8b4c 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch @@ -1,33 +1,33 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java @@ -32,6 +32,12 @@ - MapGenStructureIO.registerStructureComponent(StructureMineshaftPieces.Stairs.class, "MSStairs"); + MapGenStructureIO.func_143031_a(StructureMineshaftPieces.Stairs.class, "MSStairs"); } + static + { + net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.MINESHAFT_CORRIDOR, field_175893_a, 8, 8); -+ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.MINESHAFT_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); ++ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.MINESHAFT_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); + } + private static StructureComponent func_175892_a(List p_175892_0_, Random p_175892_1_, int p_175892_2_, int p_175892_3_, int p_175892_4_, EnumFacing p_175892_5_, int p_175892_6_) { int i = p_175892_1_.nextInt(100); @@ -351,14 +357,15 @@ - this.func_175809_a(worldIn, p_74875_3_, p_74875_2_, 0.05F, 1, 2, k1 - 1, Blocks.torch.getStateFromMeta(EnumFacing.UP.getIndex())); - this.func_175809_a(worldIn, p_74875_3_, p_74875_2_, 0.05F, 1, 2, k1 + 1, Blocks.torch.getStateFromMeta(EnumFacing.UP.getIndex())); + this.func_175809_a(p_74875_1_, p_74875_3_, p_74875_2_, 0.05F, 1, 2, k1 - 1, Blocks.field_150478_aa.func_176203_a(EnumFacing.UP.func_176745_a())); + this.func_175809_a(p_74875_1_, p_74875_3_, p_74875_2_, 0.05F, 1, 2, k1 + 1, Blocks.field_150478_aa.func_176203_a(EnumFacing.UP.func_176745_a())); + net.minecraftforge.common.ChestGenHooks info = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.MINESHAFT_CORRIDOR); if (p_74875_2_.nextInt(100) == 0) { -- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 2, 0, k1 - 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.field_175893_a, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 3 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 2, 0, k1 - 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); +- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 2, 0, k1 - 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.field_175893_a, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 3 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 2, 0, k1 - 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); } if (p_74875_2_.nextInt(100) == 0) { -- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 0, 0, k1 + 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.field_175893_a, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 3 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 0, 0, k1 + 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); +- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 0, 0, k1 + 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.field_175893_a, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 3 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 0, 0, k1 + 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); } - if (this.hasSpiders && !this.spawnerPlaced) + if (this.field_74956_b && !this.field_74957_c) diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch index b4b94753a..8d9ab3d84 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch @@ -1,27 +1,27 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java @@ -154,7 +154,7 @@ - if (this.field_111021_b && p_74875_3_.func_175898_b(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) + if (this.field_111021_b && p_74875_3_.func_175898_b(new BlockPos(this.func_74865_a(3, 3), this.func_74862_a(2), this.func_74873_b(3, 3)))) { this.field_111021_b = false; -- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 2, 3, field_111019_a, 2 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_)); +- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 2, 3, field_111019_a, 2 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_)); } - this.func_175804_a(worldIn, p_74875_3_, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.func_175804_a(p_74875_1_, p_74875_3_, 0, 6, 0, 4, 6, 4, Blocks.field_150385_bj.func_176223_P(), Blocks.field_150385_bj.func_176223_P(), false); @@ -225,7 +225,7 @@ - if (this.field_111020_b && p_74875_3_.func_175898_b(new BlockPos(this.getXWithOffset(1, 3), this.getYWithOffset(2), this.getZWithOffset(1, 3)))) + if (this.field_111020_b && p_74875_3_.func_175898_b(new BlockPos(this.func_74865_a(1, 3), this.func_74862_a(2), this.func_74873_b(1, 3)))) { this.field_111020_b = false; -- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 1, 2, 3, field_111019_a, 2 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 1, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_)); +- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 1, 2, 3, field_111019_a, 2 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 1, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_)); } - this.func_175804_a(worldIn, p_74875_3_, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.func_175804_a(p_74875_1_, p_74875_3_, 0, 6, 0, 4, 6, 4, Blocks.field_150385_bj.func_176223_P(), Blocks.field_150385_bj.func_176223_P(), false); @@ -943,6 +943,7 @@ abstract static class Piece extends StructureComponent { - protected static final List field_111019_a = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.diamond, 0, 1, 3, 5), new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 5), new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 15), new WeightedRandomChestContent(Items.golden_sword, 0, 1, 1, 5), new WeightedRandomChestContent(Items.golden_chestplate, 0, 1, 1, 5), new WeightedRandomChestContent(Items.flint_and_steel, 0, 1, 1, 5), new WeightedRandomChestContent(Items.nether_wart, 0, 3, 7, 5), new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 10), new WeightedRandomChestContent(Items.golden_horse_armor, 0, 1, 1, 8), new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 5), new WeightedRandomChestContent(Items.diamond_horse_armor, 0, 1, 1, 3), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.obsidian), 0, 2, 4, 2)}); + protected static final List field_111019_a = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.field_151045_i, 0, 1, 3, 5), new WeightedRandomChestContent(Items.field_151042_j, 0, 1, 5, 5), new WeightedRandomChestContent(Items.field_151043_k, 0, 1, 3, 15), new WeightedRandomChestContent(Items.field_151010_B, 0, 1, 1, 5), new WeightedRandomChestContent(Items.field_151171_ah, 0, 1, 1, 5), new WeightedRandomChestContent(Items.field_151033_d, 0, 1, 1, 5), new WeightedRandomChestContent(Items.field_151075_bm, 0, 3, 7, 5), new WeightedRandomChestContent(Items.field_151141_av, 0, 1, 1, 10), new WeightedRandomChestContent(Items.field_151136_bY, 0, 1, 1, 8), new WeightedRandomChestContent(Items.field_151138_bX, 0, 1, 1, 5), new WeightedRandomChestContent(Items.field_151125_bZ, 0, 1, 1, 3), new WeightedRandomChestContent(Item.func_150898_a(Blocks.field_150343_Z), 0, 2, 4, 2)}); + static { net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, field_111019_a, 2, 5); } public Piece() diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch index da767fef7..7ff46ea18 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch @@ -9,15 +9,15 @@ + throw new RuntimeException("StructureStart \"" + this.getClass().getName() + "\" missing ID Mapping, Modder see MapGenStructureIO"); + } NBTTagCompound nbttagcompound = new NBTTagCompound(); - nbttagcompound.setString("id", MapGenStructureIO.func_143033_a(this)); - nbttagcompound.setInteger("ChunkX", p_143021_1_); + nbttagcompound.func_74778_a("id", MapGenStructureIO.func_143033_a(this)); + nbttagcompound.func_74768_a("ChunkX", p_143021_1_); @@ -97,7 +101,8 @@ - for (int i = 0; i < nbttaglist.tagCount(); ++i) + for (int i = 0; i < nbttaglist.func_74745_c(); ++i) { -- this.components.add(MapGenStructureIO.func_143032_b(nbttaglist.getCompoundTagAt(i), worldIn)); -+ StructureComponent tmp = MapGenStructureIO.func_143032_b(nbttaglist.getCompoundTagAt(i), worldIn); -+ if (tmp != null) this.components.add(tmp); //Forge: Prevent NPEs further down the line when a componenet can't be loaded. +- this.field_75075_a.add(MapGenStructureIO.func_143032_b(nbttaglist.func_150305_b(i), p_143020_1_)); ++ StructureComponent tmp = MapGenStructureIO.func_143032_b(nbttaglist.func_150305_b(i), p_143020_1_); ++ if (tmp != null) this.field_75075_a.add(tmp); //Forge: Prevent NPEs further down the line when a componenet can't be loaded. } this.func_143017_b(p_143020_2_); diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch index 83e88c9b3..0d5ebc0bb 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch @@ -6,70 +6,70 @@ + static + { -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, strongholdChestContents, 2, 4); -+ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, field_75003_a, 2, 4); ++ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); + } + public ChestCorridor(int p_i45582_1_, Random p_i45582_2_, StructureBoundingBox p_i45582_3_, EnumFacing p_i45582_4_) { super(p_i45582_1_); @@ -296,7 +302,7 @@ - if (!this.hasMadeChest && p_74875_3_.func_175898_b(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) + if (!this.field_75002_c && p_74875_3_.func_175898_b(new BlockPos(this.func_74865_a(3, 3), this.func_74862_a(2), this.func_74873_b(3, 3)))) { - this.hasMadeChest = true; -- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 2, 3, WeightedRandomChestContent.func_177629_a(strongholdChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 2 + p_74875_2_.nextInt(2)); -+ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, p_74875_2_)); + this.field_75002_c = true; +- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 2, 3, WeightedRandomChestContent.func_177629_a(field_75003_a, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 2 + p_74875_2_.nextInt(2)); ++ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CORRIDOR, p_74875_2_)); } return true; @@ -592,6 +598,12 @@ - private static final List strongholdLibraryChestContents = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.book, 0, 1, 3, 20), new WeightedRandomChestContent(Items.paper, 0, 2, 7, 20), new WeightedRandomChestContent(Items.map, 0, 1, 1, 1), new WeightedRandomChestContent(Items.compass, 0, 1, 1, 1)}); - private boolean isLargeRoom; + private static final List field_75007_b = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.field_151122_aG, 0, 1, 3, 20), new WeightedRandomChestContent(Items.field_151121_aF, 0, 2, 7, 20), new WeightedRandomChestContent(Items.field_151148_bJ, 0, 1, 1, 1), new WeightedRandomChestContent(Items.field_151111_aL, 0, 1, 1, 1)}); + private boolean field_75008_c; + static + { -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_LIBRARY, strongholdLibraryChestContents, 1, 5); -+ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_LIBRARY, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 5, 2)); ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_LIBRARY, field_75007_b, 1, 5); ++ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_LIBRARY, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 5, 2)); + } + public Library() { } @@ -736,12 +748,13 @@ - this.func_175811_a(worldIn, Blocks.torch.getDefaultState(), i1, 8, j1 + 1, p_74875_3_); + this.func_175811_a(p_74875_1_, Blocks.field_150478_aa.func_176223_P(), i1, 8, j1 + 1, p_74875_3_); } -- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 3, 5, WeightedRandomChestContent.func_177629_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_, 1, 5, 2)}), 1 + p_74875_2_.nextInt(4)); +- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 3, 5, WeightedRandomChestContent.func_177629_a(field_75007_b, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92112_a(p_74875_2_, 1, 5, 2)}), 1 + p_74875_2_.nextInt(4)); + net.minecraftforge.common.ChestGenHooks info = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_LIBRARY); -+ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 3, 5, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); ++ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 3, 5, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); - if (this.isLargeRoom) + if (this.field_75008_c) { - this.func_175811_a(worldIn, Blocks.air.getDefaultState(), 12, 9, 1, p_74875_3_); -- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 12, 8, 1, WeightedRandomChestContent.func_177629_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_, 1, 5, 2)}), 1 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 12, 8, 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); + this.func_175811_a(p_74875_1_, Blocks.field_150350_a.func_176223_P(), 12, 9, 1, p_74875_3_); +- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 12, 8, 1, WeightedRandomChestContent.func_177629_a(field_75007_b, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92112_a(p_74875_2_, 1, 5, 2)}), 1 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 12, 8, 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); } return true; @@ -1013,6 +1026,12 @@ - private static final List strongholdRoomCrossingChestContents = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 10), new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 5), new WeightedRandomChestContent(Items.redstone, 0, 4, 9, 5), new WeightedRandomChestContent(Items.coal, 0, 3, 8, 10), new WeightedRandomChestContent(Items.bread, 0, 1, 3, 15), new WeightedRandomChestContent(Items.apple, 0, 1, 3, 15), new WeightedRandomChestContent(Items.iron_pickaxe, 0, 1, 1, 1)}); - protected int roomType; + private static final List field_75014_c = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.field_151042_j, 0, 1, 5, 10), new WeightedRandomChestContent(Items.field_151043_k, 0, 1, 3, 5), new WeightedRandomChestContent(Items.field_151137_ax, 0, 4, 9, 5), new WeightedRandomChestContent(Items.field_151044_h, 0, 3, 8, 10), new WeightedRandomChestContent(Items.field_151025_P, 0, 1, 3, 15), new WeightedRandomChestContent(Items.field_151034_e, 0, 1, 3, 15), new WeightedRandomChestContent(Items.field_151035_b, 0, 1, 1, 1)}); + protected int field_75013_b; + static + { -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, strongholdRoomCrossingChestContents, 1, 5); -+ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, field_75014_c, 1, 5); ++ net.minecraftforge.common.ChestGenHooks.addItem(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 1, 0), 1, 1, 1)); + } + public RoomCrossing() { } @@ -1151,7 +1170,7 @@ - this.func_175811_a(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 1, 3, p_74875_3_); - this.func_175811_a(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 2, 3, p_74875_3_); - this.func_175811_a(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 3, 3, p_74875_3_); -- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 4, 8, WeightedRandomChestContent.func_177629_a(strongholdRoomCrossingChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 1 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 4, 8, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, p_74875_2_)); + this.func_175811_a(p_74875_1_, Blocks.field_150468_ap.func_176203_a(this.func_151555_a(Blocks.field_150468_ap, EnumFacing.WEST.func_176745_a())), 9, 1, 3, p_74875_3_); + this.func_175811_a(p_74875_1_, Blocks.field_150468_ap.func_176203_a(this.func_151555_a(Blocks.field_150468_ap, EnumFacing.WEST.func_176745_a())), 9, 2, 3, p_74875_3_); + this.func_175811_a(p_74875_1_, Blocks.field_150468_ap.func_176203_a(this.func_151555_a(Blocks.field_150468_ap, EnumFacing.WEST.func_176745_a())), 9, 3, 3, p_74875_3_); +- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 4, 8, WeightedRandomChestContent.func_177629_a(field_75014_c, new WeightedRandomChestContent[] {Items.field_151134_bR.func_92114_b(p_74875_2_)}), 1 + p_74875_2_.nextInt(4)); ++ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 3, 4, 8, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.STRONGHOLD_CROSSING, p_74875_2_)); } return true; diff --git a/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch b/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch index 7e6bfd221..43cc68cb1 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch @@ -1,9 +1,9 @@ --- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java @@ -57,6 +57,7 @@ - list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Field2.class, 3, MathHelper.getRandomIntegerInRange(p_75084_0_, 2 + p_75084_1_, 4 + p_75084_1_ * 2))); - list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House2.class, 15, MathHelper.getRandomIntegerInRange(p_75084_0_, 0, 1 + p_75084_1_))); - list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House3.class, 8, MathHelper.getRandomIntegerInRange(p_75084_0_, 0 + p_75084_1_, 3 + p_75084_1_ * 2))); + list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Field2.class, 3, MathHelper.func_76136_a(p_75084_0_, 2 + p_75084_1_, 4 + p_75084_1_ * 2))); + list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House2.class, 15, MathHelper.func_76136_a(p_75084_0_, 0, 1 + p_75084_1_))); + list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House3.class, 8, MathHelper.func_76136_a(p_75084_0_, 0 + p_75084_1_, 3 + p_75084_1_ * 2))); + net.minecraftforge.fml.common.registry.VillagerRegistry.addExtraVillageComponents(list, p_75084_0_, p_75084_1_); Iterator iterator = list.iterator(); @@ -25,23 +25,23 @@ + static + { -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.VILLAGE_BLACKSMITH, villageBlacksmithChestContents, 3, 8); ++ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.VILLAGE_BLACKSMITH, field_74918_a, 3, 8); + } + public House2(StructureVillagePieces.Start p_i45563_1_, int p_i45563_2_, Random p_i45563_3_, StructureBoundingBox p_i45563_4_, EnumFacing p_i45563_5_) { super(p_i45563_1_, p_i45563_2_); @@ -911,7 +921,7 @@ - if (!this.hasMadeChest && p_74875_3_.func_175898_b(new BlockPos(this.getXWithOffset(5, 5), this.getYWithOffset(1), this.getZWithOffset(5, 5)))) + if (!this.field_74917_c && p_74875_3_.func_175898_b(new BlockPos(this.func_74865_a(5, 5), this.func_74862_a(1), this.func_74873_b(5, 5)))) { - this.hasMadeChest = true; -- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 5, 1, 5, villageBlacksmithChestContents, 3 + p_74875_2_.nextInt(6)); -+ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 5, 1, 5, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.VILLAGE_BLACKSMITH, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.VILLAGE_BLACKSMITH, p_74875_2_)); + this.field_74917_c = true; +- this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 5, 1, 5, field_74918_a, 3 + p_74875_2_.nextInt(6)); ++ this.func_180778_a(p_74875_1_, p_74875_3_, p_74875_2_, 5, 1, 5, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.VILLAGE_BLACKSMITH, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.VILLAGE_BLACKSMITH, p_74875_2_)); } for (int i = 6; i <= 8; ++i) @@ -1403,6 +1413,7 @@ - public List structureVillageWeightedPieceList; + public List field_74931_h; public List field_74932_i = Lists.newArrayList(); public List field_74930_j = Lists.newArrayList(); + public BiomeGenBase biome; @@ -49,16 +49,16 @@ public Start() { @@ -1416,6 +1427,7 @@ - this.terrainType = p_i2104_7_; + this.field_74928_c = p_i2104_7_; BiomeGenBase biomegenbase = p_i2104_1_.func_180300_a(new BlockPos(p_i2104_4_, 0, p_i2104_5_), BiomeGenBase.field_180279_ad); - this.inDesert = biomegenbase == BiomeGenBase.desert || biomegenbase == BiomeGenBase.desertHills; + this.field_74927_b = biomegenbase == BiomeGenBase.field_76769_d || biomegenbase == BiomeGenBase.field_76786_s; + this.biome = biomegenbase; - this.func_175846_a(this.inDesert); + this.func_175846_a(this.field_74927_b); } @@ -1477,6 +1489,7 @@ protected int field_143015_k = -1; - private int villagersSpawned; + private int field_74896_a; private boolean field_143014_b; + private StructureVillagePieces.Start startPiece; @@ -67,7 +67,7 @@ @@ -1489,6 +1502,7 @@ if (p_i2107_1_ != null) { - this.field_143014_b = p_i2107_1_.inDesert; + this.field_143014_b = p_i2107_1_.field_74927_b; + startPiece = p_i2107_1_; } } @@ -81,4 +81,4 @@ + if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.replacement; if (this.field_143014_b) { - if (p_175847_1_.getBlock() == Blocks.log || p_175847_1_.getBlock() == Blocks.log2) + if (p_175847_1_.func_177230_c() == Blocks.field_150364_r || p_175847_1_.func_177230_c() == Blocks.field_150363_s) diff --git a/patches/minecraft/net/minecraft/world/storage/MapData.java.patch b/patches/minecraft/net/minecraft/world/storage/MapData.java.patch index ab579d3d1..4bddcf6da 100644 --- a/patches/minecraft/net/minecraft/world/storage/MapData.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/MapData.java.patch @@ -2,47 +2,47 @@ +++ ../src-work/minecraft/net/minecraft/world/storage/MapData.java @@ -21,7 +21,7 @@ { - public int xCenter; - public int zCenter; -- public byte dimension; -+ public int dimension; //FML byte -> int - public byte scale; - public byte[] colors = new byte[16384]; - public List playersArrayList = Lists.newArrayList(); + public int field_76201_a; + public int field_76199_b; +- public byte field_76200_c; ++ public int field_76200_c; //FML byte -> int + public byte field_76197_d; + public byte[] field_76198_e = new byte[16384]; + public List field_76196_g = Lists.newArrayList(); @@ -44,7 +44,17 @@ - public void readFromNBT(NBTTagCompound nbt) + public void func_76184_a(NBTTagCompound p_76184_1_) { -- this.dimension = nbt.getByte("dimension"); -+ net.minecraft.nbt.NBTBase dimension = nbt.getTag("dimension"); +- this.field_76200_c = p_76184_1_.func_74771_c("dimension"); ++ net.minecraft.nbt.NBTBase dimension = p_76184_1_.func_74781_a("dimension"); + + if (dimension instanceof net.minecraft.nbt.NBTTagByte) + { -+ this.dimension = ((net.minecraft.nbt.NBTTagByte)dimension).getByte(); ++ this.field_76200_c = ((net.minecraft.nbt.NBTTagByte)dimension).func_150290_f(); + } + else + { -+ this.dimension = ((net.minecraft.nbt.NBTTagInt)dimension).getInt(); ++ this.field_76200_c = ((net.minecraft.nbt.NBTTagInt)dimension).func_150287_d(); + } + - this.xCenter = nbt.getInteger("xCenter"); - this.zCenter = nbt.getInteger("zCenter"); - this.scale = nbt.getByte("scale"); + this.field_76201_a = p_76184_1_.func_74762_e("xCenter"); + this.field_76199_b = p_76184_1_.func_74762_e("zCenter"); + this.field_76197_d = p_76184_1_.func_74771_c("scale"); @@ -85,7 +95,7 @@ - public void writeToNBT(NBTTagCompound nbt) + public void func_76187_b(NBTTagCompound p_76187_1_) { -- nbt.setByte("dimension", this.dimension); -+ nbt.setInteger("dimension", this.dimension); - nbt.setInteger("xCenter", this.xCenter); - nbt.setInteger("zCenter", this.zCenter); - nbt.setByte("scale", this.scale); +- p_76187_1_.func_74774_a("dimension", this.field_76200_c); ++ p_76187_1_.func_74768_a("dimension", this.field_76200_c); + p_76187_1_.func_74768_a("xCenter", this.field_76201_a); + p_76187_1_.func_74768_a("zCenter", this.field_76199_b); + p_76187_1_.func_74774_a("scale", this.field_76197_d); @@ -164,7 +174,7 @@ p_82567_8_ = p_82567_8_ + (p_82567_8_ < 0.0D ? -8.0D : 8.0D); b2 = (byte)((int)(p_82567_8_ * 16.0D / 360.0D)); -- if (this.dimension < 0) -+ if (worldIn.provider.shouldMapSpin(p_82567_3_, p_82567_4_, p_82567_6_, p_82567_8_)) +- if (this.field_76200_c < 0) ++ if (p_82567_2_.field_73011_w.shouldMapSpin(p_82567_3_, p_82567_4_, p_82567_6_, p_82567_8_)) { - int k = (int)(worldIn.getWorldInfo().getWorldTime() / 10L); + int k = (int)(p_82567_2_.func_72912_H().func_76073_f() / 10L); b2 = (byte)(k * k * 34187121 + k * 121 >> 15 & 15); diff --git a/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch b/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch index e8fb0c830..f3f48d646 100644 --- a/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch @@ -2,7 +2,7 @@ +++ ../src-work/minecraft/net/minecraft/world/storage/SaveHandler.java @@ -104,13 +104,17 @@ { - File file1 = new File(this.worldDirectory, "level.dat"); + File file1 = new File(this.field_75770_b, "level.dat"); + WorldInfo worldInfo = null; + @@ -10,8 +10,8 @@ { try { - NBTTagCompound nbttagcompound2 = CompressedStreamTools.readCompressed(new FileInputStream(file1)); - NBTTagCompound nbttagcompound3 = nbttagcompound2.getCompoundTag("Data"); + NBTTagCompound nbttagcompound2 = CompressedStreamTools.func_74796_a(new FileInputStream(file1)); + NBTTagCompound nbttagcompound3 = nbttagcompound2.func_74775_l("Data"); - return new WorldInfo(nbttagcompound3); + worldInfo = new WorldInfo(nbttagcompound3); + net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound2); @@ -24,13 +24,13 @@ } + net.minecraftforge.fml.common.FMLCommonHandler.instance().confirmBackupLevelDatUse(this); - file1 = new File(this.worldDirectory, "level.dat_old"); + file1 = new File(this.field_75770_b, "level.dat_old"); if (file1.exists()) @@ -126,7 +131,13 @@ { - NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1)); - NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Data"); + NBTTagCompound nbttagcompound = CompressedStreamTools.func_74796_a(new FileInputStream(file1)); + NBTTagCompound nbttagcompound1 = nbttagcompound.func_74775_l("Data"); - return new WorldInfo(nbttagcompound1); + worldInfo = new WorldInfo(nbttagcompound1); + net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound); @@ -44,57 +44,57 @@ { @@ -143,6 +154,8 @@ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.setTag("Data", nbttagcompound); + nbttagcompound1.func_74782_a("Data", nbttagcompound); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, worldInformation, nbttagcompound1); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, p_75755_1_, nbttagcompound1); + try { - File file1 = new File(this.worldDirectory, "level.dat_new"); + File file1 = new File(this.field_75770_b, "level.dat_new"); @@ -181,6 +194,8 @@ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.setTag("Data", nbttagcompound); + nbttagcompound1.func_74782_a("Data", nbttagcompound); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, worldInformation, nbttagcompound1); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, p_75761_1_, nbttagcompound1); + try { - File file1 = new File(this.worldDirectory, "level.dat_new"); + File file1 = new File(this.field_75770_b, "level.dat_new"); @@ -229,6 +244,7 @@ } file1.renameTo(file2); -+ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(p_75753_1_, this.playersDirectory, p_75753_1_.getUniqueID().toString()); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(p_75753_1_, this.field_75771_c, p_75753_1_.func_110124_au().toString()); } catch (Exception var5) { @@ -259,6 +275,7 @@ - p_75752_1_.readFromNBT(nbttagcompound); + p_75752_1_.func_70020_e(nbttagcompound); } -+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_75752_1_, playersDirectory, p_75752_1_.getUniqueID().toString()); ++ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_75752_1_, field_75771_c, p_75752_1_.func_110124_au().toString()); return nbttagcompound; } @@ -300,4 +317,22 @@ { - return this.saveDirectoryName; + return this.field_75767_f; } + + public NBTTagCompound getPlayerNBT(net.minecraft.entity.player.EntityPlayerMP player) + { + try + { -+ File file1 = new File(this.playersDirectory, player.getUniqueID().toString() + ".dat"); ++ File file1 = new File(this.field_75771_c, player.func_110124_au().toString() + ".dat"); + + if (file1.exists() && file1.isFile()) + { -+ return CompressedStreamTools.readCompressed(new FileInputStream(file1)); ++ return CompressedStreamTools.func_74796_a(new FileInputStream(file1)); + } + } + catch (Exception exception) + { -+ logger.warn("Failed to load player data for " + player.getName()); ++ field_151478_a.warn("Failed to load player data for " + player.func_70005_c_()); + } + return null; + } diff --git a/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch b/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch index a95b7f74e..808536451 100644 --- a/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch @@ -1,9 +1,9 @@ --- ../src-base/minecraft/net/minecraft/world/storage/WorldInfo.java +++ ../src-work/minecraft/net/minecraft/world/storage/WorldInfo.java @@ -51,6 +51,7 @@ - private int borderWarningDistance = 5; - private int borderWarningTime = 15; - private GameRules theGameRules = new GameRules(); + private int field_176154_I = 5; + private int field_176155_J = 15; + private GameRules field_82577_x = new GameRules(); + private java.util.Map additionalProperties; protected WorldInfo() From 2abca14a053e6a49f41653e9b28b1ee645827ab3 Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 22 Nov 2015 15:31:06 -0500 Subject: [PATCH 048/133] Small tweak to the OUT/ERR logger - should skip the Throwable stuffs now. --- .../fml/common/TracingPrintStream.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/TracingPrintStream.java b/src/main/java/net/minecraftforge/fml/common/TracingPrintStream.java index 2187c9d3e..80aef6c26 100644 --- a/src/main/java/net/minecraftforge/fml/common/TracingPrintStream.java +++ b/src/main/java/net/minecraftforge/fml/common/TracingPrintStream.java @@ -15,34 +15,36 @@ import org.apache.logging.log4j.Logger; /** * PrintStream which redirects it's output to a given logger. - * + * * @author Arkan */ public class TracingPrintStream extends PrintStream { - + private Logger logger; private int BASE_DEPTH = 3; - + public TracingPrintStream(Logger logger, PrintStream original) { super(original); this.logger = logger; } - + @Override public void println(Object o) { logger.info(getPrefix() + o); } - + @Override public void println(String s) { logger.info(getPrefix() + s); } - + private String getPrefix() { StackTraceElement[] elems = Thread.currentThread().getStackTrace(); StackTraceElement elem = elems[BASE_DEPTH]; // The caller is always at BASE_DEPTH, including this call. if (elem.getClassName().startsWith("kotlin.io.")) { elem = elems[BASE_DEPTH + 2]; // Kotlins IoPackage masks origins 2 deeper in the stack. + } else if (elem.getClassName().startsWith("java.lang.Throwable")) { + elem = elems[BASE_DEPTH + 1]; } return "[" + elem.getClassName() + ":" + elem.getMethodName() + ":" + elem.getLineNumber() + "]: "; } From 4320a0f1ed9e07c44b0276e4bc43de9aea3324c4 Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 22 Nov 2015 16:27:13 -0500 Subject: [PATCH 049/133] Fix weird patch issue where the this FG commit: https://github.com/MinecraftForge/ForgeGradle/commit/2f0ca9921b961133689d29b807333241010a802d breaks if the exact end of a line is a srgname. Not ideal, but should work. --- .../net/minecraft/world/gen/ChunkProviderGenerate.java.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch index e147f9431..d8d3ed7df 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch @@ -68,8 +68,8 @@ } - if (!flag && this.field_73220_k.nextInt(this.field_177477_r.field_177777_D / 10) == 0 && this.field_177477_r.field_177783_C) -+ if (!flag && this.field_73220_k.nextInt(this.field_177477_r.field_177777_D / 10) == 0 && this.field_177477_r.field_177783_C -+ && net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA)) ++ if (!flag && this.field_73220_k.nextInt(this.field_177477_r.field_177777_D / 10) == 0 && this.field_177477_r.field_177783_C && ++ net.minecraftforge.event.terraingen.TerrainGen.populate(p_73153_1_, field_73230_p, field_73220_k, p_73153_2_, p_73153_3_, flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA)) { int i2 = this.field_73220_k.nextInt(16) + 8; int l2 = this.field_73220_k.nextInt(this.field_73220_k.nextInt(248) + 8); From 918d59d6a63ab76cf35bf7ef952a02a92f0eaa9f Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 22 Nov 2015 22:35:21 -0500 Subject: [PATCH 050/133] Fix derpy fir trees in the taiga. So many patches. See if we can find any more mistakes?! --- .../net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch index 0303f2295..a8ca16188 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch @@ -31,7 +31,7 @@ BlockPos blockpos = new BlockPos(j3, l2, i2); - if (!p_180709_1_.func_180495_p(blockpos).func_177230_c().func_149730_j()) -+ if (!p_180709_1_.func_180495_p(blockpos).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos)) ++ if (p_180709_1_.func_180495_p(blockpos).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos)) { this.func_175903_a(p_180709_1_, blockpos, field_181637_b); } From 9815d729b53a347a389700bc04fa8ac3ca4e1548 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Mon, 23 Nov 2015 10:12:01 +0300 Subject: [PATCH 051/133] Fixed NPE is B3D loader caused by the missing vertex normal; updated the example chest model - it's now has 2 meshes; Updated ModelAnimationDebug - it now uses the new chest model, renders the base with the static world renderer, and only the lid with the TESR. --- .../client/model/b3d/B3DModel.java | 20 +++++++++------ .../debug/ModelAnimationDebug.java | 16 ++++++++---- .../blockstates/test_animation_block.json | 23 ++++++++++++++++-- .../blockstates/CustomModelBlock.json | 5 +++- .../models/block/chest.b3d | Bin 6104 -> 5659 bytes 5 files changed, 49 insertions(+), 15 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java index 60af64849..06c297099 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DModel.java @@ -636,13 +636,19 @@ public class B3DModel Vector3f rPos = new Vector3f(newPos.x / newPos.w, newPos.y / newPos.w, newPos.z / newPos.w); // normal - Matrix3f tm = new Matrix3f(); - t.getRotationScale(tm); - tm.invert(); - tm.transpose(); - Vector3f normal = new Vector3f(this.normal), rNormal = new Vector3f(); - tm.transform(normal, rNormal); - rNormal.normalize(); + Vector3f rNormal = null; + + if(this.normal != null) + { + Matrix3f tm = new Matrix3f(); + t.getRotationScale(tm); + tm.invert(); + tm.transpose(); + Vector3f normal = new Vector3f(this.normal); + rNormal = new Vector3f(); + tm.transform(normal, rNormal); + rNormal.normalize(); + } // texCoords TODO return new Vertex(rPos, rNormal, color, texCoords); diff --git a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java index 48b8ec2a1..fbdb0e254 100644 --- a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java @@ -4,6 +4,7 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockPistonBase; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; @@ -25,6 +26,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.client.model.ISmartBlockModel; import net.minecraftforge.client.model.ModelLoader; @@ -52,6 +54,7 @@ public class ModelAnimationDebug public static String blockName = "test_animation_block"; public static final PropertyDirection FACING = PropertyDirection.create("facing"); + public static final PropertyBool STATIC = PropertyBool.create("static");; @SidedProxy(serverSide = "net.minecraftforge.debug.ModelAnimationDebug$CommonProxy", clientSide = "net.minecraftforge.debug.ModelAnimationDebug$ClientProxy") public static CommonProxy proxy; @@ -71,12 +74,9 @@ public class ModelAnimationDebug @Override public ExtendedBlockState createBlockState() { - return new ExtendedBlockState(this, new IProperty[]{ FACING }, new IUnlistedProperty[]{ B3DFrameProperty.instance }); + return new ExtendedBlockState(this, new IProperty[]{ FACING, STATIC }, new IUnlistedProperty[]{ B3DFrameProperty.instance }); } - @Override - public int getRenderType() { return -1; } - @Override public boolean isOpaqueCube() { return false; } @@ -109,6 +109,11 @@ public class ModelAnimationDebug return new Chest(state); } + @Override + public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) { + return state.withProperty(STATIC, true); + } + /*@Override public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { TileEntity te = world.getTileEntity(pos); @@ -239,7 +244,8 @@ public class ModelAnimationDebug public void renderTileEntityAt(Chest te, double x, double y, double z, float partialTick, int breakStage) { IBlockState state = te.getWorld().getBlockState(te.getPos()); - IBakedModel model = this.blockRenderer.getModelFromBlockState(state, te.getWorld(), te.getPos()); + state = state.withProperty(STATIC, false); + IBakedModel model = this.blockRenderer.getBlockModelShapes().getModelForState(state); if(state instanceof IExtendedBlockState) { IExtendedBlockState exState = (IExtendedBlockState)state; diff --git a/src/test/resources/assets/forgedebugmodelanimation/blockstates/test_animation_block.json b/src/test/resources/assets/forgedebugmodelanimation/blockstates/test_animation_block.json index b12b0913d..2b46abd6c 100644 --- a/src/test/resources/assets/forgedebugmodelanimation/blockstates/test_animation_block.json +++ b/src/test/resources/assets/forgedebugmodelanimation/blockstates/test_animation_block.json @@ -6,13 +6,20 @@ }, "model": "forgedebugmodelloaderregistry:chest.b3d", "custom": { - "mesh": ["Cube.001"] + "mesh": ["Base", "Lid"] } }, "variants": { "normal": [{}], "inventory": [{ - "transform": "forge:default-block" + "transform": { + "rotation": { "y": 180 }, + "thirdperson": { + "rotation": [ { "z": 170 }, { "y": -45 }, { "z": 20 } ], + "translation": [ 0, 0.09375, -0.171875 ], + "scale": 0.375 + } + } }], "facing": { "down": { "transform": { "rotation": { "x": 90 } } }, @@ -21,6 +28,18 @@ "south": { "transform": "identity" }, "west": { "transform": { "rotation": { "y": 90 } } }, "east": { "transform": { "rotation": { "y": 270 } } } + }, + "static": { + "true": { + "custom": { + "mesh": ["Base"] + } + }, + "false": { + "custom": { + "mesh": ["Lid"] + } + } } } } diff --git a/src/test/resources/assets/forgedebugmodelloaderregistry/blockstates/CustomModelBlock.json b/src/test/resources/assets/forgedebugmodelloaderregistry/blockstates/CustomModelBlock.json index b1926396b..d8e22b4a6 100644 --- a/src/test/resources/assets/forgedebugmodelloaderregistry/blockstates/CustomModelBlock.json +++ b/src/test/resources/assets/forgedebugmodelloaderregistry/blockstates/CustomModelBlock.json @@ -6,7 +6,10 @@ "#chest": "entity/chest/normal" }, "model": "forgedebugmodelloaderregistry:chest.b3d", - "transform": "forge:default-block" + "transform": "forge:default-block", + "custom": { + "mesh": ["Base", "Lid"] + } }, "variants": { "normal": [{}], diff --git a/src/test/resources/assets/forgedebugmodelloaderregistry/models/block/chest.b3d b/src/test/resources/assets/forgedebugmodelloaderregistry/models/block/chest.b3d index b070d7a6fabd24734f4b11657566e347c321499e..5e5b6580809018b0ea5930b80c43926e3228e593 100644 GIT binary patch literal 5659 zcmeH~U5Hgx6vwxEb^7i$I#%}KZANpA1(U_W6G+LJRlJ`hN z6k-ob&4Ul26e;0LF+q9n2$m3pOfQ;3kq==;1O>-QB0McvJ-)tB+Co=rY-6?bZ!dX*5%? zj@8G@yL#{6BZnUo>hJ06{hosgF<{f!*yhL%W46fnbzn>m+d9EGS*!f_WjsSR6yzcu zaLCXd5@ufT)=27tZ}XnB?||s3tYFVaXF}%dR&ke}xy}9-=@hIxlW#}udTF|~c3@kZ zofz4sb~qo5zlZu@AkwY%0kT}`dTIM6bZdO-`z7rxwP$wm=<8Y1yNBb&q;cmj@t-7| z6P_$QC7v@j2urS+%Z0Cq=ZsehUnP9C@HO$A@mk@$@O8qC@tkq0@HAmbb|V!Q%^9y3 zUbJG#a@K-aTk@?)lAn;n6gLmnCi%s&l7%k_kDed2E1#d#DO^6?JX|Suujo1wEx=D` zU5#rY!rNor*Lj3yUv& z%EIC=pR%ydr&V+o*7?0YEWYq5Yh4$=Dmn}6Vq72AC1-tDa>b{tGmz}(BzPoy^xim= zH}AFfEwYd7*d{NLP;L&AIJBQj!mpBKUoA<0s(Co5P55fEXd-BkHGmo%b-X%N9j4Au zL)8eaP7)p>;UN+patZIMp8q5~M8ZQPJVe4nBs@gIL&=0s+K=-li2W4&Lt_7VLfQ>!zIn34c(M>Ve1Bijl^XI)zXDCSbfwSY%eQVcC(@onW-Clg4K6QR^onVK^d3Ho> z3Ku%NRK~efMwbE(*_*=rR~fp<^71@Q7a4hTpJ4p;RHnMRUYJ-a*r}+vLh+shk3L;ogA^LSeV@kjvf(8*dh~Pm44kCCE0fY!5L;xXz z2oXq#U_t~EBA8IJ0di9Jt1suYFCGfRr!1_-Qt??>ip!@gtmcH`v#^>s^cMLM z)q~X>tq03R;!~DwTsS^uVQGL4NI?Ep$FBvu>^xnuF|WT^s`C!{`(DW%*CXf9hDtx`GWY1v@NqSFoX_V8Kza$X&sP))j1MUBQO7AkXFP zV!376hk|8YSFoXV1shrlmUUdghL(Z_Pr+g@1D_Hpo VNPMCvJ70oN_xt}B%YWmGeDZiSUI8t@{7w%-s9j%X9B_lCx)?IcLtyocYgx zZd)v#zh>{OBsnZelHvZVht84hx_O@h%Rg#6m8A7v47~&WydASA<31Shlh?m z#u76Yd zzUU`s$e%ZUzG8MZnV&g#7AE=ib*NokA9GY}P0T_5s^9y}PyXm1asPjP>@AM}ul)E~ zzs*mb!~T5@Z0yd$pT7PbZgQ>u!M{&qcNSWokJYdF`a4|S{Q3E<{`u>(`sLT3^;4f_ z_@O?;E!J6h{Q14x`RvxYr7P|1s(xyS>U`OE^pj)E-F)~3%9A9r!T+LS@KyclkACvw z=j>YL$DhWzy-kw7hWXR%{EEjP^H=9rf1E$f`1A57ieYTkUkUqXJ*rLg6XWNvg#5vu zoj-4V&GIux^f#UlGeti!zW#B3Z*Bkh(7g4v>u;5ROndfg3UkwD|F!(yout9f+M_?O zzQlAWZ`EJLK>hjSuj5b6(Wki)=CAtW`N>aicp3ghs^fi(jhifA8uC=@AN<_Etl#q= zKCek)_ZMEV{Ehs`x*|Vy`gy`wXZMRy&GO^#ZnC}+<&XZ(EdP*S*D^#`~P2lxFhRN<9@?<{0L*wMnCxxYH$9``=vhoa@-uh6 z-}0ql{^+meulL9N(VzEzMt|P>QS-OTU++&F_SeYoyMsUGZ?(QL)dZ>T|6lp*{g!`t z^T5#b%y0GhyO>zI50_4s9wD6)+SsYmBc(@4j}C3DeqJZXO7)XFIX<+pCrCS_CrVEW zZR|AZbmFm(Po+<5=&XJxK+So4XT{NcZR{n|HPU|R+R(;~y&(v8x=(8g|(UM{^t zx;eD5L(*aC7U`9tjlD{`dT?MPXNer`|Be;;huD`o^x|!!+k98;4;S3@kzYsMo{j@6 zXYM+2qIc^-c10COSv49Ub-i!wy zO#p}hLgXYf9)vUjA_5qZnPxl~X#z+DP$B>l0h9>9L;xoOFcH9sbo##rQkrLlZ$OFw zR0Oah02KkO2!KTZEwaFj2Q5v&${7G&EWpJA-Xms|8~}c4f5`!2`T;N&5Wn_F$pK`( z0W%gL_fIW3z>FV2(+{Z02cXwalpLTY4q)R4+{^>8@dIw+`(zP7jsS23kRt${ae$rq z06KXAJ9z*+0_YI{j{tfE;3I$^0r&{uN4Nk8mjK}cAY1~3i-2$$5H143Wk5FcZyowk z;GL>=#ISexKl%8NIBzF5-i3Bz<9%r-Hr}arV&lDQCze{&OMV^V{jJ64$HqI}PHg0X zc4B#;>Lq^-kllV28M5>L>ooTM18>Y5UhS^=V$PDk50&Z&@6(P0yF_@aE?hcZ$P(U$ zKS~a;Jo8{lzgCgdambw-ZwHt<4hKJl|KY>?97Vmq_ijhQh_hm(j*ZgKCLX`&J_q4_ z`9aA+c+3Og5r0DPLwNKnj0LyYk3_2wJGLm)iF2+v+|z9BpW!b6Pk z>^0{b!b2cDq)*Cut(K+kMOn@P!sGnb$RZFP0^uR+%=j0cdO+XydpMtG?+!b_bI zUh0hSQfGvhItY((MtG?+!b=^5M?Zu|eh80m2oDS4(cegTS^OVT9A|{`;D06j&lUcc z3;*Ce8+$;pG5+*VM%}x^y%Trb{@cpGc8nLe3)$H0y?XPPTixCR?@SC72Uos*aJ;~M zX^bWQp!Dlyx40XZFDyU(*`vE=e?MN}PBq4|R^ng!<_6b$@uTJaTW+41QF*Jtz01bN zwG#j8uB~o#^uzLdPkuge>t(MOxSQG7?0N_Gtasgu4wkoe%_`sf@hb)HZ#Fj8Ym)N* zwq%8S?#=0y2fkfVzNh>70(ZPImb$UGwF5nF(aT+xpB8K>|NPxk1$dw_mfWm+$Lx7- s?#~M=AK!R=dHX|86yS<%EbBc?vBZCRU6*_Ip`OaV?{6x Date: Mon, 23 Nov 2015 23:18:52 -0500 Subject: [PATCH 052/133] Update mappings to 20151122. --- build.gradle | 2 +- .../client/ClientCommandHandler.java | 4 +- .../minecraftforge/client/GuiIngameForge.java | 40 +++++++++---------- .../client/model/ForgeBlockStateV1.java | 18 ++++----- .../minecraftforge/common/ChestGenHooks.java | 2 +- .../net/minecraftforge/common/ForgeHooks.java | 2 +- .../common/util/FakePlayer.java | 2 +- .../event/world/ExplosionEvent.java | 2 +- .../minecraftforge/fml/client/GuiModList.java | 2 +- .../network/internal/FMLNetworkHandler.java | 2 +- .../FMLControlledNamespacedRegistry.java | 2 +- .../fml/common/registry/GameRegistry.java | 2 +- .../fml/server/FMLServerHandler.java | 2 +- .../server/command/ForgeCommand.java | 8 ++-- .../debug/ForgeBlockStatesLoaderDebug.java | 40 +++++++++---------- 15 files changed, 65 insertions(+), 65 deletions(-) diff --git a/build.gradle b/build.gradle index f6acdc606..e8c7fbf2a 100644 --- a/build.gradle +++ b/build.gradle @@ -28,7 +28,7 @@ apply plugin: "net.minecraftforge.gradle.launch4j" minecraft { version = "1.8.8" //mappings = 'stable_16' - mappings = "snapshot_nodoc_20141130" + mappings = "snapshot_nodoc_20151122" workspaceDir = "projects" versionJson = "jsons/1.8.8-dev.json" buildUserdev = true diff --git a/src/main/java/net/minecraftforge/client/ClientCommandHandler.java b/src/main/java/net/minecraftforge/client/ClientCommandHandler.java index 4978616c6..455c76477 100644 --- a/src/main/java/net/minecraftforge/client/ClientCommandHandler.java +++ b/src/main/java/net/minecraftforge/client/ClientCommandHandler.java @@ -57,7 +57,7 @@ public class ClientCommandHandler extends CommandHandler return 0; } - if (icommand.canCommandSenderUse(sender)) + if (icommand.canCommandSenderUseCommand(sender)) { CommandEvent event = new CommandEvent(icommand, sender, args); if (MinecraftForge.EVENT_BUS.post(event)) @@ -69,7 +69,7 @@ public class ClientCommandHandler extends CommandHandler return 0; } - icommand.execute(sender, args); + icommand.processCommand(sender, args); return 1; } else diff --git a/src/main/java/net/minecraftforge/client/GuiIngameForge.java b/src/main/java/net/minecraftforge/client/GuiIngameForge.java index 5c3adae6b..a41ecdf01 100644 --- a/src/main/java/net/minecraftforge/client/GuiIngameForge.java +++ b/src/main/java/net/minecraftforge/client/GuiIngameForge.java @@ -113,7 +113,7 @@ public class GuiIngameForge extends GuiIngame if (Minecraft.isFancyGraphicsEnabled()) { - func_180480_a(mc.thePlayer.getBrightness(partialTicks), res); + renderVignette(mc.thePlayer.getBrightness(partialTicks), res); } else { @@ -163,16 +163,16 @@ public class GuiIngameForge extends GuiIngame Scoreboard scoreboard = this.mc.theWorld.getScoreboard(); ScoreObjective objective = null; - ScorePlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(mc.thePlayer.getName()); + ScorePlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(mc.thePlayer.getCommandSenderName()); if (scoreplayerteam != null) { - int slot = scoreplayerteam.func_178775_l().getColorIndex(); + int slot = scoreplayerteam.getChatFormat().getColorIndex(); if (slot >= 0) objective = scoreboard.getObjectiveInDisplaySlot(3 + slot); } ScoreObjective scoreobjective1 = objective != null ? objective : scoreboard.getObjectiveInDisplaySlot(1); if (renderObjective && scoreobjective1 != null) { - this.func_180475_a(scoreobjective1, res); + this.renderScoreboard(scoreobjective1, res); } GlStateManager.enableBlend(); @@ -234,7 +234,7 @@ public class GuiIngameForge extends GuiIngame { if (itemstack.getItem() == Item.getItemFromBlock(Blocks.pumpkin)) { - func_180476_e(res); + renderPumpkinOverlay(res); } else { @@ -345,28 +345,28 @@ public class GuiIngameForge extends GuiIngame EntityPlayer player = (EntityPlayer)this.mc.getRenderViewEntity(); int health = MathHelper.ceiling_float_int(player.getHealth()); - boolean highlight = field_175191_F > (long)updateCounter && (field_175191_F - (long)updateCounter) / 3L %2L == 1L; + boolean highlight = healthUpdateCounter > (long)updateCounter && (healthUpdateCounter - (long)updateCounter) / 3L %2L == 1L; - if (health < this.field_175194_C && player.hurtResistantTime > 0) + if (health < this.playerHealth && player.hurtResistantTime > 0) { this.lastSystemTime = Minecraft.getSystemTime(); - this.field_175191_F = (long)(this.updateCounter + 20); + this.healthUpdateCounter = (long)(this.updateCounter + 20); } - else if (health > this.field_175194_C && player.hurtResistantTime > 0) + else if (health > this.playerHealth && player.hurtResistantTime > 0) { this.lastSystemTime = Minecraft.getSystemTime(); - this.field_175191_F = (long)(this.updateCounter + 10); + this.healthUpdateCounter = (long)(this.updateCounter + 10); } if (Minecraft.getSystemTime() - this.lastSystemTime > 1000L) { - this.field_175194_C = health; - this.field_175189_D = health; + this.playerHealth = health; + this.lastPlayerHealth = health; this.lastSystemTime = Minecraft.getSystemTime(); } - this.field_175194_C = health; - int healthLast = this.field_175189_D; + this.playerHealth = health; + int healthLast = this.lastPlayerHealth; IAttributeInstance attrMaxHealth = player.getEntityAttribute(SharedMonsterAttributes.maxHealth); float healthMax = (float)attrMaxHealth.getAttributeValue(); @@ -748,11 +748,11 @@ public class GuiIngameForge extends GuiIngame GlStateManager.pushMatrix(); GlStateManager.scale(4.0F, 4.0F, 4.0F); int l = opacity << 24 & -16777216; - this.func_175179_f().drawString(this.field_175201_x, (float)(-this.func_175179_f().getStringWidth(this.field_175201_x) / 2), -10.0F, 16777215 | l, true); + this.getFontRenderer().drawString(this.field_175201_x, (float)(-this.getFontRenderer().getStringWidth(this.field_175201_x) / 2), -10.0F, 16777215 | l, true); GlStateManager.popMatrix(); GlStateManager.pushMatrix(); GlStateManager.scale(2.0F, 2.0F, 2.0F); - this.func_175179_f().drawString(this.field_175200_y, (float)(-this.func_175179_f().getStringWidth(this.field_175200_y) / 2), 5.0F, 16777215 | l, true); + this.getFontRenderer().drawString(this.field_175200_y, (float)(-this.getFontRenderer().getStringWidth(this.field_175200_y) / 2), 5.0F, 16777215 | l, true); GlStateManager.popMatrix(); GlStateManager.disableBlend(); GlStateManager.popMatrix(); @@ -784,16 +784,16 @@ public class GuiIngameForge extends GuiIngame ScoreObjective scoreobjective = this.mc.theWorld.getScoreboard().getObjectiveInDisplaySlot(0); NetHandlerPlayClient handler = mc.thePlayer.sendQueue; - if (mc.gameSettings.keyBindPlayerList.isKeyDown() && (!mc.isIntegratedServerRunning() || handler.func_175106_d().size() > 1 || scoreobjective != null)) + if (mc.gameSettings.keyBindPlayerList.isKeyDown() && (!mc.isIntegratedServerRunning() || handler.getPlayerInfoMap().size() > 1 || scoreobjective != null)) { - this.overlayPlayerList.func_175246_a(true); + this.overlayPlayerList.updatePlayerList(true); if (pre(PLAYER_LIST)) return; - this.overlayPlayerList.func_175249_a(width, this.mc.theWorld.getScoreboard(), scoreobjective); + this.overlayPlayerList.renderPlayerlist(width, this.mc.theWorld.getScoreboard(), scoreobjective); post(PLAYER_LIST); } else { - this.overlayPlayerList.func_175246_a(false); + this.overlayPlayerList.updatePlayerList(false); } } diff --git a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java index b5ced65a6..462a30751 100644 --- a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java +++ b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java @@ -50,7 +50,7 @@ public class ForgeBlockStateV1 extends Marker { JsonObject json = element.getAsJsonObject(); ForgeBlockStateV1 ret = new ForgeBlockStateV1(); - ret.forge_marker = JsonUtils.getJsonObjectIntegerFieldValue(json, "forge_marker"); + ret.forge_marker = JsonUtils.getInt(json, "forge_marker"); if (json.has("defaults")) // Load defaults Variant. { @@ -146,13 +146,13 @@ public class ForgeBlockStateV1 extends Marker part.state = state; } } - + Iterator> iter = v.submodels.values().iterator(); - + while (iter.hasNext()) { List submodel = iter.next(); - + if (submodel == null) iter.remove(); } @@ -430,7 +430,7 @@ public class ForgeBlockStateV1 extends Marker if (json.get("model").isJsonNull()) ret.model = null; // Allow overriding base model to remove it from a state. else - ret.model = getBlockLocation(JsonUtils.getJsonObjectStringFieldValue(json, "model")); + ret.model = getBlockLocation(JsonUtils.getString(json, "model")); ret.modelSet = true; } @@ -447,8 +447,8 @@ public class ForgeBlockStateV1 extends Marker if (json.has("x") || json.has("y")) { // Load rotation values. - int x = JsonUtils.getJsonObjectIntegerFieldValueOrDefault(json, "x", 0); - int y = JsonUtils.getJsonObjectIntegerFieldValueOrDefault(json, "y", 0); + int x = JsonUtils.getInt(json, "x", 0); + int y = JsonUtils.getInt(json, "y", 0); ret.state = Optional.of(new TRSRTransformation(ModelRotation.getModelRotation(x, y))); if (!ret.state.isPresent()) throw new JsonParseException("Invalid BlockModelRotation x: " + x + " y: " + y); @@ -589,12 +589,12 @@ public class ForgeBlockStateV1 extends Marker if (json.has("uvlock")) { // Load uvlock. - ret.uvLock = Optional.of(JsonUtils.getJsonObjectBooleanFieldValue(json, "uvlock")); + ret.uvLock = Optional.of(JsonUtils.getBoolean(json, "uvlock")); } if (json.has("weight")) { // Load weight. - ret.weight = Optional.of(JsonUtils.getJsonObjectIntegerFieldValue(json, "weight")); + ret.weight = Optional.of(JsonUtils.getInt(json, "weight")); } if (json.has("submodel")) diff --git a/src/main/java/net/minecraftforge/common/ChestGenHooks.java b/src/main/java/net/minecraftforge/common/ChestGenHooks.java index 55fd8e029..61c024423 100644 --- a/src/main/java/net/minecraftforge/common/ChestGenHooks.java +++ b/src/main/java/net/minecraftforge/common/ChestGenHooks.java @@ -234,7 +234,7 @@ public class ChestGenHooks public ItemStack getOneItem(Random rand) { WeightedRandomChestContent item = (WeightedRandomChestContent)WeightedRandom.getRandomItem(rand, getItems(rand)); - ItemStack[] stacks = ChestGenHooks.generateStacks(rand, item.theItemId, item.theMinimumChanceToGenerateItem, item.theMaximumChanceToGenerateItem); + ItemStack[] stacks = ChestGenHooks.generateStacks(rand, item.theItemId, item.minStackSize, item.maxStackSize); return (stacks.length > 0 ? stacks[0] : null); } diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index 429a85966..aab0aca45 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -670,7 +670,7 @@ public class ForgeHooks if (world.getTileEntity(pos) == null) { S23PacketBlockChange packet = new S23PacketBlockChange(world, pos); - packet.field_148883_d = Blocks.air.getDefaultState(); + packet.blockState = Blocks.air.getDefaultState(); entityPlayer.playerNetServerHandler.sendPacket(packet); } diff --git a/src/main/java/net/minecraftforge/common/util/FakePlayer.java b/src/main/java/net/minecraftforge/common/util/FakePlayer.java index 260737782..3cbb21eb2 100644 --- a/src/main/java/net/minecraftforge/common/util/FakePlayer.java +++ b/src/main/java/net/minecraftforge/common/util/FakePlayer.java @@ -23,7 +23,7 @@ public class FakePlayer extends EntityPlayerMP } @Override public Vec3 getPositionVector(){ return new Vec3(0, 0, 0); } - @Override public boolean canUseCommand(int i, String s){ return false; } + @Override public boolean canCommandSenderUseCommand(int i, String s){ return false; } @Override public void addChatComponentMessage(IChatComponent chatmessagecomponent){} @Override public void addStat(StatBase par1StatBase, int par2){} @Override public void openGui(Object mod, int modGuiId, World world, int x, int y, int z){} diff --git a/src/main/java/net/minecraftforge/event/world/ExplosionEvent.java b/src/main/java/net/minecraftforge/event/world/ExplosionEvent.java index fc14d7d29..167c09724 100644 --- a/src/main/java/net/minecraftforge/event/world/ExplosionEvent.java +++ b/src/main/java/net/minecraftforge/event/world/ExplosionEvent.java @@ -64,7 +64,7 @@ public class ExplosionEvent extends Event /** return the list of blocks affected by the explosion. */ public List getAffectedBlocks() { - return explosion.func_180343_e(); + return explosion.getAffectedBlockPositions(); } /** return the list of entities affected by the explosion. */ diff --git a/src/main/java/net/minecraftforge/fml/client/GuiModList.java b/src/main/java/net/minecraftforge/fml/client/GuiModList.java index 8cb8efc68..2792b7b40 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiModList.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiModList.java @@ -579,7 +579,7 @@ public class GuiModList extends GuiScreen k += GuiModList.this.fontRendererObj.getStringWidth(((ChatComponentText)part).getChatComponentText_TextValue()); if (k >= x) { - GuiModList.this.func_175276_a(part); + GuiModList.this.handleComponentClick(part); break; } } diff --git a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLNetworkHandler.java b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLNetworkHandler.java index 657bb22dd..285128114 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLNetworkHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLNetworkHandler.java @@ -90,7 +90,7 @@ public class FMLNetworkHandler embeddedChannel.writeOutbound(openGui); entityPlayerMP.openContainer = remoteGuiContainer; entityPlayerMP.openContainer.windowId = windowId; - entityPlayerMP.openContainer.addCraftingToCrafters(entityPlayerMP); + entityPlayerMP.openContainer.onCraftGuiOpened(entityPlayerMP); } } else if (entityPlayer instanceof FakePlayer) diff --git a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java index 81a3c914b..da5139d4d 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java @@ -456,7 +456,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul for (I thing : this.typeSafeIterable()) { - if (!registry.field_148758_b.containsKey(thing)) + if (!registry.inverseObjectRegistry.containsKey(thing)) { if (!registry.activeSubstitutions.containsKey(getNameForObject(thing).toString())) { diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java index f222b1b67..8116b2030 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java @@ -506,7 +506,7 @@ public class GameRegistry NBTBase nbttag = null; try { - nbttag = JsonToNBT.func_180713_a(nbtString); + nbttag = JsonToNBT.getTagFromJson(nbtString); } catch (NBTException e) { FMLLog.getLogger().log(Level.WARN, "Encountered an exception parsing ItemStack NBT string {}", nbtString, e); diff --git a/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java b/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java index be2f2d67a..252e94dc3 100644 --- a/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java +++ b/src/main/java/net/minecraftforge/fml/server/FMLServerHandler.java @@ -180,7 +180,7 @@ public class FMLServerHandler implements IFMLSidedHandler { for (Iterator it = GenericIterableFactory.newCastingIterable(dedServer.pendingCommandList, ServerCommand.class).iterator(); it.hasNext(); ) { - String cmd = it.next().input.trim().toLowerCase(); + String cmd = it.next().command.trim().toLowerCase(); if (cmd.equals("/fml confirm")) { diff --git a/src/main/java/net/minecraftforge/server/command/ForgeCommand.java b/src/main/java/net/minecraftforge/server/command/ForgeCommand.java index 163bc3469..a940bd8c4 100644 --- a/src/main/java/net/minecraftforge/server/command/ForgeCommand.java +++ b/src/main/java/net/minecraftforge/server/command/ForgeCommand.java @@ -25,7 +25,7 @@ public class ForgeCommand extends CommandBase { } @Override - public String getName() + public String getCommandName() { return "forge"; } @@ -42,7 +42,7 @@ public class ForgeCommand extends CommandBase { return 2; } @Override - public void execute(ICommandSender sender, String[] args) throws CommandException + public void processCommand(ICommandSender sender, String[] args) throws CommandException { if (args.length == 0) { @@ -80,7 +80,7 @@ public class ForgeCommand extends CommandBase { else if (args.length == 2) { if ("tps".equals(args[0])) { - return func_175762_a(args, getServer().worldTickTimes.keySet()); + return getListOfStringsMatchingLastWord(args, getServer().worldTickTimes.keySet()); } else if ("track".equals(args[0])) { @@ -89,7 +89,7 @@ public class ForgeCommand extends CommandBase { } return null; } - + private void handleTracking(ICommandSender sender, String[] args) throws CommandException { if (args.length != 3) diff --git a/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java b/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java index 4dfa7b49d..1ad65041e 100644 --- a/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java +++ b/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java @@ -36,7 +36,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class ForgeBlockStatesLoaderDebug { public static final String MODID = "ForgeBlockStatesLoader"; public static final String ASSETS = "forgeblockstatesloader:"; - + public static final Block blockCustom = new CustomMappedBlock(); public static final String nameCustomWall = "custom_wall"; public static final BlockWall blockCustomWall = new BlockWall(Blocks.cobblestone); @@ -48,42 +48,42 @@ public class ForgeBlockStatesLoaderDebug { return BlockWall.EnumType.byMetadata(stack.getMetadata()).getUnlocalizedName(); } }); - + @EventHandler public void preInit(FMLPreInitializationEvent event) - { + { blockCustom.setUnlocalizedName(MODID + ".customBlock"); GameRegistry.registerBlock(blockCustom, "customBlock"); - + blockCustomWall.setUnlocalizedName(MODID + ".customWall"); GameRegistry.registerBlock(blockCustomWall, null, nameCustomWall); GameRegistry.registerItem(itemCustomWall, nameCustomWall); GameData.getBlockItemMap().put(blockCustomWall, itemCustomWall); - + if (event.getSide() == Side.CLIENT) preInitClient(event); } - + @SideOnly(Side.CLIENT) public void preInitClient(FMLPreInitializationEvent event) { - ModelLoader.setCustomStateMapper(blockCustom, new StateMap.Builder().setProperty(CustomMappedBlock.VARIANT).build()); - + ModelLoader.setCustomStateMapper(blockCustom, new StateMap.Builder().withName(CustomMappedBlock.VARIANT).build()); + ModelLoader.setCustomStateMapper(blockCustomWall, new IStateMapper() { - StateMap stateMap = new StateMap.Builder().setProperty(BlockWall.VARIANT).setBuilderSuffix("_wall").build(); + StateMap stateMap = new StateMap.Builder().withName(BlockWall.VARIANT).withSuffix("_wall").build(); @Override public Map putStateModelLocations(Block block) { Map map = (Map) stateMap.putStateModelLocations(block); Map newMap = Maps.newHashMap(); - + for (Entry e : map.entrySet()) { ModelResourceLocation loc = e.getValue(); newMap.put(e.getKey(), new ModelResourceLocation(ASSETS + loc.getResourcePath(), loc.getVariant())); } - + return newMap; } }); @@ -92,41 +92,41 @@ public class ForgeBlockStatesLoaderDebug { ModelLoader.setCustomModelResourceLocation(customWallItem, 1, new ModelResourceLocation(ASSETS + "mossy_cobblestone_wall", "inventory")); ModelBakery.addVariantName(customWallItem, ASSETS + "cobblestone_wall", ASSETS + "mossy_cobblestone_wall"); } - + // this block is never actually used, it's only needed for the error message on load to see the variant it maps to public static class CustomMappedBlock extends Block { public static final PropertyEnum VARIANT = PropertyEnum.create("type", CustomVariant.class); - + protected CustomMappedBlock() { super(Material.rock); - + this.setUnlocalizedName(MODID + ".customMappedBlock"); } - + @Override protected BlockState createBlockState() { return new BlockState(this, VARIANT); } - + @Override public int getMetaFromState(IBlockState state) { return ((CustomVariant)state.getValue(VARIANT)).ordinal(); } - + @Override public IBlockState getStateFromMeta(int meta) { if(meta > CustomVariant.values().length || meta < 0) meta = 0; - + return this.getDefaultState().withProperty(VARIANT, CustomVariant.values()[meta]); } - + public static enum CustomVariant implements IStringSerializable { TypeA, TypeB; - + public String getName() { return this.toString(); }; } } From 22e99a2cff723f885a319e0a4fe5f94ee3280ee9 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 24 Nov 2015 03:37:17 -0800 Subject: [PATCH 053/133] Update universal manifest for 1.8.8's json. --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e8c7fbf2a..2a53eeb89 100644 --- a/build.gradle +++ b/build.gradle @@ -125,7 +125,7 @@ outputJar { manifest.attributes([ "Main-Class": "net.minecraftforge.fml.relauncher.ServerLaunchWrapper", "TweakClass": "net.minecraftforge.fml.common.launcher.FMLTweaker", - "Class-Path": getServerClasspath(file("jsons/1.8-rel.json")) + "Class-Path": getServerClasspath(file("jsons/${minecraft.version}-rel.json")) ]) } From b4dc15a9cb6b3d7918749f33c87b8600ad959b72 Mon Sep 17 00:00:00 2001 From: cpw Date: Tue, 24 Nov 2015 10:05:35 -0500 Subject: [PATCH 054/133] Cleanup Fluid deprecations stuff. --- .../classloading/FMLForgePlugin.java | 2 +- .../classloading/FluidIdTransformer.java | 55 ------------- .../client/ForgeHooksClient.java | 1 - .../java/net/minecraftforge/fluids/Fluid.java | 80 ------------------- .../minecraftforge/fluids/FluidRegistry.java | 37 ++------- .../net/minecraftforge/fluids/FluidStack.java | 22 ----- 6 files changed, 7 insertions(+), 190 deletions(-) delete mode 100644 src/main/java/net/minecraftforge/classloading/FluidIdTransformer.java diff --git a/src/main/java/net/minecraftforge/classloading/FMLForgePlugin.java b/src/main/java/net/minecraftforge/classloading/FMLForgePlugin.java index ea9bb5952..9dc4bf19d 100644 --- a/src/main/java/net/minecraftforge/classloading/FMLForgePlugin.java +++ b/src/main/java/net/minecraftforge/classloading/FMLForgePlugin.java @@ -13,7 +13,7 @@ public class FMLForgePlugin implements IFMLLoadingPlugin @Override public String[] getASMTransformerClass() { - return new String[] { "net.minecraftforge.classloading.FluidIdTransformer" }; + return new String[0]; } @Override diff --git a/src/main/java/net/minecraftforge/classloading/FluidIdTransformer.java b/src/main/java/net/minecraftforge/classloading/FluidIdTransformer.java deleted file mode 100644 index bd6a49a87..000000000 --- a/src/main/java/net/minecraftforge/classloading/FluidIdTransformer.java +++ /dev/null @@ -1,55 +0,0 @@ -package net.minecraftforge.classloading; - -import java.util.ListIterator; - -import net.minecraft.launchwrapper.IClassTransformer; - -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.tree.AbstractInsnNode; -import org.objectweb.asm.tree.ClassNode; -import org.objectweb.asm.tree.FieldInsnNode; -import org.objectweb.asm.tree.MethodInsnNode; -import org.objectweb.asm.tree.MethodNode; - -import net.minecraftforge.fml.common.FMLLog;; - -public class FluidIdTransformer implements IClassTransformer { - private static final String FLUID_TYPE = "net/minecraftforge/fluids/FluidStack"; - private static final String GETID_NAME = "getFluidID"; - private static final String LEGACY_FIELDNAME = "fluidID"; - private static final String GETID_DESC = "()I"; - - @Override - public byte[] transform(String name, String transformedName, byte[] basicClass) { - if (basicClass == null) - return null; - ClassNode classNode = new ClassNode(); - ClassReader classReader = new ClassReader(basicClass); - classReader.accept(classNode, 0); - - for (MethodNode m: classNode.methods) - { - for (ListIterator it = m.instructions.iterator(); it.hasNext(); ) - { - AbstractInsnNode insnNode = it.next(); - if (insnNode.getType() == AbstractInsnNode.FIELD_INSN) - { - FieldInsnNode fi = (FieldInsnNode)insnNode; - if (FLUID_TYPE.equals(fi.owner) && LEGACY_FIELDNAME.equals(fi.name) && fi.getOpcode() == Opcodes.GETFIELD) - { - FMLLog.fine("Method %s.%s%s: Replacing GETFIELD fluidID with INVOKEVIRTUAL getFluidID", name, m.name, m.desc); - it.remove(); - MethodInsnNode replace = new MethodInsnNode(Opcodes.INVOKEVIRTUAL, FLUID_TYPE, GETID_NAME, GETID_DESC, false); - it.add(replace); - } - } - } - } - ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS); - classNode.accept(writer); - return writer.toByteArray(); - } - -} diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 2b58deec7..31e7ef026 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -300,7 +300,6 @@ public class ForgeHooksClient { MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Pre(map)); ModelLoader.White.instance.register(map); - FluidRegistry.onTextureStitchedPre(map); } public static void onTextureStitchedPost(TextureMap map) diff --git a/src/main/java/net/minecraftforge/fluids/Fluid.java b/src/main/java/net/minecraftforge/fluids/Fluid.java index faf675874..9198ac271 100644 --- a/src/main/java/net/minecraftforge/fluids/Fluid.java +++ b/src/main/java/net/minecraftforge/fluids/Fluid.java @@ -42,15 +42,6 @@ public class Fluid /** The unlocalized name of this fluid. */ protected String unlocalizedName; - /** - * The Icons for this fluid. - * @deprecated use ResourceLocation-based ones instead. - */ - @Deprecated - protected TextureAtlasSprite stillIcon; - @Deprecated - protected TextureAtlasSprite flowingIcon; - protected final ResourceLocation still; protected final ResourceLocation flowing; @@ -112,15 +103,6 @@ public class Fluid */ protected Block block = null; - /** - * @deprecated use the constructor with texture locations. - */ - @Deprecated - public Fluid(String fluidName) - { - this(fluidName, null, null); - } - public Fluid(String fluidName, ResourceLocation still, ResourceLocation flowing) { this.fluidName = fluidName.toLowerCase(Locale.ENGLISH); @@ -209,15 +191,6 @@ public class Fluid * Returns the localized name of this fluid. */ public String getLocalizedName(FluidStack stack) - { - return getLocalizedName(); - } - - /** - * Use the FluidStack sensitive version above - */ - @Deprecated - public String getLocalizedName() { String s = this.getUnlocalizedName(); return s == null ? "" : StatCollector.translateToLocal(s); @@ -239,14 +212,6 @@ public class Fluid return "fluid." + this.unlocalizedName; } - /** - * Returns 0 for "/terrain.png". ALL FLUID TEXTURES MUST BE ON THIS SHEET. - */ - public final int getSpriteNumber() - { - return 0; - } - /* Default Accessors */ public final int getLuminosity() { @@ -293,47 +258,6 @@ public class Fluid return flowing; } - @Deprecated - public final Fluid setStillIcon(TextureAtlasSprite stillIcon) - { - this.stillIcon = stillIcon; - return this; - } - - @Deprecated - public final Fluid setFlowingIcon(TextureAtlasSprite flowingIcon) - { - this.flowingIcon = flowingIcon; - return this; - } - - @Deprecated - public final Fluid setIcons(TextureAtlasSprite stillIcon, TextureAtlasSprite flowingIcon) - { - return this.setStillIcon(stillIcon).setFlowingIcon(flowingIcon); - } - - @Deprecated - public final Fluid setIcons(TextureAtlasSprite commonIcon) - { - return this.setStillIcon(commonIcon).setFlowingIcon(commonIcon); - } - - @Deprecated - public TextureAtlasSprite getIcon(){ return getStillIcon(); } - - @Deprecated - public TextureAtlasSprite getStillIcon() - { - return this.stillIcon; - } - - @Deprecated - public TextureAtlasSprite getFlowingIcon() - { - return this.flowingIcon; - } - /* Stack-based Accessors */ public int getLuminosity(FluidStack stack){ return getLuminosity(); } public int getDensity(FluidStack stack){ return getDensity(); } @@ -342,8 +266,6 @@ public class Fluid public boolean isGaseous(FluidStack stack){ return isGaseous(); } public EnumRarity getRarity(FluidStack stack){ return getRarity(); } public int getColor(FluidStack stack){ return getColor(); } - @Deprecated - public TextureAtlasSprite getIcon(FluidStack stack){ return getIcon(); } public ResourceLocation getStill(FluidStack stack) { return getStill(); } public ResourceLocation getFlowing(FluidStack stack) { return getFlowing(); } @@ -355,8 +277,6 @@ public class Fluid public boolean isGaseous(World world, BlockPos pos){ return isGaseous(); } public EnumRarity getRarity(World world, BlockPos pos){ return getRarity(); } public int getColor(World world, BlockPos pos){ return getColor(); } - @Deprecated - public TextureAtlasSprite getIcon(World world, BlockPos pos){ return getIcon(); } public ResourceLocation getStill(World world, BlockPos pos) { return getStill(); } public ResourceLocation getFlowing(World world, BlockPos pos) { return getFlowing(); } diff --git a/src/main/java/net/minecraftforge/fluids/FluidRegistry.java b/src/main/java/net/minecraftforge/fluids/FluidRegistry.java index f444e4e27..9869c9545 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidRegistry.java +++ b/src/main/java/net/minecraftforge/fluids/FluidRegistry.java @@ -52,20 +52,18 @@ public abstract class FluidRegistry public static final Fluid WATER = new Fluid("water", new ResourceLocation("blocks/water_still"), new ResourceLocation("blocks/water_flow")) { @Override - public String getLocalizedName() { + public String getLocalizedName(FluidStack fs) { return StatCollector.translateToLocal("tile.water.name"); } }.setBlock(Blocks.water).setUnlocalizedName(Blocks.water.getUnlocalizedName()); public static final Fluid LAVA = new Fluid("lava", new ResourceLocation("blocks/lava_still"), new ResourceLocation("blocks/lava_flow")) { @Override - public String getLocalizedName() { + public String getLocalizedName(FluidStack fs) { return StatCollector.translateToLocal("tile.lava.name"); } }.setBlock(Blocks.lava).setLuminosity(15).setDensity(3000).setViscosity(6000).setTemperature(1300).setUnlocalizedName(Blocks.lava.getUnlocalizedName()); - public static int renderIdFluid = -1; - static { registerFluid(WATER); @@ -87,7 +85,8 @@ public abstract class FluidRegistry /** * Called by forge to load default fluid IDs from the world or from server -> client for syncing * DO NOT call this and expect useful behaviour. - * @param newfluidIDs + * @param localFluidIDs + * @param defaultNames */ private static void loadFluidDefaults(BiMap localFluidIDs, Set defaultNames) { @@ -206,12 +205,6 @@ public abstract class FluidRegistry return fluidIDs.get(getFluid(fluidName)); } - @Deprecated //Remove in 1.8.3 - public static String getFluidName(int fluidID) - { - return fluidNames.get(fluidID); - } - public static String getFluidName(Fluid fluid) { return fluids.inverse().get(fluid); @@ -242,10 +235,9 @@ public abstract class FluidRegistry /** * Returns a read-only map containing Fluid Names and their associated IDs. */ - @Deprecated //Change return type to in 1.8.3 - public static Map getRegisteredFluidIDs() + public static Map getRegisteredFluidIDs() { - return ImmutableMap.copyOf(fluidNames.inverse()); + return ImmutableMap.copyOf(fluidIDs); } /** @@ -396,21 +388,4 @@ public abstract class FluidRegistry fluid = fluids.get(name); } } - - public static void onTextureStitchedPre(TextureMap map) - { - for(Fluid fluid : fluids.values()) - { - if(fluid.getStill() != null) - { - TextureAtlasSprite still = map.registerSprite(fluid.getStill()); - fluid.setStillIcon(still); - } - if(fluid.getFlowing() != null) - { - TextureAtlasSprite flowing = map.registerSprite(fluid.getFlowing()); - fluid.setStillIcon(flowing); - } - } - } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/fluids/FluidStack.java b/src/main/java/net/minecraftforge/fluids/FluidStack.java index 053e7ba44..8af9ede19 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidStack.java +++ b/src/main/java/net/minecraftforge/fluids/FluidStack.java @@ -22,8 +22,6 @@ public class FluidStack * This field will be removed in 1.8. It may be incorrect after a world is loaded. Code should always * use {@link #getFluid()} instead. That will always reflect the correct value. */ - @Deprecated - public final Fluid fluid; public int amount; public NBTTagCompound tag; private RegistryDelegate fluidDelegate; @@ -42,7 +40,6 @@ public class FluidStack } this.fluidDelegate = FluidRegistry.makeDelegate(fluid); this.amount = amount; - this.fluid = fluid; } public FluidStack(Fluid fluid, int amount, NBTTagCompound nbt) @@ -60,20 +57,6 @@ public class FluidStack this(stack.getFluid(), amount, stack.tag); } - // To be removed in 1.8 - @Deprecated - public FluidStack(int fluidID, int amount) - { - this(FluidRegistry.getFluid(fluidID), amount); - } - - // To be removed in 1.8 - @Deprecated - public FluidStack(int fluidID, int amount, NBTTagCompound nbt) - { - this(FluidRegistry.getFluid(fluidID), amount, nbt); - } - /** * This provides a safe method for retrieving a FluidStack - if the Fluid is invalid, the stack * will return as null. @@ -116,11 +99,6 @@ public class FluidStack return fluidDelegate.get(); } - public final int getFluidID() - { - return FluidRegistry.getFluidID(getFluid()); - } - public String getLocalizedName() { return this.getFluid().getLocalizedName(this); From c713309769af2cf0b75d2ce517a40c3d0eec7332 Mon Sep 17 00:00:00 2001 From: cpw Date: Tue, 24 Nov 2015 14:44:19 -0500 Subject: [PATCH 055/133] OMG! Documentation? WUT? I haz lost my mind. Also, Functional interface for IMC. Senders can send a classname implementing Guava's function, and receivers will be able to get that function, and do, well, whatever, really. Probably best for those callback type scenarios, connecting up APIs and stuffs. --- .../common/event/FMLConstructionEvent.java | 3 + .../fml/common/event/FMLEvent.java | 4 + .../event/FMLFingerprintViolationEvent.java | 5 + .../common/event/FMLInitializationEvent.java | 13 ++ .../fml/common/event/FMLInterModComms.java | 151 +++++++++++++++++- .../common/event/FMLLoadCompleteEvent.java | 6 + .../fml/common/event/FMLLoadEvent.java | 5 + .../common/event/FMLMissingMappingsEvent.java | 16 +- .../common/event/FMLModIdMappingEvent.java | 15 +- .../event/FMLPostInitializationEvent.java | 45 +++++- .../event/FMLPreInitializationEvent.java | 43 +++++ .../event/FMLServerAboutToStartEvent.java | 8 + .../common/event/FMLServerStartedEvent.java | 6 + .../common/event/FMLServerStartingEvent.java | 8 + .../common/event/FMLServerStoppedEvent.java | 8 + .../common/event/FMLServerStoppingEvent.java | 6 + .../fml/common/event/FMLStateEvent.java | 12 ++ 17 files changed, 333 insertions(+), 21 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLConstructionEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLConstructionEvent.java index 9d259bcc3..4c854819a 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLConstructionEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLConstructionEvent.java @@ -18,6 +18,9 @@ import net.minecraftforge.fml.common.discovery.ASMDataTable; import com.google.common.collect.ListMultimap; +/** + * An internal FML event used to signal the construction of mods. Should not be used by mods. + */ public class FMLConstructionEvent extends FMLStateEvent { private ModClassLoader modClassLoader; diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLEvent.java index 943655a87..77aa097c5 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLEvent.java @@ -14,6 +14,10 @@ package net.minecraftforge.fml.common.event; import net.minecraftforge.fml.common.ModContainer; +/** + * Parent type to all FML events. This is based on Guava EventBus. Event Subscription isn't using the Guava annotation + * however, it's using a custom annotation specific to FML {@link net.minecraftforge.fml.common.Mod.EventHandler} + */ public class FMLEvent { public final String getEventType() diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLFingerprintViolationEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLFingerprintViolationEvent.java index e13280ee5..3f351563f 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLFingerprintViolationEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLFingerprintViolationEvent.java @@ -16,8 +16,13 @@ import java.io.File; import java.util.Set; import com.google.common.collect.ImmutableSet; +import net.minecraftforge.fml.common.Mod; +/** + * A special event used when the {@link Mod#certificateFingerprint()} doesn't match the certificate loaded from the JAR + * file. You could use this to log a warning that the code that is running might not be yours, for example. + */ public class FMLFingerprintViolationEvent extends FMLEvent { public final boolean isDirectory; diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLInitializationEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLInitializationEvent.java index 19c6968d0..c3b48d154 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLInitializationEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLInitializationEvent.java @@ -14,6 +14,19 @@ package net.minecraftforge.fml.common.event; import net.minecraftforge.fml.common.LoaderState.ModState; +/** + * Called after {@link FMLPreInitializationEvent} and before {@link FMLPostInitializationEvent} during mod + * startup. + * + * This is the second of three commonly called events during mod initialization. + * + * Recommended activities: Register your recipes and Ore Dictionary entries in the + * {@link net.minecraftforge.fml.common.registry.GameRegistry} and {@link net.minecraftforge.oredict.OreDictionary} + * Dispatch requests through {@link FMLInterModComms} to other mods, to tell them what you wish them to do. + * + * @see net.minecraftforge.fml.common.Mod.EventHandler for how to subscribe to this event + * @author cpw + */ public class FMLInitializationEvent extends FMLStateEvent { diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLInterModComms.java b/src/main/java/net/minecraftforge/fml/common/event/FMLInterModComms.java index dcbc80cbf..5db7be6bc 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLInterModComms.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLInterModComms.java @@ -12,6 +12,8 @@ package net.minecraftforge.fml.common.event; +import com.google.common.base.Function; +import com.google.common.base.Optional; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -23,6 +25,7 @@ import net.minecraftforge.fml.common.Mod.Instance; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ImmutableList; +import org.apache.logging.log4j.Level; /** * Simple intermod communications to receive simple messages directed at you @@ -37,10 +40,10 @@ public class FMLInterModComms { /** * Subscribe to this event to receive your messages (they are sent between - * {@link Init} and {@link PostInit}) + * {@link FMLInitializationEvent} and {@link FMLPostInitializationEvent}) * + * @see net.minecraftforge.fml.common.Mod.EventHandler for how to subscribe to this event * @author cpw - * */ public static class IMCEvent extends FMLEvent { private ModContainer activeContainer; @@ -72,6 +75,7 @@ public class FMLInterModComms { * */ public static final class IMCMessage { + private final boolean isFunction; /** * This is the modid of the mod that sent you the message */ @@ -83,12 +87,19 @@ public class FMLInterModComms { /** * This field, and {@link #key} are both at the mod's discretion */ - private Object value; + private final Object value; private IMCMessage(String key, Object value) { this.key = key; this.value = value; + this.isFunction = false; + } + + private IMCMessage(String key, String value, boolean isFunction) { + this.key = key; + this.value = value; + this.isFunction = isFunction; } @Override @@ -97,6 +108,10 @@ public class FMLInterModComms { return sender; } + /** + * Get the sending modId of this message. + * @return The modId of the mod that originated the message + */ public String getSender() { return this.sender; @@ -107,70 +122,200 @@ public class FMLInterModComms { this.sender = activeModContainer.getModId(); } + /** + * Get the string value from this message. + * @throws ClassCastException if this message doesn't contain a String value + * @return The string value + */ public String getStringValue() { return (String) value; } + /** + * Get the {@link NBTTagCompound} value from this message + * @throws ClassCastException if this message doesn't contain an NBT value + * @return The NBT value + */ public NBTTagCompound getNBTValue() { return (NBTTagCompound) value; } + /** + * Get the {@link ItemStack} value from this message + * @throws ClassCastException if this message doesn't contain an Itemstack value + * @return The Itemstack value + */ public ItemStack getItemStackValue() { return (ItemStack) value; } + /** + * Get the {@link Function} value from this message. This will attempt to classload the function + * supplied by the caller. The parameter classes are strictly to give a concrete generic function return value. + * @param functionFrom The type of the argument to the function + * @param functionTo The type of the result of the function + * @param The argument type + * @param The result type + * @return The function value or Optional.absent if it wasn't readable or isn't a function call + */ + public Optional> getFunctionValue(Class functionFrom, Class functionTo) { + if (!isFunction) { + return Optional.absent(); + } + try { + Function f = Class.forName((String) value).asSubclass(Function.class).newInstance(); + return Optional.of(f); + } catch (Exception e) { + FMLLog.getLogger().log(Level.INFO, "An error occurred instantiating the IMC function. key: {} value: {}, caller: {}", key,value,sender); + return Optional.absent(); + } + } + + /** + * Get the actual message class type + * @return The type of the message + */ public Class getMessageType() { return value.getClass(); } + /** + * Is this a string type message + * @return if this is a string type message + */ public boolean isStringMessage() { return String.class.isAssignableFrom(getMessageType()); } + /** + * Is this an {@link ItemStack} type message + * @return if this is an itemstack type message + */ public boolean isItemStackMessage() { return ItemStack.class.isAssignableFrom(getMessageType()); } + /** + * Is this an {@link NBTTagCompound} type message + * @return if this is an NBT type message + */ public boolean isNBTMessage() { return NBTTagCompound.class.isAssignableFrom(getMessageType()); } + + /** + * Is this a {@link Function} type message + * @return if this is a function type message + */ + public boolean isFunctionMessage() { return Function.class.isAssignableFrom(getMessageType()); } } + /** + * Send a startup time message + * @param modId The modid to send it to + * @param key The mod specific key + * @param value An NBT type value + * @return if the message was enqueued successfully and will be processed during startup + */ public static boolean sendMessage(String modId, String key, NBTTagCompound value) { return enqueueStartupMessage(modId, new IMCMessage(key, value)); } + + /** + * Send a startup time message + * @param modId The modid to send it to + * @param key The mod specific key + * @param value An Itemstack value + * @return if the message was enqueued successfully and will be processed during startup + */ public static boolean sendMessage(String modId, String key, ItemStack value) { return enqueueStartupMessage(modId, new IMCMessage(key, value)); } + + /** + * Send a startup time message + * @param modId The modid to send it to + * @param key The mod specific key + * @param value A String value + * @return if the message was enqueued successfully and will be processed during startup + */ public static boolean sendMessage(String modId, String key, String value) { return enqueueStartupMessage(modId, new IMCMessage(key, value)); } + /** + * Send a startup time function message + * @param modId The modid to send it to + * @param key The mod specific key + * @param functionClassName The class name of a function that will be instantiated when the + * message is read. It must implement {@link Function} + * @return if the message was enqueued successfully and will be processed during startup + */ + public static boolean sendFunctionMessage(String modId, String key, String functionClassName) + { + return enqueueStartupMessage(modId, new IMCMessage(key, functionClassName, true)); + } + + /** + * Send a post-startup message + * @param sourceMod The mod sending the message + * @param modId The modid to send it to + * @param key The mod specific key + * @param value An NBT type value + */ public static void sendRuntimeMessage(Object sourceMod, String modId, String key, NBTTagCompound value) { enqueueMessage(sourceMod, modId, new IMCMessage(key, value)); } + /** + * Send a post-startup message + * @param sourceMod The mod sending the message + * @param modId The modid to send it to + * @param key The mod specific key + * @param value An Itemstack value + */ public static void sendRuntimeMessage(Object sourceMod, String modId, String key, ItemStack value) { enqueueMessage(sourceMod, modId, new IMCMessage(key, value)); } + /** + * Send a post-startup message + * @param sourceMod The mod sending the message + * @param modId The modid to send it to + * @param key The mod specific key + * @param value A string value + */ public static void sendRuntimeMessage(Object sourceMod, String modId, String key, String value) { enqueueMessage(sourceMod, modId, new IMCMessage(key, value)); } + /** + * Send a post-startup function message. + * + * @param sourceMod The mod originating this message + * @param modId The modid to send it to + * @param key The mod specific key + * @param functionClassName The name of a class to be loaded when the caller processes this message. + * The named class must extend {@link Function} + */ + public static void sendRuntimeFunctionMessage(Object sourceMod, String modId, String key, String functionClassName) + { + enqueueMessage(sourceMod, modId, new IMCMessage(key, functionClassName, true)); + } + private static boolean enqueueStartupMessage(String modTarget, IMCMessage message) { if (Loader.instance().activeModContainer() == null) diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLLoadCompleteEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLLoadCompleteEvent.java index 45cf93216..40fbff711 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLLoadCompleteEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLLoadCompleteEvent.java @@ -14,6 +14,12 @@ package net.minecraftforge.fml.common.event; import net.minecraftforge.fml.common.LoaderState.ModState; +/** + * This is a mostly internal event fired to mod containers that indicates that loading is complete. Mods should not + * in general override or otherwise attempt to implement this event. + * + * @author cpw + */ public class FMLLoadCompleteEvent extends FMLStateEvent { diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLLoadEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLLoadEvent.java index 33dfca044..3258ffc3c 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLLoadEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLLoadEvent.java @@ -12,6 +12,11 @@ package net.minecraftforge.fml.common.event; +/** + * Internal only event, used to begin the lifecycle of loading mods. + * + * @author cpw + */ public class FMLLoadEvent { diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLMissingMappingsEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLMissingMappingsEvent.java index 7515da10e..2d5d48802 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLMissingMappingsEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLMissingMappingsEvent.java @@ -17,7 +17,9 @@ import com.google.common.collect.ListMultimap; * These can be remapped to other existing objects, or simply discarded. * Use get() and getAll() to process this event. * - * @author cpw, Player + * @see net.minecraftforge.fml.common.Mod.EventHandler for how to subscribe to this event + * @author cpw + * @author Player * */ public class FMLMissingMappingsEvent extends FMLEvent { @@ -31,7 +33,7 @@ public class FMLMissingMappingsEvent extends FMLEvent { * @author cpw * */ - public static enum Action { + public enum Action { /** * Take the default action */ @@ -70,16 +72,6 @@ public class FMLMissingMappingsEvent extends FMLEvent { this.name = name; this.id = id; } - /** - * @deprecated use ignore(), warn(), fail() or remap() instead - */ - @Deprecated - public void setAction(Action target) - { - if (target == Action.DEFAULT || target == Action.REMAP || target == Action.BLOCKONLY) throw new IllegalArgumentException(); - - this.action = target; - } /** * Ignore the missing item. diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLModIdMappingEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLModIdMappingEvent.java index d371aa0c0..ab761c37a 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLModIdMappingEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLModIdMappingEvent.java @@ -9,8 +9,21 @@ import java.util.Map.Entry; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; +/** + * Called whenever the ID mapping might have changed. If you register for this event, you + * will be called back whenever the client or server loads an ID set. This includes both + * when the ID maps are loaded from disk, as well as when the ID maps revert to the initial + * state. + * + * Note: you cannot change the IDs that have been allocated, but you might want to use + * this event to update caches or other in-mod artifacts that might be impacted by an ID + * change. + * + * @see net.minecraftforge.fml.common.Mod.EventHandler for how to subscribe to this event + * @author cpw + */ public class FMLModIdMappingEvent extends FMLEvent { - public static enum RemapTarget { BLOCK, ITEM } + public enum RemapTarget { BLOCK, ITEM } public class ModRemapping { public final int oldId; diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLPostInitializationEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLPostInitializationEvent.java index f281b4e8e..124589691 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLPostInitializationEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLPostInitializationEvent.java @@ -12,11 +12,29 @@ package net.minecraftforge.fml.common.event; +import com.google.common.base.Function; +import com.google.common.base.Optional; +import com.google.common.collect.Lists; +import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.LoaderState.ModState; import com.google.common.base.Throwables; +import org.apache.logging.log4j.Level; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.lang.reflect.Constructor; + +/** + * Called after {@link FMLInitializationEvent} has been dispatched on every mod. This is the third and last + * commonly called event during mod initialization. + * + * Recommended activities: interact with other mods to establish cross-mod behaviours. + * + * @see net.minecraftforge.fml.common.Mod.EventHandler for how to subscribe to this event + * @author cpw + */ public class FMLPostInitializationEvent extends FMLStateEvent { public FMLPostInitializationEvent(Object... data) @@ -30,21 +48,38 @@ public class FMLPostInitializationEvent extends FMLStateEvent return ModState.POSTINITIALIZED; } - public Object buildSoftDependProxy(String modId, String className) + /** + * Build an object depending on if a specific target mod is loaded or not. + * + * Usually would be used to access an object from the other mod. + * + * @param modId The modId I conditionally want to build an object for + * @param className The name of the class I wish to instantiate + * @return An optional containing the object if possible, or null if not + */ + public Optional buildSoftDependProxy(String modId, String className, Object... arguments) { if (Loader.isModLoaded(modId)) { + Class[] args = Lists.transform(Lists.newArrayList(arguments),new Function>() { + @Nullable + @Override + public Class apply(@Nullable Object input) { + return input.getClass(); + } + }).toArray(new Class[0]); try { Class clz = Class.forName(className,true,Loader.instance().getModClassLoader()); - return clz.newInstance(); + Constructor ct = clz.getConstructor(args); + return Optional.fromNullable(ct.newInstance(arguments)); } catch (Exception e) { - Throwables.propagateIfPossible(e); - return null; + FMLLog.getLogger().log(Level.INFO, "An error occurred trying to build a soft depend proxy",e); + return Optional.absent(); } } - return null; + return Optional.absent(); } } diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLPreInitializationEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLPreInitializationEvent.java index b8e803cae..009b0b58e 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLPreInitializationEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLPreInitializationEvent.java @@ -26,6 +26,22 @@ import net.minecraftforge.fml.common.discovery.ASMDataTable; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +/** + * Called before {@link FMLInitializationEvent} during mod startup. + * + * This is the first of three commonly called events during mod initialization. + * + * Recommended activities: + * Setup your logging {@link #getModLog()} + * Load any configuration data you might have {@link #getSuggestedConfigurationFile()} + * Search for a version.properties file and load it {@link #getVersionProperties()} + * Configure your {@link ModMetadata} programmatically {@link #getModMetadata()} + * Register your blocks and items with the {@link net.minecraftforge.fml.common.registry.GameRegistry} + * Discover parts of your mod by using annotation search {@link #getAsmData()} + * + * @see net.minecraftforge.fml.common.Mod.EventHandler for how to subscribe to this event + * @author cpw + */ public class FMLPreInitializationEvent extends FMLStateEvent { private ModMetadata modMetadata; @@ -57,31 +73,58 @@ public class FMLPreInitializationEvent extends FMLStateEvent this.suggestedConfigFile = new File(configurationDir, activeContainer.getModId()+".cfg"); } + /** + * Get the {@link File} the mod was loaded from + * @return The file the mod was loaded from + */ public File getSourceFile() { return sourceFile; } + /** + * Get the {@link ModMetadata} for this mod + * @return the mod metadata for the mod + */ public ModMetadata getModMetadata() { return modMetadata; } + /** + * Get the main configuration directory for this minecraft instance + * @return the main configuration directory + */ public File getModConfigurationDirectory() { return configurationDir; } + /** + * Get a suggested configuration file for this mod. It will be of the form <modid>.cfg + * @return A suggested configuration file name for this mod + */ public File getSuggestedConfigurationFile() { return suggestedConfigFile; } + /** + * Get the {@link ASMDataTable} for this instance of Minecraft. This is a special structure containing + * parsing information from FML. It can be searched for annotations parsed out by FML. + * @return + */ public ASMDataTable getAsmData() { return asmData; } + /** + * Get a version.properties file as a {@link Properties} object from the mod file. + * This can be used to load build-type information + * such as a unique version number from a properties file shipped as part of the distributable. + * @return A properties object if one exists, else null + */ public Properties getVersionProperties() { if (this.modContainer instanceof FMLModContainer) diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLServerAboutToStartEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLServerAboutToStartEvent.java index b58c80b43..8c129d85a 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLServerAboutToStartEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLServerAboutToStartEvent.java @@ -15,6 +15,14 @@ package net.minecraftforge.fml.common.event; import net.minecraft.server.MinecraftServer; import net.minecraftforge.fml.common.LoaderState.ModState; +/** + * Called before the server begins loading anything. Called after {@link FMLPostInitializationEvent} on the dedicated + * server, and after the player has hit "Play Selected World" in the client. Called before {@link FMLServerStartingEvent}. + * + * You can obtain a reference to the server with this event. + * @see net.minecraftforge.fml.common.Mod.EventHandler for how to subscribe to this event + * @author cpw + */ public class FMLServerAboutToStartEvent extends FMLStateEvent { private MinecraftServer server; diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLServerStartedEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLServerStartedEvent.java index c0fddc92f..b11e6cbba 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLServerStartedEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLServerStartedEvent.java @@ -14,6 +14,12 @@ package net.minecraftforge.fml.common.event; import net.minecraftforge.fml.common.LoaderState.ModState; +/** + * Called after {@link FMLServerStartingEvent} when the server is available and ready to play. + * + * @see net.minecraftforge.fml.common.Mod.EventHandler for how to subscribe to this event + * @author cpw + */ public class FMLServerStartedEvent extends FMLStateEvent { diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLServerStartingEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLServerStartingEvent.java index fd0131cbc..ae5d54faa 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLServerStartingEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLServerStartingEvent.java @@ -17,6 +17,14 @@ import net.minecraft.command.ICommand; import net.minecraft.server.MinecraftServer; import net.minecraftforge.fml.common.LoaderState.ModState; +/** + * Called after {@link FMLServerAboutToStartEvent} and before {@link FMLServerStartedEvent}. + * This event allows for customizations of the server, such as loading custom commands, perhaps customizing recipes or + * other activities. + * + * @see net.minecraftforge.fml.common.Mod.EventHandler for how to subscribe to this event + * @author cpw + */ public class FMLServerStartingEvent extends FMLStateEvent { diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLServerStoppedEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLServerStoppedEvent.java index 6a5200e9f..52325c882 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLServerStoppedEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLServerStoppedEvent.java @@ -14,6 +14,14 @@ package net.minecraftforge.fml.common.event; import net.minecraftforge.fml.common.LoaderState.ModState; +/** + * Called after {@link FMLServerStoppingEvent} when the server has completely shut down. + * Called immediately before shutting down, on the dedicated server, and before returning + * to the main menu on the client. + * + * @see net.minecraftforge.fml.common.Mod.EventHandler for how to subscribe to this event + * @author cpw + */ public class FMLServerStoppedEvent extends FMLStateEvent { public FMLServerStoppedEvent(Object... data) diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLServerStoppingEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLServerStoppingEvent.java index ea9565430..8556d9be0 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLServerStoppingEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLServerStoppingEvent.java @@ -14,6 +14,12 @@ package net.minecraftforge.fml.common.event; import net.minecraftforge.fml.common.LoaderState.ModState; +/** + * Called when the server begins an orderly shutdown, before {@link FMLServerStoppedEvent}. + * + * @see net.minecraftforge.fml.common.Mod.EventHandler for how to subscribe to this event + * @author cpw + */ public class FMLServerStoppingEvent extends FMLStateEvent { diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLStateEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLStateEvent.java index c2a8cc529..e384c90a0 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLStateEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLStateEvent.java @@ -16,6 +16,9 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.LoaderState.ModState; import net.minecraftforge.fml.relauncher.Side; +/** + * The parent of all mod-state changing events + */ public abstract class FMLStateEvent extends FMLEvent { public FMLStateEvent(Object... data) @@ -23,8 +26,17 @@ public abstract class FMLStateEvent extends FMLEvent } + /** + * The current state of the mod + * @return The current state of the mod + */ public abstract ModState getModState(); + /** + * The side we're loading on. {@link Side#CLIENT} means we're loading in the client, {@link Side#SERVER} means + * we're loading in the dedicated server. + * @return Return which side we're loading on. + */ public Side getSide() { return FMLCommonHandler.instance().getSide(); From 1280462ec725106431f425a383cdfa49bbca6434 Mon Sep 17 00:00:00 2001 From: cpw Date: Tue, 24 Nov 2015 15:30:09 -0500 Subject: [PATCH 056/133] Fix MDK for 1.8.8 using FG2.1 snapshot --- mdk/build.gradle | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mdk/build.gradle b/mdk/build.gradle index a4a1dbf2a..8b821c778 100644 --- a/mdk/build.gradle +++ b/mdk/build.gradle @@ -1,4 +1,4 @@ -/* + // For those who want the bleeding edge buildscript { repositories { @@ -9,17 +9,17 @@ buildscript { } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.0-SNAPSHOT' + classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT' } } apply plugin: 'net.minecraftforge.gradle.forge' */ - -// for people who want stable +/* +// for people who want stable - not yet functional for MC 1.8.8 - we require the forgegradle 2.1 snapshot plugins { id "net.minecraftforge.gradle.forge" version "2.0.2" } - +*/ version = "1.0" group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "modid" From 44c4011575b4fc2d639cee21895c1e58d31edd70 Mon Sep 17 00:00:00 2001 From: cpw Date: Tue, 24 Nov 2015 15:30:22 -0500 Subject: [PATCH 057/133] Yeah, amount is NOT deprecated. --- src/main/java/net/minecraftforge/fluids/FluidStack.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/net/minecraftforge/fluids/FluidStack.java b/src/main/java/net/minecraftforge/fluids/FluidStack.java index 8af9ede19..616b55c49 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidStack.java +++ b/src/main/java/net/minecraftforge/fluids/FluidStack.java @@ -18,10 +18,6 @@ import net.minecraftforge.fml.common.registry.RegistryDelegate; */ public class FluidStack { - /** - * This field will be removed in 1.8. It may be incorrect after a world is loaded. Code should always - * use {@link #getFluid()} instead. That will always reflect the correct value. - */ public int amount; public NBTTagCompound tag; private RegistryDelegate fluidDelegate; From aa40a8edd714e099a4e762cc4adb03c2826fc6b7 Mon Sep 17 00:00:00 2001 From: cpw Date: Tue, 24 Nov 2015 15:35:24 -0500 Subject: [PATCH 058/133] ONE EVENT BUS TO RULE THEM ALL AND IN THE DARKNESS FIRE THEM! --- .../java/net/minecraftforge/fml/common/FMLCommonHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java b/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java index a5015ac27..48fa60e1c 100644 --- a/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java @@ -108,7 +108,7 @@ public class FMLCommonHandler private List crashCallables = Lists.newArrayList(Loader.instance().getCallableCrashInformation()); private Set handlerSet = Sets.newSetFromMap(new MapMaker().weakKeys().makeMap()); private WeakReference handlerToCheck; - private EventBus eventBus = new EventBus(); + private EventBus eventBus = MinecraftForge.EVENT_BUS; private volatile CountDownLatch exitLatch = null; private FMLCommonHandler() From f227f4ff7243d0a1b0e74c4a692da8cf7e47a906 Mon Sep 17 00:00:00 2001 From: cpw Date: Tue, 24 Nov 2015 15:39:18 -0500 Subject: [PATCH 059/133] Deprecate it as well, because hey, it's redundant now. --- .../java/net/minecraftforge/fml/common/FMLCommonHandler.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java b/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java index 48fa60e1c..d60665058 100644 --- a/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java @@ -135,8 +135,10 @@ public class FMLCommonHandler /** * The FML event bus. Subscribe here for FML related events * + * @Deprecated Use {@link MinecraftForge#EVENT_BUS} they're the same thing now * @return the event bus */ + @Deprecated public EventBus bus() { return eventBus; From 8c5038c3015944e632f869e0a66c43355448452c Mon Sep 17 00:00:00 2001 From: cpw Date: Tue, 24 Nov 2015 15:52:14 -0500 Subject: [PATCH 060/133] Clean up some very long dead code. Bukkit hasn't existed in a very long time now. IASM never worked, and I'm not about to implement it. --- .../fml/common/BukkitPluginRef.java | 41 ------------------- .../fml/common/BukkitProxy.java | 24 ----------- .../minecraftforge/fml/common/IASMHook.java | 34 --------------- .../net/minecraftforge/fml/common/Mod.java | 20 --------- 4 files changed, 119 deletions(-) delete mode 100644 src/main/java/net/minecraftforge/fml/common/BukkitPluginRef.java delete mode 100644 src/main/java/net/minecraftforge/fml/common/BukkitProxy.java delete mode 100644 src/main/java/net/minecraftforge/fml/common/IASMHook.java diff --git a/src/main/java/net/minecraftforge/fml/common/BukkitPluginRef.java b/src/main/java/net/minecraftforge/fml/common/BukkitPluginRef.java deleted file mode 100644 index ccebf4e6e..000000000 --- a/src/main/java/net/minecraftforge/fml/common/BukkitPluginRef.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Forge Mod Loader - * Copyright (c) 2012-2013 cpw. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Lesser Public License v2.1 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * - * Contributors: - * cpw - implementation - */ - -package net.minecraftforge.fml.common; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Declare a variable to be populated by a Bukkit Plugin proxy instance if the bukkit coremod - * is available. It can only be applied to field typed as {@link BukkitProxy} - * Generally it should be used in conjunction with {@link Mod#bukkitPlugin()} specifying the - * plugin to load. - * - * @author cpw - * - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) -public @interface BukkitPluginRef -{ - /** - * A reference (possibly version specific) to a Bukkit Plugin by name, using the name@versionbound - * specification. If this is a bukkit enabled environment the field annotated by this - * will be populated with a {@link BukkitProxy} instance if possible. This proxy will be gotten by - * reflectively calling the "getModProxy" method on the bukkit plugin instance. - * @return The name of the plugin which we will inject into this field - */ - String value(); -} diff --git a/src/main/java/net/minecraftforge/fml/common/BukkitProxy.java b/src/main/java/net/minecraftforge/fml/common/BukkitProxy.java deleted file mode 100644 index 5af5f56fa..000000000 --- a/src/main/java/net/minecraftforge/fml/common/BukkitProxy.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Forge Mod Loader - * Copyright (c) 2012-2013 cpw. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Lesser Public License v2.1 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * - * Contributors: - * cpw - implementation - */ - -package net.minecraftforge.fml.common; - -/** - * A marker interface for retrieving a proxy to a bukkit plugin. - * Fields associated with {@link BukkitPluginRef} annotations should - * declare this type and cast down if the target is available (not null) - * @author cpw - * - */ -public interface BukkitProxy -{ -} diff --git a/src/main/java/net/minecraftforge/fml/common/IASMHook.java b/src/main/java/net/minecraftforge/fml/common/IASMHook.java deleted file mode 100644 index cad89b3ce..000000000 --- a/src/main/java/net/minecraftforge/fml/common/IASMHook.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Forge Mod Loader - * Copyright (c) 2012-2013 cpw. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Lesser Public License v2.1 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * - * Contributors: - * cpw - implementation - */ - -package net.minecraftforge.fml.common; - -import org.objectweb.asm.tree.ClassNode; - -public interface IASMHook { - /** - * Inject the {@link Mod} class node into this instance. This allows retrieval from custom - * attributes or other artifacts in your mod class - * - * @param modClassNode The mod class - * @return optionally some code generated classes that will be injected into the classloader - */ - ClassNode[] inject(ClassNode modClassNode); - /** - * Allow mods to manipulate classes loaded from this {@link Mod}'s jar file. The {@link Mod} - * class is always guaranteed to be called first. - * The node state should be changed in place. - * - * @param node The class being loaded - */ - void modifyClass(String className, ClassNode node); -} diff --git a/src/main/java/net/minecraftforge/fml/common/Mod.java b/src/main/java/net/minecraftforge/fml/common/Mod.java index 1236d97b5..0460ffb43 100644 --- a/src/main/java/net/minecraftforge/fml/common/Mod.java +++ b/src/main/java/net/minecraftforge/fml/common/Mod.java @@ -128,16 +128,6 @@ public @interface Mod * @return A version range as specified by the maven version range specification or the empty string */ String acceptableSaveVersions() default ""; - /** - * An optional bukkit plugin that will be injected into the bukkit plugin framework if - * this mod is loaded into the FML framework and the bukkit coremod is present. - * Instances of the bukkit plugin can be obtained via the {@link BukkitPluginRef} annotation on fields. - * - * This may be implemented by a bukkit integration. It is not provided with vanilla FML or MinecraftForge. - * - * @return The name of the plugin to load for this mod - */ - String bukkitPlugin() default ""; /** * Specifying this field allows for a mod to expect a signed jar with a fingerprint matching this value. * The fingerprint should be SHA-1 encoded, lowercase with ':' removed. An empty value indicates that @@ -169,16 +159,6 @@ public @interface Mod */ String modLanguageAdapter() default ""; - /** - * NOT YET IMPLEMENTED.
- * An optional ASM hook class, that can be used to apply ASM to classes loaded from this mod. It is also given - * the ASM tree of the class declaring {@link Mod} to do with what it will. - * - * @return The name of a class to be loaded and executed. Must implement {@link IASMHook}. - */ - @Deprecated - String asmHookClass() default ""; - /** * If your mod doesn't have a runtime persistent effect on the state of the game, and can be disabled without side effects * (minimap mods, graphical tweak mods) then you can set true here and receive the FMLDeactivationEvent to perform deactivation From c5a980f8a4fefd6403e3ebdf7b391d48227bc62c Mon Sep 17 00:00:00 2001 From: cpw Date: Tue, 24 Nov 2015 16:17:08 -0500 Subject: [PATCH 061/133] Cleaning up some derpy names --- .../fml/common/TracingPrintStream.java | 2 +- .../fml/common/discovery/ModDiscoverer.java | 5 +- .../fml/relauncher/CoreModManager.java | 59 ++++--------------- .../fml/relauncher/FileListHelper.java | 2 +- 4 files changed, 16 insertions(+), 52 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/TracingPrintStream.java b/src/main/java/net/minecraftforge/fml/common/TracingPrintStream.java index 80aef6c26..f6ea78e7c 100644 --- a/src/main/java/net/minecraftforge/fml/common/TracingPrintStream.java +++ b/src/main/java/net/minecraftforge/fml/common/TracingPrintStream.java @@ -44,7 +44,7 @@ public class TracingPrintStream extends PrintStream { if (elem.getClassName().startsWith("kotlin.io.")) { elem = elems[BASE_DEPTH + 2]; // Kotlins IoPackage masks origins 2 deeper in the stack. } else if (elem.getClassName().startsWith("java.lang.Throwable")) { - elem = elems[BASE_DEPTH + 1]; + elem = elems[BASE_DEPTH + 2]; } return "[" + elem.getClassName() + ":" + elem.getMethodName() + ":" + elem.getLineNumber() + "]: "; } diff --git a/src/main/java/net/minecraftforge/fml/common/discovery/ModDiscoverer.java b/src/main/java/net/minecraftforge/fml/common/discovery/ModDiscoverer.java index 105aaa6f3..23432b96c 100644 --- a/src/main/java/net/minecraftforge/fml/common/discovery/ModDiscoverer.java +++ b/src/main/java/net/minecraftforge/fml/common/discovery/ModDiscoverer.java @@ -23,7 +23,6 @@ import net.minecraftforge.fml.common.ModClassLoader; import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.relauncher.CoreModManager; import net.minecraftforge.fml.relauncher.FileListHelper; -import net.minecraftforge.fml.relauncher.ModListHelper; import org.apache.logging.log4j.Level; @@ -48,7 +47,7 @@ public class ModDiscoverer // skip default libs .addAll(modClassLoader.getDefaultLibraries()) // skip loaded coremods - .addAll(CoreModManager.getLoadedCoremods()) + .addAll(CoreModManager.getIgnoredMods()) // skip reparse coremods here .addAll(CoreModManager.getReparseableCoremods()) .build(); @@ -98,7 +97,7 @@ public class ModDiscoverer for (File modFile : modList) { // skip loaded coremods - if (CoreModManager.getLoadedCoremods().contains(modFile.getName())) + if (CoreModManager.getIgnoredMods().contains(modFile.getName())) { FMLLog.finer("Skipping already parsed coremod or tweaker %s", modFile.getName()); } diff --git a/src/main/java/net/minecraftforge/fml/relauncher/CoreModManager.java b/src/main/java/net/minecraftforge/fml/relauncher/CoreModManager.java index 87c4449e6..1da4ed3f0 100644 --- a/src/main/java/net/minecraftforge/fml/relauncher/CoreModManager.java +++ b/src/main/java/net/minecraftforge/fml/relauncher/CoreModManager.java @@ -34,12 +34,10 @@ import java.util.jar.JarFile; import net.minecraft.launchwrapper.ITweaker; import net.minecraft.launchwrapper.Launch; import net.minecraft.launchwrapper.LaunchClassLoader; -import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.asm.ASMTransformerWrapper; import net.minecraftforge.fml.common.asm.transformers.ModAccessTransformer; import net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker; import net.minecraftforge.fml.common.launcher.FMLTweaker; -import net.minecraftforge.fml.common.toposort.TopologicalSort; import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.DependsOn; import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.MCVersion; import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.Name; @@ -62,13 +60,13 @@ public class CoreModManager { private static final Attributes.Name MODTYPE = new Attributes.Name("ModType"); private static final Attributes.Name MODSIDE = new Attributes.Name("ModSide"); private static String[] rootPlugins = { "net.minecraftforge.fml.relauncher.FMLCorePlugin", "net.minecraftforge.classloading.FMLForgePlugin" }; - private static List loadedCoremods = Lists.newArrayList(); + private static List ignoredModFiles = Lists.newArrayList(); private static Map> transformers = Maps.newHashMap(); private static List loadPlugins; private static boolean deobfuscatedEnvironment; private static FMLTweaker tweaker; private static File mcDir; - private static List reparsedCoremods = Lists.newArrayList(); + private static List candidateModFiles = Lists.newArrayList(); private static List accessTransformers = Lists.newArrayList(); private static Set rootNames = Sets.newHashSet(); @@ -196,6 +194,7 @@ public class CoreModManager { } catch (IOException e1) { + // NOOP } if (!deobfuscatedEnvironment) @@ -360,7 +359,7 @@ public class CoreModManager { Integer sortOrder = Ints.tryParse(Strings.nullToEmpty(mfAttributes.getValue("TweakOrder"))); sortOrder = (sortOrder == null ? Integer.valueOf(0) : sortOrder); handleCascadingTweak(coreMod, jar, cascadedTweaker, classLoader, sortOrder); - loadedCoremods.add(coreMod.getName()); + ignoredModFiles.add(coreMod.getName()); continue; } List modTypes = mfAttributes.containsKey(MODTYPE) ? Arrays.asList(mfAttributes.getValue(MODTYPE).split(",")) : ImmutableList.of("FML"); @@ -368,14 +367,14 @@ public class CoreModManager { if (!modTypes.contains("FML")) { FMLRelaunchLog.fine("Adding %s to the list of things to skip. It is not an FML mod, it has types %s", coreMod.getName(), modTypes); - loadedCoremods.add(coreMod.getName()); + ignoredModFiles.add(coreMod.getName()); continue; } String modSide = mfAttributes.containsKey(MODSIDE) ? mfAttributes.getValue(MODSIDE) : "BOTH"; if (! ("BOTH".equals(modSide) || FMLLaunchHandler.side.name().equals(modSide))) { FMLRelaunchLog.fine("Mod %s has ModSide meta-inf value %s, and we're %s. It will be ignored", coreMod.getName(), modSide, FMLLaunchHandler.side.name()); - loadedCoremods.add(coreMod.getName()); + ignoredModFiles.add(coreMod.getName()); continue; } String fmlCorePlugin = mfAttributes.getValue("FMLCorePlugin"); @@ -392,13 +391,13 @@ public class CoreModManager { if (!mfAttributes.containsKey(COREMODCONTAINSFMLMOD)) { FMLRelaunchLog.finer("Adding %s to the list of known coremods, it will not be examined again", coreMod.getName()); - loadedCoremods.add(coreMod.getName()); + ignoredModFiles.add(coreMod.getName()); } else { FMLRelaunchLog.finer("Found FMLCorePluginContainsFMLMod marker in %s, it will be examined later for regular @Mod instances", coreMod.getName()); - reparsedCoremods.add(coreMod.getName()); + candidateModFiles.add(coreMod.getName()); } } catch (MalformedURLException e) @@ -460,9 +459,9 @@ public class CoreModManager { return coreModDir; } - public static List getLoadedCoremods() + public static List getIgnoredMods() { - return loadedCoremods; + return ignoredModFiles; } public static Map> getTransformers() @@ -472,7 +471,7 @@ public class CoreModManager { public static List getReparseableCoremods() { - return reparsedCoremods; + return candidateModFiles; } private static FMLPluginWrapper loadCoreMod(LaunchClassLoader classLoader, String coreModClass, File location) @@ -557,40 +556,6 @@ public class CoreModManager { return null; } - private static void sortCoreMods() - { - TopologicalSort.DirectedGraph sortGraph = new TopologicalSort.DirectedGraph(); - Map pluginMap = Maps.newHashMap(); - for (FMLPluginWrapper plug : loadPlugins) - { - sortGraph.addNode(plug); - pluginMap.put(plug.name, plug); - } - - for (FMLPluginWrapper plug : loadPlugins) - { - for (String dep : plug.predepends) - { - if (!pluginMap.containsKey(dep)) - { - FMLRelaunchLog.log(Level.ERROR, "Missing coremod dependency - the coremod %s depends on coremod %s which isn't present.", plug.name, dep); - throw new RuntimeException(); - } - sortGraph.addEdge(plug, pluginMap.get(dep)); - } - } - try - { - loadPlugins = TopologicalSort.topologicalSort(sortGraph); - FMLRelaunchLog.fine("Sorted coremod list %s", loadPlugins); - } - catch (Exception e) - { - FMLLog.log(Level.ERROR, e, "There was a problem performing the coremod sort"); - throw Throwables.propagate(e); - } - } - public static void injectTransformers(LaunchClassLoader classLoader) { @@ -677,7 +642,7 @@ public class CoreModManager { public static void onCrash(StringBuilder builder) { - if(!loadedCoremods.isEmpty() || !reparsedCoremods.isEmpty()) + if(!ignoredModFiles.isEmpty() || !candidateModFiles.isEmpty()) { builder.append("\nWARNING: coremods are present:\n"); for(String coreMod : transformers.keySet()) diff --git a/src/main/java/net/minecraftforge/fml/relauncher/FileListHelper.java b/src/main/java/net/minecraftforge/fml/relauncher/FileListHelper.java index 71506ed2c..6d9854ea0 100644 --- a/src/main/java/net/minecraftforge/fml/relauncher/FileListHelper.java +++ b/src/main/java/net/minecraftforge/fml/relauncher/FileListHelper.java @@ -6,7 +6,7 @@ import java.util.Arrays; import java.util.Comparator; public final class FileListHelper { - private static enum CaseInsensitiveFileComparator implements Comparator + private enum CaseInsensitiveFileComparator implements Comparator { INSTANCE; @Override From 85d7b69d1933c60048e7752429e9d78180e8dcb8 Mon Sep 17 00:00:00 2001 From: cpw Date: Tue, 24 Nov 2015 16:47:46 -0500 Subject: [PATCH 062/133] More cleanups, some documentation, a bunch of deprecations. --- .../fml/common/registry/EntityRegistry.java | 114 +++++++++++++----- .../fml/common/registry/GameRegistry.java | 36 +++--- 2 files changed, 105 insertions(+), 45 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java index 6e4c099e7..79de3d030 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java @@ -235,6 +235,15 @@ public class EntityRegistry return instance().entityEggsUn; } + /** + * Registers in the minecraft Entity ID list. This is generally not a good idea and shouldn't be used. + * Simply use {@link #registerModEntity(Class, String, int, Object, int, int, boolean, int, int)} instead. + * + * @param entityClass Class of the entity being registered + * @param entityName Name for the entity being registered + * @param id A globally unique ID for the entity + */ + @Deprecated public static void registerGlobalEntityID(Class entityClass, String entityName, int id) { if (EntityList.classToStringMapping.containsKey(entityClass)) @@ -256,6 +265,37 @@ public class EntityRegistry EntityList.addMapping(entityClass, entityName, id); } + /** + * Registers in the minecraft Entity ID list. This is generally not a good idea, and shouldn't be used. + * Simply use {@link #registerModEntity(Class, String, int, Object, int, int, boolean)} instead. + * @param entityClass The class of the entity being registered + * @param entityName The name of the entity being registered + * @param id The globally unique ID of the entity + * @param backgroundEggColour An RGB colour value for the spawn egg background colour + * @param foregroundEggColour An RGB colour value for the spawn egg foreground colour + */ + @Deprecated + public static void registerGlobalEntityID(Class entityClass, String entityName, int id, int backgroundEggColour, int foregroundEggColour) + { + if (EntityList.classToStringMapping.containsKey(entityClass)) + { + ModContainer activeModContainer = Loader.instance().activeModContainer(); + String modId = "unknown"; + if (activeModContainer != null) + { + modId = activeModContainer.getModId(); + } + else + { + FMLLog.severe("There is a rogue mod failing to register entities from outside the context of mod loading. This is incredibly dangerous and should be stopped."); + } + FMLLog.warning("The mod %s tried to register the entity class %s which was already registered - if you wish to override default naming for FML mod entities, register it here first", modId, entityClass); + return; + } + instance().validateAndClaimId(id); + EntityList.addMapping(entityClass, entityName, id, backgroundEggColour, foregroundEggColour); + } + private int validateAndClaimId(int id) { // workaround for broken ML @@ -287,32 +327,19 @@ public class EntityRegistry return realId; } - public static void registerGlobalEntityID(Class entityClass, String entityName, int id, int backgroundEggColour, int foregroundEggColour) - { - if (EntityList.classToStringMapping.containsKey(entityClass)) - { - ModContainer activeModContainer = Loader.instance().activeModContainer(); - String modId = "unknown"; - if (activeModContainer != null) - { - modId = activeModContainer.getModId(); - } - else - { - FMLLog.severe("There is a rogue mod failing to register entities from outside the context of mod loading. This is incredibly dangerous and should be stopped."); - } - FMLLog.warning("The mod %s tried to register the entity class %s which was already registered - if you wish to override default naming for FML mod entities, register it here first", modId, entityClass); - return; - } - instance().validateAndClaimId(id); - EntityList.addMapping(entityClass, entityName, id, backgroundEggColour, foregroundEggColour); - } - + /** + * Add a spawn entry for the supplied entity in the supplied {@link BiomeGenBase} list + * @param entityClass Entity class added + * @param weightedProb Probability + * @param min Min spawn count + * @param max Max spawn count + * @param typeOfCreature Type of spawn + * @param biomes List of biomes + */ public static void addSpawn(Class entityClass, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, BiomeGenBase... biomes) { for (BiomeGenBase biome : biomes) { - @SuppressWarnings("unchecked") List spawns = biome.getSpawnableList(typeOfCreature); for (SpawnListEntry entry : spawns) @@ -331,22 +358,35 @@ public class EntityRegistry } } - @SuppressWarnings("unchecked") - public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeGenBase... biomes) + /** + * Add a spawn entry for the supplied entity in the supplied {@link BiomeGenBase} list + * @param entityName The entity name + * @param weightedProb Probability + * @param min Min spawn count + * @param max Max spawn count + * @param typeOfCreature type of spawn + * @param biomes List of biomes + */ + public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, BiomeGenBase... biomes) { - Class entityClazz = (Class) EntityList.stringToClassMapping.get(entityName); + Class entityClazz = EntityList.stringToClassMapping.get(entityName); if (EntityLiving.class.isAssignableFrom(entityClazz)) { - addSpawn((Class ) entityClazz, weightedProb, min, max, spawnList, biomes); + addSpawn((Class ) entityClazz, weightedProb, min, max, typeOfCreature, biomes); } } + /** + * Remove the spawn entry for the supplied entity + * @param entityClass The entity class + * @param typeOfCreature type of spawn + * @param biomes Biomes to remove from + */ public static void removeSpawn(Class entityClass, EnumCreatureType typeOfCreature, BiomeGenBase... biomes) { for (BiomeGenBase biome : biomes) { - @SuppressWarnings("unchecked") Iterator spawns = biome.getSpawnableList(typeOfCreature).iterator(); while (spawns.hasNext()) @@ -360,17 +400,29 @@ public class EntityRegistry } } - @SuppressWarnings("unchecked") - public static void removeSpawn(String entityName, EnumCreatureType spawnList, BiomeGenBase... biomes) + /** + * Remove the spawn entry for the supplied entity + * @param entityName Name of entity being removed + * @param typeOfCreature type of spawn + * @param biomes Biomes to remove from + */ + public static void removeSpawn(String entityName, EnumCreatureType typeOfCreature, BiomeGenBase... biomes) { - Class entityClazz = (Class) EntityList.stringToClassMapping.get(entityName); + Class entityClazz = EntityList.stringToClassMapping.get(entityName); if (EntityLiving.class.isAssignableFrom(entityClazz)) { - removeSpawn((Class ) entityClazz, spawnList, biomes); + removeSpawn((Class ) entityClazz, typeOfCreature, biomes); } } + /** + * Utility function to try and obtain a globally unique entity ID. Not useful as it requires syncing between + * client and server. Use {@link #registerModEntity(Class, String, int, Object, int, int, boolean)} instead, + * for a much better experience. + * @return A theoretically globally unique ID + */ + @Deprecated public static int findGlobalUniqueEntityId() { int res = instance().availableIndicies.nextSetBit(0); diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java index 8116b2030..82090ed0e 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java @@ -88,11 +88,11 @@ public class GameRegistry * Callback hook for world gen - if your mod wishes to add extra mod related generation to the world * call this * - * @param chunkX - * @param chunkZ - * @param world - * @param chunkGenerator - * @param chunkProvider + * @param chunkX Chunk X coordinate + * @param chunkZ Chunk Z coordinate + * @param world World we're generating into + * @param chunkGenerator The chunk generator + * @param chunkProvider The chunk provider */ public static void generateWorld(int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { @@ -142,7 +142,6 @@ public class GameRegistry * @param item The item to register * @param name The mod-unique name to register it as - null will remove a custom name * @param modId deprecated, unused - * where one mod should "own" all the blocks of all the mods, null defaults to the active mod */ public static Item registerItem(Item item, String name, String modId) { @@ -329,6 +328,10 @@ public class GameRegistry return GameData.findItem(modId, name); } + /** + * Will be switching to using ResourceLocation, since it's used widely elsewhere + */ + @Deprecated public static final class UniqueIdentifier { public final String modId; @@ -387,7 +390,7 @@ public class GameRegistry } } - public static enum Type { + public enum Type { BLOCK { @Override @@ -407,8 +410,6 @@ public class GameRegistry } /** * Look up the mod identifier data for a block. - * Returns null if there is no mod specified mod identifier data, or it is part of a - * custom itemstack definition {@link #registerCustomItemStack} * * Note: uniqueness and persistence is only guaranteed by mods using the game registry * correctly. @@ -416,14 +417,13 @@ public class GameRegistry * @param block to lookup * @return a {@link UniqueIdentifier} for the block or null */ + @Deprecated public static UniqueIdentifier findUniqueIdentifierFor(Block block) { return GameData.getUniqueName(block); } /** * Look up the mod identifier data for an item. - * Returns null if there is no mod specified mod identifier data, or it is part of a - * custom itemstack definition {@link #registerCustomItemStack} * * Note: uniqueness and persistence is only guaranteed by mods using the game registry * correctly. @@ -431,6 +431,7 @@ public class GameRegistry * @param item to lookup * @return a {@link UniqueIdentifier} for the item or null */ + @Deprecated public static UniqueIdentifier findUniqueIdentifierFor(Item item) { return GameData.getUniqueName(item); @@ -439,9 +440,8 @@ public class GameRegistry /** - * This will cause runtime injection of public static final fields to occur at various points - * where mod blocks and items could be subject to change. This allows for dynamic - * substitution to occur. + * ObjectHolder can be used to automatically populate public static final fields with entries + * from the registry. These values can then be referred within mod code directly. * */ @Retention(RetentionPolicy.RUNTIME) @@ -457,6 +457,14 @@ public class GameRegistry String value(); } + /** + * ItemStackHolder can be used to automatically populate public static final fields with + * {@link ItemStack} instances, referring a specific item, potentially configured with NBT. + * These values can then be used in things like recipes and other places where ItemStacks + * might be required. + * + * If the item is not found, the field will be populated with null. + */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface ItemStackHolder From 91fe229bf0fd58e9938a8862a33c83d0ca5a0342 Mon Sep 17 00:00:00 2001 From: Anthony Anderson Date: Tue, 24 Nov 2015 20:02:50 -0500 Subject: [PATCH 063/133] Remove trailing */ in the build.gradle Signed-off-by: Anthony Anderson --- mdk/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mdk/build.gradle b/mdk/build.gradle index 8b821c778..1c5f080b3 100644 --- a/mdk/build.gradle +++ b/mdk/build.gradle @@ -13,7 +13,7 @@ buildscript { } } apply plugin: 'net.minecraftforge.gradle.forge' -*/ + /* // for people who want stable - not yet functional for MC 1.8.8 - we require the forgegradle 2.1 snapshot plugins { From 4f2feee9318462117f2c260d3bf379dd981370b0 Mon Sep 17 00:00:00 2001 From: cpw Date: Tue, 24 Nov 2015 22:00:27 -0500 Subject: [PATCH 064/133] Fix button and lever placement problem. Closes #2204 --- patches/minecraft/net/minecraft/block/BlockButton.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/block/BlockButton.java.patch b/patches/minecraft/net/minecraft/block/BlockButton.java.patch index c4ca0f384..18a171549 100644 --- a/patches/minecraft/net/minecraft/block/BlockButton.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockButton.java.patch @@ -6,7 +6,7 @@ { - BlockPos blockpos = p_181088_1_.func_177972_a(p_181088_2_); - return p_181088_2_ == EnumFacing.DOWN ? World.func_175683_a(p_181088_0_, blockpos) : p_181088_0_.func_180495_p(blockpos).func_177230_c().func_149721_r(); -+ return p_181088_2_ == EnumFacing.UP && World.func_175683_a(p_181088_0_, p_181088_1_.func_177977_b()) ? true : p_181088_0_.isSideSolid(p_181088_1_.func_177972_a(p_181088_2_.func_176734_d()), p_181088_2_); ++ return p_181088_2_ == EnumFacing.DOWN && World.func_175683_a(p_181088_0_, p_181088_1_.func_177977_b()) ? true : p_181088_0_.isSideSolid(p_181088_1_.func_177972_a(p_181088_2_), p_181088_2_); } public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) From cde6be77425639a161d36de5e1ca1dcfc7ae0bb3 Mon Sep 17 00:00:00 2001 From: cpw Date: Wed, 25 Nov 2015 02:07:48 -0500 Subject: [PATCH 065/133] Fix up a couple of patches, affected by the recent update --- .../net/minecraft/inventory/Slot.java.patch | 9 ++++----- .../minecraft/world/biome/BiomeGenForest.java.patch | 12 ------------ 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/patches/minecraft/net/minecraft/inventory/Slot.java.patch b/patches/minecraft/net/minecraft/inventory/Slot.java.patch index 3b5a76863..d47ee2d87 100644 --- a/patches/minecraft/net/minecraft/inventory/Slot.java.patch +++ b/patches/minecraft/net/minecraft/inventory/Slot.java.patch @@ -9,7 +9,7 @@ } public ItemStack func_75209_a(int p_75209_1_) -@@ -112,4 +112,64 @@ +@@ -112,4 +112,63 @@ { return true; } @@ -20,7 +20,7 @@ + protected Object backgroundMap; + /** + * Gets the path of the texture file to use for the background image of this slot when drawing the GUI. -+ * @return String: The texture file that will be used in GuiContainer.drawSlotInventory for the slot background. ++ * @return The resource location for the background image + */ + @SideOnly(Side.CLIENT) + public net.minecraft.util.ResourceLocation getBackgroundLocation() @@ -30,7 +30,7 @@ + + /** + * Sets the texture file to use for the background image of the slot when it's empty. -+ * @param textureFilename String: Path of texture file to use, or null to use "/gui/items.png" ++ * @param texture the resourcelocation for the texture + */ + @SideOnly(Side.CLIENT) + public void setBackgroundLocation(net.minecraft.util.ResourceLocation texture) @@ -40,8 +40,7 @@ + + /** + * Sets which icon index to use as the background image of the slot when it's empty. -+ * Getter is func_178171_c -+ * @param icon The icon to use, null for none ++ * @param name The icon to use, null for none + */ + public void setBackgroundName(String name) + { diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch index 9a2aa4c10..95b469419 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch @@ -1,17 +1,5 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenForest.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenForest.java -@@ -188,9 +188,9 @@ - { - return this.field_76756_M != BiomeGenBase.field_150583_P.field_76756_M && this.field_76756_M != BiomeGenBase.field_150582_Q.field_76756_M ? new BiomeGenMutated(p_180277_1_, this) - { -- public void func_180624_a(World p_180624_1_, Random p_180624_2_, BlockPos p_180624_3_) -+ public void func_180624_a(World worldIn, Random p_180624_2_, BlockPos p_180624_3_) - { -- this.field_150611_aD.func_180624_a(p_180624_1_, p_180624_2_, p_180624_3_); -+ this.field_150611_aD.func_180624_a(worldIn, p_180624_2_, p_180624_3_); - } - }: new BiomeGenMutated(p_180277_1_, this) - { @@ -201,4 +201,20 @@ }; } From cb2d5992d29e1669509c0dd684bbb18b9f7c6ee2 Mon Sep 17 00:00:00 2001 From: cpw Date: Wed, 25 Nov 2015 02:02:25 -0500 Subject: [PATCH 066/133] Add .exc for StatList patch More tweaking --- src/main/resources/forge.exc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/resources/forge.exc b/src/main/resources/forge.exc index 225802f04..9735ddfdb 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -40,3 +40,5 @@ net/minecraft/item/ItemBlock.setTileEntityNBT(Lnet/minecraft/world/World;Lnet/mi net/minecraft/server/management/ServerConfigurationManager.initializeConnectionToPlayer(Lnet/minecraft/network/NetworkManager;Lnet/minecraft/entity/player/EntityPlayerMP;Lnet/minecraft/network/NetHandlerPlayServer;)V=|p_72355_1_,p_72355_2_,nethandlerplayserver net/minecraft/item/ItemMonsterPlacer.spawnCreature(Lnet/minecraft/world/World;Ljava/lang/String;DDD)Lnet/minecraft/entity/Entity;=|p_77840_0_,name,p_77840_2_,p_77840_4_,p_77840_6_ + +net/minecraft/stats/StatList.func_151180_a([Lnet/minecraft/stats/StatBase;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Z)V=|p_151180_0_,p_151180_1_,p_151180_2_,useItemIds \ No newline at end of file From 2ecc92c4b38622faf173d89a75ec5d7ccb8e7b58 Mon Sep 17 00:00:00 2001 From: Lumien Date: Wed, 25 Nov 2015 20:43:53 +0100 Subject: [PATCH 067/133] Fixed: The Integrated Server not being stopped when exiting a singleplayer world to the main menu --- .../net/minecraft/server/MinecraftServer.java.patch | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch index d72ce626f..c8298d70a 100644 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -147,7 +147,7 @@ catch (Throwable throwable1) { field_147145_h.error("Encountered an unexpected exception", throwable1); -@@ -535,6 +524,7 @@ +@@ -535,14 +524,15 @@ field_147145_h.error("We were unable to save this crash report to disk."); } @@ -155,6 +155,15 @@ this.func_71228_a(crashreport); } finally + { + try + { +- this.field_71316_v = true; + this.func_71260_j(); ++ this.field_71316_v = true; + } + catch (Throwable throwable) + { @@ -550,6 +540,8 @@ } finally From 7e5a2cb5cab48ed7ab7050d275865c1b5c018073 Mon Sep 17 00:00:00 2001 From: cpw Date: Wed, 25 Nov 2015 16:28:06 -0500 Subject: [PATCH 068/133] Propogate AbortException. Closes #2206. Also fix tracing printstream when printStackTrace is called. --- .../world/storage/SaveHandler.java.patch | 20 +++++++++++-------- .../fml/common/TracingPrintStream.java | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch b/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch index f3f48d646..6f920a640 100644 --- a/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/storage/SaveHandler.java +++ ../src-work/minecraft/net/minecraft/world/storage/SaveHandler.java -@@ -104,13 +104,17 @@ +@@ -104,20 +104,29 @@ { File file1 = new File(this.field_75770_b, "level.dat"); @@ -17,9 +17,13 @@ + net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound2); + return worldInfo; } ++ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) ++ { ++ throw e; ++ } catch (Exception exception1) { -@@ -118,6 +122,7 @@ + exception1.printStackTrace(); } } @@ -27,7 +31,7 @@ file1 = new File(this.field_75770_b, "level.dat_old"); if (file1.exists()) -@@ -126,7 +131,13 @@ +@@ -126,7 +135,13 @@ { NBTTagCompound nbttagcompound = CompressedStreamTools.func_74796_a(new FileInputStream(file1)); NBTTagCompound nbttagcompound1 = nbttagcompound.func_74775_l("Data"); @@ -42,7 +46,7 @@ } catch (Exception exception) { -@@ -143,6 +154,8 @@ +@@ -143,6 +158,8 @@ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.func_74782_a("Data", nbttagcompound); @@ -51,7 +55,7 @@ try { File file1 = new File(this.field_75770_b, "level.dat_new"); -@@ -181,6 +194,8 @@ +@@ -181,6 +198,8 @@ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.func_74782_a("Data", nbttagcompound); @@ -60,7 +64,7 @@ try { File file1 = new File(this.field_75770_b, "level.dat_new"); -@@ -229,6 +244,7 @@ +@@ -229,6 +248,7 @@ } file1.renameTo(file2); @@ -68,7 +72,7 @@ } catch (Exception var5) { -@@ -259,6 +275,7 @@ +@@ -259,6 +279,7 @@ p_75752_1_.func_70020_e(nbttagcompound); } @@ -76,7 +80,7 @@ return nbttagcompound; } -@@ -300,4 +317,22 @@ +@@ -300,4 +321,22 @@ { return this.field_75767_f; } diff --git a/src/main/java/net/minecraftforge/fml/common/TracingPrintStream.java b/src/main/java/net/minecraftforge/fml/common/TracingPrintStream.java index f6ea78e7c..0451edfb6 100644 --- a/src/main/java/net/minecraftforge/fml/common/TracingPrintStream.java +++ b/src/main/java/net/minecraftforge/fml/common/TracingPrintStream.java @@ -44,7 +44,7 @@ public class TracingPrintStream extends PrintStream { if (elem.getClassName().startsWith("kotlin.io.")) { elem = elems[BASE_DEPTH + 2]; // Kotlins IoPackage masks origins 2 deeper in the stack. } else if (elem.getClassName().startsWith("java.lang.Throwable")) { - elem = elems[BASE_DEPTH + 2]; + elem = elems[BASE_DEPTH + 4]; } return "[" + elem.getClassName() + ":" + elem.getMethodName() + ":" + elem.getLineNumber() + "]: "; } From eb26b3ca0fb1296b4cd63c06f67b1acef4be3876 Mon Sep 17 00:00:00 2001 From: LexManos Date: Thu, 26 Nov 2015 17:05:45 -0800 Subject: [PATCH 069/133] Bump version for new Minecraft version. --- src/main/java/net/minecraftforge/common/ForgeVersion.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraftforge/common/ForgeVersion.java b/src/main/java/net/minecraftforge/common/ForgeVersion.java index e40202feb..a37bd3c92 100644 --- a/src/main/java/net/minecraftforge/common/ForgeVersion.java +++ b/src/main/java/net/minecraftforge/common/ForgeVersion.java @@ -33,9 +33,9 @@ public class ForgeVersion //This number is incremented every time we remove deprecated code/major API changes, never reset public static final int majorVersion = 11; //This number is incremented every minecraft release, never reset - public static final int minorVersion = 14; + public static final int minorVersion = 15; //This number is incremented every time a interface changes or new major feature is added, and reset every Minecraft version - public static final int revisionVersion = 4; + public static final int revisionVersion = 0; //This number is incremented every time Jenkins builds Forge, and never reset. Should always be 0 in the repo code. public static final int buildVersion = 0; // This is the minecraft version we're building for - used in various places in Forge/FML code From 81f9f3f20d3fe06662fd477c5a1fe19800cd0002 Mon Sep 17 00:00:00 2001 From: LexManos Date: Thu, 26 Nov 2015 19:36:38 -0800 Subject: [PATCH 070/133] Fixed placing blocks on snow layers with more then one layer. --- .../minecraft/net/minecraft/block/BlockSnow.java.patch | 2 +- .../client/multiplayer/PlayerControllerMP.java.patch | 2 +- .../minecraft/net/minecraft/item/ItemBlock.java.patch | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/patches/minecraft/net/minecraft/block/BlockSnow.java.patch b/patches/minecraft/net/minecraft/block/BlockSnow.java.patch index 78104241b..cc8659d20 100644 --- a/patches/minecraft/net/minecraft/block/BlockSnow.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSnow.java.patch @@ -5,7 +5,7 @@ IBlockState iblockstate = p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()); Block block = iblockstate.func_177230_c(); - return block != Blocks.field_150432_aD && block != Blocks.field_150403_cj ? (block.func_149688_o() == Material.field_151584_j ? true : (block == this && ((Integer)iblockstate.func_177229_b(field_176315_a)).intValue() >= 7 ? true : block.func_149662_c() && block.field_149764_J.func_76230_c())) : false; -+ return block != Blocks.field_150432_aD && block != Blocks.field_150403_cj ? (block.isLeaves(p_176196_1_, p_176196_2_.func_177977_b()) ? true : (block == this && ((Integer)iblockstate.func_177229_b(field_176315_a)).intValue() == 7 ? true : block.func_149662_c() && block.field_149764_J.func_76230_c())) : false; ++ return block != Blocks.field_150432_aD && block != Blocks.field_150403_cj ? (block.isLeaves(p_176196_1_, p_176196_2_.func_177977_b()) ? true : (block == this && ((Integer)iblockstate.func_177229_b(field_176315_a)).intValue() >= 7 ? true : block.func_149662_c() && block.field_149764_J.func_76230_c())) : false; } public void func_176204_a(World p_176204_1_, BlockPos p_176204_2_, IBlockState p_176204_3_, Block p_176204_4_) diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch index e739c1655..891b51bc7 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch @@ -49,7 +49,7 @@ + p_178890_3_.func_77973_b() != null && + p_178890_3_.func_77973_b().onItemUseFirst(p_178890_3_, p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2)) + { -+ return true; ++ return true; + } + IBlockState iblockstate = p_178890_2_.func_180495_p(p_178890_4_); diff --git a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch index 88d2705ae..b87dbda54 100644 --- a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch @@ -18,6 +18,15 @@ p_180614_3_.func_72908_a((double)((float)p_180614_4_.func_177958_n() + 0.5F), (double)((float)p_180614_4_.func_177956_o() + 0.5F), (double)((float)p_180614_4_.func_177952_p() + 0.5F), this.field_150939_a.field_149762_H.func_150496_b(), (this.field_150939_a.field_149762_H.func_150497_c() + 1.0F) / 2.0F, this.field_150939_a.field_149762_H.func_150494_d() * 0.8F); --p_180614_1_.field_77994_a; } +@@ -124,7 +116,7 @@ + { + Block block = p_179222_1_.func_180495_p(p_179222_2_).func_177230_c(); + +- if (block == Blocks.field_150431_aC) ++ if (block == Blocks.field_150431_aC && block.func_176200_f(p_179222_1_, p_179222_2_)) + { + p_179222_3_ = EnumFacing.UP; + } @@ -162,4 +154,26 @@ { return this.field_150939_a; From d878a2ae262db767dcbff63005e499ca93e74c40 Mon Sep 17 00:00:00 2001 From: LexManos Date: Thu, 26 Nov 2015 19:36:53 -0800 Subject: [PATCH 071/133] Fixed Large mushrooms generating incorrectly. --- .../world/gen/feature/WorldGenBigMushroom.java.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch index 0aba92cfd..2a98d8c83 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch @@ -5,7 +5,7 @@ Block block = p_180709_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(l, j, i1)).func_177230_c(); - if (block.func_149688_o() != Material.field_151579_a && block.func_149688_o() != Material.field_151584_j) -+ if (!block.isAir(p_180709_1_,blockpos$mutableblockpos) && !block.isLeaves(p_180709_1_,blockpos$mutableblockpos)) ++ if (!block.isAir(p_180709_1_, blockpos$mutableblockpos) && !block.isLeaves(p_180709_1_, blockpos$mutableblockpos)) { flag = false; } @@ -14,7 +14,7 @@ BlockPos blockpos = new BlockPos(l1, l2, i2); - if (!p_180709_1_.func_180495_p(blockpos).func_177230_c().func_149730_j()) -+ if (!p_180709_1_.func_180495_p(blockpos).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos)) ++ if (p_180709_1_.func_180495_p(blockpos).func_177230_c().canBeReplacedByLeaves(p_180709_1_, blockpos)) { this.func_175903_a(p_180709_1_, blockpos, this.field_76523_a.func_176223_P().func_177226_a(BlockHugeMushroom.field_176380_a, blockhugemushroom$enumtype)); } From e2818a28035a4ecafb88aee6dc17ca2897be4393 Mon Sep 17 00:00:00 2001 From: LexManos Date: Thu, 26 Nov 2015 19:37:44 -0800 Subject: [PATCH 072/133] Removed IItemRenderer class, all functionality is possible with new rendering system. --- .../client/ForgeHooksClient.java | 177 +----------------- .../minecraftforge/client/IItemRenderer.java | 141 -------------- 2 files changed, 5 insertions(+), 313 deletions(-) delete mode 100644 src/main/java/net/minecraftforge/client/IItemRenderer.java diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 31e7ef026..5ca7c02b7 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -77,23 +77,16 @@ import net.minecraftforge.common.ForgeModContainer; import net.minecraftforge.common.ForgeVersion; import net.minecraftforge.common.ForgeVersion.Status; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.common.FMLLog; import org.apache.commons.lang3.tuple.Pair; import org.lwjgl.BufferUtils; import org.lwjgl.opengl.GL11; -//import static net.minecraftforge.client.IItemRenderer.ItemRenderType.*; -//import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.*; - - - - - import com.google.common.collect.Maps; +@SuppressWarnings("deprecation") public class ForgeHooksClient { //private static final ResourceLocation ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png"); @@ -109,165 +102,6 @@ public class ForgeHooksClient return result != null ? result : _default; } - /* - * Removed, Modders let me know if this is needed anymore. - public static boolean renderEntityItem(EntityItem entity, ItemStack item, float bobing, float rotation, Random random, TextureManager engine, RenderBlocks renderBlocks, int count) - { - IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, ENTITY); - if (customRenderer == null) - { - return false; - } - - if (customRenderer.shouldUseRenderHelper(ENTITY, item, ENTITY_ROTATION)) - { - GL11.glRotatef(rotation, 0.0F, 1.0F, 0.0F); - } - if (!customRenderer.shouldUseRenderHelper(ENTITY, item, ENTITY_BOBBING)) - { - GL11.glTranslatef(0.0F, -bobing, 0.0F); - } - boolean is3D = customRenderer.shouldUseRenderHelper(ENTITY, item, BLOCK_3D); - - engine.bindTexture(item.getItemSpriteNumber() == 0 ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture); - Block block = item.getItem() instanceof ItemBlock ? Block.getBlockFromItem(item.getItem()) : null; - if (is3D || (block != null && RenderBlocks.renderItemIn3d(block.getRenderType()))) - { - int renderType = (block != null ? block.getRenderType() : 1); - float scale = (renderType == 1 || renderType == 19 || renderType == 12 || renderType == 2 ? 0.5F : 0.25F); - boolean blend = block != null && block.getRenderBlockPass() > 0; - - if (RenderItem.renderInFrame) - { - GL11.glScalef(1.25F, 1.25F, 1.25F); - GL11.glTranslatef(0.0F, 0.05F, 0.0F); - GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); - } - - if (blend) - { - GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); - GL11.glEnable(GL11.GL_BLEND); - OpenGlHelper.glBlendFunc(770, 771, 1, 0); - } - - GL11.glScalef(scale, scale, scale); - - for(int j = 0; j < count; j++) - { - GL11.glPushMatrix(); - if (j > 0) - { - GL11.glTranslatef( - ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / scale, - ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / scale, - ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / scale); - } - customRenderer.renderItem(ENTITY, item, renderBlocks, entity); - GL11.glPopMatrix(); - } - - if (blend) - { - GL11.glDisable(GL11.GL_BLEND); - } - } - else - { - GL11.glScalef(0.5F, 0.5F, 0.5F); - customRenderer.renderItem(ENTITY, item, renderBlocks, entity); - } - - return true; - } - */ - - /* - public static boolean renderInventoryItem(RenderBlocks renderBlocks, TextureManager engine, ItemStack item, boolean inColor, float zLevel, float x, float y) - { - IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, INVENTORY); - if (customRenderer == null) - { - return false; - } - - engine.bindTexture(item.getItemSpriteNumber() == 0 ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture); - if (customRenderer.shouldUseRenderHelper(INVENTORY, item, INVENTORY_BLOCK)) - { - GL11.glPushMatrix(); - GL11.glTranslatef(x - 2, y + 3, -3.0F + zLevel); - GL11.glScalef(10F, 10F, 10F); - GL11.glTranslatef(1.0F, 0.5F, 1.0F); - GL11.glScalef(1.0F, 1.0F, -1F); - GL11.glRotatef(210F, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F); - - if(inColor) - { - int color = item.getItem().getColorFromItemStack(item, 0); - float r = (float)(color >> 16 & 0xff) / 255F; - float g = (float)(color >> 8 & 0xff) / 255F; - float b = (float)(color & 0xff) / 255F; - GL11.glColor4f(r, g, b, 1.0F); - } - - GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F); - renderBlocks.useInventoryTint = inColor; - customRenderer.renderItem(INVENTORY, item, renderBlocks); - renderBlocks.useInventoryTint = true; - GL11.glPopMatrix(); - } - else - { - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glPushMatrix(); - GL11.glTranslatef(x, y, -3.0F + zLevel); - - if (inColor) - { - int color = item.getItem().getColorFromItemStack(item, 0); - float r = (float)(color >> 16 & 255) / 255.0F; - float g = (float)(color >> 8 & 255) / 255.0F; - float b = (float)(color & 255) / 255.0F; - GL11.glColor4f(r, g, b, 1.0F); - } - - customRenderer.renderItem(INVENTORY, item, renderBlocks); - GL11.glPopMatrix(); - GL11.glEnable(GL11.GL_LIGHTING); - } - - return true; - } - - public static void renderEffectOverlay(TextureManager manager, RenderItem render) - { - } - - public static void renderEquippedItem(ItemRenderType type, IItemRenderer customRenderer, RenderBlocks renderBlocks, EntityLivingBase entity, ItemStack item) - { - if (customRenderer.shouldUseRenderHelper(type, item, EQUIPPED_BLOCK)) - { - GL11.glPushMatrix(); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - customRenderer.renderItem(type, item, renderBlocks, entity); - GL11.glPopMatrix(); - } - else - { - GL11.glPushMatrix(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glTranslatef(0.0F, -0.3F, 0.0F); - GL11.glScalef(1.5F, 1.5F, 1.5F); - GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F); - GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F); - customRenderer.renderItem(type, item, renderBlocks, entity); - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - GL11.glPopMatrix(); - } - }*/ - //Optifine Helper Functions u.u, these are here specifically for Optifine //Note: When using Optfine, these methods are invoked using reflection, which //incurs a major performance penalty. @@ -518,7 +352,7 @@ public class ForgeHooksClient loader.onPostBakeEvent(modelRegistry); } - public static Matrix4f getMatrix(ItemTransformVec3f transform) + public static Matrix4f getMatrix(ItemTransformVec3f transform) { javax.vecmath.Matrix4f m = new javax.vecmath.Matrix4f(), t = new javax.vecmath.Matrix4f(); m.setIdentity(); @@ -540,7 +374,7 @@ public class ForgeHooksClient return m; } - public static IBakedModel handleCameraTransforms(IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType) + public static IBakedModel handleCameraTransforms(IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType) { if(model instanceof IPerspectiveAwareModel) { @@ -686,11 +520,10 @@ public class ForgeHooksClient public static void renderTileItem(Item item, int metadata) { - Class tileClass = tileItemMap.get(Pair.of(item, - metadata)); + Class tileClass = tileItemMap.get(Pair.of(item, metadata)); if (tileClass != null) { - TileEntitySpecialRenderer r = TileEntityRendererDispatcher.instance.getSpecialRendererByClass(tileClass); + TileEntitySpecialRenderer r = TileEntityRendererDispatcher.instance.getSpecialRendererByClass(tileClass); if (r != null) { r.renderTileEntityAt(null, 0, 0, 0, 0, -1); diff --git a/src/main/java/net/minecraftforge/client/IItemRenderer.java b/src/main/java/net/minecraftforge/client/IItemRenderer.java deleted file mode 100644 index b1f630b6e..000000000 --- a/src/main/java/net/minecraftforge/client/IItemRenderer.java +++ /dev/null @@ -1,141 +0,0 @@ -package net.minecraftforge.client; - -import net.minecraft.item.ItemStack; - -@Deprecated //Unused, for now. Rendering emensely changed in 1.8, Is this even needed at all anymore? -//Modders should speak up if needed. -public interface IItemRenderer -{ - @Deprecated - public enum ItemRenderType - { - /** - * Called to render an in-world item, e.g. one that has been thrown or - * dropped. The appropriate OpenGL transformations and scaling have already - * been applied, so Tessellator location (0,0,0) is the center of the - * EntityItem. - * - * Data parameters: - * RenderBlocks render - The RenderBlocks instance - * EntityItem entity - The in-world item to be rendered - */ - ENTITY, - - /** - * Called to render an item currently held in-hand by a living entity. If - * rendering as a 3D block, the item will be rotated to a 45-degree angle. - * To render a 2D texture with some thickness (like default items), see - * net.minecraft.src.ItemRenderer. In either case, rendering should be done - * in local coordinates from (0,0,0)-(1,1,1). - * - * Data parameters: - * RenderBlocks render - The RenderBlocks instance - * EntityLiving entity - The entity holding this item - */ - EQUIPPED, - - /** - * Called to render an item currently held in-hand by a living entity in - * first person. If rendering as a 3D block, the item will be rotated to a - * 45-degree angle. To render a 2D texture with some thickness, see - * net.minecraft.src.ItemRenderer. In either case, rendering should be done - * in local coordinates from (0,0,0)-(1,1,1). - * - * Data parameters: - * RenderBlocks render - The RenderBlocks instance - * EntityLiving entity - The entity holding this item - */ - EQUIPPED_FIRST_PERSON, - - /** - * Called to render an item in a GUI inventory slot. If rendering as a 3D - * block, the appropriate OpenGL translations and scaling have already been - * applied, and the rendering should be done in local coordinates from - * (0,0,0)-(1,1,1). If rendering as a 2D texture, the rendering should be in - * GUI pixel coordinates from (0, 0, 0)-(16, 16, 0). - * - * Data parameters: - * RenderBlocks render - The RenderBlocks instance - */ - INVENTORY, - - /** - * The render type used for when a ItemMap is rendered in first person, - * All appropriate rotations have been applied, and the player's hands, - * and the map BG are already rendered. - * - * Data Parameters: - * EntityPlayer player - The player holding the map - * RenderEngine engine - The RenderEngine instance - * MapData mapData - The map data - */ - FIRST_PERSON_MAP - } - - @Deprecated - public enum ItemRendererHelper - { - /** - * Determines if a rotation effect should be used when rendering an - * EntityItem, like most default blocks do. - */ - ENTITY_ROTATION, - - /** - * Determines if an up-and-down bobbing effect should be used when - * rendering an EntityItem, like most default items do. - */ - ENTITY_BOBBING, - - /** - * Determines if the currently equipped item should be rendered as a 3D - * block or as a 2D texture. - */ - EQUIPPED_BLOCK, - - /** - * Determines if the item should equate to a block that has - * RenderBlocks.renderItemIn3d return true - */ - BLOCK_3D, - - /** - * Determines if the item should be rendered in GUI inventory slots as a 3D - * block or as a 2D texture. - */ - INVENTORY_BLOCK - } - - /** - * Checks if this renderer should handle a specific item's render type - * @param item The item we are trying to render - * @param type A render type to check if this renderer handles - * @return true if this renderer should handle the given render type, - * otherwise false - */ - @Deprecated - public boolean handleRenderType(ItemStack item, ItemRenderType type); - - /** - * Checks if certain helper functionality should be executed for this renderer. - * See ItemRendererHelper for more info - * - * @param type The render type - * @param item The ItemStack being rendered - * @param helper The type of helper functionality to be ran - * @return True to run the helper functionality, false to not. - */ - @Deprecated - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper); - - /** - * Called to do the actual rendering, see ItemRenderType for details on when specific - * types are run, and what extra data is passed into the data parameter. - * - * @param type The render type - * @param item The ItemStack being rendered - * @param data Extra Type specific data - */ - @Deprecated - public void renderItem(ItemRenderType type, ItemStack item, Object... data); -} From 5549b06f966d6129cd5b82e8328cea57a5c88c9e Mon Sep 17 00:00:00 2001 From: LexManos Date: Thu, 26 Nov 2015 19:38:21 -0800 Subject: [PATCH 073/133] Compiler warnings pass, undeprecated SplashProgress related stuff. --- src/main/java/ibxm/Channel.java | 3 +- src/main/java/ibxm/Envelope.java | 2 +- src/main/java/ibxm/FastTracker2.java | 1 + src/main/java/ibxm/IBXM.java | 2 +- src/main/java/ibxm/ScreamTracker3.java | 1 + .../client/ClientCommandHandler.java | 1 - .../client/EnumHelperClient.java | 3 +- .../minecraftforge/client/GuiIngameForge.java | 14 +--- .../client/ItemModelMesherForge.java | 8 +- .../client/MinecraftForgeClient.java | 32 -------- .../client/event/EntityViewRenderEvent.java | 2 - .../client/event/GuiScreenEvent.java | 30 +++---- .../client/event/ModelBakeEvent.java | 8 +- .../client/event/RenderBlockOverlayEvent.java | 1 - .../client/event/RenderLivingEvent.java | 26 +++--- .../client/event/sound/PlaySoundEvent.java | 1 - .../client/model/BlockStateLoader.java | 1 - .../client/model/ForgeBlockStateV1.java | 1 + .../client/model/IFlexibleBakedModel.java | 1 + .../client/model/IPerspectiveAwareModel.java | 1 + .../client/model/IPerspectiveState.java | 1 + .../client/model/ItemLayerModel.java | 1 + .../client/model/ModelFluid.java | 1 + .../client/model/ModelLoader.java | 5 +- .../client/model/MultiModel.java | 1 + .../client/model/TRSRTransformation.java | 2 + .../client/model/b3d/B3DLoader.java | 1 + .../client/model/obj/OBJModel.java | 10 ++- .../common/DimensionManager.java | 3 +- .../net/minecraftforge/common/ForgeHooks.java | 1 - .../common/ForgeModContainer.java | 5 +- .../common/property/ExtendedBlockState.java | 5 ++ .../common/util/AsynchronousExecutor.java | 2 +- .../common/util/BlockSnapshot.java | 4 +- .../common/util/FakePlayerFactory.java | 3 +- .../event/ForgeEventFactory.java | 6 -- .../event/brewing/PotionBrewEvent.java | 1 + .../event/brewing/PotionBrewedEvent.java | 3 +- .../event/entity/EntityMountEvent.java | 1 - .../event/entity/player/AchievementEvent.java | 1 - .../event/entity/player/BonemealEvent.java | 1 - .../event/terraingen/BiomeEvent.java | 1 - .../event/terraingen/ChunkProviderEvent.java | 2 - .../event/world/BlockEvent.java | 2 - .../event/world/NoteBlockEvent.java | 1 + .../minecraftforge/fluids/BlockFluidBase.java | 4 +- .../java/net/minecraftforge/fluids/Fluid.java | 7 -- .../fluids/FluidContainerRegistry.java | 5 -- .../minecraftforge/fluids/FluidRegistry.java | 2 - .../fml/client/FMLClientHandler.java | 11 +-- .../fml/client/GuiAccessDenied.java | 1 - .../fml/client/GuiBackupFailed.java | 1 - .../fml/client/GuiConfirmation.java | 1 - .../minecraftforge/fml/client/GuiModList.java | 6 -- .../fml/client/GuiModsMissingForServer.java | 1 - .../fml/client/GuiNotification.java | 1 - .../fml/client/SplashProgress.java | 4 +- .../fml/client/config/GuiConfig.java | 10 +-- .../fml/client/config/GuiConfigEntries.java | 8 +- .../fml/client/config/GuiEditArray.java | 10 +-- .../client/config/GuiEditArrayEntries.java | 10 +-- .../fml/client/config/GuiSelectString.java | 10 +-- .../fml/client/config/GuiSlider.java | 2 - .../client/config/GuiUnicodeGlyphButton.java | 2 - .../fml/client/config/GuiUtils.java | 1 - .../fml/client/registry/ClientRegistry.java | 5 +- .../common/DuplicateModsFoundException.java | 28 +++---- .../fml/common/FMLCommonHandler.java | 9 +-- .../fml/common/FMLContainer.java | 6 -- .../fml/common/LoadController.java | 1 - .../net/minecraftforge/fml/common/Loader.java | 1 + .../fml/common/LoaderState.java | 6 ++ .../fml/common/MissingModsException.java | 1 - .../fml/common/ModAPIManager.java | 1 + .../fml/common/ProgressManager.java | 22 ++--- .../fml/common/asm/ASMTransformerWrapper.java | 6 +- .../asm/transformers/BlamingTransformer.java | 7 +- .../EventSubscriptionTransformer.java | 2 - .../fml/common/event/FMLInterModComms.java | 1 + .../event/FMLPostInitializationEvent.java | 2 - .../common/network/FMLEmbeddedChannel.java | 4 +- .../FMLIndexedMessageToMessageCodec.java | 2 +- .../fml/common/network/FMLNetworkEvent.java | 8 +- .../common/network/FMLOutboundHandler.java | 7 +- .../common/network/PacketLoggingHandler.java | 10 ++- .../handshake/FMLHandshakeClientState.java | 1 - .../network/handshake/NetworkDispatcher.java | 25 +++--- .../network/internal/FMLNetworkHandler.java | 2 +- .../network/internal/FMLProxyPacket.java | 10 ++- .../simpleimpl/SimpleNetworkWrapper.java | 2 +- .../fml/common/registry/EntityRegistry.java | 3 +- .../FMLControlledNamespacedRegistry.java | 6 +- .../fml/common/registry/GameData.java | 17 +--- .../fml/common/registry/GameRegistry.java | 1 + .../fml/common/registry/ObjectHolderRef.java | 1 + .../fml/common/registry/VillagerRegistry.java | 25 ++---- .../fml/relauncher/ReflectionHelper.java | 16 ++-- .../minecraftforge/oredict/OreDictionary.java | 8 +- .../minecraftforge/oredict/RecipeSorter.java | 1 - .../oredict/ShapelessOreRecipe.java | 1 - .../server/ForgeTimeTracker.java | 8 +- .../server/command/ForgeCommand.java | 4 +- .../paulscode/sound/codecs/CodecIBXM.java | 2 + .../debug/ForgeBlockStatesLoaderDebug.java | 80 +++++++++---------- .../minecraftforge/debug/ItemTileDebug.java | 5 +- .../debug/LayerBreakingTest.java | 5 +- .../debug/ModelBakeEventDebug.java | 4 +- .../minecraftforge/test/EnumHelperTest.java | 5 +- 108 files changed, 261 insertions(+), 400 deletions(-) diff --git a/src/main/java/ibxm/Channel.java b/src/main/java/ibxm/Channel.java index 13e6d5d89..1ab5bb8a2 100644 --- a/src/main/java/ibxm/Channel.java +++ b/src/main/java/ibxm/Channel.java @@ -10,7 +10,8 @@ public class Channel { private int[] global_volume, current_note; private boolean linear_periods, fast_volume_slides, key_on, silent; private int sample_idx, sample_frac, step, left_gain, right_gain; - private int volume, panning, fine_tune, period, porta_period, key_add; + @SuppressWarnings("unused") //Forge + private int volume, panning, fine_tune, period, porta_period, key_add; private int tremolo_speed, tremolo_depth, tremolo_tick, tremolo_wave, tremolo_add; private int vibrato_speed, vibrato_depth, vibrato_tick, vibrato_wave, vibrato_add; private int volume_slide_param, portamento_param, retrig_param; diff --git a/src/main/java/ibxm/Envelope.java b/src/main/java/ibxm/Envelope.java index 94b9c656f..6282d8355 100644 --- a/src/main/java/ibxm/Envelope.java +++ b/src/main/java/ibxm/Envelope.java @@ -11,7 +11,7 @@ public class Envelope { } public void set_num_points( int num_points ) { - int point; + //int point; Forge: Unused if( num_points <= 0 ) { num_points = 1; } diff --git a/src/main/java/ibxm/FastTracker2.java b/src/main/java/ibxm/FastTracker2.java index 4f05cf7f7..2249bfffe 100644 --- a/src/main/java/ibxm/FastTracker2.java +++ b/src/main/java/ibxm/FastTracker2.java @@ -70,6 +70,7 @@ public class FastTracker2 { } private static Pattern read_xm_pattern( DataInput data_input, int num_channels ) throws IOException { + @SuppressWarnings("unused") //Forge int pattern_header_length, packing_type, num_rows, pattern_data_length; byte[] structure_header, pattern_header, pattern_data; Pattern pattern; diff --git a/src/main/java/ibxm/IBXM.java b/src/main/java/ibxm/IBXM.java index f1c05f25e..00f22a6aa 100644 --- a/src/main/java/ibxm/IBXM.java +++ b/src/main/java/ibxm/IBXM.java @@ -86,7 +86,7 @@ public class IBXM { } public void seek( int sample_position ) { - int idx; + //int idx; Forge, Unused set_sequence_index( 0, 0 ); next_tick(); while( sample_position > tick_length_samples ) { diff --git a/src/main/java/ibxm/ScreamTracker3.java b/src/main/java/ibxm/ScreamTracker3.java index 8aa4f804d..26144703e 100644 --- a/src/main/java/ibxm/ScreamTracker3.java +++ b/src/main/java/ibxm/ScreamTracker3.java @@ -59,6 +59,7 @@ public class ScreamTracker3 { public static Module load_s3m( byte[] header_96_bytes, DataInput data_input ) throws IOException { int num_pattern_orders, num_instruments, num_patterns, num_channels; + @SuppressWarnings("unused") //Forge int flags, tracker_version, master_volume, panning, channel_config, sequence_length; int instrument_idx, pattern_idx, channel_idx, order_idx, panning_offset; boolean signed_samples, stereo_mode, default_panning; diff --git a/src/main/java/net/minecraftforge/client/ClientCommandHandler.java b/src/main/java/net/minecraftforge/client/ClientCommandHandler.java index 455c76477..87a196e48 100644 --- a/src/main/java/net/minecraftforge/client/ClientCommandHandler.java +++ b/src/main/java/net/minecraftforge/client/ClientCommandHandler.java @@ -113,7 +113,6 @@ public class ClientCommandHandler extends CommandHandler Minecraft mc = FMLClientHandler.instance().getClient(); if (mc.currentScreen instanceof GuiChat) { - @SuppressWarnings("unchecked") List commands = getTabCompletionOptions(mc.thePlayer, leftOfCursor, mc.thePlayer.getPosition()); if (commands != null && !commands.isEmpty()) { diff --git a/src/main/java/net/minecraftforge/client/EnumHelperClient.java b/src/main/java/net/minecraftforge/client/EnumHelperClient.java index 65149fb1a..95a3f9997 100644 --- a/src/main/java/net/minecraftforge/client/EnumHelperClient.java +++ b/src/main/java/net/minecraftforge/client/EnumHelperClient.java @@ -2,8 +2,7 @@ package net.minecraftforge.client; import net.minecraft.util.Util.EnumOS; import net.minecraft.world.WorldSettings.GameType; -import net.minecraft.client.settings.GameSettings.Options; -import net.minecraft.item.EnumRarity; +import net.minecraft.client.settings.GameSettings.Options; import net.minecraftforge.common.util.EnumHelper; public class EnumHelperClient extends EnumHelper diff --git a/src/main/java/net/minecraftforge/client/GuiIngameForge.java b/src/main/java/net/minecraftforge/client/GuiIngameForge.java index a41ecdf01..e4f3e3e6c 100644 --- a/src/main/java/net/minecraftforge/client/GuiIngameForge.java +++ b/src/main/java/net/minecraftforge/client/GuiIngameForge.java @@ -16,19 +16,16 @@ import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.IAttributeInstance; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; -import net.minecraft.scoreboard.Score; import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.scoreboard.ScorePlayerTeam; import net.minecraft.scoreboard.Scoreboard; @@ -37,24 +34,17 @@ import net.minecraft.util.FoodStats; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StringUtils; -import net.minecraft.world.EnumSkyBlock; -import net.minecraft.world.chunk.Chunk; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.MinecraftForge; import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import com.google.common.base.Strings; - -import net.minecraftforge.fml.common.FMLCommonHandler; public class GuiIngameForge extends GuiIngame { //private static final ResourceLocation VIGNETTE = new ResourceLocation("textures/misc/vignette.png"); - private static final ResourceLocation WIDGITS = new ResourceLocation("textures/gui/widgets.png"); + //private static final ResourceLocation WIDGITS = new ResourceLocation("textures/gui/widgets.png"); //private static final ResourceLocation PUMPKIN_BLUR = new ResourceLocation("textures/misc/pumpkinblur.png"); private static final int WHITE = 0xFFFFFF; @@ -82,7 +72,7 @@ public class GuiIngameForge extends GuiIngame private ScaledResolution res = null; private FontRenderer fontrenderer = null; private RenderGameOverlayEvent eventParent; - private static final String MC_VERSION = MinecraftForge.MC_VERSION; + //private static final String MC_VERSION = MinecraftForge.MC_VERSION; private GuiOverlayDebugForge debugOverlay; public GuiIngameForge(Minecraft mc) diff --git a/src/main/java/net/minecraftforge/client/ItemModelMesherForge.java b/src/main/java/net/minecraftforge/client/ItemModelMesherForge.java index 9966c2346..b65665f68 100644 --- a/src/main/java/net/minecraftforge/client/ItemModelMesherForge.java +++ b/src/main/java/net/minecraftforge/client/ItemModelMesherForge.java @@ -1,9 +1,7 @@ package net.minecraftforge.client; import java.util.IdentityHashMap; -import java.util.Iterator; import java.util.Map; -import java.util.Map.Entry; import com.google.common.collect.Maps; @@ -40,12 +38,12 @@ public class ItemModelMesherForge extends ItemModelMesher TIntObjectHashMap mods = models.get(item); if (locs == null) { - locs = new TIntObjectHashMap(); + locs = new TIntObjectHashMap(); locations.put(item, locs); } if (mods == null) { - mods = new TIntObjectHashMap(); + mods = new TIntObjectHashMap(); models.put(item, mods); } locs.put(meta, location); @@ -64,7 +62,7 @@ public class ItemModelMesherForge extends ItemModelMesher } else { - mods = new TIntObjectHashMap(); + mods = new TIntObjectHashMap(); models.put(e.getKey(), mods); } final TIntObjectHashMap map = mods; diff --git a/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java b/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java index ae5194ef6..a363d8ded 100644 --- a/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java +++ b/src/main/java/net/minecraftforge/client/MinecraftForgeClient.java @@ -6,42 +6,10 @@ package net.minecraftforge.client; import java.util.BitSet; -import java.util.IdentityHashMap; - -import com.google.common.collect.Maps; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; import net.minecraft.util.EnumWorldBlockLayer; -import net.minecraftforge.client.IItemRenderer.ItemRenderType; public class MinecraftForgeClient { - private static IdentityHashMap customItemRenderers = Maps.newIdentityHashMap(); - - /** - * Register a custom renderer for a specific item. This can be used to - * render the item in-world as an EntityItem, when the item is equipped, or - * when the item is in an inventory slot. - * @param itemID The item ID (shifted index) to handle rendering. - * @param renderer The IItemRenderer interface that handles rendering for - * this item. - */ - public static void registerItemRenderer(Item item, IItemRenderer renderer) - { - customItemRenderers.put(item, renderer); - } - - public static IItemRenderer getItemRenderer(ItemStack item, ItemRenderType type) - { - IItemRenderer renderer = customItemRenderers.get(item.getItem()); - if (renderer != null && renderer.handleRenderType(item, type)) - { - return renderer; - } - return null; - } - public static int getRenderPass() { return ForgeHooksClient.renderPass; diff --git a/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java b/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java index 4dfd78301..7d08011f8 100644 --- a/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java +++ b/src/main/java/net/minecraftforge/client/event/EntityViewRenderEvent.java @@ -3,10 +3,8 @@ package net.minecraftforge.client.event; import net.minecraft.block.Block; import net.minecraft.client.renderer.EntityRenderer; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event; -import net.minecraftforge.fml.common.eventhandler.Event.Result; /** * Event that hooks into EntityRenderer, allowing any feature to customize visual attributes of diff --git a/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java b/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java index db4efe00f..7ed451c77 100644 --- a/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java +++ b/src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java @@ -33,9 +33,9 @@ public class GuiScreenEvent extends Event /** * The {@code buttonList} field from the GuiScreen object referenced by {@code gui}. */ - public List buttonList; + public List buttonList; - public InitGuiEvent(GuiScreen gui, List buttonList) + public InitGuiEvent(GuiScreen gui, List buttonList) { super(gui); this.buttonList = buttonList; @@ -49,13 +49,11 @@ public class GuiScreenEvent extends Event * If canceled the following lines are skipped in {@code GuiScreen.setWorldAndResolution()}:
* {@code this.buttonList.clear();}
* {@code this.initGui();}
- * - * @author bspkrs */ @Cancelable public static class Pre extends InitGuiEvent { - public Pre(GuiScreen gui, List buttonList) + public Pre(GuiScreen gui, List buttonList) { super(gui, buttonList); } @@ -64,12 +62,10 @@ public class GuiScreenEvent extends Event /** * This event fires right after {@code GuiScreen.initGui()}. * This is a good place to alter a GuiScreen's component layout if desired. - * - * @author bspkrs */ public static class Post extends InitGuiEvent { - public Post(GuiScreen gui, List buttonList) + public Post(GuiScreen gui, List buttonList) { super(gui, buttonList); } @@ -102,8 +98,6 @@ public class GuiScreenEvent extends Event /** * This event fires just before {@code GuiScreen.drawScreen()} is called. * Cancel this event to skip {@code GuiScreen.drawScreen()}. - * - * @author bspkrs */ @Cancelable public static class Pre extends DrawScreenEvent @@ -116,8 +110,6 @@ public class GuiScreenEvent extends Event /** * This event fires just after {@code GuiScreen.drawScreen()} is called. - * - * @author bspkrs */ public static class Post extends DrawScreenEvent { @@ -137,26 +129,24 @@ public class GuiScreenEvent extends Event /** * A COPY of the {@code buttonList} field from the GuiScreen referenced by {@code gui}. */ - public List buttonList; + public List buttonList; - public ActionPerformedEvent(GuiScreen gui, GuiButton button, List buttonList) + public ActionPerformedEvent(GuiScreen gui, GuiButton button, List buttonList) { super(gui); this.button = button; - this.buttonList = new ArrayList(buttonList); + this.buttonList = new ArrayList(buttonList); } /** * This event fires once it has been determined that a GuiButton object has been clicked. * Cancel this event to bypass {@code GuiScreen.actionPerformed()}. * Replace button with a different button from buttonList to have that button's action executed. - * - * @author bspkrs */ @Cancelable public static class Pre extends ActionPerformedEvent { - public Pre(GuiScreen gui, GuiButton button, List buttonList) + public Pre(GuiScreen gui, GuiButton button, List buttonList) { super(gui, button, buttonList); } @@ -165,12 +155,10 @@ public class GuiScreenEvent extends Event /** * This event fires after {@code GuiScreen.actionPerformed()} provided that the active * screen has not been changed as a result of {@code GuiScreen.actionPerformed()}. - * - * @author bspkrs */ public static class Post extends ActionPerformedEvent { - public Post(GuiScreen gui, GuiButton button, List buttonList) + public Post(GuiScreen gui, GuiButton button, List buttonList) { super(gui, button, buttonList); } diff --git a/src/main/java/net/minecraftforge/client/event/ModelBakeEvent.java b/src/main/java/net/minecraftforge/client/event/ModelBakeEvent.java index 3c55c5d98..d4ac470b0 100644 --- a/src/main/java/net/minecraftforge/client/event/ModelBakeEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ModelBakeEvent.java @@ -1,7 +1,9 @@ package net.minecraftforge.client.event; +import net.minecraft.client.resources.model.IBakedModel; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelManager; +import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.util.IRegistry; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.eventhandler.Event; @@ -13,18 +15,18 @@ import net.minecraftforge.fml.common.eventhandler.Event; public class ModelBakeEvent extends Event { public final ModelManager modelManager; - public final IRegistry modelRegistry; + public final IRegistry modelRegistry; @Deprecated public final ModelBakery modelBakery; public final ModelLoader modelLoader; @Deprecated - public ModelBakeEvent(ModelManager modelManager, IRegistry modelRegistry, ModelBakery modelBakery) + public ModelBakeEvent(ModelManager modelManager, IRegistry modelRegistry, ModelBakery modelBakery) { this(modelManager, modelRegistry, (ModelLoader)modelBakery); } - public ModelBakeEvent(ModelManager modelManager, IRegistry modelRegistry, ModelLoader modelLoader) + public ModelBakeEvent(ModelManager modelManager, IRegistry modelRegistry, ModelLoader modelLoader) { this.modelManager = modelManager; this.modelRegistry = modelRegistry; diff --git a/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java b/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java index fdcdf4e65..97d7d5fde 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderBlockOverlayEvent.java @@ -3,7 +3,6 @@ package net.minecraftforge.client.event; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event; diff --git a/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java b/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java index 10544ce4d..d7491eca6 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderLivingEvent.java @@ -5,15 +5,15 @@ import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.client.renderer.entity.RendererLivingEntity; import net.minecraft.entity.EntityLivingBase; -public abstract class RenderLivingEvent extends Event +public abstract class RenderLivingEvent extends Event { public final EntityLivingBase entity; - public final RendererLivingEntity renderer; + public final RendererLivingEntity renderer; public final double x; public final double y; public final double z; - public RenderLivingEvent(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z) + public RenderLivingEvent(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z) { this.entity = entity; this.renderer = renderer; @@ -23,27 +23,27 @@ public abstract class RenderLivingEvent extends Event } @Cancelable - public static class Pre extends RenderLivingEvent + public static class Pre extends RenderLivingEvent { - public Pre(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } + public Pre(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } } - public static class Post extends RenderLivingEvent + public static class Post extends RenderLivingEvent { - public Post(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } + public Post(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } } - public abstract static class Specials extends RenderLivingEvent + public abstract static class Specials extends RenderLivingEvent { - public Specials(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } + public Specials(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } @Cancelable - public static class Pre extends Specials + public static class Pre extends Specials { - public Pre(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } + public Pre(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } } - public static class Post extends Specials + public static class Post extends Specials { - public Post(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } + public Post(EntityLivingBase entity, RendererLivingEntity renderer, double x, double y, double z){ super(entity, renderer, x, y, z); } } } } diff --git a/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEvent.java b/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEvent.java index ca3af9d62..d3ae0382f 100644 --- a/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEvent.java +++ b/src/main/java/net/minecraftforge/client/event/sound/PlaySoundEvent.java @@ -3,7 +3,6 @@ package net.minecraftforge.client.event.sound; import net.minecraft.client.audio.ISound; import net.minecraft.client.audio.SoundCategory; import net.minecraft.client.audio.SoundManager; -import net.minecraft.client.audio.SoundPoolEntry; /*** * Raised when the SoundManager tries to play a normal sound. diff --git a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java index 007fefc38..b07bb2668 100644 --- a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java +++ b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java @@ -23,7 +23,6 @@ import com.google.common.collect.Lists; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -@SuppressWarnings("deprecation") public class BlockStateLoader { private static final Gson GSON = (new GsonBuilder()) diff --git a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java index 462a30751..2a644a3ad 100644 --- a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java +++ b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java @@ -37,6 +37,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; +@SuppressWarnings("deprecation") public class ForgeBlockStateV1 extends Marker { ForgeBlockStateV1.Variant defaults; diff --git a/src/main/java/net/minecraftforge/client/model/IFlexibleBakedModel.java b/src/main/java/net/minecraftforge/client/model/IFlexibleBakedModel.java index 4d921fa0c..b0cdb977d 100644 --- a/src/main/java/net/minecraftforge/client/model/IFlexibleBakedModel.java +++ b/src/main/java/net/minecraftforge/client/model/IFlexibleBakedModel.java @@ -12,6 +12,7 @@ import net.minecraft.util.EnumFacing; /* * Version of IBakedModel with less restriction on camera transformations and with explicit format of the baked array. */ +@SuppressWarnings("deprecation") public interface IFlexibleBakedModel extends IBakedModel { /* diff --git a/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java b/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java index d78326724..1a32071f6 100644 --- a/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java +++ b/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java @@ -20,6 +20,7 @@ import com.google.common.collect.ImmutableMap; * Model that changes based on the rendering perspective * (first-person, GUI, e.t.c - see TransformType) */ +@SuppressWarnings("deprecation") public interface IPerspectiveAwareModel extends IBakedModel { /* diff --git a/src/main/java/net/minecraftforge/client/model/IPerspectiveState.java b/src/main/java/net/minecraftforge/client/model/IPerspectiveState.java index 838090f6c..a057a85e6 100644 --- a/src/main/java/net/minecraftforge/client/model/IPerspectiveState.java +++ b/src/main/java/net/minecraftforge/client/model/IPerspectiveState.java @@ -12,6 +12,7 @@ import com.google.common.collect.Maps; /** * IModelState that can change depending on the perspective. */ +@SuppressWarnings("deprecation") public interface IPerspectiveState extends IModelState { /** diff --git a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java index feade2917..3165a6366 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java @@ -27,6 +27,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; +@SuppressWarnings("deprecation") public class ItemLayerModel implements IRetexturableModel { public static final ItemLayerModel instance = new ItemLayerModel(ImmutableList.of()); diff --git a/src/main/java/net/minecraftforge/client/model/ModelFluid.java b/src/main/java/net/minecraftforge/client/model/ModelFluid.java index 21b29f9fd..a283f0790 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelFluid.java +++ b/src/main/java/net/minecraftforge/client/model/ModelFluid.java @@ -33,6 +33,7 @@ import com.google.common.collect.Maps; import com.google.gson.JsonElement; import com.google.gson.JsonParser; +@SuppressWarnings("deprecation") public class ModelFluid implements IModelCustomData { public static final ModelFluid waterModel = new ModelFluid(FluidRegistry.WATER); diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 4e0fdef2c..d286890a5 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -63,6 +63,7 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; +@SuppressWarnings("deprecation") public class ModelLoader extends ModelBakery { private final Map stateModels = new HashMap(); @@ -498,7 +499,7 @@ public class ModelLoader extends ModelBakery private final List models = new ArrayList(); private final IModelState defaultState; - @Deprecated public WeightedRandomModel(Variants variants){ this(null, variants); } // Remove 1.9 + @Deprecated @SuppressWarnings("unused") public WeightedRandomModel(Variants variants){ this(null, variants); } // Remove 1.9 public WeightedRandomModel(ModelResourceLocation parent, Variants variants) { this.variants = variants.getVariants(); @@ -601,6 +602,7 @@ public class ModelLoader extends ModelBakery private static class FlexibleWeightedBakedModel extends WeightedBakedModel implements IFlexibleBakedModel { + @SuppressWarnings("unused") private final WeightedBakedModel parent; private final VertexFormat format; @@ -617,6 +619,7 @@ public class ModelLoader extends ModelBakery } } + @SuppressWarnings("unused") private boolean isBuiltinModel(ModelBlock model) { return model == MODEL_GENERATED || model == MODEL_COMPASS || model == MODEL_CLOCK || model == MODEL_ENTITY; diff --git a/src/main/java/net/minecraftforge/client/model/MultiModel.java b/src/main/java/net/minecraftforge/client/model/MultiModel.java index b20112c9f..115d3b9d8 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiModel.java @@ -29,6 +29,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import com.google.common.collect.Sets; +@SuppressWarnings("deprecation") public class MultiModel implements IModel { public static class Baked implements IFlexibleBakedModel, IPerspectiveAwareModel diff --git a/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java b/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java index 3aed561b0..b6a201e2a 100644 --- a/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java +++ b/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java @@ -30,6 +30,7 @@ import com.google.common.base.Objects; * should be comparable to using Matrix4f directly. * Immutable. */ +@SuppressWarnings("deprecation") public class TRSRTransformation implements IModelState, ITransformation { private final Matrix4f matrix; @@ -312,6 +313,7 @@ public class TRSRTransformation implements IModelState, ITransformation m.setColumn(i, t); } + @SuppressWarnings("unused") private static void sortSingularValues(Matrix3f b, Quat4f v) { float p0 = b.m00 * b.m00 + b.m10 * b.m10 + b.m20 * b.m20; diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java index 91130d2d4..95a2b307d 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java @@ -75,6 +75,7 @@ import com.google.gson.JsonParser; * To enable for your mod call instance.addDomain(modid). * If you need more control over accepted resources - extend the class, and register a new instance with ModelLoaderRegistry. */ +@SuppressWarnings("deprecation") public class B3DLoader implements ICustomModelLoader { public static final B3DLoader instance = new B3DLoader(); diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java index dc3ceb971..9afe97410 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java @@ -57,12 +57,11 @@ import com.google.common.base.Function; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; +@SuppressWarnings("deprecation") public class OBJModel implements IRetexturableModel, IModelCustomData { - private Gson GSON = new GsonBuilder().create(); + //private Gson GSON = new GsonBuilder().create(); private MaterialLibrary matLib; private final ResourceLocation modelLocation; private CustomData customData; @@ -832,6 +831,11 @@ public class OBJModel implements IRetexturableModel, IModelCustomData { return this.materialName; } + + public boolean isTriangles() + { + return isTri; + } public boolean setVertices(Vertex[] verts) { diff --git a/src/main/java/net/minecraftforge/common/DimensionManager.java b/src/main/java/net/minecraftforge/common/DimensionManager.java index b522920b6..096457fc3 100644 --- a/src/main/java/net/minecraftforge/common/DimensionManager.java +++ b/src/main/java/net/minecraftforge/common/DimensionManager.java @@ -29,7 +29,6 @@ import net.minecraft.world.WorldProviderHell; import net.minecraft.world.WorldProviderSurface; import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServerMulti; -import net.minecraft.world.WorldSettings; import net.minecraft.world.storage.ISaveHandler; import net.minecraft.world.storage.SaveHandler; import net.minecraftforge.event.world.WorldEvent; @@ -242,7 +241,7 @@ public class DimensionManager } MinecraftServer mcServer = overworld.getMinecraftServer(); ISaveHandler savehandler = overworld.getSaveHandler(); - WorldSettings worldSettings = new WorldSettings(overworld.getWorldInfo()); + //WorldSettings worldSettings = new WorldSettings(overworld.getWorldInfo()); WorldServer world = (dim == 0 ? overworld : (WorldServer)(new WorldServerMulti(mcServer, savehandler, dim, overworld, mcServer.theProfiler).init())); world.addWorldAccess(new WorldManager(mcServer, world)); diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index aab0aca45..ec12a1482 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -574,7 +574,6 @@ public class ForgeHooks IChatComponent ichat = null; Matcher matcher = URL_PATTERN.matcher(string); int lastEnd = 0; - String remaining = string; // Find all urls while (matcher.find()) diff --git a/src/main/java/net/minecraftforge/common/ForgeModContainer.java b/src/main/java/net/minecraftforge/common/ForgeModContainer.java index 832842d3f..48d4ab36b 100644 --- a/src/main/java/net/minecraftforge/common/ForgeModContainer.java +++ b/src/main/java/net/minecraftforge/common/ForgeModContainer.java @@ -37,7 +37,6 @@ import net.minecraftforge.fml.client.FMLFileResourcePack; import net.minecraftforge.fml.client.FMLFolderResourcePack; import net.minecraftforge.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent; import net.minecraftforge.fml.common.DummyModContainer; -import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.LoadController; import net.minecraftforge.fml.common.Loader; @@ -79,7 +78,6 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC private URL updateJSONUrl = null; - @SuppressWarnings("deprecation") public ForgeModContainer() { super(new ModMetadata()); @@ -93,7 +91,6 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC "to work cooperatively together. It allows many mods to be created without " + "them editing the main Minecraft code."; meta.url = "http://minecraftforge.net"; - meta.updateUrl = "http://minecraftforge.net/forum/index.php/topic,5.0.html"; meta.screenshots = new String[0]; meta.logoFile = "/forge_logo.png"; try { @@ -303,7 +300,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC { MinecraftForge.EVENT_BUS.register(MinecraftForge.INTERNAL_HANDLER); ForgeChunkManager.captureConfig(evt.getModConfigurationDirectory()); - FMLCommonHandler.instance().bus().register(this); + MinecraftForge.EVENT_BUS.register(this); if (!ForgeModContainer.disableVersionCheck) { diff --git a/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java b/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java index 7711273e8..25166eec9 100644 --- a/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java +++ b/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java @@ -32,6 +32,11 @@ public class ExtendedBlockState extends BlockState } this.unlistedProperties = builder.build(); } + + public Collection> getUnlistedProperties() + { + return unlistedProperties; + } private static ImmutableMap, Optional> buildUnlistedMap(IUnlistedProperty[] unlistedProperties) { diff --git a/src/main/java/net/minecraftforge/common/util/AsynchronousExecutor.java b/src/main/java/net/minecraftforge/common/util/AsynchronousExecutor.java index f98bf8da5..9fa2656ec 100644 --- a/src/main/java/net/minecraftforge/common/util/AsynchronousExecutor.java +++ b/src/main/java/net/minecraftforge/common/util/AsynchronousExecutor.java @@ -314,7 +314,7 @@ public final class AsynchronousExecutor { /** * Processes a parameter as if it was in the queue, without ever passing to another thread. */ - public T getSkipQueue(P parameter, C...callbacks) throws E { + public T getSkipQueue(P parameter, @SuppressWarnings("unchecked")C... callbacks) throws E { final CallBackProvider provider = this.provider; final T object = skipQueue(parameter); for (C callback : callbacks) { diff --git a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java index 26977a24b..53222e42e 100644 --- a/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java +++ b/src/main/java/net/minecraftforge/common/util/BlockSnapshot.java @@ -1,9 +1,7 @@ package net.minecraftforge.common.util; - import java.io.Serializable; -import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -20,7 +18,7 @@ import net.minecraftforge.fml.common.registry.GameRegistry.UniqueIdentifier; * Unlike Block, which only one object can exist per coordinate, BlockSnapshot * can exist multiple times for any given Block. */ -@SuppressWarnings("serial") +@SuppressWarnings({"serial", "deprecation"}) public class BlockSnapshot implements Serializable { private static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("forge.debugBlockSnapshot", "false")); diff --git a/src/main/java/net/minecraftforge/common/util/FakePlayerFactory.java b/src/main/java/net/minecraftforge/common/util/FakePlayerFactory.java index 13a8ea089..e7bbbccbc 100644 --- a/src/main/java/net/minecraftforge/common/util/FakePlayerFactory.java +++ b/src/main/java/net/minecraftforge/common/util/FakePlayerFactory.java @@ -10,7 +10,6 @@ import com.google.common.collect.Maps; import com.mojang.authlib.GameProfile; import net.minecraft.world.WorldServer; -import net.minecraftforge.common.DimensionManager; //To be expanded for generic Mod fake players? public class FakePlayerFactory @@ -26,7 +25,7 @@ public class FakePlayerFactory if (ret == null) { ret = FakePlayerFactory.get(world, MINECRAFT); - MINECRAFT_PLAYER = new WeakReference(ret); + MINECRAFT_PLAYER = new WeakReference(ret); } return ret; } diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index 9356e262d..b7e53a40f 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -1,10 +1,7 @@ package net.minecraftforge.event; import java.io.File; -import java.util.ArrayList; import java.util.EnumSet; -import java.util.HashMap; -import java.util.Iterator; import java.util.List; import net.minecraft.block.Block; @@ -25,7 +22,6 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; import net.minecraft.world.Explosion; import net.minecraft.world.World; import net.minecraft.world.WorldServer; @@ -36,8 +32,6 @@ import net.minecraft.world.storage.SaveHandler; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.RenderBlockOverlayEvent; import net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType; -import net.minecraftforge.common.ForgeHooks; -import net.minecraftforge.common.IExtendedEntityProperties; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.BlockSnapshot; import net.minecraftforge.event.brewing.PotionBrewEvent; diff --git a/src/main/java/net/minecraftforge/event/brewing/PotionBrewEvent.java b/src/main/java/net/minecraftforge/event/brewing/PotionBrewEvent.java index d7c3d1be5..8ec9d6724 100644 --- a/src/main/java/net/minecraftforge/event/brewing/PotionBrewEvent.java +++ b/src/main/java/net/minecraftforge/event/brewing/PotionBrewEvent.java @@ -73,6 +73,7 @@ public class PotionBrewEvent extends Event *
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/ + @SuppressWarnings("deprecation") public static class Post extends PotionBrewedEvent { public Post(ItemStack[] stacks) diff --git a/src/main/java/net/minecraftforge/event/brewing/PotionBrewedEvent.java b/src/main/java/net/minecraftforge/event/brewing/PotionBrewedEvent.java index c18cfab95..59bf94d61 100644 --- a/src/main/java/net/minecraftforge/event/brewing/PotionBrewedEvent.java +++ b/src/main/java/net/minecraftforge/event/brewing/PotionBrewedEvent.java @@ -1,6 +1,5 @@ package net.minecraftforge.event.brewing; -import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.item.ItemStack; /** @@ -16,7 +15,7 @@ import net.minecraft.item.ItemStack; *
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/ -@Deprecated +@Deprecated // remove in 1.9 public class PotionBrewedEvent extends PotionBrewEvent { /** diff --git a/src/main/java/net/minecraftforge/event/entity/EntityMountEvent.java b/src/main/java/net/minecraftforge/event/entity/EntityMountEvent.java index 3ed532409..c849e4792 100644 --- a/src/main/java/net/minecraftforge/event/entity/EntityMountEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/EntityMountEvent.java @@ -1,7 +1,6 @@ package net.minecraftforge.event.entity; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; import net.minecraft.world.World; import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event.HasResult; diff --git a/src/main/java/net/minecraftforge/event/entity/player/AchievementEvent.java b/src/main/java/net/minecraftforge/event/entity/player/AchievementEvent.java index 22a0d8271..5a8e5c15d 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/AchievementEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/AchievementEvent.java @@ -3,7 +3,6 @@ package net.minecraftforge.event.entity.player; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.stats.Achievement; import net.minecraftforge.fml.common.eventhandler.Cancelable; -import net.minecraftforge.fml.common.eventhandler.Event; /** * When the player receives an achievement. If canceled the player will not receive anything. diff --git a/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java b/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java index 8424fb6b7..efd23ace5 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/BonemealEvent.java @@ -2,7 +2,6 @@ package net.minecraftforge.event.entity.player; import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event; -import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.BlockPos; diff --git a/src/main/java/net/minecraftforge/event/terraingen/BiomeEvent.java b/src/main/java/net/minecraftforge/event/terraingen/BiomeEvent.java index 55c4a1675..5ee2cc597 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/BiomeEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/BiomeEvent.java @@ -2,7 +2,6 @@ package net.minecraftforge.event.terraingen; import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraftforge.fml.common.eventhandler.Event.HasResult; -import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.biome.BiomeGenBase; diff --git a/src/main/java/net/minecraftforge/event/terraingen/ChunkProviderEvent.java b/src/main/java/net/minecraftforge/event/terraingen/ChunkProviderEvent.java index 1da93b7f3..d9374346a 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/ChunkProviderEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/ChunkProviderEvent.java @@ -1,9 +1,7 @@ package net.minecraftforge.event.terraingen; import net.minecraftforge.fml.common.eventhandler.Event; -import net.minecraft.block.Block; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.ChunkPrimer; import net.minecraft.world.chunk.IChunkProvider; diff --git a/src/main/java/net/minecraftforge/event/world/BlockEvent.java b/src/main/java/net/minecraftforge/event/world/BlockEvent.java index 8e87f8543..bd33fe17d 100644 --- a/src/main/java/net/minecraftforge/event/world/BlockEvent.java +++ b/src/main/java/net/minecraftforge/event/world/BlockEvent.java @@ -1,10 +1,8 @@ package net.minecraftforge.event.world; -import java.util.ArrayList; import java.util.EnumSet; import java.util.List; -import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java b/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java index e9e3894e8..5df225e85 100644 --- a/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java +++ b/src/main/java/net/minecraftforge/event/world/NoteBlockEvent.java @@ -15,6 +15,7 @@ import net.minecraftforge.fml.common.eventhandler.Event; * Base class for Noteblock Events * */ +@SuppressWarnings("unused") public class NoteBlockEvent extends BlockEvent { private int noteId; diff --git a/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java b/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java index 5580d72b9..b5828a447 100644 --- a/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java +++ b/src/main/java/net/minecraftforge/fluids/BlockFluidBase.java @@ -37,6 +37,7 @@ import com.google.common.collect.Maps; * @author King Lemming, OvermindDL1 * */ +@SuppressWarnings("unchecked") public abstract class BlockFluidBase extends Block implements IFluidBlock { protected final static Map defaultDisplacements = Maps.newHashMap(); @@ -90,10 +91,11 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock public static final PropertyInteger LEVEL = PropertyInteger.create("level", 0, 15); public static final PropertyFloat[] LEVEL_CORNERS = new PropertyFloat[4]; public static final PropertyFloat FLOW_DIRECTION = new PropertyFloat("flow_direction"); - public static final IUnlistedProperty[] FLUID_RENDER_PROPS; + public static final IUnlistedProperty[] FLUID_RENDER_PROPS; static { + @SuppressWarnings("rawtypes") ImmutableList.Builder builder = ImmutableList.builder(); builder.add(FLOW_DIRECTION); for(int i = 0; i < 4; i++) diff --git a/src/main/java/net/minecraftforge/fluids/Fluid.java b/src/main/java/net/minecraftforge/fluids/Fluid.java index 9198ac271..8da11b417 100644 --- a/src/main/java/net/minecraftforge/fluids/Fluid.java +++ b/src/main/java/net/minecraftforge/fluids/Fluid.java @@ -1,19 +1,12 @@ package net.minecraftforge.fluids; import java.util.Locale; -import java.util.Map; - -import com.google.common.collect.Maps; - import net.minecraft.block.Block; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.util.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeModContainer; import net.minecraftforge.fml.common.FMLLog; -import net.minecraftforge.fml.common.LoaderException; import net.minecraft.item.EnumRarity; /** diff --git a/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java b/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java index 435598c03..da4d53504 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java +++ b/src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java @@ -1,10 +1,6 @@ package net.minecraftforge.fluids; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; import java.util.Map; import java.util.Set; @@ -14,7 +10,6 @@ import com.google.common.collect.Sets; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraft.init.Items; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; diff --git a/src/main/java/net/minecraftforge/fluids/FluidRegistry.java b/src/main/java/net/minecraftforge/fluids/FluidRegistry.java index 9869c9545..c58218bc5 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidRegistry.java +++ b/src/main/java/net/minecraftforge/fluids/FluidRegistry.java @@ -7,8 +7,6 @@ import java.util.Set; import org.apache.logging.log4j.Level; import net.minecraft.block.Block; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; diff --git a/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java b/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java index 814a68311..d357636dc 100644 --- a/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java +++ b/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java @@ -41,14 +41,12 @@ import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.client.network.OldServerPinger; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.resources.AbstractResourcePack; import net.minecraft.client.resources.FallbackResourceManager; import net.minecraft.client.resources.IReloadableResourceManager; import net.minecraft.client.resources.IResourcePack; import net.minecraft.client.resources.SimpleReloadableResourceManager; import net.minecraft.crash.CrashReport; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.launchwrapper.Launch; import net.minecraft.nbt.CompressedStreamTools; @@ -154,10 +152,6 @@ public class FMLClientHandler implements IFMLSidedHandler private DummyModContainer optifineContainer; - private boolean guiLoaded; - - private boolean serverIsRunning; - private MissingModsException modsMissing; private ModSortingException modSorting; @@ -174,8 +168,6 @@ public class FMLClientHandler implements IFMLSidedHandler private List resourcePackList; - private IReloadableResourceManager resourceManager; - private Map resourcePackMap; private BiMap guiFactories; @@ -199,7 +191,6 @@ public class FMLClientHandler implements IFMLSidedHandler SplashProgress.start(); client = minecraft; this.resourcePackList = resourcePackList; - this.resourceManager = resourceManager; this.resourcePackMap = Maps.newHashMap(); if (minecraft.isDemo()) { @@ -369,6 +360,7 @@ public class FMLClientHandler implements IFMLSidedHandler { continue; } + /* Map mod = modEntry.getValue(); String modSystem = mod.get("modsystem"); // the modsystem (FML uses FML or ModLoader) String modId = mod.get("id"); // unique ID @@ -377,6 +369,7 @@ public class FMLClientHandler implements IFMLSidedHandler String modURL = mod.get("url"); // a URL for the mod (can be empty string) String modAuthors = mod.get("authors"); // a csv of authors (can be empty string) String modDescription = mod.get("description"); // a (potentially) multiline description (can be empty string) + */ } } diff --git a/src/main/java/net/minecraftforge/fml/client/GuiAccessDenied.java b/src/main/java/net/minecraftforge/fml/client/GuiAccessDenied.java index a730f00d8..1941e90f5 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiAccessDenied.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiAccessDenied.java @@ -27,7 +27,6 @@ public class GuiAccessDenied extends GuiScreen this.data = data; } - @SuppressWarnings("unchecked") @Override public void initGui() { diff --git a/src/main/java/net/minecraftforge/fml/client/GuiBackupFailed.java b/src/main/java/net/minecraftforge/fml/client/GuiBackupFailed.java index abb74ee20..4526c5408 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiBackupFailed.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiBackupFailed.java @@ -27,7 +27,6 @@ public class GuiBackupFailed extends GuiScreen this.zipName = zipName; } - @SuppressWarnings("unchecked") @Override public void initGui() { diff --git a/src/main/java/net/minecraftforge/fml/client/GuiConfirmation.java b/src/main/java/net/minecraftforge/fml/client/GuiConfirmation.java index f1e6fb8b4..97b26d450 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiConfirmation.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiConfirmation.java @@ -12,7 +12,6 @@ public class GuiConfirmation extends GuiNotification super(query); } - @SuppressWarnings("unchecked") @Override public void initGui() { diff --git a/src/main/java/net/minecraftforge/fml/client/GuiModList.java b/src/main/java/net/minecraftforge/fml/client/GuiModList.java index 2792b7b40..e94680638 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiModList.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiModList.java @@ -150,7 +150,6 @@ public class GuiModList extends GuiScreen } } - @SuppressWarnings("unchecked") @Override public void initGui() { @@ -476,11 +475,6 @@ public class GuiModList extends GuiScreen @Override protected void drawBackground() {} @Override protected void drawSlot(int slotIdx, int entryRight, int slotTop, int slotBuffer, Tessellator tess) { } - private List splitLines(String line) - { - return null; - } - private List resizeContent(List lines) { List ret = new ArrayList(); diff --git a/src/main/java/net/minecraftforge/fml/client/GuiModsMissingForServer.java b/src/main/java/net/minecraftforge/fml/client/GuiModsMissingForServer.java index a55aa5431..07a4235a5 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiModsMissingForServer.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiModsMissingForServer.java @@ -27,7 +27,6 @@ public class GuiModsMissingForServer extends GuiScreen this.modsMissing = modsMissing; } - @SuppressWarnings("unchecked") @Override public void initGui() { diff --git a/src/main/java/net/minecraftforge/fml/client/GuiNotification.java b/src/main/java/net/minecraftforge/fml/client/GuiNotification.java index 7cbc45ba6..fbf826283 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiNotification.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiNotification.java @@ -12,7 +12,6 @@ public class GuiNotification extends GuiScreen this.query = query; } - @SuppressWarnings("unchecked") @Override public void initGui() { diff --git a/src/main/java/net/minecraftforge/fml/client/SplashProgress.java b/src/main/java/net/minecraftforge/fml/client/SplashProgress.java index 5582f03ba..9ed49fefd 100644 --- a/src/main/java/net/minecraftforge/fml/client/SplashProgress.java +++ b/src/main/java/net/minecraftforge/fml/client/SplashProgress.java @@ -100,9 +100,9 @@ import org.lwjgl.opengl.SharedDrawable; import org.lwjgl.util.glu.GLU; /** - * @deprecated not a stable API, will break, don't use this yet + * Not a fully fleshed out API, may change in future MC versions. + * However feel free to use and suggest additions. */ -@Deprecated @SuppressWarnings("serial") public class SplashProgress { diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiConfig.java b/src/main/java/net/minecraftforge/fml/client/config/GuiConfig.java index 0d61d073b..7b1071364 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiConfig.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiConfig.java @@ -24,11 +24,11 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; import net.minecraft.util.ChatComponentText; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.config.GuiConfigEntries.IConfigEntry; import net.minecraftforge.fml.client.event.ConfigChangedEvent; import net.minecraftforge.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent; import net.minecraftforge.fml.client.event.ConfigChangedEvent.PostConfigChangedEvent; -import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.eventhandler.Event.Result; @@ -175,7 +175,6 @@ public class GuiConfig extends GuiScreen return path.replace("\\", "/").replace(mc.mcDataDir.getAbsolutePath().replace("\\", "/"), "/.minecraft"); } - @SuppressWarnings("unchecked") @Override public void initGui() { @@ -240,9 +239,9 @@ public class GuiConfig extends GuiScreen if (Loader.isModLoaded(modID)) { ConfigChangedEvent event = new OnConfigChangedEvent(modID, configID, isWorldRunning, requiresMcRestart); - FMLCommonHandler.instance().bus().post(event); + MinecraftForge.EVENT_BUS.post(event); if (!event.getResult().equals(Result.DENY)) - FMLCommonHandler.instance().bus().post(new PostConfigChangedEvent(modID, configID, isWorldRunning, requiresMcRestart)); + MinecraftForge.EVENT_BUS.post(new PostConfigChangedEvent(modID, configID, isWorldRunning, requiresMcRestart)); if (requiresMcRestart) { @@ -344,8 +343,7 @@ public class GuiConfig extends GuiScreen this.drawToolTip(this.mc.fontRendererObj.listFormattedStringToWidth(I18n.format("fml.configgui.tooltip.applyGlobally"), 300), mouseX, mouseY); } - @SuppressWarnings("rawtypes") - public void drawToolTip(List stringList, int x, int y) + public void drawToolTip(List stringList, int x, int y) { this.drawHoveringText(stringList, x, y); } diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiConfigEntries.java b/src/main/java/net/minecraftforge/fml/client/config/GuiConfigEntries.java index cdc5c1ff3..b7b5b220c 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiConfigEntries.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiConfigEntries.java @@ -1454,7 +1454,6 @@ public class GuiConfigEntries extends GuiListExtended * * Provides a base entry for others to extend. Handles drawing the prop label (if drawLabel == true) and the Undo/Default buttons. */ - @SuppressWarnings("rawtypes") public static abstract class ListEntryBase implements IConfigEntry { protected final GuiConfig owningScreen; @@ -1464,16 +1463,15 @@ public class GuiConfigEntries extends GuiListExtended protected final String name; protected final GuiButtonExt btnUndoChanges; protected final GuiButtonExt btnDefault; - protected List toolTip; - protected List undoToolTip; - protected List defaultToolTip; + protected List toolTip; + protected List undoToolTip; + protected List defaultToolTip; protected boolean isValidValue = true; protected HoverChecker tooltipHoverChecker; protected HoverChecker undoHoverChecker; protected HoverChecker defaultHoverChecker; protected boolean drawLabel; - @SuppressWarnings({ "unchecked" }) public ListEntryBase(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement configElement) { this.owningScreen = owningScreen; diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiEditArray.java b/src/main/java/net/minecraftforge/fml/client/config/GuiEditArray.java index 914347ce5..1202b7e39 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiEditArray.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiEditArray.java @@ -46,11 +46,9 @@ public class GuiEditArray extends GuiScreen protected final Object[] beforeValues; protected Object[] currentValues; protected HoverChecker tooltipHoverChecker; - @SuppressWarnings("rawtypes") - protected List toolTip; + protected List toolTip; protected boolean enabled; - @SuppressWarnings("rawtypes") public GuiEditArray(GuiScreen parentScreen, IConfigElement configElement, int slotIndex, Object[] currentValues, boolean enabled) { this.mc = Minecraft.getMinecraft(); @@ -59,7 +57,7 @@ public class GuiEditArray extends GuiScreen this.slotIndex = slotIndex; this.beforeValues = currentValues; this.currentValues = currentValues; - this.toolTip = new ArrayList(); + this.toolTip = new ArrayList(); this.enabled = enabled; String propName = I18n.format(configElement.getLanguageKey()); String comment; @@ -96,7 +94,6 @@ public class GuiEditArray extends GuiScreen } } - @SuppressWarnings("unchecked") @Override public void initGui() { @@ -206,8 +203,7 @@ public class GuiEditArray extends GuiScreen drawToolTip(this.toolTip, par1, par2); } - @SuppressWarnings("rawtypes") - public void drawToolTip(List stringList, int x, int y) + public void drawToolTip(List stringList, int x, int y) { this.drawHoveringText(stringList, x, y); } diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiEditArrayEntries.java b/src/main/java/net/minecraftforge/fml/client/config/GuiEditArrayEntries.java index d7bb4622a..85088e8fc 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiEditArrayEntries.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiEditArrayEntries.java @@ -32,10 +32,7 @@ import static net.minecraftforge.fml.client.config.GuiUtils.VALID; /** * This class implements the scrolling list functionality of the GuiEditList screen. It also provides all the default controls * for editing array-type properties. - * - * @author bspkrs */ -@SuppressWarnings("rawtypes") public class GuiEditArrayEntries extends GuiListExtended { protected GuiEditArray owningGui; @@ -535,11 +532,10 @@ public class GuiEditArrayEntries extends GuiListExtended private final HoverChecker addNewEntryAboveHoverChecker; protected final GuiButtonExt btnRemoveEntry; private final HoverChecker removeEntryHoverChecker; - private List addNewToolTip, removeToolTip; + private List addNewToolTip, removeToolTip; protected boolean isValidValue = true; protected boolean isValidated = false; - @SuppressWarnings({ "unchecked" }) public BaseEntry(GuiEditArray owningScreen, GuiEditArrayEntries owningEntryList, IConfigElement configElement) { this.owningScreen = owningScreen; @@ -553,8 +549,8 @@ public class GuiEditArrayEntries extends GuiListExtended this.btnRemoveEntry.enabled = owningScreen.enabled; this.addNewEntryAboveHoverChecker = new HoverChecker(this.btnAddNewEntryAbove, 800); this.removeEntryHoverChecker = new HoverChecker(this.btnRemoveEntry, 800); - this.addNewToolTip = new ArrayList(); - this.removeToolTip = new ArrayList(); + this.addNewToolTip = new ArrayList(); + this.removeToolTip = new ArrayList(); addNewToolTip.add(I18n.format("fml.configgui.tooltip.addNewEntryAbove")); removeToolTip.add(I18n.format("fml.configgui.tooltip.removeEntry")); } diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiSelectString.java b/src/main/java/net/minecraftforge/fml/client/config/GuiSelectString.java index fb519979e..e4975fc4a 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiSelectString.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiSelectString.java @@ -44,11 +44,9 @@ public class GuiSelectString extends GuiScreen public final Object beforeValue; public Object currentValue; protected HoverChecker tooltipHoverChecker; - @SuppressWarnings("rawtypes") - protected List toolTip; + protected List toolTip; protected boolean enabled; - @SuppressWarnings("rawtypes") public GuiSelectString(GuiScreen parentScreen, IConfigElement configElement, int slotIndex, Map selectableValues, Object currentValue, boolean enabled) { this.mc = Minecraft.getMinecraft(); @@ -58,7 +56,7 @@ public class GuiSelectString extends GuiScreen this.selectableValues = selectableValues; this.beforeValue = currentValue; this.currentValue = currentValue; - this.toolTip = new ArrayList(); + this.toolTip = new ArrayList(); this.enabled = enabled; String propName = I18n.format(configElement.getLanguageKey()); String comment; @@ -95,7 +93,6 @@ public class GuiSelectString extends GuiScreen } } - @SuppressWarnings("unchecked") @Override public void initGui() { @@ -178,8 +175,7 @@ public class GuiSelectString extends GuiScreen drawToolTip(this.toolTip, par1, par2); } - @SuppressWarnings("rawtypes") - public void drawToolTip(List stringList, int x, int y) + public void drawToolTip(List stringList, int x, int y) { this.drawHoveringText(stringList, x, y); } diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiSlider.java b/src/main/java/net/minecraftforge/fml/client/config/GuiSlider.java index d698630ad..0085dc41b 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiSlider.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiSlider.java @@ -3,8 +3,6 @@ package net.minecraftforge.fml.client.config; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; -import org.lwjgl.opengl.GL11; - /** * This class is blatantly stolen from iChunUtils with permission. * diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiUnicodeGlyphButton.java b/src/main/java/net/minecraftforge/fml/client/config/GuiUnicodeGlyphButton.java index b8b53501b..d11289868 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiUnicodeGlyphButton.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiUnicodeGlyphButton.java @@ -15,8 +15,6 @@ package net.minecraftforge.fml.client.config; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; -import org.lwjgl.opengl.GL11; - /** * This class provides a button that shows a string glyph at the beginning. The glyph can be scaled using the glyphScale parameter. * diff --git a/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java b/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java index 75a79493e..d2985182d 100644 --- a/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java +++ b/src/main/java/net/minecraftforge/fml/client/config/GuiUtils.java @@ -14,7 +14,6 @@ package net.minecraftforge.fml.client.config; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; diff --git a/src/main/java/net/minecraftforge/fml/client/registry/ClientRegistry.java b/src/main/java/net/minecraftforge/fml/client/registry/ClientRegistry.java index 790d47149..853b321be 100644 --- a/src/main/java/net/minecraftforge/fml/client/registry/ClientRegistry.java +++ b/src/main/java/net/minecraftforge/fml/client/registry/ClientRegistry.java @@ -31,14 +31,13 @@ public class ClientRegistry * @param id * @param specialRenderer */ - public static void registerTileEntity(Class tileEntityClass, String id, TileEntitySpecialRenderer specialRenderer) + public static void registerTileEntity(Class tileEntityClass, String id, TileEntitySpecialRenderer specialRenderer) { GameRegistry.registerTileEntity(tileEntityClass, id); bindTileEntitySpecialRenderer(tileEntityClass, specialRenderer); } - @SuppressWarnings("unchecked") - public static void bindTileEntitySpecialRenderer(Class tileEntityClass, TileEntitySpecialRenderer specialRenderer) + public static void bindTileEntitySpecialRenderer(Class tileEntityClass, TileEntitySpecialRenderer specialRenderer) { TileEntityRendererDispatcher.instance.mapSpecialRenderers.put(tileEntityClass, specialRenderer); specialRenderer.setRendererDispatcher(TileEntityRendererDispatcher.instance); diff --git a/src/main/java/net/minecraftforge/fml/common/DuplicateModsFoundException.java b/src/main/java/net/minecraftforge/fml/common/DuplicateModsFoundException.java index e9e4f0af0..992356a57 100644 --- a/src/main/java/net/minecraftforge/fml/common/DuplicateModsFoundException.java +++ b/src/main/java/net/minecraftforge/fml/common/DuplicateModsFoundException.java @@ -15,26 +15,24 @@ package net.minecraftforge.fml.common; import java.io.File; import java.util.Map.Entry; -import net.minecraftforge.fml.common.EnhancedRuntimeException.WrappedPrintStream; - import com.google.common.collect.SetMultimap; public class DuplicateModsFoundException extends LoaderException { private static final long serialVersionUID = 1L; public SetMultimap dupes; - public DuplicateModsFoundException(SetMultimap dupes) { - this.dupes = dupes; - } + public DuplicateModsFoundException(SetMultimap dupes) { + this.dupes = dupes; + } - @Override - protected void printStackTrace(WrappedPrintStream stream) - { - stream.println("Duplicate Mods:"); - for (Entry e : dupes.entries()) - { - stream.println(String.format("\t%s : %s", e.getKey().getModId(), e.getValue().getAbsolutePath())); - } - stream.println(""); - } + @Override + protected void printStackTrace(WrappedPrintStream stream) + { + stream.println("Duplicate Mods:"); + for (Entry e : dupes.entries()) + { + stream.println(String.format("\t%s : %s", e.getKey().getModId(), e.getValue().getAbsolutePath())); + } + stream.println(""); + } } diff --git a/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java b/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java index d60665058..63d60cec4 100644 --- a/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java @@ -18,8 +18,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.lang.ref.WeakReference; -import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -67,8 +65,6 @@ import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Logger; import com.google.common.base.Joiner; -import com.google.common.base.Strings; -import com.google.common.base.Throwables; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList.Builder; import com.google.common.collect.Lists; @@ -101,7 +97,6 @@ public class FMLCommonHandler */ private IFMLSidedHandler sidedDelegate; - private Class forge; private boolean noForge; private List brandings; private List brandingsNoMC; @@ -676,7 +671,7 @@ public class FMLCommonHandler return sidedDelegate.getWorldThread(net); } - public static void callFuture(FutureTask task) + public static void callFuture(FutureTask task) { try { @@ -726,7 +721,7 @@ public class FMLCommonHandler Properties props = new Properties(); props.load(new InputStreamReader(new ByteArrayInputStream(data), Charsets.UTF_8)); - for (Entry e : props.entrySet()) + for (Entry e : props.entrySet()) { table.put((String)e.getKey(), (String)e.getValue()); } diff --git a/src/main/java/net/minecraftforge/fml/common/FMLContainer.java b/src/main/java/net/minecraftforge/fml/common/FMLContainer.java index bf2fd345a..85cde3e24 100644 --- a/src/main/java/net/minecraftforge/fml/common/FMLContainer.java +++ b/src/main/java/net/minecraftforge/fml/common/FMLContainer.java @@ -15,7 +15,6 @@ package net.minecraftforge.fml.common; import java.io.File; import java.security.cert.Certificate; import java.util.Arrays; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -24,7 +23,6 @@ import java.util.Set; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagIntArray; import net.minecraft.nbt.NBTTagList; import net.minecraft.world.storage.SaveHandler; import net.minecraft.world.storage.WorldInfo; @@ -42,9 +40,6 @@ import net.minecraftforge.fml.relauncher.Side; import org.apache.logging.log4j.Level; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; import com.google.common.eventbus.EventBus; import com.google.common.eventbus.Subscribe; @@ -67,7 +62,6 @@ public class FMLContainer extends DummyModContainer implements WorldAccessContai "from the file system. It also provides key capabilities for mods to be able " + "to cooperate and provide a good modding environment. "; meta.url="https://github.com/MinecraftForge/FML/wiki"; - meta.updateUrl="https://github.com/MinecraftForge/FML/wiki"; meta.screenshots=new String[0]; meta.logoFile=""; } diff --git a/src/main/java/net/minecraftforge/fml/common/LoadController.java b/src/main/java/net/minecraftforge/fml/common/LoadController.java index 470293d17..3a5a60a5a 100644 --- a/src/main/java/net/minecraftforge/fml/common/LoadController.java +++ b/src/main/java/net/minecraftforge/fml/common/LoadController.java @@ -31,7 +31,6 @@ import net.minecraftforge.fml.common.versioning.ArtifactVersion; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.ThreadContext; -import com.google.common.base.Joiner; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.BiMap; import com.google.common.collect.Collections2; diff --git a/src/main/java/net/minecraftforge/fml/common/Loader.java b/src/main/java/net/minecraftforge/fml/common/Loader.java index 099404427..33dcb6cad 100644 --- a/src/main/java/net/minecraftforge/fml/common/Loader.java +++ b/src/main/java/net/minecraftforge/fml/common/Loader.java @@ -112,6 +112,7 @@ import com.google.gson.JsonParser; * @author cpw * */ +@SuppressWarnings("unused") public class Loader { public static final String MC_VERSION = "1.8.8"; diff --git a/src/main/java/net/minecraftforge/fml/common/LoaderState.java b/src/main/java/net/minecraftforge/fml/common/LoaderState.java index 5bf8d85b3..144376322 100644 --- a/src/main/java/net/minecraftforge/fml/common/LoaderState.java +++ b/src/main/java/net/minecraftforge/fml/common/LoaderState.java @@ -92,6 +92,12 @@ public enum LoaderState if (this == NOINIT) return NOINIT; return LoaderState.values()[this.ordinal()-1]; } + + public String getPrettyName() + { + return name; + } + public enum ModState { UNLOADED ("Unloaded", "U"), diff --git a/src/main/java/net/minecraftforge/fml/common/MissingModsException.java b/src/main/java/net/minecraftforge/fml/common/MissingModsException.java index 5d268e554..d98d6511e 100644 --- a/src/main/java/net/minecraftforge/fml/common/MissingModsException.java +++ b/src/main/java/net/minecraftforge/fml/common/MissingModsException.java @@ -14,7 +14,6 @@ package net.minecraftforge.fml.common; import java.util.Set; -import net.minecraftforge.fml.common.EnhancedRuntimeException.WrappedPrintStream; import net.minecraftforge.fml.common.versioning.ArtifactVersion; public class MissingModsException extends EnhancedRuntimeException diff --git a/src/main/java/net/minecraftforge/fml/common/ModAPIManager.java b/src/main/java/net/minecraftforge/fml/common/ModAPIManager.java index 4d361ca64..4f4d8b2cd 100644 --- a/src/main/java/net/minecraftforge/fml/common/ModAPIManager.java +++ b/src/main/java/net/minecraftforge/fml/common/ModAPIManager.java @@ -22,6 +22,7 @@ import com.google.common.collect.Sets; public class ModAPIManager { public static final ModAPIManager INSTANCE = new ModAPIManager(); + @SuppressWarnings("unused") private ModAPITransformer transformer; private ASMDataTable dataTable; private Map apiContainers; diff --git a/src/main/java/net/minecraftforge/fml/common/ProgressManager.java b/src/main/java/net/minecraftforge/fml/common/ProgressManager.java index ded580991..c774d1d13 100644 --- a/src/main/java/net/minecraftforge/fml/common/ProgressManager.java +++ b/src/main/java/net/minecraftforge/fml/common/ProgressManager.java @@ -7,25 +7,25 @@ import java.util.concurrent.CopyOnWriteArrayList; import com.google.common.base.Joiner; /** - * @deprecated not a stable API, will break, don't use this yet + * Not a fully fleshed out API, may change in future MC versions. + * However feel free to use and suggest additions. */ -@Deprecated public class ProgressManager { private static final List bars = new CopyOnWriteArrayList(); /** - * @deprecated not a stable API, will break, don't use this yet + * Not a fully fleshed out API, may change in future MC versions. + * However feel free to use and suggest additions. */ - @Deprecated public static ProgressBar push(String title, int steps) { return push(title, steps, false); } /** - * @deprecated not a stable API, will break, don't use this yet + * Not a fully fleshed out API, may change in future MC versions. + * However feel free to use and suggest additions. */ - @Deprecated public static ProgressBar push(String title, int steps, boolean timeEachStep) { ProgressBar bar = new ProgressBar(title, steps); @@ -38,10 +38,11 @@ public class ProgressManager return bar; } + /** - * @deprecated not a stable API, will break, don't use this yet + * Not a fully fleshed out API, may change in future MC versions. + * However feel free to use and suggest additions. */ - @Deprecated public static void pop(ProgressBar bar) { if(bar.getSteps() != bar.getStep()) throw new IllegalStateException("can't pop unfinished ProgressBar " + bar.getTitle()); @@ -67,10 +68,11 @@ public class ProgressManager return bars.iterator(); } + /** - * @deprecated not a stable API, will break, don't use this yet + * Not a fully fleshed out API, may change in future MC versions. + * However feel free to use and suggest additions. */ - @Deprecated public static class ProgressBar { private final String title; diff --git a/src/main/java/net/minecraftforge/fml/common/asm/ASMTransformerWrapper.java b/src/main/java/net/minecraftforge/fml/common/asm/ASMTransformerWrapper.java index dd9d76c79..e86ada6a3 100644 --- a/src/main/java/net/minecraftforge/fml/common/asm/ASMTransformerWrapper.java +++ b/src/main/java/net/minecraftforge/fml/common/asm/ASMTransformerWrapper.java @@ -11,7 +11,6 @@ import java.net.URLConnection; import java.net.URLStreamHandler; import java.security.Permission; import java.util.Map; -import java.util.concurrent.ExecutionException; import net.minecraft.launchwrapper.IClassTransformer; import net.minecraft.launchwrapper.LaunchClassLoader; @@ -178,7 +177,8 @@ public class ASMTransformerWrapper return "$wrapper." + parentClass; } - private static class WrapperVisitor extends ClassVisitor + @SuppressWarnings("unused") + private static class WrapperVisitor extends ClassVisitor { private final String name; private final String parentClass; @@ -248,6 +248,8 @@ public class ASMTransformerWrapper static class TransformerException extends RuntimeException { + private static final long serialVersionUID = -6616232415696157218L; + public TransformerException(String message, Throwable cause) { super(message, cause); diff --git a/src/main/java/net/minecraftforge/fml/common/asm/transformers/BlamingTransformer.java b/src/main/java/net/minecraftforge/fml/common/asm/transformers/BlamingTransformer.java index 772bcaff4..bafe23fdc 100644 --- a/src/main/java/net/minecraftforge/fml/common/asm/transformers/BlamingTransformer.java +++ b/src/main/java/net/minecraftforge/fml/common/asm/transformers/BlamingTransformer.java @@ -1,11 +1,7 @@ package net.minecraftforge.fml.common.asm.transformers; -import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.ListIterator; import java.util.Map; import java.util.Set; import java.util.TreeSet; @@ -17,7 +13,6 @@ import org.apache.commons.lang3.JavaVersion; import org.apache.commons.lang3.SystemUtils; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.ClassWriter; import org.objectweb.asm.Opcodes; import com.google.common.collect.ImmutableSet; @@ -27,7 +22,7 @@ public class BlamingTransformer implements IClassTransformer private static final Map classMap = new HashMap(); private static final Set naughtyMods = new HashSet(); private static final Set naughtyClasses = new TreeSet(); - private static final Set orphanNaughtyClasses = new HashSet(); + private static final Set orphanNaughtyClasses = new HashSet(); @Override public byte[] transform(String name, String transformedName, byte[] bytes) diff --git a/src/main/java/net/minecraftforge/fml/common/asm/transformers/EventSubscriptionTransformer.java b/src/main/java/net/minecraftforge/fml/common/asm/transformers/EventSubscriptionTransformer.java index 46842f005..7013cb630 100644 --- a/src/main/java/net/minecraftforge/fml/common/asm/transformers/EventSubscriptionTransformer.java +++ b/src/main/java/net/minecraftforge/fml/common/asm/transformers/EventSubscriptionTransformer.java @@ -1,14 +1,12 @@ package net.minecraftforge.fml.common.asm.transformers; import static org.objectweb.asm.ClassWriter.COMPUTE_FRAMES; -import static org.objectweb.asm.ClassWriter.COMPUTE_MAXS; import static org.objectweb.asm.Opcodes.ACC_PRIVATE; import static org.objectweb.asm.Opcodes.ACC_PROTECTED; import static org.objectweb.asm.Opcodes.ACC_PUBLIC; import static org.objectweb.asm.Opcodes.ACC_STATIC; import static org.objectweb.asm.Opcodes.ALOAD; import static org.objectweb.asm.Opcodes.ARETURN; -import static org.objectweb.asm.Opcodes.ASM5; import static org.objectweb.asm.Opcodes.DUP; import static org.objectweb.asm.Opcodes.F_SAME; import static org.objectweb.asm.Opcodes.GETSTATIC; diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLInterModComms.java b/src/main/java/net/minecraftforge/fml/common/event/FMLInterModComms.java index 5db7be6bc..5db8c1409 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLInterModComms.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLInterModComms.java @@ -161,6 +161,7 @@ public class FMLInterModComms { * @param The result type * @return The function value or Optional.absent if it wasn't readable or isn't a function call */ + @SuppressWarnings("unchecked") public Optional> getFunctionValue(Class functionFrom, Class functionTo) { if (!isFunction) { return Optional.absent(); diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLPostInitializationEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLPostInitializationEvent.java index 124589691..eb0d64f88 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLPostInitializationEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLPostInitializationEvent.java @@ -19,10 +19,8 @@ import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.LoaderState.ModState; -import com.google.common.base.Throwables; import org.apache.logging.log4j.Level; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.lang.reflect.Constructor; diff --git a/src/main/java/net/minecraftforge/fml/common/network/FMLEmbeddedChannel.java b/src/main/java/net/minecraftforge/fml/common/network/FMLEmbeddedChannel.java index d430a73a6..8016687eb 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/FMLEmbeddedChannel.java +++ b/src/main/java/net/minecraftforge/fml/common/network/FMLEmbeddedChannel.java @@ -44,11 +44,11 @@ public class FMLEmbeddedChannel extends EmbeddedChannel { * @param object The inbound packet * @return A Packet suitable for passing to vanilla network code. */ - public Packet generatePacketFrom(Object object) + public Packet generatePacketFrom(Object object) { OutboundTarget outboundTarget = attr(FMLOutboundHandler.FML_MESSAGETARGET).getAndSet(OutboundTarget.NOWHERE); writeOutbound(object); - Packet pkt = (Packet) outboundMessages().poll(); + Packet pkt = (Packet) outboundMessages().poll(); attr(FMLOutboundHandler.FML_MESSAGETARGET).set(outboundTarget); return pkt; } diff --git a/src/main/java/net/minecraftforge/fml/common/network/FMLIndexedMessageToMessageCodec.java b/src/main/java/net/minecraftforge/fml/common/network/FMLIndexedMessageToMessageCodec.java index a81671f03..613e7c309 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/FMLIndexedMessageToMessageCodec.java +++ b/src/main/java/net/minecraftforge/fml/common/network/FMLIndexedMessageToMessageCodec.java @@ -27,7 +27,7 @@ public abstract class FMLIndexedMessageToMessageCodec extends MessageToMessag * Make this accessible to subclasses */ - public static final AttributeKey>> INBOUNDPACKETTRACKER = new AttributeKey>>("fml:inboundpacket"); + public static final AttributeKey>> INBOUNDPACKETTRACKER = AttributeKey.valueOf("fml:inboundpacket"); @Override public void handlerAdded(ChannelHandlerContext ctx) throws Exception diff --git a/src/main/java/net/minecraftforge/fml/common/network/FMLNetworkEvent.java b/src/main/java/net/minecraftforge/fml/common/network/FMLNetworkEvent.java index 5934290be..a6e9129ec 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/FMLNetworkEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/network/FMLNetworkEvent.java @@ -23,10 +23,14 @@ public class FMLNetworkEvent extends Event { this.type = type; this.manager = manager; } + + public Class getHandlerType() + { + return type; + } + /** * Fired at the client when a client connects to a server - * @author cpw - * */ public static class ClientConnectedToServerEvent extends FMLNetworkEvent { public final boolean isLocal; diff --git a/src/main/java/net/minecraftforge/fml/common/network/FMLOutboundHandler.java b/src/main/java/net/minecraftforge/fml/common/network/FMLOutboundHandler.java index e29a7a32c..6d3ad27f0 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/FMLOutboundHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/network/FMLOutboundHandler.java @@ -21,8 +21,8 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter { - public static final AttributeKey FML_MESSAGETARGET = new AttributeKey("fml:outboundTarget"); - public static final AttributeKey FML_MESSAGETARGETARGS = new AttributeKey("fml:outboundTargetArgs"); + public static final AttributeKey FML_MESSAGETARGET = AttributeKey.valueOf("fml:outboundTarget"); + public static final AttributeKey FML_MESSAGETARGETARGS = AttributeKey.valueOf("fml:outboundTargetArgs"); public enum OutboundTarget { /** * The packet is sent nowhere. It will be on the {@link EmbeddedChannel#outboundMessages()} Queue. @@ -124,7 +124,6 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter { public void validateArgs(Object args) { } - @SuppressWarnings("unchecked") @Override public List selectNetworks(Object args, ChannelHandlerContext context, FMLProxyPacket packet) { @@ -152,7 +151,6 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter { throw new RuntimeException("DIMENSION expects an integer argument"); } } - @SuppressWarnings("unchecked") @Override public List selectNetworks(Object args, ChannelHandlerContext context, FMLProxyPacket packet) { @@ -187,7 +185,6 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter { } } - @SuppressWarnings("unchecked") @Override public List selectNetworks(Object args, ChannelHandlerContext context, FMLProxyPacket packet) { diff --git a/src/main/java/net/minecraftforge/fml/common/network/PacketLoggingHandler.java b/src/main/java/net/minecraftforge/fml/common/network/PacketLoggingHandler.java index 1cea65cb7..f94033add 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/PacketLoggingHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/network/PacketLoggingHandler.java @@ -8,6 +8,7 @@ import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPromise; import io.netty.channel.SimpleChannelInboundHandler; +import java.util.Iterator; import java.util.List; import org.apache.logging.log4j.Level; @@ -22,7 +23,8 @@ import net.minecraftforge.fml.common.FMLLog; public class PacketLoggingHandler { - public static void register(NetworkManager manager) + @SuppressWarnings("rawtypes") + public static void register(NetworkManager manager) { ChannelPipeline pipeline = manager.channel().pipeline(); final EnumPacketDirection direction = manager.getDirection(); @@ -62,11 +64,13 @@ public class PacketLoggingHandler { String prefix = (direction == EnumPacketDirection.SERVERBOUND ? "SERVER: C->S" : "CLIENT: S->C"); @Override - protected void decode(ChannelHandlerContext context, ByteBuf input, List output) throws Exception + protected void decode(ChannelHandlerContext context, ByteBuf input, List output) throws Exception { super.decode(context, input, output); - for (ByteBuf pkt : (List)output) + Iterator itr = output.iterator(); + while (itr.hasNext()) { + ByteBuf pkt = (ByteBuf)itr.next(); pkt.markReaderIndex(); FMLLog.log(Level.DEBUG, "%s:\n%s", prefix, ByteBufUtils.getContentDump(pkt)); pkt.resetReaderIndex(); diff --git a/src/main/java/net/minecraftforge/fml/common/network/handshake/FMLHandshakeClientState.java b/src/main/java/net/minecraftforge/fml/common/network/handshake/FMLHandshakeClientState.java index 15324aa23..633907cd0 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/handshake/FMLHandshakeClientState.java +++ b/src/main/java/net/minecraftforge/fml/common/network/handshake/FMLHandshakeClientState.java @@ -1,6 +1,5 @@ package net.minecraftforge.fml.common.network.handshake; -import java.util.HashSet; import java.util.List; import net.minecraftforge.fml.common.FMLLog; diff --git a/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java b/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java index 58c16db5b..e775f2dcf 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java +++ b/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java @@ -28,6 +28,7 @@ import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; import net.minecraft.network.play.client.C17PacketCustomPayload; import net.minecraft.network.play.server.S01PacketJoinGame; import net.minecraft.network.play.server.S3FPacketCustomPayload; @@ -35,6 +36,7 @@ import net.minecraft.network.play.server.S40PacketDisconnect; import net.minecraft.server.management.ServerConfigurationManager; import net.minecraft.util.ChatComponentText; import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.network.FMLNetworkEvent; @@ -48,6 +50,7 @@ import net.minecraftforge.fml.common.network.internal.FMLProxyPacket; import net.minecraftforge.fml.common.registry.GameData; import net.minecraftforge.fml.relauncher.Side; +@SuppressWarnings("rawtypes") public class NetworkDispatcher extends SimpleChannelInboundHandler implements ChannelOutboundHandler { private static boolean DEBUG_HANDSHAKE = Boolean.parseBoolean(System.getProperty("fml.debugNetworkHandshake", "false")); private static enum ConnectionState { @@ -222,7 +225,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple this.connectionType = type; FMLLog.info("[%s] Client side %s connection established", Thread.currentThread().getName(), this.connectionType.name().toLowerCase(Locale.ENGLISH)); this.state = ConnectionState.CONNECTED; - FMLCommonHandler.instance().bus().post(new FMLNetworkEvent.ClientConnectedToServerEvent(manager, this.connectionType.name())); + MinecraftForge.EVENT_BUS.post(new FMLNetworkEvent.ClientConnectedToServerEvent(manager, this.connectionType.name())); } private synchronized void completeServerSideConnection(ConnectionType type) @@ -230,11 +233,12 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple this.connectionType = type; FMLLog.info("[%s] Server side %s connection established", Thread.currentThread().getName(), this.connectionType.name().toLowerCase(Locale.ENGLISH)); this.state = ConnectionState.CONNECTED; - FMLCommonHandler.instance().bus().post(new FMLNetworkEvent.ServerConnectionFromClientEvent(manager)); + MinecraftForge.EVENT_BUS.post(new FMLNetworkEvent.ServerConnectionFromClientEvent(manager)); if (DEBUG_HANDSHAKE) manager.closeChannel(new ChatComponentText("Handshake Complete review log file for details.")); scm.initializeConnectionToPlayer(manager, player, serverHandler); } + @Override protected void channelRead0(ChannelHandlerContext ctx, Packet msg) throws Exception { @@ -257,7 +261,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple } } - private boolean handleVanilla(Packet msg) + private boolean handleVanilla(Packet msg) { if (state == ConnectionState.AWAITING_HANDSHAKE && msg instanceof S01PacketJoinGame) { @@ -299,7 +303,8 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple { kickWithMessage("This is modded. No modded response received. Bye!"); } - private void kickWithMessage(String message) + @SuppressWarnings("unchecked") + private void kickWithMessage(String message) { final ChatComponentText chatcomponenttext = new ChatComponentText(message); if (side == Side.CLIENT) @@ -450,11 +455,11 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple { if (side == Side.CLIENT) { - FMLCommonHandler.instance().bus().post(new FMLNetworkEvent.ClientDisconnectionFromServerEvent(manager)); + MinecraftForge.EVENT_BUS.post(new FMLNetworkEvent.ClientDisconnectionFromServerEvent(manager)); } else { - FMLCommonHandler.instance().bus().post(new FMLNetworkEvent.ServerDisconnectionFromClientEvent(manager)); + MinecraftForge.EVENT_BUS.post(new FMLNetworkEvent.ServerDisconnectionFromClientEvent(manager)); } cleanAttributes(ctx); ctx.disconnect(promise); @@ -465,11 +470,11 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple { if (side == Side.CLIENT) { - FMLCommonHandler.instance().bus().post(new FMLNetworkEvent.ClientDisconnectionFromServerEvent(manager)); + MinecraftForge.EVENT_BUS.post(new FMLNetworkEvent.ClientDisconnectionFromServerEvent(manager)); } else { - FMLCommonHandler.instance().bus().post(new FMLNetworkEvent.ServerDisconnectionFromClientEvent(manager)); + MinecraftForge.EVENT_BUS.post(new FMLNetworkEvent.ServerDisconnectionFromClientEvent(manager)); } cleanAttributes(ctx); ctx.close(promise); @@ -500,8 +505,8 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple } else { - List parts = ((FMLProxyPacket)msg).toS3FPackets(); - for (Packet pkt : parts) + List> parts = ((FMLProxyPacket)msg).toS3FPackets(); + for (Packet pkt : parts) { ctx.write(pkt, promise); } diff --git a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLNetworkHandler.java b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLNetworkHandler.java index 285128114..6afdf342b 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLNetworkHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLNetworkHandler.java @@ -117,7 +117,7 @@ public class FMLNetworkHandler embeddedChannel.writeOutbound(new FMLMessage.EntityAdjustMessage(entity, serverX, serverY, serverZ)); } - public static Packet getEntitySpawningPacket(Entity entity) + public static Packet getEntitySpawningPacket(Entity entity) { EntityRegistration er = EntityRegistry.instance().lookupModSpawn(entity.getClass(), false); if (er == null) diff --git a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLProxyPacket.java b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLProxyPacket.java index acd222ee6..fa215c3ad 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/internal/FMLProxyPacket.java +++ b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLProxyPacket.java @@ -11,6 +11,8 @@ import net.minecraft.network.INetHandler; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.network.play.INetHandlerPlayServer; import net.minecraft.network.play.client.C17PacketCustomPayload; import net.minecraft.network.play.server.S3FPacketCustomPayload; import net.minecraftforge.fml.common.FMLLog; @@ -28,7 +30,7 @@ import com.google.common.collect.Multiset; import com.google.common.collect.Multiset.Entry; import com.google.common.collect.Multisets; -public class FMLProxyPacket implements Packet { +public class FMLProxyPacket implements Packet { final String channel; private Side target; private final PacketBuffer payload; @@ -117,16 +119,16 @@ public class FMLProxyPacket implements Packet { { return netHandler; } - public Packet toC17Packet() + public Packet toC17Packet() { return new C17PacketCustomPayload(channel, payload); } static final int PART_SIZE = 0x1000000 - 0x50; // Make it a constant so that it gets inlined below. public static final int MAX_LENGTH = PART_SIZE * 255; - public List toS3FPackets() throws IOException + public List> toS3FPackets() throws IOException { - List ret = Lists.newArrayList(); + List> ret = Lists.newArrayList(); byte[] data = payload.array(); if (data.length < PART_SIZE) diff --git a/src/main/java/net/minecraftforge/fml/common/network/simpleimpl/SimpleNetworkWrapper.java b/src/main/java/net/minecraftforge/fml/common/network/simpleimpl/SimpleNetworkWrapper.java index fdce956d6..d67c148fa 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/simpleimpl/SimpleNetworkWrapper.java +++ b/src/main/java/net/minecraftforge/fml/common/network/simpleimpl/SimpleNetworkWrapper.java @@ -165,7 +165,7 @@ public class SimpleNetworkWrapper { * @param message The message to translate into packet form * @return A minecraft {@link Packet} suitable for use in minecraft APIs */ - public Packet getPacketFrom(IMessage message) + public Packet getPacketFrom(IMessage message) { return channels.get(Side.SERVER).generatePacketFrom(message); } diff --git a/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java index 79de3d030..939ef706f 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java @@ -172,7 +172,6 @@ public class EntityRegistry EntityRegistry.registerEgg(entityClass, eggPrimary, eggSecondary); } - @SuppressWarnings("unchecked") private void doModEntityRegistration(Class entityClass, String entityName, int id, Object mod, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates) { ModContainer mc = FMLCommonHandler.instance().findContainerFor(mod); @@ -367,6 +366,7 @@ public class EntityRegistry * @param typeOfCreature type of spawn * @param biomes List of biomes */ + @SuppressWarnings("unchecked") public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, BiomeGenBase... biomes) { Class entityClazz = EntityList.stringToClassMapping.get(entityName); @@ -406,6 +406,7 @@ public class EntityRegistry * @param typeOfCreature type of spawn * @param biomes Biomes to remove from */ + @SuppressWarnings("unchecked") public static void removeSpawn(String entityName, EnumCreatureType typeOfCreature, BiomeGenBase... biomes) { Class entityClazz = EntityList.stringToClassMapping.get(entityName); diff --git a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java index da5139d4d..6f27abd77 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java @@ -17,7 +17,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemBanner; import net.minecraft.item.ItemBlock; import net.minecraft.util.ObjectIntIdentityMap; -import net.minecraft.util.RegistryNamespaced; import net.minecraft.util.RegistryNamespacedDefaultedByKey; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.FMLLog; @@ -26,9 +25,9 @@ import net.minecraftforge.fml.common.registry.RegistryDelegate.Delegate; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; -import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterators; +@SuppressWarnings({"rawtypes", "unchecked"}) // cpw is working on these classes just shut them up for now. public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaultedByKey { public static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("fml.debugRegistryEntries", "false")); private final Class superType; @@ -103,7 +102,6 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul } - @SuppressWarnings("unchecked") void setFrom(FMLControlledNamespacedRegistry registry) { set((FMLControlledNamespacedRegistry) registry); } @@ -259,7 +257,6 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul * @param obj * @return */ - @SuppressWarnings("unchecked") private I cast(Object obj) { return (I)(obj); @@ -579,7 +576,6 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul * This iterator is used by some regular MC methods to visit all blocks, we need to include substitutions * Compare #typeSafeIterable() */ - @SuppressWarnings("unchecked") @Override public Iterator iterator() { diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java index 052604316..0f0f441fc 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java @@ -12,9 +12,7 @@ package net.minecraftforge.fml.common.registry; -import java.io.File; import java.io.IOException; -import java.util.ArrayList; import java.util.BitSet; import java.util.HashMap; import java.util.HashSet; @@ -30,7 +28,6 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; import net.minecraft.item.ItemBanner; import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; import net.minecraft.util.ObjectIntIdentityMap; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -44,27 +41,18 @@ import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent.MissingMappin import net.minecraftforge.fml.common.registry.GameRegistry.Type; import net.minecraftforge.fml.common.registry.GameRegistry.UniqueIdentifier; -import org.apache.logging.log4j.Level; - -import com.google.common.base.Charsets; -import com.google.common.base.Joiner; -import com.google.common.base.Joiner.MapJoiner; import com.google.common.collect.BiMap; -import com.google.common.collect.HashBasedTable; import com.google.common.collect.HashBiMap; import com.google.common.collect.ImmutableBiMap; import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; -import com.google.common.collect.Iterators; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.google.common.collect.Sets.SetView; -import com.google.common.collect.Table; -import com.google.common.io.Files; +@SuppressWarnings({"rawtypes", "deprecation", "unchecked", "static-access", "unused"}) // cpw is cleaning these classes up so just suppress everything for now. public class GameData { static final int MIN_BLOCK_ID = 0; static final int MAX_BLOCK_ID = 4095; @@ -965,7 +953,6 @@ public class GameData { private BiMap itemSubstitutions = HashBiMap.create(); private BiMap blockSubstitutions = HashBiMap.create(); - @SuppressWarnings("unchecked") BiMap getPersistentSubstitutionMap(Class type) { if (type.equals(Item.class)) @@ -1024,13 +1011,11 @@ public class GameData { findSuperTypes(type.getSuperclass(),types); } - @SuppressWarnings("unchecked") private FMLControlledNamespacedRegistry getGenericRegistry(String registryName, Class type) { FMLControlledNamespacedRegistry fmlControlledNamespacedRegistry = genericRegistries.get(registryName); return (FMLControlledNamespacedRegistry) fmlControlledNamespacedRegistry; } - @SuppressWarnings("unchecked") private FMLControlledNamespacedRegistry createGenericRegistry(String registryName, Class type, int minId, int maxId) { Set> parents = Sets.newHashSet(); findSuperTypes(type, parents); diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java index 82090ed0e..6f2ff27e1 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java @@ -194,6 +194,7 @@ public class GameRegistry * @param name The mod-unique name to register it as, will get prefixed by your modid. * @param itemCtorArgs Arguments to pass (after the required {@code Block} parameter) to the ItemBlock constructor (optional). */ + @SuppressWarnings("unchecked") public static Block registerBlock(Block block, Class itemclass, String name, Object... itemCtorArgs) { if (Loader.instance().isInState(LoaderState.CONSTRUCTING)) diff --git a/src/main/java/net/minecraftforge/fml/common/registry/ObjectHolderRef.java b/src/main/java/net/minecraftforge/fml/common/registry/ObjectHolderRef.java index 08a93821f..2eb7743f9 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/ObjectHolderRef.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/ObjectHolderRef.java @@ -49,6 +49,7 @@ class ObjectHolderRef { } else { + @SuppressWarnings("unchecked") Object tmp = isBlock ? GameData.getBlockRegistry().getNameForObject(existing) : isItem ? GameData.getItemRegistry().getNameForObject(existing) : null; this.injectedObject = tmp != null ? tmp.toString() : null; diff --git a/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java index 8ef615362..6da52df3e 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java @@ -12,19 +12,13 @@ package net.minecraftforge.fml.common.registry; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Random; -import java.util.Set; - import org.apache.commons.lang3.Validate; -import net.minecraft.block.Block; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.passive.EntityVillager.*; import net.minecraft.init.Blocks; @@ -33,11 +27,7 @@ import net.minecraft.item.EnumDyeColor; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; -import net.minecraft.util.ObjectIntIdentityMap; -import net.minecraft.util.RegistryNamespacedDefaultedByKey; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Tuple; -import net.minecraft.village.MerchantRecipeList; import net.minecraft.world.gen.structure.StructureComponent; import net.minecraft.world.gen.structure.StructureVillagePieces; import net.minecraft.world.gen.structure.StructureVillagePieces.PieceWeight; @@ -46,10 +36,8 @@ import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import com.google.common.collect.Multimap; /** * Registry for villager trading control @@ -203,6 +191,7 @@ public class VillagerRegistry { register(prof, -1); } + @SuppressWarnings("deprecation") private void register(VillagerProfession prof, int id) { professions.register(id, prof.name, prof); @@ -253,14 +242,14 @@ public class VillagerRegistry public static class VillagerProfession { private ResourceLocation name; - private ResourceLocation texture; + //private ResourceLocation texture; private List careers = Lists.newArrayList(); private RegistryDelegate delegate = GameData.getRegistry("villagerprofessions", VillagerProfession.class).getDelegate(this, VillagerProfession.class); public VillagerProfession(String name, String texture) { this.name = new ResourceLocation(name); - this.texture = new ResourceLocation(texture); + //this.texture = new ResourceLocation(texture); ((RegistryDelegate.Delegate)delegate).setName(name); } @@ -268,7 +257,7 @@ public class VillagerRegistry { Validate.isTrue(!careers.contains(career), "Attempted to register career that is already registered."); Validate.isTrue(career.profession == this, "Attempted to register career for the wrong profession."); - career.id = careers.size(); + //career.id = careers.size(); careers.add(career); } } @@ -277,7 +266,7 @@ public class VillagerRegistry { private VillagerProfession profession; private String name; - private int id; + //private int id; public VillagerCareer(VillagerProfession parent, String name) { this.profession = parent; @@ -308,8 +297,8 @@ public class VillagerRegistry */ public static void setRandomProfession(EntityVillager entity, Random rand) { - Set entries = INSTANCE.professions.getKeys(); - int prof = rand.nextInt(entries.size()); + //int count = INSTANCE.professions.getKeys().size(); + //int prof = rand.nextInt(count); //TODO: Grab id range from internal registry entity.setProfession(rand.nextInt(5)); } diff --git a/src/main/java/net/minecraftforge/fml/relauncher/ReflectionHelper.java b/src/main/java/net/minecraftforge/fml/relauncher/ReflectionHelper.java index ff72524ec..06cad6811 100644 --- a/src/main/java/net/minecraftforge/fml/relauncher/ReflectionHelper.java +++ b/src/main/java/net/minecraftforge/fml/relauncher/ReflectionHelper.java @@ -25,12 +25,12 @@ public class ReflectionHelper public static class UnableToFindMethodException extends RuntimeException { private static final long serialVersionUID = 1L; - private String[] methodNames; + //private String[] methodNames; public UnableToFindMethodException(String[] methodNames, Exception failed) { super(failed); - this.methodNames = methodNames; + //this.methodNames = methodNames; } } @@ -38,12 +38,12 @@ public class ReflectionHelper public static class UnableToFindClassException extends RuntimeException { private static final long serialVersionUID = 1L; - private String[] classNames; + //private String[] classNames; public UnableToFindClassException(String[] classNames, Exception err) { super(err); - this.classNames = classNames; + //this.classNames = classNames; } } @@ -51,23 +51,23 @@ public class ReflectionHelper public static class UnableToAccessFieldException extends RuntimeException { private static final long serialVersionUID = 1L; - private String[] fieldNameList; + //private String[] fieldNameList; public UnableToAccessFieldException(String[] fieldNames, Exception e) { super(e); - this.fieldNameList = fieldNames; + //this.fieldNameList = fieldNames; } } public static class UnableToFindFieldException extends RuntimeException { private static final long serialVersionUID = 1L; - private String[] fieldNameList; + //private String[] fieldNameList; public UnableToFindFieldException(String[] fieldNameList, Exception e) { super(e); - this.fieldNameList = fieldNameList; + //this.fieldNameList = fieldNameList; } } diff --git a/src/main/java/net/minecraftforge/oredict/OreDictionary.java b/src/main/java/net/minecraftforge/oredict/OreDictionary.java index 3a7de810f..6c40af205 100644 --- a/src/main/java/net/minecraftforge/oredict/OreDictionary.java +++ b/src/main/java/net/minecraftforge/oredict/OreDictionary.java @@ -1,16 +1,11 @@ package net.minecraftforge.oredict; import java.util.ArrayList; -import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; import java.util.List; -import java.util.ListIterator; import java.util.Map; -import java.util.RandomAccess; -import java.util.Map.Entry; import java.util.Set; import org.apache.logging.log4j.Level; @@ -55,7 +50,6 @@ public class OreDictionary initVanillaEntries(); } - @SuppressWarnings("unchecked") public static void initVanillaEntries() { if (!hasInit) @@ -406,7 +400,7 @@ public class OreDictionary return false; } - private static boolean containsMatch(boolean strict, List inputs, ItemStack... targets) + public static boolean containsMatch(boolean strict, List inputs, ItemStack... targets) { for (ItemStack input : inputs) { diff --git a/src/main/java/net/minecraftforge/oredict/RecipeSorter.java b/src/main/java/net/minecraftforge/oredict/RecipeSorter.java index bc7f152dd..4ef622f88 100644 --- a/src/main/java/net/minecraftforge/oredict/RecipeSorter.java +++ b/src/main/java/net/minecraftforge/oredict/RecipeSorter.java @@ -143,7 +143,6 @@ public class RecipeSorter implements Comparator } private static Set warned = Sets.newHashSet(); - @SuppressWarnings("unchecked") public static void sortCraftManager() { bake(); diff --git a/src/main/java/net/minecraftforge/oredict/ShapelessOreRecipe.java b/src/main/java/net/minecraftforge/oredict/ShapelessOreRecipe.java index 69c8151a0..cb235c3c2 100644 --- a/src/main/java/net/minecraftforge/oredict/ShapelessOreRecipe.java +++ b/src/main/java/net/minecraftforge/oredict/ShapelessOreRecipe.java @@ -56,7 +56,6 @@ public class ShapelessOreRecipe implements IRecipe } } - @SuppressWarnings("unchecked") ShapelessOreRecipe(ShapelessRecipes recipe, Map replacements) { output = recipe.getRecipeOutput(); diff --git a/src/main/java/net/minecraftforge/server/ForgeTimeTracker.java b/src/main/java/net/minecraftforge/server/ForgeTimeTracker.java index e6357b0a7..7265ee268 100644 --- a/src/main/java/net/minecraftforge/server/ForgeTimeTracker.java +++ b/src/main/java/net/minecraftforge/server/ForgeTimeTracker.java @@ -18,12 +18,14 @@ public class ForgeTimeTracker { public static long tileEntityTrackingTime; private Map tileEntityTimings; - private Map entityTimings; + private WeakReference tile; private static final ForgeTimeTracker INSTANCE = new ForgeTimeTracker(); - private WeakReference tile; + /* not implemented private WeakReference entity; + private Map entityTimings; + */ private long timing; @@ -32,7 +34,7 @@ public class ForgeTimeTracker { MapMaker mm = new MapMaker(); mm.weakKeys(); tileEntityTimings = mm.makeMap(); - entityTimings = mm.makeMap(); + //entityTimings = mm.makeMap(); } diff --git a/src/main/java/net/minecraftforge/server/command/ForgeCommand.java b/src/main/java/net/minecraftforge/server/command/ForgeCommand.java index a940bd8c4..93cadbb84 100644 --- a/src/main/java/net/minecraftforge/server/command/ForgeCommand.java +++ b/src/main/java/net/minecraftforge/server/command/ForgeCommand.java @@ -21,7 +21,7 @@ public class ForgeCommand extends CommandBase { public ForgeCommand(MinecraftServer server) { - this.server = new WeakReference(server); + this.server = new WeakReference(server); } @Override @@ -71,7 +71,7 @@ public class ForgeCommand extends CommandBase { } @Override - public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { diff --git a/src/main/java/paulscode/sound/codecs/CodecIBXM.java b/src/main/java/paulscode/sound/codecs/CodecIBXM.java index fb5c165de..f3e9e4bf5 100644 --- a/src/main/java/paulscode/sound/codecs/CodecIBXM.java +++ b/src/main/java/paulscode/sound/codecs/CodecIBXM.java @@ -501,6 +501,7 @@ public class CodecIBXM implements ICodec * @param maxLength Maximum size this array may be. * @return New array. */ + @SuppressWarnings("unused") //Forge private static byte[] trimArray( byte[] array, int maxLength ) { byte[] trimmedArray = null; @@ -545,6 +546,7 @@ public class CodecIBXM implements ICodec * @param two_bytes_data For stereo sounds. * @return byte array containing the converted data. */ + @SuppressWarnings("unused") //Forge private static byte[] convertAudioBytes( byte[] audio_bytes, boolean two_bytes_data ) { diff --git a/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java b/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java index 1ad65041e..603e3f62e 100644 --- a/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java +++ b/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java @@ -9,13 +9,11 @@ import com.google.common.collect.Maps; import net.minecraft.block.Block; import net.minecraft.block.BlockWall; import net.minecraft.block.material.Material; -import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.statemap.IStateMapper; import net.minecraft.client.renderer.block.statemap.StateMap; -import net.minecraft.client.renderer.block.statemap.StateMapperBase; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.init.Blocks; @@ -49,11 +47,12 @@ public class ForgeBlockStatesLoaderDebug { } }); + @SuppressWarnings("unchecked") @EventHandler public void preInit(FMLPreInitializationEvent event) { - blockCustom.setUnlocalizedName(MODID + ".customBlock"); - GameRegistry.registerBlock(blockCustom, "customBlock"); + blockCustom.setUnlocalizedName(MODID + ".customBlock"); + GameRegistry.registerBlock(blockCustom, "customBlock"); blockCustomWall.setUnlocalizedName(MODID + ".customWall"); GameRegistry.registerBlock(blockCustomWall, null, nameCustomWall); @@ -67,13 +66,13 @@ public class ForgeBlockStatesLoaderDebug { @SideOnly(Side.CLIENT) public void preInitClient(FMLPreInitializationEvent event) { - ModelLoader.setCustomStateMapper(blockCustom, new StateMap.Builder().withName(CustomMappedBlock.VARIANT).build()); + ModelLoader.setCustomStateMapper(blockCustom, new StateMap.Builder().withName(CustomMappedBlock.VARIANT).build()); ModelLoader.setCustomStateMapper(blockCustomWall, new IStateMapper() { StateMap stateMap = new StateMap.Builder().withName(BlockWall.VARIANT).withSuffix("_wall").build(); @Override - public Map putStateModelLocations(Block block) + public Map putStateModelLocations(Block block) { Map map = (Map) stateMap.putStateModelLocations(block); Map newMap = Maps.newHashMap(); @@ -94,40 +93,41 @@ public class ForgeBlockStatesLoaderDebug { } // this block is never actually used, it's only needed for the error message on load to see the variant it maps to - public static class CustomMappedBlock extends Block { - public static final PropertyEnum VARIANT = PropertyEnum.create("type", CustomVariant.class); + public static class CustomMappedBlock extends Block + { + public static final PropertyEnum VARIANT = PropertyEnum.create("type", CustomVariant.class); - protected CustomMappedBlock() { - super(Material.rock); - - this.setUnlocalizedName(MODID + ".customMappedBlock"); - } - - @Override - protected BlockState createBlockState() { - return new BlockState(this, VARIANT); - } - - @Override - public int getMetaFromState(IBlockState state) - { - return ((CustomVariant)state.getValue(VARIANT)).ordinal(); - } - - @Override - public IBlockState getStateFromMeta(int meta) - { - if(meta > CustomVariant.values().length || meta < 0) - meta = 0; - - return this.getDefaultState().withProperty(VARIANT, CustomVariant.values()[meta]); - } - - public static enum CustomVariant implements IStringSerializable { - TypeA, - TypeB; - - public String getName() { return this.toString(); }; - } + protected CustomMappedBlock() { + super(Material.rock); + + this.setUnlocalizedName(MODID + ".customMappedBlock"); + } + + @Override + protected BlockState createBlockState() { + return new BlockState(this, VARIANT); + } + + @Override + public int getMetaFromState(IBlockState state) + { + return ((CustomVariant)state.getValue(VARIANT)).ordinal(); + } + + @Override + public IBlockState getStateFromMeta(int meta) + { + if(meta > CustomVariant.values().length || meta < 0) + meta = 0; + + return this.getDefaultState().withProperty(VARIANT, CustomVariant.values()[meta]); + } + + public static enum CustomVariant implements IStringSerializable { + TypeA, + TypeB; + + public String getName() { return this.toString(); }; + } } } diff --git a/src/test/java/net/minecraftforge/debug/ItemTileDebug.java b/src/test/java/net/minecraftforge/debug/ItemTileDebug.java index cfee7269d..0f1dec7ce 100644 --- a/src/test/java/net/minecraftforge/debug/ItemTileDebug.java +++ b/src/test/java/net/minecraftforge/debug/ItemTileDebug.java @@ -54,6 +54,7 @@ public class ItemTileDebug { private static ModelResourceLocation itemLocation = new ModelResourceLocation(blockName, "inventory"); + @SuppressWarnings("deprecation") @Override public void preInit(FMLPreInitializationEvent event) { @@ -83,14 +84,14 @@ public class ItemTileDebug } } - public static class TestTESR extends TileEntitySpecialRenderer + public static class TestTESR extends TileEntitySpecialRenderer { private static final TestTESR instance = new TestTESR(); private TestTESR() {} @Override - public void renderTileEntityAt(TileEntity p_180535_1_, double x, double y, double z, float p_180535_8_, int p_180535_9_) + public void renderTileEntityAt(CustomTileEntity p_180535_1_, double x, double y, double z, float p_180535_8_, int p_180535_9_) { glPushMatrix(); glTranslated(x, y, z); diff --git a/src/test/java/net/minecraftforge/debug/LayerBreakingTest.java b/src/test/java/net/minecraftforge/debug/LayerBreakingTest.java index aaf389609..573e1b012 100644 --- a/src/test/java/net/minecraftforge/debug/LayerBreakingTest.java +++ b/src/test/java/net/minecraftforge/debug/LayerBreakingTest.java @@ -147,6 +147,7 @@ public class LayerBreakingTest IFlexibleBakedModel solid; IFlexibleBakedModel translucent; + @SuppressWarnings("unused") private class DefState implements IModelState { @Override @@ -157,13 +158,13 @@ public class LayerBreakingTest }; @Override - public List getFaceQuads(EnumFacing p_177551_1_) + public List getFaceQuads(EnumFacing p_177551_1_) { return Collections.emptyList(); } @Override - public List getGeneralQuads() + public List getGeneralQuads() { return Collections.emptyList(); } diff --git a/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java b/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java index ac9daa20d..9d42a7f72 100644 --- a/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelBakeEventDebug.java @@ -45,6 +45,7 @@ import net.minecraftforge.fml.common.registry.GameRegistry; import com.google.common.primitives.Ints; +@SuppressWarnings("deprecation") @Mod(modid = ModelBakeEventDebug.MODID, version = ModelBakeEventDebug.VERSION) public class ModelBakeEventDebug { @@ -54,6 +55,7 @@ public class ModelBakeEventDebug private static String blockName = MODID.toLowerCase() + ":" + CustomModelBlock.name; + @SuppressWarnings("unchecked") public static final IUnlistedProperty[] properties = new IUnlistedProperty[6]; static @@ -207,7 +209,7 @@ public class ModelBakeEventDebug public static class CustomModel implements IBakedModel, ISmartBlockModel, ISmartItemModel { private final TextureAtlasSprite base, overlay; - private boolean hasStateSet = false; + //private boolean hasStateSet = false; private final IExtendedBlockState state; public CustomModel(TextureAtlasSprite base, TextureAtlasSprite overlay) diff --git a/src/test/java/net/minecraftforge/test/EnumHelperTest.java b/src/test/java/net/minecraftforge/test/EnumHelperTest.java index 992b8fdcb..174a46561 100644 --- a/src/test/java/net/minecraftforge/test/EnumHelperTest.java +++ b/src/test/java/net/minecraftforge/test/EnumHelperTest.java @@ -1,9 +1,6 @@ package net.minecraftforge.test; import java.lang.reflect.Constructor; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; import net.minecraftforge.client.EnumHelperClient; import net.minecraftforge.common.BiomeDictionary; @@ -38,7 +35,7 @@ public class EnumHelperTest } private void testType(Object[] info) { - Class cls = (Class)info[0]; + Class cls = (Class)info[0]; Class[] parameterTypes = new Class[info.length + 2 - 1]; parameterTypes[0] = String.class; parameterTypes[1] = int.class; From 97ef6a5d1fb7f9abd4052ab449b089533a2c7938 Mon Sep 17 00:00:00 2001 From: cpw Date: Sat, 28 Nov 2015 03:01:31 -0500 Subject: [PATCH 074/133] Giant registry fixup --- .../minecraftforge/fluids/FluidRegistry.java | 5 + .../fml/client/FMLClientHandler.java | 4 +- .../fml/common/FMLContainer.java | 110 +- .../net/minecraftforge/fml/common/Loader.java | 28 +- .../common/event/FMLMissingMappingsEvent.java | 7 +- .../common/event/FMLModIdMappingEvent.java | 14 +- .../handshake/FMLHandshakeClientState.java | 12 +- .../handshake/FMLHandshakeMessage.java | 32 +- .../handshake/FMLHandshakeServerState.java | 8 +- .../network/handshake/NetworkDispatcher.java | 3 +- .../ExistingSubstitutionException.java | 4 +- .../FMLControlledNamespacedRegistry.java | 366 +++--- .../fml/common/registry/GameData.java | 1008 +---------------- .../fml/common/registry/GameRegistry.java | 20 +- .../IncompatibleSubstitutionException.java | 4 +- .../fml/common/registry/ObjectHolderRef.java | 12 +- .../common/registry/ObjectHolderRegistry.java | 5 +- .../registry/PersistentRegistryManager.java | 407 +++++++ .../fml/common/registry/RegistryDelegate.java | 27 +- .../fml/common/registry/VillagerRegistry.java | 21 +- .../minecraftforge/oredict/OreDictionary.java | 7 +- 21 files changed, 801 insertions(+), 1303 deletions(-) create mode 100644 src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java diff --git a/src/main/java/net/minecraftforge/fluids/FluidRegistry.java b/src/main/java/net/minecraftforge/fluids/FluidRegistry.java index c58218bc5..6f1bd7eb1 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidRegistry.java +++ b/src/main/java/net/minecraftforge/fluids/FluidRegistry.java @@ -375,6 +375,11 @@ public abstract class FluidRegistry return name; } + @Override + public ResourceLocation getResourceName() { + return new ResourceLocation(name); + } + @Override public Class type() { diff --git a/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java b/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java index d357636dc..993ded08c 100644 --- a/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java +++ b/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java @@ -87,8 +87,8 @@ import net.minecraftforge.fml.common.WrongMinecraftVersionException; import net.minecraftforge.fml.common.eventhandler.EventBus; import net.minecraftforge.fml.common.network.FMLNetworkEvent; import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; -import net.minecraftforge.fml.common.registry.GameData; import net.minecraftforge.fml.common.registry.LanguageRegistry; +import net.minecraftforge.fml.common.registry.PersistentRegistryManager; import net.minecraftforge.fml.common.toposort.ModSortingException; import net.minecraftforge.fml.relauncher.Side; @@ -651,7 +651,7 @@ public class FMLClientHandler implements IFMLSidedHandler // ONLY revert a non-local connection if (client != null && !client.isLocalChannel()) { - GameData.revertToFrozen(); + PersistentRegistryManager.revertToFrozen(); } } diff --git a/src/main/java/net/minecraftforge/fml/common/FMLContainer.java b/src/main/java/net/minecraftforge/fml/common/FMLContainer.java index 85cde3e24..fd995c1f1 100644 --- a/src/main/java/net/minecraftforge/fml/common/FMLContainer.java +++ b/src/main/java/net/minecraftforge/fml/common/FMLContainer.java @@ -24,6 +24,7 @@ import java.util.Set; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.ResourceLocation; import net.minecraft.world.storage.SaveHandler; import net.minecraft.world.storage.WorldInfo; import net.minecraftforge.fml.client.FMLFileResourcePack; @@ -35,6 +36,7 @@ import net.minecraftforge.fml.common.network.NetworkCheckHandler; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; import net.minecraftforge.fml.common.registry.GameData; +import net.minecraftforge.fml.common.registry.PersistentRegistryManager; import net.minecraftforge.fml.common.registry.VillagerRegistry; import net.minecraftforge.fml.relauncher.Side; @@ -109,38 +111,38 @@ public class FMLContainer extends DummyModContainer implements WorldAccessContai NBTTagCompound registries = new NBTTagCompound(); fmlData.setTag("Registries", registries); FMLLog.fine("Gathering id map for writing to world save %s", info.getWorldName()); - GameData.GameDataSnapshot dataSnapshot = GameData.takeSnapshot(); + PersistentRegistryManager.GameDataSnapshot dataSnapshot = PersistentRegistryManager.takeSnapshot(); - for (Map.Entry e : dataSnapshot.entries.entrySet()) + for (Map.Entry e : dataSnapshot.entries.entrySet()) { NBTTagCompound data = new NBTTagCompound(); - registries.setTag(e.getKey(), data); + registries.setTag(e.getKey().toString(), data); NBTTagList ids = new NBTTagList(); - for (Entry item : e.getValue().ids.entrySet()) + for (Entry item : e.getValue().ids.entrySet()) { NBTTagCompound tag = new NBTTagCompound(); - tag.setString("K", item.getKey()); + tag.setString("K", item.getKey().toString()); tag.setInteger("V", item.getValue()); ids.appendTag(tag); } data.setTag("ids", ids); NBTTagList aliases = new NBTTagList(); - for (Entry entry : e.getValue().aliases.entrySet()) + for (Entry entry : e.getValue().aliases.entrySet()) { NBTTagCompound tag = new NBTTagCompound(); - tag.setString("K", entry.getKey()); - tag.setString("V", entry.getValue()); + tag.setString("K", entry.getKey().toString()); + tag.setString("V", entry.getValue().toString()); aliases.appendTag(tag); } data.setTag("aliases", aliases); NBTTagList subs = new NBTTagList(); - for (String entry : e.getValue().substitutions) + for (ResourceLocation entry : e.getValue().substitutions) { NBTTagCompound tag = new NBTTagCompound(); - tag.setString("K", entry); + tag.setString("K", entry.toString()); subs.appendTag(tag); } data.setTag("substitutions", subs); @@ -184,39 +186,21 @@ public class FMLContainer extends DummyModContainer implements WorldAccessContai if (tag.hasKey("ModItemData")) // Pre 1.7 { - GameData.GameDataSnapshot snapshot = new GameData.GameDataSnapshot(); - GameData.GameDataSnapshot.Entry items = new GameData.GameDataSnapshot.Entry(); - snapshot.entries.put("fml:blocks", new GameData.GameDataSnapshot.Entry()); - snapshot.entries.put("fml:items", items); - - FMLLog.info("Attempting to convert old world data to new system. This may be trouble!"); - NBTTagList modList = tag.getTagList("ModItemData", (byte)10); - for (int i = 0; i < modList.tagCount(); i++) - { - NBTTagCompound data = modList.getCompoundTagAt(i); - String forcedModId = data.hasKey("ForcedModId") ? data.getString("ForcedModId") : null; - String forcedName = data.hasKey("ForcedName") ? data.getString("ForcedName") : null; - if (forcedName == null) - { - FMLLog.warning("Found unlabelled item in world save, this may cause problems. The item type %s:%d will not be present", data.getString("ItemType"), data.getInteger("ordinal")); - } - else - { - // all entries are Items, blocks were only saved through their ItemBlock - String itemLabel = String.format("%s:%s", forcedModId != null ? forcedModId : data.getString("ModId"), forcedName); - items.ids.put(itemLabel, data.getInteger("ItemId")); - } - } - failedElements = GameData.injectSnapshot(snapshot, true, true); - + StartupQuery.notify("This save predates 1.7.10, it can no longer be loaded here. Please load in 1.7.10 or 1.8 first"); + StartupQuery.abort(); } else if (tag.hasKey("ItemData")) // 1.7 { - GameData.GameDataSnapshot snapshot = new GameData.GameDataSnapshot(); - GameData.GameDataSnapshot.Entry blocks = new GameData.GameDataSnapshot.Entry(); - GameData.GameDataSnapshot.Entry items = new GameData.GameDataSnapshot.Entry(); - snapshot.entries.put("fml:blocks", blocks); - snapshot.entries.put("fml:items", items); + if (!tag.hasKey("BlockedItemIds")) // no blocked id info -> old 1.7 save + { + StartupQuery.notify("This save predates 1.7.10, it can no longer be loaded here. Please load in 1.7.10 or 1.8 first"); + StartupQuery.abort(); + } + PersistentRegistryManager.GameDataSnapshot snapshot = new PersistentRegistryManager.GameDataSnapshot(); + PersistentRegistryManager.GameDataSnapshot.Entry blocks = new PersistentRegistryManager.GameDataSnapshot.Entry(); + PersistentRegistryManager.GameDataSnapshot.Entry items = new PersistentRegistryManager.GameDataSnapshot.Entry(); + snapshot.entries.put(PersistentRegistryManager.BLOCKS, blocks); + snapshot.entries.put(PersistentRegistryManager.ITEMS, items); NBTTagList list = tag.getTagList("ItemData", 10); for (int i = 0; i < list.tagCount(); i++) @@ -225,24 +209,15 @@ public class FMLContainer extends DummyModContainer implements WorldAccessContai String name = e.getString("K"); if (name.charAt(0) == '\u0001') - blocks.ids.put(name.substring(1), e.getInteger("V")); + blocks.ids.put(new ResourceLocation(name.substring(1)), e.getInteger("V")); else if (name.charAt(0) == '\u0002') - items.ids.put(name.substring(1), e.getInteger("V")); + items.ids.put(new ResourceLocation(name.substring(1)), e.getInteger("V")); } Set blockedIds = new HashSet(); - if (!tag.hasKey("BlockedItemIds")) // no blocked id info -> old 1.7 save + for (int id : tag.getIntArray("BlockedItemIds")) { - // old early 1.7 save potentially affected by the registry mapping bug - // fix the ids the best we can... - GameData.fixBrokenIds(blocks, items, blockedIds); - } - else - { - for (int id : tag.getIntArray("BlockedItemIds")) - { - blockedIds.add(id); - } + blockedIds.add(id); } blocks.blocked.addAll(blockedIds); items.blocked.addAll(blockedIds); @@ -251,7 +226,7 @@ public class FMLContainer extends DummyModContainer implements WorldAccessContai for (int i = 0; i < list.tagCount(); i++) { NBTTagCompound dataTag = list.getCompoundTagAt(i); - blocks.aliases.put(dataTag.getString("K"), dataTag.getString("V")); + blocks.aliases.put(new ResourceLocation(dataTag.getString("K")), new ResourceLocation(dataTag.getString("V"))); } if (tag.hasKey("BlockSubstitutions", 9)) @@ -260,7 +235,7 @@ public class FMLContainer extends DummyModContainer implements WorldAccessContai for (int i = 0; i < list.tagCount(); i++) { NBTTagCompound dataTag = list.getCompoundTagAt(i); - blocks.substitutions.add(dataTag.getString("K")); + blocks.substitutions.add(new ResourceLocation(dataTag.getString("K"))); } } @@ -268,7 +243,7 @@ public class FMLContainer extends DummyModContainer implements WorldAccessContai for (int i = 0; i < list.tagCount(); i++) { NBTTagCompound dataTag = list.getCompoundTagAt(i); - items.aliases.put(dataTag.getString("K"), dataTag.getString("V")); + items.aliases.put(new ResourceLocation(dataTag.getString("K")), new ResourceLocation(dataTag.getString("V"))); } if (tag.hasKey("ItemSubstitutions", 9)) @@ -277,39 +252,42 @@ public class FMLContainer extends DummyModContainer implements WorldAccessContai for (int i = 0; i < list.tagCount(); i++) { NBTTagCompound dataTag = list.getCompoundTagAt(i); - items.substitutions.add(dataTag.getString("K")); + items.substitutions.add(new ResourceLocation(dataTag.getString("K"))); } } - failedElements = GameData.injectSnapshot(snapshot, true, true); + failedElements = PersistentRegistryManager.injectSnapshot(snapshot, true, true); } else if (tag.hasKey("Registries")) // 1.8, genericed out the 'registries' list { - GameData.GameDataSnapshot snapshot = new GameData.GameDataSnapshot(); + PersistentRegistryManager.GameDataSnapshot snapshot = new PersistentRegistryManager.GameDataSnapshot(); NBTTagCompound regs = tag.getCompoundTag("Registries"); - for (String key : (Set)regs.getKeySet()) + for (String key : regs.getKeySet()) { - GameData.GameDataSnapshot.Entry entry = new GameData.GameDataSnapshot.Entry(); - snapshot.entries.put(key, entry); + PersistentRegistryManager.GameDataSnapshot.Entry entry = new PersistentRegistryManager.GameDataSnapshot.Entry(); + if ("fml:blocks".equals(key)) key = "minecraft:blocks"; + if ("fml:items".equals(key)) key = "minecraft:items"; + if ("fmlgr:villagerprofessions".equals(key)) key = "minecraft:villagerprofessions"; + snapshot.entries.put(new ResourceLocation(key), entry); NBTTagList list = regs.getCompoundTag(key).getTagList("ids", 10); for (int x = 0; x < list.tagCount(); x++) { NBTTagCompound e = list.getCompoundTagAt(x); - entry.ids.put(e.getString("K"), e.getInteger("V")); + entry.ids.put(new ResourceLocation(e.getString("K")), e.getInteger("V")); } list = regs.getCompoundTag(key).getTagList("aliases", 10); for (int x = 0; x < list.tagCount(); x++) { NBTTagCompound e = list.getCompoundTagAt(x); - entry.aliases.put(e.getString("K"), e.getString("V")); + entry.aliases.put(new ResourceLocation(e.getString("K")), new ResourceLocation(e.getString("V"))); } list = regs.getCompoundTag(key).getTagList("substitutions", 10); for (int x = 0; x < list.tagCount(); x++) { NBTTagCompound e = list.getCompoundTagAt(x); - entry.substitutions.add(e.getString("K")); + entry.substitutions.add(new ResourceLocation(e.getString("K"))); } int[] blocked = regs.getCompoundTag(key).getIntArray("blocked"); @@ -318,7 +296,7 @@ public class FMLContainer extends DummyModContainer implements WorldAccessContai entry.blocked.add(i); } } - failedElements = GameData.injectSnapshot(snapshot, true, true); + failedElements = PersistentRegistryManager.injectSnapshot(snapshot, true, true); } if (failedElements != null && !failedElements.isEmpty()) diff --git a/src/main/java/net/minecraftforge/fml/common/Loader.java b/src/main/java/net/minecraftforge/fml/common/Loader.java index 33dcb6cad..14ee5d194 100644 --- a/src/main/java/net/minecraftforge/fml/common/Loader.java +++ b/src/main/java/net/minecraftforge/fml/common/Loader.java @@ -21,12 +21,12 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.LoaderState.ModState; import net.minecraftforge.fml.common.ModContainer.Disableable; import net.minecraftforge.fml.common.ProgressManager.ProgressBar; @@ -38,10 +38,7 @@ import net.minecraftforge.fml.common.event.FMLModIdMappingEvent; import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent.MissingMapping; import net.minecraftforge.fml.common.functions.ArtifactVersionNameFunction; import net.minecraftforge.fml.common.functions.ModIdFunction; -import net.minecraftforge.fml.common.registry.GameData; -import net.minecraftforge.fml.common.registry.GameRegistry; -import net.minecraftforge.fml.common.registry.ItemStackHolderInjector; -import net.minecraftforge.fml.common.registry.ObjectHolderRegistry; +import net.minecraftforge.fml.common.registry.*; import net.minecraftforge.fml.common.registry.GameRegistry.Type; import net.minecraftforge.fml.common.toposort.ModSorter; import net.minecraftforge.fml.common.toposort.ModSortingException; @@ -738,7 +735,7 @@ public class Loader progressBar.step("Finishing up"); modController.transition(LoaderState.AVAILABLE, false); modController.distributeStateMessage(LoaderState.AVAILABLE); - GameData.freezeData(); + PersistentRegistryManager.freezeData(); FMLLog.info("Forge Mod Loader has successfully loaded %d mod%s", mods.size(), mods.size() == 1 ? "" : "s"); progressBar.step("Completing Minecraft initialization"); } @@ -839,7 +836,7 @@ public class Loader public void serverStopped() { - GameData.revertToFrozen(); + PersistentRegistryManager.revertToFrozen(); modController.distributeStateMessage(LoaderState.SERVER_STOPPED); modController.transition(LoaderState.SERVER_STOPPED, true); modController.transition(LoaderState.AVAILABLE, true); @@ -914,8 +911,7 @@ public class Loader * @param gameData GameData instance where the new map's config is to be loaded into. * @return List with the mapping results. */ - public List fireMissingMappingEvent(LinkedHashMap missingBlocks, LinkedHashMap missingItems, - boolean isLocalWorld, GameData gameData, Map remapBlocks, Map remapItems) + public List fireMissingMappingEvent(Map missingBlocks, Map missingItems, boolean isLocalWorld, Map remapBlocks, Map remapItems) { if (missingBlocks.isEmpty() && missingItems.isEmpty()) // nothing to do { @@ -925,15 +921,15 @@ public class Loader FMLLog.fine("There are %d mappings missing - attempting a mod remap", missingBlocks.size() + missingItems.size()); ArrayListMultimap missingMappings = ArrayListMultimap.create(); - for (Map.Entry mapping : missingBlocks.entrySet()) + for (Map.Entry mapping : missingBlocks.entrySet()) { MissingMapping m = new MissingMapping(GameRegistry.Type.BLOCK, mapping.getKey(), mapping.getValue()); - missingMappings.put(m.name.substring(0, m.name.indexOf(':')), m); + missingMappings.put(m.resourceLocation.getResourceDomain(), m); } - for (Map.Entry mapping : missingItems.entrySet()) + for (Map.Entry mapping : missingItems.entrySet()) { MissingMapping m = new MissingMapping(GameRegistry.Type.ITEM, mapping.getKey(), mapping.getValue()); - missingMappings.put(m.name.substring(0, m.name.indexOf(':')), m); + missingMappings.put(m.resourceLocation.getResourceDomain(), m); } FMLMissingMappingsEvent missingEvent = new FMLMissingMappingsEvent(missingMappings); @@ -975,12 +971,12 @@ public class Loader } } - return GameData.processIdRematches(missingMappings.values(), isLocalWorld, gameData, remapBlocks, remapItems); + return PersistentRegistryManager.processIdRematches(missingMappings.values(), isLocalWorld, remapBlocks, remapItems); } - public void fireRemapEvent(Map remapBlocks, Map remapItems) + public void fireRemapEvent(Map remapBlocks, Map remapItems) { - modController.propogateStateMessage(new FMLModIdMappingEvent(remapBlocks, remapItems)); + modController.propogateStateMessage(new FMLModIdMappingEvent(remapBlocks, remapItems)); } public void runtimeDisableMod(String modId) diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLMissingMappingsEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLMissingMappingsEvent.java index 2d5d48802..9d5322f16 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLMissingMappingsEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLMissingMappingsEvent.java @@ -4,6 +4,7 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.item.Item; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.common.registry.GameData; import net.minecraftforge.fml.common.registry.GameRegistry; @@ -63,14 +64,16 @@ public class FMLMissingMappingsEvent extends FMLEvent { public final GameRegistry.Type type; public final String name; public final int id; + public final ResourceLocation resourceLocation; private Action action = Action.DEFAULT; private Object target; - public MissingMapping(GameRegistry.Type type, String name, int id) + public MissingMapping(GameRegistry.Type type, ResourceLocation name, int id) { this.type = type; - this.name = name; + this.name = name.toString(); this.id = id; + this.resourceLocation = name; } /** diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLModIdMappingEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLModIdMappingEvent.java index ab761c37a..f628ea6b1 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLModIdMappingEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLModIdMappingEvent.java @@ -8,6 +8,7 @@ import java.util.Map.Entry; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; +import net.minecraft.util.ResourceLocation; /** * Called whenever the ID mapping might have changed. If you register for this event, you @@ -30,25 +31,28 @@ public class FMLModIdMappingEvent extends FMLEvent { public final int newId; public final String tag; public final RemapTarget remapTarget; - public ModRemapping(int oldId, int newId, String tag, RemapTarget type) + public final ResourceLocation resourceLocation; + + public ModRemapping(int oldId, int newId, ResourceLocation tag, RemapTarget type) { this.oldId = oldId; this.newId = newId; - this.tag = tag; + this.tag = tag.toString(); this.remapTarget = type; + this.resourceLocation = tag; } } public final ImmutableList remappedIds; - public FMLModIdMappingEvent(Map blocks, Map items) + public FMLModIdMappingEvent(Map blocks, Map items) { List remappings = Lists.newArrayList(); - for (Entry mapping : blocks.entrySet()) + for (Entry mapping : blocks.entrySet()) { remappings.add(new ModRemapping(mapping.getValue()[0], mapping.getValue()[1], mapping.getKey(), RemapTarget.BLOCK)); } - for (Entry mapping : items.entrySet()) + for (Entry mapping : items.entrySet()) { remappings.add(new ModRemapping(mapping.getValue()[0], mapping.getValue()[1], mapping.getKey(), RemapTarget.ITEM)); } diff --git a/src/main/java/net/minecraftforge/fml/common/network/handshake/FMLHandshakeClientState.java b/src/main/java/net/minecraftforge/fml/common/network/handshake/FMLHandshakeClientState.java index 633907cd0..f5d62a87c 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/handshake/FMLHandshakeClientState.java +++ b/src/main/java/net/minecraftforge/fml/common/network/handshake/FMLHandshakeClientState.java @@ -2,6 +2,7 @@ package net.minecraftforge.fml.common.network.handshake; import java.util.List; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.network.NetworkRegistry; @@ -9,6 +10,7 @@ import net.minecraftforge.fml.common.network.handshake.FMLHandshakeMessage.Serve import net.minecraftforge.fml.common.network.internal.FMLMessage; import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; import net.minecraftforge.fml.common.registry.GameData; +import net.minecraftforge.fml.common.registry.PersistentRegistryManager; import net.minecraftforge.fml.relauncher.Side; import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelHandlerContext; @@ -94,14 +96,14 @@ enum FMLHandshakeClientState implements IHandshakeState public FMLHandshakeClientState accept(ChannelHandlerContext ctx, FMLHandshakeMessage msg) { FMLHandshakeMessage.RegistryData pkt = (FMLHandshakeMessage.RegistryData)msg; - GameData.GameDataSnapshot snap = ctx.channel().attr(NetworkDispatcher.FML_GAMEDATA_SNAPSHOT).get(); + PersistentRegistryManager.GameDataSnapshot snap = ctx.channel().attr(NetworkDispatcher.FML_GAMEDATA_SNAPSHOT).get(); if (snap == null) { - snap = new GameData.GameDataSnapshot(); + snap = new PersistentRegistryManager.GameDataSnapshot(); ctx.channel().attr(NetworkDispatcher.FML_GAMEDATA_SNAPSHOT).set(snap); } - GameData.GameDataSnapshot.Entry entry = new GameData.GameDataSnapshot.Entry(); + PersistentRegistryManager.GameDataSnapshot.Entry entry = new PersistentRegistryManager.GameDataSnapshot.Entry(); entry.ids.putAll(pkt.getIdMap()); entry.substitutions.addAll(pkt.getSubstitutions()); snap.entries.put(pkt.getName(), entry); @@ -114,7 +116,7 @@ enum FMLHandshakeClientState implements IHandshakeState ctx.channel().attr(NetworkDispatcher.FML_GAMEDATA_SNAPSHOT).remove(); - List locallyMissing = GameData.injectSnapshot(snap, false, false); + List locallyMissing = PersistentRegistryManager.injectSnapshot(snap, false, false); if (!locallyMissing.isEmpty()) { NetworkDispatcher dispatcher = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER).get(); @@ -156,7 +158,7 @@ enum FMLHandshakeClientState implements IHandshakeState { if (msg instanceof FMLHandshakeMessage.HandshakeReset) { - GameData.revertToFrozen(); + PersistentRegistryManager.revertToFrozen(); return HELLO; } return this; diff --git a/src/main/java/net/minecraftforge/fml/common/network/handshake/FMLHandshakeMessage.java b/src/main/java/net/minecraftforge/fml/common/network/handshake/FMLHandshakeMessage.java index 984f600ff..f0690933b 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/handshake/FMLHandshakeMessage.java +++ b/src/main/java/net/minecraftforge/fml/common/network/handshake/FMLHandshakeMessage.java @@ -10,6 +10,7 @@ import java.util.Map.Entry; import java.util.Set; import net.minecraft.network.PacketBuffer; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.common.network.ByteBufUtils; @@ -22,6 +23,7 @@ import com.google.common.base.Joiner; import com.google.common.collect.Iterables; import com.google.common.collect.Maps; import com.google.common.collect.Sets; +import net.minecraftforge.fml.common.registry.PersistentRegistryManager; public abstract class FMLHandshakeMessage { public static FMLProxyPacket makeCustomChannelRegistration(Set channels) @@ -158,7 +160,7 @@ public abstract class FMLHandshakeMessage { } - public RegistryData(boolean hasMore, String name, GameData.GameDataSnapshot.Entry entry) + public RegistryData(boolean hasMore, ResourceLocation name, PersistentRegistryManager.GameDataSnapshot.Entry entry) { this.hasMore = hasMore; this.name = name; @@ -167,22 +169,22 @@ public abstract class FMLHandshakeMessage { } private boolean hasMore; - private String name; - private Map ids; - private Set substitutions; + private ResourceLocation name; + private Map ids; + private Set substitutions; @Override public void fromBytes(ByteBuf buffer) { this.hasMore = buffer.readBoolean(); - this.name = ByteBufUtils.readUTF8String(buffer); + this.name = new ResourceLocation(ByteBufUtils.readUTF8String(buffer)); int length = ByteBufUtils.readVarInt(buffer, 3); ids = Maps.newHashMap(); for (int i = 0; i < length; i++) { - ids.put(ByteBufUtils.readUTF8String(buffer), ByteBufUtils.readVarInt(buffer, 3)); + ids.put(new ResourceLocation(ByteBufUtils.readUTF8String(buffer)), ByteBufUtils.readVarInt(buffer, 3)); } length = ByteBufUtils.readVarInt(buffer, 3); @@ -190,7 +192,7 @@ public abstract class FMLHandshakeMessage { for (int i = 0; i < length; i++) { - substitutions.add(ByteBufUtils.readUTF8String(buffer)); + substitutions.add(new ResourceLocation(ByteBufUtils.readUTF8String(buffer))); } //if (!buffer.isReadable()) return; // In case we expand } @@ -199,31 +201,31 @@ public abstract class FMLHandshakeMessage { public void toBytes(ByteBuf buffer) { buffer.writeBoolean(this.hasMore); - ByteBufUtils.writeUTF8String(buffer, this.name); + ByteBufUtils.writeUTF8String(buffer, this.name.toString()); ByteBufUtils.writeVarInt(buffer, ids.size(), 3); - for (Entry entry: ids.entrySet()) + for (Entry entry: ids.entrySet()) { - ByteBufUtils.writeUTF8String(buffer, entry.getKey()); + ByteBufUtils.writeUTF8String(buffer, entry.getKey().toString()); ByteBufUtils.writeVarInt(buffer, entry.getValue(), 3); } ByteBufUtils.writeVarInt(buffer, substitutions.size(), 3); - for (String entry: substitutions) + for (ResourceLocation entry: substitutions) { - ByteBufUtils.writeUTF8String(buffer, entry); + ByteBufUtils.writeUTF8String(buffer, entry.toString()); } } - public Map getIdMap() + public Map getIdMap() { return ids; } - public Set getSubstitutions() + public Set getSubstitutions() { return substitutions; } - public String getName() + public ResourceLocation getName() { return this.name; } diff --git a/src/main/java/net/minecraftforge/fml/common/network/handshake/FMLHandshakeServerState.java b/src/main/java/net/minecraftforge/fml/common/network/handshake/FMLHandshakeServerState.java index f2683b8e0..bb10e72f0 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/handshake/FMLHandshakeServerState.java +++ b/src/main/java/net/minecraftforge/fml/common/network/handshake/FMLHandshakeServerState.java @@ -4,12 +4,14 @@ import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.internal.FMLMessage; import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; import net.minecraftforge.fml.common.registry.GameData; +import net.minecraftforge.fml.common.registry.PersistentRegistryManager; import net.minecraftforge.fml.relauncher.Side; import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelHandlerContext; @@ -61,11 +63,11 @@ enum FMLHandshakeServerState implements IHandshakeState { if (!ctx.channel().attr(NetworkDispatcher.IS_LOCAL).get()) { - GameData.GameDataSnapshot snapshot = GameData.takeSnapshot(); - Iterator> itr = snapshot.entries.entrySet().iterator(); + PersistentRegistryManager.GameDataSnapshot snapshot = PersistentRegistryManager.takeSnapshot(); + Iterator> itr = snapshot.entries.entrySet().iterator(); while (itr.hasNext()) { - Entry e = itr.next(); + Entry e = itr.next(); ctx.writeAndFlush(new FMLHandshakeMessage.RegistryData(itr.hasNext(), e.getKey(), e.getValue())).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE); } } diff --git a/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java b/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java index e775f2dcf..e6f6115be 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java +++ b/src/main/java/net/minecraftforge/fml/common/network/handshake/NetworkDispatcher.java @@ -18,6 +18,7 @@ import java.util.List; import java.util.Locale; import java.util.Map; +import net.minecraftforge.fml.common.registry.PersistentRegistryManager; import org.apache.logging.log4j.Level; import net.minecraft.entity.player.EntityPlayerMP; @@ -82,7 +83,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler imple public static final AttributeKey FML_DISPATCHER = AttributeKey.valueOf("fml:dispatcher"); public static final AttributeKey IS_LOCAL = AttributeKey.valueOf("fml:isLocal"); - public static final AttributeKey FML_GAMEDATA_SNAPSHOT = AttributeKey.valueOf("fml:gameDataSnapshot"); + public static final AttributeKey FML_GAMEDATA_SNAPSHOT = AttributeKey.valueOf("fml:gameDataSnapshot"); public final NetworkManager manager; private final ServerConfigurationManager scm; private EntityPlayerMP player; diff --git a/src/main/java/net/minecraftforge/fml/common/registry/ExistingSubstitutionException.java b/src/main/java/net/minecraftforge/fml/common/registry/ExistingSubstitutionException.java index b0bafa3b1..39e38656d 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/ExistingSubstitutionException.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/ExistingSubstitutionException.java @@ -1,7 +1,9 @@ package net.minecraftforge.fml.common.registry; +import net.minecraft.util.ResourceLocation; + public class ExistingSubstitutionException extends Exception { - public ExistingSubstitutionException(String fromName, Object toReplace) { + public ExistingSubstitutionException(ResourceLocation fromName, Object toReplace) { } private static final long serialVersionUID = 1L; diff --git a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java index 6f27abd77..9f1fd475e 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java @@ -1,5 +1,6 @@ package net.minecraftforge.fml.common.registry; +import java.lang.reflect.Field; import java.util.ArrayList; import java.util.BitSet; import java.util.Collections; @@ -8,7 +9,10 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.concurrent.Callable; +import com.google.common.base.Throwables; +import com.google.common.collect.*; import org.apache.commons.lang3.Validate; import org.apache.logging.log4j.Level; @@ -17,128 +21,128 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemBanner; import net.minecraft.item.ItemBlock; import net.minecraft.util.ObjectIntIdentityMap; +import net.minecraft.util.RegistryNamespaced; import net.minecraft.util.RegistryNamespacedDefaultedByKey; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.functions.GenericIterableFactory; import net.minecraftforge.fml.common.registry.RegistryDelegate.Delegate; -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; -import com.google.common.collect.Iterators; +import com.google.common.base.Function; -@SuppressWarnings({"rawtypes", "unchecked"}) // cpw is working on these classes just shut them up for now. -public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaultedByKey { +public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaultedByKey { public static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("fml.debugRegistryEntries", "false")); private final Class superType; - private Object optionalDefaultKey; + private final boolean isDelegated; + private final Field delegateAccessor; + private ResourceLocation optionalDefaultKey; private I optionalDefaultObject; private int maxId; private int minId; - // aliases redirecting legacy names to the actual name, may need recursive application to find the final name. - // these need to be registry specific, it's possible to only have a loosely linked item for a block which may get renamed by itself. - private final Map aliases = new HashMap(); - private BiMap persistentSubstitutions; - private BiMap activeSubstitutions = HashBiMap.create(); + /** + * Aliases are resource location to resource location pointers, allowing for alternative names to be supplied + * pointing at the same thing. They are used to allow programmatic migration of an ID. + */ + private final Map aliases = Maps.newHashMap(); + /** + * Persistent substitutions are the mechanism to allow mods to override specific behaviours with new behaviours. + */ + private final BiMap persistentSubstitutions = HashBiMap.create(); + /** + * This is the current active substitution set for a particular world. It will change as worlds come and go. + */ + private final BiMap activeSubstitutions = HashBiMap.create(); + /** + * The list of IDs blocked for this world. IDs will never be allocated in this set. + */ + private final Set blockedIds = Sets.newHashSet(); - FMLControlledNamespacedRegistry(Object defaultKey, int maxIdValue, int minIdValue, Class type) + private final BitSet availabilityMap; + FMLControlledNamespacedRegistry(ResourceLocation defaultKey, int maxIdValue, int minIdValue, Class type, boolean isDelegated) { super(defaultKey); this.superType = type; this.optionalDefaultKey = defaultKey; this.maxId = maxIdValue; this.minId = minIdValue; + this.availabilityMap = new BitSet(maxIdValue + 1); + this.isDelegated = isDelegated; + if (this.isDelegated) { + try { + this.delegateAccessor = type.getField("delegate"); + } catch (NoSuchFieldException e) { + FMLLog.log(Level.ERROR, e, "Delegate class identified with missing delegate field"); + throw Throwables.propagate(e); + } + } else { + this.delegateAccessor = null; + } } - void validateContent(int maxId, String type, BitSet availabilityMap, Set blockedIds, FMLControlledNamespacedRegistry iBlockRegistry) + void validateContent(ResourceLocation registryName) { for (I obj : typeSafeIterable()) { int id = getId(obj); - Object name = getNameForObject(obj); + ResourceLocation name = getNameForObject(obj); boolean isSubstituted = activeSubstitutions.containsKey(name); // name lookup failed -> obj is not in the obj<->name map - if (name == null) throw new IllegalStateException(String.format("Registry entry for %s %s, id %d, doesn't yield a name.", type, obj, id)); - - ResourceLocation loc = (name instanceof ResourceLocation) ? (ResourceLocation)name : null; - String nameS = (name instanceof String) ? (String)name : (loc != null ? name.toString() : null); - if (loc == null && nameS == null) throw new IllegalStateException(String.format("Registry entry for %s %s name is invalid, must be a String or ResourceLocation %s", type, obj, name)); - + if (name == null) throw new IllegalStateException(String.format("Registry entry for %s %s, id %d, doesn't yield a name.", registryName, obj, id)); // id lookup failed -> obj is not in the obj<->id map - if (!isSubstituted && id < 0) throw new IllegalStateException(String.format("Registry entry for %s %s, name %s, doesn't yield an id.", type, obj, name)); + if (!isSubstituted && id < 0) throw new IllegalStateException(String.format("Registry entry for %s %s, name %s, doesn't yield an id.", registryName, obj, name)); // id is too high - if (id > maxId) throw new IllegalStateException(String.format("Registry entry for %s %s, name %s uses the too large id %d.", type, obj, name)); - // empty name - if (name.toString().isEmpty()) throw new IllegalStateException(String.format("Registry entry for %s %s, id %d, yields an empty name.", type, obj, id)); - // non-prefixed name - if (name.toString().indexOf(':') == -1) throw new IllegalStateException(String.format("Registry entry for %s %s, id %d, has the non-prefixed name %s.", type, obj, id, name)); + if (id > maxId) throw new IllegalStateException(String.format("Registry entry for %s %s, name %s uses the too large id %d.", registryName, obj, name, id)); // the rest of the tests don't really work for substituted items or blocks if (isSubstituted) continue; // id -> obj lookup is inconsistent - if (getRaw(id) != obj) throw new IllegalStateException(String.format("Registry entry for id %d, name %s, doesn't yield the expected %s %s.", id, name, type, obj)); + if (getRaw(id) != obj) throw new IllegalStateException(String.format("Registry entry for id %d, name %s, doesn't yield the expected %s %s.", id, name, registryName, obj)); // name -> obj lookup is inconsistent - if (getRaw(nameS) != obj ) throw new IllegalStateException(String.format("Registry entry for name %s, id %d, doesn't yield the expected %s %s.", name, id, type, obj)); + if (getRaw(name) != obj ) throw new IllegalStateException(String.format("Registry entry for name %s, id %d, doesn't yield the expected %s %s.", name, id, registryName, obj)); // name -> id lookup is inconsistent - if (getId(nameS) != id) throw new IllegalStateException(String.format("Registry entry for name %s doesn't yield the expected id %d.", name, id)); - // id isn't marked as unavailable - if (!availabilityMap.get(id)) throw new IllegalStateException(String.format("Registry entry for %s %s, id %d, name %s, marked as empty.", type, obj, id, name)); + if (getId(name) != id) throw new IllegalStateException(String.format("Registry entry for name %s doesn't yield the expected id %d.", name, id)); // entry is blocked, thus should be empty - if (blockedIds.contains(id)) throw new IllegalStateException(String.format("Registry entry for %s %s, id %d, name %s, marked as dangling.", type, obj, id, name)); - - if (obj instanceof ItemBlock && !(obj instanceof ItemBanner)) //Dammet Mojang not linking Banners - { - Block block = ((ItemBlock) obj).block; - - // verify matching block entry - if (iBlockRegistry.getId(block) != id) - { - throw new IllegalStateException(String.format("Registry entry for ItemBlock %s, id %d, is missing or uses the non-matching id %d.", obj, id, iBlockRegistry.getId(block))); - } - // verify id range - if (id > GameData.MAX_BLOCK_ID) throw new IllegalStateException(String.format("ItemBlock %s uses the id %d outside the block id range", name, id)); - } + if (blockedIds.contains(id)) throw new IllegalStateException(String.format("Registry entry for %s %s, id %d, name %s, marked as dangling.", registryName, obj, id, name)); } } - void setFrom(FMLControlledNamespacedRegistry registry) { - set((FMLControlledNamespacedRegistry) registry); - } - void set(FMLControlledNamespacedRegistry registry) + @SuppressWarnings("unchecked") + void set(FMLControlledNamespacedRegistry otherRegistry) { - if (this.superType != registry.superType) throw new IllegalArgumentException("incompatible registry"); + if (this.superType != otherRegistry.superType) throw new IllegalArgumentException("incompatible registry"); - this.optionalDefaultKey = registry.optionalDefaultKey; - this.maxId = registry.maxId; - this.minId = registry.minId; + this.optionalDefaultKey = otherRegistry.optionalDefaultKey; + this.maxId = otherRegistry.maxId; + this.minId = otherRegistry.minId; this.aliases.clear(); - this.aliases.putAll(registry.aliases); + this.aliases.putAll(otherRegistry.aliases); this.activeSubstitutions.clear(); - underlyingIntegerMap = new ObjectIntIdentityMap(); + underlyingIntegerMap = new ObjectIntIdentityMap(); registryObjects.clear(); - for (I thing : registry.typeSafeIterable()) + for (I thing : otherRegistry.typeSafeIterable()) { - addObjectRaw(registry.getId(thing), registry.getNameForObject(thing), thing); + addObjectRaw(otherRegistry.getId(thing), otherRegistry.getNameForObject(thing), thing); } - this.activeSubstitutions.putAll(registry.activeSubstitutions); + this.activeSubstitutions.putAll(otherRegistry.activeSubstitutions); } // public api /** * Add an object to the registry, trying to use the specified id. + * This is required, to re-route vanilla block and item registration through to + * the {@link #add} method. * * @deprecated register through {@link GameRegistry} instead. */ @Override @Deprecated - public void register(int id, Object name, Object thing) + public void register(int id, ResourceLocation name, I thing) { - Validate.isInstanceOf(ResourceLocation.class, name); - GameData.getMain().register(thing, name.toString(), id); + add(id, name, thing); } /** @@ -148,17 +152,13 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul */ @Override @Deprecated - public void putObject(Object objName, Object obj) + public void putObject(ResourceLocation name, I thing) { - String name = objName.toString(); - I thing = superType.cast(obj); if (name == null) throw new NullPointerException("Can't use a null-name for the registry."); - if (name.isEmpty()) throw new IllegalArgumentException("Can't use an empty name for the registry."); if (thing == null) throw new NullPointerException("Can't add null-object to the registry."); - name = new ResourceLocation(name).toString(); - Object existingName = getNameForObject(thing); + ResourceLocation existingName = getNameForObject(thing); if (existingName == null) { @@ -171,7 +171,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul else { FMLLog.bigWarning("Ignoring putObject(%s, %s), adding alias to %s instead", name, thing, existingName); - addAlias(name, existingName.toString()); + addAlias(name, existingName); } } @@ -184,11 +184,9 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul * @return Registered object of the default object if it wasn't found- */ @Override - public I getObject(Object name) + public I getObject(ResourceLocation name) { - I object = null; - if (name instanceof ResourceLocation) object = getRaw((ResourceLocation)name); - if (name instanceof String) object = getRaw((String)name); + I object = getRaw(name); return object == null ? this.optionalDefaultObject : object; } @@ -207,24 +205,6 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul return object == null ? this.optionalDefaultObject : object; } - /** - * @deprecated use getObjectById instead - */ - @Deprecated - public I get(int id) - { - return getObjectById(id); - } - - /** - * @deprecated use getObject instead - */ - @Deprecated - public I get(String name) - { - return getObject(name); - } - /** * Get the id for the specified object. * @@ -249,27 +229,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul */ public I getRaw(int id) { - return cast(super.getObjectById(id)); - } - - /** - * superType.cast appears to be expensive. Skip it for speed? - * @param obj - * @return - */ - private I cast(Object obj) - { - return (I)(obj); - } - /** - * Get the object identified by the specified name. - * - * @param name Block/Item name. - * @return Block/Item object or null if it wasn't found. - */ - public I getRaw(String name) - { - return getRaw(new ResourceLocation(name)); + return super.getObjectById(id); } /** @@ -278,13 +238,13 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul * @param name Block/Item name. * @return Block/Item object or null if it wasn't found. */ - private I getRaw(ResourceLocation loc) + private I getRaw(ResourceLocation name) { - I ret = superType.cast(super.getObject(loc)); + I ret = super.getObject(name); if (ret == null) // no match, try aliases recursively { - String name = aliases.get(loc.toString()); + name = aliases.get(name); if (name != null) return getRaw(name); } @@ -301,7 +261,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul * @return true if a matching entry was found. */ @Override - public boolean containsKey(Object name) + public boolean containsKey(ResourceLocation name) { boolean ret = super.containsKey(name); @@ -326,7 +286,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul * @param itemName Block/Item registry name. * @return Block/Item id or -1 if it wasn't found. */ - public int getId(String itemName) + public int getId(ResourceLocation itemName) { I obj = getRaw(itemName); if (obj == null) return -1; @@ -334,15 +294,6 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul return getId(obj); } - /** - * @deprecated use containsKey instead - */ - @Deprecated - public boolean contains(String itemName) - { - return containsKey(itemName); - } - /* * This iterator is used by FML to visit the actual block sets, it should use the super.iterator method instead * Compare #iterator() @@ -354,44 +305,36 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul // internal - public void serializeInto(Map idMapping) // for saving + public void serializeIds(Map idMapping) // for saving { for (I thing : this.typeSafeIterable()) { - idMapping.put(getNameForObject(thing).toString(), getId(thing)); + idMapping.put(getNameForObject(thing), getId(thing)); } } - public void serializeAliases(Map map) + public void serializeAliases(Map map) { map.putAll(this.aliases); } - public void serializeSubstitutions(Set set) + + public void serializeSubstitutions(Set set) { set.addAll(activeSubstitutions.keySet()); } - private BitSet internalAvailabilityMap = new BitSet(); - - int add(int id, String name, Object thing) { - return add(id, name, superType.cast(thing), internalAvailabilityMap); - } - /** * Add the specified object to the registry. * * @param id ID to use if available, auto-assigned otherwise. * @param name Name to use, prefixed by the mod id. * @param thing Object to add. - * @param availabilityMap Map marking available IDs for auto assignment. * @return ID eventually allocated. */ - int add(int id, String name, I thing, BitSet availabilityMap) + int add(int id, ResourceLocation name, I thing) { if (name == null) throw new NullPointerException(String.format("Can't use a null-name for the registry, object %s.", thing)); - if (name.isEmpty()) throw new IllegalArgumentException(String.format("Can't use an empty name for the registry, object %s.", thing)); - if (name.indexOf(':') == -1) throw new IllegalArgumentException(String.format("Can't add the name (%s) without a prefix, object %s", name, thing)); if (thing == null) throw new NullPointerException(String.format("Can't add null-object to the registry, name %s.", name)); - if (optionalDefaultKey != null && optionalDefaultKey.toString().equals(name) && this.optionalDefaultObject == null) + if (optionalDefaultKey != null && optionalDefaultKey.equals(name) && this.optionalDefaultObject == null) { this.optionalDefaultObject = thing; } @@ -421,43 +364,50 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul if (getId(thing) >= 0) // duplicate object - but only if it's not being substituted { int foundId = getId(thing); - Object otherThing = getRaw(foundId); + I otherThing = getRaw(foundId); throw new IllegalArgumentException(String.format("The object %s{%x} has been registered twice, using the names %s and %s. (Other object at this id is %s{%x})", thing, System.identityHashCode(thing), getNameForObject(thing), name, otherThing, System.identityHashCode(otherThing))); } - if (GameData.isFrozen(this)) + if (PersistentRegistryManager.isFrozen(this)) { FMLLog.bigWarning("The object %s (name %s) is being added too late.", thing, name); } if (activeSubstitutions.containsKey(name)) { + I oldThing = thing; thing = activeSubstitutions.get(name); + if (DEBUG) FMLLog.getLogger().log(Level.DEBUG, "Active substitution: {} {}@{} -> {}@{}",name, oldThing.getClass().getName(), System.identityHashCode(oldThing), thing.getClass().getName(), System.identityHashCode(thing)); } - addObjectRaw(idToUse, new ResourceLocation(name), thing); + + addObjectRaw(idToUse, name, thing); + if (isDelegated) + { + getExistingDelegate(thing).setResourceName(name); + } if (DEBUG) FMLLog.finer("Registry add: %s %d %s (req. id %d)", name, idToUse, thing, id); return idToUse; } - void addAlias(String from, String to) + void addAlias(ResourceLocation from, ResourceLocation to) { aliases.put(from, to); if (DEBUG) FMLLog.finer("Registry alias: %s -> %s", from, to); } - Map getEntriesNotIn(FMLControlledNamespacedRegistry registry) + Map getEntriesNotIn(FMLControlledNamespacedRegistry registry) { - Map ret = new HashMap(); + Map ret = new HashMap(); for (I thing : this.typeSafeIterable()) { if (!registry.inverseObjectRegistry.containsKey(thing)) { - if (!registry.activeSubstitutions.containsKey(getNameForObject(thing).toString())) + if (!registry.activeSubstitutions.containsKey(getNameForObject(thing))) { - ret.put(getNameForObject(thing).toString(), getId(thing)); + ret.put(getNameForObject(thing), getId(thing)); } } } @@ -465,7 +415,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul return ret; } - void dump() + void dump(ResourceLocation registryName) { if (!DEBUG) return; @@ -479,7 +429,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul // sort by id Collections.sort(ids); - + FMLLog.finer("Registry Name : {}", registryName); for (int id : ids) { I thing = getRaw(id); @@ -490,7 +440,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul /** * Version of addObject not using the API restricting overrides. */ - private void addObjectRaw(int id, Object name, I thing) + private void addObjectRaw(int id, ResourceLocation name, I thing) { if (name == null) throw new NullPointerException("The name to be added to the registry is null. This can only happen with a corrupted registry state. Reflection/ASM hackery? Registry bug?"); if (thing == null) throw new NullPointerException("The object to be added to the registry is null. This can only happen with a corrupted registry state. Reflection/ASM hackery? Registry bug?"); @@ -498,6 +448,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul underlyingIntegerMap.put(thing, id); // obj <-> id super.putObject(name, thing); // name <-> obj + availabilityMap.set(id); } public I getDefaultValue() @@ -506,37 +457,35 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul } public RegistryDelegate getDelegate(I thing, Class clazz) { - return GameData.buildDelegate(thing, clazz); + return new RegistryDelegate.Delegate(thing, clazz); } - void activateSubstitution(String nameToReplace) + @SuppressWarnings("unchecked") + public Delegate getExistingDelegate(I thing) { + try { + return (Delegate) delegateAccessor.get(thing); + } catch (IllegalAccessException e) { + FMLLog.log(Level.ERROR, e, "Illegal attempt to access delegate"); + throw Throwables.propagate(e); + } + } + void activateSubstitution(ResourceLocation nameToReplace) { if (getPersistentSubstitutions().containsKey(nameToReplace)) { I original = getRaw(nameToReplace); - if (superType == Item.class) { - Item sub = (Item) getPersistentSubstitutions().get(nameToReplace); - if (original == null) { - // When we're activated from the server side, we need to set the delegate on the original instance to - // point to us. Go to the "default state" registry to get it - original = (I)GameData.getItemRegistry().getRaw(nameToReplace); - } - FMLLog.log(Level.DEBUG, "Replacing %s with %s (name %s)", original, sub, nameToReplace); - Delegate delegate = (Delegate)((Item)original).delegate; - delegate.changeReference(sub); - ((Delegate)sub.delegate).setName(nameToReplace); - } - activeSubstitutions.put(nameToReplace, getPersistentSubstitutions().get(nameToReplace)); + I sub = getPersistentSubstitutions().get(nameToReplace); + getExistingDelegate(original).changeReference(sub); + activeSubstitutions.put(nameToReplace, sub); } } - void addSubstitutionAlias(String modId, String nameToReplace, Object toReplace) throws ExistingSubstitutionException { - if (getPersistentSubstitutions().containsKey(nameToReplace) || getPersistentSubstitutions().containsValue(toReplace)) + void addSubstitutionAlias(String modId, ResourceLocation nameToReplace, I replacement) throws ExistingSubstitutionException { + if (getPersistentSubstitutions().containsKey(nameToReplace) || getPersistentSubstitutions().containsValue(replacement)) { - FMLLog.severe("The substitution of %s has already occured. You cannot duplicate substitutions", nameToReplace); - throw new ExistingSubstitutionException(nameToReplace, toReplace); + FMLLog.severe("The substitution of %s has already occurred. You cannot duplicate substitutions", nameToReplace); + throw new ExistingSubstitutionException(nameToReplace, replacement); } - I replacement = cast(toReplace); I original = getRaw(nameToReplace); if (original == null) { @@ -557,12 +506,8 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul getPersistentSubstitutions().put(nameToReplace, replacement); } - private BiMap getPersistentSubstitutions() + private BiMap getPersistentSubstitutions() { - if (persistentSubstitutions == null) - { - persistentSubstitutions = GameData.getMain().getPersistentSubstitutionMap(superType); - } return persistentSubstitutions; } @@ -576,6 +521,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul * This iterator is used by some regular MC methods to visit all blocks, we need to include substitutions * Compare #typeSafeIterable() */ + @SuppressWarnings("unchecked") @Override public Iterator iterator() { @@ -585,14 +531,72 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul FMLControlledNamespacedRegistry makeShallowCopy() { - return new FMLControlledNamespacedRegistry(optionalDefaultKey, maxId, minId, superType); + return new FMLControlledNamespacedRegistry(optionalDefaultKey, maxId, minId, superType, isDelegated); } - // ONLY CALLED ON ITEM registry + void resetSubstitutionDelegates() { - for (I item: typeSafeIterable()) { - Delegate delegate = (Delegate)((Item)item).delegate; - delegate.changeReference((Item)item); + if (!isDelegated) return; + for (I obj: typeSafeIterable()) { + Delegate delegate = getExistingDelegate(obj); + delegate.changeReference(obj); } } + + @SuppressWarnings("unchecked") + public FMLControlledNamespacedRegistry asType(Class type) + { + return (FMLControlledNamespacedRegistry) this; + } + + public void serializeBlockList(Set blocked) { + blocked.addAll(this.blockedIds); + } + + public Set getActiveSubstitutions() { + return activeSubstitutions.keySet(); + } + + public void loadAliases(Map aliases) { + for (Map.Entry alias : aliases.entrySet()) { + addAlias(alias.getKey(), alias.getValue()); + } + } + + public void loadSubstitutions(Set substitutions) { + for (ResourceLocation rl : substitutions) { + activateSubstitution(rl); + } + } + + public void loadBlocked(Set blocked) { + for (Integer id : blocked) { + blockedIds.add(id); + availabilityMap.set(id); + } + } + + public void loadIds(Map ids, Map missingIds, Map remappedIds, FMLControlledNamespacedRegistry currentRegistry, ResourceLocation registryName) { + for (Map.Entry entry : ids.entrySet()) { + ResourceLocation itemName = entry.getKey(); + int newId = entry.getValue(); + int currId = currentRegistry.getId(itemName); + + if (currId == -1) { + FMLLog.info("Found a missing id from the world %s", itemName); + missingIds.put(entry.getKey(), newId); + continue; // no block/item -> nothing to add + } else if (currId != newId) { + FMLLog.fine("Fixed %s id mismatch %s: %d (init) -> %d (map).", registryName, itemName, currId, newId); + remappedIds.put(itemName, new Integer[]{currId, newId}); + } + I obj = currentRegistry.getRaw(itemName); + + add(newId, itemName, obj); + } + } + + public void blockId(int id) { + blockedIds.add(id); + } } diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java index 0f0f441fc..c96a942e0 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java @@ -12,47 +12,21 @@ package net.minecraftforge.fml.common.registry; -import java.io.IOException; -import java.util.BitSet; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; -import net.minecraft.item.ItemBanner; -import net.minecraft.item.ItemBlock; import net.minecraft.util.ObjectIntIdentityMap; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModContainer; -import net.minecraftforge.fml.common.StartupQuery; -import net.minecraftforge.fml.common.ZipperUtil; -import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent; -import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent.MissingMapping; import net.minecraftforge.fml.common.registry.GameRegistry.Type; import net.minecraftforge.fml.common.registry.GameRegistry.UniqueIdentifier; -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; -import com.google.common.collect.ImmutableBiMap; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import com.google.common.collect.Sets.SetView; -@SuppressWarnings({"rawtypes", "deprecation", "unchecked", "static-access", "unused"}) // cpw is cleaning these classes up so just suppress everything for now. public class GameData { static final int MIN_BLOCK_ID = 0; static final int MAX_BLOCK_ID = 4095; @@ -60,9 +34,6 @@ public class GameData { static final int MAX_ITEM_ID = 31999; private static final GameData mainData = new GameData(); - private static Map customOwners = Maps.newHashMap(); - private static GameData frozen; - // public api /** @@ -87,1018 +58,135 @@ public class GameData { * INTERNAL CODE FROM HERE ON DO NOT USE! ***************************************************/ - public static class GameDataSnapshot - { - public static class Entry - { - public final Map ids; - public final Set substitutions; - public final Map aliases; - public final Set blocked; - public Entry() - { - this(new HashMap(), new HashSet(), new HashMap(), new HashSet()); - } - - public Entry(Map ids, Set substitions, Map aliases, Set blocked) - { - this.ids = ids; - this.substitutions = substitions; - this.aliases = aliases; - this.blocked = blocked; - } - - public Entry(FMLControlledNamespacedRegistry registry) - { - this.ids = Maps.newHashMap(); - this.substitutions = Sets.newHashSet(); - this.aliases = Maps.newHashMap(); - this.blocked = Sets.newHashSet(); - - registry.serializeInto(this.ids); - registry.serializeSubstitutions(this.substitutions); - registry.serializeAliases(this.aliases); - - if (GameData.getBlockRegistry() == registry || - GameData.getItemRegistry() == registry) - { - this.blocked.addAll(GameData.getMain().blockedIds); - } - } - } - public final Map entries = Maps.newHashMap(); + static Item findItem(String modId, String name) { + return getMain().iItemRegistry.getObject(new ResourceLocation(modId, name)); } - public static GameDataSnapshot takeSnapshot() - { - GameDataSnapshot snap = new GameDataSnapshot(); - snap.entries.put("fml:blocks", new GameDataSnapshot.Entry(getMain().getBlockRegistry())); - snap.entries.put("fml:items", new GameDataSnapshot.Entry(getMain().getItemRegistry())); - for (Map.Entry> e : getMain().genericRegistries.entrySet()) { - snap.entries.put("fmlgr:"+e.getKey(), new GameDataSnapshot.Entry(e.getValue())); - } - return snap; + static Block findBlock(String modId, String name) { + return getMain().iBlockRegistry.getObject(new ResourceLocation(modId, name)); } - static Item findItem(String modId, String name) - { - return getMain().iItemRegistry.getObject(modId + ":" + name); - } - - static Block findBlock(String modId, String name) - { - return getMain().iBlockRegistry.getObject(modId + ":" + name); - } - - static UniqueIdentifier getUniqueName(Block block) - { + static UniqueIdentifier getUniqueName(Block block) { if (block == null) return null; Object name = getMain().iBlockRegistry.getNameForObject(block); return new UniqueIdentifier(name); } - static UniqueIdentifier getUniqueName(Item item) - { + static UniqueIdentifier getUniqueName(Item item) { if (item == null) return null; Object name = getMain().iItemRegistry.getNameForObject(item); return new UniqueIdentifier(name); } - /** - * Fix IDs improperly allocated by early versions of the registry, best-effort. - * - * Items sharing the same ID with a block, but not sharing the same registry name will be - * mapped to an unused id. Losing items instead of blocks should minimize the damage. - * - * @param dataList List containing the IDs to fix - */ - public static void fixBrokenIds(GameDataSnapshot.Entry blocks, GameDataSnapshot.Entry items, Set blockedIds) - { - BitSet availabilityMap = new BitSet(MAX_ITEM_ID + 1); - - // reserve all ids occupied by blocks - for (Entry entry : blocks.ids.entrySet()) - { - availabilityMap.set(entry.getValue()); - } - - Set newBlockedIds = new HashSet(); - Set itemsToRemove = new HashSet(); - Map itemsToRelocate = new HashMap(); - - // check all ids occupied by items - for (Entry entry : items.ids.entrySet()) - { - int oldId = entry.getValue(); - String name = entry.getKey(); - Item item = getMain().iItemRegistry.getRaw(name); - boolean blockThisId = false; // block oldId unless it's used by a block - - if (item == null) // item no longer available - { - // can't fix items without reliably checking if they are ItemBlocks - FMLLog.warning("Item %s (old id %d) is no longer available and thus can't be fixed.", name, oldId); - itemsToRemove.add(name); - blockThisId = true; - } - else if (item instanceof ItemBlock) - { - if (blocks.ids.containsKey(name)) // the item was an ItemBlock before - { - int blockId = blocks.ids.get(name); - - if (blockId != oldId) // mis-located ItemBlock - { - // relocate to the matching block - FMLLog.warning("ItemBlock %s (old id %d) doesn't have the same id as its block (%d).", name, oldId, blockId); - itemsToRelocate.put(name, blockId); - blockThisId = true; - } - else // intact ItemBlock - { - availabilityMap.set(oldId); // occupy id - } - } - else // the item hasn't been an ItemBlock before, but it's now - { - // can't fix these, drop them - FMLLog.warning("Item %s (old id %d) has been migrated to an ItemBlock and can't be fixed.", name, oldId); - itemsToRemove.add(name); - blockThisId = true; - } - } - else if (availabilityMap.get(oldId)) // normal item, id is already occupied - { - // remove the item mapping - FMLLog.warning("Item %s (old id %d) is conflicting with another block/item and can't be fixed.", name, oldId); - itemsToRemove.add(name); - } - else // intact Item - { - availabilityMap.set(oldId); // occupy id - } - - // handle blocking the id from future use if possible (i.e. not used by a conflicting block) - // blockThisId requests don't modify availabilityMap, it could only be set by a block (or another item, which isn't being handled) - if (blockThisId && !availabilityMap.get(oldId)) - { - // there's no block occupying this id, thus block the id from future use - // as there may still be ItemStacks in the world referencing it - newBlockedIds.add(oldId); - availabilityMap.set(oldId); - } - } - - if (itemsToRemove.isEmpty() && itemsToRelocate.isEmpty()) return; // nothing to do - - // confirm - String text = "Forge Mod Loader detected that this save is damaged.\n\n" + - "It's likely that an automatic repair can successfully restore\n" + - "most of it, except some items which may get swapped with others.\n\n" + - "A world backup will be created as a zip file in your saves\n" + - "directory automatically.\n\n" + - itemsToRemove.size()+" items need to be removed.\n"+ - itemsToRelocate.size()+" items need to be relocated."; - - boolean confirmed = StartupQuery.confirm(text); - if (!confirmed) StartupQuery.abort(); - - // confirm missing mods causing item removal - Set modsMissing = new HashSet(); - - for (String name : itemsToRemove) - { - modsMissing.add(name.substring(0, name.indexOf(':'))); - } - - for (Iterator it = modsMissing.iterator(); it.hasNext(); ) - { - String mod = it.next(); - - if (mod.equals("minecraft") || Loader.isModLoaded(mod)) it.remove(); - } - - if (!modsMissing.isEmpty()) - { - text = "Forge Mod Loader detected that "+modsMissing.size()+" mods are missing.\n\n" + - "If you continue items previously provided by those mods will be\n" + - "removed while repairing this world save.\n\n" + - "Missing mods:\n"; - - for (String mod : modsMissing) text += mod+"\n"; - - confirmed = StartupQuery.confirm(text); - if (!confirmed) StartupQuery.abort(); - } - - // backup - try - { - String skip = System.getProperty("fml.doNotBackup"); - if (skip == null || !"true".equals(skip)) - { - ZipperUtil.backupWorld(); - } - else - { - for (int x = 0; x < 10; x++) - FMLLog.severe("!!!!!!!!!! UPDATING WORLD WITHOUT DOING BACKUP !!!!!!!!!!!!!!!!"); - } - } - catch (IOException e) - { - StartupQuery.notify("The world backup couldn't be created.\n\n"+e); - StartupQuery.abort(); - } - - // apply fix - for (String name : itemsToRemove) - { - FMLLog.warning("Removed Item %s, old id %d.", name, items.ids.remove(name)); - } - - for (Map.Entry entry : itemsToRelocate.entrySet()) - { - int newId = entry.getValue(); - int oldId = items.ids.put(entry.getKey(), newId); - FMLLog.warning("Remapped Item %s to id %d, old id %d.", entry.getKey(), newId, oldId); - } - - blockedIds.addAll(newBlockedIds); - } - - public static List injectSnapshot(GameDataSnapshot snapshot, boolean injectFrozenData, boolean isLocalWorld) - { - FMLLog.info("Injecting existing block and item data into this %s instance", FMLCommonHandler.instance().getEffectiveSide().isServer() ? "server" : "client"); - Map remapBlocks = Maps.newHashMap(); - Map remapItems = Maps.newHashMap(); - LinkedHashMap missingBlocks = new LinkedHashMap(); - LinkedHashMap missingItems = new LinkedHashMap(); - getMain().testConsistency(); - getMain().iBlockRegistry.dump(); - getMain().iItemRegistry.dump(); - - getMain().iItemRegistry.resetSubstitutionDelegates(); - - GameDataSnapshot.Entry blocks = snapshot.entries.get("fml:blocks"); - GameDataSnapshot.Entry items = snapshot.entries.get("fml:items"); - - GameData newData = new GameData(); - - for (int id : blocks.blocked) - { - newData.block(id); - } - - for (Map.Entry entry : blocks.aliases.entrySet()) - { - newData.iBlockRegistry.addAlias(entry.getKey(), entry.getValue()); - } - - for (Map.Entry entry : items.aliases.entrySet()) - { - newData.iItemRegistry.addAlias(entry.getKey(), entry.getValue()); - } - - for (String entry : blocks.substitutions) - { - newData.iBlockRegistry.activateSubstitution(entry); - } - for (String entry : items.substitutions) - { - newData.iItemRegistry.activateSubstitution(entry); - } - if (injectFrozenData) - { - for (String newBlockSubstitution : getMain().blockSubstitutions.keySet()) - { - if (!blocks.substitutions.contains(newBlockSubstitution)) - { - newData.iBlockRegistry.activateSubstitution(newBlockSubstitution); - } - } - for (String newItemSubstitution : getMain().itemSubstitutions.keySet()) - { - if (!items.substitutions.contains(newItemSubstitution)) - { - newData.iItemRegistry.activateSubstitution(newItemSubstitution); - } - } - } - - // Clear State map for it's ready for us to register below. - GameData.BLOCKSTATE_TO_ID.clear(); - - // process blocks and items in the world, blocks in the first pass, items in the second - // blocks need to be added first for proper ItemBlock handling - for (int pass = 0; pass < 2; pass++) - { - boolean isBlock = (pass == 0); - Map ids = (isBlock ? blocks.ids : items.ids); - - for (Entry entry : ids.entrySet()) - { - String itemName = entry.getKey(); - int newId = entry.getValue(); - int currId = isBlock ? getMain().iBlockRegistry.getId(itemName) : getMain().iItemRegistry.getId(itemName); - - if (currId == -1) - { - FMLLog.info("Found a missing id from the world %s", itemName); - (isBlock ? missingBlocks : missingItems).put(entry.getKey(), newId); - continue; // no block/item -> nothing to add - } - else if (currId != newId) - { - FMLLog.fine("Fixed %s id mismatch %s: %d (init) -> %d (map).", isBlock ? "block" : "item", itemName, currId, newId); - (isBlock ? remapBlocks : remapItems).put(itemName, new Integer[] { currId, newId }); - } - - // register - if (isBlock) - { - currId = newData.registerBlock(getMain().iBlockRegistry.getRaw(itemName), itemName, newId); - } - else - { - currId = newData.registerItem(getMain().iItemRegistry.getRaw(itemName), itemName, newId); - } - - if (currId != newId) - { - throw new IllegalStateException(String.format("Can't map %s %s to id %d (seen at: %d), already occupied by %s, blocked %b, ItemBlock %b", - isBlock ? "block" : "item", - itemName, - newId, - currId, - isBlock ? newData.iBlockRegistry.getRaw(newId) : newData.iItemRegistry.getRaw(newId), - newData.blockedIds.contains(newId), - isBlock ? false : (getMain().iItemRegistry.getRaw(currId) instanceof ItemBlock))); - } - } - } - - List missedMappings = Loader.instance().fireMissingMappingEvent(missingBlocks, missingItems, isLocalWorld, newData, remapBlocks, remapItems); - if (!missedMappings.isEmpty()) return missedMappings; - - // If we got here - the load was accepted. We'll load generic repositories here. - // Generic registries can fail by returning a missing mapping. - missedMappings = newData.loadGenericRegistries(snapshot, getMain()); - if (!missedMappings.isEmpty()) return missedMappings; - - if (injectFrozenData) // add blocks + items missing from the map - { - Map newBlocks = frozen.iBlockRegistry.getEntriesNotIn(newData.iBlockRegistry); - Map newItems = frozen.iItemRegistry.getEntriesNotIn(newData.iItemRegistry); - - if (!newBlocks.isEmpty() || !newItems.isEmpty()) - { - FMLLog.info("Injecting new block and item data into this server instance."); - - for (int pass = 0; pass < 2; pass++) - { - boolean isBlock = pass == 0; - Map missing = (pass == 0) ? newBlocks : newItems; - Map remaps = (isBlock ? remapBlocks : remapItems); - - for (Entry entry : missing.entrySet()) - { - String itemName = entry.getKey(); - int currId = entry.getValue(); - int newId; - - if (isBlock) - { - newId = newData.registerBlock(frozen.iBlockRegistry.getRaw(itemName), itemName, currId); - } - else - { - newId = newData.registerItem(frozen.iItemRegistry.getRaw(itemName), itemName, currId); - } - - FMLLog.info("Injected new block/item %s: %d (init) -> %d (map).", itemName, currId, newId); - - if (newId != currId) // a new id was assigned - { - remaps.put(itemName, new Integer[] { entry.getValue(), newId }); - } - } - } - } - } - - newData.testConsistency(); - getMain().set(newData); - - getMain().iBlockRegistry.dump(); - getMain().iItemRegistry.dump(); - Loader.instance().fireRemapEvent(remapBlocks, remapItems); - // The id map changed, ensure we apply object holders - ObjectHolderRegistry.INSTANCE.applyObjectHolders(); - return ImmutableList.of(); - } - - public static List processIdRematches(Iterable missedMappings, boolean isLocalWorld, GameData gameData, Map remapBlocks, Map remapItems) - { - List failed = Lists.newArrayList(); - List ignored = Lists.newArrayList(); - List warned = Lists.newArrayList(); - List defaulted = Lists.newArrayList(); - - for (MissingMapping remap : missedMappings) - { - FMLMissingMappingsEvent.Action action = remap.getAction(); - - if (action == FMLMissingMappingsEvent.Action.REMAP) - { - // block/item re-mapped, finish the registration with the new name/object, but the old id - int currId, newId; - String newName; - - if (remap.type == Type.BLOCK) - { - currId = getMain().iBlockRegistry.getId((Block) remap.getTarget()); - newName = getMain().iBlockRegistry.getNameForObject(remap.getTarget()).toString(); - FMLLog.fine("The Block %s is being remapped to %s.", remap.name, newName); - - newId = gameData.registerBlock((Block) remap.getTarget(), newName, remap.id); - gameData.iBlockRegistry.addAlias(remap.name, newName); - } - else - { - currId = getMain().iItemRegistry.getId((Item) remap.getTarget()); - newName = getMain().iItemRegistry.getNameForObject(remap.getTarget()).toString(); - FMLLog.fine("The Item %s is being remapped to %s.", remap.name, newName); - - newId = gameData.registerItem((Item) remap.getTarget(), newName, remap.id); - gameData.iItemRegistry.addAlias(remap.name, newName); - } - - if (newId != remap.id) throw new IllegalStateException(); - - if (currId != newId) - { - FMLLog.info("Fixed %s id mismatch %s: %d (init) -> %d (map).", remap.type == Type.BLOCK ? "block" : "item", newName, currId, newId); - (remap.type == Type.BLOCK ? remapBlocks : remapItems).put(newName, new Integer[] { currId, newId }); - } - } - else if (action == FMLMissingMappingsEvent.Action.BLOCKONLY) - { - // Pulled out specifically so the block doesn't get reassigned a new ID just because it's - // Item block has gone away - FMLLog.fine("The ItemBlock %s is no longer present in the game. The residual block will remain", remap.name); - } - else - { - // block item missing, warn as requested and block the id - if (action == FMLMissingMappingsEvent.Action.DEFAULT) - { - defaulted.add(remap.name); - } - else if (action == FMLMissingMappingsEvent.Action.IGNORE) - { - ignored.add(remap.name); - } - else if (action == FMLMissingMappingsEvent.Action.FAIL) - { - failed.add(remap.name); - } - else if (action == FMLMissingMappingsEvent.Action.WARN) - { - warned.add(remap.name); - } - - gameData.block(remap.id); // prevent the id from being reused later - } - } - - if (!defaulted.isEmpty()) - { - String text = "Forge Mod Loader detected missing blocks/items.\n\n" + - "There are "+defaulted.size()+" missing blocks and items in this save.\n" + - "If you continue the missing blocks/items will get removed.\n" + - "A world backup will be automatically created in your saves directory.\n\n" + - "Missing Blocks/Items:\n"; - - for (String s : defaulted) text += s + "\n"; - - boolean confirmed = StartupQuery.confirm(text); - if (!confirmed) StartupQuery.abort(); - - try - { - String skip = System.getProperty("fml.doNotBackup"); - if (skip == null || !"true".equals(skip)) - { - ZipperUtil.backupWorld(); - } - else - { - for (int x = 0; x < 10; x++) - FMLLog.severe("!!!!!!!!!! UPDATING WORLD WITHOUT DOING BACKUP !!!!!!!!!!!!!!!!"); - } - } - catch (IOException e) - { - StartupQuery.notify("The world backup couldn't be created.\n\n"+e); - StartupQuery.abort(); - } - - warned.addAll(defaulted); - } - if (!failed.isEmpty()) - { - FMLLog.severe("This world contains blocks and items that refuse to be remapped. The world will not be loaded"); - return failed; - } - if (!warned.isEmpty()) - { - FMLLog.severe("This world contains block and item mappings that may cause world breakage"); - return failed; - } - else if (!ignored.isEmpty()) - { - FMLLog.fine("There were %d missing mappings that have been ignored", ignored.size()); - } - return failed; - } - - public static void freezeData() - { - FMLLog.fine("Freezing block and item id maps"); - - getMain().testConsistency(); - frozen = new GameData(getMain()); - frozen.testConsistency(); - } - - public static void revertToFrozen() - { - if (frozen == null) - { - FMLLog.warning("Can't revert to frozen GameData state without freezing first."); - } - else - { - FMLLog.fine("Reverting to frozen data state."); - - getMain().set(frozen); - } - // the id mapping has reverted, fire remap events for those that care about id changes - Loader.instance().fireRemapEvent(ImmutableMap.of(), ImmutableMap.of()); - // the id mapping has reverted, ensure we sync up the object holders - ObjectHolderRegistry.INSTANCE.applyObjectHolders(); - } - - protected static boolean isFrozen(FMLControlledNamespacedRegistry registry) - { - return frozen != null && (getMain().iBlockRegistry == registry || getMain().iItemRegistry == registry); - } - - protected static GameData getMain() - { + protected static GameData getMain() { return mainData; } // internal registry objects - private final FMLControlledNamespacedRegistry iBlockRegistry; - private final FMLControlledNamespacedRegistry iItemRegistry; - // bit set marking ids as occupied - private final BitSet availabilityMap; - // IDs previously allocated in a world, but now unmapped/dangling; prevents the IDs from being reused - private final Set blockedIds; - - private GameData() - { - iBlockRegistry = new FMLControlledNamespacedRegistry(new ResourceLocation("minecraft:air"), MAX_BLOCK_ID, MIN_BLOCK_ID, Block.class); - iItemRegistry = new FMLControlledNamespacedRegistry(null, MAX_ITEM_ID, MIN_ITEM_ID, Item.class); - availabilityMap = new BitSet(MAX_ITEM_ID + 1); - blockedIds = new HashSet(); - genericRegistries = new HashMap>(); - } - - private GameData(GameData data) - { - this(); - set(data); - } - - private void set(GameData data) - { - iBlockRegistry.set(data.iBlockRegistry); - iItemRegistry.set(data.iItemRegistry); - availabilityMap.clear(); - availabilityMap.or(data.availabilityMap); - blockedIds.clear(); - blockedIds.addAll(data.blockedIds); - copyGenericRegistries(data); - } - - private void copyGenericRegistries(GameData data) { - for (Map.Entry> e : data.genericRegistries.entrySet()) { - FMLControlledNamespacedRegistry orig = e.getValue(); - FMLControlledNamespacedRegistry copy = orig.makeShallowCopy(); - // UGLY AS FUCK - copy.setFrom(orig); - genericRegistries.put(e.getKey(), copy); - } - } - - int register(Object obj, String name, int idHint) // from FMLControlledNamespacedRegistry.addObject - { - if (obj instanceof Block) - { - // tolerate extra name prefixes here since mc does it as well - name = addPrefix(name); - - return registerBlock((Block) obj, name, idHint); - } - else if (obj instanceof Item) - { - // tolerate extra name prefixes here since mc does it as well - name = addPrefix(name); - - return registerItem((Item) obj, name, idHint); - } - else - { - return findRegistry(obj.getClass()).add(idHint,name,obj); - } - } + private final FMLControlledNamespacedRegistry iBlockRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.BLOCKS, Block.class, new ResourceLocation("minecraft:air"), MAX_BLOCK_ID, MIN_BLOCK_ID, true); + private final FMLControlledNamespacedRegistry iItemRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.ITEMS, Item.class, null, MAX_ITEM_ID, MIN_ITEM_ID, true); int registerItem(Item item, String name) // from GameRegistry { int index = name.indexOf(':'); - if (name.indexOf(':') != -1) FMLLog.bigWarning("Illegal extra prefix %s for name %s, invalid registry invocation/invalid name?", name.substring(0, index), name); + if (index != -1) + FMLLog.bigWarning("Dangerous extra prefix %s for name %s, invalid registry invocation/invalid name?", name.substring(0, index), name); - name = addPrefix(name); - return registerItem(item, name, -1); + ResourceLocation rl = addPrefix(name); + return registerItem(item, rl, -1); } - private int registerItem(Item item, String name, int idHint) - { - if (item instanceof ItemBlock && !(item instanceof ItemBanner)) // ItemBlock, adjust id and clear the slot already occupied by the corresponding block - { - Block block = ((ItemBlock) item).block; - if (idHint != -1 && getMain().blockSubstitutions.containsKey(name)) - { - block = getMain().blockSubstitutions.get(name); - } - int id = iBlockRegistry.getId(block); - - if (id == -1) // ItemBlock before its Block - { - if (idHint < 0 || availabilityMap.get(idHint) || idHint > MAX_BLOCK_ID) // non-suitable id, allocate one in the block id range, add would use the item id range otherwise - { - id = availabilityMap.nextClearBit(MIN_BLOCK_ID); // find suitable id here, iItemRegistry would search from MIN_ITEM_ID - if (id > MAX_BLOCK_ID) throw new RuntimeException(String.format("Invalid id %d - maximum id range exceeded.", id)); - FMLLog.fine("Allocated id %d for ItemBlock %s in the block id range, original id requested: %d.", id, name, idHint); - } - else // idHint is suitable without changes - { - id = idHint; - } - } - else // ItemBlock after its Block - { - if (FMLControlledNamespacedRegistry.DEBUG) - FMLLog.fine("Found matching Block %s for ItemBlock %s at id %d, original id requested: %d", block, item, id, idHint); - freeSlot(id, item); // temporarily free the slot occupied by the Block for the item registration - } - - idHint = id; - } - - int itemId = iItemRegistry.add(idHint, name, item, availabilityMap); - - if (item instanceof ItemBlock) // verify - { - if (itemId != idHint) throw new IllegalStateException(String.format("ItemBlock at block id %d insertion failed, got id %d.", idHint, itemId)); - verifyItemBlockName((ItemBlock) item); - } - - // block the Block Registry slot with the same id - useSlot(itemId); - ((RegistryDelegate.Delegate) item.delegate).setName(name); - return itemId; + private int registerItem(Item item, ResourceLocation name, int idHint) { + return iItemRegistry.add(idHint, name, item); } int registerBlock(Block block, String name) // from GameRegistry { int index = name.indexOf(':'); - if (name.indexOf(':') != -1) FMLLog.bigWarning("Illegal extra prefix %s for name %s, invalid registry invocation/invalid name?", name.substring(0, index), name); + if (index != -1) + FMLLog.bigWarning("Dangerous alternative prefix %s for name %s, invalid registry invocation/invalid name?", name.substring(0, index), name); - name = addPrefix(name); - return registerBlock(block, name, -1); + ResourceLocation rl = addPrefix(name); + return registerBlock(block, rl, -1); } - private int registerBlock(Block block, String name, int idHint) - { - // handle ItemBlock-before-Block registrations - ItemBlock itemBlock = null; + private int registerBlock(Block block, ResourceLocation name, int idHint) { + int blockId = iBlockRegistry.add(idHint, name, block); - for (Item item : iItemRegistry.typeSafeIterable()) // find matching ItemBlock - { - if (item instanceof ItemBlock && ((ItemBlock) item).block == block) - { - itemBlock = (ItemBlock) item; - break; - } - } - - if (itemBlock != null) // has ItemBlock, adjust id and clear the slot already occupied by the corresponding item - { - idHint = iItemRegistry.getId(itemBlock); - FMLLog.fine("Found matching ItemBlock %s for Block %s at id %d", itemBlock, block, idHint); - freeSlot(idHint, block); // temporarily free the slot occupied by the Item for the block registration - } - - // add - int blockId = iBlockRegistry.add(idHint, name, block, availabilityMap); - - if (itemBlock != null) // verify - { - if (blockId != idHint) throw new IllegalStateException(String.format("Block at itemblock id %d insertion failed, got id %d.", idHint, blockId)); - verifyItemBlockName(itemBlock); - } - - useSlot(blockId); - ((RegistryDelegate.Delegate) block.delegate).setName(name); - - for (IBlockState state : ((List)block.getBlockState().getValidStates())) - { + for (IBlockState state : block.getBlockState().getValidStates()) { GameData.BLOCKSTATE_TO_ID.put(state, blockId << 4 | block.getMetaFromState(state)); } return blockId; } - /** - * Block the specified id from being reused. - */ - private void block(int id) - { - blockedIds.add(id); - useSlot(id); - } - - private void useSlot(int id) - { - availabilityMap.set(id); - } - - /** - * Free the specified slot. - * - * The slot must not be occupied by something else than the specified object within the same type. - * The same object is permitted for handling duplicate registrations. - * - * @param id id to free - * @param obj object allowed besides different types (block vs item) - */ - private void freeSlot(int id, Object obj) - { - FMLControlledNamespacedRegistry registry = (obj instanceof Block) ? iBlockRegistry : iItemRegistry; - Object thing = registry.getRaw(id); - - if (thing != null && thing != obj) - { - throw new IllegalStateException(String.format("Can't free registry slot %d occupied by %s", id, thing)); - } - - availabilityMap.clear(id); - } - /** * Prefix the supplied name with the current mod id. - * + *

* If no mod id can be determined, minecraft will be assumed. * The prefix is separated with a colon. - * + *

* If there's already a prefix, it'll be prefixed again if the new prefix * doesn't match the old prefix, as used by vanilla calls to addObject. * * @param name name to prefix. * @return prefixed name. */ - private String addPrefix(String name) - { + private ResourceLocation addPrefix(String name) { int index = name.lastIndexOf(':'); String oldPrefix = index == -1 ? "" : name.substring(0, index); String prefix; ModContainer mc = Loader.instance().activeModContainer(); - if (mc != null) - { + if (mc != null) { prefix = mc.getModId(); - } - else // no mod container, assume minecraft + } else // no mod container, assume minecraft { prefix = "minecraft"; } - if (!oldPrefix.equals(prefix)) - { - name = prefix + ":" + name; + if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0) { + prefix = oldPrefix; } - return name; + return new ResourceLocation(prefix,name); } - private void verifyItemBlockName(ItemBlock item) - { - Object blockName = iBlockRegistry.getNameForObject(item.block); - Object itemName = iItemRegistry.getNameForObject(item); - - //Vanilla has a mismatch: - //Block <-> ItemBlock name mismatch, block name minecraft:standing_banner, item name minecraft:banner - //TODO: Untie these in the rest of the registry - if (blockName != null && !blockName.equals(itemName) && !"minecraft:standing_banner".equals(blockName.toString())) - { - FMLLog.bigWarning("Block <-> ItemBlock name mismatch, block name %s, item name %s", blockName, itemName); - } - } - - private void testConsistency() { - // test if there's an entry for every set bit in availabilityMap - for (int i = availabilityMap.nextSetBit(0); i >= 0; i = availabilityMap.nextSetBit(i+1)) - { - if (iBlockRegistry.getRaw(i) == null && iItemRegistry.getRaw(i) == null && !blockedIds.contains(i)) - { - throw new IllegalStateException(String.format("availabilityMap references empty entries for id %d.", i)); - } - } - - for (int pass = 0; pass < 2; pass++) - { - boolean isBlock = pass == 0; - String type = isBlock ? "block" : "item"; - FMLControlledNamespacedRegistry registry = isBlock ? iBlockRegistry : iItemRegistry; - registry.validateContent((isBlock ? MAX_BLOCK_ID : MAX_ITEM_ID), type, availabilityMap, blockedIds, iBlockRegistry); - } - - FMLLog.fine("Registry consistency check successful"); - } - - void registerSubstitutionAlias(String nameToSubstitute, Type type, Object toReplace) throws ExistingSubstitutionException - { - type.getRegistry().addSubstitutionAlias(Loader.instance().activeModContainer().getModId(),nameToSubstitute, toReplace); - type.getRegistry().activateSubstitution(nameToSubstitute); - } - static RegistryDelegate buildDelegate(T referant, Class type) - { - return new RegistryDelegate.Delegate(referant, type); - } - - private BiMap itemSubstitutions = HashBiMap.create(); - private BiMap blockSubstitutions = HashBiMap.create(); - BiMap getPersistentSubstitutionMap(Class type) - { - if (type.equals(Item.class)) - { - return (BiMap) itemSubstitutions; - } - else if (type.equals(Block.class)) - { - return (BiMap) blockSubstitutions; - } - else - { - return ImmutableBiMap.of(); + void registerSubstitutionAlias(String name, Type type, Object toReplace) throws ExistingSubstitutionException { + ResourceLocation nameToSubstitute = new ResourceLocation(Loader.instance().activeModContainer().getModId(), name); + if (type == Type.BLOCK) { + iBlockRegistry.addSubstitutionAlias(Loader.instance().activeModContainer().getModId(), nameToSubstitute, (Block) toReplace); + iBlockRegistry.activateSubstitution(nameToSubstitute); + } else if (type == Type.ITEM) { + iItemRegistry.addSubstitutionAlias(Loader.instance().activeModContainer().getModId(), nameToSubstitute, (Item) toReplace); + iItemRegistry.activateSubstitution(nameToSubstitute); } } private static Map BLOCK_TO_ITEM = Maps.newHashMap(); + //Internal: DO NOT USE, will change without warning. - public static Map getBlockItemMap() - { + public static Map getBlockItemMap() { return BLOCK_TO_ITEM; } - private static ClearableObjectIntIdentityMap BLOCKSTATE_TO_ID = new ClearableObjectIntIdentityMap(); + private static ClearableObjectIntIdentityMap BLOCKSTATE_TO_ID = new ClearableObjectIntIdentityMap(); + //Internal: DO NOT USE, will change without warning. - public static ObjectIntIdentityMap getBlockStateIDMap() - { + public static ObjectIntIdentityMap getBlockStateIDMap() { return BLOCKSTATE_TO_ID; } //Lets us clear the map so we can rebuild it. - private static class ClearableObjectIntIdentityMap extends ObjectIntIdentityMap - { - private void clear() - { + private static class ClearableObjectIntIdentityMap extends ObjectIntIdentityMap { + private void clear() { this.identityMap.clear(); this.objectList.clear(); } } - private Map> genericRegistries; - // Seed registry types with the blocks and items types so you can't make a new registry of them - private BiMap> registryTypes = HashBiMap.create( - ImmutableMap.>builder() - .put("minecraft:blocks", Block.class) - .put("minecraft:items", Item.class).build()); - - private void findSuperTypes(Class type, Set> types) { - if (type == null || type == Object.class) { - return; - } - types.add(type); - for (Class intf : type.getInterfaces()) { - findSuperTypes(intf, types); - } - findSuperTypes(type.getSuperclass(),types); + public RegistryDelegate makeDelegate(T obj, Class rootClass) { + return PersistentRegistryManager.makeDelegate(obj, rootClass); } - - private FMLControlledNamespacedRegistry getGenericRegistry(String registryName, Class type) { - FMLControlledNamespacedRegistry fmlControlledNamespacedRegistry = genericRegistries.get(registryName); - return (FMLControlledNamespacedRegistry) fmlControlledNamespacedRegistry; - } - - private FMLControlledNamespacedRegistry createGenericRegistry(String registryName, Class type, int minId, int maxId) { - Set> parents = Sets.newHashSet(); - findSuperTypes(type, parents); - SetView> overlappedTypes = Sets.intersection(parents, registryTypes.values()); - if (!overlappedTypes.isEmpty()) { - Class foundType = overlappedTypes.iterator().next(); - FMLLog.severe("Found existing registry of type %1s named %2s, you cannot create a new registry (%3s) with type %4s, as %4s has a parent of that type", foundType, registryTypes.inverse().get(foundType), registryName, type); - throw new IllegalArgumentException("Duplicate registry parent type found - you can only have one registry for a particular super type"); - } - FMLControlledNamespacedRegistry fmlControlledNamespacedRegistry = new FMLControlledNamespacedRegistry(null, maxId, minId, type); - genericRegistries.put(registryName, fmlControlledNamespacedRegistry); - registryTypes.put(registryName, type); - return (FMLControlledNamespacedRegistry) fmlControlledNamespacedRegistry; - } - - public static FMLControlledNamespacedRegistry createRegistry(String registryName, Class type, int minId, int maxId) { - return getMain().createGenericRegistry(registryName, type, minId, maxId); - } - - private FMLControlledNamespacedRegistry findRegistry(Class type) { - BiMap, String> typeReg = registryTypes.inverse(); - String name = typeReg.get(type); - if (name == null) { - Set> parents = Sets.newHashSet(); - findSuperTypes(type, parents); - SetView> foundType = Sets.intersection(parents, registryTypes.values()); - if (foundType.isEmpty()) { - FMLLog.severe("Unable to find registry for type %s", type.getName()); - throw new IllegalArgumentException("Attempt to register an object without an associated registry"); - } - Class regtype = Iterables.getOnlyElement(foundType); - name = typeReg.get(regtype); - } - return genericRegistries.get(name); - } - private List loadGenericRegistries(GameDataSnapshot snapshot, GameData existing) { - List result = Lists.newArrayList(); - for (Map.Entry> e : existing.genericRegistries.entrySet()) - { - String regName = e.getKey(); - FMLControlledNamespacedRegistry registry = e.getValue(); - FMLControlledNamespacedRegistry newRegistry = genericRegistries.get(regName); - if (newRegistry == null) - { - newRegistry = registry.makeShallowCopy(); - genericRegistries.put(regName, newRegistry); - } - - GameDataSnapshot.Entry regSnap = snapshot.entries.get("fmlgr:"+regName); - if (regSnap == null) { - FMLLog.info("Weird, there was no registry data for registry %s found in the snapshot", regName); - continue; - } - - for (Entry entry : regSnap.ids.entrySet()) - { - String entryName = entry.getKey(); - int entryId = entry.getValue(); - int currId = registry.getId(entryName); - - if (currId == -1) - { - FMLLog.info("Found a missing id in registry %s from the world %s", regName, entryName); - result.add(regName+"{"+entryName+"}="+entryId); - continue; // no block/item -> nothing to add - } - else if (currId != entryId) - { - FMLLog.fine("Fixed registry %s id mismatch %s: %d (init) -> %d (map).", regName, entryName, currId, entryId); - } - - - newRegistry.add(entryId, entryName, registry.getRaw(entryName)); - - } - } - return result; - } - - public static FMLControlledNamespacedRegistry getRegistry(String registryName, Class type) { - return getMain().getGenericRegistry(registryName, type); - } - - - -} +} \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java index 6f2ff27e1..99b5bca70 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java @@ -392,22 +392,8 @@ public class GameRegistry } public enum Type { - BLOCK - { - @Override - public FMLControlledNamespacedRegistry getRegistry() { - return GameData.getBlockRegistry(); - } - }, - ITEM - { - @Override - public FMLControlledNamespacedRegistry getRegistry() { - return GameData.getItemRegistry(); - } - }; - - public abstract FMLControlledNamespacedRegistry getRegistry(); + BLOCK, + ITEM; } /** * Look up the mod identifier data for a block. @@ -505,7 +491,7 @@ public class GameRegistry public static ItemStack makeItemStack(String itemName, int meta, int stackSize, String nbtString) { if (itemName == null) throw new IllegalArgumentException("The itemName cannot be null"); - Item item = GameData.getItemRegistry().getObject(itemName); + Item item = GameData.getItemRegistry().getObject(new ResourceLocation(itemName)); if (item == null) { FMLLog.getLogger().log(Level.TRACE, "Unable to find item with name {}", itemName); return null; diff --git a/src/main/java/net/minecraftforge/fml/common/registry/IncompatibleSubstitutionException.java b/src/main/java/net/minecraftforge/fml/common/registry/IncompatibleSubstitutionException.java index b40b341cc..778efa1bf 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/IncompatibleSubstitutionException.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/IncompatibleSubstitutionException.java @@ -1,7 +1,9 @@ package net.minecraftforge.fml.common.registry; +import net.minecraft.util.ResourceLocation; + public class IncompatibleSubstitutionException extends RuntimeException { - public IncompatibleSubstitutionException(String fromName, Object replacement, Object original) + public IncompatibleSubstitutionException(ResourceLocation fromName, Object replacement, Object original) { super(String.format("The substitute %s for %s (type %s) is type incompatible.", replacement.getClass().getName(), fromName, original.getClass().getName())); } diff --git a/src/main/java/net/minecraftforge/fml/common/registry/ObjectHolderRef.java b/src/main/java/net/minecraftforge/fml/common/registry/ObjectHolderRef.java index 2eb7743f9..15946999f 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/ObjectHolderRef.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/ObjectHolderRef.java @@ -4,6 +4,7 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; +import net.minecraft.util.ResourceLocation; import org.apache.logging.log4j.Level; import com.google.common.base.Throwables; @@ -23,12 +24,12 @@ import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder; */ class ObjectHolderRef { private Field field; - private String injectedObject; + private ResourceLocation injectedObject; private boolean isBlock; private boolean isItem; - ObjectHolderRef(Field field, String injectedObject, boolean extractFromExistingValues) + ObjectHolderRef(Field field, ResourceLocation injectedObject, boolean extractFromExistingValues) { this.field = field; this.isBlock = Block.class.isAssignableFrom(field.getType()); @@ -49,10 +50,9 @@ class ObjectHolderRef { } else { - @SuppressWarnings("unchecked") - Object tmp = isBlock ? GameData.getBlockRegistry().getNameForObject(existing) : - isItem ? GameData.getItemRegistry().getNameForObject(existing) : null; - this.injectedObject = tmp != null ? tmp.toString() : null; + ResourceLocation tmp = isBlock ? GameData.getBlockRegistry().getNameForObject((Block)existing) : + isItem ? GameData.getItemRegistry().getNameForObject((Item)existing) : null; + this.injectedObject = tmp; } } catch (Exception e) { diff --git a/src/main/java/net/minecraftforge/fml/common/registry/ObjectHolderRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/ObjectHolderRegistry.java index ca6da5418..9d56cace7 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/ObjectHolderRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/ObjectHolderRegistry.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.discovery.ASMDataTable; import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData; @@ -97,7 +98,7 @@ public enum ObjectHolderRegistry { try { Field f = clazz.getField(annotationTarget); - addHolderReference(new ObjectHolderRef(f, value, extractFromValue)); + addHolderReference(new ObjectHolderRef(f, new ResourceLocation(value), extractFromValue)); } catch (Exception ex) { @@ -118,7 +119,7 @@ public enum ObjectHolderRegistry { { continue; } - addHolderReference(new ObjectHolderRef(f, value + ":"+ f.getName(), extractFromExistingValues)); + addHolderReference(new ObjectHolderRef(f, new ResourceLocation(value, f.getName()), extractFromExistingValues)); } } diff --git a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java new file mode 100644 index 000000000..7667a84e3 --- /dev/null +++ b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java @@ -0,0 +1,407 @@ +package net.minecraftforge.fml.common.registry; + +import java.io.IOException; +import java.util.*; + +import com.google.common.base.Function; +import com.google.common.collect.*; +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraftforge.fml.common.*; +import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent; +import org.apache.logging.log4j.Level; + +import com.google.common.collect.Sets.SetView; + +import net.minecraft.util.ResourceLocation; + +import javax.annotation.Nullable; + +/** + * Persistent registry manager. Manages the registries loading from disk, and from network. Handles staging + * registry data before loading uniformly into the active registry, and keeps a frozen registry instance + * for reversion after connection. + * @author cpw + */ +public class PersistentRegistryManager +{ + private enum PersistentRegistry { + ACTIVE, FROZEN, STAGING; + + private final BiMap> registries = HashBiMap.create(); + private final BiMap,ResourceLocation> registrySuperTypes = HashBiMap.create(); + + @SuppressWarnings("unchecked") + FMLControlledNamespacedRegistry getRegistry(ResourceLocation key, Class regType) + { + return (FMLControlledNamespacedRegistry) registries.get(key); + } + + FMLControlledNamespacedRegistry getOrShallowCopyRegistry(ResourceLocation key, Class regType, FMLControlledNamespacedRegistry other) + { + if (!registries.containsKey(key)) { + registries.put(key, other.makeShallowCopy()); + registrySuperTypes.put(regType, key); + } + return getRegistry(key, regType); + } + + private FMLControlledNamespacedRegistry createRegistry(ResourceLocation registryName, Class type, ResourceLocation defaultObjectKey, int minId, int maxId, boolean isDelegated) { + Set> parents = Sets.newHashSet(); + findSuperTypes(type, parents); + SetView> overlappedTypes = Sets.intersection(parents, registrySuperTypes.keySet()); + if (!overlappedTypes.isEmpty()) { + Class foundType = overlappedTypes.iterator().next(); + FMLLog.severe("Found existing registry of type %1s named %2s, you cannot create a new registry (%3s) with type %4s, as %4s has a parent of that type", foundType, registrySuperTypes.get(foundType), registryName, type); + throw new IllegalArgumentException("Duplicate registry parent type found - you can only have one registry for a particular super type"); + } + FMLControlledNamespacedRegistry fmlControlledNamespacedRegistry = new FMLControlledNamespacedRegistry(defaultObjectKey, maxId, minId, type, isDelegated); + registries.put(registryName, fmlControlledNamespacedRegistry); + registrySuperTypes.put(type, registryName); + return getRegistry(registryName, type); + } + + private void findSuperTypes(Class type, Set> types) + { + if (type == null || type == Object.class) { + return; + } + types.add(type); + for (Class interfac : type.getInterfaces()) { + findSuperTypes(interfac, types); + } + findSuperTypes(type.getSuperclass(),types); + } + + + void clean() { + registries.clear(); + registrySuperTypes.clear(); + } + + boolean isPopulated() { + return !registries.isEmpty(); + } + + boolean containsRegistry(FMLControlledNamespacedRegistry registry) { + return registries.containsValue(registry); + } + + public FMLControlledNamespacedRegistry getRegistry(Class rootClass) { + ResourceLocation rl = registrySuperTypes.get(rootClass); + return getRegistry(rl, rootClass); + } + } + + public static final ResourceLocation BLOCKS = new ResourceLocation("minecraft:blocks"); + public static final ResourceLocation ITEMS = new ResourceLocation("minecraft:items"); + + public static FMLControlledNamespacedRegistry createRegistry(ResourceLocation registryName, Class registryType, ResourceLocation optionalDefaultKey, int maxId, int minId, boolean hasDelegates) { + return PersistentRegistry.ACTIVE.createRegistry(registryName,registryType,optionalDefaultKey,minId, maxId, hasDelegates); + } + + + public static List injectSnapshot(GameDataSnapshot snapshot, boolean injectFrozenData, boolean isLocalWorld) { + FMLLog.info("Injecting existing block and item data into this {} instance", FMLCommonHandler.instance().getEffectiveSide().isServer() ? "server" : "client"); + final Map> remaps = Maps.newHashMap(); + final LinkedHashMap> missing = Maps.newLinkedHashMap(); + + forAllRegistries(PersistentRegistry.ACTIVE, ValidateRegistryFunction.OPERATION); + forAllRegistries(PersistentRegistry.ACTIVE, DumpRegistryFunction.OPERATION); + forAllRegistries(PersistentRegistry.ACTIVE, ResetDelegatesFunction.OPERATION); + + // Load the snapshot into the "STAGING" registry + for (Map.Entry snapshotEntry : snapshot.entries.entrySet()) + { + loadPersistentDataToStagingRegistry(injectFrozenData, remaps, missing, snapshotEntry, PersistentRegistry.ACTIVE.registrySuperTypes.inverse().get(snapshotEntry.getKey())); + } + + // If we have missed data, fire the missing mapping event + List missedMappings = Loader.instance().fireMissingMappingEvent(missing.get(BLOCKS), missing.get(ITEMS), isLocalWorld, remaps.get(BLOCKS), remaps.get(ITEMS)); + // If there's still missed mappings, we return, because that's an error + if (!missedMappings.isEmpty()) return missedMappings; + + // If we're loading up the world from disk, we want to add in the new data that might have been provisioned by mods + if (injectFrozenData) + { + // So we load it from the frozen persistent registry + for (Map.Entry> r : PersistentRegistry.ACTIVE.registries.entrySet()) { + loadFrozenDataToStagingRegistry(remaps, r.getKey(), PersistentRegistry.ACTIVE.registrySuperTypes.inverse().get(r.getKey())); + } + } + + // Validate that all the STAGING data is good + forAllRegistries(PersistentRegistry.STAGING, ValidateRegistryFunction.OPERATION); + + // Load the STAGING registry into the ACTIVE registry + for (Map.Entry> r : PersistentRegistry.ACTIVE.registries.entrySet()) { + loadRegistry(r.getKey(), PersistentRegistry.STAGING, PersistentRegistry.ACTIVE, PersistentRegistry.ACTIVE.registrySuperTypes.inverse().get(r.getKey())); + } + + // Dump the active registry + forAllRegistries(PersistentRegistry.ACTIVE, DumpRegistryFunction.OPERATION); + + // Tell mods that the ids have changed + Loader.instance().fireRemapEvent(remaps.get(BLOCKS), remaps.get(ITEMS)); + + // The id map changed, ensure we apply object holders + ObjectHolderRegistry.INSTANCE.applyObjectHolders(); + + // Return an empty list, because we're good + return ImmutableList.of(); + } + + private static void forAllRegistries(PersistentRegistry registrySet, Function>, Void> operation) { + for (Map.Entry> r : registrySet.registries.entrySet()) + { + operation.apply(r); + } + } + + private static void loadRegistry(ResourceLocation registryName, PersistentRegistry from, PersistentRegistry to, Class regType) { + FMLControlledNamespacedRegistry fromRegistry = from.getRegistry(registryName, regType); + FMLControlledNamespacedRegistry toRegistry = to.getOrShallowCopyRegistry(registryName, regType, fromRegistry); + toRegistry.set(fromRegistry); + } + + private static void loadFrozenDataToStagingRegistry(Map> remaps, ResourceLocation registryName, Class regType) { + FMLControlledNamespacedRegistry newRegistry = PersistentRegistry.STAGING.getRegistry(registryName, regType); + FMLControlledNamespacedRegistry frozenRegistry = PersistentRegistry.FROZEN.getRegistry(registryName, regType); + newRegistry.loadIds(frozenRegistry.getEntriesNotIn(newRegistry), Maps.newLinkedHashMap(), remaps.get(registryName), frozenRegistry, registryName); + } + + private static void loadPersistentDataToStagingRegistry(boolean injectFrozenData, Map> remaps, LinkedHashMap> missing, Map.Entry snapEntry, Class regType) { + ResourceLocation registryName = snapEntry.getKey(); + FMLControlledNamespacedRegistry currentRegistry = PersistentRegistry.ACTIVE.getRegistry(registryName, regType); + if (currentRegistry == null) { + FMLLog.severe("An unknown persistent registry type {} has been encountered. This Forge instance cannot understand it.", registryName); + StartupQuery.abort(); + } + FMLControlledNamespacedRegistry newRegistry = PersistentRegistry.STAGING.getOrShallowCopyRegistry(registryName, regType, currentRegistry); + GameDataSnapshot.Entry snapshotEntry = snapEntry.getValue(); + Set substitutions = snapshotEntry.substitutions; + if (injectFrozenData) + { + substitutions = Sets.union(snapshotEntry.substitutions, currentRegistry.getActiveSubstitutions()); + } + newRegistry.loadAliases(snapshotEntry.aliases); + newRegistry.loadSubstitutions(substitutions); + newRegistry.loadBlocked(snapshotEntry.blocked); + missing.put(registryName, Maps.newLinkedHashMap()); + remaps.put(registryName, Maps.newHashMap()); + newRegistry.loadIds(snapshotEntry.ids, missing.get(registryName), remaps.get(registryName), currentRegistry, registryName); + } + + public static boolean isFrozen(FMLControlledNamespacedRegistry registry) { + return PersistentRegistry.FROZEN.containsRegistry(registry); + } + + public static void revertToFrozen() { + if (!PersistentRegistry.FROZEN.isPopulated()) { + FMLLog.warning("Can't revert to frozen GameData state without freezing first."); + } else { + FMLLog.fine("Reverting to frozen data state."); + } + for (Map.Entry> r : PersistentRegistry.ACTIVE.registries.entrySet()) { + loadRegistry(r.getKey(), PersistentRegistry.FROZEN, PersistentRegistry.ACTIVE, PersistentRegistry.ACTIVE.registrySuperTypes.inverse().get(r.getKey())); + } + // the id mapping has reverted, fire remap events for those that care about id changes + Loader.instance().fireRemapEvent(ImmutableMap.of(), ImmutableMap.of()); + // the id mapping has reverted, ensure we sync up the object holders + ObjectHolderRegistry.INSTANCE.applyObjectHolders(); + } + + public static void freezeData() { + FMLLog.fine("Freezing block and item id maps"); + for (Map.Entry> r : PersistentRegistry.ACTIVE.registries.entrySet()) { + loadRegistry(r.getKey(), PersistentRegistry.ACTIVE, PersistentRegistry.FROZEN, PersistentRegistry.ACTIVE.registrySuperTypes.inverse().get(r.getKey())); + } + forAllRegistries(PersistentRegistry.FROZEN, ValidateRegistryFunction.OPERATION); + } + + public static List processIdRematches(Iterable missedMappings, boolean isLocalWorld, Map remapBlocks, Map remapItems) { + List failed = Lists.newArrayList(); + List ignored = Lists.newArrayList(); + List warned = Lists.newArrayList(); + List defaulted = Lists.newArrayList(); + + final PersistentRegistry staging = PersistentRegistry.STAGING; + final PersistentRegistry active = PersistentRegistry.ACTIVE; + for (FMLMissingMappingsEvent.MissingMapping remap : missedMappings) { + FMLMissingMappingsEvent.Action action = remap.getAction(); + + if (action == FMLMissingMappingsEvent.Action.REMAP) { + // block/item re-mapped, finish the registration with the new name/object, but the old id + int currId = -1, newId = -1; + ResourceLocation newName; + + if (remap.type == GameRegistry.Type.BLOCK) { + currId = staging.getRegistry(BLOCKS, Block.class).getId((Block) remap.getTarget()); + newName = active.getRegistry(BLOCKS, Block.class).getNameForObject((Block)remap.getTarget()); + FMLLog.fine("The Block %s is being remapped to %s.", remap.name, newName); + + newId = staging.getRegistry(BLOCKS,Block.class).add(remap.id, newName, (Block) remap.getTarget()); + staging.getRegistry(BLOCKS,Block.class).addAlias(remap.resourceLocation, newName); + } else if (remap.type == GameRegistry.Type.ITEM) { + currId = staging.getRegistry(ITEMS, Item.class).getId((Item) remap.getTarget()); + newName = active.getRegistry(ITEMS, Item.class).getNameForObject((Item)remap.getTarget()); + FMLLog.fine("The Item %s is being remapped to %s.", remap.name, newName); + + newId = staging.getRegistry(ITEMS,Item.class).add(remap.id, newName, (Item) remap.getTarget()); + staging.getRegistry(ITEMS,Item.class).addAlias(remap.resourceLocation, newName); + } else { + // currently not remapping non-blocks and items + continue; + } + + if (newId != remap.id) throw new IllegalStateException(); + + if (currId != newId) { + FMLLog.info("Fixed %s id mismatch %s: %d (init) -> %d (map).", remap.type == GameRegistry.Type.BLOCK ? "block" : "item", newName, currId, newId); + (remap.type == GameRegistry.Type.BLOCK ? remapBlocks : remapItems).put(newName, new Integer[]{currId, newId}); + } + } else if (action == FMLMissingMappingsEvent.Action.BLOCKONLY) { + // Pulled out specifically so the block doesn't get reassigned a new ID just because it's + // Item block has gone away + FMLLog.fine("The ItemBlock %s is no longer present in the game. The residual block will remain", remap.name); + } else { + // block item missing, warn as requested and block the id + if (action == FMLMissingMappingsEvent.Action.DEFAULT) { + defaulted.add(remap.name); + } else if (action == FMLMissingMappingsEvent.Action.IGNORE) { + ignored.add(remap.name); + } else if (action == FMLMissingMappingsEvent.Action.FAIL) { + failed.add(remap.name); + } else if (action == FMLMissingMappingsEvent.Action.WARN) { + warned.add(remap.name); + } + // prevent the id from being reused later + if (remap.type == GameRegistry.Type.BLOCK) { + staging.getRegistry(BLOCKS, Block.class).blockId(remap.id); + } else if (remap.type == GameRegistry.Type.ITEM) { + staging.getRegistry(ITEMS, Item.class).blockId(remap.id); + } + } + } + + if (!defaulted.isEmpty()) { + String text = "Forge Mod Loader detected missing blocks/items.\n\n" + + "There are " + defaulted.size() + " missing blocks and items in this save.\n" + + "If you continue the missing blocks/items will get removed.\n" + + "A world backup will be automatically created in your saves directory.\n\n" + + "Missing Blocks/Items:\n"; + + for (String s : defaulted) text += s + "\n"; + + boolean confirmed = StartupQuery.confirm(text); + if (!confirmed) StartupQuery.abort(); + + try { + String skip = System.getProperty("fml.doNotBackup"); + if (skip == null || !"true".equals(skip)) { + ZipperUtil.backupWorld(); + } else { + for (int x = 0; x < 10; x++) + FMLLog.severe("!!!!!!!!!! UPDATING WORLD WITHOUT DOING BACKUP !!!!!!!!!!!!!!!!"); + } + } catch (IOException e) { + StartupQuery.notify("The world backup couldn't be created.\n\n" + e); + StartupQuery.abort(); + } + + warned.addAll(defaulted); + } + if (!failed.isEmpty()) { + FMLLog.severe("This world contains blocks and items that refuse to be remapped. The world will not be loaded"); + return failed; + } + if (!warned.isEmpty()) { + FMLLog.warning("This world contains block and item mappings that may cause world breakage"); + return failed; + } else if (!ignored.isEmpty()) { + FMLLog.fine("There were %d missing mappings that have been ignored", ignored.size()); + } + return failed; + } + + + public static GameDataSnapshot takeSnapshot() { + final GameDataSnapshot snap = new GameDataSnapshot(); + forAllRegistries(PersistentRegistry.ACTIVE, new Function>, Void>() { + @Override + public Void apply(Map.Entry> input) { + snap.entries.put(input.getKey(), new GameDataSnapshot.Entry(input.getValue())); + return null; + } + }); + return snap; + } + + + public static class GameDataSnapshot { + public static class Entry { + public final Map ids; + public final Set substitutions; + public final Map aliases; + public final Set blocked; + + public Entry() { + this(new HashMap(), new HashSet(), new HashMap(), new HashSet()); + } + + public Entry(Map ids, Set substitutions, Map aliases, Set blocked) { + this.ids = ids; + this.substitutions = substitutions; + this.aliases = aliases; + this.blocked = blocked; + } + + public Entry(FMLControlledNamespacedRegistry registry) { + this.ids = Maps.newHashMap(); + this.substitutions = Sets.newHashSet(); + this.aliases = Maps.newHashMap(); + this.blocked = Sets.newHashSet(); + + registry.serializeIds(this.ids); + registry.serializeSubstitutions(this.substitutions); + registry.serializeAliases(this.aliases); + registry.serializeBlockList(this.blocked); + } + } + + public final Map entries = Maps.newHashMap(); + } + + public static RegistryDelegate makeDelegate(T obj, Class rootClass) { + return PersistentRegistry.ACTIVE.getRegistry(rootClass).getDelegate(obj, rootClass); + } + + + private static class DumpRegistryFunction implements Function>, Void> { + static final DumpRegistryFunction OPERATION = new DumpRegistryFunction(); + + @Override + public Void apply(Map.Entry> input) { + input.getValue().dump(input.getKey()); + return null; + } + } + private static class ValidateRegistryFunction implements Function>, Void> { + static final ValidateRegistryFunction OPERATION = new ValidateRegistryFunction(); + + @Override + public Void apply(Map.Entry> input) { + input.getValue().validateContent(input.getKey()); + return null; + } + } + private static class ResetDelegatesFunction implements Function>, Void> { + static final ResetDelegatesFunction OPERATION = new ResetDelegatesFunction(); + + @Override + public Void apply(Map.Entry> input) { + input.getValue().resetSubstitutionDelegates(); + return null; + } + } +} diff --git a/src/main/java/net/minecraftforge/fml/common/registry/RegistryDelegate.java b/src/main/java/net/minecraftforge/fml/common/registry/RegistryDelegate.java index 0052bdec4..2e255f25e 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/RegistryDelegate.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/RegistryDelegate.java @@ -1,6 +1,7 @@ package net.minecraftforge.fml.common.registry; import com.google.common.base.Objects; +import net.minecraft.util.ResourceLocation; /** @@ -24,12 +25,24 @@ public interface RegistryDelegate { /** * Get the name of this delegate. This is completely static after registration has completed and will never change. + * + * Deprecated in favour of the resource location. + * + * @see #getResourceName() * @return The name */ + @Deprecated String name(); /** - * Get the delegate type. It will be Item or Block. + * Get the unique resource location for this delegate. Completely static after registration has completed, and + * will never change. + * @return The name + */ + ResourceLocation getResourceName(); + + /** + * Get the delegate type. It will be dependent on the registry this delegate is sourced from. * @return The type of delegate */ Class type(); @@ -40,7 +53,7 @@ public interface RegistryDelegate { final class Delegate implements RegistryDelegate { private T referant; - private String name; + private ResourceLocation name; private final Class type; public Delegate(T referant, Class type) { @@ -55,9 +68,12 @@ public interface RegistryDelegate { @Override public String name() { - return name; + return name.toString(); } + @Override + public ResourceLocation getResourceName() { return name; } + @Override public Class type() { @@ -69,10 +85,7 @@ public interface RegistryDelegate { this.referant = newTarget; } - void setName(String name) - { - this.name = name; - } + void setResourceName(ResourceLocation name) { this.name = name; } @Override public boolean equals(Object obj) diff --git a/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java index 6da52df3e..340c4e35c 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java @@ -17,6 +17,8 @@ import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Random; +import java.util.Set; + import org.apache.commons.lang3.Validate; import net.minecraft.entity.passive.EntityVillager; @@ -191,14 +193,13 @@ public class VillagerRegistry { register(prof, -1); } - @SuppressWarnings("deprecation") private void register(VillagerProfession prof, int id) { professions.register(id, prof.name, prof); } private boolean hasInit = false; - private FMLControlledNamespacedRegistry professions = GameData.createRegistry("villagerprofessions", VillagerProfession.class, 0, 1024); + private FMLControlledNamespacedRegistry professions = PersistentRegistryManager.createRegistry(new ResourceLocation("minecraft:villagerprofessions"), VillagerProfession.class, null, 1024, 0, true); private void init() @@ -242,22 +243,22 @@ public class VillagerRegistry public static class VillagerProfession { private ResourceLocation name; - //private ResourceLocation texture; + private ResourceLocation texture; private List careers = Lists.newArrayList(); - private RegistryDelegate delegate = GameData.getRegistry("villagerprofessions", VillagerProfession.class).getDelegate(this, VillagerProfession.class); + public final RegistryDelegate delegate = PersistentRegistryManager.makeDelegate(this, VillagerProfession.class); public VillagerProfession(String name, String texture) { this.name = new ResourceLocation(name); - //this.texture = new ResourceLocation(texture); - ((RegistryDelegate.Delegate)delegate).setName(name); + this.texture = new ResourceLocation(texture); + ((RegistryDelegate.Delegate)delegate).setResourceName(this.name); } private void register(VillagerCareer career) { Validate.isTrue(!careers.contains(career), "Attempted to register career that is already registered."); Validate.isTrue(career.profession == this, "Attempted to register career for the wrong profession."); - //career.id = careers.size(); + career.id = careers.size(); careers.add(career); } } @@ -266,7 +267,7 @@ public class VillagerRegistry { private VillagerProfession profession; private String name; - //private int id; + private int id; public VillagerCareer(VillagerProfession parent, String name) { this.profession = parent; @@ -297,8 +298,8 @@ public class VillagerRegistry */ public static void setRandomProfession(EntityVillager entity, Random rand) { - //int count = INSTANCE.professions.getKeys().size(); - //int prof = rand.nextInt(count); + Set entries = INSTANCE.professions.getKeys(); + int prof = rand.nextInt(entries.size()); //TODO: Grab id range from internal registry entity.setProfession(rand.nextInt(5)); } diff --git a/src/main/java/net/minecraftforge/oredict/OreDictionary.java b/src/main/java/net/minecraftforge/oredict/OreDictionary.java index 6c40af205..b8e880cc6 100644 --- a/src/main/java/net/minecraftforge/oredict/OreDictionary.java +++ b/src/main/java/net/minecraftforge/oredict/OreDictionary.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import net.minecraft.util.ResourceLocation; import org.apache.logging.log4j.Level; import net.minecraft.block.Block; @@ -325,7 +326,7 @@ public class OreDictionary // HACK: use the registry name's ID. It is unique and it knows about substitutions. Fallback to a -1 value (what Item.getIDForItem would have returned) in the case where the registry is not aware of the item yet // IT should be noted that -1 will fail the gate further down, if an entry already exists with value -1 for this name. This is what is broken and being warned about. // APPARENTLY it's quite common to do this. OreDictionary should be considered alongside Recipes - you can't make them properly until you've registered with the game. - String registryName = stack.getItem().delegate.name(); + ResourceLocation registryName = stack.getItem().delegate.getResourceName(); int id; if (registryName == null) { @@ -449,7 +450,7 @@ public class OreDictionary // HACK: use the registry name's ID. It is unique and it knows about substitutions. Fallback to a -1 value (what Item.getIDForItem would have returned) in the case where the registry is not aware of the item yet // IT should be noted that -1 will fail the gate further down, if an entry already exists with value -1 for this name. This is what is broken and being warned about. // APPARENTLY it's quite common to do this. OreDictionary should be considered alongside Recipes - you can't make them properly until you've registered with the game. - String registryName = ore.getItem().delegate.name(); + ResourceLocation registryName = ore.getItem().delegate.getResourceName(); int hash; if (registryName == null) { @@ -506,7 +507,7 @@ public class OreDictionary for (ItemStack ore : ores) { // HACK: use the registry name's ID. It is unique and it knows about substitutions - String name = ore.getItem().delegate.name(); + ResourceLocation name = ore.getItem().delegate.getResourceName(); int hash; if (name == null) { From 02e9b9d99cce5e568c5186bcdda687c87e599890 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sat, 28 Nov 2015 03:36:33 -0800 Subject: [PATCH 075/133] Add chunk loading protection to WorldSever.getTileEntitiesIn, may prevent orphanced chunks and a CME in EntityPlayerMP. Note: The 'max' parameters are NON-inclusive. --- .../entity/player/EntityPlayerMP.java.patch | 20 ++++--------- .../minecraft/world/WorldServer.java.patch | 29 ++++++++++--------- 2 files changed, 20 insertions(+), 29 deletions(-) diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch index 91bf0b3df..cda8667cb 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch @@ -27,17 +27,7 @@ { this.func_71053_j(); this.field_71070_bA = this.field_71069_bz; -@@ -264,7 +265,8 @@ - if (chunk.func_150802_k()) - { - list.add(chunk); -- list1.addAll(((WorldServer)this.field_70170_p).func_147486_a(chunkcoordintpair.field_77276_a * 16, 0, chunkcoordintpair.field_77275_b * 16, chunkcoordintpair.field_77276_a * 16 + 16, 256, chunkcoordintpair.field_77275_b * 16 + 16)); -+ list1.addAll(((WorldServer)this.field_70170_p).func_147486_a(chunkcoordintpair.field_77276_a * 16, 0, chunkcoordintpair.field_77275_b * 16, chunkcoordintpair.field_77276_a * 16 + 16, 256, chunkcoordintpair.field_77275_b * 16 + 15)); -+ //BugFix: 16 makes it load an extra chunk, which isn't associated with a player, which makes it not unload unless a player walks near it. - iterator1.remove(); - } - } -@@ -294,6 +296,7 @@ +@@ -294,6 +295,7 @@ for (Chunk chunk1 : list) { this.func_71121_q().func_73039_n().func_85172_a(this, chunk1); @@ -45,7 +35,7 @@ } } } -@@ -424,6 +427,7 @@ +@@ -424,6 +426,7 @@ public void func_70645_a(DamageSource p_70645_1_) { @@ -53,7 +43,7 @@ if (this.field_70170_p.func_82736_K().func_82766_b("showDeathMessages")) { Team team = this.func_96124_cp(); -@@ -447,7 +451,20 @@ +@@ -447,7 +450,20 @@ if (!this.field_70170_p.func_82736_K().func_82766_b("keepInventory")) { @@ -74,7 +64,7 @@ } for (ScoreObjective scoreobjective : this.field_70170_p.func_96441_U().func_96520_a(IScoreObjectiveCriteria.field_96642_c)) -@@ -461,6 +478,7 @@ +@@ -461,6 +477,7 @@ if (entitylivingbase != null) { EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.field_75627_a.get(Integer.valueOf(EntityList.func_75619_a(entitylivingbase))); @@ -82,7 +72,7 @@ if (entitylist$entityegginfo != null) { -@@ -831,6 +849,7 @@ +@@ -831,6 +848,7 @@ { if (p_71064_1_ != null) { diff --git a/patches/minecraft/net/minecraft/world/WorldServer.java.patch b/patches/minecraft/net/minecraft/world/WorldServer.java.patch index b8e52a8fc..bb280aa63 100644 --- a/patches/minecraft/net/minecraft/world/WorldServer.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldServer.java.patch @@ -127,23 +127,24 @@ int k = 0; if (this.func_175707_a(nextticklistentry1.field_180282_a.func_177982_a(-k, -k, -k), nextticklistentry1.field_180282_a.func_177982_a(k, k, k))) -@@ -696,22 +720,39 @@ +@@ -696,22 +720,40 @@ { List list = Lists.newArrayList(); - for (int i = 0; i < this.field_147482_g.size(); ++i) -+ //Forge: Optomize this loop to only grab from the chunks it needs -+ for (int x = (p_147486_1_ >> 4); x <= (p_147486_4_ >> 4); x++) ++ //Forge: Optimize this loop to only grab from the chunks it needs ++ for (int x = p_147486_1_; x < p_147486_4_; x += 16) { - TileEntity tileentity = (TileEntity)this.field_147482_g.get(i); - BlockPos blockpos = tileentity.func_174877_v(); - - if (blockpos.func_177958_n() >= p_147486_1_ && blockpos.func_177956_o() >= p_147486_2_ && blockpos.func_177952_p() >= p_147486_3_ && blockpos.func_177958_n() < p_147486_4_ && blockpos.func_177956_o() < p_147486_5_ && blockpos.func_177952_p() < p_147486_6_) -+ for (int z = (p_147486_3_ >> 4); z <= (p_147486_6_ >> 4); z++) ++ for (int z = p_147486_3_; z < p_147486_6_; z += 16) { - list.add(tileentity); -+ Chunk chunk = this.func_72964_e(x, z); -+ if (chunk != null) ++ if (!this.func_175680_a(x >> 4, z >> 4, true)) continue; //Prevent loading extra chunks to just read data. This causes orphaned chunks that never unload. ++ Chunk chunk = this.func_72964_e(x >> 4, z >> 4); ++ if (chunk != null && !chunk.func_76621_g()) + { + for (TileEntity entity : chunk.func_177434_r().values()) + { @@ -151,7 +152,7 @@ + { + BlockPos pos = entity.func_174877_v(); + if (pos.func_177958_n() >= p_147486_1_ && pos.func_177956_o() >= p_147486_2_ && pos.func_177952_p() >= p_147486_3_ && -+ pos.func_177958_n() <= p_147486_4_ && pos.func_177956_o() <= p_147486_5_ && pos.func_177952_p() <= p_147486_6_) ++ pos.func_177958_n() < p_147486_4_ && pos.func_177956_o() < p_147486_5_ && pos.func_177952_p() < p_147486_6_) + { + list.add(entity); + } @@ -174,7 +175,7 @@ return !this.field_73061_a.func_175579_a(this, p_175660_2_, p_175660_1_) && this.func_175723_af().func_177746_a(p_175660_2_); } -@@ -777,6 +818,7 @@ +@@ -777,6 +819,7 @@ } else { @@ -182,7 +183,7 @@ this.field_72987_B = true; WorldChunkManager worldchunkmanager = this.field_73011_w.func_177499_m(); List list = worldchunkmanager.func_76932_a(); -@@ -822,7 +864,7 @@ +@@ -822,7 +865,7 @@ protected void func_73047_i() { @@ -191,7 +192,7 @@ for (int i = 0; i < 10; ++i) { -@@ -859,6 +901,7 @@ +@@ -859,6 +902,7 @@ } this.field_73020_y.func_73151_a(p_73044_1_, p_73044_2_); @@ -199,7 +200,7 @@ for (Chunk chunk : Lists.newArrayList(this.field_73059_b.func_152380_a())) { -@@ -892,6 +935,7 @@ +@@ -892,6 +936,7 @@ this.field_72986_A.func_176135_e(this.func_175723_af().func_177732_i()); this.field_73019_z.func_75755_a(this.field_72986_A, this.field_73061_a.func_71203_ab().func_72378_q()); this.field_72988_C.func_75744_a(); @@ -207,7 +208,7 @@ } public void func_72923_a(Entity p_72923_1_) -@@ -947,6 +991,7 @@ +@@ -947,6 +992,7 @@ public Explosion func_72885_a(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) { Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_); @@ -215,7 +216,7 @@ explosion.func_77278_a(); explosion.func_77279_a(false); -@@ -1026,19 +1071,23 @@ +@@ -1026,19 +1072,23 @@ this.field_73061_a.func_71203_ab().func_148537_a(new S2BPacketChangeGameState(8, this.field_73017_q), this.field_73011_w.func_177502_q()); } @@ -243,7 +244,7 @@ } } -@@ -1104,6 +1153,11 @@ +@@ -1104,6 +1154,11 @@ return this.field_73061_a.func_152345_ab(); } From 21173c3b656de10e2e9d2d3acbd5b317ea5bb816 Mon Sep 17 00:00:00 2001 From: cpw Date: Sat, 28 Nov 2015 16:30:58 -0500 Subject: [PATCH 076/133] Fix up blockstate rebuild. Closes #2221. Also fix formatting. IDEA has differences. Solved now. --- .../FMLControlledNamespacedRegistry.java | 258 ++++++++--- .../fml/common/registry/GameData.java | 121 +++-- .../fml/common/registry/GameRegistry.java | 147 +++--- .../registry/PersistentRegistryManager.java | 298 ++++++++---- .../fml/common/registry/VillagerRegistry.java | 432 +++++++++--------- 5 files changed, 780 insertions(+), 476 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java index 9f1fd475e..e35847845 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java @@ -9,28 +9,25 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.concurrent.Callable; import com.google.common.base.Throwables; -import com.google.common.collect.*; +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; +import com.google.common.collect.Iterators; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; import org.apache.commons.lang3.Validate; import org.apache.logging.log4j.Level; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBanner; -import net.minecraft.item.ItemBlock; import net.minecraft.util.ObjectIntIdentityMap; -import net.minecraft.util.RegistryNamespaced; import net.minecraft.util.RegistryNamespacedDefaultedByKey; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.functions.GenericIterableFactory; import net.minecraftforge.fml.common.registry.RegistryDelegate.Delegate; -import com.google.common.base.Function; - -public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaultedByKey { +public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaultedByKey +{ public static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("fml.debugRegistryEntries", "false")); private final Class superType; private final boolean isDelegated; @@ -43,7 +40,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul * Aliases are resource location to resource location pointers, allowing for alternative names to be supplied * pointing at the same thing. They are used to allow programmatic migration of an ID. */ - private final Map aliases = Maps.newHashMap(); + private final Map aliases = Maps.newHashMap(); /** * Persistent substitutions are the mechanism to allow mods to override specific behaviours with new behaviours. */ @@ -58,7 +55,20 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul private final Set blockedIds = Sets.newHashSet(); private final BitSet availabilityMap; + + private final AddCallback addCallback; + + public interface AddCallback + { + public void onAdd(T obj, int id); + } + FMLControlledNamespacedRegistry(ResourceLocation defaultKey, int maxIdValue, int minIdValue, Class type, boolean isDelegated) + { + this(defaultKey, maxIdValue, minIdValue, type, isDelegated, null); + } + + FMLControlledNamespacedRegistry(ResourceLocation defaultKey, int maxIdValue, int minIdValue, Class type, boolean isDelegated, AddCallback callback) { super(defaultKey); this.superType = type; @@ -67,16 +77,22 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul this.minId = minIdValue; this.availabilityMap = new BitSet(maxIdValue + 1); this.isDelegated = isDelegated; - if (this.isDelegated) { - try { + if (this.isDelegated) + { + try + { this.delegateAccessor = type.getField("delegate"); - } catch (NoSuchFieldException e) { + } catch (NoSuchFieldException e) + { FMLLog.log(Level.ERROR, e, "Delegate class identified with missing delegate field"); throw Throwables.propagate(e); } - } else { + } + else + { this.delegateAccessor = null; } + this.addCallback = callback; } void validateContent(ResourceLocation registryName) @@ -88,21 +104,45 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul boolean isSubstituted = activeSubstitutions.containsKey(name); // name lookup failed -> obj is not in the obj<->name map - if (name == null) throw new IllegalStateException(String.format("Registry entry for %s %s, id %d, doesn't yield a name.", registryName, obj, id)); + if (name == null) + { + throw new IllegalStateException(String.format("Registry entry for %s %s, id %d, doesn't yield a name.", registryName, obj, id)); + } // id lookup failed -> obj is not in the obj<->id map - if (!isSubstituted && id < 0) throw new IllegalStateException(String.format("Registry entry for %s %s, name %s, doesn't yield an id.", registryName, obj, name)); + if (!isSubstituted && id < 0) + { + throw new IllegalStateException(String.format("Registry entry for %s %s, name %s, doesn't yield an id.", registryName, obj, name)); + } // id is too high - if (id > maxId) throw new IllegalStateException(String.format("Registry entry for %s %s, name %s uses the too large id %d.", registryName, obj, name, id)); + if (id > maxId) + { + throw new IllegalStateException(String.format("Registry entry for %s %s, name %s uses the too large id %d.", registryName, obj, name, id)); + } // the rest of the tests don't really work for substituted items or blocks - if (isSubstituted) continue; + if (isSubstituted) + { + continue; + } // id -> obj lookup is inconsistent - if (getRaw(id) != obj) throw new IllegalStateException(String.format("Registry entry for id %d, name %s, doesn't yield the expected %s %s.", id, name, registryName, obj)); + if (getRaw(id) != obj) + { + throw new IllegalStateException(String.format("Registry entry for id %d, name %s, doesn't yield the expected %s %s.", id, name, registryName, obj)); + } // name -> obj lookup is inconsistent - if (getRaw(name) != obj ) throw new IllegalStateException(String.format("Registry entry for name %s, id %d, doesn't yield the expected %s %s.", name, id, registryName, obj)); + if (getRaw(name) != obj) + { + throw new IllegalStateException(String.format("Registry entry for name %s, id %d, doesn't yield the expected %s %s.", name, id, registryName, obj)); + } // name -> id lookup is inconsistent - if (getId(name) != id) throw new IllegalStateException(String.format("Registry entry for name %s doesn't yield the expected id %d.", name, id)); + if (getId(name) != id) + { + throw new IllegalStateException(String.format("Registry entry for name %s doesn't yield the expected id %d.", name, id)); + } // entry is blocked, thus should be empty - if (blockedIds.contains(id)) throw new IllegalStateException(String.format("Registry entry for %s %s, id %d, name %s, marked as dangling.", registryName, obj, id, name)); + if (blockedIds.contains(id)) + { + throw new IllegalStateException(String.format("Registry entry for %s %s, id %d, name %s, marked as dangling.", registryName, obj, id, name)); + } } } @@ -110,7 +150,10 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul @SuppressWarnings("unchecked") void set(FMLControlledNamespacedRegistry otherRegistry) { - if (this.superType != otherRegistry.superType) throw new IllegalArgumentException("incompatible registry"); + if (this.superType != otherRegistry.superType) + { + throw new IllegalArgumentException("incompatible registry"); + } this.optionalDefaultKey = otherRegistry.optionalDefaultKey; this.maxId = otherRegistry.maxId; @@ -155,8 +198,14 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul public void putObject(ResourceLocation name, I thing) { - if (name == null) throw new NullPointerException("Can't use a null-name for the registry."); - if (thing == null) throw new NullPointerException("Can't add null-object to the registry."); + if (name == null) + { + throw new NullPointerException("Can't use a null-name for the registry."); + } + if (thing == null) + { + throw new NullPointerException("Can't add null-object to the registry."); + } ResourceLocation existingName = getNameForObject(thing); @@ -177,7 +226,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul /** * Fetch the object identified by the specified name or the default object. - * + *

* For blocks the default object is the air block, for items it's null. * * @param name Unique name identifying the object. @@ -192,7 +241,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul /** * Fetch the object identified by the specified id or the default object. - * + *

* For blocks the default object is the air block, for items it's null. * * @param id ID identifying the object. @@ -207,9 +256,9 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul /** * Get the id for the specified object. - * + *

* Don't hold onto the id across the world, it's being dynamically re-mapped as needed. - * + *

* Usually the name should be used instead of the id, if using the Block/Item object itself is * not suitable for the task. * @@ -246,7 +295,10 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul { name = aliases.get(name); - if (name != null) return getRaw(name); + if (name != null) + { + return getRaw(name); + } } return ret; @@ -254,7 +306,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul /** * Determine if the registry has an entry for the specified name. - * + *

* Aliased names will be resolved as well. * * @param name Object name to check. @@ -269,7 +321,10 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul { name = aliases.get(name); - if (name != null) return containsKey(name); + if (name != null) + { + return containsKey(name); + } } return ret; @@ -277,9 +332,9 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul /** * Get the id for the specified object. - * + *

* Don't hold onto the id across the world, it's being dynamically re-mapped as needed. - * + *

* Usually the name should be used instead of the id, if using the Block/Item object itself is * not suitable for the task. * @@ -289,7 +344,10 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul public int getId(ResourceLocation itemName) { I obj = getRaw(itemName); - if (obj == null) return -1; + if (obj == null) + { + return -1; + } return getId(obj); } @@ -312,6 +370,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul idMapping.put(getNameForObject(thing), getId(thing)); } } + public void serializeAliases(Map map) { map.putAll(this.aliases); @@ -325,15 +384,21 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul /** * Add the specified object to the registry. * - * @param id ID to use if available, auto-assigned otherwise. - * @param name Name to use, prefixed by the mod id. + * @param id ID to use if available, auto-assigned otherwise. + * @param name Name to use, prefixed by the mod id. * @param thing Object to add. * @return ID eventually allocated. */ int add(int id, ResourceLocation name, I thing) { - if (name == null) throw new NullPointerException(String.format("Can't use a null-name for the registry, object %s.", thing)); - if (thing == null) throw new NullPointerException(String.format("Can't add null-object to the registry, name %s.", name)); + if (name == null) + { + throw new NullPointerException(String.format("Can't use a null-name for the registry, object %s.", thing)); + } + if (thing == null) + { + throw new NullPointerException(String.format("Can't add null-object to the registry, name %s.", name)); + } if (optionalDefaultKey != null && optionalDefaultKey.equals(name) && this.optionalDefaultObject == null) { this.optionalDefaultObject = thing; @@ -376,7 +441,10 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul { I oldThing = thing; thing = activeSubstitutions.get(name); - if (DEBUG) FMLLog.getLogger().log(Level.DEBUG, "Active substitution: {} {}@{} -> {}@{}",name, oldThing.getClass().getName(), System.identityHashCode(oldThing), thing.getClass().getName(), System.identityHashCode(thing)); + if (DEBUG) + { + FMLLog.getLogger().log(Level.DEBUG, "Active substitution: {} {}@{} -> {}@{}", name, oldThing.getClass().getName(), System.identityHashCode(oldThing), thing.getClass().getName(), System.identityHashCode(thing)); + } } @@ -386,7 +454,9 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul getExistingDelegate(thing).setResourceName(name); } if (DEBUG) + { FMLLog.finer("Registry add: %s %d %s (req. id %d)", name, idToUse, thing, id); + } return idToUse; } @@ -394,12 +464,14 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul { aliases.put(from, to); if (DEBUG) + { FMLLog.finer("Registry alias: %s -> %s", from, to); + } } - Map getEntriesNotIn(FMLControlledNamespacedRegistry registry) + Map getEntriesNotIn(FMLControlledNamespacedRegistry registry) { - Map ret = new HashMap(); + Map ret = new HashMap(); for (I thing : this.typeSafeIterable()) { @@ -418,7 +490,9 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul void dump(ResourceLocation registryName) { if (!DEBUG) + { return; + } List ids = new ArrayList(); @@ -442,13 +516,26 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul */ private void addObjectRaw(int id, ResourceLocation name, I thing) { - if (name == null) throw new NullPointerException("The name to be added to the registry is null. This can only happen with a corrupted registry state. Reflection/ASM hackery? Registry bug?"); - if (thing == null) throw new NullPointerException("The object to be added to the registry is null. This can only happen with a corrupted registry state. Reflection/ASM hackery? Registry bug?"); - if (!superType.isInstance(thing)) throw new IllegalArgumentException("The object to be added to the registry is not of the right type. Reflection/ASM hackery? Registry bug?"); + if (name == null) + { + throw new NullPointerException("The name to be added to the registry is null. This can only happen with a corrupted registry state. Reflection/ASM hackery? Registry bug?"); + } + if (thing == null) + { + throw new NullPointerException("The object to be added to the registry is null. This can only happen with a corrupted registry state. Reflection/ASM hackery? Registry bug?"); + } + if (!superType.isInstance(thing)) + { + throw new IllegalArgumentException("The object to be added to the registry is not of the right type. Reflection/ASM hackery? Registry bug?"); + } underlyingIntegerMap.put(thing, id); // obj <-> id super.putObject(name, thing); // name <-> obj availabilityMap.set(id); + if (addCallback != null) + { + addCallback.onAdd(thing, id); + } } public I getDefaultValue() @@ -456,19 +543,24 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul return optionalDefaultObject; } - public RegistryDelegate getDelegate(I thing, Class clazz) { + public RegistryDelegate getDelegate(I thing, Class clazz) + { return new RegistryDelegate.Delegate(thing, clazz); } @SuppressWarnings("unchecked") - public Delegate getExistingDelegate(I thing) { - try { - return (Delegate) delegateAccessor.get(thing); - } catch (IllegalAccessException e) { + public Delegate getExistingDelegate(I thing) + { + try + { + return (Delegate)delegateAccessor.get(thing); + } catch (IllegalAccessException e) + { FMLLog.log(Level.ERROR, e, "Illegal attempt to access delegate"); throw Throwables.propagate(e); } } + void activateSubstitution(ResourceLocation nameToReplace) { if (getPersistentSubstitutions().containsKey(nameToReplace)) @@ -480,7 +572,8 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul } } - void addSubstitutionAlias(String modId, ResourceLocation nameToReplace, I replacement) throws ExistingSubstitutionException { + void addSubstitutionAlias(String modId, ResourceLocation nameToReplace, I replacement) throws ExistingSubstitutionException + { if (getPersistentSubstitutions().containsKey(nameToReplace) || getPersistentSubstitutions().containsValue(replacement)) { FMLLog.severe("The substitution of %s has already occurred. You cannot duplicate substitutions", nameToReplace); @@ -515,8 +608,11 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul public void validateKey() { if (this.optionalDefaultKey != null) + { Validate.notNull(this.optionalDefaultObject); + } } + /* * This iterator is used by some regular MC methods to visit all blocks, we need to include substitutions * Compare #typeSafeIterable() @@ -525,19 +621,23 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul @Override public Iterator iterator() { - return Iterators.concat(super.iterator(),getPersistentSubstitutions().values().iterator()); + return Iterators.concat(super.iterator(), getPersistentSubstitutions().values().iterator()); } - - FMLControlledNamespacedRegistry makeShallowCopy() { + FMLControlledNamespacedRegistry makeShallowCopy() + { return new FMLControlledNamespacedRegistry(optionalDefaultKey, maxId, minId, superType, isDelegated); } void resetSubstitutionDelegates() { - if (!isDelegated) return; - for (I obj: typeSafeIterable()) { + if (!isDelegated) + { + return; + } + for (I obj : typeSafeIterable()) + { Delegate delegate = getExistingDelegate(obj); delegate.changeReference(obj); } @@ -546,49 +646,62 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul @SuppressWarnings("unchecked") public FMLControlledNamespacedRegistry asType(Class type) { - return (FMLControlledNamespacedRegistry) this; + return (FMLControlledNamespacedRegistry)this; } - public void serializeBlockList(Set blocked) { + public void serializeBlockList(Set blocked) + { blocked.addAll(this.blockedIds); } - public Set getActiveSubstitutions() { + public Set getActiveSubstitutions() + { return activeSubstitutions.keySet(); } - public void loadAliases(Map aliases) { - for (Map.Entry alias : aliases.entrySet()) { + public void loadAliases(Map aliases) + { + for (Map.Entry alias : aliases.entrySet()) + { addAlias(alias.getKey(), alias.getValue()); } } - public void loadSubstitutions(Set substitutions) { - for (ResourceLocation rl : substitutions) { + public void loadSubstitutions(Set substitutions) + { + for (ResourceLocation rl : substitutions) + { activateSubstitution(rl); } } - public void loadBlocked(Set blocked) { - for (Integer id : blocked) { + public void loadBlocked(Set blocked) + { + for (Integer id : blocked) + { blockedIds.add(id); availabilityMap.set(id); } } - public void loadIds(Map ids, Map missingIds, Map remappedIds, FMLControlledNamespacedRegistry currentRegistry, ResourceLocation registryName) { - for (Map.Entry entry : ids.entrySet()) { + public void loadIds(Map ids, Map missingIds, Map remappedIds, FMLControlledNamespacedRegistry currentRegistry, ResourceLocation registryName) + { + for (Map.Entry entry : ids.entrySet()) + { ResourceLocation itemName = entry.getKey(); int newId = entry.getValue(); int currId = currentRegistry.getId(itemName); - if (currId == -1) { + if (currId == -1) + { FMLLog.info("Found a missing id from the world %s", itemName); missingIds.put(entry.getKey(), newId); continue; // no block/item -> nothing to add - } else if (currId != newId) { + } + else if (currId != newId) + { FMLLog.fine("Fixed %s id mismatch %s: %d (init) -> %d (map).", registryName, itemName, currId, newId); - remappedIds.put(itemName, new Integer[]{currId, newId}); + remappedIds.put(itemName, new Integer[] {currId, newId}); } I obj = currentRegistry.getRaw(itemName); @@ -596,7 +709,8 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul } } - public void blockId(int id) { + public void blockId(int id) + { blockedIds.add(id); } } diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java index c96a942e0..71e8d7e09 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java @@ -14,6 +14,8 @@ package net.minecraftforge.fml.common.registry; import java.util.Map; +import com.google.common.collect.Maps; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; @@ -22,12 +24,9 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModContainer; -import net.minecraftforge.fml.common.registry.GameRegistry.Type; -import net.minecraftforge.fml.common.registry.GameRegistry.UniqueIdentifier; -import com.google.common.collect.Maps; - -public class GameData { +public class GameData +{ static final int MIN_BLOCK_ID = 0; static final int MAX_BLOCK_ID = 4095; static final int MIN_ITEM_ID = 4096; @@ -41,7 +40,8 @@ public class GameData { * * @return Block Registry. */ - public static FMLControlledNamespacedRegistry getBlockRegistry() { + public static FMLControlledNamespacedRegistry getBlockRegistry() + { return getMain().iBlockRegistry; } @@ -50,7 +50,8 @@ public class GameData { * * @return Item Registry. */ - public static FMLControlledNamespacedRegistry getItemRegistry() { + public static FMLControlledNamespacedRegistry getItemRegistry() + { return getMain().iItemRegistry; } @@ -59,45 +60,59 @@ public class GameData { ***************************************************/ - static Item findItem(String modId, String name) { + static Item findItem(String modId, String name) + { return getMain().iItemRegistry.getObject(new ResourceLocation(modId, name)); } - static Block findBlock(String modId, String name) { + static Block findBlock(String modId, String name) + { return getMain().iBlockRegistry.getObject(new ResourceLocation(modId, name)); } - static UniqueIdentifier getUniqueName(Block block) { - if (block == null) return null; + static GameRegistry.UniqueIdentifier getUniqueName(Block block) + { + if (block == null) + { + return null; + } Object name = getMain().iBlockRegistry.getNameForObject(block); - return new UniqueIdentifier(name); + return new GameRegistry.UniqueIdentifier(name); } - static UniqueIdentifier getUniqueName(Item item) { - if (item == null) return null; + static GameRegistry.UniqueIdentifier getUniqueName(Item item) + { + if (item == null) + { + return null; + } Object name = getMain().iItemRegistry.getNameForObject(item); - return new UniqueIdentifier(name); + return new GameRegistry.UniqueIdentifier(name); } - protected static GameData getMain() { + protected static GameData getMain() + { return mainData; } // internal registry objects - private final FMLControlledNamespacedRegistry iBlockRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.BLOCKS, Block.class, new ResourceLocation("minecraft:air"), MAX_BLOCK_ID, MIN_BLOCK_ID, true); + private final FMLControlledNamespacedRegistry iBlockRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.BLOCKS, Block.class, new ResourceLocation("minecraft:air"), MAX_BLOCK_ID, MIN_BLOCK_ID, true, BlockStateCapture.INSTANCE); private final FMLControlledNamespacedRegistry iItemRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.ITEMS, Item.class, null, MAX_ITEM_ID, MIN_ITEM_ID, true); int registerItem(Item item, String name) // from GameRegistry { int index = name.indexOf(':'); if (index != -1) + { FMLLog.bigWarning("Dangerous extra prefix %s for name %s, invalid registry invocation/invalid name?", name.substring(0, index), name); + } ResourceLocation rl = addPrefix(name); return registerItem(item, rl, -1); } - private int registerItem(Item item, ResourceLocation name, int idHint) { + private int registerItem(Item item, ResourceLocation name, int idHint) + { return iItemRegistry.add(idHint, name, item); } @@ -105,20 +120,17 @@ public class GameData { { int index = name.indexOf(':'); if (index != -1) + { FMLLog.bigWarning("Dangerous alternative prefix %s for name %s, invalid registry invocation/invalid name?", name.substring(0, index), name); + } ResourceLocation rl = addPrefix(name); return registerBlock(block, rl, -1); } - private int registerBlock(Block block, ResourceLocation name, int idHint) { - int blockId = iBlockRegistry.add(idHint, name, block); - - for (IBlockState state : block.getBlockState().getValidStates()) { - GameData.BLOCKSTATE_TO_ID.put(state, blockId << 4 | block.getMetaFromState(state)); - } - - return blockId; + private int registerBlock(Block block, ResourceLocation name, int idHint) + { + return iBlockRegistry.add(idHint, name, block); } /** @@ -133,33 +145,41 @@ public class GameData { * @param name name to prefix. * @return prefixed name. */ - private ResourceLocation addPrefix(String name) { + private ResourceLocation addPrefix(String name) + { int index = name.lastIndexOf(':'); String oldPrefix = index == -1 ? "" : name.substring(0, index); String prefix; ModContainer mc = Loader.instance().activeModContainer(); - if (mc != null) { + if (mc != null) + { prefix = mc.getModId(); - } else // no mod container, assume minecraft + } + else // no mod container, assume minecraft { prefix = "minecraft"; } - if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0) { + if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0) + { prefix = oldPrefix; } - return new ResourceLocation(prefix,name); + return new ResourceLocation(prefix, name); } - void registerSubstitutionAlias(String name, Type type, Object toReplace) throws ExistingSubstitutionException { + void registerSubstitutionAlias(String name, GameRegistry.Type type, Object toReplace) throws ExistingSubstitutionException + { ResourceLocation nameToSubstitute = new ResourceLocation(Loader.instance().activeModContainer().getModId(), name); - if (type == Type.BLOCK) { - iBlockRegistry.addSubstitutionAlias(Loader.instance().activeModContainer().getModId(), nameToSubstitute, (Block) toReplace); + if (type == GameRegistry.Type.BLOCK) + { + iBlockRegistry.addSubstitutionAlias(Loader.instance().activeModContainer().getModId(), nameToSubstitute, (Block)toReplace); iBlockRegistry.activateSubstitution(nameToSubstitute); - } else if (type == Type.ITEM) { - iItemRegistry.addSubstitutionAlias(Loader.instance().activeModContainer().getModId(), nameToSubstitute, (Item) toReplace); + } + else if (type == GameRegistry.Type.ITEM) + { + iItemRegistry.addSubstitutionAlias(Loader.instance().activeModContainer().getModId(), nameToSubstitute, (Item)toReplace); iItemRegistry.activateSubstitution(nameToSubstitute); } } @@ -167,26 +187,45 @@ public class GameData { private static Map BLOCK_TO_ITEM = Maps.newHashMap(); //Internal: DO NOT USE, will change without warning. - public static Map getBlockItemMap() { + public static Map getBlockItemMap() + { return BLOCK_TO_ITEM; } private static ClearableObjectIntIdentityMap BLOCKSTATE_TO_ID = new ClearableObjectIntIdentityMap(); //Internal: DO NOT USE, will change without warning. - public static ObjectIntIdentityMap getBlockStateIDMap() { + public static ClearableObjectIntIdentityMap getBlockStateIDMap() + { return BLOCKSTATE_TO_ID; } //Lets us clear the map so we can rebuild it. - private static class ClearableObjectIntIdentityMap extends ObjectIntIdentityMap { - private void clear() { + static class ClearableObjectIntIdentityMap extends ObjectIntIdentityMap + { + void clear() + { this.identityMap.clear(); this.objectList.clear(); } } - public RegistryDelegate makeDelegate(T obj, Class rootClass) { + public RegistryDelegate makeDelegate(T obj, Class rootClass) + { return PersistentRegistryManager.makeDelegate(obj, rootClass); } + + private static class BlockStateCapture implements FMLControlledNamespacedRegistry.AddCallback + { + static final BlockStateCapture INSTANCE = new BlockStateCapture(); + + @Override + public void onAdd(Block block, int blockId) + { + for (IBlockState state : block.getBlockState().getValidStates()) + { + GameData.BLOCKSTATE_TO_ID.put(state, blockId << 4 | block.getMetaFromState(state)); + } + } + } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java index 99b5bca70..837f2ab7e 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java @@ -25,6 +25,17 @@ import java.util.Map; import java.util.Random; import java.util.Set; +import com.google.common.base.Objects; +import com.google.common.base.Strings; +import com.google.common.base.Throwables; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.ObjectArrays; +import com.google.common.collect.Sets; +import com.google.common.primitives.Ints; +import org.apache.logging.log4j.Level; + import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; @@ -48,18 +59,6 @@ import net.minecraftforge.fml.common.LoaderException; import net.minecraftforge.fml.common.LoaderState; import net.minecraftforge.fml.common.ObfuscationReflectionHelper; -import org.apache.logging.log4j.Level; - -import com.google.common.base.Objects; -import com.google.common.base.Strings; -import com.google.common.base.Throwables; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.common.collect.ObjectArrays; -import com.google.common.collect.Sets; -import com.google.common.primitives.Ints; - public class GameRegistry { private static Set worldGenerators = Sets.newHashSet(); @@ -70,9 +69,9 @@ public class GameRegistry /** * Register a world generator - something that inserts new block types into the world * - * @param generator the generator + * @param generator the generator * @param modGenerationWeight a weight to assign to this generator. Heavy weights tend to sink to the bottom of - * list of world generators (i.e. they run later) + * list of world generators (i.e. they run later) */ public static void registerWorldGenerator(IWorldGenerator generator, int modGenerationWeight) { @@ -88,11 +87,11 @@ public class GameRegistry * Callback hook for world gen - if your mod wishes to add extra mod related generation to the world * call this * - * @param chunkX Chunk X coordinate - * @param chunkZ Chunk Z coordinate - * @param world World we're generating into + * @param chunkX Chunk X coordinate + * @param chunkZ Chunk Z coordinate + * @param world World we're generating into * @param chunkGenerator The chunk generator - * @param chunkProvider The chunk provider + * @param chunkProvider The chunk provider */ public static void generateWorld(int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { @@ -116,7 +115,8 @@ public class GameRegistry private static void computeSortedGeneratorList() { ArrayList list = Lists.newArrayList(worldGenerators); - Collections.sort(list, new Comparator() { + Collections.sort(list, new Comparator() + { @Override public int compare(IWorldGenerator o1, IWorldGenerator o2) { @@ -139,8 +139,9 @@ public class GameRegistry /** * Register the specified Item with a mod specific name : overrides the standard type based name - * @param item The item to register - * @param name The mod-unique name to register it as - null will remove a custom name + * + * @param item The item to register + * @param name The mod-unique name to register it as - null will remove a custom name * @param modId deprecated, unused */ public static Item registerItem(Item item, String name, String modId) @@ -156,9 +157,9 @@ public class GameRegistry * referenced. * * @param nameToSubstitute The name to link to (this is the NEW block or item) - * @param type The type (Block or Item) - * @param object a NEW instance that is type compatible with the existing instance - * @throws ExistingSubstitutionException if someone else has already registered an alias either from or to one of the names + * @param type The type (Block or Item) + * @param object a NEW instance that is type compatible with the existing instance + * @throws ExistingSubstitutionException if someone else has already registered an alias either from or to one of the names * @throws IncompatibleSubstitutionException if the substitution is incompatible */ public static void addSubstitutionAlias(String nameToSubstitute, GameRegistry.Type type, Object object) throws ExistingSubstitutionException @@ -168,8 +169,9 @@ public class GameRegistry /** * Register a block with the specified mod specific name + * * @param block The block to register - * @param name The mod-unique name to register it as, will get prefixed by your modid. + * @param name The mod-unique name to register it as, will get prefixed by your modid. */ public static Block registerBlock(Block block, String name) { @@ -178,20 +180,22 @@ public class GameRegistry /** * Register a block with the world, with the specified item class and block name - * @param block The block to register + * + * @param block The block to register * @param itemclass The item type to register with it : null registers a block without associated item. - * @param name The mod-unique name to register it as, will get prefixed by your modid. + * @param name The mod-unique name to register it as, will get prefixed by your modid. */ public static Block registerBlock(Block block, Class itemclass, String name) { - return registerBlock(block, itemclass, name, new Object[]{}); + return registerBlock(block, itemclass, name, new Object[] {}); } /** * Register a block with the world, with the specified item class, block name and owning modId - * @param block The block to register - * @param itemclass The item type to register with it : null registers a block without associated item. - * @param name The mod-unique name to register it as, will get prefixed by your modid. + * + * @param block The block to register + * @param itemclass The item type to register with it : null registers a block without associated item. + * @param name The mod-unique name to register it as, will get prefixed by your modid. * @param itemCtorArgs Arguments to pass (after the required {@code Block} parameter) to the ItemBlock constructor (optional). */ @SuppressWarnings("unchecked") @@ -211,7 +215,7 @@ public class GameRegistry ctorArgClasses[0] = Block.class; for (int idx = 1; idx < ctorArgClasses.length; idx++) { - ctorArgClasses[idx] = itemCtorArgs[idx-1].getClass(); + ctorArgClasses[idx] = itemCtorArgs[idx - 1].getClass(); } Constructor itemCtor = itemclass.getConstructor(ctorArgClasses); i = itemCtor.newInstance(ObjectArrays.concat(block, itemCtorArgs)); @@ -224,8 +228,7 @@ public class GameRegistry GameData.getBlockItemMap().put(block, i); } return block; - } - catch (Exception e) + } catch (Exception e) { FMLLog.log(Level.ERROR, e, "Caught an exception during block registration"); throw new LoaderException(e); @@ -277,14 +280,14 @@ public class GameRegistry * This method allows for you to "rename" the 'id' of the tile entity. * * @param tileEntityClass The tileEntity class to register - * @param id The primary ID, this will be the ID that the tileentity saves as - * @param alternatives A list of alternative IDs that will also map to this class. These will never save, but they will load + * @param id The primary ID, this will be the ID that the tileentity saves as + * @param alternatives A list of alternative IDs that will also map to this class. These will never save, but they will load */ public static void registerTileEntityWithAlternatives(Class tileEntityClass, String id, String... alternatives) { TileEntity.addMapping(tileEntityClass, id); - Map> teMappings = ObfuscationReflectionHelper.getPrivateValue(TileEntity.class, null, "field_" + "145855_i", "nameToClassMap"); - for (String s: alternatives) + Map> teMappings = ObfuscationReflectionHelper.getPrivateValue(TileEntity.class, null, "field_" + "145855_i", "nameToClassMap"); + for (String s : alternatives) { if (!teMappings.containsKey(s)) { @@ -297,6 +300,7 @@ public class GameRegistry { fuelHandlers.add(handler); } + public static int getFuelValue(ItemStack itemStack) { int fuelValue = 0; @@ -309,8 +313,9 @@ public class GameRegistry /** * Look up a mod block in the global "named item list" + * * @param modId The modid owning the block - * @param name The name of the block itself + * @param name The name of the block itself * @return The block or null if not found */ public static Block findBlock(String modId, String name) @@ -320,8 +325,9 @@ public class GameRegistry /** * Look up a mod item in the global "named item list" + * * @param modId The modid owning the item - * @param name The name of the item itself + * @param name The name of the item itself * @return The item or null if not found */ public static Item findItem(String modId, String name) @@ -337,6 +343,7 @@ public class GameRegistry { public final String modId; public final String name; + UniqueIdentifier(String modId, String name) { this.modId = modId; @@ -361,7 +368,7 @@ public class GameRegistry else if (obj instanceof ResourceLocation) { this.modId = ((ResourceLocation)obj).getResourceDomain(); - this.name = ((ResourceLocation)obj).getResourcePath(); + this.name = ((ResourceLocation)obj).getResourcePath(); } else { @@ -372,9 +379,15 @@ public class GameRegistry @Override public boolean equals(Object obj) { - if (obj == null) return false; - if (obj.getClass() != this.getClass()) return false; - final UniqueIdentifier other = (UniqueIdentifier) obj; + if (obj == null) + { + return false; + } + if (obj.getClass() != this.getClass()) + { + return false; + } + final UniqueIdentifier other = (UniqueIdentifier)obj; return Objects.equal(modId, other.modId) && Objects.equal(name, other.name); } @@ -391,13 +404,15 @@ public class GameRegistry } } - public enum Type { + public enum Type + { BLOCK, ITEM; } + /** * Look up the mod identifier data for a block. - * + *

* Note: uniqueness and persistence is only guaranteed by mods using the game registry * correctly. * @@ -409,9 +424,10 @@ public class GameRegistry { return GameData.getUniqueName(block); } + /** * Look up the mod identifier data for an item. - * + *

* Note: uniqueness and persistence is only guaranteed by mods using the game registry * correctly. * @@ -425,15 +441,14 @@ public class GameRegistry } - /** * ObjectHolder can be used to automatically populate public static final fields with entries * from the registry. These values can then be referred within mod code directly. - * */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.FIELD}) - public @interface ObjectHolder { + public @interface ObjectHolder + { /** * If used on a class, this represents a modid only. * If used on a field, it represents a name, which can be abbreviated or complete. @@ -449,7 +464,7 @@ public class GameRegistry * {@link ItemStack} instances, referring a specific item, potentially configured with NBT. * These values can then be used in things like recipes and other places where ItemStacks * might be required. - * + *

* If the item is not found, the field will be populated with null. */ @Retention(RetentionPolicy.RUNTIME) @@ -458,12 +473,14 @@ public class GameRegistry { /** * The registry name of the item being looked up. + * * @return The registry name */ public String value(); /** * The metadata or damage value for the itemstack, defaults to 0. + * * @return the metadata value */ public int meta() default 0; @@ -478,26 +495,31 @@ public class GameRegistry /** * Makes an {@link ItemStack} based on the itemName reference, with supplied meta, stackSize and nbt, if possible - * + *

* Will return null if the item doesn't exist (because it's not from a loaded mod for example) * Will throw a {@link RuntimeException} if the nbtString is invalid for use in an {@link ItemStack} * - * @param itemName a registry name reference - * @param meta the meta + * @param itemName a registry name reference + * @param meta the meta * @param stackSize the stack size * @param nbtString an nbt stack as a string, will be processed by {@link JsonToNBT} * @return a new itemstack */ public static ItemStack makeItemStack(String itemName, int meta, int stackSize, String nbtString) { - if (itemName == null) throw new IllegalArgumentException("The itemName cannot be null"); + if (itemName == null) + { + throw new IllegalArgumentException("The itemName cannot be null"); + } Item item = GameData.getItemRegistry().getObject(new ResourceLocation(itemName)); - if (item == null) { + if (item == null) + { FMLLog.getLogger().log(Level.TRACE, "Unable to find item with name {}", itemName); return null; } - ItemStack is = new ItemStack(item,1,meta); - if (!Strings.isNullOrEmpty(nbtString)) { + ItemStack is = new ItemStack(item, 1, meta); + if (!Strings.isNullOrEmpty(nbtString)) + { NBTBase nbttag = null; try { @@ -507,11 +529,14 @@ public class GameRegistry FMLLog.getLogger().log(Level.WARN, "Encountered an exception parsing ItemStack NBT string {}", nbtString, e); throw Throwables.propagate(e); } - if (!(nbttag instanceof NBTTagCompound)) { + if (!(nbttag instanceof NBTTagCompound)) + { FMLLog.getLogger().log(Level.WARN, "Unexpected NBT string - multiple values {}", nbtString); throw new RuntimeException("Invalid NBT JSON"); - } else { - is.setTagCompound((NBTTagCompound) nbttag); + } + else + { + is.setTagCompound((NBTTagCompound)nbttag); } } return is; diff --git a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java index 7667a84e3..138cfd882 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java @@ -1,61 +1,82 @@ package net.minecraftforge.fml.common.registry; import java.io.IOException; -import java.util.*; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; import com.google.common.base.Function; -import com.google.common.collect.*; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraftforge.fml.common.*; -import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent; -import org.apache.logging.log4j.Level; - +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; import com.google.common.collect.Sets.SetView; +import net.minecraft.block.Block; +import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; - -import javax.annotation.Nullable; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.StartupQuery; +import net.minecraftforge.fml.common.ZipperUtil; +import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent; /** * Persistent registry manager. Manages the registries loading from disk, and from network. Handles staging * registry data before loading uniformly into the active registry, and keeps a frozen registry instance * for reversion after connection. + * * @author cpw */ public class PersistentRegistryManager { - private enum PersistentRegistry { + private enum PersistentRegistry + { ACTIVE, FROZEN, STAGING; - private final BiMap> registries = HashBiMap.create(); - private final BiMap,ResourceLocation> registrySuperTypes = HashBiMap.create(); + private final BiMap> registries = HashBiMap.create(); + private final BiMap, ResourceLocation> registrySuperTypes = HashBiMap.create(); @SuppressWarnings("unchecked") FMLControlledNamespacedRegistry getRegistry(ResourceLocation key, Class regType) { - return (FMLControlledNamespacedRegistry) registries.get(key); + return (FMLControlledNamespacedRegistry)registries.get(key); } FMLControlledNamespacedRegistry getOrShallowCopyRegistry(ResourceLocation key, Class regType, FMLControlledNamespacedRegistry other) { - if (!registries.containsKey(key)) { + if (!registries.containsKey(key)) + { registries.put(key, other.makeShallowCopy()); registrySuperTypes.put(regType, key); } return getRegistry(key, regType); } - private FMLControlledNamespacedRegistry createRegistry(ResourceLocation registryName, Class type, ResourceLocation defaultObjectKey, int minId, int maxId, boolean isDelegated) { + private FMLControlledNamespacedRegistry createRegistry(ResourceLocation registryName, Class registryType, ResourceLocation optionalDefaultKey, int minId, int maxId, boolean hasDelegates) + { + return this.createRegistry(registryName, registryType, optionalDefaultKey, minId, maxId, hasDelegates, null); + } + + private FMLControlledNamespacedRegistry createRegistry(ResourceLocation registryName, Class type, ResourceLocation defaultObjectKey, int minId, int maxId, boolean isDelegated, FMLControlledNamespacedRegistry.AddCallback addCallback) + { Set> parents = Sets.newHashSet(); findSuperTypes(type, parents); SetView> overlappedTypes = Sets.intersection(parents, registrySuperTypes.keySet()); - if (!overlappedTypes.isEmpty()) { + if (!overlappedTypes.isEmpty()) + { Class foundType = overlappedTypes.iterator().next(); FMLLog.severe("Found existing registry of type %1s named %2s, you cannot create a new registry (%3s) with type %4s, as %4s has a parent of that type", foundType, registrySuperTypes.get(foundType), registryName, type); throw new IllegalArgumentException("Duplicate registry parent type found - you can only have one registry for a particular super type"); } - FMLControlledNamespacedRegistry fmlControlledNamespacedRegistry = new FMLControlledNamespacedRegistry(defaultObjectKey, maxId, minId, type, isDelegated); + FMLControlledNamespacedRegistry fmlControlledNamespacedRegistry = new FMLControlledNamespacedRegistry(defaultObjectKey, maxId, minId, type, isDelegated, addCallback); registries.put(registryName, fmlControlledNamespacedRegistry); registrySuperTypes.put(type, registryName); return getRegistry(registryName, type); @@ -63,31 +84,37 @@ public class PersistentRegistryManager private void findSuperTypes(Class type, Set> types) { - if (type == null || type == Object.class) { + if (type == null || type == Object.class) + { return; } types.add(type); - for (Class interfac : type.getInterfaces()) { + for (Class interfac : type.getInterfaces()) + { findSuperTypes(interfac, types); } - findSuperTypes(type.getSuperclass(),types); + findSuperTypes(type.getSuperclass(), types); } - void clean() { + void clean() + { registries.clear(); registrySuperTypes.clear(); } - boolean isPopulated() { + boolean isPopulated() + { return !registries.isEmpty(); } - boolean containsRegistry(FMLControlledNamespacedRegistry registry) { + boolean containsRegistry(FMLControlledNamespacedRegistry registry) + { return registries.containsValue(registry); } - public FMLControlledNamespacedRegistry getRegistry(Class rootClass) { + public FMLControlledNamespacedRegistry getRegistry(Class rootClass) + { ResourceLocation rl = registrySuperTypes.get(rootClass); return getRegistry(rl, rootClass); } @@ -96,20 +123,29 @@ public class PersistentRegistryManager public static final ResourceLocation BLOCKS = new ResourceLocation("minecraft:blocks"); public static final ResourceLocation ITEMS = new ResourceLocation("minecraft:items"); - public static FMLControlledNamespacedRegistry createRegistry(ResourceLocation registryName, Class registryType, ResourceLocation optionalDefaultKey, int maxId, int minId, boolean hasDelegates) { - return PersistentRegistry.ACTIVE.createRegistry(registryName,registryType,optionalDefaultKey,minId, maxId, hasDelegates); + public static FMLControlledNamespacedRegistry createRegistry(ResourceLocation registryName, Class registryType, ResourceLocation optionalDefaultKey, int maxId, int minId, boolean hasDelegates, FMLControlledNamespacedRegistry.AddCallback addCallback) + { + return PersistentRegistry.ACTIVE.createRegistry(registryName, registryType, optionalDefaultKey, minId, maxId, hasDelegates, addCallback); } + public static FMLControlledNamespacedRegistry createRegistry(ResourceLocation registryName, Class registryType, ResourceLocation optionalDefaultKey, int maxId, int minId, boolean hasDelegates) + { + return PersistentRegistry.ACTIVE.createRegistry(registryName, registryType, optionalDefaultKey, minId, maxId, hasDelegates); + } - public static List injectSnapshot(GameDataSnapshot snapshot, boolean injectFrozenData, boolean isLocalWorld) { + public static List injectSnapshot(GameDataSnapshot snapshot, boolean injectFrozenData, boolean isLocalWorld) + { FMLLog.info("Injecting existing block and item data into this {} instance", FMLCommonHandler.instance().getEffectiveSide().isServer() ? "server" : "client"); - final Map> remaps = Maps.newHashMap(); - final LinkedHashMap> missing = Maps.newLinkedHashMap(); + final Map> remaps = Maps.newHashMap(); + final LinkedHashMap> missing = Maps.newLinkedHashMap(); forAllRegistries(PersistentRegistry.ACTIVE, ValidateRegistryFunction.OPERATION); forAllRegistries(PersistentRegistry.ACTIVE, DumpRegistryFunction.OPERATION); forAllRegistries(PersistentRegistry.ACTIVE, ResetDelegatesFunction.OPERATION); + // Empty the blockstate map before loading + GameData.getBlockStateIDMap().clear(); + // Load the snapshot into the "STAGING" registry for (Map.Entry snapshotEntry : snapshot.entries.entrySet()) { @@ -119,13 +155,17 @@ public class PersistentRegistryManager // If we have missed data, fire the missing mapping event List missedMappings = Loader.instance().fireMissingMappingEvent(missing.get(BLOCKS), missing.get(ITEMS), isLocalWorld, remaps.get(BLOCKS), remaps.get(ITEMS)); // If there's still missed mappings, we return, because that's an error - if (!missedMappings.isEmpty()) return missedMappings; + if (!missedMappings.isEmpty()) + { + return missedMappings; + } // If we're loading up the world from disk, we want to add in the new data that might have been provisioned by mods if (injectFrozenData) { // So we load it from the frozen persistent registry - for (Map.Entry> r : PersistentRegistry.ACTIVE.registries.entrySet()) { + for (Map.Entry> r : PersistentRegistry.ACTIVE.registries.entrySet()) + { loadFrozenDataToStagingRegistry(remaps, r.getKey(), PersistentRegistry.ACTIVE.registrySuperTypes.inverse().get(r.getKey())); } } @@ -134,7 +174,8 @@ public class PersistentRegistryManager forAllRegistries(PersistentRegistry.STAGING, ValidateRegistryFunction.OPERATION); // Load the STAGING registry into the ACTIVE registry - for (Map.Entry> r : PersistentRegistry.ACTIVE.registries.entrySet()) { + for (Map.Entry> r : PersistentRegistry.ACTIVE.registries.entrySet()) + { loadRegistry(r.getKey(), PersistentRegistry.STAGING, PersistentRegistry.ACTIVE, PersistentRegistry.ACTIVE.registrySuperTypes.inverse().get(r.getKey())); } @@ -151,29 +192,34 @@ public class PersistentRegistryManager return ImmutableList.of(); } - private static void forAllRegistries(PersistentRegistry registrySet, Function>, Void> operation) { + private static void forAllRegistries(PersistentRegistry registrySet, Function>, Void> operation) + { for (Map.Entry> r : registrySet.registries.entrySet()) { operation.apply(r); } } - private static void loadRegistry(ResourceLocation registryName, PersistentRegistry from, PersistentRegistry to, Class regType) { + private static void loadRegistry(ResourceLocation registryName, PersistentRegistry from, PersistentRegistry to, Class regType) + { FMLControlledNamespacedRegistry fromRegistry = from.getRegistry(registryName, regType); FMLControlledNamespacedRegistry toRegistry = to.getOrShallowCopyRegistry(registryName, regType, fromRegistry); toRegistry.set(fromRegistry); } - private static void loadFrozenDataToStagingRegistry(Map> remaps, ResourceLocation registryName, Class regType) { + private static void loadFrozenDataToStagingRegistry(Map> remaps, ResourceLocation registryName, Class regType) + { FMLControlledNamespacedRegistry newRegistry = PersistentRegistry.STAGING.getRegistry(registryName, regType); FMLControlledNamespacedRegistry frozenRegistry = PersistentRegistry.FROZEN.getRegistry(registryName, regType); newRegistry.loadIds(frozenRegistry.getEntriesNotIn(newRegistry), Maps.newLinkedHashMap(), remaps.get(registryName), frozenRegistry, registryName); } - private static void loadPersistentDataToStagingRegistry(boolean injectFrozenData, Map> remaps, LinkedHashMap> missing, Map.Entry snapEntry, Class regType) { + private static void loadPersistentDataToStagingRegistry(boolean injectFrozenData, Map> remaps, LinkedHashMap> missing, Map.Entry snapEntry, Class regType) + { ResourceLocation registryName = snapEntry.getKey(); FMLControlledNamespacedRegistry currentRegistry = PersistentRegistry.ACTIVE.getRegistry(registryName, regType); - if (currentRegistry == null) { + if (currentRegistry == null) + { FMLLog.severe("An unknown persistent registry type {} has been encountered. This Forge instance cannot understand it.", registryName); StartupQuery.abort(); } @@ -192,17 +238,23 @@ public class PersistentRegistryManager newRegistry.loadIds(snapshotEntry.ids, missing.get(registryName), remaps.get(registryName), currentRegistry, registryName); } - public static boolean isFrozen(FMLControlledNamespacedRegistry registry) { + public static boolean isFrozen(FMLControlledNamespacedRegistry registry) + { return PersistentRegistry.FROZEN.containsRegistry(registry); } - public static void revertToFrozen() { - if (!PersistentRegistry.FROZEN.isPopulated()) { + public static void revertToFrozen() + { + if (!PersistentRegistry.FROZEN.isPopulated()) + { FMLLog.warning("Can't revert to frozen GameData state without freezing first."); - } else { + } + else + { FMLLog.fine("Reverting to frozen data state."); } - for (Map.Entry> r : PersistentRegistry.ACTIVE.registries.entrySet()) { + for (Map.Entry> r : PersistentRegistry.ACTIVE.registries.entrySet()) + { loadRegistry(r.getKey(), PersistentRegistry.FROZEN, PersistentRegistry.ACTIVE, PersistentRegistry.ACTIVE.registrySuperTypes.inverse().get(r.getKey())); } // the id mapping has reverted, fire remap events for those that care about id changes @@ -211,15 +263,18 @@ public class PersistentRegistryManager ObjectHolderRegistry.INSTANCE.applyObjectHolders(); } - public static void freezeData() { + public static void freezeData() + { FMLLog.fine("Freezing block and item id maps"); - for (Map.Entry> r : PersistentRegistry.ACTIVE.registries.entrySet()) { + for (Map.Entry> r : PersistentRegistry.ACTIVE.registries.entrySet()) + { loadRegistry(r.getKey(), PersistentRegistry.ACTIVE, PersistentRegistry.FROZEN, PersistentRegistry.ACTIVE.registrySuperTypes.inverse().get(r.getKey())); } forAllRegistries(PersistentRegistry.FROZEN, ValidateRegistryFunction.OPERATION); } - public static List processIdRematches(Iterable missedMappings, boolean isLocalWorld, Map remapBlocks, Map remapItems) { + public static List processIdRematches(Iterable missedMappings, boolean isLocalWorld, Map remapBlocks, Map remapItems) + { List failed = Lists.newArrayList(); List ignored = Lists.newArrayList(); List warned = Lists.newArrayList(); @@ -227,64 +282,90 @@ public class PersistentRegistryManager final PersistentRegistry staging = PersistentRegistry.STAGING; final PersistentRegistry active = PersistentRegistry.ACTIVE; - for (FMLMissingMappingsEvent.MissingMapping remap : missedMappings) { + for (FMLMissingMappingsEvent.MissingMapping remap : missedMappings) + { FMLMissingMappingsEvent.Action action = remap.getAction(); - if (action == FMLMissingMappingsEvent.Action.REMAP) { + if (action == FMLMissingMappingsEvent.Action.REMAP) + { // block/item re-mapped, finish the registration with the new name/object, but the old id int currId = -1, newId = -1; ResourceLocation newName; - if (remap.type == GameRegistry.Type.BLOCK) { - currId = staging.getRegistry(BLOCKS, Block.class).getId((Block) remap.getTarget()); + if (remap.type == GameRegistry.Type.BLOCK) + { + currId = staging.getRegistry(BLOCKS, Block.class).getId((Block)remap.getTarget()); newName = active.getRegistry(BLOCKS, Block.class).getNameForObject((Block)remap.getTarget()); FMLLog.fine("The Block %s is being remapped to %s.", remap.name, newName); - newId = staging.getRegistry(BLOCKS,Block.class).add(remap.id, newName, (Block) remap.getTarget()); - staging.getRegistry(BLOCKS,Block.class).addAlias(remap.resourceLocation, newName); - } else if (remap.type == GameRegistry.Type.ITEM) { - currId = staging.getRegistry(ITEMS, Item.class).getId((Item) remap.getTarget()); + newId = staging.getRegistry(BLOCKS, Block.class).add(remap.id, newName, (Block)remap.getTarget()); + staging.getRegistry(BLOCKS, Block.class).addAlias(remap.resourceLocation, newName); + } + else if (remap.type == GameRegistry.Type.ITEM) + { + currId = staging.getRegistry(ITEMS, Item.class).getId((Item)remap.getTarget()); newName = active.getRegistry(ITEMS, Item.class).getNameForObject((Item)remap.getTarget()); FMLLog.fine("The Item %s is being remapped to %s.", remap.name, newName); - newId = staging.getRegistry(ITEMS,Item.class).add(remap.id, newName, (Item) remap.getTarget()); - staging.getRegistry(ITEMS,Item.class).addAlias(remap.resourceLocation, newName); - } else { + newId = staging.getRegistry(ITEMS, Item.class).add(remap.id, newName, (Item)remap.getTarget()); + staging.getRegistry(ITEMS, Item.class).addAlias(remap.resourceLocation, newName); + } + else + { // currently not remapping non-blocks and items continue; } - if (newId != remap.id) throw new IllegalStateException(); - - if (currId != newId) { - FMLLog.info("Fixed %s id mismatch %s: %d (init) -> %d (map).", remap.type == GameRegistry.Type.BLOCK ? "block" : "item", newName, currId, newId); - (remap.type == GameRegistry.Type.BLOCK ? remapBlocks : remapItems).put(newName, new Integer[]{currId, newId}); + if (newId != remap.id) + { + throw new IllegalStateException(); } - } else if (action == FMLMissingMappingsEvent.Action.BLOCKONLY) { + + if (currId != newId) + { + FMLLog.info("Fixed %s id mismatch %s: %d (init) -> %d (map).", remap.type == GameRegistry.Type.BLOCK ? "block" : "item", newName, currId, newId); + (remap.type == GameRegistry.Type.BLOCK ? remapBlocks : remapItems).put(newName, new Integer[] {currId, newId}); + } + } + else if (action == FMLMissingMappingsEvent.Action.BLOCKONLY) + { // Pulled out specifically so the block doesn't get reassigned a new ID just because it's // Item block has gone away FMLLog.fine("The ItemBlock %s is no longer present in the game. The residual block will remain", remap.name); - } else { + } + else + { // block item missing, warn as requested and block the id - if (action == FMLMissingMappingsEvent.Action.DEFAULT) { + if (action == FMLMissingMappingsEvent.Action.DEFAULT) + { defaulted.add(remap.name); - } else if (action == FMLMissingMappingsEvent.Action.IGNORE) { + } + else if (action == FMLMissingMappingsEvent.Action.IGNORE) + { ignored.add(remap.name); - } else if (action == FMLMissingMappingsEvent.Action.FAIL) { + } + else if (action == FMLMissingMappingsEvent.Action.FAIL) + { failed.add(remap.name); - } else if (action == FMLMissingMappingsEvent.Action.WARN) { + } + else if (action == FMLMissingMappingsEvent.Action.WARN) + { warned.add(remap.name); } // prevent the id from being reused later - if (remap.type == GameRegistry.Type.BLOCK) { + if (remap.type == GameRegistry.Type.BLOCK) + { staging.getRegistry(BLOCKS, Block.class).blockId(remap.id); - } else if (remap.type == GameRegistry.Type.ITEM) { + } + else if (remap.type == GameRegistry.Type.ITEM) + { staging.getRegistry(ITEMS, Item.class).blockId(remap.id); } } } - if (!defaulted.isEmpty()) { + if (!defaulted.isEmpty()) + { String text = "Forge Mod Loader detected missing blocks/items.\n\n" + "There are " + defaulted.size() + " missing blocks and items in this save.\n" + "If you continue the missing blocks/items will get removed.\n" + @@ -294,42 +375,57 @@ public class PersistentRegistryManager for (String s : defaulted) text += s + "\n"; boolean confirmed = StartupQuery.confirm(text); - if (!confirmed) StartupQuery.abort(); + if (!confirmed) + { + StartupQuery.abort(); + } - try { + try + { String skip = System.getProperty("fml.doNotBackup"); - if (skip == null || !"true".equals(skip)) { + if (skip == null || !"true".equals(skip)) + { ZipperUtil.backupWorld(); - } else { + } + else + { for (int x = 0; x < 10; x++) FMLLog.severe("!!!!!!!!!! UPDATING WORLD WITHOUT DOING BACKUP !!!!!!!!!!!!!!!!"); } - } catch (IOException e) { + } catch (IOException e) + { StartupQuery.notify("The world backup couldn't be created.\n\n" + e); StartupQuery.abort(); } warned.addAll(defaulted); } - if (!failed.isEmpty()) { + if (!failed.isEmpty()) + { FMLLog.severe("This world contains blocks and items that refuse to be remapped. The world will not be loaded"); return failed; } - if (!warned.isEmpty()) { + if (!warned.isEmpty()) + { FMLLog.warning("This world contains block and item mappings that may cause world breakage"); return failed; - } else if (!ignored.isEmpty()) { + } + else if (!ignored.isEmpty()) + { FMLLog.fine("There were %d missing mappings that have been ignored", ignored.size()); } return failed; } - public static GameDataSnapshot takeSnapshot() { + public static GameDataSnapshot takeSnapshot() + { final GameDataSnapshot snap = new GameDataSnapshot(); - forAllRegistries(PersistentRegistry.ACTIVE, new Function>, Void>() { + forAllRegistries(PersistentRegistry.ACTIVE, new Function>, Void>() + { @Override - public Void apply(Map.Entry> input) { + public Void apply(Map.Entry> input) + { snap.entries.put(input.getKey(), new GameDataSnapshot.Entry(input.getValue())); return null; } @@ -338,25 +434,30 @@ public class PersistentRegistryManager } - public static class GameDataSnapshot { - public static class Entry { + public static class GameDataSnapshot + { + public static class Entry + { public final Map ids; public final Set substitutions; public final Map aliases; public final Set blocked; - public Entry() { + public Entry() + { this(new HashMap(), new HashSet(), new HashMap(), new HashSet()); } - public Entry(Map ids, Set substitutions, Map aliases, Set blocked) { + public Entry(Map ids, Set substitutions, Map aliases, Set blocked) + { this.ids = ids; this.substitutions = substitutions; this.aliases = aliases; this.blocked = blocked; } - public Entry(FMLControlledNamespacedRegistry registry) { + public Entry(FMLControlledNamespacedRegistry registry) + { this.ids = Maps.newHashMap(); this.substitutions = Sets.newHashSet(); this.aliases = Maps.newHashMap(); @@ -372,34 +473,43 @@ public class PersistentRegistryManager public final Map entries = Maps.newHashMap(); } - public static RegistryDelegate makeDelegate(T obj, Class rootClass) { + public static RegistryDelegate makeDelegate(T obj, Class rootClass) + { return PersistentRegistry.ACTIVE.getRegistry(rootClass).getDelegate(obj, rootClass); } - private static class DumpRegistryFunction implements Function>, Void> { + private static class DumpRegistryFunction implements Function>, Void> + { static final DumpRegistryFunction OPERATION = new DumpRegistryFunction(); @Override - public Void apply(Map.Entry> input) { + public Void apply(Map.Entry> input) + { input.getValue().dump(input.getKey()); return null; } } - private static class ValidateRegistryFunction implements Function>, Void> { + + private static class ValidateRegistryFunction implements Function>, Void> + { static final ValidateRegistryFunction OPERATION = new ValidateRegistryFunction(); @Override - public Void apply(Map.Entry> input) { + public Void apply(Map.Entry> input) + { input.getValue().validateContent(input.getKey()); return null; } } - private static class ResetDelegatesFunction implements Function>, Void> { + + private static class ResetDelegatesFunction implements Function>, Void> + { static final ResetDelegatesFunction OPERATION = new ResetDelegatesFunction(); @Override - public Void apply(Map.Entry> input) { + public Void apply(Map.Entry> input) + { input.getValue().resetSubstitutionDelegates(); return null; } diff --git a/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java index 340c4e35c..17c37c12c 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java @@ -19,10 +19,18 @@ import java.util.Map; import java.util.Random; import java.util.Set; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; import org.apache.commons.lang3.Validate; import net.minecraft.entity.passive.EntityVillager; -import net.minecraft.entity.passive.EntityVillager.*; +import net.minecraft.entity.passive.EntityVillager.EmeraldForItems; +import net.minecraft.entity.passive.EntityVillager.ITradeList; +import net.minecraft.entity.passive.EntityVillager.ItemAndEmeraldToItem; +import net.minecraft.entity.passive.EntityVillager.ListEnchantedBookForEmeralds; +import net.minecraft.entity.passive.EntityVillager.ListEnchantedItemForEmeralds; +import net.minecraft.entity.passive.EntityVillager.ListItemForEmeralds; +import net.minecraft.entity.passive.EntityVillager.PriceInfo; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; @@ -38,14 +46,10 @@ import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; - /** * Registry for villager trading control * * @author cpw - * */ public class VillagerRegistry { @@ -66,7 +70,6 @@ public class VillagerRegistry * creation so you can insert your own new village pieces * * @author cpw - * */ public interface IVillageCreationHandler { @@ -86,6 +89,7 @@ public class VillagerRegistry /** * Build an instance of the village component {@link net.minecraft.world.gen.structure.StructureVillagePieces} + * * @param villagePiece * @param startPiece * @param pieces @@ -97,7 +101,7 @@ public class VillagerRegistry * @param p5 */ Village buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List pieces, Random random, int p1, - int p2, int p3, EnumFacing facing, int p5); + int p2, int p3, EnumFacing facing, int p5); } public static VillagerRegistry instance() @@ -107,6 +111,7 @@ public class VillagerRegistry /** * Register your villager id + * * @param id */ @Deprecated // Doesn't work at all. @@ -119,6 +124,7 @@ public class VillagerRegistry } newVillagerIds.add(id); } + /** * Register a new skin for a villager type * @@ -184,7 +190,7 @@ public class VillagerRegistry } public static Village getVillageComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List pieces, Random random, - int p1, int p2, int p3, EnumFacing facing, int p5) + int p1, int p2, int p3, EnumFacing facing, int p5) { return instance().villageCreationHandlers.get(villagePiece.villagePieceClass).buildComponent(villagePiece, startPiece, pieces, random, p1, p2, p3, facing, p5); } @@ -193,27 +199,30 @@ public class VillagerRegistry { register(prof, -1); } + private void register(VillagerProfession prof, int id) { professions.register(id, prof.name, prof); } private boolean hasInit = false; - private FMLControlledNamespacedRegistry professions = PersistentRegistryManager.createRegistry(new ResourceLocation("minecraft:villagerprofessions"), VillagerProfession.class, null, 1024, 0, true); + private FMLControlledNamespacedRegistry professions = PersistentRegistryManager.createRegistry(new ResourceLocation("minecraft:villagerprofessions"), VillagerProfession.class, null, 1024, 0, true, null); private void init() { if (hasInit) + { return; + } VillagerProfession prof = new VillagerProfession("minecraft:farmer", "minecraft:textures/entity/villager/farmer.png"); { register(prof, 0); - (new VillagerCareer(prof, "farmer" )).init(VanillaTrades.trades[0][0]); - (new VillagerCareer(prof, "fisherman" )).init(VanillaTrades.trades[0][1]); - (new VillagerCareer(prof, "shepherd" )).init(VanillaTrades.trades[0][2]); - (new VillagerCareer(prof, "fletcher" )).init(VanillaTrades.trades[0][3]); + (new VillagerCareer(prof, "farmer")).init(VanillaTrades.trades[0][0]); + (new VillagerCareer(prof, "fisherman")).init(VanillaTrades.trades[0][1]); + (new VillagerCareer(prof, "shepherd")).init(VanillaTrades.trades[0][2]); + (new VillagerCareer(prof, "fletcher")).init(VanillaTrades.trades[0][3]); } prof = new VillagerProfession("minecraft:librarian", "minecraft:textures/entity/villager/librarian.png"); { @@ -228,9 +237,9 @@ public class VillagerRegistry prof = new VillagerProfession("minecraft:smith", "minecraft:textures/entity/villager/smith.png"); { register(prof, 3); - (new VillagerCareer(prof, "armor" )).init(VanillaTrades.trades[3][0]); + (new VillagerCareer(prof, "armor")).init(VanillaTrades.trades[3][0]); (new VillagerCareer(prof, "weapon")).init(VanillaTrades.trades[3][1]); - (new VillagerCareer(prof, "tool" )).init(VanillaTrades.trades[3][2]); + (new VillagerCareer(prof, "tool")).init(VanillaTrades.trades[3][2]); } prof = new VillagerProfession("minecraft:butcher", "minecraft:textures/entity/villager/butcher.png"); { @@ -268,6 +277,7 @@ public class VillagerRegistry private VillagerProfession profession; private String name; private int id; + public VillagerCareer(VillagerProfession parent, String name) { this.profession = parent; @@ -283,8 +293,14 @@ public class VillagerRegistry @Override public boolean equals(Object o) { - if (o == this) return true; - if (!(o instanceof VillagerCareer)) return false; + if (o == this) + { + return true; + } + if (!(o instanceof VillagerCareer)) + { + return false; + } VillagerCareer oc = (VillagerCareer)o; return name.equals(oc.name) && profession == oc.profession; } @@ -294,7 +310,7 @@ public class VillagerRegistry * Hook called when spawning a Villager, sets it's profession to a random registered profession. * * @param entity The new entity - * @param rand The world's RNG + * @param rand The world's RNG */ public static void setRandomProfession(EntityVillager entity, Random rand) { @@ -312,196 +328,196 @@ public class VillagerRegistry //Moved to inner class to stop static initializer issues. //It is nasty I know but it's vanilla. private static final ITradeList[][][][] trades = - { - { { - { - new EmeraldForItems(Items.wheat, new PriceInfo(18, 22)), - new EmeraldForItems(Items.potato, new PriceInfo(15, 19)), - new EmeraldForItems(Items.carrot, new PriceInfo(15, 19)), - new ListItemForEmeralds(Items.bread, new PriceInfo(-4, -2)) - }, - { - new EmeraldForItems(Item.getItemFromBlock(Blocks.pumpkin), new PriceInfo(8, 13)), - new ListItemForEmeralds(Items.pumpkin_pie, new PriceInfo(-3, -2)) - }, - { - new EmeraldForItems(Item.getItemFromBlock(Blocks.melon_block), new PriceInfo(7, 12)), - new ListItemForEmeralds(Items.apple, new PriceInfo(-5, -7)) - }, - { - new ListItemForEmeralds(Items.cookie, new PriceInfo(-6, -10)), - new ListItemForEmeralds(Items.cake, new PriceInfo(1, 1)) - } - }, - { - { - new EmeraldForItems(Items.string, new PriceInfo(15, 20)), - new EmeraldForItems(Items.coal, new PriceInfo(16, 24)), - new ItemAndEmeraldToItem(Items.fish, new PriceInfo(6, 6), Items.cooked_fish, new PriceInfo(6, 6)) - }, - { - new ListEnchantedItemForEmeralds(Items.fishing_rod, new PriceInfo(7, 8)) - } - }, - { - { - new EmeraldForItems(Item.getItemFromBlock(Blocks.wool), new PriceInfo(16, 22)), - new ListItemForEmeralds(Items.shears, new PriceInfo(3, 4)) - }, - { - new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 0), new PriceInfo(1, 2)), - new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 1), new PriceInfo(1, 2)), - new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 2), new PriceInfo(1, 2)), - new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 3), new PriceInfo(1, 2)), - new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 4), new PriceInfo(1, 2)), - new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 5), new PriceInfo(1, 2)), - new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 6), new PriceInfo(1, 2)), - new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 7), new PriceInfo(1, 2)), - new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 8), new PriceInfo(1, 2)), - new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 9), new PriceInfo(1, 2)), - new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 10), new PriceInfo(1, 2)), - new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 11), new PriceInfo(1, 2)), - new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 12), new PriceInfo(1, 2)), - new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 13), new PriceInfo(1, 2)), - new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 14), new PriceInfo(1, 2)), - new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 15), new PriceInfo(1, 2)) - } - }, - { - { - new EmeraldForItems(Items.string, new PriceInfo(15, 20)), - new ListItemForEmeralds(Items.arrow, new PriceInfo(-12, -8)) - }, - { - new ListItemForEmeralds(Items.bow, new PriceInfo(2, 3)), - new ItemAndEmeraldToItem(Item.getItemFromBlock(Blocks.gravel), new PriceInfo(10, 10), Items.flint, new PriceInfo(6, 10)) - } - } - }, - { - { - { - new EmeraldForItems(Items.paper, new PriceInfo(24, 36)), - new ListEnchantedBookForEmeralds() - }, - { - new EmeraldForItems(Items.book, new PriceInfo(8, 10)), - new ListItemForEmeralds(Items.compass, new PriceInfo(10, 12)), - new ListItemForEmeralds(Item.getItemFromBlock(Blocks.bookshelf), new PriceInfo(3, 4)) - }, - { - new EmeraldForItems(Items.written_book, new PriceInfo(2, 2)), - new ListItemForEmeralds(Items.clock, new PriceInfo(10, 12)), - new ListItemForEmeralds(Item.getItemFromBlock(Blocks.glass), new PriceInfo(-5, -3)) - }, - { - new ListEnchantedBookForEmeralds() - }, - { - new ListEnchantedBookForEmeralds() - }, - { - new ListItemForEmeralds(Items.name_tag, new PriceInfo(20, 22)) - } - } - }, - { - { - { - new EmeraldForItems(Items.rotten_flesh, new PriceInfo(36, 40)), - new EmeraldForItems(Items.gold_ingot, new PriceInfo(8, 10)) - }, - { - new ListItemForEmeralds(Items.redstone, new PriceInfo(-4, -1)), - new ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), - new PriceInfo(-2, -1)) - }, - { - new ListItemForEmeralds(Items.ender_eye, new PriceInfo(7, 11)), - new ListItemForEmeralds(Item.getItemFromBlock(Blocks.glowstone), new PriceInfo(-3, -1)) - }, - { - new ListItemForEmeralds(Items.experience_bottle, new PriceInfo(3, 11)) - } - } - }, - { - { - { - new EmeraldForItems(Items.coal, new PriceInfo(16, 24)), - new ListItemForEmeralds(Items.iron_helmet, new PriceInfo(4, 6)) - }, - { - new EmeraldForItems(Items.iron_ingot, new PriceInfo(7, 9)), - new ListItemForEmeralds(Items.iron_chestplate, new PriceInfo(10, 14)) - }, - { - new EmeraldForItems(Items.diamond, new PriceInfo(3, 4)), - new ListEnchantedItemForEmeralds(Items.diamond_chestplate, new PriceInfo(16, 19)) - }, - { - new ListItemForEmeralds(Items.chainmail_boots, new PriceInfo(5, 7)), - new ListItemForEmeralds(Items.chainmail_leggings, new PriceInfo(9, 11)), - new ListItemForEmeralds(Items.chainmail_helmet, new PriceInfo(5, 7)), - new ListItemForEmeralds(Items.chainmail_chestplate, new PriceInfo(11, 15)) - } - }, - { - { - new EmeraldForItems(Items.coal, new PriceInfo(16, 24)), - new ListItemForEmeralds(Items.iron_axe, new PriceInfo(6, 8)) - }, - { - new EmeraldForItems(Items.iron_ingot, new PriceInfo(7, 9)), - new ListEnchantedItemForEmeralds(Items.iron_sword, new PriceInfo(9, 10)) - }, - { - new EmeraldForItems(Items.diamond, new PriceInfo(3, 4)), - new ListEnchantedItemForEmeralds(Items.diamond_sword, new PriceInfo(12, 15)), - new ListEnchantedItemForEmeralds(Items.diamond_axe, new PriceInfo(9, 12)) - } - }, - { - { - new EmeraldForItems(Items.coal, new PriceInfo(16, 24)), - new ListEnchantedItemForEmeralds(Items.iron_shovel, new PriceInfo(5, 7)) - }, - { - new EmeraldForItems(Items.iron_ingot, new PriceInfo(7, 9)), - new ListEnchantedItemForEmeralds(Items.iron_pickaxe, new PriceInfo(9, 11)) - }, - { - new EmeraldForItems(Items.diamond, new PriceInfo(3, 4)), - new ListEnchantedItemForEmeralds(Items.diamond_pickaxe, new PriceInfo(12, 15)) - } - } - }, - { - { - { - new EmeraldForItems(Items.porkchop, new PriceInfo(14, 18)), - new EmeraldForItems(Items.chicken, new PriceInfo(14, 18)) - }, - { - new EmeraldForItems(Items.coal, new PriceInfo(16, 24)), - new ListItemForEmeralds(Items.cooked_porkchop, new PriceInfo(-7, -5)), - new ListItemForEmeralds(Items.cooked_chicken, new PriceInfo(-8, -6)) - } - }, - { - { - new EmeraldForItems(Items.leather, new PriceInfo(9, 12)), - new ListItemForEmeralds(Items.leather_leggings, new PriceInfo(2, 4)) - }, - { - new ListEnchantedItemForEmeralds(Items.leather_chestplate, new PriceInfo(7, 12)) - }, - { - new ListItemForEmeralds(Items.saddle, new PriceInfo(8, 10)) - } - } - } - }; + { + { + { + new EmeraldForItems(Items.wheat, new PriceInfo(18, 22)), + new EmeraldForItems(Items.potato, new PriceInfo(15, 19)), + new EmeraldForItems(Items.carrot, new PriceInfo(15, 19)), + new ListItemForEmeralds(Items.bread, new PriceInfo(-4, -2)) + }, + { + new EmeraldForItems(Item.getItemFromBlock(Blocks.pumpkin), new PriceInfo(8, 13)), + new ListItemForEmeralds(Items.pumpkin_pie, new PriceInfo(-3, -2)) + }, + { + new EmeraldForItems(Item.getItemFromBlock(Blocks.melon_block), new PriceInfo(7, 12)), + new ListItemForEmeralds(Items.apple, new PriceInfo(-5, -7)) + }, + { + new ListItemForEmeralds(Items.cookie, new PriceInfo(-6, -10)), + new ListItemForEmeralds(Items.cake, new PriceInfo(1, 1)) + } + }, + { + { + new EmeraldForItems(Items.string, new PriceInfo(15, 20)), + new EmeraldForItems(Items.coal, new PriceInfo(16, 24)), + new ItemAndEmeraldToItem(Items.fish, new PriceInfo(6, 6), Items.cooked_fish, new PriceInfo(6, 6)) + }, + { + new ListEnchantedItemForEmeralds(Items.fishing_rod, new PriceInfo(7, 8)) + } + }, + { + { + new EmeraldForItems(Item.getItemFromBlock(Blocks.wool), new PriceInfo(16, 22)), + new ListItemForEmeralds(Items.shears, new PriceInfo(3, 4)) + }, + { + new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 0), new PriceInfo(1, 2)), + new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 1), new PriceInfo(1, 2)), + new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 2), new PriceInfo(1, 2)), + new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 3), new PriceInfo(1, 2)), + new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 4), new PriceInfo(1, 2)), + new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 5), new PriceInfo(1, 2)), + new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 6), new PriceInfo(1, 2)), + new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 7), new PriceInfo(1, 2)), + new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 8), new PriceInfo(1, 2)), + new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 9), new PriceInfo(1, 2)), + new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 10), new PriceInfo(1, 2)), + new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 11), new PriceInfo(1, 2)), + new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 12), new PriceInfo(1, 2)), + new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 13), new PriceInfo(1, 2)), + new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 14), new PriceInfo(1, 2)), + new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 15), new PriceInfo(1, 2)) + } + }, + { + { + new EmeraldForItems(Items.string, new PriceInfo(15, 20)), + new ListItemForEmeralds(Items.arrow, new PriceInfo(-12, -8)) + }, + { + new ListItemForEmeralds(Items.bow, new PriceInfo(2, 3)), + new ItemAndEmeraldToItem(Item.getItemFromBlock(Blocks.gravel), new PriceInfo(10, 10), Items.flint, new PriceInfo(6, 10)) + } + } + }, + { + { + { + new EmeraldForItems(Items.paper, new PriceInfo(24, 36)), + new ListEnchantedBookForEmeralds() + }, + { + new EmeraldForItems(Items.book, new PriceInfo(8, 10)), + new ListItemForEmeralds(Items.compass, new PriceInfo(10, 12)), + new ListItemForEmeralds(Item.getItemFromBlock(Blocks.bookshelf), new PriceInfo(3, 4)) + }, + { + new EmeraldForItems(Items.written_book, new PriceInfo(2, 2)), + new ListItemForEmeralds(Items.clock, new PriceInfo(10, 12)), + new ListItemForEmeralds(Item.getItemFromBlock(Blocks.glass), new PriceInfo(-5, -3)) + }, + { + new ListEnchantedBookForEmeralds() + }, + { + new ListEnchantedBookForEmeralds() + }, + { + new ListItemForEmeralds(Items.name_tag, new PriceInfo(20, 22)) + } + } + }, + { + { + { + new EmeraldForItems(Items.rotten_flesh, new PriceInfo(36, 40)), + new EmeraldForItems(Items.gold_ingot, new PriceInfo(8, 10)) + }, + { + new ListItemForEmeralds(Items.redstone, new PriceInfo(-4, -1)), + new ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), + new PriceInfo(-2, -1)) + }, + { + new ListItemForEmeralds(Items.ender_eye, new PriceInfo(7, 11)), + new ListItemForEmeralds(Item.getItemFromBlock(Blocks.glowstone), new PriceInfo(-3, -1)) + }, + { + new ListItemForEmeralds(Items.experience_bottle, new PriceInfo(3, 11)) + } + } + }, + { + { + { + new EmeraldForItems(Items.coal, new PriceInfo(16, 24)), + new ListItemForEmeralds(Items.iron_helmet, new PriceInfo(4, 6)) + }, + { + new EmeraldForItems(Items.iron_ingot, new PriceInfo(7, 9)), + new ListItemForEmeralds(Items.iron_chestplate, new PriceInfo(10, 14)) + }, + { + new EmeraldForItems(Items.diamond, new PriceInfo(3, 4)), + new ListEnchantedItemForEmeralds(Items.diamond_chestplate, new PriceInfo(16, 19)) + }, + { + new ListItemForEmeralds(Items.chainmail_boots, new PriceInfo(5, 7)), + new ListItemForEmeralds(Items.chainmail_leggings, new PriceInfo(9, 11)), + new ListItemForEmeralds(Items.chainmail_helmet, new PriceInfo(5, 7)), + new ListItemForEmeralds(Items.chainmail_chestplate, new PriceInfo(11, 15)) + } + }, + { + { + new EmeraldForItems(Items.coal, new PriceInfo(16, 24)), + new ListItemForEmeralds(Items.iron_axe, new PriceInfo(6, 8)) + }, + { + new EmeraldForItems(Items.iron_ingot, new PriceInfo(7, 9)), + new ListEnchantedItemForEmeralds(Items.iron_sword, new PriceInfo(9, 10)) + }, + { + new EmeraldForItems(Items.diamond, new PriceInfo(3, 4)), + new ListEnchantedItemForEmeralds(Items.diamond_sword, new PriceInfo(12, 15)), + new ListEnchantedItemForEmeralds(Items.diamond_axe, new PriceInfo(9, 12)) + } + }, + { + { + new EmeraldForItems(Items.coal, new PriceInfo(16, 24)), + new ListEnchantedItemForEmeralds(Items.iron_shovel, new PriceInfo(5, 7)) + }, + { + new EmeraldForItems(Items.iron_ingot, new PriceInfo(7, 9)), + new ListEnchantedItemForEmeralds(Items.iron_pickaxe, new PriceInfo(9, 11)) + }, + { + new EmeraldForItems(Items.diamond, new PriceInfo(3, 4)), + new ListEnchantedItemForEmeralds(Items.diamond_pickaxe, new PriceInfo(12, 15)) + } + } + }, + { + { + { + new EmeraldForItems(Items.porkchop, new PriceInfo(14, 18)), + new EmeraldForItems(Items.chicken, new PriceInfo(14, 18)) + }, + { + new EmeraldForItems(Items.coal, new PriceInfo(16, 24)), + new ListItemForEmeralds(Items.cooked_porkchop, new PriceInfo(-7, -5)), + new ListItemForEmeralds(Items.cooked_chicken, new PriceInfo(-8, -6)) + } + }, + { + { + new EmeraldForItems(Items.leather, new PriceInfo(9, 12)), + new ListItemForEmeralds(Items.leather_leggings, new PriceInfo(2, 4)) + }, + { + new ListEnchantedItemForEmeralds(Items.leather_chestplate, new PriceInfo(7, 12)) + }, + { + new ListItemForEmeralds(Items.saddle, new PriceInfo(8, 10)) + } + } + } + }; } } From 57d1a657a0db0495738ce0260918889883711733 Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Sun, 29 Nov 2015 22:02:55 +0100 Subject: [PATCH 077/133] Add a PotionRegistry to handle dynamic distribution and remapping of Potion IDs --- .../net/minecraft/potion/Potion.java.patch | 43 ++++++++- .../fml/common/registry/GameData.java | 33 +++++++ .../fml/common/registry/GameRegistry.java | 6 ++ .../registry/PersistentRegistryManager.java | 5 ++ src/main/resources/forge_at.cfg | 2 + .../debug/PotionRegistryDebug.java | 88 +++++++++++++++++++ 6 files changed, 176 insertions(+), 1 deletion(-) create mode 100644 src/test/java/net/minecraftforge/debug/PotionRegistryDebug.java diff --git a/patches/minecraft/net/minecraft/potion/Potion.java.patch b/patches/minecraft/net/minecraft/potion/Potion.java.patch index 8b374f8a0..621a89f3c 100644 --- a/patches/minecraft/net/minecraft/potion/Potion.java.patch +++ b/patches/minecraft/net/minecraft/potion/Potion.java.patch @@ -1,6 +1,47 @@ --- ../src-base/minecraft/net/minecraft/potion/Potion.java +++ ../src-work/minecraft/net/minecraft/potion/Potion.java -@@ -310,4 +310,27 @@ +@@ -21,7 +21,7 @@ + + public class Potion + { +- public static final Potion[] field_76425_a = new Potion[32]; ++ public static final Potion[] field_76425_a = new Potion[256]; + private static final Map field_180150_I = Maps.newHashMap(); + public static final Potion field_180151_b = null; + public static final Potion field_76424_c = (new Potion(1, new ResourceLocation("speed"), false, 8171462)).func_76390_b("potion.moveSpeed").func_76399_b(0, 0).func_111184_a(SharedMonsterAttributes.field_111263_d, "91AEAA56-376B-4498-935B-2F7F68070635", 0.20000000298023224D, 2); +@@ -64,8 +64,10 @@ + private double field_76412_L; + private boolean field_76413_M; + ++ @Deprecated // use the Constructor without potion ID or everything will explode. + protected Potion(int p_i45897_1_, ResourceLocation p_i45897_2_, boolean p_i45897_3_, int p_i45897_4_) + { ++ p_i45897_1_ = net.minecraftforge.fml.common.registry.GameRegistry.registerPotion(this, p_i45897_2_, p_i45897_1_); + this.field_76415_H = p_i45897_1_; + field_76425_a[p_i45897_1_] = this; + field_180150_I.put(p_i45897_2_, this); +@@ -83,14 +85,18 @@ + this.field_76414_N = p_i45897_4_; + } + ++ protected Potion(ResourceLocation location, boolean badEffect, int potionColor) { ++ this(-1, location, badEffect, potionColor); ++ } ++ + public static Potion func_180142_b(String p_180142_0_) + { +- return (Potion)field_180150_I.get(new ResourceLocation(p_180142_0_)); ++ return net.minecraftforge.fml.common.registry.GameData.getPotionRegistry().func_82594_a(new ResourceLocation(p_180142_0_)); + } + + public static Set func_181168_c() + { +- return field_180150_I.keySet(); ++ return net.minecraftforge.fml.common.registry.GameData.getPotionRegistry().func_148742_b(); + } + + protected Potion func_76399_b(int p_76399_1_, int p_76399_2_) +@@ -310,4 +316,27 @@ { return p_111183_2_.func_111164_d() * (double)(p_111183_1_ + 1); } diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java index 71e8d7e09..f8e850b6d 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java @@ -19,6 +19,7 @@ import com.google.common.collect.Maps; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; +import net.minecraft.potion.Potion; import net.minecraft.util.ObjectIntIdentityMap; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.FMLLog; @@ -31,6 +32,8 @@ public class GameData static final int MAX_BLOCK_ID = 4095; static final int MIN_ITEM_ID = 4096; static final int MAX_ITEM_ID = 31999; + public static final int MIN_POTION_ID = 32; // 0-31 are vanilla, forge start at 32 + public static final int MAX_POTION_ID = 255; // S1DPacketEntityEffect sends bytes, we can only use 255 private static final GameData mainData = new GameData(); // public api @@ -55,6 +58,16 @@ public class GameData return getMain().iItemRegistry; } + /** + * Get the currently active potion registry. + * + * @return Potion Registry. + */ + public static FMLControlledNamespacedRegistry getPotionRegistry() { + return getMain().iPotionRegistry; + } + + /*************************************************** * INTERNAL CODE FROM HERE ON DO NOT USE! ***************************************************/ @@ -98,6 +111,7 @@ public class GameData // internal registry objects private final FMLControlledNamespacedRegistry iBlockRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.BLOCKS, Block.class, new ResourceLocation("minecraft:air"), MAX_BLOCK_ID, MIN_BLOCK_ID, true, BlockStateCapture.INSTANCE); private final FMLControlledNamespacedRegistry iItemRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.ITEMS, Item.class, null, MAX_ITEM_ID, MIN_ITEM_ID, true); + private final FMLControlledNamespacedRegistry iPotionRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.POTIONS, Potion.class, null, MAX_POTION_ID, MIN_POTION_ID, false, PotionArrayCapture.INSTANCE); int registerItem(Item item, String name) // from GameRegistry { @@ -133,6 +147,13 @@ public class GameData return iBlockRegistry.add(idHint, name, block); } + /** + * Called from GameRegistry, which is called from Potion-Constructor + */ + int registerPotion(Potion potion, ResourceLocation name, int id) { + return iPotionRegistry.add(id, name, potion); + } + /** * Prefix the supplied name with the current mod id. *

@@ -228,4 +249,16 @@ public class GameData } } } + + private static class PotionArrayCapture implements FMLControlledNamespacedRegistry.AddCallback + { + static final PotionArrayCapture INSTANCE = new PotionArrayCapture(); + + @Override + public void onAdd(Potion potion, int id) { + // fix the data in the potion and the potions-array + potion.id = id; + Potion.potionTypes[id] = potion; + } + } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java index 837f2ab7e..954e2c6d3 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java @@ -47,6 +47,7 @@ import net.minecraft.nbt.JsonToNBT; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTException; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.Potion; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; @@ -235,6 +236,11 @@ public class GameRegistry } } + /** Called from Potion Constructor */ + public static int registerPotion(Potion potion, ResourceLocation name, int potionID) { + return GameData.getMain().registerPotion(potion, name, potionID); + } + public static void addRecipe(ItemStack output, Object... params) { addShapedRecipe(output, params); diff --git a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java index 138cfd882..8cd1e0705 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java @@ -1,6 +1,7 @@ package net.minecraftforge.fml.common.registry; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; @@ -20,6 +21,7 @@ import com.google.common.collect.Sets.SetView; import net.minecraft.block.Block; import net.minecraft.item.Item; +import net.minecraft.potion.Potion; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLLog; @@ -122,6 +124,7 @@ public class PersistentRegistryManager public static final ResourceLocation BLOCKS = new ResourceLocation("minecraft:blocks"); public static final ResourceLocation ITEMS = new ResourceLocation("minecraft:items"); + public static final ResourceLocation POTIONS = new ResourceLocation("minecraft:potions"); public static FMLControlledNamespacedRegistry createRegistry(ResourceLocation registryName, Class registryType, ResourceLocation optionalDefaultKey, int maxId, int minId, boolean hasDelegates, FMLControlledNamespacedRegistry.AddCallback addCallback) { @@ -145,6 +148,8 @@ public class PersistentRegistryManager // Empty the blockstate map before loading GameData.getBlockStateIDMap().clear(); + // Clean up potion array before reloading it from the snapshot + Arrays.fill(Potion.potionTypes, null); // Load the snapshot into the "STAGING" registry for (Map.Entry snapshotEntry : snapshot.entries.entrySet()) diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index 754ae072b..70b634801 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -25,6 +25,8 @@ public net.minecraft.block.BlockFire func_176534_d(Lnet/minecraft/block/Block;)I public net.minecraft.item.Item func_77656_e(I)Lnet.minecraft.item.Item; #setMaxDamage public net.minecraft.item.Item func_77627_a(Z)Lnet.minecraft.item.Item; #setHasSubtypes public net.minecraft.item.Item func_77631_c(Ljava.lang.String;)Lnet.minecraft.item.Item; #setPotionEffect +# Potion +public-f net.minecraft.potion.Potion field_76415_H #id # EntityPlayer public net.minecraft.entity.player.EntityPlayer func_71012_a(Lnet/minecraft/entity/item/EntityItem;)V #joinEntityItemWithWorld public net.minecraft.client.entity.EntityPlayerSP func_71012_a(Lnet/minecraft/entity/item/EntityItem;)V #joinEntityItemWithWorld diff --git a/src/test/java/net/minecraftforge/debug/PotionRegistryDebug.java b/src/test/java/net/minecraftforge/debug/PotionRegistryDebug.java new file mode 100644 index 000000000..072189262 --- /dev/null +++ b/src/test/java/net/minecraftforge/debug/PotionRegistryDebug.java @@ -0,0 +1,88 @@ +package net.minecraftforge.debug; + +import gnu.trove.set.TIntSet; +import gnu.trove.set.hash.TIntHashSet; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; + +import java.util.Random; + +@Mod(modid=PotionRegistryDebug.MODID) +public class PotionRegistryDebug { + public static final String MODID = "ForgePotionRegistry"; + + @Mod.EventHandler + public void preInit(FMLPreInitializationEvent event) { + new PotionForge(new ResourceLocation("forge", "forge"), false, 0xff00ff); // test automatic id distribution + new PotionForge(200, new ResourceLocation("forge", "forgy"), true, 0x00ff00); // test that ids above 127 work + + Random rand = new Random(); + TIntSet taken = new TIntHashSet(100); + int ra = rand.nextInt(100) + 100; + taken.add(ra); + + // a new potion with a random id so that forge has to remap it + new PotionForge(ra, new ResourceLocation("forge", "realRandomPotion"), false, 0x0000ff); + + for(int i = 0; i < 20; i++) { + int r = rand.nextInt(200) + 35; + while(taken.contains(r)) + r = rand.nextInt(200) + 35; + //r = 32+i; + taken.add(r); + // this potions will most likely not have the same IDs between server and client. + // The forge handshake on connect should fix this. + new PotionForge(r, new ResourceLocation("forge", "randomPotion" + r), false, 0xff00ff); + } + } + + protected class PotionForge extends Potion { + + public PotionForge(int potionID, ResourceLocation location, boolean badEffect, int potionColor) { + super(potionID, location, badEffect, potionColor); + setPotionName("potion." + location.getResourcePath()); + } + + protected PotionForge(ResourceLocation location, boolean badEffect, int potionColor) { + super(location, badEffect, potionColor); + setPotionName("potion." + location.getResourcePath()); + } + + @Override + public void renderInventoryEffect(int x, int y, PotionEffect effect, Minecraft mc) { + Potion potion = Potion.potionTypes[effect.getPotionID()]; + + mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + TextureAtlasSprite sprite = mc.getTextureMapBlocks().getAtlasSprite("minecraft:blocks/fire_layer_0"); + + x += 6; + y += 7; + + int width = 18; + int height = width; +/* + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.startDrawingQuads(); + worldrenderer.setColorOpaque_I(potion.getLiquidColor()); + worldrenderer.addVertexWithUV((double) x, (double) (y + height), 0.0D, sprite.getMinU(), sprite.getMaxV()); + worldrenderer.addVertexWithUV((double)(x + width), (double)(y + height), 0.0D, sprite.getMaxU(), sprite.getMaxV()); + worldrenderer.addVertexWithUV((double)(x + width), (double)y, 0.0D, sprite.getMaxU(), sprite.getMinV()); + worldrenderer.addVertexWithUV((double)x, (double)y, 0.0D, sprite.getMinU(), sprite.getMinV()); + tessellator.draw();*/ + } + } +} From d58ad8db68da19c0603b5d104f847bbd03a5081c Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 29 Nov 2015 22:41:11 -0500 Subject: [PATCH 078/133] Fix problem with spam from registry on loading a second world. Empty the staging. --- .../fml/common/registry/PersistentRegistryManager.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java index 138cfd882..b27ccec4e 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java @@ -188,6 +188,9 @@ public class PersistentRegistryManager // The id map changed, ensure we apply object holders ObjectHolderRegistry.INSTANCE.applyObjectHolders(); + // Clean out the staging registry now, we're done with it + PersistentRegistry.STAGING.clean(); + // Return an empty list, because we're good return ImmutableList.of(); } @@ -259,8 +262,10 @@ public class PersistentRegistryManager } // the id mapping has reverted, fire remap events for those that care about id changes Loader.instance().fireRemapEvent(ImmutableMap.of(), ImmutableMap.of()); + // the id mapping has reverted, ensure we sync up the object holders ObjectHolderRegistry.INSTANCE.applyObjectHolders(); + FMLLog.fine("Frozen state restored."); } public static void freezeData() From 55e707cc0770af2c3a73eb43989af612cd26c945 Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 29 Nov 2015 23:12:34 -0500 Subject: [PATCH 079/133] Some tweaks - GameRegistry is modder facing API, so avoid having MC methods there. Fix a couple of registry bugs. --- .../common/registry/FMLControlledNamespacedRegistry.java | 2 +- .../net/minecraftforge/fml/common/registry/GameData.java | 9 +-------- .../minecraftforge/fml/common/registry/GameRegistry.java | 5 ----- .../fml/common/registry/PersistentRegistryManager.java | 2 +- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java index e35847845..9d620514c 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java @@ -28,7 +28,7 @@ import net.minecraftforge.fml.common.registry.RegistryDelegate.Delegate; public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaultedByKey { - public static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("fml.debugRegistryEntries", "false")); + public static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("fml.debugRegistryEntries", "true")); private final Class superType; private final boolean isDelegated; private final Field delegateAccessor; diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java index f8e850b6d..8833d69d0 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java @@ -32,7 +32,7 @@ public class GameData static final int MAX_BLOCK_ID = 4095; static final int MIN_ITEM_ID = 4096; static final int MAX_ITEM_ID = 31999; - public static final int MIN_POTION_ID = 32; // 0-31 are vanilla, forge start at 32 + public static final int MIN_POTION_ID = 0; // 0-~31 are vanilla, forge start at 32 public static final int MAX_POTION_ID = 255; // S1DPacketEntityEffect sends bytes, we can only use 255 private static final GameData mainData = new GameData(); @@ -147,13 +147,6 @@ public class GameData return iBlockRegistry.add(idHint, name, block); } - /** - * Called from GameRegistry, which is called from Potion-Constructor - */ - int registerPotion(Potion potion, ResourceLocation name, int id) { - return iPotionRegistry.add(id, name, potion); - } - /** * Prefix the supplied name with the current mod id. *

diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java index 954e2c6d3..04182af02 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameRegistry.java @@ -236,11 +236,6 @@ public class GameRegistry } } - /** Called from Potion Constructor */ - public static int registerPotion(Potion potion, ResourceLocation name, int potionID) { - return GameData.getMain().registerPotion(potion, name, potionID); - } - public static void addRecipe(ItemStack output, Object... params) { addShapedRecipe(output, params); diff --git a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java index 9683db840..a8c4a157a 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java @@ -217,8 +217,8 @@ public class PersistentRegistryManager private static void loadFrozenDataToStagingRegistry(Map> remaps, ResourceLocation registryName, Class regType) { - FMLControlledNamespacedRegistry newRegistry = PersistentRegistry.STAGING.getRegistry(registryName, regType); FMLControlledNamespacedRegistry frozenRegistry = PersistentRegistry.FROZEN.getRegistry(registryName, regType); + FMLControlledNamespacedRegistry newRegistry = PersistentRegistry.STAGING.getOrShallowCopyRegistry(registryName, regType, frozenRegistry); newRegistry.loadIds(frozenRegistry.getEntriesNotIn(newRegistry), Maps.newLinkedHashMap(), remaps.get(registryName), frozenRegistry, registryName); } From cf4c0ca0011026e74a0fe93396b4b8a036276f7d Mon Sep 17 00:00:00 2001 From: cpw Date: Mon, 30 Nov 2015 14:14:03 -0500 Subject: [PATCH 080/133] Fixup Jline integration --- jsons/1.8.8-dev.json | 5 +++++ jsons/1.8.8-rel.json | 7 +++++++ .../server/dedicated/DedicatedServer.java.patch | 16 ++++++---------- .../minecraft/util/ChatComponentStyle.java.patch | 2 +- .../net/minecraft/util/ChatStyle.java.patch | 2 +- .../net/minecraft/util/IChatComponent.java.patch | 4 ++-- 6 files changed, 22 insertions(+), 14 deletions(-) diff --git a/jsons/1.8.8-dev.json b/jsons/1.8.8-dev.json index 72552fdb6..0fb703e28 100644 --- a/jsons/1.8.8-dev.json +++ b/jsons/1.8.8-dev.json @@ -8,6 +8,11 @@ { "name": "net.minecraft:launchwrapper:1.12" }, + { + "name": "jline:jline:2.13", + "children": ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, { "name": "com.google.code.findbugs:jsr305:1.3.9", "children": ["sources"], diff --git a/jsons/1.8.8-rel.json b/jsons/1.8.8-rel.json index 2f71ce7ac..e25ac3ab6 100644 --- a/jsons/1.8.8-rel.json +++ b/jsons/1.8.8-rel.json @@ -39,6 +39,13 @@ "name": "org.ow2.asm:asm-all:5.0.3", "serverreq":true }, + { + "name": "jline:jline:2.13", + "url" : "http://files.minecraftforge.net/maven/", + "checksums" : [ "2d9530d0a25daffaffda7c35037b046b627bb171" ], + "serverreq":true, + "clientreq":false + }, { "name": "com.typesafe.akka:akka-actor_2.11:2.3.3", "url" : "http://files.minecraftforge.net/maven/", diff --git a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch index c4eedd946..3669b9d00 100644 --- a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -8,15 +8,15 @@ public DedicatedServer(File p_i1508_1_) { -@@ -88,6 +89,7 @@ - +@@ -82,6 +83,7 @@ + { public void run() { + if (net.minecraftforge.server.console.TerminalHandler.handleCommands(DedicatedServer.this)) return; BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in)); String s4; -@@ -107,6 +108,8 @@ +@@ -107,6 +109,8 @@ field_155771_h.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); } @@ -25,7 +25,7 @@ field_155771_h.info("Loading properties"); this.field_71340_o = new PropertyManager(new File("server.properties")); this.field_154332_n = new ServerEula(new File("eula.txt")); -@@ -198,6 +201,7 @@ +@@ -198,6 +202,7 @@ } else { @@ -33,7 +33,7 @@ this.func_152361_a(new DedicatedPlayerList(this)); long j = System.nanoTime(); -@@ -244,6 +248,7 @@ +@@ -244,6 +249,7 @@ this.func_71191_d((this.func_71207_Z() + 8) / 16 * 16); this.func_71191_d(MathHelper.func_76125_a(this.func_71207_Z(), 64, 256)); this.field_71340_o.func_73667_a("max-build-height", Integer.valueOf(this.func_71207_Z())); @@ -41,7 +41,7 @@ field_155771_h.info("Preparing level \"" + this.func_71270_I() + "\""); this.func_71247_a(this.func_71270_I(), this.func_71270_I(), k, worldtype, s2); long i1 = System.nanoTime() - j; -@@ -272,7 +277,7 @@ +@@ -272,7 +278,7 @@ thread1.start(); } @@ -50,7 +50,3 @@ } } } -+ public void func_145747_a(net.minecraft.util.IChatComponent message) { field_155771_h.info(message.func_150254_d()); } - - public void func_71235_a(WorldSettings.GameType p_71235_1_) - { diff --git a/patches/minecraft/net/minecraft/util/ChatComponentStyle.java.patch b/patches/minecraft/net/minecraft/util/ChatComponentStyle.java.patch index c8a5e732d..fd4f0534d 100644 --- a/patches/minecraft/net/minecraft/util/ChatComponentStyle.java.patch +++ b/patches/minecraft/net/minecraft/util/ChatComponentStyle.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/util/ChatComponentStyle.java +++ ../src-work/minecraft/net/minecraft/util/ChatComponentStyle.java -@@ -81,7 +81,6 @@ +@@ -74,7 +74,6 @@ return stringbuilder.toString(); } diff --git a/patches/minecraft/net/minecraft/util/ChatStyle.java.patch b/patches/minecraft/net/minecraft/util/ChatStyle.java.patch index 2622b5ec4..55efa51da 100644 --- a/patches/minecraft/net/minecraft/util/ChatStyle.java.patch +++ b/patches/minecraft/net/minecraft/util/ChatStyle.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/util/ChatStyle.java +++ ../src-work/minecraft/net/minecraft/util/ChatStyle.java -@@ -230,7 +230,6 @@ +@@ -229,7 +229,6 @@ return this; } diff --git a/patches/minecraft/net/minecraft/util/IChatComponent.java.patch b/patches/minecraft/net/minecraft/util/IChatComponent.java.patch index 2605247ba..2f0530ce4 100644 --- a/patches/minecraft/net/minecraft/util/IChatComponent.java.patch +++ b/patches/minecraft/net/minecraft/util/IChatComponent.java.patch @@ -1,10 +1,10 @@ --- ../src-base/minecraft/net/minecraft/util/IChatComponent.java +++ ../src-work/minecraft/net/minecraft/util/IChatComponent.java -@@ -32,7 +32,6 @@ +@@ -31,7 +31,6 @@ String func_150260_c(); - @SideOnly(Side.CLIENT) String func_150254_d(); - List func_150253_a(); + List func_150253_a(); From ff42107b927c336229beda297d84fca5edec478f Mon Sep 17 00:00:00 2001 From: cpw Date: Mon, 30 Nov 2015 14:14:33 -0500 Subject: [PATCH 081/133] A few fixes --- .../net/minecraft/potion/Potion.java.patch | 14 ++++++++------ .../registry/FMLControlledNamespacedRegistry.java | 2 +- .../common/registry/PersistentRegistryManager.java | 1 + .../minecraftforge/debug/ModelAnimationDebug.java | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/patches/minecraft/net/minecraft/potion/Potion.java.patch b/patches/minecraft/net/minecraft/potion/Potion.java.patch index 621a89f3c..63d5eb26d 100644 --- a/patches/minecraft/net/minecraft/potion/Potion.java.patch +++ b/patches/minecraft/net/minecraft/potion/Potion.java.patch @@ -9,18 +9,20 @@ private static final Map field_180150_I = Maps.newHashMap(); public static final Potion field_180151_b = null; public static final Potion field_76424_c = (new Potion(1, new ResourceLocation("speed"), false, 8171462)).func_76390_b("potion.moveSpeed").func_76399_b(0, 0).func_111184_a(SharedMonsterAttributes.field_111263_d, "91AEAA56-376B-4498-935B-2F7F68070635", 0.20000000298023224D, 2); -@@ -64,8 +64,10 @@ +@@ -64,10 +64,10 @@ private double field_76412_L; private boolean field_76413_M; + @Deprecated // use the Constructor without potion ID or everything will explode. protected Potion(int p_i45897_1_, ResourceLocation p_i45897_2_, boolean p_i45897_3_, int p_i45897_4_) { -+ p_i45897_1_ = net.minecraftforge.fml.common.registry.GameRegistry.registerPotion(this, p_i45897_2_, p_i45897_1_); - this.field_76415_H = p_i45897_1_; - field_76425_a[p_i45897_1_] = this; +- this.field_76415_H = p_i45897_1_; +- field_76425_a[p_i45897_1_] = this; ++ net.minecraftforge.fml.common.registry.GameData.getPotionRegistry().func_177775_a(p_i45897_1_, p_i45897_2_, this); field_180150_I.put(p_i45897_2_, this); -@@ -83,14 +85,18 @@ + this.field_76418_K = p_i45897_3_; + +@@ -83,14 +83,18 @@ this.field_76414_N = p_i45897_4_; } @@ -41,7 +43,7 @@ } protected Potion func_76399_b(int p_76399_1_, int p_76399_2_) -@@ -310,4 +316,27 @@ +@@ -310,4 +314,27 @@ { return p_111183_2_.func_111164_d() * (double)(p_111183_1_ + 1); } diff --git a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java index 9d620514c..e35847845 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java @@ -28,7 +28,7 @@ import net.minecraftforge.fml.common.registry.RegistryDelegate.Delegate; public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaultedByKey { - public static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("fml.debugRegistryEntries", "true")); + public static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("fml.debugRegistryEntries", "false")); private final Class superType; private final boolean isDelegated; private final Field delegateAccessor; diff --git a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java index a8c4a157a..03d997d0d 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java @@ -256,6 +256,7 @@ public class PersistentRegistryManager if (!PersistentRegistry.FROZEN.isPopulated()) { FMLLog.warning("Can't revert to frozen GameData state without freezing first."); + return; } else { diff --git a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java index fbdb0e254..20e48161c 100644 --- a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java @@ -63,7 +63,6 @@ public class ModelAnimationDebug { public void preInit(FMLPreInitializationEvent event) { - B3DLoader.instance.addDomain(MODID); GameRegistry.registerBlock(new Block(Material.wood) { { @@ -149,6 +148,7 @@ public class ModelAnimationDebug public void preInit(FMLPreInitializationEvent event) { super.preInit(event); + B3DLoader.instance.addDomain(MODID); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(GameRegistry.findBlock(MODID, blockName)), 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + blockName, "inventory")); } From 8187f48ddcd306859aa98b9fd69dd375ee328c09 Mon Sep 17 00:00:00 2001 From: cpw Date: Tue, 1 Dec 2015 00:14:05 -0500 Subject: [PATCH 082/133] Allow entity selectors to select "." in entity names. Closes #2125 --- .../minecraft/command/PlayerSelector.java.patch | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 patches/minecraft/net/minecraft/command/PlayerSelector.java.patch diff --git a/patches/minecraft/net/minecraft/command/PlayerSelector.java.patch b/patches/minecraft/net/minecraft/command/PlayerSelector.java.patch new file mode 100644 index 000000000..1aacfa255 --- /dev/null +++ b/patches/minecraft/net/minecraft/command/PlayerSelector.java.patch @@ -0,0 +1,14 @@ +--- ../src-base/minecraft/net/minecraft/command/PlayerSelector.java ++++ ../src-work/minecraft/net/minecraft/command/PlayerSelector.java +@@ -36,9 +36,9 @@ + + public class PlayerSelector + { +- private static final Pattern field_82389_a = Pattern.compile("^@([pare])(?:\\[([\\w=,!-]*)\\])?$"); ++ private static final Pattern field_82389_a = Pattern.compile("^@([pare])(?:\\[([\\w\\.=,!-]*)\\])?$"); // FORGE: allow . in entity selectors + private static final Pattern field_82387_b = Pattern.compile("\\G([-!]?[\\w-]*)(?:$|,)"); +- private static final Pattern field_82388_c = Pattern.compile("\\G(\\w+)=([-!]?[\\w-]*)(?:$|,)"); ++ private static final Pattern field_82388_c = Pattern.compile("\\G(\\w+)=([-!]?[\\w\\.-]*)(?:$|,)"); // FORGE: allow . in entity selectors + private static final Set field_179666_d = Sets.newHashSet(new String[] {"x", "y", "z", "dx", "dy", "dz", "rm", "r"}); + + public static EntityPlayerMP func_82386_a(ICommandSender p_82386_0_, String p_82386_1_) From a703367553290555b3455301828a4cddefe03dc9 Mon Sep 17 00:00:00 2001 From: cpw Date: Tue, 1 Dec 2015 13:08:35 -0500 Subject: [PATCH 083/133] Be noisy when API is in a coremod. It'll never work and modders should realize that fact. --- .../net/minecraftforge/fml/common/Loader.java | 2 +- .../fml/common/ModAPIManager.java | 3 +++ .../fml/common/ModClassLoader.java | 20 +++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/fml/common/Loader.java b/src/main/java/net/minecraftforge/fml/common/Loader.java index 14ee5d194..b58949b8c 100644 --- a/src/main/java/net/minecraftforge/fml/common/Loader.java +++ b/src/main/java/net/minecraftforge/fml/common/Loader.java @@ -639,7 +639,7 @@ public class Loader return "8.0.99.99"; } - public ClassLoader getModClassLoader() + public ModClassLoader getModClassLoader() { return modClassLoader; } diff --git a/src/main/java/net/minecraftforge/fml/common/ModAPIManager.java b/src/main/java/net/minecraftforge/fml/common/ModAPIManager.java index 4f4d8b2cd..5733190e7 100644 --- a/src/main/java/net/minecraftforge/fml/common/ModAPIManager.java +++ b/src/main/java/net/minecraftforge/fml/common/ModAPIManager.java @@ -90,6 +90,9 @@ public class ModAPIManager { public void validate(String providedAPI, String apiOwner, String apiVersion) { + if (Loader.instance().getModClassLoader().containsSource(this.getSource())) { + FMLLog.bigWarning("The API %s from source %s is loaded from an incompatible classloader. THIS WILL NOT WORK!", providedAPI, this.getSource().getAbsolutePath()); + } // TODO Compare this annotation data to the one we first found. Maybe barf if there is inconsistency? } diff --git a/src/main/java/net/minecraftforge/fml/common/ModClassLoader.java b/src/main/java/net/minecraftforge/fml/common/ModClassLoader.java index 161f93623..854ff23c4 100644 --- a/src/main/java/net/minecraftforge/fml/common/ModClassLoader.java +++ b/src/main/java/net/minecraftforge/fml/common/ModClassLoader.java @@ -19,6 +19,7 @@ import java.net.URISyntaxException; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Set; @@ -30,6 +31,7 @@ import net.minecraftforge.fml.common.discovery.ASMDataTable; import org.apache.logging.log4j.Level; import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; /** * A simple delegating class loader used to load mods into the system @@ -42,6 +44,7 @@ public class ModClassLoader extends URLClassLoader { private static final List STANDARD_LIBRARIES = ImmutableList.of("jinput.jar", "lwjgl.jar", "lwjgl_util.jar", "rt.jar"); private LaunchClassLoader mainClassLoader; + private List sources; public ModClassLoader(ClassLoader parent) { super(new URL[0], null); @@ -52,6 +55,7 @@ public class ModClassLoader extends URLClassLoader { URL url = modFile.toURI().toURL(); mainClassLoader.addURL(url); + this.sources.add(modFile); } @Override @@ -148,4 +152,20 @@ public class ModClassLoader extends URLClassLoader modAPI.initTable(dataTable); return modAPI; } + + List parentURLs = null; + public boolean containsSource(File source) + { + if (parentURLs == null) { + parentURLs = Arrays.asList(mainClassLoader.getURLs()); + } + try + { + return parentURLs.contains(source.toURI().toURL()); + } catch (MalformedURLException e) + { + // shouldn't happen + return false; + } + } } From 7a960edb35564127235905e5aa8868e31ee9cf28 Mon Sep 17 00:00:00 2001 From: Arkan Emberwalker Date: Wed, 27 May 2015 16:59:10 +0100 Subject: [PATCH 084/133] Fix language adapter loading. The language adapter is now properly picked up after the mod is loaded on the classpath, fixing the ClassNotFoundException occurring before. Also fixed some minor formatting and made it throw a full RuntimeException on failure. Fix up some formatting --- .../fml/common/FMLModContainer.java | 91 +++++++++++-------- 1 file changed, 52 insertions(+), 39 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/FMLModContainer.java b/src/main/java/net/minecraftforge/fml/common/FMLModContainer.java index 05ea50593..eec059fe4 100644 --- a/src/main/java/net/minecraftforge/fml/common/FMLModContainer.java +++ b/src/main/java/net/minecraftforge/fml/common/FMLModContainer.java @@ -86,12 +86,12 @@ public class FMLModContainer implements ModContainer private String modLanguage; private ILanguageAdapter languageAdapter; private Disableable disableability; - private ListMultimap,Method> eventMethods; + private ListMultimap, Method> eventMethods; private Map customModProperties; private ModCandidate candidate; private URL updateJSONUrl; - public FMLModContainer(String className, ModCandidate container, Map modDescriptor) + public FMLModContainer(String className, ModCandidate container, Map modDescriptor) { this.className = className; this.source = container.getModContainer(); @@ -99,7 +99,7 @@ public class FMLModContainer implements ModContainer this.descriptor = modDescriptor; this.eventMethods = ArrayListMultimap.create(); - this.modLanguage = (String) modDescriptor.get("modLanguage"); + this.modLanguage = (String)modDescriptor.get("modLanguage"); String languageAdapterType = (String)modDescriptor.get("modLanguageAdapter"); if (Strings.isNullOrEmpty(languageAdapterType)) { @@ -107,27 +107,33 @@ public class FMLModContainer implements ModContainer } else { - try - { - this.languageAdapter = (ILanguageAdapter)Class.forName(languageAdapterType, true, Loader.instance().getModClassLoader()).newInstance(); - FMLLog.finer("Using custom language adapter %s (type %s) for %s (modid %s)", this.languageAdapter, languageAdapterType, this.className, getModId()); - } - catch (Exception ex) - { - FMLLog.log(Level.ERROR, ex, "Error constructing custom mod language adapter %s (referenced by %s) (modid: %s)", languageAdapterType, this.className, getModId()); - throw new LoaderException(ex); - } + // Delay loading of the adapter until the mod is on the classpath, in case the mod itself contains it. + this.languageAdapter = null; + FMLLog.finer("Using custom language adapter %s for %s (modid: %s)", languageAdapterType, this.className, getModId()); } } private ILanguageAdapter getLanguageAdapter() { + if (languageAdapter == null) + { + try + { + languageAdapter = (ILanguageAdapter)Class.forName((String)descriptor.get("modLanguageAdapter"), true, Loader.instance().getModClassLoader()).newInstance(); + } + catch (Exception ex) + { + FMLLog.log(Level.ERROR, ex, "Error constructing custom mod language adapter referenced by %s (modid: %s)", this.className, getModId()); + throw new RuntimeException(ex); + } + } return languageAdapter; } + @Override public String getModId() { - return (String) descriptor.get("modid"); + return (String)descriptor.get("modid"); } @Override @@ -169,7 +175,7 @@ public class FMLModContainer implements ModContainer Set requirements = Sets.newHashSet(); List dependencies = Lists.newArrayList(); List dependants = Lists.newArrayList(); - annotationDependencies = (String) descriptor.get("dependencies"); + annotationDependencies = (String)descriptor.get("dependencies"); Loader.instance().computeDependencies(annotationDependencies, requirements, dependencies, dependants); dependants.addAll(Loader.instance().getInjectedBefore(getModId())); dependencies.addAll(Loader.instance().getInjectedAfter(getModId())); @@ -184,16 +190,16 @@ public class FMLModContainer implements ModContainer } if (Strings.isNullOrEmpty(modMetadata.name)) { - FMLLog.log(getModId(), Level.INFO,"Mod %s is missing the required element 'name'. Substituting %s", getModId(), getModId()); + FMLLog.log(getModId(), Level.INFO, "Mod %s is missing the required element 'name'. Substituting %s", getModId(), getModId()); modMetadata.name = getModId(); } - internalVersion = (String) descriptor.get("version"); + internalVersion = (String)descriptor.get("version"); if (Strings.isNullOrEmpty(internalVersion)) { Properties versionProps = searchForVersionProperties(); if (versionProps != null) { - internalVersion = versionProps.getProperty(getModId()+".version"); + internalVersion = versionProps.getProperty(getModId() + ".version"); FMLLog.log(getModId(), Level.DEBUG, "Found version %s for mod %s in version.properties, using", internalVersion, getModId()); } @@ -209,7 +215,7 @@ public class FMLModContainer implements ModContainer modMetadata.version = internalVersion = "1.0"; } - String mcVersionString = (String) descriptor.get("acceptedMinecraftVersions"); + String mcVersionString = (String)descriptor.get("acceptedMinecraftVersions"); if (!Strings.isNullOrEmpty(mcVersionString)) { minecraftAccepted = VersionParser.parseRange(mcVersionString); @@ -237,13 +243,13 @@ public class FMLModContainer implements ModContainer { try { - FMLLog.log(getModId(), Level.DEBUG,"Attempting to load the file version.properties from %s to locate a version number for %s", getSource().getName(), getModId()); + FMLLog.log(getModId(), Level.DEBUG, "Attempting to load the file version.properties from %s to locate a version number for %s", getSource().getName(), getModId()); Properties version = null; if (getSource().isFile()) { ZipFile source = new ZipFile(getSource()); ZipEntry versionFile = source.getEntry("version.properties"); - if (versionFile!=null) + if (versionFile != null) { version = new Properties(); version.load(source.getInputStream(versionFile)); @@ -252,7 +258,7 @@ public class FMLModContainer implements ModContainer } else if (getSource().isDirectory()) { - File propsFile = new File(getSource(),"version.properties"); + File propsFile = new File(getSource(), "version.properties"); if (propsFile.exists() && propsFile.isFile()) { version = new Properties(); @@ -343,11 +349,11 @@ public class FMLModContainer implements ModContainer if (m.getParameterTypes().length == 1 && FMLEvent.class.isAssignableFrom(m.getParameterTypes()[0])) { m.setAccessible(true); - eventMethods.put((Class) m.getParameterTypes()[0],m); + eventMethods.put((Class)m.getParameterTypes()[0], m); } else { - FMLLog.log(getModId(), Level.ERROR,"The mod %s appears to have an invalid event annotation %s. This annotation can only apply to methods with recognized event arguments - it will not be called", getModId(), a.annotationType().getSimpleName()); + FMLLog.log(getModId(), Level.ERROR, "The mod %s appears to have an invalid event annotation %s. This annotation can only apply to methods with recognized event arguments - it will not be called", getModId(), a.annotationType().getSimpleName()); } } else if (a.annotationType().equals(Mod.InstanceFactory.class)) @@ -359,7 +365,7 @@ public class FMLModContainer implements ModContainer } else if (!(Modifier.isStatic(m.getModifiers()) && m.getParameterTypes().length == 0)) { - FMLLog.log(getModId(), Level.ERROR, "The InstanceFactory annotation can only apply to a static method, taking zero arguments - it will be ignored on %s(%s)", m.getName(), Arrays.asList(m.getParameterTypes())); + FMLLog.log(getModId(), Level.ERROR, "The InstanceFactory annotation can only apply to a static method, taking zero arguments - it will be ignored on %s(%s)", m.getName(), Arrays.asList(m.getParameterTypes())); } else if (factoryMethod != null) { @@ -399,7 +405,7 @@ public class FMLModContainer implements ModContainer String annotationName = annName[annName.length - 1]; for (ASMData targets : annotations.get(annotationClassName)) { - String targetMod = (String) targets.getAnnotationInfo().get("value"); + String targetMod = (String)targets.getAnnotationInfo().get("value"); Field f = null; Object injectedMod = null; ModContainer mc = this; @@ -475,7 +481,7 @@ public class FMLModContainer implements ModContainer ImmutableList certList = certBuilder.build(); sourceFingerprints = ImmutableSet.copyOf(certList); - String expectedFingerprint = (String) descriptor.get("certificateFingerprint"); + String expectedFingerprint = (String)descriptor.get("certificateFingerprint"); fingerprintNotPresent = true; @@ -498,13 +504,13 @@ public class FMLModContainer implements ModContainer } @SuppressWarnings("unchecked") - List> props = (List>) descriptor.get("customProperties"); + List> props = (List>)descriptor.get("customProperties"); if (props != null) { - com.google.common.collect.ImmutableMap.Builder builder = ImmutableMap.builder(); + com.google.common.collect.ImmutableMap.Builder builder = ImmutableMap.builder(); for (Map p : props) { - builder.put((String)p.get("k"),(String)p.get("v")); + builder.put((String)p.get("k"), (String)p.get("v")); } customModProperties = builder.build(); } @@ -513,7 +519,7 @@ public class FMLModContainer implements ModContainer customModProperties = EMPTY_PROPERTIES; } - Boolean hasDisableableFlag = (Boolean) descriptor.get("canBeDeactivated"); + Boolean hasDisableableFlag = (Boolean)descriptor.get("canBeDeactivated"); boolean hasReverseDepends = !event.getReverseDependencies().get(getModId()).isEmpty(); if (hasDisableableFlag != null && hasDisableableFlag) { @@ -524,7 +530,7 @@ public class FMLModContainer implements ModContainer disableability = hasReverseDepends ? Disableable.DEPENDENCIES : Disableable.RESTART; } Method factoryMethod = gatherAnnotations(clazz); - modInstance = getLanguageAdapter().getNewInstance(this,clazz, modClassLoader, factoryMethod); + modInstance = getLanguageAdapter().getNewInstance(this, clazz, modClassLoader, factoryMethod); NetworkRegistry.INSTANCE.register(this, clazz, (String)(descriptor.containsKey("acceptableRemoteVersions") ? descriptor.get("acceptableRemoteVersions") : null), event.getASMHarvestedData()); if (fingerprintNotPresent) { @@ -568,6 +574,7 @@ public class FMLModContainer implements ModContainer } return processedVersion; } + @Override public boolean isImmutable() { @@ -595,7 +602,7 @@ public class FMLModContainer implements ModContainer @Override public String toString() { - return "FMLMod:"+getModId()+"{"+getVersion()+"}"; + return "FMLMod:" + getModId() + "{" + getVersion() + "}"; } @Override @@ -609,20 +616,21 @@ public class FMLModContainer implements ModContainer { try { - return getSource().isDirectory() ? Class.forName("net.minecraftforge.fml.client.FMLFolderResourcePack", true, getClass().getClassLoader()) : Class.forName("net.minecraftforge.fml.client.FMLFileResourcePack",true, getClass().getClassLoader()); + return getSource().isDirectory() ? Class.forName("net.minecraftforge.fml.client.FMLFolderResourcePack", true, getClass().getClassLoader()) : Class.forName("net.minecraftforge.fml.client.FMLFileResourcePack", true, getClass().getClassLoader()); } catch (ClassNotFoundException e) { return null; } } + @Override public Map getSharedModDescriptor() { - Map descriptor = Maps.newHashMap(); + Map descriptor = Maps.newHashMap(); descriptor.put("modsystem", "FML"); descriptor.put("id", getModId()); - descriptor.put("version",getDisplayVersion()); + descriptor.put("version", getDisplayVersion()); descriptor.put("name", getName()); descriptor.put("url", modMetadata.url); descriptor.put("authors", modMetadata.getAuthorList()); @@ -639,7 +647,7 @@ public class FMLModContainer implements ModContainer @Override public String getGuiClassName() { - return (String) descriptor.get("guiFactory"); + return (String)descriptor.get("guiFactory"); } @Override @@ -650,7 +658,10 @@ public class FMLModContainer implements ModContainer private boolean isTrue(Boolean value) { - if (value == null) return false; + if (value == null) + { + return false; + } return value.booleanValue(); } @@ -661,7 +672,9 @@ public class FMLModContainer implements ModContainer boolean serverSideOnly = isTrue((Boolean)descriptor.get("serverSideOnly")); if (clientSideOnly && serverSideOnly) + { throw new RuntimeException("Mod annotation claims to be both client and server side only!"); + } Side side = FMLCommonHandler.instance().getSide(); @@ -685,4 +698,4 @@ public class FMLModContainer implements ModContainer { return updateJSONUrl; } -} +} \ No newline at end of file From 31faf63e941bcdb6284545a788907dbd878e6c4a Mon Sep 17 00:00:00 2001 From: cpw Date: Tue, 1 Dec 2015 15:20:10 -0500 Subject: [PATCH 085/133] Most requested feature of all time? TileEntity init method called after it's ready to roll. remove all the if (firstTicks) --- .../tileentity/TileEntity.java.patch | 13 ++++++- .../minecraft/world/chunk/Chunk.java.patch | 34 ++++++++++++++----- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch index 5e2a3c357..ac86c28d6 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch @@ -54,7 +54,7 @@ public double func_145835_a(double p_145835_1_, double p_145835_3_, double p_145835_5_) { double d0 = (double)this.field_174879_c.func_177958_n() + 0.5D - p_145835_1_; -@@ -279,4 +291,135 @@ +@@ -279,4 +291,146 @@ func_145826_a(TileEntityFlowerPot.class, "FlowerPot"); func_145826_a(TileEntityBanner.class, "Banner"); } @@ -188,5 +188,16 @@ + return this instanceof TileEntityCommandBlock || + this instanceof TileEntityMobSpawner || + this instanceof TileEntitySign; ++ } ++ ++ ++ /** ++ * Called from the Chunk when this is first added to the world. Override instead of adding ++ * if (firstTick) stuff in update. Happens after validate and after it has been placed into the Chunk tileEntity ++ * map. ++ */ ++ public void onLoad() ++ { ++ // NOOP + } } diff --git a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch index 2c8ef5224..1903a6983 100644 --- a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -1,6 +1,14 @@ --- ../src-base/minecraft/net/minecraft/world/chunk/Chunk.java +++ ../src-work/minecraft/net/minecraft/world/chunk/Chunk.java -@@ -167,7 +167,7 @@ +@@ -10,7 +10,6 @@ + import java.util.concurrent.Callable; + import java.util.concurrent.ConcurrentLinkedQueue; + import net.minecraft.block.Block; +-import net.minecraft.block.ITileEntityProvider; + import net.minecraft.block.material.Material; + import net.minecraft.block.state.IBlockState; + import net.minecraft.crash.CrashReport; +@@ -167,7 +166,7 @@ { Block block = this.func_150810_a(j, l - 1, k); @@ -9,7 +17,7 @@ { this.field_76634_f[k << 4 | j] = l; -@@ -440,12 +440,12 @@ +@@ -440,12 +439,12 @@ public int func_177437_b(BlockPos p_177437_1_) { @@ -24,7 +32,7 @@ } private Block func_150810_a(int p_150810_1_, int p_150810_2_, int p_150810_3_) -@@ -623,14 +623,19 @@ +@@ -623,14 +622,19 @@ extendedblockstorage.func_177484_a(i, j & 15, k, p_177436_2_); @@ -46,7 +54,7 @@ this.field_76637_e.func_175713_t(p_177436_1_); } } -@@ -647,8 +652,8 @@ +@@ -647,8 +651,8 @@ } else { @@ -57,7 +65,7 @@ if (j1 > 0) { -@@ -668,28 +673,18 @@ +@@ -668,28 +672,18 @@ } } @@ -88,7 +96,7 @@ this.field_76637_e.func_175690_a(p_177436_1_, tileentity1); } -@@ -792,6 +787,7 @@ +@@ -792,6 +786,7 @@ k = this.field_76645_j.length - 1; } @@ -96,7 +104,7 @@ p_76612_1_.field_70175_ag = true; p_76612_1_.field_70176_ah = this.field_76635_g; p_76612_1_.field_70162_ai = k; -@@ -830,13 +826,20 @@ +@@ -830,13 +825,20 @@ private TileEntity func_177422_i(BlockPos p_177422_1_) { Block block = this.func_177428_a(p_177422_1_); @@ -118,7 +126,7 @@ if (tileentity == null) { if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE) -@@ -849,11 +852,6 @@ +@@ -849,11 +851,6 @@ this.field_177447_w.add(p_177424_1_); } } @@ -130,7 +138,7 @@ return tileentity; } -@@ -873,7 +871,7 @@ +@@ -873,7 +870,7 @@ p_177426_2_.func_145834_a(this.field_76637_e); p_177426_2_.func_174878_a(p_177426_1_); @@ -139,6 +147,14 @@ { if (this.field_150816_i.containsKey(p_177426_1_)) { +@@ -882,6 +879,7 @@ + + p_177426_2_.func_145829_t(); + this.field_150816_i.put(p_177426_1_, p_177426_2_); ++ p_177426_2_.onLoad(); + } + } + @@ -910,8 +908,9 @@ entity.func_110123_P(); } From 606b402c2d01386f2f19c8411350fe5cd511bbd0 Mon Sep 17 00:00:00 2001 From: techbrew-mc Date: Tue, 1 Dec 2015 16:02:45 -0700 Subject: [PATCH 086/133] Initialize sources list Fixes crash NPE thrown by addFile() --- src/main/java/net/minecraftforge/fml/common/ModClassLoader.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/net/minecraftforge/fml/common/ModClassLoader.java b/src/main/java/net/minecraftforge/fml/common/ModClassLoader.java index 854ff23c4..8c37819c8 100644 --- a/src/main/java/net/minecraftforge/fml/common/ModClassLoader.java +++ b/src/main/java/net/minecraftforge/fml/common/ModClassLoader.java @@ -49,6 +49,7 @@ public class ModClassLoader extends URLClassLoader public ModClassLoader(ClassLoader parent) { super(new URL[0], null); this.mainClassLoader = (LaunchClassLoader)parent; + this.sources = new ArrayList(); } public void addFile(File modFile) throws MalformedURLException From f8447264e6962d93462e97fa1aea3f4b6a5ba3a7 Mon Sep 17 00:00:00 2001 From: cpw Date: Tue, 1 Dec 2015 19:54:40 -0500 Subject: [PATCH 087/133] Clean up chunk patch. --- .../minecraft/world/chunk/Chunk.java.patch | 44 ++++++++----------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch index 1903a6983..f05c96eb7 100644 --- a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -1,14 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/chunk/Chunk.java +++ ../src-work/minecraft/net/minecraft/world/chunk/Chunk.java -@@ -10,7 +10,6 @@ - import java.util.concurrent.Callable; - import java.util.concurrent.ConcurrentLinkedQueue; - import net.minecraft.block.Block; --import net.minecraft.block.ITileEntityProvider; - import net.minecraft.block.material.Material; - import net.minecraft.block.state.IBlockState; - import net.minecraft.crash.CrashReport; -@@ -167,7 +166,7 @@ +@@ -167,7 +167,7 @@ { Block block = this.func_150810_a(j, l - 1, k); @@ -17,7 +9,7 @@ { this.field_76634_f[k << 4 | j] = l; -@@ -440,12 +439,12 @@ +@@ -440,12 +440,12 @@ public int func_177437_b(BlockPos p_177437_1_) { @@ -32,7 +24,7 @@ } private Block func_150810_a(int p_150810_1_, int p_150810_2_, int p_150810_3_) -@@ -623,14 +622,19 @@ +@@ -623,14 +623,19 @@ extendedblockstorage.func_177484_a(i, j & 15, k, p_177436_2_); @@ -54,7 +46,7 @@ this.field_76637_e.func_175713_t(p_177436_1_); } } -@@ -647,8 +651,8 @@ +@@ -647,8 +652,8 @@ } else { @@ -65,7 +57,7 @@ if (j1 > 0) { -@@ -668,28 +672,18 @@ +@@ -668,28 +673,18 @@ } } @@ -96,7 +88,7 @@ this.field_76637_e.func_175690_a(p_177436_1_, tileentity1); } -@@ -792,6 +786,7 @@ +@@ -792,6 +787,7 @@ k = this.field_76645_j.length - 1; } @@ -104,7 +96,7 @@ p_76612_1_.field_70175_ag = true; p_76612_1_.field_70176_ah = this.field_76635_g; p_76612_1_.field_70162_ai = k; -@@ -830,13 +825,20 @@ +@@ -830,13 +826,20 @@ private TileEntity func_177422_i(BlockPos p_177422_1_) { Block block = this.func_177428_a(p_177422_1_); @@ -126,7 +118,7 @@ if (tileentity == null) { if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE) -@@ -849,11 +851,6 @@ +@@ -849,11 +852,6 @@ this.field_177447_w.add(p_177424_1_); } } @@ -138,7 +130,7 @@ return tileentity; } -@@ -873,7 +870,7 @@ +@@ -873,7 +871,7 @@ p_177426_2_.func_145834_a(this.field_76637_e); p_177426_2_.func_174878_a(p_177426_1_); @@ -147,7 +139,7 @@ { if (this.field_150816_i.containsKey(p_177426_1_)) { -@@ -882,6 +879,7 @@ +@@ -882,6 +880,7 @@ p_177426_2_.func_145829_t(); this.field_150816_i.put(p_177426_1_, p_177426_2_); @@ -155,7 +147,7 @@ } } -@@ -910,8 +908,9 @@ +@@ -910,8 +909,9 @@ entity.func_110123_P(); } @@ -166,7 +158,7 @@ } public void func_76623_d() -@@ -927,6 +926,7 @@ +@@ -927,6 +927,7 @@ { this.field_76637_e.func_175681_c(this.field_76645_j[i]); } @@ -174,7 +166,7 @@ } public void func_76630_e() -@@ -936,8 +936,8 @@ +@@ -936,8 +937,8 @@ public void func_177414_a(Entity p_177414_1_, AxisAlignedBB p_177414_2_, List p_177414_3_, Predicate p_177414_4_) { @@ -185,7 +177,7 @@ 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); -@@ -976,8 +976,8 @@ +@@ -976,8 +977,8 @@ public void func_177430_a(Class p_177430_1_, AxisAlignedBB p_177430_2_, List p_177430_3_, Predicate p_177430_4_) { @@ -196,7 +188,7 @@ 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); -@@ -1137,8 +1137,10 @@ +@@ -1137,8 +1138,10 @@ while (!this.field_177447_w.isEmpty()) { BlockPos blockpos = (BlockPos)this.field_177447_w.poll(); @@ -208,7 +200,7 @@ { TileEntity tileentity = this.func_177422_i(blockpos); this.field_76637_e.func_175690_a(blockpos, tileentity); -@@ -1200,6 +1202,13 @@ +@@ -1200,6 +1203,13 @@ @SideOnly(Side.CLIENT) public void func_177439_a(byte[] p_177439_1_, int p_177439_2_, boolean p_177439_3_) { @@ -222,7 +214,7 @@ int i = 0; boolean flag = !this.field_76637_e.field_73011_w.func_177495_o(); -@@ -1267,10 +1276,16 @@ +@@ -1267,10 +1277,16 @@ this.field_76646_k = true; this.func_76590_a(); @@ -239,7 +231,7 @@ } public BiomeGenBase func_177411_a(BlockPos p_177411_1_, WorldChunkManager p_177411_2_) -@@ -1583,4 +1598,20 @@ +@@ -1583,4 +1599,20 @@ QUEUED, CHECK; } From ee61baee73c2c99c8f54008d2b0f55e03103c21a Mon Sep 17 00:00:00 2001 From: liach Date: Tue, 1 Dec 2015 22:01:21 -0800 Subject: [PATCH 088/133] Fix typo in `guava` --- src/main/java/net/minecraftforge/fml/common/ModClassLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/fml/common/ModClassLoader.java b/src/main/java/net/minecraftforge/fml/common/ModClassLoader.java index 854ff23c4..99911eb39 100644 --- a/src/main/java/net/minecraftforge/fml/common/ModClassLoader.java +++ b/src/main/java/net/minecraftforge/fml/common/ModClassLoader.java @@ -116,7 +116,7 @@ public class ModClassLoader extends URLClassLoader "librarylwjglopenal-", "soundsystem-", "netty-all-", - "quava-", + "guava-", "commons-lang3-", "commons-compress-", "commons-logging-", From 30bc2653c5995a26688a01633dee83f5cf7cb362 Mon Sep 17 00:00:00 2001 From: cpw Date: Thu, 3 Dec 2015 17:21:04 -0500 Subject: [PATCH 089/133] Add a flag to the modidremapping event. If the remapevent is because the registry is refreezing, it'll be true. --- src/main/java/net/minecraftforge/fml/common/Loader.java | 4 ++-- .../fml/common/event/FMLModIdMappingEvent.java | 5 +++-- .../fml/common/registry/PersistentRegistryManager.java | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/Loader.java b/src/main/java/net/minecraftforge/fml/common/Loader.java index b58949b8c..6cbd42021 100644 --- a/src/main/java/net/minecraftforge/fml/common/Loader.java +++ b/src/main/java/net/minecraftforge/fml/common/Loader.java @@ -974,9 +974,9 @@ public class Loader return PersistentRegistryManager.processIdRematches(missingMappings.values(), isLocalWorld, remapBlocks, remapItems); } - public void fireRemapEvent(Map remapBlocks, Map remapItems) + public void fireRemapEvent(Map remapBlocks, Map remapItems, boolean isFreezing) { - modController.propogateStateMessage(new FMLModIdMappingEvent(remapBlocks, remapItems)); + modController.propogateStateMessage(new FMLModIdMappingEvent(remapBlocks, remapItems, isFreezing)); } public void runtimeDisableMod(String modId) diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLModIdMappingEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLModIdMappingEvent.java index f628ea6b1..5b4b9a97d 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLModIdMappingEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLModIdMappingEvent.java @@ -44,9 +44,10 @@ public class FMLModIdMappingEvent extends FMLEvent { } public final ImmutableList remappedIds; - - public FMLModIdMappingEvent(Map blocks, Map items) + public final boolean isFrozen; + public FMLModIdMappingEvent(Map blocks, Map items, boolean isFrozen) { + this.isFrozen = isFrozen; List remappings = Lists.newArrayList(); for (Entry mapping : blocks.entrySet()) { diff --git a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java index 03d997d0d..daf8b669b 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java @@ -188,7 +188,7 @@ public class PersistentRegistryManager forAllRegistries(PersistentRegistry.ACTIVE, DumpRegistryFunction.OPERATION); // Tell mods that the ids have changed - Loader.instance().fireRemapEvent(remaps.get(BLOCKS), remaps.get(ITEMS)); + Loader.instance().fireRemapEvent(remaps.get(BLOCKS), remaps.get(ITEMS), false); // The id map changed, ensure we apply object holders ObjectHolderRegistry.INSTANCE.applyObjectHolders(); @@ -267,7 +267,7 @@ public class PersistentRegistryManager loadRegistry(r.getKey(), PersistentRegistry.FROZEN, PersistentRegistry.ACTIVE, PersistentRegistry.ACTIVE.registrySuperTypes.inverse().get(r.getKey())); } // the id mapping has reverted, fire remap events for those that care about id changes - Loader.instance().fireRemapEvent(ImmutableMap.of(), ImmutableMap.of()); + Loader.instance().fireRemapEvent(ImmutableMap.of(), ImmutableMap.of(), true); // the id mapping has reverted, ensure we sync up the object holders ObjectHolderRegistry.INSTANCE.applyObjectHolders(); From bb3596b31ebb565a73a5067fd789e6bdbea8a02c Mon Sep 17 00:00:00 2001 From: Minecrell Date: Tue, 1 Dec 2015 15:29:59 +0100 Subject: [PATCH 090/133] Improve the console command completer - Fix space after command getting removed when completing a subcommand together with the command prefix - Add support for completing without input (shows command list) - Sort command completion results - Fix console spamming command prefixes after closing the input stream --- .../server/console/ConsoleCommandCompleter.java | 13 +++++++------ .../server/console/TerminalHandler.java | 15 ++++++++------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/main/java/net/minecraftforge/server/console/ConsoleCommandCompleter.java b/src/main/java/net/minecraftforge/server/console/ConsoleCommandCompleter.java index af0216edb..fd73fbc3c 100644 --- a/src/main/java/net/minecraftforge/server/console/ConsoleCommandCompleter.java +++ b/src/main/java/net/minecraftforge/server/console/ConsoleCommandCompleter.java @@ -2,6 +2,7 @@ package net.minecraftforge.server.console; import static com.google.common.base.Preconditions.checkNotNull; +import java.util.Collections; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; @@ -28,14 +29,9 @@ public final class ConsoleCommandCompleter implements Completer public int complete(String buffer, int cursor, List candidates) { int len = buffer.length(); - buffer = buffer.trim(); - if (buffer.isEmpty()) - { - return cursor; - } boolean prefix; - if (buffer.charAt(0) != '/') + if (buffer.isEmpty() || buffer.charAt(0) != '/') { buffer = '/' + buffer; prefix = false; @@ -59,6 +55,7 @@ public final class ConsoleCommandCompleter implements Completer try { List completions = tabComplete.get(); + Collections.sort(completions); if (prefix) { candidates.addAll(completions); @@ -76,6 +73,10 @@ public final class ConsoleCommandCompleter implements Completer { return cursor - len; } + else if (prefix) + { + return cursor - len + pos + 1; + } else { return cursor - len + pos; diff --git a/src/main/java/net/minecraftforge/server/console/TerminalHandler.java b/src/main/java/net/minecraftforge/server/console/TerminalHandler.java index 3c9f6af28..142b32bc7 100644 --- a/src/main/java/net/minecraftforge/server/console/TerminalHandler.java +++ b/src/main/java/net/minecraftforge/server/console/TerminalHandler.java @@ -34,14 +34,15 @@ public final class TerminalHandler try { line = reader.readLine("> "); - - if (line != null) + if (line == null) { - line = line.trim(); - if (!line.isEmpty()) - { - server.addPendingCommand(line, server); - } + break; + } + + line = line.trim(); + if (!line.isEmpty()) + { + server.addPendingCommand(line, server); } } catch (IOException e) From 2324c2fd204ef6a51ef69f5b5729dabb0b724d4e Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Sun, 18 Oct 2015 21:40:52 +0200 Subject: [PATCH 091/133] Add shouldRender() to Potions that allows to hide them completely in the inventory --- .../InventoryEffectRenderer.java.patch | 24 ++++++++++++++- .../net/minecraft/potion/Potion.java.patch | 9 +++++- .../debug/NoPotionEffectRenderTest.java | 29 +++++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 src/test/java/net/minecraftforge/debug/NoPotionEffectRenderTest.java diff --git a/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch index fd3e46ca8..74f00edc5 100644 --- a/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch @@ -1,6 +1,28 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java -@@ -80,6 +80,8 @@ +@@ -27,7 +27,12 @@ + + protected void func_175378_g() + { +- if (!this.field_146297_k.field_71439_g.func_70651_bq().isEmpty()) ++ boolean hasVisibleEffect = false; ++ for(PotionEffect potioneffect : this.field_146297_k.field_71439_g.func_70651_bq()) { ++ Potion potion = Potion.field_76425_a[potioneffect.func_76456_a()]; ++ if(potion.shouldRender(potioneffect)) { hasVisibleEffect = true; break; } ++ } ++ if (!this.field_146297_k.field_71439_g.func_70651_bq().isEmpty() && hasVisibleEffect) + { + this.field_147003_i = 160 + (this.field_146294_l - this.field_146999_f - 200) / 2; + this.field_147045_u = true; +@@ -70,6 +75,7 @@ + for (PotionEffect potioneffect : this.field_146297_k.field_71439_g.func_70651_bq()) + { + Potion potion = Potion.field_76425_a[potioneffect.func_76456_a()]; ++ if(!potion.shouldRender(potioneffect)) continue; + GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + this.field_146297_k.func_110434_K().func_110577_a(field_147001_a); + this.func_73729_b(i, j, 0, 166, 140, 32); +@@ -80,6 +86,8 @@ this.func_73729_b(i + 6, j + 7, 0 + i1 % 8 * 18, 198 + i1 / 8 * 18, 18, 18); } diff --git a/patches/minecraft/net/minecraft/potion/Potion.java.patch b/patches/minecraft/net/minecraft/potion/Potion.java.patch index 05ec68e23..1ee629dcc 100644 --- a/patches/minecraft/net/minecraft/potion/Potion.java.patch +++ b/patches/minecraft/net/minecraft/potion/Potion.java.patch @@ -51,7 +51,7 @@ public boolean func_76398_f() { return this.field_76418_K; -@@ -310,4 +313,27 @@ +@@ -310,4 +313,34 @@ { return p_111183_2_.func_111164_d() * (double)(p_111183_1_ + 1); } @@ -59,6 +59,13 @@ + /* ======================================== FORGE START =====================================*/ + + /** ++ * If the Potion effect should be displayed in the players inventory ++ * @param effect the active PotionEffect ++ * @return true to display it (default), false to hide it. ++ */ ++ public boolean shouldRender(PotionEffect effect) { return true; } ++ ++ /** + * If the standard PotionEffect text (name and duration) should be drawn when this potion is active. + * @param effect the active PotionEffect + * @return true to draw the standard text diff --git a/src/test/java/net/minecraftforge/debug/NoPotionEffectRenderTest.java b/src/test/java/net/minecraftforge/debug/NoPotionEffectRenderTest.java new file mode 100644 index 000000000..f8d779140 --- /dev/null +++ b/src/test/java/net/minecraftforge/debug/NoPotionEffectRenderTest.java @@ -0,0 +1,29 @@ +package net.minecraftforge.debug; + +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; + +@Mod( modid = NoPotionEffectRenderTest.modID, name = "No Potion Effect Render Test", version = "0.0.0" ) +public class NoPotionEffectRenderTest { + public static final String modID = "nopotioneffect"; + + @Mod.EventHandler + public void preInit(FMLPreInitializationEvent event) { + TestPotion INSTANCE = new TestPotion(30, new ResourceLocation(modID, "test_potion"), false, 0xff00ff); + } + + public static class TestPotion extends Potion { + + public TestPotion(int potionID, ResourceLocation location, boolean badEffect, int potionColor) { + super(potionID, location, badEffect, potionColor); + } + + @Override + public boolean shouldRender(PotionEffect effect) { + return false; + } + } +} From 01f4a627be238d1a03a528cbc217663e3237571f Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 8 Dec 2015 00:34:42 -0800 Subject: [PATCH 092/133] Remove MCP reference patches. --- .../net/minecraft/block/Block.java.patch | 1219 ----------------- .../net/minecraft/block/BlockAir.java.patch | 9 - .../net/minecraft/block/BlockBush.java.patch | 66 - .../minecraft/block/BlockButton.java.patch | 46 - .../minecraft/block/BlockCactus.java.patch | 37 - .../net/minecraft/block/BlockChest.java.patch | 11 - .../net/minecraft/block/BlockCocoa.java.patch | 27 - .../net/minecraft/block/BlockCrops.java.patch | 77 -- .../minecraft/block/BlockDeadBush.java.patch | 33 - .../net/minecraft/block/BlockDoor.java.patch | 20 - .../block/BlockDoublePlant.java.patch | 89 -- .../minecraft/block/BlockFalling.java.patch | 10 - .../minecraft/block/BlockFarmland.java.patch | 11 - .../net/minecraft/block/BlockFire.java.patch | 211 --- .../minecraft/block/BlockFlowerPot.java.patch | 48 - .../net/minecraft/block/BlockGrass.java.patch | 41 - .../block/BlockHugeMushroom.java.patch | 23 - .../net/minecraft/block/BlockIce.java.patch | 35 - .../minecraft/block/BlockLadder.java.patch | 32 - .../minecraft/block/BlockLeaves.java.patch | 130 -- .../net/minecraft/block/BlockLever.java.patch | 67 - .../net/minecraft/block/BlockLog.java.patch | 24 - .../block/BlockMobSpawner.java.patch | 19 - .../minecraft/block/BlockMushroom.java.patch | 11 - .../minecraft/block/BlockMycelium.java.patch | 20 - .../block/BlockNetherWart.java.patch | 49 - .../minecraft/block/BlockNewLeaf.java.patch | 24 - .../net/minecraft/block/BlockNote.java.patch | 23 - .../minecraft/block/BlockOldLeaf.java.patch | 21 - .../net/minecraft/block/BlockOre.java.patch | 59 - .../net/minecraft/block/BlockPane.java.patch | 41 - .../block/BlockPistonBase.java.patch | 31 - .../block/BlockPistonMoving.java.patch | 37 - .../minecraft/block/BlockPotato.java.patch | 25 - .../minecraft/block/BlockPumpkin.java.patch | 11 - .../minecraft/block/BlockQuartz.java.patch | 29 - .../minecraft/block/BlockRailBase.java.patch | 147 -- .../block/BlockRedstoneComparator.java.patch | 24 - .../block/BlockRedstoneDiode.java.patch | 11 - .../block/BlockRedstoneOre.java.patch | 22 - .../block/BlockRedstoneWire.java.patch | 59 - .../net/minecraft/block/BlockReed.java.patch | 35 - .../block/BlockRotatedPillar.java.patch | 29 - .../minecraft/block/BlockSapling.java.patch | 10 - .../net/minecraft/block/BlockSkull.java.patch | 55 - .../net/minecraft/block/BlockSnow.java.patch | 53 - .../net/minecraft/block/BlockStem.java.patch | 42 - .../minecraft/block/BlockTallGrass.java.patch | 66 - .../net/minecraft/block/BlockTorch.java.patch | 38 - .../minecraft/block/BlockTrapDoor.java.patch | 43 - .../block/BlockTripWireHook.java.patch | 29 - .../net/minecraft/block/BlockVine.java.patch | 42 - .../BlockPistonStructureHelper.java.patch | 29 - .../block/state/BlockState.java.patch | 53 - .../block/state/BlockStateBase.java.patch | 12 - .../client/ClientBrandRetriever.java.patch | 10 - .../client/LoadingScreenRenderer.java.patch | 26 - .../net/minecraft/client/Minecraft.java.patch | 476 ------- .../client/audio/SoundManager.java.patch | 52 - .../entity/AbstractClientPlayer.java.patch | 10 - .../client/entity/EntityPlayerSP.java.patch | 80 -- .../client/gui/FontRenderer.java.patch | 155 --- .../minecraft/client/gui/GuiButton.java.patch | 24 - .../minecraft/client/gui/GuiChat.java.patch | 32 - .../client/gui/GuiCreateWorld.java.patch | 36 - .../client/gui/GuiIngameMenu.java.patch | 33 - .../client/gui/GuiMainMenu.java.patch | 44 - .../client/gui/GuiMultiplayer.java.patch | 19 - .../client/gui/GuiOverlayDebug.java.patch | 12 - .../minecraft/client/gui/GuiScreen.java.patch | 113 -- .../client/gui/GuiSelectWorld.java.patch | 11 - .../client/gui/GuiSleepMP.java.patch | 11 - .../minecraft/client/gui/GuiSlot.java.patch | 40 - .../gui/ServerListEntryNormal.java.patch | 23 - .../achievement/GuiAchievements.java.patch | 127 -- .../gui/achievement/GuiStats.java.patch | 19 - .../gui/inventory/GuiContainer.java.patch | 65 - .../inventory/GuiContainerCreative.java.patch | 267 ---- .../client/model/ModelBase.java.patch | 10 - .../client/model/ModelBox.java.patch | 18 - .../client/model/ModelRenderer.java.patch | 42 - .../model/PositionTextureVertex.java.patch | 13 - .../client/model/TexturedQuad.java.patch | 13 - .../ChunkProviderClient.java.patch | 10 - .../multiplayer/GuiConnecting.java.patch | 11 - .../multiplayer/PlayerControllerMP.java.patch | 69 - .../client/multiplayer/WorldClient.java.patch | 17 - .../NetHandlerHandshakeMemory.java.patch | 10 - .../network/NetHandlerLoginClient.java.patch | 14 - .../network/NetHandlerPlayClient.java.patch | 72 - .../client/network/OldServerPinger.java.patch | 10 - .../client/particle/EffectRenderer.java.patch | 33 - .../renderer/BlockModelRenderer.java.patch | 32 - .../renderer/BlockModelShapes.java.patch | 10 - .../BlockRendererDispatcher.java.patch | 49 - .../client/renderer/EntityRenderer.java.patch | 176 --- .../InventoryEffectRenderer.java.patch | 11 - .../renderer/ItemModelMesher.java.patch | 14 - .../client/renderer/ItemRenderer.java.patch | 65 - .../client/renderer/OpenGlHelper.java.patch | 26 - .../client/renderer/RenderGlobal.java.patch | 134 -- .../client/renderer/WorldRenderer.java.patch | 17 - .../WorldVertexBufferUploader.java.patch | 70 - .../renderer/block/model/BakedQuad.java.patch | 13 - .../block/model/FaceBakery.java.patch | 68 - .../model/ItemCameraTransforms.java.patch | 14 - .../block/model/ItemTransformVec3f.java.patch | 18 - .../model/ModelBlockDefinition.java.patch | 29 - .../block/statemap/StateMap.java.patch | 11 - .../renderer/chunk/RenderChunk.java.patch | 64 - .../entity/RenderEntityItem.java.patch | 52 - .../renderer/entity/RenderItem.java.patch | 128 -- .../renderer/entity/RenderManager.java.patch | 25 - .../renderer/entity/RenderPlayer.java.patch | 18 - .../renderer/entity/RenderVillager.java.patch | 11 - .../entity/RendererLivingEntity.java.patch | 49 - .../entity/layers/LayerArmorBase.java.patch | 102 -- .../renderer/texture/Stitcher.java.patch | 42 - .../texture/TextureAtlasSprite.java.patch | 33 - .../texture/TextureManager.java.patch | 18 - .../renderer/texture/TextureMap.java.patch | 190 --- .../renderer/texture/TextureUtil.java.patch | 15 - .../tileentity/RenderItemFrame.java.patch | 31 - .../TileEntityItemStackRenderer.java.patch | 10 - .../vertex/VertexFormatElement.java.patch | 49 - .../resources/AbstractResourcePack.java.patch | 11 - .../FallbackResourceManager.java.patch | 10 - .../resources/LanguageManager.java.patch | 10 - .../client/resources/Locale.java.patch | 11 - ...SimpleReloadableResourceManager.java.patch | 46 - .../client/resources/SkinManager.java.patch | 13 - .../resources/model/IBakedModel.java.patch | 21 - .../resources/model/ModelBakery.java.patch | 98 -- .../resources/model/ModelManager.java.patch | 14 - .../resources/model/ModelRotation.java.patch | 21 - .../client/settings/GameSettings.java.patch | 10 - .../client/shader/Framebuffer.java.patch | 57 - .../command/CommandEnchant.java.patch | 11 - .../minecraft/command/CommandFill.java.patch | 28 - .../command/CommandHandler.java.patch | 19 - .../command/server/CommandSetBlock.java.patch | 20 - .../server/CommandTestForBlock.java.patch | 11 - .../minecraft/crash/CrashReport.java.patch | 19 - .../crash/CrashReportCategory.java.patch | 16 - .../creativetab/CreativeTabs.java.patch | 106 -- .../enchantment/Enchantment.java.patch | 65 - .../enchantment/EnchantmentHelper.java.patch | 41 - .../net/minecraft/entity/Entity.java.patch | 312 ----- .../minecraft/entity/EntityHanging.java.patch | 12 - .../minecraft/entity/EntityList.java.patch | 68 - .../minecraft/entity/EntityLiving.java.patch | 41 - .../entity/EntityLivingBase.java.patch | 212 --- .../EntityMinecartCommandBlock.java.patch | 10 - .../EntitySpawnPlacementRegistry.java.patch | 15 - .../minecraft/entity/EntityTracker.java.patch | 35 - .../entity/EntityTrackerEntry.java.patch | 42 - .../ai/EntityAIAttackOnCollide.java.patch | 61 - .../entity/boss/EntityDragon.java.patch | 14 - .../entity/boss/EntityWither.java.patch | 11 - .../entity/boss/IBossDisplayData.java.patch | 10 - .../effect/EntityLightningBolt.java.patch | 12 - .../entity/item/EntityEnderPearl.java.patch | 25 - .../entity/item/EntityItem.java.patch | 94 -- .../entity/item/EntityItemFrame.java.patch | 11 - .../entity/item/EntityMinecart.java.patch | 454 ------ .../item/EntityMinecartContainer.java.patch | 10 - .../item/EntityMinecartEmpty.java.patch | 10 - .../item/EntityMinecartFurnace.java.patch | 10 - .../item/EntityMinecartHopper.java.patch | 10 - .../entity/item/EntityXPOrb.java.patch | 10 - .../entity/monster/EntityEnderman.java.patch | 37 - .../entity/monster/EntityMagmaCube.java.patch | 10 - .../entity/monster/EntitySlime.java.patch | 11 - .../entity/monster/EntityZombie.java.patch | 60 - .../entity/passive/EntityHorse.java.patch | 10 - .../entity/passive/EntityMooshroom.java.patch | 62 - .../entity/passive/EntityOcelot.java.patch | 11 - .../entity/passive/EntitySheep.java.patch | 45 - .../entity/passive/EntityVillager.java.patch | 44 - .../entity/player/EntityPlayer.java.patch | 637 --------- .../entity/player/EntityPlayerMP.java.patch | 92 -- .../entity/player/InventoryPlayer.java.patch | 17 - .../projectile/EntityFishHook.java.patch | 22 - .../net/minecraft/init/Bootstrap.java.patch | 35 - .../minecraft/inventory/Container.java.patch | 11 - .../inventory/ContainerBeacon.java.patch | 11 - .../ContainerBrewingStand.java.patch | 29 - .../inventory/ContainerEnchantment.java.patch | 85 -- .../inventory/ContainerPlayer.java.patch | 12 - .../inventory/ContainerRepair.java.patch | 47 - .../net/minecraft/inventory/Slot.java.patch | 83 -- .../inventory/SlotCrafting.java.patch | 14 - .../inventory/SlotFurnaceOutput.java.patch | 11 - .../net/minecraft/item/Item.java.patch | 688 ---------- .../net/minecraft/item/ItemArmor.java.patch | 47 - .../net/minecraft/item/ItemBlock.java.patch | 72 - .../net/minecraft/item/ItemBow.java.patch | 29 - .../net/minecraft/item/ItemBucket.java.patch | 12 - .../minecraft/item/ItemBucketMilk.java.patch | 11 - .../net/minecraft/item/ItemDye.java.patch | 56 - .../minecraft/item/ItemEmptyMap.java.patch | 11 - .../item/ItemFlintAndSteel.java.patch | 11 - .../net/minecraft/item/ItemHoe.java.patch | 17 - .../net/minecraft/item/ItemLilyPad.java.patch | 17 - .../net/minecraft/item/ItemMap.java.patch | 11 - .../item/ItemMonsterPlacer.java.patch | 107 -- .../net/minecraft/item/ItemRecord.java.patch | 18 - .../net/minecraft/item/ItemReed.java.patch | 11 - .../minecraft/item/ItemSeedFood.java.patch | 37 - .../net/minecraft/item/ItemSeeds.java.patch | 37 - .../net/minecraft/item/ItemShears.java.patch | 89 -- .../net/minecraft/item/ItemSign.java.patch | 11 - .../net/minecraft/item/ItemSkull.java.patch | 31 - .../net/minecraft/item/ItemSnow.java.patch | 13 - .../net/minecraft/item/ItemStack.java.patch | 149 -- .../net/minecraft/item/ItemSword.java.patch | 13 - .../net/minecraft/item/ItemTool.java.patch | 71 - .../item/crafting/FurnaceRecipes.java.patch | 20 - .../item/crafting/RecipeFireworks.java.patch | 36 - .../item/crafting/RecipeRepairItem.java.patch | 42 - .../item/crafting/RecipesArmorDyes.java.patch | 15 - .../item/crafting/RecipesBanners.java.patch | 27 - .../crafting/RecipesMapCloning.java.patch | 15 - .../item/crafting/ShapedRecipes.java.patch | 15 - .../item/crafting/ShapelessRecipes.java.patch | 15 - .../nbt/CompressedStreamTools.java.patch | 53 - .../minecraft/nbt/NBTSizeTracker.java.patch | 37 - .../minecraft/nbt/NBTTagByteArray.java.patch | 10 - .../minecraft/nbt/NBTTagCompound.java.patch | 27 - .../minecraft/nbt/NBTTagIntArray.java.patch | 10 - .../net/minecraft/nbt/NBTTagList.java.patch | 16 - .../net/minecraft/nbt/NBTTagString.java.patch | 11 - .../network/NetHandlerPlayServer.java.patch | 166 --- .../network/NetworkManager.java.patch | 53 - .../network/NetworkSystem.java.patch | 11 - .../network/ServerStatusResponse.java.patch | 92 -- .../handshake/client/C00Handshake.java.patch | 48 - .../client/C12PacketUpdateSign.java.patch | 11 - .../client/C17PacketCustomPayload.java.patch | 14 - .../server/S3FPacketCustomPayload.java.patch | 14 - .../server/S00PacketServerInfo.java.patch | 11 - .../net/minecraft/potion/Potion.java.patch | 30 - .../minecraft/potion/PotionEffect.java.patch | 100 -- .../minecraft/realms/RealmsConnect.java.patch | 19 - .../server/MinecraftServer.java.patch | 306 ----- .../dedicated/DedicatedServer.java.patch | 44 - .../server/gui/MinecraftServerGui.java.patch | 24 - .../integrated/IntegratedServer.java.patch | 97 -- .../management/ItemInWorldManager.java.patch | 257 ---- .../management/PlayerManager.java.patch | 224 --- .../management/PlayerProfileCache.java.patch | 50 - .../ServerConfigurationManager.java.patch | 223 --- .../network/NetHandlerHandshakeTCP.java.patch | 11 - .../network/NetHandlerLoginServer.java.patch | 20 - .../net/minecraft/stats/StatList.java.patch | 43 - .../tileentity/TileEntity.java.patch | 192 --- .../tileentity/TileEntityBeacon.java.patch | 20 - .../TileEntityBrewingStand.java.patch | 78 -- .../tileentity/TileEntityFurnace.java.patch | 51 - .../tileentity/TileEntityHopper.java.patch | 40 - .../tileentity/TileEntityNote.java.patch | 12 - .../tileentity/TileEntityPiston.java.patch | 22 - .../tileentity/TileEntitySign.java.patch | 11 - .../util/EnumChatFormatting.java.patch | 10 - .../net/minecraft/util/EnumFacing.java.patch | 76 - .../util/EnumWorldBlockLayer.java.patch | 12 - .../util/MessageSerializer.java.patch | 11 - .../net/minecraft/util/MouseHelper.java.patch | 10 - .../util/MovingObjectPosition.java.patch | 15 - .../util/ResourceLocation.java.patch | 26 - .../net/minecraft/util/Session.java.patch | 63 - .../minecraft/util/StringTranslate.java.patch | 64 - .../net/minecraft/util/Vec3.java.patch | 27 - .../WeightedRandomChestContent.java.patch | 72 - .../net/minecraft/world/ChunkCache.java.patch | 61 - .../net/minecraft/world/Explosion.java.patch | 52 - .../minecraft/world/IBlockAccess.java.patch | 17 - .../minecraft/world/SpawnerAnimals.java.patch | 60 - .../net/minecraft/world/World.java.patch | 902 ------------ .../minecraft/world/WorldProvider.java.patch | 383 ------ .../minecraft/world/WorldServer.java.patch | 257 ---- .../world/WorldServerMulti.java.patch | 62 - .../net/minecraft/world/WorldType.java.patch | 170 --- .../world/biome/BiomeColorHelper.java.patch | 11 - .../world/biome/BiomeDecorator.java.patch | 267 ---- .../world/biome/BiomeGenBase.java.patch | 148 -- .../world/biome/BiomeGenForest.java.patch | 23 - .../world/biome/BiomeGenHills.java.patch | 11 - .../world/biome/BiomeGenJungle.java.patch | 13 - .../world/biome/BiomeGenPlains.java.patch | 22 - .../world/biome/BiomeGenSwamp.java.patch | 13 - .../world/biome/WorldChunkManager.java.patch | 51 - .../world/border/WorldBorder.java.patch | 12 - .../minecraft/world/chunk/Chunk.java.patch | 264 ---- .../chunk/storage/AnvilChunkLoader.java.patch | 192 --- .../chunk/storage/AnvilSaveHandler.java.patch | 23 - .../storage/ExtendedBlockStorage.java.patch | 11 - .../world/chunk/storage/RegionFile.java.patch | 42 - .../world/gen/ChunkProviderEnd.java.patch | 74 - .../gen/ChunkProviderGenerate.java.patch | 121 -- .../world/gen/ChunkProviderHell.java.patch | 145 -- .../world/gen/ChunkProviderServer.java.patch | 138 -- .../world/gen/MapGenCaves.java.patch | 126 -- .../world/gen/MapGenRavine.java.patch | 110 -- .../feature/WorldGenAbstractTree.java.patch | 13 - .../feature/WorldGenBigMushroom.java.patch | 37 - .../gen/feature/WorldGenBigTree.java.patch | 52 - .../gen/feature/WorldGenCanopyTree.java.patch | 67 - .../gen/feature/WorldGenDeadBush.java.patch | 17 - .../gen/feature/WorldGenDungeons.java.patch | 40 - .../gen/feature/WorldGenForest.java.patch | 50 - .../gen/feature/WorldGenHugeTrees.java.patch | 66 - .../gen/feature/WorldGenMegaJungle.java.patch | 62 - .../feature/WorldGenMegaPineTree.java.patch | 65 - .../gen/feature/WorldGenMinable.java.patch | 11 - .../feature/WorldGenSavannaTree.java.patch | 64 - .../gen/feature/WorldGenShrub.java.patch | 31 - .../gen/feature/WorldGenSwamp.java.patch | 98 -- .../gen/feature/WorldGenTaiga1.java.patch | 50 - .../gen/feature/WorldGenTaiga2.java.patch | 54 - .../gen/feature/WorldGenTallGrass.java.patch | 17 - .../gen/feature/WorldGenTrees.java.patch | 94 -- .../WorldGeneratorBonusChest.java.patch | 17 - .../world/gen/layer/GenLayer.java.patch | 64 - .../world/gen/layer/GenLayerBiome.java.patch | 107 -- ...ComponentScatteredFeaturePieces.java.patch | 94 -- .../gen/structure/MapGenStronghold.java.patch | 22 - .../gen/structure/MapGenStructure.java.patch | 17 - .../structure/StructureComponent.java.patch | 13 - .../StructureMineshaftPieces.java.patch | 42 - .../StructureNetherBridgePieces.java.patch | 28 - .../gen/structure/StructureStart.java.patch | 23 - .../StructureStrongholdPieces.java.patch | 84 -- .../StructureVillagePieces.java.patch | 97 -- .../world/storage/MapData.java.patch | 48 - .../world/storage/SaveHandler.java.patch | 105 -- .../world/storage/WorldInfo.java.patch | 35 - 337 files changed, 20692 deletions(-) delete mode 100644 patches.mcp/minecraft/net/minecraft/block/Block.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockAir.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockCocoa.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockLever.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockNote.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockSapling.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/state/BlockState.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiButton.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiScreen.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/model/ModelBase.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/model/ModelRenderer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/network/OldServerPinger.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/Locale.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/SkinManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/settings/GameSettings.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/client/shader/Framebuffer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/command/CommandEnchant.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/command/CommandFill.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/command/CommandHandler.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/crash/CrashReport.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/crash/CrashReportCategory.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityLiving.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityTracker.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/init/Bootstrap.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/inventory/Container.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/inventory/Slot.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/inventory/SlotCrafting.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/Item.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemBucketMilk.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemDye.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemRecord.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemReed.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemSign.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemSnow.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemSword.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/nbt/NBTTagByteArray.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/nbt/NBTTagIntArray.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/nbt/NBTTagList.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/nbt/NBTTagString.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/network/NetworkManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/network/NetworkSystem.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/server/management/PlayerManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/EnumChatFormatting.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/MessageSerializer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/MouseHelper.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/MovingObjectPosition.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/ResourceLocation.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/Session.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/StringTranslate.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/Vec3.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/IBlockAccess.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/SpawnerAnimals.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/World.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/WorldServerMulti.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/border/WorldBorder.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch delete mode 100644 patches.mcp/minecraft/net/minecraft/world/storage/WorldInfo.java.patch diff --git a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch b/patches.mcp/minecraft/net/minecraft/block/Block.java.patch deleted file mode 100644 index b3a3dfca1..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/Block.java.patch +++ /dev/null @@ -1,1219 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/Block.java -+++ ../src-work/minecraft/net/minecraft/block/Block.java -@@ -39,8 +39,9 @@ - public class Block - { - private static final ResourceLocation AIR_ID = new ResourceLocation("air"); -- public static final RegistryNamespacedDefaultedByKey blockRegistry = new RegistryNamespacedDefaultedByKey(AIR_ID); -- public static final ObjectIntIdentityMap BLOCK_STATE_IDS = new ObjectIntIdentityMap(); -+ public static final RegistryNamespacedDefaultedByKey blockRegistry = net.minecraftforge.fml.common.registry.GameData.getBlockRegistry(); -+ @Deprecated //Modders: DO NOT use this! Use GameRegistry -+ public static final ObjectIntIdentityMap BLOCK_STATE_IDS = net.minecraftforge.fml.common.registry.GameData.getBlockStateIDMap(); - private CreativeTabs displayOnCreativeTab; - public static final Block.SoundType soundTypeStone = new Block.SoundType("stone", 1.0F, 1.0F); - public static final Block.SoundType soundTypeWood = new Block.SoundType("wood", 1.0F, 1.0F); -@@ -124,6 +125,9 @@ - private String unlocalizedName; - private static final String __OBFID = "CL_00000199"; - -+ public final net.minecraftforge.fml.common.registry.RegistryDelegate delegate = -+ ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)blockRegistry).getDelegate(this, Block.class); -+ - public static int getIdFromBlock(Block blockIn) - { - return blockRegistry.getIDForObject(blockIn); -@@ -136,7 +140,8 @@ - - public static Block getBlockById(int id) - { -- return (Block)blockRegistry.getObjectById(id); -+ Block ret = (Block)blockRegistry.getObjectById(id); -+ return ret == null ? net.minecraft.init.Blocks.air : ret; - } - - public static IBlockState getStateById(int id) -@@ -300,7 +305,7 @@ - - public boolean isReplaceable(World worldIn, BlockPos pos) - { -- return false; -+ return getMaterial().isReplaceable(); - } - - public Block setHardness(float hardness) -@@ -337,9 +342,10 @@ - return this.needsRandomTick; - } - -+ @Deprecated //Forge: New State sensitive version. - public boolean hasTileEntity() - { -- return this.isBlockContainer; -+ return hasTileEntity(getDefaultState()); - } - - public final void setBlockBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ) -@@ -356,13 +362,13 @@ - public int getMixedBrightnessForBlock(IBlockAccess worldIn, BlockPos pos) - { - Block block = worldIn.getBlockState(pos).getBlock(); -- int i = worldIn.getCombinedLight(pos, block.getLightValue()); -+ int i = worldIn.getCombinedLight(pos, block.getLightValue(worldIn, pos)); - - if (i == 0 && block instanceof BlockSlab) - { - pos = pos.down(); - block = worldIn.getBlockState(pos).getBlock(); -- return worldIn.getCombinedLight(pos, block.getLightValue()); -+ return worldIn.getCombinedLight(pos, block.getLightValue(worldIn, pos)); - } - else - { -@@ -438,7 +444,13 @@ - - public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {} - -- public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {} -+ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) -+ { -+ if (hasTileEntity(state) && !(this instanceof BlockContainer)) -+ { -+ worldIn.removeTileEntity(pos); -+ } -+ } - - public int quantityDropped(Random random) - { -@@ -452,8 +464,7 @@ - - public float getPlayerRelativeBlockHardness(EntityPlayer playerIn, World worldIn, BlockPos pos) - { -- float f = this.getBlockHardness(worldIn, pos); -- return f < 0.0F ? 0.0F : (!playerIn.canHarvestBlock(this) ? playerIn.getToolDigEfficiency(this) / f / 100.0F : playerIn.getToolDigEfficiency(this) / f / 30.0F); -+ return net.minecraftforge.common.ForgeHooks.blockStrength(worldIn.getBlockState(pos), playerIn, worldIn, pos); - } - - public final void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int forture) -@@ -463,20 +474,16 @@ - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -- if (!worldIn.isRemote) -+ if (!worldIn.isRemote && !worldIn.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe - { -- int j = this.quantityDroppedWithBonus(fortune, worldIn.rand); -+ java.util.List items = getDrops(worldIn, pos, state, fortune); -+ chance = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, fortune, chance, false, harvesters.get()); - -- for (int k = 0; k < j; ++k) -+ for (ItemStack item : items) - { - if (worldIn.rand.nextFloat() <= chance) - { -- Item item = this.getItemDropped(state, worldIn.rand, fortune); -- -- if (item != null) -- { -- spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); -- } -+ spawnAsEntity(worldIn, pos, item); - } - } - } -@@ -484,8 +491,13 @@ - - public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack) - { -- if (!worldIn.isRemote && worldIn.getGameRules().getGameRuleBooleanValue("doTileDrops")) -+ if (!worldIn.isRemote && worldIn.getGameRules().getGameRuleBooleanValue("doTileDrops") && !worldIn.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe - { -+ if (captureDrops.get()) -+ { -+ capturedDrops.get().add(stack); -+ return; -+ } - float f = 0.5F; - double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; - double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -@@ -670,7 +682,7 @@ - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable(); -+ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos); - } - - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) -@@ -772,25 +784,35 @@ - player.triggerAchievement(StatList.mineBlockStatArray[getIdFromBlock(this)]); - player.addExhaustion(0.025F); - -- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) -+ if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player)) - { -+ java.util.ArrayList items = new java.util.ArrayList(); - ItemStack itemstack = this.createStackedBlock(state); - - if (itemstack != null) - { -- spawnAsEntity(worldIn, pos, itemstack); -+ items.add(itemstack); - } -+ -+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, worldIn.getBlockState(pos), 0, 1.0f, true, player); -+ for (ItemStack stack : items) -+ { -+ spawnAsEntity(worldIn, pos, stack); -+ } - } - else - { -+ harvesters.set(player); - int i = EnchantmentHelper.getFortuneModifier(player); - this.dropBlockAsItem(worldIn, pos, state, i); -+ harvesters.set(null); - } - } - -+ @Deprecated //Forge: State sensitive version - protected boolean canSilkHarvest() - { -- return this.isFullCube() && !this.isBlockContainer; -+ return this.isFullCube() && !this.hasTileEntity(silk_check_state.get()); - } - - protected ItemStack createStackedBlock(IBlockState state) -@@ -967,6 +989,1033 @@ - return Block.EnumOffsetType.NONE; - } - -+ /* ======================================== FORGE START =====================================*/ -+ //For ForgeInternal use Only! -+ protected ThreadLocal harvesters = new ThreadLocal(); -+ private ThreadLocal silk_check_state = new ThreadLocal(); -+ protected static java.util.Random RANDOM = new java.util.Random(); // Useful for random things without a seed. -+ /** -+ * Get a light value for the block at the specified coordinates, normal ranges are between 0 and 15 -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @return The light value -+ */ -+ public int getLightValue(IBlockAccess world, BlockPos pos) -+ { -+ Block block = world.getBlockState(pos).getBlock(); -+ if (block != this) -+ { -+ return block.getLightValue(world, pos); -+ } -+ return getLightValue(); -+ } -+ -+ /** -+ * Checks if a player or entity can use this block to 'climb' like a ladder. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param entity The entity trying to use the ladder, CAN be null. -+ * @return True if the block should act like a ladder -+ */ -+ public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return false; } -+ -+ /** -+ * Return true if the block is a normal, solid cube. This -+ * determines indirect power state, entity ejection from blocks, and a few -+ * others. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @return True if the block is a full cube -+ */ -+ public boolean isNormalCube(IBlockAccess world, BlockPos pos) -+ { -+ return getMaterial().isOpaque() && isFullCube() && !canProvidePower(); -+ } -+ -+ /** -+ * Checks if the block is a solid face on the given side, used by placement logic. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param side The side to check -+ * @return True if the block is solid on the specified side. -+ */ -+ public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side) -+ { -+ IBlockState state = this.getActualState(world.getBlockState(pos), world, pos); -+ -+ if (this instanceof BlockSlab) -+ { -+ return isFullBlock() || (state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP && side == EnumFacing.UP); -+ } -+ else if (this instanceof BlockFarmland) -+ { -+ return (side != EnumFacing.DOWN && side != EnumFacing.UP); -+ } -+ else if (this instanceof BlockStairs) -+ { -+ boolean flipped = state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP; -+ BlockStairs.EnumShape shape = (BlockStairs.EnumShape)state.getValue(BlockStairs.SHAPE); -+ EnumFacing facing = (EnumFacing)state.getValue(BlockStairs.FACING); -+ if (side == EnumFacing.UP) return flipped; -+ if (facing == side) return true; -+ if (flipped) -+ { -+ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.rotateYCCW(); -+ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.rotateY(); -+ } -+ else -+ { -+ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.rotateY(); -+ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.rotateYCCW(); -+ } -+ return false; -+ } -+ else if (this instanceof BlockSnow) -+ { -+ return ((Integer)state.getValue(BlockSnow.LAYERS)) >= 8; -+ } -+ else if (this instanceof BlockHopper && side == EnumFacing.UP) -+ { -+ return true; -+ } -+ else if (this instanceof BlockCompressedPowered) -+ { -+ return true; -+ } -+ return isNormalCube(world, pos); -+ } -+ -+ /** -+ * Determines if this block should set fire and deal fire damage -+ * to entities coming into contact with it. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @return True if the block should deal damage -+ */ -+ public boolean isBurning(IBlockAccess world, BlockPos pos) -+ { -+ return false; -+ } -+ -+ /** -+ * Determines this block should be treated as an air block -+ * by the rest of the code. This method is primarily -+ * useful for creating pure logic-blocks that will be invisible -+ * to the player and otherwise interact as air would. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @return True if the block considered air -+ */ -+ public boolean isAir(IBlockAccess world, BlockPos pos) -+ { -+ return getMaterial() == Material.air; -+ } -+ -+ /** -+ * Determines if the player can harvest this block, obtaining it's drops when the block is destroyed. -+ * -+ * @param player The player damaging the block, may be null -+ * @param meta The block's current metadata -+ * @return True to spawn the drops -+ */ -+ public boolean canHarvestBlock(IBlockAccess world, BlockPos pos, EntityPlayer player) -+ { -+ return net.minecraftforge.common.ForgeHooks.canHarvestBlock(this, player, world, pos); -+ } -+ -+ /** -+ * Called when a player removes a block. This is responsible for -+ * actually destroying the block, and the block is intact at time of call. -+ * This is called regardless of whether the player can harvest the block or -+ * not. -+ * -+ * Return true if the block is actually destroyed. -+ * -+ * Note: When used in multiplayer, this is called on both client and -+ * server sides! -+ * -+ * @param world The current world -+ * @param player The player damaging the block, may be null -+ * @param pos Block position in world -+ * @param willHarvest True if Block.harvestBlock will be called after this, if the return in true. -+ * Can be useful to delay the destruction of tile entities till after harvestBlock -+ * @return True if the block is actually destroyed. -+ */ -+ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) -+ { -+ return world.setBlockToAir(pos); -+ } -+ -+ /** -+ * Chance that fire will spread and consume this block. -+ * 300 being a 100% chance, 0, being a 0% chance. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param face The face that the fire is coming from -+ * @return A number ranging from 0 to 300 relating used to determine if the block will be consumed by fire -+ */ -+ public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ return net.minecraft.init.Blocks.fire.getFlammability(this); -+ } -+ -+ /** -+ * Called when fire is updating, checks if a block face can catch fire. -+ * -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param face The face that the fire is coming from -+ * @return True if the face can be on fire, false otherwise. -+ */ -+ public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ return getFlammability(world, pos, face) > 0; -+ } -+ -+ /** -+ * Called when fire is updating on a neighbor block. -+ * The higher the number returned, the faster fire will spread around this block. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param face The face that the fire is coming from -+ * @return A number that is used to determine the speed of fire growth around the block -+ */ -+ public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ return net.minecraft.init.Blocks.fire.getEncouragement(this); -+ } -+ -+ /** -+ * Currently only called by fire when it is on top of this block. -+ * Returning true will prevent the fire from naturally dying during updating. -+ * Also prevents firing from dying from rain. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param metadata The blocks current metadata -+ * @param side The face that the fire is coming from -+ * @return True if this block sustains fire, meaning it will never go out. -+ */ -+ public boolean isFireSource(World world, BlockPos pos, EnumFacing side) -+ { -+ if (this == net.minecraft.init.Blocks.netherrack && side == EnumFacing.UP) -+ { -+ return true; -+ } -+ if ((world.provider instanceof net.minecraft.world.WorldProviderEnd) && this == net.minecraft.init.Blocks.bedrock && side == EnumFacing.UP) -+ { -+ return true; -+ } -+ return false; -+ } -+ -+ private boolean isTileProvider = this instanceof ITileEntityProvider; -+ /** -+ * Called throughout the code as a replacement for block instanceof BlockContainer -+ * Moving this to the Block base class allows for mods that wish to extend vanilla -+ * blocks, and also want to have a tile entity on that block, may. -+ * -+ * Return true from this function to specify this block has a tile entity. -+ * -+ * @param state State of the current block -+ * @return True if block has a tile entity, false otherwise -+ */ -+ public boolean hasTileEntity(IBlockState state) -+ { -+ return isTileProvider; -+ } -+ -+ /** -+ * Called throughout the code as a replacement for ITileEntityProvider.createNewTileEntity -+ * Return the same thing you would from that function. -+ * This will fall back to ITileEntityProvider.createNewTileEntity(World) if this block is a ITileEntityProvider -+ * -+ * @param metadata The Metadata of the current block -+ * @return A instance of a class extending TileEntity -+ */ -+ public TileEntity createTileEntity(World world, IBlockState state) -+ { -+ if (isTileProvider) -+ { -+ return ((ITileEntityProvider)this).createNewTileEntity(world, getMetaFromState(state)); -+ } -+ return null; -+ } -+ -+ /** -+ * State and fortune sensitive version, this replaces the old (int meta, Random rand) -+ * version in 1.1. -+ * -+ * @param state Current state -+ * @param fortune Current item fortune level -+ * @param random Random number generator -+ * @return The number of items to drop -+ */ -+ public int quantityDropped(IBlockState state, int fortune, Random random) -+ { -+ return quantityDroppedWithBonus(fortune, random); -+ } -+ -+ /** -+ * This returns a complete list of items dropped from this block. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param state Current state -+ * @param fortune Breakers fortune level -+ * @return A ArrayList containing all items this block drops -+ */ -+ public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ List ret = new java.util.ArrayList(); -+ -+ Random rand = world instanceof World ? ((World)world).rand : RANDOM; -+ -+ int count = quantityDropped(state, fortune, rand); -+ for(int i = 0; i < count; i++) -+ { -+ Item item = this.getItemDropped(state, rand, fortune); -+ if (item != null) -+ { -+ ret.add(new ItemStack(item, 1, this.damageDropped(state))); -+ } -+ } -+ return ret; -+ } -+ -+ /** -+ * Return true from this function if the player with silk touch can harvest this block directly, and not it's normal drops. -+ * -+ * @param world The world -+ * @param pos Block position in world -+ * @param state current block state -+ * @param player The player doing the harvesting -+ * @return True if the block can be directly harvested using silk touch -+ */ -+ public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) -+ { -+ silk_check_state.set(state);; -+ boolean ret = this.canSilkHarvest(); -+ silk_check_state.set(null); -+ return ret; -+ } -+ -+ /** -+ * Determines if a specified mob type can spawn on this block, returning false will -+ * prevent any mob from spawning on the block. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param type The Mob Category Type -+ * @return True to allow a mob of the specified category to spawn, false to prevent it. -+ */ -+ public boolean canCreatureSpawn(IBlockAccess world, BlockPos pos, net.minecraft.entity.EntityLiving.SpawnPlacementType type) -+ { -+ IBlockState state = world.getBlockState(pos); -+ if (this instanceof BlockSlab) -+ { -+ return (isFullBlock() || state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP); -+ } -+ else if (this instanceof BlockStairs) -+ { -+ return state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP; -+ } -+ return isSideSolid(world, pos, EnumFacing.UP); -+ } -+ -+ /** -+ * Determines if this block is classified as a Bed, Allowing -+ * players to sleep in it, though the block has to specifically -+ * perform the sleeping functionality in it's activated event. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param player The player or camera entity, null in some cases. -+ * @return True to treat this as a bed -+ */ -+ public boolean isBed(IBlockAccess world, BlockPos pos, Entity player) -+ { -+ return this == net.minecraft.init.Blocks.bed; -+ } -+ -+ /** -+ * Returns the position that the player is moved to upon -+ * waking up, or respawning at the bed. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param player The player or camera entity, null in some cases. -+ * @return The spawn position -+ */ -+ public BlockPos getBedSpawnPosition(IBlockAccess world, BlockPos pos, EntityPlayer player) -+ { -+ if (world instanceof World) -+ return BlockBed.getSafeExitLocation((World)world, pos, 0); -+ return null; -+ } -+ -+ /** -+ * Called when a user either starts or stops sleeping in the bed. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param player The player or camera entity, null in some cases. -+ * @param occupied True if we are occupying the bed, or false if they are stopping use of the bed -+ */ -+ public void setBedOccupied(IBlockAccess world, BlockPos pos, EntityPlayer player, boolean occupied) -+ { -+ if (world instanceof World) -+ { -+ IBlockState state = world.getBlockState(pos); -+ state = state.getBlock().getActualState(state, world, pos); -+ state = state.withProperty(BlockBed.OCCUPIED, true); -+ ((World)world).setBlockState(pos, state, 4); -+ } -+ } -+ -+ /** -+ * Returns the direction of the block. Same values that -+ * are returned by BlockDirectional -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @return Bed direction -+ */ -+ public EnumFacing getBedDirection(IBlockAccess world, BlockPos pos) -+ { -+ return (EnumFacing)getActualState(world.getBlockState(pos), world, pos).getValue(BlockDirectional.FACING); -+ } -+ -+ /** -+ * Determines if the current block is the foot half of the bed. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @return True if the current block is the foot side of a bed. -+ */ -+ public boolean isBedFoot(IBlockAccess world, BlockPos pos) -+ { -+ return getActualState(world.getBlockState(pos), world, pos).getValue(BlockBed.PART) == BlockBed.EnumPartType.FOOT; -+ } -+ -+ /** -+ * Called when a leaf should start its decay process. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ */ -+ public void beginLeavesDecay(World world, BlockPos pos){} -+ -+ /** -+ * Determines if this block can prevent leaves connected to it from decaying. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @return true if the presence this block can prevent leaves from decaying. -+ */ -+ public boolean canSustainLeaves(IBlockAccess world, BlockPos pos) -+ { -+ return false; -+ } -+ -+ /** -+ * Determines if this block is considered a leaf block, used to apply the leaf decay and generation system. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @return true if this block is considered leaves. -+ */ -+ public boolean isLeaves(IBlockAccess world, BlockPos pos) -+ { -+ return getMaterial() == Material.leaves; -+ } -+ -+ /** -+ * Used during tree growth to determine if newly generated leaves can replace this block. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @return true if this block can be replaced by growing leaves. -+ */ -+ public boolean canBeReplacedByLeaves(IBlockAccess world, BlockPos pos) -+ { -+ return !isFullBlock(); -+ } -+ -+ /** -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @return true if the block is wood (logs) -+ */ -+ public boolean isWood(IBlockAccess world, BlockPos pos) -+ { -+ return false; -+ } -+ -+ /** -+ * Determines if the current block is replaceable by Ore veins during world generation. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param target The generic target block the gen is looking for, Standards define stone -+ * for overworld generation, and neatherack for the nether. -+ * @return True to allow this block to be replaced by a ore -+ */ -+ public boolean isReplaceableOreGen(World world, BlockPos pos, com.google.common.base.Predicate target) -+ { -+ return target.apply(world.getBlockState(pos)); -+ } -+ -+ /** -+ * Location sensitive version of getExplosionRestance -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param exploder The entity that caused the explosion, can be null -+ * @param explosion The explosion -+ * @return The amount of the explosion absorbed. -+ */ -+ public float getExplosionResistance(World world, BlockPos pos, Entity exploder, Explosion explosion) -+ { -+ return getExplosionResistance(exploder); -+ } -+ -+ /** -+ * Called when the block is destroyed by an explosion. -+ * Useful for allowing the block to take into account tile entities, -+ * state, etc. when exploded, before it is removed. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param Explosion The explosion instance affecting the block -+ */ -+ public void onBlockExploded(World world, BlockPos pos, Explosion explosion) -+ { -+ world.setBlockToAir(pos); -+ onBlockDestroyedByExplosion(world, pos, explosion); -+ } -+ -+ /** -+ * Determine if this block can make a redstone connection on the side provided, -+ * Useful to control which sides are inputs and outputs for redstone wires. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param side The side that is trying to make the connection, CAN BE NULL -+ * @return True to make the connection -+ */ -+ public boolean canConnectRedstone(IBlockAccess world, BlockPos pos, EnumFacing side) -+ { -+ return canProvidePower() && side != null; -+ } -+ -+ /** -+ * Determines if a torch can be placed on the top surface of this block. -+ * Useful for creating your own block that torches can be on, such as fences. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @return True to allow the torch to be placed -+ */ -+ public boolean canPlaceTorchOnTop(IBlockAccess world, BlockPos pos) -+ { -+ if (isSideSolid(world, pos, EnumFacing.UP)) -+ { -+ return true; -+ } -+ else -+ { -+ return this instanceof BlockFence || this == net.minecraft.init.Blocks.glass || this == net.minecraft.init.Blocks.cobblestone_wall || this == net.minecraft.init.Blocks.stained_glass; -+ } -+ } -+ -+ /** Dont think this exists in 1.8 anymore -+ /** -+ * Determines if this block should render in this pass. -+ * -+ * @param pass The pass in question -+ * @return True to render -+ * / -+ public boolean canRenderInPass(int pass) -+ { -+ return pass == func_149701_w(); -+ } -+ */ -+ -+ /** -+ * Called when a user uses the creative pick block button on this block -+ * -+ * @param target The full target the player is looking at -+ * @return A ItemStack to add to the player's inventory, Null if nothing should be added. -+ */ -+ public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) -+ { -+ return getPickBlock(target, world, pos); -+ } -+ @Deprecated -+ public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos) -+ { -+ Item item = getItem(world, pos); -+ -+ if (item == null) -+ { -+ return null; -+ } -+ -+ Block block = item instanceof ItemBlock && !isFlowerPot() ? Block.getBlockFromItem(item) : this; -+ return new ItemStack(item, 1, block.getDamageValue(world, pos)); -+ } -+ -+ /** -+ * Used by getTopSolidOrLiquidBlock while placing biome decorations, villages, etc -+ * Also used to determine if the player can spawn on this block. -+ * -+ * @return False to disallow spawning -+ */ -+ public boolean isFoliage(IBlockAccess world, BlockPos pos) -+ { -+ return false; -+ } -+ -+ /** -+ * Spawn a digging particle effect in the world, this is a wrapper -+ * around EffectRenderer.addBlockHitEffects to allow the block more -+ * control over the particles. Useful when you have entirely different -+ * texture sheets for different sides/locations in the world. -+ * -+ * @param world The current world -+ * @param target The target the player is looking at {x/y/z/side/sub} -+ * @param effectRenderer A reference to the current effect renderer. -+ * @return True to prevent vanilla digging particles form spawning. -+ */ -+ @SideOnly(Side.CLIENT) -+ public boolean addHitEffects(World worldObj, MovingObjectPosition target, net.minecraft.client.particle.EffectRenderer effectRenderer) -+ { -+ return false; -+ } -+ -+ /** -+ * Spawn particles for when the block is destroyed. Due to the nature -+ * of how this is invoked, the x/y/z locations are not always guaranteed -+ * to host your block. So be sure to do proper sanity checks before assuming -+ * that the location is this block. -+ * -+ * @param world The current world -+ * @param pos Position to spawn the particle -+ * @param effectRenderer A reference to the current effect renderer. -+ * @return True to prevent vanilla break particles from spawning. -+ */ -+ @SideOnly(Side.CLIENT) -+ public boolean addDestroyEffects(World world, BlockPos pos, net.minecraft.client.particle.EffectRenderer effectRenderer) -+ { -+ return false; -+ } -+ -+ /** -+ * Determines if this block can support the passed in plant, allowing it to be planted and grow. -+ * Some examples: -+ * Reeds check if its a reed, or if its sand/dirt/grass and adjacent to water -+ * Cacti checks if its a cacti, or if its sand -+ * Nether types check for soul sand -+ * Crops check for tilled soil -+ * Caves check if it's a solid surface -+ * Plains check if its grass or dirt -+ * Water check if its still water -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param direction The direction relative to the given position the plant wants to be, typically its UP -+ * @param plantable The plant that wants to check -+ * @return True to allow the plant to be planted/stay. -+ */ -+ public boolean canSustainPlant(IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable) -+ { -+ IBlockState state = world.getBlockState(pos); -+ IBlockState plant = plantable.getPlant(world, pos.offset(direction)); -+ net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction)); -+ -+ if (plant.getBlock() == net.minecraft.init.Blocks.cactus && this == net.minecraft.init.Blocks.cactus) -+ { -+ return true; -+ } -+ -+ if (plant.getBlock() == net.minecraft.init.Blocks.reeds && this == net.minecraft.init.Blocks.reeds) -+ { -+ return true; -+ } -+ -+ if (plantable instanceof BlockBush && ((BlockBush)plantable).canPlaceBlockOn(this)) -+ { -+ return true; -+ } -+ -+ switch (plantType) -+ { -+ case Desert: return this == net.minecraft.init.Blocks.sand || this == net.minecraft.init.Blocks.hardened_clay || this == net.minecraft.init.Blocks.stained_hardened_clay || this == net.minecraft.init.Blocks.dirt; -+ case Nether: return this == net.minecraft.init.Blocks.soul_sand; -+ case Crop: return this == net.minecraft.init.Blocks.farmland; -+ case Cave: return isSideSolid(world, pos, EnumFacing.UP); -+ case Plains: return this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.dirt || this == net.minecraft.init.Blocks.farmland; -+ case Water: return getMaterial() == Material.water && ((Integer)state.getValue(BlockLiquid.LEVEL)) == 0; -+ case Beach: -+ boolean isBeach = this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.dirt || this == net.minecraft.init.Blocks.sand; -+ boolean hasWater = (world.getBlockState(pos.east()).getBlock().getMaterial() == Material.water || -+ world.getBlockState(pos.west()).getBlock().getMaterial() == Material.water || -+ world.getBlockState(pos.north()).getBlock().getMaterial() == Material.water || -+ world.getBlockState(pos.south()).getBlock().getMaterial() == Material.water); -+ return isBeach && hasWater; -+ } -+ -+ return false; -+ } -+ -+ /** -+ * Called when a plant grows on this block, only implemented for saplings using the WorldGen*Trees classes right now. -+ * Modder may implement this for custom plants. -+ * This does not use ForgeDirection, because large/huge trees can be located in non-representable direction, -+ * so the source location is specified. -+ * Currently this just changes the block to dirt if it was grass. -+ * -+ * Note: This happens DURING the generation, the generation may not be complete when this is called. -+ * -+ * @param world Current world -+ * @param pos Block position in world -+ * @param source Source plant's position in world -+ */ -+ public void onPlantGrow(World world, BlockPos pos, BlockPos source) -+ { -+ if (this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.farmland) -+ { -+ world.setBlockState(pos, net.minecraft.init.Blocks.dirt.getDefaultState(), 2); -+ } -+ } -+ -+ /** -+ * Checks if this soil is fertile, typically this means that growth rates -+ * of plants on this soil will be slightly sped up. -+ * Only vanilla case is tilledField when it is within range of water. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @return True if the soil should be considered fertile. -+ */ -+ public boolean isFertile(World world, BlockPos pos) -+ { -+ if (this == net.minecraft.init.Blocks.farmland) -+ { -+ return ((Integer)world.getBlockState(pos).getValue(BlockFarmland.MOISTURE)) > 0; -+ } -+ -+ return false; -+ } -+ -+ /** -+ * Location aware and overrideable version of the lightOpacity array, -+ * return the number to subtract from the light value when it passes through this block. -+ * -+ * This is not guaranteed to have the tile entity in place before this is called, so it is -+ * Recommended that you have your tile entity call relight after being placed if you -+ * rely on it for light info. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @return The amount of light to block, 0 for air, 255 for fully opaque. -+ */ -+ public int getLightOpacity(IBlockAccess world, BlockPos pos) -+ { -+ return getLightOpacity(); -+ } -+ -+ /** -+ * Determines if this block is can be destroyed by the specified entities normal behavior. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @return True to allow the ender dragon to destroy this block -+ */ -+ public boolean canEntityDestroy(IBlockAccess world, BlockPos pos, Entity entity) -+ { -+ if (entity instanceof net.minecraft.entity.boss.EntityWither) -+ { -+ return this != net.minecraft.init.Blocks.barrier && this != net.minecraft.init.Blocks.bedrock && this != net.minecraft.init.Blocks.end_portal && this != net.minecraft.init.Blocks.end_portal_frame && this != net.minecraft.init.Blocks.command_block; -+ } -+ else if (entity instanceof net.minecraft.entity.boss.EntityDragon) -+ { -+ return this != net.minecraft.init.Blocks.barrier && this != net.minecraft.init.Blocks.obsidian && this != net.minecraft.init.Blocks.end_stone && this != net.minecraft.init.Blocks.bedrock && this != net.minecraft.init.Blocks.command_block; -+ } -+ -+ return true; -+ } -+ -+ /** -+ * Determines if this block can be used as the base of a beacon. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param beacon Beacon position in world -+ * @return True, to support the beacon, and make it active with this block. -+ */ -+ public boolean isBeaconBase(IBlockAccess worldObj, BlockPos pos, BlockPos beacon) -+ { -+ return this == net.minecraft.init.Blocks.emerald_block || this == net.minecraft.init.Blocks.gold_block || this == net.minecraft.init.Blocks.diamond_block || this == net.minecraft.init.Blocks.iron_block; -+ } -+ -+ /** -+ * Rotate the block. For vanilla blocks this rotates around the axis passed in (generally, it should be the "face" that was hit). -+ * Note: for mod blocks, this is up to the block and modder to decide. It is not mandated that it be a rotation around the -+ * face, but could be a rotation to orient *to* that face, or a visiting of possible rotations. -+ * The method should return true if the rotation was successful though. -+ * -+ * @param world The world -+ * @param pos Block position in world -+ * @param axis The axis to rotate around -+ * @return True if the rotation was successful, False if the rotation failed, or is not possible -+ */ -+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) -+ { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) -+ { -+ if (prop.getName().equals("facing") || prop.getName().equals("rotation")) -+ { -+ world.setBlockState(pos, state.cycleProperty(prop)); -+ return true; -+ } -+ } -+ return false; -+ } -+ -+ /** -+ * Get the rotations that can apply to the block at the specified coordinates. Null means no rotations are possible. -+ * Note, this is up to the block to decide. It may not be accurate or representative. -+ * @param world The world -+ * @param pos Block position in world -+ * @return An array of valid axes to rotate around, or null for none or unknown -+ */ -+ public EnumFacing[] getValidRotations(World world, BlockPos pos) -+ { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) -+ { -+ if (prop.getName().equals("facing") && prop.getValueClass() == EnumFacing.class) -+ { -+ java.util.Collection values = ((java.util.Collection)prop.getAllowedValues()); -+ return values.toArray(new EnumFacing[values.size()]); -+ } -+ } -+ return null; -+ } -+ -+ /** -+ * Determines the amount of enchanting power this block can provide to an enchanting table. -+ * @param world The World -+ * @param pos Block position in world -+ * @return The amount of enchanting power this block produces. -+ */ -+ public float getEnchantPowerBonus(World world, BlockPos pos) -+ { -+ return this == net.minecraft.init.Blocks.bookshelf ? 1 : 0; -+ } -+ -+ /** -+ * Common way to recolor a block with an external tool -+ * @param world The world -+ * @param pos Block position in world -+ * @param side The side hit with the coloring tool -+ * @param color The color to change to -+ * @return If the recoloring was successful -+ */ -+ public boolean recolorBlock(World world, BlockPos pos, EnumFacing side, net.minecraft.item.EnumDyeColor color) -+ { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) -+ { -+ if (prop.getName().equals("color") && prop.getValueClass() == net.minecraft.item.EnumDyeColor.class) -+ { -+ net.minecraft.item.EnumDyeColor current = (net.minecraft.item.EnumDyeColor)state.getValue(prop); -+ if (current != color) -+ { -+ world.setBlockState(pos, state.withProperty(prop, color)); -+ return true; -+ } -+ } -+ } -+ return false; -+ } -+ -+ /** -+ * Gathers how much experience this block drops when broken. -+ * -+ * @param world The world -+ * @param pos Block position -+ * @param fortune -+ * @return Amount of XP from breaking this block. -+ */ -+ public int getExpDrop(IBlockAccess world, BlockPos pos, int fortune) -+ { -+ return 0; -+ } -+ -+ /** -+ * Called when a tile entity on a side of this block changes is created or is destroyed. -+ * @param world The world -+ * @param pos Block position in world -+ * @param neighbor Block position of neighbor -+ */ -+ public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor){} -+ -+ /** -+ * Called to determine whether to allow the a block to handle its own indirect power rather than using the default rules. -+ * @param world The world -+ * @param pos Block position in world -+ * @param side The INPUT side of the block to be powered - ie the opposite of this block's output side -+ * @return Whether Block#isProvidingWeakPower should be called when determining indirect power -+ */ -+ public boolean shouldCheckWeakPower(IBlockAccess world, BlockPos pos, EnumFacing side) -+ { -+ return isNormalCube(); -+ } -+ -+ /** -+ * If this block should be notified of weak changes. -+ * Weak changes are changes 1 block away through a solid block. -+ * Similar to comparators. -+ * -+ * @param world The current world -+ * @param pos Block position in world -+ * @param side The side to check -+ * @return true To be notified of changes -+ */ -+ public boolean getWeakChanges(IBlockAccess world, BlockPos pos) -+ { -+ return false; -+ } -+ -+ private String[] harvestTool = new String[16];; -+ private int[] harvestLevel = new int[]{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; -+ /** -+ * Sets or removes the tool and level required to harvest this block. -+ * -+ * @param toolClass Class -+ * @param level Harvest level: -+ * Wood: 0 -+ * Stone: 1 -+ * Iron: 2 -+ * Diamond: 3 -+ * Gold: 0 -+ */ -+ public void setHarvestLevel(String toolClass, int level) -+ { -+ Iterator itr = getBlockState().getValidStates().iterator(); -+ while (itr.hasNext()) -+ { -+ setHarvestLevel(toolClass, level, itr.next()); -+ } -+ } -+ -+ /** -+ * Sets or removes the tool and level required to harvest this block. -+ * -+ * @param toolClass Class -+ * @param level Harvest level: -+ * Wood: 0 -+ * Stone: 1 -+ * Iron: 2 -+ * Diamond: 3 -+ * Gold: 0 -+ * @param state The specific state. -+ */ -+ public void setHarvestLevel(String toolClass, int level, IBlockState state) -+ { -+ int idx = this.getMetaFromState(state); -+ this.harvestTool[idx] = toolClass; -+ this.harvestLevel[idx] = level; -+ } -+ -+ /** -+ * Queries the class of tool required to harvest this block, if null is returned -+ * we assume that anything can harvest this block. -+ */ -+ public String getHarvestTool(IBlockState state) -+ { -+ return harvestTool[getMetaFromState(state)]; -+ } -+ -+ /** -+ * Queries the harvest level of this item stack for the specified tool class, -+ * Returns -1 if this tool is not of the specified type -+ * -+ * @param stack This item stack instance -+ * @return Harvest level, or -1 if not the specified tool type. -+ */ -+ public int getHarvestLevel(IBlockState state) -+ { -+ return harvestLevel[getMetaFromState(state)]; -+ } -+ -+ /** -+ * Checks if the specified tool type is efficient on this block, -+ * meaning that it digs at full speed. -+ */ -+ public boolean isToolEffective(String type, IBlockState state) -+ { -+ if ("pickaxe".equals(type) && (this == net.minecraft.init.Blocks.redstone_ore || this == net.minecraft.init.Blocks.lit_redstone_ore || this == net.minecraft.init.Blocks.obsidian)) -+ return false; -+ return type != null && type.equals(getHarvestTool(state)); -+ } -+ -+ /** -+ * Can return IExtendedBlockState -+ */ -+ public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) -+ { -+ return getActualState(state, world, pos); -+ } -+ -+ /** -+ * Queries if this block should render in a given layer. -+ * ISmartBlockModel can use MinecraftForgeClient.getRenderLayer to alter their model based on layer -+ */ -+ public boolean canRenderInLayer(EnumWorldBlockLayer layer) -+ { -+ return getBlockLayer() == layer; -+ } -+ -+ // For Internal use only to capture droped items inside getDrops -+ protected static ThreadLocal captureDrops = new ThreadLocal() -+ { -+ @Override protected Boolean initialValue() { return false; } -+ }; -+ protected static ThreadLocal> capturedDrops = new ThreadLocal>() -+ { -+ @Override protected List initialValue() { return new java.util.ArrayList(); } -+ }; -+ protected List captureDrops(boolean start) -+ { -+ if (start) -+ { -+ captureDrops.set(true); -+ capturedDrops.get().clear(); -+ return null; -+ } -+ else -+ { -+ captureDrops.set(false); -+ return capturedDrops.get(); -+ } -+ } -+ /* ========================================= FORGE END ======================================*/ -+ - public static void registerBlocks() - { - registerBlock(0, AIR_ID, (new BlockAir()).setUnlocalizedName("air")); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockAir.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockAir.java.patch deleted file mode 100644 index a85287bef..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockAir.java.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockAir.java -+++ ../src-work/minecraft/net/minecraft/block/BlockAir.java -@@ -36,4 +36,6 @@ - } - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) {} -+ -+ public boolean isReplaceable(World worldIn, BlockPos pos){ return true; } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch deleted file mode 100644 index 107960c2a..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockBush.java.patch +++ /dev/null @@ -1,66 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockBush.java -+++ ../src-work/minecraft/net/minecraft/block/BlockBush.java -@@ -12,7 +12,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class BlockBush extends Block -+public class BlockBush extends Block implements net.minecraftforge.common.IPlantable - { - private static final String __OBFID = "CL_00000208"; - -@@ -32,7 +32,7 @@ - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return super.canPlaceBlockAt(worldIn, pos) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); -+ return super.canPlaceBlockAt(worldIn, pos) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); - } - - protected boolean canPlaceBlockOn(Block ground) -@@ -62,7 +62,10 @@ - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); -+ BlockPos down = pos.down(); -+ Block soil = worldIn.getBlockState(down).getBlock(); -+ if (state.getBlock() != this) return this.canPlaceBlockOn(soil); //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 soil.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, this); - } - - public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) -@@ -85,4 +88,33 @@ - { - return EnumWorldBlockLayer.CUTOUT; - } -+ -+ @Override -+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ if (this == Blocks.wheat) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.carrots) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.potatoes) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.melon_stem) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.pumpkin_stem) return net.minecraftforge.common.EnumPlantType.Crop; -+ if (this == Blocks.deadbush) return net.minecraftforge.common.EnumPlantType.Desert; -+ if (this == Blocks.waterlily) return net.minecraftforge.common.EnumPlantType.Water; -+ if (this == Blocks.red_mushroom) return net.minecraftforge.common.EnumPlantType.Cave; -+ if (this == Blocks.brown_mushroom) return net.minecraftforge.common.EnumPlantType.Cave; -+ if (this == Blocks.nether_wart) return net.minecraftforge.common.EnumPlantType.Nether; -+ if (this == Blocks.sapling) return net.minecraftforge.common.EnumPlantType.Plains; -+ if (this == Blocks.tallgrass) return net.minecraftforge.common.EnumPlantType.Plains; -+ if (this == Blocks.double_plant) return net.minecraftforge.common.EnumPlantType.Plains; -+ if (this == Blocks.red_flower) return net.minecraftforge.common.EnumPlantType.Plains; -+ if (this == Blocks.yellow_flower) return net.minecraftforge.common.EnumPlantType.Plains; -+ return net.minecraftforge.common.EnumPlantType.Plains; -+ } -+ -+ @Override -+ public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ IBlockState state = world.getBlockState(pos); -+ if (state.getBlock() != this) return getDefaultState(); -+ return state; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch deleted file mode 100644 index e91728561..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockButton.java.patch +++ /dev/null @@ -1,46 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockButton.java -+++ ../src-work/minecraft/net/minecraft/block/BlockButton.java -@@ -18,6 +18,7 @@ - import net.minecraft.util.EnumFacing; - import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; -+import static net.minecraft.util.EnumFacing.*; - - public abstract class BlockButton extends Block - { -@@ -57,7 +58,7 @@ - - public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) - { -- return worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock().isNormalCube(); -+ return worldIn.isSideSolid(pos.offset(side.getOpposite()), side, true); - } - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) -@@ -69,7 +70,7 @@ - { - EnumFacing enumfacing = aenumfacing[j]; - -- if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock().isNormalCube()) -+ if (worldIn.isSideSolid(pos.offset(enumfacing), enumfacing.getOpposite(), true)) - { - return true; - } -@@ -80,7 +81,7 @@ - - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) - { -- return worldIn.getBlockState(pos.offset(facing.getOpposite())).getBlock().isNormalCube() ? this.getDefaultState().withProperty(FACING, facing).withProperty(POWERED, Boolean.valueOf(false)) : this.getDefaultState().withProperty(FACING, EnumFacing.DOWN).withProperty(POWERED, Boolean.valueOf(false)); -+ return worldIn.isSideSolid(pos.offset(facing.getOpposite()), facing, true) ? this.getDefaultState().withProperty(FACING, facing).withProperty(POWERED, Boolean.valueOf(false)) : this.getDefaultState().withProperty(FACING, EnumFacing.DOWN).withProperty(POWERED, Boolean.valueOf(false)); - } - - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) -@@ -89,7 +90,7 @@ - { - EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); - -- if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).getBlock().isNormalCube()) -+ if (!worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) - { - this.dropBlockAsItem(worldIn, pos, state, 0); - worldIn.setBlockToAir(pos); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch deleted file mode 100644 index 25c9d4cb0..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockCactus.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockCactus.java -+++ ../src-work/minecraft/net/minecraft/block/BlockCactus.java -@@ -19,7 +19,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class BlockCactus extends Block -+public class BlockCactus extends Block implements net.minecraftforge.common.IPlantable - { - public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15); - private static final String __OBFID = "CL_00000210"; -@@ -115,7 +115,7 @@ - } - - Block block = worldIn.getBlockState(pos.down()).getBlock(); -- return block == Blocks.cactus || block == Blocks.sand; -+ return block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this); - } - - public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) -@@ -143,4 +143,16 @@ - { - return new BlockState(this, new IProperty[] {AGE}); - } -+ -+ @Override -+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ return net.minecraftforge.common.EnumPlantType.Desert; -+ } -+ -+ @Override -+ public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ return getDefaultState(); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch deleted file mode 100644 index 66e55dc38..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockChest.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockChest.java -+++ ../src-work/minecraft/net/minecraft/block/BlockChest.java -@@ -531,7 +531,7 @@ - - private boolean isBelowSolidBlock(World worldIn, BlockPos pos) - { -- return worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); -+ return worldIn.isSideSolid(pos.up(), EnumFacing.DOWN, false); - } - - private boolean isOcelotSittingOnChest(World worldIn, BlockPos pos) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockCocoa.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockCocoa.java.patch deleted file mode 100644 index d99b486cf..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockCocoa.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java -+++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java -@@ -137,6 +137,13 @@ - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -+ } -+ -+ @Override -+ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List dropped = super.getDrops(world, pos, state, fortune); - int j = ((Integer)state.getValue(AGE)).intValue(); - byte b0 = 1; - -@@ -147,8 +154,9 @@ - - for (int k = 0; k < b0; ++k) - { -- spawnAsEntity(worldIn, pos, new ItemStack(Items.dye, 1, EnumDyeColor.BROWN.getDyeDamage())); -+ dropped.add(new ItemStack(Items.dye, 1, EnumDyeColor.BROWN.getDyeDamage())); - } -+ return dropped; - } - - @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch deleted file mode 100644 index e7efd49a1..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockCrops.java.patch +++ /dev/null @@ -1,77 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockCrops.java -+++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java -@@ -82,11 +82,11 @@ - float f1 = 0.0F; - IBlockState iblockstate = worldIn.getBlockState(blockpos1.add(i, 0, j)); - -- if (iblockstate.getBlock() == Blocks.farmland) -+ if (iblockstate.getBlock().canSustainPlant(worldIn, blockpos1.add(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)blockIn)) - { - f1 = 1.0F; - -- if (((Integer)iblockstate.getValue(BlockFarmland.MOISTURE)).intValue() > 0) -+ if (iblockstate.getBlock().isFertile(worldIn, blockpos1.add(i, 0, j))) - { - f1 = 3.0F; - } -@@ -127,7 +127,7 @@ - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -- return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); -+ return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); - } - - protected Item getSeed() -@@ -143,24 +143,6 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); -- -- if (!worldIn.isRemote) -- { -- int j = ((Integer)state.getValue(AGE)).intValue(); -- -- if (j >= 7) -- { -- int k = 3 + fortune; -- -- for (int l = 0; l < k; ++l) -- { -- if (worldIn.rand.nextInt(15) <= j) -- { -- spawnAsEntity(worldIn, pos, new ItemStack(this.getSeed(), 1, 0)); -- } -- } -- } -- } - } - - public Item getItemDropped(IBlockState state, Random rand, int fortune) -@@ -203,4 +185,26 @@ - { - return new BlockState(this, new IProperty[] {AGE}); - } -+ -+ @Override -+ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = super.getDrops(world, pos, state, fortune); -+ int age = ((Integer)state.getValue(AGE)).intValue(); -+ Random rand = world instanceof World ? ((World)world).rand : new Random(); -+ -+ if (age >= 7) -+ { -+ int k = 3 + fortune; -+ -+ for (int i = 0; i < 3 + fortune; ++i) -+ { -+ if (rand.nextInt(15) <= age) -+ { -+ ret.add(new ItemStack(this.getSeed(), 1, 0)); -+ } -+ } -+ } -+ return ret; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch deleted file mode 100644 index 5a36603ea..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockDeadBush.java.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockDeadBush.java -+++ ../src-work/minecraft/net/minecraft/block/BlockDeadBush.java -@@ -13,7 +13,7 @@ - import net.minecraft.util.BlockPos; - import net.minecraft.world.World; - --public class BlockDeadBush extends BlockBush -+public class BlockDeadBush extends BlockBush implements net.minecraftforge.common.IShearable - { - private static final String __OBFID = "CL_00000224"; - -@@ -41,14 +41,15 @@ - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) - { -- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) - { -- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0)); -- } -- else -- { - super.harvestBlock(worldIn, player, pos, state, te); - } - } -+ -+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(Blocks.deadbush))); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch deleted file mode 100644 index e44689205..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockDoor.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockDoor.java -+++ ../src-work/minecraft/net/minecraft/block/BlockDoor.java -@@ -149,7 +149,7 @@ - { - if (this.blockMaterial == Material.iron) - { -- return true; -+ return false; //Allow items to interact with the door - } - else - { -@@ -267,7 +267,7 @@ - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return pos.getY() >= 255 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); -+ return pos.getY() >= worldIn.getHeight() - 1 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); - } - - public int getMobilityFlag() diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch deleted file mode 100644 index e617af020..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockDoublePlant.java.patch +++ /dev/null @@ -1,89 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockDoublePlant.java -+++ ../src-work/minecraft/net/minecraft/block/BlockDoublePlant.java -@@ -24,7 +24,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class BlockDoublePlant extends BlockBush implements IGrowable -+public class BlockDoublePlant extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable - { - public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockDoublePlant.EnumPlantType.class); - public static final PropertyEnum HALF = PropertyEnum.create("half", BlockDoublePlant.EnumBlockHalf.class); -@@ -89,6 +89,8 @@ - Object object = flag ? this : worldIn.getBlockState(blockpos1).getBlock(); - Object object1 = flag ? worldIn.getBlockState(blockpos2).getBlock() : this; - -+ if (!flag) this.dropBlockAsItem(worldIn, pos, state, 0); //Forge move above the setting to air. -+ - if (object == this) - { - worldIn.setBlockState(blockpos1, Blocks.air.getDefaultState(), 3); -@@ -97,17 +99,13 @@ - if (object1 == this) - { - worldIn.setBlockState(blockpos2, Blocks.air.getDefaultState(), 3); -- -- if (!flag) -- { -- this.dropBlockAsItem(worldIn, blockpos2, state, 0); -- } - } - } - } - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -+ if (state.getBlock() != this) return super.canBlockStay(worldIn, pos, state); //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. - if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) - { - return worldIn.getBlockState(pos.down()).getBlock() == this; -@@ -157,7 +155,6 @@ - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) - { -- if (worldIn.isRemote || player.getCurrentEquippedItem() == null || player.getCurrentEquippedItem().getItem() != Items.shears || state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.onHarvest(worldIn, pos, state, player)) - { - super.harvestBlock(worldIn, player, pos, state, te); - } -@@ -220,8 +217,6 @@ - else - { - player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- int i = (enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).getMeta(); -- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 2, i)); - return true; - } - } -@@ -296,6 +291,32 @@ - return Block.EnumOffsetType.XZ; - } - -+ @Override -+ public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos) -+ { -+ IBlockState state = world.getBlockState(pos); -+ EnumPlantType type = (EnumPlantType)state.getValue(VARIANT); -+ return state.getValue(HALF) == EnumBlockHalf.LOWER && (type == EnumPlantType.FERN || type == EnumPlantType.GRASS); -+ } -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ java.util.List ret = new java.util.ArrayList(); -+ EnumPlantType type = (EnumPlantType)world.getBlockState(pos).getValue(VARIANT); -+ if (type == EnumPlantType.FERN) ret.add(new ItemStack(Blocks.tallgrass, 2, BlockTallGrass.EnumType.FERN.getMeta())); -+ if (type == EnumPlantType.GRASS) ret.add(new ItemStack(Blocks.tallgrass, 2, BlockTallGrass.EnumType.GRASS.getMeta())); -+ return ret; -+ } -+ @Override -+ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) -+ { -+ //Forge: Break both parts on the client to prevent the top part flickering as default type for a few frames. -+ IBlockState state = world.getBlockState(pos); -+ if (state.getBlock() == this && state.getValue(HALF) == EnumBlockHalf.LOWER && world.getBlockState(pos.up()).getBlock() == this) -+ world.setBlockToAir(pos.up()); -+ return world.setBlockToAir(pos); -+ } -+ - static enum EnumBlockHalf implements IStringSerializable - { - UPPER, diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch deleted file mode 100644 index f303f1b29..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockFalling.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockFalling.java -+++ ../src-work/minecraft/net/minecraft/block/BlockFalling.java -@@ -85,6 +85,7 @@ - - public static boolean canFallInto(World worldIn, BlockPos pos) - { -+ if (worldIn.isAirBlock(pos)) return true; - Block block = worldIn.getBlockState(pos).getBlock(); - Material material = block.blockMaterial; - return block == Blocks.fire || material == Material.air || material == Material.water || material == Material.lava; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch deleted file mode 100644 index b94b5429e..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockFarmland.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockFarmland.java -+++ ../src-work/minecraft/net/minecraft/block/BlockFarmland.java -@@ -89,7 +89,7 @@ - private boolean hasCrops(World worldIn, BlockPos pos) - { - Block block = worldIn.getBlockState(pos.up()).getBlock(); -- return block instanceof BlockCrops || block instanceof BlockStem; -+ return block instanceof net.minecraftforge.common.IPlantable && canSustainPlant(worldIn, pos, net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)block); - } - - private boolean hasWater(World worldIn, BlockPos pos) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch deleted file mode 100644 index ebd791a84..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockFire.java.patch +++ /dev/null @@ -1,211 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockFire.java -+++ ../src-work/minecraft/net/minecraft/block/BlockFire.java -@@ -42,18 +42,24 @@ - int j = pos.getY(); - int k = pos.getZ(); - -- if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down())) -+ if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP)) - { - boolean flag = (i + j + k & 1) == 1; - boolean flag1 = (i / 2 + j / 2 + k / 2 & 1) == 1; - int l = 0; - -- if (this.canCatchFire(worldIn, pos.up())) -+ if (this.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN)) - { - l = flag ? 1 : 2; - } - -- return state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west()))).withProperty(UPPER, Integer.valueOf(l)).withProperty(FLIP, Boolean.valueOf(flag1)).withProperty(ALT, Boolean.valueOf(flag)); -+ return state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH))) -+ .withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east(), EnumFacing.EAST ))) -+ .withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH))) -+ .withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west(), EnumFacing.EAST ))) -+ .withProperty(UPPER, Integer.valueOf(l)) -+ .withProperty(FLIP, Boolean.valueOf(flag1)) -+ .withProperty(ALT, Boolean.valueOf(flag)); - } - else - { -@@ -109,6 +115,7 @@ - - public void setFireInfo(Block blockIn, int encouragement, int flammability) - { -+ if (blockIn == Blocks.air) throw new IllegalArgumentException("Tried to set air on fire... This is bad."); - this.encouragements.put(blockIn, Integer.valueOf(encouragement)); - this.flammabilities.put(blockIn, Integer.valueOf(flammability)); - } -@@ -148,13 +155,8 @@ - } - - Block block = worldIn.getBlockState(pos.down()).getBlock(); -- boolean flag = block == Blocks.netherrack; -+ boolean flag = block.isFireSource(worldIn, pos.down(), EnumFacing.UP); - -- if (worldIn.provider instanceof WorldProviderEnd && block == Blocks.bedrock) -- { -- flag = true; -- } -- - if (!flag && worldIn.isRaining() && this.canDie(worldIn, pos)) - { - worldIn.setBlockToAir(pos); -@@ -183,7 +185,7 @@ - return; - } - -- if (!this.canCatchFire(worldIn, pos.down()) && i == 15 && rand.nextInt(4) == 0) -+ if (!this.canCatchFire(worldIn, pos.down(), EnumFacing.UP) && i == 15 && rand.nextInt(4) == 0) - { - worldIn.setBlockToAir(pos); - return; -@@ -198,12 +200,12 @@ - b0 = -50; - } - -- this.catchOnFire(worldIn, pos.east(), 300 + b0, rand, i); -- this.catchOnFire(worldIn, pos.west(), 300 + b0, rand, i); -- this.catchOnFire(worldIn, pos.down(), 250 + b0, rand, i); -- this.catchOnFire(worldIn, pos.up(), 250 + b0, rand, i); -- this.catchOnFire(worldIn, pos.north(), 300 + b0, rand, i); -- this.catchOnFire(worldIn, pos.south(), 300 + b0, rand, i); -+ this.tryCatchFire(worldIn, pos.east(), 300 + b0, rand, i, EnumFacing.WEST); -+ this.tryCatchFire(worldIn, pos.west(), 300 + b0, rand, i, EnumFacing.EAST); -+ this.tryCatchFire(worldIn, pos.down(), 250 + b0, rand, i, EnumFacing.UP); -+ this.tryCatchFire(worldIn, pos.up(), 250 + b0, rand, i, EnumFacing.DOWN); -+ this.tryCatchFire(worldIn, pos.north(), 300 + b0, rand, i, EnumFacing.SOUTH); -+ this.tryCatchFire(worldIn, pos.south(), 300 + b0, rand, i, EnumFacing.NORTH); - - for (int j = -1; j <= 1; ++j) - { -@@ -262,22 +264,30 @@ - return false; - } - -+ @Deprecated // Use Block.getFlammability - public int getFlammability(Block blockIn) - { - Integer integer = (Integer)this.flammabilities.get(blockIn); - return integer == null ? 0 : integer.intValue(); - } - -+ @Deprecated // Use Block.getFlammability - public int getEncouragement(Block blockIn) - { - Integer integer = (Integer)this.encouragements.get(blockIn); - return integer == null ? 0 : integer.intValue(); - } - -+ @Deprecated // Use tryCatchFire with face below - private void catchOnFire(World worldIn, BlockPos pos, int chance, Random random, int age) - { -- int k = this.getFlammability(worldIn.getBlockState(pos).getBlock()); -+ this.tryCatchFire(worldIn, pos, chance, random, age, EnumFacing.UP); -+ } - -+ private void tryCatchFire(World worldIn, BlockPos pos, int chance, Random random, int age, EnumFacing face) -+ { -+ int k = worldIn.getBlockState(pos).getBlock().getFlammability(worldIn, pos, face); -+ - if (random.nextInt(chance) < k) - { - IBlockState iblockstate = worldIn.getBlockState(pos); -@@ -314,7 +324,7 @@ - { - EnumFacing enumfacing = aenumfacing[j]; - -- if (this.canCatchFire(worldIn, pos.offset(enumfacing))) -+ if (this.canCatchFire(worldIn, pos.offset(enumfacing), enumfacing.getOpposite())) - { - return true; - } -@@ -338,7 +348,7 @@ - for (int k = 0; k < j; ++k) - { - EnumFacing enumfacing = aenumfacing[k]; -- i = Math.max(this.getEncouragement(worldIn.getBlockState(pos.offset(enumfacing)).getBlock()), i); -+ i = Math.max(worldIn.getBlockState(pos.offset(enumfacing)).getBlock().getFlammability(worldIn, pos.offset(enumfacing), enumfacing.getOpposite()), i); - } - - return i; -@@ -350,9 +360,10 @@ - return false; - } - -+ @Deprecated // Use canCatchFire with face sensitive version below - public boolean canCatchFire(IBlockAccess worldIn, BlockPos pos) - { -- return this.getEncouragement(worldIn.getBlockState(pos).getBlock()) > 0; -+ return canCatchFire(worldIn, pos, EnumFacing.UP); - } - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) -@@ -396,9 +407,9 @@ - double d1; - double d2; - -- if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down())) -+ if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP)) - { -- if (Blocks.fire.canCatchFire(worldIn, pos.west())) -+ if (Blocks.fire.canCatchFire(worldIn, pos.west(), EnumFacing.EAST)) - { - for (i = 0; i < 2; ++i) - { -@@ -409,7 +420,7 @@ - } - } - -- if (Blocks.fire.canCatchFire(worldIn, pos.east())) -+ if (Blocks.fire.canCatchFire(worldIn, pos.east(), EnumFacing.WEST)) - { - for (i = 0; i < 2; ++i) - { -@@ -420,7 +431,7 @@ - } - } - -- if (Blocks.fire.canCatchFire(worldIn, pos.north())) -+ if (Blocks.fire.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH)) - { - for (i = 0; i < 2; ++i) - { -@@ -431,7 +442,7 @@ - } - } - -- if (Blocks.fire.canCatchFire(worldIn, pos.south())) -+ if (Blocks.fire.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH)) - { - for (i = 0; i < 2; ++i) - { -@@ -442,7 +453,7 @@ - } - } - -- if (Blocks.fire.canCatchFire(worldIn, pos.up())) -+ if (Blocks.fire.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN)) - { - for (i = 0; i < 2; ++i) - { -@@ -490,4 +501,19 @@ - { - return new BlockState(this, new IProperty[] {AGE, NORTH, EAST, SOUTH, WEST, UPPER, FLIP, ALT}); - } -+ -+ /*================================= Forge Start ======================================*/ -+ /** -+ * Side sensitive version that calls the block function. -+ * -+ * @param world The current world -+ * @param pos Block position -+ * @param face The side the fire is coming from -+ * @return True if the face can catch fire. -+ */ -+ public boolean canCatchFire(IBlockAccess world, BlockPos pos, EnumFacing face) -+ { -+ return world.getBlockState(pos).getBlock().isFlammable(world, pos, face); -+ } -+ /*================================= Forge Start ======================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch deleted file mode 100644 index cc2eda3c8..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockFlowerPot.java.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockFlowerPot.java -+++ ../src-work/minecraft/net/minecraft/block/BlockFlowerPot.java -@@ -162,13 +162,6 @@ - - public void breakBlock(World worldIn, BlockPos pos, IBlockState state) - { -- TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos); -- -- if (tileentityflowerpot != null && tileentityflowerpot.getFlowerPotItem() != null) -- { -- spawnAsEntity(worldIn, pos, new ItemStack(tileentityflowerpot.getFlowerPotItem(), 1, tileentityflowerpot.getFlowerPotData())); -- } -- - super.breakBlock(worldIn, pos, state); - } - -@@ -388,6 +381,31 @@ - return EnumWorldBlockLayer.CUTOUT; - } - -+ -+ /*============================FORGE START=====================================*/ -+ @Override -+ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = super.getDrops(world, pos, state, fortune); -+ TileEntityFlowerPot te = world.getTileEntity(pos) instanceof TileEntityFlowerPot ? (TileEntityFlowerPot)world.getTileEntity(pos) : null; -+ if (te != null && te.getFlowerPotItem() != null) -+ ret.add(new ItemStack(te.getFlowerPotItem(), 1, te.getFlowerPotData())); -+ return ret; -+ } -+ @Override -+ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) -+ { -+ if (willHarvest) return true; //If it will harvest, delay deletion of the block until after getDrops -+ return super.removedByPlayer(world, pos, player, willHarvest); -+ } -+ @Override -+ public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) -+ { -+ super.harvestBlock(world, player, pos, state, te); -+ world.setBlockToAir(pos); -+ } -+ /*===========================FORGE END==========================================*/ -+ - public static enum EnumFlowerType implements IStringSerializable - { - EMPTY("empty"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch deleted file mode 100644 index dcf8c192c..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockGrass.java.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockGrass.java -+++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java -@@ -59,7 +59,7 @@ - { - if (!worldIn.isRemote) - { -- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2) -+ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity(worldIn, pos.up()) > 2) - { - worldIn.setBlockState(pos, Blocks.dirt.getDefaultState()); - } -@@ -73,7 +73,7 @@ - Block block = worldIn.getBlockState(blockpos1.up()).getBlock(); - IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); - -- if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity() <= 2) -+ if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity(worldIn, blockpos1.up()) <= 2) - { - worldIn.setBlockState(blockpos1, Blocks.grass.getDefaultState()); - } -@@ -120,18 +120,11 @@ - continue; - } - } -- else if (worldIn.getBlockState(blockpos2).getBlock().blockMaterial == Material.air) -+ else if (worldIn.isAirBlock(blockpos2)) - { - if (rand.nextInt(8) == 0) - { -- BlockFlower.EnumFlowerType enumflowertype = worldIn.getBiomeGenForCoords(blockpos2).pickRandomFlower(rand, blockpos2); -- BlockFlower blockflower = enumflowertype.getBlockType().getBlock(); -- IBlockState iblockstate1 = blockflower.getDefaultState().withProperty(blockflower.getTypeProperty(), enumflowertype); -- -- if (blockflower.canBlockStay(worldIn, blockpos2, iblockstate1)) -- { -- worldIn.setBlockState(blockpos2, iblockstate1, 3); -- } -+ worldIn.getBiomeGenForCoords(blockpos2).plantFlower(worldIn, rand, blockpos2); - } - else - { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch deleted file mode 100644 index a46fe79eb..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockHugeMushroom.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockHugeMushroom.java -+++ ../src-work/minecraft/net/minecraft/block/BlockHugeMushroom.java -@@ -64,6 +64,20 @@ - return new BlockState(this, new IProperty[] {VARIANT}); - } - -+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) -+ { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) -+ { -+ if (prop.getName().equals("variant")) -+ { -+ world.setBlockState(pos, state.cycleProperty(prop)); -+ return true; -+ } -+ } -+ return false; -+ } -+ - public static enum EnumType implements IStringSerializable - { - NORTH_WEST(1, "north_west"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch deleted file mode 100644 index ebd4a9f12..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockIce.java.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockIce.java -+++ ../src-work/minecraft/net/minecraft/block/BlockIce.java -@@ -40,14 +40,17 @@ - player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); - player.addExhaustion(0.025F); - -- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) -+ if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player)) - { -+ java.util.List items = new java.util.ArrayList(); - ItemStack itemstack = this.createStackedBlock(state); - -- if (itemstack != null) -- { -- spawnAsEntity(worldIn, pos, itemstack); -- } -+ if (itemstack != null) items.add(itemstack); -+ -+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, worldIn.getBlockState(pos), 0, 1.0f, true, player); -+ -+ for (ItemStack is : items) -+ spawnAsEntity(worldIn, pos, is); - } - else - { -@@ -58,7 +61,9 @@ - } - - int i = EnchantmentHelper.getFortuneModifier(player); -+ harvesters.set(player); - this.dropBlockAsItem(worldIn, pos, state, i); -+ harvesters.set(null); - Material material = worldIn.getBlockState(pos.down()).getBlock().getMaterial(); - - if (material.blocksMovement() || material.isLiquid()) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch deleted file mode 100644 index 9c4b2704e..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockLadder.java.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockLadder.java -+++ ../src-work/minecraft/net/minecraft/block/BlockLadder.java -@@ -80,7 +80,10 @@ - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return worldIn.getBlockState(pos.west()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.east()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.north()).getBlock().isNormalCube() ? true : worldIn.getBlockState(pos.south()).getBlock().isNormalCube())); -+ return worldIn.isSideSolid(pos.west(), EnumFacing.EAST, true) || -+ worldIn.isSideSolid(pos.east(), EnumFacing.WEST, true) || -+ worldIn.isSideSolid(pos.north(), EnumFacing.SOUTH, true) || -+ worldIn.isSideSolid(pos.south(), EnumFacing.NORTH, true); - } - - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) -@@ -124,7 +127,7 @@ - - protected boolean canBlockStay(World worldIn, BlockPos pos, EnumFacing facing) - { -- return worldIn.getBlockState(pos.offset(facing.getOpposite())).getBlock().isNormalCube(); -+ return worldIn.isSideSolid(pos.offset(facing.getOpposite()), facing, true); - } - - @SideOnly(Side.CLIENT) -@@ -155,6 +158,8 @@ - return new BlockState(this, new IProperty[] {FACING}); - } - -+ @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; } -+ - static final class SwitchEnumFacing - { - static final int[] FACING_LOOKUP = new int[EnumFacing.values().length]; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch deleted file mode 100644 index 662e1f74d..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockLeaves.java.patch +++ /dev/null @@ -1,130 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java -+++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java -@@ -18,7 +18,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public abstract class BlockLeaves extends BlockLeavesBase -+public abstract class BlockLeaves extends BlockLeavesBase implements net.minecraftforge.common.IShearable - { - public static final PropertyBool DECAYABLE = PropertyBool.create("decayable"); - public static final PropertyBool CHECK_DECAY = PropertyBool.create("check_decay"); -@@ -76,9 +76,9 @@ - BlockPos blockpos1 = pos.add(i1, j1, k1); - IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); - -- if (iblockstate1.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate1.getValue(CHECK_DECAY)).booleanValue()) -+ if (iblockstate1.getBlock().isLeaves(worldIn, blockpos1)) - { -- worldIn.setBlockState(blockpos1, iblockstate1.withProperty(CHECK_DECAY, Boolean.valueOf(true)), 4); -+ iblockstate1.getBlock().beginLeavesDecay(worldIn, blockpos1); - } - } - } -@@ -119,11 +119,12 @@ - { - for (i2 = -b0; i2 <= b0; ++i2) - { -- Block block = worldIn.getBlockState(new BlockPos(j + k1, k + l1, l + i2)).getBlock(); -+ BlockPos tmp = new BlockPos(j + k1, k + l1, l + i2); -+ Block block = worldIn.getBlockState(tmp).getBlock(); - -- if (block != Blocks.log && block != Blocks.log2) -+ if (!block.canSustainLeaves(worldIn, tmp)) - { -- if (block.getMaterial() == Material.leaves) -+ if (block.isLeaves(worldIn, tmp)) - { - this.surroundings[(k1 + j1) * i1 + (l1 + j1) * b1 + i2 + j1] = -2; - } -@@ -230,40 +231,7 @@ - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -- if (!worldIn.isRemote) -- { -- int j = this.getSaplingDropChance(state); -- -- if (fortune > 0) -- { -- j -= 2 << fortune; -- -- if (j < 10) -- { -- j = 10; -- } -- } -- -- if (worldIn.rand.nextInt(j) == 0) -- { -- Item item = this.getItemDropped(state, worldIn.rand, fortune); -- spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); -- } -- -- j = 200; -- -- if (fortune > 0) -- { -- j -= 10 << fortune; -- -- if (j < 40) -- { -- j = 40; -- } -- } -- -- this.dropApple(worldIn, pos, state, j); -- } -+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); - } - - protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance) {} -@@ -298,4 +266,48 @@ - } - - public abstract BlockPlanks.EnumType getWoodType(int meta); -+ -+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } -+ @Override public boolean isLeaves(IBlockAccess world, BlockPos pos){ return true; } -+ -+ @Override -+ public void beginLeavesDecay(World world, BlockPos pos) -+ { -+ IBlockState state = world.getBlockState(pos); -+ if (!(Boolean)state.getValue(CHECK_DECAY)) -+ { -+ world.setBlockState(pos, state.withProperty(CHECK_DECAY, true), 4); -+ } -+ } -+ -+ @Override -+ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = new java.util.ArrayList(); -+ Random rand = world instanceof World ? ((World)world).rand : new Random(); -+ int chance = this.getSaplingDropChance(state); -+ -+ if (fortune > 0) -+ { -+ chance -= 2 << fortune; -+ if (chance < 10) chance = 10; -+ } -+ -+ if (rand.nextInt(chance) == 0) -+ ret.add(new ItemStack(getItemDropped(state, rand, fortune), 1, damageDropped(state))); -+ -+ chance = 200; -+ if (fortune > 0) -+ { -+ chance -= 10 << fortune; -+ if (chance < 40) chance = 40; -+ } -+ -+ this.captureDrops(true); -+ if (world instanceof World) -+ this.dropApple((World)world, pos, state, chance); // Dammet mojang -+ ret.addAll(this.captureDrops(false)); -+ return ret; -+ } -+ - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLever.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLever.java.patch deleted file mode 100644 index 3742cca4c..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockLever.java.patch +++ /dev/null @@ -1,67 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockLever.java -+++ ../src-work/minecraft/net/minecraft/block/BlockLever.java -@@ -47,24 +47,24 @@ - - public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) - { -- return side == EnumFacing.UP && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) ? true : this.canSustainLever(worldIn, pos.offset(side.getOpposite())); -+ return side == EnumFacing.UP && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) ? true : worldIn.isSideSolid(pos.offset(side.getOpposite()), side); - } - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return this.canSustainLever(worldIn, pos.west()) ? true : (this.canSustainLever(worldIn, pos.east()) ? true : (this.canSustainLever(worldIn, pos.north()) ? true : (this.canSustainLever(worldIn, pos.south()) ? true : (World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) ? true : this.canSustainLever(worldIn, pos.up()))))); -+ return worldIn.isSideSolid(pos.west(), EnumFacing.EAST ) || -+ worldIn.isSideSolid(pos.east(), EnumFacing.WEST ) || -+ worldIn.isSideSolid(pos.north(), EnumFacing.SOUTH) || -+ worldIn.isSideSolid(pos.south(), EnumFacing.NORTH) || -+ worldIn.isSideSolid(pos.down(), EnumFacing.UP ) || -+ worldIn.isSideSolid(pos.up(), EnumFacing.DOWN ); - } - -- protected boolean canSustainLever(World worldIn, BlockPos pos) -- { -- return worldIn.getBlockState(pos).getBlock().isNormalCube(); -- } -- - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) - { - IBlockState iblockstate = this.getDefaultState().withProperty(POWERED, Boolean.valueOf(false)); - -- if (this.canSustainLever(worldIn, pos.offset(facing.getOpposite()))) -+ if (worldIn.isSideSolid(pos.offset(facing.getOpposite()), facing)) - { - return iblockstate.withProperty(FACING, BlockLever.EnumOrientation.forFacings(facing, placer.getHorizontalFacing())); - } -@@ -87,7 +87,7 @@ - - enumfacing1 = (EnumFacing)iterator.next(); - } -- while (enumfacing1 == facing || !this.canSustainLever(worldIn, pos.offset(enumfacing1.getOpposite()))); -+ while (enumfacing1 == facing || !worldIn.isSideSolid(pos.offset(enumfacing1.getOpposite()), enumfacing1)); - - return iblockstate.withProperty(FACING, BlockLever.EnumOrientation.forFacings(enumfacing1, placer.getHorizontalFacing())); - } -@@ -116,7 +116,8 @@ - - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) - { -- if (this.checkForDrop(worldIn, pos) && !this.canSustainLever(worldIn, pos.offset(((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing().getOpposite()))) -+ EnumFacing dir = ((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing(); -+ if (this.checkForDrop(worldIn, pos) && !worldIn.isSideSolid(pos.offset(dir.getOpposite()), dir)) - { - this.dropBlockAsItem(worldIn, pos, state, 0); - worldIn.setBlockToAir(pos); -@@ -235,6 +236,12 @@ - return new BlockState(this, new IProperty[] {FACING, POWERED}); - } - -+ -+ private boolean canAttach(World world, BlockPos pos, EnumFacing side) -+ { -+ return world.isSideSolid(pos, side); -+ } -+ - public static enum EnumOrientation implements IStringSerializable - { - DOWN_X(0, "down_x", EnumFacing.DOWN), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch deleted file mode 100644 index 2690041c2..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockLog.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockLog.java -+++ ../src-work/minecraft/net/minecraft/block/BlockLog.java -@@ -38,9 +38,9 @@ - BlockPos blockpos1 = (BlockPos)iterator.next(); - IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); - -- if (iblockstate1.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate1.getValue(BlockLeaves.CHECK_DECAY)).booleanValue()) -+ if (iblockstate1.getBlock().isLeaves(worldIn, blockpos1)) - { -- worldIn.setBlockState(blockpos1, iblockstate1.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(true)), 4); -+ iblockstate1.getBlock().beginLeavesDecay(worldIn, blockpos1); - } - } - } -@@ -51,6 +51,9 @@ - return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(LOG_AXIS, BlockLog.EnumAxis.fromFacingAxis(facing.getAxis())); - } - -+ @Override public boolean canSustainLeaves(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } -+ @Override public boolean isWood(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } -+ - public static enum EnumAxis implements IStringSerializable - { - X("x"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch deleted file mode 100644 index 29a5e234a..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockMobSpawner.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockMobSpawner.java -+++ ../src-work/minecraft/net/minecraft/block/BlockMobSpawner.java -@@ -39,10 +39,14 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -- int j = 15 + worldIn.rand.nextInt(15) + worldIn.rand.nextInt(15); -- this.dropXpOnBlockBreak(worldIn, pos, j); - } - -+ @Override -+ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15); -+ } -+ - public boolean isOpaqueCube() - { - return false; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch deleted file mode 100644 index be26c64c3..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockMushroom.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java -+++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java -@@ -76,7 +76,7 @@ - if (pos.getY() >= 0 && pos.getY() < 256) - { - IBlockState iblockstate1 = worldIn.getBlockState(pos.down()); -- return iblockstate1.getBlock() == Blocks.mycelium ? true : (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.canPlaceBlockOn(iblockstate1.getBlock())); -+ return iblockstate1.getBlock() == Blocks.mycelium ? true : (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && iblockstate1.getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this)); - } - else - { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch deleted file mode 100644 index 554a24123..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockMycelium.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockMycelium.java -+++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java -@@ -39,7 +39,7 @@ - { - if (!worldIn.isRemote) - { -- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2) -+ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity(worldIn, pos.up()) > 2) - { - worldIn.setBlockState(pos, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); - } -@@ -53,7 +53,7 @@ - IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); - Block block = worldIn.getBlockState(blockpos1.up()).getBlock(); - -- if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity() <= 2) -+ if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity(worldIn, blockpos1.up()) <= 2) - { - worldIn.setBlockState(blockpos1, this.getDefaultState()); - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch deleted file mode 100644 index e46eedd1b..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockNetherWart.java.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java -+++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java -@@ -36,7 +36,7 @@ - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); -+ return super.canBlockStay(worldIn, pos, state); - } - - public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) -@@ -52,9 +52,11 @@ - super.updateTick(worldIn, pos, state, rand); - } - -+ @SuppressWarnings("unused") - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -- if (!worldIn.isRemote) -+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -+ if (false && !worldIn.isRemote) - { - int j = 1; - -@@ -105,4 +107,24 @@ - { - return new BlockState(this, new IProperty[] {AGE}); - } -+ -+ @Override -+ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = new java.util.ArrayList(); -+ Random rand = world instanceof World ? ((World)world).rand : new Random(); -+ int count = 1; -+ -+ if (((Integer)state.getValue(AGE)) >= 3) -+ { -+ count = 2 + rand.nextInt(3) + (fortune > 0 ? rand.nextInt(fortune + 1) : 0); -+ } -+ -+ for (int i = 0; i < count; i++) -+ { -+ ret.add(new ItemStack(Items.nether_wart)); -+ } -+ -+ return ret; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch deleted file mode 100644 index 906f299da..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockNewLeaf.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockNewLeaf.java -+++ ../src-work/minecraft/net/minecraft/block/BlockNewLeaf.java -@@ -105,14 +105,15 @@ - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) - { -- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) - { -- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4)); -- } -- else -- { - super.harvestBlock(worldIn, player, pos, state, te); - } - } -+ -+ @Override -+ public List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ IBlockState state = world.getBlockState(pos); -+ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4))); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockNote.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockNote.java.patch deleted file mode 100644 index 2ce222a73..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockNote.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockNote.java -+++ ../src-work/minecraft/net/minecraft/block/BlockNote.java -@@ -58,7 +58,9 @@ - if (tileentity instanceof TileEntityNote) - { - TileEntityNote tileentitynote = (TileEntityNote)tileentity; -+ int old = tileentitynote.note; - tileentitynote.changePitch(); -+ if (old == tileentitynote.note) return false; - tileentitynote.triggerNote(worldIn, pos); - } - -@@ -96,6 +98,10 @@ - - public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam) - { -+ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(worldIn, pos, state, eventParam, eventID); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e)) return false; -+ eventID = e.instrument.ordinal(); -+ eventParam = e.getVanillaNoteId(); - float f = (float)Math.pow(2.0D, (double)(eventParam - 12) / 12.0D); - worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "note." + this.getInstrument(eventID), 3.0F, f); - worldIn.spawnParticle(EnumParticleTypes.NOTE, (double)pos.getX() + 0.5D, (double)pos.getY() + 1.2D, (double)pos.getZ() + 0.5D, (double)eventParam / 24.0D, 0.0D, 0.0D, new int[0]); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch deleted file mode 100644 index 15acd8235..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockOldLeaf.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockOldLeaf.java -+++ ../src-work/minecraft/net/minecraft/block/BlockOldLeaf.java -@@ -148,11 +148,17 @@ - if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) - { - player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata())); - } - else - { - super.harvestBlock(worldIn, player, pos, state, te); - } - } -+ -+ @Override -+ public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) -+ { -+ IBlockState state = world.getBlockState(pos); -+ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata()))); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch deleted file mode 100644 index 178e59206..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockOre.java.patch +++ /dev/null @@ -1,59 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockOre.java -+++ ../src-work/minecraft/net/minecraft/block/BlockOre.java -@@ -10,6 +10,7 @@ - import net.minecraft.item.Item; - import net.minecraft.util.BlockPos; - import net.minecraft.util.MathHelper; -+import net.minecraft.world.IBlockAccess; - import net.minecraft.world.World; - - public class BlockOre extends Block -@@ -54,34 +55,40 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -- -- if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this)) -+ } -+ @Override -+ public int getExpDrop(IBlockAccess world, BlockPos pos, int fortune) -+ { -+ IBlockState state = world.getBlockState(pos); -+ Random rand = world instanceof World ? ((World)world).rand : new Random(); -+ if (this.getItemDropped(state, rand, fortune) != Item.getItemFromBlock(this)) - { - int j = 0; - - if (this == Blocks.coal_ore) - { -- j = MathHelper.getRandomIntegerInRange(worldIn.rand, 0, 2); -+ j = MathHelper.getRandomIntegerInRange(rand, 0, 2); - } - else if (this == Blocks.diamond_ore) - { -- j = MathHelper.getRandomIntegerInRange(worldIn.rand, 3, 7); -+ j = MathHelper.getRandomIntegerInRange(rand, 3, 7); - } - else if (this == Blocks.emerald_ore) - { -- j = MathHelper.getRandomIntegerInRange(worldIn.rand, 3, 7); -+ j = MathHelper.getRandomIntegerInRange(rand, 3, 7); - } - else if (this == Blocks.lapis_ore) - { -- j = MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); -+ j = MathHelper.getRandomIntegerInRange(rand, 2, 5); - } - else if (this == Blocks.quartz_ore) - { -- j = MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); -+ j = MathHelper.getRandomIntegerInRange(rand, 2, 5); - } - -- this.dropXpOnBlockBreak(worldIn, pos, j); -+ return j; - } -+ return 0; - } - - public int getDamageValue(World worldIn, BlockPos pos) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch deleted file mode 100644 index bb91fe6ca..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockPane.java.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPane.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPane.java -@@ -39,7 +39,10 @@ - - public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) - { -- return state.withProperty(NORTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.north()).getBlock()))).withProperty(SOUTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.south()).getBlock()))).withProperty(WEST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.west()).getBlock()))).withProperty(EAST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.east()).getBlock()))); -+ return state.withProperty(NORTH, canPaneConnectTo(worldIn, pos, EnumFacing.NORTH)) -+ .withProperty(SOUTH, canPaneConnectTo(worldIn, pos, EnumFacing.SOUTH)) -+ .withProperty(WEST, canPaneConnectTo(worldIn, pos, EnumFacing.WEST)) -+ .withProperty(EAST, canPaneConnectTo(worldIn, pos, EnumFacing.EAST)); - } - - public Item getItemDropped(IBlockState state, Random rand, int fortune) -@@ -65,10 +68,10 @@ - - public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) - { -- boolean flag = this.canPaneConnectToBlock(worldIn.getBlockState(pos.north()).getBlock()); -- boolean flag1 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.south()).getBlock()); -- boolean flag2 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.west()).getBlock()); -- boolean flag3 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.east()).getBlock()); -+ boolean flag = this.canPaneConnectTo(worldIn, pos, EnumFacing.NORTH); -+ boolean flag1 = this.canPaneConnectTo(worldIn, pos, EnumFacing.SOUTH); -+ boolean flag2 = this.canPaneConnectTo(worldIn, pos, EnumFacing.WEST); -+ boolean flag3 = this.canPaneConnectTo(worldIn, pos, EnumFacing.EAST); - - if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) - { -@@ -187,4 +190,11 @@ - { - return new BlockState(this, new IProperty[] {NORTH, EAST, WEST, SOUTH}); - } -+ -+ public boolean canPaneConnectTo(IBlockAccess world, BlockPos pos, EnumFacing dir) -+ { -+ BlockPos off = pos.offset(dir); -+ Block block = world.getBlockState(off).getBlock(); -+ return canPaneConnectToBlock(block) || block.isSideSolid(world, off, dir.getOpposite()); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch deleted file mode 100644 index 669fa4fd5..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockPistonBase.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java -@@ -200,7 +200,7 @@ - } - } - -- if (!flag1 && block.getMaterial() != Material.air && canPush(block, worldIn, blockpos1, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) -+ if (!flag1 && !block.isAir(worldIn, blockpos1) && canPush(block, worldIn, blockpos1, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) - { - this.doMove(worldIn, pos, enumfacing, false); - } -@@ -344,7 +344,7 @@ - return false; - } - -- return !(blockIn instanceof ITileEntityProvider); -+ return !(blockIn.hasTileEntity(worldIn.getBlockState(pos))); - } - else - { -@@ -384,7 +384,9 @@ - { - blockpos1 = (BlockPos)list1.get(j); - Block block = worldIn.getBlockState(blockpos1).getBlock(); -- block.dropBlockAsItem(worldIn, blockpos1, worldIn.getBlockState(blockpos1), 0); -+ //With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. -+ float chance = block instanceof BlockSnow ? -1.0f : 1.0f; -+ block.dropBlockAsItemWithChance(worldIn, blockpos1, worldIn.getBlockState(blockpos1), chance, 0); - worldIn.setBlockToAir(blockpos1); - --i; - ablock[i] = block; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch deleted file mode 100644 index 0121d2a6e..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockPistonMoving.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPistonMoving.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPistonMoving.java -@@ -110,16 +110,7 @@ - - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { -- if (!worldIn.isRemote) -- { -- TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos); -- -- if (tileentitypiston != null) -- { -- IBlockState iblockstate1 = tileentitypiston.getPistonState(); -- iblockstate1.getBlock().dropBlockAsItem(worldIn, pos, iblockstate1, 0); -- } -- } -+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); - } - - public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) -@@ -283,4 +274,16 @@ - { - return new BlockState(this, new IProperty[] {FACING, TYPE}); - } -+ -+ @Override -+ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ TileEntityPiston tileentitypiston = this.getTileEntity(world, pos); -+ if (tileentitypiston != null) -+ { -+ IBlockState pushed = tileentitypiston.getPistonState(); -+ return pushed.getBlock().getDrops(world, pos, pushed, fortune); -+ } -+ return new java.util.ArrayList(); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch deleted file mode 100644 index afe064e2b..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockPotato.java.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPotato.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPotato.java -@@ -24,13 +24,14 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -- -- if (!worldIn.isRemote) -- { -- if (((Integer)state.getValue(AGE)).intValue() >= 7 && worldIn.rand.nextInt(50) == 0) -- { -- spawnAsEntity(worldIn, pos, new ItemStack(Items.poisonous_potato)); -- } -- } - } -+ @Override -+ public java.util.List getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = super.getDrops(world, pos, state, fortune); -+ java.util.Random rand = world instanceof World ? ((World)world).rand : new java.util.Random(); -+ if (((Integer)state.getValue(AGE)) >= 7 && rand.nextInt(50) == 0) -+ ret.add(new ItemStack(Items.poisonous_potato)); -+ return ret; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch deleted file mode 100644 index 898ac8e07..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockPumpkin.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockPumpkin.java -+++ ../src-work/minecraft/net/minecraft/block/BlockPumpkin.java -@@ -109,7 +109,7 @@ - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { -- return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable() && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); -+ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); - } - - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch deleted file mode 100644 index 7c75b6cdc..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockQuartz.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockQuartz.java -+++ ../src-work/minecraft/net/minecraft/block/BlockQuartz.java -@@ -91,6 +91,26 @@ - return new BlockState(this, new IProperty[] {VARIANT}); - } - -+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) -+ { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) -+ { -+ if (prop.getName().equals("variant") && prop.getValueClass() == EnumType.class) -+ { -+ EnumType current = (EnumType)state.getValue(prop); -+ EnumType next = current == EnumType.LINES_X ? EnumType.LINES_Y : -+ current == EnumType.LINES_Y ? EnumType.LINES_Z : -+ current == EnumType.LINES_Z ? EnumType.LINES_X : current; -+ if (next == current) -+ return false; -+ world.setBlockState(pos, state.withProperty(prop, next)); -+ return true; -+ } -+ } -+ return false; -+ } -+ - public static enum EnumType implements IStringSerializable - { - DEFAULT(0, "default", "default"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch deleted file mode 100644 index 46e1f211c..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRailBase.java.patch +++ /dev/null @@ -1,147 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockRailBase.java -+++ ../src-work/minecraft/net/minecraft/block/BlockRailBase.java -@@ -33,7 +33,7 @@ - public static boolean isRailBlock(IBlockState state) - { - Block block = state.getBlock(); -- return block == Blocks.rail || block == Blocks.golden_rail || block == Blocks.detector_rail || block == Blocks.activator_rail; -+ return block instanceof BlockRailBase; - } - - protected BlockRailBase(boolean isPowered) -@@ -174,7 +174,81 @@ - } - - public abstract IProperty getShapeProperty(); -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * Return true if the rail can make corners. -+ * Used by placement logic. -+ * @param world The world. -+ * @param pod Block's position in world -+ * @return True if the rail can make corners. -+ */ -+ public boolean isFlexibleRail(IBlockAccess world, BlockPos pos) -+ { -+ return !this.isPowered; -+ } - -+ /** -+ * Returns true if the rail can make up and down slopes. -+ * Used by placement logic. -+ * @param world The world. -+ * @param pod Block's position in world -+ * @return True if the rail can make slopes. -+ */ -+ public boolean canMakeSlopes(IBlockAccess world, BlockPos pos) -+ { -+ return true; -+ } -+ -+ /** -+ * Returns the max speed of the rail at the specified position. -+ * @param world The world. -+ * @param cart The cart on the rail, may be null. -+ * @param pod Block's position in world -+ * @return The max speed of the current rail. -+ */ -+ public float getRailMaxSpeed(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos) -+ { -+ return 0.4f; -+ } -+ -+ /** -+ * This function is called by any minecart that passes over this rail. -+ * It is called once per update tick that the minecart is on the rail. -+ * @param world The world. -+ * @param cart The cart on the rail. -+ * @param pod Block's position in world -+ */ -+ public void onMinecartPass(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos) -+ { -+ } -+ -+ /** -+ * Rotate the block. For vanilla blocks this rotates around the axis passed in (generally, it should be the "face" that was hit). -+ * Note: for mod blocks, this is up to the block and modder to decide. It is not mandated that it be a rotation around the -+ * face, but could be a rotation to orient *to* that face, or a visiting of possible rotations. -+ * The method should return true if the rotation was successful though. -+ * -+ * @param world The world -+ * @param pos Block position in world -+ * @param axis The axis to rotate around -+ * @return True if the rotation was successful, False if the rotation failed, or is not possible -+ */ -+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) -+ { -+ IBlockState state = world.getBlockState(pos); -+ for (IProperty prop : (java.util.Set)state.getProperties().keySet()) -+ { -+ if (prop.getName().equals("shape")) -+ { -+ world.setBlockState(pos, state.cycleProperty(prop)); -+ return true; -+ } -+ } -+ return false; -+ } -+ -+ /* ======================================== FORGE END =====================================*/ -+ - public static enum EnumRailDirection implements IStringSerializable - { - NORTH_SOUTH(0, "north_south"), -@@ -251,6 +325,7 @@ - private final boolean isPowered; - private final List field_150657_g = Lists.newArrayList(); - private static final String __OBFID = "CL_00000196"; -+ private final boolean canMakeSlopes; - - public Rail(World worldIn, BlockPos pos, IBlockState state) - { -@@ -259,7 +334,8 @@ - this.state = state; - this.block = (BlockRailBase)state.getBlock(); - BlockRailBase.EnumRailDirection enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(BlockRailBase.this.getShapeProperty()); -- this.isPowered = this.block.isPowered; -+ this.isPowered = !this.block.isFlexibleRail(worldIn, pos); -+ canMakeSlopes = this.block.canMakeSlopes(worldIn, pos); - this.func_180360_a(enumraildirection); - } - -@@ -448,7 +524,7 @@ - } - } - -- if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) -+ if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) - { - if (BlockRailBase.isRailBlock(this.world, blockpos.up())) - { -@@ -461,7 +537,7 @@ - } - } - -- if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) -+ if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) - { - if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) - { -@@ -604,7 +680,7 @@ - } - } - -- if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) -+ if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) - { - if (BlockRailBase.isRailBlock(this.world, blockpos.up())) - { -@@ -617,7 +693,7 @@ - } - } - -- if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) -+ if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) - { - if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) - { diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch deleted file mode 100644 index 6799d4271..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneComparator.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockRedstoneComparator.java -+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneComparator.java -@@ -295,6 +295,21 @@ - return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(POWERED, Boolean.valueOf(false)).withProperty(MODE, BlockRedstoneComparator.Mode.COMPARE); - } - -+ @Override -+ public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) -+ { -+ if (pos.getY() == neighbor.getY() && world instanceof World) -+ { -+ onNeighborBlockChange((World)world, pos, world.getBlockState(pos), world.getBlockState(neighbor).getBlock()); -+ } -+ } -+ -+ @Override -+ public boolean getWeakChanges(IBlockAccess world, BlockPos pos) -+ { -+ return true; -+ } -+ - public static enum Mode implements IStringSerializable - { - COMPARE("compare"), diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch deleted file mode 100644 index e98007889..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockRedstoneDiode.java -+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneDiode.java -@@ -200,6 +200,8 @@ - { - EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); - BlockPos blockpos1 = pos.offset(enumfacing.getOpposite()); -+ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldIn, pos, worldIn.getBlockState(pos), java.util.EnumSet.of(enumfacing.getOpposite())).isCanceled()) -+ return; - worldIn.notifyBlockOfStateChange(blockpos1, this); - worldIn.notifyNeighborsOfStateExcept(blockpos1, this, enumfacing); - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch deleted file mode 100644 index df5eb2d3f..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneOre.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockRedstoneOre.java -+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneOre.java -@@ -92,12 +92,16 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -+ } - -- if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this)) -+ @Override -+ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ if (this.getItemDropped(world.getBlockState(pos), RANDOM, fortune) != Item.getItemFromBlock(this)) - { -- int j = 1 + worldIn.rand.nextInt(5); -- this.dropXpOnBlockBreak(worldIn, pos, j); -+ return 1 + RANDOM.nextInt(5); - } -+ return 0; - } - - @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch deleted file mode 100644 index 520e8486e..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch +++ /dev/null @@ -1,59 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java -+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java -@@ -60,10 +60,10 @@ - BlockPos blockpos1 = pos.offset(direction); - Block block = worldIn.getBlockState(pos.offset(direction)).getBlock(); - -- if (!canConnectTo(worldIn.getBlockState(blockpos1), direction) && (block.isSolidFullCube() || !canConnectUpwardsTo(worldIn.getBlockState(blockpos1.down())))) -+ if (!canRestoneConnect(worldIn, blockpos1, direction) && (block.isSolidFullCube() || !canRestoneConnect(worldIn, blockpos1.down(), null))) - { - Block block1 = worldIn.getBlockState(pos.up()).getBlock(); -- return !block1.isSolidFullCube() && block.isSolidFullCube() && canConnectUpwardsTo(worldIn.getBlockState(blockpos1.up())) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; -+ return !block1.isSolidFullCube() && block.isSolidFullCube() && canRestoneConnect(worldIn, blockpos1.up(), null) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; - } - else - { -@@ -393,35 +393,25 @@ - Block block = iblockstate.getBlock(); - boolean flag = block.isNormalCube(); - boolean flag1 = worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); -- return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos1.up()) ? true : (canConnectTo(iblockstate, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos1.down()))); -+ return !flag1 && flag && canRestoneConnect(worldIn, blockpos1.up(), null) ? true : (canRestoneConnect(worldIn, blockpos1, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canRestoneConnect(worldIn, blockpos1.down(), null))); - } - -- protected static boolean canConnectUpwardsTo(IBlockAccess worldIn, BlockPos pos) -+ protected static boolean canRestoneConnect(IBlockAccess world, BlockPos pos, EnumFacing side) - { -- return canConnectUpwardsTo(worldIn.getBlockState(pos)); -- } -+ IBlockState state = world.getBlockState(pos); - -- protected static boolean canConnectUpwardsTo(IBlockState state) -- { -- return canConnectTo(state, (EnumFacing)null); -- } -- -- protected static boolean canConnectTo(IBlockState blockState, EnumFacing side) -- { -- Block block = blockState.getBlock(); -- -- if (block == Blocks.redstone_wire) -+ if (state.getBlock() == Blocks.redstone_wire) - { - return true; - } -- else if (Blocks.unpowered_repeater.isAssociated(block)) -+ else if (Blocks.unpowered_repeater.isAssociated(state.getBlock())) - { -- EnumFacing enumfacing1 = (EnumFacing)blockState.getValue(BlockRedstoneRepeater.FACING); -- return enumfacing1 == side || enumfacing1.getOpposite() == side; -+ EnumFacing direction = (EnumFacing)state.getValue(BlockRedstoneRepeater.FACING); -+ return direction == side || direction.getOpposite() == side; - } - else - { -- return block.canProvidePower() && side != null; -+ return state.getBlock().canConnectRedstone(world, pos, side); - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch deleted file mode 100644 index a117b9404..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockReed.java.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockReed.java -+++ ../src-work/minecraft/net/minecraft/block/BlockReed.java -@@ -19,7 +19,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class BlockReed extends Block -+public class BlockReed extends Block implements net.minecraftforge.common.IPlantable - { - public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15); - private static final String __OBFID = "CL_00000300"; -@@ -67,6 +67,7 @@ - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) - { - Block block = worldIn.getBlockState(pos.down()).getBlock(); -+ if (block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this)) return true; - - if (block == this) - { -@@ -172,4 +173,15 @@ - { - return new BlockState(this, new IProperty[] {AGE}); - } -+ -+ @Override -+ public net.minecraftforge.common.EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) -+ { -+ return net.minecraftforge.common.EnumPlantType.Beach; -+ } -+ @Override -+ public IBlockState getPlant(IBlockAccess world, BlockPos pos) -+ { -+ return this.getDefaultState(); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch deleted file mode 100644 index 2fdba40cd..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockRotatedPillar.java -+++ ../src-work/minecraft/net/minecraft/block/BlockRotatedPillar.java -@@ -2,6 +2,7 @@ - - import net.minecraft.block.material.Material; - import net.minecraft.block.properties.PropertyEnum; -+import net.minecraft.block.state.IBlockState; - import net.minecraft.util.EnumFacing; - - public abstract class BlockRotatedPillar extends Block -@@ -13,4 +14,18 @@ - { - super(materialIn); - } -+ -+ public boolean rotateBlock(net.minecraft.world.World world, net.minecraft.util.BlockPos pos, EnumFacing axis) -+ { -+ IBlockState state = world.getBlockState(pos); -+ for (net.minecraft.block.properties.IProperty prop : (java.util.Set)state.getProperties().keySet()) -+ { -+ if (prop.getName().equals("axis")) -+ { -+ world.setBlockState(pos, state.cycleProperty(prop)); -+ return true; -+ } -+ } -+ return false; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSapling.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSapling.java.patch deleted file mode 100644 index e061b2ac1..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockSapling.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockSapling.java -+++ ../src-work/minecraft/net/minecraft/block/BlockSapling.java -@@ -66,6 +66,7 @@ - - public void generateTree(World worldIn, BlockPos pos, IBlockState state, Random rand) - { -+ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(worldIn, rand, pos)) return; - Object object = rand.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true); - int i = 0; - int j = 0; diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch deleted file mode 100644 index 5841ef52d..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockSkull.java.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockSkull.java -+++ ../src-work/minecraft/net/minecraft/block/BlockSkull.java -@@ -122,8 +122,6 @@ - return tileentity instanceof TileEntitySkull ? ((TileEntitySkull)tileentity).getSkullType() : super.getDamageValue(worldIn, pos); - } - -- public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) {} -- - public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) - { - if (player.capabilities.isCreativeMode) -@@ -131,13 +129,18 @@ - state = state.withProperty(NODROP, Boolean.valueOf(true)); - worldIn.setBlockState(pos, state, 4); - } -+ this.dropBlockAsItem(worldIn, pos, state, 0); - - super.onBlockHarvested(worldIn, pos, state, player); - } - - public void breakBlock(World worldIn, BlockPos pos, IBlockState state) - { -- if (!worldIn.isRemote) -+ super.breakBlock(worldIn, pos, state); -+ } -+ public java.util.List getDrops(IBlockAccess worldIn, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = new java.util.ArrayList(); - { - if (!((Boolean)state.getValue(NODROP)).booleanValue()) - { -@@ -146,7 +149,7 @@ - if (tileentity instanceof TileEntitySkull) - { - TileEntitySkull tileentityskull = (TileEntitySkull)tileentity; -- ItemStack itemstack = new ItemStack(Items.skull, 1, this.getDamageValue(worldIn, pos)); -+ ItemStack itemstack = new ItemStack(Items.skull, 1, tileentityskull.getSkullType()); - - if (tileentityskull.getSkullType() == 3 && tileentityskull.getPlayerProfile() != null) - { -@@ -156,12 +159,11 @@ - itemstack.getTagCompound().setTag("SkullOwner", nbttagcompound); - } - -- spawnAsEntity(worldIn, pos, itemstack); -+ ret.add(itemstack); - } - } -- -- super.breakBlock(worldIn, pos, state); - } -+ return ret; - } - - public Item getItemDropped(IBlockState state, Random rand, int fortune) diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch deleted file mode 100644 index 1ca183c63..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockSnow.java.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockSnow.java -+++ ../src-work/minecraft/net/minecraft/block/BlockSnow.java -@@ -80,7 +80,7 @@ - { - IBlockState iblockstate = worldIn.getBlockState(pos.down()); - Block block = iblockstate.getBlock(); -- return block != Blocks.ice && block != Blocks.packed_ice ? (block.getMaterial() == Material.leaves ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() == 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; -+ return block != Blocks.ice && block != Blocks.packed_ice ? (block.isLeaves(worldIn, pos.down()) ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() == 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; - } - - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) -@@ -92,7 +92,6 @@ - { - if (!this.canPlaceBlockAt(worldIn, p_176314_2_)) - { -- this.dropBlockAsItem(worldIn, p_176314_2_, p_176314_3_, 0); - worldIn.setBlockToAir(p_176314_2_); - return false; - } -@@ -104,9 +103,8 @@ - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) - { -- spawnAsEntity(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1, 0)); -+ super.harvestBlock(worldIn, player, pos, state, te); - worldIn.setBlockToAir(pos); -- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); - } - - public Item getItemDropped(IBlockState state, Random rand, int fortune) -@@ -116,14 +114,13 @@ - - public int quantityDropped(Random random) - { -- return 0; -+ return 1; - } - - public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) - { - if (worldIn.getLightFor(EnumSkyBlock.BLOCK, pos) > 11) - { -- this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0); - worldIn.setBlockToAir(pos); - } - } -@@ -153,4 +150,6 @@ - { - return new BlockState(this, new IProperty[] {LAYERS}); - } -+ -+ @Override public int quantityDropped(IBlockState state, int fortune, Random random){ return ((Integer)state.getValue(LAYERS)) + 1; } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch deleted file mode 100644 index f00f753b8..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockStem.java.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockStem.java -+++ ../src-work/minecraft/net/minecraft/block/BlockStem.java -@@ -108,7 +108,7 @@ - pos = pos.offset(EnumFacing.Plane.HORIZONTAL.random(rand)); - Block block = worldIn.getBlockState(pos.down()).getBlock(); - -- if (worldIn.getBlockState(pos).getBlock().blockMaterial == Material.air && (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass)) -+ if (worldIn.isAirBlock(pos) && (block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this) || block == Blocks.dirt || block == Blocks.grass)) - { - worldIn.setBlockState(pos, this.crop.getDefaultState()); - } -@@ -162,8 +162,12 @@ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) - { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); -+ } - -- if (!worldIn.isRemote) -+ @Override -+ public java.util.List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ java.util.List ret = new java.util.ArrayList(); - { - Item item = this.getSeedItem(); - -@@ -173,13 +177,14 @@ - - for (int k = 0; k < 3; ++k) - { -- if (worldIn.rand.nextInt(15) <= j) -+ if (RANDOM.nextInt(15) <= j) - { -- spawnAsEntity(worldIn, pos, new ItemStack(item)); -+ ret.add(new ItemStack(item)); - } - } - } - } -+ return ret; - } - - protected Item getSeedItem() diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch deleted file mode 100644 index cba499e8f..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockTallGrass.java.patch +++ /dev/null @@ -1,66 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockTallGrass.java -+++ ../src-work/minecraft/net/minecraft/block/BlockTallGrass.java -@@ -23,7 +23,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class BlockTallGrass extends BlockBush implements IGrowable -+public class BlockTallGrass extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable - { - public static final PropertyEnum TYPE = PropertyEnum.create("type", BlockTallGrass.EnumType.class); - private static final String __OBFID = "CL_00000321"; -@@ -44,7 +44,7 @@ - - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) - { -- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); -+ return super.canBlockStay(worldIn, pos, state); - } - - public boolean isReplaceable(World worldIn, BlockPos pos) -@@ -74,7 +74,7 @@ - - public Item getItemDropped(IBlockState state, Random rand, int fortune) - { -- return rand.nextInt(8) == 0 ? Items.wheat_seeds : null; -+ return null; - } - - public int quantityDroppedWithBonus(int fortune, Random random) -@@ -84,13 +84,7 @@ - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) - { -- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) - { -- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)state.getValue(TYPE)).getMeta())); -- } -- else -- { - super.harvestBlock(worldIn, player, pos, state, te); - } - } -@@ -210,4 +204,22 @@ - } - } - } -+ -+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } -+ @Override -+ public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) -+ { -+ List ret = new java.util.ArrayList(); -+ ret.add(new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)world.getBlockState(pos).getValue(TYPE)).getMeta())); -+ return ret; -+ } -+ @Override -+ public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) -+ { -+ List ret = new java.util.ArrayList(); -+ if (RANDOM.nextInt(8) != 0) return ret; -+ ItemStack seed = net.minecraftforge.common.ForgeHooks.getGrassSeed(RANDOM); -+ if (seed != null) ret.add(seed); -+ return ret; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch deleted file mode 100644 index 059911a36..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockTorch.java.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockTorch.java -+++ ../src-work/minecraft/net/minecraft/block/BlockTorch.java -@@ -70,7 +70,7 @@ - else - { - Block block = worldIn.getBlockState(pos).getBlock(); -- return block instanceof BlockFence || block == Blocks.glass || block == Blocks.cobblestone_wall || block == Blocks.stained_glass; -+ return block.canPlaceTorchOnTop(worldIn, pos); - } - } - -@@ -97,7 +97,7 @@ - { - BlockPos blockpos1 = pos.offset(facing.getOpposite()); - boolean flag = facing.getAxis().isHorizontal(); -- return flag && worldIn.isBlockNormalCube(blockpos1, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos1); -+ return flag && worldIn.isSideSolid(blockpos1, facing, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos1); - } - - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) -@@ -120,7 +120,7 @@ - - enumfacing1 = (EnumFacing)iterator.next(); - } -- while (!worldIn.isBlockNormalCube(pos.offset(enumfacing1.getOpposite()), true)); -+ while (!worldIn.isSideSolid(pos.offset(enumfacing1.getOpposite()), enumfacing1, true)); - - return this.getDefaultState().withProperty(FACING, enumfacing1); - } -@@ -149,7 +149,7 @@ - EnumFacing enumfacing1 = enumfacing.getOpposite(); - boolean flag = false; - -- if (axis.isHorizontal() && !worldIn.isBlockNormalCube(pos.offset(enumfacing1), true)) -+ if (axis.isHorizontal() && !worldIn.isSideSolid(pos.offset(enumfacing1), enumfacing1, true)) - { - flag = true; - } diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch deleted file mode 100644 index d73a8a1e7..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockTrapDoor.java.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockTrapDoor.java -+++ ../src-work/minecraft/net/minecraft/block/BlockTrapDoor.java -@@ -25,6 +25,8 @@ - - public class BlockTrapDoor extends Block - { -+ /** Set this to allow trapdoors to remain free-floating */ -+ public static boolean disableValidation = false; - public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); - public static final PropertyBool OPEN = PropertyBool.create("open"); - public static final PropertyEnum HALF = PropertyEnum.create("half", BlockTrapDoor.DoorHalf.class); -@@ -141,9 +143,10 @@ - { - if (!worldIn.isRemote) - { -+ EnumFacing direction = (EnumFacing)state.getValue(FACING); - BlockPos blockpos1 = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite()); - -- if (!isValidSupportBlock(worldIn.getBlockState(blockpos1).getBlock())) -+ if (!(isValidSupportBlock(worldIn.getBlockState(blockpos1).getBlock()) || worldIn.isSideSolid(blockpos1, direction, true))) - { - worldIn.setBlockToAir(pos); - this.dropBlockAsItem(worldIn, pos, state, 0); -@@ -187,7 +190,10 @@ - - public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) - { -- return !side.getAxis().isVertical() && isValidSupportBlock(worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock()); -+ if (disableValidation) return true; -+ EnumFacing dir = side.getOpposite(); -+ pos = pos.offset(dir); -+ return !side.getAxis().isVertical() && (isValidSupportBlock(worldIn.getBlockState(pos).getBlock()) || worldIn.isSideSolid(pos, side, true)); - } - - protected static EnumFacing getFacing(int meta) -@@ -224,6 +230,7 @@ - - private static boolean isValidSupportBlock(Block blockIn) - { -+ if (disableValidation) return true; - return blockIn.blockMaterial.isOpaque() && blockIn.isFullCube() || blockIn == Blocks.glowstone || blockIn instanceof BlockSlab || blockIn instanceof BlockStairs; - } - diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch deleted file mode 100644 index e5f0df6c5..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockTripWireHook.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockTripWireHook.java -+++ ../src-work/minecraft/net/minecraft/block/BlockTripWireHook.java -@@ -60,7 +60,7 @@ - - public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) - { -- return side.getAxis().isHorizontal() && worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock().isNormalCube(); -+ return side.getAxis().isHorizontal() && worldIn.isSideSolid(pos.offset(side.getOpposite()), side, true); - } - - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) -@@ -77,7 +77,7 @@ - - enumfacing = (EnumFacing)iterator.next(); - } -- while (!worldIn.getBlockState(pos.offset(enumfacing)).getBlock().isNormalCube()); -+ while (!worldIn.isSideSolid(pos.offset(enumfacing), enumfacing.getOpposite(), true)); - - return true; - } -@@ -107,7 +107,7 @@ - { - EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); - -- if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).getBlock().isNormalCube()) -+ if (!worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) - { - this.dropBlockAsItem(worldIn, pos, state, 0); - worldIn.setBlockToAir(pos); diff --git a/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch b/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch deleted file mode 100644 index 911d961f2..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/BlockVine.java.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/BlockVine.java -+++ ../src-work/minecraft/net/minecraft/block/BlockVine.java -@@ -26,7 +26,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class BlockVine extends Block -+public class BlockVine extends Block implements net.minecraftforge.common.IShearable - { - public static final PropertyBool UP = PropertyBool.create("up"); - public static final PropertyBool NORTH = PropertyBool.create("north"); -@@ -416,13 +416,7 @@ - - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) - { -- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) - { -- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); -- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.vine, 1, 0)); -- } -- else -- { - super.harvestBlock(worldIn, player, pos, state, te); - } - } -@@ -508,6 +502,16 @@ - return i; - } - -+ /*************************FORGE START***********************************/ -+ @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity){ return true; } -+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } -+ @Override -+ public java.util.List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) -+ { -+ return java.util.Arrays.asList(new ItemStack(this, 1)); -+ } -+ /*************************FORGE END***********************************/ -+ - static final class SwitchEnumFacing - { - static final int[] FACING_LOOKUP = new int[EnumFacing.values().length]; diff --git a/patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch deleted file mode 100644 index 3a0c759c1..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java -+++ ../src-work/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java -@@ -80,7 +80,7 @@ - { - Block block = this.world.getBlockState(origin).getBlock(); - -- if (block.getMaterial() == Material.air) -+ if (block.isAir(world, origin)) - { - return true; - } -@@ -111,7 +111,7 @@ - BlockPos blockpos1 = origin.offset(this.moveDirection.getOpposite(), i); - block = this.world.getBlockState(blockpos1).getBlock(); - -- if (block.getMaterial() == Material.air || !BlockPistonBase.canPush(block, this.world, blockpos1, this.moveDirection, false) || blockpos1.equals(this.pistonPos)) -+ if (block.isAir(world, blockpos1)|| !BlockPistonBase.canPush(block, this.world, blockpos1, this.moveDirection, false) || blockpos1.equals(this.pistonPos)) - { - break; - } -@@ -159,7 +159,7 @@ - - block = this.world.getBlockState(blockpos2).getBlock(); - -- if (block.getMaterial() == Material.air) -+ if (block.isAir(world, blockpos2)) - { - return true; - } diff --git a/patches.mcp/minecraft/net/minecraft/block/state/BlockState.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/BlockState.java.patch deleted file mode 100644 index 18159f17b..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/state/BlockState.java.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/state/BlockState.java -+++ ../src-work/minecraft/net/minecraft/block/state/BlockState.java -@@ -47,6 +47,16 @@ - - public BlockState(Block blockIn, IProperty ... properties) - { -+ this(blockIn, properties, null); -+ } -+ -+ protected StateImplementation createState(Block block, ImmutableMap properties, ImmutableMap unlistedProperties) -+ { -+ return new StateImplementation(block, properties); -+ } -+ -+ protected BlockState(Block blockIn, IProperty[] properties, ImmutableMap unlistedProperties) -+ { - this.block = blockIn; - Arrays.sort(properties, new Comparator() - { -@@ -70,7 +80,7 @@ - { - List list = (List)iterator.next(); - Map map = MapPopulator.createMap(this.properties, list); -- BlockState.StateImplementation stateimplementation = new BlockState.StateImplementation(blockIn, ImmutableMap.copyOf(map), null); -+ BlockState.StateImplementation stateimplementation = createState(blockIn, ImmutableMap.copyOf(map), unlistedProperties); - linkedhashmap.put(map, stateimplementation); - arraylist.add(stateimplementation); - } -@@ -135,6 +145,13 @@ - this.block = blockIn; - this.properties = propertiesIn; - } -+ -+ protected StateImplementation(Block blockIn, ImmutableMap propertiesIn, ImmutableTable propertyValueTable) -+ { -+ this.block = blockIn; -+ this.properties = propertiesIn; -+ this.propertyValueTable = propertyValueTable; -+ } - - public Collection getPropertyNames() - { -@@ -231,5 +248,10 @@ - { - this(p_i45661_1_, p_i45661_2_); - } -+ -+ public ImmutableTable getPropertyValueTable() -+ { -+ return propertyValueTable; -+ } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch b/patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch deleted file mode 100644 index 9587997da..000000000 --- a/patches.mcp/minecraft/net/minecraft/block/state/BlockStateBase.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/block/state/BlockStateBase.java -+++ ../src-work/minecraft/net/minecraft/block/state/BlockStateBase.java -@@ -76,4 +76,9 @@ - - return stringbuilder.toString(); - } -+ -+ public com.google.common.collect.ImmutableTable getPropertyValueTable() -+ { -+ return null; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch b/patches.mcp/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch deleted file mode 100644 index d046aa4a5..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/ClientBrandRetriever.java -+++ ../src-work/minecraft/net/minecraft/client/ClientBrandRetriever.java -@@ -10,6 +10,6 @@ - - public static String getClientModName() - { -- return "vanilla"; -+ return net.minecraftforge.fml.common.FMLCommonHandler.instance().getModName(); - } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch deleted file mode 100644 index 5a04f69b6..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/LoadingScreenRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/LoadingScreenRenderer.java -@@ -139,6 +139,10 @@ - GlStateManager.clear(16640); - } - -+ try -+ { -+ if (!net.minecraftforge.fml.client.FMLClientHandler.instance().handleLoadingScreen(scaledresolution)) //FML Don't render while FML's pre-screen is rendering -+ { - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - this.mc.getTextureManager().bindTexture(Gui.optionsBackground); -@@ -177,6 +181,12 @@ - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - this.mc.fontRendererObj.drawStringWithShadow(this.currentlyDisplayedText, (float)((l - this.mc.fontRendererObj.getStringWidth(this.currentlyDisplayedText)) / 2), (float)(i1 / 2 - 4 - 16), 16777215); - this.mc.fontRendererObj.drawStringWithShadow(this.message, (float)((l - this.mc.fontRendererObj.getStringWidth(this.message)) / 2), (float)(i1 / 2 - 4 + 8), 16777215); -+ } -+ } -+ catch (java.io.IOException e) -+ { -+ com.google.common.base.Throwables.propagate(e); -+ } //FML End - this.framebuffer.unbindFramebuffer(); - - if (OpenGlHelper.isFramebufferEnabled()) diff --git a/patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch b/patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch deleted file mode 100644 index 883fbf527..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/Minecraft.java.patch +++ /dev/null @@ -1,476 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/Minecraft.java -+++ ../src-work/minecraft/net/minecraft/client/Minecraft.java -@@ -296,7 +296,6 @@ - this.sessionService = (new YggdrasilAuthenticationService(gameConfig.userInfo.proxy, UUID.randomUUID().toString())).createMinecraftSessionService(); - this.session = gameConfig.userInfo.session; - logger.info("Setting user: " + this.session.getUsername()); -- logger.info("(Session ID is " + this.session.getSessionID() + ")"); - this.isDemo = gameConfig.gameInfo.isDemo; - this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1; - this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1; -@@ -410,10 +409,10 @@ - this.mcResourceManager = new SimpleReloadableResourceManager(this.metadataSerializer_); - this.mcLanguageManager = new LanguageManager(this.metadataSerializer_, this.gameSettings.language); - this.mcResourceManager.registerReloadListener(this.mcLanguageManager); -- this.refreshResources(); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().beginMinecraftLoading(this, this.defaultResourcePacks, this.mcResourceManager); - this.renderEngine = new TextureManager(this.mcResourceManager); - this.mcResourceManager.registerReloadListener(this.renderEngine); -- this.drawSplashScreen(this.renderEngine); -+ net.minecraftforge.fml.client.SplashProgress.drawVanillaScreen(this.renderEngine); - this.initStream(); - this.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService); - this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves")); -@@ -449,6 +448,8 @@ - } - }); - this.mouseHelper = new MouseHelper(); -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar= net.minecraftforge.fml.common.ProgressManager.push("Rendering Setup", 5, true); -+ bar.step("GL Setup"); - this.checkGLError("Pre startup"); - GlStateManager.enableTexture2D(); - GlStateManager.shadeModel(7425); -@@ -462,17 +463,21 @@ - GlStateManager.loadIdentity(); - GlStateManager.matrixMode(5888); - this.checkGLError("Startup"); -- this.textureMapBlocks = new TextureMap("textures"); -+ bar.step("Loading Texture Map"); -+ this.textureMapBlocks = new TextureMap("textures",true); - this.textureMapBlocks.setMipmapLevels(this.gameSettings.mipmapLevels); - this.renderEngine.loadTickableTexture(TextureMap.locationBlocksTexture, this.textureMapBlocks); - this.renderEngine.bindTexture(TextureMap.locationBlocksTexture); - this.textureMapBlocks.setBlurMipmapDirect(false, this.gameSettings.mipmapLevels > 0); -+ bar.step("Loading Model Manager"); - this.modelManager = new ModelManager(this.textureMapBlocks); - this.mcResourceManager.registerReloadListener(this.modelManager); -+ bar.step("Loading Item Renderer"); - this.renderItem = new RenderItem(this.renderEngine, this.modelManager); - this.renderManager = new RenderManager(this.renderEngine, this.renderItem); - this.itemRenderer = new ItemRenderer(this); - this.mcResourceManager.registerReloadListener(this.renderItem); -+ bar.step("Loading Entity Renderer"); - this.entityRenderer = new EntityRenderer(this, this.mcResourceManager); - this.mcResourceManager.registerReloadListener(this.entityRenderer); - this.blockRenderDispatcher = new BlockRendererDispatcher(this.modelManager.getBlockModelShapes(), this.gameSettings); -@@ -482,22 +487,25 @@ - this.guiAchievement = new GuiAchievement(this); - GlStateManager.viewport(0, 0, this.displayWidth, this.displayHeight); - this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine); -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().finishMinecraftLoading(); - this.checkGLError("Post startup"); -- this.ingameGUI = new GuiIngame(this); -+ this.ingameGUI = new net.minecraftforge.client.GuiIngameForge(this); - - if (this.serverName != null) - { -- this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort)); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServerAtStartup(this.serverName, this.serverPort); - } - else - { - this.displayGuiScreen(new GuiMainMenu()); - } - -- this.renderEngine.deleteTexture(this.mojangLogo); -+ net.minecraftforge.fml.client.SplashProgress.clearVanillaResources(renderEngine, mojangLogo); - this.mojangLogo = null; - this.loadingScreen = new LoadingScreenRenderer(this); - -+ net.minecraftforge.fml.client.FMLClientHandler.instance().onInitializationComplete(); - if (this.gameSettings.fullScreen && !this.fullscreen) - { - this.toggleFullscreen(); -@@ -681,21 +689,23 @@ - File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt"); - Bootstrap.printToSYSOUT(crashReportIn.getCompleteReport()); - -+ int retVal; - if (crashReportIn.getFile() != null) - { - Bootstrap.printToSYSOUT("#@!@# Game crashed! Crash report saved to: #@!@# " + crashReportIn.getFile()); -- System.exit(-1); -+ retVal = -1; - } - else if (crashReportIn.saveToFile(file2)) - { - Bootstrap.printToSYSOUT("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath()); -- System.exit(-1); -+ retVal = -1; - } - else - { - Bootstrap.printToSYSOUT("#@?@# Game crashed! Crash report could not be saved. #@?@#"); -- System.exit(-2); -+ retVal = -2; - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleExit(retVal); - } - - public boolean isUnicode() -@@ -887,11 +897,6 @@ - - public void displayGuiScreen(GuiScreen guiScreenIn) - { -- if (this.currentScreen != null) -- { -- this.currentScreen.onGuiClosed(); -- } -- - if (guiScreenIn == null && this.theWorld == null) - { - guiScreenIn = new GuiMainMenu(); -@@ -901,6 +906,17 @@ - guiScreenIn = new GuiGameOver(); - } - -+ GuiScreen old = this.currentScreen; -+ net.minecraftforge.client.event.GuiOpenEvent event = new net.minecraftforge.client.event.GuiOpenEvent(guiScreenIn); -+ -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; -+ -+ guiScreenIn = event.gui; -+ if (old != null && guiScreenIn != old) -+ { -+ old.onGuiClosed(); -+ } -+ - if (guiScreenIn instanceof GuiMainMenu) - { - this.gameSettings.showDebugInfo = false; -@@ -999,7 +1015,7 @@ - { - while (!this.scheduledTasks.isEmpty()) - { -- ((FutureTask)this.scheduledTasks.poll()).run(); -+ net.minecraftforge.fml.common.FMLCommonHandler.callFuture(((FutureTask)this.scheduledTasks.poll())); - } - } - -@@ -1034,9 +1050,11 @@ - - if (!this.skipRenderWorld) - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickStart(this.timer.renderPartialTicks); - this.mcProfiler.endStartSection("gameRenderer"); - this.entityRenderer.updateCameraAndRender(this.timer.renderPartialTicks); - this.mcProfiler.endSection(); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickEnd(this.timer.renderPartialTicks); - } - - this.mcProfiler.endSection(); -@@ -1382,7 +1400,7 @@ - - if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air && this.playerController.func_180512_c(blockpos, this.objectMouseOver.sideHit)) - { -- this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver.sideHit); -+ this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver); - this.thePlayer.swingItem(); - } - } -@@ -1462,15 +1480,19 @@ - case 2: - BlockPos blockpos = this.objectMouseOver.getBlockPos(); - -- if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air) -+ if (!this.theWorld.isAirBlock(blockpos)) - { - int i = itemstack != null ? itemstack.stackSize : 0; - -+ -+ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, this.theWorld, blockpos, this.objectMouseOver.sideHit).isCanceled(); -+ if (result) { //Forge: Kept separate to simplify patch - if (this.playerController.func_178890_a(this.thePlayer, this.theWorld, itemstack, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec)) - { - flag = false; - this.thePlayer.swingItem(); - } -+ } - - if (itemstack == null) - { -@@ -1493,7 +1515,8 @@ - { - ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem(); - -- if (itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) -+ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, theWorld, null, null).isCanceled(); -+ if (result && itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) - { - this.entityRenderer.itemRenderer.resetEquippedProgress2(); - } -@@ -1591,6 +1614,8 @@ - --this.rightClickDelayTimer; - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreClientTick(); -+ - this.mcProfiler.startSection("gui"); - - if (!this.isGamePaused) -@@ -1689,6 +1714,8 @@ - - while (Mouse.next()) - { -+ if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue; -+ - i = Mouse.getEventButton(); - KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState()); - -@@ -1744,6 +1771,7 @@ - this.currentScreen.handleMouseInput(); - } - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireMouseInput(); - } - - if (this.leftClickCounter > 0) -@@ -1920,6 +1948,7 @@ - } - } - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireKeyInput(); - } - - for (i = 0; i < 9; ++i) -@@ -2120,12 +2149,15 @@ - this.myNetworkManager.processReceivedPackets(); - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostClientTick(); -+ - this.mcProfiler.endSection(); - this.systemTime = getSystemTime(); - } - - public void launchIntegratedServer(String folderName, String worldName, WorldSettings worldSettingsIn) - { -+ net.minecraftforge.fml.client.FMLClientHandler.instance().startIntegratedServer(folderName, worldName, worldSettingsIn); - this.loadWorld((WorldClient)null); - System.gc(); - ISaveHandler isavehandler = this.saveLoader.getSaveLoader(folderName, false); -@@ -2161,6 +2193,12 @@ - - while (!this.theIntegratedServer.serverIsInRunLoop()) - { -+ if (!net.minecraftforge.fml.common.StartupQuery.check()) -+ { -+ loadWorld(null); -+ displayGuiScreen(null); -+ return; -+ } - String s2 = this.theIntegratedServer.getUserMessage(); - - if (s2 != null) -@@ -2186,8 +2224,14 @@ - SocketAddress socketaddress = this.theIntegratedServer.getNetworkSystem().addLocalEndpoint(); - NetworkManager networkmanager = NetworkManager.provideLocalClient(socketaddress); - networkmanager.setNetHandler(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null)); -- networkmanager.sendPacket(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN)); -- networkmanager.sendPacket(new C00PacketLoginStart(this.getSession().getProfile())); -+ networkmanager.sendPacket(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN, true)); -+ com.mojang.authlib.GameProfile gameProfile = this.getSession().getProfile(); -+ if (!this.getSession().hasCachedProperties()) -+ { -+ gameProfile = sessionService.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974. -+ this.getSession().setProperties(gameProfile.getProperties()); -+ } -+ networkmanager.sendPacket(new C00PacketLoginStart(gameProfile)); - this.myNetworkManager = networkmanager; - } - -@@ -2198,6 +2242,8 @@ - - public void loadWorld(WorldClient worldClientIn, String loadingMessage) - { -+ if (theWorld != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(theWorld)); -+ - if (worldClientIn == null) - { - NetHandlerPlayClient nethandlerplayclient = this.getNetHandler(); -@@ -2211,6 +2257,18 @@ - { - this.theIntegratedServer.initiateShutdown(); - this.theIntegratedServer.setStaticInstance(); -+ if (loadingScreen != null) -+ { -+ this.loadingScreen.displayLoadingString(I18n.format("forge.client.shutdown.internal")); -+ } -+ while (!theIntegratedServer.isServerStopped()) -+ { -+ try -+ { -+ Thread.sleep(10); -+ } -+ catch (InterruptedException ie) {} -+ } - } - - this.theIntegratedServer = null; -@@ -2237,6 +2295,7 @@ - - this.setServerData((ServerData)null); - this.integratedServerIsRunning = false; -+ net.minecraftforge.fml.client.FMLClientHandler.instance().handleClientWorldClosing(this.theWorld); - } - - this.mcSoundHandler.stopSounds(); -@@ -2341,134 +2400,11 @@ - if (this.objectMouseOver != null) - { - boolean flag = this.thePlayer.capabilities.isCreativeMode; -- int i = 0; -- boolean flag1 = false; -- TileEntity tileentity = null; -- Object object; - -- if (this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) -- { -- BlockPos blockpos = this.objectMouseOver.getBlockPos(); -- Block block = this.theWorld.getBlockState(blockpos).getBlock(); -- -- if (block.getMaterial() == Material.air) -- { -- return; -- } -- -- object = block.getItem(this.theWorld, blockpos); -- -- if (object == null) -- { -- return; -- } -- -- if (flag && GuiScreen.isCtrlKeyDown()) -- { -- tileentity = this.theWorld.getTileEntity(blockpos); -- } -- -- Block block1 = object instanceof ItemBlock && !block.isFlowerPot() ? Block.getBlockFromItem((Item)object) : block; -- i = block1.getDamageValue(this.theWorld, blockpos); -- flag1 = ((Item)object).getHasSubtypes(); -- } -- else -- { -- if (this.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !flag) -- { -- return; -- } -- -- if (this.objectMouseOver.entityHit instanceof EntityPainting) -- { -- object = Items.painting; -- } -- else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot) -- { -- object = Items.lead; -- } -- else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) -- { -- EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit; -- ItemStack itemstack = entityitemframe.getDisplayedItem(); -- -- if (itemstack == null) -- { -- object = Items.item_frame; -- } -- else -- { -- object = itemstack.getItem(); -- i = itemstack.getMetadata(); -- flag1 = true; -- } -- } -- else if (this.objectMouseOver.entityHit instanceof EntityMinecart) -- { -- EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit; -- -- switch (Minecraft.SwitchEnumMinecartType.field_178901_b[entityminecart.getMinecartType().ordinal()]) -- { -- case 1: -- object = Items.furnace_minecart; -- break; -- case 2: -- object = Items.chest_minecart; -- break; -- case 3: -- object = Items.tnt_minecart; -- break; -- case 4: -- object = Items.hopper_minecart; -- break; -- case 5: -- object = Items.command_block_minecart; -- break; -- default: -- object = Items.minecart; -- } -- } -- else if (this.objectMouseOver.entityHit instanceof EntityBoat) -- { -- object = Items.boat; -- } -- else if (this.objectMouseOver.entityHit instanceof EntityArmorStand) -- { -- object = Items.armor_stand; -- } -- else -- { -- object = Items.spawn_egg; -- i = EntityList.getEntityID(this.objectMouseOver.entityHit); -- flag1 = true; -- -- if (!EntityList.entityEggs.containsKey(Integer.valueOf(i))) -- { -- return; -- } -- } -- } -- - InventoryPlayer inventoryplayer = this.thePlayer.inventory; - -- if (tileentity == null) -- { -- inventoryplayer.setCurrentItem((Item)object, i, flag1, flag); -- } -- else -- { -- NBTTagCompound nbttagcompound1 = new NBTTagCompound(); -- tileentity.writeToNBT(nbttagcompound1); -- ItemStack itemstack1 = new ItemStack((Item)object, 1, i); -- itemstack1.setTagInfo("BlockEntityTag", nbttagcompound1); -- NBTTagCompound nbttagcompound = new NBTTagCompound(); -- NBTTagList nbttaglist = new NBTTagList(); -- nbttaglist.appendTag(new NBTTagString("(+NBT)")); -- nbttagcompound.setTag("Lore", nbttaglist); -- itemstack1.setTagInfo("display", nbttagcompound); -- inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, itemstack1); -- } -- -+ if (!net.minecraftforge.common.ForgeHooks.onPickBlock(this.objectMouseOver, this.thePlayer, this.theWorld)) return; -+ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions - if (flag) - { - int j = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + inventoryplayer.currentItem; -@@ -2726,18 +2662,8 @@ - - public static int getGLMaximumTextureSize() - { -- for (int i = 16384; i > 0; i >>= 1) -- { -- GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null); -- int j = GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); -- -- if (j != 0) -- { -- return i; -- } -- } -- -- return -1; -+ //Forge we redirect this to our code which caches the value before any splash screen stuff is done. -+ return net.minecraftforge.fml.client.SplashProgress.getMaxTextureSize(); - } - - public boolean isSnooperEnabled() diff --git a/patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch deleted file mode 100644 index e58577e04..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/audio/SoundManager.java.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/audio/SoundManager.java -+++ ../src-work/minecraft/net/minecraft/client/audio/SoundManager.java -@@ -36,6 +36,10 @@ - import paulscode.sound.codecs.CodecJOrbis; - import paulscode.sound.libraries.LibraryLWJGLOpenAL; - -+import net.minecraftforge.client.ForgeHooksClient; -+import net.minecraftforge.client.event.sound.*; -+import net.minecraftforge.common.MinecraftForge; -+ - @SideOnly(Side.CLIENT) - public class SoundManager - { -@@ -70,6 +74,7 @@ - { - SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class); - SoundSystemConfig.setCodec("ogg", CodecJOrbis.class); -+ MinecraftForge.EVENT_BUS.post(new SoundSetupEvent(this)); - } - catch (SoundSystemException soundsystemexception) - { -@@ -81,6 +86,7 @@ - { - this.unloadSoundSystem(); - this.loadSoundSystem(); -+ MinecraftForge.EVENT_BUS.post(new SoundLoadEvent(this)); - } - - private synchronized void loadSoundSystem() -@@ -329,6 +335,9 @@ - } - else - { -+ sound = ForgeHooksClient.playSound(this, sound); -+ if (sound == null) return; -+ - SoundEventAccessorComposite soundeventaccessorcomposite = this.sndHandler.getSound(sound.getSoundLocation()); - - if (soundeventaccessorcomposite == null) -@@ -370,10 +379,12 @@ - if (soundpoolentry.isStreamingSound()) - { - this.sndSystem.newStreamingSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1); -+ MinecraftForge.EVENT_BUS.post(new PlayStreamingSourceEvent(this, sound, s)); - } - else - { - this.sndSystem.newSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1); -+ MinecraftForge.EVENT_BUS.post(new PlaySoundSourceEvent(this, sound, s)); - } - - logger.debug(LOG_MARKER, "Playing sound {} for event {} as channel {}", new Object[] {soundpoolentry.getSoundPoolEntryLocation(), soundeventaccessorcomposite.getSoundEventLocation(), s}); diff --git a/patches.mcp/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch deleted file mode 100644 index fe5943864..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java -+++ ../src-work/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java -@@ -129,6 +129,6 @@ - f *= 1.0F - f1 * 0.15F; - } - -- return f; -+ return net.minecraftforge.client.ForgeHooksClient.getOffsetFOV(this, f); - } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch b/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch deleted file mode 100644 index 8b3b22b9e..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch +++ /dev/null @@ -1,80 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/entity/EntityPlayerSP.java -+++ ../src-work/minecraft/net/minecraft/client/entity/EntityPlayerSP.java -@@ -53,6 +53,9 @@ - import net.minecraft.world.World; - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; -+import net.minecraftforge.client.ForgeHooksClient; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.PlaySoundAtEntityEvent; - - @SideOnly(Side.CLIENT) - public class EntityPlayerSP extends AbstractClientPlayer -@@ -342,6 +345,15 @@ - this.mc.ingameGUI.getChatGUI().printChatMessage(chatComponent); - } - -+ private boolean isHeadspaceFree(BlockPos pos, int height) -+ { -+ for (int y = 0; y < height; y++) -+ { -+ if (isOpenBlockSpace(pos.add(0, y, 0))) return false; -+ } -+ return true; -+ } -+ - protected boolean pushOutOfBlocks(double x, double y, double z) - { - if (this.noClip) -@@ -354,30 +366,34 @@ - double d3 = x - (double)blockpos.getX(); - double d4 = z - (double)blockpos.getZ(); - -- if (!this.isOpenBlockSpace(blockpos)) -+ int entHeight = Math.max(Math.round(this.height), 1); -+ -+ boolean inTranslucentBlock = this.isHeadspaceFree(blockpos, entHeight); -+ -+ if (inTranslucentBlock) - { - byte b0 = -1; - double d5 = 9999.0D; - -- if (this.isOpenBlockSpace(blockpos.west()) && d3 < d5) -+ if (!this.isHeadspaceFree(blockpos.west(), entHeight) && d3 < d5) - { - d5 = d3; - b0 = 0; - } - -- if (this.isOpenBlockSpace(blockpos.east()) && 1.0D - d3 < d5) -+ if (!this.isHeadspaceFree(blockpos.east(), entHeight) && 1.0D - d3 < d5) - { - d5 = 1.0D - d3; - b0 = 1; - } - -- if (this.isOpenBlockSpace(blockpos.north()) && d4 < d5) -+ if (!this.isHeadspaceFree(blockpos.north(), entHeight) && d4 < d5) - { - d5 = d4; - b0 = 4; - } - -- if (this.isOpenBlockSpace(blockpos.south()) && 1.0D - d4 < d5) -+ if (!this.isHeadspaceFree(blockpos.south(), entHeight) && 1.0D - d4 < d5) - { - d5 = 1.0D - d4; - b0 = 5; -@@ -445,6 +461,11 @@ - - public void playSound(String name, float volume, float pitch) - { -+ PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, name, volume, pitch); -+ if (event.isCanceled() || event.name == null) return; -+ name = event.name; -+ volume = event.newVolume; -+ pitch = event.newPitch; - this.worldObj.playSound(this.posX, this.posY, this.posZ, name, volume, pitch, false); - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch deleted file mode 100644 index 08bb966fe..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/FontRenderer.java.patch +++ /dev/null @@ -1,155 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/FontRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/gui/FontRenderer.java -@@ -57,7 +57,7 @@ - this.locationFontTexture = p_i1035_2_; - this.renderEngine = p_i1035_3_; - this.unicodeFlag = p_i1035_4_; -- p_i1035_3_.bindTexture(this.locationFontTexture); -+ bindTexture(this.locationFontTexture); - - for (int i = 0; i < 32; ++i) - { -@@ -97,6 +97,7 @@ - public void onResourceManagerReload(IResourceManager resourceManager) - { - this.readFontTexture(); -+ this.readGlyphSizes(); - } - - private void readFontTexture() -@@ -105,7 +106,7 @@ - - try - { -- bufferedimage = TextureUtil.readBufferedImage(Minecraft.getMinecraft().getResourceManager().getResource(this.locationFontTexture).getInputStream()); -+ bufferedimage = TextureUtil.readBufferedImage(getResourceInputStream(this.locationFontTexture)); - } - catch (IOException ioexception) - { -@@ -172,7 +173,7 @@ - - try - { -- inputstream = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("font/glyph_sizes.bin")).getInputStream(); -+ inputstream = getResourceInputStream(new ResourceLocation("font/glyph_sizes.bin")); - inputstream.read(this.glyphWidth); - } - catch (IOException ioexception) -@@ -195,7 +196,7 @@ - float f = (float)(p_78266_1_ % 16 * 8); - float f1 = (float)(p_78266_1_ / 16 * 8); - float f2 = p_78266_2_ ? 1.0F : 0.0F; -- this.renderEngine.bindTexture(this.locationFontTexture); -+ bindTexture(this.locationFontTexture); - float f3 = (float)this.charWidth[p_78266_1_] - 0.01F; - GL11.glBegin(GL11.GL_TRIANGLE_STRIP); - GL11.glTexCoord2f(f / 128.0F, f1 / 128.0F); -@@ -222,7 +223,7 @@ - - private void loadGlyphTexture(int p_78257_1_) - { -- this.renderEngine.bindTexture(this.getUnicodePageLocation(p_78257_1_)); -+ bindTexture(this.getUnicodePageLocation(p_78257_1_)); - } - - protected float renderUnicodeChar(char p_78277_1_, boolean p_78277_2_) -@@ -269,7 +270,7 @@ - - public int drawString(String p_175065_1_, float p_175065_2_, float p_175065_3_, int p_175065_4_, boolean p_175065_5_) - { -- GlStateManager.enableAlpha(); -+ enableAlpha(); - this.resetStyles(); - int j; - -@@ -341,7 +342,7 @@ - - k = this.colorCode[j]; - this.textColor = k; -- GlStateManager.color((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.alpha); -+ setColor((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.alpha); - } - else if (j == 16) - { -@@ -370,7 +371,7 @@ - this.strikethroughStyle = false; - this.underlineStyle = false; - this.italicStyle = false; -- GlStateManager.color(this.red, this.blue, this.green, this.alpha); -+ setColor(this.red, this.blue, this.green, this.alpha); - } - - ++i; -@@ -390,7 +391,7 @@ - j = k; - } - -- float f1 = this.unicodeFlag ? 0.5F : 1.0F; -+ float f1 = getCharWidth(c0) / 32f; - boolean flag1 = (c0 == 0 || j == -1 || this.unicodeFlag) && p_78255_2_; - - if (flag1) -@@ -429,6 +430,15 @@ - ++f; - } - -+ doDraw(f); -+ } -+ } -+ } -+ -+ protected void doDraw(float f) -+ { -+ { -+ { - Tessellator tessellator; - WorldRenderer worldrenderer; - -@@ -504,7 +514,7 @@ - this.blue = (float)(p_180455_4_ >> 8 & 255) / 255.0F; - this.green = (float)(p_180455_4_ & 255) / 255.0F; - this.alpha = (float)(p_180455_4_ >> 24 & 255) / 255.0F; -- GlStateManager.color(this.red, this.blue, this.green, this.alpha); -+ setColor(this.red, this.blue, this.green, this.alpha); - this.posX = p_180455_2_; - this.posY = p_180455_3_; - this.renderStringAtPos(p_180455_1_, p_180455_5_); -@@ -583,11 +593,6 @@ - int j = this.glyphWidth[p_78263_1_] >>> 4; - int k = this.glyphWidth[p_78263_1_] & 15; - -- if (k > 7) -- { -- k = 15; -- j = 0; -- } - - ++k; - return (k - j) / 2 + 1; -@@ -842,6 +847,26 @@ - return this.bidiFlag; - } - -+ protected void setColor(float r, float g, float b, float a) -+ { -+ GlStateManager.color(r,g,b,a); -+ } -+ -+ protected void enableAlpha() -+ { -+ GlStateManager.enableAlpha(); -+ } -+ -+ protected void bindTexture(ResourceLocation location) -+ { -+ renderEngine.bindTexture(location); -+ } -+ -+ protected InputStream getResourceInputStream(ResourceLocation location) throws IOException -+ { -+ return Minecraft.getMinecraft().getResourceManager().getResource(location).getInputStream(); -+ } -+ - public int getColorCode(char p_175064_1_) - { - return this.colorCode["0123456789abcdef".indexOf(p_175064_1_)]; diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiButton.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiButton.java.patch deleted file mode 100644 index 0ccb62296..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiButton.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiButton.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiButton.java -@@ -22,6 +22,7 @@ - public boolean visible; - protected boolean hovered; - private static final String __OBFID = "CL_00000668"; -+ public int packedFGColour; //FML - - public GuiButton(int buttonId, int x, int y, String buttonText) - { -@@ -75,8 +76,12 @@ - this.mouseDragged(mc, mouseX, mouseY); - int l = 14737632; - -- if (!this.enabled) -+ if (packedFGColour != 0) - { -+ l = packedFGColour; -+ } -+ else if (!this.enabled) -+ { - l = 10526880; - } - else if (this.hovered) diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch deleted file mode 100644 index f336b38d2..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiChat.java.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiChat.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiChat.java -@@ -217,13 +217,14 @@ - this.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(stringbuilder.toString()), 1); - } - -- this.inputField.writeText((String)this.foundPlayerNames.get(this.autocompleteIndex++)); -+ this.inputField.writeText(net.minecraft.util.EnumChatFormatting.getTextWithoutFormattingCodes((String)this.foundPlayerNames.get(this.autocompleteIndex++))); - } - - private void sendAutocompleteRequest(String p_146405_1_, String p_146405_2_) - { - if (p_146405_1_.length() >= 1) - { -+ net.minecraftforge.client.ClientCommandHandler.instance.autoComplete(p_146405_1_, p_146405_2_); - BlockPos blockpos = null; - - if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) -@@ -285,6 +286,13 @@ - String[] astring1 = p_146406_1_; - int i = p_146406_1_.length; - -+ String[] complete = net.minecraftforge.client.ClientCommandHandler.instance.latestAutoComplete; -+ if (complete != null) -+ { -+ astring1 = com.google.common.collect.ObjectArrays.concat(complete, astring1, String.class); -+ i = astring1.length; -+ } -+ - for (int j = 0; j < i; ++j) - { - String s = astring1[j]; diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch deleted file mode 100644 index bf1617dab..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java -@@ -213,6 +213,8 @@ - } - } - -+ WorldType.worldTypes[this.selectedIndex].onGUICreateWorldPress(); -+ - WorldSettings.GameType gametype = WorldSettings.GameType.getByName(this.field_146342_r); - WorldSettings worldsettings = new WorldSettings(i, gametype, this.field_146341_s, this.field_146337_w, WorldType.worldTypes[this.selectedIndex]); - worldsettings.setWorldName(this.chunkProviderSettingsJson); -@@ -320,14 +322,7 @@ - } - else if (button.id == 8) - { -- if (WorldType.worldTypes[this.selectedIndex] == WorldType.FLAT) -- { -- this.mc.displayGuiScreen(new GuiCreateFlatWorld(this, this.chunkProviderSettingsJson)); -- } -- else -- { -- this.mc.displayGuiScreen(new GuiCustomizeWorldScreen(this, this.chunkProviderSettingsJson)); -- } -+ WorldType.worldTypes[this.selectedIndex].onCustomizeButton(mc, this); - } - } - } -@@ -379,7 +374,7 @@ - this.btnBonusItems.visible = this.field_146344_y; - this.btnMapType.visible = this.field_146344_y; - this.btnAllowCommands.visible = this.field_146344_y; -- this.btnCustomizeType.visible = this.field_146344_y && (WorldType.worldTypes[this.selectedIndex] == WorldType.FLAT || WorldType.worldTypes[this.selectedIndex] == WorldType.CUSTOMIZED); -+ this.btnCustomizeType.visible = this.field_146344_y && WorldType.worldTypes[this.selectedIndex].isCustomizable(); - } - - this.func_146319_h(); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch deleted file mode 100644 index dc621b142..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiIngameMenu.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngameMenu.java -@@ -30,8 +30,9 @@ - - this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 24 + b0, I18n.format("menu.returnToGame", new Object[0]))); - this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + b0, 98, 20, I18n.format("menu.options", new Object[0]))); -+ this.buttonList.add(new GuiButton(12, this.width / 2 + 2, this.height / 4 + 96 + b0, 98, 20, I18n.format("fml.menu.modoptions"))); - GuiButton guibutton; -- this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 + 2, this.height / 4 + 96 + b0, 98, 20, I18n.format("menu.shareToLan", new Object[0]))); -+ this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 - 100, this.height / 4 + 72 + b0, 200, 20, I18n.format("menu.shareToLan", new Object[0]))); - this.buttonList.add(new GuiButton(5, this.width / 2 - 100, this.height / 4 + 48 + b0, 98, 20, I18n.format("gui.achievements", new Object[0]))); - this.buttonList.add(new GuiButton(6, this.width / 2 + 2, this.height / 4 + 48 + b0, 98, 20, I18n.format("gui.stats", new Object[0]))); - guibutton.enabled = this.mc.isSingleplayer() && !this.mc.getIntegratedServer().getPublic(); -@@ -58,13 +59,19 @@ - this.mc.setIngameFocus(); - break; - case 5: -+ if (this.mc.thePlayer != null) - this.mc.displayGuiScreen(new GuiAchievements(this, this.mc.thePlayer.getStatFileWriter())); - break; - case 6: -+ if (this.mc.thePlayer != null) - this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter())); - break; - case 7: - this.mc.displayGuiScreen(new GuiShareToLan(this)); -+ break; -+ case 12: -+ net.minecraftforge.fml.client.FMLClientHandler.instance().showInGameModOptions(this); -+ break; - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch deleted file mode 100644 index 62e8f7c30..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiMainMenu.java.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiMainMenu.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiMainMenu.java -@@ -198,6 +198,11 @@ - this.buttonList.add(new GuiButton(1, this.width / 2 - 100, p_73969_1_, I18n.format("menu.singleplayer", new Object[0]))); - this.buttonList.add(new GuiButton(2, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.format("menu.multiplayer", new Object[0]))); - this.buttonList.add(this.realmsButton = new GuiButton(14, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.format("menu.online", new Object[0]))); -+ GuiButton fmlModButton = new GuiButton(6, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.format("fml.menu.mods")); -+ fmlModButton.xPosition = this.width / 2 + 2; -+ realmsButton.width = 98; -+ fmlModButton.width = 98; -+ this.buttonList.add(fmlModButton); - } - - private void addDemoButtons(int p_73972_1_, int p_73972_2_) -@@ -245,6 +250,11 @@ - this.mc.shutdown(); - } - -+ if (button.id == 6) -+ { -+ this.mc.displayGuiScreen(new net.minecraftforge.fml.client.GuiModList(this)); -+ } -+ - if (button.id == 11) - { - this.mc.launchIntegratedServer("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings); -@@ -492,7 +502,16 @@ - s = s + " Demo"; - } - -- this.drawString(this.fontRendererObj, s, 2, this.height - 10, -1); -+ java.util.List brandings = com.google.common.collect.Lists.reverse(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(true)); -+ for (int i = 0; i < brandings.size(); i++) -+ { -+ String brd = brandings.get(i); -+ if (!com.google.common.base.Strings.isNullOrEmpty(brd)) -+ { -+ this.drawString(this.fontRendererObj, brd, 2, this.height - ( 10 + i * (this.fontRendererObj.FONT_HEIGHT + 1)), 16777215); -+ } -+ } -+ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, this.fontRendererObj, this.width, this.height); - String s1 = "Copyright Mojang AB. Do not distribute!"; - this.drawString(this.fontRendererObj, s1, this.width - this.fontRendererObj.getStringWidth(s1) - 2, this.height - 10, -1); - diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch deleted file mode 100644 index b4563e39b..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiMultiplayer.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiMultiplayer.java -@@ -41,6 +41,7 @@ - public GuiMultiplayer(GuiScreen parentScreen) - { - this.parentScreen = parentScreen; -+ net.minecraftforge.fml.client.FMLClientHandler.instance().setupServerList(); - } - - public void initGui() -@@ -373,7 +374,7 @@ - - private void connectToServer(ServerData server) - { -- this.mc.displayGuiScreen(new GuiConnecting(this, this.mc, server)); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServer(this, server); - } - - public void selectServer(int index) diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch deleted file mode 100644 index 909dc5dbc..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java -@@ -170,6 +170,9 @@ - long l = j - k; - ArrayList arraylist = Lists.newArrayList(new String[] {String.format("Java: %s %dbit", new Object[]{System.getProperty("java.version"), Integer.valueOf(this.mc.isJava64bit() ? 64 : 32)}), String.format("Mem: % 2d%% %03d/%03dMB", new Object[]{Long.valueOf(l * 100L / i), Long.valueOf(bytesToMb(l)), Long.valueOf(bytesToMb(i))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(j * 100L / i), Long.valueOf(bytesToMb(j))}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GL11.glGetString(GL11.GL_VENDOR)}), GL11.glGetString(GL11.GL_RENDERER), GL11.glGetString(GL11.GL_VERSION)}); - -+ arraylist.add(""); -+ arraylist.addAll(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(false)); -+ - if (this.isReducedDebug()) - { - return arraylist; diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiScreen.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiScreen.java.patch deleted file mode 100644 index c6e3b5403..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiScreen.java.patch +++ /dev/null @@ -1,113 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiScreen.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiScreen.java -@@ -37,6 +37,9 @@ - import net.minecraft.util.ChatComponentTranslation; - import net.minecraft.util.EnumChatFormatting; - import net.minecraft.util.IChatComponent; -+import net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent; -+import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; -+import net.minecraftforge.common.MinecraftForge; - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - import org.apache.commons.lang3.StringUtils; -@@ -146,7 +149,8 @@ - } - } - -- this.drawHoveringText(list, x, y); -+ FontRenderer font = stack.getItem().getFontRenderer(stack); -+ this.drawHoveringText(list, x, y, (font == null ? fontRendererObj : font)); - } - - protected void drawCreativeTabHoveringText(String tabName, int mouseX, int mouseY) -@@ -156,6 +160,11 @@ - - protected void drawHoveringText(List textLines, int x, int y) - { -+ drawHoveringText(textLines, x, y, fontRendererObj); -+ } -+ -+ protected void drawHoveringText(List textLines, int x, int y, FontRenderer font) -+ { - if (!textLines.isEmpty()) - { - GlStateManager.disableRescaleNormal(); -@@ -168,7 +177,7 @@ - while (iterator.hasNext()) - { - String s = (String)iterator.next(); -- int l = this.fontRendererObj.getStringWidth(s); -+ int l = font.getStringWidth(s); - - if (l > k) - { -@@ -213,7 +222,7 @@ - for (int i2 = 0; i2 < textLines.size(); ++i2) - { - String s1 = (String)textLines.get(i2); -- this.fontRendererObj.drawStringWithShadow(s1, (float)j2, (float)k2, -1); -+ font.drawStringWithShadow(s1, j2, k2, -1); - - if (i2 == 0) - { -@@ -441,6 +450,7 @@ - this.mc.ingameGUI.getChatGUI().addToSentMessages(msg); - } - -+ if (net.minecraftforge.client.ClientCommandHandler.instance.executeCommand(mc.thePlayer, msg) != 0) return; - this.mc.thePlayer.sendChatMessage(msg); - } - -@@ -454,9 +464,14 @@ - - if (guibutton.mousePressed(this.mc, mouseX, mouseY)) - { -- this.selectedButton = guibutton; -- guibutton.playPressSound(this.mc.getSoundHandler()); -- this.actionPerformed(guibutton); -+ ActionPerformedEvent.Pre event = new ActionPerformedEvent.Pre(this, guibutton, this.buttonList); -+ if (MinecraftForge.EVENT_BUS.post(event)) -+ break; -+ this.selectedButton = event.button; -+ event.button.playPressSound(this.mc.getSoundHandler()); -+ this.actionPerformed(event.button); -+ if (this.equals(this.mc.currentScreen)) -+ MinecraftForge.EVENT_BUS.post(new ActionPerformedEvent.Post(this, event.button, this.buttonList)); - } - } - } -@@ -482,8 +497,12 @@ - this.fontRendererObj = mc.fontRendererObj; - this.width = width; - this.height = height; -- this.buttonList.clear(); -- this.initGui(); -+ if (!MinecraftForge.EVENT_BUS.post(new InitGuiEvent.Pre(this, this.buttonList))) -+ { -+ this.buttonList.clear(); -+ this.initGui(); -+ } -+ MinecraftForge.EVENT_BUS.post(new InitGuiEvent.Post(this, this.buttonList)); - } - - public void initGui() {} -@@ -494,7 +513,9 @@ - { - while (Mouse.next()) - { -+ if (MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Pre(this))) continue; - this.handleMouseInput(); -+ if (this.equals(this.mc.currentScreen)) MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Post(this)); - } - } - -@@ -502,7 +523,9 @@ - { - while (Keyboard.next()) - { -+ if (MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Pre(this))) continue; - this.handleKeyboardInput(); -+ if (this.equals(this.mc.currentScreen)) MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Post(this)); - } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch deleted file mode 100644 index 83c8e4e05..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSelectWorld.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiSelectWorld.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSelectWorld.java -@@ -187,7 +187,7 @@ - - if (this.mc.getSaveLoader().canLoadWorld(s)) - { -- this.mc.launchIntegratedServer(s, s1, (WorldSettings)null); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().tryLoadExistingWorld(this, s, s1); - } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch deleted file mode 100644 index 5df4b471b..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiSleepMP.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSleepMP.java -@@ -34,7 +34,7 @@ - - if (!s.isEmpty()) - { -- this.mc.thePlayer.sendChatMessage(s); -+ this.sendChatMessage(s); // Forge: fix vanilla not adding messages to the sent list while sleeping - } - - this.inputField.setText(""); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch deleted file mode 100644 index 0ae54f80c..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/GuiSlot.java.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiSlot.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSlot.java -@@ -185,16 +185,7 @@ - GlStateManager.disableFog(); - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); -- this.mc.getTextureManager().bindTexture(Gui.optionsBackground); -- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); -- float f1 = 32.0F; -- worldrenderer.startDrawingQuads(); -- worldrenderer.setColorOpaque_I(2105376); -- worldrenderer.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); -- worldrenderer.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); -- worldrenderer.addVertexWithUV((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); -- worldrenderer.addVertexWithUV((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); -- tessellator.draw(); -+ this.drawContainerBackground(tessellator); - int i1 = this.left + this.width / 2 - this.getListWidth() / 2 + 2; - int j1 = this.top + 4 - (int)this.amountScrolled; - -@@ -456,4 +447,19 @@ - { - return this.slotHeight; - } -+ -+ protected void drawContainerBackground(Tessellator tessellator) -+ { -+ WorldRenderer worldrenderer = tessellator.getWorldRenderer(); -+ this.mc.getTextureManager().bindTexture(Gui.optionsBackground); -+ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); -+ float f1 = 32.0F; -+ worldrenderer.startDrawingQuads(); -+ worldrenderer.setColorOpaque_I(2105376); -+ worldrenderer.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); -+ worldrenderer.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1)); -+ worldrenderer.addVertexWithUV((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); -+ worldrenderer.addVertexWithUV((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1)); -+ tessellator.draw(); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch deleted file mode 100644 index a5e77286b..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java -+++ ../src-work/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java -@@ -84,7 +84,7 @@ - boolean flag2 = this.field_148301_e.version < 47; - boolean flag3 = flag1 || flag2; - this.field_148300_d.fontRendererObj.drawString(this.field_148301_e.serverName, x + 32 + 3, y + 1, 16777215); -- List list = this.field_148300_d.fontRendererObj.listFormattedStringToWidth(this.field_148301_e.serverMOTD, listWidth - 32 - 2); -+ List list = this.field_148300_d.fontRendererObj.listFormattedStringToWidth(net.minecraftforge.fml.client.FMLClientHandler.instance().fixDescription(this.field_148301_e.serverMOTD), listWidth - 48 - 2); - - for (int l1 = 0; l1 < Math.min(list.size(), 2); ++l1) - { -@@ -178,6 +178,11 @@ - int k2 = mouseX - x; - int l2 = mouseY - y; - -+ String tooltip = net.minecraftforge.fml.client.FMLClientHandler.instance().enhanceServerListEntry(this, this.field_148301_e, x, listWidth, y, k2, l2); -+ if (tooltip != null) -+ { -+ this.field_148303_c.func_146793_a(tooltip); -+ } else - if (k2 >= listWidth - 15 && k2 <= listWidth - 5 && l2 >= 0 && l2 <= 8) - { - this.field_148303_c.func_146793_a(s1); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch deleted file mode 100644 index fa2823869..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java.patch +++ /dev/null @@ -1,127 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java -+++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java -@@ -24,6 +24,9 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - import org.lwjgl.input.Mouse; -+import java.util.LinkedList; -+import java.util.List; -+import net.minecraftforge.common.AchievementPage; - - @SideOnly(Side.CLIENT) - public class GuiAchievements extends GuiScreen implements IProgressMeter -@@ -50,6 +53,10 @@ - private boolean loadingAchievements = true; - private static final String __OBFID = "CL_00000722"; - -+ private int currentPage = -1; -+ private GuiButton button; -+ private LinkedList minecraftAchievements = new LinkedList(); -+ - public GuiAchievements(GuiScreen p_i45026_1_, StatFileWriter p_i45026_2_) - { - this.parentScreen = p_i45026_1_; -@@ -58,6 +65,14 @@ - short short2 = 141; - this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.openInventory.displayColumn * 24 - short1 / 2 - 12); - this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.openInventory.displayRow * 24 - short2 / 2); -+ minecraftAchievements.clear(); -+ for (Object achievement : AchievementList.achievementList) -+ { -+ if (!AchievementPage.isAchievementInPages((Achievement)achievement)) -+ { -+ minecraftAchievements.add((Achievement)achievement); -+ } -+ } - } - - public void initGui() -@@ -65,6 +80,7 @@ - this.mc.getNetHandler().addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.REQUEST_STATS)); - this.buttonList.clear(); - this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, I18n.format("gui.done", new Object[0]))); -+ this.buttonList.add(button = new GuiButton(2, (width - field_146555_f) / 2 + 24, height / 2 + 74, 125, 20, AchievementPage.getTitle(currentPage))); - } - - protected void actionPerformed(GuiButton button) throws IOException -@@ -75,6 +91,16 @@ - { - this.mc.displayGuiScreen(this.parentScreen); - } -+ -+ if (button.id == 2) -+ { -+ currentPage++; -+ if (currentPage >= AchievementPage.getAchievementPages().size()) -+ { -+ currentPage = -1; -+ } -+ this.button.displayString = AchievementPage.getTitle(currentPage); -+ } - } - } - -@@ -260,7 +286,9 @@ - GlStateManager.depthFunc(518); - GlStateManager.pushMatrix(); - GlStateManager.translate((float)k1, (float)l1, -200.0F); -- GlStateManager.scale(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 0.0F); -+ // FIXES models rendering weirdly in the acheivements pane -+ // see https://github.com/MinecraftForge/MinecraftForge/commit/1b7ce7592caafb760ec93066184182ae0711e793#commitcomment-10512284 -+ GlStateManager.scale(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 1.0F); - GlStateManager.enableTexture2D(); - GlStateManager.disableLighting(); - GlStateManager.enableRescaleNormal(); -@@ -341,11 +369,12 @@ - int i4; - int l4; - -- for (i3 = 0; i3 < AchievementList.achievementList.size(); ++i3) -+ List achievementList = (currentPage == -1 ? minecraftAchievements : AchievementPage.getAchievementPage(currentPage).getAchievements()); -+ for (i3 = 0; i3 < achievementList.size(); ++i3) - { -- Achievement achievement1 = (Achievement)AchievementList.achievementList.get(i3); -+ Achievement achievement1 = achievementList.get(i3); - -- if (achievement1.parentAchievement != null) -+ if (achievement1.parentAchievement != null && achievementList.contains(achievement1.parentAchievement)) - { - j3 = achievement1.displayColumn * 24 - k + 11; - k3 = achievement1.displayRow * 24 - l + 11; -@@ -401,9 +430,9 @@ - int i5; - int j5; - -- for (k3 = 0; k3 < AchievementList.achievementList.size(); ++k3) -+ for (k3 = 0; k3 < achievementList.size(); ++k3) - { -- Achievement achievement2 = (Achievement)AchievementList.achievementList.get(k3); -+ Achievement achievement2 = (Achievement)achievementList.get(k3); - l4 = achievement2.displayColumn * 24 - k; - i5 = achievement2.displayRow * 24 - l; - -@@ -445,6 +474,7 @@ - - this.mc.getTextureManager().bindTexture(field_146561_C); - -+ GlStateManager.enableBlend(); // Forge: Specifically enable blend because it is needed here. And we fix Generic RenderItem's leakage of it. - if (achievement2.getSpecial()) - { - this.drawTexturedModalRect(l4 - 2, i5 - 2, 26, 202, 26, 26); -@@ -453,6 +483,7 @@ - { - this.drawTexturedModalRect(l4 - 2, i5 - 2, 0, 202, 26, 26); - } -+ GlStateManager.disableBlend(); //Forge: Cleanup states we set. - - if (!this.statFileWriter.canUnlockAchievement(achievement2)) - { -@@ -461,7 +492,7 @@ - this.itemRender.func_175039_a(false); - } - -- GlStateManager.enableLighting(); -+ GlStateManager.disableLighting(); //Forge: Make sure Lighting is disabled. Fixes MC-33065 - GlStateManager.enableCull(); - this.itemRender.renderItemAndEffectIntoGUI(achievement2.theItemStack, l4 + 3, i5 + 3); - GlStateManager.blendFunc(770, 771); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch deleted file mode 100644 index 2b81ff699..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiStats.java -+++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiStats.java -@@ -769,6 +769,7 @@ - super(mcIn, GuiStats.this.width, GuiStats.this.height, 32, GuiStats.this.height - 64, GuiStats.this.fontRendererObj.FONT_HEIGHT * 4); - this.setShowSelectionBox(false); - Iterator iterator = EntityList.entityEggs.values().iterator(); -+ iterator = com.google.common.collect.Iterators.concat(iterator, net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().values().iterator()); - - while (iterator.hasNext()) - { -@@ -806,7 +807,7 @@ - protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int p_180791_5_, int p_180791_6_) - { - EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)this.field_148222_l.get(entryID); -- String s = I18n.format("entity." + EntityList.getStringFromID(entityegginfo.spawnedID) + ".name", new Object[0]); -+ String s = I18n.format("entity." + entityegginfo.name + ".name", new Object[0]); - int k1 = GuiStats.this.field_146546_t.readStat(entityegginfo.field_151512_d); - int l1 = GuiStats.this.field_146546_t.readStat(entityegginfo.field_151513_e); - String s1 = I18n.format("stat.entityKills", new Object[] {Integer.valueOf(k1), s}); diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch deleted file mode 100644 index c72e0db72..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java.patch +++ /dev/null @@ -1,65 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java -+++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java -@@ -5,6 +5,7 @@ - import java.util.Iterator; - import java.util.Set; - import net.minecraft.client.Minecraft; -+import net.minecraft.client.gui.FontRenderer; - import net.minecraft.client.gui.GuiScreen; - import net.minecraft.client.renderer.GlStateManager; - import net.minecraft.client.renderer.OpenGlHelper; -@@ -178,8 +179,11 @@ - GlStateManager.translate(0.0F, 0.0F, 32.0F); - this.zLevel = 200.0F; - this.itemRender.zLevel = 200.0F; -+ FontRenderer font = null; -+ if (stack != null) font = stack.getItem().getFontRenderer(stack); -+ if (font == null) font = fontRendererObj; - this.itemRender.renderItemAndEffectIntoGUI(stack, x, y); -- this.itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, stack, x, y - (this.draggedStack == null ? 0 : 8), altText); -+ this.itemRender.renderItemOverlayIntoGUI(font, stack, x, y - (this.draggedStack == null ? 0 : 8), altText); - this.zLevel = 0.0F; - this.itemRender.zLevel = 0.0F; - } -@@ -240,13 +244,12 @@ - - if (itemstack == null) - { -- String s1 = slotIn.getSlotTexture(); -+ TextureAtlasSprite textureatlassprite = slotIn.getBackgroundSprite(); - -- if (s1 != null) -+ if (textureatlassprite != null) - { -- TextureAtlasSprite textureatlassprite = this.mc.getTextureMapBlocks().getAtlasSprite(s1); - GlStateManager.disableLighting(); -- this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); -+ this.mc.getTextureManager().bindTexture(slotIn.getBackgroundLocation()); - this.drawTexturedModalRect(i, j, textureatlassprite, 16, 16); - GlStateManager.enableLighting(); - flag1 = true; -@@ -465,6 +468,7 @@ - - protected void mouseReleased(int mouseX, int mouseY, int state) - { -+ super.mouseReleased(mouseX, mouseY, state); //Forge, Call parent to release buttons - Slot slot = this.getSlotAtPosition(mouseX, mouseY); - int l = this.guiLeft; - int i1 = this.guiTop; -@@ -698,4 +702,16 @@ - this.mc.thePlayer.closeScreen(); - } - } -+ -+ /* ======================================== FORGE START =====================================*/ -+ -+ /** -+ * Returns the slot that is currently displayed under the mouse. -+ */ -+ public Slot getSlotUnderMouse() -+ { -+ return this.theSlot; -+ } -+ -+ /* ======================================== FORGE END =====================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch b/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch deleted file mode 100644 index 736edfcb9..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch +++ /dev/null @@ -1,267 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java -+++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java -@@ -49,6 +49,8 @@ - private boolean field_147057_D; - private CreativeCrafting field_147059_E; - private static final String __OBFID = "CL_00000752"; -+ private static int tabPage = 0; -+ private int maxPages = 0; - - public GuiContainerCreative(EntityPlayer p_i1088_1_) - { -@@ -187,7 +189,7 @@ - return; - } - -- if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2)) -+ if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2) && ItemStack.areItemStackTagsEqual(itemstack1, itemstack2)) //Forge: Bugfix, Compare NBT data, allow for deletion of enchanted books, MC-12770 - { - if (clickedButton == 0) - { -@@ -262,6 +264,13 @@ - this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[i]); - this.field_147059_E = new CreativeCrafting(this.mc); - this.mc.thePlayer.inventoryContainer.addCraftingToCrafters(this.field_147059_E); -+ int tabCount = CreativeTabs.creativeTabArray.length; -+ if (tabCount > 12) -+ { -+ buttonList.add(new GuiButton(101, guiLeft, guiTop - 50, 20, 20, "<")); -+ buttonList.add(new GuiButton(102, guiLeft + xSize - 20, guiTop - 50, 20, 20, ">")); -+ maxPages = ((tabCount - 12) / 10) + 1; -+ } - } - else - { -@@ -283,7 +292,7 @@ - - protected void keyTyped(char typedChar, int keyCode) throws IOException - { -- if (selectedTabIndex != CreativeTabs.tabAllSearch.getTabIndex()) -+ if (!CreativeTabs.creativeTabArray[selectedTabIndex].hasSearchBar()) - { - if (GameSettings.isKeyDown(this.mc.gameSettings.keyBindChat)) - { -@@ -320,6 +329,15 @@ - { - GuiContainerCreative.ContainerCreative containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; - containercreative.itemList.clear(); -+ -+ CreativeTabs tab = CreativeTabs.creativeTabArray[selectedTabIndex]; -+ if (tab.hasSearchBar() && tab != CreativeTabs.tabAllSearch) -+ { -+ tab.displayAllReleventItems(containercreative.itemList); -+ updateFilteredItems(containercreative); -+ return; -+ } -+ - Iterator iterator = Item.itemRegistry.iterator(); - - while (iterator.hasNext()) -@@ -331,10 +349,17 @@ - item.getSubItems(item, (CreativeTabs)null, containercreative.itemList); - } - } -+ updateFilteredItems(containercreative); -+ } - -+ //split from above for custom search tabs -+ private void updateFilteredItems(GuiContainerCreative.ContainerCreative containercreative) -+ { -+ Iterator iterator; - Enchantment[] aenchantment = Enchantment.enchantmentsBookList; - int j = aenchantment.length; - -+ if (CreativeTabs.creativeTabArray[selectedTabIndex] != CreativeTabs.tabAllSearch) j = 0; //Forge: Don't add enchants to custom tabs. - for (int i = 0; i < j; ++i) - { - Enchantment enchantment = aenchantment[i]; -@@ -385,7 +410,7 @@ - { - CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; - -- if (creativetabs.drawInForegroundOfTab()) -+ if (creativetabs != null && creativetabs.drawInForegroundOfTab()) - { - GlStateManager.disableBlend(); - this.fontRendererObj.drawString(I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]), 8, 6, 4210752); -@@ -428,7 +453,7 @@ - { - CreativeTabs creativetabs = acreativetabs[k1]; - -- if (this.func_147049_a(creativetabs, l, i1)) -+ if (creativetabs != null && this.func_147049_a(creativetabs, l, i1)) - { - this.setCurrentCreativeTab(creativetabs); - return; -@@ -441,11 +466,13 @@ - - private boolean needsScrollBars() - { -+ if (CreativeTabs.creativeTabArray[selectedTabIndex] == null) return false; - return selectedTabIndex != CreativeTabs.tabInventory.getTabIndex() && CreativeTabs.creativeTabArray[selectedTabIndex].shouldHidePlayerInventory() && ((GuiContainerCreative.ContainerCreative)this.inventorySlots).func_148328_e(); - } - - private void setCurrentCreativeTab(CreativeTabs p_147050_1_) - { -+ if (p_147050_1_ == null) return; - int i = selectedTabIndex; - selectedTabIndex = p_147050_1_.getTabIndex(); - GuiContainerCreative.ContainerCreative containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; -@@ -514,12 +541,14 @@ - - if (this.searchField != null) - { -- if (p_147050_1_ == CreativeTabs.tabAllSearch) -+ if (p_147050_1_.hasSearchBar()) - { - this.searchField.setVisible(true); - this.searchField.setCanLoseFocus(false); - this.searchField.setFocused(true); - this.searchField.setText(""); -+ this.searchField.width = p_147050_1_.getSearchbarWidth(); -+ this.searchField.xPosition = this.guiLeft + (82 /*default left*/ + 89 /*default width*/) - this.searchField.width; - this.updateCreativeSearch(); - } - else -@@ -590,23 +619,45 @@ - - super.drawScreen(mouseX, mouseY, partialTicks); - CreativeTabs[] acreativetabs = CreativeTabs.creativeTabArray; -- int i2 = acreativetabs.length; -+ int start = tabPage * 10; -+ int i2 = Math.min(acreativetabs.length, ((tabPage + 1) * 10) + 2); -+ if (tabPage != 0) start += 2; -+ boolean rendered = false; - -- for (int j2 = 0; j2 < i2; ++j2) -+ for (int j2 = start; j2 < i2; ++j2) - { - CreativeTabs creativetabs = acreativetabs[j2]; - -+ if (creativetabs == null) continue; - if (this.renderCreativeInventoryHoveringText(creativetabs, mouseX, mouseY)) - { -+ rendered = true; - break; - } - } - -+ if (!rendered && renderCreativeInventoryHoveringText(CreativeTabs.tabAllSearch, mouseX, mouseY)) -+ { -+ renderCreativeInventoryHoveringText(CreativeTabs.tabInventory, mouseX, mouseY); -+ } -+ - if (this.field_147064_C != null && selectedTabIndex == CreativeTabs.tabInventory.getTabIndex() && this.isPointInRegion(this.field_147064_C.xDisplayPosition, this.field_147064_C.yDisplayPosition, 16, 16, mouseX, mouseY)) - { - this.drawCreativeTabHoveringText(I18n.format("inventory.binSlot", new Object[0]), mouseX, mouseY); - } - -+ if (maxPages != 0) -+ { -+ String page = String.format("%d / %d", tabPage + 1, maxPages + 1); -+ int width = fontRendererObj.getStringWidth(page); -+ GlStateManager.disableLighting(); -+ this.zLevel = 300.0F; -+ itemRender.zLevel = 300.0F; -+ fontRendererObj.drawString(page, guiLeft + (xSize / 2) - (width / 2), guiTop - 44, -1); -+ this.zLevel = 0.0F; -+ itemRender.zLevel = 0.0F; -+ } -+ - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.disableLighting(); - } -@@ -675,17 +726,36 @@ - int k = acreativetabs.length; - int l; - -- for (l = 0; l < k; ++l) -+ int start = tabPage * 10; -+ k = Math.min(acreativetabs.length, ((tabPage + 1) * 10 + 2)); -+ if (tabPage != 0) start += 2; -+ -+ for (l = start; l < k; ++l) - { - CreativeTabs creativetabs1 = acreativetabs[l]; - this.mc.getTextureManager().bindTexture(creativeInventoryTabs); - -+ if (creativetabs1 == null) continue; - if (creativetabs1.getTabIndex() != selectedTabIndex) - { - this.func_147051_a(creativetabs1); - } - } - -+ if (tabPage != 0) -+ { -+ if (creativetabs != CreativeTabs.tabAllSearch) -+ { -+ this.mc.getTextureManager().bindTexture(creativeInventoryTabs); -+ func_147051_a(CreativeTabs.tabAllSearch); -+ } -+ if (creativetabs != CreativeTabs.tabInventory) -+ { -+ this.mc.getTextureManager().bindTexture(creativeInventoryTabs); -+ func_147051_a(CreativeTabs.tabInventory); -+ } -+ } -+ - this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.getBackgroundImageName())); - this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); - this.searchField.drawTextBox(); -@@ -700,6 +770,14 @@ - this.drawTexturedModalRect(i1, k + (int)((float)(l - k - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15); - } - -+ if (creativetabs == null || creativetabs.getTabPage() != tabPage) -+ { -+ if (creativetabs != CreativeTabs.tabAllSearch && creativetabs != CreativeTabs.tabInventory) -+ { -+ return; -+ } -+ } -+ - this.func_147051_a(creativetabs); - - if (creativetabs == CreativeTabs.tabInventory) -@@ -710,6 +788,15 @@ - - protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_) - { -+ if (p_147049_1_.getTabPage() != tabPage) -+ { -+ if (p_147049_1_ != CreativeTabs.tabAllSearch && -+ p_147049_1_ != CreativeTabs.tabInventory) -+ { -+ return false; -+ } -+ } -+ - int k = p_147049_1_.getTabColumn(); - int l = 28 * k; - byte b0 = 0; -@@ -810,6 +897,8 @@ - } - - GlStateManager.disableLighting(); -+ GlStateManager.color(1F, 1F, 1F); //Forge: Reset color in case Items change it. -+ GlStateManager.enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border. - this.drawTexturedModalRect(l, i1, j, k, 28, b0); - this.zLevel = 100.0F; - this.itemRender.zLevel = 100.0F; -@@ -836,6 +925,15 @@ - { - this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter())); - } -+ -+ if (button.id == 101) -+ { -+ tabPage = Math.max(tabPage - 1, 0); -+ } -+ else if (button.id == 102) -+ { -+ tabPage = Math.min(tabPage + 1, maxPages); -+ } - } - - public int getSelectedTabIndex() diff --git a/patches.mcp/minecraft/net/minecraft/client/model/ModelBase.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/ModelBase.java.patch deleted file mode 100644 index 4f3c8aede..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/model/ModelBase.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/model/ModelBase.java -+++ ../src-work/minecraft/net/minecraft/client/model/ModelBase.java -@@ -10,7 +10,6 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --@SideOnly(Side.CLIENT) - public abstract class ModelBase - { - public float swingProgress; diff --git a/patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch deleted file mode 100644 index ed3cab955..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/model/ModelBox.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/model/ModelBox.java -+++ ../src-work/minecraft/net/minecraft/client/model/ModelBox.java -@@ -4,7 +4,6 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --@SideOnly(Side.CLIENT) - public class ModelBox - { - private PositionTextureVertex[] vertexPositions; -@@ -82,6 +81,7 @@ - } - } - -+ @SideOnly(Side.CLIENT) - public void render(WorldRenderer p_178780_1_, float p_178780_2_) - { - for (int i = 0; i < this.quadList.length; ++i) diff --git a/patches.mcp/minecraft/net/minecraft/client/model/ModelRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/ModelRenderer.java.patch deleted file mode 100644 index 737fdac2f..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/model/ModelRenderer.java.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/model/ModelRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/model/ModelRenderer.java -@@ -10,7 +10,6 @@ - import net.minecraftforge.fml.relauncher.SideOnly; - import org.lwjgl.opengl.GL11; - --@SideOnly(Side.CLIENT) - public class ModelRenderer - { - public float textureWidth; -@@ -110,6 +109,7 @@ - this.rotationPointZ = p_78793_3_; - } - -+ @SideOnly(Side.CLIENT) - public void render(float p_78785_1_) - { - if (!this.isHidden) -@@ -192,6 +192,7 @@ - } - } - -+ @SideOnly(Side.CLIENT) - public void renderWithRotation(float p_78791_1_) - { - if (!this.isHidden) -@@ -227,6 +228,7 @@ - } - } - -+ @SideOnly(Side.CLIENT) - public void postRender(float p_78794_1_) - { - if (!this.isHidden) -@@ -268,6 +270,7 @@ - } - } - -+ @SideOnly(Side.CLIENT) - private void compileDisplayList(float p_78788_1_) - { - this.displayList = GLAllocation.generateDisplayLists(1); diff --git a/patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch deleted file mode 100644 index c3d2571d6..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/model/PositionTextureVertex.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/model/PositionTextureVertex.java -+++ ../src-work/minecraft/net/minecraft/client/model/PositionTextureVertex.java -@@ -1,10 +1,7 @@ - package net.minecraft.client.model; - - import net.minecraft.util.Vec3; --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; - --@SideOnly(Side.CLIENT) - public class PositionTextureVertex - { - public Vec3 vector3D; diff --git a/patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch b/patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch deleted file mode 100644 index 54dcb21f4..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/model/TexturedQuad.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/model/TexturedQuad.java -+++ ../src-work/minecraft/net/minecraft/client/model/TexturedQuad.java -@@ -3,10 +3,7 @@ - import net.minecraft.client.renderer.Tessellator; - import net.minecraft.client.renderer.WorldRenderer; - import net.minecraft.util.Vec3; --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; - --@SideOnly(Side.CLIENT) - public class TexturedQuad - { - public PositionTextureVertex[] vertexPositions; diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch deleted file mode 100644 index faf4f9779..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java -+++ ../src-work/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java -@@ -56,6 +56,7 @@ - Chunk chunk = new Chunk(this.worldObj, p_73158_1_, p_73158_2_); - this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_), chunk); - this.chunkListing.add(chunk); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk)); - chunk.setChunkLoaded(true); - return chunk; - } diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch deleted file mode 100644 index 74de972f3..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java -+++ ../src-work/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java -@@ -69,7 +69,7 @@ - inetaddress = InetAddress.getByName(ip); - GuiConnecting.this.networkManager = NetworkManager.provideLanClient(inetaddress, port); - GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen)); -- GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN)); -+ GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN, true)); - GuiConnecting.this.networkManager.sendPacket(new C00PacketLoginStart(GuiConnecting.this.mc.getSession().getProfile())); - } - catch (UnknownHostException unknownhostexception) diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch deleted file mode 100644 index 14f4f3c9b..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ /dev/null @@ -1,69 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java -+++ ../src-work/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java -@@ -113,6 +113,12 @@ - } - } - -+ ItemStack stack = mc.thePlayer.getCurrentEquippedItem(); -+ if (stack != null && stack.getItem() != null && stack.getItem().onBlockStartBreak(stack, pos, mc.thePlayer)) -+ { -+ return false; -+ } -+ - if (this.currentGameType.isCreative() && this.mc.thePlayer.getHeldItem() != null && this.mc.thePlayer.getHeldItem().getItem() instanceof ItemSword) - { - return false; -@@ -130,7 +136,7 @@ - else - { - worldclient.playAuxSFX(2001, pos, Block.getStateId(iblockstate)); -- boolean flag = worldclient.setBlockToAir(pos); -+ boolean flag = block1.removedByPlayer(worldclient, pos, mc.thePlayer, false); - - if (flag) - { -@@ -360,11 +366,19 @@ - { - if (this.currentGameType != WorldSettings.GameType.SPECTATOR) - { -+ -+ if (p_178890_3_ != null && -+ p_178890_3_.getItem() != null && -+ p_178890_3_.getItem().onItemUseFirst(p_178890_3_, p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2)) -+ { -+ return true; -+ } -+ - IBlockState iblockstate = p_178890_2_.getBlockState(p_178890_4_); - -- if ((!p_178890_1_.isSneaking() || p_178890_1_.getHeldItem() == null) && iblockstate.getBlock().onBlockActivated(p_178890_2_, p_178890_4_, iblockstate, p_178890_1_, p_178890_5_, f, f1, f2)) -+ if ((!p_178890_1_.isSneaking() || p_178890_1_.getHeldItem() == null || p_178890_1_.getHeldItem().getItem().doesSneakBypassUse(p_178890_2_, p_178890_4_, p_178890_1_))) - { -- flag = true; -+ flag = iblockstate.getBlock().onBlockActivated(p_178890_2_, p_178890_4_, iblockstate, p_178890_1_, p_178890_5_, f, f1, f2); - } - - if (!flag && p_178890_3_ != null && p_178890_3_.getItem() instanceof ItemBlock) -@@ -397,7 +411,9 @@ - } - else - { -- return p_178890_3_.onItemUse(p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2); -+ if (!p_178890_3_.onItemUse(p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2)) return false; -+ if (p_178890_3_.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_178890_1_, p_178890_3_); -+ return true; - } - } - else -@@ -428,9 +444,10 @@ - { - playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = itemstack1; - -- if (itemstack1.stackSize == 0) -+ if (itemstack1.stackSize <= 0) - { - playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = null; -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(playerIn, itemstack1); - } - - return true; diff --git a/patches.mcp/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch deleted file mode 100644 index bd5159cf2..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/multiplayer/WorldClient.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/multiplayer/WorldClient.java -+++ ../src-work/minecraft/net/minecraft/client/multiplayer/WorldClient.java -@@ -54,12 +54,13 @@ - super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), WorldProvider.getProviderForDimension(p_i45063_3_), p_i45063_5_, true); - this.sendQueue = p_i45063_1_; - this.getWorldInfo().setDifficulty(p_i45063_4_); -- this.setSpawnPoint(new BlockPos(8, 64, 8)); - this.provider.registerWorld(this); -+ this.setSpawnPoint(new BlockPos(8, 64, 8)); //Forge: Moved below registerWorld to prevent NPE in our redirect. - this.chunkProvider = this.createChunkProvider(); - this.mapStorage = new SaveDataMemoryStorage(); - this.calculateInitialSkylight(); - this.calculateInitialWeather(); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(this)); - } - - public void tick() diff --git a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch deleted file mode 100644 index c84d9a2d2..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java -+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java -@@ -24,6 +24,7 @@ - - public void processHandshake(C00Handshake packetIn) - { -+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return; - this.networkManager.setConnectionState(packetIn.getRequestedState()); - this.networkManager.setNetHandler(new NetHandlerLoginServer(this.mcServer, this.networkManager)); - } diff --git a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch deleted file mode 100644 index e2dc0d668..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java -+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java -@@ -92,7 +92,10 @@ - { - this.gameProfile = packetIn.getProfile(); - this.networkManager.setConnectionState(EnumConnectionState.PLAY); -- this.networkManager.setNetHandler(new NetHandlerPlayClient(this.mc, this.previousGuiScreen, this.networkManager, this.gameProfile)); -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlClientHandshake(this.networkManager); -+ NetHandlerPlayClient nhpc = new NetHandlerPlayClient(this.mc, this.previousGuiScreen, this.networkManager, this.gameProfile); -+ this.networkManager.setNetHandler(nhpc); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().setPlayClient(nhpc); - } - - public void onDisconnect(IChatComponent reason) diff --git a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch deleted file mode 100644 index 14bdf5825..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch +++ /dev/null @@ -1,72 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java -+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java -@@ -247,7 +247,7 @@ - { - PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); - this.gameController.playerController = new PlayerControllerMP(this.gameController, this); -- this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler); -+ this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.get(getNetworkManager()).getOverrideDimension(packetIn), packetIn.getDifficulty(), this.gameController.mcProfiler); - this.gameController.gameSettings.difficulty = packetIn.getDifficulty(); - this.gameController.loadWorld(this.clientWorldController); - this.gameController.thePlayer.dimension = packetIn.getDimension(); -@@ -410,7 +410,8 @@ - public void handleSpawnExperienceOrb(S11PacketSpawnExperienceOrb packetIn) - { - PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); -- EntityXPOrb entityxporb = new EntityXPOrb(this.clientWorldController, (double)packetIn.func_148984_d(), (double)packetIn.func_148983_e(), (double)packetIn.func_148982_f(), packetIn.func_148986_g()); -+ EntityXPOrb entityxporb = new EntityXPOrb(this.clientWorldController, (double)packetIn.func_148984_d() / 32.0D, (double)packetIn.func_148983_e() / 32.0D, (double)packetIn.func_148982_f() / 32.0D, packetIn.func_148986_g()); -+ // FORGE: BugFix MC-12013 Wrong XP orb clientside spawn position - entityxporb.serverPosX = packetIn.func_148984_d(); - entityxporb.serverPosY = packetIn.func_148983_e(); - entityxporb.serverPosZ = packetIn.func_148982_f(); -@@ -754,14 +755,16 @@ - public void handleChat(S02PacketChat packetIn) - { - PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); -+ net.minecraft.util.IChatComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(packetIn.func_179841_c(), packetIn.func_148915_c()); -+ if (message == null) return; - - if (packetIn.func_179841_c() == 2) - { -- this.gameController.ingameGUI.func_175188_a(packetIn.func_148915_c(), false); -+ this.gameController.ingameGUI.func_175188_a(message, false); - } - else - { -- this.gameController.ingameGUI.getChatGUI().printChatMessage(packetIn.func_148915_c()); -+ this.gameController.ingameGUI.getChatGUI().printChatMessage(message); - } - } - -@@ -812,6 +815,11 @@ - float f = (float)(packetIn.func_149028_l() * 360) / 256.0F; - float f1 = (float)(packetIn.func_149030_m() * 360) / 256.0F; - EntityLivingBase entitylivingbase = (EntityLivingBase)EntityList.createEntityByID(packetIn.func_149025_e(), this.gameController.theWorld); -+ if (entitylivingbase == null) -+ { -+ net.minecraftforge.fml.common.FMLLog.info("Server attempted to spawn an unknown entity using ID: {0} at ({1}, {2}, {3}) Skipping!", packetIn.func_149025_e(), d0, d1, d2); -+ return; -+ } - entitylivingbase.serverPosX = packetIn.func_149023_f(); - entitylivingbase.serverPosY = packetIn.func_149034_g(); - entitylivingbase.serverPosZ = packetIn.func_149029_h(); -@@ -1137,6 +1145,10 @@ - { - tileentity.readFromNBT(packetIn.getNbtCompound()); - } -+ else -+ { -+ tileentity.onDataPacket(netManager, packetIn); -+ } - } - } - -@@ -1346,7 +1358,7 @@ - - if (entity instanceof EntityLivingBase) - { -- PotionEffect potioneffect = new PotionEffect(packetIn.func_149427_e(), packetIn.func_180755_e(), packetIn.func_149428_f(), false, packetIn.func_179707_f()); -+ PotionEffect potioneffect = new PotionEffect(packetIn.func_149427_e() & 0xff, packetIn.func_180755_e(), packetIn.func_149428_f(), false, packetIn.func_179707_f()); - potioneffect.setPotionDurationMax(packetIn.func_149429_c()); - ((EntityLivingBase)entity).addPotionEffect(potioneffect); - } diff --git a/patches.mcp/minecraft/net/minecraft/client/network/OldServerPinger.java.patch b/patches.mcp/minecraft/net/minecraft/client/network/OldServerPinger.java.patch deleted file mode 100644 index 5072ca555..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/network/OldServerPinger.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/network/OldServerPinger.java -+++ ../src-work/minecraft/net/minecraft/client/network/OldServerPinger.java -@@ -148,6 +148,7 @@ - server.setBase64EncodedIconData((String)null); - } - -+ net.minecraftforge.fml.client.FMLClientHandler.instance().bindServerListData(server, serverstatusresponse); - this.field_175092_e = Minecraft.getSystemTime(); - networkmanager.sendPacket(new C01PacketPing(this.field_175092_e)); - this.field_147403_d = true; diff --git a/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch deleted file mode 100644 index 5d8ab91b2..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/particle/EffectRenderer.java.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/particle/EffectRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/particle/EffectRenderer.java -@@ -135,6 +135,7 @@ - - public void addEffect(EntityFX p_78873_1_) - { -+ if (p_78873_1_ == null) return; //Forge: Prevent modders from being bad and adding nulls causing untraceable NPEs. - int i = p_78873_1_.getFXLayer(); - int j = p_78873_1_.func_174838_j() != 1.0F ? 0 : 1; - -@@ -361,7 +362,7 @@ - - public void func_180533_a(BlockPos p_180533_1_, IBlockState p_180533_2_) - { -- if (p_180533_2_.getBlock().getMaterial() != Material.air) -+ if (!p_180533_2_.getBlock().isAir(worldObj, p_180533_1_) && !p_180533_2_.getBlock().addDestroyEffects(worldObj, p_180533_1_, this)) - { - p_180533_2_ = p_180533_2_.getBlock().getActualState(p_180533_2_, this.worldObj, p_180533_1_); - byte b0 = 4; -@@ -467,4 +468,13 @@ - - return "" + i; - } -+ -+ public void addBlockHitEffects(BlockPos pos, net.minecraft.util.MovingObjectPosition target) -+ { -+ Block block = worldObj.getBlockState(pos).getBlock(); -+ if (block != null && !block.addHitEffects(worldObj, target, this)) -+ { -+ addBlockHitEffects(pos, target.sideHit); -+ } -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch deleted file mode 100644 index 83192d8a5..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java -@@ -20,6 +20,7 @@ - import net.minecraft.world.IBlockAccess; - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; -+import static net.minecraft.client.renderer.BlockModelRenderer.Orientation.*; - - @SideOnly(Side.CLIENT) - public class BlockModelRenderer -@@ -556,8 +557,19 @@ - @SideOnly(Side.CLIENT) - public static enum EnumNeighborInfo - { -- DOWN(new EnumFacing[]{EnumFacing.WEST, EnumFacing.EAST, EnumFacing.NORTH, EnumFacing.SOUTH}, 0.5F, false, new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0]), -- UP(new EnumFacing[]{EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH}, 1.0F, false, new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0], new BlockModelRenderer.Orientation[0]), -+ // -- Forge Patch to Fix Top/Bottom Lighting Interpolation -- -+ // Forge PR - https://github.com/MinecraftForge/MinecraftForge/pull/1892 -+ // Mojang Bug - https://bugs.mojang.com/browse/MC-80148 -+ DOWN( new EnumFacing[]{ EnumFacing.WEST, EnumFacing.EAST, EnumFacing.NORTH, EnumFacing.SOUTH }, 0.5F, true, -+ new Orientation[]{ FLIP_WEST, Orientation.SOUTH, FLIP_WEST, FLIP_SOUTH, Orientation.WEST, FLIP_SOUTH, Orientation.WEST, Orientation.SOUTH }, -+ new Orientation[]{ FLIP_WEST, Orientation.NORTH, FLIP_WEST, FLIP_NORTH, Orientation.WEST, Orientation.FLIP_NORTH, Orientation.WEST, Orientation.NORTH }, -+ new Orientation[]{ FLIP_EAST, Orientation.NORTH, FLIP_EAST, FLIP_NORTH, Orientation.EAST, Orientation.FLIP_NORTH, Orientation.EAST, Orientation.NORTH }, -+ new Orientation[]{ FLIP_EAST, Orientation.SOUTH, FLIP_EAST, FLIP_SOUTH, Orientation.EAST, FLIP_SOUTH, Orientation.EAST, Orientation.SOUTH } ), -+ UP( new EnumFacing[]{ EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH }, 1.0F, true, -+ new Orientation[]{ Orientation.EAST, Orientation.SOUTH, Orientation.EAST, FLIP_SOUTH, FLIP_EAST, FLIP_SOUTH, FLIP_EAST, Orientation.SOUTH }, -+ new Orientation[]{ Orientation.EAST, Orientation.NORTH, Orientation.EAST, FLIP_NORTH, FLIP_EAST, FLIP_NORTH, FLIP_EAST, Orientation.NORTH }, -+ new Orientation[]{ Orientation.WEST, Orientation.NORTH, Orientation.WEST, FLIP_NORTH, FLIP_WEST, FLIP_NORTH, FLIP_WEST, Orientation.NORTH }, -+ new Orientation[]{ Orientation.WEST, Orientation.SOUTH, Orientation.WEST, FLIP_SOUTH, FLIP_WEST, FLIP_SOUTH, FLIP_WEST, Orientation.SOUTH } ), - NORTH(new EnumFacing[]{EnumFacing.UP, EnumFacing.DOWN, EnumFacing.EAST, EnumFacing.WEST}, 0.8F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_WEST}), - SOUTH(new EnumFacing[]{EnumFacing.WEST, EnumFacing.EAST, EnumFacing.DOWN, EnumFacing.UP}, 0.8F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.EAST}), - WEST(new EnumFacing[]{EnumFacing.UP, EnumFacing.DOWN, EnumFacing.NORTH, EnumFacing.SOUTH}, 0.6F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.SOUTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.SOUTH}), diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch deleted file mode 100644 index ae731a3e8..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/BlockModelShapes.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/BlockModelShapes.java -@@ -321,6 +321,7 @@ - return new ModelResourceLocation(s + "_double_slab", s1); - } - }); -+ net.minecraftforge.client.model.ModelLoader.onRegisterAllBlocks(this); - } - - @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch deleted file mode 100644 index 5890b09e3..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java -@@ -24,7 +24,7 @@ - { - private BlockModelShapes blockModelShapes; - private final GameSettings gameSettings; -- private final BlockModelRenderer blockModelRenderer = new BlockModelRenderer(); -+ private final BlockModelRenderer blockModelRenderer = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(); - private final ChestRenderer chestRenderer = new ChestRenderer(); - private final BlockFluidRenderer fluidRenderer = new BlockFluidRenderer(); - private static final String __OBFID = "CL_00002520"; -@@ -49,6 +49,24 @@ - { - p_175020_1_ = block.getActualState(p_175020_1_, p_175020_4_, p_175020_2_); - IBakedModel ibakedmodel = this.blockModelShapes.getModelForState(p_175020_1_); -+ -+ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartBlockModel) -+ { -+ IBlockState extendedState = block.getExtendedState(p_175020_1_, p_175020_4_, p_175020_2_); -+ for ( net.minecraft.util.EnumWorldBlockLayer layer : net.minecraft.util.EnumWorldBlockLayer.values() ) -+ { -+ if ( block.canRenderInLayer( layer ) ) -+ { -+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(layer); -+ -+ IBakedModel targetLayer = ((net.minecraftforge.client.model.ISmartBlockModel)ibakedmodel).handleBlockState(extendedState); -+ IBakedModel damageModel = (new SimpleBakedModel.Builder(targetLayer, p_175020_3_)).makeBakedModel(); -+ this.blockModelRenderer.renderModel(p_175020_4_, damageModel, p_175020_1_, p_175020_2_, Tessellator.getInstance().getWorldRenderer()); -+ } -+ } -+ return; -+ } -+ - IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(ibakedmodel, p_175020_3_)).makeBakedModel(); - this.blockModelRenderer.renderModel(p_175020_4_, ibakedmodel1, p_175020_1_, p_175020_2_, Tessellator.getInstance().getWorldRenderer()); - } -@@ -129,6 +147,12 @@ - ibakedmodel = ((WeightedBakedModel)ibakedmodel).getAlternativeModel(MathHelper.getPositionRandom(p_175022_3_)); - } - -+ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartBlockModel) -+ { -+ IBlockState extendedState = block.getExtendedState(p_175022_1_, p_175022_2_, p_175022_3_); -+ ibakedmodel = ((net.minecraftforge.client.model.ISmartBlockModel)ibakedmodel).handleBlockState(extendedState); -+ } -+ - return ibakedmodel; - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch deleted file mode 100644 index 24ac4e8e1..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch +++ /dev/null @@ -1,176 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/EntityRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/EntityRenderer.java -@@ -403,7 +403,7 @@ - - if (d3 < d2 || d2 == 0.0D) - { -- if (entity1 == entity.ridingEntity) -+ if (entity1 == entity.ridingEntity && !entity.canRiderInteract()) - { - if (d2 == 0.0D) - { -@@ -556,14 +556,8 @@ - { - BlockPos blockpos = new BlockPos(entity); - IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); -- Block block = iblockstate.getBlock(); -+ net.minecraftforge.client.ForgeHooksClient.orientBedCamera(this.mc.theWorld, blockpos, iblockstate, entity); - -- if (block == Blocks.bed) -- { -- int j = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex(); -- GlStateManager.rotate((float)(j * 90), 0.0F, 1.0F, 0.0F); -- } -- - GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_78467_1_ + 180.0F, 0.0F, -1.0F, 0.0F); - GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_78467_1_, -1.0F, 0.0F, 0.0F); - } -@@ -630,17 +624,20 @@ - - if (!this.mc.gameSettings.debugCamEnable) - { -- GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_78467_1_, 1.0F, 0.0F, 0.0F); -- -+ float yaw = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_78467_1_ + 180.0F; -+ float pitch = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_78467_1_; -+ float roll = 0.0F; - if (entity instanceof EntityAnimal) - { - EntityAnimal entityanimal = (EntityAnimal)entity; -- GlStateManager.rotate(entityanimal.prevRotationYawHead + (entityanimal.rotationYawHead - entityanimal.prevRotationYawHead) * p_78467_1_ + 180.0F, 0.0F, 1.0F, 0.0F); -+ yaw = entityanimal.prevRotationYawHead + (entityanimal.rotationYawHead - entityanimal.prevRotationYawHead) * p_78467_1_ + 180.0F; - } -- else -- { -- GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_78467_1_ + 180.0F, 0.0F, 1.0F, 0.0F); -- } -+ Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, p_78467_1_); -+ net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup event = new net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup(this, entity, block, p_78467_1_, yaw, pitch, roll); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ GlStateManager.rotate(event.roll, 0.0F, 0.0F, 1.0F); -+ GlStateManager.rotate(event.pitch, 1.0F, 0.0F, 0.0F); -+ GlStateManager.rotate(event.yaw, 0.0F, 1.0F, 0.0F); - } - - GlStateManager.translate(0.0F, -f1, 0.0F); -@@ -1081,7 +1078,7 @@ - - try - { -- this.mc.currentScreen.drawScreen(l, i1, partialTicks); -+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.mc.currentScreen, l, i1, partialTicks); - } - catch (Throwable throwable) - { -@@ -1145,7 +1142,7 @@ - - if (this.mc.playerController.getCurrentGameType() == WorldSettings.GameType.SPECTATOR) - { -- flag = block.hasTileEntity() && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory; -+ flag = block.hasTileEntity(this.mc.theWorld.getBlockState(blockpos)) && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory; - } - else - { -@@ -1296,7 +1293,9 @@ - GlStateManager.pushMatrix(); - RenderHelper.enableStandardItemLighting(); - this.mc.mcProfiler.endStartSection("entities"); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); - renderglobal.renderEntities(entity, frustum, partialTicks); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0); - RenderHelper.disableStandardItemLighting(); - this.disableLightmap(); - GlStateManager.matrixMode(5888); -@@ -1308,6 +1307,7 @@ - entityplayer = (EntityPlayer)entity; - GlStateManager.disableAlpha(); - this.mc.mcProfiler.endStartSection("outline"); -+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, entityplayer.getHeldItem(), partialTicks)) - renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); - GlStateManager.enableAlpha(); - } -@@ -1321,6 +1321,7 @@ - entityplayer = (EntityPlayer)entity; - GlStateManager.disableAlpha(); - this.mc.mcProfiler.endStartSection("outline"); -+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, entityplayer.getHeldItem(), partialTicks)) - renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); - GlStateManager.enableAlpha(); - } -@@ -1373,6 +1374,16 @@ - renderglobal.renderBlockLayer(EnumWorldBlockLayer.TRANSLUCENT, (double)partialTicks, pass, entity); - } - -+ if (!this.debugView) //Only render if render pass 0 happens as well. -+ { -+ RenderHelper.enableStandardItemLighting(); -+ this.mc.mcProfiler.endStartSection("entities"); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(1); -+ renderglobal.renderEntities(entity, frustum, partialTicks); -+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(-1); -+ RenderHelper.disableStandardItemLighting(); -+ } -+ - GlStateManager.shadeModel(7424); - GlStateManager.depthMask(true); - GlStateManager.enableCull(); -@@ -1385,8 +1396,12 @@ - this.renderCloudsCheck(renderglobal, partialTicks, pass); - } - -+ this.mc.mcProfiler.endStartSection("forge_render_last"); -+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(renderglobal, partialTicks); -+ - this.mc.mcProfiler.endStartSection("hand"); - -+ if (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(renderglobal, partialTicks, pass)) - if (this.renderHand) - { - GlStateManager.clear(256); -@@ -1498,6 +1513,13 @@ - - protected void renderRainSnow(float partialTicks) - { -+ net.minecraftforge.client.IRenderHandler renderer = this.mc.theWorld.provider.getWeatherRenderer(); -+ if (renderer != null) -+ { -+ renderer.render(partialTicks, this.mc.theWorld, mc); -+ return; -+ } -+ - float f1 = this.mc.theWorld.getRainStrength(partialTicks); - - if (f1 > 0.0F) -@@ -1835,6 +1857,13 @@ - this.fogColorBlue = f8; - } - -+ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, entity, block, partialTicks, this.fogColorRed, this.fogColorGreen, this.fogColorBlue); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); -+ -+ this.fogColorRed = event.red; -+ this.fogColorGreen = event.green; -+ this.fogColorBlue = event.blue; -+ - GlStateManager.clearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F); - } - -@@ -1854,6 +1883,10 @@ - Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); - float f1; - -+ float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, entity, block, partialTicks, 0.1F); -+ if (hook >= 0) -+ GlStateManager.setFogDensity(hook); -+ else - if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.blindness)) - { - f1 = 5.0F; -@@ -1931,6 +1964,7 @@ - GlStateManager.setFogStart(f1 * 0.05F); - GlStateManager.setFogEnd(Math.min(f1, 192.0F) * 0.5F); - } -+ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, entity, block, partialTicks, p_78468_1_, f1); - } - - GlStateManager.enableColorMaterial(); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch deleted file mode 100644 index c9a499ab0..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java -@@ -83,6 +83,8 @@ - this.drawTexturedModalRect(i + 6, j + 7, 0 + l % 8 * 18, 198 + l / 8 * 18, 18, 18); - } - -+ potion.renderInventoryEffect(i, j, potioneffect, mc); -+ if (!potion.shouldRenderInvText(potioneffect)) continue; - String s1 = I18n.format(potion.getName(), new Object[0]); - - if (potioneffect.getAmplifier() == 1) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch deleted file mode 100644 index a71a73e5c..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/ItemModelMesher.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/ItemModelMesher.java -@@ -52,6 +52,11 @@ - } - } - -+ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartItemModel) -+ { -+ ibakedmodel = ((net.minecraftforge.client.model.ISmartItemModel)ibakedmodel).handleItemState(stack); -+ } -+ - if (ibakedmodel == null) - { - ibakedmodel = this.modelManager.getMissingModel(); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch deleted file mode 100644 index cee99ddff..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ /dev/null @@ -1,65 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/ItemRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/ItemRenderer.java -@@ -308,7 +308,7 @@ - - if (this.itemToRender != null) - { -- if (this.itemToRender.getItem() == Items.filled_map) -+ if (this.itemToRender.getItem() instanceof net.minecraft.item.ItemMap) - { - this.func_178097_a(entityplayersp, f3, f1, f2); - } -@@ -359,7 +359,8 @@ - - if (this.mc.thePlayer.isEntityInsideOpaqueBlock()) - { -- IBlockState iblockstate = this.mc.theWorld.getBlockState(new BlockPos(this.mc.thePlayer)); -+ BlockPos blockpos = new BlockPos(this.mc.thePlayer); -+ IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); - EntityPlayerSP entityplayersp = this.mc.thePlayer; - - for (int i = 0; i < 8; ++i) -@@ -367,7 +368,7 @@ - double d0 = entityplayersp.posX + (double)(((float)((i >> 0) % 2) - 0.5F) * entityplayersp.width * 0.8F); - double d1 = entityplayersp.posY + (double)(((float)((i >> 1) % 2) - 0.5F) * 0.1F); - double d2 = entityplayersp.posZ + (double)(((float)((i >> 2) % 2) - 0.5F) * entityplayersp.width * 0.8F); -- BlockPos blockpos = new BlockPos(d0, d1 + (double)entityplayersp.getEyeHeight(), d2); -+ blockpos = new BlockPos(d0, d1 + (double)entityplayersp.getEyeHeight(), d2); - IBlockState iblockstate1 = this.mc.theWorld.getBlockState(blockpos); - - if (iblockstate1.getBlock().isVisuallyOpaque()) -@@ -378,6 +379,7 @@ - - if (iblockstate.getBlock().getRenderType() != -1) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(mc.thePlayer, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, blockpos)) - this.func_178108_a(p_78447_1_, this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate)); - } - } -@@ -386,11 +388,13 @@ - { - if (this.mc.thePlayer.isInsideOfMaterial(Material.water)) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderWaterOverlay(mc.thePlayer, p_78447_1_)) - this.renderWaterOverlayTexture(p_78447_1_); - } - - if (this.mc.thePlayer.isBurning()) - { -+ if (!net.minecraftforge.event.ForgeEventFactory.renderFireOverlay(mc.thePlayer, p_78447_1_)) - this.renderFireInFirstPerson(p_78447_1_); - } - } -@@ -507,6 +511,12 @@ - { - if (!this.itemToRender.getIsItemStackEqual(itemstack)) - { -+ if (!this.itemToRender.getItem().shouldCauseReequipAnimation(this.itemToRender, itemstack, equippedItemSlot != entityplayersp.inventory.currentItem)) -+ { -+ this.itemToRender = itemstack; -+ this.equippedItemSlot = entityplayersp.inventory.currentItem; -+ return; -+ } - flag = true; - } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch deleted file mode 100644 index 22beb0e0f..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/OpenGlHelper.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/OpenGlHelper.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/OpenGlHelper.java -@@ -78,6 +78,10 @@ - public static int GL_STATIC_DRAW; - private static final String __OBFID = "CL_00001179"; - -+ /* Stores the last values sent into setLightmapTextureCoords */ -+ public static float lastBrightnessX = 0.0f; -+ public static float lastBrightnessY = 0.0f; -+ - public static void initializeTextures() - { - ContextCapabilities contextcapabilities = GLContext.getCapabilities(); -@@ -813,6 +817,12 @@ - { - GL13.glMultiTexCoord2f(p_77475_0_, p_77475_1_, p_77475_2_); - } -+ -+ if (p_77475_0_ == lightmapTexUnit) -+ { -+ lastBrightnessX = p_77475_1_; -+ lastBrightnessY = p_77475_2_; -+ } - } - - public static void glBlendFunc(int p_148821_0_, int p_148821_1_, int p_148821_2_, int p_148821_3_) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch deleted file mode 100644 index 15582220b..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/RenderGlobal.java.patch +++ /dev/null @@ -1,134 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/RenderGlobal.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/RenderGlobal.java -@@ -517,8 +517,10 @@ - - public void renderEntities(Entity p_180446_1_, ICamera p_180446_2_, float partialTicks) - { -+ int pass = net.minecraftforge.client.MinecraftForgeClient.getRenderPass(); - if (this.renderEntitiesStartupCounter > 0) - { -+ if (pass > 0) return; - --this.renderEntitiesStartupCounter; - } - else -@@ -529,9 +531,12 @@ - this.theWorld.theProfiler.startSection("prepare"); - TileEntityRendererDispatcher.instance.cacheActiveRenderInfo(this.theWorld, this.mc.getTextureManager(), this.mc.fontRendererObj, this.mc.getRenderViewEntity(), partialTicks); - this.renderManager.cacheActiveRenderInfo(this.theWorld, this.mc.fontRendererObj, this.mc.getRenderViewEntity(), this.mc.pointedEntity, this.mc.gameSettings, partialTicks); -+ if (pass == 0) // no indentation to shrink patch -+ { - this.countEntitiesTotal = 0; - this.countEntitiesRendered = 0; - this.countEntitiesHidden = 0; -+ } - Entity entity1 = this.mc.getRenderViewEntity(); - double d3 = entity1.lastTickPosX + (entity1.posX - entity1.lastTickPosX) * (double)partialTicks; - double d4 = entity1.lastTickPosY + (entity1.posY - entity1.lastTickPosY) * (double)partialTicks; -@@ -543,13 +548,17 @@ - this.mc.entityRenderer.enableLightmap(); - this.theWorld.theProfiler.endStartSection("global"); - List list = this.theWorld.getLoadedEntityList(); -+ if (pass == 0) // no indentation to shrink patch -+ { - this.countEntitiesTotal = list.size(); -+ } - int i; - Entity entity2; - - for (i = 0; i < this.theWorld.weatherEffects.size(); ++i) - { - entity2 = (Entity)this.theWorld.weatherEffects.get(i); -+ if (!entity2.shouldRenderInPass(pass)) continue; - ++this.countEntitiesRendered; - - if (entity2.isInRangeToRender3d(d0, d1, d2)) -@@ -571,6 +580,7 @@ - for (i = 0; i < list.size(); ++i) - { - entity2 = (Entity)list.get(i); -+ if (!entity2.shouldRenderInPass(pass)) continue; - boolean flag = this.mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping(); - boolean flag1 = entity2.isInRangeToRender3d(d0, d1, d2) && (entity2.ignoreFrustumCheck || p_180446_2_.isBoundingBoxInFrustum(entity2.getEntityBoundingBox()) || entity2.riddenByEntity == this.mc.thePlayer) && entity2 instanceof EntityPlayer; - -@@ -605,6 +615,7 @@ - while (iterator2.hasNext()) - { - Entity entity3 = (Entity)iterator2.next(); -+ if (!entity3.shouldRenderInPass(pass)) continue; - boolean flag2 = this.renderManager.shouldRender(entity3, p_180446_2_, d0, d1, d2) || entity3.riddenByEntity == this.mc.thePlayer; - - if (flag2) -@@ -640,6 +651,7 @@ - while (iterator1.hasNext()) - { - tileentity = (TileEntity)iterator1.next(); -+ if (!tileentity.shouldRenderInPass(pass) || !p_180446_2_.isBoundingBoxInFrustum(tileentity.getRenderBoundingBox())) continue; - TileEntityRendererDispatcher.instance.renderTileEntity(tileentity, partialTicks, -1); - } - } -@@ -671,7 +683,7 @@ - - Block block = this.theWorld.getBlockState(blockpos).getBlock(); - -- if (tileentity != null && (block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull)) -+ if (tileentity != null && tileentity.shouldRenderInPass(pass) && tileentity.canRenderBreaking() && p_180446_2_.isBoundingBoxInFrustum(tileentity.getRenderBoundingBox())) - { - TileEntityRendererDispatcher.instance.renderTileEntity(tileentity, partialTicks, destroyblockprogress.getPartialBlockDamage()); - } -@@ -1151,6 +1163,12 @@ - - public void renderSky(float partialTicks, int pass) - { -+ net.minecraftforge.client.IRenderHandler renderer = this.theWorld.provider.getSkyRenderer(); -+ if (renderer != null) -+ { -+ renderer.render(partialTicks, theWorld, mc); -+ return; -+ } - if (this.mc.theWorld.provider.getDimensionId() == 1) - { - this.renderSkyEnd(); -@@ -1381,6 +1399,12 @@ - - public void renderClouds(float p_180447_1_, int p_180447_2_) - { -+ net.minecraftforge.client.IRenderHandler renderer = this.mc.theWorld.provider.getCloudRenderer(); -+ if (renderer != null) -+ { -+ renderer.render(p_180447_1_, this.mc.theWorld, mc); -+ return; -+ } - if (this.mc.theWorld.provider.isSurfaceWorld()) - { - if (this.mc.gameSettings.fancyGraphics) -@@ -1805,8 +1829,11 @@ - double d4 = (double)blockpos.getY() - d1; - double d5 = (double)blockpos.getZ() - d2; - Block block = this.theWorld.getBlockState(blockpos).getBlock(); -+ TileEntity te = this.theWorld.getTileEntity(blockpos); -+ boolean hasBreak = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull; -+ if (!hasBreak) hasBreak = te != null && te.canRenderBreaking(); - -- if (!(block instanceof BlockChest) && !(block instanceof BlockEnderChest) && !(block instanceof BlockSign) && !(block instanceof BlockSkull)) -+ if (!hasBreak) - { - if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) - { -@@ -1949,13 +1976,16 @@ - if (recordName != null) - { - ItemRecord itemrecord = ItemRecord.getRecord(recordName); -+ ResourceLocation resource = null; - - if (itemrecord != null) - { - this.mc.ingameGUI.setRecordPlayingMessage(itemrecord.getRecordNameLocal()); -+ resource = itemrecord.getRecordResource(recordName); - } - -- PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(new ResourceLocation(recordName), (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ()); -+ if (resource == null) resource = new ResourceLocation(recordName); -+ PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(resource, (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ()); - this.mapSoundPositions.put(blockPosIn, positionedsoundrecord); - this.mc.getSoundHandler().playSound(positionedsoundrecord); - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch deleted file mode 100644 index 2f3b084ad..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/WorldRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/WorldRenderer.java -@@ -520,6 +520,14 @@ - } - } - -+ public void checkAndGrow() -+ { -+ if (this.rawBufferIndex >= this.bufferSize - this.vertexFormat.getNextOffset()) -+ { -+ this.growBuffer(2097152); -+ } -+ } -+ - @SideOnly(Side.CLIENT) - public class State - { diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch deleted file mode 100644 index 548fa5d6d..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch +++ /dev/null @@ -1,70 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java -@@ -29,35 +29,9 @@ - - while (iterator.hasNext()) - { -+ // moved to VertexFormatElement.preDraw - vertexformatelement = (VertexFormatElement)iterator.next(); -- enumusage = vertexformatelement.getUsage(); -- k = vertexformatelement.getType().getGlConstant(); -- int l = vertexformatelement.getIndex(); -- -- switch (WorldVertexBufferUploader.SwitchEnumUsage.VALUES[enumusage.ordinal()]) -- { -- case 1: -- bytebuffer.position(vertexformatelement.getOffset()); -- GL11.glVertexPointer(vertexformatelement.getElementCount(), k, j, bytebuffer); -- GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); -- break; -- case 2: -- bytebuffer.position(vertexformatelement.getOffset()); -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + l); -- GL11.glTexCoordPointer(vertexformatelement.getElementCount(), k, j, bytebuffer); -- GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); -- break; -- case 3: -- bytebuffer.position(vertexformatelement.getOffset()); -- GL11.glColorPointer(vertexformatelement.getElementCount(), k, j, bytebuffer); -- GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); -- break; -- case 4: -- bytebuffer.position(vertexformatelement.getOffset()); -- GL11.glNormalPointer(k, j, bytebuffer); -- GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY); -- } -+ vertexformatelement.getUsage().preDraw(vertexformatelement, j, bytebuffer); - } - - GL11.glDrawArrays(p_178177_1_.getDrawMode(), 0, p_178177_1_.getVertexCount()); -@@ -65,27 +39,9 @@ - - while (iterator.hasNext()) - { -+ // moved to VertexFormatElement.postDraw - vertexformatelement = (VertexFormatElement)iterator.next(); -- enumusage = vertexformatelement.getUsage(); -- k = vertexformatelement.getIndex(); -- -- switch (WorldVertexBufferUploader.SwitchEnumUsage.VALUES[enumusage.ordinal()]) -- { -- case 1: -- GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); -- break; -- case 2: -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + k); -- GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); -- OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); -- break; -- case 3: -- GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); -- GlStateManager.resetColor(); -- break; -- case 4: -- GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); -- } -+ vertexformatelement.getUsage().postDraw(vertexformatelement, j, bytebuffer); - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch deleted file mode 100644 index 97dc4cd38..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java -@@ -5,8 +5,9 @@ - import net.minecraftforge.fml.relauncher.SideOnly; - - @SideOnly(Side.CLIENT) --public class BakedQuad -+public class BakedQuad implements net.minecraftforge.client.model.pipeline.IVertexProducer - { -+ @Override public void pipe(net.minecraftforge.client.model.pipeline.IVertexConsumer consumer) { net.minecraftforge.client.model.pipeline.LightUtil.putBakedQuad(consumer, this); } - protected final int[] vertexData; - protected final int tintIndex; - protected final EnumFacing face; diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch deleted file mode 100644 index 530af67af..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java.patch +++ /dev/null @@ -1,68 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java -@@ -22,6 +22,11 @@ - - public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) - { -+ return makeBakedQuad(posFrom, posTo, face, sprite, facing, (net.minecraftforge.client.model.ITransformation)modelRotationIn, partRotation, uvLocked, shade); -+ } -+ -+ public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) -+ { - int[] aint = this.makeQuadVertexData(face, sprite, facing, this.getPositionsDiv16(posFrom, posTo), modelRotationIn, partRotation, uvLocked, shade); - EnumFacing enumfacing1 = getFacingFromVertexData(aint); - -@@ -35,11 +40,17 @@ - this.func_178408_a(aint, enumfacing1); - } - -+ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing1); - return new BakedQuad(aint, face.tintIndex, enumfacing1); - } - - private int[] makeQuadVertexData(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, ModelRotation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean shade) - { -+ return makeQuadVertexData(p_178405_1_, p_178405_2_, p_178405_3_, p_178405_4_, (net.minecraftforge.client.model.ITransformation)p_178405_5_, p_178405_6_, p_178405_7_, shade); -+ } -+ -+ private int[] makeQuadVertexData(BlockPartFace p_178405_1_, TextureAtlasSprite p_178405_2_, EnumFacing p_178405_3_, float[] p_178405_4_, net.minecraftforge.client.model.ITransformation p_178405_5_, BlockPartRotation p_178405_6_, boolean p_178405_7_, boolean shade) -+ { - int[] aint = new int[28]; - - for (int i = 0; i < 4; ++i) -@@ -90,7 +101,12 @@ - - private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) - { -- EnumFacing enumfacing1 = modelRotationIn.rotateFace(facing); -+ fillVertexData(faceData, vertexIndex, facing, partFace, p_178402_5_, sprite, (net.minecraftforge.client.model.ITransformation)modelRotationIn, partRotation, uvLocked, shade); -+ } -+ -+ private void fillVertexData(int[] faceData, int vertexIndex, EnumFacing facing, BlockPartFace partFace, float[] p_178402_5_, TextureAtlasSprite sprite, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) -+ { -+ EnumFacing enumfacing1 = modelRotationIn.rotate(facing); - int j = shade ? this.getFaceShadeColor(enumfacing1) : -1; - EnumFaceDirection.VertexInformation vertexinformation = EnumFaceDirection.getFacing(facing).func_179025_a(vertexIndex); - Vector3d vector3d = new Vector3d((double)p_178402_5_[vertexinformation.field_179184_a], (double)p_178402_5_[vertexinformation.field_179182_b], (double)p_178402_5_[vertexinformation.field_179183_c]); -@@ -156,14 +172,19 @@ - - public int rotateVertex(Vector3d position, EnumFacing facing, int vertexIndex, ModelRotation modelRotationIn, boolean uvLocked) - { -+ return rotateVertex(position, facing, vertexIndex, (net.minecraftforge.client.model.ITransformation)modelRotationIn, uvLocked); -+ } -+ -+ public int rotateVertex(Vector3d position, EnumFacing facing, int vertexIndex, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) -+ { - if (modelRotationIn == ModelRotation.X0_Y0) - { - return vertexIndex; - } - else - { -- this.rotateScale(position, new Vector3d(0.5D, 0.5D, 0.5D), modelRotationIn.getMatrix4d(), new Vector3d(1.0D, 1.0D, 1.0D)); -- return modelRotationIn.rotateVertex(facing, vertexIndex); -+ net.minecraftforge.client.ForgeHooksClient.transform(position, modelRotationIn.getMatrix()); -+ return modelRotationIn.rotate(facing, vertexIndex); - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch deleted file mode 100644 index 5641c8a60..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java -@@ -8,7 +8,11 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - -+/* -+ * @deprecated use {@link net.minecraftforge.client.model.IPerspectiveAwareModel} instead -+ */ - @SideOnly(Side.CLIENT) -+@Deprecated - public class ItemCameraTransforms - { - public static final ItemCameraTransforms DEFAULT = new ItemCameraTransforms(ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch deleted file mode 100644 index 81410fc8c..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java -@@ -13,9 +13,14 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - -+/* -+ * @deprecated use {@link net.minecraftforge.client.model.IModelState} and {@link net.minecraftforge.client.model.TRSRTransformation} -+ */ - @SideOnly(Side.CLIENT) --public class ItemTransformVec3f -+@Deprecated -+public class ItemTransformVec3f implements net.minecraftforge.client.model.IModelState - { -+ public net.minecraftforge.client.model.TRSRTransformation apply(net.minecraftforge.client.model.IModelPart part) { return new net.minecraftforge.client.model.TRSRTransformation(this); } - public static final ItemTransformVec3f DEFAULT = new ItemTransformVec3f(new Vector3f(), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F)); - public final Vector3f rotation; - public final Vector3f translation; diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch deleted file mode 100644 index 63ac31ca9..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java -@@ -32,7 +32,7 @@ - - public static ModelBlockDefinition parseFromReader(Reader p_178331_0_) - { -- return (ModelBlockDefinition)GSON.fromJson(p_178331_0_, ModelBlockDefinition.class); -+ return net.minecraftforge.client.model.BlockStateLoader.load(p_178331_0_, GSON); - } - - public ModelBlockDefinition(Collection p_i46221_1_) -@@ -178,11 +178,17 @@ - return this.modelLocation; - } - -+ @Deprecated - public ModelRotation getRotation() - { - return this.modelRotation; - } - -+ public net.minecraftforge.client.model.IModelState getState() -+ { -+ return this.modelRotation; -+ } -+ - public boolean isUvLocked() - { - return this.uvLock; diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch deleted file mode 100644 index 543153388..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java -@@ -40,7 +40,7 @@ - } - else - { -- s = this.property.getName((Comparable)linkedhashmap.remove(this.property)); -+ s = String.format("%s:%s", ((ResourceLocation)Block.blockRegistry.getNameForObject(p_178132_1_.getBlock())).getResourceDomain(), this.property.getName((Comparable)linkedhashmap.remove(this.property))); - } - - if (this.suffix != null) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch deleted file mode 100644 index b176e3567..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java -@@ -124,7 +124,7 @@ - return; - } - -- regionrendercache = new RegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1); -+ regionrendercache = createRegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1); - p_178581_4_.setCompiledChunk(compiledchunk); - } - finally -@@ -150,7 +150,7 @@ - visgraph.func_178606_a(mutableblockpos); - } - -- if (block.hasTileEntity()) -+ if (block.hasTileEntity(iblockstate)) - { - TileEntity tileentity = regionrendercache.getTileEntity(new BlockPos(mutableblockpos)); - -@@ -160,7 +160,9 @@ - } - } - -- EnumWorldBlockLayer enumworldblocklayer1 = block.getBlockLayer(); -+ for(EnumWorldBlockLayer enumworldblocklayer1 : EnumWorldBlockLayer.values()) { -+ if(!block.canRenderInLayer(enumworldblocklayer1)) continue; -+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(enumworldblocklayer1); - int i = enumworldblocklayer1.ordinal(); - - if (block.getRenderType() != -1) -@@ -178,6 +180,7 @@ - compiledchunk.setLayerUsed(enumworldblocklayer1); - } - } -+ } - } - - EnumWorldBlockLayer[] aenumworldblocklayer = EnumWorldBlockLayer.values(); -@@ -374,4 +377,24 @@ - { - return this.needsUpdate; - } -+ -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * Creates a new RegionRenderCache instance.
-+ * Extending classes can change the behavior of the cache, allowing to visually change -+ * blocks (schematics etc). -+ * -+ * @see RegionRenderCache -+ * @param world The world to cache. -+ * @param from The starting position of the chunk minus one on each axis. -+ * @param to The ending position of the chunk plus one on each axis. -+ * @param subtract Padding used internally by the RegionRenderCache constructor to make -+ * the cache a 20x20x20 cube, for a total of 8000 states in the cache. -+ * @return new RegionRenderCache instance -+ */ -+ protected RegionRenderCache createRegionRenderCache(World world, BlockPos from, BlockPos to, int subtract) -+ { -+ return new RegionRenderCache(world, from, to, subtract); -+ } -+ /* ========================================= FORGE END ======================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch deleted file mode 100644 index 35faeffcb..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java -@@ -42,7 +42,7 @@ - boolean flag = p_177077_9_.isGui3d(); - int i = this.func_177078_a(itemstack); - float f1 = 0.25F; -- float f2 = MathHelper.sin(((float)p_177077_1_.getAge() + p_177077_8_) / 10.0F + p_177077_1_.hoverStart) * 0.1F + 0.1F; -+ float f2 = shouldBob() ? MathHelper.sin(((float)p_177077_1_.getAge() + p_177077_8_) / 10.0F + p_177077_1_.hoverStart) * 0.1F + 0.1F : 0.0F; - GlStateManager.translate((float)p_177077_2_, (float)p_177077_4_ + f2 + 0.25F, (float)p_177077_6_); - float f3; - -@@ -129,6 +129,14 @@ - } - else - { -+ // Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug... -+ if (j > 0 && shouldSpreadItems()) -+ { -+ float f2 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; -+ float f3 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; -+ float f4 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; -+ GlStateManager.translate(f2, f3, 0); -+ } - this.field_177080_a.renderItem(itemstack, ibakedmodel); - GlStateManager.translate(0.0F, 0.0F, 0.046875F); - } -@@ -161,4 +169,25 @@ - { - this.func_177075_a((EntityItem)entity, x, y, z, p_76986_8_, partialTicks); - } -+ -+ /*==================================== FORGE START ===========================================*/ -+ -+ /** -+ * Items should spread out when rendered in 3d? -+ * @return -+ */ -+ public boolean shouldSpreadItems() -+ { -+ return true; -+ } -+ -+ /** -+ * Items should have a bob effect -+ * @return -+ */ -+ public boolean shouldBob() -+ { -+ return true; -+ } -+ /*==================================== FORGE END =============================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch deleted file mode 100644 index 715166828..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderItem.java.patch +++ /dev/null @@ -1,128 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderItem.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderItem.java -@@ -83,7 +83,7 @@ - public RenderItem(TextureManager textureManager, ModelManager modelManager) - { - this.textureManager = textureManager; -- this.itemModelMesher = new ItemModelMesher(modelManager); -+ this.itemModelMesher = new net.minecraftforge.client.ItemModelMesherForge(modelManager); - this.registerItems(); - } - -@@ -222,7 +222,7 @@ - BakedQuad bakedquad; - int j; - -- for (Iterator iterator = quads.iterator(); iterator.hasNext(); this.renderQuad(renderer, bakedquad, j)) -+ for (Iterator iterator = quads.iterator(); iterator.hasNext(); net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(renderer, bakedquad, j)) - { - bakedquad = (BakedQuad)iterator.next(); - j = color; -@@ -302,6 +302,10 @@ - modelresourcelocation = new ModelResourceLocation("bow_pulling_0", "inventory"); - } - } -+ else -+ { -+ modelresourcelocation = item.getModel(stack, entityplayer, entityplayer.getItemInUseCount()); -+ } - - if (modelresourcelocation != null) - { -@@ -314,6 +318,11 @@ - - protected void applyTransform(ItemTransformVec3f transform) - { -+ applyVanillaTransform(transform); -+ } -+ -+ public static void applyVanillaTransform(ItemTransformVec3f transform) -+ { - if (transform != ItemTransformVec3f.DEFAULT) - { - GlStateManager.translate(transform.translation.x + debugItemOffsetX, transform.translation.y + debugItemOffsetY, transform.translation.z + debugItemOffsetZ); -@@ -335,23 +344,7 @@ - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - GlStateManager.pushMatrix(); - -- switch (RenderItem.SwitchTransformType.TRANSFORM_LOOKUP[cameraTransformType.ordinal()]) -- { -- case 1: -- default: -- break; -- case 2: -- this.applyTransform(model.getItemCameraTransforms().thirdPerson); -- break; -- case 3: -- this.applyTransform(model.getItemCameraTransforms().firstPerson); -- break; -- case 4: -- this.applyTransform(model.getItemCameraTransforms().head); -- break; -- case 5: -- this.applyTransform(model.getItemCameraTransforms().gui); -- } -+ model = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(model, cameraTransformType); - - this.renderItem(stack, model); - GlStateManager.popMatrix(); -@@ -374,7 +367,7 @@ - GlStateManager.blendFunc(770, 771); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - this.setupGuiTransform(x, y, ibakedmodel.isGui3d()); -- this.applyTransform(ibakedmodel.getItemCameraTransforms().gui); -+ ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GUI); - this.renderItem(stack, ibakedmodel); - GlStateManager.disableAlpha(); - GlStateManager.disableRescaleNormal(); -@@ -485,10 +478,11 @@ - GlStateManager.enableDepth(); - } - -- if (stack.isItemDamaged()) -+ if (stack.getItem().showDurabilityBar(stack)) - { -- int j1 = (int)Math.round(13.0D - (double)stack.getItemDamage() * 13.0D / (double)stack.getMaxDamage()); -- int k = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage()); -+ double health = stack.getItem().getDurabilityForDisplay(stack); -+ int j1 = (int)Math.round(13.0D - health * 13.0D); -+ int k = (int)Math.round(255.0D - health * 255.0D); - GlStateManager.disableLighting(); - GlStateManager.disableDepth(); - GlStateManager.disableTexture2D(); -@@ -501,7 +495,7 @@ - this.drawRect(worldrenderer, xPosition + 2, yPosition + 13, 13, 2, 0); - this.drawRect(worldrenderer, xPosition + 2, yPosition + 13, 12, 1, i1); - this.drawRect(worldrenderer, xPosition + 2, yPosition + 13, j1, 1, l); -- GlStateManager.enableBlend(); -+ //GlStateManager.enableBlend(); // Forge: Disable Bled because it screws with a lot of things down the line. - GlStateManager.enableAlpha(); - GlStateManager.enableTexture2D(); - GlStateManager.enableLighting(); -@@ -1072,12 +1066,26 @@ - this.registerBlock(Blocks.brown_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "brown_mushroom_block"); - this.registerBlock(Blocks.red_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "red_mushroom_block"); - this.registerBlock(Blocks.dragon_egg, "dragon_egg"); -+ net.minecraftforge.client.model.ModelLoader.onRegisterItems(this.itemModelMesher); - } - - public void onResourceManagerReload(IResourceManager resourceManager) - { - this.itemModelMesher.rebuildCache(); - } -+ /*==================================== FORGE START ===========================================* / -+ private static RenderItem instance; -+ /** -+ * Returns a single lazy loaded instance of RenderItem, for use in mods who -+ * don't care about the interaction of other objects on the current state of the RenderItem they are using. -+ * @return A global instance of RenderItem -+ * / -+ public static RenderItem getInstance() -+ { -+ if (instance == null) instance = new RenderItem(); -+ return instance; -+ } -+ /*==================================== FORGE END =============================================*/ - - @SideOnly(Side.CLIENT) - diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch deleted file mode 100644 index 7513d3e08..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderManager.java.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java -@@ -193,6 +193,10 @@ - this.skinMap.put("default", this.field_178637_m); - this.skinMap.put("slim", new RenderPlayer(this, true)); - } -+ -+ public Map getSkinMap() { -+ return (Map) java.util.Collections.unmodifiableMap(skinMap); -+ } - - public void setRenderPosition(double p_178628_1_, double p_178628_3_, double p_178628_5_) - { -@@ -241,9 +245,9 @@ - IBlockState iblockstate = worldIn.getBlockState(new BlockPos(p_180597_3_)); - Block block = iblockstate.getBlock(); - -- if (block == Blocks.bed) -+ if (block.isBed(worldIn, new BlockPos(p_180597_3_), (EntityLivingBase)p_180597_3_)) - { -- int i = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex(); -+ int i = block.getBedDirection(worldIn, new BlockPos(p_180597_3_)).getHorizontalIndex(); - this.playerViewY = (float)(i * 90 + 180); - this.playerViewX = 0.0F; - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch deleted file mode 100644 index 5d1296a17..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java -@@ -53,6 +53,7 @@ - - public void func_180596_a(AbstractClientPlayer p_180596_1_, double p_180596_2_, double p_180596_4_, double p_180596_6_, float p_180596_8_, float p_180596_9_) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(p_180596_1_, this, p_180596_9_, p_180596_2_, p_180596_4_, p_180596_6_))) return; - if (!p_180596_1_.isUser() || this.renderManager.livingPlayer == p_180596_1_) - { - double d3 = p_180596_4_; -@@ -65,6 +66,7 @@ - this.func_177137_d(p_180596_1_); - super.doRender((EntityLivingBase)p_180596_1_, p_180596_2_, d3, p_180596_6_, p_180596_8_, p_180596_9_); - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(p_180596_1_, this, p_180596_9_, p_180596_2_, p_180596_4_, p_180596_6_)); - } - - private void func_177137_d(AbstractClientPlayer p_177137_1_) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch deleted file mode 100644 index 3b71964a4..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java -@@ -48,7 +48,7 @@ - case 4: - return butcherVillagerTextures; - default: -- return villagerTextures; -+ return net.minecraftforge.fml.common.registry.VillagerRegistry.getVillagerSkin(entity.getProfession(), villagerTextures); - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch deleted file mode 100644 index f151beeef..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java -@@ -40,6 +40,9 @@ - protected boolean renderOutlines = false; - private static final String __OBFID = "CL_00001012"; - -+ public static float NAME_TAG_RANGE = 64.0f; -+ public static float NAME_TAG_RANGE_SNEAK = 32.0f; -+ - public RendererLivingEntity(RenderManager p_i46156_1_, ModelBase p_i46156_2_, float p_i46156_3_) - { - super(p_i46156_1_); -@@ -83,6 +86,7 @@ - - public void doRender(EntityLivingBase entity, double x, double y, double z, float p_76986_8_, float partialTicks) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre(entity, this, x, y, z))) return; - GlStateManager.pushMatrix(); - GlStateManager.disableCull(); - this.mainModel.swingProgress = this.getSwingProgress(entity, partialTicks); -@@ -193,6 +197,7 @@ - { - super.doRender(entity, x, y, z, p_76986_8_, partialTicks); - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post(entity, this, x, y, z)); - } - - protected boolean func_177088_c(EntityLivingBase p_177088_1_) -@@ -472,10 +477,11 @@ - - public void passSpecialRender(EntityLivingBase p_77033_1_, double p_77033_2_, double p_77033_4_, double p_77033_6_) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre(p_77033_1_, this, p_77033_2_, p_77033_4_, p_77033_6_))) return; - if (this.canRenderName(p_77033_1_)) - { - double d3 = p_77033_1_.getDistanceSqToEntity(this.renderManager.livingPlayer); -- float f = p_77033_1_.isSneaking() ? 32.0F : 64.0F; -+ float f = p_77033_1_.isSneaking() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE; - - if (d3 < (double)(f * f)) - { -@@ -522,6 +528,7 @@ - } - } - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Post(p_77033_1_, this, p_77033_2_, p_77033_4_, p_77033_6_)); - } - - protected boolean canRenderName(EntityLivingBase targetEntity) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch deleted file mode 100644 index bfa7ac052..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch +++ /dev/null @@ -1,102 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java -@@ -56,31 +56,32 @@ - ModelBase modelbase = this.func_177175_a(p_177182_9_); - modelbase.setModelAttributes(this.field_177190_a.getMainModel()); - modelbase.setLivingAnimations(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_4_); -+ modelbase = net.minecraftforge.client.ForgeHooksClient.getArmorModel(p_177182_1_, itemstack, p_177182_9_, modelbase); - this.func_177179_a(modelbase, p_177182_9_); - boolean flag = this.func_177180_b(p_177182_9_); -- this.field_177190_a.bindTexture(this.getArmorResource(itemarmor, flag)); -+ this.field_177190_a.bindTexture(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, null)); - -- switch (LayerArmorBase.SwitchArmorMaterial.field_178747_a[itemarmor.getArmorMaterial().ordinal()]) - { -- case 1: -- int j = itemarmor.getColor(itemstack); -+ int j = itemarmor.getColor(itemstack); -+ if (j != -1) //Allow this for anything, not only cloth. -+ { - float f7 = (float)(j >> 16 & 255) / 255.0F; - float f8 = (float)(j >> 8 & 255) / 255.0F; - float f9 = (float)(j & 255) / 255.0F; - GlStateManager.color(this.field_177184_f * f7, this.field_177185_g * f8, this.field_177192_h * f9, this.field_177187_e); - modelbase.render(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); -- this.field_177190_a.bindTexture(this.getArmorResource(itemarmor, flag, "overlay")); -- case 2: -- case 3: -- case 4: -- case 5: -+ this.field_177190_a.bindTexture(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, "overlay")); -+ } -+ { // Non-cloth - GlStateManager.color(this.field_177184_f, this.field_177185_g, this.field_177192_h, this.field_177187_e); - modelbase.render(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); -- default: -+ } -+ { // Default, Why is this a switch? there were no breaks. - if (!this.field_177193_i && itemstack.isItemEnchanted()) - { - this.func_177183_a(p_177182_1_, modelbase, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); - } -+ } - } - } - } -@@ -135,11 +136,13 @@ - GlStateManager.disableBlend(); - } - -+ @Deprecated //Use the more sensitive version getArmorResource below - private ResourceLocation getArmorResource(ItemArmor p_177181_1_, boolean p_177181_2_) - { - return this.getArmorResource(p_177181_1_, p_177181_2_, (String)null); - } - -+ @Deprecated //Use the more sensitive version getArmorResource below - private ResourceLocation getArmorResource(ItemArmor p_177178_1_, boolean p_177178_2_, String p_177178_3_) - { - String s1 = String.format("textures/models/armor/%s_layer_%d%s.png", new Object[] {p_177178_1_.getArmorMaterial().getName(), Integer.valueOf(p_177178_2_ ? 2 : 1), p_177178_3_ == null ? "" : String.format("_%s", new Object[]{p_177178_3_})}); -@@ -158,6 +161,42 @@ - - protected abstract void func_177179_a(ModelBase p_177179_1_, int p_177179_2_); - -+ /*=================================== FORGE START =========================================*/ -+ /** -+ * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide. -+ * -+ * @param entity Entity wearing the armor -+ * @param stack ItemStack for the armor -+ * @param slot Slot ID that the item is in -+ * @param type Subtype, can be null or "overlay" -+ * @return ResourceLocation pointing at the armor's texture -+ */ -+ public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, int slot, String type) -+ { -+ ItemArmor item = (ItemArmor)stack.getItem(); -+ String texture = ((ItemArmor)stack.getItem()).getArmorMaterial().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, (slot == 2 ? 2 : 1), type == null ? "" : String.format("_%s", type)); -+ -+ s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type); -+ ResourceLocation resourcelocation = (ResourceLocation)field_177191_j.get(s1); -+ -+ if (resourcelocation == null) -+ { -+ resourcelocation = new ResourceLocation(s1); -+ field_177191_j.put(s1, resourcelocation); -+ } -+ -+ return resourcelocation; -+ } -+ /*=================================== FORGE END ===========================================*/ -+ - @SideOnly(Side.CLIENT) - - static final class SwitchArmorMaterial diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch deleted file mode 100644 index fe1185a58..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/texture/Stitcher.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/Stitcher.java -@@ -60,6 +60,7 @@ - public void doStitch() - { - Stitcher.Holder[] aholder = (Stitcher.Holder[])this.setStitchHolders.toArray(new Stitcher.Holder[this.setStitchHolders.size()]); -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", aholder.length); - Arrays.sort(aholder); - Stitcher.Holder[] aholder1 = aholder; - int i = aholder.length; -@@ -67,10 +68,14 @@ - for (int j = 0; j < i; ++j) - { - Stitcher.Holder holder = aholder1[j]; -+ bar.step(holder.getAtlasSprite().getIconName()); - - if (!this.allocateSlot(holder)) - { - String s = String.format("Unable to fit: %s - size: %dx%d - Maybe try a lowerresolution resourcepack?", new Object[] {holder.getAtlasSprite().getIconName(), Integer.valueOf(holder.getAtlasSprite().getIconWidth()), Integer.valueOf(holder.getAtlasSprite().getIconHeight())}); -+ net.minecraftforge.fml.common.FMLLog.info(s); -+ for (Stitcher.Holder h : aholder) -+ net.minecraftforge.fml.common.FMLLog.info(" %s", h); - throw new StitcherException(holder, s); - } - } -@@ -80,6 +85,7 @@ - this.currentWidth = MathHelper.roundUpToPowerOfTwo(this.currentWidth); - this.currentHeight = MathHelper.roundUpToPowerOfTwo(this.currentHeight); - } -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); - } - - public List getStichSlots() -@@ -273,7 +279,7 @@ - - public String toString() - { -- return "Holder{width=" + this.width + ", height=" + this.height + '}'; -+ return "Holder{width=" + this.width + ", height=" + this.height + ", name=" + this.theTexture.getIconName() + '}'; - } - - public int compareTo(Stitcher.Holder p_compareTo_1_) diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch deleted file mode 100644 index 88f5b1c6f..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java -@@ -410,4 +410,30 @@ - { - return "TextureAtlasSprite{name=\'" + this.iconName + '\'' + ", frameCount=" + this.framesTextureData.size() + ", rotated=" + this.rotated + ", x=" + this.originX + ", y=" + this.originY + ", height=" + this.height + ", width=" + this.width + ", u0=" + this.minU + ", u1=" + this.maxU + ", v0=" + this.minV + ", v1=" + this.maxV + '}'; - } -+ -+ /*===================================== FORGE START =====================================*/ -+ /** -+ * The result of this function determines is the below 'load' function is called, and the -+ * default vanilla loading code is bypassed completely. -+ * @param manager -+ * @param location -+ * @return True to use your own custom load code and bypass vanilla loading. -+ */ -+ public boolean hasCustomLoader(net.minecraft.client.resources.IResourceManager manager, net.minecraft.util.ResourceLocation location) -+ { -+ return false; -+ } -+ -+ /** -+ * Load the specified resource as this sprite's data. -+ * Returning false from this function will prevent this icon from being stitched onto the master texture. -+ * @param manager Main resource manager -+ * @param location File resource location -+ * @return False to prevent this Icon from being stitched -+ */ -+ public boolean load(net.minecraft.client.resources.IResourceManager manager, net.minecraft.util.ResourceLocation location) -+ { -+ return true; -+ } -+ /*===================================== FORGE END ======================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch deleted file mode 100644 index d51da4fc9..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureManager.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureManager.java -@@ -143,12 +143,15 @@ - - public void onResourceManagerReload(IResourceManager resourceManager) - { -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Reloading Texture Manager", this.mapTextureObjects.keySet().size(), true); - Iterator iterator = this.mapTextureObjects.entrySet().iterator(); - - while (iterator.hasNext()) - { - Entry entry = (Entry)iterator.next(); -+ bar.step(entry.getKey().toString()); - this.loadTexture((ResourceLocation)entry.getKey(), (ITextureObject)entry.getValue()); - } -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); - } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch deleted file mode 100644 index 93a0cefb4..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ /dev/null @@ -1,190 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureMap.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureMap.java -@@ -29,6 +29,7 @@ - @SideOnly(Side.CLIENT) - public class TextureMap extends AbstractTexture implements ITickableTextureObject - { -+ private static final boolean ENABLE_SKIP = Boolean.parseBoolean(System.getProperty("fml.skipFirstTextureLoad", "true")); - private static final Logger logger = LogManager.getLogger(); - public static final ResourceLocation LOCATION_MISSING_TEXTURE = new ResourceLocation("missingno"); - public static final ResourceLocation locationBlocksTexture = new ResourceLocation("textures/atlas/blocks.png"); -@@ -40,6 +41,7 @@ - private int mipmapLevels; - private final TextureAtlasSprite missingImage; - private static final String __OBFID = "CL_00001058"; -+ private boolean skipFirst = false; - - public TextureMap(String p_i46099_1_) - { -@@ -48,12 +50,23 @@ - - public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn) - { -+ this(p_i46100_1_, iconCreatorIn, false); -+ } -+ -+ public TextureMap(String p_i46100_1_, boolean skipFirst) -+ { -+ this(p_i46100_1_, null, skipFirst); -+ } -+ -+ public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn, boolean skipFirst) -+ { - this.listAnimatedSprites = Lists.newArrayList(); - this.mapRegisteredSprites = Maps.newHashMap(); - this.mapUploadedSprites = Maps.newHashMap(); - this.missingImage = new TextureAtlasSprite("missingno"); - this.basePath = p_i46100_1_; - this.iconCreator = iconCreatorIn; -+ this.skipFirst = skipFirst && ENABLE_SKIP; - } - - private void initMissingImage() -@@ -91,15 +104,29 @@ - this.listAnimatedSprites.clear(); - int j = Integer.MAX_VALUE; - int k = 1 << this.mipmapLevels; -+ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(this); -+ net.minecraftforge.fml.common.FMLLog.info("Max texture size: %d", i); -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", skipFirst ? 0 : this.mapRegisteredSprites.size()); - Iterator iterator = this.mapRegisteredSprites.entrySet().iterator(); - -- while (iterator.hasNext()) -+ while (!skipFirst && iterator.hasNext()) - { - Entry entry = (Entry)iterator.next(); - TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue(); - ResourceLocation resourcelocation = new ResourceLocation(textureatlassprite.getIconName()); - ResourceLocation resourcelocation1 = this.completeResourceLocation(resourcelocation, 0); -+ bar.step(resourcelocation1.getResourcePath()); - -+ if (textureatlassprite.hasCustomLoader(resourceManager, resourcelocation)) -+ { -+ if (!textureatlassprite.load(resourceManager, resourcelocation)) -+ { -+ j = Math.min(j, Math.min(textureatlassprite.getIconWidth(), textureatlassprite.getIconHeight())); -+ stitcher.addSprite(textureatlassprite); -+ } -+ continue; -+ } -+ - try - { - IResource iresource = resourceManager.getResource(resourcelocation1); -@@ -150,12 +177,14 @@ - } - catch (RuntimeException runtimeexception) - { -- logger.error("Unable to parse metadata from " + resourcelocation1, runtimeexception); -+ //logger.error("Unable to parse metadata from " + resourcelocation1, runtimeexception); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackBrokenTexture(resourcelocation1, runtimeexception.getMessage()); - continue; - } - catch (IOException ioexception1) - { -- logger.error("Using missing texture, unable to load " + resourcelocation1, ioexception1); -+ //logger.error("Using missing texture, unable to load " + resourcelocation1, ioexception1); -+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackMissingTexture(resourcelocation1); - continue; - } - -@@ -171,6 +200,7 @@ - stitcher.addSprite(textureatlassprite); - } - -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); - int j1 = Math.min(j, k); - int k1 = MathHelper.calculateLogBaseTwo(j1); - -@@ -181,10 +211,12 @@ - } - - Iterator iterator1 = this.mapRegisteredSprites.values().iterator(); -+ bar = net.minecraftforge.fml.common.ProgressManager.push("Mipmap generation", skipFirst ? 0 : this.mapRegisteredSprites.size()); - -- while (iterator1.hasNext()) -+ while (!skipFirst && iterator1.hasNext()) - { - final TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)iterator1.next(); -+ bar.step(textureatlassprite1.getIconName()); - - try - { -@@ -225,9 +257,13 @@ - - this.missingImage.generateMipmaps(this.mipmapLevels); - stitcher.addSprite(this.missingImage); -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); -+ skipFirst = false; -+ bar = net.minecraftforge.fml.common.ProgressManager.push("Texture creation", 3); - - try - { -+ bar.step("Stitching"); - stitcher.doStitch(); - } - catch (StitcherException stitcherexception) -@@ -236,11 +272,13 @@ - } - - logger.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.getCurrentWidth()), Integer.valueOf(stitcher.getCurrentHeight()), this.basePath}); -+ bar.step("Allocating GL texture"); - TextureUtil.allocateTextureImpl(this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); - HashMap hashmap = Maps.newHashMap(this.mapRegisteredSprites); - Iterator iterator2 = stitcher.getStichSlots().iterator(); - TextureAtlasSprite textureatlassprite2; - -+ bar.step("Uploading GL texture"); - while (iterator2.hasNext()) - { - textureatlassprite2 = (TextureAtlasSprite)iterator2.next(); -@@ -275,7 +313,11 @@ - textureatlassprite2.copyFrom(this.missingImage); - } - -+ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this); -+ -+ if (!net.minecraftforge.common.ForgeModContainer.disableStitchedFileSaving) - TextureUtil.saveGlTexture(this.basePath.replaceAll("/", "_"), this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); -+ net.minecraftforge.fml.common.ProgressManager.pop(bar); - } - - private ResourceLocation completeResourceLocation(ResourceLocation location, int p_147634_2_) -@@ -341,4 +383,37 @@ - { - return this.missingImage; - } -+ -+ //=================================================================================================== -+ // Forge Start -+ //=================================================================================================== -+ /** -+ * Grabs the registered entry for the specified name, returning null if there was not a entry. -+ * Opposed to registerIcon, this will not instantiate the entry, useful to test if a mapping exists. -+ * -+ * @param name The name of the entry to find -+ * @return The registered entry, null if nothing was registered. -+ */ -+ public TextureAtlasSprite getTextureExtry(String name) -+ { -+ return (TextureAtlasSprite)mapRegisteredSprites.get(name); -+ } -+ -+ /** -+ * Adds a texture registry entry to this map for the specified name if one does not already exist. -+ * Returns false if the map already contains a entry for the specified name. -+ * -+ * @param name Entry name -+ * @param entry Entry instance -+ * @return True if the entry was added to the map, false otherwise. -+ */ -+ public boolean setTextureEntry(String name, TextureAtlasSprite entry) -+ { -+ if (!mapRegisteredSprites.containsKey(name)) -+ { -+ mapRegisteredSprites.put(name, entry); -+ return true; -+ } -+ return false; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch deleted file mode 100644 index bd098bb10..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java -@@ -202,9 +202,11 @@ - - public static void allocateTextureImpl(int p_180600_0_, int p_180600_1_, int p_180600_2_, int p_180600_3_) - { -+ synchronized (net.minecraftforge.fml.client.SplashProgress.class) -+ { - deleteTexture(p_180600_0_); - bindTexture(p_180600_0_); -- -+ } - if (p_180600_1_ >= 0) - { - GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, p_180600_1_); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch deleted file mode 100644 index d05ff8ac8..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java -@@ -99,15 +99,18 @@ - GlStateManager.disableLighting(); - int i = p_82402_1_.getRotation(); - -- if (item == Items.filled_map) -+ if (item instanceof net.minecraft.item.ItemMap) - { - i = i % 4 * 2; - } - - GlStateManager.rotate((float)i * 360.0F / 8.0F, 0.0F, 0.0F, 1.0F); - -- if (item == Items.filled_map) -+ net.minecraftforge.client.event.RenderItemInFrameEvent event = new net.minecraftforge.client.event.RenderItemInFrameEvent(p_82402_1_, this); -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) - { -+ if (item instanceof net.minecraft.item.ItemMap) -+ { - this.renderManager.renderEngine.bindTexture(mapBackgroundTextures); - GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); - float f = 0.0078125F; -@@ -165,6 +168,7 @@ - textureatlassprite.updateAnimation(); - } - } -+ } - - GlStateManager.enableLighting(); - GlStateManager.popMatrix(); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch deleted file mode 100644 index 9137aa309..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java -@@ -79,6 +79,7 @@ - { - TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147718_c, 0.0D, 0.0D, 0.0D, 0.0F); - } -+ else if (block != Blocks.chest) net.minecraftforge.client.ForgeHooksClient.renderTileItem(p_179022_1_.getItem(), p_179022_1_.getMetadata()); - else - { - TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147717_b, 0.0D, 0.0D, 0.0D, 0.0F); diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch deleted file mode 100644 index 31665ebe0..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java -+++ ../src-work/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java -@@ -114,13 +114,20 @@ - @SideOnly(Side.CLIENT) - public static enum EnumType - { -- FLOAT(4, "Float", 5126), -- UBYTE(1, "Unsigned Byte", 5121), -- BYTE(1, "Byte", 5120), -- USHORT(2, "Unsigned Short", 5123), -- SHORT(2, "Short", 5122), -- UINT(4, "Unsigned Int", 5125), -- INT(4, "Int", 5124); -+ FLOAT(4, "Float", org.lwjgl.opengl.GL11.GL_FLOAT), -+ UBYTE(1, "Unsigned Byte", org.lwjgl.opengl.GL11.GL_UNSIGNED_BYTE), -+ BYTE(1, "Byte", org.lwjgl.opengl.GL11.GL_BYTE), -+ USHORT(2, "Unsigned Short", org.lwjgl.opengl.GL11.GL_UNSIGNED_SHORT), -+ SHORT(2, "Short", org.lwjgl.opengl.GL11.GL_SHORT), -+ UINT(4, "Unsigned Int", org.lwjgl.opengl.GL11.GL_UNSIGNED_INT), -+ INT(4, "Int", org.lwjgl.opengl.GL11.GL_INT); -+ // Commented for now, might be added in the future if anyone needs them -+ //HALF_FLOAT(2, "Half Float", org.lwjgl.opengl.GL30.GL_HALF_FLOAT), -+ //DOUBLE(8, "Double", org.lwjgl.opengl.GL11.GL_DOUBLE), -+ //INT_2_10_10_10_REV(4, "Int 2-10-10-10 reversed", org.lwjgl.opengl.GL33.GL_INT_2_10_10_10_REV), -+ //UINT_2_10_10_10_REV(4, "Unsigned Int 2-10-10-10 reversed", org.lwjgl.opengl.GL12.GL_UNSIGNED_INT_2_10_10_10_REV), -+ //UINT_10F_11F_11F_REV(4, "Unsigned Int 10F 11F 11F reversed", GL_UNSIGNED_INT_10F_11F_11F_REV); -+ - private final int size; - private final String displayName; - private final int glConstant; -@@ -157,9 +164,17 @@ - NORMAL("Normal"), - COLOR("Vertex Color"), - UV("UV"), -+ // As of 1.8 - unused in vanilla; use GENERIC for now -+ @Deprecated - MATRIX("Bone Matrix"), -+ @Deprecated - BLEND_WEIGHT("Blend Weight"), -- PADDING("Padding"); -+ PADDING("Padding"), -+ GENERIC("Generic Attribute"); -+ -+ public void preDraw(VertexFormatElement element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.preDraw(this, element, stride, buffer); } -+ public void postDraw(VertexFormatElement element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.postDraw(this, element, stride, buffer); } -+ - private final String displayName; - - private static final String __OBFID = "CL_00002397"; diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch deleted file mode 100644 index b55e36165..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/AbstractResourcePack.java -+++ ../src-work/minecraft/net/minecraft/client/resources/AbstractResourcePack.java -@@ -58,7 +58,7 @@ - - protected void logNameNotLowercase(String p_110594_1_) - { -- resourceLog.warn("ResourcePack: ignored non-lowercase namespace: %s in %s", new Object[] {p_110594_1_, this.resourcePackFile}); -+ resourceLog.warn("ResourcePack: ignored non-lowercase namespace: {} in {}", new Object[] {p_110594_1_, this.resourcePackFile}); - } - - public IMetadataSection getPackMetadata(IMetadataSerializer p_135058_1_, String p_135058_2_) throws IOException diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch deleted file mode 100644 index 9d8482917..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/FallbackResourceManager.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/FallbackResourceManager.java -+++ ../src-work/minecraft/net/minecraft/client/resources/FallbackResourceManager.java -@@ -70,6 +70,7 @@ - throw new FileNotFoundException(p_110536_1_.toString()); - } - -+ @SuppressWarnings("resource") - protected InputStream getInputStream(ResourceLocation p_177245_1_, IResourcePack p_177245_2_) throws IOException - { - InputStream inputstream = p_177245_2_.getInputStream(p_177245_1_); diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch deleted file mode 100644 index 3a799d2e9..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/LanguageManager.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/LanguageManager.java -+++ ../src-work/minecraft/net/minecraft/client/resources/LanguageManager.java -@@ -83,6 +83,7 @@ - } - - currentLocale.loadLocaleDataFiles(resourceManager, arraylist); -+ net.minecraftforge.fml.common.registry.LanguageRegistry.instance().mergeLanguageTable(currentLocale.properties, this.currentLanguage); - StringTranslate.replaceWith(currentLocale.properties); - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/Locale.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/Locale.java.patch deleted file mode 100644 index 9d053f76d..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/Locale.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/Locale.java -+++ ../src-work/minecraft/net/minecraft/client/resources/Locale.java -@@ -107,6 +107,8 @@ - - private void loadLocaleData(InputStream p_135021_1_) throws IOException - { -+ p_135021_1_ = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(properties, p_135021_1_); -+ if (p_135021_1_ == null) return; - Iterator iterator = IOUtils.readLines(p_135021_1_, Charsets.UTF_8).iterator(); - - while (iterator.hasNext()) diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch deleted file mode 100644 index 839265f93..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch +++ /dev/null @@ -1,46 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java -+++ ../src-work/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java -@@ -95,6 +95,7 @@ - public void reloadResources(List p_110541_1_) - { - this.clearResources(); -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Loading Resources", p_110541_1_.size()+1, true); - logger.info("Reloading ResourceManager: " + joinerResourcePacks.join(Iterables.transform(p_110541_1_, new Function() - { - private static final String __OBFID = "CL_00001092"; -@@ -112,26 +113,35 @@ - while (iterator.hasNext()) - { - IResourcePack iresourcepack = (IResourcePack)iterator.next(); -+ resReload.step(iresourcepack.getPackName()); - this.reloadResourcePack(iresourcepack); - } - -+ resReload.step("Reloading listeners"); - this.notifyReloadListeners(); -+ net.minecraftforge.fml.common.ProgressManager.pop(resReload); - } - - public void registerReloadListener(IResourceManagerReloadListener p_110542_1_) - { - this.reloadListeners.add(p_110542_1_); -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Loading Resource", 1); -+ resReload.step(p_110542_1_.getClass()); - p_110542_1_.onResourceManagerReload(this); -+ net.minecraftforge.fml.common.ProgressManager.pop(resReload); - } - - private void notifyReloadListeners() - { - Iterator iterator = this.reloadListeners.iterator(); - -+ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Reloading", this.reloadListeners.size()); - while (iterator.hasNext()) - { - IResourceManagerReloadListener iresourcemanagerreloadlistener = (IResourceManagerReloadListener)iterator.next(); -+ resReload.step(iresourcemanagerreloadlistener.getClass()); - iresourcemanagerreloadlistener.onResourceManagerReload(this); - } -+ net.minecraftforge.fml.common.ProgressManager.pop(resReload); - } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/SkinManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/SkinManager.java.patch deleted file mode 100644 index 48764cbfc..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/SkinManager.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/SkinManager.java -+++ ../src-work/minecraft/net/minecraft/client/resources/SkinManager.java -@@ -129,7 +129,9 @@ - - if (hashmap.isEmpty() && p_152790_1_.getId().equals(Minecraft.getMinecraft().getSession().getProfile().getId())) - { -- hashmap.putAll(SkinManager.this.sessionService.getTextures(SkinManager.this.sessionService.fillProfileProperties(p_152790_1_, false), false)); -+ // FORGE: Use already filled profile from session rather -+ // than getting rate limited by filling the input profile -+ hashmap.putAll(SkinManager.this.sessionService.getTextures(Minecraft.getMinecraft().getSession().getProfile(), false)); - } - - Minecraft.getMinecraft().addScheduledTask(new Runnable() diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch deleted file mode 100644 index 1b59a084d..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/model/IBakedModel.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/model/IBakedModel.java -+++ ../src-work/minecraft/net/minecraft/client/resources/model/IBakedModel.java -@@ -7,7 +7,11 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - -+/* -+ * @deprecated use {@link net.minecraftforge.client.model.IFlexibleBakedModel}, {@link net.minecraftforge.client.model.IPerspectiveAwareModel} -+ */ - @SideOnly(Side.CLIENT) -+@Deprecated - public interface IBakedModel - { - List getFaceQuads(EnumFacing p_177551_1_); -@@ -22,5 +26,6 @@ - - TextureAtlasSprite getTexture(); - -+ @Deprecated - ItemCameraTransforms getItemCameraTransforms(); - } diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch deleted file mode 100644 index e6b109684..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch +++ /dev/null @@ -1,98 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/model/ModelBakery.java -+++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelBakery.java -@@ -123,7 +123,7 @@ - } - catch (Exception exception) - { -- LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation); -+ LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation, exception); - } - } - catch (Exception exception1) -@@ -172,6 +172,7 @@ - } - } - } -+ catch (FileNotFoundException e) {} - catch (IOException ioexception) - { - throw new RuntimeException("Encountered an exception when loading model definition of model " + resourcelocation1.toString(), ioexception); -@@ -318,6 +319,7 @@ - - protected void registerVariantNames() - { -+ this.variantNames.clear(); //FML clear this to prevent double ups. - this.variantNames.put(Item.getItemFromBlock(Blocks.stone), Lists.newArrayList(new String[] {"stone", "granite", "granite_smooth", "diorite", "diorite_smooth", "andesite", "andesite_smooth"})); - this.variantNames.put(Item.getItemFromBlock(Blocks.dirt), Lists.newArrayList(new String[] {"dirt", "coarse_dirt", "podzol"})); - this.variantNames.put(Item.getItemFromBlock(Blocks.planks), Lists.newArrayList(new String[] {"oak_planks", "spruce_planks", "birch_planks", "jungle_planks", "acacia_planks", "dark_oak_planks"})); -@@ -360,6 +362,10 @@ - this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence_gate), Lists.newArrayList(new String[] {"oak_fence_gate"})); - this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence), Lists.newArrayList(new String[] {"oak_fence"})); - this.variantNames.put(Items.oak_door, Lists.newArrayList(new String[] {"oak_door"})); -+ for (Entry, Set> e : customVariantNames.entrySet()) -+ { -+ this.variantNames.put(e.getKey().get(), Lists.newArrayList(e.getValue().iterator())); -+ } - } - - protected List getVariantNames(Item p_177596_1_) -@@ -494,6 +500,11 @@ - - private IBakedModel bakeModel(ModelBlock modelBlockIn, ModelRotation modelRotationIn, boolean uvLocked) - { -+ return bakeModel(modelBlockIn, (net.minecraftforge.client.model.ITransformation)modelRotationIn, uvLocked); -+ } -+ -+ protected IBakedModel bakeModel(ModelBlock modelBlockIn, net.minecraftforge.client.model.ITransformation modelRotationIn, boolean uvLocked) -+ { - TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName("particle"))); - SimpleBakedModel.Builder builder = (new SimpleBakedModel.Builder(modelBlockIn)).setTexture(textureatlassprite); - Iterator iterator = modelBlockIn.getElements().iterator(); -@@ -509,13 +520,13 @@ - BlockPartFace blockpartface = (BlockPartFace)blockpart.mapFaces.get(enumfacing); - TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName(blockpartface.texture))); - -- if (blockpartface.cullFace == null) -+ if (blockpartface.cullFace == null || !net.minecraftforge.client.model.TRSRTransformation.isInteger(modelRotationIn.getMatrix())) - { - builder.addGeneralQuad(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); - } - else - { -- builder.addFaceQuad(modelRotationIn.rotateFace(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); -+ builder.addFaceQuad(modelRotationIn.rotate(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); - } - } - } -@@ -525,6 +536,11 @@ - - private BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_) - { -+ return makeBakedQuad(p_177589_1_, p_177589_2_, p_177589_3_, p_177589_4_, (net.minecraftforge.client.model.ITransformation)p_177589_5_, p_177589_6_); -+ } -+ -+ protected BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, net.minecraftforge.client.model.ITransformation p_177589_5_, boolean p_177589_6_) -+ { - return this.faceBakery.makeBakedQuad(p_177589_1_.positionFrom, p_177589_1_.positionTo, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.partRotation, p_177589_6_, p_177589_1_.shade); - } - -@@ -809,4 +825,19 @@ - MODEL_CLOCK.name = "class generation marker"; - MODEL_ENTITY.name = "block entity marker"; - } -+ -+ /*********************************************************** -+ * FML Start -+ ***********************************************************/ -+ private static Map, Set> customVariantNames = Maps.newHashMap(); -+ public static void addVariantName(Item item, String... names) -+ { -+ if (customVariantNames.containsKey(item.delegate)) -+ customVariantNames.get(item.delegate).addAll(Lists.newArrayList(names)); -+ else -+ customVariantNames.put(item.delegate, Sets.newHashSet(names)); -+ } -+ /*********************************************************** -+ * FML End -+ ***********************************************************/ - } diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch deleted file mode 100644 index cdc1701f2..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/model/ModelManager.java -+++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelManager.java -@@ -25,9 +25,10 @@ - - public void onResourceManagerReload(IResourceManager resourceManager) - { -- ModelBakery modelbakery = new ModelBakery(resourceManager, this.texMap, this.modelProvider); -+ ModelBakery modelbakery = new net.minecraftforge.client.model.ModelLoader(resourceManager, this.texMap, this.modelProvider); - this.modelRegistry = modelbakery.setupModelRegistry(); - this.defaultModel = (IBakedModel)this.modelRegistry.getObject(ModelBakery.MODEL_MISSING); -+ net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.modelRegistry, modelbakery); - this.modelProvider.reloadModels(); - } - diff --git a/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch b/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch deleted file mode 100644 index a97ecb1a3..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/resources/model/ModelRotation.java -+++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelRotation.java -@@ -10,7 +10,7 @@ - import net.minecraftforge.fml.relauncher.SideOnly; - - @SideOnly(Side.CLIENT) --public enum ModelRotation -+public enum ModelRotation implements net.minecraftforge.client.model.IModelState, net.minecraftforge.client.model.ITransformation - { - X0_Y0(0, 0), - X0_Y90(0, 90), -@@ -122,4 +122,9 @@ - mapRotations.put(Integer.valueOf(var3.combinedXY), var3); - } - } -+ -+ public net.minecraftforge.client.model.TRSRTransformation apply(net.minecraftforge.client.model.IModelPart part) { return new net.minecraftforge.client.model.TRSRTransformation(getMatrix()); } -+ public javax.vecmath.Matrix4f getMatrix() { return net.minecraftforge.client.ForgeHooksClient.getMatrix(this); } -+ public EnumFacing rotate(EnumFacing facing) { return rotateFace(facing); } -+ public int rotate(EnumFacing facing, int vertexIndex) { return rotateVertex(facing, vertexIndex); } - } diff --git a/patches.mcp/minecraft/net/minecraft/client/settings/GameSettings.java.patch b/patches.mcp/minecraft/net/minecraft/client/settings/GameSettings.java.patch deleted file mode 100644 index fe8f10615..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/settings/GameSettings.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/settings/GameSettings.java -+++ ../src-work/minecraft/net/minecraft/client/settings/GameSettings.java -@@ -1067,6 +1067,7 @@ - - public void saveOptions() - { -+ if (net.minecraftforge.fml.client.FMLClientHandler.instance().isLoading()) return; - try - { - PrintWriter printwriter = new PrintWriter(new FileWriter(this.optionsFile)); diff --git a/patches.mcp/minecraft/net/minecraft/client/shader/Framebuffer.java.patch b/patches.mcp/minecraft/net/minecraft/client/shader/Framebuffer.java.patch deleted file mode 100644 index c3b400a6b..000000000 --- a/patches.mcp/minecraft/net/minecraft/client/shader/Framebuffer.java.patch +++ /dev/null @@ -1,57 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/shader/Framebuffer.java -+++ ../src-work/minecraft/net/minecraft/client/shader/Framebuffer.java -@@ -119,8 +119,17 @@ - if (this.useDepth) - { - OpenGlHelper.glBindRenderbuffer(OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); -+ if (!this.stencilEnabled) -+ { - OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, 33190, this.framebufferTextureWidth, this.framebufferTextureHeight); - OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_DEPTH_ATTACHMENT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); -+ } -+ else -+ { -+ OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, org.lwjgl.opengl.EXTPackedDepthStencil.GL_DEPTH24_STENCIL8_EXT, this.framebufferTextureWidth, this.framebufferTextureHeight); -+ OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, org.lwjgl.opengl.EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); -+ OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, org.lwjgl.opengl.EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); -+ } - } - - this.framebufferClear(); -@@ -281,4 +290,36 @@ - GlStateManager.clear(i); - this.unbindFramebuffer(); - } -+ -+ /*================================ FORGE START ================================================*/ -+ private boolean stencilEnabled = false; -+ /** -+ * Attempts to enabled 8 bits of stencil buffer on this FrameBuffer. -+ * Modders must call this directly to set things up. -+ * This is to prevent the default cause where graphics cards do not support stencil bits. -+ * Modders should check the below 'isStencilEnabled' to check if another modder has already enabled them. -+ * -+ * Note: -+ * As of now the only thing that is checked is if FBOs are supported entirely, in the future -+ * we may expand to check for errors. -+ * -+ * @return True if the FBO was re-initialized with stencil bits. -+ */ -+ public boolean enableStencil() -+ { -+ if (!OpenGlHelper.isFramebufferEnabled()) return false; -+ stencilEnabled = true; -+ this.createBindFramebuffer(framebufferWidth, framebufferHeight); -+ return true; //TODO: Find a way to detect if this failed? -+ } -+ -+ /** -+ * Returns wither or not this FBO has been successfully initialized with stencil bits. -+ * If not, and a modder wishes it to be, they must call enableStencil. -+ */ -+ public boolean isStencilEnabled() -+ { -+ return this.stencilEnabled; -+ } -+ /*================================ FORGE END ================================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/command/CommandEnchant.java.patch b/patches.mcp/minecraft/net/minecraft/command/CommandEnchant.java.patch deleted file mode 100644 index c6ea2fffb..000000000 --- a/patches.mcp/minecraft/net/minecraft/command/CommandEnchant.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/command/CommandEnchant.java -+++ ../src-work/minecraft/net/minecraft/command/CommandEnchant.java -@@ -95,7 +95,7 @@ - { - Enchantment enchantment2 = Enchantment.getEnchantmentById(short1); - -- if (!enchantment2.canApplyTogether(enchantment1)) -+ if (!enchantment2.canApplyTogether(enchantment1) || !enchantment1.canApplyTogether(enchantment2)) //Forge BugFix: Let Both enchantments veto being together - { - throw new CommandException("commands.enchant.cantCombine", new Object[] {enchantment1.getTranslatedName(j), enchantment2.getTranslatedName(nbttaglist.getCompoundTagAt(k).getShort("lvl"))}); - } diff --git a/patches.mcp/minecraft/net/minecraft/command/CommandFill.java.patch b/patches.mcp/minecraft/net/minecraft/command/CommandFill.java.patch deleted file mode 100644 index 205a36382..000000000 --- a/patches.mcp/minecraft/net/minecraft/command/CommandFill.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/command/CommandFill.java -+++ ../src-work/minecraft/net/minecraft/command/CommandFill.java -@@ -52,6 +52,7 @@ - { - i = parseInt(args[7], 0, 15); - } -+ IBlockState state = block.getStateFromMeta(i); - - BlockPos blockpos2 = new BlockPos(Math.min(blockpos.getX(), blockpos1.getX()), Math.min(blockpos.getY(), blockpos1.getY()), Math.min(blockpos.getZ(), blockpos1.getZ())); - BlockPos blockpos3 = new BlockPos(Math.max(blockpos.getX(), blockpos1.getX()), Math.max(blockpos.getY(), blockpos1.getY()), Math.max(blockpos.getZ(), blockpos1.getZ())); -@@ -79,7 +80,7 @@ - NBTTagCompound nbttagcompound = new NBTTagCompound(); - boolean flag = false; - -- if (args.length >= 10 && block.hasTileEntity()) -+ if (args.length >= 10 && block.hasTileEntity(state)) - { - String s = getChatComponentFromNthArg(sender, args, 9).getUnformattedText(); - -@@ -121,7 +122,7 @@ - continue; - } - } -- else if (args[8].equals("replace") && !block.hasTileEntity()) -+ else if (args[8].equals("replace") && !block.hasTileEntity(state)) - { - if (args.length > 9) - { diff --git a/patches.mcp/minecraft/net/minecraft/command/CommandHandler.java.patch b/patches.mcp/minecraft/net/minecraft/command/CommandHandler.java.patch deleted file mode 100644 index 08c37a03d..000000000 --- a/patches.mcp/minecraft/net/minecraft/command/CommandHandler.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/command/CommandHandler.java -+++ ../src-work/minecraft/net/minecraft/command/CommandHandler.java -@@ -48,6 +48,16 @@ - } - else if (icommand.canCommandSenderUse(sender)) - { -+ net.minecraftforge.event.CommandEvent event = new net.minecraftforge.event.CommandEvent(icommand, sender, astring); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) -+ { -+ if (event.exception != null) -+ { -+ com.google.common.base.Throwables.propagateIfPossible(event.exception); -+ } -+ return 1; -+ } -+ - if (i > -1) - { - List list = PlayerSelector.matchEntities(sender, astring[i], Entity.class); diff --git a/patches.mcp/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch b/patches.mcp/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch deleted file mode 100644 index 44ccb6290..000000000 --- a/patches.mcp/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/command/server/CommandSetBlock.java -+++ ../src-work/minecraft/net/minecraft/command/server/CommandSetBlock.java -@@ -54,6 +54,8 @@ - i = parseInt(args[4], 0, 15); - } - -+ IBlockState state = block.getStateFromMeta(i); -+ - World world = sender.getEntityWorld(); - - if (!world.isBlockLoaded(blockpos)) -@@ -65,7 +67,7 @@ - NBTTagCompound nbttagcompound = new NBTTagCompound(); - boolean flag = false; - -- if (args.length >= 7 && block.hasTileEntity()) -+ if (args.length >= 7 && block.hasTileEntity(state)) - { - String s = getChatComponentFromNthArg(sender, args, 6).getUnformattedText(); - diff --git a/patches.mcp/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch b/patches.mcp/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch deleted file mode 100644 index c37587222..000000000 --- a/patches.mcp/minecraft/net/minecraft/command/server/CommandTestForBlock.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/command/server/CommandTestForBlock.java -+++ ../src-work/minecraft/net/minecraft/command/server/CommandTestForBlock.java -@@ -74,7 +74,7 @@ - NBTTagCompound nbttagcompound = new NBTTagCompound(); - boolean flag = false; - -- if (args.length >= 6 && block.hasTileEntity()) -+ if (args.length >= 6 && block.hasTileEntity(block.getStateFromMeta(i))) - { - String s = getChatComponentFromNthArg(sender, args, 5).getUnformattedText(); - diff --git a/patches.mcp/minecraft/net/minecraft/crash/CrashReport.java.patch b/patches.mcp/minecraft/net/minecraft/crash/CrashReport.java.patch deleted file mode 100644 index 1ff0379f3..000000000 --- a/patches.mcp/minecraft/net/minecraft/crash/CrashReport.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/crash/CrashReport.java -+++ ../src-work/minecraft/net/minecraft/crash/CrashReport.java -@@ -126,6 +126,7 @@ - return IntCache.getCacheSizes(); - } - }); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().enhanceCrashReport(this, this.theReportCategory); - } - - public String getDescription() -@@ -220,6 +221,8 @@ - { - StringBuilder stringbuilder = new StringBuilder(); - stringbuilder.append("---- Minecraft Crash Report ----\n"); -+ net.minecraftforge.fml.common.asm.transformers.BlamingTransformer.onCrash(stringbuilder); -+ net.minecraftforge.fml.relauncher.CoreModManager.onCrash(stringbuilder); - stringbuilder.append("// "); - stringbuilder.append(getWittyComment()); - stringbuilder.append("\n\n"); diff --git a/patches.mcp/minecraft/net/minecraft/crash/CrashReportCategory.java.patch b/patches.mcp/minecraft/net/minecraft/crash/CrashReportCategory.java.patch deleted file mode 100644 index 775be4459..000000000 --- a/patches.mcp/minecraft/net/minecraft/crash/CrashReportCategory.java.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/crash/CrashReportCategory.java -+++ ../src-work/minecraft/net/minecraft/crash/CrashReportCategory.java -@@ -128,8 +128,11 @@ - } - else - { -- this.stackTrace = new StackTraceElement[astacktraceelement.length - 3 - size]; -- System.arraycopy(astacktraceelement, 3 + size, this.stackTrace, 0, this.stackTrace.length); -+ int len = astacktraceelement.length - 3 - size; -+ // Really Mojang, Still, god damn... -+ if (len <= 0) len = astacktraceelement.length; -+ this.stackTrace = new StackTraceElement[len]; -+ System.arraycopy(astacktraceelement, astacktraceelement.length - len, this.stackTrace, 0, this.stackTrace.length); - return this.stackTrace.length; - } - } diff --git a/patches.mcp/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch b/patches.mcp/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch deleted file mode 100644 index c2f5798b4..000000000 --- a/patches.mcp/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch +++ /dev/null @@ -1,106 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/creativetab/CreativeTabs.java -+++ ../src-work/minecraft/net/minecraft/creativetab/CreativeTabs.java -@@ -139,8 +139,22 @@ - private ItemStack iconItemStack; - private static final String __OBFID = "CL_00000005"; - -+ public CreativeTabs(String label) -+ { -+ this(getNextID(), label); -+ } -+ - public CreativeTabs(int index, String label) - { -+ if (index >= creativeTabArray.length) -+ { -+ CreativeTabs[] tmp = new CreativeTabs[index + 1]; -+ for (int x = 0; x < creativeTabArray.length; x++) -+ { -+ tmp[x] = creativeTabArray[x]; -+ } -+ creativeTabArray = tmp; -+ } - this.tabIndex = index; - this.tabLabel = label; - creativeTabArray[index] = this; -@@ -223,12 +237,20 @@ - @SideOnly(Side.CLIENT) - public int getTabColumn() - { -+ if (tabIndex > 11) -+ { -+ return ((tabIndex - 12) % 10) % 5; -+ } - return this.tabIndex % 6; - } - - @SideOnly(Side.CLIENT) - public boolean isTabInFirstRow() - { -+ if (tabIndex > 11) -+ { -+ return ((tabIndex - 12) % 10) < 5; -+ } - return this.tabIndex < 6; - } - -@@ -278,10 +300,17 @@ - while (iterator.hasNext()) - { - Item item = (Item)iterator.next(); -+ if (item == null) -+ { -+ continue; -+ } - -- if (item != null && item.getCreativeTab() == this) -+ for (CreativeTabs tab : item.getCreativeTabs()) - { -- item.getSubItems(item, this, p_78018_1_); -+ if (tab == this) -+ { -+ item.getSubItems(item, this, p_78018_1_); -+ } - } - } - -@@ -320,4 +349,39 @@ - } - } - } -+ -+ public int getTabPage() -+ { -+ if (tabIndex > 11) -+ { -+ return ((tabIndex - 12) / 10) + 1; -+ } -+ return 0; -+ } -+ -+ public static int getNextID() -+ { -+ return creativeTabArray.length; -+ } -+ -+ /** -+ * Determines if the search bar should be shown for this tab. -+ * -+ * @return True to show the bar -+ */ -+ public boolean hasSearchBar() -+ { -+ return tabIndex == CreativeTabs.tabAllSearch.tabIndex; -+ } -+ -+ /** -+ * Gets the width of the search bar of the creative tab, use this if your -+ * creative tab name overflows together with a custom texture. -+ * -+ * @return The width of the search bar, 89 by default -+ */ -+ public int getSearchbarWidth() -+ { -+ return 89; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch b/patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch deleted file mode 100644 index 4173a9d40..000000000 --- a/patches.mcp/minecraft/net/minecraft/enchantment/Enchantment.java.patch +++ /dev/null @@ -1,65 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/enchantment/Enchantment.java -+++ ../src-work/minecraft/net/minecraft/enchantment/Enchantment.java -@@ -62,7 +62,7 @@ - - if (enchantmentsList[enchID] != null) - { -- throw new IllegalArgumentException("Duplicate enchantment id!"); -+ throw new IllegalArgumentException("Duplicate enchantment id! " + this.getClass() + " and " + enchantmentsList[enchID].getClass() + " Enchantment ID:" + enchID); - } - else - { -@@ -149,13 +149,52 @@ - - public boolean canApply(ItemStack stack) - { -- return this.type.canEnchantItem(stack.getItem()); -+ return canApplyAtEnchantingTable(stack); - } - - public void onEntityDamaged(EntityLivingBase user, Entity target, int level) {} - - public void onUserHurt(EntityLivingBase user, Entity attacker, int level) {} - -+ /** -+ * This applies specifically to applying at the enchanting table. The other method {@link #canApply(ItemStack)} -+ * applies for all possible enchantments. -+ * @param stack -+ * @return -+ */ -+ public boolean canApplyAtEnchantingTable(ItemStack stack) -+ { -+ return this.type.canEnchantItem(stack.getItem()); -+ } -+ -+ private static final java.lang.reflect.Field bookSetter = Enchantment.class.getDeclaredFields()[1]; -+ /** -+ * Add to the list of enchantments applicable by the anvil from a book -+ * -+ * @param enchantment -+ */ -+ public static void addToBookList(Enchantment enchantment) -+ { -+ try -+ { -+ net.minecraftforge.common.util.EnumHelper.setFailsafeFieldValue(bookSetter, null, -+ com.google.common.collect.ObjectArrays.concat(enchantmentsBookList, enchantment)); -+ } -+ catch (Exception e) -+ { -+ throw new RuntimeException(e); //Rethrow see what happens -+ } -+ } -+ -+ /** -+ * Is this enchantment allowed to be enchanted on books via Enchantment Table -+ * @return false to disable the vanilla feature -+ */ -+ public boolean isAllowedOnBooks() -+ { -+ return true; -+ } -+ - static - { - ArrayList var0 = Lists.newArrayList(); diff --git a/patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch b/patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch deleted file mode 100644 index fa0235c3a..000000000 --- a/patches.mcp/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/enchantment/EnchantmentHelper.java -+++ ../src-work/minecraft/net/minecraft/enchantment/EnchantmentHelper.java -@@ -308,7 +308,7 @@ - public static int calcItemStackEnchantability(Random p_77514_0_, int p_77514_1_, int p_77514_2_, ItemStack p_77514_3_) - { - Item item = p_77514_3_.getItem(); -- int k = item.getItemEnchantability(); -+ int k = item.getItemEnchantability(p_77514_3_); - - if (k <= 0) - { -@@ -361,7 +361,7 @@ - public static List buildEnchantmentList(Random p_77513_0_, ItemStack p_77513_1_, int p_77513_2_) - { - Item item = p_77513_1_.getItem(); -- int j = item.getItemEnchantability(); -+ int j = item.getItemEnchantability(p_77513_1_); - - if (j <= 0) - { -@@ -408,7 +408,9 @@ - { - EnchantmentData enchantmentdata1 = (EnchantmentData)iterator1.next(); - -- if (enchantmentdata1.enchantmentobj.canApplyTogether(Enchantment.getEnchantmentById(integer.intValue()))) -+ Enchantment e1 = enchantmentdata1.enchantmentobj; -+ Enchantment e2 = Enchantment.getEnchantmentById(integer.intValue()); -+ if (e1.canApplyTogether(e2) && e2.canApplyTogether(e1)) //Forge BugFix: Let Both enchantments veto being together - { - continue; - } -@@ -450,7 +452,8 @@ - { - Enchantment enchantment = aenchantment[k]; - -- if (enchantment != null && (enchantment.type.canEnchantItem(item) || flag)) -+ if (enchantment == null) continue; -+ if (enchantment.canApplyAtEnchantingTable(p_77505_1_) || ((item == Items.book) && enchantment.isAllowedOnBooks())) - { - for (int l = enchantment.getMinLevel(); l <= enchantment.getMaxLevel(); ++l) - { diff --git a/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch b/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch deleted file mode 100644 index 6631d32c3..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/Entity.java.patch +++ /dev/null @@ -1,312 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/Entity.java -+++ ../src-work/minecraft/net/minecraft/entity/Entity.java -@@ -128,6 +128,14 @@ - private final CommandResultStats cmdResultStats; - private static final String __OBFID = "CL_00001533"; - -+ /** Forge: Used to store custom data for each entity. */ -+ private NBTTagCompound customEntityData; -+ public boolean captureDrops = false; -+ public java.util.ArrayList capturedDrops = new java.util.ArrayList(); -+ private UUID persistentID; -+ -+ protected java.util.HashMap extendedProperties = new java.util.HashMap(); -+ - public int getEntityId() - { - return this.entityId; -@@ -171,6 +179,8 @@ - this.dataWatcher.addObject(2, ""); - this.dataWatcher.addObject(4, Byte.valueOf((byte)0)); - this.entityInit(); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this)); -+ for (net.minecraftforge.common.IExtendedEntityProperties props : extendedProperties.values()) props.init(this, worldIn); - } - - protected abstract void entityInit(); -@@ -1010,10 +1020,7 @@ - - if (block.getMaterial() == materialIn) - { -- float f = BlockLiquid.getLiquidHeightPercent(iblockstate.getBlock().getMetaFromState(iblockstate)) - 0.11111111F; -- float f1 = (float)(blockpos.getY() + 1) - f; -- boolean flag = d0 < (double)f1; -- return !flag && this instanceof EntityPlayer ? false : flag; -+ return net.minecraftforge.common.ForgeHooks.isInsideOfMaterial(materialIn, this, blockpos); - } - else - { -@@ -1378,6 +1385,21 @@ - tagCompund.setBoolean("Silent", this.isSilent()); - } - -+ if (customEntityData != null) tagCompund.setTag("ForgeData", customEntityData); -+ for (String identifier : this.extendedProperties.keySet()) -+ { -+ try -+ { -+ net.minecraftforge.common.IExtendedEntityProperties props = this.extendedProperties.get(identifier); -+ props.saveNBTData(tagCompund); -+ } -+ catch (Throwable t) -+ { -+ net.minecraftforge.fml.common.FMLLog.severe("Failed to save extended properties for %s. This is a mod issue.", identifier); -+ t.printStackTrace(); -+ } -+ } -+ - this.writeEntityToNBT(tagCompund); - - if (this.ridingEntity != null) -@@ -1458,6 +1480,28 @@ - this.setAlwaysRenderNameTag(tagCompund.getBoolean("CustomNameVisible")); - this.cmdResultStats.func_179668_a(tagCompund); - this.setSilent(tagCompund.getBoolean("Silent")); -+ -+ if (tagCompund.hasKey("ForgeData")) customEntityData = tagCompund.getCompoundTag("ForgeData"); -+ for (String identifier : this.extendedProperties.keySet()) -+ { -+ try -+ { -+ net.minecraftforge.common.IExtendedEntityProperties props = this.extendedProperties.get(identifier); -+ props.loadNBTData(tagCompund); -+ } -+ catch (Throwable t) -+ { -+ net.minecraftforge.fml.common.FMLLog.severe("Failed to load extended properties for %s. This is a mod issue.", identifier); -+ t.printStackTrace(); -+ } -+ } -+ -+ //Rawr, legacy code, Vanilla added a UUID, keep this so older maps will convert properly -+ if (tagCompund.hasKey("PersistentIDMSB") && tagCompund.hasKey("PersistentIDLSB")) -+ { -+ this.entityUniqueID = new UUID(tagCompund.getLong("PersistentIDMSB"), tagCompund.getLong("PersistentIDLSB")); -+ } -+ - this.readEntityFromNBT(tagCompund); - - if (this.shouldSetPosAfterLoading()) -@@ -1536,7 +1580,10 @@ - { - EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)offsetY, this.posZ, itemStackIn); - entityitem.setDefaultPickupDelay(); -- this.worldObj.spawnEntityInWorld(entityitem); -+ if (captureDrops) -+ this.capturedDrops.add(entityitem); -+ else -+ this.worldObj.spawnEntityInWorld(entityitem); - return entityitem; - } - else -@@ -1672,6 +1719,7 @@ - - public void mountEntity(Entity entityIn) - { -+ if(!(this instanceof EntityLivingBase) && !net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entityIn, true)){ return; } - this.entityRiderPitchDelta = 0.0D; - this.entityRiderYawDelta = 0.0D; - -@@ -1810,7 +1858,7 @@ - - public boolean isRiding() - { -- return this.ridingEntity != null; -+ return this.ridingEntity != null && ridingEntity.shouldRiderSit(); - } - - public boolean isSneaking() -@@ -2103,7 +2151,7 @@ - - public float getExplosionResistance(Explosion p_180428_1_, World worldIn, BlockPos p_180428_3_, IBlockState p_180428_4_) - { -- return p_180428_4_.getBlock().getExplosionResistance(this); -+ return p_180428_4_.getBlock().getExplosionResistance(worldIn, p_180428_3_.add(0, getEyeHeight(), 0), this, p_180428_1_); - } - - public boolean func_174816_a(Explosion p_174816_1_, World worldIn, BlockPos p_174816_3_, IBlockState p_174816_4_, float p_174816_5_) -@@ -2357,4 +2405,184 @@ - - EnchantmentHelper.func_151385_b(p_174815_1_, p_174815_2_); - } -+ -+ /* ================================== Forge Start =====================================*/ -+ /** -+ * Returns a NBTTagCompound that can be used to store custom data for this entity. -+ * It will be written, and read from disc, so it persists over world saves. -+ * @return A NBTTagCompound -+ */ -+ public NBTTagCompound getEntityData() -+ { -+ if (customEntityData == null) -+ { -+ customEntityData = new NBTTagCompound(); -+ } -+ return customEntityData; -+ } -+ -+ /** -+ * Used in model rendering to determine if the entity riding this entity should be in the 'sitting' position. -+ * @return false to prevent an entity that is mounted to this entity from displaying the 'sitting' animation. -+ */ -+ public boolean shouldRiderSit() -+ { -+ return true; -+ } -+ -+ /** -+ * Called when a user uses the creative pick block button on this entity. -+ * -+ * @param target The full target the player is looking at -+ * @return A ItemStack to add to the player's inventory, Null if nothing should be added. -+ */ -+ public ItemStack getPickedResult(MovingObjectPosition target) -+ { -+ if (this instanceof net.minecraft.entity.item.EntityPainting) -+ { -+ return new ItemStack(net.minecraft.init.Items.painting); -+ } -+ else if (this instanceof EntityLeashKnot) -+ { -+ return new ItemStack(net.minecraft.init.Items.lead); -+ } -+ else if (this instanceof net.minecraft.entity.item.EntityItemFrame) -+ { -+ ItemStack held = ((net.minecraft.entity.item.EntityItemFrame)this).getDisplayedItem(); -+ if (held == null) -+ { -+ return new ItemStack(net.minecraft.init.Items.item_frame); -+ } -+ else -+ { -+ return held.copy(); -+ } -+ } -+ else if (this instanceof net.minecraft.entity.item.EntityMinecart) -+ { -+ return ((net.minecraft.entity.item.EntityMinecart)this).getCartItem(); -+ } -+ else if (this instanceof net.minecraft.entity.item.EntityBoat) -+ { -+ return new ItemStack(net.minecraft.init.Items.boat); -+ } -+ else if (this instanceof net.minecraft.entity.item.EntityArmorStand) -+ { -+ return new ItemStack(net.minecraft.init.Items.armor_stand); -+ } -+ else -+ { -+ int id = EntityList.getEntityID(this); -+ if (id > 0 && EntityList.entityEggs.containsKey(id)) -+ { -+ return new ItemStack(net.minecraft.init.Items.spawn_egg, 1, id); -+ } -+ String name = EntityList.getEntityString(this); -+ if (name != null && net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().containsKey(name)) -+ { -+ ItemStack stack = new ItemStack(net.minecraft.init.Items.spawn_egg); -+ stack.setTagInfo("entity_name", new net.minecraft.nbt.NBTTagString(name)); -+ return stack; -+ } -+ } -+ return null; -+ } -+ -+ public UUID getPersistentID() -+ { -+ return entityUniqueID; -+ } -+ -+ /** -+ * Reset the entity ID to a new value. Not to be used from Mod code -+ */ -+ public final void resetEntityId() -+ { -+ this.entityId = nextEntityID++; -+ } -+ -+ public boolean shouldRenderInPass(int pass) -+ { -+ return pass == 0; -+ } -+ -+ /** -+ * Returns true if the entity is of the @link{EnumCreatureType} provided -+ * @param type The EnumCreatureType type this entity is evaluating -+ * @param forSpawnCount If this is being invoked to check spawn count caps. -+ * @return If the creature is of the type provided -+ */ -+ public boolean isCreatureType(EnumCreatureType type, boolean forSpawnCount) -+ { -+ if (forSpawnCount && (this instanceof EntityLiving) && ((EntityLiving)this).isNoDespawnRequired()) return false; -+ return type.getCreatureClass().isAssignableFrom(this.getClass()); -+ } -+ -+ /** -+ * Register the instance of IExtendedProperties into the entity's collection. -+ * @param identifier The identifier which you can use to retrieve these properties for the entity. -+ * @param properties The instanceof IExtendedProperties to register -+ * @return The identifier that was used to register the extended properties. Empty String indicates an error. If your requested key already existed, this will return a modified one that is unique. -+ */ -+ public String registerExtendedProperties(String identifier, net.minecraftforge.common.IExtendedEntityProperties properties) -+ { -+ if (identifier == null) -+ { -+ net.minecraftforge.fml.common.FMLLog.warning("Someone is attempting to register extended properties using a null identifier. This is not allowed. Aborting. This may have caused instability."); -+ return ""; -+ } -+ if (properties == null) -+ { -+ net.minecraftforge.fml.common.FMLLog.warning("Someone is attempting to register null extended properties. This is not allowed. Aborting. This may have caused instability."); -+ return ""; -+ } -+ -+ String baseIdentifier = identifier; -+ int identifierModCount = 1; -+ while (this.extendedProperties.containsKey(identifier)) -+ { -+ identifier = String.format("%s%d", baseIdentifier, identifierModCount++); -+ } -+ -+ if (baseIdentifier != identifier) -+ { -+ net.minecraftforge.fml.common.FMLLog.info("An attempt was made to register exended properties using an existing key. The duplicate identifier (%s) has been remapped to %s.", baseIdentifier, identifier); -+ } -+ -+ this.extendedProperties.put(identifier, properties); -+ return identifier; -+ } -+ -+ /** -+ * Gets the extended properties identified by the passed in key -+ * @param identifier The key that identifies the extended properties. -+ * @return The instance of IExtendedProperties that was found, or null. -+ */ -+ public net.minecraftforge.common.IExtendedEntityProperties getExtendedProperties(String identifier) -+ { -+ return this.extendedProperties.get(identifier); -+ } -+ -+ /** -+ * If a rider of this entity can interact with this entity. Should return true on the -+ * ridden entity if so. -+ * -+ * @return if the entity can be interacted with from a rider -+ */ -+ public boolean canRiderInteract() -+ { -+ return false; -+ } -+ -+ /** -+ * If the rider should be dismounted from the entity when the entity goes under water -+ * -+ * @param rider The entity that is riding -+ * @return if the entity should be dismounted when under water -+ */ -+ public boolean shouldDismountInWater(Entity rider) -+ { -+ return this instanceof EntityLivingBase; -+ } -+ /* ================================== Forge End =====================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch deleted file mode 100644 index a9cab8a70..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityHanging.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityHanging.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityHanging.java -@@ -124,6 +124,9 @@ - { - BlockPos blockpos1 = blockpos.offset(enumfacing, k).up(l); - Block block = this.worldObj.getBlockState(blockpos1).getBlock(); -+ -+ if ( block.isSideSolid( this.worldObj, blockpos1, this.field_174860_b )) -+ continue; - - if (!block.getMaterial().isSolid() && !BlockRedstoneDiode.isRedstoneRepeaterBlockID(block)) - { diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch deleted file mode 100644 index 2c4220234..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityList.java.patch +++ /dev/null @@ -1,68 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityList.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityList.java -@@ -90,6 +90,7 @@ - - public static void addMapping(Class p_75618_0_, String p_75618_1_, int p_75618_2_) - { -+ if (p_75618_2_ < 0 || p_75618_2_ > 255) throw new IllegalArgumentException("Attempted to register a entity with invalid ID: " + p_75618_2_ + " Name: " + p_75618_1_ + " Class: " + p_75618_0_); - if (stringToClassMapping.containsKey(p_75618_1_)) - { - throw new IllegalArgumentException("ID is already registered: " + p_75618_1_); -@@ -153,9 +154,10 @@ - p_75615_0_.removeTag("Type"); - } - -+ Class oclass = null; - try - { -- Class oclass = (Class)stringToClassMapping.get(p_75615_0_.getString("id")); -+ oclass = (Class)stringToClassMapping.get(p_75615_0_.getString("id")); - - if (oclass != null) - { -@@ -169,7 +171,17 @@ - - if (entity != null) - { -+ try -+ { - entity.readFromNBT(p_75615_0_); -+ } -+ catch (Exception e) -+ { -+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, -+ "An Entity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", -+ p_75615_0_.getString("id"), oclass.getName()); -+ entity = null; -+ } - } - else - { -@@ -344,7 +356,9 @@ - - public static class EntityEggInfo - { -+ @Deprecated // This is not always a valid number in the global ID list. - public final int spawnedID; -+ public final String name; - public final int primaryColor; - public final int secondaryColor; - public final StatBase field_151512_d; -@@ -358,6 +372,17 @@ - this.secondaryColor = p_i1583_3_; - this.field_151512_d = StatList.getStatKillEntity(this); - this.field_151513_e = StatList.getStatEntityKilledBy(this); -+ this.name = EntityList.getStringFromID(p_i1583_1_); - } -+ -+ public EntityEggInfo(String name, int primaryColor, int secondaryColor) -+ { -+ this.spawnedID = -1; -+ this.name = name; -+ this.primaryColor = primaryColor; -+ this.secondaryColor = secondaryColor; -+ this.field_151512_d = (new StatBase("stat.killEntity." + name, new net.minecraft.util.ChatComponentTranslation("stat.entityKill", new net.minecraft.util.ChatComponentTranslation("entity." + name + ".name")))).registerStat(); -+ this.field_151513_e = (new StatBase("stat.entityKilledBy." + name, new net.minecraft.util.ChatComponentTranslation("stat.entityKilledBy", new net.minecraft.util.ChatComponentTranslation("entity." + name + ".name")))).registerStat(); -+ } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityLiving.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityLiving.java.patch deleted file mode 100644 index 876ec7925..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityLiving.java.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityLiving.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityLiving.java -@@ -124,6 +124,7 @@ - public void setAttackTarget(EntityLivingBase p_70624_1_) - { - this.attackTarget = p_70624_1_; -+ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, p_70624_1_); - } - - public boolean canAttackClass(Class p_70686_1_) -@@ -507,10 +508,22 @@ - - protected void despawnEntity() - { -+ net.minecraftforge.fml.common.eventhandler.Event.Result result = null; - if (this.persistenceRequired) - { - this.entityAge = 0; - } -+ else if ((this.entityAge & 0x1F) == 0x1F && (result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this)) != net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT) -+ { -+ if (result == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) -+ { -+ this.entityAge = 0; -+ } -+ else -+ { -+ this.setDead(); -+ } -+ } - else - { - EntityPlayer entityplayer = this.worldObj.getClosestPlayerToEntity(this, -1.0D); -@@ -628,7 +641,6 @@ - return this.worldObj.checkNoEntityCollision(this.getEntityBoundingBox(), this) && this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(this.getEntityBoundingBox()); - } - -- @SideOnly(Side.CLIENT) - public float getRenderSizeModifier() - { - return 1.0F; diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch deleted file mode 100644 index 42dd1f820..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ /dev/null @@ -1,212 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java -@@ -233,7 +233,7 @@ - } - } - -- if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity instanceof EntityLivingBase) -+ if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity != null && ridingEntity.shouldDismountInWater(this)) - { - this.mountEntity((Entity)null); - } -@@ -316,7 +316,7 @@ - if (!this.worldObj.isRemote && (this.recentlyHit > 0 || this.isPlayer()) && this.func_146066_aG() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) - { - i = this.getExperiencePoints(this.attackingPlayer); -- -+ i = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.attackingPlayer, i); - while (i > 0) - { - int j = EntityXPOrb.getXPSplit(i); -@@ -377,6 +377,7 @@ - { - this.entityLivingToAttack = livingBase; - this.revengeTimer = this.ticksExisted; -+ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, livingBase); - } - - public EntityLivingBase getLastAttacker() -@@ -672,7 +673,6 @@ - return this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD; - } - -- @SideOnly(Side.CLIENT) - public void removePotionEffectClient(int p_70618_1_) - { - this.activePotionsMap.remove(Integer.valueOf(p_70618_1_)); -@@ -721,6 +721,8 @@ - - public void heal(float healAmount) - { -+ healAmount = net.minecraftforge.event.ForgeEventFactory.onLivingHeal(this, healAmount); -+ if (healAmount <= 0) return; - float f1 = this.getHealth(); - - if (f1 > 0.0F) -@@ -741,6 +743,7 @@ - - public boolean attackEntityFrom(DamageSource source, float amount) - { -+ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, source, amount)) return false; - if (this.isEntityInvulnerable(source)) - { - return false; -@@ -806,9 +809,9 @@ - this.recentlyHit = 100; - this.attackingPlayer = (EntityPlayer)entity; - } -- else if (entity instanceof EntityWolf) -+ else if (entity instanceof net.minecraft.entity.passive.EntityTameable) - { -- EntityWolf entitywolf = (EntityWolf)entity; -+ net.minecraft.entity.passive.EntityTameable entitywolf = (net.minecraft.entity.passive.EntityTameable)entity; - - if (entitywolf.isTamed()) - { -@@ -894,6 +897,7 @@ - - public void onDeath(DamageSource cause) - { -+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; - Entity entity = cause.getEntity(); - EntityLivingBase entitylivingbase = this.func_94060_bK(); - -@@ -919,6 +923,9 @@ - i = EnchantmentHelper.getLootingModifier((EntityLivingBase)entity); - } - -+ captureDrops = true; -+ capturedDrops.clear(); -+ - if (this.func_146066_aG() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) - { - this.dropFewItems(this.recentlyHit > 0, i); -@@ -929,6 +936,16 @@ - this.addRandomArmor(); - } - } -+ -+ captureDrops = false; -+ -+ if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, cause, capturedDrops, i, recentlyHit > 0)) -+ { -+ for (EntityItem item : capturedDrops) -+ { -+ worldObj.spawnEntityInWorld(item); -+ } -+ } - } - - this.worldObj.setEntityState(this, (byte)3); -@@ -977,7 +994,7 @@ - int j = MathHelper.floor_double(this.getEntityBoundingBox().minY); - int k = MathHelper.floor_double(this.posZ); - Block block = this.worldObj.getBlockState(new BlockPos(i, j, k)).getBlock(); -- return (block == Blocks.ladder || block == Blocks.vine) && (!(this instanceof EntityPlayer) || !((EntityPlayer)this).isSpectator()); -+ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(block, worldObj, new BlockPos(i, j, k), this); - } - - public boolean isEntityAlive() -@@ -987,6 +1004,9 @@ - - public void fall(float distance, float damageMultiplier) - { -+ float[] ret = net.minecraftforge.common.ForgeHooks.onLivingFall(this, distance, damageMultiplier); -+ if (ret == null) return; -+ distance = ret[0]; damageMultiplier = ret[1]; - super.fall(distance, damageMultiplier); - PotionEffect potioneffect = this.getActivePotionEffect(Potion.jump); - float f2 = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F; -@@ -1105,6 +1125,8 @@ - { - if (!this.isEntityInvulnerable(damageSrc)) - { -+ damageAmount = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, damageSrc, damageAmount); -+ if (damageAmount <= 0) return; - damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); - damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); - float f1 = damageAmount; -@@ -1153,6 +1175,11 @@ - - public void swingItem() - { -+ ItemStack stack = this.getHeldItem(); -+ if (stack != null && stack.getItem() != null) -+ { -+ if (stack.getItem().onEntitySwing(this, stack)) return; -+ } - if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0) - { - this.swingProgressInt = -1; -@@ -1294,6 +1321,7 @@ - - public void dismountEntity(Entity p_110145_1_) - { -+ if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_110145_1_, false)){ return; } - double d0 = p_110145_1_.posX; - double d1 = p_110145_1_.getEntityBoundingBox().minY + (double)p_110145_1_.height; - double d2 = p_110145_1_.posZ; -@@ -1359,6 +1387,7 @@ - } - - this.isAirBorne = true; -+ net.minecraftforge.common.ForgeHooks.onLivingJump(this); - } - - protected void updateAITick() -@@ -1545,6 +1574,7 @@ - - public void onUpdate() - { -+ if (net.minecraftforge.common.ForgeHooks.onLivingUpdate(this)) return; - super.onUpdate(); - - if (!this.worldObj.isRemote) -@@ -1828,6 +1858,7 @@ - - public void mountEntity(Entity entityIn) - { -+ if(!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entityIn, true)){ return; } - if (this.ridingEntity != null && entityIn == null) - { - if (!this.worldObj.isRemote) -@@ -2000,4 +2031,39 @@ - { - this.potionsNeedUpdate = true; - } -+ -+ /*** -+ * Removes all potion effects that have curativeItem as a curative item for its effect -+ * @param curativeItem The itemstack we are using to cure potion effects -+ */ -+ public void curePotionEffects(ItemStack curativeItem) -+ { -+ Iterator potionKey = activePotionsMap.keySet().iterator(); -+ if (worldObj.isRemote) return; -+ -+ while (potionKey.hasNext()) -+ { -+ Integer key = potionKey.next(); -+ PotionEffect effect = (PotionEffect)activePotionsMap.get(key); -+ -+ if (effect.isCurativeItem(curativeItem)) -+ { -+ potionKey.remove(); -+ onFinishedPotionEffect(effect); -+ this.potionsNeedUpdate = true; -+ } -+ } -+ } -+ -+ /** -+ * Returns true if the entity's rider (EntityPlayer) should face forward when mounted. -+ * currently only used in vanilla code by pigs. -+ * -+ * @param player The player who is riding the entity. -+ * @return If the player should orient the same direction as this entity. -+ */ -+ public boolean shouldRiderFaceForward(EntityPlayer player) -+ { -+ return this instanceof net.minecraft.entity.passive.EntityPig; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch deleted file mode 100644 index ad187ed62..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java -@@ -111,6 +111,7 @@ - - public boolean interactFirst(EntityPlayer playerIn) - { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; - this.commandBlockLogic.func_175574_a(playerIn); - return false; - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch deleted file mode 100644 index 7ca011b1c..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java -+++ ../src-work/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java -@@ -45,6 +45,12 @@ - return (EntityLiving.SpawnPlacementType)field_180110_a.get(p_180109_0_); - } - -+ public static void setPlacementType(Class entityClass, EntityLiving.SpawnPlacementType placementType) -+ { -+ if(!field_180110_a.containsKey(entityClass)) -+ field_180110_a.put(entityClass, placementType); -+ } -+ - static - { - field_180110_a.put(EntityBat.class, EntityLiving.SpawnPlacementType.ON_GROUND); diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityTracker.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityTracker.java.patch deleted file mode 100644 index 7b2ba0345..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityTracker.java.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityTracker.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityTracker.java -@@ -58,6 +58,8 @@ - - public void trackEntity(Entity p_72786_1_) - { -+ if (net.minecraftforge.fml.common.registry.EntityRegistry.instance().tryTrackingEntity(this, p_72786_1_)) return; -+ - if (p_72786_1_ instanceof EntityPlayerMP) - { - this.trackEntity(p_72786_1_, 512, 2); -@@ -355,4 +357,23 @@ - } - } - } -+ -+ /* ======================================== FORGE START =====================================*/ -+ -+ // don't expose the EntityTrackerEntry directly so mods can't mess with the data in there as easily -+ /** -+ * Get all players tracking the given Entity. The Entity must be part of the World that this Tracker belongs to. -+ * @param entity the Entity -+ * @return all players tracking the Entity -+ */ -+ public Set getTrackingPlayers(Entity entity) -+ { -+ EntityTrackerEntry entry = (EntityTrackerEntry) trackedEntityHashTable.lookup(entity.getEntityId()); -+ if (entry == null) -+ return java.util.Collections.emptySet(); -+ else -+ return java.util.Collections.unmodifiableSet(entry.trackingPlayers); -+ } -+ -+ /* ======================================== FORGE END =====================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch b/patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch deleted file mode 100644 index 047889a3d..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/EntityTrackerEntry.java -+++ ../src-work/minecraft/net/minecraft/entity/EntityTrackerEntry.java -@@ -388,6 +388,14 @@ - this.lastTrackedEntityMotionY = this.trackedEntity.motionY; - this.motionZ = this.trackedEntity.motionZ; - -+ int posX = MathHelper.floor_double(this.trackedEntity.posX * 32.0D); -+ int posY = MathHelper.floor_double(this.trackedEntity.posY * 32.0D); -+ int posZ = MathHelper.floor_double(this.trackedEntity.posZ * 32.0D); -+ if (posX != this.encodedPosX || posY != this.encodedPosY || posZ != this.encodedPosZ) -+ { -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.makeEntitySpawnAdjustment(this.trackedEntity, p_73117_1_, this.encodedPosX, this.encodedPosY, this.encodedPosZ); -+ } -+ - if (this.sendVelocityUpdates && !(packet instanceof S0FPacketSpawnMob)) - { - p_73117_1_.playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(this.trackedEntity.getEntityId(), this.trackedEntity.motionX, this.trackedEntity.motionY, this.trackedEntity.motionZ)); -@@ -437,12 +445,14 @@ - p_73117_1_.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(this.trackedEntity.getEntityId(), potioneffect)); - } - } -+ net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(trackedEntity, p_73117_1_); - } - } - else if (this.trackingPlayers.contains(p_73117_1_)) - { - this.trackingPlayers.remove(p_73117_1_); - p_73117_1_.func_152339_d(this.trackedEntity); -+ net.minecraftforge.event.ForgeEventFactory.onStopEntityTracking(trackedEntity, p_73117_1_); - } - } - } -@@ -474,6 +484,9 @@ - logger.warn("Fetching addPacket for removed entity"); - } - -+ Packet pkt = net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.getEntitySpawningPacket(this.trackedEntity); -+ if (pkt != null) return pkt; -+ - if (this.trackedEntity instanceof EntityItem) - { - return new S0EPacketSpawnObject(this.trackedEntity, 2, 1); diff --git a/patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch b/patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch deleted file mode 100644 index edc78f44e..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java.patch +++ /dev/null @@ -1,61 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java -+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java -@@ -20,11 +20,14 @@ - private double field_151495_j; - private double field_151496_k; - private static final String __OBFID = "CL_00001595"; -+ private int failedPathFindingPenalty = 0; -+ private boolean canPenalize = false; - - public EntityAIAttackOnCollide(EntityCreature p_i1635_1_, Class p_i1635_2_, double p_i1635_3_, boolean p_i1635_5_) - { - this(p_i1635_1_, p_i1635_3_, p_i1635_5_); - this.classTarget = p_i1635_2_; -+ canPenalize = classTarget == null || !net.minecraft.entity.player.EntityPlayer.class.isAssignableFrom(classTarget); //Only enable delaying when not targeting players. - } - - public EntityAIAttackOnCollide(EntityCreature p_i1636_1_, double p_i1636_2_, boolean p_i1636_4_) -@@ -54,6 +57,19 @@ - } - else - { -+ if (canPenalize) -+ { -+ if (--this.field_75445_i <= 0) -+ { -+ this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); -+ this.field_151497_i = 4 + this.attacker.getRNG().nextInt(7); -+ return this.entityPathEntity != null; -+ } -+ else -+ { -+ return true; -+ } -+ } - this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); - return this.entityPathEntity != null; - } -@@ -91,6 +107,23 @@ - this.field_151496_k = entitylivingbase.posZ; - this.field_75445_i = 4 + this.attacker.getRNG().nextInt(7); - -+ if (this.canPenalize) -+ { -+ this.field_151497_i += failedPathFindingPenalty; -+ if (this.attacker.getNavigator().getPath() != null) -+ { -+ net.minecraft.pathfinding.PathPoint finalPathPoint = this.attacker.getNavigator().getPath().getFinalPathPoint(); -+ if (finalPathPoint != null && entitylivingbase.getDistanceSq(finalPathPoint.xCoord, finalPathPoint.yCoord, finalPathPoint.zCoord) < 1) -+ failedPathFindingPenalty = 0; -+ else -+ failedPathFindingPenalty += 10; -+ } -+ else -+ { -+ failedPathFindingPenalty += 10; -+ } -+ } -+ - if (d0 > 1024.0D) - { - this.field_75445_i += 10; diff --git a/patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch b/patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch deleted file mode 100644 index a1da34e91..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/boss/EntityDragon.java -+++ ../src-work/minecraft/net/minecraft/entity/boss/EntityDragon.java -@@ -486,9 +486,9 @@ - { - Block block = this.worldObj.getBlockState(new BlockPos(k1, l1, i2)).getBlock(); - -- if (block.getMaterial() != Material.air) -+ if (!block.isAir(worldObj, new BlockPos(k1, l1, i2))) - { -- if (block != Blocks.barrier && block != Blocks.obsidian && block != Blocks.end_stone && block != Blocks.bedrock && block != Blocks.command_block && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) -+ if (block.canEntityDestroy(worldObj, new BlockPos(k1, l1, i2), this) && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) - { - flag1 = this.worldObj.setBlockToAir(new BlockPos(k1, l1, i2)) || flag1; - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch b/patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch deleted file mode 100644 index f4a070815..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/boss/EntityWither.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/boss/EntityWither.java -+++ ../src-work/minecraft/net/minecraft/entity/boss/EntityWither.java -@@ -351,7 +351,7 @@ - int l = j1 + i2; - Block block = this.worldObj.getBlockState(new BlockPos(j2, k, l)).getBlock(); - -- if (block.getMaterial() != Material.air && block != Blocks.bedrock && block != Blocks.end_portal && block != Blocks.end_portal_frame && block != Blocks.command_block && block != Blocks.barrier) -+ if (!block.isAir(worldObj, new BlockPos(j2, k, l)) && block.canEntityDestroy(worldObj, new BlockPos(j2, k, l), this)) - { - flag = this.worldObj.destroyBlock(new BlockPos(j2, k, l), true) || flag; - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch b/patches.mcp/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch deleted file mode 100644 index 98bf84269..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/boss/IBossDisplayData.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/boss/IBossDisplayData.java -+++ ../src-work/minecraft/net/minecraft/entity/boss/IBossDisplayData.java -@@ -4,7 +4,6 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --@SideOnly(Side.CLIENT) - public interface IBossDisplayData - { - float getMaxHealth(); diff --git a/patches.mcp/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch b/patches.mcp/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch deleted file mode 100644 index 61146d333..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java -+++ ../src-work/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java -@@ -92,7 +92,8 @@ - for (int i = 0; i < list.size(); ++i) - { - Entity entity = (Entity)list.get(i); -- entity.onStruckByLightning(this); -+ if (!net.minecraftforge.event.ForgeEventFactory.onEntityStruckByLightning(entity, this)) -+ entity.onStruckByLightning(this); - } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch deleted file mode 100644 index 9086df4b3..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityEnderPearl.java.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityEnderPearl.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityEnderPearl.java -@@ -50,6 +50,9 @@ - - if (entityplayermp.playerNetServerHandler.getNetworkManager().isChannelOpen() && entityplayermp.worldObj == this.worldObj && !entityplayermp.isPlayerSleeping()) - { -+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ, 5.0F); -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) -+ { // Don't indent to lower patch size - if (this.rand.nextFloat() < 0.05F && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobSpawning")) - { - EntityEndermite entityendermite = new EntityEndermite(this.worldObj); -@@ -63,9 +66,10 @@ - entitylivingbase.mountEntity((Entity)null); - } - -- entitylivingbase.setPositionAndUpdate(this.posX, this.posY, this.posZ); -+ entitylivingbase.setPositionAndUpdate(event.targetX, event.targetY, event.targetZ); - entitylivingbase.fallDistance = 0.0F; -- entitylivingbase.attackEntityFrom(DamageSource.fall, 5.0F); -+ entitylivingbase.attackEntityFrom(DamageSource.fall, event.attackDamage); -+ } - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch deleted file mode 100644 index be95fe9e9..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityItem.java.patch +++ /dev/null @@ -1,94 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityItem.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityItem.java -@@ -31,6 +31,11 @@ - public float hoverStart; - private static final String __OBFID = "CL_00001669"; - -+ /** -+ * The maximum age of this EntityItem. The item is expired once this is reached. -+ */ -+ public int lifespan = 6000; -+ - public EntityItem(World worldIn, double x, double y, double z) - { - super(worldIn); -@@ -48,6 +53,7 @@ - { - this(worldIn, x, y, z); - this.setEntityItemStack(stack); -+ this.lifespan = (stack.getItem() == null ? 6000 : stack.getItem().getEntityLifespan(stack, worldIn)); - } - - protected boolean canTriggerWalking() -@@ -71,6 +77,8 @@ - - public void onUpdate() - { -+ ItemStack stack = this.getDataWatcher().getWatchableObjectItemStack(10); -+ if (stack != null && stack.getItem() != null && stack.getItem().onEntityItemUpdate(this)) return; - if (this.getEntityItem() == null) - { - this.setDead(); -@@ -131,8 +139,16 @@ - - this.handleWaterMovement(); - -- if (!this.worldObj.isRemote && this.age >= 6000) -+ ItemStack item = getDataWatcher().getWatchableObjectItemStack(10); -+ -+ if (!this.worldObj.isRemote && this.age >= lifespan) - { -+ int hook = net.minecraftforge.event.ForgeEventFactory.onItemExpire(this, item); -+ if (hook < 0) this.setDead(); -+ else this.lifespan += hook; -+ } -+ if (item != null && item.stackSize <= 0) -+ { - this.setDead(); - } - } -@@ -276,6 +292,7 @@ - tagCompound.setShort("Health", (short)((byte)this.health)); - tagCompound.setShort("Age", (short)this.age); - tagCompound.setShort("PickupDelay", (short)this.delayBeforeCanPickup); -+ tagCompound.setInteger("Lifespan", lifespan); - - if (this.getThrower() != null) - { -@@ -316,20 +333,23 @@ - NBTTagCompound nbttagcompound1 = tagCompund.getCompoundTag("Item"); - this.setEntityItemStack(ItemStack.loadItemStackFromNBT(nbttagcompound1)); - -- if (this.getEntityItem() == null) -- { -- this.setDead(); -- } -+ ItemStack item = getDataWatcher().getWatchableObjectItemStack(10); -+ if (item == null || item.stackSize <= 0) this.setDead(); -+ if (tagCompund.hasKey("Lifespan")) lifespan = tagCompund.getInteger("Lifespan"); - } - - public void onCollideWithPlayer(EntityPlayer entityIn) - { - if (!this.worldObj.isRemote) - { -+ if (this.delayBeforeCanPickup > 0) return; - ItemStack itemstack = this.getEntityItem(); - int i = itemstack.stackSize; - -- if (this.delayBeforeCanPickup == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack)) -+ int hook = net.minecraftforge.event.ForgeEventFactory.onItemPickup(this, entityIn, itemstack); -+ if (hook < 0) return; -+ -+ if (this.delayBeforeCanPickup <= 0 && (this.owner == null || lifespan - this.age <= 200 || this.owner.equals(entityIn.getName())) && (hook == 1 || i <= 0 || entityIn.inventory.addItemStackToInventory(itemstack))) - { - if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log)) - { -@@ -366,6 +386,7 @@ - } - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerItemPickupEvent(entityIn, this); - if (!this.isSilent()) - { - this.worldObj.playSoundAtEntity(entityIn, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch deleted file mode 100644 index 3b105563f..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityItemFrame.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityItemFrame.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityItemFrame.java -@@ -123,7 +123,7 @@ - { - if (p_110131_1_ != null) - { -- if (p_110131_1_.getItem() == Items.filled_map) -+ if (p_110131_1_.getItem() instanceof net.minecraft.item.ItemMap) - { - MapData mapdata = ((ItemMap)p_110131_1_.getItem()).getMapData(p_110131_1_, this.worldObj); - mapdata.playersVisibleOnMap.remove("frame-" + this.getEntityId()); diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch deleted file mode 100644 index e75910a28..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecart.java.patch +++ /dev/null @@ -1,454 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecart.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecart.java -@@ -52,6 +52,20 @@ - private double velocityZ; - private static final String __OBFID = "CL_00001670"; - -+ /* Forge: Minecart Compatibility Layer Integration. */ -+ public static float defaultMaxSpeedAirLateral = 0.4f; -+ public static float defaultMaxSpeedAirVertical = -1f; -+ public static double defaultDragAir = 0.94999998807907104D; -+ protected boolean canUseRail = true; -+ protected boolean canBePushed = true; -+ private static net.minecraftforge.common.IMinecartCollisionHandler collisionHandler = null; -+ -+ /* Instance versions of the above physics properties */ -+ private float currentSpeedRail = getMaxCartSpeedOnRail(); -+ protected float maxSpeedAirLateral = defaultMaxSpeedAirLateral; -+ protected float maxSpeedAirVertical = defaultMaxSpeedAirVertical; -+ protected double dragAir = defaultDragAir; -+ - public EntityMinecart(World worldIn) - { - super(worldIn); -@@ -97,17 +111,19 @@ - - public AxisAlignedBB getCollisionBox(Entity entityIn) - { -+ if (getCollisionHandler() != null) return getCollisionHandler().getCollisionBox(this, entityIn); - return entityIn.canBePushed() ? entityIn.getEntityBoundingBox() : null; - } - - public AxisAlignedBB getBoundingBox() - { -+ if (getCollisionHandler() != null) return getCollisionHandler().getBoundingBox(this); - return null; - } - - public boolean canBePushed() - { -- return true; -+ return canBePushed; - } - - public EntityMinecart(World worldIn, double p_i1713_2_, double p_i1713_4_, double p_i1713_6_) -@@ -309,7 +325,7 @@ - BlockPos blockpos = new BlockPos(j, i, k); - IBlockState iblockstate = this.worldObj.getBlockState(blockpos); - -- if (BlockRailBase.isRailBlock(iblockstate)) -+ if (canUseRail() && BlockRailBase.isRailBlock(iblockstate)) - { - this.func_180460_a(blockpos, iblockstate); - -@@ -347,7 +363,10 @@ - } - - this.setRotation(this.rotationYaw, this.rotationPitch); -- Iterator iterator = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D)).iterator(); -+ AxisAlignedBB box; -+ if (getCollisionHandler() != null) box = this.getCollisionHandler().getMinecartCollisionBox(this); -+ else box = this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D); -+ Iterator iterator = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, box).iterator(); - - while (iterator.hasNext()) - { -@@ -370,6 +389,7 @@ - } - - this.handleWaterMovement(); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartUpdateEvent(this, this.getCurrentRailPosition())); - } - } - -@@ -382,10 +402,21 @@ - - protected void moveDerailedMinecart() - { -- double d0 = this.func_174898_m(); -+ double d0 = onGround ? this.func_174898_m() : getMaxSpeedAirLateral(); - this.motionX = MathHelper.clamp_double(this.motionX, -d0, d0); - this.motionZ = MathHelper.clamp_double(this.motionZ, -d0, d0); - -+ double moveY = motionY; -+ if(getMaxSpeedAirVertical() > 0 && motionY > getMaxSpeedAirVertical()) -+ { -+ moveY = getMaxSpeedAirVertical(); -+ if(Math.abs(motionX) < 0.3f && Math.abs(motionZ) < 0.3f) -+ { -+ moveY = 0.15f; -+ motionY = moveY; -+ } -+ } -+ - if (this.onGround) - { - this.motionX *= 0.5D; -@@ -393,13 +424,13 @@ - this.motionZ *= 0.5D; - } - -- this.moveEntity(this.motionX, this.motionY, this.motionZ); -+ this.moveEntity(this.motionX, moveY, this.motionZ); - - if (!this.onGround) - { -- this.motionX *= 0.949999988079071D; -- this.motionY *= 0.949999988079071D; -- this.motionZ *= 0.949999988079071D; -+ this.motionX *= getDragAir(); -+ this.motionY *= getDragAir(); -+ this.motionZ *= getDragAir(); - } - } - -@@ -418,25 +449,25 @@ - flag1 = !flag; - } - -- double d0 = 0.0078125D; -+ double slopeAdjustment = getSlopeAdjustment(); - BlockRailBase.EnumRailDirection enumraildirection = (BlockRailBase.EnumRailDirection)p_180460_2_.getValue(blockrailbase.getShapeProperty()); - - switch (EntityMinecart.SwitchEnumMinecartType.RAIL_SHAPE_LOOKUP[enumraildirection.ordinal()]) - { - case 1: -- this.motionX -= 0.0078125D; -+ this.motionX -= slopeAdjustment; - ++this.posY; - break; - case 2: -- this.motionX += 0.0078125D; -+ this.motionX += slopeAdjustment; - ++this.posY; - break; - case 3: -- this.motionZ += 0.0078125D; -+ this.motionZ += slopeAdjustment; - ++this.posY; - break; - case 4: -- this.motionZ -= 0.0078125D; -+ this.motionZ -= slopeAdjustment; - ++this.posY; - } - -@@ -485,7 +516,7 @@ - } - } - -- if (flag1) -+ if (flag1 && shouldDoRailFunctions()) - { - d6 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); - -@@ -533,20 +564,8 @@ - this.posX = d7 + d1 * d6; - this.posZ = d8 + d2 * d6; - this.setPosition(this.posX, this.posY, this.posZ); -- d11 = this.motionX; -- d12 = this.motionZ; -+ this.moveMinecartOnRail(p_180460_1_); - -- if (this.riddenByEntity != null) -- { -- d11 *= 0.75D; -- d12 *= 0.75D; -- } -- -- double d13 = this.func_174898_m(); -- d11 = MathHelper.clamp_double(d11, -d13, d13); -- d12 = MathHelper.clamp_double(d12, -d13, d13); -- this.moveEntity(d11, 0.0D, d12); -- - if (aint[0][1] != 0 && MathHelper.floor_double(this.posX) - p_180460_1_.getX() == aint[0][0] && MathHelper.floor_double(this.posZ) - p_180460_1_.getZ() == aint[0][2]) - { - this.setPosition(this.posX, this.posY + (double)aint[0][1], this.posZ); -@@ -583,8 +602,14 @@ - this.motionZ = d5 * (double)(i - p_180460_1_.getZ()); - } - -- if (flag) -+ -+ if(shouldDoRailFunctions()) - { -+ ((BlockRailBase)p_180460_2_.getBlock()).onMinecartPass(worldObj, this, p_180460_1_); -+ } -+ -+ if (flag && shouldDoRailFunctions()) -+ { - double d15 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); - - if (d15 > 0.01D) -@@ -824,13 +849,20 @@ - - public void applyEntityCollision(Entity entityIn) - { -+ -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartCollisionEvent(this, entityIn)); -+ if (getCollisionHandler() != null) -+ { -+ getCollisionHandler().onEntityCollision(this, entityIn); -+ return; -+ } - if (!this.worldObj.isRemote) - { - if (!entityIn.noClip && !this.noClip) - { - if (entityIn != this.riddenByEntity) - { -- if (entityIn instanceof EntityLivingBase && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && this.getMinecartType() == EntityMinecart.EnumMinecartType.RIDEABLE && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && entityIn.ridingEntity == null) -+ if (entityIn instanceof EntityLivingBase && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && canBeRidden() && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && entityIn.ridingEntity == null) - { - entityIn.mountEntity(this); - } -@@ -876,7 +908,7 @@ - double d7 = entityIn.motionX + this.motionX; - double d8 = entityIn.motionZ + this.motionZ; - -- if (((EntityMinecart)entityIn).getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE && this.getMinecartType() != EntityMinecart.EnumMinecartType.FURNACE) -+ if (((EntityMinecart)entityIn).isPoweredCart() && !isPoweredCart()) - { - this.motionX *= 0.20000000298023224D; - this.motionZ *= 0.20000000298023224D; -@@ -884,7 +916,7 @@ - entityIn.motionX *= 0.949999988079071D; - entityIn.motionZ *= 0.949999988079071D; - } -- else if (((EntityMinecart)entityIn).getMinecartType() != EntityMinecart.EnumMinecartType.FURNACE && this.getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE) -+ else if (((EntityMinecart)entityIn).isPoweredCart() && isPoweredCart()) - { - entityIn.motionX *= 0.20000000298023224D; - entityIn.motionZ *= 0.20000000298023224D; -@@ -1049,6 +1081,221 @@ - } - } - -+ /* =================================== FORGE START ===========================================*/ -+ private BlockPos getCurrentRailPosition() -+ { -+ int x = MathHelper.floor_double(this.posX); -+ int y = MathHelper.floor_double(this.posY); -+ int z = MathHelper.floor_double(this.posZ); -+ -+ if (BlockRailBase.isRailBlock(this.worldObj, new BlockPos(x, y - 1, z))) y--; -+ return new BlockPos(x, y, z); -+ } -+ -+ protected double getMaxSpeed() -+ { -+ if (!canUseRail()) return func_174898_m(); -+ BlockPos pos = this.getCurrentRailPosition(); -+ IBlockState state = this.worldObj.getBlockState(pos); -+ if (!BlockRailBase.isRailBlock(state)) return func_174898_m(); -+ -+ float railMaxSpeed = ((BlockRailBase)state.getBlock()).getRailMaxSpeed(worldObj, this, pos); -+ return Math.min(railMaxSpeed, getCurrentCartSpeedCapOnRail()); -+ } -+ -+ /** -+ * Moved to allow overrides. -+ * This code handles minecart movement and speed capping when on a rail. -+ */ -+ public void moveMinecartOnRail(BlockPos pos) -+ { -+ double mX = this.motionX; -+ double mZ = this.motionZ; -+ -+ if (this.riddenByEntity != null) -+ { -+ mX *= 0.75D; -+ mZ *= 0.75D; -+ } -+ -+ double max = this.getMaxSpeed(); -+ mX = MathHelper.clamp_double(mX, -max, max); -+ mZ = MathHelper.clamp_double(mZ, -max, max); -+ this.moveEntity(mX, 0.0D, mZ); -+ } -+ -+ /** -+ * Gets the current global Minecart Collision handler if none -+ * is registered, returns null -+ * @return The collision handler or null -+ */ -+ public static net.minecraftforge.common.IMinecartCollisionHandler getCollisionHandler() -+ { -+ return collisionHandler; -+ } -+ -+ /** -+ * Sets the global Minecart Collision handler, overwrites any -+ * that is currently set. -+ * @param handler The new handler -+ */ -+ public static void setCollisionHandler(net.minecraftforge.common.IMinecartCollisionHandler handler) -+ { -+ collisionHandler = handler; -+ } -+ -+ /** -+ * This function returns an ItemStack that represents this cart. -+ * This should be an ItemStack that can be used by the player to place the cart, -+ * but is not necessary the item the cart drops when destroyed. -+ * @return An ItemStack that can be used to place the cart. -+ */ -+ public ItemStack getCartItem() -+ { -+ if (this instanceof EntityMinecartFurnace) -+ { -+ return new ItemStack(Items.furnace_minecart); -+ } -+ else if (this instanceof EntityMinecartChest) -+ { -+ return new ItemStack(Items.chest_minecart); -+ } -+ else if (this instanceof EntityMinecartTNT) -+ { -+ return new ItemStack(Items.tnt_minecart); -+ } -+ else if (this instanceof EntityMinecartHopper) -+ { -+ return new ItemStack(Items.hopper_minecart); -+ } -+ else if (this instanceof EntityMinecartCommandBlock) -+ { -+ return new ItemStack(Items.command_block_minecart); -+ } -+ return new ItemStack(Items.minecart); -+ } -+ -+ /** -+ * Returns true if this cart can currently use rails. -+ * This function is mainly used to gracefully detach a minecart from a rail. -+ * @return True if the minecart can use rails. -+ */ -+ public boolean canUseRail() -+ { -+ return canUseRail; -+ } -+ -+ /** -+ * Set whether the minecart can use rails. -+ * This function is mainly used to gracefully detach a minecart from a rail. -+ * @param use Whether the minecart can currently use rails. -+ */ -+ public void setCanUseRail(boolean use) -+ { -+ canUseRail = use; -+ } -+ -+ /** -+ * Return false if this cart should not call onMinecartPass() and should ignore Powered Rails. -+ * @return True if this cart should call onMinecartPass(). -+ */ -+ public boolean shouldDoRailFunctions() -+ { -+ return true; -+ } -+ -+ /** -+ * Returns true if this cart is self propelled. -+ * @return True if powered. -+ */ -+ public boolean isPoweredCart() -+ { -+ return getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE; -+ } -+ -+ /** -+ * Returns true if this cart can be ridden by an Entity. -+ * @return True if this cart can be ridden. -+ */ -+ public boolean canBeRidden() -+ { -+ return this.getMinecartType() == EntityMinecart.EnumMinecartType.RIDEABLE; -+ } -+ -+ /** -+ * Getters/setters for physics variables -+ */ -+ -+ /** -+ * Returns the carts max speed when traveling on rails. Carts going faster -+ * than 1.1 cause issues with chunk loading. Carts cant traverse slopes or -+ * corners at greater than 0.5 - 0.6. This value is compared with the rails -+ * max speed and the carts current speed cap to determine the carts current -+ * max speed. A normal rail's max speed is 0.4. -+ * -+ * @return Carts max speed. -+ */ -+ public float getMaxCartSpeedOnRail() -+ { -+ return 1.2f; -+ } -+ -+ /** -+ * Returns the current speed cap for the cart when traveling on rails. This -+ * functions differs from getMaxCartSpeedOnRail() in that it controls -+ * current movement and cannot be overridden. The value however can never be -+ * higher than getMaxCartSpeedOnRail(). -+ * -+ * @return -+ */ -+ public final float getCurrentCartSpeedCapOnRail() -+ { -+ return currentSpeedRail; -+ } -+ -+ public final void setCurrentCartSpeedCapOnRail(float value) -+ { -+ value = Math.min(value, getMaxCartSpeedOnRail()); -+ currentSpeedRail = value; -+ } -+ -+ public float getMaxSpeedAirLateral() -+ { -+ return maxSpeedAirLateral; -+ } -+ -+ public void setMaxSpeedAirLateral(float value) -+ { -+ maxSpeedAirLateral = value; -+ } -+ -+ public float getMaxSpeedAirVertical() -+ { -+ return maxSpeedAirVertical; -+ } -+ -+ public void setMaxSpeedAirVertical(float value) -+ { -+ maxSpeedAirVertical = value; -+ } -+ -+ public double getDragAir() -+ { -+ return dragAir; -+ } -+ -+ public void setDragAir(double value) -+ { -+ dragAir = value; -+ } -+ -+ public double getSlopeAdjustment() -+ { -+ return 0.0078125D; -+ } -+ -+ /* =================================== FORGE END ===========================================*/ -+ - public static enum EnumMinecartType - { - RIDEABLE(0, "MinecartRideable"), diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch deleted file mode 100644 index cdca16d4d..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java -@@ -173,6 +173,7 @@ - - public boolean interactFirst(EntityPlayer playerIn) - { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; - if (!this.worldObj.isRemote) - { - playerIn.displayGUIChest(this); diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch deleted file mode 100644 index 729dcfd0a..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java -@@ -20,6 +20,7 @@ - - public boolean interactFirst(EntityPlayer playerIn) - { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; - if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn) - { - return true; diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch deleted file mode 100644 index 46cb9f930..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java -@@ -132,6 +132,7 @@ - - public boolean interactFirst(EntityPlayer playerIn) - { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; - ItemStack itemstack = playerIn.inventory.getCurrentItem(); - - if (itemstack != null && itemstack.getItem() == Items.coal) diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch deleted file mode 100644 index 54d8cad44..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java -@@ -57,6 +57,7 @@ - - public boolean interactFirst(EntityPlayer playerIn) - { -+ if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, playerIn))) return true; - if (!this.worldObj.isRemote) - { - playerIn.displayGUIChest(this); diff --git a/patches.mcp/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch b/patches.mcp/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch deleted file mode 100644 index 296ca8a03..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/item/EntityXPOrb.java -+++ ../src-work/minecraft/net/minecraft/entity/item/EntityXPOrb.java -@@ -198,6 +198,7 @@ - { - if (this.field_70532_c == 0 && entityIn.xpCooldown == 0) - { -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerPickupXpEvent(entityIn, this))) return; - entityIn.xpCooldown = 2; - this.worldObj.playSoundAtEntity(entityIn, "random.orb", 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F)); - entityIn.onItemPickup(this, 1); diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch deleted file mode 100644 index f986ab50c..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/monster/EntityEnderman.java -+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityEnderman.java -@@ -204,12 +204,14 @@ - - protected boolean teleportTo(double p_70825_1_, double p_70825_3_, double p_70825_5_) - { -+ net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(this, p_70825_1_, p_70825_3_, p_70825_5_, 0); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return false; - double d3 = this.posX; - double d4 = this.posY; - double d5 = this.posZ; -- this.posX = p_70825_1_; -- this.posY = p_70825_3_; -- this.posZ = p_70825_5_; -+ this.posX = event.targetX; -+ this.posY = event.targetY; -+ this.posZ = event.targetZ; - boolean flag = false; - BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ); - -@@ -565,4 +567,16 @@ - } - } - } -+ -+ /*===================================== Forge Start ==============================*/ -+ public static void setCarriable(Block block, boolean canCarry) -+ { -+ if (canCarry) carriableBlocks.add(block); -+ else carriableBlocks.remove(block); -+ } -+ public static boolean getCarriable(Block block) -+ { -+ return carriableBlocks.contains(block); -+ } -+ /*===================================== Forge End ==============================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch deleted file mode 100644 index b68b510e8..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java -+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java -@@ -105,6 +105,7 @@ - { - this.motionY = (double)(0.42F + (float)this.getSlimeSize() * 0.1F); - this.isAirBorne = true; -+ net.minecraftforge.common.ForgeHooks.onLivingJump(this); - } - - protected void func_180466_bG() diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch deleted file mode 100644 index 96ce050c1..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/monster/EntitySlime.java -+++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySlime.java -@@ -271,7 +271,7 @@ - { - Chunk chunk = this.worldObj.getChunkFromBlockCoords(new BlockPos(MathHelper.floor_double(this.posX), 0, MathHelper.floor_double(this.posZ))); - -- if (this.worldObj.getWorldInfo().getTerrainType() == WorldType.FLAT && this.rand.nextInt(4) != 1) -+ if (this.worldObj.getWorldInfo().getTerrainType().handleSlimeSpawnReduction(rand, worldObj)) - { - return false; - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch b/patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch deleted file mode 100644 index 5468901ba..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch +++ /dev/null @@ -1,60 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/monster/EntityZombie.java -+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityZombie.java -@@ -89,7 +89,7 @@ - this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(35.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); -- this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * 0.10000000149011612D); -+ this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * net.minecraftforge.common.ForgeModContainer.zombieSummonBaseChance); - } - - protected void entityInit() -@@ -231,12 +231,25 @@ - entitylivingbase = (EntityLivingBase)source.getEntity(); - } - -- if (entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue()) -+ int i = MathHelper.floor_double(this.posX); -+ int j = MathHelper.floor_double(this.posY); -+ int k = MathHelper.floor_double(this.posZ); -+ -+ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent summonAid = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, worldObj, i, j, k, entitylivingbase, this.getEntityAttribute(reinforcementChance).getAttributeValue()); -+ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return true; -+ -+ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || -+ entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue()) - { -- int i = MathHelper.floor_double(this.posX); -- int j = MathHelper.floor_double(this.posY); -- int k = MathHelper.floor_double(this.posZ); -- EntityZombie entityzombie = new EntityZombie(this.worldObj); -+ EntityZombie entityzombie; -+ if (summonAid.customSummonedAid != null && summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW) -+ { -+ entityzombie = summonAid.customSummonedAid; -+ } -+ else -+ { -+ entityzombie = new EntityZombie(this.worldObj); -+ } - - for (int l = 0; l < 50; ++l) - { -@@ -251,7 +264,7 @@ - if (!this.worldObj.func_175636_b((double)i1, (double)j1, (double)k1, 7.0D) && this.worldObj.checkNoEntityCollision(entityzombie.getEntityBoundingBox(), entityzombie) && this.worldObj.getCollidingBoundingBoxes(entityzombie, entityzombie.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(entityzombie.getEntityBoundingBox())) - { - this.worldObj.spawnEntityInWorld(entityzombie); -- entityzombie.setAttackTarget(entitylivingbase); -+ if (entitylivingbase != null) entityzombie.setAttackTarget(entitylivingbase); - entityzombie.func_180482_a(this.worldObj.getDifficultyForLocation(new BlockPos(entityzombie)), (IEntityLivingData)null); - this.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0)); - entityzombie.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0)); -@@ -458,7 +471,7 @@ - - if (p_180482_2_1 == null) - { -- p_180482_2_1 = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < 0.05F, this.worldObj.rand.nextFloat() < 0.05F, null); -+ p_180482_2_1 = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < net.minecraftforge.common.ForgeModContainer.zombieBabyChance, this.worldObj.rand.nextFloat() < 0.05F, null); - } - - if (p_180482_2_1 instanceof EntityZombie.GroupData) diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch deleted file mode 100644 index 97788b993..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityHorse.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/passive/EntityHorse.java -+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityHorse.java -@@ -1260,6 +1260,7 @@ - } - - this.jumpPower = 0.0F; -+ net.minecraftforge.common.ForgeHooks.onLivingJump(this); - } - - this.stepHeight = 1.0F; diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch deleted file mode 100644 index f6bdbce10..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityMooshroom.java.patch +++ /dev/null @@ -1,62 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/passive/EntityMooshroom.java -+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityMooshroom.java -@@ -9,7 +9,7 @@ - import net.minecraft.util.EnumParticleTypes; - import net.minecraft.world.World; - --public class EntityMooshroom extends EntityCow -+public class EntityMooshroom extends EntityCow implements net.minecraftforge.common.IShearable - { - private static final String __OBFID = "CL_00001645"; - -@@ -20,6 +20,7 @@ - this.field_175506_bl = Blocks.mycelium; - } - -+ @SuppressWarnings("unused") - public boolean interact(EntityPlayer player) - { - ItemStack itemstack = player.inventory.getCurrentItem(); -@@ -39,7 +40,7 @@ - } - } - -- if (itemstack != null && itemstack.getItem() == Items.shears && this.getGrowingAge() >= 0) -+ if (false && itemstack != null && itemstack.getItem() == Items.shears && this.getGrowingAge() >= 0) //Forge Disable, Moved to onSheared - { - this.setDead(); - this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); -@@ -79,4 +80,33 @@ - { - return new EntityMooshroom(this.worldObj); - } -+ -+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos){ return getGrowingAge() >= 0; } -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.BlockPos pos, int fortune) -+ { -+ this.setDead(); -+ this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); -+ -+ EntityCow entitycow = new EntityCow(this.worldObj); -+ entitycow.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); -+ entitycow.setHealth(this.getHealth()); -+ entitycow.renderYawOffset = this.renderYawOffset; -+ -+ if (this.hasCustomName()) -+ { -+ entitycow.setCustomNameTag(this.getCustomNameTag()); -+ } -+ -+ this.worldObj.spawnEntityInWorld(entitycow); -+ -+ java.util.List ret = new java.util.ArrayList(); -+ for (int i = 0; i < 5; ++i) -+ { -+ ret.add(new ItemStack(Blocks.red_mushroom)); -+ } -+ -+ this.playSound("mob.sheep.shear", 1.0F, 1.0F); -+ return ret; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch deleted file mode 100644 index c2c76667c..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/passive/EntityOcelot.java -+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityOcelot.java -@@ -276,7 +276,7 @@ - - Block block = this.worldObj.getBlockState(blockpos.down()).getBlock(); - -- if (block == Blocks.grass || block.getMaterial() == Material.leaves) -+ if (block == Blocks.grass || block.isLeaves(worldObj, blockpos.down())) - { - return true; - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch deleted file mode 100644 index 88e34a852..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch +++ /dev/null @@ -1,45 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/passive/EntitySheep.java -+++ ../src-work/minecraft/net/minecraft/entity/passive/EntitySheep.java -@@ -35,7 +35,7 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - --public class EntitySheep extends EntityAnimal -+public class EntitySheep extends EntityAnimal implements net.minecraftforge.common.IShearable - { - private final InventoryCrafting inventoryCrafting = new InventoryCrafting(new Container() - { -@@ -142,11 +142,12 @@ - } - } - -+ @SuppressWarnings("unused") - public boolean interact(EntityPlayer player) - { - ItemStack itemstack = player.inventory.getCurrentItem(); - -- if (itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared() && !this.isChild()) -+ if (false && itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared() && !this.isChild()) //Forge: Moved to onSheared - { - if (!this.worldObj.isRemote) - { -@@ -334,4 +335,19 @@ - field_175514_bm.put(EnumDyeColor.RED, new float[] {0.6F, 0.2F, 0.2F}); - field_175514_bm.put(EnumDyeColor.BLACK, new float[] {0.1F, 0.1F, 0.1F}); - } -+ -+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return !this.getSheared() && !this.isChild(); } -+ @Override -+ public java.util.List onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) -+ { -+ this.setSheared(true); -+ int i = 1 + this.rand.nextInt(3); -+ -+ java.util.List ret = new java.util.ArrayList(); -+ for (int j = 0; j < i; ++j) -+ ret.add(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, this.getFleeceColor().getMetadata())); -+ -+ this.playSound("mob.sheep.shear", 1.0F, 1.0F); -+ return ret; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch b/patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch deleted file mode 100644 index 2b7169882..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/passive/EntityVillager.java -+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityVillager.java -@@ -83,6 +83,7 @@ - private boolean isLookingForHome; - private boolean field_175564_by; - private InventoryBasic villagerInventory; -+ @Deprecated //Use VillagerRegistry - private static final EntityVillager.ITradeList[][][][] DEFAULT_TRADE_LIST_MAP = new EntityVillager.ITradeList[][][][] {{{{new EntityVillager.EmeraldForItems(Items.wheat, new EntityVillager.PriceInfo(18, 22)), new EntityVillager.EmeraldForItems(Items.potato, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.EmeraldForItems(Items.carrot, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.ListItemForEmeralds(Items.bread, new EntityVillager.PriceInfo(-4, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.pumpkin), new EntityVillager.PriceInfo(8, 13)), new EntityVillager.ListItemForEmeralds(Items.pumpkin_pie, new EntityVillager.PriceInfo(-3, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.melon_block), new EntityVillager.PriceInfo(7, 12)), new EntityVillager.ListItemForEmeralds(Items.apple, new EntityVillager.PriceInfo(-5, -7))}, {new EntityVillager.ListItemForEmeralds(Items.cookie, new EntityVillager.PriceInfo(-6, -10)), new EntityVillager.ListItemForEmeralds(Items.cake, new EntityVillager.PriceInfo(1, 1))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ItemAndEmeraldToItem(Items.fish, new EntityVillager.PriceInfo(6, 6), Items.cooked_fish, new EntityVillager.PriceInfo(6, 6))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.fishing_rod, new EntityVillager.PriceInfo(7, 8))}}, {{new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.wool), new EntityVillager.PriceInfo(16, 22)), new EntityVillager.ListItemForEmeralds(Items.shears, new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 0), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 1), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 2), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 3), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 4), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 5), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 6), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 7), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 8), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 9), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 10), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 11), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 12), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 13), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 14), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 15), new EntityVillager.PriceInfo(1, 2))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.ListItemForEmeralds(Items.arrow, new EntityVillager.PriceInfo(-12, -8))}, {new EntityVillager.ListItemForEmeralds(Items.bow, new EntityVillager.PriceInfo(2, 3)), new EntityVillager.ItemAndEmeraldToItem(Item.getItemFromBlock(Blocks.gravel), new EntityVillager.PriceInfo(10, 10), Items.flint, new EntityVillager.PriceInfo(6, 10))}}}, {{{new EntityVillager.EmeraldForItems(Items.paper, new EntityVillager.PriceInfo(24, 36)), new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.EmeraldForItems(Items.book, new EntityVillager.PriceInfo(8, 10)), new EntityVillager.ListItemForEmeralds(Items.compass, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.bookshelf), new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.EmeraldForItems(Items.written_book, new EntityVillager.PriceInfo(2, 2)), new EntityVillager.ListItemForEmeralds(Items.clock, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glass), new EntityVillager.PriceInfo(-5, -3))}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListItemForEmeralds(Items.name_tag, new EntityVillager.PriceInfo(20, 22))}}}, {{{new EntityVillager.EmeraldForItems(Items.rotten_flesh, new EntityVillager.PriceInfo(36, 40)), new EntityVillager.EmeraldForItems(Items.gold_ingot, new EntityVillager.PriceInfo(8, 10))}, {new EntityVillager.ListItemForEmeralds(Items.redstone, new EntityVillager.PriceInfo(-4, -1)), new EntityVillager.ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new EntityVillager.PriceInfo(-2, -1))}, {new EntityVillager.ListItemForEmeralds(Items.ender_eye, new EntityVillager.PriceInfo(7, 11)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glowstone), new EntityVillager.PriceInfo(-3, -1))}, {new EntityVillager.ListItemForEmeralds(Items.experience_bottle, new EntityVillager.PriceInfo(3, 11))}}}, {{{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_helmet, new EntityVillager.PriceInfo(4, 6))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListItemForEmeralds(Items.iron_chestplate, new EntityVillager.PriceInfo(10, 14))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_chestplate, new EntityVillager.PriceInfo(16, 19))}, {new EntityVillager.ListItemForEmeralds(Items.chainmail_boots, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_leggings, new EntityVillager.PriceInfo(9, 11)), new EntityVillager.ListItemForEmeralds(Items.chainmail_helmet, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_chestplate, new EntityVillager.PriceInfo(11, 15))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_axe, new EntityVillager.PriceInfo(6, 8))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_sword, new EntityVillager.PriceInfo(9, 10))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_sword, new EntityVillager.PriceInfo(12, 15)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_axe, new EntityVillager.PriceInfo(9, 12))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_shovel, new EntityVillager.PriceInfo(5, 7))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_pickaxe, new EntityVillager.PriceInfo(9, 11))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_pickaxe, new EntityVillager.PriceInfo(12, 15))}}}, {{{new EntityVillager.EmeraldForItems(Items.porkchop, new EntityVillager.PriceInfo(14, 18)), new EntityVillager.EmeraldForItems(Items.chicken, new EntityVillager.PriceInfo(14, 18))}, {new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.cooked_porkchop, new EntityVillager.PriceInfo(-7, -5)), new EntityVillager.ListItemForEmeralds(Items.cooked_chicken, new EntityVillager.PriceInfo(-8, -6))}}, {{new EntityVillager.EmeraldForItems(Items.leather, new EntityVillager.PriceInfo(9, 12)), new EntityVillager.ListItemForEmeralds(Items.leather_leggings, new EntityVillager.PriceInfo(2, 4))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.leather_chestplate, new EntityVillager.PriceInfo(7, 12))}, {new EntityVillager.ListItemForEmeralds(Items.saddle, new EntityVillager.PriceInfo(8, 10))}}}}; - private static final String __OBFID = "CL_00001707"; - -@@ -228,7 +229,7 @@ - ItemStack itemstack = player.inventory.getCurrentItem(); - boolean flag = itemstack != null && itemstack.getItem() == Items.spawn_egg; - -- if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild()) -+ if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild() && !player.isSneaking()) - { - if (!this.worldObj.isRemote && (this.buyingList == null || this.buyingList.size() > 0)) - { -@@ -540,6 +541,7 @@ - - private void populateBuyingList() - { -+ //TODO: Hook into VillagerRegistry - EntityVillager.ITradeList[][][] aitradelist = DEFAULT_TRADE_LIST_MAP[this.getProfession()]; - - if (this.careerId != 0 && this.careerLevel != 0) -@@ -648,6 +650,7 @@ - } - } - -+ //TODO: Hook into VillagerRegistry to get name - if (s1 != null) - { - ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("entity.Villager." + s1, new Object[0]); -@@ -710,7 +713,7 @@ - public IEntityLivingData func_180482_a(DifficultyInstance p_180482_1_, IEntityLivingData p_180482_2_) - { - p_180482_2_ = super.func_180482_a(p_180482_1_, p_180482_2_); -- this.setProfession(this.worldObj.rand.nextInt(5)); -+ net.minecraftforge.fml.common.registry.VillagerRegistry.setRandomProfession(this, this.worldObj.rand); - this.func_175552_ct(); - return p_180482_2_; - } diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch deleted file mode 100644 index b65fb2c57..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ /dev/null @@ -1,637 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayer.java -+++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayer.java -@@ -77,9 +77,23 @@ - import net.minecraft.world.WorldSettings; - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; -+import net.minecraftforge.common.ISpecialArmor.ArmorProperties; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.ForgeEventFactory; -+import net.minecraftforge.event.entity.living.LivingHurtEvent; -+import net.minecraftforge.event.entity.player.AttackEntityEvent; -+import net.minecraftforge.event.entity.player.EntityInteractEvent; -+import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; -+import net.minecraftforge.event.entity.player.PlayerDropsEvent; -+import net.minecraftforge.event.entity.player.PlayerFlyableFallEvent; -+import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent; - - public abstract class EntityPlayer extends EntityLivingBase - { -+ public static final String PERSISTED_NBT_TAG = "PlayerPersisted"; -+ private java.util.HashMap spawnChunkMap = new java.util.HashMap(); -+ private java.util.HashMap spawnForcedMap = new java.util.HashMap(); -+ - public InventoryPlayer inventory = new InventoryPlayer(this); - private InventoryEnderChest theInventoryEnderChest = new InventoryEnderChest(); - public Container inventoryContainer; -@@ -118,6 +132,7 @@ - private final GameProfile gameProfile; - private boolean hasReducedDebug = false; - public EntityFishHook fishEntity; -+ public float eyeHeight = this.getDefaultEyeHeight(); - private static final String __OBFID = "CL_00001711"; - - public EntityPlayer(World worldIn, GameProfile p_i45324_2_) -@@ -176,7 +191,8 @@ - { - if (this.itemInUse != null) - { -- this.itemInUse.onPlayerStoppedUsing(this.worldObj, this, this.itemInUseCount); -+ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, itemInUse, this.itemInUseCount)) -+ this.itemInUse.onPlayerStoppedUsing(this.worldObj, this, this.itemInUseCount); - } - - this.clearItemInUse(); -@@ -200,6 +216,7 @@ - - public void onUpdate() - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPreTick(this); - this.noClip = this.isSpectator(); - - if (this.isSpectator()) -@@ -213,6 +230,14 @@ - - if (itemstack == this.itemInUse) - { -+ itemInUseCount = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, itemInUse, itemInUseCount); -+ if (itemInUseCount <= 0) -+ { -+ this.onItemUseFinish(); -+ } -+ else -+ { // Forge Keep unindented to lower patch -+ itemInUse.getItem().onUsingTick(itemInUse, this, itemInUseCount); //Forge Added - if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0) - { - this.updateItemUse(itemstack, 5); -@@ -222,6 +247,7 @@ - { - this.onItemUseFinish(); - } -+ } - } - else - { -@@ -267,7 +293,7 @@ - - super.onUpdate(); - -- if (!this.worldObj.isRemote && this.openContainer != null && !this.openContainer.canInteractWith(this)) -+ if (!this.worldObj.isRemote && this.openContainer != null && !net.minecraftforge.common.ForgeHooks.canInteractWith(this, this.openContainer)) - { - this.closeScreen(); - this.openContainer = this.inventoryContainer; -@@ -344,6 +370,7 @@ - { - this.setPosition(d3, this.posY, d4); - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPostTick(this); - } - - public int getMaxInPortalTime() -@@ -413,11 +440,13 @@ - int i = this.itemInUse.stackSize; - ItemStack itemstack = this.itemInUse.onItemUseFinish(this.worldObj, this); - -+ itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, itemInUse, itemInUseCount, itemstack); -+ - if (itemstack != this.itemInUse || itemstack != null && itemstack.stackSize != i) - { - this.inventory.mainInventory[this.inventory.currentItem] = itemstack; - -- if (itemstack.stackSize == 0) -+ if (itemstack != null && itemstack.stackSize == 0) - { - this.inventory.mainInventory[this.inventory.currentItem] = null; - } -@@ -477,11 +506,11 @@ - this.cameraYaw = 0.0F; - this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2); - -- if (this.ridingEntity instanceof EntityPig) -+ if (this.ridingEntity instanceof EntityLivingBase && ((EntityLivingBase)ridingEntity).shouldRiderFaceForward(this)) - { - this.rotationPitch = f1; - this.rotationYaw = f; -- this.renderYawOffset = ((EntityPig)this.ridingEntity).renderYawOffset; -+ this.renderYawOffset = ((EntityLivingBase)this.ridingEntity).renderYawOffset; - } - } - } -@@ -611,11 +640,15 @@ - - public void onDeath(DamageSource cause) - { -+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; - super.onDeath(cause); - this.setSize(0.2F, 0.2F); - this.setPosition(this.posX, this.posY, this.posZ); - this.motionY = 0.10000000149011612D; - -+ captureDrops = true; -+ capturedDrops.clear(); -+ - if (this.getName().equals("Notch")) - { - this.dropItem(new ItemStack(Items.apple, 1), true, false); -@@ -626,6 +659,9 @@ - this.inventory.dropAllItems(); - } - -+ captureDrops = false; -+ if (!worldObj.isRemote) net.minecraftforge.event.ForgeEventFactory.onPlayerDrops(this, cause, capturedDrops, recentlyHit > 0); -+ - if (cause != null) - { - this.motionX = (double)(-MathHelper.cos((this.attackedAtYaw + this.rotationYaw) * (float)Math.PI / 180.0F) * 0.1F); -@@ -714,12 +750,25 @@ - - public EntityItem dropOneItem(boolean p_71040_1_) - { -- return this.dropItem(this.inventory.decrStackSize(this.inventory.currentItem, p_71040_1_ && this.inventory.getCurrentItem() != null ? this.inventory.getCurrentItem().stackSize : 1), false, true); -+ ItemStack stack = inventory.getCurrentItem(); -+ -+ if (stack == null) -+ { -+ return null; -+ } -+ -+ if (stack.getItem().onDroppedByPlayer(stack, this)) -+ { -+ int count = p_71040_1_ && this.inventory.getCurrentItem() != null ? this.inventory.getCurrentItem().stackSize : 1; -+ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, inventory.decrStackSize(inventory.currentItem, count), true); -+ } -+ -+ return null; - } - - public EntityItem dropPlayerItemWithRandomChoice(ItemStack itemStackIn, boolean unused) - { -- return this.dropItem(itemStackIn, false, false); -+ return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, itemStackIn, false); - } - - public EntityItem dropItem(ItemStack droppedItem, boolean dropAround, boolean traceItem) -@@ -780,13 +829,25 @@ - - public void joinEntityItemWithWorld(EntityItem p_71012_1_) - { -+ if (captureDrops) -+ { -+ capturedDrops.add(p_71012_1_); -+ return; -+ } - this.worldObj.spawnEntityInWorld(p_71012_1_); - } - -+ @Deprecated //Use location sensitive version below - public float getToolDigEfficiency(Block p_180471_1_) - { -- float f = this.inventory.getStrVsBlock(p_180471_1_); -+ return getBreakSpeed(p_180471_1_.getDefaultState(), new BlockPos(0, -1, 0)); -+ } - -+ public float getBreakSpeed(IBlockState state, BlockPos pos) -+ { -+ ItemStack stack = inventory.getCurrentItem(); -+ float f = (stack == null ? 1.0F : stack.getItem().getDigSpeed(stack, state)); -+ - if (f > 1.0F) - { - int i = EnchantmentHelper.getEfficiencyModifier(this); -@@ -836,12 +897,13 @@ - f /= 5.0F; - } - -- return f; -+ f = net.minecraftforge.event.ForgeEventFactory.getBreakSpeed(this, state, f, pos); -+ return (f < 0 ? 0 : f); - } - - public boolean canHarvestBlock(Block p_146099_1_) - { -- return this.inventory.func_146025_b(p_146099_1_); -+ return net.minecraftforge.event.ForgeEventFactory.doPlayerHarvestCheck(this, p_146099_1_, this.inventory.func_146025_b(p_146099_1_)); - } - - public void readEntityFromNBT(NBTTagCompound tagCompund) -@@ -877,6 +939,16 @@ - this.spawnForced = tagCompund.getBoolean("SpawnForced"); - } - -+ NBTTagList spawnlist = null; -+ spawnlist = tagCompund.getTagList("Spawns", 10); -+ for (int i = 0; i < spawnlist.tagCount(); i++) -+ { -+ NBTTagCompound spawndata = (NBTTagCompound)spawnlist.getCompoundTagAt(i); -+ int spawndim = spawndata.getInteger("Dim"); -+ this.spawnChunkMap.put(spawndim, new BlockPos(spawndata.getInteger("SpawnX"), spawndata.getInteger("SpawnY"), spawndata.getInteger("SpawnZ"))); -+ this.spawnForcedMap.put(spawndim, spawndata.getBoolean("SpawnForced")); -+ } -+ - this.foodStats.readNBT(tagCompund); - this.capabilities.readCapabilitiesFromNBT(tagCompund); - -@@ -908,6 +980,23 @@ - tagCompound.setBoolean("SpawnForced", this.spawnForced); - } - -+ NBTTagList spawnlist = new NBTTagList(); -+ for (java.util.Map.Entry entry : this.spawnChunkMap.entrySet()) -+ { -+ BlockPos spawn = entry.getValue(); -+ if (spawn == null) continue; -+ Boolean forced = spawnForcedMap.get(entry.getKey()); -+ if (forced == null) forced = false; -+ NBTTagCompound spawndata = new NBTTagCompound(); -+ spawndata.setInteger("Dim", entry.getKey()); -+ spawndata.setInteger("SpawnX", spawn.getX()); -+ spawndata.setInteger("SpawnY", spawn.getY()); -+ spawndata.setInteger("SpawnZ", spawn.getZ()); -+ spawndata.setBoolean("SpawnForced", forced); -+ spawnlist.appendTag(spawndata); -+ } -+ tagCompound.setTag("Spawns", spawnlist); -+ - this.foodStats.writeNBT(tagCompound); - this.capabilities.writeCapabilitiesToNBT(tagCompound); - tagCompound.setTag("EnderItems", this.theInventoryEnderChest.saveInventoryToNBT()); -@@ -921,6 +1010,7 @@ - - public boolean attackEntityFrom(DamageSource source, float amount) - { -+ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, source, amount)) return false; - if (this.isEntityInvulnerable(source)) - { - return false; -@@ -1021,12 +1111,15 @@ - { - if (!this.isEntityInvulnerable(damageSrc)) - { -+ damageAmount = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, damageSrc, damageAmount); -+ if (damageAmount <= 0) return; - if (!damageSrc.isUnblockable() && this.isBlocking() && damageAmount > 0.0F) - { - damageAmount = (1.0F + damageAmount) * 0.5F; - } - -- damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); -+ damageAmount = net.minecraftforge.common.ISpecialArmor.ArmorProperties.applyArmor(this, inventory.armorInventory, damageSrc, damageAmount); -+ if (damageAmount <= 0) return; - damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); - float f1 = damageAmount; - damageAmount = Math.max(damageAmount - this.getAbsorptionAmount(), 0.0F); -@@ -1074,6 +1167,7 @@ - } - else - { -+ if (!net.minecraftforge.event.ForgeEventFactory.canInteractWith(this, p_70998_1_)) return false; - ItemStack itemstack = this.getCurrentEquippedItem(); - ItemStack itemstack1 = itemstack != null ? itemstack.copy() : null; - -@@ -1125,7 +1219,9 @@ - - public void destroyCurrentEquippedItem() - { -+ ItemStack orig = getCurrentEquippedItem(); - this.inventory.setInventorySlotContents(this.inventory.currentItem, (ItemStack)null); -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, orig); - } - - public double getYOffset() -@@ -1135,6 +1231,7 @@ - - public void attackTargetEntityWithCurrentItem(Entity targetEntity) - { -+ if (!net.minecraftforge.common.ForgeHooks.onPlayerAttackTarget(this, targetEntity)) return; - if (targetEntity.canAttackWithItem()) - { - if (!targetEntity.hitByEntity(this)) -@@ -1305,6 +1402,8 @@ - - public EntityPlayer.EnumStatus trySleep(BlockPos bedLocation) - { -+ EntityPlayer.EnumStatus ret = net.minecraftforge.event.ForgeEventFactory.onPlayerSleepInBed(this, bedLocation); -+ if (ret != null) return ret; - if (!this.worldObj.isRemote) - { - if (this.isPlayerSleeping() || !this.isEntityAlive()) -@@ -1346,7 +1445,7 @@ - - if (this.worldObj.isBlockLoaded(bedLocation)) - { -- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(bedLocation).getValue(BlockDirectional.FACING); -+ EnumFacing enumfacing = this.worldObj.getBlockState(bedLocation).getBlock().getBedDirection(worldObj, bedLocation); - float f = 0.5F; - float f1 = 0.5F; - -@@ -1409,13 +1508,14 @@ - - public void wakeUpPlayer(boolean p_70999_1_, boolean updateWorldFlag, boolean setSpawn) - { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this, p_70999_1_, updateWorldFlag, setSpawn); - this.setSize(0.6F, 1.8F); - IBlockState iblockstate = this.worldObj.getBlockState(this.playerLocation); - -- if (this.playerLocation != null && iblockstate.getBlock() == Blocks.bed) -+ if (this.playerLocation != null && iblockstate.getBlock().isBed(worldObj, playerLocation, this)) - { -- this.worldObj.setBlockState(this.playerLocation, iblockstate.withProperty(BlockBed.OCCUPIED, Boolean.valueOf(false)), 4); -- BlockPos blockpos = BlockBed.getSafeExitLocation(this.worldObj, this.playerLocation, 0); -+ iblockstate.getBlock().setBedOccupied(worldObj, playerLocation, this, false); -+ BlockPos blockpos = iblockstate.getBlock().getBedSpawnPosition(worldObj, playerLocation, this); - - if (blockpos == null) - { -@@ -1442,12 +1542,12 @@ - - private boolean isInBed() - { -- return this.worldObj.getBlockState(this.playerLocation).getBlock() == Blocks.bed; -+ return this.worldObj.getBlockState(this.playerLocation).getBlock().isBed(worldObj, playerLocation, this); - } - - public static BlockPos getBedSpawnLocation(World worldIn, BlockPos bedLocation, boolean forceSpawn) - { -- if (worldIn.getBlockState(bedLocation).getBlock() != Blocks.bed) -+ if (!worldIn.getBlockState(bedLocation).getBlock().isBed(worldIn, bedLocation, null)) - { - if (!forceSpawn) - { -@@ -1464,7 +1564,7 @@ - } - else - { -- return BlockBed.getSafeExitLocation(worldIn, bedLocation, 0); -+ return worldIn.getBlockState(bedLocation).getBlock().getBedSpawnPosition(worldIn, bedLocation, null); - } - } - -@@ -1473,7 +1573,7 @@ - { - if (this.playerLocation != null) - { -- EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(this.playerLocation).getValue(BlockDirectional.FACING); -+ EnumFacing enumfacing = this.worldObj.getBlockState(this.playerLocation).getBlock().getBedDirection(worldObj, playerLocation); - - switch (EntityPlayer.SwitchEnumFacing.FACING_LOOKUP[enumfacing.ordinal()]) - { -@@ -1511,16 +1611,23 @@ - - public BlockPos getBedLocation() - { -- return this.spawnChunk; -+ return getBedLocation(this.dimension); - } - -+ @Deprecated - public boolean isSpawnForced() - { -- return this.spawnForced; -+ return isSpawnForced(this.dimension); - } - - public void setSpawnPoint(BlockPos pos, boolean forced) - { -+ if(net.minecraftforge.event.ForgeEventFactory.onPlayerSpawnSet(this, pos, forced)) return; -+ if (this.dimension != 0) -+ { -+ setSpawnChunk(pos, forced, this.dimension); -+ return; -+ } - if (pos != null) - { - this.spawnChunk = pos; -@@ -1702,6 +1809,10 @@ - - super.fall(distance, damageMultiplier); - } -+ else -+ { -+ net.minecraftforge.event.ForgeEventFactory.onPlayerFall(this, distance, damageMultiplier); -+ } - } - - protected void resetHeight() -@@ -1725,6 +1836,7 @@ - } - - EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entityLivingIn))); -+ if (entityegginfo == null) entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.getEntityString(entityLivingIn)); - - if (entityegginfo != null) - { -@@ -1837,6 +1949,8 @@ - { - if (stack != this.itemInUse) - { -+ duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, stack, duration); -+ if (duration <= 0) return; - this.itemInUse = stack; - this.itemInUseCount = duration; - -@@ -1906,6 +2020,10 @@ - this.experience = oldPlayer.experience; - this.setScore(oldPlayer.getScore()); - this.teleportDirection = oldPlayer.teleportDirection; -+ //Copy and re-init ExtendedProperties when switching dimensions. -+ this.extendedProperties = oldPlayer.extendedProperties; -+ for (net.minecraftforge.common.IExtendedEntityProperties p : this.extendedProperties.values()) -+ p.init(this, this.worldObj); - } - else if (this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) - { -@@ -1918,6 +2036,18 @@ - - this.theInventoryEnderChest = oldPlayer.theInventoryEnderChest; - this.getDataWatcher().updateObject(10, Byte.valueOf(oldPlayer.getDataWatcher().getWatchableObjectByte(10))); -+ -+ this.spawnChunkMap = oldPlayer.spawnChunkMap; -+ this.spawnForcedMap = oldPlayer.spawnForcedMap; -+ -+ //Copy over a section of the Entity Data from the old player. -+ //Allows mods to specify data that persists after players respawn. -+ NBTTagCompound old = oldPlayer.getEntityData(); -+ if (old.hasKey(PERSISTED_NBT_TAG)) -+ { -+ getEntityData().setTag(PERSISTED_NBT_TAG, old.getCompoundTag(PERSISTED_NBT_TAG)); -+ } -+ net.minecraftforge.event.ForgeEventFactory.onPlayerClone(this, oldPlayer, !respawnFromEnd); - } - - protected boolean canTriggerWalking() -@@ -1951,7 +2081,14 @@ - - public void setCurrentItemOrArmor(int slotIn, ItemStack stack) - { -- this.inventory.armorInventory[slotIn] = stack; -+ if (slotIn == 0) //Forge: Fix issue in Player where it doen't take into account selected item -+ { -+ this.inventory.mainInventory[this.inventory.currentItem] = stack; -+ } -+ else -+ { -+ this.inventory.armorInventory[slotIn - 1] = stack; -+ } - } - - @SideOnly(Side.CLIENT) -@@ -1996,7 +2133,10 @@ - - public IChatComponent getDisplayName() - { -- ChatComponentText chatcomponenttext = new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getName())); -+ ChatComponentText chatcomponenttext = new ChatComponentText(""); -+ if (!prefixes.isEmpty()) for (net.minecraft.util.IChatComponent prefix : prefixes) chatcomponenttext.appendSibling(prefix); -+ chatcomponenttext.appendSibling(new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getDisplayNameString()))); -+ if (!suffixes.isEmpty()) for (net.minecraft.util.IChatComponent suffix : suffixes) chatcomponenttext.appendSibling(suffix); - chatcomponenttext.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.getName() + " ")); - chatcomponenttext.getChatStyle().setChatHoverEvent(this.func_174823_aP()); - chatcomponenttext.getChatStyle().setInsertion(this.getName()); -@@ -2005,7 +2145,7 @@ - - public float getEyeHeight() - { -- float f = 1.62F; -+ float f = eyeHeight; - - if (this.isPlayerSleeping()) - { -@@ -2139,6 +2279,136 @@ - this.hasReducedDebug = reducedDebug; - } - -+ /** -+ * Opens a GUI with this player, uses FML's IGuiHandler system. -+ * Allows for extension by modders. -+ * -+ * @param mod The mod trying to open a GUI -+ * @param modGuiId GUI ID -+ * @param world Current World -+ * @param x Passed directly to IGuiHandler, data meaningless Typically world X position -+ * @param y Passed directly to IGuiHandler, data meaningless Typically world Y position -+ * @param z Passed directly to IGuiHandler, data meaningless Typically world Z position -+ */ -+ public void openGui(Object mod, int modGuiId, World world, int x, int y, int z) -+ { -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(this, mod, modGuiId, world, x, y, z); -+ } -+ -+ -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * A dimension aware version of getBedLocation. -+ * @param dimension The dimension to get the bed spawn for -+ * @return The player specific spawn location for the dimension. May be null. -+ */ -+ public BlockPos getBedLocation(int dimension) -+ { -+ return dimension == 0 ? spawnChunk : spawnChunkMap.get(dimension); -+ } -+ -+ /** -+ * A dimension aware version of isSpawnForced. -+ * Noramally isSpawnForced is used to determine if the respawn system should check for a bed or not. -+ * This just extends that to be dimension aware. -+ * @param dimension The dimension to get whether to check for a bed before spawning for -+ * @return The player specific spawn location for the dimension. May be null. -+ */ -+ public boolean isSpawnForced(int dimension) -+ { -+ if (dimension == 0) return this.spawnForced; -+ Boolean forced = this.spawnForcedMap.get(dimension); -+ return forced == null ? false : forced; -+ } -+ -+ /** -+ * A dimension aware version of setSpawnChunk. -+ * This functions identically, but allows you to specify which dimension to affect, rather than affecting the player's current dimension. -+ * @param pos The spawn point to set as the player-specific spawn point for the dimension -+ * @param forced Whether or not the respawn code should check for a bed at this location (true means it won't check for a bed) -+ * @param dimension Which dimension to apply the player-specific respawn point to -+ */ -+ public void setSpawnChunk(BlockPos pos, boolean forced, int dimension) -+ { -+ if (dimension == 0) -+ { -+ if (pos != null) -+ { -+ spawnChunk = pos; -+ spawnForced = forced; -+ } -+ else -+ { -+ spawnChunk = null; -+ spawnForced = false; -+ } -+ return; -+ } -+ -+ if (pos != null) -+ { -+ spawnChunkMap.put(dimension, pos); -+ spawnForcedMap.put(dimension, forced); -+ } -+ else -+ { -+ spawnChunkMap.remove(dimension); -+ spawnForcedMap.remove(dimension); -+ } -+ } -+ -+ private String displayname; -+ -+ /** -+ * Returns the default eye height of the player -+ * @return player default eye height -+ */ -+ public float getDefaultEyeHeight() -+ { -+ return 1.62F; -+ } -+ -+ /** -+ * Get the currently computed display name, cached for efficiency. -+ * @return the current display name -+ */ -+ public String getDisplayNameString() -+ { -+ if(this.displayname == null) -+ { -+ this.displayname = ForgeEventFactory.getPlayerDisplayName(this, this.getName()); -+ } -+ return this.displayname; -+ } -+ -+ /** -+ * Force the displayed name to refresh -+ */ -+ public void refreshDisplayName() -+ { -+ this.displayname = ForgeEventFactory.getPlayerDisplayName(this, this.getName()); -+ } -+ -+ private final java.util.Collection prefixes = new java.util.LinkedList(); -+ private final java.util.Collection suffixes = new java.util.LinkedList(); -+ -+ /** -+ * Add a prefix to the player's username in chat -+ * @param prefix The prefix -+ */ -+ public void addPrefix(net.minecraft.util.IChatComponent prefix) { prefixes.add(prefix); } -+ -+ /** -+ * Add a suffix to the player's username in chat -+ * @param suffix The suffix -+ */ -+ public void addSuffix(net.minecraft.util.IChatComponent suffix) { suffixes.add(suffix); } -+ -+ public java.util.Collection getPrefixes() { return this.prefixes; } -+ public java.util.Collection getSuffixes() { return this.suffixes; } -+ -+ /* ======================================== FORGE END =====================================*/ -+ - public static enum EnumChatVisibility - { - FULL(0, "options.chat.visibility.full"), diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch deleted file mode 100644 index 7db228e41..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch +++ /dev/null @@ -1,92 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayerMP.java -+++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayerMP.java -@@ -127,14 +127,15 @@ - public boolean playerConqueredTheEnd; - private static final String __OBFID = "CL_00001440"; - -+ @SuppressWarnings("unused") - public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, ItemInWorldManager interactionManager) - { - super(worldIn, profile); - interactionManager.thisPlayerMP = this; - this.theItemInWorldManager = interactionManager; -- BlockPos blockpos = worldIn.getSpawnPoint(); -+ BlockPos blockpos = worldIn.provider.getRandomizedSpawnPoint(); - -- if (!worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) -+ if (false && !worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) - { - int i = Math.max(5, server.getSpawnProtectionSize() - 6); - int j = MathHelper.floor_double(worldIn.getWorldBorder().getClosestDistance((double)blockpos.getX(), (double)blockpos.getZ())); -@@ -227,7 +228,7 @@ - - this.openContainer.detectAndSendChanges(); - -- if (!this.worldObj.isRemote && !this.openContainer.canInteractWith(this)) -+ if (!this.worldObj.isRemote && !net.minecraftforge.common.ForgeHooks.canInteractWith(this, this.openContainer)) - { - this.closeScreen(); - this.openContainer = this.inventoryContainer; -@@ -269,7 +270,8 @@ - if (chunk.isPopulated()) - { - arraylist.add(chunk); -- arraylist1.addAll(((WorldServer)this.worldObj).func_147486_a(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 16, 256, chunkcoordintpair.chunkZPos * 16 + 16)); -+ arraylist1.addAll(((WorldServer)this.worldObj).func_147486_a(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 15, 256, chunkcoordintpair.chunkZPos * 16 + 15)); -+ //BugFix: 16 makes it load an extra chunk, which isn't associated with a player, which makes it not unload unless a player walks near it. - iterator1.remove(); - } - } -@@ -305,6 +307,7 @@ - { - chunk = (Chunk)iterator2.next(); - this.getServerForPlayer().getEntityTracker().func_85172_a(this, chunk); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(chunk.getChunkCoordIntPair(), this)); - } - } - } -@@ -440,6 +443,7 @@ - - public void onDeath(DamageSource cause) - { -+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, cause)) return; - if (this.worldObj.getGameRules().getGameRuleBooleanValue("showDeathMessages")) - { - Team team = this.getTeam(); -@@ -463,7 +467,20 @@ - - if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) - { -+ captureDrops = true; -+ capturedDrops.clear(); -+ - this.inventory.dropAllItems(); -+ -+ captureDrops = false; -+ net.minecraftforge.event.entity.player.PlayerDropsEvent event = new net.minecraftforge.event.entity.player.PlayerDropsEvent(this, cause, capturedDrops, recentlyHit > 0); -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) -+ { -+ for (net.minecraft.entity.item.EntityItem item : capturedDrops) -+ { -+ joinEntityItemWithWorld(item); -+ } -+ } - } - - Collection collection = this.worldObj.getScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.deathCount); -@@ -481,6 +498,7 @@ - if (entitylivingbase != null) - { - EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entitylivingbase))); -+ if (entityegginfo == null) entityegginfo = net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(EntityList.getEntityString(entitylivingbase)); - - if (entityegginfo != null) - { -@@ -849,6 +867,7 @@ - { - if (stat != null) - { -+ if (stat.isAchievement() && net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.AchievementEvent(this, (net.minecraft.stats.Achievement) stat))) return; - this.statsFile.func_150871_b(this, stat, amount); - Iterator iterator = this.getWorldScoreboard().getObjectivesFromCriteria(stat.func_150952_k()).iterator(); - diff --git a/patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch deleted file mode 100644 index 7a1769164..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/player/InventoryPlayer.java -+++ ../src-work/minecraft/net/minecraft/entity/player/InventoryPlayer.java -@@ -319,6 +319,14 @@ - this.mainInventory[i].updateAnimation(this.player.worldObj, this.player, i, this.currentItem == i); - } - } -+ -+ for (int i = 0; i < armorInventory.length; i++) -+ { -+ if (armorInventory[i] != null) -+ { -+ armorInventory[i].getItem().onArmorTick(player.worldObj, player, armorInventory[i]); -+ } -+ } - } - - public boolean consumeInventoryItem(Item p_146026_1_) diff --git a/patches.mcp/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch b/patches.mcp/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch deleted file mode 100644 index 4b1e039f3..000000000 --- a/patches.mcp/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/projectile/EntityFishHook.java -+++ ../src-work/minecraft/net/minecraft/entity/projectile/EntityFishHook.java -@@ -562,11 +562,19 @@ - } - } - -+ @SuppressWarnings("unused") - private ItemStack getFishingResult() - { - float f = this.worldObj.rand.nextFloat(); - int i = EnchantmentHelper.getLuckOfSeaModifier(this.angler); - int j = EnchantmentHelper.getLureModifier(this.angler); -+ -+ if (true) -+ { -+ this.angler.addStat(net.minecraftforge.common.FishingHooks.getFishableCategory(f, i, j).stat, 1); -+ return net.minecraftforge.common.FishingHooks.getRandomFishable(this.rand, f, i, j); -+ } -+ - float f1 = 0.1F - (float)i * 0.025F - (float)j * 0.01F; - float f2 = 0.05F + (float)i * 0.01F - (float)j * 0.01F; - f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); diff --git a/patches.mcp/minecraft/net/minecraft/init/Bootstrap.java.patch b/patches.mcp/minecraft/net/minecraft/init/Bootstrap.java.patch deleted file mode 100644 index 3566d51cb..000000000 --- a/patches.mcp/minecraft/net/minecraft/init/Bootstrap.java.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/init/Bootstrap.java -+++ ../src-work/minecraft/net/minecraft/init/Bootstrap.java -@@ -67,6 +67,7 @@ - return alreadyRegistered; - } - -+ @SuppressWarnings("unused") - static void registerDispenserBehaviors() - { - BlockDispenser.dispenseBehaviorRegistry.putObject(Items.arrow, new BehaviorProjectileDispense() -@@ -144,7 +145,7 @@ - double d0 = source.getX() + (double)enumfacing.getFrontOffsetX(); - double d1 = (double)((float)source.getBlockPos().getY() + 0.2F); - double d2 = source.getZ() + (double)enumfacing.getFrontOffsetZ(); -- Entity entity = ItemMonsterPlacer.spawnCreature(source.getWorld(), stack.getMetadata(), d0, d1, d2); -+ Entity entity = ItemMonsterPlacer.spawnCreature(source.getWorld(), ItemMonsterPlacer.getEntityName(stack), d0, d1, d2); - - if (entity instanceof EntityLivingBase && stack.hasDisplayName()) - { -@@ -509,6 +510,7 @@ - } - } - }); -+ if (false){ //Forge: Removed, Fixes MC-75630 - Exploit with signs and command blocks - BlockDispenser.dispenseBehaviorRegistry.putObject(Item.getItemFromBlock(Blocks.command_block), new BehaviorDefaultDispenseItem() - { - private static final String __OBFID = "CL_00002276"; -@@ -535,6 +537,7 @@ - protected void playDispenseSound(IBlockSource source) {} - protected void spawnDispenseParticles(IBlockSource source, EnumFacing facingIn) {} - }); -+ } - } - - public static void register() diff --git a/patches.mcp/minecraft/net/minecraft/inventory/Container.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/Container.java.patch deleted file mode 100644 index 35180e976..000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/Container.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/Container.java -+++ ../src-work/minecraft/net/minecraft/inventory/Container.java -@@ -624,7 +624,7 @@ - slot = (Slot)this.inventorySlots.get(k); - itemstack1 = slot.getStack(); - -- if (itemstack1 == null) -+ if (itemstack1 == null && slot.isItemValid(stack)) // Forge: Make sure to respect isItemValid in the slot. - { - slot.putStack(stack.copy()); - slot.onSlotChanged(); diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch deleted file mode 100644 index 7ef5ed191..000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/ContainerBeacon.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerBeacon.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerBeacon.java -@@ -132,7 +132,7 @@ - - public boolean isItemValid(ItemStack stack) - { -- return stack == null ? false : stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot; -+ return stack == null ? false : stack.getItem().isBeaconPayment(stack); - } - - public int getSlotStackLimit() diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch deleted file mode 100644 index 305f94fad..000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerBrewingStand.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerBrewingStand.java -@@ -158,7 +158,7 @@ - - public boolean isItemValid(ItemStack stack) - { -- return stack != null ? stack.getItem().isPotionIngredient(stack) : false; -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack); - } - - public int getSlotStackLimit() -@@ -190,7 +190,7 @@ - - public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) - { -- if (stack.getItem() == Items.potionitem && stack.getMetadata() > 0) -+ if (stack.getItem() instanceof net.minecraft.item.ItemPotion && stack.getMetadata() > 0) - { - this.player.triggerAchievement(AchievementList.potion); - } -@@ -200,7 +200,7 @@ - - public static boolean canHoldPotion(ItemStack p_75243_0_) - { -- return p_75243_0_ != null && (p_75243_0_.getItem() == Items.potionitem || p_75243_0_.getItem() == Items.glass_bottle); -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_75243_0_); - } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch deleted file mode 100644 index 12196925d..000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch +++ /dev/null @@ -1,85 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerEnchantment.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerEnchantment.java -@@ -14,6 +14,7 @@ - import net.minecraft.world.World; - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; -+import net.minecraftforge.oredict.OreDictionary; - - public class ContainerEnchantment extends Container - { -@@ -68,9 +69,12 @@ - this.addSlotToContainer(new Slot(this.tableInventory, 1, 35, 47) - { - private static final String __OBFID = "CL_00002185"; -+ java.util.List ores = net.minecraftforge.oredict.OreDictionary.getOres("gemLapis"); - public boolean isItemValid(ItemStack stack) - { -- return stack.getItem() == Items.dye && EnumDyeColor.byDyeDamage(stack.getMetadata()) == EnumDyeColor.BLUE; -+ for (ItemStack ore : ores) -+ if (net.minecraftforge.oredict.OreDictionary.itemMatches(ore, stack, false)) return true; -+ return false; - } - }); - int i; -@@ -152,6 +156,7 @@ - { - i = 0; - int j; -+ float power = 0; - - for (j = -1; j <= 1; ++j) - { -@@ -159,37 +164,15 @@ - { - if ((j != 0 || k != 0) && this.worldPointer.isAirBlock(this.position.add(k, 0, j)) && this.worldPointer.isAirBlock(this.position.add(k, 1, j))) - { -- if (this.worldPointer.getBlockState(this.position.add(k * 2, 0, j * 2)).getBlock() == Blocks.bookshelf) -- { -- ++i; -- } -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 0, j * 2)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 1, j * 2)); - -- if (this.worldPointer.getBlockState(this.position.add(k * 2, 1, j * 2)).getBlock() == Blocks.bookshelf) -- { -- ++i; -- } -- - if (k != 0 && j != 0) - { -- if (this.worldPointer.getBlockState(this.position.add(k * 2, 0, j)).getBlock() == Blocks.bookshelf) -- { -- ++i; -- } -- -- if (this.worldPointer.getBlockState(this.position.add(k * 2, 1, j)).getBlock() == Blocks.bookshelf) -- { -- ++i; -- } -- -- if (this.worldPointer.getBlockState(this.position.add(k, 0, j * 2)).getBlock() == Blocks.bookshelf) -- { -- ++i; -- } -- -- if (this.worldPointer.getBlockState(this.position.add(k, 1, j * 2)).getBlock() == Blocks.bookshelf) -- { -- ++i; -- } -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 0, j)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k * 2, 1, j)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k, 0, j * 2)); -+ power += net.minecraftforge.common.ForgeHooks.getEnchantPower(worldPointer, position.add(k, 1, j * 2)); - } - } - } -@@ -199,7 +182,7 @@ - - for (j = 0; j < 3; ++j) - { -- this.enchantLevels[j] = EnchantmentHelper.calcItemStackEnchantability(this.rand, j, i, itemstack); -+ this.enchantLevels[j] = EnchantmentHelper.calcItemStackEnchantability(this.rand, j, (int)power, itemstack); - this.field_178151_h[j] = -1; - - if (this.enchantLevels[j] < j + 1) diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch deleted file mode 100644 index b2ff5dd66..000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerPlayer.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerPlayer.java -@@ -47,7 +47,8 @@ - } - public boolean isItemValid(ItemStack stack) - { -- return stack == null ? false : (stack.getItem() instanceof ItemArmor ? ((ItemArmor)stack.getItem()).armorType == k : (stack.getItem() != Item.getItemFromBlock(Blocks.pumpkin) && stack.getItem() != Items.skull ? false : k == 0)); -+ if (stack == null) return false; -+ return stack.getItem().isValidArmor(stack, k, thePlayer); - } - @SideOnly(Side.CLIENT) - public String getSlotTexture() diff --git a/patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch deleted file mode 100644 index 6dd53ae6c..000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/ContainerRepair.java.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/ContainerRepair.java -+++ ../src-work/minecraft/net/minecraft/inventory/ContainerRepair.java -@@ -73,6 +73,8 @@ - playerIn.addExperienceLevel(-ContainerRepair.this.maximumCost); - } - -+ float breakChance = net.minecraftforge.common.ForgeHooks.onAnvilRepair(playerIn, stack, ContainerRepair.this.inputSlots.getStackInSlot(0), ContainerRepair.this.inputSlots.getStackInSlot(1)); -+ - ContainerRepair.this.inputSlots.setInventorySlotContents(0, (ItemStack)null); - - if (ContainerRepair.this.materialCost > 0) -@@ -97,7 +99,7 @@ - ContainerRepair.this.maximumCost = 0; - IBlockState iblockstate = worldIn.getBlockState(blockPosIn); - -- if (!playerIn.capabilities.isCreativeMode && !worldIn.isRemote && iblockstate.getBlock() == Blocks.anvil && playerIn.getRNG().nextFloat() < 0.12F) -+ if (!playerIn.capabilities.isCreativeMode && !worldIn.isRemote && iblockstate.getBlock() == Blocks.anvil && playerIn.getRNG().nextFloat() < breakChance) - { - int k = ((Integer)iblockstate.getValue(BlockAnvil.DAMAGE)).intValue(); - ++k; -@@ -177,6 +179,7 @@ - - if (itemstack2 != null) - { -+ if (!net.minecraftforge.common.ForgeHooks.onAnvilChange(this, itemstack, itemstack2, outputSlot, repairedItemName, i2)) return; - flag7 = itemstack2.getItem() == Items.enchanted_book && Items.enchanted_book.getEnchantments(itemstack2).tagCount() > 0; - int k; - int l; -@@ -271,7 +274,8 @@ - { - int l1 = ((Integer)iterator.next()).intValue(); - -- if (l1 != l && !enchantment.canApplyTogether(Enchantment.getEnchantmentById(l1))) -+ Enchantment e2 = Enchantment.getEnchantmentById(l1); -+ if (l1 != l && !(enchantment.canApplyTogether(e2) && e2.canApplyTogether(enchantment))) //Forge BugFix: Let Both enchantments veto being together - { - flag8 = false; - ++i; -@@ -322,6 +326,8 @@ - } - } - -+ if (flag7 && !itemstack1.getItem().isBookEnchantable(itemstack1, itemstack2)) itemstack1 = null; -+ - if (StringUtils.isBlank(this.repairedItemName)) - { - if (itemstack.hasDisplayName()) diff --git a/patches.mcp/minecraft/net/minecraft/inventory/Slot.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/Slot.java.patch deleted file mode 100644 index 5617898aa..000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/Slot.java.patch +++ /dev/null @@ -1,83 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/Slot.java -+++ ../src-work/minecraft/net/minecraft/inventory/Slot.java -@@ -1,5 +1,6 @@ - package net.minecraft.inventory; - -+import net.minecraft.client.Minecraft; - import net.minecraft.entity.player.EntityPlayer; - import net.minecraft.item.ItemStack; - import net.minecraftforge.fml.relauncher.Side; -@@ -86,7 +87,7 @@ - @SideOnly(Side.CLIENT) - public String getSlotTexture() - { -- return null; -+ return backgroundName; - } - - public ItemStack decrStackSize(int amount) -@@ -109,4 +110,64 @@ - { - return true; - } -+ -+ /*========================================= FORGE START =====================================*/ -+ protected String backgroundName = null; -+ protected net.minecraft.util.ResourceLocation backgroundLocation = null; -+ protected Object backgroundMap; -+ /** -+ * Gets the path of the texture file to use for the background image of this slot when drawing the GUI. -+ * @return String: The texture file that will be used in GuiContainer.drawSlotInventory for the slot background. -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.util.ResourceLocation getBackgroundLocation() -+ { -+ return (backgroundLocation == null ? net.minecraft.client.renderer.texture.TextureMap.locationBlocksTexture : backgroundLocation); -+ } -+ -+ /** -+ * Sets the texture file to use for the background image of the slot when it's empty. -+ * @param textureFilename String: Path of texture file to use, or null to use "/gui/items.png" -+ */ -+ @SideOnly(Side.CLIENT) -+ public void setBackgroundLocation(net.minecraft.util.ResourceLocation texture) -+ { -+ this.backgroundLocation = texture; -+ } -+ -+ /** -+ * Sets which icon index to use as the background image of the slot when it's empty. -+ * Getter is func_178171_c -+ * @param icon The icon to use, null for none -+ */ -+ public void setBackgroundName(String name) -+ { -+ this.backgroundName = name; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.client.renderer.texture.TextureAtlasSprite getBackgroundSprite() -+ { -+ String name = getSlotTexture(); -+ return name == null ? null : getBackgroundMap().getAtlasSprite(name); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ protected net.minecraft.client.renderer.texture.TextureMap getBackgroundMap() -+ { -+ if (backgroundMap == null) backgroundMap = Minecraft.getMinecraft().getTextureMapBlocks(); -+ return (net.minecraft.client.renderer.texture.TextureMap)backgroundMap; -+ } -+ -+ /** -+ * Retrieves the index in the inventory for this slot, this value should typically not -+ * be used, but can be useful for some occasions. -+ * -+ * @return Index in associated inventory for this slot. -+ */ -+ public int getSlotIndex() -+ { -+ return slotIndex; -+ } -+ /*========================================= FORGE END =====================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/inventory/SlotCrafting.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/SlotCrafting.java.patch deleted file mode 100644 index 61021f825..000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/SlotCrafting.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/SlotCrafting.java -+++ ../src-work/minecraft/net/minecraft/inventory/SlotCrafting.java -@@ -113,8 +113,11 @@ - - public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, craftMatrix); - this.onCrafting(stack); -+ net.minecraftforge.common.ForgeHooks.setCraftingPlayer(playerIn); - ItemStack[] aitemstack = CraftingManager.getInstance().func_180303_b(this.craftMatrix, playerIn.worldObj); -+ net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null); - - for (int i = 0; i < aitemstack.length; ++i) - { diff --git a/patches.mcp/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch b/patches.mcp/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch deleted file mode 100644 index f33e8758c..000000000 --- a/patches.mcp/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java -+++ ../src-work/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java -@@ -83,6 +83,8 @@ - - this.field_75228_b = 0; - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerSmeltedEvent(thePlayer, stack); -+ - if (stack.getItem() == Items.iron_ingot) - { - this.thePlayer.triggerAchievement(AchievementList.acquireIron); diff --git a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch b/patches.mcp/minecraft/net/minecraft/item/Item.java.patch deleted file mode 100644 index 57972967b..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/Item.java.patch +++ /dev/null @@ -1,688 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/Item.java -+++ ../src-work/minecraft/net/minecraft/item/Item.java -@@ -47,8 +47,8 @@ - - public class Item - { -- public static final RegistryNamespaced itemRegistry = new RegistryNamespaced(); -- private static final Map BLOCK_TO_ITEM = Maps.newHashMap(); -+ public static final RegistryNamespaced itemRegistry = net.minecraftforge.fml.common.registry.GameData.getItemRegistry(); -+ private static final Map BLOCK_TO_ITEM = net.minecraftforge.fml.common.registry.GameData.getBlockItemMap(); - protected static final UUID itemModifierUUID = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); - private CreativeTabs tabToDisplayOn; - protected static Random itemRand = new Random(); -@@ -61,6 +61,9 @@ - private String unlocalizedName; - private static final String __OBFID = "CL_00000041"; - -+ public final net.minecraftforge.fml.common.registry.RegistryDelegate delegate = -+ ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)itemRegistry).getDelegate(this, Item.class); -+ - public static int getIdFromItem(Item itemIn) - { - return itemIn == null ? 0 : itemRegistry.getIDForObject(itemIn); -@@ -126,6 +129,7 @@ - return stack; - } - -+ @Deprecated // Use ItemStack sensitive version below. - public int getItemStackLimit() - { - return this.maxStackSize; -@@ -239,6 +243,7 @@ - return this.containerItem; - } - -+ @Deprecated // Use ItemStack sensitive version below. - public boolean hasContainerItem() - { - return this.containerItem != null; -@@ -308,7 +313,7 @@ - - public boolean isItemTool(ItemStack stack) - { -- return this.getItemStackLimit() == 1 && this.isDamageable(); -+ return this.getItemStackLimit(stack) == 1 && this.isDamageable(); - } - - protected MovingObjectPosition getMovingObjectPositionFromPlayer(World worldIn, EntityPlayer playerIn, boolean useLiquids) -@@ -326,6 +331,10 @@ - float f6 = f3 * f4; - float f7 = f2 * f4; - double d3 = 5.0D; -+ if (playerIn instanceof net.minecraft.entity.player.EntityPlayerMP) -+ { -+ d3 = ((net.minecraft.entity.player.EntityPlayerMP)playerIn).theItemInWorldManager.getBlockReachDistance(); -+ } - Vec3 vec31 = vec3.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); - return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false); - } -@@ -363,11 +372,579 @@ - return false; - } - -+ @Deprecated // Use ItemStack sensitive version below. - public Multimap getItemAttributeModifiers() - { - return HashMultimap.create(); - } - -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * ItemStack sensitive version of getItemAttributeModifiers -+ */ -+ public Multimap getAttributeModifiers(ItemStack stack) -+ { -+ return this.getItemAttributeModifiers(); -+ } -+ -+ /** -+ * Called when a player drops the item into the world, -+ * returning false from this will prevent the item from -+ * being removed from the players inventory and spawning -+ * in the world -+ * -+ * @param player The player that dropped the item -+ * @param item The item stack, before the item is removed. -+ */ -+ public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player) -+ { -+ return true; -+ } -+ -+ /** -+ * This is called when the item is used, before the block is activated. -+ * @param stack The Item Stack -+ * @param player The Player that used the item -+ * @param world The Current World -+ * @param pos Target position -+ * @param side The side of the target hit -+ * @return Return true to prevent any further processing. -+ */ -+ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) -+ { -+ return false; -+ } -+ -+ /** -+ * Metadata-sensitive version of getStrVsBlock -+ * @param itemstack The Item Stack -+ * @param state The block state -+ * @return The damage strength -+ */ -+ public float getDigSpeed(ItemStack itemstack, net.minecraft.block.state.IBlockState state) -+ { -+ return getStrVsBlock(itemstack, state.getBlock()); -+ } -+ -+ -+ protected boolean canRepair = true; -+ /** -+ * Called by CraftingManager to determine if an item is reparable. -+ * @return True if reparable -+ */ -+ public boolean isRepairable() -+ { -+ return canRepair && isDamageable(); -+ } -+ -+ /** -+ * Call to disable repair recipes. -+ * @return The current Item instance -+ */ -+ public Item setNoRepair() -+ { -+ canRepair = false; -+ return this; -+ } -+ -+ /** -+ * Called before a block is broken. Return true to prevent default block harvesting. -+ * -+ * Note: In SMP, this is called on both client and server sides! -+ * -+ * @param itemstack The current ItemStack -+ * @param pos Block's position in world -+ * @param player The Player that is wielding the item -+ * @return True to prevent harvesting, false to continue as normal -+ */ -+ public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) -+ { -+ return false; -+ } -+ -+ /** -+ * Called each tick while using an item. -+ * @param stack The Item being used -+ * @param player The Player using the item -+ * @param count The amount of time in tick the item has been used for continuously -+ */ -+ public void onUsingTick(ItemStack stack, EntityPlayer player, int count) -+ { -+ } -+ -+ /** -+ * Called when the player Left Clicks (attacks) an entity. -+ * Processed before damage is done, if return value is true further processing is canceled -+ * and the entity is not attacked. -+ * -+ * @param stack The Item being used -+ * @param player The player that is attacking -+ * @param entity The entity being attacked -+ * @return True to cancel the rest of the interaction. -+ */ -+ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) -+ { -+ return false; -+ } -+ -+ /** -+ * Player, Render pass, and item usage sensitive version of getIconIndex. -+ * -+ * @param stack The item stack to get the icon for. -+ * @param player The player holding the item -+ * @param useRemaining The ticks remaining for the active item. -+ * @return Null to use default model, or a custom ModelResourceLocation for the stage of use. -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.client.resources.model.ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) -+ { -+ return null; -+ } -+ -+ /** -+ * ItemStack sensitive version of getContainerItem. -+ * Returns a full ItemStack instance of the result. -+ * -+ * @param itemStack The current ItemStack -+ * @return The resulting ItemStack -+ */ -+ public ItemStack getContainerItem(ItemStack itemStack) -+ { -+ if (!hasContainerItem(itemStack)) -+ { -+ return null; -+ } -+ return new ItemStack(getContainerItem()); -+ } -+ -+ /** -+ * ItemStack sensitive version of hasContainerItem -+ * @param stack The current item stack -+ * @return True if this item has a 'container' -+ */ -+ public boolean hasContainerItem(ItemStack stack) -+ { -+ return hasContainerItem(); -+ } -+ -+ /** -+ * Retrieves the normal 'lifespan' of this item when it is dropped on the ground as a EntityItem. -+ * This is in ticks, standard result is 6000, or 5 mins. -+ * -+ * @param itemStack The current ItemStack -+ * @param world The world the entity is in -+ * @return The normal lifespan in ticks. -+ */ -+ public int getEntityLifespan(ItemStack itemStack, World world) -+ { -+ return 6000; -+ } -+ -+ /** -+ * Determines if this Item has a special entity for when they are in the world. -+ * Is called when a EntityItem is spawned in the world, if true and Item#createCustomEntity -+ * returns non null, the EntityItem will be destroyed and the new Entity will be added to the world. -+ * -+ * @param stack The current item stack -+ * @return True of the item has a custom entity, If true, Item#createCustomEntity will be called -+ */ -+ public boolean hasCustomEntity(ItemStack stack) -+ { -+ return false; -+ } -+ -+ /** -+ * This function should return a new entity to replace the dropped item. -+ * Returning null here will not kill the EntityItem and will leave it to function normally. -+ * Called when the item it placed in a world. -+ * -+ * @param world The world object -+ * @param location The EntityItem object, useful for getting the position of the entity -+ * @param itemstack The current item stack -+ * @return A new Entity object to spawn or null -+ */ -+ public Entity createEntity(World world, Entity location, ItemStack itemstack) -+ { -+ return null; -+ } -+ -+ /** -+ * Called by the default implemetation of EntityItem's onUpdate method, allowing for cleaner -+ * control over the update of the item without having to write a subclass. -+ * -+ * @param entityItem The entity Item -+ * @return Return true to skip any further update code. -+ */ -+ public boolean onEntityItemUpdate(net.minecraft.entity.item.EntityItem entityItem) -+ { -+ return false; -+ } -+ -+ /** -+ * Gets a list of tabs that items belonging to this class can display on, -+ * combined properly with getSubItems allows for a single item to span -+ * many sub-items across many tabs. -+ * -+ * @return A list of all tabs that this item could possibly be one. -+ */ -+ public CreativeTabs[] getCreativeTabs() -+ { -+ return new CreativeTabs[]{ getCreativeTab() }; -+ } -+ -+ /** -+ * Determines the base experience for a player when they remove this item from a furnace slot. -+ * This number must be between 0 and 1 for it to be valid. -+ * This number will be multiplied by the stack size to get the total experience. -+ * -+ * @param item The item stack the player is picking up. -+ * @return The amount to award for each item. -+ */ -+ public float getSmeltingExperience(ItemStack item) -+ { -+ return -1; //-1 will default to the old lookups. -+ } -+ -+ /** -+ * Return the correct icon for rendering based on the supplied ItemStack and render pass. -+ * -+ * Defers to {@link #getIconFromDamageForRenderPass(int, int)} -+ * @param stack to render for -+ * @param pass the multi-render pass -+ * @return the icon -+ * / -+ public IIcon getIcon(ItemStack stack, int pass) -+ { -+ return func_77618_c(stack.getMetadata(), pass); -+ } -+ */ -+ -+ /** -+ * Generates the base Random item for a specific instance of the chest gen, -+ * Enchanted books use this to pick a random enchantment. -+ * -+ * @param chest The chest category to generate for -+ * @param rnd World RNG -+ * @param original Original result registered with the chest gen hooks. -+ * @return New values to use as the random item, typically this will be original -+ */ -+ public net.minecraft.util.WeightedRandomChestContent getChestGenBase(net.minecraftforge.common.ChestGenHooks chest, Random rnd, net.minecraft.util.WeightedRandomChestContent original) -+ { -+ if (this instanceof ItemEnchantedBook) -+ { -+ return ((ItemEnchantedBook)this).getRandom(rnd, -+ original.theMinimumChanceToGenerateItem, -+ original.theMaximumChanceToGenerateItem, original.itemWeight); -+ } -+ return original; -+ } -+ -+ /** -+ * -+ * Should this item, when held, allow sneak-clicks to pass through to the underlying block? -+ * -+ * @param world The world -+ * @param pos Block position in world -+ * @param player The Player that is wielding the item -+ * @return -+ */ -+ public boolean doesSneakBypassUse(World world, BlockPos pos, EntityPlayer player) -+ { -+ return false; -+ } -+ -+ /** -+ * Called to tick armor in the armor slot. Override to do something -+ */ -+ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack){} -+ -+ /** -+ * Determines if the specific ItemStack can be placed in the specified armor slot. -+ * -+ * @param stack The ItemStack -+ * @param armorType Armor slot ID: 0: Helmet, 1: Chest, 2: Legs, 3: Boots -+ * @param entity The entity trying to equip the armor -+ * @return True if the given ItemStack can be inserted in the slot -+ */ -+ public boolean isValidArmor(ItemStack stack, int armorType, Entity entity) -+ { -+ if (this instanceof ItemArmor) -+ { -+ return ((ItemArmor)this).armorType == armorType; -+ } -+ -+ if (armorType == 0) -+ { -+ return this == Item.getItemFromBlock(Blocks.pumpkin) || this == Items.skull; -+ } -+ -+ return false; -+ } -+ -+ /** -+ * Allow or forbid the specific book/item combination as an anvil enchant -+ * -+ * @param stack The item -+ * @param book The book -+ * @return if the enchantment is allowed -+ */ -+ public boolean isBookEnchantable(ItemStack stack, ItemStack book) -+ { -+ return true; -+ } -+ -+ /** -+ * Called by RenderBiped and RenderPlayer to determine the armor texture that -+ * should be use for the currently equipped item. -+ * This will only be called on instances of ItemArmor. -+ * -+ * Returning null from this function will use the default value. -+ * -+ * @param stack ItemStack for the equipped armor -+ * @param entity The entity wearing the armor -+ * @param slot The slot the armor is in -+ * @param type The subtype, can be null or "overlay" -+ * @return Path of texture to bind, or null to use default -+ */ -+ public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) -+ { -+ return null; -+ } -+ -+ /** -+ * Returns the font renderer used to render tooltips and overlays for this item. -+ * Returning null will use the standard font renderer. -+ * -+ * @param stack The current item stack -+ * @return A instance of FontRenderer or null to use default -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.client.gui.FontRenderer getFontRenderer(ItemStack stack) -+ { -+ return null; -+ } -+ -+ /** -+ * Override this method to have an item handle its own armor rendering. -+ * -+ * @param entityLiving The entity wearing the armor -+ * @param itemStack The itemStack to render the model of -+ * @param armorSlot 0=head, 1=torso, 2=legs, 3=feet -+ * -+ * @return A ModelBiped to render instead of the default -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) -+ { -+ return null; -+ } -+ -+ /** -+ * Called when a entity tries to play the 'swing' animation. -+ * -+ * @param entityLiving The entity swinging the item. -+ * @param stack The Item stack -+ * @return True to cancel any further processing by EntityLiving -+ */ -+ public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) -+ { -+ return false; -+ } -+ -+ /** -+ * Called when the client starts rendering the HUD, for whatever item the player currently has as a helmet. -+ * This is where pumpkins would render there overlay. -+ * -+ * @param stack The ItemStack that is equipped -+ * @param player Reference to the current client entity -+ * @param resolution Resolution information about the current viewport and configured GUI Scale -+ * @param partialTicks Partial ticks for the renderer, useful for interpolation -+ */ -+ @SideOnly(Side.CLIENT) -+ public void renderHelmetOverlay(ItemStack stack, EntityPlayer player, net.minecraft.client.gui.ScaledResolution resolution, float partialTicks){} -+ -+ /** -+ * Return the itemDamage represented by this ItemStack. Defaults to the itemDamage field on ItemStack, but can be overridden here for other sources such as NBT. -+ * -+ * @param stack The itemstack that is damaged -+ * @return the damage value -+ */ -+ public int getDamage(ItemStack stack) -+ { -+ return stack.itemDamage; -+ } -+ -+ /** -+ * This used to be 'display damage' but its really just 'aux' data in the ItemStack, usually shares the same variable as damage. -+ * @param stack -+ * @return -+ */ -+ public int getMetadata(ItemStack stack) -+ { -+ return stack.itemDamage; -+ } -+ -+ /** -+ * Determines if the durability bar should be rendered for this item. -+ * Defaults to vanilla stack.isDamaged behavior. -+ * But modders can use this for any data they wish. -+ * -+ * @param stack The current Item Stack -+ * @return True if it should render the 'durability' bar. -+ */ -+ public boolean showDurabilityBar(ItemStack stack) -+ { -+ return stack.isItemDamaged(); -+ } -+ -+ /** -+ * Queries the percentage of the 'Durability' bar that should be drawn. -+ * -+ * @param stack The current ItemStack -+ * @return 1.0 for 100% 0 for 0% -+ */ -+ public double getDurabilityForDisplay(ItemStack stack) -+ { -+ return (double)stack.getItemDamage() / (double)stack.getMaxDamage(); -+ } -+ -+ /** -+ * Return the maxDamage for this ItemStack. Defaults to the maxDamage field in this item, -+ * but can be overridden here for other sources such as NBT. -+ * -+ * @param stack The itemstack that is damaged -+ * @return the damage value -+ */ -+ public int getMaxDamage(ItemStack stack) -+ { -+ return getMaxDamage(); -+ } -+ -+ /** -+ * Return if this itemstack is damaged. Note only called if {@link #isDamageable()} is true. -+ * @param stack the stack -+ * @return if the stack is damaged -+ */ -+ public boolean isDamaged(ItemStack stack) -+ { -+ return stack.itemDamage > 0; -+ } -+ -+ /** -+ * Set the damage for this itemstack. Note, this method is responsible for zero checking. -+ * @param stack the stack -+ * @param damage the new damage value -+ */ -+ public void setDamage(ItemStack stack, int damage) -+ { -+ stack.itemDamage = damage; -+ -+ if (stack.itemDamage < 0) -+ { -+ stack.itemDamage = 0; -+ } -+ } -+ -+ /** -+ * ItemStack sensitive version of {@link #canHarvestBlock(Block)} -+ * @param par1Block The block trying to harvest -+ * @param itemStack The itemstack used to harvest the block -+ * @return true if can harvest the block -+ */ -+ public boolean canHarvestBlock(Block par1Block, ItemStack itemStack) -+ { -+ return canHarvestBlock(par1Block); -+ } -+ -+ /** -+ * Gets the maximum number of items that this stack should be able to hold. -+ * This is a ItemStack (and thus NBT) sensitive version of Item.getItemStackLimit() -+ * -+ * @param stack The ItemStack -+ * @return THe maximum number this item can be stacked to -+ */ -+ public int getItemStackLimit(ItemStack stack) -+ { -+ return this.getItemStackLimit(); -+ } -+ -+ private java.util.Map toolClasses = new java.util.HashMap(); -+ /** -+ * Sets or removes the harvest level for the specified tool class. -+ * -+ * @param toolClass Class -+ * @param level Harvest level: -+ * Wood: 0 -+ * Stone: 1 -+ * Iron: 2 -+ * Diamond: 3 -+ * Gold: 0 -+ */ -+ public void setHarvestLevel(String toolClass, int level) -+ { -+ if (level < 0) -+ toolClasses.remove(toolClass); -+ else -+ toolClasses.put(toolClass, level); -+ } -+ -+ public java.util.Set getToolClasses(ItemStack stack) -+ { -+ return toolClasses.keySet(); -+ } -+ -+ /** -+ * Queries the harvest level of this item stack for the specifred tool class, -+ * Returns -1 if this tool is not of the specified type -+ * -+ * @param stack This item stack instance -+ * @param toolClass Tool Class -+ * @return Harvest level, or -1 if not the specified tool type. -+ */ -+ public int getHarvestLevel(ItemStack stack, String toolClass) -+ { -+ Integer ret = toolClasses.get(toolClass); -+ return ret == null ? -1 : ret; -+ } -+ -+ /** -+ * ItemStack sensitive version of getItemEnchantability -+ * -+ * @param stack The ItemStack -+ * @return the item echantability value -+ */ -+ public int getItemEnchantability(ItemStack stack) -+ { -+ return getItemEnchantability(); -+ } -+ -+ /** -+ * Whether this Item can be used as a payment to activate the vanilla beacon. -+ * @param stack the ItemStack -+ * @return true if this Item can be used -+ */ -+ public boolean isBeaconPayment(ItemStack stack) -+ { -+ return this == Items.emerald || this == Items.diamond || this == Items.gold_ingot || this == Items.iron_ingot; -+ } -+ -+ -+ /** -+ * Determine if the player switching between these two item stacks -+ * @param oldStack The old stack that was equipped -+ * @param newStack The new stack -+ * @param slotChanged If the current equipped slot was changed, -+ * Vanilla does not play the animation if you switch between two -+ * slots that hold the exact same item. -+ * @return True to play the item change animation -+ */ -+ public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) -+ { -+ return !ItemStack.areItemStacksEqual(oldStack, newStack); -+ } -+ /* ======================================== FORGE END =====================================*/ -+ -+ - public static void registerItems() - { - registerItemBlock(Blocks.stone, (new ItemMultiTexture(Blocks.stone, Blocks.stone, new Function() -@@ -933,6 +1510,10 @@ - - private static final String __OBFID = "CL_00000042"; - -+ //Added by forge for custom Tool materials. -+ @Deprecated public Item customCraftingMaterial = null; // Remote in 1.8.1 -+ private ItemStack repairMaterial = null; -+ - private ToolMaterial(int harvestLevel, int maxUses, float efficiency, float damageVsEntity, int enchantability) - { - this.harvestLevel = harvestLevel; -@@ -967,9 +1548,36 @@ - return this.enchantability; - } - -+ @Deprecated // Use getRepairItemStack below - public Item getRepairItem() - { -- return this == WOOD ? Item.getItemFromBlock(Blocks.planks) : (this == STONE ? Item.getItemFromBlock(Blocks.cobblestone) : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == EMERALD ? Items.diamond : null)))); -+ switch (this) -+ { -+ case WOOD: return Item.getItemFromBlock(Blocks.planks); -+ case STONE: return Item.getItemFromBlock(Blocks.cobblestone); -+ case GOLD: return Items.gold_ingot; -+ case IRON: return Items.iron_ingot; -+ case EMERALD: return Items.diamond; -+ default: return customCraftingMaterial; -+ } - } -+ -+ public ToolMaterial setRepairItem(ItemStack stack) -+ { -+ if (this.repairMaterial != null || customCraftingMaterial != null) throw new RuntimeException("Can not change already set repair material"); -+ if (this == WOOD || this == STONE || this == GOLD || this == IRON || this == EMERALD) throw new RuntimeException("Can not change vanilla tool repair materials"); -+ this.repairMaterial = stack; -+ this.customCraftingMaterial = stack.getItem(); -+ return this; -+ } -+ -+ public ItemStack getRepairItemStack() -+ { -+ if (repairMaterial != null) return repairMaterial; -+ Item ret = this.getRepairItem(); -+ if (ret == null) return null; -+ repairMaterial = new ItemStack(ret, 1, net.minecraftforge.oredict.OreDictionary.WILDCARD_VALUE); -+ return repairMaterial; -+ } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch deleted file mode 100644 index 7113ee312..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemArmor.java.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemArmor.java -+++ ../src-work/minecraft/net/minecraft/item/ItemArmor.java -@@ -38,7 +38,7 @@ - if (list.size() > 0) - { - EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0); -- int l = entitylivingbase instanceof EntityPlayer ? 1 : 0; -+ int l = 0;// Forge: We fix the indexes. Mojang Stop hard coding this! - int i1 = EntityLiving.getArmorPosition(stack); - ItemStack itemstack1 = stack.copy(); - itemstack1.stackSize = 1; -@@ -192,7 +192,7 @@ - - if (itemstack1 == null) - { -- playerIn.setCurrentItemOrArmor(i, itemStackIn.copy()); -+ playerIn.setCurrentItemOrArmor(i + 1, itemStackIn.copy()); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. - itemStackIn.stackSize = 0; - } - -@@ -213,6 +213,9 @@ - - private static final String __OBFID = "CL_00001768"; - -+ //Added by forge for custom Armor materials. -+ public Item customCraftingMaterial = null; -+ - private ArmorMaterial(String name, int p_i45789_4_, int[] reductionAmounts, int enchantability) - { - this.name = name; -@@ -238,7 +241,15 @@ - - public Item getRepairItem() - { -- return this == LEATHER ? Items.leather : (this == CHAIN ? Items.iron_ingot : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == DIAMOND ? Items.diamond : null)))); -+ switch (this) -+ { -+ case LEATHER: return Items.leather; -+ case CHAIN: return Items.iron_ingot; -+ case GOLD: return Items.gold_ingot; -+ case IRON: return Items.iron_ingot; -+ case DIAMOND: return Items.diamond; -+ default: return customCraftingMaterial; -+ } - } - - @SideOnly(Side.CLIENT) diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch deleted file mode 100644 index 38a636725..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemBlock.java.patch +++ /dev/null @@ -1,72 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemBlock.java -+++ ../src-work/minecraft/net/minecraft/item/ItemBlock.java -@@ -63,16 +63,8 @@ - int i = this.getMetadata(stack.getMetadata()); - IBlockState iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, i, playerIn); - -- if (worldIn.setBlockState(pos, iblockstate1, 3)) -+ if (placeBlockAt(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ, iblockstate1)) - { -- iblockstate1 = worldIn.getBlockState(pos); -- -- if (iblockstate1.getBlock() == this.block) -- { -- setTileEntityNBT(worldIn, pos, stack); -- this.block.onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack); -- } -- - worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), this.block.stepSound.getPlaceSound(), (this.block.stepSound.getVolume() + 1.0F) / 2.0F, this.block.stepSound.getFrequency() * 0.8F); - --stack.stackSize; - } -@@ -85,14 +77,24 @@ - } - } - -+ @Deprecated //Use player sensitive version - public static boolean setTileEntityNBT(World worldIn, BlockPos pos, ItemStack stack) - { -+ return setTileEntityNBT(worldIn, pos, stack, null); -+ } -+ public static boolean setTileEntityNBT(World worldIn, BlockPos pos, ItemStack stack, EntityPlayer player) -+ { - if (stack.hasTagCompound() && stack.getTagCompound().hasKey("BlockEntityTag", 10)) - { - TileEntity tileentity = worldIn.getTileEntity(pos); - - if (tileentity != null) - { -+ //Forge: Fixes MC-75630 - Exploit with signs and command blocks -+ final net.minecraft.server.MinecraftServer server = net.minecraft.server.MinecraftServer.getServer(); -+ if (!worldIn.isRemote && tileentity.restrictNBTCopy() && -+ (server == null || !server.getConfigurationManager().canSendCommands(player.getGameProfile()))) -+ return false; - NBTTagCompound nbttagcompound = new NBTTagCompound(); - NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttagcompound.copy(); - tileentity.writeToNBT(nbttagcompound); -@@ -157,4 +159,26 @@ - { - return this.block; - } -+ -+ /** -+ * Called to actually place the block, after the location is determined -+ * and all permission checks have been made. -+ * -+ * @param stack The item stack that was used to place the block. This can be changed inside the method. -+ * @param player The player who is placing the block. Can be null if the block is not being placed by a player. -+ * @param side The side the player (or machine) right-clicked on. -+ */ -+ public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) -+ { -+ if (!world.setBlockState(pos, newState, 3)) return false; -+ -+ IBlockState state = world.getBlockState(pos); -+ if (state.getBlock() == this.block) -+ { -+ setTileEntityNBT(world, pos, stack, player); -+ this.block.onBlockPlacedBy(world, pos, state, player, stack); -+ } -+ -+ return true; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch deleted file mode 100644 index 9a6b0c0ba..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemBow.java.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemBow.java -+++ ../src-work/minecraft/net/minecraft/item/ItemBow.java -@@ -23,11 +23,15 @@ - - public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityPlayer playerIn, int timeLeft) - { -+ int j = this.getMaxItemUseDuration(stack) - timeLeft; -+ net.minecraftforge.event.entity.player.ArrowLooseEvent event = new net.minecraftforge.event.entity.player.ArrowLooseEvent(playerIn, stack, j); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return; -+ j = event.charge; -+ - boolean flag = playerIn.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0; - - if (flag || playerIn.inventory.hasItem(Items.arrow)) - { -- int j = this.getMaxItemUseDuration(stack) - timeLeft; - float f = (float)j / 20.0F; - f = (f * f + f * 2.0F) / 3.0F; - -@@ -105,6 +109,9 @@ - - public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) - { -+ net.minecraftforge.event.entity.player.ArrowNockEvent event = new net.minecraftforge.event.entity.player.ArrowNockEvent(playerIn, itemStackIn); -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return event.result; -+ - if (playerIn.capabilities.isCreativeMode || playerIn.inventory.hasItem(Items.arrow)) - { - playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn)); diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch deleted file mode 100644 index 23bf6daf0..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemBucket.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemBucket.java -+++ ../src-work/minecraft/net/minecraft/item/ItemBucket.java -@@ -37,6 +37,9 @@ - } - else - { -+ ItemStack ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(playerIn, worldIn, itemStackIn, movingobjectposition); -+ if (ret != null) return ret; -+ - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { - BlockPos blockpos = movingobjectposition.getBlockPos(); diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemBucketMilk.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemBucketMilk.java.patch deleted file mode 100644 index 0e6f3935e..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemBucketMilk.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemBucketMilk.java -+++ ../src-work/minecraft/net/minecraft/item/ItemBucketMilk.java -@@ -25,7 +25,7 @@ - - if (!worldIn.isRemote) - { -- playerIn.clearActivePotions(); -+ playerIn.curePotionEffects(stack); - } - - playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemDye.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemDye.java.patch deleted file mode 100644 index 4ae5b8110..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemDye.java.patch +++ /dev/null @@ -1,56 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemDye.java -+++ ../src-work/minecraft/net/minecraft/item/ItemDye.java -@@ -48,7 +48,7 @@ - - if (enumdyecolor == EnumDyeColor.WHITE) - { -- if (applyBonemeal(stack, worldIn, pos)) -+ if (applyBonemeal(stack, worldIn, pos, playerIn)) - { - if (!worldIn.isRemote) - { -@@ -98,8 +98,18 @@ - - public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target) - { -+ if (worldIn instanceof net.minecraft.world.WorldServer) -+ return applyBonemeal(stack, worldIn, target, net.minecraftforge.common.util.FakePlayerFactory.getMinecraft((net.minecraft.world.WorldServer)worldIn)); -+ return false; -+ } -+ -+ public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target, EntityPlayer player) -+ { - IBlockState iblockstate = worldIn.getBlockState(target); - -+ int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, worldIn, target, iblockstate, stack); -+ if (hook != 0) return hook > 0; -+ - if (iblockstate.getBlock() instanceof IGrowable) - { - IGrowable igrowable = (IGrowable)iblockstate.getBlock(); -@@ -133,7 +143,7 @@ - - Block block = worldIn.getBlockState(pos).getBlock(); - -- if (block.getMaterial() != Material.air) -+ if (block.isAir(worldIn, pos)) - { - block.setBlockBoundsBasedOnState(worldIn, pos); - -@@ -145,6 +155,16 @@ - worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)pos.getX() + itemRand.nextFloat()), (double)pos.getY() + (double)itemRand.nextFloat() * block.getBlockBoundsMaxY(), (double)((float)pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]); - } - } -+ else -+ { -+ for (int i1 = 0; i1 < amount; ++i1) -+ { -+ double d0 = itemRand.nextGaussian() * 0.02D; -+ double d1 = itemRand.nextGaussian() * 0.02D; -+ double d2 = itemRand.nextGaussian() * 0.02D; -+ worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)pos.getX() + itemRand.nextFloat()), (double)pos.getY() + (double)itemRand.nextFloat() * 1.0f, (double)((float)pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]); -+ } -+ } - } - - public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target) diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch deleted file mode 100644 index 2e0696c64..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemEmptyMap.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemEmptyMap.java -+++ ../src-work/minecraft/net/minecraft/item/ItemEmptyMap.java -@@ -24,7 +24,7 @@ - worldIn.setItemData(s, mapdata); - mapdata.scale = 0; - mapdata.func_176054_a(playerIn.posX, playerIn.posZ, mapdata.scale); -- mapdata.dimension = (byte)worldIn.provider.getDimensionId(); -+ mapdata.dimension = worldIn.provider.getDimensionId(); - mapdata.markDirty(); - --itemStackIn.stackSize; - diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch deleted file mode 100644 index 92d47f90b..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemFlintAndSteel.java -+++ ../src-work/minecraft/net/minecraft/item/ItemFlintAndSteel.java -@@ -29,7 +29,7 @@ - } - else - { -- if (worldIn.getBlockState(pos).getBlock().getMaterial() == Material.air) -+ if (worldIn.isAirBlock(pos)) - { - worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); - worldIn.setBlockState(pos, Blocks.fire.getDefaultState()); diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch deleted file mode 100644 index 28920005f..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemHoe.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemHoe.java -+++ ../src-work/minecraft/net/minecraft/item/ItemHoe.java -@@ -34,10 +34,13 @@ - } - else - { -+ int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(stack, playerIn, worldIn, pos); -+ if (hook != 0) return hook > 0; -+ - IBlockState iblockstate = worldIn.getBlockState(pos); - Block block = iblockstate.getBlock(); - -- if (side != EnumFacing.DOWN && worldIn.getBlockState(pos.up()).getBlock().getMaterial() == Material.air) -+ if (side != EnumFacing.DOWN && worldIn.isAirBlock(pos.up())) - { - if (block == Blocks.grass) - { diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch deleted file mode 100644 index 6251c9d0f..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemLilyPad.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemLilyPad.java -+++ ../src-work/minecraft/net/minecraft/item/ItemLilyPad.java -@@ -51,7 +51,14 @@ - - if (iblockstate.getBlock().getMaterial() == Material.water && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.isAirBlock(blockpos1)) - { -+ // special case for handling block placement with water lilies -+ net.minecraftforge.common.util.BlockSnapshot blocksnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(worldIn, blockpos1); - worldIn.setBlockState(blockpos1, Blocks.waterlily.getDefaultState()); -+ if (net.minecraftforge.event.ForgeEventFactory.onPlayerBlockPlace(playerIn, blocksnapshot, net.minecraft.util.EnumFacing.UP).isCanceled()) -+ { -+ blocksnapshot.restore(true, false); -+ return itemStackIn; -+ } - - if (!playerIn.capabilities.isCreativeMode) - { diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch deleted file mode 100644 index 0281e3d97..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemMap.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemMap.java -+++ ../src-work/minecraft/net/minecraft/item/ItemMap.java -@@ -58,7 +58,7 @@ - mapdata = new MapData(s); - mapdata.scale = 3; - mapdata.func_176054_a((double)worldIn.getWorldInfo().getSpawnX(), (double)worldIn.getWorldInfo().getSpawnZ(), mapdata.scale); -- mapdata.dimension = (byte)worldIn.provider.getDimensionId(); -+ mapdata.dimension = worldIn.provider.getDimensionId(); - mapdata.markDirty(); - worldIn.setItemData(s, mapdata); - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch deleted file mode 100644 index 40b28e9c6..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch +++ /dev/null @@ -1,107 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemMonsterPlacer.java -+++ ../src-work/minecraft/net/minecraft/item/ItemMonsterPlacer.java -@@ -39,7 +39,7 @@ - public String getItemStackDisplayName(ItemStack stack) - { - String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim(); -- String s1 = EntityList.getStringFromID(stack.getMetadata()); -+ String s1 = ItemMonsterPlacer.getEntityName(stack); - - if (s1 != null) - { -@@ -52,7 +52,7 @@ - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack stack, int renderPass) - { -- EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(stack.getMetadata())); -+ EntityList.EntityEggInfo entityegginfo = ItemMonsterPlacer.getEggInfo(stack); - return entityegginfo != null ? (renderPass == 0 ? entityegginfo.primaryColor : entityegginfo.secondaryColor) : 16777215; - } - -@@ -77,7 +77,7 @@ - if (tileentity instanceof TileEntityMobSpawner) - { - MobSpawnerBaseLogic mobspawnerbaselogic = ((TileEntityMobSpawner)tileentity).getSpawnerBaseLogic(); -- mobspawnerbaselogic.setEntityName(EntityList.getStringFromID(stack.getMetadata())); -+ mobspawnerbaselogic.setEntityName(ItemMonsterPlacer.getEntityName(stack)); - tileentity.markDirty(); - worldIn.markBlockForUpdate(pos); - -@@ -98,7 +98,7 @@ - d0 = 0.5D; - } - -- Entity entity = spawnCreature(worldIn, stack.getMetadata(), (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D); -+ Entity entity = spawnCreature(worldIn, ItemMonsterPlacer.getEntityName(stack), (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D); - - if (entity != null) - { -@@ -149,7 +149,7 @@ - - if (worldIn.getBlockState(blockpos).getBlock() instanceof BlockLiquid) - { -- Entity entity = spawnCreature(worldIn, itemStackIn.getMetadata(), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D); -+ Entity entity = spawnCreature(worldIn, ItemMonsterPlacer.getEntityName(itemStackIn), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D); - - if (entity != null) - { -@@ -173,19 +173,29 @@ - } - } - -+ @Deprecated // Use string version below. - public static Entity spawnCreature(World worldIn, int entityID, double x, double y, double z) - { - if (!EntityList.entityEggs.containsKey(Integer.valueOf(entityID))) - { - return null; - } -+ return spawnCreature(worldIn, EntityList.getStringFromID(entityID), x, y, z); -+ } -+ -+ public static Entity spawnCreature(World worldIn, String name, double x, double y, double z) -+ { -+ if (!EntityList.stringToClassMapping.containsKey(name)) -+ { -+ return null; -+ } - else - { - Entity entity = null; - - for (int j = 0; j < 1; ++j) - { -- entity = EntityList.createEntityByID(entityID, worldIn); -+ entity = EntityList.createEntityByName(name, worldIn); - - if (entity instanceof EntityLivingBase) - { -@@ -213,5 +223,28 @@ - EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)iterator.next(); - subItems.add(new ItemStack(itemIn, 1, entityegginfo.spawnedID)); - } -+ -+ for (String name : net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().keySet()) -+ { -+ ItemStack stack = new ItemStack(itemIn); -+ net.minecraft.nbt.NBTTagCompound nbt = new net.minecraft.nbt.NBTTagCompound(); -+ nbt.setString("entity_name", name); -+ stack.setTagCompound(nbt); -+ subItems.add(stack); -+ } - } -+ -+ public static String getEntityName(ItemStack stack) -+ { -+ if (stack.hasTagCompound() && stack.getTagCompound().hasKey("entity_name", 8)) -+ return stack.getTagCompound().getString("entity_name"); -+ return EntityList.getStringFromID(stack.getMetadata()); -+ } -+ -+ private static EntityList.EntityEggInfo getEggInfo(ItemStack stack) -+ { -+ if (stack.hasTagCompound() && stack.getTagCompound().hasKey("entity_name", 8)) -+ return net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().get(stack.getTagCompound().getString("entity_name")); -+ return (EntityList.EntityEggInfo)EntityList.entityEggs.get(stack.getMetadata()); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemRecord.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemRecord.java.patch deleted file mode 100644 index 0fce10880..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemRecord.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemRecord.java -+++ ../src-work/minecraft/net/minecraft/item/ItemRecord.java -@@ -75,4 +75,15 @@ - { - return (ItemRecord)RECORDS.get(name); - } -+ -+ /** -+ * Retrieves the resource location of the sound to play for this record. -+ * -+ * @param name The name of the record to play -+ * @return The resource location for the audio, null to use default. -+ */ -+ public net.minecraft.util.ResourceLocation getRecordResource(String name) -+ { -+ return new net.minecraft.util.ResourceLocation(name); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemReed.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemReed.java.patch deleted file mode 100644 index 1dfe0385e..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemReed.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemReed.java -+++ ../src-work/minecraft/net/minecraft/item/ItemReed.java -@@ -54,7 +54,7 @@ - - if (iblockstate1.getBlock() == this.block) - { -- ItemBlock.setTileEntityNBT(worldIn, pos, stack); -+ ItemBlock.setTileEntityNBT(worldIn, pos, stack, playerIn); - iblockstate1.getBlock().onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack); - } - diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch deleted file mode 100644 index a80f9b920..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemSeedFood.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemSeedFood.java -+++ ../src-work/minecraft/net/minecraft/item/ItemSeedFood.java -@@ -6,7 +6,7 @@ - import net.minecraft.util.EnumFacing; - import net.minecraft.world.World; - --public class ItemSeedFood extends ItemFood -+public class ItemSeedFood extends ItemFood implements net.minecraftforge.common.IPlantable - { - private Block crops; - private Block soilId; -@@ -29,7 +29,7 @@ - { - return false; - } -- else if (worldIn.getBlockState(pos).getBlock() == this.soilId && worldIn.isAirBlock(pos.up())) -+ else if (worldIn.getBlockState(pos).getBlock().canSustainPlant(worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) - { - worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); - --stack.stackSize; -@@ -40,4 +40,16 @@ - return false; - } - } -+ -+ @Override -+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ return net.minecraftforge.common.EnumPlantType.Crop; -+ } -+ -+ @Override -+ public net.minecraft.block.state.IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ return this.crops.getDefaultState(); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch deleted file mode 100644 index ebdd88861..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemSeeds.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemSeeds.java -+++ ../src-work/minecraft/net/minecraft/item/ItemSeeds.java -@@ -7,7 +7,7 @@ - import net.minecraft.util.EnumFacing; - import net.minecraft.world.World; - --public class ItemSeeds extends Item -+public class ItemSeeds extends Item implements net.minecraftforge.common.IPlantable - { - private Block crops; - private Block soilBlockID; -@@ -30,7 +30,7 @@ - { - return false; - } -- else if (worldIn.getBlockState(pos).getBlock() == this.soilBlockID && worldIn.isAirBlock(pos.up())) -+ else if (worldIn.getBlockState(pos).getBlock().canSustainPlant(worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up())) - { - worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); - --stack.stackSize; -@@ -41,4 +41,16 @@ - return false; - } - } -+ -+ @Override -+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ return this.crops == net.minecraft.init.Blocks.nether_wart ? net.minecraftforge.common.EnumPlantType.Nether : net.minecraftforge.common.EnumPlantType.Crop; -+ } -+ -+ @Override -+ public net.minecraft.block.state.IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) -+ { -+ return this.crops.getDefaultState(); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch deleted file mode 100644 index 921a20435..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemShears.java.patch +++ /dev/null @@ -1,89 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemShears.java -+++ ../src-work/minecraft/net/minecraft/item/ItemShears.java -@@ -21,13 +21,12 @@ - - public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) - { -- if (blockIn.getMaterial() != Material.leaves && blockIn != Blocks.web && blockIn != Blocks.tallgrass && blockIn != Blocks.vine && blockIn != Blocks.tripwire && blockIn != Blocks.wool) -+ if (blockIn.getMaterial() != Material.leaves && blockIn != Blocks.web && blockIn != Blocks.tallgrass && blockIn != Blocks.vine && blockIn != Blocks.tripwire && blockIn != Blocks.wool && !(blockIn instanceof net.minecraftforge.common.IShearable)) - { - return super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn); - } - else - { -- stack.damageItem(1, playerIn); - return true; - } - } -@@ -41,4 +40,71 @@ - { - return block != Blocks.web && block.getMaterial() != Material.leaves ? (block == Blocks.wool ? 5.0F : super.getStrVsBlock(stack, block)) : 15.0F; - } -+ -+ -+ @Override -+ public boolean itemInteractionForEntity(ItemStack itemstack, net.minecraft.entity.player.EntityPlayer player, EntityLivingBase entity) -+ { -+ if (entity.worldObj.isRemote) -+ { -+ return false; -+ } -+ if (entity instanceof net.minecraftforge.common.IShearable) -+ { -+ net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)entity; -+ BlockPos pos = new BlockPos(entity.posX, entity.posY, entity.posZ); -+ if (target.isShearable(itemstack, entity.worldObj, pos)) -+ { -+ java.util.List drops = target.onSheared(itemstack, entity.worldObj, pos, -+ net.minecraft.enchantment.EnchantmentHelper.getEnchantmentLevel(net.minecraft.enchantment.Enchantment.fortune.effectId, itemstack)); -+ -+ java.util.Random rand = new java.util.Random(); -+ for(ItemStack stack : drops) -+ { -+ net.minecraft.entity.item.EntityItem ent = entity.entityDropItem(stack, 1.0F); -+ ent.motionY += rand.nextFloat() * 0.05F; -+ ent.motionX += (rand.nextFloat() - rand.nextFloat()) * 0.1F; -+ ent.motionZ += (rand.nextFloat() - rand.nextFloat()) * 0.1F; -+ } -+ itemstack.damageItem(1, entity); -+ } -+ return true; -+ } -+ return false; -+ } -+ -+ @Override -+ public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, net.minecraft.entity.player.EntityPlayer player) -+ { -+ if (player.worldObj.isRemote || player.capabilities.isCreativeMode) -+ { -+ return false; -+ } -+ Block block = player.worldObj.getBlockState(pos).getBlock(); -+ if (block instanceof net.minecraftforge.common.IShearable) -+ { -+ net.minecraftforge.common.IShearable target = (net.minecraftforge.common.IShearable)block; -+ if (target.isShearable(itemstack, player.worldObj, pos)) -+ { -+ java.util.List drops = target.onSheared(itemstack, player.worldObj, pos, -+ net.minecraft.enchantment.EnchantmentHelper.getEnchantmentLevel(net.minecraft.enchantment.Enchantment.fortune.effectId, itemstack)); -+ java.util.Random rand = new java.util.Random(); -+ -+ for(ItemStack stack : drops) -+ { -+ float f = 0.7F; -+ double d = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -+ double d1 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -+ double d2 = (double)(rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; -+ net.minecraft.entity.item.EntityItem entityitem = new net.minecraft.entity.item.EntityItem(player.worldObj, (double)pos.getX() + d, (double)pos.getY() + d1, (double)pos.getZ() + d2, stack); -+ entityitem.setDefaultPickupDelay(); -+ player.worldObj.spawnEntityInWorld(entityitem); -+ } -+ -+ itemstack.damageItem(1, player); -+ player.addStat(net.minecraft.stats.StatList.mineBlockStatArray[Block.getIdFromBlock(block)], 1); -+ } -+ } -+ return false; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSign.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSign.java.patch deleted file mode 100644 index 592003138..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemSign.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemSign.java -+++ ../src-work/minecraft/net/minecraft/item/ItemSign.java -@@ -63,7 +63,7 @@ - --stack.stackSize; - TileEntity tileentity = worldIn.getTileEntity(pos); - -- if (tileentity instanceof TileEntitySign && !ItemBlock.setTileEntityNBT(worldIn, pos, stack)) -+ if (tileentity instanceof TileEntitySign && !ItemBlock.setTileEntityNBT(worldIn, pos, stack, playerIn)) - { - playerIn.openEditSign((TileEntitySign)tileentity); - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch deleted file mode 100644 index 9c1921c95..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemSkull.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemSkull.java -+++ ../src-work/minecraft/net/minecraft/item/ItemSkull.java -@@ -35,6 +35,11 @@ - - public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) - { -+ if (worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && side != EnumFacing.DOWN) -+ { -+ side = EnumFacing.UP; -+ pos = pos.down(); -+ } - if (side == EnumFacing.DOWN) - { - return false; -@@ -47,7 +52,7 @@ - - if (!flag) - { -- if (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid()) -+ if (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid() && !worldIn.isSideSolid(pos, side, true)) - { - return false; - } -@@ -67,6 +72,7 @@ - { - if (!worldIn.isRemote) - { -+ if (!Blocks.skull.canPlaceBlockOnSide(worldIn, pos, side)) return false; - worldIn.setBlockState(pos, Blocks.skull.getDefaultState().withProperty(BlockSkull.FACING, side), 3); - int i = 0; - diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSnow.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSnow.java.patch deleted file mode 100644 index b7bb49b2e..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemSnow.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemSnow.java -+++ ../src-work/minecraft/net/minecraft/item/ItemSnow.java -@@ -66,4 +66,10 @@ - { - return damage; - } -+ -+ public boolean canPlaceBlockOnSide(World world, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) -+ { -+ IBlockState state = world.getBlockState(pos); -+ return (state.getBlock() != net.minecraft.init.Blocks.snow_layer || ((Integer)state.getValue(BlockSnow.LAYERS)) > 7) ? super.canPlaceBlockOnSide(world, pos, side, player, stack) : true; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch deleted file mode 100644 index 0909d6238..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemStack.java.patch +++ /dev/null @@ -1,149 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemStack.java -+++ ../src-work/minecraft/net/minecraft/item/ItemStack.java -@@ -52,6 +52,7 @@ - private boolean canPlaceOnCacheResult; - private static final String __OBFID = "CL_00000043"; - -+ private net.minecraftforge.fml.common.registry.RegistryDelegate delegate; - public ItemStack(Block blockIn) - { - this(blockIn, 1); -@@ -83,7 +84,7 @@ - this.canDestroyCacheResult = false; - this.canPlaceOnCacheBlock = null; - this.canPlaceOnCacheResult = false; -- this.item = itemIn; -+ this.setItem(itemIn); - this.stackSize = amount; - this.itemDamage = meta; - -@@ -123,11 +124,12 @@ - - public Item getItem() - { -- return this.item; -+ return this.delegate != null ? this.delegate.get() : null; - } - - public boolean onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) - { -+ if (!worldIn.isRemote) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ); - boolean flag = this.getItem().onItemUse(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ); - - if (flag) -@@ -172,11 +174,11 @@ - { - if (nbt.hasKey("id", 8)) - { -- this.item = Item.getByNameOrId(nbt.getString("id")); -+ this.setItem(Item.getByNameOrId(nbt.getString("id"))); - } - else - { -- this.item = Item.getItemById(nbt.getShort("id")); -+ this.setItem(Item.getItemById(nbt.getShort("id"))); - } - - this.stackSize = nbt.getByte("Count"); -@@ -200,7 +202,7 @@ - - public int getMaxStackSize() - { -- return this.getItem().getItemStackLimit(); -+ return this.getItem().getItemStackLimit(this); - } - - public boolean isStackable() -@@ -210,7 +212,7 @@ - - public boolean isItemStackDamageable() - { -- return this.item == null ? false : (this.item.getMaxDamage() <= 0 ? false : !this.hasTagCompound() || !this.getTagCompound().getBoolean("Unbreakable")); -+ return this.item == null ? false : (this.item.getMaxDamage(this) <= 0 ? false : !this.hasTagCompound() || !this.getTagCompound().getBoolean("Unbreakable")); - } - - public boolean getHasSubtypes() -@@ -220,32 +222,27 @@ - - public boolean isItemDamaged() - { -- return this.isItemStackDamageable() && this.itemDamage > 0; -+ return this.isItemStackDamageable() && getItem().isDamaged(this); - } - - public int getItemDamage() - { -- return this.itemDamage; -+ return getItem().getDamage(this); - } - - public int getMetadata() - { -- return this.itemDamage; -+ return getItem().getMetadata(this); - } - - public void setItemDamage(int meta) - { -- this.itemDamage = meta; -- -- if (this.itemDamage < 0) -- { -- this.itemDamage = 0; -- } -+ getItem().setDamage(this, meta); - } - - public int getMaxDamage() - { -- return this.item.getMaxDamage(); -+ return this.item.getMaxDamage(this); - } - - public boolean attemptDamageItem(int amount, Random rand) -@@ -277,8 +274,8 @@ - } - } - -- this.itemDamage += amount; -- return this.itemDamage > this.getMaxDamage(); -+ setItemDamage(getItemDamage() + amount); //Redirect through Item's callback if applicable. -+ return getItemDamage() > getMaxDamage(); - } - } - -@@ -337,7 +334,7 @@ - - public boolean canHarvestBlock(Block blockIn) - { -- return this.item.canHarvestBlock(blockIn); -+ return getItem().canHarvestBlock(blockIn, this); - } - - public boolean interactWithEntity(EntityPlayer playerIn, EntityLivingBase entityIn) -@@ -752,6 +749,8 @@ - } - } - -+ net.minecraftforge.event.ForgeEventFactory.onItemTooltip(this, playerIn, arraylist, advanced); -+ - return arraylist; - } - -@@ -862,7 +861,7 @@ - } - else - { -- object = this.getItem().getItemAttributeModifiers(); -+ object = this.getItem().getAttributeModifiers(this); - } - - return (Multimap)object; -@@ -870,6 +869,7 @@ - - public void setItem(Item newItem) - { -+ this.delegate = newItem != null ? newItem.delegate : null; - this.item = newItem; - } - diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemSword.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemSword.java.patch deleted file mode 100644 index 2305fb8d6..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemSword.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemSword.java -+++ ../src-work/minecraft/net/minecraft/item/ItemSword.java -@@ -102,7 +102,9 @@ - - public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) - { -- return this.material.getRepairItem() == repair.getItem() ? true : super.getIsRepairable(toRepair, repair); -+ ItemStack mat = this.material.getRepairItemStack(); -+ if (mat != null && net.minecraftforge.oredict.OreDictionary.itemMatches(mat, repair, false)) return true; -+ return super.getIsRepairable(toRepair, repair); - } - - public Multimap getItemAttributeModifiers() diff --git a/patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch b/patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch deleted file mode 100644 index 366612546..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/ItemTool.java.patch +++ /dev/null @@ -1,71 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/ItemTool.java -+++ ../src-work/minecraft/net/minecraft/item/ItemTool.java -@@ -29,6 +29,18 @@ - this.efficiencyOnProperMaterial = material.getEfficiencyOnProperMaterial(); - this.damageVsEntity = attackDamage + material.getDamageVsEntity(); - this.setCreativeTab(CreativeTabs.tabTools); -+ if (this instanceof ItemPickaxe) -+ { -+ toolClass = "pickaxe"; -+ } -+ else if (this instanceof ItemAxe) -+ { -+ toolClass = "axe"; -+ } -+ else if (this instanceof ItemSpade) -+ { -+ toolClass = "shovel"; -+ } - } - - public float getStrVsBlock(ItemStack stack, Block block) -@@ -75,7 +87,9 @@ - - public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) - { -- return this.toolMaterial.getRepairItem() == repair.getItem() ? true : super.getIsRepairable(toRepair, repair); -+ ItemStack mat = this.toolMaterial.getRepairItemStack(); -+ if (mat != null && net.minecraftforge.oredict.OreDictionary.itemMatches(mat, repair, false)) return true; -+ return super.getIsRepairable(toRepair, repair); - } - - public Multimap getItemAttributeModifiers() -@@ -84,4 +98,38 @@ - multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(itemModifierUUID, "Tool modifier", (double)this.damageVsEntity, 0)); - return multimap; - } -+ -+ /*===================================== FORGE START =================================*/ -+ private String toolClass; -+ @Override -+ public int getHarvestLevel(ItemStack stack, String toolClass) -+ { -+ int level = super.getHarvestLevel(stack, toolClass); -+ if (level == -1 && toolClass != null && toolClass.equals(this.toolClass)) -+ { -+ return this.toolMaterial.getHarvestLevel(); -+ } -+ else -+ { -+ return level; -+ } -+ } -+ -+ @Override -+ public Set getToolClasses(ItemStack stack) -+ { -+ return toolClass != null ? com.google.common.collect.ImmutableSet.of(toolClass) : super.getToolClasses(stack); -+ } -+ -+ @Override -+ public float getDigSpeed(ItemStack stack, net.minecraft.block.state.IBlockState state) -+ { -+ for (String type : getToolClasses(stack)) -+ { -+ if (state.getBlock().isToolEffective(type, state)) -+ return efficiencyOnProperMaterial; -+ } -+ return super.getDigSpeed(stack, state); -+ } -+ /*===================================== FORGE END =================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch deleted file mode 100644 index 935002f5f..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java -@@ -78,6 +78,7 @@ - - public void addSmeltingRecipe(ItemStack input, ItemStack stack, float experience) - { -+ if (getSmeltingResult(input) != null) { net.minecraftforge.fml.common.FMLLog.info("Ignored smelting recipe with conflicting input: " + input + " = " + stack); return; } - this.smeltingList.put(input, stack); - this.experienceList.put(stack, Float.valueOf(experience)); - } -@@ -113,6 +114,9 @@ - - public float getSmeltingExperience(ItemStack stack) - { -+ float ret = stack.getItem().getSmeltingExperience(stack); -+ if (ret != -1) return ret; -+ - Iterator iterator = this.experienceList.entrySet().iterator(); - Entry entry; - diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch deleted file mode 100644 index f87e64fd1..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/RecipeFireworks.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeFireworks.java -@@ -90,9 +90,9 @@ - { - this.field_92102_a = new ItemStack(Items.fireworks); - -+ nbttagcompound = new NBTTagCompound(); - if (l > 0) - { -- nbttagcompound = new NBTTagCompound(); - nbttagcompound1 = new NBTTagCompound(); - NBTTagList nbttaglist = new NBTTagList(); - -@@ -109,8 +109,8 @@ - nbttagcompound1.setTag("Explosions", nbttaglist); - nbttagcompound1.setByte("Flight", (byte)j); - nbttagcompound.setTag("Fireworks", nbttagcompound1); -- this.field_92102_a.setTagCompound(nbttagcompound); - } -+ this.field_92102_a.setTagCompound(nbttagcompound); //Forge BugFix: NPE Protection - - return true; - } -@@ -253,11 +253,7 @@ - for (int i = 0; i < aitemstack.length; ++i) - { - ItemStack itemstack = p_179532_1_.getStackInSlot(i); -- -- if (itemstack != null && itemstack.getItem().hasContainerItem()) -- { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -- } -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - - return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch deleted file mode 100644 index 0eb9dbffe..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java -@@ -27,7 +27,7 @@ - { - ItemStack itemstack1 = (ItemStack)arraylist.get(0); - -- if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isDamageable()) -+ if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isRepairable()) - { - return false; - } -@@ -55,7 +55,7 @@ - { - ItemStack itemstack1 = (ItemStack)arraylist.get(0); - -- if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isDamageable()) -+ if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isRepairable()) - { - return null; - } -@@ -68,7 +68,7 @@ - ItemStack itemstack2 = (ItemStack)arraylist.get(0); - itemstack = (ItemStack)arraylist.get(1); - -- if (itemstack2.getItem() == itemstack.getItem() && itemstack2.stackSize == 1 && itemstack.stackSize == 1 && itemstack2.getItem().isDamageable()) -+ if (itemstack2.getItem() == itemstack.getItem() && itemstack2.stackSize == 1 && itemstack.stackSize == 1 && itemstack2.getItem().isRepairable()) - { - Item item = itemstack2.getItem(); - int j = item.getMaxDamage() - itemstack2.getItemDamage(); -@@ -105,11 +105,7 @@ - for (int i = 0; i < aitemstack.length; ++i) - { - ItemStack itemstack = p_179532_1_.getStackInSlot(i); -- -- if (itemstack != null && itemstack.getItem().hasContainerItem()) -- { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -- } -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - - return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch deleted file mode 100644 index 261c45a79..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java -@@ -153,11 +153,7 @@ - for (int i = 0; i < aitemstack.length; ++i) - { - ItemStack itemstack = p_179532_1_.getStackInSlot(i); -- -- if (itemstack != null && itemstack.getItem().hasContainerItem()) -- { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -- } -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - - return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch deleted file mode 100644 index 04640835d..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/RecipesBanners.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesBanners.java -@@ -143,11 +143,7 @@ - for (int i = 0; i < aitemstack.length; ++i) - { - ItemStack itemstack = p_179532_1_.getStackInSlot(i); -- -- if (itemstack != null && itemstack.getItem().hasContainerItem()) -- { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -- } -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - - return aitemstack; -@@ -375,9 +371,9 @@ - - if (itemstack != null) - { -- if (itemstack.getItem().hasContainerItem()) -+ if (itemstack.getItem().hasContainerItem(itemstack)) - { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - else if (itemstack.hasTagCompound() && TileEntityBanner.getPatterns(itemstack) > 0) - { diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch deleted file mode 100644 index 5ad702f77..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java -@@ -110,11 +110,7 @@ - for (int i = 0; i < aitemstack.length; ++i) - { - ItemStack itemstack = p_179532_1_.getStackInSlot(i); -- -- if (itemstack != null && itemstack.getItem().hasContainerItem()) -- { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -- } -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - - return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch deleted file mode 100644 index 02c3e7f16..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/ShapedRecipes.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/ShapedRecipes.java -@@ -34,11 +34,7 @@ - for (int i = 0; i < aitemstack.length; ++i) - { - ItemStack itemstack = p_179532_1_.getStackInSlot(i); -- -- if (itemstack != null && itemstack.getItem().hasContainerItem()) -- { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -- } -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - - return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch b/patches.mcp/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch deleted file mode 100644 index f0670bb96..000000000 --- a/patches.mcp/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java -+++ ../src-work/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java -@@ -32,11 +32,7 @@ - for (int i = 0; i < aitemstack.length; ++i) - { - ItemStack itemstack = p_179532_1_.getStackInSlot(i); -- -- if (itemstack != null && itemstack.getItem().hasContainerItem()) -- { -- aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); -- } -+ aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack); - } - - return aitemstack; diff --git a/patches.mcp/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch deleted file mode 100644 index 6abd19298..000000000 --- a/patches.mcp/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/nbt/CompressedStreamTools.java -+++ ../src-work/minecraft/net/minecraft/nbt/CompressedStreamTools.java -@@ -17,8 +17,6 @@ - import net.minecraft.crash.CrashReport; - import net.minecraft.crash.CrashReportCategory; - import net.minecraft.util.ReportedException; --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; - - public class CompressedStreamTools - { -@@ -55,7 +53,6 @@ - } - } - -- @SideOnly(Side.CLIENT) - public static void safeWrite(NBTTagCompound p_74793_0_, File p_74793_1_) throws IOException - { - File file2 = new File(p_74793_1_.getAbsolutePath() + "_tmp"); -@@ -120,6 +117,7 @@ - private static NBTBase func_152455_a(DataInput p_152455_0_, int p_152455_1_, NBTSizeTracker p_152455_2_) throws IOException - { - byte b0 = p_152455_0_.readByte(); -+ p_152455_2_.read(8); // Forge: Count everything! - - if (b0 == 0) - { -@@ -127,7 +125,8 @@ - } - else - { -- p_152455_0_.readUTF(); -+ NBTSizeTracker.readUTF(p_152455_2_, p_152455_0_.readUTF()); //Forge: Count this string. -+ p_152455_2_.read(32); //Forge: 4 extra bytes for the object allocation. - NBTBase nbtbase = NBTBase.createNewByType(b0); - - try -@@ -146,7 +145,6 @@ - } - } - -- @SideOnly(Side.CLIENT) - public static void write(NBTTagCompound p_74795_0_, File p_74795_1_) throws IOException - { - DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(p_74795_1_)); -@@ -161,7 +159,6 @@ - } - } - -- @SideOnly(Side.CLIENT) - public static NBTTagCompound read(File p_74797_0_) throws IOException - { - if (!p_74797_0_.exists()) diff --git a/patches.mcp/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch deleted file mode 100644 index 078cb5b16..000000000 --- a/patches.mcp/minecraft/net/minecraft/nbt/NBTSizeTracker.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/nbt/NBTSizeTracker.java -+++ ../src-work/minecraft/net/minecraft/nbt/NBTSizeTracker.java -@@ -25,4 +25,34 @@ - throw new RuntimeException("Tried to read NBT tag that was too big; tried to allocate: " + this.read + "bytes where max allowed: " + this.max); - } - } -+ -+ /* -+ * UTF8 is not a simple encoding system, each character can be either -+ * 1, 2, or 3 bytes. Depending on where it's numerical value falls. -+ * We have to count up each character individually to see the true -+ * length of the data. -+ * -+ * Basic concept is that it uses the MSB of each byte as a 'read more' signal. -+ * So it has to shift each 7-bit segment. -+ * -+ * This will accurately count the correct byte length to encode this string, plus the 2 bytes for it's length prefix. -+ */ -+ public static void readUTF(NBTSizeTracker tracker, String data) -+ { -+ tracker.read(16); //Header length -+ if (data == null) -+ return; -+ -+ int len = data.length(); -+ int utflen = 0; -+ -+ for (int i = 0; i < len; i++) -+ { -+ int c = data.charAt(i); -+ if ((c >= 0x0001) && (c <= 0x007F)) utflen += 1; -+ else if (c > 0x07FF) utflen += 3; -+ else utflen += 2; -+ } -+ tracker.read(8 * utflen); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagByteArray.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagByteArray.java.patch deleted file mode 100644 index 924246163..000000000 --- a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagByteArray.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/nbt/NBTTagByteArray.java -+++ ../src-work/minecraft/net/minecraft/nbt/NBTTagByteArray.java -@@ -25,6 +25,7 @@ - - void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException - { -+ sizeTracker.read(32); //Forge: Count the length as well - int j = input.readInt(); - sizeTracker.read((long)(8 * j)); - this.data = new byte[j]; diff --git a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch deleted file mode 100644 index e4bc0da41..000000000 --- a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/nbt/NBTTagCompound.java -+++ ../src-work/minecraft/net/minecraft/nbt/NBTTagCompound.java -@@ -48,7 +48,7 @@ - while ((b0 = readType(input, sizeTracker)) != 0) - { - String s = readKey(input, sizeTracker); -- sizeTracker.read((long)(16 * s.length())); -+ NBTSizeTracker.readUTF(sizeTracker, s); // Forge: Correctly read String length including header. - NBTBase nbtbase = readNBT(b0, s, input, depth + 1, sizeTracker); - this.tagMap.put(s, nbtbase); - } -@@ -396,6 +396,7 @@ - - private static byte readType(DataInput input, NBTSizeTracker sizeTracker) throws IOException - { -+ sizeTracker.read(8); - return input.readByte(); - } - -@@ -406,6 +407,7 @@ - - static NBTBase readNBT(byte id, String key, DataInput input, int depth, NBTSizeTracker sizeTracker) - { -+ sizeTracker.read(32); //Forge: 4 extra bytes for the object allocation. - NBTBase nbtbase = NBTBase.createNewByType(id); - - try diff --git a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagIntArray.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagIntArray.java.patch deleted file mode 100644 index 4248de8b0..000000000 --- a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagIntArray.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/nbt/NBTTagIntArray.java -+++ ../src-work/minecraft/net/minecraft/nbt/NBTTagIntArray.java -@@ -29,6 +29,7 @@ - - void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException - { -+ sizeTracker.read(32); //Forge: Count the length as well - int j = input.readInt(); - sizeTracker.read((long)(32 * j)); - this.intArray = new int[j]; diff --git a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagList.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagList.java.patch deleted file mode 100644 index b3272419a..000000000 --- a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagList.java.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/nbt/NBTTagList.java -+++ ../src-work/minecraft/net/minecraft/nbt/NBTTagList.java -@@ -46,11 +46,13 @@ - { - sizeTracker.read(8L); - this.tagType = input.readByte(); -+ sizeTracker.read(32); //Forge: Count the length as well - int j = input.readInt(); - this.tagList = Lists.newArrayList(); - - for (int k = 0; k < j; ++k) - { -+ sizeTracker.read(32); //Forge: 4 extra bytes for the object allocation. - NBTBase nbtbase = NBTBase.createNewByType(this.tagType); - nbtbase.read(input, depth + 1, sizeTracker); - this.tagList.add(nbtbase); diff --git a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagString.java.patch b/patches.mcp/minecraft/net/minecraft/nbt/NBTTagString.java.patch deleted file mode 100644 index 491b667f2..000000000 --- a/patches.mcp/minecraft/net/minecraft/nbt/NBTTagString.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/nbt/NBTTagString.java -+++ ../src-work/minecraft/net/minecraft/nbt/NBTTagString.java -@@ -32,7 +32,7 @@ - void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException - { - this.data = input.readUTF(); -- sizeTracker.read((long)(16 * this.data.length())); -+ NBTSizeTracker.readUTF(sizeTracker, data); // Forge: Correctly read String length including header. - } - - public byte getId() diff --git a/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch b/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch deleted file mode 100644 index 744329a52..000000000 --- a/patches.mcp/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch +++ /dev/null @@ -1,166 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/NetHandlerPlayServer.java -+++ ../src-work/minecraft/net/minecraft/network/NetHandlerPlayServer.java -@@ -93,6 +93,14 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - -+import net.minecraftforge.common.ForgeHooks; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.fml.common.eventhandler.Event; -+import net.minecraftforge.event.ForgeEventFactory; -+import net.minecraftforge.event.ServerChatEvent; -+import net.minecraftforge.event.entity.player.PlayerInteractEvent; -+import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; -+ - public class NetHandlerPlayServer implements INetHandlerPlayServer, IUpdatePlayerListBox - { - private static final Logger logger = LogManager.getLogger(); -@@ -246,6 +254,8 @@ - this.playerEntity.ridingEntity.updateRiderPosition(); - } - -+ if (!this.hasMoved) return; //Fixes teleportation kick while riding entities -+ - this.serverController.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); - - if (this.playerEntity.ridingEntity != null) -@@ -324,9 +334,10 @@ - double d11 = d8 - this.playerEntity.posX; - double d12 = d9 - this.playerEntity.posY; - double d13 = d10 - this.playerEntity.posZ; -- double d14 = Math.min(Math.abs(d11), Math.abs(this.playerEntity.motionX)); -- double d15 = Math.min(Math.abs(d12), Math.abs(this.playerEntity.motionY)); -- double d16 = Math.min(Math.abs(d13), Math.abs(this.playerEntity.motionZ)); -+ //BUGFIX: min -> max, grabs the highest distance -+ double d14 = Math.max(Math.abs(d11), Math.abs(this.playerEntity.motionX)); -+ double d15 = Math.max(Math.abs(d12), Math.abs(this.playerEntity.motionY)); -+ double d16 = Math.max(Math.abs(d13), Math.abs(this.playerEntity.motionZ)); - double d17 = d14 * d14 + d15 * d15 + d16 * d16; - - if (d17 > 100.0D && (!this.serverController.isSinglePlayer() || !this.serverController.getServerOwner().equals(this.playerEntity.getName()))) -@@ -344,6 +355,8 @@ - this.playerEntity.jump(); - } - -+ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving -+ - this.playerEntity.moveEntity(d11, d12, d13); - this.playerEntity.onGround = packetIn.isOnGround(); - double d18 = d12; -@@ -365,6 +378,8 @@ - logger.warn(this.playerEntity.getName() + " moved wrongly!"); - } - -+ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving -+ - this.playerEntity.setPositionAndRotation(d8, d9, d10, f1, f2); - this.playerEntity.addMovementStat(this.playerEntity.posX - d0, this.playerEntity.posY - d1, this.playerEntity.posZ - d2); - -@@ -372,7 +387,7 @@ - { - boolean flag2 = worldserver.getCollidingBoundingBoxes(this.playerEntity, this.playerEntity.getEntityBoundingBox().contract((double)f3, (double)f3, (double)f3)).isEmpty(); - -- if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping()) -+ if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping() && !this.playerEntity.noClip) - { - this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, f1, f2); - return; -@@ -400,6 +415,8 @@ - this.floatingTickCount = 0; - } - -+ if (!this.hasMoved) return; //Fixes "Moved Too Fast" kick when being teleported while moving -+ - this.playerEntity.onGround = packetIn.isOnGround(); - this.serverController.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); - this.playerEntity.handleFalling(this.playerEntity.posY - d7, packetIn.isOnGround()); -@@ -489,7 +506,10 @@ - double d2 = this.playerEntity.posZ - ((double)blockpos.getZ() + 0.5D); - double d3 = d0 * d0 + d1 * d1 + d2 * d2; - -- if (d3 > 36.0D) -+ double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 1; -+ dist *= dist; -+ -+ if (d3 > dist) - { - return; - } -@@ -540,6 +560,7 @@ - WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); - ItemStack itemstack = this.playerEntity.inventory.getCurrentItem(); - boolean flag = false; -+ boolean placeResult = true; - BlockPos blockpos = packetIn.getPosition(); - EnumFacing enumfacing = EnumFacing.getFront(packetIn.getPlacedBlockDirection()); - this.playerEntity.markPlayerActive(); -@@ -551,7 +572,11 @@ - return; - } - -+ PlayerInteractEvent event = ForgeEventFactory.onPlayerInteract(playerEntity, PlayerInteractEvent.Action.RIGHT_CLICK_AIR, worldserver, new BlockPos(0, 0, 0), null); -+ if (event.useItem != Event.Result.DENY) -+ { - this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, worldserver, itemstack); -+ } - } - else if (blockpos.getY() >= this.serverController.getBuildLimit() - 1 && (enumfacing == EnumFacing.UP || blockpos.getY() >= this.serverController.getBuildLimit())) - { -@@ -562,9 +587,12 @@ - } - else - { -- if (this.hasMoved && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < 64.0D && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) -+ double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 1; -+ dist *= dist; -+ if (this.hasMoved && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < dist && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) - { -- this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, blockpos, enumfacing, packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ()); -+ // record block place result so we can update client itemstack size if place event was cancelled. -+ placeResult = this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, blockpos, enumfacing, packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ()); - } - - flag = true; -@@ -592,7 +620,7 @@ - this.playerEntity.openContainer.detectAndSendChanges(); - this.playerEntity.isChangingQuantityOnly = false; - -- if (!ItemStack.areItemStacksEqual(this.playerEntity.inventory.getCurrentItem(), packetIn.getStack())) -+ if (!ItemStack.areItemStacksEqual(this.playerEntity.inventory.getCurrentItem(), packetIn.getStack()) || !placeResult) // force client itemstack update if place event was cancelled - { - this.sendPacket(new S2FPacketSetSlot(this.playerEntity.openContainer.windowId, slot.slotNumber, this.playerEntity.inventory.getCurrentItem())); - } -@@ -764,8 +792,10 @@ - } - else - { -- ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("chat.type.text", new Object[] {this.playerEntity.getDisplayName(), s}); -- this.serverController.getConfigurationManager().sendChatMsgImpl(chatcomponenttranslation1, false); -+ ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("chat.type.text", this.playerEntity.getDisplayName(), ForgeHooks.newChatWithLinks(s)); -+ IChatComponent chat = ForgeHooks.onServerChatEvent(this, s, chatcomponenttranslation1); -+ if (chat == null) return; -+ this.serverController.getConfigurationManager().sendChatMsgImpl(chat, false); - } - - this.chatSpamThresholdCount += 20; -@@ -907,7 +937,7 @@ - return; - } - -- this.playerEntity = this.serverController.getConfigurationManager().recreatePlayerEntity(this.playerEntity, 0, false); -+ this.playerEntity = this.serverController.getConfigurationManager().recreatePlayerEntity(this.playerEntity, playerEntity.dimension, false); - } - - break; -@@ -1080,7 +1110,10 @@ - return; - } - -- System.arraycopy(packetIn.getLines(), 0, tileentitysign.signText, 0, 4); -+ IChatComponent[] lines = packetIn.getLines(); //Forge: Prevent client from directly sending commands -+ for (int x = 0; x < tileentitysign.signText.length && x < lines.length; x++) -+ tileentitysign.signText[x] = new ChatComponentText(net.minecraft.util.EnumChatFormatting.getTextWithoutFormattingCodes(lines[x].getUnformattedText())); -+ - tileentitysign.markDirty(); - worldserver.markBlockForUpdate(blockpos); - } diff --git a/patches.mcp/minecraft/net/minecraft/network/NetworkManager.java.patch b/patches.mcp/minecraft/net/minecraft/network/NetworkManager.java.patch deleted file mode 100644 index d59871ee0..000000000 --- a/patches.mcp/minecraft/net/minecraft/network/NetworkManager.java.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/NetworkManager.java -+++ ../src-work/minecraft/net/minecraft/network/NetworkManager.java -@@ -88,6 +88,11 @@ - this.direction = packetDirection; - } - -+ public EnumPacketDirection getDirection() -+ { -+ return this.direction; -+ } -+ - public void channelActive(ChannelHandlerContext p_channelActive_1_) throws Exception - { - super.channelActive(p_channelActive_1_); -@@ -175,7 +180,7 @@ - final EnumConnectionState enumconnectionstate = EnumConnectionState.getFromPacket(inPacket); - final EnumConnectionState enumconnectionstate1 = (EnumConnectionState)this.channel.attr(attrKeyConnectionState).get(); - -- if (enumconnectionstate1 != enumconnectionstate) -+ if (enumconnectionstate1 != enumconnectionstate && !( inPacket instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) - { - logger.debug("Disabled auto read"); - this.channel.config().setAutoRead(false); -@@ -183,7 +188,7 @@ - - if (this.channel.eventLoop().inEventLoop()) - { -- if (enumconnectionstate != enumconnectionstate1) -+ if (enumconnectionstate != enumconnectionstate1 && !( inPacket instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) - { - this.setConnectionState(enumconnectionstate); - } -@@ -204,7 +209,7 @@ - private static final String __OBFID = "CL_00001243"; - public void run() - { -- if (enumconnectionstate != enumconnectionstate1) -+ if (enumconnectionstate != enumconnectionstate1 && !( inPacket instanceof net.minecraftforge.fml.common.network.internal.FMLProxyPacket)) - { - NetworkManager.this.setConnectionState(enumconnectionstate); - } -@@ -409,6 +414,11 @@ - this.channelRead0(p_channelRead0_1_, (Packet)p_channelRead0_2_); - } - -+ public Channel channel() -+ { -+ return channel; -+ } -+ - static class InboundHandlerTuplePacketListener - { - private final Packet packet; diff --git a/patches.mcp/minecraft/net/minecraft/network/NetworkSystem.java.patch b/patches.mcp/minecraft/net/minecraft/network/NetworkSystem.java.patch deleted file mode 100644 index 71fdc4309..000000000 --- a/patches.mcp/minecraft/net/minecraft/network/NetworkSystem.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/NetworkSystem.java -+++ ../src-work/minecraft/net/minecraft/network/NetworkSystem.java -@@ -110,7 +110,7 @@ - ; - } - -- p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new PingResponseHandler(NetworkSystem.this)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer(EnumPacketDirection.SERVERBOUND)).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer(EnumPacketDirection.CLIENTBOUND)); -+ p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.READ_TIMEOUT)).addLast("legacy_query", new PingResponseHandler(NetworkSystem.this)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer(EnumPacketDirection.SERVERBOUND)).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer(EnumPacketDirection.CLIENTBOUND)); - NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND); - NetworkSystem.this.networkManagers.add(networkmanager); - p_initChannel_1_.pipeline().addLast("packet_handler", networkmanager); diff --git a/patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch b/patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch deleted file mode 100644 index b7c9b8cab..000000000 --- a/patches.mcp/minecraft/net/minecraft/network/ServerStatusResponse.java.patch +++ /dev/null @@ -1,92 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/ServerStatusResponse.java -+++ ../src-work/minecraft/net/minecraft/network/ServerStatusResponse.java -@@ -29,6 +29,7 @@ - public void setServerDescription(IChatComponent motd) - { - this.serverMotd = motd; -+ invalidateJson(); - } - - public ServerStatusResponse.PlayerCountData getPlayerCountData() -@@ -39,6 +40,7 @@ - public void setPlayerCountData(ServerStatusResponse.PlayerCountData countData) - { - this.playerCount = countData; -+ invalidateJson(); - } - - public ServerStatusResponse.MinecraftProtocolVersionIdentifier getProtocolVersionInfo() -@@ -49,11 +51,13 @@ - public void setProtocolVersionInfo(ServerStatusResponse.MinecraftProtocolVersionIdentifier protocolVersionData) - { - this.protocolVersion = protocolVersionData; -+ invalidateJson(); - } - - public void setFavicon(String faviconBlob) - { - this.favicon = faviconBlob; -+ invalidateJson(); - } - - public String getFavicon() -@@ -233,6 +237,7 @@ - serverstatusresponse.setFavicon(JsonUtils.getJsonObjectStringFieldValue(jsonobject, "favicon")); - } - -+ net.minecraftforge.fml.client.FMLClientHandler.instance().captureAdditionalData(serverstatusresponse, jsonobject); - return serverstatusresponse; - } - -@@ -260,6 +265,7 @@ - jsonobject.addProperty("favicon", p_serialize_1_.getFavicon()); - } - -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.enhanceStatusQuery(jsonobject); - return jsonobject; - } - -@@ -268,4 +274,43 @@ - return this.serialize((ServerStatusResponse)p_serialize_1_, p_serialize_2_, p_serialize_3_); - } - } -+ -+ private java.util.concurrent.Semaphore mutex = new java.util.concurrent.Semaphore(1); -+ private String json = null; -+ /** -+ * Returns this object as a Json string. -+ * Converting to JSON if a cached version is not available. -+ * -+ * Also to prevent potentially large memory allocations on the server -+ * this is moved from the S00PacketServerInfo writePacket function -+ * -+ * As this method is called from the network threads thread safety is important! -+ * -+ * @return -+ */ -+ public String getJson() -+ { -+ String ret = this.json; -+ if (ret == null) -+ { -+ mutex.acquireUninterruptibly(); -+ ret = this.json; -+ if (ret == null) -+ { -+ ret = net.minecraft.network.status.server.S00PacketServerInfo.GSON.toJson(this); -+ this.json = ret; -+ } -+ mutex.release(); -+ } -+ return ret; -+ } -+ -+ /** -+ * Invalidates the cached json, causing the next call to getJson to rebuild it. -+ * This is needed externally because PlayerCountData.setPlayer's is public. -+ */ -+ public void invalidateJson() -+ { -+ this.json = null; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch b/patches.mcp/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch deleted file mode 100644 index d52c5fb63..000000000 --- a/patches.mcp/minecraft/net/minecraft/network/handshake/client/C00Handshake.java.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/handshake/client/C00Handshake.java -+++ ../src-work/minecraft/net/minecraft/network/handshake/client/C00Handshake.java -@@ -16,6 +16,7 @@ - private int port; - private EnumConnectionState requestedState; - private static final String __OBFID = "CL_00001372"; -+ private boolean hasFMLMarker = false; - - public C00Handshake() {} - -@@ -28,18 +29,26 @@ - this.requestedState = requestedState; - } - -+ public C00Handshake(int protocol, String address, int port, EnumConnectionState state, boolean addFMLMarker) -+ { -+ this(protocol, address, port, state); -+ this.hasFMLMarker = addFMLMarker; -+ } -+ - public void readPacketData(PacketBuffer buf) throws IOException - { - this.protocolVersion = buf.readVarIntFromBuffer(); - this.ip = buf.readStringFromBuffer(255); - this.port = buf.readUnsignedShort(); - this.requestedState = EnumConnectionState.getById(buf.readVarIntFromBuffer()); -+ this.hasFMLMarker = this.ip.contains("\0FML\0"); -+ this.ip = this.ip.split("\0")[0]; - } - - public void writePacketData(PacketBuffer buf) throws IOException - { - buf.writeVarIntToBuffer(this.protocolVersion); -- buf.writeString(this.ip); -+ buf.writeString(this.ip + "\0FML\0"); - buf.writeShort(this.port); - buf.writeVarIntToBuffer(this.requestedState.getId()); - } -@@ -63,4 +72,9 @@ - { - this.handle((INetHandlerHandshakeServer)handler); - } -+ -+ public boolean hasFMLMarker() -+ { -+ return this.hasFMLMarker; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch b/patches.mcp/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch deleted file mode 100644 index a0a015760..000000000 --- a/patches.mcp/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java -+++ ../src-work/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java -@@ -32,7 +32,7 @@ - - for (int i = 0; i < 4; ++i) - { -- this.lines[i] = buf.readChatComponent(); -+ this.lines[i] = IChatComponent.Serializer.jsonToComponent(buf.readStringFromBuffer(384)); - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch b/patches.mcp/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch deleted file mode 100644 index 331306c78..000000000 --- a/patches.mcp/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java -+++ ../src-work/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java -@@ -47,7 +47,11 @@ - public void writePacketData(PacketBuffer buf) throws IOException - { - buf.writeString(this.channel); -+ synchronized(this.data) { //This may be access multiple times, from multiple threads, lets be safe. -+ this.data.markReaderIndex(); - buf.writeBytes((ByteBuf)this.data); -+ this.data.resetReaderIndex(); -+ } - } - - public void processPacket(INetHandlerPlayServer handler) diff --git a/patches.mcp/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch b/patches.mcp/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch deleted file mode 100644 index af5d3f67d..000000000 --- a/patches.mcp/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java -+++ ../src-work/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java -@@ -46,7 +46,11 @@ - public void writePacketData(PacketBuffer buf) throws IOException - { - buf.writeString(this.channel); -+ synchronized(this.data) { //This may be access multiple times, from multiple threads, lets be safe. -+ this.data.markReaderIndex(); - buf.writeBytes((ByteBuf)this.data); -+ this.data.resetReaderIndex(); -+ } - } - - public void process(INetHandlerPlayClient p_180734_1_) diff --git a/patches.mcp/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch b/patches.mcp/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch deleted file mode 100644 index dcb18e144..000000000 --- a/patches.mcp/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java -+++ ../src-work/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java -@@ -34,7 +34,7 @@ - - public void writePacketData(PacketBuffer buf) throws IOException - { -- buf.writeString(GSON.toJson(this.response)); -+ buf.writeString(this.response.getJson()); - } - - public void processPacket(INetHandlerStatusClient handler) diff --git a/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch b/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch deleted file mode 100644 index 915b67091..000000000 --- a/patches.mcp/minecraft/net/minecraft/potion/Potion.java.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/potion/Potion.java -+++ ../src-work/minecraft/net/minecraft/potion/Potion.java -@@ -330,4 +330,27 @@ - { - return p_111183_2_.getAmount() * (double)(p_111183_1_ + 1); - } -+ -+ /* ======================================== FORGE START =====================================*/ -+ -+ /** -+ * If the standard PotionEffect text (name and duration) should be drawn when this potion is active. -+ * @param effect the active PotionEffect -+ * @return true to draw the standard text -+ */ -+ public boolean shouldRenderInvText(PotionEffect effect) -+ { -+ return true; -+ } -+ -+ /** -+ * Called to draw the this Potion onto the player's inventory when it's active. -+ * This can be used to e.g. render Potion icons from your own texture. -+ * @param x the x coordinate -+ * @param y the y coordinate -+ * @param effect the active PotionEffect -+ * @param mc the Minecraft instance, for convenience -+ */ -+ @SideOnly(Side.CLIENT) -+ public void renderInventoryEffect(int x, int y, PotionEffect effect, net.minecraft.client.Minecraft mc) { } - } diff --git a/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch b/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch deleted file mode 100644 index ea0070e75..000000000 --- a/patches.mcp/minecraft/net/minecraft/potion/PotionEffect.java.patch +++ /dev/null @@ -1,100 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/potion/PotionEffect.java -+++ ../src-work/minecraft/net/minecraft/potion/PotionEffect.java -@@ -19,6 +19,8 @@ - private boolean isPotionDurationMax; - private boolean showParticles; - private static final String __OBFID = "CL_00001529"; -+ /** List of ItemStack that can cure the potion effect **/ -+ private java.util.List curativeItems; - - public PotionEffect(int id, int effectDuration) - { -@@ -37,6 +39,8 @@ - this.amplifier = effectAmplifier; - this.isAmbient = ambient; - this.showParticles = showParticles; -+ this.curativeItems = new java.util.ArrayList(); -+ this.curativeItems.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.milk_bucket)); - } - - public PotionEffect(PotionEffect other) -@@ -46,6 +50,7 @@ - this.amplifier = other.amplifier; - this.isAmbient = other.isAmbient; - this.showParticles = other.showParticles; -+ this.curativeItems = other.curativeItems; - } - - public void combine(PotionEffect other) -@@ -191,7 +196,7 @@ - - public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt) - { -- byte b0 = nbt.getByte("Id"); -+ int b0 = nbt.getByte("Id") & 0xff; - - if (b0 >= 0 && b0 < Potion.potionTypes.length && Potion.potionTypes[b0] != null) - { -@@ -224,4 +229,62 @@ - { - return this.isPotionDurationMax; - } -+ -+ /* ======================================== FORGE START =====================================*/ -+ /*** -+ * Returns a list of curative items for the potion effect -+ * @return The list (ItemStack) of curative items for the potion effect -+ */ -+ public java.util.List getCurativeItems() -+ { -+ return this.curativeItems; -+ } -+ -+ /*** -+ * Checks the given ItemStack to see if it is in the list of curative items for the potion effect -+ * @param stack The ItemStack being checked against the list of curative items for the potion effect -+ * @return true if the given ItemStack is in the list of curative items for the potion effect, false otherwise -+ */ -+ public boolean isCurativeItem(net.minecraft.item.ItemStack stack) -+ { -+ boolean found = false; -+ for (net.minecraft.item.ItemStack curativeItem : this.curativeItems) -+ { -+ if (curativeItem.isItemEqual(stack)) -+ { -+ found = true; -+ } -+ } -+ -+ return found; -+ } -+ -+ /*** -+ * Sets the array of curative items for the potion effect -+ * @param curativeItems The list of ItemStacks being set to the potion effect -+ */ -+ public void setCurativeItems(java.util.List curativeItems) -+ { -+ this.curativeItems = curativeItems; -+ } -+ -+ /*** -+ * Adds the given stack to list of curative items for the potion effect -+ * @param stack The ItemStack being added to the curative item list -+ */ -+ public void addCurativeItem(net.minecraft.item.ItemStack stack) -+ { -+ boolean found = false; -+ for (net.minecraft.item.ItemStack curativeItem : this.curativeItems) -+ { -+ if (curativeItem.isItemEqual(stack)) -+ { -+ found = true; -+ } -+ } -+ if (!found) -+ { -+ this.curativeItems.add(stack); -+ } -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch b/patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch deleted file mode 100644 index e6eb9ca74..000000000 --- a/patches.mcp/minecraft/net/minecraft/realms/RealmsConnect.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/realms/RealmsConnect.java -+++ ../src-work/minecraft/net/minecraft/realms/RealmsConnect.java -@@ -39,6 +39,7 @@ - - try - { -+ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToRealmsServer(p_connect_1_, p_connect_2_); - inetaddress = InetAddress.getByName(p_connect_1_); - - if (RealmsConnect.this.aborted) -@@ -60,7 +61,7 @@ - return; - } - -- RealmsConnect.this.connection.sendPacket(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN)); -+ RealmsConnect.this.connection.sendPacket(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN, true)); - - if (RealmsConnect.this.aborted) - { diff --git a/patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch deleted file mode 100644 index c9905ed3a..000000000 --- a/patches.mcp/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ /dev/null @@ -1,306 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/MinecraftServer.java -+++ ../src-work/minecraft/net/minecraft/server/MinecraftServer.java -@@ -99,7 +99,7 @@ - @SideOnly(Side.SERVER) - private String hostname; - private int serverPort = -1; -- public WorldServer[] worldServers; -+ public WorldServer[] worldServers = new WorldServer[0]; - private ServerConfigurationManager serverConfigManager; - private boolean serverRunning = true; - private boolean serverStopped; -@@ -116,7 +116,8 @@ - private int buildLimit; - private int maxPlayerIdleMinutes = 0; - public final long[] tickTimeArray = new long[100]; -- public long[][] timeOfLastDimensionTick; -+ //public long[][] timeOfLastDimensionTick; -+ public java.util.Hashtable worldTickTimes = new java.util.Hashtable(); - private KeyPair serverKeyPair; - private String serverOwner; - private String folderName; -@@ -222,8 +223,6 @@ - { - this.convertMapIfNeeded(p_71247_1_); - this.setUserMessage("menu.loadingLevel"); -- this.worldServers = new WorldServer[3]; -- this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; - ISaveHandler isavehandler = this.anvilConverterForAnvilFile.getSaveLoader(p_71247_1_, true); - this.setResourcePackFromWorld(this.getFolderName(), isavehandler); - WorldInfo worldinfo = isavehandler.loadWorldInfo(); -@@ -254,47 +253,21 @@ - worldsettings = new WorldSettings(worldinfo); - } - -- for (int j = 0; j < this.worldServers.length; ++j) -+ WorldServer overWorld = (WorldServer)(isDemo() ? new DemoWorldServer(this, isavehandler, worldinfo, 0, theProfiler).init() : new WorldServer(this, isavehandler, worldinfo, 0, theProfiler).init()); -+ overWorld.initialize(worldsettings); -+ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) - { -- byte b0 = 0; -+ WorldServer world = (dim == 0 ? overWorld : (WorldServer)new WorldServerMulti(this, isavehandler, dim, overWorld, theProfiler).init()); -+ world.addWorldAccess(new WorldManager(this, world)); - -- if (j == 1) -- { -- b0 = -1; -- } -- -- if (j == 2) -- { -- b0 = 1; -- } -- -- if (j == 0) -- { -- if (this.isDemo()) -- { -- this.worldServers[j] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, b0, this.theProfiler)).init(); -- } -- else -- { -- this.worldServers[j] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, b0, this.theProfiler)).init(); -- } -- -- this.worldServers[j].initialize(worldsettings); -- } -- else -- { -- this.worldServers[j] = (WorldServer)(new WorldServerMulti(this, isavehandler, b0, this.worldServers[0], this.theProfiler)).init(); -- } -- -- this.worldServers[j].addWorldAccess(new WorldManager(this, this.worldServers[j])); -- - if (!this.isSinglePlayer()) - { -- this.worldServers[j].getWorldInfo().setGameType(this.getGameType()); -+ world.getWorldInfo().setGameType(this.getGameType()); - } -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); - } - -- this.serverConfigManager.setPlayerManager(this.worldServers); -+ this.serverConfigManager.setPlayerManager(new WorldServer[]{ overWorld }); - this.setDifficultyForAllWorlds(this.getDifficulty()); - this.initialWorldChunkLoad(); - } -@@ -309,7 +282,7 @@ - this.setUserMessage("menu.generatingTerrain"); - byte b0 = 0; - logger.info("Preparing start region for level " + b0); -- WorldServer worldserver = this.worldServers[b0]; -+ WorldServer worldserver = net.minecraftforge.common.DimensionManager.getWorld(b0); - BlockPos blockpos = worldserver.getSpawnPoint(); - long j = getCurrentTimeMillis(); - -@@ -371,6 +344,7 @@ - if (!this.worldIsBeingDeleted) - { - WorldServer[] aworldserver = this.worldServers; -+ if (aworldserver == null) return; //Forge: Just in case, NPE protection as it has been encountered. - int i = aworldserver.length; - - for (int j = 0; j < i; ++j) -@@ -399,7 +373,7 @@ - - public void stopServer() - { -- if (!this.worldIsBeingDeleted) -+ if (!this.worldIsBeingDeleted && net.minecraftforge.fml.common.Loader.instance().hasReachedState(net.minecraftforge.fml.common.LoaderState.SERVER_STARTED) && !serverStopped) // make sure the save is valid and we don't save twice - { - logger.info("Stopping server"); - -@@ -423,8 +397,15 @@ - for (int i = 0; i < this.worldServers.length; ++i) - { - WorldServer worldserver = this.worldServers[i]; -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); - worldserver.flush(); - } -+ -+ WorldServer[] tmp = worldServers; -+ for (WorldServer world : tmp) -+ { -+ net.minecraftforge.common.DimensionManager.setWorld(world.provider.getDimensionId(), null); -+ } - } - - if (this.usageSnooper.isSnooperRunning()) -@@ -456,6 +437,7 @@ - { - if (this.startServer()) - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarted(); - this.currentTime = getCurrentTimeMillis(); - long i = 0L; - this.statusResponse.setServerDescription(new ChatComponentText(this.motd)); -@@ -500,12 +482,20 @@ - Thread.sleep(Math.max(1L, 50L - i)); - this.serverIsRunning = true; - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStopping(); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions - } - else - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions - this.finalTick((CrashReport)null); - } - } -+ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) -+ { -+ // ignore silently -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions -+ } - catch (Throwable throwable1) - { - logger.error("Encountered an unexpected exception", throwable1); -@@ -531,6 +521,7 @@ - logger.error("We were unable to save this crash report to disk."); - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions - this.finalTick(crashreport); - } - finally -@@ -546,6 +537,8 @@ - } - finally - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStopped(); -+ this.serverStopped = true; - this.systemExitNow(); - } - } -@@ -591,6 +584,7 @@ - public void tick() - { - long i = System.nanoTime(); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreServerTick(); - ++this.tickCounter; - - if (this.startProfiling) -@@ -617,6 +611,7 @@ - - Collections.shuffle(Arrays.asList(agameprofile)); - this.statusResponse.getPlayerCountData().setPlayers(agameprofile); -+ this.statusResponse.invalidateJson(); - } - - if (this.tickCounter % 900 == 0) -@@ -644,6 +639,7 @@ - - this.theProfiler.endSection(); - this.theProfiler.endSection(); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostServerTick(); - } - - public void updateTimeLightAndEntities() -@@ -657,7 +653,7 @@ - { - try - { -- ((FutureTask)this.futureTaskQueue.poll()).run(); -+ net.minecraftforge.fml.common.FMLCommonHandler.callFuture(((FutureTask)this.futureTaskQueue.poll())); - } - catch (Throwable throwable2) - { -@@ -667,15 +663,18 @@ - } - - this.theProfiler.endStartSection("levels"); -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.tick(); - int j; - -- for (j = 0; j < this.worldServers.length; ++j) -+ Integer[] ids = net.minecraftforge.common.DimensionManager.getIDs(this.tickCounter % 200 == 0); -+ for (int x = 0; x < ids.length; x++) - { -+ int id = ids[x]; - long i = System.nanoTime(); - -- if (j == 0 || this.getAllowNether()) -+ if (id == 0 || this.getAllowNether()) - { -- WorldServer worldserver = this.worldServers[j]; -+ WorldServer worldserver = net.minecraftforge.common.DimensionManager.getWorld(id); - this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName()); - - if (this.tickCounter % 20 == 0) -@@ -686,6 +685,7 @@ - } - - this.theProfiler.startSection("tick"); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreWorldTick(worldserver); - CrashReport crashreport; - - try -@@ -710,6 +710,7 @@ - throw new ReportedException(crashreport); - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostWorldTick(worldserver); - this.theProfiler.endSection(); - this.theProfiler.startSection("tracker"); - worldserver.getEntityTracker().updateTrackedEntities(); -@@ -717,9 +718,11 @@ - this.theProfiler.endSection(); - } - -- this.timeOfLastDimensionTick[j][this.tickCounter % 100] = System.nanoTime() - i; -+ worldTickTimes.get(id)[this.tickCounter % 100] = System.nanoTime() - i; - } - -+ this.theProfiler.endStartSection("dim_unloading"); -+ net.minecraftforge.common.DimensionManager.unloadWorlds(worldTickTimes); - this.theProfiler.endStartSection("connection"); - this.getNetworkSystem().networkTick(); - this.theProfiler.endStartSection("players"); -@@ -741,6 +744,7 @@ - - public void startServerThread() - { -+ net.minecraftforge.fml.common.StartupQuery.reset(); - this.serverThread = new Thread(this, "Server thread"); - this.serverThread.start(); - } -@@ -757,7 +761,13 @@ - - public WorldServer worldServerForDimension(int dimension) - { -- return dimension == -1 ? this.worldServers[1] : (dimension == 1 ? this.worldServers[2] : this.worldServers[0]); -+ WorldServer ret = net.minecraftforge.common.DimensionManager.getWorld(dimension); -+ if (ret == null) -+ { -+ net.minecraftforge.common.DimensionManager.initDimension(dimension); -+ ret = net.minecraftforge.common.DimensionManager.getWorld(dimension); -+ } -+ return ret; - } - - public String getMinecraftVersion() -@@ -787,7 +797,7 @@ - - public String getServerModName() - { -- return "vanilla"; -+ return net.minecraftforge.fml.common.FMLCommonHandler.instance().getModName(); - } - - public CrashReport addServerInfoToCrashReport(CrashReport report) -@@ -1008,6 +1018,7 @@ - - if (worldserver != null) - { -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver)); - worldserver.flush(); - } - } -@@ -1590,7 +1601,6 @@ - this.serverPort = port; - } - -- @SideOnly(Side.SERVER) - public boolean isServerStopped() - { - return this.serverStopped; diff --git a/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch deleted file mode 100644 index ea7edb2a8..000000000 --- a/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/dedicated/DedicatedServer.java -+++ ../src-work/minecraft/net/minecraft/server/dedicated/DedicatedServer.java -@@ -49,6 +49,7 @@ - private boolean canSpawnStructures; - private WorldSettings.GameType gameType; - private boolean guiIsEnabled; -+ public static boolean allowPlayerLogins = false; - private static final String __OBFID = "CL_00001784"; - - public DedicatedServer(File workDir) -@@ -113,6 +114,8 @@ - logger.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStart(this); -+ - logger.info("Loading properties"); - this.settings = new PropertyManager(new File("server.properties")); - this.eula = new ServerEula(new File("eula.txt")); -@@ -204,6 +207,7 @@ - } - else - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStarted(); - this.setConfigManager(new DedicatedPlayerList(this)); - long j = System.nanoTime(); - -@@ -250,6 +254,7 @@ - this.setBuildLimit((this.getBuildLimit() + 8) / 16 * 16); - this.setBuildLimit(MathHelper.clamp_int(this.getBuildLimit(), 64, 256)); - this.settings.setProperty("max-build-height", Integer.valueOf(this.getBuildLimit())); -+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; - logger.info("Preparing level \"" + this.getFolderName() + "\""); - this.loadAllWorlds(this.getFolderName(), this.getFolderName(), k, worldtype, s2); - long i1 = System.nanoTime() - j; -@@ -278,7 +283,7 @@ - thread1.start(); - } - -- return true; -+ return net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarting(this); - } - } - } diff --git a/patches.mcp/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch b/patches.mcp/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch deleted file mode 100644 index c01217c8d..000000000 --- a/patches.mcp/minecraft/net/minecraft/server/gui/MinecraftServerGui.java.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/gui/MinecraftServerGui.java -+++ ../src-work/minecraft/net/minecraft/server/gui/MinecraftServerGui.java -@@ -79,6 +79,7 @@ - System.exit(0); - } - }); -+ minecraftservergui.latch.countDown(); - } - - public MinecraftServerGui(DedicatedServer serverIn) -@@ -164,8 +165,13 @@ - return jpanel; - } - -+ private java.util.concurrent.CountDownLatch latch = new java.util.concurrent.CountDownLatch(1); - public void func_164247_a(final JTextArea p_164247_1_, final JScrollPane p_164247_2_, final String p_164247_3_) - { -+ try -+ { -+ latch.await(); -+ } catch (InterruptedException e){} //Prevent logging until after constructor has ended. - if (!SwingUtilities.isEventDispatchThread()) - { - SwingUtilities.invokeLater(new Runnable() diff --git a/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch deleted file mode 100644 index 113c5ef2c..000000000 --- a/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch +++ /dev/null @@ -1,97 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/integrated/IntegratedServer.java -+++ ../src-work/minecraft/net/minecraft/server/integrated/IntegratedServer.java -@@ -74,8 +74,6 @@ - protected void loadAllWorlds(String p_71247_1_, String p_71247_2_, long seed, WorldType type, String p_71247_6_) - { - this.convertMapIfNeeded(p_71247_1_); -- this.worldServers = new WorldServer[3]; -- this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; - ISaveHandler isavehandler = this.getActiveAnvilConverter().getSaveLoader(p_71247_1_, true); - this.setResourcePackFromWorld(this.getFolderName(), isavehandler); - WorldInfo worldinfo = isavehandler.loadWorldInfo(); -@@ -88,45 +86,25 @@ - { - worldinfo.setWorldName(p_71247_2_); - } -+ WorldServer overWorld = (isDemo() ? (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init() : -+ (WorldServer)(new WorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init()); -+ overWorld.initialize(this.theWorldSettings); - -- for (int j = 0; j < this.worldServers.length; ++j) -+ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) - { -- byte b0 = 0; - -- if (j == 1) -+ WorldServer world = (dim == 0 ? overWorld : (WorldServer)(new WorldServerMulti(this, isavehandler, dim, overWorld, this.theProfiler)).init()); -+ world.addWorldAccess(new WorldManager(this, world)); -+ if (!this.isSinglePlayer()) - { -- b0 = -1; -+ world.getWorldInfo().setGameType(getGameType()); - } -- -- if (j == 2) -- { -- b0 = 1; -- } -- -- if (j == 0) -- { -- if (this.isDemo()) -- { -- this.worldServers[j] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, b0, this.theProfiler)).init(); -- } -- else -- { -- this.worldServers[j] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, b0, this.theProfiler)).init(); -- } -- -- this.worldServers[j].initialize(this.theWorldSettings); -- } -- else -- { -- this.worldServers[j] = (WorldServer)(new WorldServerMulti(this, isavehandler, b0, this.worldServers[0], this.theProfiler)).init(); -- } -- -- this.worldServers[j].addWorldAccess(new WorldManager(this, this.worldServers[j])); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); - } - -- this.getConfigurationManager().setPlayerManager(this.worldServers); -+ this.getConfigurationManager().setPlayerManager(new WorldServer[]{ overWorld }); - -- if (this.worldServers[0].getWorldInfo().getDifficulty() == null) -+ if (overWorld.getWorldInfo().getDifficulty() == null) - { - this.setDifficultyForAllWorlds(this.mc.gameSettings.difficulty); - } -@@ -144,9 +122,10 @@ - this.setAllowFlight(true); - logger.info("Generating keypair"); - this.setKeyPair(CryptManager.generateKeyPair()); -+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; - this.loadAllWorlds(this.getFolderName(), this.getWorldName(), this.theWorldSettings.getSeed(), this.theWorldSettings.getTerrainType(), this.theWorldSettings.getWorldName()); - this.setMOTD(this.getServerOwner() + " - " + this.worldServers[0].getWorldInfo().getWorldName()); -- return true; -+ return net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarting(this); - } - - public void tick() -@@ -171,7 +150,7 @@ - { - try - { -- ((FutureTask)this.futureTaskQueue.poll()).run(); -+ net.minecraftforge.fml.common.FMLCommonHandler.callFuture(((FutureTask)this.futureTaskQueue.poll())); - } - catch (Throwable throwable) - { -@@ -232,6 +211,7 @@ - - public EnumDifficulty getDifficulty() - { -+ if (this.mc.theWorld == null) return this.mc.gameSettings.difficulty; // Fix NPE just in case. - return this.mc.theWorld.getWorldInfo().getDifficulty(); - } - diff --git a/patches.mcp/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch b/patches.mcp/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch deleted file mode 100644 index 603ffad4c..000000000 --- a/patches.mcp/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch +++ /dev/null @@ -1,257 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/management/ItemInWorldManager.java -+++ ../src-work/minecraft/net/minecraft/server/management/ItemInWorldManager.java -@@ -22,6 +22,8 @@ - - public class ItemInWorldManager - { -+ /** Forge reach distance */ -+ private double blockReachDistance = 5.0d; - public World theWorld; - public EntityPlayerMP thisPlayerMP; - private WorldSettings.GameType gameType; -@@ -137,6 +139,14 @@ - - public void onBlockClicked(BlockPos pos, EnumFacing side) - { -+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thisPlayerMP, -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, theWorld, pos, side); -+ if (event.isCanceled()) -+ { -+ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); -+ return; -+ } -+ - if (this.isCreative()) - { - if (!this.theWorld.extinguishFire((EntityPlayer)null, pos, side)) -@@ -171,18 +181,35 @@ - } - } - -- this.theWorld.extinguishFire((EntityPlayer)null, pos, side); -+ // - this.initialDamage = this.curblockDamage; - float f = 1.0F; - -- if (block.getMaterial() != Material.air) -+ if (!block.isAir(theWorld, pos)) - { -- block.onBlockClicked(this.theWorld, pos, this.thisPlayerMP); -+ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) -+ { -+ block.onBlockClicked(this.theWorld, pos, this.thisPlayerMP); -+ this.theWorld.extinguishFire((EntityPlayer)null, pos, side); -+ } -+ else -+ { -+ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); -+ } - f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos); - } - -- if (block.getMaterial() != Material.air && f >= 1.0F) -+ if (event.useItem == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) - { -+ if (f >= 1.0F) -+ { -+ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); -+ } -+ return; -+ } -+ -+ if (!block.isAir(theWorld, pos) && f >= 1.0F) -+ { - this.tryHarvestBlock(pos); - } - else -@@ -203,7 +230,7 @@ - int i = this.curblockDamage - this.initialDamage; - Block block = this.theWorld.getBlockState(pos).getBlock(); - -- if (block.getMaterial() != Material.air) -+ if (!block.isAir(theWorld, pos)) - { - float f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos) * (float)(i + 1); - -@@ -232,9 +259,13 @@ - - private boolean removeBlock(BlockPos pos) - { -+ return removeBlock(pos, false); -+ } -+ private boolean removeBlock(BlockPos pos, boolean canHarvest) -+ { - IBlockState iblockstate = this.theWorld.getBlockState(pos); - iblockstate.getBlock().onBlockHarvested(this.theWorld, pos, iblockstate, this.thisPlayerMP); -- boolean flag = this.theWorld.setBlockToAir(pos); -+ boolean flag = iblockstate.getBlock().removedByPlayer(theWorld, pos, thisPlayerMP, canHarvest); - - if (flag) - { -@@ -246,7 +277,8 @@ - - public boolean tryHarvestBlock(BlockPos pos) - { -- if (this.gameType.isCreative() && this.thisPlayerMP.getHeldItem() != null && this.thisPlayerMP.getHeldItem().getItem() instanceof ItemSword) -+ int exp = net.minecraftforge.common.ForgeHooks.onBlockBreakEvent(theWorld, gameType, thisPlayerMP, pos); -+ if (exp == -1) - { - return false; - } -@@ -255,40 +287,21 @@ - IBlockState iblockstate = this.theWorld.getBlockState(pos); - TileEntity tileentity = this.theWorld.getTileEntity(pos); - -- if (this.gameType.isAdventure()) -- { -- if (this.gameType == WorldSettings.GameType.SPECTATOR) -- { -- return false; -- } -+ ItemStack stack = thisPlayerMP.getCurrentEquippedItem(); -+ if (stack != null && stack.getItem().onBlockStartBreak(stack, pos, thisPlayerMP)) return false; - -- if (!this.thisPlayerMP.isAllowEdit()) -- { -- ItemStack itemstack = this.thisPlayerMP.getCurrentEquippedItem(); -- -- if (itemstack == null) -- { -- return false; -- } -- -- if (!itemstack.canDestroy(iblockstate.getBlock())) -- { -- return false; -- } -- } -- } -- - this.theWorld.playAuxSFXAtEntity(this.thisPlayerMP, 2001, pos, Block.getStateId(iblockstate)); -- boolean flag1 = this.removeBlock(pos); -+ boolean flag1 = false; - - if (this.isCreative()) - { -+ flag1 = this.removeBlock(pos); - this.thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(this.theWorld, pos)); - } - else - { - ItemStack itemstack1 = this.thisPlayerMP.getCurrentEquippedItem(); -- boolean flag = this.thisPlayerMP.canHarvestBlock(iblockstate.getBlock()); -+ boolean flag = iblockstate.getBlock().canHarvestBlock(theWorld, pos, thisPlayerMP); - - if (itemstack1 != null) - { -@@ -300,12 +313,18 @@ - } - } - -+ flag1 = this.removeBlock(pos, flag); - if (flag1 && flag) - { - iblockstate.getBlock().harvestBlock(this.theWorld, this.thisPlayerMP, pos, iblockstate, tileentity); - } - } - -+ // Drop experiance -+ if (!this.isCreative() && flag1 && exp > 0) -+ { -+ iblockstate.getBlock().dropXpOnBlockBreak(theWorld, pos, exp); -+ } - return flag1; - } - } -@@ -343,6 +362,7 @@ - if (itemstack1.stackSize == 0) - { - player.inventory.mainInventory[player.inventory.currentItem] = null; -+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, itemstack1); - } - - if (!player.isUsingItem()) -@@ -387,33 +407,51 @@ - } - else - { -- if (!player.isSneaking() || player.getHeldItem() == null) -+ net.minecraftforge.event.entity.player.PlayerInteractEvent event = net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(player, -+ net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, worldIn, pos, side); -+ if (event.isCanceled()) - { -- IBlockState iblockstate = worldIn.getBlockState(pos); -- -- if (iblockstate.getBlock().onBlockActivated(worldIn, pos, iblockstate, player, side, p_180236_6_, p_180236_7_, p_180236_8_)) -- { -- return true; -- } -+ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); -+ return false; - } - -- if (stack == null) -+ if (stack != null && stack.getItem().onItemUseFirst(stack, player, worldIn, pos, side, p_180236_6_, p_180236_7_, p_180236_8_)) - { -- return false; -+ if (stack.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(thisPlayerMP, stack); -+ return true; - } -- else if (this.isCreative()) -+ -+ IBlockState iblockstate = worldIn.getBlockState(pos); -+ boolean isAir = worldIn.isAirBlock(pos); -+ boolean useBlock = !player.isSneaking() || player.getHeldItem() == null; -+ if (!useBlock) useBlock = player.getHeldItem().getItem().doesSneakBypassUse(worldIn, pos, player); -+ boolean result = false; -+ -+ if (useBlock) - { -- int j = stack.getMetadata(); -- int i = stack.stackSize; -- boolean flag = stack.onItemUse(player, worldIn, pos, side, p_180236_6_, p_180236_7_, p_180236_8_); -- stack.setItemDamage(j); -- stack.stackSize = i; -- return flag; -+ if (event.useBlock != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) -+ { -+ result = iblockstate.getBlock().onBlockActivated(worldIn, pos, iblockstate, player, side, p_180236_6_, p_180236_7_, p_180236_8_); -+ } -+ else -+ { -+ thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(theWorld, pos)); -+ result = event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW; -+ } - } -- else -+ if (stack != null && !result && event.useItem != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) - { -- return stack.onItemUse(player, worldIn, pos, side, p_180236_6_, p_180236_7_, p_180236_8_); -+ int meta = stack.getMetadata(); -+ int size = stack.stackSize; -+ result = stack.onItemUse(player, worldIn, pos, side, p_180236_6_, p_180236_7_, p_180236_8_); -+ if (isCreative()) -+ { -+ stack.setItemDamage(meta); -+ stack.stackSize = size; -+ } -+ if (stack.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(thisPlayerMP, stack); - } -+ return result; - } - } - -@@ -421,4 +459,13 @@ - { - this.theWorld = serverWorld; - } -+ -+ public double getBlockReachDistance() -+ { -+ return blockReachDistance; -+ } -+ public void setBlockReachDistance(double distance) -+ { -+ blockReachDistance = distance; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/server/management/PlayerManager.java.patch b/patches.mcp/minecraft/net/minecraft/server/management/PlayerManager.java.patch deleted file mode 100644 index 3c08033a0..000000000 --- a/patches.mcp/minecraft/net/minecraft/server/management/PlayerManager.java.patch +++ /dev/null @@ -1,224 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/management/PlayerManager.java -+++ ../src-work/minecraft/net/minecraft/server/management/PlayerManager.java -@@ -122,15 +122,24 @@ - int j = (int)p_72683_1_.posZ >> 4; - p_72683_1_.managedPosX = p_72683_1_.posX; - p_72683_1_.managedPosZ = p_72683_1_.posZ; -+ // Load nearby chunks first -+ List chunkList = new ArrayList(); - - for (int k = i - this.playerViewRadius; k <= i + this.playerViewRadius; ++k) - { - for (int l = j - this.playerViewRadius; l <= j + this.playerViewRadius; ++l) - { -- this.getPlayerInstance(k, l, true).addPlayer(p_72683_1_); -+ chunkList.add(new ChunkCoordIntPair(k, l)); - } - } - -+ java.util.Collections.sort(chunkList, new net.minecraftforge.common.util.ChunkCoordComparator(p_72683_1_)); -+ -+ for (ChunkCoordIntPair pair : chunkList) -+ { -+ this.getPlayerInstance(pair.chunkXPos, pair.chunkZPos, true).addPlayer(p_72683_1_); -+ } -+ - this.players.add(p_72683_1_); - this.filterChunkLoadQueue(p_72683_1_); - } -@@ -232,6 +241,7 @@ - int i1 = this.playerViewRadius; - int j1 = i - k; - int k1 = j - l; -+ List chunksToLoad = new ArrayList(); - - if (j1 != 0 || k1 != 0) - { -@@ -241,7 +251,7 @@ - { - if (!this.overlaps(l1, i2, k, l, i1)) - { -- this.getPlayerInstance(l1, i2, true).addPlayer(p_72685_1_); -+ chunksToLoad.add(new ChunkCoordIntPair(l1, i2)); - } - - if (!this.overlaps(l1 - j1, i2 - k1, i, j, i1)) -@@ -259,6 +269,18 @@ - this.filterChunkLoadQueue(p_72685_1_); - p_72685_1_.managedPosX = p_72685_1_.posX; - p_72685_1_.managedPosZ = p_72685_1_.posZ; -+ // send nearest chunks first -+ java.util.Collections.sort(chunksToLoad, new net.minecraftforge.common.util.ChunkCoordComparator(p_72685_1_)); -+ -+ for (ChunkCoordIntPair pair : chunksToLoad) -+ { -+ this.getPlayerInstance(pair.chunkXPos, pair.chunkZPos, true).addPlayer(p_72685_1_); -+ } -+ -+ if (i1 > 1 || i1 < -1 || j1 > 1 || j1 < -1) -+ { -+ java.util.Collections.sort(p_72685_1_.loadedChunks, new net.minecraftforge.common.util.ChunkCoordComparator(p_72685_1_)); -+ } - } - } - } -@@ -334,12 +356,21 @@ - private int numBlocksToUpdate; - private int flagsYAreasToUpdate; - private long previousWorldTime; -+ private final java.util.HashMap players = new java.util.HashMap(); -+ private boolean loaded = false; -+ private Runnable loadedRunnable = new Runnable() -+ { -+ public void run() -+ { -+ PlayerInstance.this.loaded = true; -+ } -+ }; - private static final String __OBFID = "CL_00001435"; - - public PlayerInstance(int p_i1518_2_, int p_i1518_3_) - { - this.chunkCoords = new ChunkCoordIntPair(p_i1518_2_, p_i1518_3_); -- PlayerManager.this.getMinecraftServer().theChunkProviderServer.loadChunk(p_i1518_2_, p_i1518_3_); -+ PlayerManager.this.getMinecraftServer().theChunkProviderServer.loadChunk(p_i1518_2_, p_i1518_3_, this.loadedRunnable); - } - - public void addPlayer(EntityPlayerMP p_73255_1_) -@@ -356,7 +387,24 @@ - } - - this.playersWatchingChunk.add(p_73255_1_); -+ Runnable playerRunnable = null; -+ if (this.loaded) -+ { - p_73255_1_.loadedChunks.add(this.chunkCoords); -+ } -+ else -+ { -+ final EntityPlayerMP tmp = p_73255_1_; -+ playerRunnable = new Runnable() -+ { -+ public void run() -+ { -+ tmp.loadedChunks.add(PlayerInstance.this.chunkCoords); -+ } -+ }; -+ PlayerManager.this.getMinecraftServer().theChunkProviderServer.loadChunk(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, playerRunnable); -+ } -+ this.players.put(p_73255_1_, playerRunnable); - } - } - -@@ -364,6 +412,24 @@ - { - if (this.playersWatchingChunk.contains(p_73252_1_)) - { -+ // If we haven't loaded yet don't load the chunk just so we can clean it up -+ if (!this.loaded) -+ { -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.getMinecraftServer(), this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, this.players.get(p_73252_1_)); -+ this.playersWatchingChunk.remove(p_73252_1_); -+ this.players.remove(p_73252_1_); -+ -+ if (this.playersWatchingChunk.isEmpty()) -+ { -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.dropQueuedChunkLoad(PlayerManager.this.getMinecraftServer(), this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos, this.loadedRunnable); -+ long i = (long) this.chunkCoords.chunkXPos + 2147483647L | (long) this.chunkCoords.chunkZPos + 2147483647L << 32; -+ PlayerManager.this.playerInstances.remove(i); -+ PlayerManager.this.playerInstanceList.remove(this); -+ } -+ -+ return; -+ } -+ - Chunk chunk = PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos); - - if (chunk.isPopulated()) -@@ -371,9 +437,12 @@ - p_73252_1_.playerNetServerHandler.sendPacket(new S21PacketChunkData(chunk, true, 0)); - } - -+ this.players.remove(p_73252_1_); - this.playersWatchingChunk.remove(p_73252_1_); - p_73252_1_.loadedChunks.remove(this.chunkCoords); - -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.UnWatch(chunkCoords, p_73252_1_)); -+ - if (this.playersWatchingChunk.isEmpty()) - { - long i = (long)this.chunkCoords.chunkXPos + 2147483647L | (long)this.chunkCoords.chunkZPos + 2147483647L << 32; -@@ -411,7 +480,7 @@ - - this.flagsYAreasToUpdate |= 1 << (p_151253_2_ >> 4); - -- if (this.numBlocksToUpdate < 64) -+ //Forge; Cache everything, so always run - { - short short1 = (short)(p_151253_1_ << 12 | p_151253_3_ << 8 | p_151253_2_); - -@@ -423,6 +492,10 @@ - } - } - -+ if (numBlocksToUpdate == locationOfBlockChange.length) -+ { -+ locationOfBlockChange = java.util.Arrays.copyOf(locationOfBlockChange, locationOfBlockChange.length << 1); -+ } - this.locationOfBlockChange[this.numBlocksToUpdate++] = short1; - } - } -@@ -440,6 +513,7 @@ - } - } - -+ @SuppressWarnings("unused") - public void onUpdate() - { - if (this.numBlocksToUpdate != 0) -@@ -456,7 +530,7 @@ - BlockPos blockpos = new BlockPos(i, j, k); - this.sendToAllPlayersWatchingChunk(new S23PacketBlockChange(PlayerManager.this.theWorldServer, blockpos)); - -- if (PlayerManager.this.theWorldServer.getBlockState(blockpos).getBlock().hasTileEntity()) -+ if (PlayerManager.this.theWorldServer.getBlockState(blockpos).getBlock().hasTileEntity(PlayerManager.this.theWorldServer.getBlockState(blockpos))) - { - this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos)); - } -@@ -465,13 +539,14 @@ - { - int i1; - -- if (this.numBlocksToUpdate == 64) -+ if (this.numBlocksToUpdate >= net.minecraftforge.common.ForgeModContainer.clumpingThreshold) - { - i = this.chunkCoords.chunkXPos * 16; - j = this.chunkCoords.chunkZPos * 16; - this.sendToAllPlayersWatchingChunk(new S21PacketChunkData(PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos), false, this.flagsYAreasToUpdate)); - -- for (k = 0; k < 16; ++k) -+ // Forge: Grabs ALL tile entities is costly on a modded server, only send needed ones -+ for (k = 0; false && k < 16; ++k) - { - if ((this.flagsYAreasToUpdate & 1 << k) != 0) - { -@@ -488,7 +563,10 @@ - else - { - this.sendToAllPlayersWatchingChunk(new S22PacketMultiBlockChange(this.numBlocksToUpdate, this.locationOfBlockChange, PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos))); -+ } - -+ { //Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small -+ WorldServer world = PlayerManager.this.theWorldServer; - for (i = 0; i < this.numBlocksToUpdate; ++i) - { - j = (this.locationOfBlockChange[i] >> 12 & 15) + this.chunkCoords.chunkXPos * 16; -@@ -496,7 +574,7 @@ - i1 = (this.locationOfBlockChange[i] >> 8 & 15) + this.chunkCoords.chunkZPos * 16; - BlockPos blockpos1 = new BlockPos(j, k, i1); - -- if (PlayerManager.this.theWorldServer.getBlockState(blockpos1).getBlock().hasTileEntity()) -+ if (world.getBlockState(blockpos1).getBlock().hasTileEntity(world.getBlockState(blockpos1))) - { - this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos1)); - } diff --git a/patches.mcp/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch b/patches.mcp/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch deleted file mode 100644 index 678f9b276..000000000 --- a/patches.mcp/minecraft/net/minecraft/server/management/PlayerProfileCache.java.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/management/PlayerProfileCache.java -+++ ../src-work/minecraft/net/minecraft/server/management/PlayerProfileCache.java -@@ -204,26 +204,12 @@ - { - List list = null; - BufferedReader bufferedreader = null; -- label64: - { - try - { - bufferedreader = Files.newReader(this.usercacheFile, Charsets.UTF_8); - list = (List)this.gson.fromJson(bufferedreader, field_152666_h); -- break label64; -- } -- catch (FileNotFoundException filenotfoundexception) -- { -- ; -- } -- finally -- { -- IOUtils.closeQuietly(bufferedreader); -- } - -- return; -- } -- - if (list != null) - { - this.field_152661_c.clear(); -@@ -242,6 +228,20 @@ - } - } - } -+ } -+ catch (FileNotFoundException filenotfoundexception) -+ { -+ ; -+ } -+ catch (com.google.gson.JsonParseException parsefail) -+ { -+ // No op - the cache can quietly rebuild if it's junk -+ } -+ finally -+ { -+ IOUtils.closeQuietly(bufferedreader); -+ } -+ } - } - - public void func_152658_c() diff --git a/patches.mcp/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch b/patches.mcp/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch deleted file mode 100644 index 5eacc8196..000000000 --- a/patches.mcp/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch +++ /dev/null @@ -1,223 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/management/ServerConfigurationManager.java -+++ ../src-work/minecraft/net/minecraft/server/management/ServerConfigurationManager.java -@@ -103,7 +103,7 @@ - this.maxPlayers = 8; - } - -- public void initializeConnectionToPlayer(NetworkManager netManager, EntityPlayerMP playerIn) -+ public void initializeConnectionToPlayer(NetworkManager netManager, EntityPlayerMP playerIn, NetHandlerPlayServer nethandlerplayserver) - { - GameProfile gameprofile = playerIn.getGameProfile(); - PlayerProfileCache playerprofilecache = this.mcServer.getPlayerProfileCache(); -@@ -112,6 +112,17 @@ - playerprofilecache.func_152649_a(gameprofile); - NBTTagCompound nbttagcompound = this.readPlayerDataFromFile(playerIn); - playerIn.setWorld(this.mcServer.worldServerForDimension(playerIn.dimension)); -+ -+ World playerWorld = this.mcServer.worldServerForDimension(playerIn.dimension); -+ if (playerWorld == null) -+ { -+ playerIn.dimension=0; -+ playerWorld=this.mcServer.worldServerForDimension(0); -+ BlockPos spawnPoint = playerWorld.provider.getRandomizedSpawnPoint(); -+ playerIn.setPosition(spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ()); -+ } -+ -+ playerIn.setWorld(playerWorld); - playerIn.theItemInWorldManager.setWorld((WorldServer)playerIn.worldObj); - String s1 = "local"; - -@@ -125,7 +136,7 @@ - WorldInfo worldinfo = worldserver.getWorldInfo(); - BlockPos blockpos = worldserver.getSpawnPoint(); - this.func_72381_a(playerIn, (EntityPlayerMP)null, worldserver); -- NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.mcServer, netManager, playerIn); -+ playerIn.playerNetServerHandler = nethandlerplayserver; - nethandlerplayserver.sendPacket(new S01PacketJoinGame(playerIn.getEntityId(), playerIn.theItemInWorldManager.getGameType(), worldinfo.isHardcoreModeEnabled(), worldserver.provider.getDimensionId(), worldserver.getDifficulty(), this.getMaxPlayers(), worldinfo.getTerrainType(), worldserver.getGameRules().getGameRuleBooleanValue("reducedDebugInfo"))); - nethandlerplayserver.sendPacket(new S3FPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(this.getServerInstance().getServerModName()))); - nethandlerplayserver.sendPacket(new S41PacketServerDifficulty(worldinfo.getDifficulty(), worldinfo.isDifficultyLocked())); -@@ -168,6 +179,7 @@ - - playerIn.addSelfToInternalCraftingInventory(); - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedIn(playerIn); - if (nbttagcompound != null && nbttagcompound.hasKey("Riding", 10)) - { - Entity entity = EntityList.createEntityFromNBT(nbttagcompound.getCompoundTag("Riding"), worldserver); -@@ -272,6 +284,7 @@ - playerIn.readFromNBT(nbttagcompound); - nbttagcompound1 = nbttagcompound; - logger.debug("loading single player"); -+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(playerIn, this.playerNBTManagerObj, playerIn.getUniqueID().toString()); - } - else - { -@@ -281,8 +294,23 @@ - return nbttagcompound1; - } - -+ public NBTTagCompound getPlayerNBT(EntityPlayerMP player) -+ { -+ // Hacky method to allow loading the NBT for a player prior to login -+ NBTTagCompound nbttagcompound = this.mcServer.worldServers[0].getWorldInfo().getPlayerNBTTagCompound(); -+ if (player.getName().equals(this.mcServer.getServerOwner()) && nbttagcompound != null) -+ { -+ return nbttagcompound; -+ } -+ else -+ { -+ return ((net.minecraft.world.storage.SaveHandler)this.playerNBTManagerObj).getPlayerNBT(player); -+ } -+ } - protected void writePlayerData(EntityPlayerMP playerIn) - { -+ if (playerIn.playerNetServerHandler == null) return; -+ - this.playerNBTManagerObj.writePlayerData(playerIn); - StatisticsFile statisticsfile = (StatisticsFile)this.playerStatFiles.get(playerIn.getUniqueID()); - -@@ -298,6 +326,7 @@ - this.uuidToPlayerMap.put(playerIn.getUniqueID(), playerIn); - this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {playerIn})); - WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); - worldserver.spawnEntityInWorld(playerIn); - this.func_72375_a(playerIn, (WorldServer)null); - -@@ -315,6 +344,7 @@ - - public void playerLoggedOut(EntityPlayerMP playerIn) - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerLoggedOut(playerIn); - playerIn.triggerAchievement(StatList.leaveGameStat); - this.writePlayerData(playerIn); - WorldServer worldserver = playerIn.getServerForPlayer(); -@@ -330,6 +360,7 @@ - this.playerEntityList.remove(playerIn); - this.uuidToPlayerMap.remove(playerIn.getUniqueID()); - this.playerStatFiles.remove(playerIn.getUniqueID()); -+ net.minecraftforge.common.chunkio.ChunkIOExecutor.adjustPoolSize(this.getCurrentPlayerCount()); - this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn})); - } - -@@ -411,13 +442,23 @@ - - public EntityPlayerMP recreatePlayerEntity(EntityPlayerMP playerIn, int dimension, boolean conqueredEnd) - { -+ World world = mcServer.worldServerForDimension(dimension); -+ if (world == null) -+ { -+ dimension = 0; -+ } -+ else if (!world.provider.canRespawnHere()) -+ { -+ dimension = world.provider.getRespawnDimension(playerIn); -+ } -+ - playerIn.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(playerIn); - playerIn.getServerForPlayer().getEntityTracker().untrackEntity(playerIn); - playerIn.getServerForPlayer().getPlayerManager().removePlayer(playerIn); - this.playerEntityList.remove(playerIn); - this.mcServer.worldServerForDimension(playerIn.dimension).removePlayerEntityDangerously(playerIn); -- BlockPos blockpos = playerIn.getBedLocation(); -- boolean flag1 = playerIn.isSpawnForced(); -+ BlockPos blockpos = playerIn.getBedLocation(dimension); -+ boolean flag1 = playerIn.isSpawnForced(dimension); - playerIn.dimension = dimension; - Object object; - -@@ -433,6 +474,7 @@ - EntityPlayerMP entityplayermp1 = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(playerIn.dimension), playerIn.getGameProfile(), (ItemInWorldManager)object); - entityplayermp1.playerNetServerHandler = playerIn.playerNetServerHandler; - entityplayermp1.clonePlayer(playerIn, conqueredEnd); -+ entityplayermp1.dimension = dimension; - entityplayermp1.setEntityId(playerIn.getEntityId()); - entityplayermp1.func_174817_o(playerIn); - WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); -@@ -473,19 +515,25 @@ - this.uuidToPlayerMap.put(entityplayermp1.getUniqueID(), entityplayermp1); - entityplayermp1.addSelfToInternalCraftingInventory(); - entityplayermp1.setHealth(entityplayermp1.getHealth()); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp1); - return entityplayermp1; - } - - public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension) - { -+ transferPlayerToDimension(playerIn, dimension, mcServer.worldServerForDimension(dimension).getDefaultTeleporter()); -+ } -+ -+ public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension, net.minecraft.world.Teleporter teleporter) -+ { - int j = playerIn.dimension; - WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); - playerIn.dimension = dimension; - WorldServer worldserver1 = this.mcServer.worldServerForDimension(playerIn.dimension); -- playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, playerIn.worldObj.getDifficulty(), playerIn.worldObj.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); -+ playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); // Forge: Use new dimensions information - worldserver.removePlayerEntityDangerously(playerIn); - playerIn.isDead = false; -- this.transferEntityToWorld(playerIn, j, worldserver, worldserver1); -+ this.transferEntityToWorld(playerIn, j, worldserver, worldserver1, teleporter); - this.func_72375_a(playerIn, worldserver); - playerIn.playerNetServerHandler.setPlayerLocation(playerIn.posX, playerIn.posY, playerIn.posZ, playerIn.rotationYaw, playerIn.rotationPitch); - playerIn.theItemInWorldManager.setWorld(worldserver1); -@@ -498,17 +546,27 @@ - PotionEffect potioneffect = (PotionEffect)iterator.next(); - playerIn.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(playerIn.getEntityId(), potioneffect)); - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(playerIn, j, dimension); - } - - public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_) - { -- double d0 = entityIn.posX; -- double d1 = entityIn.posZ; -+ transferEntityToWorld(entityIn, p_82448_2_, p_82448_3_, p_82448_4_, p_82448_4_.getDefaultTeleporter()); -+ } -+ -+ @SuppressWarnings("unused") -+ public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, net.minecraft.world.Teleporter teleporter) -+ { -+ net.minecraft.world.WorldProvider pOld = p_82448_3_.provider; -+ net.minecraft.world.WorldProvider pNew = p_82448_4_.provider; -+ double moveFactor = pOld.getMovementFactor() / pNew.getMovementFactor(); -+ double d0 = entityIn.posX * moveFactor; -+ double d1 = entityIn.posZ * moveFactor; - double d2 = 8.0D; - float f = entityIn.rotationYaw; - p_82448_3_.theProfiler.startSection("moving"); - -- if (entityIn.dimension == -1) -+ if (false && entityIn.dimension == -1) //Forge Kill it but dont comment out so we can rename it. - { - d0 = MathHelper.clamp_double(d0 / d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); - d1 = MathHelper.clamp_double(d1 / d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); -@@ -519,7 +577,7 @@ - p_82448_3_.updateEntityWithOptionalForce(entityIn, false); - } - } -- else if (entityIn.dimension == 0) -+ else if (false && entityIn.dimension == 0) //Forge Kill it but dont comment out so we can rename it. - { - d0 = MathHelper.clamp_double(d0 * d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); - d1 = MathHelper.clamp_double(d1 * d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); -@@ -530,7 +588,8 @@ - p_82448_3_.updateEntityWithOptionalForce(entityIn, false); - } - } -- else -+ -+ if (entityIn.dimension == 1) - { - BlockPos blockpos; - -@@ -565,7 +624,7 @@ - if (entityIn.isEntityAlive()) - { - entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch); -- p_82448_4_.getDefaultTeleporter().placeInPortal(entityIn, f); -+ teleporter.placeInPortal(entityIn, f); - p_82448_4_.spawnEntityInWorld(entityIn); - p_82448_4_.updateEntityWithOptionalForce(entityIn, false); - } diff --git a/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch b/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch deleted file mode 100644 index 9a0c6b233..000000000 --- a/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java -+++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java -@@ -23,6 +23,8 @@ - - public void processHandshake(C00Handshake packetIn) - { -+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return; -+ - switch (NetHandlerHandshakeTCP.SwitchEnumConnectionState.VALUES[packetIn.getRequestedState().ordinal()]) - { - case 1: diff --git a/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch deleted file mode 100644 index c6a8ad1f0..000000000 --- a/patches.mcp/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java -+++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java -@@ -62,7 +62,7 @@ - this.tryAcceptPlayer(); - } - -- if (this.connectionTimer++ == 600) -+ if (this.connectionTimer++ == net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.LOGIN_TIMEOUT) - { - this.closeConnection("Took too long to log in"); - } -@@ -113,7 +113,7 @@ - } - - this.networkManager.sendPacket(new S02PacketLoginSuccess(this.loginGameProfile)); -- this.server.getConfigurationManager().initializeConnectionToPlayer(this.networkManager, this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile)); -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.server.getConfigurationManager(), this.networkManager, this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile)); - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch b/patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch deleted file mode 100644 index 07cee7f68..000000000 --- a/patches.mcp/minecraft/net/minecraft/stats/StatList.java.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/stats/StatList.java -+++ ../src-work/minecraft/net/minecraft/stats/StatList.java -@@ -101,7 +101,7 @@ - - if (item != null) - { -- int i = Item.getIdFromItem(item); -+ int i = Item.getIdFromItem(item); //TODO: Hook FML's stat change event and re-assign these - String s = func_180204_a(item); - - if (s != null) -@@ -121,11 +121,11 @@ - while (iterator.hasNext()) - { - Block block = (Block)iterator.next(); -- Item item = Item.getItemFromBlock(block); -+ Item item = Item.getItemFromBlock(block); //TODO: Hook FML's stat change event and re-assign these - - if (item != null) - { -- int i = Block.getIdFromBlock(block); -+ int i = Block.getIdFromBlock(block); //TODO: Hook FML's stat change event and re-assign these - String s = func_180204_a(item); - - if (s != null && block.getEnableStats()) -@@ -149,7 +149,7 @@ - - if (item != null) - { -- int i = Item.getIdFromItem(item); -+ int i = Item.getIdFromItem(item); //TODO: Hook FML's stat change event and re-assign these - String s = func_180204_a(item); - - if (s != null) -@@ -177,7 +177,7 @@ - - if (item != null) - { -- int i = Item.getIdFromItem(item); -+ int i = Item.getIdFromItem(item); //TODO: Hook FML's stat change event and re-assign these - String s = func_180204_a(item); - - if (s != null && item.isDamageable()) diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch deleted file mode 100644 index f125971bf..000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ /dev/null @@ -1,192 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java -@@ -66,6 +66,7 @@ - public void readFromNBT(NBTTagCompound compound) - { - this.pos = new BlockPos(compound.getInteger("x"), compound.getInteger("y"), compound.getInteger("z")); -+ if (compound.hasKey("ForgeData")) this.customTileData = compound.getCompoundTag("ForgeData"); - } - - public void writeToNBT(NBTTagCompound compound) -@@ -82,6 +83,7 @@ - compound.setInteger("x", this.pos.getX()); - compound.setInteger("y", this.pos.getY()); - compound.setInteger("z", this.pos.getZ()); -+ if (this.customTileData != null) compound.setTag("ForgeData", this.customTileData); - } - } - -@@ -89,9 +91,10 @@ - { - TileEntity tileentity = null; - -+ Class oclass = null; - try - { -- Class oclass = (Class)nameToClassMap.get(nbt.getString("id")); -+ oclass = (Class)nameToClassMap.get(nbt.getString("id")); - - if (oclass != null) - { -@@ -109,7 +112,17 @@ - } - else - { -+ try -+ { - logger.warn("Skipping BlockEntity with id " + nbt.getString("id")); -+ } -+ catch (Exception ex) -+ { -+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, ex, -+ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", -+ nbt.getString("id"), oclass.getName()); -+ tileentity = null; -+ } - } - - return tileentity; -@@ -141,7 +154,6 @@ - } - } - -- @SideOnly(Side.CLIENT) - public double getDistanceSq(double x, double y, double z) - { - double d3 = (double)this.pos.getX() + 0.5D - x; -@@ -284,4 +296,135 @@ - addMapping(TileEntityFlowerPot.class, "FlowerPot"); - addMapping(TileEntityBanner.class, "Banner"); - } -+ -+ // -- BEGIN FORGE PATCHES -- -+ /** -+ * Called when you receive a TileEntityData packet for the location this -+ * TileEntity is currently in. On the client, the NetworkManager will always -+ * be the remote server. On the server, it will be whomever is responsible for -+ * sending the packet. -+ * -+ * @param net The NetworkManager the packet originated from -+ * @param pkt The data packet -+ */ -+ public void onDataPacket(net.minecraft.network.NetworkManager net, net.minecraft.network.play.server.S35PacketUpdateTileEntity pkt) -+ { -+ } -+ -+ /** -+ * Called when the chunk this TileEntity is on is Unloaded. -+ */ -+ public void onChunkUnload() -+ { -+ } -+ -+ private boolean isVanilla = getClass().getName().startsWith("net.minecraft."); -+ /** -+ * Called from Chunk.setBlockIDWithMetadata, determines if this tile entity should be re-created when the ID, or Metadata changes. -+ * Use with caution as this will leave straggler TileEntities, or create conflicts with other TileEntities if not used properly. -+ * -+ * @param world Current world -+ * @param pos Tile's world position -+ * @param oldID The old ID of the block -+ * @param newID The new ID of the block (May be the same) -+ * @return True to remove the old tile entity, false to keep it in tact {and create a new one if the new values specify to} -+ */ -+ public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate) -+ { -+ return !isVanilla || (oldState.getBlock() != newSate.getBlock()); -+ } -+ -+ public boolean shouldRenderInPass(int pass) -+ { -+ return pass == 0; -+ } -+ -+ /** -+ * Sometimes default render bounding box: infinite in scope. Used to control rendering on {@link TileEntitySpecialRenderer}. -+ */ -+ public static final net.minecraft.util.AxisAlignedBB INFINITE_EXTENT_AABB = new net.minecraft.util.AxisAlignedBB(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); -+ /** -+ * Return an {@link AxisAlignedBB} that controls the visible scope of a {@link TileEntitySpecialRenderer} associated with this {@link TileEntity} -+ * Defaults to the collision bounding box {@link Block#getCollisionBoundingBoxFromPool(World, int, int, int)} associated with the block -+ * at this location. -+ * -+ * @return an appropriately size {@link AxisAlignedBB} for the {@link TileEntity} -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.util.AxisAlignedBB getRenderBoundingBox() -+ { -+ net.minecraft.util.AxisAlignedBB bb = INFINITE_EXTENT_AABB; -+ Block type = getBlockType(); -+ if (type == Blocks.enchanting_table) -+ { -+ bb = new net.minecraft.util.AxisAlignedBB(getPos(), getPos().add(1, 1, 1)); -+ } -+ else if (type == Blocks.chest || type == Blocks.trapped_chest) -+ { -+ bb = new net.minecraft.util.AxisAlignedBB(getPos().add(-1, 0, -1), getPos().add(2, 2, 2)); -+ } -+ else if (type != null && type != Blocks.beacon) -+ { -+ net.minecraft.util.AxisAlignedBB cbb = null; -+ try -+ { -+ cbb = type.getCollisionBoundingBox(worldObj, getPos(), worldObj.getBlockState(getPos())); -+ } -+ catch (Exception e) -+ { -+ // We have to capture any exceptions that may occur here because BUKKIT servers like to send -+ // the tile entity data BEFORE the chunk data, you know, the OPPOSITE of what vanilla does! -+ // So we can not GARENTEE that the world state is the real state for the block... -+ // So, once again in the long line of US having to accommodate BUKKIT breaking things, -+ // here it is, assume that the TE is only 1 cubic block. Problem with this is that it may -+ // cause the TileEntity renderer to error further down the line! But alas, nothing we can do. -+ cbb = new net.minecraft.util.AxisAlignedBB(getPos().add(-1, 0, -1), getPos().add(1, 1, 1)); -+ } -+ if (cbb != null) bb = cbb; -+ } -+ return bb; -+ } -+ -+ /** -+ * Checks if this tile entity knows how to render its 'breaking' overlay effect. -+ * If this returns true, The TileEntitySpecialRenderer will be called again with break progress set. -+ * @return True to re-render tile with breaking effect. -+ */ -+ public boolean canRenderBreaking() -+ { -+ Block block = this.getBlockType(); -+ return (block instanceof net.minecraft.block.BlockChest || -+ block instanceof net.minecraft.block.BlockEnderChest || -+ block instanceof net.minecraft.block.BlockSign || -+ block instanceof net.minecraft.block.BlockSkull); -+ } -+ -+ private NBTTagCompound customTileData; -+ -+ /** -+ * Gets a {@link NBTTagCompound} that can be used to store custom data for this tile entity. -+ * It will be written, and read from disc, so it persists over world saves. -+ * -+ * @return A compound tag for custom data -+ */ -+ public NBTTagCompound getTileData() -+ { -+ if (this.customTileData == null) -+ { -+ this.customTileData = new NBTTagCompound(); -+ } -+ return this.customTileData; -+ } -+ -+ /** -+ * Determines if the player can overwrite the NBT data of this tile entity while they place it using a ItemStack. -+ * Added as a fix for MC-75630 - Exploit with signs and command blocks -+ * @return True to prevent NBT copy, false to allow. -+ */ -+ public boolean restrictNBTCopy() -+ { -+ return this instanceof TileEntityCommandBlock || -+ this instanceof TileEntityMobSpawner || -+ this instanceof TileEntitySign; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch deleted file mode 100644 index 882045eb6..000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBeacon.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBeacon.java -@@ -178,7 +178,7 @@ - { - Block block = this.worldObj.getBlockState(new BlockPos(l1, k1, j1)).getBlock(); - -- if (block != Blocks.emerald_block && block != Blocks.gold_block && block != Blocks.diamond_block && block != Blocks.iron_block) -+ if (!block.isBeaconBase(this.worldObj, new BlockPos(l1, k1, j1), getPos())) - { - flag1 = false; - break; -@@ -363,7 +363,7 @@ - - public boolean isItemValidForSlot(int index, ItemStack stack) - { -- return stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot; -+ return stack.getItem() != null && stack.getItem().isBeaconPayment(stack); - } - - public String getGuiID() diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch deleted file mode 100644 index 8724a5526..000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch +++ /dev/null @@ -1,78 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java -@@ -104,7 +104,7 @@ - - private boolean canBrew() - { -- if (this.brewingItemStacks[3] != null && this.brewingItemStacks[3].stackSize > 0) -+ if (this.brewingItemStacks[3] != null && this.brewingItemStacks[3].stackSize > 0 && false) // Code moved to net.minecraftforge.common.brewing.VanillaBrewingRecipe - { - ItemStack itemstack = this.brewingItemStacks[3]; - -@@ -118,7 +118,7 @@ - - for (int i = 0; i < 3; ++i) - { -- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem) -+ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion) - { - int j = this.brewingItemStacks[i].getMetadata(); - int k = this.func_145936_c(j, itemstack); -@@ -145,19 +145,22 @@ - } - else - { -- return false; -+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.canBrew(brewingItemStacks, brewingItemStacks[3], outputSlots); - } - } - - private void brewPotions() - { -+ if (net.minecraftforge.event.ForgeEventFactory.onPotionAttemptBreaw(brewingItemStacks)) return; - if (this.canBrew()) - { -+ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(brewingItemStacks, brewingItemStacks[3], outputSlots); - ItemStack itemstack = this.brewingItemStacks[3]; - -+ if (false) { // Code moved to net.minecraftforge.common.brewing.VanillaBrewingRecipe - for (int i = 0; i < 3; ++i) - { -- if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem) -+ if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion) - { - int j = this.brewingItemStacks[i].getMetadata(); - int k = this.func_145936_c(j, itemstack); -@@ -177,10 +180,11 @@ - } - } - } -+ } - -- if (itemstack.getItem().hasContainerItem()) -+ if (itemstack.getItem().hasContainerItem(itemstack)) - { -- this.brewingItemStacks[3] = new ItemStack(itemstack.getItem().getContainerItem()); -+ this.brewingItemStacks[3] = itemstack.getItem().getContainerItem(itemstack); - } - else - { -@@ -191,6 +195,7 @@ - this.brewingItemStacks[3] = null; - } - } -+ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(brewingItemStacks); - } - } - -@@ -306,7 +311,9 @@ - - public boolean isItemValidForSlot(int index, ItemStack stack) - { -- return index == 3 ? stack.getItem().isPotionIngredient(stack) : stack.getItem() == Items.potionitem || stack.getItem() == Items.glass_bottle; -+ if (index == 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack)) return true; -+ else if (index != 3 && net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(stack)) return true; -+ return false; - } - - public boolean[] func_174902_m() diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch deleted file mode 100644 index 3c9b75c96..000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityFurnace.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityFurnace.java -@@ -233,8 +233,7 @@ - - if (this.furnaceItemStacks[1].stackSize == 0) - { -- Item item = this.furnaceItemStacks[1].getItem().getContainerItem(); -- this.furnaceItemStacks[1] = item != null ? new ItemStack(item) : null; -+ this.furnaceItemStacks[1] = furnaceItemStacks[1].getItem().getContainerItem(furnaceItemStacks[1]); - } - } - } -@@ -285,7 +284,11 @@ - else - { - ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.furnaceItemStacks[0]); -- return itemstack == null ? false : (this.furnaceItemStacks[2] == null ? true : (!this.furnaceItemStacks[2].isItemEqual(itemstack) ? false : (this.furnaceItemStacks[2].stackSize < this.getInventoryStackLimit() && this.furnaceItemStacks[2].stackSize < this.furnaceItemStacks[2].getMaxStackSize() ? true : this.furnaceItemStacks[2].stackSize < itemstack.getMaxStackSize()))); -+ if (itemstack == null) return false; -+ if (this.furnaceItemStacks[2] == null) return true; -+ if (!this.furnaceItemStacks[2].isItemEqual(itemstack)) return false; -+ int result = furnaceItemStacks[2].stackSize + itemstack.stackSize; -+ return result <= getInventoryStackLimit() && result <= this.furnaceItemStacks[2].getMaxStackSize(); //Forge BugFix: Make it respect stack sizes properly. - } - } - -@@ -301,7 +304,7 @@ - } - else if (this.furnaceItemStacks[2].getItem() == itemstack.getItem()) - { -- ++this.furnaceItemStacks[2].stackSize; -+ this.furnaceItemStacks[2].stackSize += itemstack.stackSize; // Forge BugFix: Results may have multiple items - } - - if (this.furnaceItemStacks[0].getItem() == Item.getItemFromBlock(Blocks.sponge) && this.furnaceItemStacks[0].getMetadata() == 1 && this.furnaceItemStacks[1] != null && this.furnaceItemStacks[1].getItem() == Items.bucket) -@@ -348,7 +351,15 @@ - } - } - -- return item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD") ? 200 : (item == Items.stick ? 100 : (item == Items.coal ? 1600 : (item == Items.lava_bucket ? 20000 : (item == Item.getItemFromBlock(Blocks.sapling) ? 100 : (item == Items.blaze_rod ? 2400 : 0))))))); -+ if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200; -+ if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200; -+ if (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD")) return 200; -+ if (item == Items.stick) return 100; -+ if (item == Items.coal) return 1600; -+ if (item == Items.lava_bucket) return 20000; -+ if (item == Item.getItemFromBlock(Blocks.sapling)) return 100; -+ if (item == Items.blaze_rod) return 2400; -+ return net.minecraftforge.fml.common.registry.GameRegistry.getFuelValue(p_145952_0_); - } - } - diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch deleted file mode 100644 index 018e6784d..000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityHopper.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityHopper.java -@@ -523,17 +523,30 @@ - - if (itemstack1 == null) - { -- p_174916_0_.setInventorySlotContents(p_174916_2_, p_174916_1_); -- p_174916_1_ = null; -+ //Forge: BUGFIX: Again, make things respect max stack sizes. -+ int max = Math.min(p_174916_1_.getMaxStackSize(), p_174916_0_.getInventoryStackLimit()); -+ if (max >= p_174916_1_.stackSize) -+ { -+ p_174916_0_.setInventorySlotContents(p_174916_2_, p_174916_1_); -+ p_174916_1_ = null; -+ } -+ else -+ { -+ p_174916_0_.setInventorySlotContents(p_174916_2_, p_174916_1_.splitStack(max)); -+ } - flag = true; - } - else if (canCombine(itemstack1, p_174916_1_)) - { -- int j = p_174916_1_.getMaxStackSize() - itemstack1.stackSize; -- int k = Math.min(p_174916_1_.stackSize, j); -- p_174916_1_.stackSize -= k; -- itemstack1.stackSize += k; -- flag = k > 0; -+ //Forge: BUGFIX: Again, make things respect max stack sizes. -+ int max = Math.min(p_174916_1_.getMaxStackSize(), p_174916_0_.getInventoryStackLimit()); -+ if (max > itemstack1.stackSize) -+ { -+ int size = Math.min(p_174916_1_.stackSize, max - itemstack1.stackSize); -+ p_174916_1_.stackSize -= size; -+ itemstack1.stackSize += size; -+ flag = size > 0; -+ } - } - - if (flag) diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch deleted file mode 100644 index 51de36d50..000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityNote.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityNote.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityNote.java -@@ -28,7 +28,9 @@ - - public void changePitch() - { -+ byte old = note; - this.note = (byte)((this.note + 1) % 25); -+ if (!net.minecraftforge.common.ForgeHooks.onNoteChange(this, old)) return; - this.markDirty(); - } - diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch deleted file mode 100644 index 009c0ba03..000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntityPiston.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityPiston.java -@@ -151,7 +151,8 @@ - if (this.worldObj.getBlockState(this.pos).getBlock() == Blocks.piston_extension) - { - this.worldObj.setBlockState(this.pos, this.pistonState, 3); -- this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); -+ if(!net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldObj, pos, worldObj.getBlockState(pos), java.util.EnumSet.noneOf(EnumFacing.class)).isCanceled()) -+ this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); - } - } - } -@@ -169,7 +170,8 @@ - if (this.worldObj.getBlockState(this.pos).getBlock() == Blocks.piston_extension) - { - this.worldObj.setBlockState(this.pos, this.pistonState, 3); -- this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); -+ if(!net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldObj, pos, worldObj.getBlockState(pos), java.util.EnumSet.noneOf(EnumFacing.class)).isCanceled()) -+ this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); - } - } - else diff --git a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch b/patches.mcp/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch deleted file mode 100644 index 5b1152090..000000000 --- a/patches.mcp/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntitySign.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntitySign.java -@@ -161,7 +161,7 @@ - public void addChatMessage(IChatComponent message) {} - public boolean canUseCommand(int permLevel, String commandName) - { -- return true; -+ return permLevel <= 2; //Forge: Fixes MC-75630 - Exploit with signs and command blocks - } - public BlockPos getPosition() - { diff --git a/patches.mcp/minecraft/net/minecraft/util/EnumChatFormatting.java.patch b/patches.mcp/minecraft/net/minecraft/util/EnumChatFormatting.java.patch deleted file mode 100644 index 5531b6eb0..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/EnumChatFormatting.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/EnumChatFormatting.java -+++ ../src-work/minecraft/net/minecraft/util/EnumChatFormatting.java -@@ -92,7 +92,6 @@ - return this.controlString; - } - -- @SideOnly(Side.CLIENT) - public static String getTextWithoutFormattingCodes(String text) - { - return text == null ? null : formattingCodePattern.matcher(text).replaceAll(""); diff --git a/patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch b/patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch deleted file mode 100644 index 3375b0ccf..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/EnumFacing.java.patch +++ /dev/null @@ -1,76 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/EnumFacing.java -+++ ../src-work/minecraft/net/minecraft/util/EnumFacing.java -@@ -6,8 +6,6 @@ - import java.util.Iterator; - import java.util.Map; - import java.util.Random; --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; - - public enum EnumFacing implements IStringSerializable - { -@@ -61,7 +59,6 @@ - return getFront(this.opposite); - } - -- @SideOnly(Side.CLIENT) - public EnumFacing rotateAround(EnumFacing.Axis axis) - { - switch (EnumFacing.SwitchPlane.AXIS_LOOKUP[axis.ordinal()]) -@@ -109,7 +106,6 @@ - } - } - -- @SideOnly(Side.CLIENT) - private EnumFacing rotateX() - { - switch (EnumFacing.SwitchPlane.FACING_LOOKUP[this.ordinal()]) -@@ -129,7 +125,6 @@ - } - } - -- @SideOnly(Side.CLIENT) - private EnumFacing rotateZ() - { - switch (EnumFacing.SwitchPlane.FACING_LOOKUP[this.ordinal()]) -@@ -190,7 +185,6 @@ - return this.axis; - } - -- @SideOnly(Side.CLIENT) - public static EnumFacing byName(String name) - { - return name == null ? null : (EnumFacing)NAME_LOOKUP.get(name.toLowerCase()); -@@ -216,7 +210,6 @@ - return values()[rand.nextInt(values().length)]; - } - -- @SideOnly(Side.CLIENT) - public static EnumFacing getFacingFromVector(float p_176737_0_, float p_176737_1_, float p_176737_2_) - { - EnumFacing enumfacing = NORTH; -@@ -249,7 +242,6 @@ - return this.name; - } - -- @SideOnly(Side.CLIENT) - public Vec3i getDirectionVec() - { - return this.directionVec; -@@ -291,7 +283,6 @@ - this.plane = plane; - } - -- @SideOnly(Side.CLIENT) - public static EnumFacing.Axis byName(String name) - { - return name == null ? null : (EnumFacing.Axis)NAME_LOOKUP.get(name.toLowerCase()); -@@ -376,7 +367,7 @@ - } - } - -- public static enum Plane implements Predicate, Iterable { -+ public static enum Plane implements Predicate, Iterable { //Forge re-add generic because it just makes life easier. - HORIZONTAL, - VERTICAL; - diff --git a/patches.mcp/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch b/patches.mcp/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch deleted file mode 100644 index 7bb192c6d..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/EnumWorldBlockLayer.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/EnumWorldBlockLayer.java -+++ ../src-work/minecraft/net/minecraft/util/EnumWorldBlockLayer.java -@@ -1,9 +1,5 @@ - package net.minecraft.util; - --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; -- --@SideOnly(Side.CLIENT) - public enum EnumWorldBlockLayer - { - SOLID("Solid"), diff --git a/patches.mcp/minecraft/net/minecraft/util/MessageSerializer.java.patch b/patches.mcp/minecraft/net/minecraft/util/MessageSerializer.java.patch deleted file mode 100644 index ea204cead..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/MessageSerializer.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/MessageSerializer.java -+++ ../src-work/minecraft/net/minecraft/util/MessageSerializer.java -@@ -49,7 +49,7 @@ - { - if (p_encode_2_ instanceof S0CPacketSpawnPlayer) - { -- p_encode_2_ = p_encode_2_; -+ //p_encode_2_ = p_encode_2_; FML: Kill warning - } - - p_encode_2_.writePacketData(packetbuffer); diff --git a/patches.mcp/minecraft/net/minecraft/util/MouseHelper.java.patch b/patches.mcp/minecraft/net/minecraft/util/MouseHelper.java.patch deleted file mode 100644 index a027a060e..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/MouseHelper.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/MouseHelper.java -+++ ../src-work/minecraft/net/minecraft/util/MouseHelper.java -@@ -14,6 +14,7 @@ - - public void grabMouseCursor() - { -+ if (Boolean.parseBoolean(System.getProperty("fml.noGrab","false"))) return; - Mouse.setGrabbed(true); - this.deltaX = 0; - this.deltaY = 0; diff --git a/patches.mcp/minecraft/net/minecraft/util/MovingObjectPosition.java.patch b/patches.mcp/minecraft/net/minecraft/util/MovingObjectPosition.java.patch deleted file mode 100644 index 4dce21e9b..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/MovingObjectPosition.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/MovingObjectPosition.java -+++ ../src-work/minecraft/net/minecraft/util/MovingObjectPosition.java -@@ -11,6 +11,12 @@ - public Entity entityHit; - private static final String __OBFID = "CL_00000610"; - -+ /** Used to determine what sub-segment is hit */ -+ public int subHit = -1; -+ -+ /** Used to add extra hit info */ -+ public Object hitInfo = null; -+ - public MovingObjectPosition(Vec3 p_i45551_1_, EnumFacing p_i45551_2_, BlockPos p_i45551_3_) - { - this(MovingObjectPosition.MovingObjectType.BLOCK, p_i45551_1_, p_i45551_2_, p_i45551_3_); diff --git a/patches.mcp/minecraft/net/minecraft/util/ResourceLocation.java.patch b/patches.mcp/minecraft/net/minecraft/util/ResourceLocation.java.patch deleted file mode 100644 index 6cb2dd79b..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/ResourceLocation.java.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/ResourceLocation.java -+++ ../src-work/minecraft/net/minecraft/util/ResourceLocation.java -@@ -1,7 +1,5 @@ - package net.minecraft.util; - --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; - import org.apache.commons.lang3.Validate; - - public class ResourceLocation -@@ -22,7 +20,6 @@ - this(0, func_177516_a(p_i1293_1_)); - } - -- @SideOnly(Side.CLIENT) - public ResourceLocation(String p_i1292_1_, String p_i1292_2_) - { - this(0, new String[] {p_i1292_1_, p_i1292_2_}); -@@ -51,7 +48,6 @@ - return this.resourcePath; - } - -- @SideOnly(Side.CLIENT) - public String getResourceDomain() - { - return this.resourceDomain; diff --git a/patches.mcp/minecraft/net/minecraft/util/Session.java.patch b/patches.mcp/minecraft/net/minecraft/util/Session.java.patch deleted file mode 100644 index 8156742c0..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/Session.java.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/Session.java -+++ ../src-work/minecraft/net/minecraft/util/Session.java -@@ -16,9 +16,24 @@ - private final String token; - private final Session.Type sessionType; - private static final String __OBFID = "CL_00000659"; -+ /** Forge: Cache of the local session's GameProfile properties. */ -+ private com.mojang.authlib.properties.PropertyMap properties; - - public Session(String usernameIn, String playerIDIn, String tokenIn, String sessionTypeIn) - { -+ if (usernameIn == null || usernameIn.isEmpty()) -+ { -+ usernameIn = "MissingName"; -+ playerIDIn = tokenIn = "NotValid"; -+ System.out.println("========================================================="); -+ System.out.println("Warning the username was not set for this session, typically"); -+ System.out.println("this means you installed Forge incorrectly. We have set your"); -+ System.out.println("name to \"MissingName\" and your session to nothing. Please"); -+ System.out.println("check your instllation and post a console log from the launcher"); -+ System.out.println("when asking for help!"); -+ System.out.println("========================================================="); -+ } -+ - this.username = usernameIn; - this.playerID = playerIDIn; - this.token = tokenIn; -@@ -50,11 +65,13 @@ - try - { - UUID uuid = UUIDTypeAdapter.fromString(this.getPlayerID()); -- return new GameProfile(uuid, this.getUsername()); -+ GameProfile ret = new GameProfile(uuid, this.getUsername()); //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.getUsername()); -+ return new GameProfile(net.minecraft.entity.player.EntityPlayer.getUUID(new GameProfile((UUID)null, this.getUsername())), this.getUsername()); - } - } - -@@ -63,6 +80,19 @@ - return this.sessionType; - } - -+ /* ======================================== FORGE START ===================================== */ -+ //For internal use only. Modders should never need to use this. -+ public void setProperties(com.mojang.authlib.properties.PropertyMap properties) -+ { -+ if(this.properties == null) this.properties = properties; -+ } -+ -+ public boolean hasCachedProperties() -+ { -+ return properties != null; -+ } -+ /* ========================================= FORGE END ====================================== */ -+ - @SideOnly(Side.CLIENT) - public static enum Type - { diff --git a/patches.mcp/minecraft/net/minecraft/util/StringTranslate.java.patch b/patches.mcp/minecraft/net/minecraft/util/StringTranslate.java.patch deleted file mode 100644 index 369f31b38..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/StringTranslate.java.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/StringTranslate.java -+++ ../src-work/minecraft/net/minecraft/util/StringTranslate.java -@@ -18,16 +18,38 @@ - { - private static final Pattern numericVariablePattern = Pattern.compile("%(\\d+\\$)?[\\d\\.]*[df]"); - private static final Splitter equalSignSplitter = Splitter.on('=').limit(2); -+ private final Map languageList; - private static StringTranslate instance = new StringTranslate(); -- private final Map languageList = Maps.newHashMap(); - private long lastUpdateTimeInMilliseconds; - private static final String __OBFID = "CL_00001212"; - - public StringTranslate() - { -+ InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); -+ languageList = Maps.newHashMap(); -+ inject(this, inputstream); -+ } -+ -+ public static void inject(InputStream inputstream) -+ { -+ inject(instance, inputstream); -+ } -+ -+ private static void inject(StringTranslate inst, InputStream inputstream) -+ { -+ java.util.HashMap map = parseLangFile(inputstream); -+ inst.languageList.putAll(map); -+ inst.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); -+ } -+ -+ public static java.util.HashMap parseLangFile(InputStream inputstream) -+ { -+ java.util.HashMap table = Maps.newHashMap(); - try - { -- InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); -+ inputstream = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(table, inputstream); -+ if (inputstream == null) return table; -+ - Iterator iterator = IOUtils.readLines(inputstream, Charsets.UTF_8).iterator(); - - while (iterator.hasNext()) -@@ -42,17 +64,17 @@ - { - String s1 = astring[0]; - String s2 = numericVariablePattern.matcher(astring[1]).replaceAll("%$1s"); -- this.languageList.put(s1, s2); -+ table.put(s1, s2); - } - } - } - -- this.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); - } -- catch (IOException ioexception) -+ catch (Exception ioexception) - { - ; - } -+ return table; - } - - static StringTranslate getInstance() diff --git a/patches.mcp/minecraft/net/minecraft/util/Vec3.java.patch b/patches.mcp/minecraft/net/minecraft/util/Vec3.java.patch deleted file mode 100644 index 8712a1f7b..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/Vec3.java.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/Vec3.java -+++ ../src-work/minecraft/net/minecraft/util/Vec3.java -@@ -1,8 +1,5 @@ - package net.minecraft.util; - --import net.minecraftforge.fml.relauncher.Side; --import net.minecraftforge.fml.relauncher.SideOnly; -- - public class Vec3 - { - public final double xCoord; -@@ -32,7 +29,6 @@ - this.zCoord = z; - } - -- @SideOnly(Side.CLIENT) - public Vec3 subtractReverse(Vec3 vec) - { - return new Vec3(vec.xCoord - this.xCoord, vec.yCoord - this.yCoord, vec.zCoord - this.zCoord); -@@ -49,7 +45,6 @@ - return this.xCoord * vec.xCoord + this.yCoord * vec.yCoord + this.zCoord * vec.zCoord; - } - -- @SideOnly(Side.CLIENT) - public Vec3 crossProduct(Vec3 vec) - { - return new Vec3(this.yCoord * vec.zCoord - this.zCoord * vec.yCoord, this.zCoord * vec.xCoord - this.xCoord * vec.zCoord, this.xCoord * vec.yCoord - this.yCoord * vec.xCoord); diff --git a/patches.mcp/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch b/patches.mcp/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch deleted file mode 100644 index 86dfe202c..000000000 --- a/patches.mcp/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch +++ /dev/null @@ -1,72 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/util/WeightedRandomChestContent.java -+++ ../src-work/minecraft/net/minecraft/util/WeightedRandomChestContent.java -@@ -38,23 +38,12 @@ - for (int j = 0; j < p_177630_3_; ++j) - { - WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, p_177630_1_); -- int k = weightedrandomchestcontent.theMinimumChanceToGenerateItem + random.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1); -+ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, p_177630_2_); - -- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= k) -+ for (ItemStack itemstack : stacks) - { -- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); -- itemstack.stackSize = k; - p_177630_2_.setInventorySlotContents(random.nextInt(p_177630_2_.getSizeInventory()), itemstack); - } -- else -- { -- for (int l = 0; l < k; ++l) -- { -- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); -- itemstack1.stackSize = 1; -- p_177630_2_.setInventorySlotContents(random.nextInt(p_177630_2_.getSizeInventory()), itemstack1); -- } -- } - } - } - -@@ -63,23 +52,12 @@ - for (int j = 0; j < p_177631_3_; ++j) - { - WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, p_177631_1_); -- int k = weightedrandomchestcontent.theMinimumChanceToGenerateItem + random.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1); -+ ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(random, dispenser); - -- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= k) -+ for (ItemStack itemstack : stacks) - { -- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); -- itemstack.stackSize = k; - dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack); - } -- else -- { -- for (int l = 0; l < k; ++l) -- { -- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); -- itemstack1.stackSize = 1; -- dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack1); -- } -- } - } - } - -@@ -89,4 +67,17 @@ - Collections.addAll(arraylist, p_177629_1_); - return arraylist; - } -+ -+ // -- Forge hooks -+ /** -+ * Allow a mod to submit a custom implementation that can delegate item stack generation beyond simple stack lookup -+ * -+ * @param random The current random for generation -+ * @param newInventory The inventory being generated (do not populate it, but you can refer to it) -+ * @return An array of {@link ItemStack} to put into the chest -+ */ -+ protected ItemStack[] generateChestContent(Random random, IInventory newInventory) -+ { -+ return net.minecraftforge.common.ChestGenHooks.generateStacks(random, theItemId, theMinimumChanceToGenerateItem, theMaximumChanceToGenerateItem); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch b/patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch deleted file mode 100644 index 4f50d372d..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/ChunkCache.java.patch +++ /dev/null @@ -1,61 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/ChunkCache.java -+++ ../src-work/minecraft/net/minecraft/world/ChunkCache.java -@@ -64,6 +64,8 @@ - { - int i = (pos.getX() >> 4) - this.chunkX; - int j = (pos.getZ() >> 4) - this.chunkZ; -+ if (i < 0 || i >= chunkArray.length || j < 0 || j >= chunkArray[i].length) return null; -+ if (chunkArray[i][j] == null) return null; - return this.chunkArray[i][j].getTileEntity(pos, Chunk.EnumCreateEntityType.IMMEDIATE); - } - -@@ -87,6 +89,7 @@ - { - int i = (pos.getX() >> 4) - this.chunkX; - int j = (pos.getZ() >> 4) - this.chunkZ; -+ if (i < 0 || i >= chunkArray.length || j < 0 || i >= chunkArray[i].length) return Blocks.air.getDefaultState(); - - if (i >= 0 && i < this.chunkArray.length && j >= 0 && j < this.chunkArray[i].length) - { -@@ -147,6 +150,8 @@ - { - i = (pos.getX() >> 4) - this.chunkX; - int j = (pos.getZ() >> 4) - this.chunkZ; -+ if (i < 0 || i >= chunkArray.length || j < 0 || j >= chunkArray[i].length) return p_175629_1_.defaultLightValue; -+ if (chunkArray[i][j] == null) return p_175629_1_.defaultLightValue; - return this.chunkArray[i][j].getLightFor(p_175629_1_, pos); - } - } -@@ -158,7 +163,7 @@ - - public boolean isAirBlock(BlockPos pos) - { -- return this.getBlockState(pos).getBlock().getMaterial() == Material.air; -+ return this.getBlockState(pos).getBlock().isAir(this, pos); - } - - @SideOnly(Side.CLIENT) -@@ -168,6 +173,7 @@ - { - int i = (pos.getX() >> 4) - this.chunkX; - int j = (pos.getZ() >> 4) - this.chunkZ; -+ if (i < 0 || i >= chunkArray.length || j < 0 || i >= chunkArray[i].length) return p_175628_1_.defaultLightValue; - return this.chunkArray[i][j].getLightFor(p_175628_1_, pos); - } - else -@@ -187,4 +193,15 @@ - { - return this.worldObj.getWorldType(); - } -+ -+ @Override -+ public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) -+ { -+ int x = (pos.getX() >> 4) - this.chunkX; -+ int z = (pos.getZ() >> 4) - this.chunkZ; -+ if (pos.getY() >= 0 && pos.getY() < 256) return _default; -+ if (x < 0 || x >= chunkArray.length || z < 0 || x >= chunkArray[x].length) return _default; -+ -+ return getBlockState(pos).getBlock().isSideSolid(this, pos, side); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch b/patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch deleted file mode 100644 index 36ea6a9b2..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/Explosion.java.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/Explosion.java -+++ ../src-work/minecraft/net/minecraft/world/Explosion.java -@@ -40,6 +40,7 @@ - private final List affectedBlockPositions; - private final Map field_77288_k; - private static final String __OBFID = "CL_00000134"; -+ private final Vec3 position; - - @SideOnly(Side.CLIENT) - public Explosion(World worldIn, Entity p_i45752_2_, double p_i45752_3_, double p_i45752_5_, double p_i45752_7_, float p_i45752_9_, List p_i45752_10_) -@@ -67,6 +68,7 @@ - this.explosionZ = p_i45754_7_; - this.isFlaming = p_i45754_10_; - this.isSmoking = p_i45754_11_; -+ this.position = new Vec3(explosionX, explosionY, explosionZ); - } - - public void doExplosionA() -@@ -103,7 +105,7 @@ - - if (iblockstate.getBlock().getMaterial() != Material.air) - { -- float f2 = this.exploder != null ? this.exploder.getExplosionResistance(this, this.worldObj, blockpos, iblockstate) : iblockstate.getBlock().getExplosionResistance((Entity)null); -+ float f2 = this.exploder != null ? this.exploder.getExplosionResistance(this, this.worldObj, blockpos, iblockstate) : iblockstate.getBlock().getExplosionResistance(worldObj, blockpos, (Entity)null, this); - f -= (f2 + 0.3F) * 0.3F; - } - -@@ -130,6 +132,7 @@ - int k1 = MathHelper.floor_double(this.explosionZ - (double)f3 - 1.0D); - int i1 = MathHelper.floor_double(this.explosionZ + (double)f3 + 1.0D); - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, new AxisAlignedBB((double)j, (double)j1, (double)k1, (double)k, (double)l, (double)i1)); -+ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.worldObj, this, list, f3); - Vec3 vec3 = new Vec3(this.explosionX, this.explosionY, this.explosionZ); - - for (int l1 = 0; l1 < list.size(); ++l1) -@@ -223,8 +226,7 @@ - block.dropBlockAsItemWithChance(this.worldObj, blockpos, this.worldObj.getBlockState(blockpos), 1.0F / this.explosionSize, 0); - } - -- this.worldObj.setBlockState(blockpos, Blocks.air.getDefaultState(), 3); -- block.onBlockDestroyedByExplosion(this.worldObj, blockpos, this); -+ block.onBlockExploded(this.worldObj, blockpos, this); - } - } - } -@@ -264,4 +266,6 @@ - { - return this.affectedBlockPositions; - } -+ -+ public Vec3 getPosition(){ return this.position; } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/IBlockAccess.java.patch b/patches.mcp/minecraft/net/minecraft/world/IBlockAccess.java.patch deleted file mode 100644 index 7fb64f305..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/IBlockAccess.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/IBlockAccess.java -+++ ../src-work/minecraft/net/minecraft/world/IBlockAccess.java -@@ -29,4 +29,14 @@ - - @SideOnly(Side.CLIENT) - WorldType getWorldType(); -+ -+ /** -+ * FORGE: isSideSolid, pulled up from {@link World} -+ * -+ * @param pos Position -+ * @param side Side -+ * @param _default default return value -+ * @return if the block is solid on the side -+ */ -+ boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/SpawnerAnimals.java.patch b/patches.mcp/minecraft/net/minecraft/world/SpawnerAnimals.java.patch deleted file mode 100644 index 8bc35b522..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/SpawnerAnimals.java.patch +++ /dev/null @@ -1,60 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/SpawnerAnimals.java -+++ ../src-work/minecraft/net/minecraft/world/SpawnerAnimals.java -@@ -17,6 +17,10 @@ - import net.minecraft.util.WeightedRandom; - import net.minecraft.world.biome.BiomeGenBase; - import net.minecraft.world.chunk.Chunk; -+import java.util.ArrayList; -+import java.util.Collections; -+import net.minecraftforge.fml.common.eventhandler.Event.Result; -+import net.minecraftforge.event.ForgeEventFactory; - - public final class SpawnerAnimals - { -@@ -80,12 +84,15 @@ - - if ((!enumcreaturetype.getPeacefulCreature() || p_77192_3_) && (enumcreaturetype.getPeacefulCreature() || p_77192_2_) && (!enumcreaturetype.getAnimal() || p_77192_4_)) - { -- i1 = p_77192_1_.countEntities(enumcreaturetype.getCreatureClass()); -+ i1 = p_77192_1_.countEntities(enumcreaturetype, true); - int i4 = enumcreaturetype.getMaxNumberOfCreature() * i / MOB_COUNT_DIV; - - if (i1 <= i4) - { - Iterator iterator1 = this.eligibleChunksForSpawning.iterator(); -+ ArrayList tmp = new ArrayList(eligibleChunksForSpawning); -+ Collections.shuffle(tmp); -+ iterator1 = tmp.iterator(); - label115: - - while (iterator1.hasNext()) -@@ -153,8 +160,10 @@ - - entityliving.setLocationAndAngles((double)f, (double)l2, (double)f1, p_77192_1_.rand.nextFloat() * 360.0F, 0.0F); - -- if (entityliving.getCanSpawnHere() && entityliving.handleLavaMovement()) -+ Result canSpawn = ForgeEventFactory.canEntitySpawn(entityliving, p_77192_1_, f, l2, f1); -+ if (canSpawn == Result.ALLOW || (canSpawn == Result.DEFAULT && (entityliving.getCanSpawnHere() && entityliving.handleLavaMovement()))) - { -+ if (!ForgeEventFactory.doSpecialSpawn(entityliving, p_77192_1_, f1, l2, f1)) - ientitylivingdata = entityliving.func_180482_a(p_77192_1_.getDifficultyForLocation(new BlockPos(entityliving)), ientitylivingdata); - - if (entityliving.handleLavaMovement()) -@@ -163,7 +172,7 @@ - p_77192_1_.spawnEntityInWorld(entityliving); - } - -- if (i2 >= entityliving.getMaxSpawnedInChunk()) -+ if (i2 >= ForgeEventFactory.getMaxSpawnPackSize(entityliving)) - { - continue label115; - } -@@ -220,7 +229,7 @@ - { - BlockPos blockpos1 = pos.down(); - -- if (!World.doesBlockHaveSolidTopSurface(worldIn, blockpos1)) -+ if (!worldIn.getBlockState(blockpos1).getBlock().canCreatureSpawn(worldIn, blockpos1, p_180267_0_)) - { - return false; - } diff --git a/patches.mcp/minecraft/net/minecraft/world/World.java.patch b/patches.mcp/minecraft/net/minecraft/world/World.java.patch deleted file mode 100644 index 1d9f76d6d..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/World.java.patch +++ /dev/null @@ -1,902 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/World.java -+++ ../src-work/minecraft/net/minecraft/world/World.java -@@ -56,8 +56,30 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - -+import net.minecraftforge.fml.common.FMLLog; -+import com.google.common.collect.ImmutableSetMultimap; -+import net.minecraftforge.client.ForgeHooksClient; -+import net.minecraftforge.common.ForgeChunkManager; -+import net.minecraftforge.common.ForgeChunkManager.Ticket; -+import net.minecraftforge.common.ForgeModContainer; -+import net.minecraftforge.common.ForgeHooks; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.common.WorldSpecificSaveHandler; -+import net.minecraftforge.event.entity.EntityEvent; -+import net.minecraftforge.event.entity.EntityJoinWorldEvent; -+import net.minecraftforge.event.world.WorldEvent; -+import net.minecraftforge.event.entity.PlaySoundAtEntityEvent; -+import net.minecraft.entity.EnumCreatureType; -+ - public abstract class World implements IBlockAccess - { -+ /** -+ * Used in the getEntitiesWithinAABB functions to expand the search area for entities. -+ * Modders should change this variable to a higher value if it is less then the radius -+ * of one of there entities. -+ */ -+ public static double MAX_ENTITY_RADIUS = 2.0D; -+ - protected boolean scheduledUpdatesAreImmediate; - public final List loadedEntityList = Lists.newArrayList(); - protected final List unloadedEntityList = Lists.newArrayList(); -@@ -99,6 +121,10 @@ - int[] lightUpdateBlockList; - private static final String __OBFID = "CL_00000140"; - -+ public boolean restoringBlockSnapshots = false; -+ public boolean captureBlockSnapshots = false; -+ public ArrayList capturedBlockSnapshots = new ArrayList(); -+ - protected World(ISaveHandler saveHandlerIn, WorldInfo info, WorldProvider providerIn, Profiler profilerIn, boolean client) - { - this.ambientTickCountdown = this.rand.nextInt(12000); -@@ -111,6 +137,7 @@ - this.provider = providerIn; - this.isRemote = client; - this.worldBorder = providerIn.getWorldBorder(); -+ perWorldStorage = new MapStorage((ISaveHandler)null); - } - - public World init() -@@ -120,6 +147,11 @@ - - public BiomeGenBase getBiomeGenForCoords(final BlockPos pos) - { -+ return this.provider.getBiomeGenForCoords(pos); -+ } -+ -+ public BiomeGenBase getBiomeGenForCoordsBody(final BlockPos pos) -+ { - if (this.isBlockLoaded(pos)) - { - Chunk chunk = this.getChunkFromBlockCoords(pos); -@@ -186,7 +218,7 @@ - - public boolean isAirBlock(BlockPos pos) - { -- return this.getBlockState(pos).getBlock().getMaterial() == Material.air; -+ return this.getBlockState(pos).getBlock().isAir(this, pos); - } - - public boolean isBlockLoaded(BlockPos pos) -@@ -286,39 +318,58 @@ - { - Chunk chunk = this.getChunkFromBlockCoords(pos); - Block block = newState.getBlock(); -+ -+ net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null; -+ if (this.captureBlockSnapshots && !this.isRemote) -+ { -+ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, pos, flags); -+ this.capturedBlockSnapshots.add(blockSnapshot); -+ } -+ int oldLight = getBlockState(pos).getBlock().getLightValue(this, pos); -+ - IBlockState iblockstate1 = chunk.setBlockState(pos, newState); - - if (iblockstate1 == null) - { -+ if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot); - return false; - } - else - { - Block block1 = iblockstate1.getBlock(); - -- if (block.getLightOpacity() != block1.getLightOpacity() || block.getLightValue() != block1.getLightValue()) -+ if (block.getLightOpacity() != block1.getLightOpacity() || block.getLightValue(this, pos) != oldLight) - { - this.theProfiler.startSection("checkLight"); - this.checkLight(pos); - this.theProfiler.endSection(); - } - -- if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && chunk.isPopulated()) -+ if (blockSnapshot == null) // Don't notify clients or update physics while capturing blockstates - { -- this.markBlockForUpdate(pos); -+ this.markAndNotifyBlock(pos, chunk, iblockstate1, newState, flags); // Modularize client and physic updates - } - -- if (!this.isRemote && (flags & 1) != 0) -- { -- this.notifyNeighborsRespectDebug(pos, iblockstate1.getBlock()); -+ return true; -+ } -+ } -+ } - -- if (block.hasComparatorInputOverride()) -- { -- this.updateComparatorOutputLevel(pos, block); -- } -- } -+ // Split off from original setBlockState(BlockPos, IBlockState Block p_147465_4_, int) method in order to directly send client and physic updates -+ public void markAndNotifyBlock(BlockPos pos, Chunk chunk, IBlockState old, IBlockState new_, int flags) -+ { -+ if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && (chunk == null || chunk.isPopulated())) -+ { -+ this.markBlockForUpdate(pos); -+ } - -- return true; -+ if (!this.isRemote && (flags & 1) != 0) -+ { -+ this.notifyNeighborsRespectDebug(pos, old.getBlock()); -+ -+ if (new_.getBlock().hasComparatorInputOverride()) -+ { -+ this.updateComparatorOutputLevel(pos, new_.getBlock()); - } - } - } -@@ -408,6 +459,9 @@ - - public void notifyNeighborsOfStateChange(BlockPos pos, Block blockType) - { -+ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, pos, this.getBlockState(pos), java.util.EnumSet.allOf(EnumFacing.class)).isCanceled()) -+ return; -+ - this.notifyBlockOfStateChange(pos.west(), blockType); - this.notifyBlockOfStateChange(pos.east(), blockType); - this.notifyBlockOfStateChange(pos.down(), blockType); -@@ -418,6 +472,11 @@ - - public void notifyNeighborsOfStateExcept(BlockPos pos, Block blockType, EnumFacing skipSide) - { -+ java.util.EnumSet directions = java.util.EnumSet.allOf(EnumFacing.class); -+ directions.remove(skipSide); -+ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(this, pos, this.getBlockState(pos), directions).isCanceled()) -+ return; -+ - if (skipSide != EnumFacing.WEST) - { - this.notifyBlockOfStateChange(pos.west(), blockType); -@@ -782,7 +841,7 @@ - - public boolean isDaytime() - { -- return this.skylightSubtracted < 4; -+ return this.provider.isDaytime(); - } - - public MovingObjectPosition rayTraceBlocks(Vec3 p_72933_1_, Vec3 p_72933_2_) -@@ -978,6 +1037,11 @@ - - public void playSoundAtEntity(Entity p_72956_1_, String p_72956_2_, float p_72956_3_, float p_72956_4_) - { -+ PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_72956_1_, p_72956_2_, p_72956_3_, p_72956_4_); -+ if (event.isCanceled() || event.name == null) return; -+ p_72956_2_ = event.name; -+ p_72956_3_ = event.newVolume; -+ p_72956_4_ = event.newPitch; - for (int i = 0; i < this.worldAccesses.size(); ++i) - { - ((IWorldAccess)this.worldAccesses.get(i)).playSound(p_72956_2_, p_72956_1_.posX, p_72956_1_.posY, p_72956_1_.posZ, p_72956_3_, p_72956_4_); -@@ -986,6 +1050,11 @@ - - public void playSoundToNearExcept(EntityPlayer p_85173_1_, String p_85173_2_, float p_85173_3_, float p_85173_4_) - { -+ PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_85173_1_, p_85173_2_, p_85173_3_, p_85173_4_); -+ if (event.isCanceled() || event.name == null) return; -+ p_85173_2_ = event.name; -+ p_85173_3_ = event.newVolume; -+ p_85173_4_ = event.newPitch; - for (int i = 0; i < this.worldAccesses.size(); ++i) - { - ((IWorldAccess)this.worldAccesses.get(i)).playSoundToNearExcept(p_85173_1_, p_85173_2_, p_85173_1_.posX, p_85173_1_.posY, p_85173_1_.posZ, p_85173_3_, p_85173_4_); -@@ -1037,6 +1106,9 @@ - - public boolean spawnEntityInWorld(Entity p_72838_1_) - { -+ // do not drop any items while restoring blocksnapshots. Prevents dupes -+ if (!this.isRemote && (p_72838_1_ == null || (p_72838_1_ instanceof net.minecraft.entity.item.EntityItem && this.restoringBlockSnapshots))) return false; -+ - int i = MathHelper.floor_double(p_72838_1_.posX / 16.0D); - int j = MathHelper.floor_double(p_72838_1_.posZ / 16.0D); - boolean flag = p_72838_1_.forceSpawn; -@@ -1059,6 +1131,8 @@ - this.updateAllPlayersSleepingFlag(); - } - -+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_72838_1_, this)) && !flag) return false; -+ - this.getChunkFromChunkCoords(i, j).addEntity(p_72838_1_); - this.loadedEntityList.add(p_72838_1_); - this.onEntityAdded(p_72838_1_); -@@ -1271,17 +1345,29 @@ - - public int calculateSkylightSubtracted(float p_72967_1_) - { -+ float f2 = provider.getSunBrightnessFactor(p_72967_1_); -+ f2 = 1.0F - f2; -+ return (int)(f2 * 11.0F); -+ } -+ -+ /** -+ * The current sun brightness factor for this dimension. -+ * 0.0f means no light at all, and 1.0f means maximum sunlight. -+ * Highly recommended for sunlight detection like solar panel. -+ * -+ * @return The current brightness factor -+ * */ -+ public float getSunBrightnessFactor(float p_72967_1_) -+ { - float f1 = this.getCelestialAngle(p_72967_1_); - float f2 = 1.0F - (MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F); - f2 = MathHelper.clamp_float(f2, 0.0F, 1.0F); - f2 = 1.0F - f2; - f2 = (float)((double)f2 * (1.0D - (double)(this.getRainStrength(p_72967_1_) * 5.0F) / 16.0D)); - f2 = (float)((double)f2 * (1.0D - (double)(this.getThunderStrength(p_72967_1_) * 5.0F) / 16.0D)); -- f2 = 1.0F - f2; -- return (int)(f2 * 11.0F); -+ return f2; - } - -- @SideOnly(Side.CLIENT) - public void removeWorldAccess(IWorldAccess p_72848_1_) - { - this.worldAccesses.remove(p_72848_1_); -@@ -1290,6 +1376,12 @@ - @SideOnly(Side.CLIENT) - public float getSunBrightness(float p_72971_1_) - { -+ return this.provider.getSunBrightness(p_72971_1_); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public float getSunBrightnessBody(float p_72971_1_) -+ { - float f1 = this.getCelestialAngle(p_72971_1_); - float f2 = 1.0F - (MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.2F); - f2 = MathHelper.clamp_float(f2, 0.0F, 1.0F); -@@ -1302,6 +1394,12 @@ - @SideOnly(Side.CLIENT) - public Vec3 getSkyColor(Entity p_72833_1_, float p_72833_2_) - { -+ return this.provider.getSkyColor(p_72833_1_, p_72833_2_); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public Vec3 getSkyColorBody(Entity p_72833_1_, float p_72833_2_) -+ { - float f1 = this.getCelestialAngle(p_72833_2_); - float f2 = MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; - f2 = MathHelper.clamp_float(f2, 0.0F, 1.0F); -@@ -1309,9 +1407,7 @@ - int j = MathHelper.floor_double(p_72833_1_.posY); - int k = MathHelper.floor_double(p_72833_1_.posZ); - BlockPos blockpos = new BlockPos(i, j, k); -- BiomeGenBase biomegenbase = this.getBiomeGenForCoords(blockpos); -- float f3 = biomegenbase.getFloatTemperature(blockpos); -- int l = biomegenbase.getSkyColorByTemp(f3); -+ int l = net.minecraftforge.client.ForgeHooksClient.getSkyBlendColour(this, blockpos); - float f4 = (float)(l >> 16 & 255) / 255.0F; - float f5 = (float)(l >> 8 & 255) / 255.0F; - float f6 = (float)(l & 255) / 255.0F; -@@ -1373,6 +1469,11 @@ - - public float getCurrentMoonPhaseFactor() - { -+ return provider.getCurrentMoonPhaseFactor(); -+ } -+ -+ public float getCurrentMoonPhaseFactorBody() -+ { - return WorldProvider.moonPhaseFactors[this.provider.getMoonPhase(this.worldInfo.getWorldTime())]; - } - -@@ -1385,6 +1486,12 @@ - @SideOnly(Side.CLIENT) - public Vec3 getCloudColour(float p_72824_1_) - { -+ return this.provider.drawClouds(p_72824_1_); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public Vec3 drawCloudsBody(float p_72824_1_) -+ { - float f1 = this.getCelestialAngle(p_72824_1_); - float f2 = MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; - f2 = MathHelper.clamp_float(f2, 0.0F, 1.0F); -@@ -1442,9 +1549,9 @@ - for (blockpos1 = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos1.getY() >= 0; blockpos1 = blockpos2) - { - blockpos2 = blockpos1.down(); -- Material material = chunk.getBlock(blockpos2).getMaterial(); -+ Block block = chunk.getBlock(blockpos2); - -- if (material.blocksMovement() && material != Material.leaves) -+ if (block.getMaterial().blocksMovement() && !block.isLeaves(this, blockpos2) && !block.isFoliage(this, blockpos2)) - { - break; - } -@@ -1456,6 +1563,12 @@ - @SideOnly(Side.CLIENT) - public float getStarBrightness(float p_72880_1_) - { -+ return this.provider.getStarBrightness(p_72880_1_); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public float getStarBrightnessBody(float p_72880_1_) -+ { - float f1 = this.getCelestialAngle(p_72880_1_); - float f2 = 1.0F - (MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.25F); - f2 = MathHelper.clamp_float(f2, 0.0F, 1.0F); -@@ -1500,7 +1613,15 @@ - entity.addEntityCrashInfo(crashreportcategory); - } - -- throw new ReportedException(crashreport); -+ if (ForgeModContainer.removeErroringEntities) -+ { -+ FMLLog.severe(crashreport.getCompleteReport()); -+ removeEntity(entity); -+ } -+ else -+ { -+ throw new ReportedException(crashreport); -+ } - } - - if (entity.isDead) -@@ -1562,7 +1683,16 @@ - crashreport = CrashReport.makeCrashReport(throwable1, "Ticking entity"); - crashreportcategory = crashreport.makeCategory("Entity being ticked"); - entity.addEntityCrashInfo(crashreportcategory); -- throw new ReportedException(crashreport); -+ if (ForgeModContainer.removeErroringEntities) -+ { -+ FMLLog.severe(crashreport.getCompleteReport()); -+ removeEntity(entity); -+ } -+ else -+ { -+ throw new ReportedException(crashreport); -+ } -+ - } - } - -@@ -1609,7 +1739,16 @@ - CrashReport crashreport1 = CrashReport.makeCrashReport(throwable, "Ticking block entity"); - CrashReportCategory crashreportcategory1 = crashreport1.makeCategory("Block entity being ticked"); - tileentity.addInfoToCrashReport(crashreportcategory1); -- throw new ReportedException(crashreport1); -+ if (ForgeModContainer.removeErroringTileEntities) -+ { -+ FMLLog.severe(crashreport1.getCompleteReport()); -+ tileentity.invalidate(); -+ this.removeTileEntity(tileentity.getPos()); -+ } -+ else -+ { -+ throw new ReportedException(crashreport1); -+ } - } - } - } -@@ -1626,15 +1765,19 @@ - } - } - -- this.processingLoadedTiles = false; -- - if (!this.tileEntitiesToBeRemoved.isEmpty()) - { -+ for (Object tile : tileEntitiesToBeRemoved) -+ { -+ ((TileEntity)tile).onChunkUnload(); -+ } - this.tickableTileEntities.removeAll(this.tileEntitiesToBeRemoved); - this.loadedTileEntityList.removeAll(this.tileEntitiesToBeRemoved); - this.tileEntitiesToBeRemoved.clear(); - } - -+ this.processingLoadedTiles = false; //FML Move below remove to prevent CMEs -+ - this.theProfiler.endStartSection("pendingBlockEntities"); - - if (!this.addedTileEntityList.isEmpty()) -@@ -1668,7 +1811,8 @@ - - public boolean addTileEntity(TileEntity tile) - { -- boolean flag = this.loadedTileEntityList.add(tile); -+ List dest = processingLoadedTiles ? addedTileEntityList : loadedTileEntityList; -+ boolean flag = dest.add(tile); - - if (flag && tile instanceof IUpdatePlayerListBox) - { -@@ -1710,9 +1854,12 @@ - { - int i = MathHelper.floor_double(p_72866_1_.posX); - int j = MathHelper.floor_double(p_72866_1_.posZ); -- byte b0 = 32; -+ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(i >> 4, j >> 4)); -+ byte b0 = isForced ? (byte)0 : 32; -+ boolean canUpdate = !p_72866_2_ || this.isAreaLoaded(i - b0, 0, j - b0, i + b0, 0, j + b0, true); -+ if (!canUpdate) canUpdate = net.minecraftforge.event.ForgeEventFactory.canEntityUpdate(p_72866_1_); - -- if (!p_72866_2_ || this.isAreaLoaded(i - b0, 0, j - b0, i + b0, 0, j + b0, true)) -+ if (canUpdate) - { - p_72866_1_.lastTickPosX = p_72866_1_.posX; - p_72866_1_.lastTickPosY = p_72866_1_.posY; -@@ -1839,7 +1986,7 @@ - { - Block block = this.getBlockState(new BlockPos(k1, l1, i2)).getBlock(); - -- if (block.getMaterial() != Material.air) -+ if (!block.isAir(this, new BlockPos(k1, l1, i2))) - { - return true; - } -@@ -1901,6 +2048,10 @@ - { - return true; - } -+ else if (block.isBurning(this, new BlockPos(k1, l1, i2))) -+ { -+ return true; -+ } - } - } - } -@@ -2039,6 +2190,7 @@ - public Explosion newExplosion(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) - { - Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_); -+ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; - explosion.doExplosionA(); - explosion.doExplosionB(true); - return explosion; -@@ -2185,19 +2337,28 @@ - else - { - this.addTileEntity(tileEntityIn); -- this.getChunkFromBlockCoords(pos).addTileEntity(pos, tileEntityIn); -+ Chunk chunk = this.getChunkFromBlockCoords(pos); //Forge add NPE protection -+ if (chunk != null) chunk.addTileEntity(pos, tileEntityIn); - } -+ this.updateComparatorOutputLevel(pos, getBlockState(pos).getBlock()); //Notify neighbors of changes - } - } - - public void removeTileEntity(BlockPos pos) - { -+ //Chunk chunk = this.getChunkFromBlockCoords(pos); -+ //if (chunk != null) chunk.removeTileEntity(pos); -+ //Forge ToDO: Are these patches needed anymore? -+ - TileEntity tileentity = this.getTileEntity(pos); - - if (tileentity != null && this.processingLoadedTiles) - { - tileentity.invalidate(); - this.addedTileEntityList.remove(tileentity); -+ if (!(tileentity instanceof IUpdatePlayerListBox)) //Forge: If they are not tickable they wont be removed in the update loop. -+ this.loadedTileEntityList.remove(tileentity); -+ - } - else - { -@@ -2210,6 +2371,7 @@ - - this.getChunkFromBlockCoords(pos).removeTileEntity(pos); - } -+ this.updateComparatorOutputLevel(pos, getBlockState(pos).getBlock()); //Notify neighbors of changes - } - - public void markTileEntityForRemoval(TileEntity tileEntityIn) -@@ -2228,7 +2390,7 @@ - { - IBlockState iblockstate = p_175683_0_.getBlockState(p_175683_1_); - Block block = iblockstate.getBlock(); -- return block.getMaterial().isOpaque() && block.isFullCube() ? true : (block instanceof BlockStairs ? iblockstate.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP : (block instanceof BlockSlab ? iblockstate.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? ((Integer)iblockstate.getValue(BlockSnow.LAYERS)).intValue() == 7 : false)))); -+ return block.isSideSolid(p_175683_0_, p_175683_1_, EnumFacing.UP); - } - - public boolean isBlockNormalCube(BlockPos p_175677_1_, boolean p_175677_2_) -@@ -2248,7 +2410,7 @@ - else - { - Block block = this.getBlockState(p_175677_1_).getBlock(); -- return block.getMaterial().isOpaque() && block.isFullCube(); -+ return block.isNormalCube(this, p_175677_1_); - } - } - } -@@ -2265,8 +2427,7 @@ - - public void setAllowedSpawnTypes(boolean hostile, boolean peaceful) - { -- this.spawnHostileMobs = hostile; -- this.spawnPeacefulMobs = peaceful; -+ this.provider.setAllowedSpawnTypes(hostile, peaceful); - } - - public void tick() -@@ -2276,6 +2437,11 @@ - - protected void calculateInitialWeather() - { -+ this.provider.calculateInitialWeather(); -+ } -+ -+ public void calculateInitialWeatherBody() -+ { - if (this.worldInfo.isRaining()) - { - this.rainingStrength = 1.0F; -@@ -2289,6 +2455,11 @@ - - protected void updateWeather() - { -+ this.provider.updateWeather(); -+ } -+ -+ public void updateWeatherBody() -+ { - if (!this.provider.getHasNoSky()) - { - if (!this.isRemote) -@@ -2383,6 +2554,7 @@ - { - this.activeChunkSet.clear(); - this.theProfiler.startSection("buildList"); -+ this.activeChunkSet.addAll(getPersistentChunks().keySet()); - int i; - EntityPlayer entityplayer; - int j; -@@ -2445,7 +2617,7 @@ - l += p_147467_1_; - i1 += p_147467_2_; - -- if (block.getMaterial() == Material.air && this.getLight(blockpos) <= this.rand.nextInt(8) && this.getLightFor(EnumSkyBlock.SKY, blockpos) <= 0) -+ if (block.isAir(this, blockpos) && this.getLight(blockpos) <= this.rand.nextInt(8) && this.getLightFor(EnumSkyBlock.SKY, blockpos) <= 0) - { - EntityPlayer entityplayer = this.getClosestPlayer((double)l + 0.5D, (double)j1 + 0.5D, (double)i1 + 0.5D, 8.0D); - -@@ -2485,6 +2657,11 @@ - - public boolean canBlockFreeze(BlockPos pos, boolean noWaterAdj) - { -+ return this.provider.canBlockFreeze(pos, noWaterAdj); -+ } -+ -+ public boolean canBlockFreezeBody(BlockPos pos, boolean noWaterAdj) -+ { - BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); - float f = biomegenbase.getFloatTemperature(pos); - -@@ -2526,6 +2703,11 @@ - - public boolean canSnowAt(BlockPos pos, boolean checkLight) - { -+ return this.provider.canSnowAt(pos, checkLight); -+ } -+ -+ public boolean canSnowAtBody(BlockPos pos, boolean checkLight) -+ { - BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); - float f = biomegenbase.getFloatTemperature(pos); - -@@ -2543,7 +2725,7 @@ - { - Block block = this.getBlockState(pos).getBlock(); - -- if (block.getMaterial() == Material.air && Blocks.snow_layer.canPlaceBlockAt(this, pos)) -+ if (block.isAir(this, pos) && Blocks.snow_layer.canPlaceBlockAt(this, pos)) - { - return true; - } -@@ -2575,10 +2757,11 @@ - else - { - Block block = this.getBlockState(pos).getBlock(); -- int i = lightType == EnumSkyBlock.SKY ? 0 : block.getLightValue(); -- int j = block.getLightOpacity(); -+ int blockLight = block.getLightValue(this, pos); -+ int i = lightType == EnumSkyBlock.SKY ? 0 : blockLight; -+ int j = block.getLightOpacity(this, pos); - -- if (j >= 15 && block.getLightValue() > 0) -+ if (j >= 15 && blockLight > 0) - { - j = 1; - } -@@ -2792,10 +2975,10 @@ - public List func_175674_a(Entity entityIn, AxisAlignedBB p_175674_2_, Predicate p_175674_3_) - { - ArrayList arraylist = Lists.newArrayList(); -- int i = MathHelper.floor_double((p_175674_2_.minX - 2.0D) / 16.0D); -- int j = MathHelper.floor_double((p_175674_2_.maxX + 2.0D) / 16.0D); -- int k = MathHelper.floor_double((p_175674_2_.minZ - 2.0D) / 16.0D); -- int l = MathHelper.floor_double((p_175674_2_.maxZ + 2.0D) / 16.0D); -+ int i = MathHelper.floor_double((p_175674_2_.minX - MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.floor_double((p_175674_2_.maxX + MAX_ENTITY_RADIUS) / 16.0D); -+ int k = MathHelper.floor_double((p_175674_2_.minZ - MAX_ENTITY_RADIUS) / 16.0D); -+ int l = MathHelper.floor_double((p_175674_2_.maxZ + MAX_ENTITY_RADIUS) / 16.0D); - - for (int i1 = i; i1 <= j; ++i1) - { -@@ -2854,10 +3037,10 @@ - - public List getEntitiesWithinAABB(Class clazz, AxisAlignedBB aabb, Predicate filter) - { -- int i = MathHelper.floor_double((aabb.minX - 2.0D) / 16.0D); -- int j = MathHelper.floor_double((aabb.maxX + 2.0D) / 16.0D); -- int k = MathHelper.floor_double((aabb.minZ - 2.0D) / 16.0D); -- int l = MathHelper.floor_double((aabb.maxZ + 2.0D) / 16.0D); -+ int i = MathHelper.floor_double((aabb.minX - MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.floor_double((aabb.maxX + MAX_ENTITY_RADIUS) / 16.0D); -+ int k = MathHelper.floor_double((aabb.minZ - MAX_ENTITY_RADIUS) / 16.0D); -+ int l = MathHelper.floor_double((aabb.maxZ + MAX_ENTITY_RADIUS) / 16.0D); - ArrayList arraylist = Lists.newArrayList(); - - for (int i1 = i; i1 <= j; ++i1) -@@ -2938,13 +3121,16 @@ - - public void loadEntities(Collection entityCollection) - { -- this.loadedEntityList.addAll(entityCollection); - Iterator iterator = entityCollection.iterator(); - - while (iterator.hasNext()) - { - Entity entity = (Entity)iterator.next(); -- this.onEntityAdded(entity); -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entity, this))) -+ { -+ loadedEntityList.add(entity); -+ this.onEntityAdded(entity); -+ } - } - } - -@@ -2957,7 +3143,9 @@ - { - Block block1 = this.getBlockState(p_175716_2_).getBlock(); - AxisAlignedBB axisalignedbb = p_175716_3_ ? null : p_175716_1_.getCollisionBoundingBox(this, p_175716_2_, p_175716_1_.getDefaultState()); -- return axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, p_175716_5_) ? false : (block1.getMaterial() == Material.circuits && p_175716_1_ == Blocks.anvil ? true : block1.getMaterial().isReplaceable() && p_175716_1_.canReplace(this, p_175716_2_, p_175716_4_, p_175716_6_)); -+ if (axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, p_175716_5_)) return false; -+ if (block1.getMaterial() == Material.circuits && p_175716_1_ == Blocks.anvil) return true; -+ return block1.isReplaceable(this, p_175716_2_) && p_175716_1_.canReplace(this, p_175716_2_, p_175716_4_, p_175716_6_); - } - - public int getStrongPower(BlockPos pos, EnumFacing direction) -@@ -3032,7 +3220,7 @@ - { - IBlockState iblockstate = this.getBlockState(pos); - Block block = iblockstate.getBlock(); -- return block.isNormalCube() ? this.getStrongPower(pos) : block.isProvidingWeakPower(this, pos, iblockstate, facing); -+ return block.shouldCheckWeakPower(this, pos, facing) ? this.getStrongPower(pos) : block.isProvidingWeakPower(this, pos, iblockstate, facing); - } - - public boolean isBlockPowered(BlockPos pos) -@@ -3160,7 +3348,7 @@ - - public long getSeed() - { -- return this.worldInfo.getSeed(); -+ return this.provider.getSeed(); - } - - public long getTotalWorldTime() -@@ -3170,17 +3358,17 @@ - - public long getWorldTime() - { -- return this.worldInfo.getWorldTime(); -+ return this.provider.getWorldTime(); - } - - public void setWorldTime(long time) - { -- this.worldInfo.setWorldTime(time); -+ this.provider.setWorldTime(time); - } - - public BlockPos getSpawnPoint() - { -- BlockPos blockpos = new BlockPos(this.worldInfo.getSpawnX(), this.worldInfo.getSpawnY(), this.worldInfo.getSpawnZ()); -+ BlockPos blockpos = this.provider.getSpawnPoint(); - - if (!this.getWorldBorder().contains(blockpos)) - { -@@ -3192,7 +3380,7 @@ - - public void setSpawnPoint(BlockPos pos) - { -- this.worldInfo.setSpawn(pos); -+ this.provider.setSpawnPoint(pos); - } - - @SideOnly(Side.CLIENT) -@@ -3212,12 +3400,18 @@ - - if (!this.loadedEntityList.contains(entityIn)) - { -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entityIn, this))) - this.loadedEntityList.add(entityIn); - } - } - - public boolean isBlockModifiable(EntityPlayer player, BlockPos pos) - { -+ return this.provider.canMineBlock(player, pos); -+ } -+ -+ public boolean canMineBlockBody(EntityPlayer player, BlockPos pos) -+ { - return true; - } - -@@ -3307,8 +3501,7 @@ - - public boolean isBlockinHighHumidity(BlockPos pos) - { -- BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); -- return biomegenbase.isHighHumidity(); -+ return this.provider.isBlockHighHumidity(pos); - } - - public MapStorage getMapStorage() -@@ -3367,12 +3560,12 @@ - - public int getHeight() - { -- return 256; -+ return this.provider.getHeight(); - } - - public int getActualHeight() - { -- return this.provider.getHasNoSky() ? 128 : 256; -+ return this.provider.getActualHeight(); - } - - public Random setRandomSeed(int p_72843_1_, int p_72843_2_, int p_72843_3_) -@@ -3429,7 +3622,7 @@ - @SideOnly(Side.CLIENT) - public double getHorizon() - { -- return this.worldInfo.getTerrainType() == WorldType.FLAT ? 0.0D : 63.0D; -+ return provider.getHorizon(); - } - - public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress) -@@ -3461,29 +3654,21 @@ - - public void updateComparatorOutputLevel(BlockPos pos, Block blockIn) - { -- Iterator iterator = EnumFacing.Plane.HORIZONTAL.iterator(); -- -- while (iterator.hasNext()) -+ for (EnumFacing enumfacing : EnumFacing.values()) - { -- EnumFacing enumfacing = (EnumFacing)iterator.next(); - BlockPos blockpos1 = pos.offset(enumfacing); - - if (this.isBlockLoaded(blockpos1)) - { - IBlockState iblockstate = this.getBlockState(blockpos1); -- -- if (Blocks.unpowered_comparator.isAssociated(iblockstate.getBlock())) -+ iblockstate.getBlock().onNeighborChange(this, blockpos1, pos); -+ if (iblockstate.getBlock().isNormalCube(this, blockpos1)) - { -- iblockstate.getBlock().onNeighborBlockChange(this, blockpos1, iblockstate, blockIn); -- } -- else if (iblockstate.getBlock().isNormalCube()) -- { -- blockpos1 = blockpos1.offset(enumfacing); -- iblockstate = this.getBlockState(blockpos1); -- -- if (Blocks.unpowered_comparator.isAssociated(iblockstate.getBlock())) -+ BlockPos posOther = blockpos1.offset(enumfacing); -+ Block other = getBlockState(posOther).getBlock(); -+ if (other.getWeakChanges(this, posOther)) - { -- iblockstate.getBlock().onNeighborBlockChange(this, blockpos1, iblockstate, blockIn); -+ other.onNeighborChange(this, posOther, pos); - } - } - } -@@ -3553,4 +3738,82 @@ - short short1 = 128; - return k >= -short1 && k <= short1 && l >= -short1 && l <= short1; - } -+ -+ -+ /* ======================================== FORGE START =====================================*/ -+ /** -+ * Determine if the given block is considered solid on the -+ * specified side. Used by placement logic. -+ * -+ * @param pos Block Position -+ * @param side The Side in question -+ * @return True if the side is solid -+ */ -+ public boolean isSideSolid(BlockPos pos, EnumFacing side) -+ { -+ return isSideSolid(pos, side, false); -+ } -+ -+ /** -+ * Determine if the given block is considered solid on the -+ * specified side. Used by placement logic. -+ * -+ * @param pos Block Position -+ * @param side The Side in question -+ * @param _default The default to return if the block doesn't exist. -+ * @return True if the side is solid -+ */ -+ @Override -+ public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) -+ { -+ if (!this.isValid(pos)) return _default; -+ -+ Chunk chunk = getChunkFromBlockCoords(pos); -+ if (chunk == null || chunk.isEmpty()) return _default; -+ return getBlockState(pos).getBlock().isSideSolid(this, pos, side); -+ } -+ -+ /** -+ * Get the persistent chunks for this world -+ * -+ * @return -+ */ -+ public ImmutableSetMultimap getPersistentChunks() -+ { -+ return ForgeChunkManager.getPersistentChunksFor(this); -+ } -+ -+ /** -+ * Readded as it was removed, very useful helper function -+ * -+ * @param pos Block position -+ * @return The blocks light opacity -+ */ -+ public int getBlockLightOpacity(BlockPos pos) -+ { -+ if (!this.isValid(pos)) return 0; -+ return getChunkFromBlockCoords(pos).getBlockLightOpacity(pos); -+ } -+ -+ /** -+ * Returns a count of entities that classify themselves as the specified creature type. -+ */ -+ public int countEntities(EnumCreatureType type, boolean forSpawnCount) -+ { -+ int count = 0; -+ for (int x = 0; x < loadedEntityList.size(); x++) -+ { -+ if (((Entity)loadedEntityList.get(x)).isCreatureType(type, forSpawnCount)) -+ { -+ count++; -+ } -+ } -+ return count; -+ } -+ -+ protected MapStorage perWorldStorage; //Moved to a getter to simulate final without being final so we can load in subclasses. -+ public MapStorage getPerWorldStorage() -+ { -+ return perWorldStorage; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch deleted file mode 100644 index 992abea45..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/WorldProvider.java.patch +++ /dev/null @@ -1,383 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/WorldProvider.java -+++ ../src-work/minecraft/net/minecraft/world/WorldProvider.java -@@ -52,26 +52,12 @@ - - protected void registerWorldChunkManager() - { -- WorldType worldtype = this.worldObj.getWorldInfo().getTerrainType(); -- -- if (worldtype == WorldType.FLAT) -- { -- FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.createFlatGeneratorFromString(this.worldObj.getWorldInfo().getGeneratorOptions()); -- this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), BiomeGenBase.field_180279_ad), 0.5F); -- } -- else if (worldtype == WorldType.DEBUG_WORLD) -- { -- this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.plains, 0.0F); -- } -- else -- { -- this.worldChunkMgr = new WorldChunkManager(this.worldObj); -- } -+ this.worldChunkMgr = terrainType.getChunkManager(worldObj); - } - - public IChunkProvider createChunkGenerator() - { -- return (IChunkProvider)(this.terrainType == WorldType.FLAT ? new ChunkProviderFlat(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : (this.terrainType == WorldType.DEBUG_WORLD ? new ChunkProviderDebug(this.worldObj) : (this.terrainType == WorldType.CUSTOMIZED ? new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings)))); -+ return terrainType.getChunkGenerator(worldObj, generatorSettings); - } - - public boolean canCoordinateBeSpawn(int x, int z) -@@ -155,13 +141,13 @@ - - public static WorldProvider getProviderForDimension(int dimension) - { -- return (WorldProvider)(dimension == -1 ? new WorldProviderHell() : (dimension == 0 ? new WorldProviderSurface() : (dimension == 1 ? new WorldProviderEnd() : null))); -+ return net.minecraftforge.common.DimensionManager.createProviderFor(dimension); - } - - @SideOnly(Side.CLIENT) - public float getCloudHeight() - { -- return 128.0F; -+ return this.terrainType.getCloudHeight(); - } - - @SideOnly(Side.CLIENT) -@@ -177,13 +163,13 @@ - - public int getAverageGroundLevel() - { -- return this.terrainType == WorldType.FLAT ? 4 : 64; -+ return this.terrainType.getMinimumSpawnHeight(this.worldObj); - } - - @SideOnly(Side.CLIENT) - public double getVoidFogYFactor() - { -- return this.terrainType == WorldType.FLAT ? 1.0D : 0.03125D; -+ return this.terrainType.voidFadeMagnitude(); - } - - @SideOnly(Side.CLIENT) -@@ -225,4 +211,319 @@ - { - return new WorldBorder(); - } -+ -+ /*======================================= Forge Start =========================================*/ -+ private net.minecraftforge.client.IRenderHandler skyRenderer = null; -+ private net.minecraftforge.client.IRenderHandler cloudRenderer = null; -+ private net.minecraftforge.client.IRenderHandler weatherRenderer = null; -+ -+ /** -+ * Sets the providers current dimension ID, used in default getSaveFolder() -+ * Added to allow default providers to be registered for multiple dimensions. -+ * -+ * @param dim Dimension ID -+ */ -+ public void setDimension(int dim) -+ { -+ this.dimensionId = dim; -+ } -+ -+ /** -+ * Returns the sub-folder of the world folder that this WorldProvider saves to. -+ * EXA: DIM1, DIM-1 -+ * @return The sub-folder name to save this world's chunks to. -+ */ -+ public String getSaveFolder() -+ { -+ return (dimensionId == 0 ? null : "DIM" + dimensionId); -+ } -+ -+ /** -+ * A message to display to the user when they transfer to this dimension. -+ * -+ * @return The message to be displayed -+ */ -+ public String getWelcomeMessage() -+ { -+ if (this instanceof WorldProviderEnd) -+ { -+ return "Entering the End"; -+ } -+ else if (this instanceof WorldProviderHell) -+ { -+ return "Entering the Nether"; -+ } -+ return null; -+ } -+ -+ /** -+ * A Message to display to the user when they transfer out of this dismension. -+ * -+ * @return The message to be displayed -+ */ -+ public String getDepartMessage() -+ { -+ if (this instanceof WorldProviderEnd) -+ { -+ return "Leaving the End"; -+ } -+ else if (this instanceof WorldProviderHell) -+ { -+ return "Leaving the Nether"; -+ } -+ return null; -+ } -+ -+ /** -+ * The dimensions movement factor. Relative to normal overworld. -+ * It is applied to the players position when they transfer dimensions. -+ * Exa: Nether movement is 8.0 -+ * @return The movement factor -+ */ -+ public double getMovementFactor() -+ { -+ if (this instanceof WorldProviderHell) -+ { -+ return 8.0; -+ } -+ return 1.0; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public net.minecraftforge.client.IRenderHandler getSkyRenderer() -+ { -+ return this.skyRenderer; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public void setSkyRenderer(net.minecraftforge.client.IRenderHandler skyRenderer) -+ { -+ this.skyRenderer = skyRenderer; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public net.minecraftforge.client.IRenderHandler getCloudRenderer() -+ { -+ return cloudRenderer; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public void setCloudRenderer(net.minecraftforge.client.IRenderHandler renderer) -+ { -+ cloudRenderer = renderer; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public net.minecraftforge.client.IRenderHandler getWeatherRenderer() -+ { -+ return weatherRenderer; -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public void setWeatherRenderer(net.minecraftforge.client.IRenderHandler renderer) -+ { -+ weatherRenderer = renderer; -+ } -+ -+ public BlockPos getRandomizedSpawnPoint() -+ { -+ BlockPos ret = this.worldObj.getSpawnPoint(); -+ -+ boolean isAdventure = worldObj.getWorldInfo().getGameType() == WorldSettings.GameType.ADVENTURE; -+ int spawnFuzz = terrainType.getSpawnFuzz(); -+ int border = MathHelper.floor_double(worldObj.getWorldBorder().getClosestDistance(ret.getX(), ret.getZ())); -+ if (border < spawnFuzz) spawnFuzz = border; -+ if (spawnFuzz < 1) spawnFuzz = 1; -+ int spawnFuzzHalf = spawnFuzz / 2; -+ -+ if (!getHasNoSky() && !isAdventure) -+ { -+ ret = worldObj.getTopSolidOrLiquidBlock(ret.add(worldObj.rand.nextInt(spawnFuzzHalf) - spawnFuzz, 0, worldObj.rand.nextInt(spawnFuzzHalf) - spawnFuzz)); -+ } -+ -+ return ret; -+ } -+ /** -+ * Determine if the cursor on the map should 'spin' when rendered, like it does for the player in the nether. -+ * -+ * @param entity The entity holding the map, playername, or frame-ENTITYID -+ * @param x X Position -+ * @param y Y Position -+ * @param z Z Position -+ * @return True to 'spin' the cursor -+ */ -+ public boolean shouldMapSpin(String entity, double x, double y, double z) -+ { -+ return dimensionId < 0; -+ } -+ -+ /** -+ * Determines the dimension the player will be respawned in, typically this brings them back to the overworld. -+ * -+ * @param player The player that is respawning -+ * @return The dimension to respawn the player in -+ */ -+ public int getRespawnDimension(net.minecraft.entity.player.EntityPlayerMP player) -+ { -+ return 0; -+ } -+ -+ /*======================================= Start Moved From World =========================================*/ -+ -+ public BiomeGenBase getBiomeGenForCoords(BlockPos pos) -+ { -+ return worldObj.getBiomeGenForCoordsBody(pos); -+ } -+ -+ public boolean isDaytime() -+ { -+ return worldObj.getSkylightSubtracted() < 4; -+ } -+ -+ /** -+ * The current sun brightness factor for this dimension. -+ * 0.0f means no light at all, and 1.0f means maximum sunlight. -+ * This will be used for the "calculateSkylightSubtracted" -+ * which is for Sky light value calculation. -+ * -+ * @return The current brightness factor -+ * */ -+ public float getSunBrightnessFactor(float par1) -+ { -+ return worldObj.getSunBrightnessFactor(par1); -+ } -+ -+ /** -+ * Calculates the current moon phase factor. -+ * This factor is effective for slimes. -+ * (This method do not affect the moon rendering) -+ * */ -+ public float getCurrentMoonPhaseFactor() -+ { -+ return worldObj.getCurrentMoonPhaseFactorBody(); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public Vec3 getSkyColor(net.minecraft.entity.Entity cameraEntity, float partialTicks) -+ { -+ return worldObj.getSkyColorBody(cameraEntity, partialTicks); -+ } -+ -+ @SideOnly(Side.CLIENT) -+ public Vec3 drawClouds(float partialTicks) -+ { -+ return worldObj.drawCloudsBody(partialTicks); -+ } -+ -+ /** -+ * Gets the Sun Brightness for rendering sky. -+ * */ -+ @SideOnly(Side.CLIENT) -+ public float getSunBrightness(float par1) -+ { -+ return worldObj.getSunBrightnessBody(par1); -+ } -+ -+ /** -+ * Gets the Star Brightness for rendering sky. -+ * */ -+ @SideOnly(Side.CLIENT) -+ public float getStarBrightness(float par1) -+ { -+ return worldObj.getStarBrightnessBody(par1); -+ } -+ -+ public void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful) -+ { -+ worldObj.spawnHostileMobs = allowHostile; -+ worldObj.spawnPeacefulMobs = allowPeaceful; -+ } -+ -+ public void calculateInitialWeather() -+ { -+ worldObj.calculateInitialWeatherBody(); -+ } -+ -+ public void updateWeather() -+ { -+ worldObj.updateWeatherBody(); -+ } -+ -+ public boolean canBlockFreeze(BlockPos pos, boolean byWater) -+ { -+ return worldObj.canBlockFreezeBody(pos, byWater); -+ } -+ -+ public boolean canSnowAt(BlockPos pos, boolean checkLight) -+ { -+ return worldObj.canSnowAtBody(pos, checkLight); -+ } -+ public void setWorldTime(long time) -+ { -+ worldObj.worldInfo.setWorldTime(time); -+ } -+ -+ public long getSeed() -+ { -+ return worldObj.worldInfo.getSeed(); -+ } -+ -+ public long getWorldTime() -+ { -+ return worldObj.worldInfo.getWorldTime(); -+ } -+ -+ public BlockPos getSpawnPoint() -+ { -+ net.minecraft.world.storage.WorldInfo info = worldObj.worldInfo; -+ return new BlockPos(info.getSpawnX(), info.getSpawnY(), info.getSpawnZ()); -+ } -+ -+ public void setSpawnPoint(BlockPos pos) -+ { -+ worldObj.worldInfo.setSpawn(pos); -+ } -+ -+ public boolean canMineBlock(net.minecraft.entity.player.EntityPlayer player, BlockPos pos) -+ { -+ return worldObj.canMineBlockBody(player, pos); -+ } -+ -+ public boolean isBlockHighHumidity(BlockPos pos) -+ { -+ return worldObj.getBiomeGenForCoords(pos).isHighHumidity(); -+ } -+ -+ public int getHeight() -+ { -+ return 256; -+ } -+ -+ public int getActualHeight() -+ { -+ return hasNoSky ? 128 : 256; -+ } -+ -+ public double getHorizon() -+ { -+ return worldObj.worldInfo.getTerrainType().getHorizon(worldObj); -+ } -+ -+ public void resetRainAndThunder() -+ { -+ worldObj.worldInfo.setRainTime(0); -+ worldObj.worldInfo.setRaining(false); -+ worldObj.worldInfo.setThunderTime(0); -+ worldObj.worldInfo.setThundering(false); -+ } -+ -+ public boolean canDoLightning(net.minecraft.world.chunk.Chunk chunk) -+ { -+ return true; -+ } -+ -+ public boolean canDoRainSnowIce(net.minecraft.world.chunk.Chunk chunk) -+ { -+ return true; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch deleted file mode 100644 index f403791da..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/WorldServer.java.patch +++ /dev/null @@ -1,257 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/WorldServer.java -+++ ../src-work/minecraft/net/minecraft/world/WorldServer.java -@@ -94,30 +94,46 @@ - private List pendingTickListEntriesThisTick = Lists.newArrayList(); - private static final String __OBFID = "CL_00001437"; - -+ /** Stores the recently processed (lighting) chunks */ -+ protected Set doneChunks = new java.util.HashSet(); -+ public List customTeleporters = new ArrayList(); -+ private static boolean initChest = false; -+ public static void fillChestHook() -+ { -+ if (!initChest) -+ net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.BONUS_CHEST, bonusChestContent, 10, 10); -+ initChest = true; -+ } -+ - public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn) - { - super(saveHandlerIn, info, WorldProvider.getProviderForDimension(dimensionId), profilerIn, false); - this.mcServer = server; - this.theEntityTracker = new EntityTracker(this); - this.thePlayerManager = new PlayerManager(this); -+ // Guarantee the dimension ID was not reset by the provider -+ int providerDim = this.provider.dimensionId; - this.provider.registerWorld(this); -+ this.provider.dimensionId = providerDim; - this.chunkProvider = this.createChunkProvider(); -+ perWorldStorage = new MapStorage(new net.minecraftforge.common.WorldSpecificSaveHandler((WorldServer)this, saveHandlerIn)); - this.worldTeleporter = new Teleporter(this); - this.calculateInitialSkylight(); - this.calculateInitialWeather(); - this.getWorldBorder().setSize(server.getMaxWorldSize()); -+ net.minecraftforge.common.DimensionManager.setWorld(dimensionId, this); - } - - public World init() - { - this.mapStorage = new MapStorage(this.saveHandler); - String s = VillageCollection.fileNameForProvider(this.provider); -- VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s); -+ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.loadData(VillageCollection.class, s); - - if (villagecollection == null) - { - this.villageCollectionObj = new VillageCollection(this); -- this.mapStorage.setData(s, this.villageCollectionObj); -+ this.perWorldStorage.setData(s, this.villageCollectionObj); - } - else - { -@@ -210,6 +226,10 @@ - this.villageSiege.tick(); - this.theProfiler.endStartSection("portalForcer"); - this.worldTeleporter.removeStalePortalLocations(this.getTotalWorldTime()); -+ for (Teleporter tele : customTeleporters) -+ { -+ tele.removeStalePortalLocations(getTotalWorldTime()); -+ } - this.theProfiler.endSection(); - this.sendQueuedBlockEvents(); - } -@@ -217,6 +237,7 @@ - public BiomeGenBase.SpawnListEntry func_175734_a(EnumCreatureType p_175734_1_, BlockPos p_175734_2_) - { - List list = this.getChunkProvider().func_177458_a(p_175734_1_, p_175734_2_); -+ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(this, p_175734_1_, p_175734_2_, list); - return list != null && !list.isEmpty() ? (BiomeGenBase.SpawnListEntry)WeightedRandom.getRandomItem(this.rand, list) : null; - } - -@@ -274,10 +295,7 @@ - - private void resetRainAndThunder() - { -- this.worldInfo.setRainTime(0); -- this.worldInfo.setRaining(false); -- this.worldInfo.setThunderTime(0); -- this.worldInfo.setThundering(false); -+ this.provider.resetRainAndThunder(); - } - - public boolean areAllPlayersAsleep() -@@ -367,7 +385,7 @@ - int i1; - BlockPos blockpos; - -- if (this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) -+ if (this.provider.canDoLightning(chunk) && this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) - { - this.updateLCG = this.updateLCG * 3 + 1013904223; - i1 = this.updateLCG >> 2; -@@ -381,7 +399,7 @@ - - this.theProfiler.endStartSection("iceandsnow"); - -- if (this.rand.nextInt(16) == 0) -+ if (this.provider.canDoRainSnowIce(chunk) && this.rand.nextInt(16) == 0) - { - this.updateLCG = this.updateLCG * 3 + 1013904223; - i1 = this.updateLCG >> 2; -@@ -483,6 +501,9 @@ - if (p_175654_2_.requiresUpdates()) - { - b0 = 8; -+ //Keeping here as a note for future when it may be restored. -+ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.position.getX() >> 4, nextticklistentry.position.getZ() >> 4)); -+ b0 = (byte)(isForced ? 0 : 8); - - if (this.isAreaLoaded(nextticklistentry.position.add(-b0, -b0, -b0), nextticklistentry.position.add(b0, b0, b0))) - { -@@ -535,7 +556,7 @@ - - public void updateEntities() - { -- if (this.playerEntities.isEmpty()) -+ if (this.playerEntities.isEmpty() && getPersistentChunks().isEmpty()) - { - if (this.updateEntityTick++ >= 1200) - { -@@ -601,6 +622,9 @@ - { - nextticklistentry = (NextTickListEntry)iterator.next(); - iterator.remove(); -+ //Keeping here as a note for future when it may be restored. -+ //boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.xCoord >> 4, nextticklistentry.zCoord >> 4)); -+ //byte b0 = isForced ? 0 : 8; - byte b0 = 0; - - if (this.isAreaLoaded(nextticklistentry.position.add(-b0, -b0, -b0), nextticklistentry.position.add(b0, b0, b0))) -@@ -729,14 +753,29 @@ - { - ArrayList arraylist = Lists.newArrayList(); - -- for (int k1 = 0; k1 < this.loadedTileEntityList.size(); ++k1) -+ //Forge: Optomize this loop to only grab from the chunks it needs -+ for (int x = (p_147486_1_ >> 4); x <= (p_147486_4_ >> 4); x++) - { -- TileEntity tileentity = (TileEntity)this.loadedTileEntityList.get(k1); -- BlockPos blockpos = tileentity.getPos(); -- -- if (blockpos.getX() >= p_147486_1_ && blockpos.getY() >= p_147486_2_ && blockpos.getZ() >= p_147486_3_ && blockpos.getX() < p_147486_4_ && blockpos.getY() < p_147486_5_ && blockpos.getZ() < p_147486_6_) -+ for (int z = (p_147486_3_ >> 4); z <= (p_147486_6_ >> 4); z++) - { -- arraylist.add(tileentity); -+ Chunk chunk = this.getChunkFromChunkCoords(x, z); -+ if (chunk != null) -+ { -+ for (Object obj : chunk.getTileEntityMap().values()) -+ { -+ TileEntity entity = (TileEntity)obj; -+ if (!entity.isInvalid()) -+ { -+ BlockPos pos = entity.getPos(); -+ if (pos.getX() >= p_147486_1_ && pos.getY() >= p_147486_2_ && pos.getZ() >= p_147486_3_ && -+ pos.getX() <= p_147486_4_ && pos.getY() <= p_147486_5_ && pos.getZ() <= p_147486_6_) -+ { -+ arraylist.add(entity); -+ } -+ -+ } -+ } -+ } - } - } - -@@ -745,6 +784,10 @@ - - public boolean isBlockModifiable(EntityPlayer player, BlockPos pos) - { -+ return super.isBlockModifiable(player, pos); -+ } -+ public boolean canMineBlockBody(EntityPlayer player, BlockPos pos) -+ { - return !this.mcServer.isBlockProtected(this, pos, player) && this.getWorldBorder().contains(pos); - } - -@@ -810,6 +853,7 @@ - } - else - { -+ if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(this, p_73052_1_)) return; - this.findingSpawnPoint = true; - WorldChunkManager worldchunkmanager = this.provider.getWorldChunkManager(); - List list = worldchunkmanager.getBiomesToSpawnIn(); -@@ -855,7 +899,7 @@ - - protected void createBonusChest() - { -- WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(bonusChestContent, 10); -+ WorldGeneratorBonusChest worldgeneratorbonuschest = net.minecraftforge.common.ForgeHooks.getBonusChest(rand); - - for (int i = 0; i < 10; ++i) - { -@@ -892,6 +936,7 @@ - } - - this.chunkProvider.saveChunks(p_73044_1_, p_73044_2_); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this)); - List list = this.theChunkProviderServer.func_152380_a(); - Iterator iterator = list.iterator(); - -@@ -929,6 +974,7 @@ - this.worldInfo.setBorderLerpTime(this.getWorldBorder().getTimeUntilTarget()); - this.saveHandler.saveWorldInfoWithPlayer(this.worldInfo, this.mcServer.getConfigurationManager().getHostPlayerData()); - this.mapStorage.saveAllData(); -+ this.perWorldStorage.saveAllData(); - } - - public void onEntityAdded(Entity p_72923_1_) -@@ -984,6 +1030,7 @@ - public Explosion newExplosion(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) - { - Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_); -+ if (net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this, explosion)) return explosion; - explosion.doExplosionA(); - explosion.doExplosionB(false); - -@@ -1074,19 +1121,23 @@ - this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.getDimensionId()); - } - -+ /* 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.isRaining()) - { - if (flag) - { -- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(2, 0.0F)); -+ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(2, 0.0F), this.provider.dimensionId); - } - else - { -- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(1, 0.0F)); -+ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(1, 0.0F), this.provider.dimensionId); - } - -- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(7, this.rainingStrength)); -- this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(8, this.thunderingStrength)); -+ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId); -+ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId); - } - } - -@@ -1152,6 +1203,11 @@ - return this.mcServer.isCallingFromMinecraftThread(); - } - -+ public java.io.File getChunkSaveLocation() -+ { -+ return ((net.minecraft.world.chunk.storage.AnvilChunkLoader)theChunkProviderServer.chunkLoader).chunkSaveLocation; -+ } -+ - static class ServerBlockEventList extends ArrayList - { - private static final String __OBFID = "CL_00001439"; diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldServerMulti.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldServerMulti.java.patch deleted file mode 100644 index f1d3cd163..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/WorldServerMulti.java.patch +++ /dev/null @@ -1,62 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/WorldServerMulti.java -+++ ../src-work/minecraft/net/minecraft/world/WorldServerMulti.java -@@ -11,13 +11,14 @@ - public class WorldServerMulti extends WorldServer - { - private WorldServer delegate; -+ private IBorderListener borderListener; - private static final String __OBFID = "CL_00001430"; - - public WorldServerMulti(MinecraftServer server, ISaveHandler saveHandlerIn, int dimensionId, WorldServer delegate, Profiler profilerIn) - { - super(server, saveHandlerIn, new DerivedWorldInfo(delegate.getWorldInfo()), dimensionId, profilerIn); - this.delegate = delegate; -- delegate.getWorldBorder().addListener(new IBorderListener() -+ this.borderListener = new IBorderListener() - { - private static final String __OBFID = "CL_00002273"; - public void onSizeChanged(WorldBorder border, double newSize) -@@ -48,22 +49,26 @@ - { - WorldServerMulti.this.getWorldBorder().setDamageBuffer(newSize); - } -- }); -+ }; -+ this.delegate.getWorldBorder().addListener(this.borderListener); - } - -- protected void saveLevel() throws MinecraftException {} -+ protected void saveLevel() throws MinecraftException -+ { -+ this.perWorldStorage.saveAllData(); -+ } - - public World init() - { - this.mapStorage = this.delegate.getMapStorage(); - this.worldScoreboard = this.delegate.getScoreboard(); - String s = VillageCollection.fileNameForProvider(this.provider); -- VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s); -+ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.loadData(VillageCollection.class, s); - - if (villagecollection == null) - { - this.villageCollectionObj = new VillageCollection(this); -- this.mapStorage.setData(s, this.villageCollectionObj); -+ this.perWorldStorage.setData(s, this.villageCollectionObj); - } - else - { -@@ -73,4 +78,12 @@ - - return this; - } -+ -+ -+ @Override -+ public void flush() -+ { -+ super.flush(); -+ this.delegate.getWorldBorder().removeListener(this.borderListener); // Unlink ourselves, to prevent world leak. -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch b/patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch deleted file mode 100644 index e5e993721..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/WorldType.java.patch +++ /dev/null @@ -1,170 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/WorldType.java -+++ ../src-work/minecraft/net/minecraft/world/WorldType.java -@@ -1,5 +1,14 @@ - package net.minecraft.world; - -+import java.util.Arrays; -+import net.minecraft.client.Minecraft; -+import net.minecraft.client.gui.GuiCreateFlatWorld; -+import net.minecraft.client.gui.GuiCreateWorld; -+import net.minecraft.client.gui.GuiCustomizeWorldScreen; -+import net.minecraft.world.gen.layer.GenLayer; -+import net.minecraft.world.gen.layer.GenLayerBiome; -+import net.minecraft.world.gen.layer.GenLayerBiomeEdge; -+import net.minecraft.world.gen.layer.GenLayerZoom; - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - -@@ -28,6 +37,7 @@ - - private WorldType(int id, String name, int version) - { -+ if (name.length() > 16 && DEBUG_WORLD != null) throw new IllegalArgumentException("World type names must not be longer then 16: " + name); - this.worldType = name; - this.generatorVersion = version; - this.canBeCreated = true; -@@ -114,4 +124,144 @@ - this.hasNotificationData = true; - return this; - } -+ -+ public net.minecraft.world.biome.WorldChunkManager getChunkManager(World world) -+ { -+ if (this == FLAT) -+ { -+ net.minecraft.world.gen.FlatGeneratorInfo flatgeneratorinfo = net.minecraft.world.gen.FlatGeneratorInfo.createFlatGeneratorFromString(world.getWorldInfo().getGeneratorOptions()); -+ return new net.minecraft.world.biome.WorldChunkManagerHell(net.minecraft.world.biome.BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), net.minecraft.world.biome.BiomeGenBase.field_180279_ad), 0.5F); -+ } -+ else if (this == DEBUG_WORLD) -+ { -+ return new net.minecraft.world.biome.WorldChunkManagerHell(net.minecraft.world.biome.BiomeGenBase.plains, 0.0F); -+ } -+ else -+ { -+ return new net.minecraft.world.biome.WorldChunkManager(world); -+ } -+ } -+ -+ public net.minecraft.world.chunk.IChunkProvider getChunkGenerator(World world, String generatorOptions) -+ { -+ if (this == FLAT) return new net.minecraft.world.gen.ChunkProviderFlat(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions); -+ if (this == DEBUG_WORLD) return new net.minecraft.world.gen.ChunkProviderDebug(world); -+ return new net.minecraft.world.gen.ChunkProviderGenerate(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions); -+ } -+ -+ public int getMinimumSpawnHeight(World world) -+ { -+ return this == FLAT ? 4 : 64; -+ } -+ -+ public double getHorizon(World world) -+ { -+ return this == FLAT ? 0.0D : 63.0D; -+ } -+ -+ public double voidFadeMagnitude() -+ { -+ return this == FLAT ? 1.0D : 0.03125D; -+ } -+ -+ public boolean handleSlimeSpawnReduction(java.util.Random random, World world) -+ { -+ return this == FLAT ? random.nextInt(4) != 1 : false; -+ } -+ -+ /*=================================================== FORGE START ======================================*/ -+ private static int getNextID() -+ { -+ for (int x = 0; x < worldTypes.length; x++) -+ { -+ if (worldTypes[x] == null) -+ { -+ return x; -+ } -+ } -+ -+ int oldLen = worldTypes.length; -+ worldTypes = Arrays.copyOf(worldTypes, oldLen + 16); -+ return oldLen; -+ } -+ -+ /** -+ * Creates a new world type, the ID is hidden and should not be referenced by modders. -+ * It will automatically expand the underlying workdType array if there are no IDs left. -+ * @param name -+ */ -+ public WorldType(String name) -+ { -+ this(getNextID(), name); -+ } -+ -+ /** -+ * Called when 'Create New World' button is pressed before starting game -+ */ -+ public void onGUICreateWorldPress() { } -+ -+ /** -+ * Gets the spawn fuzz for players who join the world. -+ * Useful for void world types. -+ * @return Fuzz for entity initial spawn in blocks. -+ */ -+ public int getSpawnFuzz() -+ { -+ return Math.max(5, net.minecraft.server.MinecraftServer.getServer().getSpawnProtectionSize() - 6); -+ } -+ -+ /** -+ * Called when the 'Customize' button is pressed on world creation GUI -+ * @param mc The Minecraft instance -+ * @param guiCreateWorld the createworld GUI -+ */ -+ @SideOnly(Side.CLIENT) -+ public void onCustomizeButton(Minecraft mc, GuiCreateWorld guiCreateWorld) -+ { -+ if (this == WorldType.FLAT) -+ { -+ mc.displayGuiScreen(new GuiCreateFlatWorld(guiCreateWorld, guiCreateWorld.chunkProviderSettingsJson)); -+ } -+ else if (this == WorldType.CUSTOMIZED) -+ { -+ mc.displayGuiScreen(new GuiCustomizeWorldScreen(guiCreateWorld, guiCreateWorld.chunkProviderSettingsJson)); -+ } -+ } -+ -+ /** -+ * Should world creation GUI show 'Customize' button for this world type? -+ * @return if this world type has customization parameters -+ */ -+ public boolean isCustomizable() -+ { -+ return this == FLAT || this == WorldType.CUSTOMIZED; -+ } -+ -+ -+ /** -+ * Get the height to render the clouds for this world type -+ * @return The height to render clouds at -+ */ -+ public float getCloudHeight() -+ { -+ return 128.0F; -+ } -+ -+ /** -+ * Creates the GenLayerBiome used for generating the world with the specified ChunkProviderSettings JSON String -+ * *IF AND ONLY IF* this WorldType == WorldType.CUSTOMIZED. -+ * -+ * -+ * @param worldSeed The world seed -+ * @param parentLayer The parent layer to feed into any layer you return -+ * @param chunkProviderSettingsJson The JSON string to use when initializing ChunkProviderSettings.Factory -+ * @return A GenLayer that will return ints representing the Biomes to be generated, see GenLayerBiome -+ */ -+ public GenLayer getBiomeLayer(long worldSeed, GenLayer parentLayer, String chunkProviderSettingsJson) -+ { -+ GenLayer ret = new GenLayerBiome(200L, parentLayer, this, chunkProviderSettingsJson); -+ ret = GenLayerZoom.magnify(1000L, ret, 2); -+ ret = new GenLayerBiomeEdge(1000L, ret); -+ return ret; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch deleted file mode 100644 index 2006f5b38..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeColorHelper.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeColorHelper.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeColorHelper.java -@@ -30,7 +30,7 @@ - private static final String __OBFID = "CL_00002146"; - public int getColorAtPos(BiomeGenBase p_180283_1_, BlockPos blockPosition) - { -- return p_180283_1_.waterColorMultiplier; -+ return p_180283_1_.getWaterColorMultiplier(); - } - }; - private static final String __OBFID = "CL_00002149"; diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch deleted file mode 100644 index 2ce959e0f..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch +++ /dev/null @@ -1,267 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeDecorator.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeDecorator.java -@@ -23,6 +23,11 @@ - import net.minecraft.world.gen.feature.WorldGenWaterlily; - import net.minecraft.world.gen.feature.WorldGenerator; - -+import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.*; -+import static net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.*; -+import net.minecraftforge.common.*; -+import net.minecraftforge.event.terraingen.*; -+ - public class BiomeDecorator - { - public World currentWorld; -@@ -125,26 +130,30 @@ - - protected void genDecorations(BiomeGenBase p_150513_1_) - { -+ MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(currentWorld, randomGenerator, field_180294_c)); - this.generateOres(); - int i; - int j; - int k; - -- for (i = 0; i < this.sandPerChunk2; ++i) -+ boolean doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, SAND); -+ for (i = 0; doGen && i < this.sandPerChunk2; ++i) - { - j = this.randomGenerator.nextInt(16) + 8; - k = this.randomGenerator.nextInt(16) + 8; - this.sandGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getTopSolidOrLiquidBlock(this.field_180294_c.add(j, 0, k))); - } - -- for (i = 0; i < this.clayPerChunk; ++i) -+ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, CLAY); -+ for (i = 0; doGen && i < this.clayPerChunk; ++i) - { - j = this.randomGenerator.nextInt(16) + 8; - k = this.randomGenerator.nextInt(16) + 8; - this.clayGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getTopSolidOrLiquidBlock(this.field_180294_c.add(j, 0, k))); - } - -- for (i = 0; i < this.sandPerChunk; ++i) -+ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, SAND_PASS2); -+ for (i = 0; doGen && i < this.sandPerChunk; ++i) - { - j = this.randomGenerator.nextInt(16) + 8; - k = this.randomGenerator.nextInt(16) + 8; -@@ -161,7 +170,8 @@ - int l; - BlockPos blockpos; - -- for (j = 0; j < i; ++j) -+ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, TREE); -+ for (j = 0; doGen && j < i; ++j) - { - k = this.randomGenerator.nextInt(16) + 8; - l = this.randomGenerator.nextInt(16) + 8; -@@ -175,7 +185,8 @@ - } - } - -- for (j = 0; j < this.bigMushroomsPerChunk; ++j) -+ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, BIG_SHROOM); -+ for (j = 0; doGen && j < this.bigMushroomsPerChunk; ++j) - { - k = this.randomGenerator.nextInt(16) + 8; - l = this.randomGenerator.nextInt(16) + 8; -@@ -184,11 +195,12 @@ - - int i1; - -- for (j = 0; j < this.flowersPerChunk; ++j) -+ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, FLOWERS); -+ for (j = 0; doGen && j < this.flowersPerChunk; ++j) - { - k = this.randomGenerator.nextInt(16) + 8; - l = this.randomGenerator.nextInt(16) + 8; -- i1 = this.randomGenerator.nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() + 32); -+ i1 = nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() + 32); - blockpos = this.field_180294_c.add(k, i1, l); - BlockFlower.EnumFlowerType enumflowertype = p_150513_1_.pickRandomFlower(this.randomGenerator, blockpos); - BlockFlower blockflower = enumflowertype.getBlockType().getBlock(); -@@ -200,29 +212,32 @@ - } - } - -- for (j = 0; j < this.grassPerChunk; ++j) -+ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, GRASS); -+ for (j = 0; doGen && j < this.grassPerChunk; ++j) - { - k = this.randomGenerator.nextInt(16) + 8; - l = this.randomGenerator.nextInt(16) + 8; -- i1 = this.randomGenerator.nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); -+ i1 = nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); - p_150513_1_.getRandomWorldGenForGrass(this.randomGenerator).generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(k, i1, l)); - } - -- for (j = 0; j < this.deadBushPerChunk; ++j) -+ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, DEAD_BUSH); -+ for (j = 0; doGen && j < this.deadBushPerChunk; ++j) - { - k = this.randomGenerator.nextInt(16) + 8; - l = this.randomGenerator.nextInt(16) + 8; -- i1 = this.randomGenerator.nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); -+ i1 = nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); - (new WorldGenDeadBush()).generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(k, i1, l)); - } - - j = 0; - -- while (j < this.waterlilyPerChunk) -+ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, LILYPAD); -+ while (doGen && j < this.waterlilyPerChunk) - { - k = this.randomGenerator.nextInt(16) + 8; - l = this.randomGenerator.nextInt(16) + 8; -- i1 = this.randomGenerator.nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); -+ i1 = nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); - blockpos = this.field_180294_c.add(k, i1, l); - - while (true) -@@ -244,7 +259,8 @@ - } - } - -- for (j = 0; j < this.mushroomsPerChunk; ++j) -+ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, SHROOM); -+ for (j = 0; doGen && j < this.mushroomsPerChunk; ++j) - { - if (this.randomGenerator.nextInt(4) == 0) - { -@@ -258,57 +274,60 @@ - { - k = this.randomGenerator.nextInt(16) + 8; - l = this.randomGenerator.nextInt(16) + 8; -- i1 = this.randomGenerator.nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); -+ i1 = nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); - blockpos = this.field_180294_c.add(k, i1, l); - this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, blockpos); - } - } - -- if (this.randomGenerator.nextInt(4) == 0) -+ if (doGen && this.randomGenerator.nextInt(4) == 0) - { - j = this.randomGenerator.nextInt(16) + 8; - k = this.randomGenerator.nextInt(16) + 8; -- l = this.randomGenerator.nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(j, 0, k)).getY() * 2); -+ l = nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(j, 0, k)).getY() * 2); - this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(j, l, k)); - } - -- if (this.randomGenerator.nextInt(8) == 0) -+ if (doGen && this.randomGenerator.nextInt(8) == 0) - { - j = this.randomGenerator.nextInt(16) + 8; - k = this.randomGenerator.nextInt(16) + 8; -- l = this.randomGenerator.nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(j, 0, k)).getY() * 2); -+ l = nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(j, 0, k)).getY() * 2); - this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(j, l, k)); - } - -- for (j = 0; j < this.reedsPerChunk; ++j) -+ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, REED); -+ for (j = 0; doGen && j < this.reedsPerChunk; ++j) - { - k = this.randomGenerator.nextInt(16) + 8; - l = this.randomGenerator.nextInt(16) + 8; -- i1 = this.randomGenerator.nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); -+ i1 = nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); - this.reedGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(k, i1, l)); - } - -- for (j = 0; j < 10; ++j) -+ for (j = 0; doGen && j < 10; ++j) - { - k = this.randomGenerator.nextInt(16) + 8; - l = this.randomGenerator.nextInt(16) + 8; -- i1 = this.randomGenerator.nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); -+ i1 = nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); - this.reedGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(k, i1, l)); - } - -- if (this.randomGenerator.nextInt(32) == 0) -+ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, PUMPKIN); -+ if (doGen && this.randomGenerator.nextInt(32) == 0) - { - j = this.randomGenerator.nextInt(16) + 8; - k = this.randomGenerator.nextInt(16) + 8; -- l = this.randomGenerator.nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(j, 0, k)).getY() * 2); -+ l = nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(j, 0, k)).getY() * 2); - (new WorldGenPumpkin()).generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(j, l, k)); - } - -- for (j = 0; j < this.cactiPerChunk; ++j) -+ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, CACTUS); -+ for (j = 0; doGen && j < this.cactiPerChunk; ++j) - { - k = this.randomGenerator.nextInt(16) + 8; - l = this.randomGenerator.nextInt(16) + 8; -- i1 = this.randomGenerator.nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); -+ i1 = nextInt(this.currentWorld.getHorizon(this.field_180294_c.add(k, 0, l)).getY() * 2); - this.cactusGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(k, i1, l)); - } - -@@ -316,18 +335,22 @@ - { - BlockPos blockpos1; - -- for (j = 0; j < 50; ++j) -+ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, LAKE_WATER); -+ for (j = 0; doGen && j < 50; ++j) - { - blockpos1 = this.field_180294_c.add(this.randomGenerator.nextInt(16) + 8, this.randomGenerator.nextInt(this.randomGenerator.nextInt(248) + 8), this.randomGenerator.nextInt(16) + 8); - (new WorldGenLiquids(Blocks.flowing_water)).generate(this.currentWorld, this.randomGenerator, blockpos1); - } - -- for (j = 0; j < 20; ++j) -+ doGen = TerrainGen.decorate(currentWorld, randomGenerator, field_180294_c, LAKE_LAVA); -+ for (j = 0; doGen && j < 20; ++j) - { - blockpos1 = this.field_180294_c.add(this.randomGenerator.nextInt(16) + 8, this.randomGenerator.nextInt(this.randomGenerator.nextInt(this.randomGenerator.nextInt(240) + 8) + 8), this.randomGenerator.nextInt(16) + 8); - (new WorldGenLiquids(Blocks.flowing_lava)).generate(this.currentWorld, this.randomGenerator, blockpos1); - } - } -+ -+ MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(currentWorld, randomGenerator, field_180294_c)); - } - - protected void genStandardOre1(int p_76795_1_, WorldGenerator p_76795_2_, int p_76795_3_, int p_76795_4_) -@@ -370,16 +393,35 @@ - - protected void generateOres() - { -+ MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Pre(currentWorld, randomGenerator, field_180294_c)); -+ if (TerrainGen.generateOre(currentWorld, randomGenerator, dirtGen, field_180294_c, DIRT)) - this.genStandardOre1(this.chunkProviderSettings.dirtCount, this.dirtGen, this.chunkProviderSettings.dirtMinHeight, this.chunkProviderSettings.dirtMaxHeight); -+ if (TerrainGen.generateOre(currentWorld, randomGenerator, gravelGen, field_180294_c, GRAVEL)) - this.genStandardOre1(this.chunkProviderSettings.gravelCount, this.gravelGen, this.chunkProviderSettings.gravelMinHeight, this.chunkProviderSettings.gravelMaxHeight); -+ if (TerrainGen.generateOre(currentWorld, randomGenerator, dioriteGen, field_180294_c, DIORITE)) - this.genStandardOre1(this.chunkProviderSettings.dioriteCount, this.dioriteGen, this.chunkProviderSettings.dioriteMinHeight, this.chunkProviderSettings.dioriteMaxHeight); -+ if (TerrainGen.generateOre(currentWorld, randomGenerator, graniteGen, field_180294_c, GRANITE)) - this.genStandardOre1(this.chunkProviderSettings.graniteCount, this.graniteGen, this.chunkProviderSettings.graniteMinHeight, this.chunkProviderSettings.graniteMaxHeight); -+ if (TerrainGen.generateOre(currentWorld, randomGenerator, andesiteGen, field_180294_c, ANDESITE)) - this.genStandardOre1(this.chunkProviderSettings.andesiteCount, this.andesiteGen, this.chunkProviderSettings.andesiteMinHeight, this.chunkProviderSettings.andesiteMaxHeight); -+ if (TerrainGen.generateOre(currentWorld, randomGenerator, coalGen, field_180294_c, COAL)) - this.genStandardOre1(this.chunkProviderSettings.coalCount, this.coalGen, this.chunkProviderSettings.coalMinHeight, this.chunkProviderSettings.coalMaxHeight); -+ if (TerrainGen.generateOre(currentWorld, randomGenerator, ironGen, field_180294_c, IRON)) - this.genStandardOre1(this.chunkProviderSettings.ironCount, this.ironGen, this.chunkProviderSettings.ironMinHeight, this.chunkProviderSettings.ironMaxHeight); -+ if (TerrainGen.generateOre(currentWorld, randomGenerator, goldGen, field_180294_c, GOLD)) - this.genStandardOre1(this.chunkProviderSettings.goldCount, this.goldGen, this.chunkProviderSettings.goldMinHeight, this.chunkProviderSettings.goldMaxHeight); -+ if (TerrainGen.generateOre(currentWorld, randomGenerator, redstoneGen, field_180294_c, REDSTONE)) - this.genStandardOre1(this.chunkProviderSettings.redstoneCount, this.redstoneGen, this.chunkProviderSettings.redstoneMinHeight, this.chunkProviderSettings.redstoneMaxHeight); -+ if (TerrainGen.generateOre(currentWorld, randomGenerator, diamondGen, field_180294_c, DIAMOND)) - this.genStandardOre1(this.chunkProviderSettings.diamondCount, this.diamondGen, this.chunkProviderSettings.diamondMinHeight, this.chunkProviderSettings.diamondMaxHeight); -+ if (TerrainGen.generateOre(currentWorld, randomGenerator, lapisGen, field_180294_c, LAPIS)) - this.genStandardOre2(this.chunkProviderSettings.lapisCount, this.lapisGen, this.chunkProviderSettings.lapisCenterHeight, this.chunkProviderSettings.lapisSpread); -+ MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Post(currentWorld, randomGenerator, field_180294_c)); - } -+ -+ private int nextInt(int i) { //Safety wrapper to prevent exceptions. -+ if (i <= 1) -+ return 0; -+ return this.randomGenerator.nextInt(i); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch deleted file mode 100644 index 7b45e807f..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch +++ /dev/null @@ -1,148 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenBase.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenBase.java -@@ -50,6 +50,9 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - -+import net.minecraftforge.common.*; -+import net.minecraftforge.event.terraingen.*; -+ - public abstract class BiomeGenBase - { - private static final Logger logger = LogManager.getLogger(); -@@ -139,6 +142,10 @@ - - public BiomeGenBase(int p_i1971_1_) - { -+ this(p_i1971_1_, true); -+ } -+ public BiomeGenBase(int p_i1971_1_, boolean register) -+ { - this.topBlock = Blocks.grass.getDefaultState(); - this.fillerBlock = Blocks.dirt.getDefaultState(); - this.fillerBlockMetadata = 5169201; -@@ -156,6 +163,7 @@ - this.worldGeneratorBigTree = new WorldGenBigTree(false); - this.worldGeneratorSwamp = new WorldGenSwamp(); - this.biomeID = p_i1971_1_; -+ if (register) - biomeList[p_i1971_1_] = this; - this.theBiomeDecorator = this.createBiomeDecorator(); - this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySheep.class, 12, 4, 4)); -@@ -172,11 +180,12 @@ - this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityWitch.class, 5, 1, 1)); - this.spawnableWaterCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySquid.class, 10, 4, 4)); - this.spawnableCaveCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 10, 8, 8)); -+ this.addDefaultFlowers(); - } - - public BiomeDecorator createBiomeDecorator() - { -- return new BiomeDecorator(); -+ return getModdedBiomeDecorator(new BiomeDecorator()); - } - - public BiomeGenBase setTemperatureRainfall(float p_76732_1_, float p_76732_2_) -@@ -346,7 +355,7 @@ - { - double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(p_180627_1_), 0.0F, 1.0F); - double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); -- return ColorizerGrass.getGrassColor(d0, d1); -+ return getModdedBiomeGrassColor(ColorizerGrass.getGrassColor(d0, d1)); - } - - @SideOnly(Side.CLIENT) -@@ -354,7 +363,7 @@ - { - double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(p_180625_1_), 0.0F, 1.0F); - double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); -- return ColorizerFoliage.getFoliageColor(d0, d1); -+ return getModdedBiomeFoliageColor(ColorizerFoliage.getFoliageColor(d0, d1)); - } - - public boolean isSnowyBiome() -@@ -500,6 +509,84 @@ - } - } - -+ /* ========================================= FORGE START ======================================*/ -+ protected List flowers = new java.util.ArrayList(); -+ -+ public BiomeDecorator getModdedBiomeDecorator(BiomeDecorator original) -+ { -+ return new DeferredBiomeDecorator(original); -+ } -+ -+ public int getWaterColorMultiplier() -+ { -+ BiomeEvent.GetWaterColor event = new BiomeEvent.GetWaterColor(this, waterColorMultiplier); -+ MinecraftForge.EVENT_BUS.post(event); -+ return event.newColor; -+ } -+ -+ public int getModdedBiomeGrassColor(int original) -+ { -+ BiomeEvent.GetGrassColor event = new BiomeEvent.GetGrassColor(this, original); -+ MinecraftForge.EVENT_BUS.post(event); -+ return event.newColor; -+ } -+ -+ public int getModdedBiomeFoliageColor(int original) -+ { -+ BiomeEvent.GetFoliageColor event = new BiomeEvent.GetFoliageColor(this, original); -+ MinecraftForge.EVENT_BUS.post(event); -+ return event.newColor; -+ } -+ -+ /** -+ * Weighted random holder class used to hold possible flowers -+ * that can spawn in this biome when bonemeal is used on grass. -+ */ -+ public static class FlowerEntry extends WeightedRandom.Item -+ { -+ public final net.minecraft.block.state.IBlockState state; -+ public FlowerEntry(net.minecraft.block.state.IBlockState state, int weight) -+ { -+ super(weight); -+ this.state = state; -+ } -+ } -+ -+ /** -+ * Adds the default flowers, as of 1.7, it is 2 yellow, and 1 red. I chose 10 to allow some wiggle room in the numbers. -+ */ -+ public void addDefaultFlowers() -+ { -+ addFlower(Blocks.yellow_flower.getDefaultState().withProperty(Blocks.yellow_flower.getTypeProperty(), BlockFlower.EnumFlowerType.DANDELION), 20); -+ addFlower(Blocks.red_flower.getDefaultState().withProperty(Blocks.red_flower.getTypeProperty(), BlockFlower.EnumFlowerType.POPPY), 20); -+ } -+ -+ /** Register a new plant to be planted when bonemeal is used on grass. -+ * @param state The block to place. -+ * @param weight The weight of the plant, where red flowers are -+ * 10 and yellow flowers are 20. -+ */ -+ public void addFlower(IBlockState state, int weight) -+ { -+ this.flowers.add(new FlowerEntry(state, weight)); -+ } -+ -+ public void plantFlower(World world, Random rand, BlockPos pos) -+ { -+ FlowerEntry flower = (FlowerEntry)WeightedRandom.getRandomItem(rand, flowers); -+ if (flower == null || flower.state == null || -+ (flower.state.getBlock() instanceof net.minecraft.block.BlockBush && -+ !((net.minecraft.block.BlockBush)flower.state.getBlock()).canBlockStay(world, pos, flower.state))) -+ { -+ return; -+ } -+ -+ world.setBlockState(pos, flower.state, 3); -+ } -+ -+ -+ /* ========================================= FORGE END ======================================*/ -+ - static - { - plains.createMutation(); diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch deleted file mode 100644 index 5d628a6e1..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenForest.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenForest.java -@@ -220,4 +220,20 @@ - }; - } - } -+ -+ @Override -+ public void addDefaultFlowers() -+ { -+ if (field_150632_aF != 1) -+ { -+ super.addDefaultFlowers(); -+ return; -+ } -+ for (BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) -+ { -+ if (type.getBlockType() == BlockFlower.EnumFlowerColor.YELLOW) continue; -+ if (type == BlockFlower.EnumFlowerType.BLUE_ORCHID) type = BlockFlower.EnumFlowerType.POPPY; -+ addFlower(net.minecraft.init.Blocks.red_flower.getDefaultState().withProperty(net.minecraft.init.Blocks.red_flower.getTypeProperty(), type), 10); -+ } -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch deleted file mode 100644 index 34bce4338..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenHills.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenHills.java -@@ -58,7 +58,7 @@ - int i1 = p_180624_2_.nextInt(16); - BlockPos blockpos1 = p_180624_3_.add(k, l, i1); - -- if (worldIn.getBlockState(blockpos1).getBlock() == Blocks.stone) -+ if (worldIn.getBlockState(blockpos1).getBlock().isReplaceableOreGen(worldIn, blockpos1, net.minecraft.block.state.pattern.BlockHelper.forBlock(Blocks.stone))) - { - worldIn.setBlockState(blockpos1, Blocks.emerald_ore.getDefaultState(), 2); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch deleted file mode 100644 index 80a4c94ec..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenJungle.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenJungle.java -@@ -61,7 +61,9 @@ - super.decorate(worldIn, p_180624_2_, p_180624_3_); - int i = p_180624_2_.nextInt(16) + 8; - int j = p_180624_2_.nextInt(16) + 8; -- int k = p_180624_2_.nextInt(worldIn.getHorizon(p_180624_3_.add(i, 0, j)).getY() * 2); -+ int height = worldIn.getHorizon(p_180624_3_.add(i, 0, j)).getY() * 2; // could == 0, which crashes nextInt -+ if (height < 1) height = 1; -+ int k = p_180624_2_.nextInt(height); - (new WorldGenMelon()).generate(worldIn, p_180624_2_, p_180624_3_.add(i, k, j)); - WorldGenVines worldgenvines = new WorldGenVines(); - diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch deleted file mode 100644 index ba1884cfb..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenPlains.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenPlains.java -@@ -109,4 +109,19 @@ - biomegenplains.field_150609_ah = 14273354; - return biomegenplains; - } -+ -+ @Override -+ public void addDefaultFlowers() -+ { -+ BlockFlower red = net.minecraft.init.Blocks.red_flower; -+ BlockFlower yel = net.minecraft.init.Blocks.yellow_flower; -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.ORANGE_TULIP), 3); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.RED_TULIP), 3); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.PINK_TULIP), 3); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.WHITE_TULIP), 3); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.POPPY), 20); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.HOUSTONIA), 20); -+ addFlower(red.getDefaultState().withProperty(red.getTypeProperty(), BlockFlower.EnumFlowerType.OXEYE_DAISY), 20); -+ addFlower(yel.getDefaultState().withProperty(yel.getTypeProperty(), BlockFlower.EnumFlowerType.DANDELION), 30); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch deleted file mode 100644 index c4cea2dc1..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java -+++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java -@@ -86,4 +86,10 @@ - { - return 6975545; - } -+ -+ @Override -+ public void addDefaultFlowers() -+ { -+ addFlower(Blocks.red_flower.getDefaultState().withProperty(Blocks.red_flower.getTypeProperty(), BlockFlower.EnumFlowerType.BLUE_ORCHID), 10); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch b/patches.mcp/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch deleted file mode 100644 index 4b2493b2f..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/biome/WorldChunkManager.java -+++ ../src-work/minecraft/net/minecraft/world/biome/WorldChunkManager.java -@@ -14,8 +14,13 @@ - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; - -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.terraingen.WorldTypeEvent; -+import static net.minecraft.world.biome.BiomeGenBase.*; -+ - public class WorldChunkManager - { -+ public static List allowedBiomes = Lists.newArrayList(forest, plains, taiga, taigaHills, forestHills, jungle, jungleHills); - private GenLayer genBiomes; - private GenLayer biomeIndexLayer; - private BiomeCache biomeCache; -@@ -28,13 +33,7 @@ - this.biomeCache = new BiomeCache(this); - this.field_180301_f = ""; - this.biomesToSpawnIn = Lists.newArrayList(); -- this.biomesToSpawnIn.add(BiomeGenBase.forest); -- this.biomesToSpawnIn.add(BiomeGenBase.plains); -- this.biomesToSpawnIn.add(BiomeGenBase.taiga); -- this.biomesToSpawnIn.add(BiomeGenBase.taigaHills); -- this.biomesToSpawnIn.add(BiomeGenBase.forestHills); -- this.biomesToSpawnIn.add(BiomeGenBase.jungle); -- this.biomesToSpawnIn.add(BiomeGenBase.jungleHills); -+ this.biomesToSpawnIn.addAll(allowedBiomes); - } - - public WorldChunkManager(long p_i45744_1_, WorldType p_i45744_3_, String p_i45744_4_) -@@ -42,6 +41,7 @@ - this(); - this.field_180301_f = p_i45744_4_; - GenLayer[] agenlayer = GenLayer.initializeAllBiomeGenerators(p_i45744_1_, p_i45744_3_, p_i45744_4_); -+ agenlayer = getModdedBiomeGenerators(p_i45744_3_, p_i45744_1_, agenlayer); - this.genBiomes = agenlayer[0]; - this.biomeIndexLayer = agenlayer[1]; - } -@@ -250,4 +250,11 @@ - { - this.biomeCache.cleanupCache(); - } -+ -+ public GenLayer[] getModdedBiomeGenerators(WorldType worldType, long seed, GenLayer[] original) -+ { -+ WorldTypeEvent.InitBiomeGens event = new WorldTypeEvent.InitBiomeGens(worldType, seed, original); -+ MinecraftForge.TERRAIN_GEN_BUS.post(event); -+ return event.newBiomeGens; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/border/WorldBorder.java.patch b/patches.mcp/minecraft/net/minecraft/world/border/WorldBorder.java.patch deleted file mode 100644 index ed0813c8b..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/border/WorldBorder.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/border/WorldBorder.java -+++ ../src-work/minecraft/net/minecraft/world/border/WorldBorder.java -@@ -293,4 +293,9 @@ - iborderlistener.onWarningDistanceChanged(this, warningDistance); - } - } -+ -+ public void removeListener(IBorderListener listener) -+ { -+ this.listeners.remove(listener); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch deleted file mode 100644 index 93c7472d8..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ /dev/null @@ -1,264 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/chunk/Chunk.java -+++ ../src-work/minecraft/net/minecraft/world/chunk/Chunk.java -@@ -35,6 +35,9 @@ - import net.minecraft.world.gen.ChunkProviderDebug; - import net.minecraftforge.fml.relauncher.Side; - import net.minecraftforge.fml.relauncher.SideOnly; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.entity.EntityEvent; -+import net.minecraftforge.event.world.ChunkEvent; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - -@@ -174,7 +177,7 @@ - { - Block block = this.getBlock0(j, l - 1, k); - -- if (block.getLightOpacity() == 0) -+ if (getBlockLightOpacity(j, l - 1, k) == 0) - { - --l; - continue; -@@ -469,12 +472,12 @@ - - public int getBlockLightOpacity(BlockPos pos) - { -- return this.getBlock(pos).getLightOpacity(); -+ return this.getBlock(pos).getLightOpacity(worldObj, pos); - } - - private int getBlockLightOpacity(int x, int y, int z) - { -- return this.getBlock0(x, y, z).getLightOpacity(); -+ return getBlockLightOpacity(new BlockPos((xPosition << 4) + x, y, (zPosition << 4) + z)); - } - - private Block getBlock0(int x, int y, int z) -@@ -653,16 +656,23 @@ - flag = j >= i1; - } - -+ int j1 = block.getLightOpacity(this.worldObj, pos); -+ - extendedblockstorage.set(i, j & 15, k, state); - -- if (block1 != block) -+ //if (block1 != block) - { - if (!this.worldObj.isRemote) - { -+ if (iblockstate1.getBlock() != state.getBlock()) //Only fire block breaks when the block changes. - block1.breakBlock(this.worldObj, pos, iblockstate1); -+ TileEntity te = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); -+ if (te != null && te.shouldRefresh(this.worldObj, pos, iblockstate1, state)) this.worldObj.removeTileEntity(pos); - } -- else if (block1 instanceof ITileEntityProvider) -+ else if (block1.hasTileEntity(iblockstate1)) - { -+ TileEntity te = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); -+ if (te != null && te.shouldRefresh(this.worldObj, pos, iblockstate1, state)) - this.worldObj.removeTileEntity(pos); - } - } -@@ -679,8 +689,7 @@ - } - else - { -- int j1 = block.getLightOpacity(); -- int k1 = block1.getLightOpacity(); -+ int k1 = block.getLightOpacity(this.worldObj, pos); - - if (j1 > 0) - { -@@ -702,28 +711,18 @@ - - TileEntity tileentity; - -- if (block1 instanceof ITileEntityProvider) -- { -- tileentity = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); -- -- if (tileentity != null) -- { -- tileentity.updateContainingBlockInfo(); -- } -- } -- - if (!this.worldObj.isRemote && block1 != block) - { - block.onBlockAdded(this.worldObj, pos, state); - } - -- if (block instanceof ITileEntityProvider) -+ if (block.hasTileEntity(state)) - { - tileentity = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); - - if (tileentity == null) - { -- tileentity = ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, block.getMetaFromState(state)); -+ tileentity = block.createTileEntity(this.worldObj, state); - this.worldObj.setTileEntity(pos, tileentity); - } - -@@ -826,6 +825,7 @@ - k = this.entityLists.length - 1; - } - -+ MinecraftForge.EVENT_BUS.post(new EntityEvent.EnteringChunk(entityIn, this.xPosition, this.zPosition, entityIn.chunkCoordX, entityIn.chunkCoordZ)); - entityIn.addedToChunk = true; - entityIn.chunkCoordX = this.xPosition; - entityIn.chunkCoordY = k; -@@ -864,13 +864,20 @@ - private TileEntity createNewTileEntity(BlockPos pos) - { - Block block = this.getBlock(pos); -- return !block.hasTileEntity() ? null : ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, this.getBlockMetadata(pos)); -+ IBlockState state = block.getStateFromMeta(this.getBlockMetadata(pos)); -+ return !block.hasTileEntity(state) ? null : block.createTileEntity(this.worldObj, state); - } - - public TileEntity getTileEntity(BlockPos pos, Chunk.EnumCreateEntityType p_177424_2_) - { - TileEntity tileentity = (TileEntity)this.chunkTileEntityMap.get(pos); - -+ if (tileentity != null && tileentity.isInvalid()) -+ { -+ chunkTileEntityMap.remove(pos); -+ tileentity = null; -+ } -+ - if (tileentity == null) - { - if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE) -@@ -883,11 +890,6 @@ - this.field_177447_w.add(pos); - } - } -- else if (tileentity.isInvalid()) -- { -- this.chunkTileEntityMap.remove(pos); -- return null; -- } - - return tileentity; - } -@@ -907,7 +909,7 @@ - tileEntityIn.setWorldObj(this.worldObj); - tileEntityIn.setPos(pos); - -- if (this.getBlock(pos) instanceof ITileEntityProvider) -+ if (this.getBlock(pos).hasTileEntity(getBlock(pos).getStateFromMeta(this.getBlockMetadata(pos)))) - { - if (this.chunkTileEntityMap.containsKey(pos)) - { -@@ -947,8 +949,9 @@ - entity.onChunkLoad(); - } - -- this.worldObj.loadEntities(this.entityLists[i]); -+ this.worldObj.loadEntities(com.google.common.collect.ImmutableList.copyOf(this.entityLists[i])); - } -+ MinecraftForge.EVENT_BUS.post(new ChunkEvent.Load(this)); - } - - public void onChunkUnload() -@@ -966,6 +969,7 @@ - { - this.worldObj.unloadEntities(this.entityLists[i]); - } -+ MinecraftForge.EVENT_BUS.post(new ChunkEvent.Unload(this)); - } - - public void setChunkModified() -@@ -975,8 +979,8 @@ - - public void getEntitiesWithinAABBForEntity(Entity entityIn, AxisAlignedBB aabb, List listToFill, Predicate p_177414_4_) - { -- int i = MathHelper.floor_double((aabb.minY - 2.0D) / 16.0D); -- int j = MathHelper.floor_double((aabb.maxY + 2.0D) / 16.0D); -+ int i = MathHelper.floor_double((aabb.minY - World.MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.floor_double((aabb.maxY + World.MAX_ENTITY_RADIUS) / 16.0D); - i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); - j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); - -@@ -1012,8 +1016,8 @@ - - public void getEntitiesOfTypeWithinAAAB(Class entityClass, AxisAlignedBB aabb, List listToFill, Predicate p_177430_4_) - { -- int i = MathHelper.floor_double((aabb.minY - 2.0D) / 16.0D); -- int j = MathHelper.floor_double((aabb.maxY + 2.0D) / 16.0D); -+ int i = MathHelper.floor_double((aabb.minY - World.MAX_ENTITY_RADIUS) / 16.0D); -+ int j = MathHelper.floor_double((aabb.maxY + World.MAX_ENTITY_RADIUS) / 16.0D); - i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); - j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); - -@@ -1179,8 +1183,10 @@ - while (!this.field_177447_w.isEmpty()) - { - BlockPos blockpos = (BlockPos)this.field_177447_w.poll(); -+ Block block = this.getBlock(blockpos); -+ IBlockState state = block.getStateFromMeta(this.getBlockMetadata(blockpos)); - -- if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.getBlock(blockpos).hasTileEntity()) -+ if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && block.hasTileEntity(state)) - { - TileEntity tileentity = this.createNewTileEntity(blockpos); - this.worldObj.setTileEntity(blockpos, tileentity); -@@ -1242,6 +1248,15 @@ - @SideOnly(Side.CLIENT) - public void fillChunk(byte[] p_177439_1_, int p_177439_2_, boolean p_177439_3_) - { -+ Iterator iterator = chunkTileEntityMap.values().iterator(); -+ while(iterator.hasNext()) -+ { -+ TileEntity tileEntity = (TileEntity)iterator.next(); -+ tileEntity.updateContainingBlockInfo(); -+ tileEntity.getBlockMetadata(); -+ tileEntity.getBlockType(); -+ } -+ - int j = 0; - boolean flag1 = !this.worldObj.provider.getHasNoSky(); - int k; -@@ -1311,13 +1326,18 @@ - this.isLightPopulated = true; - this.isTerrainPopulated = true; - this.generateHeightMap(); -- Iterator iterator = this.chunkTileEntityMap.values().iterator(); -+ List invalidList = new java.util.ArrayList(); -+ iterator = this.chunkTileEntityMap.values().iterator(); - - while (iterator.hasNext()) - { - TileEntity tileentity = (TileEntity)iterator.next(); -+ if (tileentity.shouldRefresh(this.worldObj, tileentity.getPos(), tileentity.getBlockType().getStateFromMeta(tileentity.getBlockMetadata()), getBlockState(tileentity.getPos()))) -+ invalidList.add(tileentity); - tileentity.updateContainingBlockInfo(); - } -+ -+ for (TileEntity te : invalidList) te.invalidate(); - } - - public BiomeGenBase getBiome(BlockPos pos, WorldChunkManager chunkManager) -@@ -1644,4 +1664,20 @@ - - private static final String __OBFID = "CL_00002009"; - } -+ -+ /** -+ * Removes the tile entity at the specified position, only if it's -+ * marked as invalid. -+ */ -+ public void removeInvalidTileEntity(BlockPos pos) -+ { -+ if (isChunkLoaded) -+ { -+ TileEntity entity = (TileEntity)chunkTileEntityMap.get(pos); -+ if (entity != null && entity.isInvalid()) -+ { -+ chunkTileEntityMap.remove(pos); -+ } -+ } -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch deleted file mode 100644 index 08e154bdb..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java.patch +++ /dev/null @@ -1,192 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java -+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java -@@ -26,6 +26,8 @@ - import net.minecraft.world.chunk.NibbleArray; - import net.minecraft.world.storage.IThreadedFileIO; - import net.minecraft.world.storage.ThreadedFileIOBase; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.world.ChunkDataEvent; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - -@@ -43,8 +45,45 @@ - this.chunkSaveLocation = chunkSaveLocationIn; - } - -+ public boolean chunkExists(World world, int x, int z) -+ { -+ ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(x, z); -+ -+ synchronized (this.syncLockObject) -+ { -+ if (this.pendingAnvilChunksCoordinates.contains(chunkcoordintpair)) -+ { -+ Iterator iter = this.chunksToRemove.iterator(); -+ while (iter.hasNext()) -+ { -+ PendingChunk pendingChunk = (PendingChunk)iter.next(); -+ if (pendingChunk.chunkCoordinate.equals(chunkcoordintpair)) -+ { -+ return true; -+ } -+ } -+ } -+ } -+ -+ return RegionFileCache.createOrLoadRegionFile(this.chunkSaveLocation, x, z).chunkExists(x & 31, z & 31); -+ } - public Chunk loadChunk(World worldIn, int x, int z) throws IOException - { -+ Object[] data = this.loadChunk__Async(worldIn, x, z); -+ -+ if (data != null) -+ { -+ Chunk chunk = (Chunk) data[0]; -+ NBTTagCompound nbttagcompound = (NBTTagCompound) data[1]; -+ this.loadEntities(worldIn, nbttagcompound.getCompoundTag("Level"), chunk); -+ return chunk; -+ } -+ -+ return null; -+ } -+ -+ public Object[] loadChunk__Async(World worldIn, int x, int z) throws IOException -+ { - NBTTagCompound nbttagcompound = null; - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(x, z); - Object object = this.syncLockObject; -@@ -53,11 +92,13 @@ - { - if (this.pendingAnvilChunksCoordinates.contains(chunkcoordintpair)) - { -- for (int k = 0; k < this.chunksToRemove.size(); ++k) -+ Iterator iter = this.chunksToRemove.iterator(); -+ while (iter.hasNext()) - { -- if (((AnvilChunkLoader.PendingChunk)this.chunksToRemove.get(k)).chunkCoordinate.equals(chunkcoordintpair)) -+ PendingChunk pendingChunk = (PendingChunk)iter.next(); -+ if (pendingChunk.chunkCoordinate.equals(chunkcoordintpair)) - { -- nbttagcompound = ((AnvilChunkLoader.PendingChunk)this.chunksToRemove.get(k)).nbtTags; -+ nbttagcompound = pendingChunk.nbtTags; - break; - } - } -@@ -76,11 +117,17 @@ - nbttagcompound = CompressedStreamTools.read(datainputstream); - } - -- return this.checkedReadChunkFromNBT(worldIn, x, z, nbttagcompound); -+ return this.checkedReadChunkFromNBT__Async(worldIn, x, z, nbttagcompound); - } - - protected Chunk checkedReadChunkFromNBT(World worldIn, int x, int z, NBTTagCompound p_75822_4_) - { -+ Object[] data = this.checkedReadChunkFromNBT__Async(worldIn, x, z, p_75822_4_); -+ return data != null ? (Chunk)data[0] : null; -+ } -+ -+ protected Object[] checkedReadChunkFromNBT__Async(World worldIn, int x, int z, NBTTagCompound p_75822_4_) -+ { - if (!p_75822_4_.hasKey("Level", 10)) - { - logger.error("Chunk file at " + x + "," + z + " is missing level data, skipping"); -@@ -100,10 +147,27 @@ - logger.error("Chunk file at " + x + "," + z + " is in the wrong location; relocating. (Expected " + x + ", " + z + ", got " + chunk.xPosition + ", " + chunk.zPosition + ")"); - p_75822_4_.setInteger("xPos", x); - p_75822_4_.setInteger("zPos", z); -+ -+ // Have to move tile entities since we don't load them at this stage -+ NBTTagList _tileEntities = p_75822_4_.getCompoundTag("Level").getTagList("TileEntities", 10); -+ -+ if (_tileEntities != null) -+ { -+ for (int te = 0; te < _tileEntities.tagCount(); te++) -+ { -+ NBTTagCompound _nbt = (NBTTagCompound) _tileEntities.getCompoundTagAt(te); -+ _nbt.setInteger("x", x * 16 + (_nbt.getInteger("x") - chunk.xPosition * 16)); -+ _nbt.setInteger("z", z * 16 + (_nbt.getInteger("z") - chunk.zPosition * 16)); -+ } -+ } - chunk = this.readChunkFromNBT(worldIn, p_75822_4_.getCompoundTag("Level")); - } -- -- return chunk; -+ Object[] data = new Object[2]; -+ data[0] = chunk; -+ data[1] = p_75822_4_; -+ // event is fired in ChunkIOProvider.callStage2 since it must be fired after TE's load. -+ // MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Load(chunk, par4NBTTagCompound)); -+ return data; - } - } - -@@ -117,6 +181,7 @@ - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound.setTag("Level", nbttagcompound1); - this.writeChunkToNBT(chunkIn, worldIn, nbttagcompound1); -+ MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Save(chunkIn, nbttagcompound)); - this.addChunkToPending(chunkIn.getChunkCoordIntPair(), nbttagcompound); - } - catch (Exception exception) -@@ -287,11 +352,20 @@ - Entity entity = (Entity)iterator.next(); - nbttagcompound1 = new NBTTagCompound(); - -+ try -+ { - if (entity.writeToNBTOptional(nbttagcompound1)) - { - chunkIn.setHasEntities(true); - nbttaglist1.appendTag(nbttagcompound1); - } -+ } -+ catch (Exception e) -+ { -+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, -+ "An Entity type %s has thrown an exception trying to write state. It will not persist. Report this to the mod author", -+ entity.getClass().getName()); -+ } - } - } - -@@ -303,8 +377,17 @@ - { - TileEntity tileentity = (TileEntity)iterator.next(); - nbttagcompound1 = new NBTTagCompound(); -+ try -+ { - tileentity.writeToNBT(nbttagcompound1); - nbttaglist2.appendTag(nbttagcompound1); -+ } -+ catch (Exception e) -+ { -+ net.minecraftforge.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e, -+ "A TileEntity type %s has throw an exception trying to write state. It will not persist. Report this to the mod author", -+ tileentity.getClass().getName()); -+ } - } - - p_75820_3_.setTag("TileEntities", nbttaglist2); -@@ -386,6 +469,12 @@ - chunk.setBiomeArray(p_75823_2_.getByteArray("Biomes")); - } - -+ // End this method here and split off entity loading to another method -+ return chunk; -+ } -+ -+ public void loadEntities(World worldIn, NBTTagCompound p_75823_2_, Chunk chunk) -+ { - NBTTagList nbttaglist1 = p_75823_2_.getTagList("Entities", 10); - - if (nbttaglist1 != null) -@@ -457,8 +546,6 @@ - } - } - } -- -- return chunk; - } - - static class PendingChunk diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch deleted file mode 100644 index 216e06a41..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java -+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java -@@ -23,18 +23,12 @@ - File file1 = this.getWorldDirectory(); - File file2; - -- if (provider instanceof WorldProviderHell) -+ if (provider.getSaveFolder() != null) - { -- file2 = new File(file1, "DIM-1"); -+ file2 = new File(file1, provider.getSaveFolder()); - file2.mkdirs(); - return new AnvilChunkLoader(file2); - } -- else if (provider instanceof WorldProviderEnd) -- { -- file2 = new File(file1, "DIM1"); -- file2.mkdirs(); -- return new AnvilChunkLoader(file2); -- } - else - { - return new AnvilChunkLoader(file1); diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch deleted file mode 100644 index 0473edcfc..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java -+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java -@@ -35,6 +35,8 @@ - - public void set(int x, int y, int z, IBlockState state) - { -+ if (state instanceof net.minecraftforge.common.property.IExtendedBlockState) -+ state = ((net.minecraftforge.common.property.IExtendedBlockState) state).getClean(); - IBlockState iblockstate1 = this.get(x, y, z); - Block block = iblockstate1.getBlock(); - Block block1 = state.getBlock(); diff --git a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch b/patches.mcp/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch deleted file mode 100644 index 134243601..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/chunk/storage/RegionFile.java.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/chunk/storage/RegionFile.java -+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/RegionFile.java -@@ -105,6 +105,39 @@ - } - } - -+ // This is a copy (sort of) of the method below it, make sure they stay in sync -+ public synchronized boolean chunkExists(int x, int z) -+ { -+ if (this.outOfBounds(x, z)) return false; -+ -+ try -+ { -+ int offset = this.getOffset(x, z); -+ -+ if (offset == 0) return false; -+ -+ int sectorNumber = offset >> 8; -+ int numSectors = offset & 255; -+ -+ if (sectorNumber + numSectors > this.sectorFree.size()) return false; -+ -+ this.dataFile.seek((long)(sectorNumber * 4096)); -+ int length = this.dataFile.readInt(); -+ -+ if (length > 4096 * numSectors || length <= 0) return false; -+ -+ byte version = this.dataFile.readByte(); -+ -+ if (version == 1 || version == 2) return true; -+ } -+ catch (IOException ioexception) -+ { -+ return false; -+ } -+ -+ return false; -+ } -+ - public synchronized DataInputStream getChunkDataInputStream(int x, int z) - { - if (this.outOfBounds(x, z)) diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch deleted file mode 100644 index 968222076..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch +++ /dev/null @@ -1,74 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java -+++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java -@@ -15,6 +15,9 @@ - import net.minecraft.world.chunk.Chunk; - import net.minecraft.world.chunk.ChunkPrimer; - import net.minecraft.world.chunk.IChunkProvider; -+import net.minecraftforge.common.*; -+import net.minecraftforge.fml.common.eventhandler.Event.*; -+import net.minecraftforge.event.terraingen.*; - - public class ChunkProviderEnd implements IChunkProvider - { -@@ -43,6 +46,14 @@ - this.noiseGen3 = new NoiseGeneratorOctaves(this.endRNG, 8); - this.noiseGen4 = new NoiseGeneratorOctaves(this.endRNG, 10); - this.noiseGen5 = new NoiseGeneratorOctaves(this.endRNG, 16); -+ -+ NoiseGenerator[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5}; -+ noiseGens = TerrainGen.getModdedNoiseGenerators(worldIn, this.endRNG, noiseGens); -+ this.noiseGen1 = (NoiseGeneratorOctaves)noiseGens[0]; -+ this.noiseGen2 = (NoiseGeneratorOctaves)noiseGens[1]; -+ this.noiseGen3 = (NoiseGeneratorOctaves)noiseGens[2]; -+ this.noiseGen4 = (NoiseGeneratorOctaves)noiseGens[3]; -+ this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4]; - } - - public void func_180520_a(int p_180520_1_, int p_180520_2_, ChunkPrimer p_180520_3_) -@@ -115,6 +126,9 @@ - - public void func_180519_a(ChunkPrimer p_180519_1_) - { -+ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, chunkX, chunkZ, p_180519_1_, this.endWorld); -+ MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == Result.DENY) return; - for (int i = 0; i < 16; ++i) - { - for (int j = 0; j < 16; ++j) -@@ -164,8 +178,10 @@ - } - } - -+ private int chunkX=0, chunkZ=0; - public Chunk provideChunk(int x, int z) - { -+ chunkX = x; chunkZ = z; - this.endRNG.setSeed((long)x * 341873128712L + (long)z * 132897987541L); - ChunkPrimer chunkprimer = new ChunkPrimer(); - this.biomesForGeneration = this.endWorld.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16); -@@ -185,6 +201,10 @@ - - private double[] initializeNoiseField(double[] p_73187_1_, int p_73187_2_, int p_73187_3_, int p_73187_4_, int p_73187_5_, int p_73187_6_, int p_73187_7_) - { -+ ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, p_73187_1_, p_73187_2_, p_73187_3_, p_73187_4_, p_73187_5_, p_73187_6_, p_73187_7_); -+ MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == Result.DENY) return event.noisefield; -+ - if (p_73187_1_ == null) - { - p_73187_1_ = new double[p_73187_5_ * p_73187_6_ * p_73187_7_]; -@@ -275,8 +295,14 @@ - public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) - { - BlockFalling.fallInstantly = true; -+ -+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, endWorld, endWorld.rand, p_73153_2_, p_73153_3_, false)); -+ - BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); - this.endWorld.getBiomeGenForCoords(blockpos.add(16, 0, 16)).decorate(this.endWorld, this.endWorld.rand, blockpos); -+ -+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, endWorld, endWorld.rand, p_73153_2_, p_73153_3_, false)); -+ - BlockFalling.fallInstantly = false; - } - diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch deleted file mode 100644 index dc67e29f2..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch +++ /dev/null @@ -1,121 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java -+++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java -@@ -24,6 +24,11 @@ - import net.minecraft.world.gen.structure.MapGenStronghold; - import net.minecraft.world.gen.structure.MapGenVillage; - import net.minecraft.world.gen.structure.StructureOceanMonument; -+import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.*; -+import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.*; -+import net.minecraftforge.common.*; -+import net.minecraftforge.fml.common.eventhandler.Event.*; -+import net.minecraftforge.event.terraingen.*; - - public class ChunkProviderGenerate implements IChunkProvider - { -@@ -68,6 +73,15 @@ - this.scatteredFeatureGenerator = new MapGenScatteredFeature(); - this.ravineGenerator = new MapGenRavine(); - this.oceanMonumentGenerator = new StructureOceanMonument(); -+ { -+ caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE); -+ strongholdGenerator = (MapGenStronghold)TerrainGen.getModdedMapGen(strongholdGenerator, STRONGHOLD); -+ villageGenerator = (MapGenVillage)TerrainGen.getModdedMapGen(villageGenerator, VILLAGE); -+ mineshaftGenerator = (MapGenMineshaft)TerrainGen.getModdedMapGen(mineshaftGenerator, MINESHAFT); -+ scatteredFeatureGenerator = (MapGenScatteredFeature)TerrainGen.getModdedMapGen(scatteredFeatureGenerator, SCATTERED_FEATURE); -+ ravineGenerator = TerrainGen.getModdedMapGen(ravineGenerator, RAVINE); -+ oceanMonumentGenerator = (StructureOceanMonument)TerrainGen.getModdedMapGen(oceanMonumentGenerator, OCEAN_MONUMENT); -+ } - this.worldObj = worldIn; - this.mapFeaturesEnabled = p_i45636_4_; - this.field_177475_o = worldIn.getWorldInfo().getTerrainType(); -@@ -96,6 +110,16 @@ - this.settings = ChunkProviderSettings.Factory.func_177865_a(p_i45636_5_).func_177864_b(); - this.field_177476_s = this.settings.useLavaOceans ? Blocks.lava : Blocks.water; - } -+ -+ NoiseGenerator[] noiseGens = {field_147431_j, field_147432_k, field_147429_l, field_147430_m, noiseGen5, noiseGen6, mobSpawnerNoise}; -+ noiseGens = TerrainGen.getModdedNoiseGenerators(worldIn, this.rand, noiseGens); -+ this.field_147431_j = (NoiseGeneratorOctaves)noiseGens[0]; -+ this.field_147432_k = (NoiseGeneratorOctaves)noiseGens[1]; -+ this.field_147429_l = (NoiseGeneratorOctaves)noiseGens[2]; -+ this.field_147430_m = (NoiseGeneratorPerlin)noiseGens[3]; -+ this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4]; -+ this.noiseGen6 = (NoiseGeneratorOctaves)noiseGens[5]; -+ this.mobSpawnerNoise = (NoiseGeneratorOctaves)noiseGens[6]; - } - - public void setBlocksInChunk(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_) -@@ -169,6 +193,10 @@ - - public void func_180517_a(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_) - { -+ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180517_1_, p_180517_2_, p_180517_3_, this.worldObj); -+ MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == Result.DENY) return; -+ - double d0 = 0.03125D; - this.stoneNoise = this.field_147430_m.func_151599_a(this.stoneNoise, (double)(p_180517_1_ * 16), (double)(p_180517_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); - -@@ -375,6 +403,8 @@ - boolean flag = false; - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); - -+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag)); -+ - if (this.settings.useMineShafts && this.mapFeaturesEnabled) - { - this.mineshaftGenerator.func_175794_a(this.worldObj, this.rand, chunkcoordintpair); -@@ -404,7 +434,8 @@ - int l1; - int i2; - -- if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && this.settings.useWaterLakes && !flag && this.rand.nextInt(this.settings.waterLakeChance) == 0) -+ if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && this.settings.useWaterLakes && !flag && this.rand.nextInt(this.settings.waterLakeChance) == 0 -+ && TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, LAKE)) - { - k1 = this.rand.nextInt(16) + 8; - l1 = this.rand.nextInt(256); -@@ -412,7 +443,7 @@ - (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, blockpos.add(k1, l1, i2)); - } - -- if (!flag && this.rand.nextInt(this.settings.lavaLakeChance / 10) == 0 && this.settings.useLavaLakes) -+ if (TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, LAVA) && !flag && this.rand.nextInt(this.settings.lavaLakeChance / 10) == 0 && this.settings.useLavaLakes) - { - k1 = this.rand.nextInt(16) + 8; - l1 = this.rand.nextInt(this.rand.nextInt(248) + 8); -@@ -426,7 +457,8 @@ - - if (this.settings.useDungeons) - { -- for (k1 = 0; k1 < this.settings.dungeonChance; ++k1) -+ boolean doGen = TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, DUNGEON); -+ for (k1 = 0; doGen && k1 < this.settings.dungeonChance; ++k1) - { - l1 = this.rand.nextInt(16) + 8; - i2 = this.rand.nextInt(256); -@@ -436,10 +468,14 @@ - } - - biomegenbase.decorate(this.worldObj, this.rand, new BlockPos(k, 0, l)); -+ if (TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, ANIMALS)) -+ { - SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand); -+ } - blockpos = blockpos.add(8, 0, 8); - -- for (k1 = 0; k1 < 16; ++k1) -+ boolean doGen = TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, ICE); -+ for (k1 = 0; doGen && k1 < 16; ++k1) - { - for (l1 = 0; l1 < 16; ++l1) - { -@@ -458,6 +494,8 @@ - } - } - -+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag)); -+ - BlockFalling.fallInstantly = false; - } - diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch deleted file mode 100644 index ac0ed930c..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch +++ /dev/null @@ -1,145 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderHell.java -+++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderHell.java -@@ -24,6 +24,13 @@ - import net.minecraft.world.gen.feature.WorldGenMinable; - import net.minecraft.world.gen.feature.WorldGenerator; - import net.minecraft.world.gen.structure.MapGenNetherBridge; -+import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.*; -+import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.*; -+import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.*; -+import static net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.*; -+import net.minecraftforge.common.*; -+import net.minecraftforge.fml.common.eventhandler.Event.*; -+import net.minecraftforge.event.terraingen.*; - - public class ChunkProviderHell implements IChunkProvider - { -@@ -65,18 +72,30 @@ - this.field_177472_y = new WorldGenHellLava(Blocks.flowing_lava, false); - this.field_177471_z = new GeneratorBushFeature(Blocks.brown_mushroom); - this.field_177465_A = new GeneratorBushFeature(Blocks.red_mushroom); -- this.genNetherBridge = new MapGenNetherBridge(); -- this.netherCaveGenerator = new MapGenCavesHell(); -+ this.genNetherBridge = (MapGenNetherBridge) TerrainGen.getModdedMapGen(new MapGenNetherBridge(), NETHER_BRIDGE); -+ this.netherCaveGenerator = TerrainGen.getModdedMapGen(new MapGenCavesHell(), NETHER_CAVE); - this.worldObj = worldIn; - this.field_177466_i = p_i45637_2_; - this.hellRNG = new Random(p_i45637_3_); -- this.netherNoiseGen1 = new NoiseGeneratorOctaves(this.hellRNG, 16); -- this.netherNoiseGen2 = new NoiseGeneratorOctaves(this.hellRNG, 16); -- this.netherNoiseGen3 = new NoiseGeneratorOctaves(this.hellRNG, 8); -- this.slowsandGravelNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); -- this.netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); -- this.netherNoiseGen6 = new NoiseGeneratorOctaves(this.hellRNG, 10); -- this.netherNoiseGen7 = new NoiseGeneratorOctaves(this.hellRNG, 16); -+ -+ NoiseGenerator[] noiseGens = -+ { -+ new NoiseGeneratorOctaves(this.hellRNG, 16), -+ new NoiseGeneratorOctaves(this.hellRNG, 16), -+ new NoiseGeneratorOctaves(this.hellRNG, 8), -+ new NoiseGeneratorOctaves(this.hellRNG, 4), -+ new NoiseGeneratorOctaves(this.hellRNG, 4), -+ new NoiseGeneratorOctaves(this.hellRNG, 10), -+ new NoiseGeneratorOctaves(this.hellRNG, 16) -+ }; -+ noiseGens = TerrainGen.getModdedNoiseGenerators(worldIn, this.hellRNG, noiseGens); -+ this.netherNoiseGen1 = (NoiseGeneratorOctaves)noiseGens[0]; -+ this.netherNoiseGen2 = (NoiseGeneratorOctaves)noiseGens[1]; -+ this.netherNoiseGen3 = (NoiseGeneratorOctaves)noiseGens[2]; -+ this.slowsandGravelNoiseGen = (NoiseGeneratorOctaves)noiseGens[3]; -+ this.netherrackExculsivityNoiseGen = (NoiseGeneratorOctaves)noiseGens[4]; -+ this.netherNoiseGen6 = (NoiseGeneratorOctaves)noiseGens[5]; -+ this.netherNoiseGen7 = (NoiseGeneratorOctaves)noiseGens[6]; - } - - public void func_180515_a(int p_180515_1_, int p_180515_2_, ChunkPrimer p_180515_3_) -@@ -155,6 +174,10 @@ - - public void func_180516_b(int p_180516_1_, int p_180516_2_, ChunkPrimer p_180516_3_) - { -+ ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180516_1_, p_180516_2_, p_180516_3_, this.worldObj); -+ MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == Result.DENY) return; -+ - byte b0 = 64; - double d0 = 0.03125D; - this.slowsandNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.slowsandNoise, p_180516_1_ * 16, p_180516_2_ * 16, 0, 16, 16, 1, d0, d0, 1.0D); -@@ -272,6 +295,10 @@ - - private double[] initializeNoiseField(double[] p_73164_1_, int p_73164_2_, int p_73164_3_, int p_73164_4_, int p_73164_5_, int p_73164_6_, int p_73164_7_) - { -+ ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, p_73164_1_, p_73164_2_, p_73164_3_, p_73164_4_, p_73164_5_, p_73164_6_, p_73164_7_); -+ MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == Result.DENY) return event.noisefield; -+ - if (p_73164_1_ == null) - { - p_73164_1_ = new double[p_73164_5_ * p_73164_6_ * p_73164_7_]; -@@ -365,47 +392,58 @@ - public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) - { - BlockFalling.fallInstantly = true; -+ -+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false)); -+ - BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); - this.genNetherBridge.func_175794_a(this.worldObj, this.hellRNG, chunkcoordintpair); - int k; - -- for (k = 0; k < 8; ++k) -+ boolean doGen = TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, NETHER_LAVA); -+ for (k = 0; doGen && k < 8; ++k) - { - this.field_177472_y.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); - } - -- for (k = 0; k < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1; ++k) -+ doGen = TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, FIRE); -+ for (k = 0; doGen && k < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1; ++k) - { - this.field_177470_t.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); - } - -- for (k = 0; k < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1); ++k) -+ doGen = TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, GLOWSTONE); -+ for (k = 0; doGen && k < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1); ++k) - { - this.field_177469_u.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); - } - -- for (k = 0; k < 10; ++k) -+ for (k = 0; doGen && k < 10; ++k) - { - this.field_177468_v.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); - } - -- if (this.hellRNG.nextBoolean()) -+ MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(worldObj, hellRNG, blockpos)); -+ -+ doGen = TerrainGen.decorate(worldObj, hellRNG, blockpos, SHROOM); -+ if (doGen && this.hellRNG.nextBoolean()) - { - this.field_177471_z.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); - } - -- if (this.hellRNG.nextBoolean()) -+ if (doGen && this.hellRNG.nextBoolean()) - { - this.field_177465_A.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); - } - -- for (k = 0; k < 16; ++k) -+ doGen = TerrainGen.generateOre(worldObj, hellRNG, field_177467_w, blockpos, QUARTZ); -+ for (k = 0; doGen && k < 16; ++k) - { - this.field_177467_w.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16), this.hellRNG.nextInt(108) + 10, this.hellRNG.nextInt(16))); - } - -- for (k = 0; k < 16; ++k) -+ doGen = TerrainGen.populate(p_73153_1_, worldObj, hellRNG, p_73153_2_, p_73153_3_, false, NETHER_LAVA2); -+ for (k = 0; doGen && k < 16; ++k) - { - this.field_177473_x.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16), this.hellRNG.nextInt(108) + 10, this.hellRNG.nextInt(16))); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch deleted file mode 100644 index 2c367ab51..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch +++ /dev/null @@ -1,138 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderServer.java -+++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderServer.java -@@ -24,6 +24,10 @@ - import net.minecraft.world.chunk.storage.IChunkLoader; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -+import net.minecraft.world.chunk.storage.AnvilChunkLoader; -+import net.minecraftforge.common.DimensionManager; -+import net.minecraftforge.common.ForgeChunkManager; -+import net.minecraftforge.common.chunkio.ChunkIOExecutor; - - public class ChunkProviderServer implements IChunkProvider - { -@@ -36,6 +40,7 @@ - public LongHashMap id2ChunkMap = new LongHashMap(); - public List loadedChunks = Lists.newArrayList(); - public WorldServer worldObj; -+ private Set loadingChunks = com.google.common.collect.Sets.newHashSet(); - private static final String __OBFID = "CL_00001436"; - - public ChunkProviderServer(WorldServer p_i1520_1_, IChunkLoader p_i1520_2_, IChunkProvider p_i1520_3_) -@@ -58,7 +63,7 @@ - - public void dropChunk(int p_73241_1_, int p_73241_2_) - { -- if (this.worldObj.provider.canRespawnHere()) -+ if (this.worldObj.provider.canRespawnHere() && DimensionManager.shouldLoadSpawn(this.worldObj.provider.getDimensionId())) - { - if (!this.worldObj.isSpawnChunk(p_73241_1_, p_73241_2_)) - { -@@ -84,12 +89,64 @@ - - public Chunk loadChunk(int p_73158_1_, int p_73158_2_) - { -+ return loadChunk(p_73158_1_, p_73158_2_, null); -+ } -+ -+ public Chunk loadChunk(int par1, int par2, Runnable runnable) -+ { -+ long k = ChunkCoordIntPair.chunkXZ2Int(par1, par2); -+ this.droppedChunksSet.remove(Long.valueOf(k)); -+ Chunk chunk = (Chunk)this.id2ChunkMap.getValueByKey(k); -+ AnvilChunkLoader loader = null; -+ -+ if (this.chunkLoader instanceof AnvilChunkLoader) -+ { -+ loader = (AnvilChunkLoader) this.chunkLoader; -+ } -+ -+ // We can only use the queue for already generated chunks -+ if (chunk == null && loader != null && loader.chunkExists(this.worldObj, par1, par2)) -+ { -+ if (runnable != null) -+ { -+ ChunkIOExecutor.queueChunkLoad(this.worldObj, loader, this, par1, par2, runnable); -+ return null; -+ } -+ else -+ { -+ chunk = ChunkIOExecutor.syncChunkLoad(this.worldObj, loader, this, par1, par2); -+ } -+ } -+ else if (chunk == null) -+ { -+ chunk = this.originalLoadChunk(par1, par2); -+ } -+ -+ // If we didn't load the chunk async and have a callback run it now -+ if (runnable != null) -+ { -+ runnable.run(); -+ } -+ -+ return chunk; -+ } -+ -+ public Chunk originalLoadChunk(int p_73158_1_, int p_73158_2_) -+ { - long k = ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_); - this.droppedChunksSet.remove(Long.valueOf(k)); - Chunk chunk = (Chunk)this.id2ChunkMap.getValueByKey(k); - - if (chunk == null) - { -+ boolean added = loadingChunks.add(k); -+ if (!added) -+ { -+ net.minecraftforge.fml.common.FMLLog.bigWarning("There is an attempt to load a chunk (%d,%d) in dimension %d that is already being loaded. This will cause weird chunk breakages.", p_73158_1_, p_73158_2_, worldObj.provider.getDimensionId()); -+ } -+ chunk = ForgeChunkManager.fetchDormantChunk(k, this.worldObj); -+ -+ if (chunk == null) - chunk = this.loadChunkFromFile(p_73158_1_, p_73158_2_); - - if (chunk == null) -@@ -118,6 +175,7 @@ - - this.id2ChunkMap.add(k, chunk); - this.loadedChunks.add(chunk); -+ loadingChunks.remove(k); - chunk.onChunkLoad(); - chunk.populateChunk(this, this, p_73158_1_, p_73158_2_); - } -@@ -209,6 +267,7 @@ - if (this.serverChunkGenerator != null) - { - this.serverChunkGenerator.populate(p_73153_1_, p_73153_2_, p_73153_3_); -+ net.minecraftforge.fml.common.registry.GameRegistry.generateWorld(p_73153_2_, p_73153_3_, worldObj, serverChunkGenerator, p_73153_1_); - chunk.setChunkModified(); - } - } -@@ -269,8 +328,13 @@ - { - if (!this.worldObj.disableLevelSaving) - { -- for (int i = 0; i < 100; ++i) -+ for (ChunkCoordIntPair forced : this.worldObj.getPersistentChunks().keySet()) - { -+ this.droppedChunksSet.remove(ChunkCoordIntPair.chunkXZ2Int(forced.chunkXPos, forced.chunkZPos)); -+ } -+ -+ for (int i = 0; i < 100; ++i) -+ { - if (!this.droppedChunksSet.isEmpty()) - { - Long olong = (Long)this.droppedChunksSet.iterator().next(); -@@ -283,6 +347,11 @@ - this.saveChunkExtraData(chunk); - this.id2ChunkMap.remove(olong.longValue()); - this.loadedChunks.remove(chunk); -+ ForgeChunkManager.putDormantChunk(ChunkCoordIntPair.chunkXZ2Int(chunk.xPosition, chunk.zPosition), chunk); -+ if(loadedChunks.size() == 0 && ForgeChunkManager.getPersistentChunksFor(this.worldObj).size() == 0 && !DimensionManager.shouldLoadSpawn(this.worldObj.provider.getDimensionId())){ -+ DimensionManager.unloadWorld(this.worldObj.provider.getDimensionId()); -+ return serverChunkGenerator.unloadQueuedChunks(); -+ } - } - - this.droppedChunksSet.remove(olong); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch deleted file mode 100644 index 27c43977a..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch +++ /dev/null @@ -1,126 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/MapGenCaves.java -+++ ../src-work/minecraft/net/minecraft/world/gen/MapGenCaves.java -@@ -2,6 +2,7 @@ - - import com.google.common.base.Objects; - import java.util.Random; -+import net.minecraft.block.Block; - import net.minecraft.block.BlockSand; - import net.minecraft.block.material.Material; - import net.minecraft.block.state.IBlockState; -@@ -141,7 +142,7 @@ - { - IBlockState iblockstate = p_180702_5_.getBlockState(k2, i3, l2); - -- if (iblockstate.getBlock() == Blocks.flowing_water || iblockstate.getBlock() == Blocks.water) -+ if (isOceanBlock(p_180702_5_, k2, i3, l2, p_180702_3_, p_180702_4_)) - { - flag3 = true; - } -@@ -177,32 +178,11 @@ - IBlockState iblockstate1 = p_180702_5_.getBlockState(k2, j3, j4); - IBlockState iblockstate2 = (IBlockState)Objects.firstNonNull(p_180702_5_.getBlockState(k2, j3 + 1, j4), Blocks.air.getDefaultState()); - -- if (iblockstate1.getBlock() == Blocks.grass || iblockstate1.getBlock() == Blocks.mycelium) -+ if (isTopBlock(p_180702_5_, k2, j3, j4, p_180702_3_, p_180702_4_)) - { - flag1 = true; - } -- -- if (this.func_175793_a(iblockstate1, iblockstate2)) -- { -- if (j3 - 1 < 10) -- { -- p_180702_5_.setBlockState(k2, j3, j4, Blocks.lava.getDefaultState()); -- } -- else -- { -- p_180702_5_.setBlockState(k2, j3, j4, Blocks.air.getDefaultState()); -- -- if (iblockstate2.getBlock() == Blocks.sand) -- { -- p_180702_5_.setBlockState(k2, j3 + 1, j4, iblockstate2.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? Blocks.red_sandstone.getDefaultState() : Blocks.sandstone.getDefaultState()); -- } -- -- if (flag1 && p_180702_5_.getBlockState(k2, j3 - 1, j4).getBlock() == Blocks.dirt) -- { -- p_180702_5_.setBlockState(k2, j3 - 1, j4, this.worldObj.getBiomeGenForCoords(new BlockPos(k2 + p_180702_3_ * 16, 0, j4 + p_180702_4_ * 16)).topBlock.getBlock().getDefaultState()); -- } -- } -- } -+ digBlock(p_180702_5_, k2, j3, j4, p_180702_3_, p_180702_4_, flag1, iblockstate1, iblockstate2); - } - } - } -@@ -261,4 +241,71 @@ - } - } - } -+ -+ protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) -+ { -+ net.minecraft.block.Block block = data.getBlockState(x, y, z).getBlock(); -+ return block== Blocks.flowing_water || block == Blocks.water; -+ } -+ -+ //Exception biomes to make sure we generate like vanilla -+ private boolean isExceptionBiome(net.minecraft.world.biome.BiomeGenBase biome) -+ { -+ if (biome == net.minecraft.world.biome.BiomeGenBase.beach) return true; -+ if (biome == net.minecraft.world.biome.BiomeGenBase.desert) return true; -+ return false; -+ } -+ -+ //Determine if the block at the specified location is the top block for the biome, we take into account -+ //Vanilla bugs to make sure that we generate the map the same way vanilla does. -+ private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) -+ { -+ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); -+ IBlockState state = data.getBlockState(x, y, z); -+ return (isExceptionBiome(biome) ? state.getBlock() == Blocks.grass : state.getBlock() == biome.topBlock); -+ } -+ -+ /** -+ * Digs out the current block, default implementation removes stone, filler, and top block -+ * Sets the block to lava if y is less then 10, and air other wise. -+ * If setting to air, it also checks to see if we've broken the surface and if so -+ * tries to make the floor the biome's top block -+ * -+ * @param data Block data array -+ * @param index Pre-calculated index into block data -+ * @param x local X position -+ * @param y local Y position -+ * @param z local Z position -+ * @param chunkX Chunk X position -+ * @param chunkZ Chunk Y position -+ * @param foundTop True if we've encountered the biome's top block. Ideally if we've broken the surface. -+ */ -+ protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop, IBlockState state, IBlockState up) -+ { -+ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); -+ IBlockState top = biome.topBlock; -+ IBlockState filler = biome.fillerBlock; -+ -+ if (this.func_175793_a(state, up) || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock()) -+ { -+ if (y < 10) -+ { -+ data.setBlockState(x, y, z, Blocks.lava.getDefaultState()); -+ } -+ else -+ { -+ data.setBlockState(x, y, z, Blocks.air.getDefaultState()); -+ -+ if (up.getBlock() == Blocks.sand) -+ { -+ data.setBlockState(x, y + 1, z, up.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? Blocks.red_sandstone.getDefaultState() : Blocks.sandstone.getDefaultState()); -+ } -+ -+ if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock()) -+ { -+ data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState()); -+ } -+ } -+ } -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch deleted file mode 100644 index da96d56c0..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch +++ /dev/null @@ -1,110 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/MapGenRavine.java -+++ ../src-work/minecraft/net/minecraft/world/gen/MapGenRavine.java -@@ -130,7 +130,7 @@ - { - IBlockState iblockstate = p_180707_5_.getBlockState(k2, i3, l2); - -- if (iblockstate.getBlock() == Blocks.flowing_water || iblockstate.getBlock() == Blocks.water) -+ if (isOceanBlock(p_180707_5_, k2, i2, l2, p_180707_3_, p_180707_4_)) - { - flag2 = true; - } -@@ -165,27 +165,12 @@ - { - IBlockState iblockstate1 = p_180707_5_.getBlockState(k2, j3, j4); - -- if (iblockstate1.getBlock() == Blocks.grass) -+ if (isTopBlock(p_180707_5_, k2, j3, j4, p_180707_3_, p_180707_4_)) - { - flag = true; - } - -- if (iblockstate1.getBlock() == Blocks.stone || iblockstate1.getBlock() == Blocks.dirt || iblockstate1.getBlock() == Blocks.grass) -- { -- if (j3 - 1 < 10) -- { -- p_180707_5_.setBlockState(k2, j3, j4, Blocks.flowing_lava.getDefaultState()); -- } -- else -- { -- p_180707_5_.setBlockState(k2, j3, j4, Blocks.air.getDefaultState()); -- -- if (flag && p_180707_5_.getBlockState(k2, j3 - 1, j4).getBlock() == Blocks.dirt) -- { -- p_180707_5_.setBlockState(k2, j3 - 1, j4, this.worldObj.getBiomeGenForCoords(new BlockPos(k2 + p_180707_3_ * 16, 0, j4 + p_180707_4_ * 16)).topBlock); -- } -- } -- } -+ digBlock(p_180707_5_, k2, j3, j4, p_180707_3_, p_180707_4_, flag); - } - } - } -@@ -220,4 +205,68 @@ - } - } - } -+ protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) -+ { -+ net.minecraft.block.Block block = data.getBlockState(x, y, z).getBlock(); -+ return block== Blocks.flowing_water || block == Blocks.water; -+ } -+ -+ //Exception biomes to make sure we generate like vanilla -+ private boolean isExceptionBiome(net.minecraft.world.biome.BiomeGenBase biome) -+ { -+ if (biome == net.minecraft.world.biome.BiomeGenBase.beach) return true; -+ if (biome == net.minecraft.world.biome.BiomeGenBase.desert) return true; -+ if (biome == net.minecraft.world.biome.BiomeGenBase.mushroomIsland) return true; -+ if (biome == net.minecraft.world.biome.BiomeGenBase.mushroomIslandShore) return true; -+ return false; -+ } -+ -+ //Determine if the block at the specified location is the top block for the biome, we take into account -+ //Vanilla bugs to make sure that we generate the map the same way vanilla does. -+ private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) -+ { -+ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); -+ IBlockState state = data.getBlockState(x, y, z); -+ return (isExceptionBiome(biome) ? state.getBlock() == Blocks.grass : state.getBlock() == biome.topBlock); -+ } -+ -+ /** -+ * Digs out the current block, default implementation removes stone, filler, and top block -+ * Sets the block to lava if y is less then 10, and air other wise. -+ * If setting to air, it also checks to see if we've broken the surface and if so -+ * tries to make the floor the biome's top block -+ * -+ * @param data Block data array -+ * @param index Pre-calculated index into block data -+ * @param x local X position -+ * @param y local Y position -+ * @param z local Z position -+ * @param chunkX Chunk X position -+ * @param chunkZ Chunk Y position -+ * @param foundTop True if we've encountered the biome's top block. Ideally if we've broken the surface. -+ */ -+ protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop) -+ { -+ net.minecraft.world.biome.BiomeGenBase biome = worldObj.getBiomeGenForCoords(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); -+ IBlockState state = data.getBlockState(x, y, z); -+ IBlockState top = isExceptionBiome(biome) ? Blocks.grass.getDefaultState() : biome.topBlock; -+ IBlockState filler = isExceptionBiome(biome) ? Blocks.dirt.getDefaultState() : biome.fillerBlock; -+ -+ if (state.getBlock() == Blocks.stone || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock()) -+ { -+ if (y < 10) -+ { -+ data.setBlockState(x, y, z, Blocks.lava.getDefaultState()); -+ } -+ else -+ { -+ data.setBlockState(x, y, z, Blocks.air.getDefaultState()); -+ -+ if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock()) -+ { -+ data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState()); -+ } -+ } -+ } -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch deleted file mode 100644 index 48879ccc0..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java -@@ -30,4 +30,10 @@ - this.func_175903_a(worldIn, p_175921_2_, Blocks.dirt.getDefaultState()); - } - } -+ -+ public boolean isReplaceable(World world, BlockPos pos) -+ { -+ net.minecraft.block.state.IBlockState state = world.getBlockState(pos); -+ return state.getBlock().isAir(world, pos) || state.getBlock().isLeaves(world, pos) || state.getBlock().isWood(world, pos) || func_150523_a(state.getBlock()); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch deleted file mode 100644 index be61529d5..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java -@@ -55,9 +55,10 @@ - { - if (k >= 0 && k < 256) - { -- Block block = worldIn.getBlockState(new BlockPos(l, k, i1)).getBlock(); -+ BlockPos pos = new BlockPos(l, k, i1); -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(pos); - -- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) -+ if (!state.getBlock().isAir(worldIn, pos) && !state.getBlock().isLeaves(worldIn, pos)) - { - flag = false; - } -@@ -188,7 +189,7 @@ - { - BlockPos blockpos1 = new BlockPos(i2, l, j1); - -- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) -+ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) - { - this.func_175905_a(worldIn, blockpos1, Block.getBlockById(Block.getIdFromBlock(Blocks.brown_mushroom_block) + i), k1); - } -@@ -199,9 +200,10 @@ - - for (l = 0; l < j; ++l) - { -- Block block2 = worldIn.getBlockState(p_180709_3_.up(l)).getBlock(); -+ BlockPos upN = p_180709_3_.up(l); -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(upN); - -- if (!block2.isFullBlock()) -+ if (state.getBlock().canBeReplacedByLeaves(worldIn, upN)) - { - this.func_175905_a(worldIn, p_180709_3_.up(l), Block.getBlockById(Block.getIdFromBlock(Blocks.brown_mushroom_block) + i), 10); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch deleted file mode 100644 index 770a0d932..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java -@@ -107,9 +107,9 @@ - if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_180712_2_ * p_180712_2_)) - { - BlockPos blockpos1 = p_180712_1_.add(j, 0, k); -- Material material = this.world.getBlockState(blockpos1).getBlock().getMaterial(); -+ net.minecraft.block.state.IBlockState state = this.world.getBlockState(blockpos1); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(this.world, blockpos1) || state.getBlock().isLeaves(this.world, blockpos1)) - { - this.func_175905_a(this.world, blockpos1, p_180712_3_, 0); - } -@@ -268,7 +268,7 @@ - { - BlockPos blockpos3 = p_175936_1_.add((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2)); - -- if (!this.func_150523_a(this.world.getBlockState(blockpos3).getBlock())) -+ if (!this.isReplaceable(world, blockpos3)) - { - return j; - } -@@ -296,6 +296,7 @@ - - if (!this.validTreeLocation()) - { -+ this.world = null; //Fix vanilla Mem leak, holds latest world - return false; - } - else -@@ -304,15 +305,18 @@ - this.func_175941_b(); - this.func_175942_c(); - this.func_175939_d(); -+ this.world = null; //Fix vanilla Mem leak, holds latest world - return true; - } - } - - private boolean validTreeLocation() - { -- Block block = this.world.getBlockState(this.field_175947_m.down()).getBlock(); -+ BlockPos down = this.field_175947_m.down(); -+ net.minecraft.block.state.IBlockState state = this.world.getBlockState(down); -+ boolean isSoil = state.getBlock().canSustainPlant(this.world, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - -- if (block != Blocks.dirt && block != Blocks.grass && block != Blocks.farmland) -+ if (!isSoil) - { - return false; - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch deleted file mode 100644 index 20776886b..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch +++ /dev/null @@ -1,67 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java -@@ -48,7 +48,7 @@ - { - if (j >= 0 && j < 256) - { -- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(k, j, l)).getBlock())) -+ if (!this.isReplaceable(worldIn, new BlockPos(k, j, l))) - { - flag = false; - } -@@ -67,14 +67,16 @@ - } - else - { -- Block block = worldIn.getBlockState(p_180709_3_.down()).getBlock(); -+ BlockPos down = p_180709_3_.down(); -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(down); -+ boolean isSoil = state.getBlock().canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - -- if ((block == Blocks.grass || block == Blocks.dirt) && p_180709_3_.getY() < 256 - i - 1) -+ if (isSoil && p_180709_3_.getY() < 256 - i - 1) - { -- this.func_175921_a(worldIn, p_180709_3_.down()); -- this.func_175921_a(worldIn, p_180709_3_.add(1, -1, 0)); -- this.func_175921_a(worldIn, p_180709_3_.add(1, -1, 1)); -- this.func_175921_a(worldIn, p_180709_3_.add(0, -1, 1)); -+ this.onPlantGrow(worldIn, p_180709_3_.down(), p_180709_3_); -+ this.onPlantGrow(worldIn, p_180709_3_.add(1, -1, 0), p_180709_3_); -+ this.onPlantGrow(worldIn, p_180709_3_.add(1, -1, 1), p_180709_3_); -+ this.onPlantGrow(worldIn, p_180709_3_.add(0, -1, 1), p_180709_3_); - EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(p_180709_2_); - k = i - p_180709_2_.nextInt(4); - l = 2 - p_180709_2_.nextInt(3); -@@ -96,9 +98,9 @@ - } - - BlockPos blockpos1 = new BlockPos(i1, i2, j1); -- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); -+ state = worldIn.getBlockState(blockpos1); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(worldIn, blockpos1) || state.getBlock().isLeaves(worldIn, blockpos1)) - { - this.func_175905_a(worldIn, blockpos1, Blocks.log2, BlockPlanks.EnumType.DARK_OAK.getMetadata() - 4); - this.func_175905_a(worldIn, blockpos1.east(), Blocks.log2, BlockPlanks.EnumType.DARK_OAK.getMetadata() - 4); -@@ -202,11 +204,18 @@ - - private void func_150526_a(World worldIn, int p_150526_2_, int p_150526_3_, int p_150526_4_) - { -- Block block = worldIn.getBlockState(new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_)).getBlock(); -+ BlockPos pos = new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_); -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(pos); - -- if (block.getMaterial() == Material.air) -+ if (state.getBlock().isAir(worldIn, pos)) - { - this.func_175905_a(worldIn, new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_), Blocks.leaves2, 1); - } - } -+ -+ //Just a helper macro -+ private void onPlantGrow(World world, BlockPos pos, BlockPos source) -+ { -+ world.getBlockState(pos).getBlock().onPlantGrow(world, pos, source); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch deleted file mode 100644 index f831c5456..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java -@@ -15,10 +15,12 @@ - { - Block block; - -- while (((block = worldIn.getBlockState(p_180709_3_).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && p_180709_3_.getY() > 0) -+ do - { -+ block = worldIn.getBlockState(p_180709_3_).getBlock(); -+ if (!block.isLeaves(worldIn, p_180709_3_) && !block.isLeaves(worldIn, p_180709_3_)) break; - p_180709_3_ = p_180709_3_.down(); -- } -+ } while (p_180709_3_.getY() > 0); - - for (int i = 0; i < 4; ++i) - { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch deleted file mode 100644 index 0e03624a9..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java -@@ -16,6 +16,9 @@ - import net.minecraft.world.World; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -+import net.minecraftforge.common.ChestGenHooks; -+import net.minecraftforge.common.DungeonHooks; -+import static net.minecraftforge.common.ChestGenHooks.DUNGEON_CHEST; - - public class WorldGenDungeons extends WorldGenerator - { -@@ -140,12 +143,11 @@ - if (k2 == 1) - { - worldIn.setBlockState(blockpos2, Blocks.chest.correctFacing(worldIn, blockpos2, Blocks.chest.getDefaultState()), 2); -- List list = WeightedRandomChestContent.func_177629_a(CHESTCONTENT, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_180709_2_)}); - TileEntity tileentity1 = worldIn.getTileEntity(blockpos2); - - if (tileentity1 instanceof TileEntityChest) - { -- WeightedRandomChestContent.generateChestContents(p_180709_2_, list, (TileEntityChest)tileentity1, 8); -+ WeightedRandomChestContent.generateChestContents(p_180709_2_, ChestGenHooks.getItems(DUNGEON_CHEST, p_180709_2_), (TileEntityChest)tileentity1, ChestGenHooks.getCount(DUNGEON_CHEST, p_180709_2_)); - } - - break label197; -@@ -184,6 +186,12 @@ - - private String pickMobSpawner(Random p_76543_1_) - { -- return SPAWNERTYPES[p_76543_1_.nextInt(SPAWNERTYPES.length)]; -+ return DungeonHooks.getRandomDungeonMob(p_76543_1_); - } -+ -+ static -+ { -+ ChestGenHooks.init(DUNGEON_CHEST, CHESTCONTENT, 8, 8); -+ ChestGenHooks.addItem(DUNGEON_CHEST, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch deleted file mode 100644 index 2d2f4adf8..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java -@@ -55,7 +55,7 @@ - { - if (j >= 0 && j < 256) - { -- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(k, j, l)).getBlock())) -+ if (!this.isReplaceable(worldIn, new BlockPos(k, j, l))) - { - flag = false; - } -@@ -74,11 +74,13 @@ - } - else - { -- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); -+ BlockPos down = p_180709_3_.down(); -+ Block block1 = worldIn.getBlockState(down).getBlock(); -+ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - -- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && p_180709_3_.getY() < 256 - i - 1) -+ if (isSoil && p_180709_3_.getY() < 256 - i - 1) - { -- this.func_175921_a(worldIn, p_180709_3_.down()); -+ block1.onPlantGrow(worldIn, down, p_180709_3_); - int i2; - - for (i2 = p_180709_3_.getY() - 3 + i; i2 <= p_180709_3_.getY() + i; ++i2) -@@ -99,7 +101,7 @@ - BlockPos blockpos1 = new BlockPos(i1, i2, k1); - Block block = worldIn.getBlockState(blockpos1).getBlock(); - -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (block.isAir(worldIn, blockpos1) || block.isLeaves(worldIn, blockpos1)) - { - this.func_175905_a(worldIn, blockpos1, Blocks.leaves, BlockPlanks.EnumType.BIRCH.getMetadata()); - } -@@ -110,9 +112,10 @@ - - for (i2 = 0; i2 < i; ++i2) - { -- Block block2 = worldIn.getBlockState(p_180709_3_.up(i2)).getBlock(); -+ BlockPos upN = p_180709_3_.up(i2); -+ Block block2 = worldIn.getBlockState(upN).getBlock(); - -- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves) -+ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN)) - { - this.func_175905_a(worldIn, p_180709_3_.up(i2), Blocks.log, BlockPlanks.EnumType.BIRCH.getMetadata()); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch deleted file mode 100644 index ba7c2ce39..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch +++ /dev/null @@ -1,66 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java -@@ -59,7 +59,7 @@ - { - for (int l = -b0; l <= b0 && flag; ++l) - { -- if (p_175926_2_.getY() + j < 0 || p_175926_2_.getY() + j >= 256 || !this.func_150523_a(worldIn.getBlockState(p_175926_2_.add(k, j, l)).getBlock())) -+ if (p_175926_2_.getY() + j < 0 || p_175926_2_.getY() + j >= 256 || !this.isReplaceable(worldIn, p_175926_2_.add(k, j, l))) - { - flag = false; - } -@@ -79,13 +79,14 @@ - { - BlockPos blockpos1 = p_175927_1_.down(); - Block block = worldIn.getBlockState(blockpos1).getBlock(); -+ boolean isSoil = block.canSustainPlant(worldIn, blockpos1, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - -- if ((block == Blocks.grass || block == Blocks.dirt) && p_175927_1_.getY() >= 2) -+ if (isSoil && p_175927_1_.getY() >= 2) - { -- this.func_175921_a(worldIn, blockpos1); -- this.func_175921_a(worldIn, blockpos1.east()); -- this.func_175921_a(worldIn, blockpos1.south()); -- this.func_175921_a(worldIn, blockpos1.south().east()); -+ this.onPlantGrow(worldIn, blockpos1, p_175927_1_); -+ this.onPlantGrow(worldIn, blockpos1.east(), p_175927_1_); -+ this.onPlantGrow(worldIn, blockpos1.south(), p_175927_1_); -+ this.onPlantGrow(worldIn, blockpos1.south().east(), p_175927_1_); - return true; - } - else -@@ -113,9 +114,9 @@ - if (k * k + l * l <= j || i1 * i1 + j1 * j1 <= j || k * k + j1 * j1 <= j || i1 * i1 + l * l <= j) - { - BlockPos blockpos1 = p_175925_2_.add(k, 0, l); -- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); -+ net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos1); - -- if (material == Material.air || material == Material.leaves) -+ if (state.getBlock().isAir(worldIn, blockpos1) || state.getBlock().isLeaves(worldIn, blockpos1)) - { - this.func_175905_a(worldIn, blockpos1, Blocks.leaves, this.leavesMetadata); - } -@@ -135,9 +136,9 @@ - if (k * k + l * l <= j) - { - BlockPos blockpos1 = p_175928_2_.add(k, 0, l); -- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); -+ Block block = worldIn.getBlockState(blockpos1).getBlock(); - -- if (material == Material.air || material == Material.leaves) -+ if (block.isAir(worldIn, blockpos1) || block.isLeaves(worldIn, blockpos1)) - { - this.func_175905_a(worldIn, blockpos1, Blocks.leaves, this.leavesMetadata); - } -@@ -145,4 +146,10 @@ - } - } - } -+ -+ //Just a helper macro -+ private void onPlantGrow(World world, BlockPos pos, BlockPos source) -+ { -+ world.getBlockState(pos).getBlock().onPlantGrow(world, pos, source); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch deleted file mode 100644 index e68e9e598..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch +++ /dev/null @@ -1,62 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java -@@ -57,7 +57,7 @@ - { - BlockPos blockpos1 = p_180709_3_.up(i2); - -- if (this.func_175931_a(worldIn.getBlockState(blockpos1).getBlock().getMaterial())) -+ if (this.isAirLeaves(worldIn, blockpos1)) - { - this.func_175905_a(worldIn, blockpos1, Blocks.log, this.woodMetadata); - -@@ -72,7 +72,7 @@ - { - BlockPos blockpos2 = blockpos1.east(); - -- if (this.func_175931_a(worldIn.getBlockState(blockpos2).getBlock().getMaterial())) -+ if (this.isAirLeaves(worldIn, blockpos2)) - { - this.func_175905_a(worldIn, blockpos2, Blocks.log, this.woodMetadata); - -@@ -85,7 +85,7 @@ - - BlockPos blockpos3 = blockpos1.south().east(); - -- if (this.func_175931_a(worldIn.getBlockState(blockpos3).getBlock().getMaterial())) -+ if (this.isAirLeaves(worldIn, blockpos3)) - { - this.func_175905_a(worldIn, blockpos3, Blocks.log, this.woodMetadata); - -@@ -98,7 +98,7 @@ - - BlockPos blockpos4 = blockpos1.south(); - -- if (this.func_175931_a(worldIn.getBlockState(blockpos4).getBlock().getMaterial())) -+ if (this.isAirLeaves(worldIn, blockpos4)) - { - this.func_175905_a(worldIn, blockpos4, Blocks.log, this.woodMetadata); - -@@ -115,11 +115,6 @@ - } - } - -- private boolean func_175931_a(Material p_175931_1_) -- { -- return p_175931_1_ == Material.air || p_175931_1_ == Material.leaves; -- } -- - private void func_175932_b(World worldIn, Random p_175932_2_, BlockPos p_175932_3_, int p_175932_4_) - { - if (p_175932_2_.nextInt(3) > 0 && worldIn.isAirBlock(p_175932_3_)) -@@ -137,4 +132,11 @@ - this.func_175925_a(worldIn, p_175930_2_.up(j), p_175930_3_ + 1 - j); - } - } -+ -+ //Helper macro -+ private boolean isAirLeaves(World world, BlockPos pos) -+ { -+ net.minecraft.block.Block block = world.getBlockState(pos).getBlock(); -+ return block.isAir(world, pos) || block.isLeaves(world, pos); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch deleted file mode 100644 index 977698bfd..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch +++ /dev/null @@ -1,65 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java -@@ -35,32 +35,24 @@ - - for (int j = 0; j < i; ++j) - { -- Block block = worldIn.getBlockState(p_180709_3_.up(j)).getBlock(); -- -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (this.isAirLeaves(worldIn, p_180709_3_.up(j))) - { - this.func_175905_a(worldIn, p_180709_3_.up(j), Blocks.log, this.woodMetadata); - } - - if (j < i - 1) - { -- block = worldIn.getBlockState(p_180709_3_.add(1, j, 0)).getBlock(); -- -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (this.isAirLeaves(worldIn, p_180709_3_.add(1, j, 0))) - { - this.func_175905_a(worldIn, p_180709_3_.add(1, j, 0), Blocks.log, this.woodMetadata); - } - -- block = worldIn.getBlockState(p_180709_3_.add(1, j, 1)).getBlock(); -- -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (this.isAirLeaves(worldIn, p_180709_3_.add(1, j, 1))) - { - this.func_175905_a(worldIn, p_180709_3_.add(1, j, 1), Blocks.log, this.woodMetadata); - } - -- block = worldIn.getBlockState(p_180709_3_.add(0, j, 1)).getBlock(); -- -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) -+ if (this.isAirLeaves(worldIn, p_180709_3_.add(0, j, 1))) - { - this.func_175905_a(worldIn, p_180709_3_.add(0, j, 1), Blocks.log, this.woodMetadata); - } -@@ -126,16 +118,23 @@ - BlockPos blockpos1 = p_175934_2_.up(i); - Block block = worldIn.getBlockState(blockpos1).getBlock(); - -- if (block == Blocks.grass || block == Blocks.dirt) -+ if (block.canSustainPlant(worldIn, blockpos1, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) - { - this.func_175905_a(worldIn, blockpos1, Blocks.dirt, BlockDirt.DirtType.PODZOL.getMetadata()); - break; - } - -- if (block.getMaterial() != Material.air && i < 0) -+ if (!block.isAir(worldIn, blockpos1) && i < 0) - { - break; - } - } - } -+ -+ //Helper macro -+ private boolean isAirLeaves(World world, BlockPos pos) -+ { -+ net.minecraft.block.Block block = world.getBlockState(pos).getBlock(); -+ return block.isAir(world, pos) || block.isLeaves(world, pos); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch deleted file mode 100644 index 481106e17..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java -@@ -74,7 +74,7 @@ - { - BlockPos blockpos1 = new BlockPos(l1, i2, j2); - -- if (this.field_175919_c.apply(worldIn.getBlockState(blockpos1))) -+ if (worldIn.getBlockState(blockpos1).getBlock().isReplaceableOreGen(worldIn, blockpos1, this.field_175919_c)) - { - worldIn.setBlockState(blockpos1, this.oreBlock, 2); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch deleted file mode 100644 index c7fe1a680..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java -@@ -48,7 +48,7 @@ - { - if (j >= 0 && j < 256) - { -- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(k, j, l)).getBlock())) -+ if (!this.isReplaceable(worldIn, new BlockPos(k, j, l))) - { - flag = false; - } -@@ -67,11 +67,13 @@ - } - else - { -- Block block = worldIn.getBlockState(p_180709_3_.down()).getBlock(); -+ BlockPos down = p_180709_3_.down(); -+ Block block = worldIn.getBlockState(down).getBlock(); -+ boolean isSoil = block.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - -- if ((block == Blocks.grass || block == Blocks.dirt) && p_180709_3_.getY() < 256 - i - 1) -+ if (isSoil && p_180709_3_.getY() < 256 - i - 1) - { -- this.func_175921_a(worldIn, p_180709_3_.down()); -+ block.onPlantGrow(worldIn, down, p_180709_3_); - EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(p_180709_2_); - k = i - p_180709_2_.nextInt(4) - 1; - l = 3 - p_180709_2_.nextInt(3); -@@ -92,9 +94,9 @@ - } - - BlockPos blockpos1 = new BlockPos(i1, i2, j1); -- Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); -+ block = worldIn.getBlockState(blockpos1).getBlock(); - -- if (material == Material.air || material == Material.leaves) -+ if (block.isAir(worldIn, blockpos1) || block.isLeaves(worldIn, blockpos1)) - { - this.func_175905_a(worldIn, blockpos1, Blocks.log2, BlockPlanks.EnumType.ACACIA.getMetadata() - 4); - k1 = i2; -@@ -148,9 +150,9 @@ - i1 += enumfacing1.getFrontOffsetX(); - j1 += enumfacing1.getFrontOffsetZ(); - BlockPos blockpos2 = new BlockPos(i1, j2, j1); -- Material material1 = worldIn.getBlockState(blockpos2).getBlock().getMaterial(); -+ block = worldIn.getBlockState(blockpos2).getBlock(); - -- if (material1 == Material.air || material1 == Material.leaves) -+ if (block.isAir(worldIn, blockpos2) || block.isLeaves(worldIn, blockpos2)) - { - this.func_175905_a(worldIn, blockpos2, Blocks.log2, BlockPlanks.EnumType.ACACIA.getMetadata() - 4); - k1 = j2; -@@ -204,9 +206,9 @@ - - private void func_175924_b(World worldIn, BlockPos p_175924_2_) - { -- Material material = worldIn.getBlockState(p_175924_2_).getBlock().getMaterial(); -+ Block block = worldIn.getBlockState(p_175924_2_).getBlock(); - -- if (material == Material.air || material == Material.leaves) -+ if (block.isAir(worldIn, p_175924_2_) || block.isLeaves(worldIn, p_175924_2_)) - { - this.func_175905_a(worldIn, p_175924_2_, Blocks.leaves2, 0); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch deleted file mode 100644 index 8e0457eb7..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java -@@ -24,14 +24,16 @@ - { - Block block; - -- while (((block = worldIn.getBlockState(p_180709_3_).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && p_180709_3_.getY() > 0) -+ do - { -+ block = worldIn.getBlockState(p_180709_3_).getBlock(); -+ if (!block.isAir(worldIn, p_180709_3_) && !block.isLeaves(worldIn, p_180709_3_)) break; - p_180709_3_ = p_180709_3_.down(); -- } -+ } while (p_180709_3_.getY() > 0); - - Block block1 = worldIn.getBlockState(p_180709_3_).getBlock(); - -- if (block1 == Blocks.dirt || block1 == Blocks.grass) -+ if (block1.canSustainPlant(worldIn, p_180709_3_, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling))) - { - p_180709_3_ = p_180709_3_.up(); - this.func_175905_a(worldIn, p_180709_3_, Blocks.log, this.field_150527_b); -@@ -53,7 +55,7 @@ - { - BlockPos blockpos1 = new BlockPos(l, i, j1); - -- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) -+ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) - { - this.func_175905_a(worldIn, blockpos1, Blocks.leaves, this.field_150528_a); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch deleted file mode 100644 index 9f494c4d2..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch +++ /dev/null @@ -1,98 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java -@@ -53,9 +53,10 @@ - { - if (j >= 0 && j < 256) - { -- Block block = worldIn.getBlockState(new BlockPos(k, j, l)).getBlock(); -+ BlockPos pos = new BlockPos(k, j, l); -+ Block block = worldIn.getBlockState(pos).getBlock(); - -- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) -+ if (!block.isAir(worldIn, pos) && !block.isLeaves(worldIn, pos)) - { - if (block != Blocks.water && block != Blocks.flowing_water) - { -@@ -81,11 +82,13 @@ - } - else - { -- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); -+ BlockPos down = p_180709_3_.down(); -+ Block block1 = worldIn.getBlockState(down).getBlock(); -+ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.sapling)); - -- if ((block1 == Blocks.grass || block1 == Blocks.dirt) && p_180709_3_.getY() < 256 - i - 1) -+ if (isSoil && p_180709_3_.getY() < 256 - i - 1) - { -- this.func_175921_a(worldIn, p_180709_3_.down()); -+ block1.onPlantGrow(worldIn, down, p_180709_3_); - int i1; - BlockPos blockpos1; - int l1; -@@ -108,7 +111,7 @@ - { - blockpos1 = new BlockPos(i2, l1, j1); - -- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) -+ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) - { - this.func_175906_a(worldIn, blockpos1, Blocks.leaves); - } -@@ -119,9 +122,10 @@ - - for (l1 = 0; l1 < i; ++l1) - { -- Block block2 = worldIn.getBlockState(p_180709_3_.up(l1)).getBlock(); -+ BlockPos upN = p_180709_3_.up(l1); -+ Block block2 = worldIn.getBlockState(upN).getBlock(); - -- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves || block2 == Blocks.flowing_water || block2 == Blocks.water) -+ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN) || block2 == Blocks.flowing_water || block2 == Blocks.water) - { - this.func_175906_a(worldIn, p_180709_3_.up(l1), Blocks.log); - } -@@ -138,29 +142,29 @@ - { - BlockPos blockpos4 = new BlockPos(i2, l1, i1); - -- if (worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.leaves) -+ if (worldIn.getBlockState(blockpos4).getBlock().isLeaves(worldIn, blockpos4)) - { - BlockPos blockpos5 = blockpos4.west(); - blockpos1 = blockpos4.east(); - BlockPos blockpos2 = blockpos4.north(); - BlockPos blockpos3 = blockpos4.south(); - -- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos5).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos5).getBlock().isAir(worldIn, blockpos5)) - { - this.func_175922_a(worldIn, blockpos5, BlockVine.EAST_FLAG); - } - -- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().isAir(worldIn, blockpos1)) - { - this.func_175922_a(worldIn, blockpos1, BlockVine.WEST_FLAG); - } - -- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().isAir(worldIn, blockpos2)) - { - this.func_175922_a(worldIn, blockpos2, BlockVine.SOUTH_FLAG); - } - -- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().isAir(worldIn, blockpos3)) - { - this.func_175922_a(worldIn, blockpos3, BlockVine.NORTH_FLAG); - } -@@ -188,7 +192,7 @@ - this.func_175905_a(worldIn, p_175922_2_, Blocks.vine, p_175922_3_); - int j = 4; - -- for (p_175922_2_ = p_175922_2_.down(); worldIn.getBlockState(p_175922_2_).getBlock().getMaterial() == Material.air && j > 0; --j) -+ for (p_175922_2_ = p_175922_2_.down(); worldIn.getBlockState(p_175922_2_).getBlock().isAir(worldIn, p_175922_2_) && j > 0; --j) - { - this.func_175905_a(worldIn, p_175922_2_, Blocks.vine, p_175922_3_); - p_175922_2_ = p_175922_2_.down(); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch deleted file mode 100644 index 61623fed2..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java -@@ -50,7 +50,7 @@ - { - if (i1 >= 0 && i1 < 256) - { -- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(j1, i1, k1)).getBlock())) -+ if (!this.isReplaceable(worldIn, new BlockPos(j1, i1, k1))) - { - flag = false; - } -@@ -69,11 +69,13 @@ - } - else - { -- Block block = worldIn.getBlockState(p_180709_3_.down()).getBlock(); -+ BlockPos down = p_180709_3_.down(); -+ Block block = worldIn.getBlockState(down).getBlock(); -+ boolean isSoil = block.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); - -- if ((block == Blocks.grass || block == Blocks.dirt) && p_180709_3_.getY() < 256 - i - 1) -+ if (isSoil && p_180709_3_.getY() < 256 - i - 1) - { -- this.func_175921_a(worldIn, p_180709_3_.down()); -+ block.onPlantGrow(worldIn, down, p_180709_3_); - k2 = 0; - - for (j1 = p_180709_3_.getY() + i; j1 >= p_180709_3_.getY() + j; --j1) -@@ -90,7 +92,7 @@ - { - BlockPos blockpos1 = new BlockPos(k1, j1, i2); - -- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) -+ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) - { - this.func_175905_a(worldIn, blockpos1, Blocks.leaves, BlockPlanks.EnumType.SPRUCE.getMetadata()); - } -@@ -110,9 +112,10 @@ - - for (j1 = 0; j1 < i - 1; ++j1) - { -- Block block1 = worldIn.getBlockState(p_180709_3_.up(j1)).getBlock(); -+ BlockPos upN = p_180709_3_.up(j1); -+ Block block1 = worldIn.getBlockState(upN).getBlock(); - -- if (block1.getMaterial() == Material.air || block1.getMaterial() == Material.leaves) -+ if (block1.isAir(worldIn, upN) || block1.isLeaves(worldIn, upN)) - { - this.func_175905_a(worldIn, p_180709_3_.up(j1), Blocks.log, BlockPlanks.EnumType.SPRUCE.getMetadata()); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch deleted file mode 100644 index ba4253cd2..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch +++ /dev/null @@ -1,54 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java -@@ -49,9 +49,10 @@ - { - if (i1 >= 0 && i1 < 256) - { -- Block block = worldIn.getBlockState(new BlockPos(j1, i1, k1)).getBlock(); -+ BlockPos off = new BlockPos(j1, i1, k1); -+ Block block = worldIn.getBlockState(off).getBlock(); - -- if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) -+ if (!block.isAir(worldIn, off) && !block.isLeaves(worldIn, off)) - { - flag = false; - } -@@ -70,11 +71,13 @@ - } - else - { -- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); -+ BlockPos down = p_180709_3_.down(); -+ Block block1 = worldIn.getBlockState(down).getBlock(); -+ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); - -- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && p_180709_3_.getY() < 256 - i - 1) -+ if (isSoil && p_180709_3_.getY() < 256 - i - 1) - { -- this.func_175921_a(worldIn, p_180709_3_.down()); -+ block1.onPlantGrow(worldIn, down, p_180709_3_); - i3 = p_180709_2_.nextInt(2); - j1 = 1; - byte b0 = 0; -@@ -97,7 +100,7 @@ - { - BlockPos blockpos1 = new BlockPos(i2, l1, k2); - -- if (!worldIn.getBlockState(blockpos1).getBlock().isFullBlock()) -+ if (worldIn.getBlockState(blockpos1).getBlock().canBeReplacedByLeaves(worldIn, blockpos1)) - { - this.func_175905_a(worldIn, blockpos1, Blocks.leaves, BlockPlanks.EnumType.SPRUCE.getMetadata()); - } -@@ -126,9 +129,10 @@ - - for (l1 = 0; l1 < i - j3; ++l1) - { -- Block block2 = worldIn.getBlockState(p_180709_3_.up(l1)).getBlock(); -+ BlockPos upN = p_180709_3_.up(l1); -+ Block block2 = worldIn.getBlockState(upN).getBlock(); - -- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves) -+ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN)) - { - this.func_175905_a(worldIn, p_180709_3_.up(l1), Blocks.log, BlockPlanks.EnumType.SPRUCE.getMetadata()); - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch deleted file mode 100644 index b4a3e7320..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java -@@ -23,10 +23,12 @@ - { - Block block; - -- while (((block = worldIn.getBlockState(p_180709_3_).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && p_180709_3_.getY() > 0) -+ do - { -+ block = worldIn.getBlockState(p_180709_3_).getBlock(); -+ if (!block.isAir(worldIn, p_180709_3_) && !block.isLeaves(worldIn, p_180709_3_)) break; - p_180709_3_ = p_180709_3_.down(); -- } -+ } while (p_180709_3_.getY() > 0); - - for (int i = 0; i < 128; ++i) - { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch deleted file mode 100644 index 83d55d981..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch +++ /dev/null @@ -1,94 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java -@@ -61,7 +61,7 @@ - { - if (j >= 0 && j < 256) - { -- if (!this.func_150523_a(worldIn.getBlockState(new BlockPos(k, j, l)).getBlock())) -+ if (!this.isReplaceable(worldIn, new BlockPos(k, j, l))) - { - flag = false; - } -@@ -80,11 +80,13 @@ - } - else - { -- Block block1 = worldIn.getBlockState(p_180709_3_.down()).getBlock(); -+ BlockPos down = p_180709_3_.down(); -+ Block block1 = worldIn.getBlockState(down).getBlock(); -+ boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.sapling); - -- if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && p_180709_3_.getY() < 256 - i - 1) -+ if (isSoil && p_180709_3_.getY() < 256 - i - 1) - { -- this.func_175921_a(worldIn, p_180709_3_.down()); -+ block1.onPlantGrow(worldIn, down, p_180709_3_); - b0 = 3; - byte b1 = 0; - int i1; -@@ -111,7 +113,7 @@ - blockpos1 = new BlockPos(k1, l, i2); - Block block = worldIn.getBlockState(blockpos1).getBlock(); - -- if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves || block.getMaterial() == Material.vine) -+ if (block.isAir(worldIn, blockpos1) || block.isLeaves(worldIn, blockpos1) || block.getMaterial() == Material.vine) - { - this.func_175905_a(worldIn, blockpos1, Blocks.leaves, this.metaLeaves); - } -@@ -122,9 +124,10 @@ - - for (l = 0; l < i; ++l) - { -- Block block2 = worldIn.getBlockState(p_180709_3_.up(l)).getBlock(); -+ BlockPos upN = p_180709_3_.up(l); -+ Block block2 = worldIn.getBlockState(upN).getBlock(); - -- if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves || block2.getMaterial() == Material.vine) -+ if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN) || block2.getMaterial() == Material.vine) - { - this.func_175905_a(worldIn, p_180709_3_.up(l), Blocks.log, this.metaWood); - -@@ -166,29 +169,29 @@ - { - BlockPos blockpos3 = new BlockPos(k1, l, l1); - -- if (worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.leaves) -+ if (worldIn.getBlockState(blockpos3).getBlock().isLeaves(worldIn, blockpos3)) - { - BlockPos blockpos4 = blockpos3.west(); - blockpos1 = blockpos3.east(); - BlockPos blockpos5 = blockpos3.north(); - BlockPos blockpos2 = blockpos3.south(); - -- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().isAir(worldIn, blockpos4)) - { - this.func_175923_a(worldIn, blockpos4, BlockVine.EAST_FLAG); - } - -- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().isAir(worldIn, blockpos1)) - { - this.func_175923_a(worldIn, blockpos1, BlockVine.WEST_FLAG); - } - -- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos5).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos5).getBlock().isAir(worldIn, blockpos5)) - { - this.func_175923_a(worldIn, blockpos5, BlockVine.SOUTH_FLAG); - } - -- if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().getMaterial() == Material.air) -+ if (p_180709_2_.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().isAir(worldIn, blockpos2)) - { - this.func_175923_a(worldIn, blockpos2, BlockVine.NORTH_FLAG); - } -@@ -233,7 +236,7 @@ - this.func_175905_a(worldIn, p_175923_2_, Blocks.vine, p_175923_3_); - int j = 4; - -- for (p_175923_2_ = p_175923_2_.down(); worldIn.getBlockState(p_175923_2_).getBlock().getMaterial() == Material.air && j > 0; --j) -+ for (p_175923_2_ = p_175923_2_.down(); worldIn.getBlockState(p_175923_2_).getBlock().isAir(worldIn, p_175923_2_) && j > 0; --j) - { - this.func_175905_a(worldIn, p_175923_2_, Blocks.vine, p_175923_3_); - p_175923_2_ = p_175923_2_.down(); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch deleted file mode 100644 index e46096942..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java -+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java -@@ -27,10 +27,12 @@ - { - Block block; - -- while (((block = worldIn.getBlockState(p_180709_3_).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && p_180709_3_.getY() > 1) -+ do - { -+ block = worldIn.getBlockState(p_180709_3_).getBlock(); -+ if (!block.isAir(worldIn, p_180709_3_) && !block.isLeaves(worldIn, p_180709_3_)) break; - p_180709_3_ = p_180709_3_.down(); -- } -+ } while (p_180709_3_.getY() > 0); - - if (p_180709_3_.getY() < 1) - { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch deleted file mode 100644 index a6a1784f0..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/layer/GenLayer.java -+++ ../src-work/minecraft/net/minecraft/world/gen/layer/GenLayer.java -@@ -8,6 +8,9 @@ - import net.minecraft.world.biome.BiomeGenBase; - import net.minecraft.world.gen.ChunkProviderSettings; - -+import net.minecraftforge.common.*; -+import net.minecraftforge.event.terraingen.*; -+ - public abstract class GenLayer - { - private long worldGenSeed; -@@ -53,11 +56,11 @@ - j = 6; - } - -+ j = getModdedBiomeSize(p_180781_2_, j); -+ - GenLayer genlayer = GenLayerZoom.magnify(1000L, genlayer2, 0); - GenLayerRiverInit genlayerriverinit = new GenLayerRiverInit(100L, genlayer); -- GenLayerBiome genlayerbiome = new GenLayerBiome(200L, genlayer2, p_180781_2_, p_180781_3_); -- GenLayer genlayer3 = GenLayerZoom.magnify(1000L, genlayerbiome, 2); -- GenLayerBiomeEdge genlayerbiomeedge = new GenLayerBiomeEdge(1000L, genlayer3); -+ GenLayer genlayerbiomeedge = p_180781_2_.getBiomeLayer(p_180781_0_, genlayer2, p_180781_3_); - GenLayer genlayer1 = GenLayerZoom.magnify(1000L, genlayerriverinit, 2); - GenLayerHills genlayerhills = new GenLayerHills(1000L, genlayerbiomeedge, genlayer1); - genlayer = GenLayerZoom.magnify(1000L, genlayerriverinit, 2); -@@ -194,7 +197,7 @@ - - protected static boolean isBiomeOceanic(int p_151618_0_) - { -- return p_151618_0_ == BiomeGenBase.ocean.biomeID || p_151618_0_ == BiomeGenBase.deepOcean.biomeID || p_151618_0_ == BiomeGenBase.frozenOcean.biomeID; -+ return BiomeManager.oceanBiomes.contains(BiomeGenBase.getBiome(p_151618_0_)); - } - - protected int selectRandom(int ... p_151619_1_) -@@ -206,4 +209,27 @@ - { - return p_151617_2_ == p_151617_3_ && p_151617_3_ == p_151617_4_ ? p_151617_2_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_3_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_3_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_2_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_4_ && p_151617_2_ != p_151617_3_ ? p_151617_1_ : (p_151617_2_ == p_151617_3_ && p_151617_1_ != p_151617_4_ ? p_151617_2_ : (p_151617_2_ == p_151617_4_ && p_151617_1_ != p_151617_3_ ? p_151617_2_ : (p_151617_3_ == p_151617_4_ && p_151617_1_ != p_151617_2_ ? p_151617_3_ : this.selectRandom(new int[] {p_151617_1_, p_151617_2_, p_151617_3_, p_151617_4_})))))))))); - } -+ -+ /* ======================================== FORGE START =====================================*/ -+ protected long nextLong(long par1) -+ { -+ long j = (this.chunkSeed >> 24) % par1; -+ -+ if (j < 0) -+ { -+ j += par1; -+ } -+ -+ this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; -+ this.chunkSeed += this.worldGenSeed; -+ return j; -+ } -+ -+ public static int getModdedBiomeSize(WorldType worldType, int original) -+ { -+ WorldTypeEvent.BiomeSize event = new WorldTypeEvent.BiomeSize(worldType, original); -+ MinecraftForge.TERRAIN_GEN_BUS.post(event); -+ return event.newSize; -+ } -+ /* ========================================= FORGE END ======================================*/ - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch deleted file mode 100644 index ecfb39760..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch +++ /dev/null @@ -1,107 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java -+++ ../src-work/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java -@@ -3,28 +3,49 @@ - import net.minecraft.world.WorldType; - import net.minecraft.world.biome.BiomeGenBase; - import net.minecraft.world.gen.ChunkProviderSettings; -+import java.util.ArrayList; -+import java.util.List; -+import net.minecraft.util.WeightedRandom; -+import net.minecraftforge.common.BiomeManager; -+import net.minecraftforge.common.BiomeManager.BiomeEntry; -+import static net.minecraftforge.common.BiomeManager.BiomeType.*; - - public class GenLayerBiome extends GenLayer - { -- private BiomeGenBase[] field_151623_c; -- private BiomeGenBase[] field_151621_d; -- private BiomeGenBase[] field_151622_e; -- private BiomeGenBase[] field_151620_f; -+ private List[] biomes = new ArrayList[BiomeManager.BiomeType.values().length]; -+ - private final ChunkProviderSettings field_175973_g; - private static final String __OBFID = "CL_00000555"; - - public GenLayerBiome(long p_i45560_1_, GenLayer p_i45560_3_, WorldType p_i45560_4_, String p_i45560_5_) - { - super(p_i45560_1_); -- this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.desert, BiomeGenBase.desert, BiomeGenBase.savanna, BiomeGenBase.savanna, BiomeGenBase.plains}; -- this.field_151621_d = new BiomeGenBase[] {BiomeGenBase.forest, BiomeGenBase.roofedForest, BiomeGenBase.extremeHills, BiomeGenBase.plains, BiomeGenBase.birchForest, BiomeGenBase.swampland}; -- this.field_151622_e = new BiomeGenBase[] {BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.taiga, BiomeGenBase.plains}; -- this.field_151620_f = new BiomeGenBase[] {BiomeGenBase.icePlains, BiomeGenBase.icePlains, BiomeGenBase.icePlains, BiomeGenBase.coldTaiga}; - this.parent = p_i45560_3_; - -+ for (BiomeManager.BiomeType type : BiomeManager.BiomeType.values()) -+ { -+ com.google.common.collect.ImmutableList biomesToAdd = BiomeManager.getBiomes(type); -+ int idx = type.ordinal(); -+ -+ if (biomes[idx] == null) biomes[idx] = new ArrayList(); -+ if (biomesToAdd != null) biomes[idx].addAll(biomesToAdd); -+ } -+ -+ int desertIdx = DESERT.ordinal(); -+ -+ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.desert, 30)); -+ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.savanna, 20)); -+ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.plains, 10)); -+ - if (p_i45560_4_ == WorldType.DEFAULT_1_1) - { -- this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.swampland, BiomeGenBase.plains, BiomeGenBase.taiga}; -+ biomes[desertIdx].clear(); -+ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.desert, 10)); -+ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.forest, 10)); -+ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.extremeHills, 10)); -+ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.swampland, 10)); -+ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.plains, 10)); -+ biomes[desertIdx].add(new BiomeEntry(BiomeGenBase.taiga, 10)); - this.field_175973_g = null; - } - else if (p_i45560_4_ == WorldType.CUSTOMIZED) -@@ -78,7 +99,7 @@ - } - else - { -- aint1[j1 + i1 * areaWidth] = this.field_151623_c[this.nextInt(this.field_151623_c.length)].biomeID; -+ aint1[j1 + i1 * areaWidth] = getWeightedBiomeEntry(DESERT).biome.biomeID; - } - } - else if (k1 == 2) -@@ -89,7 +110,7 @@ - } - else - { -- aint1[j1 + i1 * areaWidth] = this.field_151621_d[this.nextInt(this.field_151621_d.length)].biomeID; -+ aint1[j1 + i1 * areaWidth] = getWeightedBiomeEntry(WARM).biome.biomeID; - } - } - else if (k1 == 3) -@@ -100,12 +121,12 @@ - } - else - { -- aint1[j1 + i1 * areaWidth] = this.field_151622_e[this.nextInt(this.field_151622_e.length)].biomeID; -+ aint1[j1 + i1 * areaWidth] = getWeightedBiomeEntry(COOL).biome.biomeID; - } - } - else if (k1 == 4) - { -- aint1[j1 + i1 * areaWidth] = this.field_151620_f[this.nextInt(this.field_151620_f.length)].biomeID; -+ aint1[j1 + i1 * areaWidth] = getWeightedBiomeEntry(ICY).biome.biomeID; - } - else - { -@@ -116,4 +137,12 @@ - - return aint1; - } -+ -+ protected BiomeEntry getWeightedBiomeEntry(BiomeManager.BiomeType type) -+ { -+ List biomeList = biomes[type.ordinal()]; -+ int totalWeight = WeightedRandom.getTotalWeight(biomeList); -+ int weight = BiomeManager.isTypeListModded(type)?nextInt(totalWeight):nextInt(totalWeight / 10) * 10; -+ return (BiomeEntry)WeightedRandom.getRandomItem(biomeList, weight); -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch deleted file mode 100644 index ee65e0a22..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch +++ /dev/null @@ -1,94 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java -@@ -17,11 +17,14 @@ - import net.minecraft.init.Blocks; - import net.minecraft.init.Items; - import net.minecraft.item.EnumDyeColor; -+import net.minecraft.item.ItemStack; - import net.minecraft.nbt.NBTTagCompound; - import net.minecraft.util.BlockPos; - import net.minecraft.util.EnumFacing; - import net.minecraft.util.WeightedRandomChestContent; - import net.minecraft.world.World; -+import net.minecraftforge.common.ChestGenHooks; -+import static net.minecraftforge.common.ChestGenHooks.*; - - public class ComponentScatteredFeaturePieces - { -@@ -42,6 +45,12 @@ - - public DesertPyramid() {} - -+ static -+ { -+ ChestGenHooks.init(PYRAMID_DESERT_CHEST, itemsToGenerateInTemple, 2, 7); -+ ChestGenHooks.addItem(PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(new ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); -+ } -+ - public DesertPyramid(Random p_i2062_1_, int p_i2062_2_, int p_i2062_3_) - { - super(p_i2062_1_, p_i2062_2_, 64, p_i2062_3_, 21, 15, 21); -@@ -267,7 +276,7 @@ - { - int k1 = enumfacing.getFrontOffsetX() * 2; - int l1 = enumfacing.getFrontOffsetZ() * 2; -- this.field_74940_h[enumfacing.getHorizontalIndex()] = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 10 + k1, -11, 10 + l1, WeightedRandomChestContent.func_177629_a(itemsToGenerateInTemple, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); -+ this.field_74940_h[enumfacing.getHorizontalIndex()] = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 10 + k1, -11, 10 + l1, ChestGenHooks.getItems(PYRAMID_DESERT_CHEST, p_74875_2_), ChestGenHooks.getCount(PYRAMID_DESERT_CHEST, p_74875_2_)); - } - } - -@@ -370,6 +379,13 @@ - private static ComponentScatteredFeaturePieces.JunglePyramid.Stones junglePyramidsRandomScatteredStones = new ComponentScatteredFeaturePieces.JunglePyramid.Stones((ComponentScatteredFeaturePieces.SwitchEnumFacing)null); - private static final String __OBFID = "CL_00000477"; - -+ static -+ { -+ ChestGenHooks.init(PYRAMID_JUNGLE_DISPENSER, field_175815_j, 2, 2); -+ ChestGenHooks.init(PYRAMID_JUNGLE_CHEST, field_175816_i, 2, 7); -+ ChestGenHooks.addItem(PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(new ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); -+ } -+ - public JunglePyramid() {} - - public JunglePyramid(Random p_i2064_1_, int p_i2064_2_, int p_i2064_3_) -@@ -525,9 +541,12 @@ - this.func_175811_a(worldIn, Blocks.redstone_wire.getDefaultState(), 4, -3, 1, p_74875_3_); - this.func_175811_a(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 3, -3, 1, p_74875_3_); - -+ ChestGenHooks dispenser = ChestGenHooks.getInfo(PYRAMID_JUNGLE_DISPENSER); -+ ChestGenHooks chest = ChestGenHooks.getInfo(PYRAMID_JUNGLE_CHEST); -+ - if (!this.field_74945_j) - { -- this.field_74945_j = this.func_175806_a(worldIn, p_74875_3_, p_74875_2_, 3, -2, 1, EnumFacing.NORTH.getIndex(), field_175815_j, 2); -+ this.field_74945_j = this.func_175806_a(worldIn, p_74875_3_, p_74875_2_, 3, -2, 1, EnumFacing.NORTH.getIndex(), dispenser.getItems(p_74875_2_), dispenser.getCount(p_74875_2_)); - } - - this.func_175811_a(worldIn, Blocks.vine.getStateFromMeta(15), 3, -2, 2, p_74875_3_); -@@ -544,7 +563,7 @@ - - if (!this.field_74946_k) - { -- this.field_74946_k = this.func_175806_a(worldIn, p_74875_3_, p_74875_2_, 9, -2, 3, EnumFacing.WEST.getIndex(), field_175815_j, 2); -+ this.field_74946_k = this.func_175806_a(worldIn, p_74875_3_, p_74875_2_, 9, -2, 3, EnumFacing.WEST.getIndex(), dispenser.getItems(p_74875_2_), dispenser.getCount(p_74875_2_)); - } - - this.func_175811_a(worldIn, Blocks.vine.getStateFromMeta(15), 8, -1, 3, p_74875_3_); -@@ -552,7 +571,7 @@ - - if (!this.field_74947_h) - { -- this.field_74947_h = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 8, -3, 3, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); -+ this.field_74947_h = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 8, -3, 3, chest.getItems(p_74875_2_), chest.getCount(p_74875_2_)); - } - - this.func_175811_a(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 9, -3, 2, p_74875_3_); -@@ -585,7 +604,7 @@ - - if (!this.field_74948_i) - { -- this.field_74948_i = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 9, -3, 10, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 2 + p_74875_2_.nextInt(5)); -+ this.field_74948_i = this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 9, -3, 10, chest.getItems(p_74875_2_), chest.getCount(p_74875_2_)); - } - - return true; diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch deleted file mode 100644 index 6f64cda61..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java -@@ -35,11 +35,18 @@ - { - BiomeGenBase biomegenbase = abiomegenbase[j]; - -- if (biomegenbase != null && biomegenbase.minHeight > 0.0F) -+ if (biomegenbase != null && biomegenbase.minHeight > 0.0F && !net.minecraftforge.common.BiomeManager.strongHoldBiomesBlackList.contains(biomegenbase)) - { - this.field_151546_e.add(biomegenbase); - } - } -+ for (BiomeGenBase biome : net.minecraftforge.common.BiomeManager.strongHoldBiomes) -+ { -+ if (!this.field_151546_e.contains(biome)) -+ { -+ this.field_151546_e.add(biome); -+ } -+ } - } - - public MapGenStronghold(Map p_i2068_1_) diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch deleted file mode 100644 index 0832a9001..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java -@@ -231,12 +231,12 @@ - { - if (this.field_143029_e == null) - { -- this.field_143029_e = (MapGenStructureData)worldIn.loadItemData(MapGenStructureData.class, this.getStructureName()); -+ this.field_143029_e = (MapGenStructureData)worldIn.getPerWorldStorage().loadData(MapGenStructureData.class, this.getStructureName()); - - if (this.field_143029_e == null) - { - this.field_143029_e = new MapGenStructureData(this.getStructureName()); -- worldIn.setItemData(this.getStructureName(), this.field_143029_e); -+ worldIn.getPerWorldStorage().setData(this.getStructureName(), this.field_143029_e); - } - else - { diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch deleted file mode 100644 index 9f41e1cad..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureComponent.java.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureComponent.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureComponent.java -@@ -35,6 +35,10 @@ - - public NBTTagCompound func_143010_b() - { -+ if (MapGenStructureIO.func_143036_a(this) == null) // Friendlier error then the Null String error below. -+ { -+ throw new RuntimeException("StructureComponent \"" + this.getClass().getName() + "\" missing ID Mapping, Modder see MapGenStructureIO"); -+ } - NBTTagCompound nbttagcompound = new NBTTagCompound(); - nbttagcompound.setString("id", MapGenStructureIO.func_143036_a(this)); - nbttagcompound.setTag("BB", this.boundingBox.func_151535_h()); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch deleted file mode 100644 index e1e15e013..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java -@@ -19,6 +19,8 @@ - import net.minecraft.util.EnumFacing; - import net.minecraft.util.WeightedRandomChestContent; - import net.minecraft.world.World; -+import net.minecraftforge.common.ChestGenHooks; -+import static net.minecraftforge.common.ChestGenHooks.*; - - public class StructureMineshaftPieces - { -@@ -33,6 +35,12 @@ - MapGenStructureIO.registerStructureComponent(StructureMineshaftPieces.Stairs.class, "MSStairs"); - } - -+ static -+ { -+ ChestGenHooks.init(MINESHAFT_CORRIDOR, field_175893_a, 8, 8); -+ ChestGenHooks.addItem(MINESHAFT_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); -+ } -+ - private static StructureComponent func_175892_a(List p_175892_0_, Random p_175892_1_, int p_175892_2_, int p_175892_3_, int p_175892_4_, EnumFacing p_175892_5_, int p_175892_6_) - { - int i1 = p_175892_1_.nextInt(100); -@@ -354,14 +362,15 @@ - this.func_175809_a(worldIn, p_74875_3_, p_74875_2_, 0.05F, 1, 2, k - 1, Blocks.torch.getStateFromMeta(EnumFacing.UP.getIndex())); - this.func_175809_a(worldIn, p_74875_3_, p_74875_2_, 0.05F, 1, 2, k + 1, Blocks.torch.getStateFromMeta(EnumFacing.UP.getIndex())); - -+ ChestGenHooks info = ChestGenHooks.getInfo(MINESHAFT_CORRIDOR); - if (p_74875_2_.nextInt(100) == 0) - { -- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 2, 0, k - 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.field_175893_a, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 3 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 2, 0, k - 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); - } - - if (p_74875_2_.nextInt(100) == 0) - { -- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 0, 0, k + 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.field_175893_a, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 3 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 0, 0, k + 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); - } - - if (this.hasSpiders && !this.spawnerPlaced) diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch deleted file mode 100644 index 44c0e67ea..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java -@@ -154,7 +154,7 @@ - if (this.field_111021_b && p_74875_3_.func_175898_b(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) - { - this.field_111021_b = false; -- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 2, 3, field_111019_a, 2 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_)); - } - - this.func_175804_a(worldIn, p_74875_3_, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); -@@ -224,7 +224,7 @@ - if (this.field_111020_b && p_74875_3_.func_175898_b(new BlockPos(this.getXWithOffset(1, 3), this.getYWithOffset(2), this.getZWithOffset(1, 3)))) - { - this.field_111020_b = false; -- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 1, 2, 3, field_111019_a, 2 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 1, 2, 3, net.minecraftforge.common.ChestGenHooks.getItems(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_), net.minecraftforge.common.ChestGenHooks.getCount(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, p_74875_2_)); - } - - this.func_175804_a(worldIn, p_74875_3_, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); -@@ -953,6 +953,7 @@ - abstract static class Piece extends StructureComponent - { - protected static final List field_111019_a = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.diamond, 0, 1, 3, 5), new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 5), new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 15), new WeightedRandomChestContent(Items.golden_sword, 0, 1, 1, 5), new WeightedRandomChestContent(Items.golden_chestplate, 0, 1, 1, 5), new WeightedRandomChestContent(Items.flint_and_steel, 0, 1, 1, 5), new WeightedRandomChestContent(Items.nether_wart, 0, 3, 7, 5), new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 10), new WeightedRandomChestContent(Items.golden_horse_armor, 0, 1, 1, 8), new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 5), new WeightedRandomChestContent(Items.diamond_horse_armor, 0, 1, 1, 3), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.obsidian), 0, 2, 4, 2)}); -+ static { net.minecraftforge.common.ChestGenHooks.init(net.minecraftforge.common.ChestGenHooks.NETHER_FORTRESS, field_111019_a, 2, 5); } - private static final String __OBFID = "CL_00000466"; - - public Piece() {} diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch deleted file mode 100644 index 1dd1abc4d..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStart.java.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureStart.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureStart.java -@@ -63,6 +63,10 @@ - - public NBTTagCompound func_143021_a(int p_143021_1_, int p_143021_2_) - { -+ if (MapGenStructureIO.func_143033_a(this) == null) // This is just a more friendly error instead of the 'Null String' below -+ { -+ throw new RuntimeException("StructureStart \"" + this.getClass().getName() + "\" missing ID Mapping, Modder see MapGenStructureIO"); -+ } - NBTTagCompound nbttagcompound = new NBTTagCompound(); - nbttagcompound.setString("id", MapGenStructureIO.func_143033_a(this)); - nbttagcompound.setInteger("ChunkX", p_143021_1_); -@@ -98,7 +102,8 @@ - - for (int i = 0; i < nbttaglist.tagCount(); ++i) - { -- this.components.add(MapGenStructureIO.func_143032_b(nbttaglist.getCompoundTagAt(i), worldIn)); -+ StructureComponent tmp = MapGenStructureIO.func_143032_b(nbttaglist.getCompoundTagAt(i), worldIn); -+ if (tmp != null) this.components.add(tmp); //Forge: Prevent NPEs further down the line when a componenet can't be loaded. - } - - this.func_143017_b(p_143020_2_); diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch deleted file mode 100644 index 390cdf61d..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch +++ /dev/null @@ -1,84 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java -@@ -17,6 +17,8 @@ - import net.minecraft.util.EnumFacing; - import net.minecraft.util.WeightedRandomChestContent; - import net.minecraft.world.World; -+import net.minecraftforge.common.ChestGenHooks; -+import static net.minecraftforge.common.ChestGenHooks.*; - - public class StructureStrongholdPieces - { -@@ -248,6 +250,12 @@ - - public ChestCorridor() {} - -+ static -+ { -+ ChestGenHooks.init(STRONGHOLD_CORRIDOR, strongholdChestContents, 2, 4); -+ ChestGenHooks.addItem(STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); -+ } -+ - public ChestCorridor(int p_i45582_1_, Random p_i45582_2_, StructureBoundingBox p_i45582_3_, EnumFacing p_i45582_4_) - { - super(p_i45582_1_); -@@ -304,7 +312,7 @@ - if (!this.hasMadeChest && p_74875_3_.func_175898_b(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) - { - this.hasMadeChest = true; -- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 2, 3, WeightedRandomChestContent.func_177629_a(strongholdChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 2 + p_74875_2_.nextInt(2)); -+ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 2, 3, ChestGenHooks.getItems(STRONGHOLD_CORRIDOR, p_74875_2_), ChestGenHooks.getCount(STRONGHOLD_CORRIDOR, p_74875_2_)); - } - - return true; -@@ -599,6 +607,12 @@ - private boolean isLargeRoom; - private static final String __OBFID = "CL_00000491"; - -+ static -+ { -+ ChestGenHooks.init(STRONGHOLD_CORRIDOR, strongholdLibraryChestContents, 1, 5); -+ ChestGenHooks.addItem(STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 5, 2)); -+ } -+ - public Library() {} - - public Library(int p_i45578_1_, Random p_i45578_2_, StructureBoundingBox p_i45578_3_, EnumFacing p_i45578_4_) -@@ -742,12 +756,13 @@ - this.func_175811_a(worldIn, Blocks.torch.getDefaultState(), b1, 8, b2 + 1, p_74875_3_); - } - -- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 3, 5, WeightedRandomChestContent.func_177629_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_, 1, 5, 2)}), 1 + p_74875_2_.nextInt(4)); -+ ChestGenHooks info = ChestGenHooks.getInfo(STRONGHOLD_LIBRARY); -+ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 3, 5, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); - - if (this.isLargeRoom) - { - this.func_175811_a(worldIn, Blocks.air.getDefaultState(), 12, 9, 1, p_74875_3_); -- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 12, 8, 1, WeightedRandomChestContent.func_177629_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_, 1, 5, 2)}), 1 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 12, 8, 1, info.getItems(p_74875_2_), info.getCount(p_74875_2_)); - } - - return true; -@@ -1024,6 +1039,12 @@ - protected int roomType; - private static final String __OBFID = "CL_00000496"; - -+ static -+ { -+ ChestGenHooks.init(STRONGHOLD_CROSSING, strongholdRoomCrossingChestContents, 1, 5); -+ ChestGenHooks.addItem(STRONGHOLD_CROSSING, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.enchanted_book, 1, 0), 1, 1, 1)); -+ } -+ - public RoomCrossing() {} - - public RoomCrossing(int p_i45575_1_, Random p_i45575_2_, StructureBoundingBox p_i45575_3_, EnumFacing p_i45575_4_) -@@ -1159,7 +1180,7 @@ - this.func_175811_a(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 1, 3, p_74875_3_); - this.func_175811_a(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 2, 3, p_74875_3_); - this.func_175811_a(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 3, 3, p_74875_3_); -- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 4, 8, WeightedRandomChestContent.func_177629_a(strongholdRoomCrossingChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(p_74875_2_)}), 1 + p_74875_2_.nextInt(4)); -+ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 3, 4, 8, ChestGenHooks.getItems(STRONGHOLD_CROSSING, p_74875_2_), ChestGenHooks.getCount(STRONGHOLD_CROSSING, p_74875_2_)); - } - - return true; diff --git a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch b/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch deleted file mode 100644 index e285e0cfe..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch +++ /dev/null @@ -1,97 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java -+++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java -@@ -25,6 +25,11 @@ - import net.minecraft.world.World; - import net.minecraft.world.biome.BiomeGenBase; - import net.minecraft.world.biome.WorldChunkManager; -+import net.minecraftforge.fml.common.eventhandler.Event.Result; -+import net.minecraftforge.common.ChestGenHooks; -+import net.minecraftforge.common.MinecraftForge; -+import net.minecraftforge.event.terraingen.BiomeEvent; -+import static net.minecraftforge.common.ChestGenHooks.*; - - public class StructureVillagePieces - { -@@ -59,6 +64,8 @@ - arraylist.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Field2.class, 3, MathHelper.getRandomIntegerInRange(p_75084_0_, 2 + p_75084_1_, 4 + p_75084_1_ * 2))); - arraylist.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House2.class, 15, MathHelper.getRandomIntegerInRange(p_75084_0_, 0, 1 + p_75084_1_))); - arraylist.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House3.class, 8, MathHelper.getRandomIntegerInRange(p_75084_0_, 0 + p_75084_1_, 3 + p_75084_1_ * 2))); -+ net.minecraftforge.fml.common.registry.VillagerRegistry.addExtraVillageComponents(arraylist, p_75084_0_, p_75084_1_); -+ - Iterator iterator = arraylist.iterator(); - - while (iterator.hasNext()) -@@ -132,6 +139,10 @@ - { - object = StructureVillagePieces.House3.func_175849_a(p_176065_0_, p_176065_2_, p_176065_3_, p_176065_4_, p_176065_5_, p_176065_6_, p_176065_7_, p_176065_8_); - } -+ else -+ { -+ object = net.minecraftforge.fml.common.registry.VillagerRegistry.getVillageComponent(p_176065_1_, p_176065_0_ , p_176065_2_, p_176065_3_, p_176065_4_, p_176065_5_, p_176065_6_, p_176065_7_, p_176065_8_); -+ } - - return (StructureVillagePieces.Village)object; - } -@@ -842,6 +853,11 @@ - - public House2() {} - -+ static -+ { -+ ChestGenHooks.init(VILLAGE_BLACKSMITH, villageBlacksmithChestContents, 3, 8); -+ } -+ - public House2(StructureVillagePieces.Start p_i45563_1_, int p_i45563_2_, Random p_i45563_3_, StructureBoundingBox p_i45563_4_, EnumFacing p_i45563_5_) - { - super(p_i45563_1_, p_i45563_2_); -@@ -920,7 +936,7 @@ - if (!this.hasMadeChest && p_74875_3_.func_175898_b(new BlockPos(this.getXWithOffset(5, 5), this.getYWithOffset(1), this.getZWithOffset(5, 5)))) - { - this.hasMadeChest = true; -- this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 5, 1, 5, villageBlacksmithChestContents, 3 + p_74875_2_.nextInt(6)); -+ this.func_180778_a(worldIn, p_74875_3_, p_74875_2_, 5, 1, 5, ChestGenHooks.getItems(VILLAGE_BLACKSMITH, p_74875_2_), ChestGenHooks.getCount(VILLAGE_BLACKSMITH, p_74875_2_)); - } - - int i; -@@ -1422,6 +1438,7 @@ - public List field_74932_i = Lists.newArrayList(); - public List field_74930_j = Lists.newArrayList(); - private static final String __OBFID = "CL_00000527"; -+ public BiomeGenBase biome; - - public Start() {} - -@@ -1433,6 +1450,7 @@ - this.terrainType = p_i2104_7_; - BiomeGenBase biomegenbase = p_i2104_1_.func_180300_a(new BlockPos(p_i2104_4_, 0, p_i2104_5_), BiomeGenBase.field_180279_ad); - this.inDesert = biomegenbase == BiomeGenBase.desert || biomegenbase == BiomeGenBase.desertHills; -+ this.biome = biomegenbase; - this.func_175846_a(this.inDesert); - } - -@@ -1540,6 +1558,7 @@ - private int villagersSpawned; - private boolean field_143014_b; - private static final String __OBFID = "CL_00000531"; -+ private StructureVillagePieces.Start startPiece; - - public Village() {} - -@@ -1550,6 +1569,7 @@ - if (p_i2107_1_ != null) - { - this.field_143014_b = p_i2107_1_.inDesert; -+ startPiece = p_i2107_1_; - } - } - -@@ -1673,6 +1693,9 @@ - - protected IBlockState func_175847_a(IBlockState p_175847_1_) - { -+ BiomeEvent.GetVillageBlockID event = new BiomeEvent.GetVillageBlockID(startPiece == null ? null : startPiece.biome, p_175847_1_); -+ MinecraftForge.TERRAIN_GEN_BUS.post(event); -+ if (event.getResult() == Result.DENY) return event.replacement; - if (this.field_143014_b) - { - if (p_175847_1_.getBlock() == Blocks.log || p_175847_1_.getBlock() == Blocks.log2) diff --git a/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch deleted file mode 100644 index 4221e7c3e..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/storage/MapData.java.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/storage/MapData.java -+++ ../src-work/minecraft/net/minecraft/world/storage/MapData.java -@@ -22,7 +22,7 @@ - { - public int xCenter; - public int zCenter; -- public byte dimension; -+ public int dimension; //FML byte -> int - public byte scale; - public byte[] colors = new byte[16384]; - public List playersArrayList = Lists.newArrayList(); -@@ -46,7 +46,17 @@ - - public void readFromNBT(NBTTagCompound nbt) - { -- this.dimension = nbt.getByte("dimension"); -+ net.minecraft.nbt.NBTBase dimension = nbt.getTag("dimension"); -+ -+ if (dimension instanceof net.minecraft.nbt.NBTTagByte) -+ { -+ this.dimension = ((net.minecraft.nbt.NBTTagByte)dimension).getByte(); -+ } -+ else -+ { -+ this.dimension = ((net.minecraft.nbt.NBTTagInt)dimension).getInt(); -+ } -+ - this.xCenter = nbt.getInteger("xCenter"); - this.zCenter = nbt.getInteger("zCenter"); - this.scale = nbt.getByte("scale"); -@@ -87,7 +97,7 @@ - - public void writeToNBT(NBTTagCompound nbt) - { -- nbt.setByte("dimension", this.dimension); -+ nbt.setInteger("dimension", this.dimension); - nbt.setInteger("xCenter", this.xCenter); - nbt.setInteger("zCenter", this.zCenter); - nbt.setByte("scale", this.scale); -@@ -166,7 +176,7 @@ - p_82567_8_ += p_82567_8_ < 0.0D ? -8.0D : 8.0D; - b2 = (byte)((int)(p_82567_8_ * 16.0D / 360.0D)); - -- if (this.dimension < 0) -+ if (worldIn.provider.shouldMapSpin(p_82567_3_, p_82567_4_, p_82567_6_, p_82567_8_)) - { - int k = (int)(worldIn.getWorldInfo().getWorldTime() / 10L); - b2 = (byte)(k * k * 34187121 + k * 121 >> 15 & 15); diff --git a/patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch deleted file mode 100644 index 304284cdb..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/storage/SaveHandler.java.patch +++ /dev/null @@ -1,105 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/storage/SaveHandler.java -+++ ../src-work/minecraft/net/minecraft/world/storage/SaveHandler.java -@@ -107,20 +107,29 @@ - NBTTagCompound nbttagcompound; - NBTTagCompound nbttagcompound1; - -+ WorldInfo worldInfo = null; -+ - if (file1.exists()) - { - try - { - nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1)); - nbttagcompound1 = nbttagcompound.getCompoundTag("Data"); -- return new WorldInfo(nbttagcompound1); -+ worldInfo = new WorldInfo(nbttagcompound1); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound); -+ return worldInfo; - } -+ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) -+ { -+ throw e; -+ } - catch (Exception exception1) - { - exception1.printStackTrace(); - } - } - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().confirmBackupLevelDatUse(this); - file1 = new File(this.worldDirectory, "level.dat_old"); - - if (file1.exists()) -@@ -129,7 +138,13 @@ - { - nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1)); - nbttagcompound1 = nbttagcompound.getCompoundTag("Data"); -- return new WorldInfo(nbttagcompound1); -+ worldInfo = new WorldInfo(nbttagcompound1); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound); -+ return worldInfo; -+ } -+ catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) -+ { -+ throw e; - } - catch (Exception exception) - { -@@ -146,6 +161,8 @@ - NBTTagCompound nbttagcompound2 = new NBTTagCompound(); - nbttagcompound2.setTag("Data", nbttagcompound1); - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, worldInformation, nbttagcompound2); -+ - try - { - File file1 = new File(this.worldDirectory, "level.dat_new"); -@@ -184,6 +201,8 @@ - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.setTag("Data", nbttagcompound); - -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, worldInformation, nbttagcompound1); -+ - try - { - File file1 = new File(this.worldDirectory, "level.dat_new"); -@@ -232,6 +251,7 @@ - } - - file1.renameTo(file2); -+ net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(p_75753_1_, this.playersDirectory, p_75753_1_.getUniqueID().toString()); - } - catch (Exception exception) - { -@@ -262,6 +282,7 @@ - p_75752_1_.readFromNBT(nbttagcompound); - } - -+ net.minecraftforge.event.ForgeEventFactory.firePlayerLoadingEvent(p_75752_1_, playersDirectory, p_75752_1_.getUniqueID().toString()); - return nbttagcompound; - } - -@@ -301,4 +322,22 @@ - { - return this.saveDirectoryName; - } -+ -+ public NBTTagCompound getPlayerNBT(net.minecraft.entity.player.EntityPlayerMP player) -+ { -+ try -+ { -+ File file1 = new File(this.playersDirectory, player.getUniqueID().toString() + ".dat"); -+ -+ if (file1.exists() && file1.isFile()) -+ { -+ return CompressedStreamTools.readCompressed(new FileInputStream(file1)); -+ } -+ } -+ catch (Exception exception) -+ { -+ logger.warn("Failed to load player data for " + player.getName()); -+ } -+ return null; -+ } - } diff --git a/patches.mcp/minecraft/net/minecraft/world/storage/WorldInfo.java.patch b/patches.mcp/minecraft/net/minecraft/world/storage/WorldInfo.java.patch deleted file mode 100644 index a2901b7f0..000000000 --- a/patches.mcp/minecraft/net/minecraft/world/storage/WorldInfo.java.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/world/storage/WorldInfo.java -+++ ../src-work/minecraft/net/minecraft/world/storage/WorldInfo.java -@@ -52,6 +52,7 @@ - private int borderWarningTime; - private GameRules theGameRules; - private static final String __OBFID = "CL_00000587"; -+ private java.util.Map additionalProperties; - - protected WorldInfo() - { -@@ -803,4 +804,24 @@ - } - }); - } -+ -+ /** -+ * Allow access to additional mod specific world based properties -+ * Used by FML to store mod list associated with a world, and maybe an id map -+ * Used by Forge to store the dimensions available to a world -+ * @param additionalProperties -+ */ -+ public void setAdditionalProperties(java.util.Map additionalProperties) -+ { -+ // one time set for this -+ if (this.additionalProperties == null) -+ { -+ this.additionalProperties = additionalProperties; -+ } -+ } -+ -+ public net.minecraft.nbt.NBTBase getAdditionalProperty(String additionalProperty) -+ { -+ return this.additionalProperties!=null? this.additionalProperties.get(additionalProperty) : null; -+ } - } From 12cd28715a6a53d055718a3cb08e6a63cf21e2bd Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 8 Dec 2015 00:54:27 -0800 Subject: [PATCH 093/133] Fixed colored leather armor, and custom armor textures. --- .../renderer/entity/layers/LayerArmorBase.java.patch | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch index 4c6befc54..b9e87d787 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch @@ -1,13 +1,14 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java -@@ -55,28 +55,28 @@ +@@ -55,28 +55,27 @@ T t = this.func_177175_a(p_177182_9_); t.func_178686_a(this.field_177190_a.func_177087_b()); t.func_78086_a(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_4_); + t = getArmorModelHook(p_177182_1_, itemstack, p_177182_9_, t); this.func_177179_a(t, p_177182_9_); boolean flag = this.func_177180_b(p_177182_9_); - this.field_177190_a.func_110776_a(this.func_177181_a(itemarmor, flag)); +- this.field_177190_a.func_110776_a(this.func_177181_a(itemarmor, flag)); ++ this.field_177190_a.func_110776_a(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, null)); - switch (itemarmor.func_82812_d()) - { @@ -28,8 +29,7 @@ - case DIAMOND: + this.field_177190_a.func_110776_a(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, "overlay")); + } -+ else // Non-colored -+ { ++ { // Non-colored GlStateManager.func_179131_c(this.field_177184_f, this.field_177185_g, this.field_177192_h, this.field_177187_e); t.func_78088_a(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); - default: @@ -39,7 +39,7 @@ if (!this.field_177193_i && itemstack.func_77948_v()) { this.func_177183_a(p_177182_1_, t, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); -@@ -135,11 +135,13 @@ +@@ -135,11 +134,13 @@ GlStateManager.func_179084_k(); } @@ -53,7 +53,7 @@ private ResourceLocation func_177178_a(ItemArmor p_177178_1_, boolean p_177178_2_, String p_177178_3_) { String s = String.format("textures/models/armor/%s_layer_%d%s.png", new Object[] {p_177178_1_.func_82812_d().func_179242_c(), Integer.valueOf(p_177178_2_ ? 2 : 1), p_177178_3_ == null ? "" : String.format("_%s", new Object[]{p_177178_3_})}); -@@ -157,4 +159,49 @@ +@@ -157,4 +158,49 @@ protected abstract void func_177177_a(); protected abstract void func_177179_a(T p_177179_1_, int p_177179_2_); From 3254e2acc6dc6857dcc871f445815152186a553e Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 8 Dec 2015 12:26:02 +0300 Subject: [PATCH 094/133] Fixed orientations of generated item faces. Fixes #2215. --- .../java/net/minecraftforge/client/model/ItemLayerModel.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java index 3165a6366..a0d5a881c 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java @@ -194,14 +194,14 @@ public class ItemLayerModel implements IRetexturableModel { } } // front - builder.add(buildQuad(format, transform, EnumFacing.SOUTH, tint, + builder.add(buildQuad(format, transform, EnumFacing.NORTH, tint, 0, 0, 7.5f / 16f, sprite.getMinU(), sprite.getMaxV(), 0, 1, 7.5f / 16f, sprite.getMinU(), sprite.getMinV(), 1, 1, 7.5f / 16f, sprite.getMaxU(), sprite.getMinV(), 1, 0, 7.5f / 16f, sprite.getMaxU(), sprite.getMaxV() )); // back - builder.add(buildQuad(format, transform, EnumFacing.NORTH, tint, + builder.add(buildQuad(format, transform, EnumFacing.SOUTH, tint, 0, 0, 8.5f / 16f, sprite.getMinU(), sprite.getMaxV(), 1, 0, 8.5f / 16f, sprite.getMaxU(), sprite.getMaxV(), 1, 1, 8.5f / 16f, sprite.getMaxU(), sprite.getMinV(), From 724405d6d835e4821921cc7effe5aa63aaf0dbd3 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Wed, 9 Dec 2015 14:56:01 +0300 Subject: [PATCH 095/133] Workaround for https://github.com/google/guava/issues/738 --- .../java/net/minecraftforge/client/model/b3d/B3DLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java index 95a2b307d..68da43dec 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java @@ -716,7 +716,7 @@ public class B3DLoader implements ICustomModelLoader this(node, state, format, meshes, textures, CacheBuilder.newBuilder() .maximumSize(128) .expireAfterAccess(2, TimeUnit.MINUTES) - .build(new CacheLoader() + .build(new CacheLoader() { public BakedWrapper load(Integer frame) throws Exception { From 4c4223a817801df9b698a28bbd5bbcf3a8046bf8 Mon Sep 17 00:00:00 2001 From: simon-i1-h Date: Thu, 10 Dec 2015 00:40:58 +0900 Subject: [PATCH 096/133] Fixed that oldLight is not being used. --- patches/minecraft/net/minecraft/world/World.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch index b2554d20a..6ad34ed00 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -107,7 +107,7 @@ Block block1 = iblockstate.func_177230_c(); - if (block.func_149717_k() != block1.func_149717_k() || block.func_149750_m() != block1.func_149750_m()) -+ if (block.func_149717_k() != block1.func_149717_k() || block.getLightValue(this, p_180501_1_) != block1.func_149750_m()) ++ if (block.func_149717_k() != block1.func_149717_k() || block.getLightValue(this, p_180501_1_) != oldLight) { this.field_72984_F.func_76320_a("checkLight"); this.func_175664_x(p_180501_1_); From b9d1d926545c28900355bfccb67a6f89a126b496 Mon Sep 17 00:00:00 2001 From: LexManos Date: Thu, 10 Dec 2015 01:01:51 -0800 Subject: [PATCH 097/133] Fixed ModList GUI rendering incorrectly. Closes #2254 --- .../fml/client/GuiScrollingList.java | 62 +++++++------------ 1 file changed, 22 insertions(+), 40 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java b/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java index 48b0bbde8..a0bdde2d2 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java @@ -17,6 +17,7 @@ import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; @@ -96,15 +97,27 @@ public abstract class GuiScrollingList protected abstract void drawBackground(); + /** + * Draw anything special on the screen. GL_SCISSOR is enabled for anything that + * is rendered outside of the view box. Do not mess with SCISSOR unless you support this. + */ protected abstract void drawSlot(int slotIdx, int entryRight, int slotTop, int slotBuffer, Tessellator tess); @Deprecated protected void func_27260_a(int entryRight, int relativeY, Tessellator tess) {} + /** + * Draw anything special on the screen. GL_SCISSOR is enabled for anything that + * is rendered outside of the view box. Do not mess with SCISSOR unless you support this. + */ protected void drawHeader(int entryRight, int relativeY, Tessellator tess) { func_27260_a(entryRight, relativeY, tess); } @Deprecated protected void func_27255_a(int x, int y) {} protected void clickHeader(int x, int y) { func_27255_a(x, y); } @Deprecated protected void func_27257_b(int mouseX, int mouseY) {} + /** + * Draw anything special on the screen. GL_SCISSOR is enabled for anything that + * is rendered outside of the view box. Do not mess with SCISSOR unless you support this. + */ protected void drawScreen(int mouseX, int mouseY) { func_27257_b(mouseX, mouseY); } public int func_27256_c(int x, int y) @@ -252,6 +265,13 @@ public abstract class GuiScrollingList Tessellator tess = Tessellator.getInstance(); WorldRenderer worldr = tess.getWorldRenderer(); + ScaledResolution res = new ScaledResolution(client); + double scaleW = client.displayWidth / res.getScaledWidth_double(); + double scaleH = client.displayHeight / res.getScaledHeight_double(); + GL11.glEnable(GL11.GL_SCISSOR_TEST); + GL11.glScissor((int)(left * scaleW), (int)(client.displayHeight - (bottom * scaleH)), + (int)(listWidth * scaleW), (int)(viewHeight * scaleH)); + if (this.client.theWorld != null) { this.drawGradientRect(this.left, this.top, this.right, this.bottom, 0xC0101010, 0xD0101010); @@ -308,30 +328,6 @@ public abstract class GuiScrollingList } GlStateManager.disableDepth(); - if (this.client.theWorld == null) - { - this.overlayBackground(0, this.top, 255, 255); - this.overlayBackground(this.bottom, this.listHeight, 255, 255); - } - - // Render the entire background over everything but our view - GlStateManager.enableBlend(); - GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.disableAlpha(); - GlStateManager.shadeModel(GL11.GL_SMOOTH); - GlStateManager.disableTexture2D(); - worldr.func_181668_a(7, DefaultVertexFormats.field_181709_i); - worldr.func_181662_b(this.left, this.top + border, 0).func_181673_a(0, 1).func_181669_b(0x00, 0x00, 0x00, 0x00).func_181675_d(); - worldr.func_181662_b(this.right, this.top + border, 0).func_181673_a(1, 1).func_181669_b(0x00, 0x00, 0x00, 0x00).func_181675_d(); - worldr.func_181662_b(this.right, this.top, 0).func_181673_a(1, 0).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d(); - worldr.func_181662_b(this.left, this.top, 0).func_181673_a(0, 0).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d(); - tess.draw(); - worldr.func_181668_a(7, DefaultVertexFormats.field_181709_i); - worldr.func_181662_b(this.left, this.bottom, 0).func_181673_a(0, 1).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d(); - worldr.func_181662_b(this.right, this.bottom, 0).func_181673_a(1, 1).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d(); - worldr.func_181662_b(this.right, this.bottom - border, 0).func_181673_a(1, 0).func_181669_b(0x00, 0x00, 0x00, 0x00).func_181675_d(); - worldr.func_181662_b(this.left, this.bottom - border, 0).func_181673_a(0, 0).func_181669_b(0x00, 0x00, 0x00, 0x00).func_181675_d(); - tess.draw(); int extraHeight = this.getContentHeight() - viewHeight - border; if (extraHeight > 0) @@ -349,6 +345,7 @@ public abstract class GuiScrollingList barTop = this.top; } + GlStateManager.disableTexture2D(); worldr.func_181668_a(7, DefaultVertexFormats.field_181709_i); worldr.func_181662_b(scrollBarLeft, this.bottom, 0.0D).func_181673_a(0.0D, 1.0D).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d(); worldr.func_181662_b(scrollBarRight, this.bottom, 0.0D).func_181673_a(1.0D, 1.0D).func_181669_b(0x00, 0x00, 0x00, 0xFF).func_181675_d(); @@ -374,22 +371,7 @@ public abstract class GuiScrollingList GlStateManager.shadeModel(GL11.GL_FLAT); GlStateManager.enableAlpha(); GlStateManager.disableBlend(); - } - - private void overlayBackground(int top, int height, int alpha1, int alpha2) - { - Tessellator tess = Tessellator.getInstance(); - WorldRenderer worldr = tess.getWorldRenderer(); - this.client.renderEngine.bindTexture(Gui.optionsBackground); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - float scale = 32.0F; - double startUV = (screenWidth / scale) / screenWidth * (left-0); - worldr.func_181668_a(7, DefaultVertexFormats.field_181709_i); - worldr.func_181662_b(left, height, 0.0D).func_181673_a(startUV, height / scale).func_181669_b(0x40, 0x40, 0x40, alpha2).func_181675_d(); - worldr.func_181662_b(left+listWidth+8, height, 0.0D).func_181673_a((left+listWidth+8) / scale, height / scale).func_181669_b(0x40, 0x40, 0x40, alpha2).func_181675_d(); - worldr.func_181662_b(left+listWidth+8, top, 0.0D).func_181673_a((left+listWidth+8) / scale, top / scale ).func_181669_b(0x40, 0x40, 0x40, alpha1).func_181675_d(); - worldr.func_181662_b(left, top, 0.0D).func_181673_a(startUV, top / scale ).func_181669_b(0x40, 0x40, 0x40, alpha1).func_181675_d(); - tess.draw(); + GL11.glDisable(GL11.GL_SCISSOR_TEST); } protected void drawGradientRect(int left, int top, int right, int bottom, int color1, int color2) From 2302963a9f536357a719cf7c925c339d35e012b7 Mon Sep 17 00:00:00 2001 From: LexManos Date: Thu, 10 Dec 2015 02:16:58 -0800 Subject: [PATCH 098/133] Add EMERALD and SILVERFISH to GenerateMinable event. Closes #1158 --- .../world/biome/BiomeGenHills.java.patch | 65 +++++++++++++++++-- .../event/terraingen/OreGenEvent.java | 2 +- 2 files changed, 59 insertions(+), 8 deletions(-) diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch index 5d652e427..87aa2c935 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch @@ -1,11 +1,62 @@ --- ../src-base/minecraft/net/minecraft/world/biome/BiomeGenHills.java +++ ../src-work/minecraft/net/minecraft/world/biome/BiomeGenHills.java -@@ -49,7 +49,7 @@ - int i1 = p_180624_2_.nextInt(16); - BlockPos blockpos = p_180624_3_.func_177982_a(k, l, i1); +@@ -40,28 +40,20 @@ + public void func_180624_a(World p_180624_1_, Random p_180624_2_, BlockPos p_180624_3_) + { + super.func_180624_a(p_180624_1_, p_180624_2_, p_180624_3_); +- int i = 3 + p_180624_2_.nextInt(6); ++ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Pre(p_180624_1_, p_180624_2_, p_180624_3_)); ++ WorldGenerator emeralds = new EmeraldGenerator(); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_180624_1_, p_180624_2_, emeralds, p_180624_3_, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.LAPIS)) ++ emeralds.func_180709_b(p_180624_1_, p_180624_2_, p_180624_3_); +- for (int j = 0; j < i; ++j) ++ for (int i = 0; i < 7; ++i) + { +- int k = p_180624_2_.nextInt(16); +- int l = p_180624_2_.nextInt(28) + 4; +- int i1 = p_180624_2_.nextInt(16); +- BlockPos blockpos = p_180624_3_.func_177982_a(k, l, i1); +- - if (p_180624_1_.func_180495_p(blockpos).func_177230_c() == Blocks.field_150348_b) -+ if (p_180624_1_.func_180495_p(blockpos).func_177230_c().isReplaceableOreGen(p_180624_1_, blockpos, net.minecraft.block.state.pattern.BlockHelper.func_177642_a(Blocks.field_150348_b))) - { - p_180624_1_.func_180501_a(blockpos, Blocks.field_150412_bA.func_176223_P(), 2); - } +- { +- p_180624_1_.func_180501_a(blockpos, Blocks.field_150412_bA.func_176223_P(), 2); +- } +- } +- +- for (i = 0; i < 7; ++i) +- { + int j1 = p_180624_2_.nextInt(16); + int k1 = p_180624_2_.nextInt(64); + int l1 = p_180624_2_.nextInt(16); ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_180624_1_, p_180624_2_, field_82915_S, p_180624_3_.func_177982_a(j1, k1, l1), net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.SILVERFISH)) + this.field_82915_S.func_180709_b(p_180624_1_, p_180624_2_, p_180624_3_.func_177982_a(j1, k1, l1)); + } ++ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Post(p_180624_1_, p_180624_2_, p_180624_3_)); + } + + public void func_180622_a(World p_180622_1_, Random p_180622_2_, ChunkPrimer p_180622_3_, int p_180622_4_, int p_180622_5_, double p_180622_6_) +@@ -97,4 +89,23 @@ + { + return (new BiomeGenHills(p_180277_1_, false)).func_150633_b(this); + } ++ ++ private static class EmeraldGenerator extends WorldGenerator ++ { ++ @Override ++ public boolean func_180709_b(World worldIn, Random rand, BlockPos pos) ++ { ++ int count = 3 + rand.nextInt(6); ++ for (int i = 0; i < count; i++) ++ { ++ BlockPos blockpos = pos.func_177982_a(rand.nextInt(16), rand.nextInt(28) + 4, rand.nextInt(16)); ++ ++ if (worldIn.func_180495_p(blockpos).func_177230_c().isReplaceableOreGen(worldIn, blockpos, net.minecraft.block.state.pattern.BlockHelper.func_177642_a(Blocks.field_150348_b))) ++ { ++ worldIn.func_180501_a(blockpos, Blocks.field_150412_bA.func_176223_P(), 2); ++ } ++ } ++ return true; ++ } ++ } + } diff --git a/src/main/java/net/minecraftforge/event/terraingen/OreGenEvent.java b/src/main/java/net/minecraftforge/event/terraingen/OreGenEvent.java index c45a98e7e..de737b904 100644 --- a/src/main/java/net/minecraftforge/event/terraingen/OreGenEvent.java +++ b/src/main/java/net/minecraftforge/event/terraingen/OreGenEvent.java @@ -87,7 +87,7 @@ public class OreGenEvent extends Event @HasResult public static class GenerateMinable extends OreGenEvent { - public static enum EventType { COAL, DIAMOND, DIRT, GOLD, GRAVEL, IRON, LAPIS, REDSTONE, QUARTZ, DIORITE, GRANITE, ANDESITE, CUSTOM } + public static enum EventType { COAL, DIAMOND, DIRT, GOLD, GRAVEL, IRON, LAPIS, REDSTONE, QUARTZ, DIORITE, GRANITE, ANDESITE, EMERALD, SILVERFISH, CUSTOM } public final EventType type; public final WorldGenerator generator; From dcda451a0a1e482095eae549975b7524cdcd2d0f Mon Sep 17 00:00:00 2001 From: LexManos Date: Thu, 10 Dec 2015 02:54:00 -0800 Subject: [PATCH 099/133] Deprecate int IDs in FluidRegistry. Modders should only ever use the String name. Also add a 'friendly' exception when attempting to get an ID for a unregistered fluid. Closes #1374 --- .../common/network/ForgeMessage.java | 3 ++- .../java/net/minecraftforge/fluids/Fluid.java | 1 + .../minecraftforge/fluids/FluidRegistry.java | 22 +++++++++---------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/main/java/net/minecraftforge/common/network/ForgeMessage.java b/src/main/java/net/minecraftforge/common/network/ForgeMessage.java index c76f040dd..45b6ad32f 100644 --- a/src/main/java/net/minecraftforge/common/network/ForgeMessage.java +++ b/src/main/java/net/minecraftforge/common/network/ForgeMessage.java @@ -48,10 +48,11 @@ public abstract class ForgeMessage { public static class FluidIdMapMessage extends ForgeMessage { BiMap fluidIds = HashBiMap.create(); Set defaultFluids = Sets.newHashSet(); + @SuppressWarnings("deprecation") @Override void toBytes(ByteBuf bytes) { - Map ids = FluidRegistry.getRegisteredFluidIDsByFluid(); + Map ids = FluidRegistry.getRegisteredFluidIDs(); bytes.writeInt(ids.size()); for (Map.Entry entry : ids.entrySet()) { diff --git a/src/main/java/net/minecraftforge/fluids/Fluid.java b/src/main/java/net/minecraftforge/fluids/Fluid.java index 8da11b417..c533506fa 100644 --- a/src/main/java/net/minecraftforge/fluids/Fluid.java +++ b/src/main/java/net/minecraftforge/fluids/Fluid.java @@ -165,6 +165,7 @@ public class Fluid return this.fluidName; } + @Deprecated // Modders should never actually use int ID, use String public final int getID() { return FluidRegistry.getFluidID(this.fluidName); diff --git a/src/main/java/net/minecraftforge/fluids/FluidRegistry.java b/src/main/java/net/minecraftforge/fluids/FluidRegistry.java index 6f1bd7eb1..b1a2e6f22 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidRegistry.java +++ b/src/main/java/net/minecraftforge/fluids/FluidRegistry.java @@ -188,19 +188,26 @@ public abstract class FluidRegistry return fluids.get(fluidName); } + @Deprecated // Modders should never actually use int ID, use String public static Fluid getFluid(int fluidID) { return fluidIDs.inverse().get(fluidID); } + @Deprecated // Modders should never actually use int ID, use String public static int getFluidID(Fluid fluid) { - return fluidIDs.get(fluid); + Integer ret = fluidIDs.get(fluid); + if (ret == null) throw new RuntimeException("Attempted to access ID for unregistered fluid, Stop using this method modder!"); + return ret; } + @Deprecated // Modders should never actually use int ID, use String public static int getFluidID(String fluidName) { - return fluidIDs.get(getFluid(fluidName)); + Integer ret = fluidIDs.get(getFluid(fluidName)); + if (ret == null) throw new RuntimeException("Attempted to access ID for unregistered fluid, Stop using this method modder!"); + return ret; } public static String getFluidName(Fluid fluid) @@ -232,21 +239,14 @@ public abstract class FluidRegistry /** * Returns a read-only map containing Fluid Names and their associated IDs. + * Modders should never actually use this, use the String names. */ + @Deprecated public static Map getRegisteredFluidIDs() { return ImmutableMap.copyOf(fluidIDs); } - /** - * Returns a read-only map containing Fluid IDs and their associated Fluids. - * In 1.8.3, this will change to just 'getRegisteredFluidIDs' - */ - public static Map getRegisteredFluidIDsByFluid() - { - return ImmutableMap.copyOf(fluidIDs); - } - public static Fluid lookupFluidForBlock(Block block) { if (fluidBlocks == null) From c356105e6dcf85ca4700005443e79530ab7cc8d1 Mon Sep 17 00:00:00 2001 From: LexManos Date: Thu, 10 Dec 2015 12:41:48 -0800 Subject: [PATCH 100/133] Fix wrong EventType passed for Emerald ore-gen. --- .../net/minecraft/world/biome/BiomeGenHills.java.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch index 87aa2c935..129a16dfc 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenHills.java.patch @@ -7,7 +7,7 @@ - int i = 3 + p_180624_2_.nextInt(6); + net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.OreGenEvent.Pre(p_180624_1_, p_180624_2_, p_180624_3_)); + WorldGenerator emeralds = new EmeraldGenerator(); -+ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_180624_1_, p_180624_2_, emeralds, p_180624_3_, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.LAPIS)) ++ if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(p_180624_1_, p_180624_2_, emeralds, p_180624_3_, net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.EMERALD)) + emeralds.func_180709_b(p_180624_1_, p_180624_2_, p_180624_3_); - for (int j = 0; j < i; ++j) @@ -40,7 +40,7 @@ { return (new BiomeGenHills(p_180277_1_, false)).func_150633_b(this); } -+ ++ + private static class EmeraldGenerator extends WorldGenerator + { + @Override From ea75a3be69bd0892a0e4b5b1b437b3d1094ad32e Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Fri, 11 Dec 2015 13:42:04 -0600 Subject: [PATCH 101/133] Added doesSideBlockRendering to provide finer grain face culling. Implemented for BlockStairs and BlockSlab. --- .../net/minecraft/block/Block.java.patch | 27 ++++++++++++- .../net/minecraft/block/BlockSlab.java.patch | 38 +++++++++++++++++++ .../minecraft/block/BlockStairs.java.patch | 22 +++++++++++ 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 patches/minecraft/net/minecraft/block/BlockSlab.java.patch create mode 100644 patches/minecraft/net/minecraft/block/BlockStairs.java.patch diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 4585774b7..737fdf5b4 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -69,6 +69,15 @@ } else { +@@ -376,7 +382,7 @@ + @SideOnly(Side.CLIENT) + public boolean func_176225_a(IBlockAccess p_176225_1_, BlockPos p_176225_2_, EnumFacing p_176225_3_) + { +- return p_176225_3_ == EnumFacing.DOWN && this.field_149760_C > 0.0D ? true : (p_176225_3_ == EnumFacing.UP && this.field_149756_F < 1.0D ? true : (p_176225_3_ == EnumFacing.NORTH && this.field_149754_D > 0.0D ? true : (p_176225_3_ == EnumFacing.SOUTH && this.field_149757_G < 1.0D ? true : (p_176225_3_ == EnumFacing.WEST && this.field_149759_B > 0.0D ? true : (p_176225_3_ == EnumFacing.EAST && this.field_149755_E < 1.0D ? true : !p_176225_1_.func_180495_p(p_176225_2_).func_177230_c().func_149662_c()))))); ++ return p_176225_3_ == EnumFacing.DOWN && this.field_149760_C > 0.0D ? true : (p_176225_3_ == EnumFacing.UP && this.field_149756_F < 1.0D ? true : (p_176225_3_ == EnumFacing.NORTH && this.field_149754_D > 0.0D ? true : (p_176225_3_ == EnumFacing.SOUTH && this.field_149757_G < 1.0D ? true : (p_176225_3_ == EnumFacing.WEST && this.field_149759_B > 0.0D ? true : (p_176225_3_ == EnumFacing.EAST && this.field_149755_E < 1.0D ? true : !p_176225_1_.func_180495_p(p_176225_2_).func_177230_c().doesSideBlockRendering(p_176225_1_, p_176225_2_, p_176225_3_)))))); + } + + public boolean func_176212_b(IBlockAccess p_176212_1_, BlockPos p_176212_2_, EnumFacing p_176212_3_) @@ -453,6 +459,10 @@ public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_) @@ -179,7 +188,7 @@ } protected ItemStack func_180643_i(IBlockState p_180643_1_) -@@ -1010,6 +1030,1029 @@ +@@ -1010,6 +1030,1045 @@ return "Block{" + field_149771_c.func_177774_c(this) + "}"; } @@ -230,6 +239,22 @@ + } + + /** ++ * Check if the face of a block should block rendering. ++ * ++ * Faces which are fully opaque should return true, faces with transparency ++ * or faces which do not span the full size of the block should return false. ++ * ++ * @param world The current world ++ * @param pos Block position in world ++ * @param side The side to check ++ * @return True if the block is opaque on the specified side. ++ */ ++ public boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing face) ++ { ++ return func_149662_c(); ++ } ++ ++ /** + * Checks if the block is a solid face on the given side, used by placement logic. + * + * @param world The current world diff --git a/patches/minecraft/net/minecraft/block/BlockSlab.java.patch b/patches/minecraft/net/minecraft/block/BlockSlab.java.patch new file mode 100644 index 000000000..56f1865a1 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockSlab.java.patch @@ -0,0 +1,38 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockSlab.java ++++ ../src-work/minecraft/net/minecraft/block/BlockSlab.java +@@ -91,6 +91,17 @@ + return this.func_176552_j(); + } + ++ @Override ++ public boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing face) ++ { ++ if ( func_149662_c() ) ++ return true; ++ ++ // face is on the block being rendered, not this block. ++ EnumBlockHalf side = world.func_180495_p(pos).func_177229_b(field_176554_a); ++ return (side == EnumBlockHalf.TOP && face == EnumFacing.DOWN) || (side == EnumBlockHalf.BOTTOM && face == EnumFacing.UP); ++ } ++ + public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) + { + IBlockState iblockstate = super.func_180642_a(p_180642_1_, p_180642_2_, p_180642_3_, p_180642_4_, p_180642_5_, p_180642_6_, p_180642_7_, p_180642_8_).func_177226_a(field_176554_a, BlockSlab.EnumBlockHalf.BOTTOM); +@@ -118,15 +129,8 @@ + { + return false; + } +- else +- { +- BlockPos blockpos = p_176225_2_.func_177972_a(p_176225_3_.func_176734_d()); +- IBlockState iblockstate = p_176225_1_.func_180495_p(p_176225_2_); +- IBlockState iblockstate1 = p_176225_1_.func_180495_p(blockpos); +- boolean flag = func_150003_a(iblockstate.func_177230_c()) && iblockstate.func_177229_b(field_176554_a) == BlockSlab.EnumBlockHalf.TOP; +- boolean flag1 = func_150003_a(iblockstate1.func_177230_c()) && iblockstate1.func_177229_b(field_176554_a) == BlockSlab.EnumBlockHalf.TOP; +- return flag1 ? (p_176225_3_ == EnumFacing.DOWN ? true : (p_176225_3_ == EnumFacing.UP && super.func_176225_a(p_176225_1_, p_176225_2_, p_176225_3_) ? true : !func_150003_a(iblockstate.func_177230_c()) || !flag)) : (p_176225_3_ == EnumFacing.UP ? true : (p_176225_3_ == EnumFacing.DOWN && super.func_176225_a(p_176225_1_, p_176225_2_, p_176225_3_) ? true : !func_150003_a(iblockstate.func_177230_c()) || flag)); +- } ++ // additional logic breaks doesSideBlockRendering and is no longer useful. ++ return super.func_176225_a(p_176225_1_, p_176225_2_, p_176225_3_); + } + + @SideOnly(Side.CLIENT) diff --git a/patches/minecraft/net/minecraft/block/BlockStairs.java.patch b/patches/minecraft/net/minecraft/block/BlockStairs.java.patch new file mode 100644 index 000000000..dccaada1d --- /dev/null +++ b/patches/minecraft/net/minecraft/block/BlockStairs.java.patch @@ -0,0 +1,22 @@ +--- ../src-base/minecraft/net/minecraft/block/BlockStairs.java ++++ ../src-work/minecraft/net/minecraft/block/BlockStairs.java +@@ -68,6 +68,19 @@ + return false; + } + ++ @Override ++ public boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing face) ++ { ++ if ( func_149662_c() ) ++ return true; ++ ++ // face is on the block being rendered, not this block. ++ IBlockState iblockstate = world.func_180495_p(pos); ++ EnumHalf half = iblockstate.func_177229_b(field_176308_b); ++ EnumFacing side = iblockstate.func_177229_b(field_176309_a); ++ return side == face.func_176734_d() || (half == EnumHalf.TOP && face == EnumFacing.DOWN) || (half == EnumHalf.BOTTOM && face == EnumFacing.UP); ++ } ++ + public boolean func_149686_d() + { + return false; From 3631955641341ed03577920994b61d753de865bf Mon Sep 17 00:00:00 2001 From: cpw Date: Fri, 11 Dec 2015 15:30:43 -0500 Subject: [PATCH 102/133] Use ItemStack.hasEffect. closes #2230 --- .../client/renderer/entity/layers/LayerArmorBase.java.patch | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch index b9e87d787..2bbf64ef4 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java -@@ -55,28 +55,27 @@ +@@ -55,29 +55,28 @@ T t = this.func_177175_a(p_177182_9_); t.func_178686_a(this.field_177190_a.func_177087_b()); t.func_78086_a(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_4_); @@ -34,11 +34,13 @@ t.func_78088_a(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); - default: - +- if (!this.field_177193_i && itemstack.func_77948_v()) + } + // Default - if (!this.field_177193_i && itemstack.func_77948_v()) ++ if (!this.field_177193_i && itemstack.func_77962_s()) { this.func_177183_a(p_177182_1_, t, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); + } @@ -135,11 +134,13 @@ GlStateManager.func_179084_k(); } From bf6c31c8795b9ab1051e046836ba77de4f62b715 Mon Sep 17 00:00:00 2001 From: minzmann Date: Sat, 12 Dec 2015 17:05:14 +0100 Subject: [PATCH 103/133] Update PotionEffect.java.patch --- .../net/minecraft/potion/PotionEffect.java.patch | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch b/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch index e23ad06dc..81b132ac3 100644 --- a/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch +++ b/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch @@ -57,16 +57,15 @@ + */ + public boolean isCurativeItem(net.minecraft.item.ItemStack stack) + { -+ boolean found = false; + for (net.minecraft.item.ItemStack curativeItem : this.curativeItems) + { + if (curativeItem.func_77969_a(stack)) + { -+ found = true; ++ return true; + } + } + -+ return found; ++ return false; + } + + /*** @@ -84,15 +83,7 @@ + */ + public void addCurativeItem(net.minecraft.item.ItemStack stack) + { -+ boolean found = false; -+ for (net.minecraft.item.ItemStack curativeItem : this.curativeItems) -+ { -+ if (curativeItem.func_77969_a(stack)) -+ { -+ found = true; -+ } -+ } -+ if (!found) ++ if (!this.isCurativeItem(stack)) + { + this.curativeItems.add(stack); + } From 0632f2aadf50a39b3300a6999ec0085ffc6b3a8f Mon Sep 17 00:00:00 2001 From: cpw Date: Sat, 12 Dec 2015 18:53:13 -0500 Subject: [PATCH 104/133] Fix derpage when loading a 1.8 world, with persistent state being entirely ignored in that case. --- .../net/minecraftforge/fml/common/FMLContainer.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/FMLContainer.java b/src/main/java/net/minecraftforge/fml/common/FMLContainer.java index fd995c1f1..43a84747e 100644 --- a/src/main/java/net/minecraftforge/fml/common/FMLContainer.java +++ b/src/main/java/net/minecraftforge/fml/common/FMLContainer.java @@ -264,10 +264,12 @@ public class FMLContainer extends DummyModContainer implements WorldAccessContai for (String key : regs.getKeySet()) { PersistentRegistryManager.GameDataSnapshot.Entry entry = new PersistentRegistryManager.GameDataSnapshot.Entry(); - if ("fml:blocks".equals(key)) key = "minecraft:blocks"; - if ("fml:items".equals(key)) key = "minecraft:items"; - if ("fmlgr:villagerprofessions".equals(key)) key = "minecraft:villagerprofessions"; - snapshot.entries.put(new ResourceLocation(key), entry); + ResourceLocation entryLoc; + if ("fml:blocks".equals(key)) entryLoc = PersistentRegistryManager.BLOCKS; + else if ("fml:items".equals(key)) entryLoc = PersistentRegistryManager.ITEMS; + else if ("fmlgr:villagerprofessions".equals(key)) entryLoc = new ResourceLocation("minecraft:villagerprofessions"); + else entryLoc = new ResourceLocation(key); + snapshot.entries.put(entryLoc, entry); NBTTagList list = regs.getCompoundTag(key).getTagList("ids", 10); for (int x = 0; x < list.tagCount(); x++) From 8db720151d5cca3f108b45706a3f78673f15fe0d Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Sun, 13 Dec 2015 04:47:25 -0600 Subject: [PATCH 105/133] Add getHighlightTip allowing a item to override its displayed renderToolHightlight. --- .../net/minecraft/item/Item.java.patch | 19 ++++++++++++++++--- .../minecraftforge/client/GuiIngameForge.java | 2 ++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index 095c78806..e79d76add 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -57,7 +57,7 @@ Vec3 vec31 = vec3.func_72441_c((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); return p_77621_1_.func_147447_a(vec3, vec31, p_77621_3_, !p_77621_3_, false); } -@@ -371,11 +380,578 @@ +@@ -371,11 +380,591 @@ return false; } @@ -91,6 +91,19 @@ + } + + /** ++ * Allow the item one last chance to modify its name used for the ++ * tool highlight useful for adding something extra that can't be removed ++ * by a user in the displayed name, such as a mode of operation. ++ * ++ * @param item the ItemStack for the item. ++ * @param the name that will be displayed unless it is changed in this method. ++ */ ++ public String getHighlightTip( ItemStack item, String displayName ) ++ { ++ return displayName; ++ } ++ ++ /** + * This is called when the item is used, before the block is activated. + * @param stack The Item Stack + * @param player The Player that used the item @@ -636,7 +649,7 @@ public static void func_150900_l() { func_179214_a(Blocks.field_150348_b, (new ItemMultiTexture(Blocks.field_150348_b, Blocks.field_150348_b, new Function() -@@ -855,6 +1431,10 @@ +@@ -855,6 +1444,10 @@ private final float field_78011_i; private final int field_78008_j; @@ -647,7 +660,7 @@ private ToolMaterial(int p_i1874_3_, int p_i1874_4_, float p_i1874_5_, float p_i1874_6_, int p_i1874_7_) { this.field_78001_f = p_i1874_3_; -@@ -889,9 +1469,36 @@ +@@ -889,9 +1482,36 @@ return this.field_78008_j; } diff --git a/src/main/java/net/minecraftforge/client/GuiIngameForge.java b/src/main/java/net/minecraftforge/client/GuiIngameForge.java index e4f3e3e6c..33fb73911 100644 --- a/src/main/java/net/minecraftforge/client/GuiIngameForge.java +++ b/src/main/java/net/minecraftforge/client/GuiIngameForge.java @@ -597,6 +597,8 @@ public class GuiIngameForge extends GuiIngame if (this.highlightingItemStack.hasDisplayName()) name = EnumChatFormatting.ITALIC + name; + name = this.highlightingItemStack.getItem().getHighlightTip(this.highlightingItemStack, name); + int opacity = (int)((float)this.remainingHighlightTicks * 256.0F / 10.0F); if (opacity > 255) opacity = 255; From 94eadab9fdd18ba470293a0e2f24d991765ad53f Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 13 Dec 2015 14:22:53 -0500 Subject: [PATCH 106/133] A test for issue #1848. Please try this with any mods you can @ 1.8.8, and see if you still get log spam of any kind (not just the log message from the issue either). --- .../minecraftforge/fml/common/network/FMLOutboundHandler.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/network/FMLOutboundHandler.java b/src/main/java/net/minecraftforge/fml/common/network/FMLOutboundHandler.java index 6d3ad27f0..11d4715cf 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/FMLOutboundHandler.java +++ b/src/main/java/net/minecraftforge/fml/common/network/FMLOutboundHandler.java @@ -276,14 +276,12 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter { if (dispatchers == null) { ctx.write(msg, promise); - promise.setSuccess(); return; } for (NetworkDispatcher targetDispatcher : dispatchers) { targetDispatcher.sendProxy((FMLProxyPacket) msg); } - promise.setSuccess(); } } From a319adba53dc3557b5552fda253ac00adab08401 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Sun, 13 Dec 2015 15:35:15 -0600 Subject: [PATCH 107/133] Added addLandingEffects allowing mods to override landing particles, for blocks that require world information to determine textures. --- .../net/minecraft/block/Block.java.patch | 19 +++++++- .../entity/EntityLivingBase.java.patch | 46 +++++++++++-------- 2 files changed, 45 insertions(+), 20 deletions(-) diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 737fdf5b4..d871f030a 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -188,7 +188,7 @@ } protected ItemStack func_180643_i(IBlockState p_180643_1_) -@@ -1010,6 +1030,1045 @@ +@@ -1010,6 +1030,1062 @@ return "Block{" + field_149771_c.func_177774_c(this) + "}"; } @@ -807,6 +807,23 @@ + } + + /** ++ * Allows a block to override the standard EntityLivingBase.updateFallState ++ * particles, this is a server side method that spawns particles with ++ * WorldServer.spawnParticle ++ * ++ * @param world The current Server world ++ * @param blockPosition of the block that the entity landed on. ++ * @param iblockstate State at the specific world/pos ++ * @param entity the entity that hit landed on the block. ++ * @param numberOfParticles that vanilla would have spawned. ++ * @return True to prevent vanilla landing particles form spawning. ++ */ ++ public boolean addLandingEffects(net.minecraft.world.WorldServer worldObj, BlockPos blockPosition, IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles ) ++ { ++ return false; ++ } ++ ++ /** + * Spawn a digging particle effect in the world, this is a wrapper + * around EffectRenderer.addBlockHitEffects to allow the block more + * control over the particles. Useful when you have entirely different diff --git a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch index 945d7ebcc..7906ba9b3 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -1,6 +1,14 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java +++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java -@@ -237,7 +237,7 @@ +@@ -170,6 +170,7 @@ + } + + int i = (int)(150.0D * d0); ++ if ( !block.addLandingEffects( (WorldServer)this.field_70170_p, p_180433_5_, iblockstate, this, i ) ) + ((WorldServer)this.field_70170_p).func_175739_a(EnumParticleTypes.BLOCK_DUST, this.field_70165_t, this.field_70163_u, this.field_70161_v, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, new int[] {Block.func_176210_f(iblockstate)}); + } + } +@@ -237,7 +238,7 @@ } } @@ -9,7 +17,7 @@ { this.func_70078_a((Entity)null); } -@@ -319,7 +319,7 @@ +@@ -319,7 +320,7 @@ if (!this.field_70170_p.field_72995_K && (this.field_70718_bc > 0 || this.func_70684_aJ()) && this.func_146066_aG() && this.field_70170_p.func_82736_K().func_82766_b("doMobLoot")) { int i = this.func_70693_a(this.field_70717_bb); @@ -18,7 +26,7 @@ while (i > 0) { int j = EntityXPOrb.func_70527_a(i); -@@ -380,6 +380,7 @@ +@@ -380,6 +381,7 @@ { this.field_70755_b = p_70604_1_; this.field_70756_c = this.field_70173_aa; @@ -26,7 +34,7 @@ } public EntityLivingBase func_110144_aD() -@@ -663,7 +664,6 @@ +@@ -663,7 +665,6 @@ return this.func_70668_bt() == EnumCreatureAttribute.UNDEAD; } @@ -34,7 +42,7 @@ public void func_70618_n(int p_70618_1_) { this.field_70713_bf.remove(Integer.valueOf(p_70618_1_)); -@@ -712,6 +712,8 @@ +@@ -712,6 +713,8 @@ public void func_70691_i(float p_70691_1_) { @@ -43,7 +51,7 @@ float f = this.func_110143_aJ(); if (f > 0.0F) -@@ -732,6 +734,7 @@ +@@ -732,6 +735,7 @@ public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { @@ -51,7 +59,7 @@ if (this.func_180431_b(p_70097_1_)) { return false; -@@ -797,9 +800,9 @@ +@@ -797,9 +801,9 @@ this.field_70718_bc = 100; this.field_70717_bb = (EntityPlayer)entity; } @@ -63,7 +71,7 @@ if (entitywolf.func_70909_n()) { -@@ -883,6 +886,7 @@ +@@ -883,6 +887,7 @@ public void func_70645_a(DamageSource p_70645_1_) { @@ -71,7 +79,7 @@ Entity entity = p_70645_1_.func_76346_g(); EntityLivingBase entitylivingbase = this.func_94060_bK(); -@@ -908,6 +912,9 @@ +@@ -908,6 +913,9 @@ i = EnchantmentHelper.func_77519_f((EntityLivingBase)entity); } @@ -81,7 +89,7 @@ if (this.func_146066_aG() && this.field_70170_p.func_82736_K().func_82766_b("doMobLoot")) { this.func_70628_a(this.field_70718_bc > 0, i); -@@ -918,6 +925,16 @@ +@@ -918,6 +926,16 @@ this.func_82164_bB(); } } @@ -98,7 +106,7 @@ } this.field_70170_p.func_72960_a(this, (byte)3); -@@ -972,7 +989,7 @@ +@@ -972,7 +990,7 @@ int j = MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b); int k = MathHelper.func_76128_c(this.field_70161_v); Block block = this.field_70170_p.func_180495_p(new BlockPos(i, j, k)).func_177230_c(); @@ -107,7 +115,7 @@ } public boolean func_70089_S() -@@ -982,6 +999,9 @@ +@@ -982,6 +1000,9 @@ public void func_180430_e(float p_180430_1_, float p_180430_2_) { @@ -117,7 +125,7 @@ super.func_180430_e(p_180430_1_, p_180430_2_); PotionEffect potioneffect = this.func_70660_b(Potion.field_76430_j); float f = potioneffect != null ? (float)(potioneffect.func_76458_c() + 1) : 0.0F; -@@ -1094,6 +1114,8 @@ +@@ -1094,6 +1115,8 @@ { if (!this.func_180431_b(p_70665_1_)) { @@ -126,7 +134,7 @@ 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 f = p_70665_2_; -@@ -1142,6 +1164,11 @@ +@@ -1142,6 +1165,11 @@ public void func_71038_i() { @@ -138,7 +146,7 @@ if (!this.field_82175_bq || this.field_110158_av >= this.func_82166_i() / 2 || this.field_110158_av < 0) { this.field_110158_av = -1; -@@ -1281,6 +1308,7 @@ +@@ -1281,6 +1309,7 @@ public void func_110145_l(Entity p_110145_1_) { @@ -146,7 +154,7 @@ double d0 = p_110145_1_.field_70165_t; double d1 = p_110145_1_.func_174813_aQ().field_72338_b + (double)p_110145_1_.field_70131_O; double d2 = p_110145_1_.field_70161_v; -@@ -1346,6 +1374,7 @@ +@@ -1346,6 +1375,7 @@ } this.field_70160_al = true; @@ -154,7 +162,7 @@ } protected void func_70629_bd() -@@ -1530,6 +1559,7 @@ +@@ -1530,6 +1560,7 @@ public void func_70071_h_() { @@ -162,7 +170,7 @@ super.func_70071_h_(); if (!this.field_70170_p.field_72995_K) -@@ -1817,6 +1847,7 @@ +@@ -1817,6 +1848,7 @@ public void func_70078_a(Entity p_70078_1_) { @@ -170,7 +178,7 @@ if (this.field_70154_o != null && p_70078_1_ == null) { if (!this.field_70170_p.field_72995_K) -@@ -1998,4 +2029,39 @@ +@@ -1998,4 +2030,39 @@ { this.field_70752_e = true; } From 9032f7e37ef063f550c8781bb8544fa71043eeae Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 14 Dec 2015 03:49:48 -0800 Subject: [PATCH 108/133] Fix enchanting applying the same enchantment multiple times. Closes #2273 --- .../net/minecraft/enchantment/EnchantmentHelper.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch index fe2ae4132..6f607d4dd 100644 --- a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch @@ -25,7 +25,7 @@ - if (!enchantmentdata1.field_76302_b.func_77326_a(Enchantment.func_180306_c(integer.intValue()))) + Enchantment e1 = enchantmentdata1.field_76302_b; + Enchantment e2 = Enchantment.func_180306_c(integer.intValue()); -+ if (e1.func_77326_a(e2) && e2.func_77326_a(e1)) //Forge BugFix: Let Both enchantments veto being together ++ if (!e1.func_77326_a(e2) || !e2.func_77326_a(e1)) //Forge BugFix: Let Both enchantments veto being together { flag = false; break; From d6ee373e8775ddfe183b69801d228a21134661e0 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Thu, 3 Dec 2015 22:38:08 +0300 Subject: [PATCH 109/133] Preparations for the Animation system. Changes to the Model API - IModelState now works with Optional. Handling of parts of the model is not optional, and coordinate space/result interpretation is up to the caller. IModel doesn't extend IModelPart by default anymore; MapModelState uses composition to achieve previous functionality, IModelPart implementations are disjoint now. Updated perspective handing to the new API, removed IPerspectiveState (MapModelState is now the same thing). Perspective transforms for the default fluid model. --- .../model/ItemCameraTransforms.java.patch | 9 ++ .../block/model/ItemTransformVec3f.java.patch | 2 +- .../resources/model/ModelRotation.java.patch | 2 +- .../client/ForgeHooksClient.java | 24 +++- .../client/model/BlockStateLoader.java | 2 +- .../client/model/ForgeBlockStateV1.java | 20 +-- .../minecraftforge/client/model/IModel.java | 2 +- .../client/model/IModelState.java | 13 +- .../client/model/IPerspectiveAwareModel.java | 35 ++++-- .../client/model/IPerspectiveState.java | 67 ---------- .../client/model/ISmartBlockModel.java | 85 +++++++++++++ .../client/model/ItemLayerModel.java | 69 +++++------ .../client/model/MapModelState.java | 61 ++++++++-- .../client/model/ModelFluid.java | 26 +++- .../client/model/ModelLoader.java | 65 +++++++--- .../client/model/ModelStateComposition.java | 11 +- .../client/model/MultiModel.java | 31 ++--- .../client/model/SimpleModelState.java | 30 +++++ .../client/model/TRSRTransformation.java | 9 +- .../client/model/b3d/B3DLoader.java | 114 +++++++++++++++--- .../client/model/obj/OBJModel.java | 36 +++--- .../client/model/pipeline/LightUtil.java | 3 +- .../debug/LayerBreakingTest.java | 10 -- .../models/block/engine.json | 39 ++++++ .../models/block/engine_ring.json | 36 ++++++ 25 files changed, 553 insertions(+), 248 deletions(-) delete mode 100644 src/main/java/net/minecraftforge/client/model/IPerspectiveState.java create mode 100644 src/main/java/net/minecraftforge/client/model/SimpleModelState.java create mode 100644 src/test/resources/assets/forgedebugmodelanimation/models/block/engine.json create mode 100644 src/test/resources/assets/forgedebugmodelanimation/models/block/engine_ring.json diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch index 2226f0b87..7d8ba1837 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java.patch @@ -12,3 +12,12 @@ public class ItemCameraTransforms { public static final ItemCameraTransforms field_178357_a = new ItemCameraTransforms(); +@@ -117,7 +121,7 @@ + } + + @SideOnly(Side.CLIENT) +- public static enum TransformType ++ public static enum TransformType implements net.minecraftforge.client.model.IModelPart + { + NONE, + THIRD_PERSON, diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch index e0fa743a5..22f137782 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java.patch @@ -12,7 +12,7 @@ +@Deprecated +public class ItemTransformVec3f implements net.minecraftforge.client.model.IModelState { -+ public net.minecraftforge.client.model.TRSRTransformation apply(net.minecraftforge.client.model.IModelPart part) { return new net.minecraftforge.client.model.TRSRTransformation(this); } ++ public com.google.common.base.Optional apply(com.google.common.base.Optional part) { return net.minecraftforge.client.ForgeHooksClient.applyTransform(this, part); } 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 final Vector3f field_178365_c; diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch index f7b079566..893292696 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch @@ -14,7 +14,7 @@ } } + -+ public net.minecraftforge.client.model.TRSRTransformation apply(net.minecraftforge.client.model.IModelPart part) { return new net.minecraftforge.client.model.TRSRTransformation(getMatrix()); } ++ public com.google.common.base.Optional apply(com.google.common.base.Optional part) { return net.minecraftforge.client.ForgeHooksClient.applyTransform(getMatrix(), part); } + public javax.vecmath.Matrix4f getMatrix() { return net.minecraftforge.client.ForgeHooksClient.getMatrix(this); } + public EnumFacing rotate(EnumFacing facing) { return func_177523_a(facing); } + public int rotate(EnumFacing facing, int vertexIndex) { return func_177520_a(facing, vertexIndex); } diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 5ca7c02b7..7d105f2ca 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -70,6 +70,8 @@ import net.minecraftforge.client.event.RenderHandEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.client.event.sound.PlaySoundEvent; +import net.minecraftforge.client.model.IFlexibleBakedModel; +import net.minecraftforge.client.model.IModelPart; import net.minecraftforge.client.model.IPerspectiveAwareModel; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.model.TRSRTransformation; @@ -82,8 +84,8 @@ import net.minecraftforge.fml.common.FMLLog; import org.apache.commons.lang3.tuple.Pair; import org.lwjgl.BufferUtils; -import org.lwjgl.opengl.GL11; +import com.google.common.base.Optional; import com.google.common.collect.Maps; @SuppressWarnings("deprecation") @@ -111,7 +113,7 @@ public class ForgeHooksClient if (block != null && block.isBed(world, pos, entity)) { - GL11.glRotatef((float)(block.getBedDirection(world, pos).getHorizontalIndex() * 90), 0.0F, 1.0F, 0.0F); + glRotatef((float)(block.getBedDirection(world, pos).getHorizontalIndex() * 90), 0.0F, 1.0F, 0.0F); } } @@ -378,7 +380,7 @@ public class ForgeHooksClient { if(model instanceof IPerspectiveAwareModel) { - Pair pair = ((IPerspectiveAwareModel)model).handlePerspective(cameraTransformType); + Pair pair = ((IPerspectiveAwareModel)model).handlePerspective(cameraTransformType); if(pair.getRight() != null) multiplyCurrentGlMatrix(pair.getRight()); return pair.getLeft(); @@ -402,7 +404,7 @@ public class ForgeHooksClient matrixBuf.put(t); } matrixBuf.flip(); - GL11.glMultMatrix(matrixBuf); + glMultMatrix(matrixBuf); } // moved and expanded from WorldVertexBufferUploader.draw @@ -523,7 +525,7 @@ public class ForgeHooksClient Class tileClass = tileItemMap.get(Pair.of(item, metadata)); if (tileClass != null) { - TileEntitySpecialRenderer r = TileEntityRendererDispatcher.instance.getSpecialRendererByClass(tileClass); + TileEntitySpecialRenderer r = TileEntityRendererDispatcher.instance.getSpecialRendererByClass(tileClass); if (r != null) { r.renderTileEntityAt(null, 0, 0, 0, 0, -1); @@ -562,4 +564,16 @@ public class ForgeHooksClient faceData[i * 7 + 6] = x | (y << 0x08) | (z << 0x10); } } + + public static Optional applyTransform(ItemTransformVec3f transform, Optional part) + { + if(part.isPresent()) return Optional.absent(); + return Optional.of(new TRSRTransformation(transform)); + } + + public static Optional applyTransform(Matrix4f matrix, Optional part) + { + if(part.isPresent()) return Optional.absent(); + return Optional.of(new TRSRTransformation(matrix)); + } } diff --git a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java index b07bb2668..255985659 100644 --- a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java +++ b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java @@ -193,7 +193,7 @@ public class BlockStateLoader IModelState partState = new ModelStateComposition(baseTr, part.getState()); if (part.isUVLock()) partState = new ModelLoader.UVLock(partState); - models.put(entry.getKey(), Pair.of(runModelHooks(model, part.getTextures(), part.getCustomData()), partState)); + models.put(entry.getKey(), Pair.of(runModelHooks(model, part.getTextures(), part.getCustomData()), partState)); } return new MultiModel(getModelLocation(), hasBase ? base : null, baseTr, models.build()); diff --git a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java index 2a644a3ad..d950d6dfc 100644 --- a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java +++ b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java @@ -467,40 +467,40 @@ public class ForgeBlockStateV1 extends Marker } else if (transform.equals("forge:default-block")) { - IModelState thirdperson = TRSRTransformation.blockCenterToCorner(new TRSRTransformation( + TRSRTransformation thirdperson = TRSRTransformation.blockCenterToCorner(new TRSRTransformation( new Vector3f(0, 1.5f / 16, -2.75f / 16), TRSRTransformation.quatFromYXZDegrees(new Vector3f(10, -45, 170)), new Vector3f(0.375f, 0.375f, 0.375f), null)); - ret.state = Optional.of(new IPerspectiveState.Impl(TRSRTransformation.identity(), ImmutableMap.of(TransformType.THIRD_PERSON, thirdperson))); + ret.state = Optional.of(new SimpleModelState(ImmutableMap.of(TransformType.THIRD_PERSON, thirdperson))); } else if (transform.equals("forge:default-item")) { - IModelState thirdperson = TRSRTransformation.blockCenterToCorner(new TRSRTransformation( + TRSRTransformation thirdperson = TRSRTransformation.blockCenterToCorner(new TRSRTransformation( new Vector3f(0, 1f / 16, -3f / 16), TRSRTransformation.quatFromYXZDegrees(new Vector3f(-90, 0, 0)), new Vector3f(0.55f, 0.55f, 0.55f), null)); - IModelState firstperson = TRSRTransformation.blockCenterToCorner(new TRSRTransformation( + TRSRTransformation firstperson = TRSRTransformation.blockCenterToCorner(new TRSRTransformation( new Vector3f(0, 4f / 16, 2f / 16), TRSRTransformation.quatFromYXZDegrees(new Vector3f(0, -135, 25)), new Vector3f(1.7f, 1.7f, 1.7f), null)); - ret.state = Optional.of(new IPerspectiveState.Impl(TRSRTransformation.identity(), ImmutableMap.of(TransformType.THIRD_PERSON, thirdperson, TransformType.FIRST_PERSON, firstperson))); + ret.state = Optional.of(new SimpleModelState(ImmutableMap.of(TransformType.THIRD_PERSON, thirdperson, TransformType.FIRST_PERSON, firstperson))); } else if (transform.equals("forge:default-tool")) { - IModelState thirdperson = TRSRTransformation.blockCenterToCorner(new TRSRTransformation( + TRSRTransformation thirdperson = TRSRTransformation.blockCenterToCorner(new TRSRTransformation( new Vector3f(0, 1.25f / 16, -3.5f / 16), TRSRTransformation.quatFromYXZDegrees(new Vector3f(0, 90, -35)), new Vector3f(0.85f, 0.85f, 0.85f), null)); - IModelState firstperson = TRSRTransformation.blockCenterToCorner(new TRSRTransformation( + TRSRTransformation firstperson = TRSRTransformation.blockCenterToCorner(new TRSRTransformation( new Vector3f(0, 4f / 16, 2f / 16), TRSRTransformation.quatFromYXZDegrees(new Vector3f(0, -135, 25)), new Vector3f(1.7f, 1.7f, 1.7f), null)); - ret.state = Optional.of(new IPerspectiveState.Impl(TRSRTransformation.identity(), ImmutableMap.of(TransformType.THIRD_PERSON, thirdperson, TransformType.FIRST_PERSON, firstperson))); + ret.state = Optional.of(new SimpleModelState(ImmutableMap.of(TransformType.THIRD_PERSON, thirdperson, TransformType.FIRST_PERSON, firstperson))); } else { @@ -522,7 +522,7 @@ public class ForgeBlockStateV1 extends Marker else { JsonObject transform = json.get("transform").getAsJsonObject(); - EnumMap transforms = Maps.newEnumMap(TransformType.class); + EnumMap transforms = Maps.newEnumMap(TransformType.class); if(transform.has("thirdperson")) { TRSRTransformation t = context.deserialize(transform.get("thirdperson"), TRSRTransformation.class); @@ -582,7 +582,7 @@ public class ForgeBlockStateV1 extends Marker } else { - state = new IPerspectiveState.Impl(base, Maps.immutableEnumMap(transforms)); + state = new SimpleModelState(Maps.immutableEnumMap(transforms), Optional.of(base)); } ret.state = Optional.of(state); } diff --git a/src/main/java/net/minecraftforge/client/model/IModel.java b/src/main/java/net/minecraftforge/client/model/IModel.java index 457f8a581..3ac54704d 100644 --- a/src/main/java/net/minecraftforge/client/model/IModel.java +++ b/src/main/java/net/minecraftforge/client/model/IModel.java @@ -12,7 +12,7 @@ import com.google.common.base.Function; * Interface for models that can be baked * (possibly to different vertex formats and with different state). */ -public interface IModel extends IModelPart +public interface IModel { /* * Returns all model locations that this model depends on. diff --git a/src/main/java/net/minecraftforge/client/model/IModelState.java b/src/main/java/net/minecraftforge/client/model/IModelState.java index 34795854b..dff153de3 100644 --- a/src/main/java/net/minecraftforge/client/model/IModelState.java +++ b/src/main/java/net/minecraftforge/client/model/IModelState.java @@ -1,16 +1,17 @@ package net.minecraftforge.client.model; -import com.google.common.base.Function; +import com.google.common.base.Optional; /* * Represents the dynamic information associated with the model. * Common use case is (possibly interpolated) animation frame. */ -public interface IModelState extends Function +public interface IModelState { /* - * returns the transformation (in the local coordinates) that needs to be applied to the specific part of the model. + * Returns the transformation that needs to be applied to the specific part of the model. + * Coordinate system is determined by the part type. + * if no part is provided, global model transformation is returned. */ - @Override - TRSRTransformation apply(IModelPart part); -} + Optional apply(Optional part); +} \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java b/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java index 1a32071f6..7856bb04c 100644 --- a/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java +++ b/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java @@ -9,27 +9,26 @@ import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.client.resources.model.IBakedModel; import net.minecraft.util.EnumFacing; import org.apache.commons.lang3.tuple.Pair; +import com.google.common.base.Optional; import com.google.common.collect.ImmutableMap; /* * Model that changes based on the rendering perspective * (first-person, GUI, e.t.c - see TransformType) */ -@SuppressWarnings("deprecation") -public interface IPerspectiveAwareModel extends IBakedModel +public interface IPerspectiveAwareModel extends IFlexibleBakedModel { /* * Returns the pair of the model for the given perspective, and the matrix * that should be applied to the GL state before rendering it (matrix may be null). */ - Pair handlePerspective(TransformType cameraTransformType); + Pair handlePerspective(TransformType cameraTransformType); - public static class MapWrapper implements IFlexibleBakedModel, IPerspectiveAwareModel + public static class MapWrapper implements IPerspectiveAwareModel { private final IFlexibleBakedModel parent; private final ImmutableMap transforms; @@ -40,17 +39,31 @@ public interface IPerspectiveAwareModel extends IBakedModel this.transforms = transforms; } - public MapWrapper(IFlexibleBakedModel parent, IPerspectiveState state, IModelPart part) + public MapWrapper(IFlexibleBakedModel parent, IModelState state) { - this(parent, getTransforms(state, part)); + this(parent, getTransforms(state)); } - public static ImmutableMap getTransforms(IPerspectiveState state, IModelPart part) + public static ImmutableMap getTransforms(IModelState state) { ImmutableMap.Builder builder = ImmutableMap.builder(); for(TransformType type : TransformType.values()) { - builder.put(type, state.forPerspective(type).apply(part)); + Optional tr = state.apply(Optional.of(type)); + if(tr.isPresent()) + { + builder.put(type, tr.get()); + } + } + return builder.build(); + } + + public static ImmutableMap getTransforms(ItemCameraTransforms transforms) + { + ImmutableMap.Builder builder = ImmutableMap.builder(); + for(TransformType type : TransformType.values()) + { + builder.put(type, new TRSRTransformation(transforms.func_181688_b(type))); } return builder.build(); } @@ -65,12 +78,12 @@ public interface IPerspectiveAwareModel extends IBakedModel public VertexFormat getFormat() { return parent.getFormat(); } @Override - public Pair handlePerspective(TransformType cameraTransformType) + public Pair handlePerspective(TransformType cameraTransformType) { TRSRTransformation tr = transforms.get(cameraTransformType); Matrix4f mat = null; if(tr != null && tr != TRSRTransformation.identity()) mat = TRSRTransformation.blockCornerToCenter(tr).getMatrix(); - return Pair.of((IBakedModel)this, mat); + return Pair.of(this, mat); } } } diff --git a/src/main/java/net/minecraftforge/client/model/IPerspectiveState.java b/src/main/java/net/minecraftforge/client/model/IPerspectiveState.java deleted file mode 100644 index a057a85e6..000000000 --- a/src/main/java/net/minecraftforge/client/model/IPerspectiveState.java +++ /dev/null @@ -1,67 +0,0 @@ -package net.minecraftforge.client.model; - -import java.util.Map; - -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; - -import com.google.common.base.Objects; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; - -/** - * IModelState that can change depending on the perspective. - */ -@SuppressWarnings("deprecation") -public interface IPerspectiveState extends IModelState -{ - /** - * @return the additional state that needs to be applied for each part when in given perspective type. - */ - public IModelState forPerspective(TransformType type); - - public static class Impl implements IPerspectiveState - { - private final IModelState parent; - private final ImmutableMap states; - - public Impl(IModelState parent, ImmutableMap states) - { - this.parent = parent; - this.states = states; - } - - public Impl(IModelState parent, ItemCameraTransforms transforms) - { - this(parent, getMap(transforms)); - } - - private static ImmutableMap getMap(ItemCameraTransforms transforms) - { - Map map = Maps.newHashMap(); - for(TransformType type : TransformType.values()) - { - map.put(type, transforms.func_181688_b(type)); - } - return Maps.immutableEnumMap(map); - } - - public TRSRTransformation apply(IModelPart part) - { - return parent.apply(part); - } - - public IModelState forPerspective(TransformType type) - { - IModelState state = states.get(type); - if(state == null) state = TRSRTransformation.identity(); - return state; - } - - @Override - public String toString() - { - return Objects.toStringHelper(this.getClass()).add("parent", parent).add("states", states).toString(); - } - } -} diff --git a/src/main/java/net/minecraftforge/client/model/ISmartBlockModel.java b/src/main/java/net/minecraftforge/client/model/ISmartBlockModel.java index 37dee843e..718f90de5 100644 --- a/src/main/java/net/minecraftforge/client/model/ISmartBlockModel.java +++ b/src/main/java/net/minecraftforge/client/model/ISmartBlockModel.java @@ -1,9 +1,94 @@ package net.minecraftforge.client.model; +import java.util.List; + +import javax.vecmath.Matrix4f; + import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.util.EnumFacing; + +import org.apache.commons.lang3.tuple.Pair; public interface ISmartBlockModel extends IBakedModel { IBakedModel handleBlockState(IBlockState state); + + public static abstract class Wrapper implements ISmartBlockModel, IFlexibleBakedModel + { + protected final IFlexibleBakedModel parent; + + public Wrapper(IFlexibleBakedModel parent) + { + this.parent = parent; + } + + public List getFaceQuads(EnumFacing side) + { + return parent.getFaceQuads(side); + } + + public List getGeneralQuads() + { + return parent.getGeneralQuads(); + } + + public boolean isAmbientOcclusion() + { + return parent.isAmbientOcclusion(); + } + + public boolean isGui3d() + { + return parent.isGui3d(); + } + + public boolean isBuiltInRenderer() + { + return parent.isBuiltInRenderer(); + } + + public TextureAtlasSprite getTexture() + { + return parent.getTexture(); + } + + public ItemCameraTransforms getItemCameraTransforms() + { + return parent.getItemCameraTransforms(); + } + + public VertexFormat getFormat() + { + return parent.getFormat(); + } + } + + public static abstract class PerspectiveWrapper extends Wrapper implements IPerspectiveAwareModel + { + protected final IPerspectiveAwareModel parent; + + public PerspectiveWrapper(IPerspectiveAwareModel parent) + { + super(parent); + this.parent = parent; + } + + public Pair handlePerspective(TransformType type) + { + Pair pair = parent.handlePerspective(type); + return Pair.of(new ISmartBlockModel.Wrapper(pair.getLeft()) + { + public IBakedModel handleBlockState(IBlockState state) + { + return PerspectiveWrapper.this.handleBlockState(state); + } + }, pair.getRight()); + } + } } diff --git a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java index a0d5a881c..326d300fb 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java @@ -5,7 +5,6 @@ import java.util.BitSet; import java.util.Collection; import java.util.List; -import javax.vecmath.Matrix4f; import javax.vecmath.Vector4f; import net.minecraft.client.renderer.block.model.BakedQuad; @@ -15,20 +14,17 @@ import net.minecraft.client.renderer.block.model.ModelBlock; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.resources.model.IBakedModel; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; -import org.apache.commons.lang3.tuple.Pair; - import com.google.common.base.Function; +import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; -@SuppressWarnings("deprecation") -public class ItemLayerModel implements IRetexturableModel { +public class ItemLayerModel implements IRetexturableModel +{ public static final ItemLayerModel instance = new ItemLayerModel(ImmutableList.of()); @@ -85,40 +81,33 @@ public class ItemLayerModel implements IRetexturableModel { public IFlexibleBakedModel bake(IModelState state, final VertexFormat format, Function bakedTextureGetter) { ImmutableList.Builder builder = ImmutableList.builder(); - final TRSRTransformation transform = state.apply(this); + Optional transform = state.apply(Optional.absent()); for(int i = 0; i < textures.size(); i++) { TextureAtlasSprite sprite = bakedTextureGetter.apply(textures.get(i)); builder.addAll(getQuadsForSprite(i, sprite, format, transform)); } TextureAtlasSprite particle = bakedTextureGetter.apply(textures.isEmpty() ? new ResourceLocation("missingno") : textures.get(0)); - if(state instanceof IPerspectiveState) + ImmutableMap map = IPerspectiveAwareModel.MapWrapper.getTransforms(state); + IFlexibleBakedModel ret = new BakedModel(builder.build(), particle, format); + if(map.isEmpty()) { - IPerspectiveState ps = (IPerspectiveState)state; - ImmutableMap map = IPerspectiveAwareModel.MapWrapper.getTransforms(ps, this); - return new BakedModel(builder.build(), particle, format, Maps.immutableEnumMap(map)); + return ret; } - return new BakedModel(builder.build(), particle, format); + return new IPerspectiveAwareModel.MapWrapper(ret, map); } - public static class BakedModel implements IFlexibleBakedModel, IPerspectiveAwareModel + public static class BakedModel implements IFlexibleBakedModel { private final ImmutableList quads; private final TextureAtlasSprite particle; private final VertexFormat format; - private final ImmutableMap transforms; public BakedModel(ImmutableList quads, TextureAtlasSprite particle, VertexFormat format) - { - this(quads, particle, format, ImmutableMap.of()); - } - - public BakedModel(ImmutableList quads, TextureAtlasSprite particle, VertexFormat format, ImmutableMap transforms) { this.quads = quads; this.particle = particle; this.format = format; - this.transforms = transforms; } public boolean isAmbientOcclusion() { return true; } @@ -129,18 +118,9 @@ public class ItemLayerModel implements IRetexturableModel { public List getFaceQuads(EnumFacing side) { return ImmutableList.of(); } public List getGeneralQuads() { return quads; } public VertexFormat getFormat() { return format; } - - @Override - public Pair handlePerspective(TransformType cameraTransformType) - { - TRSRTransformation tr = transforms.get(cameraTransformType); - Matrix4f mat = null; - if(tr != null && tr != TRSRTransformation.identity()) mat = TRSRTransformation.blockCornerToCenter(tr).getMatrix(); - return Pair.of((IBakedModel)this, mat); - } } - public ImmutableList getQuadsForSprite(int tint, TextureAtlasSprite sprite, VertexFormat format, TRSRTransformation transform) + public ImmutableList getQuadsForSprite(int tint, TextureAtlasSprite sprite, VertexFormat format, Optional transform) { ImmutableList.Builder builder = ImmutableList.builder(); @@ -215,7 +195,7 @@ public class ItemLayerModel implements IRetexturableModel { return (pixels[u + (vMax - 1 - v) * uMax] >> 24 & 0xFF) == 0; } - private static void addSideQuad(ImmutableList.Builder builder, BitSet faces, VertexFormat format, TRSRTransformation transform, EnumFacing side, int tint, TextureAtlasSprite sprite, int uMax, int vMax, int u, int v) + private static void addSideQuad(ImmutableList.Builder builder, BitSet faces, VertexFormat format, Optional transform, EnumFacing side, int tint, TextureAtlasSprite sprite, int uMax, int vMax, int u, int v) { int si = side.ordinal(); if(si > 4) si -= 2; @@ -227,7 +207,7 @@ public class ItemLayerModel implements IRetexturableModel { } } - private static BakedQuad buildSideQuad(VertexFormat format, TRSRTransformation transform, EnumFacing side, int tint, TextureAtlasSprite sprite, int u, int v) + private static BakedQuad buildSideQuad(VertexFormat format, Optional transform, EnumFacing side, int tint, TextureAtlasSprite sprite, int u, int v) { final float eps0 = 30e-5f; final float eps1 = 45e-5f; @@ -308,7 +288,7 @@ public class ItemLayerModel implements IRetexturableModel { } private static final BakedQuad buildQuad( - VertexFormat format, TRSRTransformation transform, EnumFacing side, int tint, + VertexFormat format, Optional transform, EnumFacing side, int tint, float x0, float y0, float z0, float u0, float v0, float x1, float y1, float z1, float u1, float v1, float x2, float y2, float z2, float u2, float v2, @@ -324,7 +304,7 @@ public class ItemLayerModel implements IRetexturableModel { return builder.build(); } - private static void putVertex(UnpackedBakedQuad.Builder builder, VertexFormat format, TRSRTransformation transform, EnumFacing side, float x, float y, float z, float u, float v) + private static void putVertex(UnpackedBakedQuad.Builder builder, VertexFormat format, Optional transform, EnumFacing side, float x, float y, float z, float u, float v) { Vector4f vec = new Vector4f(); for(int e = 0; e < format.getElementCount(); e++) @@ -332,12 +312,19 @@ public class ItemLayerModel implements IRetexturableModel { switch(format.getElement(e).getUsage()) { case POSITION: - vec.x = x; - vec.y = y; - vec.z = z; - vec.w = 1; - transform.getMatrix().transform(vec); - builder.put(e, vec.x, vec.y, vec.z, vec.w); + if(transform.isPresent()) + { + vec.x = x; + vec.y = y; + vec.z = z; + vec.w = 1; + transform.get().getMatrix().transform(vec); + builder.put(e, vec.x, vec.y, vec.z, vec.w); + } + else + { + builder.put(e, x, y, z, 1); + } break; case COLOR: builder.put(e, 1f, 1f, 1f, 1f); diff --git a/src/main/java/net/minecraftforge/client/model/MapModelState.java b/src/main/java/net/minecraftforge/client/model/MapModelState.java index 1861a745e..62d93912e 100644 --- a/src/main/java/net/minecraftforge/client/model/MapModelState.java +++ b/src/main/java/net/minecraftforge/client/model/MapModelState.java @@ -2,41 +2,78 @@ package net.minecraftforge.client.model; import java.util.Map; +import com.google.common.base.Objects; +import com.google.common.base.Optional; import com.google.common.collect.ImmutableMap; /* - * Simple implementation of IModelState via a map and a default value. + * Simple implementation of IModelState via a map and a default value. Provides a full state for each part. */ public class MapModelState implements IModelState { - private final ImmutableMap map; + private final ImmutableMap map; private final IModelState def; - public MapModelState(Map map) + public MapModelState(Map map) { this(map, TRSRTransformation.identity()); } - public MapModelState(Map map, TRSRTransformation def) + public MapModelState(Map map, TRSRTransformation def) { this(map, (IModelState)def); } - public MapModelState(Map map, IModelState def) + public MapModelState(Map map, IModelState def) { - this.map = ImmutableMap.copyOf(map); + this.map = ImmutableMap.copyOf(map); this.def = def; } - public TRSRTransformation apply(IModelPart part) + public Optional apply(Optional part) { - if(!map.containsKey(part)) return def.apply(part); - return map.get(part).apply(part); + if(!part.isPresent() || !map.containsKey(part.get())) return def.apply(part); + return map.get(part.get()).apply(Optional.absent()); } - public IModelState getState(IModelPart part) + public IModelState getState(Object obj) { - if(!map.containsKey(part)) return def; - return map.get(part); + Wrapper w = wrap(obj); + if(!map.containsKey(w)) return def; + return map.get(w); + } + + public static class Wrapper implements IModelPart + { + private final Object obj; + + public Wrapper(Object obj) + { + this.obj = obj; + } + + @Override + public int hashCode() + { + return obj.hashCode(); + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Wrapper other = (Wrapper)obj; + return Objects.equal(this.obj, other.obj); + } + } + + public static Wrapper wrap(Object obj) + { + return new Wrapper(obj); } } diff --git a/src/main/java/net/minecraftforge/client/model/ModelFluid.java b/src/main/java/net/minecraftforge/client/model/ModelFluid.java index a283f0790..3a8740d6e 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelFluid.java +++ b/src/main/java/net/minecraftforge/client/model/ModelFluid.java @@ -5,9 +5,12 @@ import java.util.Collections; import java.util.EnumMap; import java.util.List; +import javax.vecmath.Vector4f; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.resources.IResourceManager; @@ -57,7 +60,13 @@ public class ModelFluid implements IModelCustomData public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { - return new BakedFluid(state.apply(this), format, fluid.getColor(), bakedTextureGetter.apply(fluid.getStill()), bakedTextureGetter.apply(fluid.getFlowing()), fluid.isGaseous()); + ImmutableMap map = IPerspectiveAwareModel.MapWrapper.getTransforms(state); + IFlexibleBakedModel ret = new BakedFluid(state.apply(Optional.absent()), format, fluid.getColor(), bakedTextureGetter.apply(fluid.getStill()), bakedTextureGetter.apply(fluid.getFlowing()), fluid.isGaseous()); + if(map.isEmpty()) + { + return ret; + } + return new IPerspectiveAwareModel.MapWrapper(ret, map); } public IModelState getDefaultState() @@ -91,7 +100,7 @@ public class ModelFluid implements IModelCustomData private static final int z[] = { 0, 1, 1, 0 }; private static final float eps = 1e-3f; - private final TRSRTransformation transformation; + private final Optional transformation; private final VertexFormat format; private final int color; private final TextureAtlasSprite still, flowing; @@ -99,12 +108,12 @@ public class ModelFluid implements IModelCustomData private final Optional state; private final EnumMap> faceQuads; - public BakedFluid(TRSRTransformation transformation, VertexFormat format, int color, TextureAtlasSprite still, TextureAtlasSprite flowing, boolean gas) + public BakedFluid(Optional transformation, VertexFormat format, int color, TextureAtlasSprite still, TextureAtlasSprite flowing, boolean gas) { this(transformation, format, color, still, flowing, gas, Optional.absent()); } - public BakedFluid(TRSRTransformation transformation, VertexFormat format, int color, TextureAtlasSprite still, TextureAtlasSprite flowing, boolean gas, Optional stateOption) + public BakedFluid(Optional transformation, VertexFormat format, int color, TextureAtlasSprite still, TextureAtlasSprite flowing, boolean gas, Optional stateOption) { this.transformation = transformation; this.format = format; @@ -237,7 +246,14 @@ public class ModelFluid implements IModelCustomData switch(format.getElement(e).getUsage()) { case POSITION: - builder.put(e, x - side.getDirectionVec().getX() * eps, y, z - side.getDirectionVec().getZ() * eps, 1f); + float[] data = new float[]{ x - side.getDirectionVec().getX() * eps, y, z - side.getDirectionVec().getZ() * eps, 1 }; + if(transformation.isPresent()) + { + Vector4f vec = new Vector4f(data); + transformation.get().getMatrix().transform(vec); + vec.get(data); + } + builder.put(e, data); break; case COLOR: float d = LightUtil.diffuseLight(side); diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index d286890a5..fd93a3f4b 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -24,6 +24,7 @@ import net.minecraft.client.renderer.ItemModelMesher; import net.minecraft.client.renderer.block.model.BlockPart; import net.minecraft.client.renderer.block.model.BlockPartFace; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.block.model.ItemModelGenerator; import net.minecraft.client.renderer.block.model.ModelBlock; import net.minecraft.client.renderer.block.model.ModelBlockDefinition; @@ -55,6 +56,7 @@ import net.minecraftforge.fml.common.registry.RegistryDelegate; import org.apache.commons.lang3.tuple.Pair; import com.google.common.base.Function; +import com.google.common.base.Optional; import com.google.common.base.Throwables; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -332,7 +334,14 @@ public class ModelLoader extends ModelBakery throw new IllegalArgumentException("can't bake vanilla models to the format that doesn't fit into the default one: " + format); } ModelBlock model = this.model; - if(model == null) return getMissingModel().bake(state, format, bakedTextureGetter); + if(model == null) return getMissingModel().bake(getMissingModel().getDefaultState(), format, bakedTextureGetter); + + List newTransforms = Lists.newArrayList(); + for(int i = 0; i < model.getElements().size(); i++) + { + newTransforms.add(null); + } + ItemCameraTransforms transforms = model.func_181682_g(); boolean uvlock = false; if(state instanceof UVLock) @@ -340,43 +349,58 @@ public class ModelLoader extends ModelBakery uvlock = true; state = ((UVLock)state).getParent(); } - IPerspectiveState perState = state instanceof IPerspectiveState ? (IPerspectiveState)state : new IPerspectiveState.Impl(state, transforms); + Map tMap = Maps.newHashMap(); + tMap.putAll(IPerspectiveAwareModel.MapWrapper.getTransforms(transforms)); + tMap.putAll(IPerspectiveAwareModel.MapWrapper.getTransforms(state)); + IModelState perState = new SimpleModelState(ImmutableMap.copyOf(tMap)); + if(hasItemModel(model)) { return new ItemLayerModel(model).bake(perState, format, bakedTextureGetter); } if(isCustomRenderer(model)) return new IFlexibleBakedModel.Wrapper(new BuiltInModel(transforms), format); - // TODO perspective awareness for this - return bakeNormal(model, perState, state.apply(this), format, bakedTextureGetter, uvlock); + return bakeNormal(model, perState, state.apply(Optional.absent()).or(TRSRTransformation.identity()), newTransforms, format, bakedTextureGetter, uvlock); } - private IFlexibleBakedModel bakeNormal(ModelBlock model, IPerspectiveState perState, TRSRTransformation state, VertexFormat format, Function bakedTextureGetter, boolean uvLocked) + private IFlexibleBakedModel bakeNormal(ModelBlock model, IModelState perState, final TRSRTransformation modelState, List newTransforms, VertexFormat format, Function bakedTextureGetter, boolean uvLocked) { TextureAtlasSprite particle = bakedTextureGetter.apply(new ResourceLocation(model.resolveTextureName("particle"))); SimpleBakedModel.Builder builder = (new SimpleBakedModel.Builder(model)).setTexture(particle); - for(BlockPart part : (Iterable)model.getElements()) + for(int i = 0; i < model.getElements().size(); i++) { + BlockPart part = model.getElements().get(i); + TRSRTransformation transformation = modelState; + if(newTransforms.get(i) != null) + { + transformation = transformation.compose(newTransforms.get(i)); + } for(Map.Entry e : (Iterable>)part.mapFaces.entrySet()) { TextureAtlasSprite textureatlassprite1 = bakedTextureGetter.apply(new ResourceLocation(model.resolveTextureName(e.getValue().texture))); - if (e.getValue().cullFace == null || !TRSRTransformation.isInteger(state.getMatrix())) + if (e.getValue().cullFace == null || !TRSRTransformation.isInteger(transformation.getMatrix())) { - builder.addGeneralQuad(makeBakedQuad(part, e.getValue(), textureatlassprite1, e.getKey(), state, uvLocked)); + builder.addGeneralQuad(makeBakedQuad(part, e.getValue(), textureatlassprite1, e.getKey(), transformation, uvLocked)); } else { - builder.addFaceQuad(state.rotate(e.getValue().cullFace), makeBakedQuad(part, e.getValue(), textureatlassprite1, e.getKey(), state, uvLocked)); + builder.addFaceQuad(modelState.rotate(e.getValue().cullFace), makeBakedQuad(part, e.getValue(), textureatlassprite1, e.getKey(), transformation, uvLocked)); } } } - return new IPerspectiveAwareModel.MapWrapper(new IFlexibleBakedModel.Wrapper(builder.makeBakedModel(), format), perState, this); + return new ISmartBlockModel.PerspectiveWrapper(new IPerspectiveAwareModel.MapWrapper(new IFlexibleBakedModel.Wrapper(builder.makeBakedModel(), format), perState)) + { + public IBakedModel handleBlockState(IBlockState state) + { + return VanillaModelWrapper.this.handleBlockState(parent, modelState, state); + } + }; } - public IModelState getDefaultState() + private IBakedModel handleBlockState(IFlexibleBakedModel model, TRSRTransformation modelState, IBlockState state) { - return ModelRotation.X0_Y0; + return model; } @Override @@ -439,6 +463,11 @@ public class ModelLoader extends ModelBakery return new VanillaModelWrapper(location, neweModel); } + + public IModelState getDefaultState() + { + return ModelRotation.X0_Y0; + } } public static class UVLock implements IModelState @@ -455,7 +484,7 @@ public class ModelLoader extends ModelBakery return parent; } - public TRSRTransformation apply(IModelPart part) + public Optional apply(Optional part) { return parent.apply(part); } @@ -503,7 +532,7 @@ public class ModelLoader extends ModelBakery public WeightedRandomModel(ModelResourceLocation parent, Variants variants) { this.variants = variants.getVariants(); - ImmutableMap.Builder builder = ImmutableMap.builder(); + ImmutableMap.Builder builder = ImmutableMap.builder(); for (Variant v : (List)variants.getVariants()) { ResourceLocation loc = v.getModelLocation(); @@ -533,14 +562,14 @@ public class ModelLoader extends ModelBakery model = new WeightedPartWrapper(model); models.add(model); - builder.put(model, v.getState()); + builder.put(MapModelState.wrap(model), v.getState()); } if (models.size() == 0) //If all variants are missing, add one with the missing model and default rotation. { IModel missing = getMissingModel(); models.add(missing); - builder.put(missing, TRSRTransformation.identity()); + builder.put(MapModelState.wrap(missing), TRSRTransformation.identity()); } defaultState = new MapModelState(builder.build()); @@ -563,11 +592,11 @@ public class ModelLoader extends ModelBakery return state; } - private IModelState getState(IModelState state, IModelPart part) + private IModelState getState(IModelState state, IModel model) { if(state instanceof MapModelState) { - return ((MapModelState)state).getState(part); + return ((MapModelState)state).getState(model); } return state; } diff --git a/src/main/java/net/minecraftforge/client/model/ModelStateComposition.java b/src/main/java/net/minecraftforge/client/model/ModelStateComposition.java index fb4dbd223..231b47b0e 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelStateComposition.java +++ b/src/main/java/net/minecraftforge/client/model/ModelStateComposition.java @@ -1,5 +1,7 @@ package net.minecraftforge.client.model; +import com.google.common.base.Optional; + public class ModelStateComposition implements IModelState { private final IModelState first; @@ -11,8 +13,13 @@ public class ModelStateComposition implements IModelState this.second = second; } - public TRSRTransformation apply(IModelPart part) + public Optional apply(Optional part) { - return first.apply(part).compose(second.apply(part)); + Optional f = first.apply(part), s = second.apply(part); + if(f.isPresent() && s.isPresent()) + { + return Optional.of(f.get().compose(s.get())); + } + return f.or(s); } } diff --git a/src/main/java/net/minecraftforge/client/model/MultiModel.java b/src/main/java/net/minecraftforge/client/model/MultiModel.java index 115d3b9d8..4f0178c54 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiModel.java @@ -15,7 +15,6 @@ import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.client.resources.model.IBakedModel; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.FMLLog; @@ -93,16 +92,8 @@ public class MultiModel implements IModel ImmutableMap.Builder> builder = ImmutableMap.builder(); for(TransformType type : TransformType.values()) { - Pair p = perBase.handlePerspective(type); - IFlexibleBakedModel newBase; - if(p.getLeft() instanceof IFlexibleBakedModel) - { - newBase = (IFlexibleBakedModel)p.getLeft(); - } - else - { - newBase = new IFlexibleBakedModel.Wrapper(p.getLeft(), base.getFormat()); - } + Pair p = perBase.handlePerspective(type); + IFlexibleBakedModel newBase = p.getLeft(); builder.put(type, Pair.of(new Baked(location, false, newBase, parts), new TRSRTransformation(p.getRight()))); } transforms = builder.build(); @@ -172,11 +163,11 @@ public class MultiModel implements IModel } @Override - public Pair handlePerspective(TransformType cameraTransformType) + public Pair handlePerspective(TransformType cameraTransformType) { - if(transforms.isEmpty()) return Pair.of(this, null); + if(transforms.isEmpty()) return Pair.of(this, null); Pair p = transforms.get(cameraTransformType); - return Pair.of((IBakedModel)p.getLeft(), p.getRight().getMatrix()); + return Pair.of(p.getLeft(), p.getRight().getMatrix()); } } @@ -261,12 +252,6 @@ public class MultiModel implements IModel return new Baked(location, true, bakedBase, mapBuilder.build()); } - @Override - public IModelState getDefaultState() - { - return baseState; - } - /** * @return The base model of this MultiModel. May be null. */ @@ -282,4 +267,10 @@ public class MultiModel implements IModel { return parts; } + + @Override + public IModelState getDefaultState() + { + return baseState; + } } diff --git a/src/main/java/net/minecraftforge/client/model/SimpleModelState.java b/src/main/java/net/minecraftforge/client/model/SimpleModelState.java new file mode 100644 index 000000000..a4da1cc28 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/model/SimpleModelState.java @@ -0,0 +1,30 @@ +package net.minecraftforge.client.model; + +import com.google.common.base.Optional; +import com.google.common.collect.ImmutableMap; + +/* + * Simple implementation of IModelState via a map and a default value. + */ +public class SimpleModelState implements IModelState +{ + private final ImmutableMap map; + private final Optional def; + + public SimpleModelState(ImmutableMap map) + { + this(map, Optional.absent()); + } + + public SimpleModelState(ImmutableMap map, Optional def) + { + this.map = map; + this.def = def; + } + + public Optional apply(Optional part) + { + if(!part.isPresent() || !map.containsKey(part.get())) return def; + return Optional.fromNullable(map.get(part.get())); + } +} diff --git a/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java b/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java index b6a201e2a..5f1f0d222 100644 --- a/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java +++ b/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java @@ -17,6 +17,7 @@ import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Triple; import com.google.common.base.Objects; +import com.google.common.base.Optional; /* * Interpolation-friendly affine transformation. @@ -474,9 +475,13 @@ public class TRSRTransformation implements IModelState, ITransformation return (Quat4f)rightRot.clone(); } - public TRSRTransformation apply(IModelPart part) + public Optional apply(Optional part) { - return this; + if(part.isPresent()) + { + return Optional.absent(); + } + return Optional.of(this); } public EnumFacing rotate(EnumFacing facing) diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java index 68da43dec..c06eacba2 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java @@ -22,7 +22,6 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.resources.IResource; import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.resources.model.IBakedModel; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; @@ -34,7 +33,6 @@ import net.minecraftforge.client.model.IModelCustomData; import net.minecraftforge.client.model.IModelPart; import net.minecraftforge.client.model.IModelState; import net.minecraftforge.client.model.IPerspectiveAwareModel; -import net.minecraftforge.client.model.IPerspectiveState; import net.minecraftforge.client.model.IRetexturableModel; import net.minecraftforge.client.model.ISmartBlockModel; import net.minecraftforge.client.model.ISmartItemModel; @@ -59,6 +57,8 @@ import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Triple; import com.google.common.base.Function; +import com.google.common.base.Objects; +import com.google.common.base.Optional; import com.google.common.base.Predicate; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; @@ -260,13 +260,15 @@ public class B3DLoader implements ICustomModelLoader return parent; } - public TRSRTransformation apply(IModelPart part) + public Optional apply(Optional part) { - if(!(part instanceof PartWrapper)) + // TODO optionify better + if(!part.isPresent()) return parent.apply(part); + if(!(part.get() instanceof NodeJoint)) { - throw new IllegalArgumentException("B3DState can only be applied to b3d models"); + return Optional.absent(); } - Node node = ((PartWrapper)part).getNode(); + Node node = ((NodeJoint)part.get()).getNode(); TRSRTransformation nodeTransform; if(progress < 1e-5 || frame == nextFrame) { @@ -281,11 +283,11 @@ public class B3DLoader implements ICustomModelLoader nodeTransform = getNodeMatrix(node, frame); nodeTransform = nodeTransform.slerp(getNodeMatrix(node, nextFrame), progress); } - if(parent != null) + if(parent != null && node.getParent() == null) { - return parent.apply(part).compose(nodeTransform); + return Optional.of(parent.apply(part).or(TRSRTransformation.identity()).compose(nodeTransform)); } - return nodeTransform; + return Optional.of(nodeTransform); } private static LoadingCache, Integer>, TRSRTransformation> cache = CacheBuilder.newBuilder() @@ -301,7 +303,7 @@ public class B3DLoader implements ICustomModelLoader public TRSRTransformation getNodeMatrix(Node node) { - return cache.getUnchecked(Triple., Integer>of(animation, node, frame)); + return getNodeMatrix(node, frame); } public TRSRTransformation getNodeMatrix(Node node, int frame) @@ -320,25 +322,102 @@ public class B3DLoader implements ICustomModelLoader Node parent = node.getParent(); if(parent != null) { + // parent model-global current pose TRSRTransformation pm = cache.getUnchecked(Triple., Integer>of(animation, node.getParent(), frame)); ret = ret.compose(pm); + // joint offset in the parent coords ret = ret.compose(new TRSRTransformation(parent.getPos(), parent.getRot(), parent.getScale(), null)); } + // current node local pose ret = ret.compose(new TRSRTransformation(key.getPos(), key.getRot(), key.getScale(), null)); - Matrix4f rm = new TRSRTransformation(node.getPos(), node.getRot(), node.getScale(), null).getMatrix(); + // this part moved inside the model + // inverse bind of the curent node + /*Matrix4f rm = new TRSRTransformation(node.getPos(), node.getRot(), node.getScale(), null).getMatrix(); rm.invert(); ret = ret.compose(new TRSRTransformation(rm)); if(parent != null) { + // inverse bind of the parent rm = new TRSRTransformation(parent.getPos(), parent.getRot(), parent.getScale(), null).getMatrix(); rm.invert(); ret = ret.compose(new TRSRTransformation(rm)); + }*/ + // TODO cache + TRSRTransformation invBind = new NodeJoint(node).getInvBindPose(); + ret = ret.compose(invBind); + } + else + { + Node parent = node.getParent(); + if(parent != null) + { + // parent model-global current pose + TRSRTransformation pm = cache.getUnchecked(Triple., Integer>of(animation, node.getParent(), frame)); + ret = ret.compose(pm); + // joint offset in the parent coords + ret = ret.compose(new TRSRTransformation(parent.getPos(), parent.getRot(), parent.getScale(), null)); } + ret = ret.compose(new TRSRTransformation(node.getPos(), node.getRot(), node.getScale(), null)); + // TODO cache + TRSRTransformation invBind = new NodeJoint(node).getInvBindPose(); + ret = ret.compose(invBind); } return ret; } } + public static class NodeJoint implements IModelPart + { + private final Node node; + + public NodeJoint(Node node) + { + this.node = node; + } + + public TRSRTransformation getInvBindPose() + { + Matrix4f m = new TRSRTransformation(node.getPos(), node.getRot(), node.getScale(), null).getMatrix(); + m.invert(); + TRSRTransformation pose = new TRSRTransformation(m); + + if(node.getParent() != null) + { + TRSRTransformation parent = new NodeJoint(node.getParent()).getInvBindPose(); + pose = pose.compose(parent); + } + return pose; + } + + public Optional getParent() + { + // FIXME cache? + if(node.getParent() == null) return Optional.absent(); + return Optional.of(new NodeJoint(node.getParent())); + } + + public Node getNode() + { + return node; + } + + @Override + public int hashCode() + { + return node.hashCode(); + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) return true; + if (!super.equals(obj)) return false; + if (getClass() != obj.getClass()) return false; + NodeJoint other = (NodeJoint) obj; + return Objects.equal(node, other.node); + } + } + public static enum B3DFrameProperty implements IUnlistedProperty { instance; @@ -760,10 +839,10 @@ public class B3DLoader implements ICustomModelLoader Mesh mesh = (Mesh)node.getKind(); Collection faces = mesh.bake(new Function, Matrix4f>() { - // gets transformation in global space + private final TRSRTransformation global = state.apply(Optional.absent()).or(TRSRTransformation.identity()); public Matrix4f apply(Node node) { - return state.apply(PartWrapper.create(node)).getMatrix(); + return global.compose(state.apply(Optional.of(new NodeJoint(node))).or(TRSRTransformation.identity())).getMatrix(); } }); for(Face f : faces) @@ -914,13 +993,14 @@ public class B3DLoader implements ICustomModelLoader return this; } - public Pair handlePerspective(TransformType cameraTransformType) + public Pair handlePerspective(TransformType cameraTransformType) { - if(state instanceof IPerspectiveState) + TRSRTransformation tr = state.apply(Optional.of(cameraTransformType)).or(TRSRTransformation.identity()); + if(tr != TRSRTransformation.identity()) { - return Pair.of((IBakedModel)this, TRSRTransformation.blockCornerToCenter(((IPerspectiveState)state).forPerspective(cameraTransformType).apply(PartWrapper.create(node))).getMatrix()); + return Pair.of(this, TRSRTransformation.blockCornerToCenter(tr).getMatrix()); } - return Pair.of((IBakedModel)this, null); + return Pair.of(this, null); } } } diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java index 9afe97410..f882cb369 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java @@ -38,7 +38,6 @@ import net.minecraftforge.client.model.IModelCustomData; import net.minecraftforge.client.model.IModelPart; import net.minecraftforge.client.model.IModelState; import net.minecraftforge.client.model.IPerspectiveAwareModel; -import net.minecraftforge.client.model.IPerspectiveState; import net.minecraftforge.client.model.IRetexturableModel; import net.minecraftforge.client.model.ISmartBlockModel; import net.minecraftforge.client.model.ISmartItemModel; @@ -54,6 +53,7 @@ import org.apache.commons.lang3.tuple.Pair; import com.google.common.base.Charsets; import com.google.common.base.Function; +import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; @@ -121,11 +121,6 @@ public class OBJModel implements IRetexturableModel, IModelCustomData return new OBJBakedModel(this, state, format, builder.build()); } - public TRSRTransformation getDefaultState() - { - return TRSRTransformation.identity(); - } - public MaterialLibrary getMatLib() { return this.matLib; @@ -1108,13 +1103,13 @@ public class OBJModel implements IRetexturableModel, IModelCustomData this.faces = faces == null ? new LinkedHashSet() : faces; } - public LinkedHashSet applyTransform(TRSRTransformation transform) + public LinkedHashSet applyTransform(Optional transform) { LinkedHashSet faceSet = new LinkedHashSet(); for (Face f : this.faces) { // if (minUVBounds != null && maxUVBounds != null) f.normalizeUVs(minUVBounds, maxUVBounds); - faceSet.add(f.bake(transform)); + faceSet.add(f.bake(transform.or(TRSRTransformation.identity()))); } return faceSet; } @@ -1169,10 +1164,10 @@ public class OBJModel implements IRetexturableModel, IModelCustomData return parent; } - public TRSRTransformation apply(IModelPart part) + public Optional apply(Optional part) { if (parent != null) return parent.apply(part); - return new TRSRTransformation(EnumFacing.NORTH); + return Optional.absent(); } public Map getVisibilityMap() @@ -1325,7 +1320,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData { quads = Collections.synchronizedSet(new LinkedHashSet()); Set faces = Collections.synchronizedSet(new LinkedHashSet()); - TRSRTransformation transform = TRSRTransformation.identity(); + Optional transform = Optional.absent(); for (Group g : this.model.getMatLib().getGroups().values()) { // g.minUVBounds = this.model.getMatLib().minUVBounds; @@ -1337,7 +1332,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData OBJState state = (OBJState) this.state; if (state.parent != null) { - transform = state.parent.apply(model); + transform = state.parent.apply(Optional.absent()); } //TODO: can this be replaced by updateStateVisibilityMap(OBJState)? if (state.getGroupNamesFromMap().contains(Group.ALL)) @@ -1374,7 +1369,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData } else { - transform = state.apply(model); + transform = state.apply(Optional.absent()); faces.addAll(g.applyTransform(transform)); } } @@ -1578,13 +1573,14 @@ public class OBJModel implements IRetexturableModel, IModelCustomData } @Override - public Pair handlePerspective(TransformType cameraTransformType) + public Pair handlePerspective(TransformType cameraTransformType) { - if (state instanceof IPerspectiveState) + TRSRTransformation tr = state.apply(Optional.of(cameraTransformType)).or(TRSRTransformation.identity()); + if(tr != TRSRTransformation.identity()) { - return Pair.of((IBakedModel) this, TRSRTransformation.blockCornerToCenter(((IPerspectiveState) state).forPerspective(cameraTransformType).apply(model)).getMatrix()); + return Pair.of(this, TRSRTransformation.blockCornerToCenter(tr).getMatrix()); } - return Pair.of((IBakedModel) this, null); + return Pair.of(this, null); } @Override @@ -1605,4 +1601,10 @@ public class OBJModel implements IRetexturableModel, IModelCustomData this.modelLocation = modelLocation; } } + + @Override + public IModelState getDefaultState() + { + return TRSRTransformation.identity(); + } } diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java b/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java index ff84baebe..00773d4fe 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java @@ -17,9 +17,10 @@ import com.google.common.cache.LoadingCache; public class LightUtil { + private static final float s2 = (float)Math.pow(2, .5); + public static float diffuseLight(float x, float y, float z) { - float s2 = (float)Math.pow(2, .5); float y1 = y + 3 - 2 * s2; return (x * x * 0.6f + (y1 * y1 * (3 + 2 * s2)) / 8 + z * z * 0.8f); } diff --git a/src/test/java/net/minecraftforge/debug/LayerBreakingTest.java b/src/test/java/net/minecraftforge/debug/LayerBreakingTest.java index 573e1b012..52167ecac 100644 --- a/src/test/java/net/minecraftforge/debug/LayerBreakingTest.java +++ b/src/test/java/net/minecraftforge/debug/LayerBreakingTest.java @@ -147,16 +147,6 @@ public class LayerBreakingTest IFlexibleBakedModel solid; IFlexibleBakedModel translucent; - @SuppressWarnings("unused") - private class DefState implements IModelState - { - @Override - public TRSRTransformation apply(IModelPart part) - { - return TRSRTransformation.identity(); - } - }; - @Override public List getFaceQuads(EnumFacing p_177551_1_) { diff --git a/src/test/resources/assets/forgedebugmodelanimation/models/block/engine.json b/src/test/resources/assets/forgedebugmodelanimation/models/block/engine.json new file mode 100644 index 000000000..d7ef2789f --- /dev/null +++ b/src/test/resources/assets/forgedebugmodelanimation/models/block/engine.json @@ -0,0 +1,39 @@ +// vanilla json model, no modifications + +{ + "elements": [ + { + "from": [ 0, 0, 0 ], + "to": [ 16, 4, 16 ], + "faces": { + "down": { "uv": [ 0, 0, 16, 16 ], "texture":"#base" }, + "up": { "uv": [ 0, 0, 16, 16 ], "texture":"#base" }, + "north": { "uv": [ 0, 0, 16, 4 ], "texture":"#front" }, + "south": { "uv": [ 0, 0, 16, 4 ], "texture":"#front" }, + "west": { "uv": [ 0, 0, 16, 4 ], "texture":"#front" }, + "east": { "uv": [ 0, 0, 16, 4 ], "texture":"#front" } + } + }, + { + "from": [ 4, 4, 4 ], + "to": [ 12, 8, 12 ], + "faces": { + "north": { "uv": [ 4, 4, 12, 8 ], "texture":"#chamber" }, + "south": { "uv": [ 4, 4, 12, 8 ], "texture":"#chamber" }, + "west": { "uv": [ 4, 4, 12, 8 ], "texture":"#chamber" }, + "east": { "uv": [ 4, 4, 12, 8 ], "texture":"#chamber" } + } + }, + { + "from": [ 4, 12, 4 ], + "to": [ 12, 16, 12 ], + "faces": { + "up": { "uv": [ 0, 0, 8, 8 ], "texture":"#trunk" }, + "north": { "uv": [ 4, 12, 12, 16 ], "texture":"#trunk" }, + "south": { "uv": [ 4, 12, 12, 16 ], "texture":"#trunk" }, + "west": { "uv": [ 4, 12, 12, 16 ], "texture":"#trunk" }, + "east": { "uv": [ 4, 12, 12, 16 ], "texture":"#trunk" } + } + } + ] +} diff --git a/src/test/resources/assets/forgedebugmodelanimation/models/block/engine_ring.json b/src/test/resources/assets/forgedebugmodelanimation/models/block/engine_ring.json new file mode 100644 index 000000000..b6de7a275 --- /dev/null +++ b/src/test/resources/assets/forgedebugmodelanimation/models/block/engine_ring.json @@ -0,0 +1,36 @@ +{ + "elements": [ + { + "from": [ 0, 4, 0 ], + "to": [ 16, 8, 16 ], + "faces": { + "down": { "uv": [ 0, 0, 16, 16 ], "texture":"#base" }, + "up": { "uv": [ 0, 0, 16, 16 ], "texture":"#base" }, + "north": { "uv": [ 0, 4, 16, 8 ], "texture":"#front" }, + "south": { "uv": [ 0, 4, 16, 8 ], "texture":"#front" }, + "west": { "uv": [ 0, 4, 16, 8 ], "texture":"#front" }, + "east": { "uv": [ 0, 4, 16, 8 ], "texture":"#front" } + } + }, + { + "from": [ 4, 0, 4 ], + "to": [ 12, 4, 12 ], + "faces": { + "north": { "uv": [ 4, 8, 12, 12 ], "texture":"#chamber" }, + "south": { "uv": [ 4, 8, 12, 12 ], "texture":"#chamber" }, + "west": { "uv": [ 4, 8, 12, 12 ], "texture":"#chamber" }, + "east": { "uv": [ 4, 8, 12, 12 ], "texture":"#chamber" } + } + }, + { + "from": [ 4, 8, 4 ], + "to": [ 12, 12, 12 ], + "faces": { + "north": { "uv": [ 4, 8, 12, 12 ], "texture":"#trunk" }, + "south": { "uv": [ 4, 8, 12, 12 ], "texture":"#trunk" }, + "west": { "uv": [ 4, 8, 12, 12 ], "texture":"#trunk" }, + "east": { "uv": [ 4, 8, 12, 12 ], "texture":"#trunk" } + } + } + ] +} From 86c09722a08df626c003abeec290b8036fa6c74d Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 15 Dec 2015 21:49:19 +0300 Subject: [PATCH 110/133] IModel can now depend on a variant definition (ModelResourceLocation); added MultiLayerModel - simple model that'll render correctly in multiple layers + example of using it. --- .../client/model/IPerspectiveAwareModel.java | 23 +- .../client/model/ModelLoader.java | 10 +- .../client/model/ModelLoaderRegistry.java | 1 + .../client/model/MultiLayerModel.java | 261 ++++++++++++++++++ .../client/model/b3d/B3DLoader.java | 7 +- .../client/model/obj/OBJModel.java | 7 +- .../debug/MultiLayerModelDebug.java | 65 +++++ .../blockstates/test_layer_block.json | 18 ++ 8 files changed, 374 insertions(+), 18 deletions(-) create mode 100644 src/main/java/net/minecraftforge/client/model/MultiLayerModel.java create mode 100644 src/test/java/net/minecraftforge/debug/MultiLayerModelDebug.java create mode 100644 src/test/resources/assets/forgedebugmultilayermodel/blockstates/test_layer_block.json diff --git a/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java b/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java index 7856bb04c..de7e797bb 100644 --- a/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java +++ b/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java @@ -68,6 +68,24 @@ public interface IPerspectiveAwareModel extends IFlexibleBakedModel return builder.build(); } + public static Pair handlePerspective(IFlexibleBakedModel model, ImmutableMap transforms, TransformType cameraTransformType) + { + TRSRTransformation tr = transforms.get(cameraTransformType); + Matrix4f mat = null; + if(tr != null && tr != TRSRTransformation.identity()) mat = TRSRTransformation.blockCornerToCenter(tr).getMatrix(); + return Pair.of(model, mat); + } + + public static Pair handlePerspective(IFlexibleBakedModel model, IModelState state, TransformType cameraTransformType) + { + TRSRTransformation tr = state.apply(Optional.of(cameraTransformType)).or(TRSRTransformation.identity()); + if(tr != TRSRTransformation.identity()) + { + return Pair.of(model, TRSRTransformation.blockCornerToCenter(tr).getMatrix()); + } + return Pair.of(model, null); + } + public boolean isAmbientOcclusion() { return parent.isAmbientOcclusion(); } public boolean isGui3d() { return parent.isGui3d(); } public boolean isBuiltInRenderer() { return parent.isBuiltInRenderer(); } @@ -80,10 +98,7 @@ public interface IPerspectiveAwareModel extends IFlexibleBakedModel @Override public Pair handlePerspective(TransformType cameraTransformType) { - TRSRTransformation tr = transforms.get(cameraTransformType); - Matrix4f mat = null; - if(tr != null && tr != TRSRTransformation.identity()) mat = TRSRTransformation.blockCornerToCenter(tr).getMatrix(); - return Pair.of(this, mat); + return handlePerspective(this, transforms, cameraTransformType); } } } diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index fd93a3f4b..f0b4850b9 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -227,8 +227,14 @@ public class ModelLoader extends ModelBakery IModel model = ModelLoaderRegistry.getModel(location); for (ResourceLocation dep : model.getDependencies()) { - getModel(dep); - + if(dep instanceof ModelResourceLocation) + { + loadVariants(ImmutableList.of((ModelResourceLocation)dep)); + } + else + { + getModel(dep); + } } textures.addAll(model.getTextures()); } diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java index 6a8f73ee0..ed36a77b4 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java @@ -33,6 +33,7 @@ public class ModelLoaderRegistry registerLoader(OBJLoader.instance); registerLoader(ModelFluid.FluidLoader.instance); registerLoader(ItemLayerModel.Loader.instance); + registerLoader(MultiLayerModel.Loader.instance); } /* diff --git a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java new file mode 100644 index 000000000..ede84210d --- /dev/null +++ b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java @@ -0,0 +1,261 @@ +package net.minecraftforge.client.model; + +import java.util.Collection; +import java.util.List; + +import javax.vecmath.Matrix4f; + +import org.apache.commons.lang3.tuple.Pair; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.client.resources.model.ModelManager; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.MinecraftForgeClient; +import net.minecraftforge.client.model.ItemLayerModel.BakedModel; +import net.minecraftforge.fml.common.FMLLog; + +import com.google.common.base.Function; +import com.google.common.base.Optional; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; + +public class MultiLayerModel implements IModelCustomData +{ + public static final MultiLayerModel instance = new MultiLayerModel(ImmutableMap.of()); + + private final ImmutableMap, ModelResourceLocation> models; + + public MultiLayerModel(ImmutableMap, ModelResourceLocation> models) + { + this.models = models; + } + + @Override + public Collection getDependencies() + { + return ImmutableList.copyOf(models.values()); + } + + @Override + public Collection getTextures() + { + return ImmutableList.of(); + } + + @Override + public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) + { + return new MultiLayerBakedModel(models, format, IPerspectiveAwareModel.MapWrapper.getTransforms(state)); + } + + @Override + public IModelState getDefaultState() + { + return TRSRTransformation.identity(); + } + + @Override + public IModel process(ImmutableMap customData) + { + ImmutableMap.Builder, ModelResourceLocation> builder = ImmutableMap.builder(); + for(String key : customData.keySet()) + { + if("base".equals(key)) + { + builder.put(Optional.absent(), getLocation(customData.get(key))); + } + for(EnumWorldBlockLayer layer : EnumWorldBlockLayer.values()) + { + if(layer.toString().equals(key)) + { + builder.put(Optional.of(layer), getLocation(customData.get(key))); + } + } + } + ImmutableMap, ModelResourceLocation> models = builder.build(); + if(models.isEmpty()) return instance; + return new MultiLayerModel(models); + } + + private ModelResourceLocation getLocation(String json) + { + JsonElement e = new JsonParser().parse(json); + if(e.isJsonPrimitive() && e.getAsJsonPrimitive().isString()) + { + return new ModelResourceLocation(e.getAsString()); + } + FMLLog.severe("Expect ModelResourceLocation, got: ", json); + return new ModelResourceLocation("builtin/missing", "missing"); + } + + public static class MultiLayerBakedModel implements IFlexibleBakedModel, ISmartBlockModel, IPerspectiveAwareModel + { + private final ImmutableMap, ModelResourceLocation> models; + private final VertexFormat format; + private final ImmutableMap cameraTransforms;; + private IBakedModel base; + private ImmutableMap bakedModels; + private ImmutableMap, ImmutableList> quads; + + public MultiLayerBakedModel(ImmutableMap, ModelResourceLocation> models, VertexFormat format, ImmutableMap cameraTransforms) + { + this.models = models; + this.format = format; + this.cameraTransforms = cameraTransforms; + } + + private void compute() + { + if(base == null) + { + ModelManager manager = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager(); + base = getModel(manager, Optional.absent()); + + ImmutableMap.Builder builder = ImmutableMap.builder(); + for(EnumWorldBlockLayer layer : EnumWorldBlockLayer.values()) + { + if(models.containsKey(Optional.of(layer))) + { + builder.put(layer, getModel(manager, Optional.of(layer))); + } + } + bakedModels = builder.build(); + + ImmutableMap.Builder, ImmutableList> quadBuilder = ImmutableMap.builder(); + quadBuilder.put(Optional.absent(), buildQuads(Optional.absent())); + for(EnumFacing side: EnumFacing.values()) + { + quadBuilder.put(Optional.of(side), buildQuads(Optional.of(side))); + } + quads = quadBuilder.build(); + } + } + + private IBakedModel getModel(ModelManager manager, Optional layer) + { + ModelResourceLocation loc = models.get(layer); + if(loc == null) + { + loc = new ModelResourceLocation("builtin/missing", "missing"); + } + return manager.getModel(loc); + } + + private ImmutableList buildQuads(Optional side) + { + ImmutableList.Builder builder = ImmutableList.builder(); + for(IBakedModel model : bakedModels.values()) + { + if(side.isPresent()) + { + builder.addAll(model.getFaceQuads(side.get())); + } + else + { + builder.addAll(model.getGeneralQuads()); + } + } + return builder.build(); + } + + @Override + public List getFaceQuads(EnumFacing side) + { + compute(); + return quads.get(Optional.of(side)); + } + + @Override + public List getGeneralQuads() + { + compute(); + return quads.get(Optional.absent()); + } + + @Override + public boolean isAmbientOcclusion() + { + compute(); + return base.isAmbientOcclusion(); + } + + @Override + public boolean isGui3d() + { + compute(); + return base.isGui3d(); + } + + @Override + public boolean isBuiltInRenderer() + { + compute(); + return base.isBuiltInRenderer(); + } + + @Override + public TextureAtlasSprite getTexture() + { + compute(); + return base.getTexture(); + } + + @Override + public ItemCameraTransforms getItemCameraTransforms() + { + return ItemCameraTransforms.DEFAULT; + } + + @Override + public IBakedModel handleBlockState(IBlockState state) + { + compute(); + return bakedModels.get(MinecraftForgeClient.getRenderLayer()); + } + + @Override + public VertexFormat getFormat() + { + return format; + } + + @Override + public Pair handlePerspective(TransformType cameraTransformType) + { + return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, cameraTransforms, cameraTransformType); + } + } + + public static enum Loader implements ICustomModelLoader + { + instance; + + public void onResourceManagerReload(IResourceManager resourceManager) {} + + public boolean accepts(ResourceLocation modelLocation) + { + return modelLocation.getResourceDomain().equals("forge") && ( + modelLocation.getResourcePath().equals("multi-layer") || + modelLocation.getResourcePath().equals("models/block/multi-layer") || + modelLocation.getResourcePath().equals("models/item/multi-layer")); + } + + public IModel loadModel(ResourceLocation modelLocation) + { + return MultiLayerModel.instance; + } + } +} diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java index c06eacba2..5be50b080 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java @@ -995,12 +995,7 @@ public class B3DLoader implements ICustomModelLoader public Pair handlePerspective(TransformType cameraTransformType) { - TRSRTransformation tr = state.apply(Optional.of(cameraTransformType)).or(TRSRTransformation.identity()); - if(tr != TRSRTransformation.identity()) - { - return Pair.of(this, TRSRTransformation.blockCornerToCenter(tr).getMatrix()); - } - return Pair.of(this, null); + return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, state, cameraTransformType); } } } diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java index f882cb369..2d2ab24ea 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java @@ -1575,12 +1575,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData @Override public Pair handlePerspective(TransformType cameraTransformType) { - TRSRTransformation tr = state.apply(Optional.of(cameraTransformType)).or(TRSRTransformation.identity()); - if(tr != TRSRTransformation.identity()) - { - return Pair.of(this, TRSRTransformation.blockCornerToCenter(tr).getMatrix()); - } - return Pair.of(this, null); + return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, state, cameraTransformType); } @Override diff --git a/src/test/java/net/minecraftforge/debug/MultiLayerModelDebug.java b/src/test/java/net/minecraftforge/debug/MultiLayerModelDebug.java new file mode 100644 index 000000000..2c4d17815 --- /dev/null +++ b/src/test/java/net/minecraftforge/debug/MultiLayerModelDebug.java @@ -0,0 +1,65 @@ +package net.minecraftforge.debug; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.Mod.EventHandler; +import net.minecraftforge.fml.common.SidedProxy; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.registry.GameRegistry; + +@Mod(modid = MultiLayerModelDebug.MODID, version = MultiLayerModelDebug.VERSION) +public class MultiLayerModelDebug +{ + public static final String MODID = "forgedebugmultilayermodel"; + public static final String VERSION = "0.0"; + + public static String blockName = "test_layer_block"; + + @SidedProxy(serverSide = "net.minecraftforge.debug.MultiLayerModelDebug$CommonProxy", clientSide = "net.minecraftforge.debug.MultiLayerModelDebug$ClientProxy") + public static CommonProxy proxy; + + public static class CommonProxy + { + public void preInit(FMLPreInitializationEvent event) + { + GameRegistry.registerBlock(new Block(Material.wood) + { + { + setCreativeTab(CreativeTabs.tabBlock); + setUnlocalizedName(MODID + "." + blockName); + } + + @Override + public boolean isOpaqueCube() { return false; } + + @Override + public boolean isFullCube() { return false; } + + @Override + public boolean canRenderInLayer(EnumWorldBlockLayer layer) + { + return layer == EnumWorldBlockLayer.SOLID || layer == EnumWorldBlockLayer.TRANSLUCENT; + } + }, blockName); + } + } + + public static class ClientProxy extends CommonProxy + { + @Override + public void preInit(FMLPreInitializationEvent event) + { + super.preInit(event); + ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(GameRegistry.findBlock(MODID, blockName)), 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + blockName, "inventory")); + } + } + + @EventHandler + public void preInit(FMLPreInitializationEvent event) { proxy.preInit(event); } +} diff --git a/src/test/resources/assets/forgedebugmultilayermodel/blockstates/test_layer_block.json b/src/test/resources/assets/forgedebugmultilayermodel/blockstates/test_layer_block.json new file mode 100644 index 000000000..50a1efe26 --- /dev/null +++ b/src/test/resources/assets/forgedebugmultilayermodel/blockstates/test_layer_block.json @@ -0,0 +1,18 @@ +{ + "forge_marker": 1, + "defaults": { + "model": "forge:multi-layer", + "custom": { + // base is used for model properties - camera transforms, isGui3d, e.t.c. + "base": "minecraft:stone_slab#half=bottom", + // per-layer models + "Solid": "minecraft:stone_slab#half=bottom", + "Translucent": "minecraft:pink_stained_glass_pane#east=true,north=false,south=false,west=true" + }, + "transform": "forge:default-block" + }, + "variants": { + "normal": [{}], + "inventory": [{}] + } +} From 7c4d643de227a3c1adf1f95baa89127e1c01c47d Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 15 Dec 2015 22:24:02 +0300 Subject: [PATCH 111/133] Fixed java6 errors in previous commit. --- .../net/minecraftforge/client/model/MultiLayerModel.java | 8 ++++---- .../fml/common/event/FMLPostInitializationEvent.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java index ede84210d..2b864ddfa 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java @@ -34,7 +34,7 @@ import com.google.gson.JsonParser; public class MultiLayerModel implements IModelCustomData { - public static final MultiLayerModel instance = new MultiLayerModel(ImmutableMap.of()); + public static final MultiLayerModel instance = new MultiLayerModel(ImmutableMap., ModelResourceLocation>of()); private final ImmutableMap, ModelResourceLocation> models; @@ -75,7 +75,7 @@ public class MultiLayerModel implements IModelCustomData { if("base".equals(key)) { - builder.put(Optional.absent(), getLocation(customData.get(key))); + builder.put(Optional.absent(), getLocation(customData.get(key))); } for(EnumWorldBlockLayer layer : EnumWorldBlockLayer.values()) { @@ -122,7 +122,7 @@ public class MultiLayerModel implements IModelCustomData if(base == null) { ModelManager manager = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager(); - base = getModel(manager, Optional.absent()); + base = getModel(manager, Optional.absent()); ImmutableMap.Builder builder = ImmutableMap.builder(); for(EnumWorldBlockLayer layer : EnumWorldBlockLayer.values()) @@ -135,7 +135,7 @@ public class MultiLayerModel implements IModelCustomData bakedModels = builder.build(); ImmutableMap.Builder, ImmutableList> quadBuilder = ImmutableMap.builder(); - quadBuilder.put(Optional.absent(), buildQuads(Optional.absent())); + quadBuilder.put(Optional.absent(), buildQuads(Optional.absent())); for(EnumFacing side: EnumFacing.values()) { quadBuilder.put(Optional.of(side), buildQuads(Optional.of(side))); diff --git a/src/main/java/net/minecraftforge/fml/common/event/FMLPostInitializationEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLPostInitializationEvent.java index eb0d64f88..9a28b50ab 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLPostInitializationEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLPostInitializationEvent.java @@ -55,7 +55,7 @@ public class FMLPostInitializationEvent extends FMLStateEvent * @param className The name of the class I wish to instantiate * @return An optional containing the object if possible, or null if not */ - public Optional buildSoftDependProxy(String modId, String className, Object... arguments) + public Optional buildSoftDependProxy(String modId, String className, Object... arguments) { if (Loader.isModLoaded(modId)) { From f0ae51bb346c8c8dacac6d9e48f97f68708798cb Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 15 Dec 2015 22:20:12 +0300 Subject: [PATCH 112/133] Forge pipeline will now take original model lightmap into account, if present. --- .../client/model/pipeline/QuadGatheringTransformer.java | 8 +++++++- .../client/model/pipeline/VertexLighterFlat.java | 6 ++++++ .../net/minecraftforge/debug/MultiLayerModelDebug.java | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/QuadGatheringTransformer.java b/src/main/java/net/minecraftforge/client/model/pipeline/QuadGatheringTransformer.java index 0edc74313..355529c86 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/QuadGatheringTransformer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/QuadGatheringTransformer.java @@ -8,6 +8,7 @@ public abstract class QuadGatheringTransformer implements IVertexConsumer protected VertexFormat format; protected int vertices = 0; + protected byte[] dataLength = null; protected float[][][] quadData = null; public void setParent(IVertexConsumer parent) @@ -18,6 +19,7 @@ public abstract class QuadGatheringTransformer implements IVertexConsumer public void setVertexFormat(VertexFormat format) { this.format = format; + dataLength = new byte[format.getElementCount()]; quadData = new float[format.getElementCount()][4][4]; } @@ -32,7 +34,11 @@ public abstract class QuadGatheringTransformer implements IVertexConsumer { System.arraycopy(data, 0, quadData[element][vertices], 0, data.length); if(element == getVertexFormat().getElementCount() - 1) vertices++; - if(vertices == 4) + if(vertices == 0) + { + dataLength[element] = (byte)data.length; + } + else if(vertices == 4) { vertices = 0; processQuad(); diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java index 954215f9f..fd54adede 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java @@ -131,7 +131,13 @@ public class VertexLighterFlat extends QuadGatheringTransformer z += normal[v][2] * .5f; } + float blockLight = lightmap[v][0], skyLight = lightmap[v][1]; updateLightmap(normal[v], lightmap[v], x, y, z); + if(dataLength[lightmapIndex] > 1) + { + if(blockLight > lightmap[v][0]) lightmap[v][0] = blockLight; + if(skyLight > lightmap[v][1]) lightmap[v][1] = skyLight; + } updateColor(normal[v], color[v], x, y, z, tint, multiplier); if(EntityRenderer.anaglyphEnable) { diff --git a/src/test/java/net/minecraftforge/debug/MultiLayerModelDebug.java b/src/test/java/net/minecraftforge/debug/MultiLayerModelDebug.java index 2c4d17815..c50bbdd49 100644 --- a/src/test/java/net/minecraftforge/debug/MultiLayerModelDebug.java +++ b/src/test/java/net/minecraftforge/debug/MultiLayerModelDebug.java @@ -40,7 +40,7 @@ public class MultiLayerModelDebug @Override public boolean isFullCube() { return false; } - + @Override public boolean canRenderInLayer(EnumWorldBlockLayer layer) { From d67c57827acbbf92c811ce486454c6a9ed40f6ff Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 15 Dec 2015 23:03:09 +0300 Subject: [PATCH 113/133] Delayed quad list resolution in MultiModel, fixes NPE in MultiLayerModel. --- .../client/model/MultiModel.java | 53 ++++++++++--------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/MultiModel.java b/src/main/java/net/minecraftforge/client/model/MultiModel.java index 4f0178c54..9e55b6001 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiModel.java @@ -37,8 +37,8 @@ public class MultiModel implements IModel protected final ImmutableMap parts; protected final IFlexibleBakedModel internalBase; - protected final ImmutableList general; - protected final ImmutableMap> faces; + protected ImmutableList general; + protected ImmutableMap> faces; protected final ImmutableMap> transforms; public Baked(IFlexibleBakedModel base, ImmutableMap parts) @@ -62,29 +62,6 @@ public class MultiModel implements IModel throw new IllegalArgumentException("No base model or submodel provided for MultiModel.Baked " + location + "."); } - // Create map of each face's quads. - EnumMap> faces = Maps.newEnumMap(EnumFacing.class); - - for (EnumFacing face : EnumFacing.values()) - { - ImmutableList.Builder faceQuads = ImmutableList.builder(); - if (base != null) - faceQuads.addAll(base.getFaceQuads(face)); - for (IFlexibleBakedModel bakedPart : parts.values()) - faceQuads.addAll(bakedPart.getFaceQuads(face)); - faces.put(face, faceQuads.build()); - } - - this.faces = Maps.immutableEnumMap(faces); - - // Create list of general quads. - ImmutableList.Builder genQuads = ImmutableList.builder(); - if (base != null) - genQuads.addAll(base.getGeneralQuads()); - for (IFlexibleBakedModel bakedPart : parts.values()) - genQuads.addAll(bakedPart.getGeneralQuads()); - general = genQuads.build(); - // Only changes the base model based on perspective, may recurse for parts in the future. if(perspective && base instanceof IPerspectiveAwareModel) { @@ -137,12 +114,38 @@ public class MultiModel implements IModel @Override public List getFaceQuads(EnumFacing side) { + if(faces == null) + { + // Create map of each face's quads. + EnumMap> faces = Maps.newEnumMap(EnumFacing.class); + + for (EnumFacing face : EnumFacing.values()) + { + ImmutableList.Builder faceQuads = ImmutableList.builder(); + if (base != null) + faceQuads.addAll(base.getFaceQuads(face)); + for (IFlexibleBakedModel bakedPart : parts.values()) + faceQuads.addAll(bakedPart.getFaceQuads(face)); + faces.put(face, faceQuads.build()); + } + this.faces = Maps.immutableEnumMap(faces); + } return faces.get(side); } @Override public List getGeneralQuads() { + if(general == null) + { + // Create list of general quads. + ImmutableList.Builder genQuads = ImmutableList.builder(); + if (base != null) + genQuads.addAll(base.getGeneralQuads()); + for (IFlexibleBakedModel bakedPart : parts.values()) + genQuads.addAll(bakedPart.getGeneralQuads()); + general = genQuads.build(); + } return general; } From 80ba13be896824e1bb8743bd8aec7ec601159e1a Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Tue, 15 Dec 2015 23:31:09 +0300 Subject: [PATCH 114/133] LightUtil.pack and .unpack now work correctly with unpacked arrays of size <4. --- .../client/model/pipeline/LightUtil.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java b/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java index 00773d4fe..4a5a8036f 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java @@ -136,7 +136,8 @@ public class LightUtil public static void unpack(int[] from, float[] to, VertexFormat formatFrom, int v, int e) { VertexFormatElement element = formatFrom.getElement(e); - for(int i = 0; i < 4; i++) + int length = 4 <+ to.length ? 4 : to.length; + for(int i = 0; i < length; i++) { if(i < element.getElementCount()) { @@ -193,20 +194,21 @@ public class LightUtil int offset = pos & 3; int bits = 0; int mask = (256 << (8 * (element.getType().getSize() - 1))) - 1; + float f = i < from.length ? from[i] : 0; switch(element.getType()) { case FLOAT: - bits = Float.floatToRawIntBits(from[i]); + bits = Float.floatToRawIntBits(f); break; case UBYTE: case USHORT: case UINT: - bits = (int)(from[i] * mask); + bits = (int)(f * mask); break; case BYTE: case SHORT: case INT: - bits = (int)(from[i] * mask / 2); + bits = (int)(f * mask / 2); break; } to[index] &= ~(mask << (offset * 8)); From 1dcc9abab2b37d32fbb6372b5988064eab233e3a Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Thu, 17 Dec 2015 04:40:34 +0300 Subject: [PATCH 115/133] Fix dependency resolution for models with custom data/textures. --- .../client/model/ModelLoader.java | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index f0b4850b9..b4c8dc5f2 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -225,18 +225,7 @@ public class ModelLoader extends ModelBakery try { IModel model = ModelLoaderRegistry.getModel(location); - for (ResourceLocation dep : model.getDependencies()) - { - if(dep instanceof ModelResourceLocation) - { - loadVariants(ImmutableList.of((ModelResourceLocation)dep)); - } - else - { - getModel(dep); - } - } - textures.addAll(model.getTextures()); + resolveDependencies(model); } finally { @@ -244,6 +233,22 @@ public class ModelLoader extends ModelBakery } } + private void resolveDependencies(IModel model) throws IOException + { + for (ResourceLocation dep : model.getDependencies()) + { + if(dep instanceof ModelResourceLocation) + { + loadVariants(ImmutableList.of((ModelResourceLocation)dep)); + } + else + { + getModel(dep); + } + } + textures.addAll(model.getTextures()); + } + private class VanillaModelWrapper implements IRetexturableModel { private final ResourceLocation location; @@ -563,6 +568,14 @@ public class ModelLoader extends ModelBakery if (v instanceof ISmartVariant) { model = ((ISmartVariant)v).process(model, ModelLoader.this); + try + { + resolveDependencies(model); + } + catch (IOException e) + { + FMLLog.getLogger().error("Exception resolving indirect dependencies for model" + loc, e); + } textures.addAll(model.getTextures()); // Kick this, just in case. } From b6650263788f863e18ba9388e29a04d8609963ab Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 19 Dec 2015 12:48:47 +0100 Subject: [PATCH 116/133] Fix client side commands adding parts of the color codes on autocomplete (prefix "7" and suffix "r"). --- .../minecraft/client/gui/GuiChat.java.patch | 8 +++ .../test/ClientCommandTest.java | 68 +++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 src/test/java/net/minecraftforge/test/ClientCommandTest.java diff --git a/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch index 8b16ab92b..799a580d0 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiChat.java.patch @@ -29,3 +29,11 @@ for (String s : p_146406_1_) { if (s.length() > 0) +@@ -291,6 +298,7 @@ + + String s1 = this.field_146415_a.func_146179_b().substring(this.field_146415_a.func_146197_a(-1, this.field_146415_a.func_146198_h(), false)); + String s2 = StringUtils.getCommonPrefix(p_146406_1_); ++ s2 = net.minecraft.util.EnumChatFormatting.func_110646_a(s2); + + if (s2.length() > 0 && !s1.equalsIgnoreCase(s2)) + { diff --git a/src/test/java/net/minecraftforge/test/ClientCommandTest.java b/src/test/java/net/minecraftforge/test/ClientCommandTest.java new file mode 100644 index 000000000..79478f298 --- /dev/null +++ b/src/test/java/net/minecraftforge/test/ClientCommandTest.java @@ -0,0 +1,68 @@ +package net.minecraftforge.test; + +import java.util.Arrays; +import java.util.List; + +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraftforge.client.ClientCommandHandler; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.Mod.EventHandler; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.registry.GameData; + +@Mod(modid="clientcommandtest", name="Client Command Test", version="0.0.0") +public class ClientCommandTest { + @EventHandler + public void init(FMLInitializationEvent event) + { + ClientCommandHandler.instance.registerCommand(new TestCommand()); + } + + private class TestCommand extends CommandBase { + @Override + public String getCommandName() + { + return "clientCommandTest"; + } + + @Override + public String getCommandUsage(ICommandSender sender) + { + return "clientCommandTest "; + } + + @Override + public boolean canCommandSenderUseCommand(ICommandSender sender) + { + return true; + } + + @Override + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + if (args.length > 0) + { + return getListOfStringsMatchingLastWord(args, GameData.getBlockRegistry().getKeys()); + } + + return null; + } + + @Override + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length > 0) + { + sender.addChatMessage(new ChatComponentText("Input: " + Arrays.toString(args))); + } + else + { + sender.addChatMessage(new ChatComponentText("No arguments.")); + } + } + } +} From 56f35f4401300324a6de73f411b5e6415ea7535d Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Sun, 20 Dec 2015 22:14:21 +0300 Subject: [PATCH 117/133] Fixed NPE caused by accessing undefined layer in MultiLayerModel. --- .../net/minecraftforge/client/model/MultiLayerModel.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java index 2b864ddfa..d992b4ba3 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java @@ -106,6 +106,7 @@ public class MultiLayerModel implements IModelCustomData private final ImmutableMap, ModelResourceLocation> models; private final VertexFormat format; private final ImmutableMap cameraTransforms;; + private IBakedModel missing; private IBakedModel base; private ImmutableMap bakedModels; private ImmutableMap, ImmutableList> quads; @@ -122,6 +123,7 @@ public class MultiLayerModel implements IModelCustomData if(base == null) { ModelManager manager = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager(); + missing = manager.getMissingModel(); base = getModel(manager, Optional.absent()); ImmutableMap.Builder builder = ImmutableMap.builder(); @@ -223,7 +225,12 @@ public class MultiLayerModel implements IModelCustomData public IBakedModel handleBlockState(IBlockState state) { compute(); - return bakedModels.get(MinecraftForgeClient.getRenderLayer()); + EnumWorldBlockLayer layer = MinecraftForgeClient.getRenderLayer(); + if(!bakedModels.containsKey(layer)) + { + return missing; + } + return bakedModels.get(layer); } @Override From 4f6784b7333ca3414d71ecf39faf1452326d3694 Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Tue, 15 Dec 2015 22:19:04 +0100 Subject: [PATCH 118/133] Add a dynamic bucket model that displays the animated liquid contained Has a config option (default off) that replaces the vanilla buckets with the forge bucket model New original bucket textures from mr_hazard --- .../client/gui/ForgeGuiFactory.java | 25 ++ .../model/ItemTextureQuadConverter.java | 273 +++++++++++++++++ .../client/model/ModelDynBucket.java | 274 ++++++++++++++++++ .../client/model/ModelLoader.java | 70 +++++ .../client/model/ModelLoaderRegistry.java | 1 + .../common/ForgeModContainer.java | 12 + .../common/config/Configuration.java | 1 + .../assets/forge/blockstates/dynbucket.json | 18 ++ .../resources/assets/forge/lang/en_US.lang | 3 + .../assets/forge/models/item/bucket.json | 18 ++ .../assets/forge/models/item/bucket_milk.json | 20 ++ .../forge/textures/items/bucket_base.png | Bin 0 -> 597 bytes .../forge/textures/items/bucket_cover.png | Bin 0 -> 611 bytes .../forge/textures/items/bucket_fluid.png | Bin 0 -> 157 bytes .../minecraftforge/debug/DynBucketTest.java | 179 ++++++++++++ .../minecraftforge/debug/ModelFluidDebug.java | 34 +++ .../assets/forge/blockstates/dynbottle.json | 18 ++ .../forge/textures/blocks/milk_flow.png | Bin 0 -> 5163 bytes .../textures/blocks/milk_flow.png.mcmeta | 3 + .../forge/textures/blocks/milk_still.png | Bin 0 -> 6438 bytes .../textures/blocks/milk_still.png.mcmeta | 5 + .../blockstates/TestFluidBlock.json | 4 + 22 files changed, 958 insertions(+) create mode 100644 src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java create mode 100644 src/main/java/net/minecraftforge/client/model/ModelDynBucket.java create mode 100644 src/main/resources/assets/forge/blockstates/dynbucket.json create mode 100644 src/main/resources/assets/forge/models/item/bucket.json create mode 100644 src/main/resources/assets/forge/models/item/bucket_milk.json create mode 100644 src/main/resources/assets/forge/textures/items/bucket_base.png create mode 100644 src/main/resources/assets/forge/textures/items/bucket_cover.png create mode 100644 src/main/resources/assets/forge/textures/items/bucket_fluid.png create mode 100644 src/test/java/net/minecraftforge/debug/DynBucketTest.java create mode 100644 src/test/resources/assets/forge/blockstates/dynbottle.json create mode 100644 src/test/resources/assets/forge/textures/blocks/milk_flow.png create mode 100644 src/test/resources/assets/forge/textures/blocks/milk_flow.png.mcmeta create mode 100644 src/test/resources/assets/forge/textures/blocks/milk_still.png create mode 100644 src/test/resources/assets/forge/textures/blocks/milk_still.png.mcmeta diff --git a/src/main/java/net/minecraftforge/client/gui/ForgeGuiFactory.java b/src/main/java/net/minecraftforge/client/gui/ForgeGuiFactory.java index fcfee4e9e..bb11f3029 100644 --- a/src/main/java/net/minecraftforge/client/gui/ForgeGuiFactory.java +++ b/src/main/java/net/minecraftforge/client/gui/ForgeGuiFactory.java @@ -104,6 +104,7 @@ public class ForgeGuiFactory implements IModGuiFactory { List list = new ArrayList(); list.add(new DummyCategoryElement("forgeCfg", "forge.configgui.ctgy.forgeGeneralConfig", GeneralEntry.class)); + list.add(new DummyCategoryElement("forgeClientCfg", "forge.configgui.ctgy.forgeClientConfig", ClientEntry.class)); list.add(new DummyCategoryElement("forgeChunkLoadingCfg", "forge.configgui.ctgy.forgeChunkLoadingConfig", ChunkLoaderEntry.class)); list.add(new DummyCategoryElement("forgeVersionCheckCfg", "forge.configgui.ctgy.VersionCheckConfig", VersionCheckEntry.class)); return list; @@ -133,6 +134,30 @@ public class ForgeGuiFactory implements IModGuiFactory } } + /** + * This custom list entry provides the Client only Settings entry on the Minecraft Forge Configuration screen. + * It extends the base Category entry class and defines the IConfigElement objects that will be used to build the child screen. + */ + public static class ClientEntry extends CategoryEntry + { + public ClientEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop) + { + super(owningScreen, owningEntryList, prop); + } + + @Override + protected GuiScreen buildChildScreen() + { + // This GuiConfig object specifies the configID of the object and as such will force-save when it is closed. The parent + // GuiConfig object's entryList will also be refreshed to reflect the changes. + return new GuiConfig(this.owningScreen, + (new ConfigElement(ForgeModContainer.getConfig().getCategory(Configuration.CATEGORY_CLIENT))).getChildElements(), + this.owningScreen.modID, Configuration.CATEGORY_CLIENT, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart, + this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, + GuiConfig.getAbridgedConfigPath(ForgeModContainer.getConfig().toString())); + } + } + /** * This custom list entry provides the Forge Chunk Manager Config entry on the Minecraft Forge Configuration screen. * It extends the base Category entry class and defines the IConfigElement objects that will be used to build the child screen. diff --git a/src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java b/src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java new file mode 100644 index 000000000..074e687e5 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/model/ItemTextureQuadConverter.java @@ -0,0 +1,273 @@ +package net.minecraftforge.client.model; + +import com.google.common.collect.Lists; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; + +import javax.vecmath.Vector4f; +import java.util.List; + +public final class ItemTextureQuadConverter +{ + private ItemTextureQuadConverter() + { + // non-instantiable + } + + /** + * Takes a texture and converts it into BakedQuads. + * The conversion is done by scanning the texture horizontally and vertically and creating "strips" of the texture. + * Strips that are of the same size and follow each other are converted into one bigger quad. + *
+ * The resulting list of quads is the texture represented as a list of horizontal OR vertical quads, + * depending on which creates less quads. If the amount of quads is equal, horizontal is preferred. + * + * @param format + * @param template The input texture to convert + * @param sprite The texture whose UVs shall be used @return The generated quads. + */ + public static List convertTexture(VertexFormat format, TRSRTransformation transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, EnumFacing facing, int color) + { + List horizontal = convertTextureHorizontal(format, transform, template, sprite, z, facing, color); + List vertical = convertTextureVertical(format, transform, template, sprite, z, facing, color); + + return horizontal.size() >= vertical.size() ? horizontal : vertical; + } + + /** + * Scans a texture and converts it into a list of horizontal strips stacked on top of each other. + * The height of the strips is as big as possible. + */ + public static List convertTextureHorizontal(VertexFormat format, TRSRTransformation transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, EnumFacing facing, int color) + { + int w = template.getIconWidth(); + int h = template.getIconHeight(); + int[] data = template.getFrameTextureData(0)[0]; + List quads = Lists.newArrayList(); + + // the upper left x-position of the current quad + int start = -1; + for (int y = 0; y < h; y++) + { + for (int x = 0; x < w; x++) + { + // current pixel + int pixel = data[y * w + x]; + + // no current quad but found a new one + if (start < 0 && isVisible(pixel)) + { + start = x; + } + // got a current quad, but it ends here + if (start >= 0 && !isVisible(pixel)) + { + // we now check if the visibility of the next row matches the one fo the current row + // if they are, we can extend the quad downwards + int endY = y + 1; + boolean sameRow = true; + while (sameRow) + { + for (int i = 0; i < w; i++) + { + int px1 = data[y * w + i]; + int px2 = data[endY * w + i]; + if (isVisible(px1) != isVisible(px2)) + { + sameRow = false; + break; + } + } + if (sameRow) + { + endY++; + } + } + + // create the quad + quads.add(genQuad(format, transform, start, y, x, endY, z, sprite, facing, color)); + + // update Y if all the rows match. no need to rescan + if (endY - y > 1) + { + y = endY - 1; + } + // clear current quad + start = -1; + } + } + } + + return quads; + } + + /** + * Scans a texture and converts it into a list of vertical strips stacked next to each other from left to right. + * The width of the strips is as big as possible. + */ + public static List convertTextureVertical(VertexFormat format, TRSRTransformation transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, EnumFacing facing, int color) + { + int w = template.getIconWidth(); + int h = template.getIconHeight(); + int[] data = template.getFrameTextureData(0)[0]; + List quads = Lists.newArrayList(); + + // the upper left y-position of the current quad + int start = -1; + for (int x = 0; x < w; x++) + { + for (int y = 0; y < h; y++) + { + // current pixel + int pixel = data[y * w + x]; + + // no current quad but found a new one + if (start < 0 && isVisible(pixel)) + { + start = y; + } + // got a current quad, but it ends here + if (start >= 0 && !isVisible(pixel)) + { + // we now check if the visibility of the next column matches the one fo the current row + // if they are, we can extend the quad downwards + int endX = x + 1; + boolean sameColumn = true; + while (sameColumn) + { + for (int i = 0; i < h; i++) + { + int px1 = data[i * w + x]; + int px2 = data[i * w + endX]; + if (isVisible(px1) != isVisible(px2)) + { + sameColumn = false; + break; + } + } + if (sameColumn) + { + endX++; + } + } + + // create the quad + quads.add(genQuad(format, transform, x, start, endX, y, z, sprite, facing, color)); + + // update X if all the columns match. no need to rescan + if (endX - x > 1) + { + x = endX - 1; + } + // clear current quad + start = -1; + } + } + } + + return quads; + } + + // true if alpha != 0 + private static boolean isVisible(int color) + { + return (color >> 24 & 255) > 0; + } + + /** + * Generates a Front/Back quad for an itemmodel. Therefore only supports facing NORTH and SOUTH. + */ + public static UnpackedBakedQuad genQuad(VertexFormat format, TRSRTransformation transform, float x1, float y1, float x2, float y2, float z, TextureAtlasSprite sprite, EnumFacing facing, int color) + { + float u1 = sprite.getInterpolatedU(x1); + float v1 = sprite.getInterpolatedV(y1); + float u2 = sprite.getInterpolatedU(x2); + float v2 = sprite.getInterpolatedV(y2); + + x1 /= 16f; + y1 /= 16f; + x2 /= 16f; + y2 /= 16f; + + float tmp = y1; + y1 = 1f - y2; + y2 = 1f - tmp; + + return putQuad(format, transform, facing, color, x1, y1, x2, y2, z, u1, v1, u2, v2); + } + + private static UnpackedBakedQuad putQuad(VertexFormat format, TRSRTransformation transform, EnumFacing side, int color, + float x1, float y1, float x2, float y2, float z, + float u1, float v1, float u2, float v2) + { + side = side.getOpposite(); + UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format); + builder.setQuadTint(-1); + builder.setQuadOrientation(side); + builder.setQuadColored(); + + if (side == EnumFacing.NORTH) + { + putVertex(builder, format, transform, side, x1, y1, z, u1, v2, color); + putVertex(builder, format, transform, side, x2, y1, z, u2, v2, color); + putVertex(builder, format, transform, side, x2, y2, z, u2, v1, color); + putVertex(builder, format, transform, side, x1, y2, z, u1, v1, color); + } else + { + putVertex(builder, format, transform, side, x1, y1, z, u1, v2, color); + putVertex(builder, format, transform, side, x1, y2, z, u1, v1, color); + putVertex(builder, format, transform, side, x2, y2, z, u2, v1, color); + putVertex(builder, format, transform, side, x2, y1, z, u2, v2, color); + } + return builder.build(); + } + + private static void putVertex(UnpackedBakedQuad.Builder builder, VertexFormat format, TRSRTransformation transform, EnumFacing side, + float x, float y, float z, float u, float v, int color) + { + Vector4f vec = new Vector4f(); + for (int e = 0; e < format.getElementCount(); e++) + { + switch (format.getElement(e).getUsage()) + { + case POSITION: + if (transform == TRSRTransformation.identity()) + { + builder.put(e, x, y, z, 1); + } + // only apply the transform if it's not identity + else + { + vec.x = x; + vec.y = y; + vec.z = z; + vec.w = 1; + transform.getMatrix().transform(vec); + builder.put(e, vec.x, vec.y, vec.z, vec.w); + } + break; + case COLOR: + float r = ((color >> 16) & 0xFF) / 255f; // red + float g = ((color >> 8) & 0xFF) / 255f; // green + float b = ((color >> 0) & 0xFF) / 255f; // blue + float a = ((color >> 24) & 0xFF) / 255f; // alpha + builder.put(e, r, g, b, a); + break; + case UV: + if (format.getElement(e).getIndex() == 0) + { + builder.put(e, u, v, 0f, 1f); + break; + } + case NORMAL: + builder.put(e, (float) side.getFrontOffsetX(), (float) side.getFrontOffsetY(), (float) side.getFrontOffsetZ(), 0f); + break; + default: + builder.put(e); + break; + } + } + } +} diff --git a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java new file mode 100644 index 000000000..0e39043e4 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java @@ -0,0 +1,274 @@ +package net.minecraftforge.client.model; + +import com.google.common.base.Function; +import com.google.common.base.Optional; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Maps; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fluids.*; +import org.apache.commons.lang3.tuple.Pair; + +import javax.vecmath.Matrix4f; +import javax.vecmath.Quat4f; +import java.io.IOException; +import java.util.Collection; +import java.util.Map; + +public class ModelDynBucket implements IModel, IModelCustomData, IRetexturableModel +{ + public static final ModelResourceLocation LOCATION = new ModelResourceLocation(new ResourceLocation("forge", "dynbucket"), "inventory"); + + // minimal Z offset to prevent depth-fighting + private static final float NORTH_Z_BASE = 7.496f / 16f; + private static final float SOUTH_Z_BASE = 8.504f / 16f; + private static final float NORTH_Z_FLUID = 7.498f / 16f; + private static final float SOUTH_Z_FLUID = 8.502f / 16f; + + public static final IModel MODEL = new ModelDynBucket(); + + protected final ResourceLocation baseLocation; + protected final ResourceLocation liquidLocation; + protected final ResourceLocation coverLocation; + + protected final Fluid fluid; + protected final boolean flipGas; + + public ModelDynBucket() + { + this(null, null, null, FluidRegistry.WATER, false); + } + + public ModelDynBucket(ResourceLocation baseLocation, ResourceLocation liquidLocation, ResourceLocation coverLocation, Fluid fluid, boolean flipGas) + { + this.baseLocation = baseLocation; + this.liquidLocation = liquidLocation; + this.coverLocation = coverLocation; + this.fluid = fluid; + this.flipGas = flipGas; + } + + @Override + public Collection getDependencies() + { + return ImmutableList.of(); + } + + @Override + public Collection getTextures() + { + ImmutableSet.Builder builder = ImmutableSet.builder(); + if (baseLocation != null) + builder.add(baseLocation); + if (liquidLocation != null) + builder.add(liquidLocation); + if (coverLocation != null) + builder.add(coverLocation); + + return builder.build(); + } + + @Override + public IFlexibleBakedModel bake(IModelState state, VertexFormat format, + Function bakedTextureGetter) + { + + ImmutableMap transformMap = IPerspectiveAwareModel.MapWrapper.getTransforms(state); + + // if the fluid is a gas wi manipulate the initial state to be rotated 180° to turn it upside down + if (flipGas && fluid.isGaseous()) + { + state = new ModelStateComposition(state, TRSRTransformation.blockCenterToCorner(new TRSRTransformation(null, new Quat4f(0, 0, 1, 0), null, null))); + } + + TRSRTransformation transform = state.apply(Optional.absent()).or(TRSRTransformation.identity()); + TextureAtlasSprite fluidSprite = bakedTextureGetter.apply(fluid.getStill()); + ImmutableList.Builder builder = ImmutableList.builder(); + + if (baseLocation != null) + { + // build base (insidest) + IFlexibleBakedModel model = (new ItemLayerModel(ImmutableList.of(baseLocation))).bake(state, format, bakedTextureGetter); + builder.addAll(model.getGeneralQuads()); + } + if (liquidLocation != null) + { + TextureAtlasSprite liquid = bakedTextureGetter.apply(liquidLocation); + // build liquid layer (inside) + builder.addAll(ItemTextureQuadConverter.convertTexture(format, transform, liquid, fluidSprite, NORTH_Z_FLUID, EnumFacing.NORTH, fluid.getColor())); + builder.addAll(ItemTextureQuadConverter.convertTexture(format, transform, liquid, fluidSprite, SOUTH_Z_FLUID, EnumFacing.SOUTH, fluid.getColor())); + } + if (coverLocation != null) + { + // cover (the actual item around the other two) + TextureAtlasSprite base = bakedTextureGetter.apply(coverLocation); + builder.add(ItemTextureQuadConverter.genQuad(format, transform, 0, 0, 16, 16, NORTH_Z_BASE, base, EnumFacing.NORTH, 0xffffffff)); + builder.add(ItemTextureQuadConverter.genQuad(format, transform, 0, 0, 16, 16, SOUTH_Z_BASE, base, EnumFacing.SOUTH, 0xffffffff)); + } + + + return new BakedDynBucket(this, builder.build(), fluidSprite, format, Maps.immutableEnumMap(transformMap), Maps.newHashMap()); + } + + @Override + public IModelState getDefaultState() + { + return TRSRTransformation.identity(); + } + + /** + * Sets the liquid in the model. + * fluid - Name of the fluid in the FluidRegistry + * flipGas - If "true" the model will be flipped upside down if the liquid is a gas. If "false" it wont + *

+ * If the fluid can't be found, water is used + */ + @Override + public IModel process(ImmutableMap customData) + { + String fluidName = customData.get("fluid"); + Fluid fluid = FluidRegistry.getFluid(fluidName); + + if (fluid == null) fluid = this.fluid; + + boolean flip = flipGas; + if (customData.containsKey("flipGas")) + { + String flipStr = customData.get("flipGas"); + if (flipStr.equals("true")) flip = true; + else if (flipStr.equals("false")) flip = false; + else + throw new IllegalArgumentException(String.format("DynBucket custom data \"flipGas\" must have value \'true\' or \'false\' (was \'%s\')", flipStr)); + } + + // create new model with correct liquid + return new ModelDynBucket(baseLocation, liquidLocation, coverLocation, fluid, flip); + } + + /** + * Allows to use different textures for the model. + * There are 3 layers: + * base - The empty bucket/container + * fluid - A texture representing the liquid portion. Non-transparent = liquid + * cover - An overlay that's put over the liquid (optional) + *

+ * If no liquid is given a hardcoded variant for the bucket is used. + */ + @Override + public IModel retexture(ImmutableMap textures) + { + + ResourceLocation base = baseLocation; + ResourceLocation liquid = liquidLocation; + ResourceLocation cover = coverLocation; + + if (textures.containsKey("base")) + base = new ResourceLocation(textures.get("base")); + if (textures.containsKey("fluid")) + liquid = new ResourceLocation(textures.get("fluid")); + if (textures.containsKey("cover")) + cover = new ResourceLocation(textures.get("cover")); + + return new ModelDynBucket(base, liquid, cover, fluid, flipGas); + } + + public enum LoaderDynBucket implements ICustomModelLoader + { + instance; + + @Override + public boolean accepts(ResourceLocation modelLocation) + { + return modelLocation.getResourceDomain().equals("forge") && modelLocation.getResourcePath().contains("forgebucket"); + } + + @Override + public IModel loadModel(ResourceLocation modelLocation) throws IOException + { + return MODEL; + } + + @Override + public void onResourceManagerReload(IResourceManager resourceManager) + { + // no need to clear cache since we create a new model instance + } + } + + // the dynamic bucket is based on the empty bucket + protected static class BakedDynBucket extends ItemLayerModel.BakedModel implements ISmartItemModel, IPerspectiveAwareModel + { + + private final ModelDynBucket parent; + private final Map cache; // contains all the baked models since they'll never change + private final ImmutableMap transforms; + + public BakedDynBucket(ModelDynBucket parent, + ImmutableList quads, TextureAtlasSprite particle, VertexFormat format, ImmutableMap transforms, + Map cache) + { + super(quads, particle, format); + this.parent = parent; + this.transforms = transforms; + this.cache = cache; + } + + @Override + public IBakedModel handleItemState(ItemStack stack) + { + FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(stack); + if (fluidStack == null) + { + if (stack.getItem() instanceof IFluidContainerItem) + { + fluidStack = ((IFluidContainerItem) stack.getItem()).getFluid(stack); + } + } + + // not a fluid item apparently + if (fluidStack == null) + return this; + + + Fluid fluid = fluidStack.getFluid(); + String name = fluid.getName(); + + if (!cache.containsKey(name)) + { + IModel model = parent.process(ImmutableMap.of("fluid", name)); + Function textureGetter; + textureGetter = new Function() + { + public TextureAtlasSprite apply(ResourceLocation location) + { + return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString()); + } + }; + + IFlexibleBakedModel bakedModel = model.bake(new SimpleModelState(transforms), this.getFormat(), textureGetter); + cache.put(name, bakedModel); + return bakedModel; + } + + return cache.get(name); + } + + @Override + public Pair handlePerspective(TransformType cameraTransformType) + { + return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, cameraTransformType); + } + } +} diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index f0b4850b9..050bbbf3e 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -45,10 +45,17 @@ import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.client.resources.model.ModelRotation; import net.minecraft.client.resources.model.SimpleBakedModel; import net.minecraft.client.resources.model.WeightedBakedModel; +import net.minecraft.init.Items; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.IRegistry; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.ForgeModContainer; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.registry.GameData; import net.minecraftforge.fml.common.registry.RegistryDelegate; @@ -177,6 +184,7 @@ public class ModelLoader extends ModelBakery registerVariantNames(); for(Item item : GameData.getItemRegistry().typeSafeIterable()) { + // default loading for(String s : (List)getVariantNames(item)) { ResourceLocation file = getItemLocation(s); @@ -201,6 +209,68 @@ public class ModelLoader extends ModelBakery } } } + + // replace vanilla bucket models if desired. done afterwards for performance reasons + if(ForgeModContainer.replaceVanillaBucketModel) + { + // empty bucket + for(String s : getVariantNames(Items.bucket)) + { + ModelResourceLocation memory = new ModelResourceLocation(s, "inventory"); + try + { + IModel model = getModel(new ResourceLocation("forge", "item/bucket")); + // only on successful load, otherwise continue using the old model + stateModels.put(memory, model); + } + catch(IOException e) + { + // use the original vanilla model + } + } + + setBucketModel(Items.water_bucket); + setBucketModel(Items.lava_bucket); + // milk bucket only replaced if some mod adds milk + if(FluidRegistry.isFluidRegistered("milk")) + { + // can the milk be put into a bucket? + Fluid milk = FluidRegistry.getFluid("milk"); + FluidStack milkStack = new FluidStack(milk, FluidContainerRegistry.BUCKET_VOLUME); + if(FluidContainerRegistry.getContainerCapacity(milkStack, new ItemStack(Items.bucket)) == FluidContainerRegistry.BUCKET_VOLUME) + { + setBucketModel(Items.milk_bucket); + } + } + else + { + // milk bucket if no milk fluid is present + for(String s : getVariantNames(Items.milk_bucket)) + { + ModelResourceLocation memory = new ModelResourceLocation(s, "inventory"); + try + { + IModel model = getModel(new ResourceLocation("forge", "item/bucket_milk")); + // only on successful load, otherwise continue using the old model + stateModels.put(memory, model); + } + catch(IOException e) + { + // use the original vanilla model + } + } + } + } + } + + private void setBucketModel(Item item) + { + for(String s : getVariantNames(item)) + { + ModelResourceLocation memory = new ModelResourceLocation(s, "inventory"); + IModel model = stateModels.get(ModelDynBucket.LOCATION); + stateModels.put(memory, model); + } } public IModel getModel(ResourceLocation location) throws IOException diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java index ed36a77b4..c50082751 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java @@ -34,6 +34,7 @@ public class ModelLoaderRegistry registerLoader(ModelFluid.FluidLoader.instance); registerLoader(ItemLayerModel.Loader.instance); registerLoader(MultiLayerModel.Loader.instance); + registerLoader(ModelDynBucket.LoaderDynBucket.instance); } /* diff --git a/src/main/java/net/minecraftforge/common/ForgeModContainer.java b/src/main/java/net/minecraftforge/common/ForgeModContainer.java index 48d4ab36b..f5ab3bfaa 100644 --- a/src/main/java/net/minecraftforge/common/ForgeModContainer.java +++ b/src/main/java/net/minecraftforge/common/ForgeModContainer.java @@ -5,6 +5,7 @@ package net.minecraftforge.common; +import static net.minecraftforge.common.config.Configuration.CATEGORY_CLIENT; import static net.minecraftforge.common.config.Configuration.CATEGORY_GENERAL; import java.io.File; @@ -68,6 +69,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC public static int defaultSpawnFuzz = 20; public static boolean defaultHasSpawnFuzz = true; public static boolean forgeLightPipelineEnabled = true; + public static boolean replaceVanillaBucketModel = true; private static Configuration config; private static ForgeModContainer INSTANCE; @@ -244,6 +246,16 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC config.setCategoryPropertyOrder(VERSION_CHECK_CAT, propOrder); + // Client-Side only properties + propOrder = new ArrayList(); + prop = config.get(Configuration.CATEGORY_CLIENT, "replaceVanillaBucketModel", Boolean.FALSE, + "Replace the vanilla bucket models with Forges own dynamic bucket model. Unifies bucket visuals if a mod uses the Forge bucket model."); + prop.setLanguageKey("forge.configgui.replaceBuckets").setRequiresMcRestart(true); + replaceVanillaBucketModel = prop.getBoolean(Boolean.FALSE); + propOrder.add(prop.getName()); + + config.setCategoryPropertyOrder(CATEGORY_CLIENT, propOrder); + if (config.hasChanged()) { config.save(); diff --git a/src/main/java/net/minecraftforge/common/config/Configuration.java b/src/main/java/net/minecraftforge/common/config/Configuration.java index 09733b49b..16aac45b5 100644 --- a/src/main/java/net/minecraftforge/common/config/Configuration.java +++ b/src/main/java/net/minecraftforge/common/config/Configuration.java @@ -48,6 +48,7 @@ import net.minecraftforge.fml.relauncher.FMLInjectionData; public class Configuration { public static final String CATEGORY_GENERAL = "general"; + public static final String CATEGORY_CLIENT = "client"; public static final String ALLOWED_CHARS = "._-"; public static final String DEFAULT_ENCODING = "UTF-8"; public static final String CATEGORY_SPLITTER = "."; diff --git a/src/main/resources/assets/forge/blockstates/dynbucket.json b/src/main/resources/assets/forge/blockstates/dynbucket.json new file mode 100644 index 000000000..9f240d8e9 --- /dev/null +++ b/src/main/resources/assets/forge/blockstates/dynbucket.json @@ -0,0 +1,18 @@ +{ + "forge_marker": 1, + "variants": { + "inventory": { + "model": "forge:forgebucket", + "textures": { + "base": "forge:items/bucket_base", + "fluid": "forge:items/bucket_fluid", + "cover": "forge:items/bucket_cover" + }, + "transform": "forge:default-item", + "custom": { + "fluid": "water", + "flipGas": true + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/forge/lang/en_US.lang b/src/main/resources/assets/forge/lang/en_US.lang index 055f15463..fed5d696b 100644 --- a/src/main/resources/assets/forge/lang/en_US.lang +++ b/src/main/resources/assets/forge/lang/en_US.lang @@ -12,6 +12,8 @@ forge.update.beta.2=Major issues may arise, verify before reporting. forge.configgui.forgeConfigTitle=Minecraft Forge Configuration forge.configgui.ctgy.forgeGeneralConfig.tooltip=This is where you can edit the settings contained in forge.cfg. forge.configgui.ctgy.forgeGeneralConfig=General Settings +forge.configgui.ctgy.forgeClientConfig.tooltip=Settings in the forge.cfg that only concern the local client. Usually graphical settings. +forge.configgui.ctgy.forgeClientConfig=Client Settings forge.configgui.ctgy.forgeChunkLoadingConfig.tooltip=This is where you can edit the settings contained in forgeChunkLoading.cfg. forge.configgui.ctgy.forgeChunkLoadingConfig=Forge Chunk Loader Default Settings forge.configgui.ctgy.forgeChunkLoadingModConfig.tooltip=This is where you can define mod-specific override settings that will be used instead of the defaults. @@ -43,6 +45,7 @@ forge.configgui.zombieBaseSummonChance.tooltip=Base zombie summoning spawn chanc forge.configgui.zombieBaseSummonChance=Zombie Summon Chance forge.configgui.stencilbits=Enable GL Stencil Bits forge.configgui.spawnfuzz=Respawn Fuzz Diameter +forge.configgui.replaceBuckets=Use Forges' bucket model forge.configgui.modID.tooltip=The mod ID that you want to define override settings for. forge.configgui.modID=Mod ID diff --git a/src/main/resources/assets/forge/models/item/bucket.json b/src/main/resources/assets/forge/models/item/bucket.json new file mode 100644 index 000000000..7a32f750a --- /dev/null +++ b/src/main/resources/assets/forge/models/item/bucket.json @@ -0,0 +1,18 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "forge:items/bucket_base" + }, + "display": { + "thirdperson": { + "rotation": [ -90, 0, 0 ], + "translation": [ 0, 1, -3 ], + "scale": [ 0.55, 0.55, 0.55 ] + }, + "firstperson": { + "rotation": [ 0, -135, 25 ], + "translation": [ 0, 4, 2 ], + "scale": [ 1.7, 1.7, 1.7 ] + } + } +} diff --git a/src/main/resources/assets/forge/models/item/bucket_milk.json b/src/main/resources/assets/forge/models/item/bucket_milk.json new file mode 100644 index 000000000..2d1fe26eb --- /dev/null +++ b/src/main/resources/assets/forge/models/item/bucket_milk.json @@ -0,0 +1,20 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "forge:items/bucket_base", + "layer1": "forge:items/bucket_fluid", # doubles as milk + "layer2": "forge:items/bucket_cover" + }, + "display": { + "thirdperson": { + "rotation": [ -90, 0, 0 ], + "translation": [ 0, 1, -3 ], + "scale": [ 0.55, 0.55, 0.55 ] + }, + "firstperson": { + "rotation": [ 0, -135, 25 ], + "translation": [ 0, 4, 2 ], + "scale": [ 1.7, 1.7, 1.7 ] + } + } +} diff --git a/src/main/resources/assets/forge/textures/items/bucket_base.png b/src/main/resources/assets/forge/textures/items/bucket_base.png new file mode 100644 index 0000000000000000000000000000000000000000..04faf510288e9496b6b121f5c6b85255baefc203 GIT binary patch literal 597 zcmV-b0;>IqP)VGd000McNliru-wY2FHX`+WA}{~|0pdwS zK~y-)rIWEsBS93#e{XiOnZ!NpgtQ@z#VPh82o|SZiu^U_zhkaTW#QR*3X)ie*NLEA z3}PS&tGn*(&RpT$szl+yDIYVx_r33Z1D`zNz5f(IzgOJY*eI#axw2jqg`A$Aeym`9 zecb~rFE3+^VIhhTpc00JVaU&e0|1VXk7W+9xw+|=mXA#dyn^?Z`<44 z4u^Q}KUR=s8I4ARuPZBT@9Z!hj~Nb!WKU1rjz(y$vDQ+pR!e|-wIZ&suZg0FX0u5g z#{@wDK%VDlttpBE=Nzv$S1Rz{Ga8Kuf`El6!WhGJI(@$M_p#QRhldBOwJ!=p1QDUv z>&gE9K53d#6a`t9p|z$`sgw->uCA^)KR*`$5qXPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E;VI^GGzb&0n|xEK~y+TrINdD8bK6>{RsO8`vlzY0<;tq zT!gq6fCPv;#bU*xqd=mdii^02p^3XJu*5MEu@oy-+{L2B4Nt)%{FyV+uDpvIE5#?x zoSFYWmzgsF|HYfZ_wZ&g91cSx7!2x|?-7QLcG2haIUNp%)8p|tTdkJV@Asunrz3?z zArP-M`XUmEz-qN}p{lB)qA22WxfH9_s?caOgi56%wA*cottDp6BqoD&It@BlEEb{` zGsCJ8yk0L@61M#p(+{)RERM$`;_>({kx1;cxJELW-1+@}l*?tfTrL(e8RYYM91aHr z0s)~`tI2M+8G7wZg~COH3vce7Lv(n*r+eI-ixM(+y|_^Z6Xx z?H0eEp77)To>xEyRKei<9KBu-rBVrYyZzLFNTpI(uh;nX_=xX!cUY+^K3!dL18RW` zXdbUM1_OG^*=)vzUv6&j`TCldKO7Eu3+zuA`X>wqL?)BLcs#~vG~&pz4EBN0U@u_K xP8c>Cg+c+bSPao$)RUX toangD5F_ subItems) + { + for (int i = 0; i < 4; i++) + { + ItemStack bucket = new ItemStack(this, 1, i); + if (FluidContainerRegistry.isFilledContainer(bucket)) + subItems.add(bucket); + } + } + } + + public static class DynBottle extends Item + { + public DynBottle() + { + setUnlocalizedName("dynbottle"); + setMaxStackSize(1); + setHasSubtypes(true); + setCreativeTab(CreativeTabs.tabMisc); + } + + @Override + public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) + { + for (int i = 0; i < 4; i++) + { + ItemStack bucket = new ItemStack(this, 1, i); + if (FluidContainerRegistry.isFilledContainer(bucket)) + subItems.add(bucket); + } + } + } +} diff --git a/src/test/java/net/minecraftforge/debug/ModelFluidDebug.java b/src/test/java/net/minecraftforge/debug/ModelFluidDebug.java index 537eb3817..808da524d 100644 --- a/src/test/java/net/minecraftforge/debug/ModelFluidDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelFluidDebug.java @@ -29,6 +29,8 @@ public class ModelFluidDebug @SidedProxy(serverSide = "net.minecraftforge.debug.ModelFluidDebug$CommonProxy", clientSide = "net.minecraftforge.debug.ModelFluidDebug$ClientProxy") public static CommonProxy proxy; + public static final Fluid milkFluid = new Fluid("milk", new ResourceLocation("forge", "blocks/milk_still"), new ResourceLocation("forge", "blocks/milk_flow")); + @EventHandler public void preInit(FMLPreInitializationEvent event) { proxy.preInit(event); } @@ -38,8 +40,10 @@ public class ModelFluidDebug { FluidRegistry.registerFluid(TestFluid.instance); FluidRegistry.registerFluid(TestGas.instance); + FluidRegistry.registerFluid(milkFluid); GameRegistry.registerBlock(TestFluidBlock.instance, TestFluidBlock.name); GameRegistry.registerBlock(TestGasBlock.instance, TestGasBlock.name); + GameRegistry.registerBlock(MilkFluidBlock.instance, MilkFluidBlock.name); } } @@ -47,6 +51,7 @@ public class ModelFluidDebug { private static ModelResourceLocation fluidLocation = new ModelResourceLocation(MODID.toLowerCase() + ":" + TestFluidBlock.name, "fluid"); private static ModelResourceLocation gasLocation = new ModelResourceLocation(MODID.toLowerCase() + ":" + TestFluidBlock.name, "gas"); + private static ModelResourceLocation milkLocation = new ModelResourceLocation(MODID.toLowerCase() + ":" + TestFluidBlock.name, "milk"); @Override public void preInit(FMLPreInitializationEvent event) @@ -54,8 +59,10 @@ public class ModelFluidDebug super.preInit(event); Item fluid = Item.getItemFromBlock(TestFluidBlock.instance); Item gas = Item.getItemFromBlock(TestGasBlock.instance); + Item milk = Item.getItemFromBlock(MilkFluidBlock.instance); ModelBakery.addVariantName(fluid); ModelBakery.addVariantName(gas); + ModelBakery.addVariantName(milk); ModelLoader.setCustomMeshDefinition(fluid, new ItemMeshDefinition() { public ModelResourceLocation getModelLocation(ItemStack stack) @@ -70,6 +77,13 @@ public class ModelFluidDebug return gasLocation; } }); + ModelLoader.setCustomMeshDefinition(milk, new ItemMeshDefinition() + { + public ModelResourceLocation getModelLocation(ItemStack stack) + { + return milkLocation; + } + }); ModelLoader.setCustomStateMapper(TestFluidBlock.instance, new StateMapperBase() { protected ModelResourceLocation getModelResourceLocation(IBlockState state) @@ -84,6 +98,13 @@ public class ModelFluidDebug return gasLocation; } }); + ModelLoader.setCustomStateMapper(MilkFluidBlock.instance, new StateMapperBase() + { + protected ModelResourceLocation getModelResourceLocation(IBlockState state) + { + return milkLocation; + } + }); } } @@ -136,6 +157,19 @@ public class ModelFluidDebug } } + public static final class MilkFluidBlock extends BlockFluidClassic + { + public static final MilkFluidBlock instance = new MilkFluidBlock(); + public static final String name = "MilkFluidBlock"; + + private MilkFluidBlock() + { + super(milkFluid, Material.water); + setCreativeTab(CreativeTabs.tabBlock); + setUnlocalizedName(MODID + ":" + name); + } + } + public static final class TestGasBlock extends BlockFluidClassic { public static final TestGasBlock instance = new TestGasBlock(); diff --git a/src/test/resources/assets/forge/blockstates/dynbottle.json b/src/test/resources/assets/forge/blockstates/dynbottle.json new file mode 100644 index 000000000..98fa082fe --- /dev/null +++ b/src/test/resources/assets/forge/blockstates/dynbottle.json @@ -0,0 +1,18 @@ +{ + "forge_marker": 1, + "variants": { + "inventory": { + "model": "forge:forgebucket", + "textures": { + "base": "minecraft:items/potion_bottle_empty", + "fluid": "minecraft:items/potion_overlay", + "cover": "minecraft:items/potion_bottle_empty" + }, + "transform": "forge:default-item", + "custom": { + "fluid": "water", + "flipGas": false + } + } + } +} \ No newline at end of file diff --git a/src/test/resources/assets/forge/textures/blocks/milk_flow.png b/src/test/resources/assets/forge/textures/blocks/milk_flow.png new file mode 100644 index 0000000000000000000000000000000000000000..e28842b6bd8c45719a2e6630229a8ffd5cacdd58 GIT binary patch literal 5163 zcmYjV2|UyP|EHxnk{pp7Blo^ixn;Jssa7?8mvn+05Z5l2-YSA$rV<9?YNO+-5xd#s$oS#@`0;n_KkD05))u6<>$R=K?{-xy*%<$6Y02kIAqYWgCGpbz2t-^Q zY@g&t;msc&V~m95(s+KL#mTHdj%EM&7$04;Setho@#jy|=2J#HZ6ETJwY2 z$CJ_2QHTe+J!anKpC6|@D7Q@;gNfG#_phfF#$ERKfdyS$D&liXkg`7ya=IaxU$mT? z5~)+WJDFC2lZ#a!8!?+XZt=yCem4Cj#_ugpLCJ@Ja4I+2ODnvIE)Z<;#Dy+QYk7m$ z;CbSwh}6_+ISb{3oziW)7RWcJ0wO{~PCovpwhQ7`ZgOv06El9*9v06Z7%{u%WEna$ z+8jL~MG>NzoS?^Kku`UU_SVFG^?)xXYR>SU;~HbK((nnE7W2~ZLtW3oakh|Yul0^? zkkuhL64=a<7ZR;c(DSROu4MngagallrMsxec*Y_yolgdZ&z~U=pRuw&xV0A4l&al9HB|PHx*&)r;Q3V}$xJDFC$GA%`YP`f%Q~qH zeDHx6E=rT2X%}==^p&c*1`)BN#H87zR3y~S#tvpqMTwnvy9?2vVsfW?xWp9h3$OWR z^CRW!1JSx3#9JcAC}y)krnzBG9No2U=@i*lVQsw+U#{uidtz=~LBr++8ll=SpA>6+ zs#{x6-l`s+S=#VqTQ{=ubNe5;w0hw@ulLN>UoIGQG@LV}Xym+UCdMq9(ZUa%tc$+S zF7@D5OFV)iWf!#->1;q>Z>%a?ct4PX6Fgh+t!tXm)RP`t_ zaSI;Qw%_}0qW{A4IcG8P{0p!tcBLlTO)R#}zg&K5Lx%`{{VqQUWih+q%3c-~y&&|r z;@nBSCg}Vv!4qn2H8AAW=Y|wnQU29cF^8XvwE=9qL%lSggFU+zq;eeIvePBZCP zNX$40i$3qȲAMKpnfJkO4w<7Bo(RM?BE23|0o1kRajr1+)h$%3NOFNFxkK6n?=u#X!<;L#n73nD3j_`M8=0C zraN%dP|uF5itx_uZ`R`SiAfTJFmpAA*xqJt*C2ipl;Ps7Fjg?h(AM>dhQ`mM+14c= z9sT_O{yukz-no518=ZL}Yitm&t{xp*e7@Z`3-O|Z1?%}HoJ@47z(uJ)pE=iN{K3}% zn-WNB&8(a{kS<=m2xtH~0dnm?f&fhg!XKC~Q^ePhz1HwI*G0-CRy%eBTv{oS_!Nj& z5!y zt4DYCC+ugJY7~yR7;nU8wDlUqG7%N>q_oH+a$37CNAcAlEq7&kexwE;g($@cCoA3o z=1bIg&yI8x10stqEF_fUKge&8x*{_3wB5B4{!D7~$Q|INOh4nv$Ubmh%GC^vu)G2tRY3O{GV=F>7FM zt$}xR)lEpj_P`hV$ER1`LnR=qY<#g-?B@szFaC+;#KC1n_<}`jvHY^1bDcYzeaR}{ z;G9qLi(YUA)-3gaZ8+}zRgJi%K4GTv?KXgmVGj42i7Q8cv2Pl*%y(s*eHl%W*vWBj zi2Lj-)^p`?dW3L~vyzK@a+%^UL^l=tYpDI2?^}B+Tae0_bCGje=`!HWa zhF(Sa%TJnVXZ26+>2CXquHkD!v&qN?dDK1jl{~~yV!+8gO6LiIMyAmNr0mQbtS9N8 zxbFPi_Xp-lP&!M==L;i5_~zHE)r$&@zIj{6Ll^ev4Du_}b!VndDFV*;t@o|sNRu9n z9d+71E6^w}l%@17pgucW17Ejz!e%M0{E2R(0bk?O<94leh2W9$%y*XfCF$Te~k$q zYn=k6=3Q(ZXUazTt*E{ z%W);la@@Q9U3Dv3q@fZsNZx+rE5;}n7<)R85q-;^}&PUBwX)P|qmi+KKpEq%MQlcAA@}bhBa(HWVVY>!NjcmRkG>O;mE7%M73&M+4-Wj#buAz^dqy71)BDV&Xn!4RyyOr0bASdqzOYQ91QRYQe z9%x9F)8XWYz?FB4&c4l`G)XZrYD_9gy^shD(WEl7gN-{yZC{4kS|FH@+4y-|m_b(> z05Cn$BHn$=GdHc_rJDb8;`Nm`&VH;&%jehcj+UJC&!ZdDn)KV9iYV5HXb9?>VCajG zqdUr4&g5AGmcb*U8sAJwP~$7pmsFU^ztq1e`Ymu-JiPzYO&>0nSgMIl7y}7wM5g?J*zB%oMc?!JB*y%p28azIkBoR{6>GUYE7~ky15HtzuJJXs3UJCuKKv z^ym@V!!tEZrMQ23*xz!9yr2m8$1hPT`H;OiIfreg^oj_rIPMK1|1iGJNVt;caF zl2foEz2&U#N7r_RyRchr&+pmzP{Tib)?`Xfjx$elZIr4fgWul1QT{1f(w9Kb=C++^ zMdek)YG#`-JM~8Jirf21IM1k->Tt5W#*&BO7!XsEEr0TA)1TnK69`66z29BRn<^&u zJ>{R_!?=m6aTDewM{#8z`n*S67dSdBpsx4%7L^6?NV>y?utKdgJGc*lg5OAZ2fL$~ zESvc|w*kQf2UY#zCDwCoYeN1GZ-Ug&FQ9y=>=jA^m~nON%s73Jf7mE$-|3{KiXU}d z4`-fJ<#m}nze!w}=;QX{2fG~LItZvbvHua2ZdyBtq=pPJrgQ63S`EWjXWzNyl6Rff`;!DzYLmn)^U zu2*##Fiul%&qrIRs*`xn!5>yNLPwsmL4&PB0}!nH>hz3h3+vSFvxZ&Pa22qJ zm>wJmnaiJ=`9r0QJTWJ3!CNkvVPd7YoOtKo(U3@5NVJEPq6R4B^Z>zQ)=19qb{P`r zMyQfY!LGfVj-#T!TWY(^Zz2l*a<%qkiF7w;oonk}M?aPi&B5^$>e6ff%>1!C*i%k* zgmWH0@3$0pg)Y6%gw4jO4OJ~;WD0}P-=5uDkFd9^)zt%V4;oTOHyF1(Arv`sVYv~H ziiPZ83fH?++_ZD&?D&%fsD8(Ws3{Q=)^j0$5PDHK8U9fRotAh>B_Ol(hkX`8P2H3G z9ZElX(^S7P2TBKi%DgW<@-*b(a1kp|g9wUQuFh|_MH2#_ds`>5sAe=PUVT!4#Ixg1 z>k9(m27JU#wQ-LvT;mC>JiCwJBuQxyU8OVO)))3QA*8&1^AtKuP zYEX_MzvOCc5wAmMEBo=A;0vhh`2le&-5#g`74P6x|5{H&n9<9Gc%!PH2Nyi{_B(sVjQ$y3^=a`rl=08jH=e+@I0=$33a~7XL`-r^%fik9%i_Q`*Fp6Jh0ce8B@w0`IO}v3r(M z!K?gPvL~~-*O9xBSQG0H6sRM3|MkkLk*cYoE1&XB8^N*d(R&J`Z7H_&L%Lo?FvU}Nd`GL&Q^{?y^E&Xtfu&g@Yij2V!kgSfm9heO?BZSK5t&d~ac z80lV5wprChnrrQ;$Wgp+R>A+rdYPlHs4^D=pQDpO$NlaT)0gG>^iY%$?;B>QLA>?RiC~F6 zk4t%PH8CP}R>8p=n4L1>&WAi3=YzxZ5U;Nt&+^ucCqf22l4xC701`#v7=zX-_5vbgr@OakjCHR$k~lkw<2#S#6^KEW1mxc{ZF z2J`C|i$0$h=S6^oW)+(*-&9|3>`MDu+>m-!ns&_%|0vukqExZ|sWaDsb3)OqC6ZKm zXLVXn0T$Nf&Q7~JS$Mf6$m&aceTbq1w^4*$CgbQbw8LZ&rm*K#$Ps5KFwjA685i2 z9doW=1;<(19EoL4Gztk)b%@s!&%O)ygogn#`hAUq-3NJM-Z@ac!`;gnn7|jzy=sUi zrOjVLy&X9Wuq@hQ^m^BXOgwKbajwk8#nmRr(x&|?vj4Xu{swHbk8OdrErlei{X;C> Y>0Y`}VA*cqT2H|CxRd35l>fE=12(~?d;kCd literal 0 HcmV?d00001 diff --git a/src/test/resources/assets/forge/textures/blocks/milk_flow.png.mcmeta b/src/test/resources/assets/forge/textures/blocks/milk_flow.png.mcmeta new file mode 100644 index 000000000..4f0718ac9 --- /dev/null +++ b/src/test/resources/assets/forge/textures/blocks/milk_flow.png.mcmeta @@ -0,0 +1,3 @@ +{ + "animation": {} +} \ No newline at end of file diff --git a/src/test/resources/assets/forge/textures/blocks/milk_still.png b/src/test/resources/assets/forge/textures/blocks/milk_still.png new file mode 100644 index 0000000000000000000000000000000000000000..d83dba2a83d37348c5a29c36c0c29c0589b4ba9a GIT binary patch literal 6438 zcmV+>8QJEEP)nWzX&3R`K)|7hJdhFWbdw`&-&xxA>i^G~K`W*ji(_!4oaW+xO>+ zCwoiUcEJ@b@CQuj=+(^DYG!ZvAmPbRG~2d|S2O#HRz3WEuUoUnt*31prWrT%j{V$j zJeXOk!8pHfpV2lFMx$Uzuc@{6cd>)$Cre-LuUherSuC*OZ~jUduUO4&soNJbW))v*@}(l3IBee?@xWGt&eP_X?c(?CZ(q#p$JQ5%4t>ZL`K54-}D>?MB3a1)j-4HnHj2 z+Hc#99S@#{j;Vq?J{Rs7$~z3qr}W}@FwtFM$P!+0#mpQwL#p%(hI!!Q-8!hek6MHW zic0>}D_Zd+phS2u1PHVSwsD%WCexNTe= zU^~OBFW8Ar^+gbTCO;^_6ZP{fBegm|pdVb}`;{MDo!S8p4wlHLG~q&SFKOcmpKh%c zZpxc_#ay^!h{yjA9kK>^|7u+I3dW8zo?IQMtH1kQEF)E*TNw6mUq2Q%!z1G8J&!am0XZ)VwsX$;t! z0S|Ui9l<)j;xk%i#&?{ET&kIU|3$ozLG65U`Dn~NkDLQ z?zSdjW*Il*Xnc6Up?Fa7YU(#v<&af8vw_Mr@kkfof!};37vN0H0MR7qO!zzS;v#y0<0b2U$p$$%O~nS0&VM0aLMnGaC89 z&@mh(pMz*>#Sv+eCa-8NJ(J_$e*+KJDgc@=R0iJY!~MBoLM0x&3l2O*xp5PoL@xZ| zc<={Ycfu@G!o5aZvclV##7f%pZ|H|7@t^?Cn!tR9G0hT$uXNc7omha8S*APj;9_Ra z8bqu9r7se_(=Hwid58xEPa1>pXLWYA{eD*P!V#?~PGJb3h!>n_q>8aGP&5)E76xJ$ zXs(mv!6>-@?_lB-F*fJdYYoOb(iNMK&RJF6U;RWf!AwiEj&78t1xi4Y&#FlS30UJw zR)(qG4Cvd$ajxJ81&~%YJh+e_WFg)IhEJt{yBOHwetyPqP8fj!lWmbs{YpJCivyun zvc8HbtBm~uxliK-$Ab%vuL@!CrZ3VegSkJL1&HE>9OPP>WB}Yxjx{jZ6-}P-G}7LO zV?q@&$!KLlr!oUXe(+f_g(rY!7S6!QbOT--q7lV|hq$&1Jh=O4RT*ys8(n3HN5I`q z#E1ux$e;n|0>a(JgI{S0Cw@?cg&4eXga-$ifOxP7;WUXG1{l);5AH$eyGj6(g&zzW zFKA$;U|Im@Bfht$*4nr26`ny~Tt)4k@j71|5B?AZ;}Rt7x}#HxZ`)IzGI0{5@&~G2ssx&*}X-S;R9m4!zW|QMVWH1R? zjRr&W*ZJzg^xp#o!-?klJN#h47iLUbDGbUMamKLcOxuYM3av)K+h(qb|gS{11U6lfcF!&}C zLGr?!`9<8sVXkKOU%<{?7G`dpcu;@`K78NlOCo+iBzl)hm|671Q@r5XX_j$U)%Tz$ zUNH94Hf>7)^Y4hAZ$5)5g(;!T^7K1oL1QOAMMG^toS<6M;O0z3)-tL=;)N#hLRMkA z1bCqFLWl=cD;NB+GP8*mxCj66*_Z@i2e7pn@80DHO@gc+fs4CHb%f(ct)kYFbVL%+ zDv|wN0p)l2L1rgc*!vVP^!z*gAOrh}he25{m#vk;0A) z*t>0bu`J(3BCj5_mr{NM^xexg)H^`#Hsfu~YSYOVcK)GX@| zE>(H=cwr3KSe7Yn(%Js1Cp^fo^#RHIRlN5YZv2Z97f?Cj^epFmJ+CZ?}7)5S3vwJYDEtVB0Q*3ZE|^WF*BoA7P9Ej4H7S` zK}2&XD_d~k6PTcwu}b~HT`A23YER-tfVpuPYru~y)LnMwAQW)VwKa){r@%9-Q0uRB zt$|;RX#I*w$HeaU`kS>#j2{ovyCOcG0Nu>)EH7ZLRQUTAl$TM-YvMa*j~5;iy+(3a z1`+=obC5keC_z0!+HBy)2PqyX3cZ8cEdUvp$_{vtaFOG|C`PtKp!yNuf!aes5yu5B zu3n4th^iZc|Esx|x}i%8VuBO?kL8jAKfi#P#7(_4Xut}?hBj(N;y;)MLml{Yw`m=Q0esVmR?7Xlc z(i3L%!;?|l7r{A(eg>S#LI=$asmGC2uwJA}U?JaGJNzI8S@HL6zBJbp8S)k(6a{45 zeZrmUCi9IG6fNq8qr^_$s;_>7PkiV%^fA9l!h$^N=7{tc)T@WYh#dbf+h$g?aJ1jxTz=I_aCzT&0*V1Mw;7F1#nFaEh zZ_LU*iWKfN5w5F9g^7P8?#&&hMgyB159VM9^NZq+42%6y1GOr5;>8Rs2;+q@;0G*R zNz#&CPh7;tS6rxzfjGSnk!ud(WnEFkg!YX^T@@Ep2(k_MUm#Z8nL=^4zQ6)0HVshs zxLDBDJ>z7`2x;8>ej)%f`4P`imnXJgDM>5BQX6G7B7CSD2NH-u>QGTE)M3Zuw zBJsn)L>KVGwZjh{y-!Zg5 z0{!4L3SaE!TBXN!!zGC5KkVm98_$U3)LQ$5pfCp+PWp%e*4TU)|7~#{>IH_A8Ds$R zryeUUq8~N1ZdOAoc3iH#2Hu%`PX_3HJV>dvc1L#e`6An8=+Mj-{25%p^tdihJS^9$oybJXNLnYgTy!muf=Cv!y`m!M zkZ00NR|-Ns$Absu!3yKi8MnMpwVbi;MO`eDARhEWVW)&seKCBI98}<)%x|!CgokJ$ zgr-gQh^)$c7x>JlowvH!Md~V&4~y7-yvTfq{2+I9lp#>N_W~E?2XA)XC+HpX;ATIU zr|juv@D;QOjcM{$ua9JBpyt?c!AkWT{Pe9xE~7Z6&vw@W#vg^uTjkSfrr#8 zv7vSFK&1e;k^Rd9-ka+fRZFE8zx#CV@q;zs2fAcsuAQbTPl%S|7-Oa^xp%L}WCmoA zRC=Pb&}elLG*;c$-USb4JFW-JjG3-* z7z^Ts`4!x|eo&!eM1>2(meE*5du)ye&JP|h_yKeBiK()GbnKn{K>5OKvdUC9mNFro zQBMAV2egGOg1!5N(T@9J?24x1foA;YAlI;$AX7ikbjd6dNRqJV>YizW0KIl9!=mW+ z!QlJRi4`IOc9@Z`);H=_XOU=WTuDRt+Sm5maU+Rm4-fR6=glu_T@p*w&CHt8*eqJ2 zK}XhVQX@YwIL=uVEf)RX@JjpIzKb1K+|!UgwhIQ~2aV$V2+`%RMrDf^7K^Kg5Bk9X zaGmU2Qg^lg)M_tK`9|BebQvM4JSC3QbiqY}^{jY64L!mGwsIc@RVlQ*HjCy?&`nh^ zzXm#bwexz%OgyM~;v{L&X2)$UnoRS`)aW20!y072ssQW(5AH8yfEBL1#RIK?@!tOyq{|c!R%UR9PH=G*VKOPC(Ju_bP$|kg zKRDsRAbp@0j{!f}C6Nk6;!Ws$-h}&Tx0*G|@~kjjRkkmJ2NUt&fx@oY&I`!3l%}YH z@lTOBsFf`eH$PQQuYo=it!LnLe$Y}i9Y(7xl7Di7@j-X5cre>>cb*xj-N4fKC0wj8 z;?v0wbfMHiTdar|9zhvF71Lf}xlcEw$BXoU#tj-TthG~vw*E%4qL5^%f^*p{bN~rW zL10>H2M3o<`n*a6(+FGFAnTnZ&%B5!o9@h0MZx4otV0klB(CXNgXX>=Vm)l_q&XIE z>LSkLnEDO(&mg>O7Vn8O+i|tkv$r%i z+9pD?YL{3X3k=4L^1pW8t_d;Gxcyj}Pl@Pnl5oyph+JC;*E zfd~7xc&WAazj(qLIM$vlUWiCqyrY2ylbDBBV~0$?i3gn02Y!%$p&vxmKy!X^A@zf~ z(_f3*BMbN78ovwilnxQK!Qclq{a-HqG+cWjVihSel zA5&}XA9mczLUTz=Cw0E#!HA}+PVn8%TZEqC1>J>7xBm1|`3iyJK|J_wKkJoei}&HD z8M6~}-C)Z^rHM*y7dvm6`czf7bws!ph_*@N1+(J<`HLNQbW}VrGkZ85WC?4_EB#FI zzyf+lVx7b?Q^ZvBZ{Wc!B{i!G(`!fFZFb%dWz~40SBtj1NMKfqaV22szQg&$jx~EN zs(OmveHOSYfciZ+tAYnwgOeZ$u;6=7>MB3bDhHMu)lKc6l;XTenwW(u%mU34M_(Ne zSP4JN@cnp^I?7aavplIvd$iyB zgRh`9xRj<)4q}Db&edbH?oPCHG-R6dNk3q1 z8n=b6cHEep$(+M^EFStj?YuWsR0w>7!)X+r3Vt0AqO(Ytr!O_I|DK97+xh63wU@l_ z?QX2X?MY88l4t5IRX*WC5nsSW-9!Asp*2+!P$r!;3EjO4-Dy$%sfN23DQ-DzEw1^- z9MHWhFyangojhLn(~jo~Q1YlR5cw^_gINUX(fa2vobX^4J+X;?@C6UJd7pU5Gf7~j z3_b-^cVWmwE7PTFIUr#^Tc1kz7m)^6X@v>Yr7G?`;s@L#h5IWX&SM$uc>V&5~OJLz#3?2 zi)1?+lXcbNqE27iN07OS7h5Ad$RcwLb}W2;htaJxq&09ZI(&EgSvk2MdZ$|ek1}~C zJ8qH5GaRe44oYGqlT*+y^iVsfaw^Y(?B#U|6SALsO;!!~fM$RvJ8rbnnBmZMtl7?G zwkGUl50`6)&NAFn%cLB1;0H})4yHwBN#^YQ!1sW-*!dhTwNMR6E2S_le*FL*u;j9c zr8dfe#Qw3v-e)`R;I+rj>ic!CG|j(Rga?bAk6`RoLon-Et2{+J>I2bQw)25khlnNG z8|f~pjV>5la-is&WO<560v|Lg-K^ZCm|>D|@B!(pGQXf}ooNHAB{ByyR2WebNt}Ct zB$*dpL9|w}HZoMQwzB0HX1vN0iStbY5Qac^JML(8IIm6j)71*eB$O{lc#tIMzDQDr zh2eW_q5C6c$#n4VJg;p(pUH{j1!W?nGP;_GQ-7cwI12h^J07PL9XGVP9o(eu;#ZZT zJSA(^L+^SS9$gdO=-L!Sa*&LOPF!8c4-^j=A5TG9RbyRRw91l+DHd?hpjM3+beHcI zL~}ev>yTe4;t#le13PpAN>wM@e`>RWx+Goa;y6-?2WH1o`&BrBRtepd;_!?O6Liif za4;~ML^h&$pfd0?3Qo1qHQBiuR?A8b$2CX$Bh46hZCOY(2Vtlzbd2cE2WcNuV%%`+ zl;ua~enOy1dWb~<;!Hw$R5sf;mH8$!aqNXzO}a?b#=6z9qW0`=$Me~SfRQxuA4!iIE2znP2GP8VFhjIR z^sZwasQ!gyyL93O1rS|ja2SQ&Zk<}dpo&JW79S_Z@lFA_>;xnSYMxoVws}D2uV_J& z%AK0P_M^Pbj^{f!9`>rojIsu8v7ehN5mfE}0L0P^|Fhbi{Qv*}07*qoM6N<$g2H@7 AcK`qY literal 0 HcmV?d00001 diff --git a/src/test/resources/assets/forge/textures/blocks/milk_still.png.mcmeta b/src/test/resources/assets/forge/textures/blocks/milk_still.png.mcmeta new file mode 100644 index 000000000..0645f48c6 --- /dev/null +++ b/src/test/resources/assets/forge/textures/blocks/milk_still.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 2 + } +} diff --git a/src/test/resources/assets/forgedebugmodelfluid/blockstates/TestFluidBlock.json b/src/test/resources/assets/forgedebugmodelfluid/blockstates/TestFluidBlock.json index 7be998c4b..bce5d7ca0 100644 --- a/src/test/resources/assets/forgedebugmodelfluid/blockstates/TestFluidBlock.json +++ b/src/test/resources/assets/forgedebugmodelfluid/blockstates/TestFluidBlock.json @@ -8,6 +8,10 @@ "gas": { "model": "forge:fluid", "custom": { "fluid": "testgas" } + }, + "milk": { + "model": "forge:fluid", + "custom": { "fluid": "milk" } } } } From cb609dbab314b40f775bf1fbadfea8d1f8da22f6 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 21 Dec 2015 13:42:40 -0800 Subject: [PATCH 119/133] Fixed registry issues that prevented connecting to 1.8 Forge servers. More precisely: Servers with missing registries default back to frozen version. Throw descriptive error if we do not have any information. --- .../fml/common/FMLContainer.java | 2 +- .../FMLControlledNamespacedRegistry.java | 11 +++++ .../registry/PersistentRegistryManager.java | 47 +++++++++++++++++-- .../fml/common/registry/VillagerRegistry.java | 3 +- 4 files changed, 56 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/FMLContainer.java b/src/main/java/net/minecraftforge/fml/common/FMLContainer.java index 43a84747e..92c225830 100644 --- a/src/main/java/net/minecraftforge/fml/common/FMLContainer.java +++ b/src/main/java/net/minecraftforge/fml/common/FMLContainer.java @@ -267,7 +267,7 @@ public class FMLContainer extends DummyModContainer implements WorldAccessContai ResourceLocation entryLoc; if ("fml:blocks".equals(key)) entryLoc = PersistentRegistryManager.BLOCKS; else if ("fml:items".equals(key)) entryLoc = PersistentRegistryManager.ITEMS; - else if ("fmlgr:villagerprofessions".equals(key)) entryLoc = new ResourceLocation("minecraft:villagerprofessions"); + else if ("fmlgr:villagerprofessions".equals(key)) entryLoc = VillagerRegistry.PROFESSIONS; else entryLoc = new ResourceLocation(key); snapshot.entries.put(entryLoc, entry); diff --git a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java index e35847845..073f07a60 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java @@ -713,4 +713,15 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul { blockedIds.add(id); } + + public void noitifyCallbacks() + { + if (addCallback == null) + return; + + for (I i : this.underlyingIntegerMap) + { + addCallback.onAdd(i, this.underlyingIntegerMap.get(i)); + } + } } diff --git a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java index daf8b669b..955c6b41f 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java @@ -23,11 +23,13 @@ import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.potion.Potion; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.EnhancedRuntimeException; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.StartupQuery; import net.minecraftforge.fml.common.ZipperUtil; +import net.minecraftforge.fml.common.EnhancedRuntimeException.WrappedPrintStream; import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent; /** @@ -138,7 +140,7 @@ public class PersistentRegistryManager public static List injectSnapshot(GameDataSnapshot snapshot, boolean injectFrozenData, boolean isLocalWorld) { - FMLLog.info("Injecting existing block and item data into this {} instance", FMLCommonHandler.instance().getEffectiveSide().isServer() ? "server" : "client"); + FMLLog.info("Injecting existing block and item data into this %s instance", FMLCommonHandler.instance().getEffectiveSide().isServer() ? "server" : "client"); final Map> remaps = Maps.newHashMap(); final LinkedHashMap> missing = Maps.newLinkedHashMap(); @@ -208,11 +210,40 @@ public class PersistentRegistryManager } } - private static void loadRegistry(ResourceLocation registryName, PersistentRegistry from, PersistentRegistry to, Class regType) + private static void loadRegistry(final ResourceLocation registryName, final PersistentRegistry from, final PersistentRegistry to, Class regType) { FMLControlledNamespacedRegistry fromRegistry = from.getRegistry(registryName, regType); - FMLControlledNamespacedRegistry toRegistry = to.getOrShallowCopyRegistry(registryName, regType, fromRegistry); - toRegistry.set(fromRegistry); + if (fromRegistry == null) + { + FMLControlledNamespacedRegistry toRegistry = to.getRegistry(registryName, regType); + if (toRegistry == null) + { + throw new EnhancedRuntimeException("Could not find registry to load: " + registryName){ + private static final long serialVersionUID = 1L; + @Override + protected void printStackTrace(WrappedPrintStream stream) + { + stream.println("Looking For: " + registryName); + stream.println("Found From:"); + for (ResourceLocation name : from.registries.keySet()) + stream.println(" " + name); + stream.println("Found To:"); + for (ResourceLocation name : to.registries.keySet()) + stream.println(" " + name); + } + }; + } + // We found it in to, so lets trust to's state... + // This happens when connecting to a server that doesn't have this registry. + // Such as a 1.8.0 Forge server with 1.8.8+ Forge. + // We must however, re-fire the callbacks as some internal data may be corrupted {potions} + toRegistry.noitifyCallbacks(); + } + else + { + FMLControlledNamespacedRegistry toRegistry = to.getOrShallowCopyRegistry(registryName, regType, fromRegistry); + toRegistry.set(fromRegistry); + } } private static void loadFrozenDataToStagingRegistry(Map> remaps, ResourceLocation registryName, Class regType) @@ -225,10 +256,16 @@ public class PersistentRegistryManager private static void loadPersistentDataToStagingRegistry(boolean injectFrozenData, Map> remaps, LinkedHashMap> missing, Map.Entry snapEntry, Class regType) { ResourceLocation registryName = snapEntry.getKey(); + + //Translate old names + if ("fml:blocks".equals(registryName.toString())) registryName = PersistentRegistryManager.BLOCKS; + else if ("fml:items".equals(registryName.toString())) registryName = PersistentRegistryManager.ITEMS; + else if ("fmlgr:villagerprofessions".equals(registryName.toString())) registryName = VillagerRegistry.PROFESSIONS; + FMLControlledNamespacedRegistry currentRegistry = PersistentRegistry.ACTIVE.getRegistry(registryName, regType); if (currentRegistry == null) { - FMLLog.severe("An unknown persistent registry type {} has been encountered. This Forge instance cannot understand it.", registryName); + FMLLog.severe("An unknown persistent registry type \"%s\" has been encountered. This Forge instance cannot understand it.", registryName); StartupQuery.abort(); } FMLControlledNamespacedRegistry newRegistry = PersistentRegistry.STAGING.getOrShallowCopyRegistry(registryName, regType, currentRegistry); diff --git a/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java index 17c37c12c..7eef45e0b 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java @@ -53,6 +53,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; */ public class VillagerRegistry { + public static final ResourceLocation PROFESSIONS = new ResourceLocation("minecraft:villagerprofessions"); private static final VillagerRegistry INSTANCE = new VillagerRegistry(); private Map, IVillageCreationHandler> villageCreationHandlers = Maps.newHashMap(); @@ -206,7 +207,7 @@ public class VillagerRegistry } private boolean hasInit = false; - private FMLControlledNamespacedRegistry professions = PersistentRegistryManager.createRegistry(new ResourceLocation("minecraft:villagerprofessions"), VillagerProfession.class, null, 1024, 0, true, null); + private FMLControlledNamespacedRegistry professions = PersistentRegistryManager.createRegistry(PROFESSIONS, VillagerProfession.class, null, 1024, 0, true, null); private void init() From 6a8a9b30975818c79c7521c022377b9e0608fd55 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 22 Dec 2015 11:52:36 -0800 Subject: [PATCH 120/133] Fixed vanilla bug related to spawning entities on top of fences. Closes #2303 --- .../net/minecraft/item/ItemMonsterPlacer.java.patch | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch b/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch index a376bad96..589f68776 100644 --- a/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch @@ -27,7 +27,13 @@ tileentity.func_70296_d(); p_180614_3_.func_175689_h(p_180614_4_); -@@ -95,7 +95,7 @@ +@@ -90,12 +90,12 @@ + p_180614_4_ = p_180614_4_.func_177972_a(p_180614_5_); + double d0 = 0.0D; + +- if (p_180614_5_ == EnumFacing.UP && iblockstate instanceof BlockFence) ++ if (p_180614_5_ == EnumFacing.UP && iblockstate.func_177230_c() instanceof BlockFence) //Forge: Fix Vanilla bug comparing state instead of block + { d0 = 0.5D; } From d8ca68b2804718f494cc00652d49556969719ad3 Mon Sep 17 00:00:00 2001 From: cpw Date: Tue, 22 Dec 2015 18:12:05 -0500 Subject: [PATCH 121/133] Fix the channel handler naming. It now uses the standard netty namer for it, by careful use of cunning reflection. --- .../simpleimpl/SimpleNetworkWrapper.java | 39 +++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/network/simpleimpl/SimpleNetworkWrapper.java b/src/main/java/net/minecraftforge/fml/common/network/simpleimpl/SimpleNetworkWrapper.java index d67c148fa..7f18106e3 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/simpleimpl/SimpleNetworkWrapper.java +++ b/src/main/java/net/minecraftforge/fml/common/network/simpleimpl/SimpleNetworkWrapper.java @@ -2,14 +2,20 @@ package net.minecraftforge.fml.common.network.simpleimpl; import io.netty.channel.ChannelFutureListener; +import java.lang.reflect.Method; import java.util.EnumMap; import com.google.common.base.Throwables; +import org.apache.logging.log4j.Level; + +import io.netty.channel.ChannelHandler; +import io.netty.channel.ChannelPipeline; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.INetHandler; import net.minecraft.network.Packet; import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.network.FMLEmbeddedChannel; import net.minecraftforge.fml.common.network.FMLOutboundHandler; @@ -85,13 +91,40 @@ import net.minecraftforge.fml.relauncher.Side; public class SimpleNetworkWrapper { private EnumMap channels; private SimpleIndexedCodec packetCodec; - + private static Class defaultChannelPipeline; + private static Method generateName; + { + try + { + defaultChannelPipeline = Class.forName("io.netty.channel.DefaultChannelPipeline"); + generateName = defaultChannelPipeline.getDeclaredMethod("generateName", ChannelHandler.class); + generateName.setAccessible(true); + } + catch (Exception e) + { + // How is this possible? + FMLLog.log(Level.FATAL, e, "What? Netty isn't installed, what magic is this?"); + throw Throwables.propagate(e); + } + } public SimpleNetworkWrapper(String channelName) { packetCodec = new SimpleIndexedCodec(); channels = NetworkRegistry.INSTANCE.newChannel(channelName, packetCodec); } + private String generateName(ChannelPipeline pipeline, ChannelHandler handler) + { + try + { + return (String)generateName.invoke(defaultChannelPipeline.cast(pipeline), handler); + } + catch (Exception e) + { + FMLLog.log(Level.FATAL, e, "It appears we somehow have a not-standard pipeline. Huh"); + throw Throwables.propagate(e); + } + } /** * Register a message and it's associated handler. The message will have the supplied discriminator byte. The message handler will * be registered on the supplied side (this is the side where you want the message to be processed and acted upon). @@ -144,13 +177,13 @@ public class SimpleNetworkWrapper { private void addServerHandlerAfter(FMLEmbeddedChannel channel, String type, IMessageHandler messageHandler, Class requestType) { SimpleChannelHandlerWrapper handler = getHandlerWrapper(messageHandler, Side.SERVER, requestType); - channel.pipeline().addAfter(type, messageHandler.getClass().getName(), handler); + channel.pipeline().addAfter(type, generateName(channel.pipeline(), handler), handler); } private void addClientHandlerAfter(FMLEmbeddedChannel channel, String type, IMessageHandler messageHandler, Class requestType) { SimpleChannelHandlerWrapper handler = getHandlerWrapper(messageHandler, Side.CLIENT, requestType); - channel.pipeline().addAfter(type, messageHandler.getClass().getName(), handler); + channel.pipeline().addAfter(type, generateName(channel.pipeline(), handler), handler); } private SimpleChannelHandlerWrapper getHandlerWrapper(IMessageHandler messageHandler, Side side, Class requestType) From 5562c14c45de47a5747087572f3b75be5e52c6d6 Mon Sep 17 00:00:00 2001 From: cpw Date: Wed, 23 Dec 2015 10:37:11 -0500 Subject: [PATCH 122/133] Fix up persistent substitution. Should close #2259 --- .../fml/common/registry/FMLControlledNamespacedRegistry.java | 4 +++- .../java/net/minecraftforge/fml/common/registry/GameData.java | 2 +- .../fml/common/registry/PersistentRegistryManager.java | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java index 073f07a60..0789301b5 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java @@ -160,6 +160,8 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul this.minId = otherRegistry.minId; this.aliases.clear(); this.aliases.putAll(otherRegistry.aliases); + this.persistentSubstitutions.clear(); + this.persistentSubstitutions.putAll(otherRegistry.getPersistentSubstitutions()); this.activeSubstitutions.clear(); underlyingIntegerMap = new ObjectIntIdentityMap(); @@ -599,7 +601,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul getPersistentSubstitutions().put(nameToReplace, replacement); } - private BiMap getPersistentSubstitutions() + BiMap getPersistentSubstitutions() { return persistentSubstitutions; } diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java index 8833d69d0..e094bd6b3 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java @@ -185,7 +185,7 @@ public class GameData void registerSubstitutionAlias(String name, GameRegistry.Type type, Object toReplace) throws ExistingSubstitutionException { - ResourceLocation nameToSubstitute = new ResourceLocation(Loader.instance().activeModContainer().getModId(), name); + ResourceLocation nameToSubstitute = new ResourceLocation(name); if (type == GameRegistry.Type.BLOCK) { iBlockRegistry.addSubstitutionAlias(Loader.instance().activeModContainer().getModId(), nameToSubstitute, (Block)toReplace); diff --git a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java index 955c6b41f..2940832a3 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java @@ -269,6 +269,8 @@ public class PersistentRegistryManager StartupQuery.abort(); } FMLControlledNamespacedRegistry newRegistry = PersistentRegistry.STAGING.getOrShallowCopyRegistry(registryName, regType, currentRegistry); + // Copy the persistent substitution set from the currently active one into the new registry + newRegistry.getPersistentSubstitutions().putAll(currentRegistry.getPersistentSubstitutions()); GameDataSnapshot.Entry snapshotEntry = snapEntry.getValue(); Set substitutions = snapshotEntry.substitutions; if (injectFrozenData) From bcecf59a875527f09738ef9493f763791b329f1b Mon Sep 17 00:00:00 2001 From: cpw Date: Wed, 23 Dec 2015 11:18:54 -0500 Subject: [PATCH 123/133] Blocks are no longer erased from the registry if the mod isn't present. This means that modded blocks can potentially retain their IDs even if they are temporarily not present in the game. Currently TileEntity data associated with the block is erased. --- .../FMLControlledNamespacedRegistry.java | 2 ++ .../registry/PersistentRegistryManager.java | 22 ++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java index 0789301b5..0cdd30593 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java @@ -138,11 +138,13 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul { throw new IllegalStateException(String.format("Registry entry for name %s doesn't yield the expected id %d.", name, id)); } +/* // entry is blocked, thus should be empty if (blockedIds.contains(id)) { throw new IllegalStateException(String.format("Registry entry for %s %s, id %d, name %s, marked as dangling.", registryName, obj, id, name)); } +*/ } } diff --git a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java index 2940832a3..723bb5524 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java @@ -19,7 +19,11 @@ import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.google.common.collect.Sets.SetView; +import org.apache.logging.log4j.Level; + import net.minecraft.block.Block; +import net.minecraft.block.BlockAir; +import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.potion.Potion; import net.minecraft.util.ResourceLocation; @@ -167,6 +171,18 @@ public class PersistentRegistryManager return missedMappings; } + // If we're loading from disk, we can actually substitute air in the block map for anything that is otherwise "missing". This keeps the reference in the map, in case + // the block comes back later + if (injectFrozenData) + { + for (Map.Entry missingBlock: missing.get(BLOCKS).entrySet()) + { + ResourceLocation rl = missingBlock.getKey(); + Integer id = missingBlock.getValue(); + FMLLog.log(Level.DEBUG, "Replacing id %s named as %s with air block. If the mod becomes available again later, it can reload here", id, rl); + PersistentRegistry.STAGING.getRegistry(BLOCKS, Block.class).add(id, rl, new BlockDummyAir()); + } + } // If we're loading up the world from disk, we want to add in the new data that might have been provisioned by mods if (injectFrozenData) { @@ -201,7 +217,11 @@ public class PersistentRegistryManager // Return an empty list, because we're good return ImmutableList.of(); } - + private static class BlockDummyAir extends BlockAir { + private BlockDummyAir() { + setUnlocalizedName("air"); + } + } private static void forAllRegistries(PersistentRegistry registrySet, Function>, Void> operation) { for (Map.Entry> r : registrySet.registries.entrySet()) From 53227982e3655eddac98cf8f466eaac668be3774 Mon Sep 17 00:00:00 2001 From: cpw Date: Wed, 23 Dec 2015 14:11:17 -0500 Subject: [PATCH 124/133] Try and fix registry NPE when substitution is active. --- .../registry/FMLControlledNamespacedRegistry.java | 13 ++++++++++++- .../common/registry/PersistentRegistryManager.java | 4 +--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java index 0cdd30593..607ac29a0 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java @@ -718,7 +718,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul blockedIds.add(id); } - public void noitifyCallbacks() + public void notifyCallbacks() { if (addCallback == null) return; @@ -728,4 +728,15 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul addCallback.onAdd(i, this.underlyingIntegerMap.get(i)); } } + + @Override + public ResourceLocation getNameForObject(I p_177774_1_) + { + ResourceLocation rl = super.getNameForObject(p_177774_1_); + if (rl == null) + { + rl = activeSubstitutions.inverse().get(p_177774_1_); + } + return rl; + } } diff --git a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java index 723bb5524..607198964 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java @@ -23,7 +23,6 @@ import org.apache.logging.log4j.Level; import net.minecraft.block.Block; import net.minecraft.block.BlockAir; -import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.potion.Potion; import net.minecraft.util.ResourceLocation; @@ -33,7 +32,6 @@ import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.StartupQuery; import net.minecraftforge.fml.common.ZipperUtil; -import net.minecraftforge.fml.common.EnhancedRuntimeException.WrappedPrintStream; import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent; /** @@ -257,7 +255,7 @@ public class PersistentRegistryManager // This happens when connecting to a server that doesn't have this registry. // Such as a 1.8.0 Forge server with 1.8.8+ Forge. // We must however, re-fire the callbacks as some internal data may be corrupted {potions} - toRegistry.noitifyCallbacks(); + toRegistry.notifyCallbacks(); } else { From 54e9a36b67e5498fbd6d768ef40bc8d002b67c81 Mon Sep 17 00:00:00 2001 From: cpw Date: Wed, 23 Dec 2015 15:07:16 -0500 Subject: [PATCH 125/133] Capture ItemBlock remaps. --- .../fml/common/registry/GameData.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java index e094bd6b3..5dd4537f1 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java @@ -19,6 +19,7 @@ import com.google.common.collect.Maps; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; import net.minecraft.potion.Potion; import net.minecraft.util.ObjectIntIdentityMap; import net.minecraft.util.ResourceLocation; @@ -110,7 +111,7 @@ public class GameData // internal registry objects private final FMLControlledNamespacedRegistry iBlockRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.BLOCKS, Block.class, new ResourceLocation("minecraft:air"), MAX_BLOCK_ID, MIN_BLOCK_ID, true, BlockStateCapture.INSTANCE); - private final FMLControlledNamespacedRegistry iItemRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.ITEMS, Item.class, null, MAX_ITEM_ID, MIN_ITEM_ID, true); + private final FMLControlledNamespacedRegistry iItemRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.ITEMS, Item.class, null, MAX_ITEM_ID, MIN_ITEM_ID, true, ItemBlockCapture.INSTANCE); private final FMLControlledNamespacedRegistry iPotionRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.POTIONS, Potion.class, null, MAX_POTION_ID, MIN_POTION_ID, false, PotionArrayCapture.INSTANCE); int registerItem(Item item, String name) // from GameRegistry @@ -243,6 +244,21 @@ public class GameData } } + private static class ItemBlockCapture implements FMLControlledNamespacedRegistry.AddCallback + { + static final ItemBlockCapture INSTANCE = new ItemBlockCapture(); + + @Override + public void onAdd(Item item, int blockId) + { + if (item instanceof ItemBlock) + { + ItemBlock itemBlock = (ItemBlock)item; + BLOCK_TO_ITEM.put(itemBlock.getBlock(), item); + } + } + } + private static class PotionArrayCapture implements FMLControlledNamespacedRegistry.AddCallback { static final PotionArrayCapture INSTANCE = new PotionArrayCapture(); From 95825e5de0d9676e3c605b2f8f187534a02a7e7b Mon Sep 17 00:00:00 2001 From: cpw Date: Wed, 23 Dec 2015 15:55:45 -0500 Subject: [PATCH 126/133] Actually use the delegate for the itemblock --- .../java/net/minecraftforge/fml/common/registry/GameData.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java index 5dd4537f1..aa8c08205 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java @@ -254,7 +254,7 @@ public class GameData if (item instanceof ItemBlock) { ItemBlock itemBlock = (ItemBlock)item; - BLOCK_TO_ITEM.put(itemBlock.getBlock(), item); + BLOCK_TO_ITEM.put(itemBlock.getBlock().delegate.get(), item); } } } From a54b939ea31e94a39c504c1d350278bbe1f391a2 Mon Sep 17 00:00:00 2001 From: cpw Date: Wed, 23 Dec 2015 16:41:53 -0500 Subject: [PATCH 127/133] Try and make sure active substitutions are immediately available in the block to item map. --- .../FMLControlledNamespacedRegistry.java | 4 +++- .../fml/common/registry/GameData.java | 20 +++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java index 607ac29a0..f096a2947 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry.java @@ -565,7 +565,7 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul } } - void activateSubstitution(ResourceLocation nameToReplace) + I activateSubstitution(ResourceLocation nameToReplace) { if (getPersistentSubstitutions().containsKey(nameToReplace)) { @@ -573,7 +573,9 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul I sub = getPersistentSubstitutions().get(nameToReplace); getExistingDelegate(original).changeReference(sub); activeSubstitutions.put(nameToReplace, sub); + return original; } + return null; } void addSubstitutionAlias(String modId, ResourceLocation nameToReplace, I replacement) throws ExistingSubstitutionException diff --git a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java index aa8c08205..71e854602 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java @@ -14,6 +14,8 @@ package net.minecraftforge.fml.common.registry; import java.util.Map; +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; import com.google.common.collect.Maps; import net.minecraft.block.Block; @@ -190,16 +192,26 @@ public class GameData if (type == GameRegistry.Type.BLOCK) { iBlockRegistry.addSubstitutionAlias(Loader.instance().activeModContainer().getModId(), nameToSubstitute, (Block)toReplace); - iBlockRegistry.activateSubstitution(nameToSubstitute); + Block orig = iBlockRegistry.activateSubstitution(nameToSubstitute); + if (BLOCK_TO_ITEM.containsKey(orig)) + { + Item i = BLOCK_TO_ITEM.get(orig); + BLOCK_TO_ITEM.forcePut((Block)toReplace,i); + } } else if (type == GameRegistry.Type.ITEM) { iItemRegistry.addSubstitutionAlias(Loader.instance().activeModContainer().getModId(), nameToSubstitute, (Item)toReplace); - iItemRegistry.activateSubstitution(nameToSubstitute); + Item orig = iItemRegistry.activateSubstitution(nameToSubstitute); + if (BLOCK_TO_ITEM.containsValue(orig)) + { + Block b = BLOCK_TO_ITEM.inverse().get(orig); + BLOCK_TO_ITEM.forcePut(b, (Item)toReplace); + } } } - private static Map BLOCK_TO_ITEM = Maps.newHashMap(); + private static BiMap BLOCK_TO_ITEM = HashBiMap.create(); //Internal: DO NOT USE, will change without warning. public static Map getBlockItemMap() @@ -254,7 +266,7 @@ public class GameData if (item instanceof ItemBlock) { ItemBlock itemBlock = (ItemBlock)item; - BLOCK_TO_ITEM.put(itemBlock.getBlock().delegate.get(), item); + BLOCK_TO_ITEM.forcePut(itemBlock.getBlock().delegate.get(), item); } } } From 097c0c61302a21f2c7008733814dff48bc9b401a Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Thu, 24 Dec 2015 06:06:38 +0300 Subject: [PATCH 128/133] Added an ability to register custom item variants, not ending with "#inventory". Should allow grouping multiple item models into 1 blockstate json. --- .../resources/model/ModelBakery.java.patch | 36 ++++++++++++++++++- .../client/model/ModelLoader.java | 29 ++++++++++++--- .../minecraftforge/debug/DynBucketTest.java | 7 ++-- .../debug/ForgeBlockStatesLoaderDebug.java | 1 - .../minecraftforge/debug/ModelFluidDebug.java | 7 ++-- 5 files changed, 68 insertions(+), 12 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch index 35547cd4e..f9f5a2c51 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch @@ -36,6 +36,24 @@ } protected List func_177596_a(Item p_177596_1_) +@@ -352,7 +358,7 @@ + + protected ResourceLocation func_177583_a(String p_177583_1_) + { +- ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_); ++ ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_.replaceAll("#.*", "")); + return new ResourceLocation(resourcelocation.func_110624_b(), "item/" + resourcelocation.func_110623_a()); + } + +@@ -395,7 +401,7 @@ + for (Entry entry : this.field_177615_s.entrySet()) + { + ResourceLocation resourcelocation = (ResourceLocation)entry.getValue(); +- ModelResourceLocation modelresourcelocation1 = new ModelResourceLocation((String)entry.getKey(), "inventory"); ++ ModelResourceLocation modelresourcelocation1 = net.minecraftforge.client.model.ModelLoader.getInventoryVariant(entry.getKey()); + ModelBlock modelblock1 = (ModelBlock)this.field_177611_h.get(resourcelocation); + + if (modelblock1 != null && modelblock1.func_178303_d()) @@ -453,6 +459,11 @@ private IBakedModel func_177578_a(ModelBlock p_177578_1_, ModelRotation p_177578_2_, boolean p_177578_3_) @@ -81,7 +99,7 @@ private void func_177597_h() { this.func_177574_i(); -@@ -722,4 +738,19 @@ +@@ -722,4 +738,35 @@ field_177617_q.field_178317_b = "class generation marker"; field_177616_r.field_178317_b = "block entity marker"; } @@ -90,6 +108,10 @@ + * FML Start + ***********************************************************/ + private static Map, Set> customVariantNames = Maps.newHashMap(); ++ /** ++ * @deprecated use registerItemVariants ++ */ ++ @Deprecated + public static void addVariantName(Item item, String... names) + { + if (customVariantNames.containsKey(item.delegate)) @@ -97,6 +119,18 @@ + else + customVariantNames.put(item.delegate, Sets.newHashSet(names)); + } ++ ++ public static void registerItemVariants(Item item, T... names) ++ { ++ if (!customVariantNames.containsKey(item.delegate)) ++ { ++ customVariantNames.put(item.delegate, Sets.newHashSet()); ++ } ++ for(ResourceLocation name : names) ++ { ++ customVariantNames.get(item.delegate).add(name.toString()); ++ } ++ } + /*********************************************************** + * FML End + ***********************************************************/ diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 7aa3d5f77..c8edb57a5 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -188,7 +188,7 @@ public class ModelLoader extends ModelBakery for(String s : (List)getVariantNames(item)) { ResourceLocation file = getItemLocation(s); - ModelResourceLocation memory = new ModelResourceLocation(s, "inventory"); + ModelResourceLocation memory = getInventoryVariant(s); IModel model = null; try { @@ -216,7 +216,7 @@ public class ModelLoader extends ModelBakery // empty bucket for(String s : getVariantNames(Items.bucket)) { - ModelResourceLocation memory = new ModelResourceLocation(s, "inventory"); + ModelResourceLocation memory = getInventoryVariant(s); try { IModel model = getModel(new ResourceLocation("forge", "item/bucket")); @@ -247,7 +247,7 @@ public class ModelLoader extends ModelBakery // milk bucket if no milk fluid is present for(String s : getVariantNames(Items.milk_bucket)) { - ModelResourceLocation memory = new ModelResourceLocation(s, "inventory"); + ModelResourceLocation memory = getInventoryVariant(s); try { IModel model = getModel(new ResourceLocation("forge", "item/bucket_milk")); @@ -267,12 +267,21 @@ public class ModelLoader extends ModelBakery { for(String s : getVariantNames(item)) { - ModelResourceLocation memory = new ModelResourceLocation(s, "inventory"); + ModelResourceLocation memory = getInventoryVariant(s); IModel model = stateModels.get(ModelDynBucket.LOCATION); stateModels.put(memory, model); } } + public static ModelResourceLocation getInventoryVariant(String s) + { + if(s.contains("#")) + { + return new ModelResourceLocation(s); + } + return new ModelResourceLocation(s, "inventory"); + } + public IModel getModel(ResourceLocation location) throws IOException { if(!ModelLoaderRegistry.loaded(location)) loadAnyModel(location); @@ -855,6 +864,9 @@ public class ModelLoader extends ModelBakery private static final Map, IStateMapper> customStateMappers = Maps.newHashMap(); + /** + * Adds a custom IBlockState -> model variant logic. + */ public static void setCustomStateMapper(Block block, IStateMapper mapper) { customStateMappers.put(block.delegate, mapper); @@ -871,11 +883,20 @@ public class ModelLoader extends ModelBakery private static final Map, ItemMeshDefinition> customMeshDefinitions = com.google.common.collect.Maps.newHashMap(); private static final Map, Integer>, ModelResourceLocation> customModels = com.google.common.collect.Maps.newHashMap(); + /** + * Adds a simple mapping from Item + metadata to the model variant. + * Registers the variant with the ModelBakery too. + */ public static void setCustomModelResourceLocation(Item item, int metadata, ModelResourceLocation model) { customModels.put(Pair.of(item.delegate, metadata), model); + ModelBakery.registerItemVariants(item, model); } + /** + * Adds generic ItemStack -> model variant logic. + * You still need to manually call ModelBakery.registerItemVariants with all values that meshDefinition can return. + */ public static void setCustomMeshDefinition(Item item, ItemMeshDefinition meshDefinition) { customMeshDefinitions.put(item.delegate, meshDefinition); diff --git a/src/test/java/net/minecraftforge/debug/DynBucketTest.java b/src/test/java/net/minecraftforge/debug/DynBucketTest.java index defc191a3..593cb79fc 100644 --- a/src/test/java/net/minecraftforge/debug/DynBucketTest.java +++ b/src/test/java/net/minecraftforge/debug/DynBucketTest.java @@ -55,17 +55,18 @@ public class DynBucketTest return ModelDynBucket.LOCATION; } }); - ModelBakery.addVariantName(dynBucket, "forge:dynbucket"); + ModelBakery.registerItemVariants(dynBucket, new ResourceLocation("forge", "dynbucket")); + final ModelResourceLocation bottle = new ModelResourceLocation(new ResourceLocation("forge", "dynbottle"), "inventory"); ModelLoader.setCustomMeshDefinition(dynBottle, new ItemMeshDefinition() { @Override public ModelResourceLocation getModelLocation(ItemStack stack) { - return new ModelResourceLocation(new ResourceLocation("forge", "dynbottle"), "inventory"); + return bottle; } }); - ModelBakery.addVariantName(dynBottle, "forge:dynbottle"); + ModelBakery.registerItemVariants(dynBottle, bottle); } } diff --git a/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java b/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java index 603e3f62e..19f2b775b 100644 --- a/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java +++ b/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java @@ -89,7 +89,6 @@ public class ForgeBlockStatesLoaderDebug { Item customWallItem = Item.getItemFromBlock(blockCustomWall); ModelLoader.setCustomModelResourceLocation(customWallItem, 0, new ModelResourceLocation(ASSETS + "cobblestone_wall", "inventory")); ModelLoader.setCustomModelResourceLocation(customWallItem, 1, new ModelResourceLocation(ASSETS + "mossy_cobblestone_wall", "inventory")); - ModelBakery.addVariantName(customWallItem, ASSETS + "cobblestone_wall", ASSETS + "mossy_cobblestone_wall"); } // this block is never actually used, it's only needed for the error message on load to see the variant it maps to diff --git a/src/test/java/net/minecraftforge/debug/ModelFluidDebug.java b/src/test/java/net/minecraftforge/debug/ModelFluidDebug.java index 808da524d..5eb6b27b4 100644 --- a/src/test/java/net/minecraftforge/debug/ModelFluidDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelFluidDebug.java @@ -60,9 +60,10 @@ public class ModelFluidDebug Item fluid = Item.getItemFromBlock(TestFluidBlock.instance); Item gas = Item.getItemFromBlock(TestGasBlock.instance); Item milk = Item.getItemFromBlock(MilkFluidBlock.instance); - ModelBakery.addVariantName(fluid); - ModelBakery.addVariantName(gas); - ModelBakery.addVariantName(milk); + // no need to pass the locations here, since they'll be loaded by the block model logic. + ModelBakery.registerItemVariants(fluid); + ModelBakery.registerItemVariants(gas); + ModelBakery.registerItemVariants(milk); ModelLoader.setCustomMeshDefinition(fluid, new ItemMeshDefinition() { public ModelResourceLocation getModelLocation(ItemStack stack) From 1cd0bf9ee4f86d138012afd571399b35161bcf90 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Fri, 25 Dec 2015 09:31:32 +0300 Subject: [PATCH 129/133] Fixed random block position offset not applying correctly. --- .../client/model/pipeline/BlockInfo.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java b/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java index b3908c39b..9ef2e5e50 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java @@ -1,6 +1,7 @@ package net.minecraftforge.client.model.pipeline; import net.minecraft.block.Block; +import net.minecraft.block.Block.EnumOffsetType; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; @@ -36,16 +37,15 @@ public class BlockInfo { shx = shy = shz = 0; long rand = 0; - // FIXME - switch(block.getOffsetType()) + if(block.getOffsetType() != EnumOffsetType.NONE) { - case XYZ: - rand = MathHelper.getPositionRandom(blockPos); + rand = MathHelper.getPositionRandom(blockPos); + shx = ((float)((rand >> 16) & 0xF) / 0xF - .5f) * .5f; + shz = ((float)((rand >> 24) & 0xF) / 0xF - .5f) * .5f; + if(block.getOffsetType() == EnumOffsetType.XYZ) + { shy = ((float)((rand >> 20) & 0xF) / 0xF - 1) * .2f; - case XZ: - shx = ((float)((rand >> 16) & 0xF) / 0xF - .5f) * .5f; - shz = ((float)((rand >> 24) & 0xF) / 0xF - .5f) * .5f; - default: + } } } From d2248c3774713bb0f5931504ceb2382e41566c62 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 27 Dec 2015 14:39:29 -0800 Subject: [PATCH 130/133] Fix Button/Torch/Lever placement on stairs and slabs. Closes #2291 --- .../minecraft/net/minecraft/block/Block.java.patch | 13 ++++++++----- .../net/minecraft/block/BlockButton.java.patch | 2 +- .../net/minecraft/block/BlockTorch.java.patch | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index d871f030a..0f8b38ce3 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -188,7 +188,7 @@ } protected ItemStack func_180643_i(IBlockState p_180643_1_) -@@ -1010,6 +1030,1062 @@ +@@ -1010,6 +1030,1065 @@ return "Block{" + field_149771_c.func_177774_c(this) + "}"; } @@ -240,10 +240,10 @@ + + /** + * Check if the face of a block should block rendering. -+ * ++ * + * Faces which are fully opaque should return true, faces with transparency + * or faces which do not span the full size of the block should return false. -+ * ++ * + * @param world The current world + * @param pos Block position in world + * @param side The side to check @@ -268,7 +268,9 @@ + + if (this instanceof BlockSlab) + { -+ return func_149730_j() || (state.func_177229_b(BlockSlab.field_176554_a) == BlockSlab.EnumBlockHalf.TOP && side == EnumFacing.UP); ++ return func_149730_j() ++ || (state.func_177229_b(BlockSlab.field_176554_a) == BlockSlab.EnumBlockHalf.TOP && side == EnumFacing.UP ) ++ || (state.func_177229_b(BlockSlab.field_176554_a) == BlockSlab.EnumBlockHalf.BOTTOM && side == EnumFacing.DOWN); + } + else if (this instanceof BlockFarmland) + { @@ -280,6 +282,7 @@ + BlockStairs.EnumShape shape = (BlockStairs.EnumShape)state.func_177229_b(BlockStairs.field_176310_M); + EnumFacing facing = (EnumFacing)state.func_177229_b(BlockStairs.field_176309_a); + if (side == EnumFacing.UP) return flipped; ++ if (side == EnumFacing.DOWN) return !flipped; + if (facing == side) return true; + if (flipped) + { @@ -808,7 +811,7 @@ + + /** + * Allows a block to override the standard EntityLivingBase.updateFallState -+ * particles, this is a server side method that spawns particles with ++ * particles, this is a server side method that spawns particles with + * WorldServer.spawnParticle + * + * @param world The current Server world diff --git a/patches/minecraft/net/minecraft/block/BlockButton.java.patch b/patches/minecraft/net/minecraft/block/BlockButton.java.patch index 18a171549..58cd17706 100644 --- a/patches/minecraft/net/minecraft/block/BlockButton.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockButton.java.patch @@ -6,7 +6,7 @@ { - BlockPos blockpos = p_181088_1_.func_177972_a(p_181088_2_); - return p_181088_2_ == EnumFacing.DOWN ? World.func_175683_a(p_181088_0_, blockpos) : p_181088_0_.func_180495_p(blockpos).func_177230_c().func_149721_r(); -+ return p_181088_2_ == EnumFacing.DOWN && World.func_175683_a(p_181088_0_, p_181088_1_.func_177977_b()) ? true : p_181088_0_.isSideSolid(p_181088_1_.func_177972_a(p_181088_2_), p_181088_2_); ++ return p_181088_2_ == EnumFacing.DOWN && World.func_175683_a(p_181088_0_, p_181088_1_.func_177977_b()) ? true : p_181088_0_.isSideSolid(p_181088_1_.func_177972_a(p_181088_2_), p_181088_2_.func_176734_d()); } public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) diff --git a/patches/minecraft/net/minecraft/block/BlockTorch.java.patch b/patches/minecraft/net/minecraft/block/BlockTorch.java.patch index 8a44d448a..ec723e30d 100644 --- a/patches/minecraft/net/minecraft/block/BlockTorch.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTorch.java.patch @@ -32,7 +32,7 @@ boolean flag = false; - if (enumfacing$axis.func_176722_c() && !p_176592_1_.func_175677_d(p_176592_2_.func_177972_a(enumfacing1), true)) -+ if (enumfacing$axis.func_176722_c() && !p_176592_1_.isSideSolid(p_176592_2_.func_177972_a(enumfacing1), enumfacing1, true)) ++ if (enumfacing$axis.func_176722_c() && !p_176592_1_.isSideSolid(p_176592_2_.func_177972_a(enumfacing1), enumfacing, true)) { flag = true; } From af1e769895fcc92d40b1089db20ef3b7864ec2cc Mon Sep 17 00:00:00 2001 From: Take Weiland Date: Mon, 28 Dec 2015 15:58:37 +0100 Subject: [PATCH 131/133] Allow forge-type spawn-eggs to spawn child entities when clicking EntityAgeable --- .../net/minecraft/entity/EntityAgeable.java.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 patches/minecraft/net/minecraft/entity/EntityAgeable.java.patch diff --git a/patches/minecraft/net/minecraft/entity/EntityAgeable.java.patch b/patches/minecraft/net/minecraft/entity/EntityAgeable.java.patch new file mode 100644 index 000000000..68c17bc54 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/EntityAgeable.java.patch @@ -0,0 +1,11 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityAgeable.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityAgeable.java +@@ -31,7 +31,7 @@ + { + if (!this.field_70170_p.field_72995_K) + { +- Class oclass = EntityList.func_90035_a(itemstack.func_77960_j()); ++ Class oclass = EntityList.field_75625_b.get(net.minecraft.item.ItemMonsterPlacer.getEntityName(itemstack)); + + if (oclass != null && this.getClass() == oclass) + { From 7f52bc654732f56c5c530841a6cca3b8792f1b3a Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Mon, 28 Dec 2015 20:16:39 +0100 Subject: [PATCH 132/133] Add a hook for custom particle spawning for slimes --- .../entity/monster/EntitySlime.java.patch | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch index 351ba4598..8bd8f7dce 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch @@ -1,5 +1,14 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntitySlime.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySlime.java +@@ -111,7 +111,7 @@ + if (this.field_70122_E && !this.field_175452_bi) + { + int i = this.func_70809_q(); +- ++ 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 * 2.0F; @@ -271,7 +271,7 @@ BlockPos blockpos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), 0, MathHelper.func_76128_c(this.field_70161_v)); Chunk chunk = this.field_70170_p.func_175726_f(blockpos); @@ -9,3 +18,18 @@ { return false; } +@@ -336,6 +336,14 @@ + return super.func_180482_a(p_180482_1_, p_180482_2_); + } + ++ /* ======================================== FORGE START =====================================*/ ++ /** ++ * Called when the slime spawns particles on landing, see onUpdate. ++ * Return true to prevent the spawning of the default particles. ++ */ ++ protected boolean spawnCustomParticles() { return false; } ++ /* ======================================== FORGE END =====================================*/ ++ + static class AISlimeAttack extends EntityAIBase + { + private EntitySlime field_179466_a; From 509cc79112674c70ad8ef9e508de8d2dc01d0bd0 Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Tue, 29 Dec 2015 13:20:36 +0100 Subject: [PATCH 133/133] Fix bucket replacement not loading the bucket model by itself if replacing buckets. This happens when no other mod that uses the bucket model is present. Also added a simple method for registering the bucket model, should give modders an idea on how to use the general model. --- .../client/model/ModelLoader.java | 25 ++++++++++++++++++- .../minecraftforge/debug/DynBucketTest.java | 10 +------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index c8edb57a5..6dec67520 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -213,6 +213,14 @@ public class ModelLoader extends ModelBakery // replace vanilla bucket models if desired. done afterwards for performance reasons if(ForgeModContainer.replaceVanillaBucketModel) { + // ensure the bucket model is loaded + if(!stateModels.containsKey(ModelDynBucket.LOCATION)) + { + // load forges blockstate json for it + ModelResourceLocation memory = getInventoryVariant("forge:dynbucket"); + registerVariant(getModelBlockDefinition(memory), memory); + } + // empty bucket for(String s : getVariantNames(Items.bucket)) { @@ -269,7 +277,10 @@ public class ModelLoader extends ModelBakery { ModelResourceLocation memory = getInventoryVariant(s); IModel model = stateModels.get(ModelDynBucket.LOCATION); - stateModels.put(memory, model); + if(model != null) + { + stateModels.put(memory, model); + } } } @@ -902,6 +913,18 @@ public class ModelLoader extends ModelBakery customMeshDefinitions.put(item.delegate, meshDefinition); } + public static void setBucketModelDefinition(Item item) { + ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() + { + @Override + public ModelResourceLocation getModelLocation(ItemStack stack) + { + return ModelDynBucket.LOCATION; + } + }); + ModelBakery.registerItemVariants(item, ModelDynBucket.LOCATION); + } + public static void onRegisterItems(ItemModelMesher mesher) { for (Map.Entry, ItemMeshDefinition> e : customMeshDefinitions.entrySet()) diff --git a/src/test/java/net/minecraftforge/debug/DynBucketTest.java b/src/test/java/net/minecraftforge/debug/DynBucketTest.java index 593cb79fc..06e88db3c 100644 --- a/src/test/java/net/minecraftforge/debug/DynBucketTest.java +++ b/src/test/java/net/minecraftforge/debug/DynBucketTest.java @@ -47,15 +47,7 @@ public class DynBucketTest @Override void setupModels() { - ModelLoader.setCustomMeshDefinition(dynBucket, new ItemMeshDefinition() - { - @Override - public ModelResourceLocation getModelLocation(ItemStack stack) - { - return ModelDynBucket.LOCATION; - } - }); - ModelBakery.registerItemVariants(dynBucket, new ResourceLocation("forge", "dynbucket")); + ModelLoader.setBucketModelDefinition(dynBucket); final ModelResourceLocation bottle = new ModelResourceLocation(new ResourceLocation("forge", "dynbottle"), "inventory"); ModelLoader.setCustomMeshDefinition(dynBottle, new ItemMeshDefinition()