diff --git a/build.gradle b/build.gradle index 1777bd41a..2a53eeb89 100644 --- a/build.gradle +++ b/build.gradle @@ -11,20 +11,26 @@ buildscript { } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.0-SNAPSHOT' + classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT' } } +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" + mappings = "snapshot_nodoc_20151122" 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,13 @@ 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 = false + applyMcpPatches = false with common } } @@ -66,7 +65,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, @@ -126,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")) ]) } 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/jsons/1.8.8-dev.json b/jsons/1.8.8-dev.json new file mode 100644 index 000000000..0fb703e28 --- /dev/null +++ b/jsons/1.8.8-dev.json @@ -0,0 +1,328 @@ +{ + "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": "jline:jline:2.13", + "children": ["sources"], + "url" : "http://repo.maven.apache.org/maven2" + }, + { + "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..e25ac3ab6 --- /dev/null +++ b/jsons/1.8.8-rel.json @@ -0,0 +1,146 @@ +{ +"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.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": "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/", + "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 + }, + { + "name": "java3d:vecmath:1.5.2", + "clientreq":true, + "serverreq":true + }, + { + "name": "net.sf.trove4j:trove4j:3.0.3", + "clientreq":true, + "serverreq":true + } + ] +} +} 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 diff --git a/mdk/build.gradle b/mdk/build.gradle index a4a1dbf2a..1c5f080b3 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" diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 87d785eae..0f8b38ce3 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -1,20 +1,20 @@ --- ../src-base/minecraft/net/minecraft/block/Block.java +++ ../src-work/minecraft/net/minecraft/block/Block.java -@@ -39,8 +39,9 @@ +@@ -38,8 +38,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(); +- 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 field_176229_d = net.minecraftforge.fml.common.registry.GameData.getBlockStateIDMap(); ++ 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); -@@ -124,6 +125,9 @@ +@@ -119,6 +120,9 @@ + private IBlockState field_176228_M; private String field_149770_b; - 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); @@ -22,7 +22,7 @@ public static int func_149682_b(Block p_149682_0_) { return field_149771_c.func_148757_b(p_149682_0_); -@@ -136,7 +140,8 @@ +@@ -132,7 +136,8 @@ public static Block func_149729_e(int p_149729_0_) { @@ -32,7 +32,7 @@ } public static IBlockState func_176220_d(int p_176220_0_) -@@ -300,7 +305,7 @@ +@@ -303,7 +308,7 @@ public boolean func_176200_f(World p_176200_1_, BlockPos p_176200_2_) { @@ -41,7 +41,7 @@ } public Block func_149711_c(float p_149711_1_) -@@ -337,9 +342,10 @@ +@@ -340,9 +345,10 @@ return this.field_149789_z; } @@ -53,7 +53,7 @@ } 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_) -@@ -356,13 +362,13 @@ +@@ -359,13 +365,13 @@ public int func_176207_c(IBlockAccess p_176207_1_, BlockPos p_176207_2_) { Block block = p_176207_1_.func_180495_p(p_176207_2_).func_177230_c(); @@ -69,22 +69,27 @@ } else { -@@ -438,7 +444,13 @@ +@@ -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 void func_176213_c(World p_176213_1_, BlockPos p_176213_2_, IBlockState p_176213_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_) {} -+ 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_) + { + if (hasTileEntity(p_180663_3_) && !(this instanceof BlockContainer)) + { + p_180663_1_.func_175713_t(p_180663_2_); + } -+ } + } public int func_149745_a(Random p_149745_1_) - { -@@ -452,8 +464,7 @@ +@@ -467,8 +477,7 @@ public float func_180647_a(EntityPlayer p_180647_1_, World p_180647_2_, BlockPos p_180647_3_) { @@ -94,18 +99,18 @@ } public final void func_176226_b(World p_176226_1_, BlockPos p_176226_2_, IBlockState p_176226_3_, int p_176226_4_) -@@ -463,20 +474,16 @@ +@@ -478,20 +487,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_) { - 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 j = this.func_149679_a(p_180653_5_, p_180653_1_.field_73012_v); +- 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 k = 0; k < j; ++k) +- for (int j = 0; j < i; ++j) + for (ItemStack item : items) { if (p_180653_1_.field_73012_v.nextFloat() <= p_180653_4_) @@ -120,7 +125,7 @@ } } } -@@ -484,8 +491,13 @@ +@@ -499,8 +504,13 @@ public static void func_180635_a(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_) { @@ -135,7 +140,7 @@ 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; -@@ -670,7 +682,7 @@ +@@ -687,7 +697,7 @@ public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { @@ -144,7 +149,7 @@ } 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_) -@@ -772,25 +784,35 @@ +@@ -799,25 +809,35 @@ p_180657_2_.func_71029_a(StatList.field_75934_C[func_149682_b(this)]); p_180657_2_.func_71020_j(0.025F); @@ -183,8 +188,8 @@ } protected ItemStack func_180643_i(IBlockState p_180643_1_) -@@ -967,6 +989,1033 @@ - return Block.EnumOffsetType.NONE; +@@ -1010,6 +1030,1065 @@ + return "Block{" + field_149771_c.func_177774_c(this) + "}"; } + /* ======================================== FORGE START =====================================*/ @@ -234,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 @@ -247,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) + { @@ -259,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) + { @@ -786,6 +810,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 @@ -943,11 +984,7 @@ + */ + public boolean canEntityDestroy(IBlockAccess world, BlockPos pos, Entity entity) + { -+ 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; -+ } -+ else if (entity instanceof net.minecraft.entity.boss.EntityDragon) ++ 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; + } @@ -1114,7 +1151,7 @@ + */ + public void setHarvestLevel(String toolClass, int level) + { -+ Iterator itr = func_176194_O().func_177619_a().iterator(); ++ java.util.Iterator itr = func_176194_O().func_177619_a().iterator(); + while (itr.hasNext()) + { + setHarvestLevel(toolClass, level, itr.next()); 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 index fa04998cf..c8c22a6eb 100644 --- a/patches/minecraft/net/minecraft/block/BlockBush.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockBush.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/block/BlockBush.java +++ ../src-work/minecraft/net/minecraft/block/BlockBush.java -@@ -12,7 +12,7 @@ +@@ -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"; - -@@ -32,7 +32,7 @@ + protected BlockBush() + { +@@ -36,7 +36,7 @@ public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { @@ -18,7 +18,7 @@ } protected boolean func_149854_a(Block p_149854_1_) -@@ -62,7 +62,10 @@ +@@ -66,7 +66,10 @@ public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_) { @@ -30,7 +30,7 @@ } public AxisAlignedBB func_180640_a(World p_180640_1_, BlockPos p_180640_2_, IBlockState p_180640_3_) -@@ -85,4 +88,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 87fff1207..58cd17706 100644 --- a/patches/minecraft/net/minecraft/block/BlockButton.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockButton.java.patch @@ -1,46 +1,12 @@ --- ../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.*; +@@ -74,8 +74,7 @@ - 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_) + protected static boolean func_181088_a(World p_181088_0_, BlockPos p_181088_1_, EnumFacing p_181088_2_) { -- 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); +- 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_.func_176734_d()); } - 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/BlockCactus.java.patch b/patches/minecraft/net/minecraft/block/BlockCactus.java.patch index af39372ed..17dfb0356 100644 --- a/patches/minecraft/net/minecraft/block/BlockCactus.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCactus.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockCactus.java +++ ../src-work/minecraft/net/minecraft/block/BlockCactus.java -@@ -19,7 +19,7 @@ +@@ -18,7 +18,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -8,8 +8,8 @@ +public class BlockCactus extends Block implements net.minecraftforge.common.IPlantable { public static final PropertyInteger field_176587_a = PropertyInteger.func_177719_a("age", 0, 15); - private static final String __OBFID = "CL_00000210"; -@@ -115,7 +115,7 @@ + +@@ -109,7 +109,7 @@ } Block block = p_176586_1_.func_180495_p(p_176586_2_.func_177977_b()).func_177230_c(); @@ -18,7 +18,7 @@ } public void func_180634_a(World p_180634_1_, BlockPos p_180634_2_, IBlockState p_180634_3_, Entity p_180634_4_) -@@ -143,4 +143,16 @@ +@@ -137,4 +137,16 @@ { return new BlockState(this, new IProperty[] {field_176587_a}); } diff --git a/patches/minecraft/net/minecraft/block/BlockChest.java.patch b/patches/minecraft/net/minecraft/block/BlockChest.java.patch index 1ab56e42b..90f209e19 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 -@@ -531,7 +531,7 @@ +@@ -527,7 +527,7 @@ private boolean func_176456_n(World p_176456_1_, BlockPos p_176456_2_) { diff --git a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch index cffac2037..5ecbf9a68 100644 --- a/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCocoa.java.patch @@ -4,7 +4,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_) { -- int j = ((Integer)p_180653_3_.func_177229_b(field_176501_a)).intValue(); +- 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_); + } + @@ -12,13 +12,13 @@ + 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; ++ int i = ((Integer)state.func_177229_b(field_176501_a)).intValue(); + int j = 1; - if (j >= 2) + if (i >= 2) @@ -147,8 +154,9 @@ - for (int k = 0; k < b0; ++k) + for (int k = 0; k < j; ++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())); diff --git a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch index a9d87a8ea..ed9298153 100644 --- a/patches/minecraft/net/minecraft/block/BlockCrops.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockCrops.java.patch @@ -1,20 +1,20 @@ --- ../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 = p_180672_1_.func_180495_p(blockpos1.func_177982_a(i, 0, j)); + IBlockState iblockstate = p_180672_1_.func_180495_p(blockpos.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_)) ++ 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.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))) ++ if (iblockstate.func_177230_c().isFertile(p_180672_1_, blockpos.func_177982_a(i, 0, j))) { f1 = 3.0F; } -@@ -127,7 +127,7 @@ +@@ -126,7 +126,7 @@ public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_) { @@ -23,22 +23,22 @@ } protected Item func_149866_i() -@@ -143,24 +143,6 @@ +@@ -142,24 +142,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(); +- int i = ((Integer)p_180653_3_.func_177229_b(field_176488_a)).intValue(); - -- if (j >= 7) +- if (i >= 7) - { -- int k = 3 + p_180653_5_; +- int j = 3 + p_180653_5_; - -- for (int l = 0; l < k; ++l) +- for (int k = 0; k < j; ++k) - { -- if (p_180653_1_.field_73012_v.nextInt(15) <= j) +- if (p_180653_1_.field_73012_v.nextInt(15) <= i) - { - func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(this.func_149866_i(), 1, 0)); - } @@ -48,7 +48,7 @@ } public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) -@@ -203,4 +185,26 @@ +@@ -202,4 +184,26 @@ { return new BlockState(this, new IProperty[] {field_176488_a}); } diff --git a/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch b/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch index daeef6fe3..a350513b4 100644 --- a/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockDeadBush.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/block/BlockDeadBush.java +++ ../src-work/minecraft/net/minecraft/block/BlockDeadBush.java -@@ -13,7 +13,7 @@ +@@ -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"; - -@@ -41,14 +41,15 @@ + protected BlockDeadBush() + { +@@ -45,14 +45,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_) { diff --git a/patches/minecraft/net/minecraft/block/BlockDoor.java.patch b/patches/minecraft/net/minecraft/block/BlockDoor.java.patch index c30049e6b..de31efb01 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 -@@ -149,7 +149,7 @@ +@@ -154,7 +154,7 @@ { if (this.field_149764_J == Material.field_151573_f) { @@ -9,7 +9,7 @@ } else { -@@ -267,7 +267,7 @@ +@@ -272,7 +272,7 @@ public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { diff --git a/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch b/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch index 8fe63ab74..2218435af 100644 --- a/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockDoublePlant.java.patch @@ -1,31 +1,31 @@ --- ../src-base/minecraft/net/minecraft/block/BlockDoublePlant.java +++ ../src-work/minecraft/net/minecraft/block/BlockDoublePlant.java -@@ -24,7 +24,7 @@ +@@ -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 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; + 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 : 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.func_176226_b(p_176475_1_, p_176475_2_, p_176475_3_, 0); //Forge move above the setting to air. + - if (object == this) + if (block == this) + { + p_176475_1_.func_180501_a(blockpos, Blocks.field_150350_a.func_176223_P(), 2); +@@ -98,17 +100,13 @@ + if (block1 == 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); +- this.func_176226_b(p_176475_1_, blockpos1, p_176475_3_, 0); - } } } @@ -37,7 +37,7 @@ 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 @@ +@@ -158,7 +156,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_) { @@ -45,16 +45,16 @@ { super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); } -@@ -220,8 +217,6 @@ +@@ -221,8 +218,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(); +- 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; } } -@@ -296,6 +291,32 @@ +@@ -293,6 +288,32 @@ return Block.EnumOffsetType.XZ; } @@ -84,6 +84,6 @@ + return world.func_175698_g(pos); + } + - static enum EnumBlockHalf implements IStringSerializable + 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 index c7dd1fa25..811cb1a2c 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 -@@ -85,6 +85,7 @@ +@@ -86,6 +86,7 @@ public static boolean func_180685_d(World p_180685_0_, BlockPos p_180685_1_) { diff --git a/patches/minecraft/net/minecraft/block/BlockFire.java.patch b/patches/minecraft/net/minecraft/block/BlockFire.java.patch index 989c8cb5b..05ab962bc 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 = p_176221_3_.func_177956_o(); int k = p_176221_3_.func_177952_p(); @@ -28,7 +28,7 @@ } else { -@@ -109,6 +115,7 @@ +@@ -108,6 +114,7 @@ public void func_180686_a(Block p_180686_1_, int p_180686_2_, int p_180686_3_) { @@ -36,7 +36,7 @@ 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 @@ +@@ -147,13 +154,8 @@ } Block block = p_180650_1_.func_180495_p(p_180650_2_.func_177977_b()).func_177230_c(); @@ -51,7 +51,7 @@ 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 @@ +@@ -182,7 +184,7 @@ return; } @@ -60,26 +60,26 @@ { p_180650_1_.func_175698_g(p_180650_2_); return; -@@ -198,12 +200,12 @@ - b0 = -50; +@@ -197,12 +199,12 @@ + j = -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); +- 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 j = -1; j <= 1; ++j) + for (int k = -1; k <= 1; ++k) { -@@ -262,22 +264,30 @@ +@@ -261,22 +263,30 @@ return false; } @@ -100,36 +100,36 @@ + @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()); +- 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 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); ++ int i = 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) + if (p_176536_4_.nextInt(p_176536_3_) < i) { IBlockState iblockstate = p_176536_1_.func_180495_p(p_176536_2_); -@@ -314,7 +324,7 @@ +@@ -308,7 +318,7 @@ + { + for (EnumFacing enumfacing : EnumFacing.values()) { - 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) +@@ -329,7 +339,7 @@ + + for (EnumFacing enumfacing : EnumFacing.values()) { - 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 @@ +@@ -341,9 +351,10 @@ return false; } @@ -141,9 +141,9 @@ } public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) -@@ -396,9 +407,9 @@ - double d1; - double d2; +@@ -382,9 +393,9 @@ + 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.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)) @@ -151,45 +151,45 @@ - 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) + for (int j = 0; j < 2; ++j) { -@@ -409,7 +420,7 @@ +@@ -395,7 +406,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) + for (int k = 0; k < 2; ++k) { -@@ -420,7 +431,7 @@ +@@ -406,7 +417,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) + for (int l = 0; l < 2; ++l) { -@@ -431,7 +442,7 @@ +@@ -417,7 +428,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) + for (int i1 = 0; i1 < 2; ++i1) { -@@ -442,7 +453,7 @@ +@@ -428,7 +439,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) + for (int j1 = 0; j1 < 2; ++j1) { -@@ -490,4 +501,19 @@ +@@ -476,4 +487,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}); } diff --git a/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch b/patches/minecraft/net/minecraft/block/BlockFlowerPot.java.patch index fc892d51e..24229b07b 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 -@@ -162,13 +162,6 @@ +@@ -169,13 +169,6 @@ public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_) { @@ -14,7 +14,7 @@ super.func_180663_b(p_180663_1_, p_180663_2_, p_180663_3_); } -@@ -388,6 +381,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 dec4d1514..7f957e591 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 (!p_180650_1_.field_72995_K) { @@ -9,33 +9,21 @@ { 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); +@@ -72,7 +72,7 @@ + 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 (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) +- 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) { - p_180650_1_.func_175656_a(blockpos1, Blocks.field_150349_c.func_176223_P()); + p_180650_1_.func_175656_a(blockpos, 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)) +@@ -110,7 +110,7 @@ + { + if (j >= i / 16) { - 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 +- 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 (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 6f2f73437..cfc4d531f 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 -@@ -64,6 +64,20 @@ +@@ -79,6 +79,20 @@ return new BlockState(this, new IProperty[] {field_176380_a}); } diff --git a/patches/minecraft/net/minecraft/block/BlockIce.java.patch b/patches/minecraft/net/minecraft/block/BlockIce.java.patch index b4f3090b0..b2ff04fe6 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 @@ p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]); p_180657_2_.func_71020_j(0.025F); @@ -23,7 +23,7 @@ } else { -@@ -58,7 +61,9 @@ +@@ -56,7 +59,9 @@ } int i = EnchantmentHelper.func_77517_e(p_180657_2_); diff --git a/patches/minecraft/net/minecraft/block/BlockLadder.java.patch b/patches/minecraft/net/minecraft/block/BlockLadder.java.patch index b72f616a4..84fa2d3db 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 -@@ -80,7 +80,10 @@ +@@ -78,7 +78,10 @@ public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { @@ -12,7 +12,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_) -@@ -124,7 +127,7 @@ +@@ -116,7 +119,7 @@ protected boolean func_176381_b(World p_176381_1_, BlockPos p_176381_2_, EnumFacing p_176381_3_) { @@ -20,13 +20,11 @@ + 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 @@ + public IBlockState func_176203_a(int p_176203_1_) +@@ -146,4 +149,6 @@ + { 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]; ++ @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 270eade4c..4dcb42a4d 100644 --- a/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLeaves.java.patch @@ -9,77 +9,73 @@ { 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); +@@ -75,9 +75,9 @@ + BlockPos blockpos = p_180663_2_.func_177982_a(j1, k1, l1); + IBlockState iblockstate = p_180663_1_.func_180495_p(blockpos); -- 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)) +- 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)) { -- 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); +- 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); } } } -@@ -119,11 +119,12 @@ - { - for (i2 = -b0; i2 <= b0; ++i2) +@@ -117,9 +117,9 @@ { -- 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(); + 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.field_150364_r && block != Blocks.field_150363_s) -+ if (!block.canSustainLeaves(p_180650_1_, tmp)) ++ if (!block.canSustainLeaves(p_180650_1_, 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_, tmp)) ++ if (block.isLeaves(p_180650_1_, blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2))) { - this.field_150128_a[(k1 + j1) * i1 + (l1 + j1) * b1 + i2 + j1] = -2; + this.field_150128_a[(i2 + l1) * k1 + (j2 + l1) * j1 + k2 + l1] = -2; } -@@ -230,40 +231,7 @@ +@@ -226,40 +226,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_); +- int i = this.func_176232_d(p_180653_3_); - - if (p_180653_5_ > 0) - { -- j -= 2 << p_180653_5_; +- i -= 2 << p_180653_5_; - -- if (j < 10) +- if (i < 10) - { -- j = 10; +- i = 10; - } - } - -- if (p_180653_1_.field_73012_v.nextInt(j) == 0) +- if (p_180653_1_.field_73012_v.nextInt(i) == 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; +- i = 200; - - if (p_180653_5_ > 0) - { -- j -= 10 << p_180653_5_; +- i -= 10 << p_180653_5_; - -- if (j < 40) +- if (i < 40) - { -- j = 40; +- i = 40; - } - } - -- this.func_176234_a(p_180653_1_, p_180653_2_, p_180653_3_, j); +- this.func_176234_a(p_180653_1_, p_180653_2_, p_180653_3_, i); - } + 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 @@ + 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 func_176233_b(int p_176233_1_); diff --git a/patches/minecraft/net/minecraft/block/BlockLever.java.patch b/patches/minecraft/net/minecraft/block/BlockLever.java.patch index ff826eb16..7bee93321 100644 --- a/patches/minecraft/net/minecraft/block/BlockLever.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLever.java.patch @@ -1,58 +1,6 @@ --- ../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 @@ +@@ -237,6 +237,12 @@ 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 39ddc1c69..a6247c0c2 100644 --- a/patches/minecraft/net/minecraft/block/BlockLog.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockLog.java.patch @@ -1,18 +1,18 @@ --- ../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); +@@ -33,9 +33,9 @@ + { + IBlockState iblockstate = p_180663_1_.func_180495_p(blockpos); -- 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)) +- 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)) { -- 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); +- 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); } } } -@@ -51,6 +51,9 @@ +@@ -46,6 +46,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())); } diff --git a/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch b/patches/minecraft/net/minecraft/block/BlockMobSpawner.java.patch index cdc8c9e42..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 -@@ -39,10 +39,14 @@ +@@ -37,10 +37,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); +- 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 diff --git a/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch b/patches/minecraft/net/minecraft/block/BlockMushroom.java.patch index bf17395b9..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 -@@ -76,7 +76,7 @@ +@@ -71,7 +71,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)); + 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 4a2c0ac2c..c7bd1a280 100644 --- a/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockMycelium.java.patch @@ -10,11 +10,11 @@ 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(); + 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 (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) +- 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) { - p_180650_1_.func_175656_a(blockpos1, this.func_176223_P()); + 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 374e2ef64..959b41a0b 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 -@@ -36,7 +36,7 @@ +@@ -38,7 +38,7 @@ public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_) { @@ -9,7 +9,7 @@ } 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 @@ +@@ -54,9 +54,11 @@ super.func_180650_b(p_180650_1_, p_180650_2_, p_180650_3_, p_180650_4_); } @@ -20,9 +20,9 @@ + 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; + int i = 1; -@@ -105,4 +107,24 @@ +@@ -107,4 +109,24 @@ { return new BlockState(this, new IProperty[] {field_176486_a}); } diff --git a/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch b/patches/minecraft/net/minecraft/block/BlockNewLeaf.java.patch index 150aabf9e..9cfc32668 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 -@@ -105,14 +105,15 @@ +@@ -99,14 +99,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_) { diff --git a/patches/minecraft/net/minecraft/block/BlockNote.java.patch b/patches/minecraft/net/minecraft/block/BlockNote.java.patch index dd913e8f5..6899eb877 100644 --- a/patches/minecraft/net/minecraft/block/BlockNote.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockNote.java.patch @@ -8,9 +8,9 @@ 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); } - -@@ -96,6 +98,10 @@ +@@ -98,6 +100,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_) { diff --git a/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch b/patches/minecraft/net/minecraft/block/BlockOldLeaf.java.patch index b3bd13fbe..c81ddd561 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 -@@ -148,11 +148,17 @@ +@@ -142,11 +142,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)]); diff --git a/patches/minecraft/net/minecraft/block/BlockOre.java.patch b/patches/minecraft/net/minecraft/block/BlockOre.java.patch index 8c026c147..a08f33dec 100644 --- a/patches/minecraft/net/minecraft/block/BlockOre.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockOre.java.patch @@ -1,14 +1,6 @@ --- ../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 @@ +@@ -58,34 +58,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_); @@ -16,42 +8,42 @@ - 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) ++ public int getExpDrop(net.minecraft.world.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; + int i = 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); +- 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.field_150482_ag) { -- j = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 3, 7); -+ j = MathHelper.func_76136_a(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.field_150412_bA) { -- j = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 3, 7); -+ j = MathHelper.func_76136_a(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.field_150369_x) { -- j = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 2, 5); -+ j = MathHelper.func_76136_a(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.field_150449_bY) { -- j = MathHelper.func_76136_a(p_180653_1_.field_73012_v, 2, 5); -+ j = MathHelper.func_76136_a(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.func_180637_b(p_180653_1_, p_180653_2_, j); -+ return j; +- this.func_180637_b(p_180653_1_, p_180653_2_, i); ++ return i; } + return 0; } diff --git a/patches/minecraft/net/minecraft/block/BlockPane.java.patch b/patches/minecraft/net/minecraft/block/BlockPane.java.patch index eb7aee52d..bf26e9faf 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 func_176221_a(IBlockState p_176221_1_, IBlockAccess p_176221_2_, BlockPos p_176221_3_) { @@ -12,9 +12,9 @@ } public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) -@@ -65,10 +68,10 @@ +@@ -64,10 +67,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_) + 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()); @@ -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[] {field_176241_b, field_176242_M, field_176244_O, field_176243_N}); } diff --git a/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch b/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch index 20426bd9d..db2e7cfae 100644 --- a/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockPistonBase.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java +++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java -@@ -200,7 +200,7 @@ +@@ -189,7 +189,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)) +- 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.func_176319_a(p_180648_1_, p_180648_2_, enumfacing, false); } -@@ -344,7 +344,7 @@ +@@ -333,7 +333,7 @@ return false; } @@ -18,14 +18,14 @@ } else { -@@ -384,7 +384,9 @@ +@@ -371,7 +371,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); + BlockPos blockpos = (BlockPos)list1.get(j); + 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.func_180653_a(p_176319_1_, blockpos1, p_176319_1_.func_180495_p(blockpos1), chance, 0); - p_176319_1_.func_175698_g(blockpos1); ++ 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 4f2d1c8a0..3ba28b443 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 func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { @@ -10,15 +10,15 @@ - - if (tileentitypiston != null) - { -- IBlockState iblockstate1 = tileentitypiston.func_174927_b(); -- iblockstate1.func_177230_c().func_176226_b(p_180653_1_, p_180653_2_, iblockstate1, 0); +- IBlockState iblockstate = tileentitypiston.func_174927_b(); +- iblockstate.func_177230_c().func_176226_b(p_180653_1_, p_180653_2_, iblockstate, 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 @@ +@@ -282,4 +273,16 @@ { return new BlockState(this, new IProperty[] {field_176426_a, field_176425_b}); } diff --git a/patches/minecraft/net/minecraft/block/BlockPotato.java.patch b/patches/minecraft/net/minecraft/block/BlockPotato.java.patch index 2adf70eee..f507e3336 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 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_); diff --git a/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch b/patches/minecraft/net/minecraft/block/BlockPumpkin.java.patch index 87ac6e5da..256bace07 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 -@@ -109,7 +109,7 @@ +@@ -115,7 +115,7 @@ public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { diff --git a/patches/minecraft/net/minecraft/block/BlockQuartz.java.patch b/patches/minecraft/net/minecraft/block/BlockQuartz.java.patch index 6a6a75d2a..b78be41ea 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[] {field_176335_a}); } diff --git a/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch b/patches/minecraft/net/minecraft/block/BlockRailBase.java.patch index 8c3b15468..9f7a36165 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 -@@ -33,7 +33,7 @@ +@@ -31,7 +31,7 @@ public static boolean func_176563_d(IBlockState p_176563_0_) { Block block = p_176563_0_.func_177230_c(); @@ -9,10 +9,10 @@ } protected BlockRailBase(boolean p_i45389_1_) -@@ -174,7 +174,81 @@ - } +@@ -175,6 +175,81 @@ + + public abstract IProperty func_176560_l(); - public abstract IProperty func_176560_l(); + /* ======================================== FORGE START =====================================*/ + /** + * Return true if the rail can make corners. @@ -25,7 +25,7 @@ + { + return !this.field_150053_a; + } - ++ + /** + * Returns true if the rail can make up and down slopes. + * Used by placement logic. @@ -91,57 +91,57 @@ public static enum EnumRailDirection implements IStringSerializable { NORTH_SOUTH(0, "north_south"), -@@ -251,6 +325,7 @@ +@@ -245,6 +320,7 @@ + private IBlockState field_180366_e; private final boolean field_150656_f; - private final List field_150657_g = Lists.newArrayList(); - private static final String __OBFID = "CL_00000196"; + private final List field_150657_g = Lists.newArrayList(); + private final boolean canMakeSlopes; public Rail(World p_i45739_2_, BlockPos p_i45739_3_, IBlockState p_i45739_4_) { -@@ -259,7 +334,8 @@ +@@ -253,7 +329,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()); + 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(enumraildirection); + this.func_180360_a(blockrailbase$enumraildirection); } -@@ -448,7 +524,7 @@ +@@ -439,7 +516,7 @@ } } -- if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) -+ if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) +- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) ++ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) { if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos.func_177984_a())) { -@@ -461,7 +537,7 @@ +@@ -452,7 +529,7 @@ } } -- if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) -+ if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) +- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) ++ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) { if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos3.func_177984_a())) { -@@ -604,7 +680,7 @@ +@@ -595,7 +672,7 @@ } } -- if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) -+ if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) +- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) ++ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes) { if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos.func_177984_a())) { -@@ -617,7 +693,7 @@ +@@ -608,7 +685,7 @@ } } -- if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) -+ if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) +- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) ++ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes) { if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos3.func_177984_a())) { diff --git a/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch b/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch index b2ed5d2dc..fe20ed8f6 100644 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneDiode.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/block/BlockRedstoneDiode.java +++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneDiode.java -@@ -200,6 +200,8 @@ +@@ -198,6 +198,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()); + 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; - p_176400_1_.func_180496_d(blockpos1, this); - p_176400_1_.func_175695_a(blockpos1, 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 7716b8837..daefa904e 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 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_); @@ -12,8 +12,8 @@ + { + 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); +- 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 b6a66a746..69aa76b4d 100644 --- a/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRedstoneWire.java.patch @@ -1,24 +1,24 @@ --- ../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_); +@@ -58,10 +58,10 @@ + 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 (!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))) +- 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 = 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; +- 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 { -@@ -393,35 +393,25 @@ +@@ -359,35 +359,24 @@ 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))); +- 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 func_176340_e(IBlockAccess p_176340_0_, BlockPos p_176340_1_) @@ -26,8 +26,7 @@ { - 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); @@ -38,6 +37,7 @@ - Block block = p_176343_0_.func_177230_c(); - - if (block == Blocks.field_150488_af) ++ IBlockState state = world.func_180495_p(pos); + if (state.func_177230_c() == Blocks.field_150488_af) { return true; @@ -45,8 +45,8 @@ - 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 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; } diff --git a/patches/minecraft/net/minecraft/block/BlockReed.java.patch b/patches/minecraft/net/minecraft/block/BlockReed.java.patch index ed23377c2..95f05667f 100644 --- a/patches/minecraft/net/minecraft/block/BlockReed.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockReed.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockReed.java +++ ../src-work/minecraft/net/minecraft/block/BlockReed.java -@@ -19,7 +19,7 @@ +@@ -18,7 +18,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -8,8 +8,8 @@ +public class BlockReed extends Block implements net.minecraftforge.common.IPlantable { public static final PropertyInteger field_176355_a = PropertyInteger.func_177719_a("age", 0, 15); - private static final String __OBFID = "CL_00000300"; -@@ -67,6 +67,7 @@ + +@@ -65,6 +65,7 @@ public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { Block block = p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_177230_c(); @@ -17,7 +17,7 @@ if (block == this) { -@@ -172,4 +173,15 @@ +@@ -164,4 +165,15 @@ { return new BlockState(this, new IProperty[] {field_176355_a}); } diff --git a/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch b/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch index dd9715ed0..bd3714927 100644 --- a/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockRotatedPillar.java.patch @@ -1,22 +1,14 @@ --- ../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 @@ +@@ -18,4 +18,18 @@ { - super(p_i45425_1_); + super(p_i46385_1_, p_i46385_2_); } + + 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()) ++ 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.func_177701_a().equals("axis")) + { diff --git a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch b/patches/minecraft/net/minecraft/block/BlockSapling.java.patch index b7fa64ce7..1bef67eb0 100644 --- a/patches/minecraft/net/minecraft/block/BlockSapling.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSapling.java.patch @@ -1,10 +1,10 @@ --- ../src-base/minecraft/net/minecraft/block/BlockSapling.java +++ ../src-work/minecraft/net/minecraft/block/BlockSapling.java -@@ -66,6 +66,7 @@ +@@ -71,6 +71,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); + 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 9fd41a780..3ec9807b9 100644 --- a/patches/minecraft/net/minecraft/block/BlockSkull.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSkull.java.patch @@ -1,15 +1,17 @@ --- ../src-base/minecraft/net/minecraft/block/BlockSkull.java +++ ../src-work/minecraft/net/minecraft/block/BlockSkull.java -@@ -122,8 +122,6 @@ +@@ -121,10 +121,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_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 @@ +@@ -132,13 +128,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); } @@ -29,7 +31,7 @@ { if (!((Boolean)p_180663_3_.func_177229_b(field_176417_b)).booleanValue()) { -@@ -146,7 +149,7 @@ +@@ -147,7 +148,7 @@ if (tileentity instanceof TileEntitySkull) { TileEntitySkull tileentityskull = (TileEntitySkull)tileentity; @@ -38,7 +40,7 @@ if (tileentityskull.func_145904_a() == 3 && tileentityskull.func_152108_a() != null) { -@@ -156,12 +159,11 @@ +@@ -157,12 +158,11 @@ itemstack.func_77978_p().func_74782_a("SkullOwner", nbttagcompound); } 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/BlockSnow.java.patch b/patches/minecraft/net/minecraft/block/BlockSnow.java.patch index c7c1efbf1..cc8659d20 100644 --- a/patches/minecraft/net/minecraft/block/BlockSnow.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockSnow.java.patch @@ -1,15 +1,15 @@ --- ../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 = 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.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 @@ +@@ -91,7 +91,6 @@ { if (!this.func_176196_c(p_176314_1_, p_176314_2_)) { @@ -17,7 +17,7 @@ p_176314_1_.func_175698_g(p_176314_2_); return false; } -@@ -104,9 +103,8 @@ +@@ -103,9 +102,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_) { @@ -28,7 +28,7 @@ } public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) -@@ -116,14 +114,13 @@ +@@ -115,14 +113,13 @@ public int func_149745_a(Random p_149745_1_) { @@ -44,7 +44,7 @@ p_180650_1_.func_175698_g(p_180650_2_); } } -@@ -153,4 +150,6 @@ +@@ -152,4 +149,6 @@ { return new BlockState(this, new IProperty[] {field_176315_a}); } 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; diff --git a/patches/minecraft/net/minecraft/block/BlockStem.java.patch b/patches/minecraft/net/minecraft/block/BlockStem.java.patch index ab4a31800..90fd806ba 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 -@@ -108,7 +108,7 @@ +@@ -94,7 +94,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(); @@ -9,7 +9,7 @@ { p_180650_1_.func_175656_a(p_180650_2_, this.field_149877_a.func_176223_P()); } -@@ -162,24 +162,29 @@ +@@ -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.func_180653_a(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_4_, p_180653_5_); @@ -25,13 +25,13 @@ 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(); +- 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 k = 0; k < 3; ++k) + for (int j = 0; j < 3; ++j) { -- if (p_180653_1_.field_73012_v.nextInt(15) <= j) -+ if (RANDOM.nextInt(15) <= j) +- if (p_180653_1_.field_73012_v.nextInt(15) <= i) ++ if (RANDOM.nextInt(15) <= i) { - func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(item)); + ret.add(new ItemStack(item)); diff --git a/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch b/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch index df5c0a009..e9629da02 100644 --- a/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTallGrass.java.patch @@ -7,9 +7,9 @@ -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 static final PropertyEnum field_176497_a = PropertyEnum.func_177709_a("type", BlockTallGrass.EnumType.class); + +@@ -43,7 +43,7 @@ public boolean func_180671_f(World p_180671_1_, BlockPos p_180671_2_, IBlockState p_180671_3_) { @@ -18,7 +18,7 @@ } public boolean func_176200_f(World p_176200_1_, BlockPos p_176200_2_) -@@ -74,7 +74,7 @@ +@@ -53,7 +53,7 @@ public Item func_180660_a(IBlockState p_180660_1_, Random p_180660_2_, int p_180660_3_) { @@ -27,7 +27,7 @@ } public int func_149679_a(int p_149679_1_, Random p_149679_2_) -@@ -84,13 +84,7 @@ +@@ -63,13 +63,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_) { @@ -41,7 +41,7 @@ super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); } } -@@ -210,4 +204,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 b7a92250f..ec723e30d 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 -@@ -70,7 +70,7 @@ +@@ -63,7 +63,7 @@ else { Block block = p_176594_1_.func_180495_p(p_176594_2_).func_177230_c(); @@ -9,30 +9,30 @@ } } -@@ -97,7 +97,7 @@ +@@ -84,7 +84,7 @@ { - BlockPos blockpos1 = p_176595_2_.func_177972_a(p_176595_3_.func_176734_d()); + 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(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); +- 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 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 @@ +@@ -97,7 +97,7 @@ + { + for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) + { +- 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.func_176223_P().func_177226_a(field_176596_a, enumfacing); + } +@@ -130,7 +130,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)) +- 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), enumfacing, true)) { flag = true; } diff --git a/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch b/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch index 21ca8d0d9..0eb19ae31 100644 --- a/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockTrapDoor.java.patch @@ -8,20 +8,20 @@ + 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 @@ + public static final PropertyEnum field_176285_M = PropertyEnum.func_177709_a("half", BlockTrapDoor.DoorHalf.class); +@@ -140,9 +142,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()); + BlockPos blockpos = 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))) +- 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))) { 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 @@ +@@ -186,7 +189,10 @@ public boolean func_176198_a(World p_176198_1_, BlockPos p_176198_2_, EnumFacing p_176198_3_) { @@ -33,7 +33,7 @@ } protected static EnumFacing func_176281_b(int p_176281_0_) -@@ -224,6 +230,7 @@ +@@ -223,6 +229,7 @@ private static boolean func_150119_a(Block p_150119_0_) { diff --git a/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch b/patches/minecraft/net/minecraft/block/BlockTripWireHook.java.patch index f5b18908b..6a6ba2054 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 -@@ -60,7 +60,7 @@ +@@ -58,14 +58,14 @@ public boolean func_176198_a(World p_176198_1_, BlockPos p_176198_2_, EnumFacing p_176198_3_) { @@ -9,16 +9,15 @@ } 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 @@ + { + for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) + { +- 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)p_176204_3_.func_177229_b(field_176264_a); diff --git a/patches/minecraft/net/minecraft/block/BlockVine.java.patch b/patches/minecraft/net/minecraft/block/BlockVine.java.patch index 5436620a3..e64d0dd18 100644 --- a/patches/minecraft/net/minecraft/block/BlockVine.java.patch +++ b/patches/minecraft/net/minecraft/block/BlockVine.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/block/BlockVine.java +++ ../src-work/minecraft/net/minecraft/block/BlockVine.java -@@ -26,7 +26,7 @@ +@@ -25,7 +25,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -9,7 +9,7 @@ { public static final PropertyBool field_176277_a = PropertyBool.func_177716_a("up"); public static final PropertyBool field_176273_b = PropertyBool.func_177716_a("north"); -@@ -416,13 +416,7 @@ +@@ -387,13 +387,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_) { @@ -23,10 +23,10 @@ super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_); } } -@@ -508,6 +502,16 @@ +@@ -474,4 +468,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; } @@ -37,6 +37,4 @@ + } + /*************************FORGE END***********************************/ + - static final class SwitchEnumFacing - { - static final int[] field_177057_a = new int[EnumFacing.values().length]; + } diff --git a/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch b/patches/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java.patch index aaff29d17..9b66c108c 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 -@@ -80,7 +80,7 @@ +@@ -78,7 +78,7 @@ { Block block = this.field_177261_a.func_180495_p(p_177251_1_).func_177230_c(); @@ -9,21 +9,21 @@ { 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(); +@@ -109,7 +109,7 @@ + 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.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)) +- 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; } -@@ -159,7 +159,7 @@ +@@ -156,7 +156,7 @@ - block = this.field_177261_a.func_180495_p(blockpos2).func_177230_c(); + block = this.field_177261_a.func_180495_p(blockpos1).func_177230_c(); - if (block.func_149688_o() == Material.field_151579_a) -+ if (block.isAir(field_177261_a, blockpos2)) ++ 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 7168f0548..8d775ed11 100644 --- a/patches/minecraft/net/minecraft/block/state/BlockState.java.patch +++ b/patches/minecraft/net/minecraft/block/state/BlockState.java.patch @@ -1,48 +1,48 @@ --- ../src-base/minecraft/net/minecraft/block/state/BlockState.java +++ ../src-work/minecraft/net/minecraft/block/state/BlockState.java -@@ -47,6 +47,16 @@ +@@ -38,6 +38,16 @@ - public BlockState(Block p_i45663_1_, IProperty ... p_i45663_2_) + public BlockState(Block p_i45663_1_, IProperty... p_i45663_2_) { + this(p_i45663_1_, p_i45663_2_, 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 p_i45663_1_, IProperty[] p_i45663_2_, ImmutableMap unlistedProperties) ++ protected BlockState(Block p_i45663_1_, IProperty[] p_i45663_2_, ImmutableMap, com.google.common.base.Optional> unlistedProperties) + { this.field_177627_c = p_i45663_1_; - Arrays.sort(p_i45663_2_, new Comparator() + Arrays.sort(p_i45663_2_, new Comparator() { -@@ -70,7 +80,7 @@ +@@ -53,7 +63,7 @@ + for (List list1 : Cartesian.func_179321_a(this.func_177620_e())) { - 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); - linkedhashmap.put(map, stateimplementation); - arraylist.add(stateimplementation); + 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); } -@@ -135,6 +145,13 @@ - this.field_177239_a = p_i45660_1_; - this.field_177237_b = p_i45660_2_; +@@ -132,6 +142,13 @@ + } } -+ -+ protected StateImplementation(Block blockIn, ImmutableMap propertiesIn, ImmutableTable propertyValueTable) + ++ protected StateImplementation(Block blockIn, ImmutableMap propertiesIn, ImmutableTable propertyValueTable) + { + this.field_177239_a = blockIn; + this.field_177237_b = propertiesIn; + this.field_177238_c = propertyValueTable; + } - - public Collection func_177227_a() ++ + public , V extends T> IBlockState func_177226_a(IProperty p_177226_1_, V p_177226_2_) { -@@ -231,5 +248,10 @@ - { - this(p_i45661_1_, p_i45661_2_); + if (!this.field_177237_b.containsKey(p_177226_1_)) +@@ -199,5 +216,10 @@ + map.put(p_177236_1_, p_177236_2_); + return map; } + + public ImmutableTable getPropertyValueTable() diff --git a/patches/minecraft/net/minecraft/block/state/BlockStateBase.java.patch b/patches/minecraft/net/minecraft/block/state/BlockStateBase.java.patch index 9587997da..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 -@@ -76,4 +76,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 9cbf23085..2d8b6e47e 100644 --- a/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/LoadingScreenRenderer.java.patch @@ -11,10 +11,10 @@ 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 @@ +@@ -174,6 +178,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); + 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) diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 28fcaf824..15098b70c 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 -@@ -296,7 +296,6 @@ +@@ -301,7 +301,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()); @@ -8,7 +8,7 @@ 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 @@ +@@ -415,10 +414,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); @@ -21,7 +21,7 @@ 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 @@ +@@ -453,6 +452,8 @@ } }); this.field_71417_B = new MouseHelper(); @@ -30,7 +30,7 @@ this.func_71361_d("Pre startup"); GlStateManager.func_179098_w(); GlStateManager.func_179103_j(7425); -@@ -463,17 +464,21 @@ +@@ -466,17 +467,21 @@ GlStateManager.func_179096_D(); GlStateManager.func_179128_n(5888); this.func_71361_d("Startup"); @@ -53,7 +53,7 @@ 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 @@ +@@ -486,22 +491,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); @@ -82,7 +82,7 @@ if (this.field_71474_y.field_74353_u && !this.field_71431_Q) { this.func_71352_k(); -@@ -682,21 +690,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.func_179870_a(p_71377_1_.func_71502_e()); @@ -109,7 +109,7 @@ } public boolean func_152349_b() -@@ -888,11 +898,6 @@ +@@ -883,11 +893,6 @@ public void func_147108_a(GuiScreen p_147108_1_) { @@ -121,7 +121,7 @@ if (p_147108_1_ == null && this.field_71441_e == null) { p_147108_1_ = new GuiMainMenu(); -@@ -902,6 +907,17 @@ +@@ -897,6 +902,17 @@ p_147108_1_ = new GuiGameOver(); } @@ -139,28 +139,19 @@ 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 @@ +@@ -1030,9 +1046,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_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.field_71424_I.func_76319_b(); -@@ -1383,7 +1401,7 @@ +@@ -1377,7 +1395,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)) { @@ -170,37 +161,37 @@ } } @@ -1463,15 +1481,19 @@ - case 2: - BlockPos blockpos = this.field_71476_x.func_178782_a(); + case BLOCK: + 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; +- 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(); - } -+ } ++ 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) - { + 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 @@ + 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(); + } +@@ -1598,6 +1621,8 @@ --this.field_71467_ac; } @@ -215,7 +206,7 @@ { + if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue; + - i = Mouse.getEventButton(); + int i = Mouse.getEventButton(); KeyBinding.func_74510_a(i - 100, Mouse.getEventButtonState()); @@ -1745,6 +1772,7 @@ @@ -226,15 +217,15 @@ } if (this.field_71429_W > 0) -@@ -1921,6 +1949,7 @@ +@@ -1923,6 +1951,7 @@ } } } + net.minecraftforge.fml.common.FMLCommonHandler.instance().fireKeyInput(); } - for (i = 0; i < 9; ++i) -@@ -2121,12 +2150,15 @@ + for (int l = 0; l < 9; ++l) +@@ -2119,12 +2148,15 @@ this.field_71453_ak.func_74428_b(); } @@ -250,7 +241,7 @@ 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 @@ +@@ -2160,6 +2192,12 @@ while (!this.field_71437_Z.func_71200_ad()) { @@ -260,10 +251,10 @@ + func_147108_a(null); + return; + } - String s2 = this.field_71437_Z.func_71195_b_(); + String s = this.field_71437_Z.func_71195_b_(); - if (s2 != null) -@@ -2187,8 +2225,14 @@ + if (s != null) +@@ -2185,8 +2223,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)); @@ -280,7 +271,7 @@ this.field_71453_ak = networkmanager; } -@@ -2199,6 +2243,8 @@ +@@ -2197,6 +2241,8 @@ public void func_71353_a(WorldClient p_71353_1_, String p_71353_2_) { @@ -289,7 +280,7 @@ if (p_71353_1_ == null) { NetHandlerPlayClient nethandlerplayclient = this.func_147114_u(); -@@ -2212,6 +2258,18 @@ +@@ -2210,6 +2256,18 @@ { this.field_71437_Z.func_71263_m(); this.field_71437_Z.func_175592_a(); @@ -308,23 +299,23 @@ } this.field_71437_Z = null; -@@ -2238,6 +2296,7 @@ - +@@ -2232,6 +2290,7 @@ + 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.field_147127_av.func_147690_c(); -@@ -2342,134 +2401,11 @@ +@@ -2336,126 +2395,10 @@ 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; - +- Item item; +- - if (this.field_71476_x.field_72313_a == MovingObjectPosition.MovingObjectType.BLOCK) - { - BlockPos blockpos = this.field_71476_x.func_178782_a(); @@ -335,9 +326,9 @@ - return; - } - -- object = block.func_180665_b(this.field_71441_e, blockpos); +- item = block.func_180665_b(this.field_71441_e, blockpos); - -- if (object == null) +- if (item == null) - { - return; - } @@ -347,9 +338,9 @@ - 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; +- 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)object).func_77614_k(); +- flag1 = item.func_77614_k(); - } - else - { @@ -360,11 +351,11 @@ - - if (this.field_71476_x.field_72308_g instanceof EntityPainting) - { -- object = Items.field_151159_an; +- item = Items.field_151159_an; - } - else if (this.field_71476_x.field_72308_g instanceof EntityLeashKnot) - { -- object = Items.field_151058_ca; +- item = Items.field_151058_ca; - } - else if (this.field_71476_x.field_72308_g instanceof EntityItemFrame) - { @@ -373,11 +364,11 @@ - - if (itemstack == null) - { -- object = Items.field_151160_bD; +- item = Items.field_151160_bD; - } - else - { -- object = itemstack.func_77973_b(); +- item = itemstack.func_77973_b(); - i = itemstack.func_77960_j(); - flag1 = true; - } @@ -386,38 +377,38 @@ - { - EntityMinecart entityminecart = (EntityMinecart)this.field_71476_x.field_72308_g; - -- switch (Minecraft.SwitchEnumMinecartType.field_178901_b[entityminecart.func_180456_s().ordinal()]) +- switch (entityminecart.func_180456_s()) - { -- case 1: -- object = Items.field_151109_aJ; +- case FURNACE: +- item = Items.field_151109_aJ; - break; -- case 2: -- object = Items.field_151108_aI; +- case CHEST: +- item = Items.field_151108_aI; - break; -- case 3: -- object = Items.field_151142_bV; +- case TNT: +- item = Items.field_151142_bV; - break; -- case 4: -- object = Items.field_151140_bW; +- case HOPPER: +- item = Items.field_151140_bW; - break; -- case 5: -- object = Items.field_151095_cc; +- case COMMAND_BLOCK: +- item = Items.field_151095_cc; - break; - default: -- object = Items.field_151143_au; +- item = Items.field_151143_au; - } - } - else if (this.field_71476_x.field_72308_g instanceof EntityBoat) - { -- object = Items.field_151124_az; +- item = Items.field_151124_az; - } - else if (this.field_71476_x.field_72308_g instanceof EntityArmorStand) - { -- object = Items.field_179565_cj; +- item = Items.field_179565_cj; - } - else - { -- object = Items.field_151063_bx; +- item = Items.field_151063_bx; - i = EntityList.func_75619_a(this.field_71476_x.field_72308_g); - flag1 = true; - @@ -432,19 +423,11 @@ - if (tileentity == null) - { -- inventoryplayer.func_146030_a((Item)object, i, flag1, flag); +- inventoryplayer.func_146030_a(item, 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); +- ItemStack itemstack1 = this.func_181036_a(item, i, tileentity); - inventoryplayer.func_70299_a(inventoryplayer.field_70461_c, itemstack1); - } - @@ -453,13 +436,13 @@ if (flag) { int j = this.field_71439_g.field_71069_bz.field_75151_b.size() - 9 + inventoryplayer.field_70461_c; -@@ -2727,18 +2663,8 @@ +@@ -2756,18 +2699,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); +- 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) @@ -474,3 +457,15 @@ } 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 0aaeff108..90c31e791 100644 --- a/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch +++ b/patches/minecraft/net/minecraft/client/audio/SoundManager.java.patch @@ -1,52 +1,41 @@ --- ../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 @@ +@@ -69,6 +69,7 @@ { SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class); SoundSystemConfig.setCodec("ogg", CodecJOrbis.class); -+ MinecraftForge.EVENT_BUS.post(new SoundSetupEvent(this)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundSetupEvent(this)); } catch (SoundSystemException soundsystemexception) { -@@ -81,6 +86,7 @@ +@@ -80,6 +81,7 @@ { this.func_148613_b(); this.func_148608_i(); -+ MinecraftForge.EVENT_BUS.post(new SoundLoadEvent(this)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundLoadEvent(this)); } private synchronized void func_148608_i() -@@ -329,6 +335,9 @@ +@@ -316,6 +318,9 @@ } else { -+ p_148611_1_ = ForgeHooksClient.playSound(this, p_148611_1_); ++ p_148611_1_ = net.minecraftforge.client.ForgeHooksClient.playSound(this, p_148611_1_); + if (p_148611_1_ == null) return; + SoundEventAccessorComposite soundeventaccessorcomposite = this.field_148622_c.func_147680_a(p_148611_1_.func_147650_b()); if (soundeventaccessorcomposite == null) -@@ -370,10 +379,12 @@ +@@ -357,10 +362,12 @@ if (soundpoolentry.func_148648_d()) { 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)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlayStreamingSourceEvent(this, p_148611_1_, 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)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlaySoundSourceEvent(this, p_148611_1_, 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/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 4b546c294..8182064b7 100644 --- a/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch +++ b/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch @@ -1,16 +1,6 @@ --- ../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 @@ +@@ -345,6 +345,15 @@ this.field_71159_c.field_71456_v.func_146158_b().func_146227_a(p_146105_1_); } @@ -26,9 +16,9 @@ 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(); +@@ -357,30 +366,34 @@ + double d0 = p_145771_1_ - (double)blockpos.func_177958_n(); + double d1 = 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); @@ -37,44 +27,45 @@ + + if (inTranslucentBlock) { - byte b0 = -1; - double d5 = 9999.0D; + int i = -1; + double d2 = 9999.0D; -- if (this.func_175162_d(blockpos.func_177976_e()) && d3 < d5) -+ if (!this.isHeadspaceFree(blockpos.func_177976_e(), entHeight) && d3 < d5) +- if (this.func_175162_d(blockpos.func_177976_e()) && d0 < d2) ++ if (!this.isHeadspaceFree(blockpos.func_177976_e(), entHeight) && d0 < d2) { - d5 = d3; - b0 = 0; + d2 = d0; + i = 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) +- 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) { - d5 = 1.0D - d3; - b0 = 1; + d2 = 1.0D - d0; + i = 1; } -- if (this.func_175162_d(blockpos.func_177978_c()) && d4 < d5) -+ if (!this.isHeadspaceFree(blockpos.func_177978_c(), entHeight) && d4 < d5) +- if (this.func_175162_d(blockpos.func_177978_c()) && d1 < d2) ++ if (!this.isHeadspaceFree(blockpos.func_177978_c(), entHeight) && d1 < d2) { - d5 = d4; - b0 = 4; + d2 = d1; + i = 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) +- 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) { - d5 = 1.0D - d4; - b0 = 5; -@@ -445,6 +461,11 @@ + d2 = 1.0D - d1; + i = 5; +@@ -448,6 +461,12 @@ 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_); ++ 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; + 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 index 359c1e780..1e1f1185d 100644 --- a/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/FontRenderer.java.patch @@ -26,7 +26,7 @@ } catch (IOException ioexception) { -@@ -172,7 +173,7 @@ +@@ -165,7 +166,7 @@ try { @@ -35,16 +35,16 @@ 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; +@@ -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.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; + int l = this.field_78286_d[p_78266_1_]; + float f = (float)l - 0.01F; GL11.glBegin(GL11.GL_TRIANGLE_STRIP); - GL11.glTexCoord2f(f / 128.0F, f1 / 128.0F); -@@ -222,7 +223,7 @@ +@@ -224,7 +225,7 @@ private void func_78257_a(int p_78257_1_) { @@ -53,23 +53,23 @@ } protected float func_78277_a(char p_78277_1_, boolean p_78277_2_) -@@ -269,7 +270,7 @@ +@@ -271,7 +272,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; + int i; @@ -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); + 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 (j == 16) + else if (i1 == 16) { @@ -370,7 +371,7 @@ this.field_78299_w = false; @@ -80,32 +80,33 @@ } ++i; -@@ -390,7 +391,7 @@ - j = k; +@@ -398,7 +399,7 @@ + c0 = c1; } - float f1 = this.field_78293_l ? 0.5F : 1.0F; + float f1 = j == -1 || this.field_78293_l ? 0.5f : 1f; - boolean flag1 = (c0 == 0 || j == -1 || this.field_78293_l) && p_78255_2_; + boolean flag = (c0 == 0 || j == -1 || this.field_78293_l) && p_78255_2_; + + if (flag) +@@ -436,7 +437,16 @@ - if (flag1) -@@ -429,6 +430,15 @@ ++f; } - + doDraw(f); + } + } + } -+ + + protected void doDraw(float f) + { + { + { - Tessellator tessellator; - WorldRenderer worldrenderer; - -@@ -504,7 +514,7 @@ ++ + if (this.field_78299_w) + { + Tessellator tessellator = Tessellator.func_178181_a(); +@@ -509,7 +519,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; @@ -114,7 +115,7 @@ 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,12 +593,6 @@ +@@ -588,11 +598,6 @@ int j = this.field_78287_e[p_78263_1_] >>> 4; int k = this.field_78287_e[p_78263_1_] & 15; @@ -123,11 +124,10 @@ - k = 15; - j = 0; - } -- + ++k; return (k - j) / 2 + 1; - } -@@ -842,6 +846,26 @@ +@@ -846,6 +851,26 @@ return this.field_78294_m; } diff --git a/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch index 1366ae5b5..b212709d6 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiButton.java.patch @@ -1,24 +1,22 @@ --- ../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 field_146124_l; public boolean field_146125_m; protected boolean field_146123_n; - 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_) { -@@ -75,8 +76,12 @@ +@@ -74,6 +75,11 @@ this.func_146119_b(p_146112_1_, p_146112_2_, p_146112_3_); - int l = 14737632; + int j = 14737632; -- if (!this.field_146124_l) + if (packedFGColour != 0) - { -+ l = packedFGColour; -+ } -+ else if (!this.field_146124_l) + { - l = 10526880; - } - else if (this.field_146123_n) ++ j = packedFGColour; ++ } ++ else + 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 e6f87a374..799a580d0 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 -@@ -217,13 +217,14 @@ +@@ -215,13 +215,14 @@ this.field_146297_k.field_71456_v.func_146158_b().func_146234_a(new ChatComponentText(stringbuilder.toString()), 1); } @@ -16,17 +16,24 @@ 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) -@@ -285,6 +286,13 @@ - String[] astring1 = p_146406_1_; - int i = p_146406_1_.length; +@@ -281,6 +282,12 @@ + this.field_146417_i = false; + this.field_146412_t.clear(); + 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; ++ p_146406_1_ = com.google.common.collect.ObjectArrays.concat(complete, p_146406_1_, String.class); + } + - for (int j = 0; j < i; ++j) + 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)) { - String s = astring1[j]; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiConfirmOpenLink.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiConfirmOpenLink.java.patch deleted file mode 100644 index 3befa5b07..000000000 --- a/patches/minecraft/net/minecraft/client/gui/GuiConfirmOpenLink.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/client/gui/GuiConfirmOpenLink.java -+++ ../src-work/minecraft/net/minecraft/client/gui/GuiConfirmOpenLink.java -@@ -26,6 +26,8 @@ - - public void func_73866_w_() - { -+ super.func_73866_w_();// Call super to add line #2 -+ this.field_146292_n.clear(); - this.field_146292_n.add(new GuiButton(0, this.field_146294_l / 2 - 50 - 105, this.field_146295_m / 6 + 96, 100, 20, this.field_146352_g)); - this.field_146292_n.add(new GuiButton(2, this.field_146294_l / 2 - 50, this.field_146295_m / 6 + 96, 100, 20, this.field_146362_s)); - this.field_146292_n.add(new GuiButton(1, this.field_146294_l / 2 - 50 + 105, this.field_146295_m / 6 + 96, 100, 20, this.field_146356_h)); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch index dbe280e82..4f9d297f4 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiCreateWorld.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java -@@ -213,6 +213,8 @@ +@@ -205,6 +205,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.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); -@@ -320,14 +322,7 @@ +@@ -312,14 +314,7 @@ } else if (p_146284_1_.field_146127_k == 8) { @@ -25,7 +25,7 @@ } } } -@@ -379,7 +374,7 @@ +@@ -371,7 +366,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; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch index aeca562a4..492f39e3e 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiIngameMenu.java.patch @@ -2,16 +2,16 @@ +++ ../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"))); + 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.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]))); +- 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(); -@@ -58,13 +59,19 @@ +@@ -74,13 +75,19 @@ this.field_146297_k.func_71381_h(); 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 5100ea6a2..cad9873e2 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.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]))); @@ -12,7 +12,7 @@ } private void func_73972_b(int p_73972_1_, int p_73972_2_) -@@ -245,6 +250,11 @@ +@@ -244,6 +249,11 @@ this.field_146297_k.func_71400_g(); } @@ -24,18 +24,18 @@ 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 @@ +@@ -489,7 +499,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++) ++ for (int brdline = 0; brdline < brandings.size(); brdline++) + { -+ String brd = brandings.get(i); ++ String brd = brandings.get(brdline); + 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); ++ 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.field_146289_q, this.field_146294_l, this.field_146295_m); diff --git a/patches/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiMultiplayer.java.patch index b3e441a5e..fadee0c78 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 p_i1040_1_) { this.field_146798_g = p_i1040_1_; @@ -8,7 +8,7 @@ } public void func_73866_w_() -@@ -373,7 +374,7 @@ +@@ -372,7 +373,7 @@ private void func_146791_a(ServerData p_146791_1_) { diff --git a/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java.patch index dc555d651..0841e6d3c 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 -@@ -170,6 +170,9 @@ +@@ -176,6 +176,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)}); + 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)}); -+ 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.func_175236_d()) { - return arraylist; + 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 c6a26aa76..4496af75e 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiScreen.java.patch @@ -1,16 +1,6 @@ --- ../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 @@ +@@ -143,7 +143,8 @@ } } @@ -20,94 +10,90 @@ } protected void func_146279_a(String p_146279_1_, int p_146279_2_, int p_146279_3_) -@@ -156,6 +160,11 @@ +@@ -153,6 +154,11 @@ - protected void func_146283_a(List p_146283_1_, int p_146283_2_, int p_146283_3_) + 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); ++ 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) ++ 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); +@@ -163,7 +169,7 @@ - if (l > k) - { -@@ -213,7 +222,7 @@ - for (int i2 = 0; i2 < p_146283_1_.size(); ++i2) + for (String s : p_146283_1_) { - 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); +- int j = this.field_146289_q.func_78256_a(s); ++ int j = font.func_78256_a(s); - if (i2 == 0) + if (j > i) { -@@ -441,6 +450,7 @@ +@@ -208,7 +214,7 @@ + for (int k1 = 0; k1 < p_146283_1_.size(); ++k1) + { + 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.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 @@ +@@ -450,9 +457,15 @@ 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)) ++ 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; -+ this.field_146290_a = event.button; -+ event.button.func_146113_a(this.field_146297_k.func_147118_V()); -+ this.func_146284_a(event.button); ++ guibutton = event.button; + 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)) -+ MinecraftForge.EVENT_BUS.post(new ActionPerformedEvent.Post(this, event.button, this.field_146292_n)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Post(this, event.button, this.field_146292_n)); } } } -@@ -482,8 +497,12 @@ +@@ -482,8 +495,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))) ++ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Pre(this, this.field_146292_n))) + { -+ this.field_146292_n.clear(); -+ this.func_73866_w_(); + this.field_146292_n.clear(); + this.func_73866_w_(); + } -+ MinecraftForge.EVENT_BUS.post(new InitGuiEvent.Post(this, this.field_146292_n)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Post(this, this.field_146292_n)); } - public void func_73866_w_() {} -@@ -494,7 +513,9 @@ + public void func_73866_w_() +@@ -496,7 +513,9 @@ { while (Mouse.next()) { -+ if (MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Pre(this))) continue; ++ if (net.minecraftforge.common.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)); ++ 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)); } } -@@ -502,7 +523,9 @@ +@@ -504,7 +523,9 @@ { while (Keyboard.next()) { -+ if (MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Pre(this))) continue; ++ if (net.minecraftforge.common.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)); ++ 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 d4be0db7a..d1ee63656 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.field_146297_k.func_71359_d().func_90033_f(s)) { diff --git a/patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiSleepMP.java.patch index 972c744d6..11a0b4f04 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 3850da1c0..d4b2b22e5 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/GuiSlot.java.patch @@ -1,24 +1,24 @@ --- ../src-base/minecraft/net/minecraft/client/gui/GuiSlot.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiSlot.java -@@ -185,16 +185,7 @@ +@@ -181,15 +181,8 @@ 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)); +- float f = 32.0F; +- worldrenderer.func_181668_a(7, DefaultVertexFormats.field_181709_i); +- 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 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; + 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; -@@ -456,4 +447,19 @@ +@@ -458,4 +451,18 @@ { return this.field_148149_f; } @@ -28,13 +28,12 @@ + 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)); ++ float f = 32.0F; ++ worldrenderer.func_181668_a(7, DefaultVertexFormats.field_181709_i); ++ 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 90dfde34b..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 -@@ -84,7 +84,7 @@ - boolean flag2 = this.field_148301_e.field_82821_f < 47; - boolean flag3 = flag1 || flag2; +@@ -82,7 +82,7 @@ + boolean flag1 = this.field_148301_e.field_82821_f < 47; + boolean flag2 = flag || flag1; 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); +- 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) + for (int i = 0; i < Math.min(list.size(), 2); ++i) { -@@ -178,6 +178,11 @@ - int k2 = p_180790_6_ - p_180790_2_; - int l2 = p_180790_7_ - p_180790_3_; +@@ -176,6 +176,11 @@ + 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, p_180790_2_, p_180790_4_, p_180790_3_, k2, l2); ++ 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 (k2 >= p_180790_4_ - 15 && k2 <= p_180790_4_ - 5 && l2 >= 0 && l2 <= 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 fc49d0fd7..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,50 +1,40 @@ --- ../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 @@ +@@ -49,6 +49,10 @@ + private StatFileWriter field_146556_E; 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(); ++ private java.util.LinkedList minecraftAchievements = new java.util.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); +@@ -57,6 +61,14 @@ + int j = 141; + 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 (Object achievement : AchievementList.field_76007_e) ++ for (Achievement achievement : AchievementList.field_76007_e) + { -+ if (!AchievementPage.isAchievementInPages((Achievement)achievement)) ++ if (!net.minecraftforge.common.AchievementPage.isAchievementInPages(achievement)) + { -+ minecraftAchievements.add((Achievement)achievement); ++ minecraftAchievements.add(achievement); + } + } } public void func_73866_w_() -@@ -65,6 +80,7 @@ +@@ -64,6 +76,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))); ++ 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 func_146284_a(GuiButton p_146284_1_) throws IOException -@@ -75,6 +91,16 @@ +@@ -74,6 +87,16 @@ { this.field_146297_k.func_147108_a(this.field_146562_a); } @@ -52,19 +42,19 @@ + if (p_146284_1_.field_146127_k == 2) + { + currentPage++; -+ if (currentPage >= AchievementPage.getAchievementPages().size()) ++ if (currentPage >= net.minecraftforge.common.AchievementPage.getAchievementPages().size()) + { + currentPage = -1; + } -+ this.button.field_146126_j = AchievementPage.getTitle(currentPage); ++ this.button.field_146126_j = net.minecraftforge.common.AchievementPage.getTitle(currentPage); + } } } -@@ -260,7 +286,9 @@ +@@ -257,7 +280,9 @@ GlStateManager.func_179143_c(518); GlStateManager.func_179094_E(); - GlStateManager.func_179109_b((float)k1, (float)l1, -200.0F); + 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 @@ -72,56 +62,56 @@ GlStateManager.func_179098_w(); GlStateManager.func_179140_f(); GlStateManager.func_179091_B(); -@@ -341,11 +369,12 @@ - int i4; - int l4; +@@ -331,11 +356,12 @@ + GlStateManager.func_179143_c(515); + this.field_146297_k.func_110434_K().func_110577_a(field_146561_C); -- 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) +- 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.field_76007_e.get(i3); -+ Achievement achievement1 = achievementList.get(i3); +- Achievement achievement1 = (Achievement)AchievementList.field_76007_e.get(j5); ++ Achievement achievement1 = achievementList.get(j5); - 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; + int k5 = achievement1.field_75993_a * 24 - i + 11; + int l5 = achievement1.field_75991_b * 24 - j + 11; +@@ -389,9 +415,9 @@ + GlStateManager.func_179091_B(); + GlStateManager.func_179142_g(); -- for (k3 = 0; k3 < AchievementList.field_76007_e.size(); ++k3) -+ for (k3 = 0; k3 < achievementList.size(); ++k3) +- for (int i6 = 0; i6 < AchievementList.field_76007_e.size(); ++i6) ++ for (int i6 = 0; i6 < achievementList.size(); ++i6) { -- 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; +- Achievement achievement2 = (Achievement)AchievementList.field_76007_e.get(i6); ++ Achievement achievement2 = achievementList.get(i6); + int l6 = achievement2.field_75993_a * 24 - i; + int j7 = achievement2.field_75991_b * 24 - j; -@@ -445,6 +474,7 @@ +@@ -432,6 +458,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(l6 - 2, j7 - 2, 26, 202, 26, 26); +@@ -440,6 +467,7 @@ { - this.func_73729_b(l4 - 2, i5 - 2, 0, 202, 26, 26); + this.func_73729_b(l6 - 2, j7 - 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 @@ +@@ -448,7 +476,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); + 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 da29b12c2..f2890750d 100644 --- a/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/achievement/GuiStats.java.patch @@ -1,19 +1,69 @@ --- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiStats.java +++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiStats.java -@@ -769,6 +769,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.field_75939_e) + { + boolean flag = false; +- 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.func_77444_a(statcrafting) > 0) + { + flag = true; + } +- 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.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; + } +@@ -468,8 +471,15 @@ + { + public int compare(StatCrafting p_compare_1_, StatCrafting p_compare_2_) + { +- 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.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.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(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()) +- 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())) { -@@ -806,7 +807,7 @@ + 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 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}); + 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 d04dc9c57..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,18 +1,10 @@ --- ../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 @@ +@@ -175,8 +175,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; ++ net.minecraft.client.gui.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_); @@ -21,7 +13,7 @@ this.field_73735_i = 0.0F; this.field_146296_j.field_77023_b = 0.0F; } -@@ -240,13 +244,12 @@ +@@ -239,13 +242,12 @@ if (itemstack == null) { @@ -38,15 +30,15 @@ this.func_175175_a(i, j, textureatlassprite, 16, 16); GlStateManager.func_179145_e(); flag1 = true; -@@ -465,6 +468,7 @@ +@@ -463,6 +465,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 @@ + int i = this.field_147003_i; + int j = this.field_147009_r; +@@ -685,4 +688,16 @@ this.field_146297_k.field_71439_g.func_71053_j(); } } 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 b91737a77..671aff30b 100644 --- a/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java.patch @@ -1,24 +1,24 @@ --- ../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_) { -@@ -187,7 +189,7 @@ - return; - } +@@ -175,7 +177,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 @@ +- 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) + { +@@ -259,6 +261,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); @@ -32,7 +32,7 @@ } else { -@@ -283,7 +292,7 @@ +@@ -280,7 +289,7 @@ protected void func_73869_a(char p_73869_1_, int p_73869_2_) throws IOException { @@ -41,41 +41,44 @@ { 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(); -+ +@@ -318,6 +327,14 @@ + GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.field_147002_h; + guicontainercreative$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); ++ tab.func_78018_a(guicontainercreative$containercreative.field_148330_a); ++ updateFilteredItems(guicontainercreative$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); + for (Item item : Item.field_150901_e) + { + if (item != null && item.func_77640_w() != null) +@@ -325,7 +342,13 @@ + item.func_150895_a(item, (CreativeTabs)null, guicontainercreative$containercreative.field_148330_a); } } -+ updateFilteredItems(containercreative); ++ updateFilteredItems(guicontainercreative$containercreative); + } + //split from above for custom search tabs -+ private void updateFilteredItems(GuiContainerCreative.ContainerCreative containercreative) ++ private void updateFilteredItems(GuiContainerCreative.ContainerCreative guicontainercreative$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) ++ 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) { - Enchantment enchantment = aenchantment[i]; -@@ -385,7 +410,7 @@ + if (enchantment != null && enchantment.field_77351_y != null) +@@ -333,7 +356,6 @@ + Items.field_151134_bR.func_92113_a(enchantment, guicontainercreative$containercreative.field_148330_a); + } + } +- + 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.field_78032_a[field_147058_w]; @@ -84,16 +87,16 @@ { 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]; +@@ -400,7 +422,7 @@ -- if (this.func_147049_a(creativetabs, l, i1)) -+ if (creativetabs != null && this.func_147049_a(creativetabs, l, i1)) + 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.func_147050_b(creativetabs); return; -@@ -441,11 +466,13 @@ +@@ -413,11 +435,13 @@ private boolean func_147055_p() { @@ -106,8 +109,8 @@ + 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 @@ + GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.field_147002_h; +@@ -483,12 +507,14 @@ if (this.field_147062_A != null) { @@ -123,21 +126,18 @@ this.func_147053_i(); } else -@@ -590,23 +619,45 @@ +@@ -558,20 +584,43 @@ + } 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); ++ int end = Math.min(CreativeTabs.field_78032_a.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) +- for (CreativeTabs creativetabs : CreativeTabs.field_78032_a) ++ for (CreativeTabs creativetabs : java.util.Arrays.copyOfRange(CreativeTabs.field_78032_a,start,end)) { - CreativeTabs creativetabs = acreativetabs[j2]; - + if (creativetabs == null) continue; if (this.func_147052_b(creativetabs, p_73863_1_, p_73863_2_)) { @@ -171,18 +171,17 @@ 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; +@@ -633,16 +682,35 @@ + RenderHelper.func_74520_c(); + CreativeTabs creativetabs = CreativeTabs.field_78032_a[field_147058_w]; -- for (l = 0; l < k; ++l) +- for (CreativeTabs creativetabs1 : CreativeTabs.field_78032_a) + int start = tabPage * 10; -+ k = Math.min(acreativetabs.length, ((tabPage + 1) * 10 + 2)); ++ int end = Math.min(CreativeTabs.field_78032_a.length, ((tabPage + 1) * 10 + 2)); + if (tabPage != 0) start += 2; + -+ for (l = start; l < k; ++l) ++ for (CreativeTabs creativetabs1 : java.util.Arrays.copyOfRange(CreativeTabs.field_78032_a,start,end)) { - CreativeTabs creativetabs1 = acreativetabs[l]; this.field_146297_k.func_110434_K().func_110577_a(field_147061_u); + if (creativetabs1 == null) continue; @@ -209,8 +208,8 @@ 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); +@@ -657,6 +725,14 @@ + 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) @@ -224,32 +223,31 @@ this.func_147051_a(creativetabs); if (creativetabs == CreativeTabs.field_78036_m) -@@ -710,6 +788,15 @@ +@@ -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.field_78027_g && -+ p_147049_1_ != CreativeTabs.field_78036_m) ++ 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 @@ + int i = p_147049_1_.func_78020_k(); + int j = 28 * i; + int k = 0; +@@ -763,6 +847,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.func_73729_b(l, i1, j, k, 28, j1); this.field_73735_i = 100.0F; this.field_146296_j.field_77023_b = 100.0F; -@@ -836,6 +925,15 @@ +@@ -789,6 +875,15 @@ { this.field_146297_k.func_147108_a(new GuiStats(this, this.field_146297_k.field_71439_g.func_146107_m())); } diff --git a/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch b/patches/minecraft/net/minecraft/client/model/ModelBox.java.patch index 36bd887e5..d91355e16 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[] field_78253_h; -@@ -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 daaf765f9..77e0a42cb 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 field_78801_a; -@@ -110,6 +109,7 @@ +@@ -109,6 +108,7 @@ this.field_78798_e = p_78793_3_; } @@ -16,7 +16,7 @@ public void func_78785_a(float p_78785_1_) { if (!this.field_78807_k) -@@ -192,6 +192,7 @@ +@@ -190,6 +190,7 @@ } } @@ -24,7 +24,7 @@ public void func_78791_b(float p_78791_1_) { if (!this.field_78807_k) -@@ -227,6 +228,7 @@ +@@ -225,6 +226,7 @@ } } @@ -32,7 +32,7 @@ public void func_78794_c(float p_78794_1_) { if (!this.field_78807_k) -@@ -268,6 +270,7 @@ +@@ -266,6 +268,7 @@ } } diff --git a/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch b/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch index 25d766877..ea7d9cd31 100644 --- a/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch +++ b/patches/minecraft/net/minecraft/client/model/TexturedQuad.java.patch @@ -1,8 +1,8 @@ --- ../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; +@@ -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; diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java.patch index 0b34576b0..feb70661e 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.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); diff --git a/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch index 05ba7abc5..fbd519d25 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java.patch @@ -1,8 +1,8 @@ --- ../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(p_146367_1_); - GuiConnecting.this.field_146371_g = NetworkManager.func_150726_a(inetaddress, p_146367_2_); + 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)); diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch index 76f35c616..891b51bc7 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 -@@ -113,6 +113,12 @@ +@@ -111,6 +111,12 @@ } } @@ -13,35 +13,34 @@ 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,13 +136,7 @@ +@@ -128,13 +134,7 @@ else { - worldclient.func_175718_b(2001, p_178888_1_, Block.func_176210_f(iblockstate)); -- boolean flag = worldclient.func_175698_g(p_178888_1_); + world.func_175718_b(2001, p_178888_1_, Block.func_176210_f(iblockstate)); +- boolean flag = world.func_175698_g(p_178888_1_); - if (flag) - { -- block1.func_176206_d(worldclient, p_178888_1_, iblockstate); +- block1.func_176206_d(world, p_178888_1_, iblockstate); - } - this.field_178895_c = new BlockPos(this.field_178895_c.func_177958_n(), -1, this.field_178895_c.func_177952_p()); if (!this.field_78779_k.func_77145_d()) -@@ -154,6 +154,13 @@ +@@ -152,6 +152,12 @@ } } -+ boolean flag = block1.removedByPlayer(worldclient, p_178888_1_, field_78776_a.field_71439_g, false); ++ boolean flag = block1.removedByPlayer(world, p_178888_1_, field_78776_a.field_71439_g, false); + + if (flag) + { -+ block1.func_176206_d(worldclient, p_178888_1_, iblockstate); ++ block1.func_176206_d(world, p_178888_1_, iblockstate); + } -+ return flag; } } -@@ -360,11 +367,19 @@ +@@ -356,11 +362,19 @@ { if (this.field_78779_k != WorldSettings.GameType.SPECTATOR) { @@ -50,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_); @@ -63,7 +62,7 @@ } if (!flag && p_178890_3_ != null && p_178890_3_.func_77973_b() instanceof ItemBlock) -@@ -397,7 +412,9 @@ +@@ -393,7 +407,9 @@ } else { @@ -74,15 +73,15 @@ } } else -@@ -428,9 +445,10 @@ +@@ -420,9 +436,10 @@ { - p_78769_1_.field_71071_by.field_70462_a[p_78769_1_.field_71071_by.field_70461_c] = itemstack1; + p_78769_1_.field_71071_by.field_70462_a[p_78769_1_.field_71071_by.field_70461_c] = itemstack; -- if (itemstack1.field_77994_a == 0) -+ if (itemstack1.field_77994_a <= 0) +- if (itemstack.field_77994_a == 0) ++ if (itemstack.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); ++ 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 3418ef76c..0996e6ecd 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 -@@ -54,12 +54,13 @@ +@@ -52,12 +52,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_); diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java.patch index 1b37230bf..a09e9fe7b 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 func_147383_a(C00Handshake p_147383_1_) { diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java.patch index 0b265296c..445652888 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 -@@ -92,7 +92,10 @@ +@@ -104,7 +104,10 @@ { this.field_175091_e = p_147390_1_.func_179730_a(); this.field_147393_d.func_150723_a(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 5da95b592..4fa630f5f 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.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); @@ -9,17 +9,7 @@ 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 @@ +@@ -750,14 +750,16 @@ public void func_147251_a(S02PacketChat p_147251_1_) { PacketThreadUtil.func_180031_a(p_147251_1_, this, this.field_147299_f); @@ -38,7 +28,7 @@ } } -@@ -812,6 +815,11 @@ +@@ -808,6 +810,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); @@ -50,7 +40,7 @@ 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 @@ +@@ -1133,6 +1140,10 @@ { tileentity.func_145839_a(p_147273_1_.func_148857_g()); } @@ -61,7 +51,7 @@ } } -@@ -1346,7 +1358,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 f85c95d04..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 -@@ -148,6 +148,7 @@ - p_147224_1_.func_147407_a((String)null); - } +@@ -150,6 +150,7 @@ + p_147224_1_.func_147407_a((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)); - this.field_147403_d = true; ++ 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 e8fb36209..08e6f7261 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 -@@ -135,6 +135,7 @@ +@@ -133,6 +133,7 @@ public void func_78873_a(EntityFX p_78873_1_) { @@ -8,7 +8,7 @@ int i = p_78873_1_.func_70537_b(); int j = p_78873_1_.func_174838_j() != 1.0F ? 0 : 1; -@@ -361,7 +362,7 @@ +@@ -351,7 +352,7 @@ public void func_180533_a(BlockPos p_180533_1_, IBlockState p_180533_2_) { @@ -16,8 +16,8 @@ + 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_.func_177230_c().func_176221_a(p_180533_2_, this.field_78878_a, p_180533_1_); - byte b0 = 4; -@@ -467,4 +468,13 @@ + int i = 4; +@@ -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 83192d8a5..39f2cb169 100644 --- a/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch @@ -1,14 +1,6 @@ --- ../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 @@ +@@ -533,8 +533,19 @@ @SideOnly(Side.CLIENT) public static enum EnumNeighborInfo { @@ -18,15 +10,15 @@ + // 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 } ), ++ 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, 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 } ), ++ 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/client/renderer/BlockModelShapes.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch index ae731a3e8..af6ec831d 100644 --- a/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/BlockModelShapes.java.patch @@ -1,10 +1,9 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/BlockModelShapes.java +++ ../src-work/minecraft/net/minecraft/client/renderer/BlockModelShapes.java -@@ -321,6 +321,7 @@ +@@ -309,5 +309,6 @@ return new ModelResourceLocation(s + "_double_slab", s1); } }); + net.minecraftforge.client.model.ModelLoader.onRegisterAllBlocks(this); } - - @SideOnly(Side.CLIENT) + } diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java.patch index e52101bb6..72ea50b40 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 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 static final String __OBFID = "CL_00002520"; -@@ -49,6 +49,24 @@ + +@@ -48,6 +48,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_); @@ -34,7 +34,7 @@ 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()); } -@@ -129,6 +147,12 @@ +@@ -128,6 +146,12 @@ ibakedmodel = ((WeightedBakedModel)ibakedmodel).func_177564_a(MathHelper.func_180186_a(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 657aa973d..ea7e48861 100644 --- a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/EntityRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/EntityRenderer.java -@@ -403,7 +403,7 @@ +@@ -419,7 +419,7 @@ - if (d3 < d2 || d2 == 0.0D) + if (d3 < d2 || d2 == 0.0D) + { +- if (entity1 == entity.field_70154_o) ++ if (entity1 == entity.field_70154_o && !entity.canRiderInteract()) { -- if (entity1 == entity.field_70154_o) -+ if (entity1 == entity.field_70154_o && !entity.canRiderInteract()) + if (d2 == 0.0D) { - if (d2 == 0.0D) - { -@@ -556,14 +556,8 @@ +@@ -576,14 +576,8 @@ { BlockPos blockpos = new BlockPos(entity); IBlockState iblockstate = this.field_78531_r.field_71441_e.func_180495_p(blockpos); @@ -25,7 +25,7 @@ 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 @@ +@@ -650,17 +644,20 @@ if (!this.field_78531_r.field_71474_y.field_74325_U) { @@ -52,17 +52,17 @@ + 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 @@ + GlStateManager.func_179109_b(0.0F, -f, 0.0F); +@@ -1103,7 +1100,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_); +- 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) { -@@ -1145,7 +1142,7 @@ +@@ -1164,7 +1161,7 @@ if (this.field_78531_r.field_71442_b.func_178889_l() == WorldSettings.GameType.SPECTATOR) { @@ -71,50 +71,49 @@ } else { -@@ -1296,7 +1293,9 @@ +@@ -1314,7 +1311,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_); + renderglobal.func_180446_a(entity, icamera, 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; +@@ -1326,6 +1325,7 @@ + EntityPlayer 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; +@@ -1339,6 +1339,7 @@ + EntityPlayer entityplayer1 = (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_); ++ 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(); } -@@ -1373,6 +1374,16 @@ - renderglobal.func_174977_a(EnumWorldBlockLayer.TRANSLUCENT, (double)p_175068_2_, p_175068_1_, entity); - } - +@@ -1380,6 +1381,15 @@ + 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.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_); ++ renderglobal.func_180446_a(entity, icamera, 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 @@ +@@ -1392,8 +1402,12 @@ this.func_180437_a(renderglobal, p_175068_2_, p_175068_1_); } @@ -127,7 +126,7 @@ if (this.field_175074_C) { GlStateManager.func_179086_m(256); -@@ -1498,6 +1513,13 @@ +@@ -1505,6 +1519,13 @@ protected void func_78474_d(float p_78474_1_) { @@ -138,11 +137,11 @@ + return; + } + - float f1 = this.field_78531_r.field_71441_e.func_72867_j(p_78474_1_); + float f = 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; + if (f > 0.0F) +@@ -1830,6 +1851,13 @@ + this.field_175081_S = f7; } + 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); @@ -155,9 +154,9 @@ GlStateManager.func_179082_a(this.field_175080_Q, this.field_175082_R, this.field_175081_S, 0.0F); } -@@ -1854,6 +1883,10 @@ +@@ -1848,6 +1876,10 @@ + 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 f1; + float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, entity, block, p_78468_2_, 0.1F); + if (hook >= 0) @@ -165,12 +164,12 @@ + 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); + float f1 = 5.0F; +@@ -1925,6 +1957,7 @@ + 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, p_78468_2_, p_78468_1_, f1); ++ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, entity, block, p_78468_2_, p_78468_1_, f); } 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 63e6a2672..74f00edc5 100644 --- a/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java.patch @@ -1,7 +1,29 @@ --- ../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); +@@ -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); } + potion.renderInventoryEffect(i, j, potioneffect, field_146297_k); diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemModelMesher.java.patch index dbe123b28..09c4a9878 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 -@@ -52,6 +52,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 ec9dc303d..9e4e3ebcd 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemRenderer.java.patch @@ -1,42 +1,37 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/ItemRenderer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/ItemRenderer.java -@@ -308,7 +308,7 @@ +@@ -313,7 +313,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); + this.func_178097_a(abstractclientplayer, f2, f, f1); } -@@ -359,7 +359,8 @@ - +@@ -365,6 +365,7 @@ 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; + 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) -@@ -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); - +@@ -378,11 +379,13 @@ if (iblockstate1.func_177230_c().func_176214_u()) -@@ -378,6 +379,7 @@ + { + iblockstate = iblockstate1; ++ overlayPos = blockpos; + } + } 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)) ++ 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)); } } -@@ -386,11 +388,13 @@ +@@ -391,11 +394,13 @@ { if (this.field_78455_a.field_71439_g.func_70055_a(Material.field_151586_h)) { @@ -50,14 +45,14 @@ this.func_78442_d(p_78447_1_); } } -@@ -507,6 +511,12 @@ +@@ -512,6 +517,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)) ++ 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.field_78453_b = itemstack; -+ this.field_78450_g = entityplayersp.field_71071_by.field_70461_c; ++ 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 c10aed1e5..98273ca48 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 -@@ -78,6 +78,10 @@ +@@ -83,6 +83,10 @@ + public static int field_176089_P; public static int field_148826_e; - 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 func_77474_a() { ContextCapabilities contextcapabilities = GLContext.getCapabilities(); -@@ -813,6 +817,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 e7f5b1855..395aa5466 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 -@@ -517,8 +517,10 @@ +@@ -525,8 +525,10 @@ public void func_180446_a(Entity p_180446_1_, ICamera p_180446_2_, float p_180446_3_) { @@ -11,71 +11,77 @@ --this.field_72740_G; } else -@@ -529,9 +531,12 @@ +@@ -537,9 +539,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 ++ if(pass == 0) + { 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 @@ + 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.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 + List list = this.field_72769_h.func_72910_y(); ++ if (pass == 0) + { this.field_72748_H = list.size(); + } - int i; - Entity entity2; - for (i = 0; i < this.field_72769_h.field_73007_j.size(); ++i) + for (int 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; + Entity entity1 = (Entity)this.field_72769_h.field_73007_j.get(i); ++ if (!entity1.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) + if (entity1.func_145770_h(d0, d1, d2)) +@@ -577,6 +586,7 @@ + for (int j = 0; j < list.size(); ++j) { - 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(); + Entity entity3 = (Entity)list.get(j); + 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; + 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; - if (flag2) -@@ -640,6 +651,7 @@ - while (iterator1.hasNext()) +@@ -626,6 +636,7 @@ + } + + entity2 = (Entity)iterator.next(); ++ if (!entity2.shouldRenderInPass(pass)) continue; + 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_.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) { - 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 @@ +@@ -700,7 +713,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())) +- 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_.func_78546_a(tileentity1.getRenderBoundingBox())) { - TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity, p_180446_3_, destroyblockprogress.func_73106_e()); + TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity1, p_180446_3_, destroyblockprogress.func_73106_e()); } -@@ -1151,6 +1163,12 @@ +@@ -1161,6 +1174,12 @@ public void func_174976_a(float p_174976_1_, int p_174976_2_) { @@ -88,7 +94,7 @@ if (this.field_72777_q.field_71441_e.field_73011_w.func_177502_q() == 1) { this.func_180448_r(); -@@ -1381,6 +1399,12 @@ +@@ -1378,6 +1397,12 @@ public void func_180447_b(float p_180447_1_, int p_180447_2_) { @@ -100,8 +106,8 @@ + } 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 @@ + if (this.field_72777_q.field_71474_y.func_181147_e() == 2) +@@ -1793,8 +1818,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(); @@ -114,7 +120,7 @@ { if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) { -@@ -1949,13 +1976,16 @@ +@@ -1949,13 +1977,16 @@ if (p_174961_1_ != null) { ItemRecord itemrecord = ItemRecord.func_150926_b(p_174961_1_); diff --git a/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/WorldRenderer.java.patch index 6d9a3666c..4b2f9e3c2 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 -@@ -520,6 +520,14 @@ +@@ -578,6 +578,11 @@ } } + public void checkAndGrow() + { -+ if (this.field_179008_i >= this.field_179009_s - this.field_179011_q.func_177338_f()) -+ { -+ this.func_178983_e(2097152); -+ } ++ 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 bf398cbd5..3102b6d98 100644 --- a/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java.patch @@ -1,70 +1,66 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java +++ ../src-work/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java -@@ -29,35 +29,9 @@ +@@ -23,32 +23,9 @@ - while (iterator.hasNext()) + for (int j = 0; j < list.size(); ++j) { + // moved to VertexFormatElement.preDraw - vertexformatelement = (VertexFormatElement)iterator.next(); -- enumusage = vertexformatelement.func_177375_c(); -- k = vertexformatelement.func_177367_b().func_177397_c(); + VertexFormatElement vertexformatelement = (VertexFormatElement)list.get(j); +- 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 (WorldVertexBufferUploader.SwitchEnumUsage.field_178958_a[enumusage.ordinal()]) +- switch (vertexformatelement$enumusage) - { -- case 1: -- bytebuffer.position(vertexformatelement.func_177373_a()); -- GL11.glVertexPointer(vertexformatelement.func_177370_d(), k, j, bytebuffer); +- case POSITION: +- GL11.glVertexPointer(vertexformatelement.func_177370_d(), k, i, bytebuffer); - GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); - break; -- case 2: -- bytebuffer.position(vertexformatelement.func_177373_a()); +- case UV: - OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a + l); -- GL11.glTexCoordPointer(vertexformatelement.func_177370_d(), k, j, bytebuffer); +- GL11.glTexCoordPointer(vertexformatelement.func_177370_d(), k, i, bytebuffer); - GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); - OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a); - break; -- case 3: -- bytebuffer.position(vertexformatelement.func_177373_a()); -- GL11.glColorPointer(vertexformatelement.func_177370_d(), k, j, bytebuffer); +- case COLOR: +- GL11.glColorPointer(vertexformatelement.func_177370_d(), k, i, bytebuffer); - GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); - break; -- case 4: -- bytebuffer.position(vertexformatelement.func_177373_a()); -- GL11.glNormalPointer(k, j, bytebuffer); +- case NORMAL: +- GL11.glNormalPointer(k, i, bytebuffer); - GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY); - } -+ vertexformatelement.func_177375_c().preDraw(vertexformatelement, j, bytebuffer); ++ vertexformatelement.func_177375_c().preDraw(vertexformat, j, i, bytebuffer); } - GL11.glDrawArrays(p_178177_1_.func_178979_i(), 0, p_178177_1_.func_178989_h()); -@@ -65,27 +39,9 @@ - - while (iterator.hasNext()) + 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) { -+ // moved to VertexFormatElement.postDraw - vertexformatelement = (VertexFormatElement)iterator.next(); -- enumusage = vertexformatelement.func_177375_c(); -- k = vertexformatelement.func_177369_e(); + VertexFormatElement vertexformatelement1 = (VertexFormatElement)list.get(i1); +- VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.func_177375_c(); +- int k1 = vertexformatelement1.func_177369_e(); - -- switch (WorldVertexBufferUploader.SwitchEnumUsage.field_178958_a[enumusage.ordinal()]) +- switch (vertexformatelement$enumusage1) - { -- case 1: +- case POSITION: - GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); - break; -- case 2: -- OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a + k); +- case UV: +- OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a + k1); - GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); - OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a); - break; -- case 3: +- case COLOR: - GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); - GlStateManager.func_179117_G(); - break; -- case 4: +- case NORMAL: - GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); - } -+ vertexformatelement.func_177375_c().postDraw(vertexformatelement, j, bytebuffer); ++ // moved to VertexFormatElement.postDraw ++ vertexformatelement1.func_177375_c().postDraw(vertexformat, i1, 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 a015f515f..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,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 -@@ -22,7 +22,12 @@ +@@ -20,7 +20,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_) { @@ -11,20 +11,20 @@ + 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); + EnumFacing enumfacing = func_178410_a(aint); if (p_178414_8_) -@@ -35,16 +40,22 @@ - this.func_178408_a(aint, enumfacing1); +@@ -33,16 +38,22 @@ + this.func_178408_a(aint, enumfacing); } -+ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing1); - return new BakedQuad(aint, p_178414_3_.field_178245_c, enumfacing1); ++ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing); + return new BakedQuad(aint, p_178414_3_.field_178245_c, enumfacing); } 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_); ++ 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 p_178405_8_) @@ -38,34 +38,34 @@ } return aint; -@@ -90,12 +101,17 @@ +@@ -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 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_); +- 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[] 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); ++ 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); } -@@ -156,14 +172,19 @@ +@@ -154,14 +170,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_) + 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(p_178415_1_, p_178415_2_, p_178415_3_, (net.minecraftforge.client.model.ITransformation)p_178415_4_, p_178415_5_); ++ return func_178415_a(p_178415_1_, p_178415_2_, p_178415_3_, 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_) ++ 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 (p_178415_4_ == ModelRotation.X0_Y0) { @@ -73,7 +73,7 @@ } 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)); +- 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 48a2d8d09..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 @@ -1,6 +1,6 @@ --- ../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 @@ +@@ -10,7 +10,11 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -11,4 +11,13 @@ +@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 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 ef42bfbc9..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 @@ -1,8 +1,8 @@ --- ../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; + import org.lwjgl.util.vector.Vector3f; +/* + * @deprecated use {@link net.minecraftforge.client.model.IModelState} and {@link net.minecraftforge.client.model.TRSRTransformation} @@ -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/renderer/block/model/ModelBlockDefinition.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java.patch index 3e878fba9..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 @@ -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 -@@ -32,7 +32,7 @@ +@@ -29,7 +29,7 @@ public static ModelBlockDefinition func_178331_a(Reader p_178331_0_) { @@ -8,8 +8,8 @@ + return net.minecraftforge.client.model.BlockStateLoader.load(p_178331_0_, field_178333_a); } - public ModelBlockDefinition(Collection p_i46221_1_) -@@ -178,11 +178,17 @@ + public ModelBlockDefinition(Collection p_i46221_1_) +@@ -155,11 +155,17 @@ return this.field_178437_a; } 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 27c36fd69..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 @@ -1,11 +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 @@ +@@ -38,7 +38,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))); +- 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.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 4de9b1458..f88c6b175 100644 --- a/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java.patch @@ -1,24 +1,24 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java +++ ../src-work/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java -@@ -124,7 +124,7 @@ +@@ -131,7 +131,7 @@ 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); +- 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 -@@ -150,7 +150,7 @@ - visgraph.func_178606_a(mutableblockpos); +@@ -158,7 +158,7 @@ + lvt_10_1_.func_178606_a(blockpos$mutableblockpos); } - if (block.func_149716_u()) + if (block.hasTileEntity(iblockstate)) { - TileEntity tileentity = regionrendercache.func_175625_s(new BlockPos(mutableblockpos)); - -@@ -160,7 +160,9 @@ + TileEntity tileentity = iblockaccess.func_175625_s(new BlockPos(blockpos$mutableblockpos)); + TileEntitySpecialRenderer tileentityspecialrenderer = TileEntityRendererDispatcher.field_147556_a.func_147547_b(tileentity); +@@ -174,7 +174,9 @@ } } @@ -26,22 +26,21 @@ + for(EnumWorldBlockLayer enumworldblocklayer1 : EnumWorldBlockLayer.values()) { + if(!block.canRenderInLayer(enumworldblocklayer1)) continue; + net.minecraftforge.client.ForgeHooksClient.setRenderLayer(enumworldblocklayer1); - int i = enumworldblocklayer1.ordinal(); + int j = enumworldblocklayer1.ordinal(); if (block.func_149645_b() != -1) -@@ -178,6 +180,7 @@ - compiledchunk.func_178486_a(enumworldblocklayer1); - } +@@ -189,6 +191,7 @@ + + aboolean[j] |= blockrendererdispatcher.func_175018_a(iblockstate, blockpos$mutableblockpos, iblockaccess, worldrenderer); } + } } - EnumWorldBlockLayer[] aenumworldblocklayer = EnumWorldBlockLayer.values(); -@@ -374,4 +377,24 @@ - { + for (EnumWorldBlockLayer enumworldblocklayer : EnumWorldBlockLayer.values()) +@@ -385,6 +388,26 @@ return this.field_178593_n; } -+ + + /* ======================================== FORGE START =====================================*/ + /** + * Creates a new RegionRenderCache instance.
@@ -61,4 +60,7 @@ + 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 index ce3002981..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,32 +1,17 @@ --- ../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_.func_177556_c(); 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 f3; + float f = 0.25F; +- 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_); -@@ -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.func_179109_b(f2, f3, 0); -+ } - this.field_177080_a.func_180454_a(itemstack, ibakedmodel); - GlStateManager.func_179109_b(0.0F, 0.0F, 0.046875F); - } -@@ -161,4 +169,25 @@ +@@ -157,4 +157,25 @@ { - this.func_177075_a((EntityItem)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); + 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 220d22619..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,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderItem.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderItem.java -@@ -83,7 +83,7 @@ +@@ -72,7 +72,7 @@ public RenderItem(TextureManager p_i46165_1_, ModelManager p_i46165_2_) { this.field_175057_n = p_i46165_1_; @@ -9,97 +9,78 @@ 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"); - } +@@ -226,7 +226,7 @@ + k = k | -16777216; } -+ else -+ { -+ modelresourcelocation = item.getModel(p_175049_1_, entityplayer, entityplayer.func_71052_bv()); -+ } - if (modelresourcelocation != null) - { -@@ -314,6 +318,11 @@ +- this.func_175033_a(p_175032_1_, bakedquad, k); ++ net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(p_175032_1_, bakedquad, k); + } + } - 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 @@ +@@ -296,6 +296,11 @@ + modelresourcelocation = new ModelResourceLocation("bow_pulling_0", "inventory"); + } + } ++ else ++ { ++ // TODO: maybe switch to the smart player model / normal smart item model? ++ modelresourcelocation = item.getModel(p_175049_1_, entityplayer, entityplayer.func_71052_bv()); ++ } + + if (modelresourcelocation != null) + { +@@ -317,14 +322,9 @@ + GlStateManager.func_179147_l(); 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); -- } +- ItemCameraTransforms itemcameratransforms = p_175040_2_.func_177552_f(); +- itemcameratransforms.func_181689_a(p_175040_3_); ++ // TODO: check if negative scale is a thing + p_175040_2_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_175040_2_, p_175040_3_); +- if (this.func_183005_a(itemcameratransforms.func_181688_b(p_175040_3_))) +- { +- GlStateManager.func_179107_e(1028); +- } +- this.func_180454_a(p_175040_1_, p_175040_2_); + GlStateManager.func_179107_e(1029); GlStateManager.func_179121_F(); -@@ -374,7 +367,7 @@ +@@ -352,7 +352,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.func_177552_f().func_181689_a(ItemCameraTransforms.TransformType.GUI); + 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 @@ +@@ -459,10 +459,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()); +- 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 j1 = (int)Math.round(13.0D - health * 13.0D); -+ int k = (int)Math.round(255.0D - health * 255.0D); ++ int j = (int)Math.round(13.0D - health * 13.0D); ++ int i = (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); +@@ -473,7 +474,7 @@ + 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 Bled because it screws with a lot of things down the line. ++ //GlStateManager.enableBlend(); // Forge: Disable Blend 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 @@ +@@ -1038,6 +1039,7 @@ 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"); @@ -107,22 +88,3 @@ } 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/RenderPlayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch index 73c21a8cb..984365594 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java.patch @@ -1,18 +1,18 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java -@@ -53,6 +53,7 @@ +@@ -49,6 +49,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_) + 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(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 (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 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_); + double d0 = p_76986_4_; +@@ -61,6 +62,7 @@ + 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(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(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 899e6b69b..75cae2f1b 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 -@@ -48,7 +48,7 @@ +@@ -44,7 +44,7 @@ case 4: return field_110906_m; 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 8ec1b5cbc..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 -@@ -40,6 +40,9 @@ +@@ -38,6 +38,9 @@ + protected List> field_177097_h = Lists.>newArrayList(); protected boolean field_177098_i = 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; @@ -12,38 +12,38 @@ 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 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(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_); -@@ -193,6 +197,7 @@ +@@ -191,6 +195,7 @@ { 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(p_76986_1_, this, p_76986_2_, p_76986_4_, p_76986_6_)); } - protected boolean func_177088_c(EntityLivingBase p_177088_1_) -@@ -472,10 +477,11 @@ + protected boolean func_177088_c(T p_177088_1_) +@@ -469,10 +474,11 @@ - public void func_77033_b(EntityLivingBase p_77033_1_, double p_77033_2_, double p_77033_4_, double p_77033_6_) + 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(p_77033_1_, this, p_77033_2_, p_77033_4_, p_77033_6_))) return; - if (this.func_110813_b(p_77033_1_)) ++ 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 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 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 (d3 < (double)(f * f)) + if (d0 < (double)(f * f)) { -@@ -522,6 +528,7 @@ +@@ -518,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_)); ++ 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 func_110813_b(EntityLivingBase p_110813_1_) + 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 18df6de02..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,49 +1,47 @@ --- ../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.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 = net.minecraftforge.client.ForgeHooksClient.getArmorModel(p_177182_1_, itemstack, p_177182_9_, modelbase); - this.func_177179_a(modelbase, p_177182_9_); +@@ -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_); ++ 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.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, null)); -- switch (LayerArmorBase.SwitchArmorMaterial.field_178747_a[itemarmor.func_82812_d().ordinal()]) - { -- case 1: -- int j = itemarmor.func_82814_b(itemstack); -+ int j = itemarmor.func_82814_b(itemstack); -+ if (j != -1) //Allow this for anything, not only cloth. +- switch (itemarmor.func_82812_d()) +- { +- case LEATHER: + int i = itemarmor.func_82814_b(itemstack); ++ { ++ if (i != -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_); + float f = (float)(i >> 16 & 255) / 255.0F; + float f1 = (float)(i >> 8 & 255) / 255.0F; + float f2 = (float)(i & 255) / 255.0F; + 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 2: -- case 3: -- case 4: -- case 5: +- case CHAIN: +- case IRON: +- case GOLD: +- case DIAMOND: + this.field_177190_a.func_110776_a(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, "overlay")); + } -+ { // Non-cloth ++ { // Non-colored 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_); + 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, Why is this a switch? there were no breaks. - if (!this.field_177193_i && itemstack.func_77948_v()) ++ // Default ++ if (!this.field_177193_i && itemstack.func_77962_s()) { - 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_); + 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 +136,13 @@ +@@ -135,11 +134,13 @@ GlStateManager.func_179084_k(); } @@ -56,12 +54,22 @@ + @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_) { - 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_})}); -@@ -158,6 +161,42 @@ - - protected abstract void func_177179_a(ModelBase p_177179_1_, int p_177179_2_); + 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 +158,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. + * @@ -74,7 +82,7 @@ + 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(); ++ String texture = item.func_82812_d().func_179242_c(); + String domain = "minecraft"; + int idx = texture.indexOf(':'); + if (idx != -1) @@ -96,7 +104,4 @@ + return resourcelocation; + } + /*=================================== FORGE END ===========================================*/ -+ - @SideOnly(Side.CLIENT) - - static final class SwitchArmorMaterial + } 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..e391d61ac --- /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 +@@ -49,4 +49,10 @@ + { + p_177194_1_.func_178719_a(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/client/renderer/texture/Stitcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch index 564cdfb40..1dbb9630a 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/Stitcher.java.patch @@ -1,37 +1,32 @@ --- ../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() +@@ -58,12 +58,17 @@ { - Stitcher.Holder[] aholder = (Stitcher.Holder[])this.field_94319_a.toArray(new Stitcher.Holder[this.field_94319_a.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.func_98150_a().func_94215_i()); + 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); - if (!this.func_94310_b(holder)) + for (Stitcher.Holder stitcher$holder : astitcher$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[] {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[] {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 : aholder) ++ for (Stitcher.Holder h : astitcher$holder) + net.minecraftforge.fml.common.FMLLog.info(" %s", h); - throw new StitcherException(holder, s); + throw new StitcherException(stitcher$holder, s); } } -@@ -80,6 +85,7 @@ +@@ -73,6 +78,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); } + net.minecraftforge.fml.common.ProgressManager.pop(bar); } - public List func_94309_g() -@@ -273,7 +279,7 @@ + public List func_94309_g() +@@ -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 8b755ed75..7d8895248 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 -@@ -410,4 +410,30 @@ +@@ -402,4 +402,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 + '}'; } 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 727f57e75..796c37a03 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch @@ -1,15 +1,12 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureManager.java +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureManager.java -@@ -143,12 +143,15 @@ +@@ -137,9 +137,12 @@ 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.field_110585_a.keySet().size(), true); - Iterator iterator = this.field_110585_a.entrySet().iterator(); - - while (iterator.hasNext()) + for (Entry entry : this.field_110585_a.entrySet()) { - Entry entry = (Entry)iterator.next(); + bar.step(entry.getKey().toString()); this.func_110579_a((ResourceLocation)entry.getKey(), (ITextureObject)entry.getValue()); } 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 1aec43664..133b68b97 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureMap.java +++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureMap.java -@@ -29,6 +29,7 @@ +@@ -28,6 +28,7 @@ @SideOnly(Side.CLIENT) public class TextureMap extends AbstractTexture implements ITickableTextureObject { @@ -8,15 +8,15 @@ 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"); -@@ -40,6 +41,7 @@ +@@ -38,6 +39,7 @@ + private final IIconCreator field_174946_m; private int field_147636_j; private final TextureAtlasSprite field_94249_f; - private static final String __OBFID = "CL_00001058"; + private boolean skipFirst = false; public TextureMap(String p_i46099_1_) { -@@ -48,12 +50,23 @@ +@@ -46,12 +48,23 @@ public TextureMap(String p_i46100_1_, IIconCreator p_i46100_2_) { @@ -30,9 +30,9 @@ + + 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_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_; @@ -41,19 +41,17 @@ } private void func_110569_e() -@@ -91,15 +104,29 @@ - this.field_94258_i.clear(); +@@ -90,12 +103,28 @@ int j = Integer.MAX_VALUE; 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.field_110574_e.size()); - Iterator iterator = this.field_110574_e.entrySet().iterator(); - -- while (iterator.hasNext()) -+ while (!skipFirst && iterator.hasNext()) ++ ++ if(!skipFirst) + for (Entry entry : this.field_110574_e.entrySet()) { - 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); @@ -72,24 +70,24 @@ try { IResource iresource = p_110571_1_.func_110536_a(resourcelocation1); -@@ -150,12 +177,14 @@ +@@ -145,12 +174,14 @@ } catch (RuntimeException runtimeexception) { -- field_147635_d.error("Unable to parse metadata from " + resourcelocation1, runtimeexception); -+ //logger.error("Unable to parse metadata from " + resourcelocation1, 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) { -- field_147635_d.error("Using missing texture, unable to load " + resourcelocation1, ioexception1); -+ //logger.error("Using missing texture, unable to load " + resourcelocation1, 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; } -@@ -171,6 +200,7 @@ +@@ -166,6 +197,7 @@ stitcher.func_110934_a(textureatlassprite); } @@ -97,21 +95,19 @@ int j1 = Math.min(j, k); int k1 = MathHelper.func_151239_c(j1); -@@ -181,10 +211,12 @@ +@@ -175,8 +207,11 @@ + this.field_147636_j = k1; } - Iterator iterator1 = this.field_110574_e.values().iterator(); + bar = net.minecraftforge.fml.common.ProgressManager.push("Mipmap generation", skipFirst ? 0 : this.field_110574_e.size()); - -- while (iterator1.hasNext()) -+ while (!skipFirst && iterator1.hasNext()) + for (final TextureAtlasSprite textureatlassprite1 : this.field_110574_e.values()) { - final TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)iterator1.next(); ++ if (skipFirst) break; + bar.step(textureatlassprite1.func_94215_i()); - try { -@@ -225,9 +257,13 @@ + textureatlassprite1.func_147963_d(this.field_147636_j); +@@ -213,9 +248,13 @@ this.field_94249_f.func_147963_d(this.field_147636_j); stitcher.func_110934_a(this.field_94249_f); @@ -125,33 +121,33 @@ stitcher.func_94305_f(); } catch (StitcherException stitcherexception) -@@ -236,11 +272,13 @@ +@@ -224,9 +263,11 @@ } 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.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(); - TextureAtlasSprite textureatlassprite2; + Map map = Maps.newHashMap(this.field_110574_e); + bar.step("Uploading GL texture"); - while (iterator2.hasNext()) + for (TextureAtlasSprite textureatlassprite2 : stitcher.func_94309_g()) { - textureatlassprite2 = (TextureAtlasSprite)iterator2.next(); -@@ -275,7 +313,11 @@ - textureatlassprite2.func_94217_a(this.field_94249_f); + String s = textureatlassprite2.func_94215_i(); +@@ -256,6 +297,13 @@ + { + textureatlassprite3.func_94217_a(this.field_94249_f); } - ++ + 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 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 func_147634_a(ResourceLocation p_147634_1_, int p_147634_2_) -@@ -341,4 +383,37 @@ +@@ -319,4 +367,37 @@ { return this.field_94249_f; } 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 4e5c66c9f..a9d758ece 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 -@@ -202,9 +202,11 @@ +@@ -197,9 +197,11 @@ public static void func_180600_a(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/TileEntityItemStackRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java.patch index 3b547aafd..22634cf06 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.field_147556_a.func_147549_a(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 5c3f9e29e..9faa76e8f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java.patch @@ -1,49 +1,21 @@ --- ../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 field_177407_h; - private final String field_177408_i; - private final int field_177405_j; -@@ -157,9 +164,17 @@ +@@ -142,10 +142,17 @@ NORMAL("Normal"), COLOR("Vertex Color"), UV("UV"), -+ // As of 1.8 - unused in vanilla; use GENERIC for now ++ // 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 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); } ++ 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 field_177392_h; - 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 feee903f7..375865cd4 100644 --- a/patches/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/AbstractResourcePack.java.patch @@ -8,4 +8,4 @@ + 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 + 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 c002dd01f..fa5296e39 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 -@@ -70,6 +70,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 de7ea2b62..4bc3d483c 100644 --- a/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/LanguageManager.java.patch @@ -1,9 +1,9 @@ --- ../src-base/minecraft/net/minecraft/client/resources/LanguageManager.java +++ ../src-work/minecraft/net/minecraft/client/resources/LanguageManager.java -@@ -83,6 +83,7 @@ +@@ -73,6 +73,7 @@ } - field_135049_a.func_135022_a(p_110549_1_, arraylist); + 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 fc84931f7..95dc701db 100644 --- a/patches/minecraft/net/minecraft/client/resources/Locale.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/Locale.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/client/resources/Locale.java +++ ../src-work/minecraft/net/minecraft/client/resources/Locale.java -@@ -107,6 +107,8 @@ +@@ -95,6 +95,8 @@ private void func_135021_a(InputStream p_135021_1_) throws IOException { + p_135021_1_ = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(field_135032_a, p_135021_1_); + if (p_135021_1_ == null) return; - Iterator iterator = IOUtils.readLines(p_135021_1_, Charsets.UTF_8).iterator(); - - while (iterator.hasNext()) + for (String s : IOUtils.readLines(p_135021_1_, Charsets.UTF_8)) + { + if (!s.isEmpty() && s.charAt(0) != 35) diff --git a/patches/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch b/patches/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch index 8d8b19f58..5dd733b35 100644 --- a/patches/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java.patch @@ -1,17 +1,17 @@ --- ../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_) +@@ -92,6 +92,7 @@ + public void func_110541_a(List p_110541_1_) { 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); - field_147967_a.info("Reloading ResourceManager: " + field_130074_a.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() { - private static final String __OBFID = "CL_00001092"; -@@ -112,26 +113,35 @@ - while (iterator.hasNext()) + public String apply(IResourcePack p_apply_1_) +@@ -102,23 +103,32 @@ + + for (IResourcePack iresourcepack : p_110541_1_) { - IResourcePack iresourcepack = (IResourcePack)iterator.next(); + resReload.step(iresourcepack.func_130077_b()); this.func_110545_a(iresourcepack); } @@ -23,21 +23,18 @@ public void func_110542_a(IResourceManagerReloadListener p_110542_1_) { - this.field_110546_b.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.field_110546_b.add(p_110542_1_); p_110542_1_.func_110549_a(this); + net.minecraftforge.fml.common.ProgressManager.pop(resReload); } private void func_110544_b() { - Iterator iterator = this.field_110546_b.iterator(); - + net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Reloading", this.field_110546_b.size()); - while (iterator.hasNext()) + for (IResourceManagerReloadListener iresourcemanagerreloadlistener : this.field_110546_b) { - IResourceManagerReloadListener iresourcemanagerreloadlistener = (IResourceManagerReloadListener)iterator.next(); + resReload.step(iresourcemanagerreloadlistener.getClass()); iresourcemanagerreloadlistener.func_110549_a(this); } diff --git a/patches/minecraft/net/minecraft/client/resources/SkinManager.java.patch b/patches/minecraft/net/minecraft/client/resources/SkinManager.java.patch deleted file mode 100644 index 9784b8e90..000000000 --- a/patches/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.func_71410_x().func_110432_I().func_148256_e().getId())) - { -- hashmap.putAll(SkinManager.this.field_152797_e.getTextures(SkinManager.this.field_152797_e.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)); - } - - Minecraft.func_71410_x().func_152344_a(new Runnable() 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 92a87972d..d792aea1b 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 -@@ -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 func_177551_a(EnumFacing p_177551_1_); -@@ -22,5 +26,6 @@ +@@ -23,5 +23,6 @@ TextureAtlasSprite func_177554_e(); 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 f8e796861..f9f5a2c51 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/ModelBakery.java.patch @@ -1,23 +1,23 @@ --- ../src-base/minecraft/net/minecraft/client/resources/model/ModelBakery.java +++ ../src-work/minecraft/net/minecraft/client/resources/model/ModelBakery.java -@@ -123,7 +123,7 @@ +@@ -114,7 +114,7 @@ } - catch (Exception exception) + catch (Exception 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, exception); ++ field_177603_c.warn("Unable to load variant: " + modelresourcelocation.func_177518_c() + " from " + modelresourcelocation, var6); } } - catch (Exception exception1) -@@ -172,6 +172,7 @@ + catch (Exception exception) +@@ -160,6 +160,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 @@ + throw new RuntimeException("Encountered an exception when loading model definition of model " + resourcelocation.toString(), ioexception); +@@ -294,6 +295,7 @@ protected void func_177592_e() { @@ -25,7 +25,7 @@ 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 @@ +@@ -336,6 +338,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"})); @@ -35,8 +35,26 @@ + } } - protected List func_177596_a(Item p_177596_1_) -@@ -494,6 +500,11 @@ + 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_) { @@ -46,26 +64,26 @@ + 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 @@ + SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(p_177578_1_)).func_177646_a(textureatlassprite); + +@@ -463,13 +474,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_)); +- 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 { -- 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_)); +- 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_)); } } } -@@ -525,9 +536,14 @@ +@@ -479,9 +490,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_) { @@ -81,7 +99,7 @@ private void func_177597_h() { this.func_177574_i(); -@@ -809,4 +825,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/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch b/patches/minecraft/net/minecraft/client/resources/model/ModelManager.java.patch index ec981fa49..9b92db76e 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 func_110549_a(IResourceManager p_110549_1_) { 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 fc6faa7d5..893292696 100644 --- a/patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch +++ b/patches/minecraft/net/minecraft/client/resources/model/ModelRotation.java.patch @@ -1,7 +1,7 @@ --- ../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; + import org.lwjgl.util.vector.Vector3f; @SideOnly(Side.CLIENT) -public enum ModelRotation @@ -9,12 +9,12 @@ { X0_Y0(0, 0), X0_Y90(0, 90), -@@ -122,4 +122,9 @@ - field_177546_q.put(Integer.valueOf(var3.field_177545_r), var3); +@@ -116,4 +116,9 @@ + 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 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/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch b/patches/minecraft/net/minecraft/client/settings/GameSettings.java.patch index 74702821a..72506bbfa 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 -@@ -1067,6 +1067,7 @@ +@@ -981,6 +981,7 @@ public void func_74303_b() { diff --git a/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch b/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch index b552a439c..5c9c777d2 100644 --- a/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch +++ b/patches/minecraft/net/minecraft/client/shader/Framebuffer.java.patch @@ -18,7 +18,7 @@ } this.func_147614_f(); -@@ -281,4 +290,36 @@ +@@ -280,4 +289,36 @@ GlStateManager.func_179086_m(i); this.func_147609_e(); } diff --git a/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch b/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch index caaea209c..361b3dc03 100644 --- a/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch +++ b/patches/minecraft/net/minecraft/command/CommandEnchant.java.patch @@ -1,8 +1,8 @@ --- ../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.func_180306_c(short1); + Enchantment enchantment2 = Enchantment.func_180306_c(l); - 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 diff --git a/patches/minecraft/net/minecraft/command/CommandFill.java.patch b/patches/minecraft/net/minecraft/command/CommandFill.java.patch index 9a592ec08..c9950fe71 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 -@@ -52,6 +52,7 @@ +@@ -48,6 +48,7 @@ { i = func_175764_a(p_71515_2_[7], 0, 15); } @@ -8,7 +8,7 @@ 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 @@ +@@ -75,7 +76,7 @@ NBTTagCompound nbttagcompound = new NBTTagCompound(); boolean flag = false; @@ -17,7 +17,7 @@ { String s = func_147178_a(p_71515_1_, p_71515_2_, 9).func_150260_c(); -@@ -121,7 +122,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 0d3e80726..1bc893d80 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 -@@ -48,6 +48,16 @@ +@@ -44,6 +44,16 @@ } else if (icommand.func_71519_b(p_71556_1_)) { @@ -16,4 +16,4 @@ + if (i > -1) { - List list = PlayerSelector.func_179656_b(p_71556_1_, 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/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_) diff --git a/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch b/patches/minecraft/net/minecraft/command/server/CommandSetBlock.java.patch index 8ef370f35..e5ef73f0b 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 = func_175764_a(p_71515_2_[4], 0, 15); } @@ -9,7 +9,7 @@ World world = p_71515_1_.func_130014_f_(); if (!world.func_175667_e(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 0542a21e8..a9dae5314 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 -@@ -74,7 +74,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 224cdfd43..7b4d498c8 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 -@@ -126,6 +126,7 @@ +@@ -115,6 +115,7 @@ return IntCache.func_85144_b(); } }); @@ -8,7 +8,7 @@ } public String func_71501_a() -@@ -220,6 +221,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 9deb81cc3..6af34573d 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 -@@ -128,8 +128,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 5e24561f7..d8d07737b 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 -@@ -139,8 +139,22 @@ +@@ -125,8 +125,22 @@ + @SideOnly(Side.CLIENT) private ItemStack field_151245_t; - private static final String __OBFID = "CL_00000005"; + public CreativeTabs(String label) + { @@ -23,7 +23,7 @@ this.field_78033_n = p_i1853_1_; this.field_78034_o = p_i1853_2_; field_78032_a[p_i1853_1_] = this; -@@ -223,12 +237,20 @@ +@@ -209,12 +223,20 @@ @SideOnly(Side.CLIENT) public int func_78020_k() { @@ -44,27 +44,27 @@ return this.field_78033_n < 6; } -@@ -278,10 +300,17 @@ - while (iterator.hasNext()) +@@ -256,10 +278,17 @@ + { + for (Item item : Item.field_150901_e) { - Item item = (Item)iterator.next(); -+ if (item == null) -+ { -+ continue; -+ } - - if (item != null && item.func_77640_w() == this) -+ for (CreativeTabs tab : item.getCreativeTabs()) ++ if (item == null) { - item.func_150895_a(item, this, p_78018_1_); ++ continue; + } ++ for (CreativeTabs tab : item.getCreativeTabs()) ++ { + if (tab == this) + { + item.func_150895_a(item, this, p_78018_1_); + } - } ++ } } -@@ -320,4 +349,39 @@ + if (this.func_111225_m() != null) +@@ -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 604488bc9..92f2bc57b 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 (field_180311_a[p_i45771_1_] != null) { @@ -9,7 +9,7 @@ } else { -@@ -149,13 +149,52 @@ +@@ -139,7 +139,7 @@ public boolean func_92089_a(ItemStack p_92089_1_) { @@ -17,9 +17,10 @@ + return canApplyAtEnchantingTable(p_92089_1_); } - public void func_151368_a(EntityLivingBase p_151368_1_, Entity p_151368_2_, int p_151368_3_) {} - - public void func_151367_b(EntityLivingBase p_151367_1_, Entity p_151367_2_, int p_151367_3_) {} + public void func_151368_a(EntityLivingBase p_151368_1_, Entity p_151368_2_, int p_151368_3_) +@@ -150,6 +150,45 @@ + { + } + /** + * This applies specifically to applying at the enchanting table. The other method {@link #canApply(ItemStack)} @@ -62,4 +63,4 @@ + static { - ArrayList var0 = Lists.newArrayList(); + List list = Lists.newArrayList(); diff --git a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch index 1f684188d..6f607d4dd 100644 --- a/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch +++ b/patches/minecraft/net/minecraft/enchantment/EnchantmentHelper.java.patch @@ -1,41 +1,41 @@ --- ../src-base/minecraft/net/minecraft/enchantment/EnchantmentHelper.java +++ ../src-work/minecraft/net/minecraft/enchantment/EnchantmentHelper.java -@@ -308,7 +308,7 @@ +@@ -296,7 +296,7 @@ public static int func_77514_a(Random p_77514_0_, int p_77514_1_, int p_77514_2_, ItemStack p_77514_3_) { Item item = p_77514_3_.func_77973_b(); -- int k = item.func_77619_b(); -+ int k = item.getItemEnchantability(p_77514_3_); +- int i = item.func_77619_b(); ++ int i = item.getItemEnchantability(p_77514_3_); - if (k <= 0) + if (i <= 0) { -@@ -361,7 +361,7 @@ - public static List func_77513_b(Random p_77513_0_, ItemStack p_77513_1_, int p_77513_2_) +@@ -345,7 +345,7 @@ + public static List func_77513_b(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(); -+ int j = item.getItemEnchantability(p_77513_1_); +- int i = item.func_77619_b(); ++ int i = item.getItemEnchantability(p_77513_1_); - if (j <= 0) + if (i <= 0) { -@@ -408,7 +408,9 @@ +@@ -387,7 +387,9 @@ + + for (EnchantmentData enchantmentdata1 : list) + { +- 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 { - EnchantmentData enchantmentdata1 = (EnchantmentData)iterator1.next(); + flag = false; + break; +@@ -421,7 +423,8 @@ -- 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 - { - continue; - } -@@ -450,7 +452,8 @@ + for (Enchantment enchantment : Enchantment.field_77331_b) { - Enchantment enchantment = aenchantment[k]; - - if (enchantment != null && (enchantment.field_77351_y.func_77557_a(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_) || (flag && enchantment.isAllowedOnBooks())) { - for (int l = enchantment.func_77319_d(); l <= enchantment.func_77325_b(); ++l) + 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 31ec4be0b..957649fc8 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 -@@ -128,6 +128,14 @@ +@@ -129,6 +129,14 @@ + protected UUID field_96093_i; private final CommandResultStats field_174837_as; - 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 func_145782_y() { return this.field_145783_c; -@@ -171,6 +179,8 @@ +@@ -172,6 +180,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(); @@ -24,7 +24,7 @@ } protected abstract void func_70088_a(); -@@ -1010,10 +1020,7 @@ +@@ -998,10 +1008,7 @@ if (block.func_149688_o() == p_70055_1_) { @@ -36,7 +36,7 @@ } else { -@@ -1378,6 +1385,21 @@ +@@ -1356,6 +1363,21 @@ p_70109_1_.func_74757_a("Silent", this.func_174814_R()); } @@ -58,7 +58,7 @@ this.func_70014_b(p_70109_1_); if (this.field_70154_o != null) -@@ -1458,6 +1480,28 @@ +@@ -1438,6 +1460,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")); @@ -87,7 +87,7 @@ this.func_70037_a(p_70020_1_); if (this.func_142008_O()) -@@ -1536,7 +1580,10 @@ +@@ -1512,7 +1556,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(); @@ -99,7 +99,7 @@ return entityitem; } else -@@ -1672,6 +1719,7 @@ +@@ -1655,6 +1702,7 @@ public void func_70078_a(Entity p_70078_1_) { @@ -107,7 +107,7 @@ this.field_70149_e = 0.0D; this.field_70147_f = 0.0D; -@@ -1810,7 +1858,7 @@ +@@ -1789,7 +1837,7 @@ public boolean func_70115_ae() { @@ -116,7 +116,7 @@ } public boolean func_70093_af() -@@ -2103,7 +2151,7 @@ +@@ -2092,7 +2140,7 @@ public float func_180428_a(Explosion p_180428_1_, World p_180428_2_, BlockPos p_180428_3_, IBlockState p_180428_4_) { @@ -125,7 +125,7 @@ } 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_) -@@ -2357,4 +2405,184 @@ +@@ -2353,4 +2401,184 @@ EnchantmentHelper.func_151385_b(p_174815_1_, p_174815_2_); } 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) + { diff --git a/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch b/patches/minecraft/net/minecraft/entity/EntityHanging.java.patch index 1544b50a8..29d340d07 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.func_177967_a(enumfacing, k).func_177981_b(l); Block block = this.field_70170_p.func_180495_p(blockpos1).func_177230_c(); diff --git a/patches/minecraft/net/minecraft/entity/EntityList.java.patch b/patches/minecraft/net/minecraft/entity/EntityList.java.patch index 800d27c1b..0a51ed53e 100644 --- a/patches/minecraft/net/minecraft/entity/EntityList.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityList.java.patch @@ -1,26 +1,26 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityList.java +++ ../src-work/minecraft/net/minecraft/entity/EntityList.java -@@ -90,6 +90,7 @@ +@@ -88,6 +88,7 @@ - public static void func_75618_a(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 (field_75625_b.containsKey(p_75618_1_)) { throw new IllegalArgumentException("ID is already registered: " + p_75618_1_); -@@ -153,9 +154,10 @@ +@@ -151,9 +152,10 @@ p_75615_0_.func_82580_o("Type"); } -+ Class oclass = null; ++ 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)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) { -@@ -169,7 +171,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 field_75611_b; public final int field_75612_c; public final StatBase field_151512_d; -@@ -358,6 +372,17 @@ +@@ -356,6 +370,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); diff --git a/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch b/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch index 5a09c3725..915de5e84 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLiving.java.patch @@ -1,14 +1,14 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityLiving.java +++ ../src-work/minecraft/net/minecraft/entity/EntityLiving.java -@@ -124,6 +124,7 @@ +@@ -121,6 +121,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 @@ + public boolean func_70686_a(Class p_70686_1_) +@@ -498,10 +499,22 @@ protected void func_70623_bb() { @@ -30,8 +30,8 @@ + } else { - EntityPlayer entityplayer = this.field_70170_p.func_72890_a(this, -1.0D); -@@ -628,7 +641,6 @@ + Entity entity = this.field_70170_p.func_72890_a(this, -1.0D); +@@ -621,7 +634,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()); } diff --git a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch index 95ebf1e2d..7906ba9b3 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -1,24 +1,32 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java +++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java -@@ -233,7 +233,7 @@ +@@ -170,6 +170,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); + 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)}); } -@@ -316,7 +316,7 @@ + } +@@ -237,7 +238,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); + } +@@ -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")) { - i = this.func_70693_a(this.field_70717_bb); + int 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 @@ +@@ -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() -@@ -672,7 +673,6 @@ +@@ -663,7 +665,6 @@ return this.func_70668_bt() == EnumCreatureAttribute.UNDEAD; } @@ -34,16 +42,16 @@ public void func_70618_n(int p_70618_1_) { this.field_70713_bf.remove(Integer.valueOf(p_70618_1_)); -@@ -721,6 +721,8 @@ +@@ -712,6 +713,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(); + float f = this.func_110143_aJ(); - if (f1 > 0.0F) -@@ -741,6 +743,7 @@ + if (f > 0.0F) +@@ -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; -@@ -806,9 +809,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()) { -@@ -894,6 +897,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(); -@@ -919,6 +923,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); -@@ -929,6 +936,16 @@ +@@ -918,6 +926,16 @@ this.func_82164_bB(); } } @@ -98,7 +106,7 @@ } this.field_70170_p.func_72960_a(this, (byte)3); -@@ -977,7 +994,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() -@@ -987,6 +1004,9 @@ +@@ -982,6 +1000,9 @@ public void func_180430_e(float p_180430_1_, float p_180430_2_) { @@ -116,8 +124,8 @@ + 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 @@ + float f = potioneffect != null ? (float)(potioneffect.func_76458_c() + 1) : 0.0F; +@@ -1094,6 +1115,8 @@ { if (!this.func_180431_b(p_70665_1_)) { @@ -125,8 +133,8 @@ + 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 @@ + float f = p_70665_2_; +@@ -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; -@@ -1294,6 +1321,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; -@@ -1359,6 +1387,7 @@ +@@ -1346,6 +1375,7 @@ } this.field_70160_al = true; @@ -154,7 +162,7 @@ } protected void func_70629_bd() -@@ -1545,6 +1574,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) -@@ -1828,6 +1858,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) -@@ -2000,4 +2031,39 @@ +@@ -1998,4 +2030,39 @@ { 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 db7a4fe19..9f22ee7e1 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 func_130002_c(EntityPlayer p_130002_1_) { 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 74d6449d4..ba155b961 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 -@@ -58,6 +58,8 @@ +@@ -56,6 +56,8 @@ public void func_72786_a(Entity p_72786_1_) { @@ -9,7 +9,7 @@ if (p_72786_1_ instanceof EntityPlayerMP) { this.func_72791_a(p_72786_1_, 512, 2); -@@ -355,4 +357,23 @@ +@@ -331,4 +333,23 @@ } } } @@ -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) field_72794_c.func_76041_a(entity.func_145782_y()); + if (entry == null) diff --git a/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch b/patches/minecraft/net/minecraft/entity/EntityTrackerEntry.java.patch index 6f346c7e8..20e203ef1 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 -@@ -388,6 +388,14 @@ +@@ -379,6 +379,14 @@ this.field_73138_k = this.field_73132_a.field_70181_x; this.field_73135_l = this.field_73132_a.field_70179_y; @@ -15,7 +15,7 @@ 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 @@ +@@ -426,12 +434,14 @@ p_73117_1_.field_71135_a.func_147359_a(new S1DPacketEntityEffect(this.field_73132_a.func_145782_y(), potioneffect)); } } @@ -30,7 +30,7 @@ } } } -@@ -474,6 +484,9 @@ +@@ -463,6 +473,9 @@ field_151262_p.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 453f8aaea..d869b3547 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 -@@ -20,11 +20,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_) + 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. - } - - public EntityAIAttackOnCollide(EntityCreature p_i1636_1_, double p_i1636_2_, boolean p_i1636_4_) -@@ -54,6 +57,19 @@ +@@ -54,6 +56,19 @@ } else { @@ -35,7 +29,7 @@ this.field_75438_g = this.field_75441_b.func_70661_as().func_75494_a(entitylivingbase); return this.field_75438_g != null; } -@@ -91,6 +107,23 @@ +@@ -91,6 +106,23 @@ this.field_151496_k = entitylivingbase.field_70161_v; this.field_75445_i = 4 + this.field_75441_b.func_70681_au().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 8f01432d9..2ccf20bdd 100644 --- a/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/EntityDragon.java.patch @@ -1,8 +1,8 @@ --- ../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(); +@@ -479,9 +479,9 @@ + BlockPos blockpos = new BlockPos(k1, l1, i2); + Block block = this.field_70170_p.func_180495_p(blockpos).func_177230_c(); - if (block.func_149688_o() != Material.field_151579_a) + if (!block.isAir(field_70170_p, new BlockPos(k1, l1, i2))) @@ -10,5 +10,5 @@ - 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; + 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 e683f35dc..38dc16d7a 100644 --- a/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch +++ b/patches/minecraft/net/minecraft/entity/boss/EntityWither.java.patch @@ -1,11 +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.field_70170_p.func_180495_p(new BlockPos(j2, k, l)).func_177230_c(); +@@ -343,7 +343,7 @@ + BlockPos blockpos = new BlockPos(i3, k, l); + Block block = this.field_70170_p.func_180495_p(blockpos).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)) +- 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.field_70170_p.func_175655_b(new BlockPos(j2, k, l), true) || flag; + flag = this.field_70170_p.func_175655_b(blockpos, true) || flag; } diff --git a/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch b/patches/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java.patch index 6a8a40087..4778abec5 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 -@@ -92,7 +92,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 c12ef4d21..4a8b020c5 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 -@@ -50,6 +50,9 @@ +@@ -61,6 +61,9 @@ if (entityplayermp.field_71135_a.func_147362_b().func_150724_d() && entityplayermp.field_70170_p == this.field_70170_p && !entityplayermp.func_70608_bn()) { @@ -10,7 +10,7 @@ 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 @@ +@@ -74,9 +77,10 @@ entitylivingbase.func_70078_a((Entity)null); } @@ -22,4 +22,4 @@ + } } } - + 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 index 62ed8fc50..85b198887 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 -@@ -31,6 +31,11 @@ +@@ -29,6 +29,11 @@ + private String field_145802_g; 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. @@ -12,7 +12,7 @@ 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 @@ +@@ -46,6 +51,7 @@ { this(p_i1710_1_, p_i1710_2_, p_i1710_4_, p_i1710_6_); this.func_92058_a(p_i1710_8_); @@ -20,7 +20,7 @@ } protected boolean func_70041_e_() -@@ -71,6 +77,8 @@ +@@ -69,6 +75,8 @@ public void func_70071_h_() { @@ -29,7 +29,7 @@ if (this.func_92059_d() == null) { this.func_70106_y(); -@@ -131,8 +139,16 @@ +@@ -129,8 +137,16 @@ this.func_70072_I(); @@ -47,7 +47,7 @@ this.func_70106_y(); } } -@@ -276,6 +292,7 @@ +@@ -271,6 +287,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); @@ -55,9 +55,9 @@ 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)); +@@ -311,20 +328,23 @@ + NBTTagCompound nbttagcompound = p_70037_1_.func_74775_l("Item"); + this.func_92058_a(ItemStack.func_77949_a(nbttagcompound)); - if (this.func_92059_d() == null) - { @@ -84,7 +84,7 @@ { if (itemstack.func_77973_b() == Item.func_150898_a(Blocks.field_150364_r)) { -@@ -366,6 +386,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 3ff9ebe83..dfb0cf0e5 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 b0dcddbec..da822bd07 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 -@@ -52,6 +52,20 @@ +@@ -50,6 +50,20 @@ + @SideOnly(Side.CLIENT) private double field_70506_as; - 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 p_i1712_1_) { super(p_i1712_1_); -@@ -97,17 +111,19 @@ +@@ -95,17 +109,19 @@ public AxisAlignedBB func_70114_g(Entity p_70114_1_) { @@ -43,7 +43,7 @@ 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(j, i, k); + BlockPos blockpos = new BlockPos(k, l, i1); IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); - if (BlockRailBase.func_176563_d(iblockstate)) @@ -51,19 +51,19 @@ { this.func_180460_a(blockpos, iblockstate); -@@ -347,7 +363,10 @@ - } +@@ -348,7 +364,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(); -+ 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(); - while (iterator.hasNext()) +- 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.func_174813_aQ().func_72314_b(0.20000000298023224D, 0.0D, 0.20000000298023224D); ++ for (Entity entity : this.field_70170_p.func_72839_b(this, box)) { -@@ -370,6 +389,7 @@ + if (entity != this.field_70153_n && entity.func_70104_M() && entity instanceof EntityMinecart) + { +@@ -367,6 +386,7 @@ } this.func_70072_I(); @@ -71,7 +71,7 @@ } } -@@ -382,10 +402,21 @@ +@@ -381,10 +401,21 @@ protected void func_180459_n() { @@ -94,7 +94,7 @@ if (this.field_70122_E) { this.field_70159_w *= 0.5D; -@@ -393,13 +424,13 @@ +@@ -392,13 +423,13 @@ this.field_70179_y *= 0.5D; } @@ -118,63 +118,63 @@ - double d0 = 0.0078125D; + double slopeAdjustment = getSlopeAdjustment(); - BlockRailBase.EnumRailDirection enumraildirection = (BlockRailBase.EnumRailDirection)p_180460_2_.func_177229_b(blockrailbase.func_176560_l()); + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)p_180460_2_.func_177229_b(blockrailbase.func_176560_l()); - switch (EntityMinecart.SwitchEnumMinecartType.field_180036_b[enumraildirection.ordinal()]) + switch (blockrailbase$enumraildirection) { - case 1: + case ASCENDING_EAST: - this.field_70159_w -= 0.0078125D; + this.field_70159_w -= slopeAdjustment; ++this.field_70163_u; break; - case 2: + case ASCENDING_WEST: - this.field_70159_w += 0.0078125D; + this.field_70159_w += slopeAdjustment; ++this.field_70163_u; break; - case 3: + case ASCENDING_NORTH: - this.field_70179_y += 0.0078125D; + this.field_70179_y += slopeAdjustment; ++this.field_70163_u; break; - case 4: + case ASCENDING_SOUTH: - this.field_70179_y -= 0.0078125D; + this.field_70179_y -= slopeAdjustment; ++this.field_70163_u; } -@@ -485,7 +516,7 @@ +@@ -481,7 +512,7 @@ } } - if (flag1) + if (flag1 && shouldDoRailFunctions()) { - d6 = Math.sqrt(this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y); + double d17 = Math.sqrt(this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y); -@@ -533,20 +564,8 @@ - this.field_70165_t = d7 + d1 * d6; - this.field_70161_v = d8 + d2 * d6; +@@ -527,20 +558,8 @@ + 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); -- d11 = this.field_70159_w; -- d12 = this.field_70179_y; +- double d22 = this.field_70159_w; +- double d23 = this.field_70179_y; + this.moveMinecartOnRail(p_180460_1_); - if (this.field_70153_n != null) - { -- d11 *= 0.75D; -- d12 *= 0.75D; +- d22 *= 0.75D; +- d23 *= 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); +- 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.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.func_70107_b(this.field_70165_t, this.field_70163_u + (double)aint[0][1], this.field_70161_v); -@@ -583,8 +602,14 @@ +@@ -577,8 +596,14 @@ this.field_70179_y = d5 * (double)(i - p_180460_1_.func_177952_p()); } @@ -190,7 +190,7 @@ double d15 = Math.sqrt(this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y); if (d15 > 0.01D) -@@ -824,13 +849,20 @@ +@@ -817,13 +842,20 @@ public void func_70108_f(Entity p_70108_1_) { @@ -212,7 +212,7 @@ { p_70108_1_.func_70078_a(this); } -@@ -876,7 +908,7 @@ +@@ -869,7 +901,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; @@ -221,7 +221,7 @@ { this.field_70159_w *= 0.20000000298023224D; this.field_70179_y *= 0.20000000298023224D; -@@ -884,7 +916,7 @@ +@@ -877,7 +909,7 @@ p_70108_1_.field_70159_w *= 0.949999988079071D; p_70108_1_.field_70179_y *= 0.949999988079071D; } @@ -230,7 +230,7 @@ { p_70108_1_.field_70159_w *= 0.20000000298023224D; p_70108_1_.field_70179_y *= 0.20000000298023224D; -@@ -1049,6 +1081,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 86de5e86a..e9ce1fedd 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 -@@ -173,6 +173,7 @@ +@@ -180,6 +180,7 @@ public boolean func_130002_c(EntityPlayer p_130002_1_) { diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java.patch index 3db54ba04..807d5622e 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 func_130002_c(EntityPlayer p_130002_1_) { diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java.patch index 0b8841524..a051aba6b 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 func_130002_c(EntityPlayer p_130002_1_) { diff --git a/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java.patch index cf2c9b8c1..7fc5668b9 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 -@@ -57,6 +57,7 @@ +@@ -54,6 +54,7 @@ public boolean func_130002_c(EntityPlayer p_130002_1_) { diff --git a/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch index 6ce41fa89..f0c991f61 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 -@@ -198,6 +198,7 @@ +@@ -199,6 +199,7 @@ { if (this.field_70532_c == 0 && p_70100_1_.field_71090_bL == 0) { diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch index f3ec30644..3f5db488a 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntityEnderman.java.patch @@ -1,14 +1,14 @@ --- ../src-base/minecraft/net/minecraft/entity/monster/EntityEnderman.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntityEnderman.java -@@ -204,12 +204,14 @@ +@@ -198,12 +198,14 @@ 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 d3 = this.field_70165_t; - double d4 = this.field_70163_u; - double d5 = this.field_70161_v; + 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_; @@ -18,11 +18,10 @@ boolean flag = false; BlockPos blockpos = new BlockPos(this.field_70165_t, this.field_70163_u, this.field_70161_v); -@@ -565,4 +567,16 @@ - } +@@ -364,6 +366,18 @@ } } -+ + + /*===================================== Forge Start ==============================*/ + public static void setCarriable(Block block, boolean canCarry) + { @@ -34,4 +33,7 @@ + return field_70827_d.contains(block); + } + /*===================================== Forge End ==============================*/ - } ++ + public boolean func_70823_r() + { + 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 ec3e09971..72690ba3f 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.field_70181_x = (double)(0.42F + (float)this.func_70809_q() * 0.1F); this.field_70160_al = true; diff --git a/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch index 45e3d5eec..8bd8f7dce 100644 --- a/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch +++ b/patches/minecraft/net/minecraft/entity/monster/EntitySlime.java.patch @@ -1,11 +1,35 @@ --- ../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 @@ - { - 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))); + 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.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; } +@@ -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; diff --git a/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch b/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch index 0ac7da22d..5e5a32c79 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 -@@ -89,7 +89,7 @@ +@@ -87,7 +87,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); @@ -9,7 +9,7 @@ } protected void func_70088_a() -@@ -231,12 +231,25 @@ +@@ -229,12 +229,25 @@ entitylivingbase = (EntityLivingBase)p_70097_1_.func_76346_g(); } @@ -40,7 +40,7 @@ for (int l = 0; l < 50; ++l) { -@@ -251,7 +264,7 @@ +@@ -249,7 +262,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); @@ -49,12 +49,12 @@ 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 @@ +@@ -465,7 +478,7 @@ - if (p_180482_2_1 == null) + if (p_180482_2_ == 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); +- 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_1 instanceof EntityZombie.GroupData) + 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 54fe1eaff..988e8b587 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 -@@ -1260,6 +1260,7 @@ +@@ -1247,6 +1247,7 @@ } this.field_110277_bt = 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 9d9d51edf..e996a2886 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 p_i1687_1_) + { +@@ -18,6 +18,7 @@ this.field_175506_bl = Blocks.field_150391_bh; } @@ -17,7 +17,7 @@ public boolean func_70085_c(EntityPlayer p_70085_1_) { ItemStack itemstack = p_70085_1_.field_71071_by.func_70448_g(); -@@ -39,7 +40,7 @@ +@@ -37,7 +38,7 @@ } } @@ -26,7 +26,7 @@ { 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 @@ +@@ -77,4 +78,33 @@ { return new EntityMooshroom(this.field_70170_p); } diff --git a/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntityOcelot.java.patch index 6219ce05b..ec6eaae58 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 -@@ -276,7 +276,7 @@ +@@ -279,7 +279,7 @@ Block block = this.field_70170_p.func_180495_p(blockpos.func_177977_b()).func_177230_c(); diff --git a/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch b/patches/minecraft/net/minecraft/entity/passive/EntitySheep.java.patch index 6faf82c50..7d9799ce8 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 field_90016_e = new InventoryCrafting(new Container() { -@@ -142,11 +142,12 @@ +@@ -140,11 +140,12 @@ } } @@ -23,7 +23,7 @@ { if (!this.field_70170_p.field_72995_K) { -@@ -334,4 +335,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 ed6df82c6..9648a8f59 100644 --- a/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch +++ b/patches/minecraft/net/minecraft/entity/passive/EntityVillager.java.patch @@ -1,14 +1,14 @@ --- ../src-base/minecraft/net/minecraft/entity/passive/EntityVillager.java +++ ../src-work/minecraft/net/minecraft/entity/passive/EntityVillager.java -@@ -83,6 +83,7 @@ +@@ -81,6 +81,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 @@ + public EntityVillager(World p_i1747_1_) +@@ -210,7 +211,7 @@ ItemStack itemstack = p_70085_1_.field_71071_by.func_70448_g(); boolean flag = itemstack != null && itemstack.func_77973_b() == Items.field_151063_bx; @@ -17,15 +17,15 @@ { if (!this.field_70170_p.field_72995_K && (this.field_70963_i == null || this.field_70963_i.size() > 0)) { -@@ -540,6 +541,7 @@ +@@ -522,6 +523,7 @@ private void func_175554_cu() { + //TODO: Hook into VillagerRegistry - EntityVillager.ITradeList[][][] aitradelist = field_175561_bA[this.func_70946_n()]; + EntityVillager.ITradeList[][][] aentityvillager$itradelist = field_175561_bA[this.func_70946_n()]; if (this.field_175563_bv != 0 && this.field_175562_bw != 0) -@@ -648,6 +650,7 @@ +@@ -635,6 +637,7 @@ } } @@ -33,7 +33,7 @@ if (s1 != null) { ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("entity.Villager." + s1, new Object[0]); -@@ -710,7 +713,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 610e37013..cdf492a0c 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -1,38 +1,18 @@ --- ../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; - +@@ -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 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 @@ +@@ -175,7 +180,8 @@ { if (this.field_71074_e != null) { @@ -42,7 +22,7 @@ } this.func_71041_bz(); -@@ -200,6 +216,7 @@ +@@ -199,6 +205,7 @@ public void func_70071_h_() { @@ -50,7 +30,7 @@ this.field_70145_X = this.func_175149_v(); if (this.func_175149_v()) -@@ -213,6 +230,14 @@ +@@ -212,6 +219,14 @@ if (itemstack == this.field_71074_e) { @@ -65,7 +45,7 @@ if (this.field_71072_f <= 25 && this.field_71072_f % 4 == 0) { this.func_71010_c(itemstack, 5); -@@ -222,6 +247,7 @@ +@@ -221,6 +236,7 @@ { this.func_71036_o(); } @@ -73,7 +53,7 @@ } else { -@@ -267,7 +293,7 @@ +@@ -266,7 +282,7 @@ super.func_70071_h_(); @@ -82,7 +62,7 @@ { this.func_71053_j(); this.field_71070_bA = this.field_71069_bz; -@@ -344,6 +370,7 @@ +@@ -343,6 +359,7 @@ { this.func_70107_b(d3, this.field_70163_u, d4); } @@ -90,12 +70,11 @@ } public int func_82145_z() -@@ -413,11 +440,13 @@ +@@ -412,11 +429,12 @@ 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; @@ -105,7 +84,7 @@ { this.field_71071_by.field_70462_a[this.field_71071_by.field_70461_c] = null; } -@@ -477,11 +506,11 @@ +@@ -476,11 +494,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); @@ -119,7 +98,7 @@ } } } -@@ -611,11 +640,15 @@ +@@ -610,11 +628,15 @@ public void func_70645_a(DamageSource p_70645_1_) { @@ -135,7 +114,7 @@ if (this.func_70005_c_().equals("Notch")) { this.func_146097_a(new ItemStack(Items.field_151034_e, 1), true, false); -@@ -626,6 +659,9 @@ +@@ -625,6 +647,9 @@ this.field_71071_by.func_70436_m(); } @@ -145,7 +124,7 @@ 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 @@ +@@ -707,12 +732,25 @@ public EntityItem func_71040_bB(boolean p_71040_1_) { @@ -173,7 +152,7 @@ } public EntityItem func_146097_a(ItemStack p_146097_1_, boolean p_146097_2_, boolean p_146097_3_) -@@ -780,13 +829,25 @@ +@@ -770,13 +808,25 @@ public void func_71012_a(EntityItem p_71012_1_) { @@ -182,6 +161,7 @@ + capturedDrops.add(p_71012_1_); + return; + } ++ this.field_70170_p.func_72838_d(p_71012_1_); } @@ -196,11 +176,10 @@ + { + 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 @@ +@@ -826,12 +876,13 @@ f /= 5.0F; } @@ -216,7 +195,7 @@ } public void func_70037_a(NBTTagCompound p_70037_1_) -@@ -877,6 +939,16 @@ +@@ -867,6 +918,16 @@ this.field_82248_d = p_70037_1_.func_74767_n("SpawnForced"); } @@ -233,7 +212,7 @@ this.field_71100_bB.func_75112_a(p_70037_1_); this.field_71075_bZ.func_75095_b(p_70037_1_); -@@ -908,6 +980,23 @@ +@@ -898,6 +959,23 @@ p_70014_1_.func_74757_a("SpawnForced", this.field_82248_d); } @@ -257,7 +236,7 @@ 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 @@ +@@ -911,6 +989,7 @@ public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { @@ -265,7 +244,7 @@ if (this.func_180431_b(p_70097_1_)) { return false; -@@ -1021,12 +1111,15 @@ +@@ -1007,12 +1086,15 @@ { if (!this.func_180431_b(p_70665_1_)) { @@ -280,9 +259,9 @@ + 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_; + float f = p_70665_2_; p_70665_2_ = Math.max(p_70665_2_ - this.func_110139_bj(), 0.0F); -@@ -1074,6 +1167,7 @@ +@@ -1074,6 +1156,7 @@ } else { @@ -290,7 +269,7 @@ ItemStack itemstack = this.func_71045_bC(); ItemStack itemstack1 = itemstack != null ? itemstack.func_77946_l() : null; -@@ -1125,7 +1219,9 @@ +@@ -1125,7 +1208,9 @@ public void func_71028_bD() { @@ -300,7 +279,7 @@ } public double func_70033_W() -@@ -1135,6 +1231,7 @@ +@@ -1135,6 +1220,7 @@ public void func_71059_n(Entity p_71059_1_) { @@ -308,7 +287,7 @@ if (p_71059_1_.func_70075_an()) { if (!p_71059_1_.func_85031_j(this)) -@@ -1305,6 +1402,8 @@ +@@ -1311,6 +1397,8 @@ public EntityPlayer.EnumStatus func_180469_a(BlockPos p_180469_1_) { @@ -317,7 +296,7 @@ if (!this.field_70170_p.field_72995_K) { if (this.func_70608_bn() || !this.func_70089_S()) -@@ -1346,7 +1445,7 @@ +@@ -1352,7 +1440,7 @@ if (this.field_70170_p.func_175667_e(p_180469_1_)) { @@ -326,7 +305,7 @@ float f = 0.5F; float f1 = 0.5F; -@@ -1409,13 +1508,14 @@ +@@ -1415,13 +1503,14 @@ public void func_70999_a(boolean p_70999_1_, boolean p_70999_2_, boolean p_70999_3_) { @@ -344,7 +323,7 @@ if (blockpos == null) { -@@ -1442,12 +1542,12 @@ +@@ -1448,14 +1537,14 @@ private boolean func_175143_p() { @@ -354,12 +333,14 @@ 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)) + Block block = p_180467_0_.func_180495_p(p_180467_1_).func_177230_c(); + +- if (block != Blocks.field_150324_C) ++ if (!block.isBed(p_180467_0_, p_180467_1_, null)) { if (!p_180467_2_) { -@@ -1464,7 +1564,7 @@ +@@ -1470,7 +1559,7 @@ } else { @@ -368,16 +349,16 @@ } } -@@ -1473,7 +1573,7 @@ +@@ -1479,7 +1568,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()]) + switch (enumfacing) { -@@ -1511,16 +1611,23 @@ +@@ -1519,16 +1608,24 @@ public BlockPos func_180470_cg() { @@ -385,7 +366,7 @@ + return getBedLocation(this.field_71093_bK); } -+ @Deprecated ++ @Deprecated // Use dimension-sensitive version. public boolean func_82245_bX() { - return this.field_82248_d; @@ -400,10 +381,11 @@ + 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 @@ +@@ -1712,6 +1809,10 @@ super.func_180430_e(p_180430_1_, p_180430_2_); } @@ -414,15 +396,15 @@ } protected void func_71061_d_() -@@ -1725,6 +1836,7 @@ +@@ -1735,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_)); + 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 (entityegginfo != null) + if (entitylist$entityegginfo != null) { -@@ -1837,6 +1949,8 @@ +@@ -1847,6 +1949,8 @@ { if (p_71008_1_ != this.field_71074_e) { @@ -431,10 +413,10 @@ 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; +@@ -1918,6 +2022,10 @@ + 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 = p_71049_1_.extendedProperties; + for (net.minecraftforge.common.IExtendedEntityProperties p : this.extendedProperties.values()) @@ -442,8 +424,8 @@ } else if (this.field_70170_p.func_82736_K().func_82766_b("keepInventory")) { -@@ -1918,6 +2036,18 @@ - +@@ -1931,6 +2039,18 @@ + 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))); + @@ -461,7 +443,7 @@ } protected boolean func_70041_e_() -@@ -1951,7 +2081,14 @@ +@@ -1968,7 +2088,14 @@ public void func_70062_b(int p_70062_1_, ItemStack p_70062_2_) { @@ -477,19 +459,19 @@ } @SideOnly(Side.CLIENT) -@@ -1996,7 +2133,10 @@ +@@ -2013,7 +2140,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 @@ +- 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.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 func_70047_e() { @@ -498,7 +480,7 @@ if (this.func_70608_bn()) { -@@ -2139,6 +2279,136 @@ +@@ -2155,6 +2285,136 @@ this.field_175153_bG = p_175150_1_; } @@ -599,7 +581,7 @@ + { + if(this.displayname == null) + { -+ this.displayname = ForgeEventFactory.getPlayerDisplayName(this, this.func_70005_c_()); ++ this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.func_70005_c_()); + } + return this.displayname; + } @@ -609,24 +591,24 @@ + */ + public void refreshDisplayName() + { -+ this.displayname = ForgeEventFactory.getPlayerDisplayName(this, this.func_70005_c_()); ++ this.displayname = net.minecraftforge.event.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; } + diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch index 7d6d0b6c8..cda8667cb 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 -@@ -127,14 +127,15 @@ +@@ -123,14 +123,15 @@ + public int field_71138_i; 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_) @@ -18,7 +18,7 @@ { 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 @@ +@@ -223,7 +224,7 @@ this.field_71070_bA.func_75142_b(); @@ -27,25 +27,15 @@ { 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 @@ +@@ -294,6 +295,7 @@ + for (Chunk chunk1 : list) { - 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)); + 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)); } } } -@@ -440,6 +443,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(); -@@ -463,7 +467,20 @@ +@@ -447,7 +450,20 @@ if (!this.field_70170_p.func_82736_K().func_82766_b("keepInventory")) { @@ -73,20 +63,20 @@ + } } - Collection collection = this.field_70170_p.func_96441_U().func_96520_a(IScoreObjectiveCriteria.field_96642_c); -@@ -481,6 +498,7 @@ + for (ScoreObjective scoreobjective : this.field_70170_p.func_96441_U().func_96520_a(IScoreObjectiveCriteria.field_96642_c)) +@@ -461,6 +477,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)); + 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 (entityegginfo != null) + if (entitylist$entityegginfo != null) { -@@ -849,6 +867,7 @@ +@@ -831,6 +848,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(); + 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 49675d1be..ed4ba1122 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 -@@ -319,6 +319,14 @@ +@@ -315,6 +315,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); } } diff --git a/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch b/patches/minecraft/net/minecraft/entity/projectile/EntityFishHook.java.patch index 14c20d778..b859938da 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 -@@ -562,11 +562,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 68b643c96..4b2ed93f3 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 -@@ -67,6 +67,7 @@ +@@ -65,6 +65,7 @@ return field_151355_a; } @@ -8,7 +8,64 @@ static void func_151353_a() { BlockDispenser.field_149943_a.func_82595_a(Items.field_151032_g, new BehaviorProjectileDispense() -@@ -144,7 +145,7 @@ +@@ -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(); @@ -17,19 +74,188 @@ if (entity instanceof EntityLivingBase && p_82487_2_.func_82837_s()) { -@@ -509,6 +510,7 @@ +@@ -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); } } }); -+ 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_) {} +@@ -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); + } + } }); -+ } - } - - 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 index 0b289ff59..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 -@@ -624,7 +624,7 @@ - slot = (Slot)this.field_75151_b.get(k); - itemstack1 = slot.func_75211_c(); +@@ -608,7 +608,7 @@ + Slot slot1 = (Slot)this.field_75151_b.get(i); + ItemStack itemstack1 = slot1.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. ++ if (itemstack1 == null && slot1.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(); + 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 8f34fa6a9..ae5dae8dd 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 -@@ -132,7 +132,7 @@ +@@ -143,7 +143,7 @@ public boolean func_75214_a(ItemStack p_75214_1_) { diff --git a/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch b/patches/minecraft/net/minecraft/inventory/ContainerBrewingStand.java.patch index e281d7c01..4e3f446a3 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 -@@ -158,7 +158,7 @@ +@@ -154,7 +154,7 @@ public boolean func_75214_a(ItemStack p_75214_1_) { @@ -9,7 +9,7 @@ } public int func_75219_a() -@@ -190,7 +190,7 @@ +@@ -185,7 +185,7 @@ public void func_82870_a(EntityPlayer p_82870_1_, ItemStack p_82870_2_) { @@ -18,7 +18,7 @@ { this.field_75244_a.func_71029_a(AchievementList.field_76001_A); } -@@ -200,7 +200,7 @@ +@@ -195,7 +195,7 @@ public static boolean func_75243_a_(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 01c2537e4..79534c19d 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerEnchantment.java.patch @@ -1,17 +1,9 @@ --- ../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 @@ +@@ -65,9 +65,12 @@ + }); this.func_75146_a(new Slot(this.field_75168_e, 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_) { @@ -21,51 +13,51 @@ + return false; } }); - int i; -@@ -152,6 +156,7 @@ + +@@ -146,6 +149,7 @@ + if (!this.field_75172_h.field_72995_K) { - i = 0; - int j; + int l = 0; + float power = 0; - for (j = -1; j <= 1; ++j) + for (int j = -1; j <= 1; ++j) { -@@ -159,37 +164,15 @@ +@@ -153,37 +157,14 @@ { 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.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) - { -- ++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)); - -- 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) -- { -- ++i; +- ++l; - } - +- 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(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.field_75172_h.func_180495_p(this.field_178150_j.func_177982_a(k * 2, 0, j)).func_177230_c() == Blocks.field_150342_X) - { -- ++i; +- ++l; - } - - 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) - { -- ++i; +- ++l; - } - - 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) - { -- ++i; +- ++l; - } - - 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) - { -- ++i; +- ++l; - } + 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)); @@ -74,12 +66,12 @@ } } } -@@ -199,7 +182,7 @@ +@@ -193,7 +174,7 @@ - for (j = 0; j < 3; ++j) + for (int i1 = 0; i1 < 3; ++i1) { -- 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.field_178151_h[j] = -1; +- 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.field_75167_g[j] < j + 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 2637c44fd..b34ce8231 100644 --- a/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch +++ b/patches/minecraft/net/minecraft/inventory/ContainerPlayer.java.patch @@ -1,12 +1,12 @@ --- ../src-base/minecraft/net/minecraft/inventory/ContainerPlayer.java +++ ../src-work/minecraft/net/minecraft/inventory/ContainerPlayer.java -@@ -47,7 +47,8 @@ +@@ -43,7 +43,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)); +- 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, field_82862_h); ++ return p_75214_1_.func_77973_b().isValidArmor(p_75214_1_, k_f, 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 index fb6952611..aad74b86d 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 @@ p_82870_1_.func_82242_a(-ContainerRepair.this.field_82854_e); } @@ -9,38 +9,38 @@ ContainerRepair.this.field_82853_g.func_70299_a(0, (ItemStack)null); if (ContainerRepair.this.field_82856_l > 0) -@@ -97,7 +99,7 @@ +@@ -94,7 +96,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 @@ + 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, 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(); + flag = itemstack2.func_77973_b() == Items.field_151134_bR && Items.field_151134_bR.func_92110_g(itemstack2).func_74745_c() > 0; -- 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 + 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.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 { - flag8 = false; - ++i; -@@ -322,6 +326,8 @@ + flag1 = false; + ++l1; +@@ -315,6 +319,8 @@ } } -+ if (flag7 && !itemstack1.func_77973_b().isBookEnchantable(itemstack1, itemstack2)) itemstack1 = null; ++ if (flag && !itemstack1.func_77973_b().isBookEnchantable(itemstack1, itemstack2)) itemstack1 = null; + if (StringUtils.isBlank(this.field_82857_m)) { diff --git a/patches/minecraft/net/minecraft/inventory/Slot.java.patch b/patches/minecraft/net/minecraft/inventory/Slot.java.patch index 0eb96c519..d47ee2d87 100644 --- a/patches/minecraft/net/minecraft/inventory/Slot.java.patch +++ b/patches/minecraft/net/minecraft/inventory/Slot.java.patch @@ -1,13 +1,6 @@ --- ../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 @@ +@@ -89,7 +89,7 @@ @SideOnly(Side.CLIENT) public String func_178171_c() { @@ -16,7 +9,7 @@ } public ItemStack func_75209_a(int p_75209_1_) -@@ -109,4 +110,64 @@ +@@ -112,4 +112,63 @@ { return true; } @@ -27,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() @@ -37,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) @@ -47,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) + { @@ -65,7 +57,7 @@ + @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 = net.minecraft.client.Minecraft.func_71410_x().func_147117_R(); + return (net.minecraft.client.renderer.texture.TextureMap)backgroundMap; + } + diff --git a/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch b/patches/minecraft/net/minecraft/inventory/SlotCrafting.java.patch index 0dd6c1066..58adc5a1a 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 func_82870_a(EntityPlayer p_82870_1_, ItemStack p_82870_2_) { diff --git a/patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch b/patches/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java.patch index e0dda7760..33dcc7b7e 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 -@@ -83,6 +83,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 af3b601e9..e79d76add 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -1,19 +1,19 @@ --- ../src-base/minecraft/net/minecraft/item/Item.java +++ ../src-work/minecraft/net/minecraft/item/Item.java -@@ -47,8 +47,8 @@ +@@ -48,8 +48,8 @@ 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(); +- 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 field_77785_bY; private String field_77774_bZ; - 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); @@ -37,7 +37,7 @@ public boolean func_77634_r() { return this.field_77700_c != null; -@@ -308,7 +313,7 @@ +@@ -316,7 +321,7 @@ public boolean func_77616_k(ItemStack p_77616_1_) { @@ -46,7 +46,7 @@ } protected MovingObjectPosition func_77621_a(World p_77621_1_, EntityPlayer p_77621_2_, boolean p_77621_3_) -@@ -326,6 +331,10 @@ +@@ -334,6 +339,10 @@ float f6 = f3 * f4; float f7 = f2 * f4; double d3 = 5.0D; @@ -57,21 +57,21 @@ 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); } -@@ -363,11 +372,579 @@ +@@ -371,11 +380,591 @@ return false; } + @Deprecated // Use ItemStack sensitive version below. - public Multimap func_111205_h() + public Multimap func_111205_h() { - return HashMultimap.create(); + return HashMultimap.create(); } + /* ======================================== FORGE START =====================================*/ + /** + * ItemStack sensitive version of getItemAttributeModifiers + */ -+ public Multimap getAttributeModifiers(ItemStack stack) ++ public Multimap getAttributeModifiers(ItemStack stack) + { + return this.func_111205_h(); + } @@ -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 @@ -632,14 +645,13 @@ + return !ItemStack.func_77989_b(oldStack, newStack); + } + /* ======================================== FORGE END =====================================*/ -+ + 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() -@@ -933,6 +1510,10 @@ - - private static final String __OBFID = "CL_00000042"; + func_179214_a(Blocks.field_150348_b, (new ItemMultiTexture(Blocks.field_150348_b, Blocks.field_150348_b, new Function() +@@ -855,6 +1444,10 @@ + 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 @@ -648,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_; -@@ -967,9 +1548,36 @@ +@@ -889,9 +1482,36 @@ return this.field_78008_j; } diff --git a/patches/minecraft/net/minecraft/item/ItemArmor.java.patch b/patches/minecraft/net/minecraft/item/ItemArmor.java.patch index 15adcb5a1..c81e15e77 100644 --- a/patches/minecraft/net/minecraft/item/ItemArmor.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemArmor.java.patch @@ -1,26 +1,26 @@ --- ../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); - 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 @@ + ItemStack itemstack = p_82487_2_.func_77946_l(); + itemstack.field_77994_a = 1; +@@ -190,7 +190,7 @@ - if (itemstack1 == null) + if (itemstack == 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"; +@@ -210,6 +210,9 @@ + private final int[] field_78049_g; + private final int field_78055_h; + //Added by forge for custom Armor materials. + public Item customCraftingMaterial = null; @@ -28,7 +28,7 @@ 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 @@ +@@ -235,7 +238,15 @@ public Item func_151685_b() { diff --git a/patches/minecraft/net/minecraft/item/ItemBlock.java.patch b/patches/minecraft/net/minecraft/item/ItemBlock.java.patch index 26420ad34..b87dbda54 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 -@@ -63,16 +63,8 @@ +@@ -54,16 +54,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_); @@ -11,39 +11,23 @@ - - if (iblockstate1.func_177230_c() == this.field_150939_a) - { -- func_179224_a(p_180614_3_, p_180614_4_, p_180614_1_); +- 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_); - } - 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_) +@@ -124,7 +116,7 @@ { -+ 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_); + Block block = p_179222_1_.func_180495_p(p_179222_2_).func_177230_c(); - 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 @@ +- 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; } @@ -63,7 +47,7 @@ + IBlockState state = world.func_180495_p(pos); + if (state.func_177230_c() == this.field_150939_a) + { -+ setTileEntityNBT(world, pos, stack, player); ++ func_179224_a(world, player, pos, stack); + this.field_150939_a.func_180633_a(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 44892d370..098450a80 100644 --- a/patches/minecraft/net/minecraft/item/ItemBow.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemBow.java.patch @@ -1,23 +1,16 @@ --- ../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; - +@@ -27,6 +27,9 @@ 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; + 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; f = (f * f + f * 2.0F) / 3.0F; -@@ -105,6 +109,9 @@ +@@ -104,6 +107,9 @@ public ItemStack func_77659_a(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) { diff --git a/patches/minecraft/net/minecraft/item/ItemBucket.java.patch b/patches/minecraft/net/minecraft/item/ItemBucket.java.patch index e8ae79af8..b2f98aa45 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 4fa7c76aa..a14a80107 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 (!p_77654_2_.field_72995_K) { diff --git a/patches/minecraft/net/minecraft/item/ItemDye.java.patch b/patches/minecraft/net/minecraft/item/ItemDye.java.patch index 68f1abec6..a698baa69 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 (!p_180614_3_.field_72995_K) { -@@ -98,8 +98,18 @@ +@@ -97,8 +97,18 @@ public static boolean func_179234_a(ItemStack p_179234_0_, World p_179234_1_, BlockPos p_179234_2_) { @@ -28,7 +28,7 @@ if (iblockstate.func_177230_c() instanceof IGrowable) { IGrowable igrowable = (IGrowable)iblockstate.func_177230_c(); -@@ -133,7 +143,7 @@ +@@ -132,7 +142,7 @@ Block block = p_180617_0_.func_180495_p(p_180617_1_).func_177230_c(); @@ -37,7 +37,7 @@ { block.func_180654_a(p_180617_0_, p_180617_1_); -@@ -145,6 +155,16 @@ +@@ -144,6 +154,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]); } } diff --git a/patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch b/patches/minecraft/net/minecraft/item/ItemEmptyMap.java.patch index dce46dfd0..aaf05d09d 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 @@ 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); diff --git a/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch b/patches/minecraft/net/minecraft/item/ItemFlintAndSteel.java.patch index cf8ab0013..624bf5ffc 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/ItemLilyPad.java.patch b/patches/minecraft/net/minecraft/item/ItemLilyPad.java.patch index efc47a1a0..e0bd7c80c 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.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)) { diff --git a/patches/minecraft/net/minecraft/item/ItemMap.java.patch b/patches/minecraft/net/minecraft/item/ItemMap.java.patch index 9201f5bba..c8f63dba2 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 -@@ -58,7 +58,7 @@ +@@ -57,7 +57,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); diff --git a/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch b/patches/minecraft/net/minecraft/item/ItemMonsterPlacer.java.patch index 700d90d00..589f68776 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 -@@ -39,7 +39,7 @@ +@@ -36,7 +36,7 @@ public String func_77653_i(ItemStack p_77653_1_) { String s = ("" + StatCollector.func_74838_a(this.func_77658_a() + ".name")).trim(); @@ -9,16 +9,16 @@ if (s1 != null) { -@@ -52,7 +52,7 @@ +@@ -49,7 +49,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; +- 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; } -@@ -77,7 +77,7 @@ +@@ -74,7 +74,7 @@ if (tileentity instanceof TileEntityMobSpawner) { MobSpawnerBaseLogic mobspawnerbaselogic = ((TileEntityMobSpawner)tileentity).func_145881_a(); @@ -27,7 +27,13 @@ tileentity.func_70296_d(); p_180614_3_.func_175689_h(p_180614_4_); -@@ -98,7 +98,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; } @@ -36,7 +42,7 @@ if (entity != null) { -@@ -149,7 +149,7 @@ +@@ -146,7 +146,7 @@ if (p_77659_2_.func_180495_p(blockpos).func_177230_c() instanceof BlockLiquid) { @@ -45,7 +51,7 @@ if (entity != null) { -@@ -173,19 +173,29 @@ +@@ -170,19 +170,29 @@ } } @@ -69,16 +75,16 @@ { Entity entity = null; - for (int j = 0; j < 1; ++j) + for (int i = 0; i < 1; ++i) { - 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)); +@@ -207,5 +217,28 @@ + { + 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()) diff --git a/patches/minecraft/net/minecraft/item/ItemRecord.java.patch b/patches/minecraft/net/minecraft/item/ItemRecord.java.patch index e36f4fca6..dcafa7df7 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 -@@ -75,4 +75,15 @@ +@@ -76,4 +76,15 @@ { return (ItemRecord)field_150928_b.get(p_150926_0_); } 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/ItemSeedFood.java.patch b/patches/minecraft/net/minecraft/item/ItemSeedFood.java.patch index ff7b8fae9..1d4182528 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 field_150908_b; private Block field_82809_c; -@@ -29,7 +29,7 @@ +@@ -28,7 +28,7 @@ { return false; } @@ -18,7 +18,7 @@ { 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; -@@ -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 eef2fbf14..08fd7261b 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 field_150925_a; private Block field_77838_b; -@@ -30,7 +30,7 @@ +@@ -29,7 +29,7 @@ { return false; } @@ -18,7 +18,7 @@ { 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 @@ +@@ -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 a4053e0c8..3f6119ca8 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 func_179218_a(ItemStack p_179218_1_, World p_179218_2_, Block p_179218_3_, BlockPos p_179218_4_, EntityLivingBase p_179218_5_) { @@ -15,7 +15,7 @@ return true; } } -@@ -41,4 +40,71 @@ +@@ -39,4 +38,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; } 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 index 83067a198..0e97068ef 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 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_) { @@ -12,7 +12,7 @@ if (p_180614_5_ == 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 (!p_180614_3_.field_72995_K) { diff --git a/patches/minecraft/net/minecraft/item/ItemSnow.java.patch b/patches/minecraft/net/minecraft/item/ItemSnow.java.patch index 15b264e65..984fba4ed 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 -@@ -66,4 +66,10 @@ +@@ -67,4 +67,10 @@ { return p_77647_1_; } diff --git a/patches/minecraft/net/minecraft/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/item/ItemStack.java.patch index 6a62baf61..8dd896471 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 -@@ -52,6 +52,7 @@ +@@ -49,6 +49,7 @@ + private Block field_179550_j; 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((Block)p_i1876_1_, 1); +@@ -80,7 +81,7 @@ this.field_179553_i = false; this.field_179550_j = null; this.field_179551_k = false; @@ -17,7 +17,7 @@ this.field_77994_a = p_i1881_2_; this.field_77991_e = p_i1881_3_; -@@ -123,11 +124,12 @@ +@@ -120,11 +121,12 @@ public Item func_77973_b() { @@ -31,7 +31,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 @@ +@@ -169,11 +171,11 @@ { if (p_77963_1_.func_150297_b("id", 8)) { @@ -45,7 +45,7 @@ } this.field_77994_a = p_77963_1_.func_74771_c("Count"); -@@ -200,7 +202,7 @@ +@@ -197,7 +199,7 @@ public int func_77976_d() { @@ -54,7 +54,7 @@ } public boolean func_77985_e() -@@ -210,7 +212,7 @@ +@@ -207,7 +209,7 @@ public boolean func_77984_f() { @@ -63,7 +63,7 @@ } public boolean func_77981_g() -@@ -220,32 +222,27 @@ +@@ -217,32 +219,27 @@ public boolean func_77951_h() { @@ -101,7 +101,7 @@ } public boolean func_96631_a(int p_96631_1_, Random p_96631_2_) -@@ -277,8 +274,8 @@ +@@ -274,8 +271,8 @@ } } @@ -112,7 +112,7 @@ } } -@@ -337,7 +334,7 @@ +@@ -334,7 +331,7 @@ public boolean func_150998_b(Block p_150998_1_) { @@ -121,25 +121,24 @@ } public boolean func_111282_a(EntityPlayer p_111282_1_, EntityLivingBase p_111282_2_) -@@ -752,6 +749,8 @@ +@@ -742,6 +739,7 @@ } } -+ net.minecraftforge.event.ForgeEventFactory.onItemTooltip(this, p_82840_1_, arraylist, p_82840_2_); -+ - return arraylist; ++ net.minecraftforge.event.ForgeEventFactory.onItemTooltip(this, p_82840_1_, list, p_82840_2_); + return list; } -@@ -862,7 +861,7 @@ +@@ -852,7 +850,7 @@ } else { -- object = this.func_77973_b().func_111205_h(); -+ object = this.func_77973_b().getAttributeModifiers(this); +- multimap = this.func_77973_b().func_111205_h(); ++ multimap = this.func_77973_b().getAttributeModifiers(this); } - return (Multimap)object; -@@ -870,6 +869,7 @@ + return multimap; +@@ -860,6 +858,7 @@ public void func_150996_a(Item p_150996_1_) { diff --git a/patches/minecraft/net/minecraft/item/ItemSword.java.patch b/patches/minecraft/net/minecraft/item/ItemSword.java.patch index b89d19f90..2b99d22f1 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 func_82789_a(ItemStack p_82789_1_, ItemStack p_82789_2_) { @@ -10,4 +10,4 @@ + return super.func_82789_a(p_82789_1_, p_82789_2_); } - public Multimap func_111205_h() + 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 802da522a..2a0e7450b 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.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); @@ -19,7 +19,7 @@ } public float func_150893_a(ItemStack p_150893_1_, Block p_150893_2_) -@@ -75,7 +87,9 @@ +@@ -74,7 +86,9 @@ public boolean func_82789_a(ItemStack p_82789_1_, ItemStack p_82789_2_) { @@ -29,8 +29,8 @@ + return super.func_82789_a(p_82789_1_, p_82789_2_); } - public Multimap func_111205_h() -@@ -84,4 +98,38 @@ + public Multimap func_111205_h() +@@ -83,4 +97,38 @@ multimap.put(SharedMonsterAttributes.field_111264_e.func_111108_a(), new AttributeModifier(field_111210_e, "Tool modifier", (double)this.field_77865_bY, 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 e717399ed..cd73ea934 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 -@@ -78,6 +78,7 @@ +@@ -72,6 +72,7 @@ public void func_151394_a(ItemStack p_151394_1_, ItemStack p_151394_2_, float p_151394_3_) { @@ -8,13 +8,13 @@ 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 @@ +@@ -101,6 +102,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; - + for (Entry entry : this.field_77605_c.entrySet()) + { + 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 aa829dcaf..4db989adf 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/RecipeFireworks.java.patch @@ -1,27 +1,28 @@ --- ../src-base/minecraft/net/minecraft/item/crafting/RecipeFireworks.java +++ ../src-work/minecraft/net/minecraft/item/crafting/RecipeFireworks.java -@@ -90,9 +90,9 @@ +@@ -86,9 +86,9 @@ { this.field_92102_a = new ItemStack(Items.field_151152_bP); -+ nbttagcompound = new NBTTagCompound(); ++ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); if (l > 0) { -- nbttagcompound = new NBTTagCompound(); - nbttagcompound1 = new NBTTagCompound(); +- NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + NBTTagCompound nbttagcompound3 = new NBTTagCompound(); 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); +@@ -105,9 +105,9 @@ + 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.func_77982_d(nbttagcompound); //Forge BugFix: NPE Protection ++ this.field_92102_a.func_77982_d(nbttagcompound1); //Forge BugFix: NPE Protection return true; } -@@ -253,11 +253,7 @@ + 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_.func_70301_a(i); diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch index e45703adc..bda702d1b 100644 --- a/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch +++ b/patches/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java.patch @@ -1,33 +1,33 @@ --- ../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)arraylist.get(0); + ItemStack itemstack1 = (ItemStack)list.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 @@ +@@ -52,7 +52,7 @@ { - ItemStack itemstack1 = (ItemStack)arraylist.get(0); + ItemStack itemstack1 = (ItemStack)list.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); +@@ -65,7 +65,7 @@ + ItemStack itemstack2 = (ItemStack)list.get(0); + ItemStack itemstack3 = (ItemStack)list.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()) +- 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.func_77973_b(); int j = item.func_77612_l() - itemstack2.func_77952_i(); -@@ -105,11 +105,7 @@ +@@ -102,11 +102,7 @@ for (int i = 0; i < aitemstack.length; ++i) { ItemStack itemstack = p_179532_1_.func_70301_a(i); diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java.patch index 4a45ed51b..15ed231ae 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 -@@ -153,11 +153,7 @@ +@@ -146,11 +146,7 @@ for (int i = 0; i < aitemstack.length; ++i) { ItemStack itemstack = p_179532_1_.func_70301_a(i); diff --git a/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch b/patches/minecraft/net/minecraft/item/crafting/RecipesBanners.java.patch index 55cf592f5..bddf21f35 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 -@@ -143,11 +143,7 @@ +@@ -135,11 +135,7 @@ for (int i = 0; i < aitemstack.length; ++i) { ItemStack itemstack = p_179532_1_.func_70301_a(i); @@ -13,7 +13,7 @@ } return aitemstack; -@@ -375,9 +371,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 7a60d54d0..b67dc5759 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_.func_70301_a(i); diff --git a/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/ShapedRecipes.java.patch index 719da837b..1db66a297 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_.func_70301_a(i); diff --git a/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch b/patches/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java.patch index 50228d863..e2155f198 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 -@@ -32,11 +32,7 @@ +@@ -29,11 +29,7 @@ for (int i = 0; i < aitemstack.length; ++i) { ItemStack itemstack = p_179532_1_.func_70301_a(i); diff --git a/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch index 3c635043e..400efd0fd 100644 --- a/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch +++ b/patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch @@ -9,15 +9,15 @@ public class CompressedStreamTools { -@@ -55,7 +53,6 @@ +@@ -53,7 +51,6 @@ } } - @SideOnly(Side.CLIENT) public static void func_74793_a(NBTTagCompound p_74793_0_, File p_74793_1_) throws IOException { - File file2 = new File(p_74793_1_.getAbsolutePath() + "_tmp"); -@@ -120,6 +117,7 @@ + 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(); @@ -25,7 +25,7 @@ if (b0 == 0) { -@@ -127,7 +125,8 @@ +@@ -125,7 +123,8 @@ } else { @@ -35,7 +35,7 @@ NBTBase nbtbase = NBTBase.func_150284_a(b0); try -@@ -146,7 +145,6 @@ +@@ -144,7 +143,6 @@ } } @@ -43,7 +43,7 @@ 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_)); -@@ -161,7 +159,6 @@ +@@ -159,7 +157,6 @@ } } 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 index 236610d98..8a494fdfb 100644 --- a/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch +++ b/patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch @@ -1,15 +1,6 @@ --- ../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 @@ +@@ -395,6 +395,7 @@ private static byte func_152447_a(DataInput p_152447_0_, NBTSizeTracker p_152447_1_) throws IOException { @@ -17,9 +8,9 @@ return p_152447_0_.readByte(); } -@@ -406,6 +407,7 @@ +@@ -405,6 +406,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_) + 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 { + p_152449_4_.func_152450_a(32); //Forge: 4 extra bytes for the object allocation. NBTBase nbtbase = NBTBase.func_150284_a(p_152449_0_); 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 index 56efede98..178a0151b 100644 --- a/patches/minecraft/net/minecraft/nbt/NBTTagString.java.patch +++ b/patches/minecraft/net/minecraft/nbt/NBTTagString.java.patch @@ -1,8 +1,8 @@ --- ../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 { + 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. diff --git a/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch b/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch index da6530665..111358910 100644 --- a/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch +++ b/patches/minecraft/net/minecraft/network/NetHandlerPlayServer.java.patch @@ -1,80 +1,51 @@ --- ../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; +@@ -254,6 +254,8 @@ + this.field_147369_b.field_70154_o.func_70043_V(); + } -+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; ++ if (!this.field_147380_r) return; //Fixes teleportation kick while riding entities + - 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(); + this.field_147367_d.func_71203_ab().func_72358_d(this.field_147369_b); + + if (this.field_147369_b.field_70154_o != null) +@@ -350,6 +352,8 @@ + this.field_147369_b.func_70664_aZ(); } -+ if (!this.field_147380_r) return; //Fixes teleportation kick while riding entities ++ if (!this.field_147380_r) return; //Fixes "Moved Too Fast" kick when being teleported while moving + - this.field_147367_d.func_71203_ab().func_72358_d(this.field_147369_b); + 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 @@ + field_147370_c.warn(this.field_147369_b.func_70005_c_() + " moved wrongly!"); + } - 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 ++ 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!"); - } + 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); -+ 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) +@@ -377,7 +383,7 @@ { - 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; - } + 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 (!this.field_147380_r) return; //Fixes "Moved Too Fast" kick when being teleported while moving +- 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; +@@ -405,6 +411,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 @@ + 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.field_147369_b.field_70161_v - ((double)blockpos.func_177952_p() + 0.5D); double d3 = d0 * d0 + d1 * d1 + d2 * d2; @@ -86,7 +57,7 @@ { return; } -@@ -540,6 +560,7 @@ +@@ -549,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; @@ -94,24 +65,20 @@ 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 @@ +@@ -560,13 +572,20 @@ 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) ++ 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.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 + 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.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; ++ double dist = field_147369_b.field_71134_c.getBlockReachDistance() + 3; + 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)) { @@ -121,7 +88,7 @@ } flag = true; -@@ -592,7 +620,7 @@ +@@ -601,7 +620,7 @@ this.field_147369_b.field_71070_bA.func_75142_b(); this.field_147369_b.field_71137_h = false; @@ -130,20 +97,20 @@ { 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 @@ +@@ -770,8 +789,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); +- 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.field_147367_d.func_71203_ab().func_148544_a(chat, false); } this.field_147374_l += 20; -@@ -907,7 +937,7 @@ +@@ -916,7 +937,7 @@ return; } @@ -152,15 +119,3 @@ } 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/NetworkManager.java.patch b/patches/minecraft/net/minecraft/network/NetworkManager.java.patch index b37433cda..d86528608 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 -@@ -88,6 +88,11 @@ +@@ -93,6 +93,11 @@ this.field_179294_g = p_i46004_1_; } @@ -12,7 +12,7 @@ public void channelActive(ChannelHandlerContext p_channelActive_1_) throws Exception { super.channelActive(p_channelActive_1_); -@@ -175,7 +180,7 @@ +@@ -208,7 +213,7 @@ final EnumConnectionState enumconnectionstate = EnumConnectionState.func_150752_a(p_150732_1_); final EnumConnectionState enumconnectionstate1 = (EnumConnectionState)this.field_150746_k.attr(field_150739_c).get(); @@ -21,7 +21,7 @@ { field_150735_g.debug("Disabled auto read"); this.field_150746_k.config().setAutoRead(false); -@@ -183,7 +188,7 @@ +@@ -216,7 +221,7 @@ if (this.field_150746_k.eventLoop().inEventLoop()) { @@ -30,8 +30,8 @@ { this.func_150723_a(enumconnectionstate); } -@@ -204,7 +209,7 @@ - private static final String __OBFID = "CL_00001243"; +@@ -236,7 +241,7 @@ + { public void run() { - if (enumconnectionstate != enumconnectionstate1) @@ -39,8 +39,8 @@ { NetworkManager.this.func_150723_a(enumconnectionstate); } -@@ -409,6 +414,11 @@ - this.channelRead0(p_channelRead0_1_, (Packet)p_channelRead0_2_); +@@ -455,6 +460,11 @@ + } } + public Channel channel() diff --git a/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch b/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch index 9452bc6bc..e31f320e9 100644 --- a/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch +++ b/patches/minecraft/net/minecraft/network/NetworkSystem.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/network/NetworkSystem.java +++ ../src-work/minecraft/net/minecraft/network/NetworkSystem.java -@@ -110,7 +110,7 @@ +@@ -115,7 +115,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)); +- 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.field_151272_f.add(networkmanager); - p_initChannel_1_.pipeline().addLast("packet_handler", 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 2407b09f5..856c5c869 100644 --- a/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch +++ b/patches/minecraft/net/minecraft/network/ServerStatusResponse.java.patch @@ -30,7 +30,7 @@ } public String func_151316_d() -@@ -233,6 +237,7 @@ +@@ -215,6 +219,7 @@ serverstatusresponse.func_151320_a(JsonUtils.func_151200_h(jsonobject, "favicon")); } @@ -38,17 +38,13 @@ return serverstatusresponse; } -@@ -260,6 +265,7 @@ +@@ -242,7 +247,47 @@ jsonobject.addProperty("favicon", p_serialize_1_.func_151316_d()); } + 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); 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 2e990c3ad..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,13 +1,13 @@ --- ../src-base/minecraft/net/minecraft/network/handshake/client/C00Handshake.java +++ ../src-work/minecraft/net/minecraft/network/handshake/client/C00Handshake.java -@@ -16,6 +16,7 @@ +@@ -14,6 +14,7 @@ + private String field_149598_b; private int field_149599_c; private EnumConnectionState field_149597_d; - private static final String __OBFID = "CL_00001372"; + private boolean hasFMLMarker = false; - public C00Handshake() {} - + public C00Handshake() + { @@ -28,18 +29,26 @@ this.field_149597_d = p_i45266_4_; } @@ -36,9 +36,9 @@ 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 @@ +@@ -58,4 +67,9 @@ { - this.func_180770_a((INetHandlerHandshakeServer)p_148833_1_); + return this.field_149600_a; } + + public boolean hasFMLMarker() diff --git a/patches/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch b/patches/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java.patch deleted file mode 100644 index a10efa861..000000000 --- a/patches/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.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)); - } - } - 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 ae048b6b5..9604b555a 100644 --- a/patches/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch +++ b/patches/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java.patch @@ -11,4 +11,4 @@ + } } - public void func_180734_a(INetHandlerPlayClient p_180734_1_) + 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 ffc613efe..6e9d12a15 100644 --- a/patches/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch +++ b/patches/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java.patch @@ -4,7 +4,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(field_149297_a.toJson((Object)this.field_149296_b)); + p_148840_1_.func_180714_a(this.field_149296_b.getJson()); } diff --git a/patches/minecraft/net/minecraft/potion/Potion.java.patch b/patches/minecraft/net/minecraft/potion/Potion.java.patch index 5892ca8c8..1ee629dcc 100644 --- a/patches/minecraft/net/minecraft/potion/Potion.java.patch +++ b/patches/minecraft/net/minecraft/potion/Potion.java.patch @@ -1,6 +1,57 @@ --- ../src-base/minecraft/net/minecraft/potion/Potion.java +++ ../src-work/minecraft/net/minecraft/potion/Potion.java -@@ -330,4 +330,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,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_) + { +- 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); + this.field_76418_K = p_i45897_3_; + +@@ -83,14 +83,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_) +@@ -230,7 +234,6 @@ + return this.field_76417_J; + } + +- @SideOnly(Side.CLIENT) + public boolean func_76398_f() + { + return this.field_76418_K; +@@ -310,4 +313,34 @@ { return p_111183_2_.func_111164_d() * (double)(p_111183_1_ + 1); } @@ -8,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/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch b/patches/minecraft/net/minecraft/potion/PotionEffect.java.patch index e23ad06dc..3651f06b7 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 field_100013_f; private boolean field_180156_h; - 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_) { -@@ -37,6 +39,8 @@ +@@ -36,6 +38,8 @@ this.field_76461_c = p_i45896_3_; this.field_82724_e = p_i45896_4_; this.field_180156_h = p_i45896_5_; @@ -18,7 +18,7 @@ } public PotionEffect(PotionEffect p_i1577_1_) -@@ -46,6 +50,7 @@ +@@ -45,6 +49,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; @@ -26,16 +26,16 @@ } public void func_76452_a(PotionEffect p_76452_1_) -@@ -191,7 +196,7 @@ +@@ -190,7 +195,7 @@ public static PotionEffect func_82722_b(NBTTagCompound p_82722_0_) { -- byte b0 = p_82722_0_.func_74771_c("Id"); -+ int b0 = p_82722_0_.func_74771_c("Id") & 0xff; +- int i = p_82722_0_.func_74771_c("Id"); ++ int i = p_82722_0_.func_74771_c("Id") & 0xff; - if (b0 >= 0 && b0 < Potion.field_76425_a.length && Potion.field_76425_a[b0] != null) + if (i >= 0 && i < Potion.field_76425_a.length && Potion.field_76425_a[i] != null) { -@@ -224,4 +229,62 @@ +@@ -223,4 +228,62 @@ { return this.field_100013_f; } @@ -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); + } diff --git a/patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch b/patches/minecraft/net/minecraft/realms/RealmsConnect.java.patch index 0e3324da7..485a416d0 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 -@@ -39,6 +39,7 @@ +@@ -38,6 +38,7 @@ try { @@ -8,7 +8,7 @@ inetaddress = InetAddress.getByName(p_connect_1_); if (RealmsConnect.this.aborted) -@@ -60,7 +61,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 f75083699..c8298d70a 100644 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/server/MinecraftServer.java +++ ../src-work/minecraft/net/minecraft/server/MinecraftServer.java -@@ -99,7 +99,7 @@ +@@ -98,7 +98,7 @@ @SideOnly(Side.SERVER) private String field_71320_r; private int field_71319_s = -1; @@ -9,7 +9,7 @@ private ServerConfigurationManager field_71318_t; private boolean field_71317_u = true; private boolean field_71316_v; -@@ -116,7 +116,8 @@ +@@ -115,7 +115,8 @@ private int field_71280_D; private int field_143008_E = 0; public final long[] field_71311_j = new long[100]; @@ -19,7 +19,7 @@ private KeyPair field_71292_I; private String field_71293_J; private String field_71294_K; -@@ -222,8 +223,6 @@ +@@ -227,8 +228,6 @@ { this.func_71237_c(p_71247_1_); this.func_71192_d("menu.loadingLevel"); @@ -28,52 +28,52 @@ 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 @@ +@@ -259,47 +258,21 @@ worldsettings = new WorldSettings(worldinfo); } -- for (int j = 0; j < this.field_71305_c.length; ++j) +- 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()) { -- byte b0 = 0; +- int j = 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) +- if (i == 1) - { -- b0 = -1; +- j = -1; - } - -- if (j == 2) +- if (i == 2) - { -- b0 = 1; +- j = 1; - } - -- if (j == 0) +- if (i == 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(); +- this.field_71305_c[i] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, j, 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[i] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, j, this.field_71304_b)).func_175643_b(); - } - -- this.field_71305_c[j].func_72963_a(worldsettings); +- this.field_71305_c[i].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[i] = (WorldServer)(new WorldServerMulti(this, isavehandler, j, 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])); +- this.field_71305_c[i].func_72954_a(new WorldManager(this, this.field_71305_c[i])); - if (!this.func_71264_H()) { -- this.field_71305_c[j].func_72912_H().func_76060_a(this.func_71265_f()); +- 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)); @@ -84,24 +84,16 @@ this.func_147139_a(this.func_147135_j()); this.func_71222_d(); } -@@ -309,7 +282,7 @@ +@@ -314,7 +287,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); + int j1 = 0; + 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.func_175694_M(); - long j = func_130071_aq(); + long k1 = 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 @@ +@@ -403,7 +376,7 @@ public void func_71260_j() { @@ -110,7 +102,7 @@ { field_147145_h.info("Stopping server"); -@@ -423,8 +397,15 @@ +@@ -427,8 +400,15 @@ for (int i = 0; i < this.field_71305_c.length; ++i) { WorldServer worldserver = this.field_71305_c[i]; @@ -126,7 +118,7 @@ } if (this.field_71307_n.func_76468_d()) -@@ -456,6 +437,7 @@ +@@ -460,6 +440,7 @@ { if (this.func_71197_b()) { @@ -134,7 +126,7 @@ 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 @@ +@@ -504,12 +485,20 @@ Thread.sleep(Math.max(1L, 50L - i)); this.field_71296_Q = true; } @@ -155,7 +147,7 @@ catch (Throwable throwable1) { field_147145_h.error("Encountered an unexpected exception", throwable1); -@@ -531,6 +521,7 @@ +@@ -535,14 +524,15 @@ field_147145_h.error("We were unable to save this crash report to disk."); } @@ -163,7 +155,16 @@ this.func_71228_a(crashreport); } finally -@@ -546,6 +537,8 @@ + { + try + { +- this.field_71316_v = true; + this.func_71260_j(); ++ this.field_71316_v = true; + } + catch (Throwable throwable) + { +@@ -550,6 +540,8 @@ } finally { @@ -172,7 +173,7 @@ this.func_71240_o(); } } -@@ -591,6 +584,7 @@ +@@ -599,6 +591,7 @@ public void func_71217_p() { long i = System.nanoTime(); @@ -180,7 +181,7 @@ ++this.field_71315_w; if (this.field_71295_T) -@@ -617,6 +611,7 @@ +@@ -625,6 +618,7 @@ Collections.shuffle(Arrays.asList(agameprofile)); this.field_147147_p.func_151318_b().func_151330_a(agameprofile); @@ -188,7 +189,7 @@ } if (this.field_71315_w % 900 == 0) -@@ -644,6 +639,7 @@ +@@ -652,6 +646,7 @@ this.field_71304_b.func_76319_b(); this.field_71304_b.func_76319_b(); @@ -196,23 +197,13 @@ } 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 @@ +@@ -667,14 +662,17 @@ } 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) +- 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++) { @@ -227,23 +218,23 @@ 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 @@ +@@ -685,6 +683,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); + { +@@ -708,6 +707,7 @@ + throw new ReportedException(crashreport1); } + 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 @@ +@@ -715,9 +715,11 @@ this.field_71304_b.func_76319_b(); } @@ -256,7 +247,7 @@ 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 @@ +@@ -739,6 +741,7 @@ public void func_71256_s() { @@ -264,7 +255,7 @@ this.field_175590_aa = new Thread(this, "Server thread"); this.field_175590_aa.start(); } -@@ -757,7 +761,13 @@ +@@ -755,7 +758,13 @@ public WorldServer func_71218_a(int p_71218_1_) { @@ -279,7 +270,7 @@ } public String func_71249_w() -@@ -787,7 +797,7 @@ +@@ -785,7 +794,7 @@ public String getServerModName() { @@ -288,7 +279,7 @@ } public CrashReport func_71230_b(CrashReport p_71230_1_) -@@ -1008,6 +1018,7 @@ +@@ -996,6 +1005,7 @@ if (worldserver != null) { @@ -296,11 +287,3 @@ 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/dedicated/DedicatedServer.java.patch b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch index 1af800c17..3669b9d00 100644 --- a/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/patches/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -5,10 +5,18 @@ private WorldSettings.GameType field_71337_q; private boolean field_71335_s; + public static boolean allowPlayerLogins = false; - private static final String __OBFID = "CL_00001784"; public DedicatedServer(File p_i1508_1_) -@@ -113,6 +114,8 @@ + { +@@ -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 +109,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 @@ +@@ -198,6 +202,7 @@ } else { @@ -25,7 +33,7 @@ this.func_152361_a(new DedicatedPlayerList(this)); long j = System.nanoTime(); -@@ -250,6 +254,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())); @@ -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 @@ +@@ -272,7 +278,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 1caa6d7a0..06a26df6e 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 -@@ -79,6 +79,7 @@ +@@ -78,6 +78,7 @@ System.exit(0); } }); @@ -8,7 +8,7 @@ } public MinecraftServerGui(DedicatedServer p_i2362_1_) -@@ -164,8 +165,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 aeee11c96..7962cb7ac 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 -@@ -74,8 +74,6 @@ +@@ -71,8 +71,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_); @@ -9,52 +9,52 @@ 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 @@ - { +@@ -86,44 +84,24 @@ worldinfo.func_76062_a(p_71247_2_); } + +- for (int i = 0; i < this.field_71305_c.length; ++i) +- { +- int j = 0; + 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) +- if (i == 1) + 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; +- j = -1; + world.func_72912_H().func_76060_a(func_71265_f()); } - -- if (j == 2) +- if (i == 2) - { -- b0 = 1; +- j = 1; - } - -- if (j == 0) +- if (i == 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(); +- this.field_71305_c[i] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, j, 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[i] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, j, this.field_71304_b)).func_175643_b(); - } - -- this.field_71305_c[j].func_72963_a(this.field_71350_m); +- this.field_71305_c[i].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[i] = (WorldServer)(new WorldServerMulti(this, isavehandler, j, 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])); +- 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)); } @@ -66,7 +66,7 @@ { this.func_147139_a(this.field_71349_l.field_71474_y.field_74318_M); } -@@ -144,9 +122,10 @@ +@@ -141,9 +119,10 @@ this.func_71245_h(true); field_147148_h.info("Generating keypair"); this.func_71253_a(CryptManager.func_75891_b()); @@ -78,16 +78,7 @@ } 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 @@ +@@ -216,6 +195,7 @@ public EnumDifficulty func_147135_j() { diff --git a/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch b/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch index 2700fc458..e9e80922d 100644 --- a/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/ItemInWorldManager.java.patch @@ -8,8 +8,8 @@ + 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 @@ + private WorldSettings.GameType field_73091_c = WorldSettings.GameType.NOT_SET; +@@ -130,6 +132,14 @@ public void func_180784_a(BlockPos p_180784_1_, EnumFacing p_180784_2_) { @@ -24,7 +24,7 @@ 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 @@ +@@ -164,18 +174,35 @@ } } @@ -64,7 +64,7 @@ this.func_180237_b(p_180784_1_); } else -@@ -203,7 +230,7 @@ +@@ -196,7 +223,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(); @@ -73,7 +73,7 @@ { 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 @@ +@@ -225,9 +252,13 @@ private boolean func_180235_c(BlockPos p_180235_1_) { @@ -88,7 +88,7 @@ if (flag) { -@@ -246,7 +277,8 @@ +@@ -239,7 +270,8 @@ public boolean func_180237_b(BlockPos p_180237_1_) { @@ -98,7 +98,7 @@ { return false; } -@@ -255,40 +287,21 @@ +@@ -248,40 +280,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_); @@ -144,7 +144,7 @@ if (itemstack1 != null) { -@@ -300,12 +313,18 @@ +@@ -293,12 +306,18 @@ } } @@ -163,15 +163,15 @@ return flag1; } } -@@ -343,6 +362,7 @@ - if (itemstack1.field_77994_a == 0) +@@ -332,6 +351,7 @@ + if (itemstack.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); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_73085_1_, itemstack); } if (!p_73085_1_.func_71039_bw()) -@@ -387,33 +407,51 @@ +@@ -380,33 +400,51 @@ } else { @@ -241,7 +241,7 @@ } } -@@ -421,4 +459,13 @@ +@@ -414,4 +452,13 @@ { this.field_73092_a = p_73080_1_; } diff --git a/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch b/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch index ac63a05cb..e0c026df7 100644 --- a/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch +++ b/patches/minecraft/net/minecraft/server/management/PlayerManager.java.patch @@ -1,11 +1,11 @@ --- ../src-base/minecraft/net/minecraft/server/management/PlayerManager.java +++ ../src-work/minecraft/net/minecraft/server/management/PlayerManager.java -@@ -122,15 +122,24 @@ +@@ -117,15 +117,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(); ++ List chunkList = Lists.newArrayList(); for (int k = i - this.field_72698_e; k <= i + this.field_72698_e; ++k) { @@ -26,15 +26,15 @@ this.field_72699_b.add(p_72683_1_); this.func_72691_b(p_72683_1_); } -@@ -232,6 +241,7 @@ +@@ -225,6 +234,7 @@ int i1 = this.field_72698_e; int j1 = i - k; int k1 = j - l; -+ List chunksToLoad = new ArrayList(); ++ List chunksToLoad = Lists.newArrayList(); if (j1 != 0 || k1 != 0) { -@@ -241,7 +251,7 @@ +@@ -234,7 +244,7 @@ { if (!this.func_72684_a(l1, i2, k, l, i1)) { @@ -43,7 +43,7 @@ } if (!this.func_72684_a(l1 - j1, i2 - k1, i, j, i1)) -@@ -259,6 +269,18 @@ +@@ -252,6 +262,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; @@ -62,7 +62,7 @@ } } } -@@ -334,12 +356,21 @@ +@@ -322,11 +344,20 @@ private int field_73262_e; private int field_73260_f; private long field_111198_g; @@ -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 func_73255_a(EntityPlayerMP p_73255_1_) -@@ -356,7 +387,24 @@ +@@ -343,7 +374,24 @@ } this.field_73263_b.add(p_73255_1_); @@ -110,7 +109,7 @@ } } -@@ -364,6 +412,24 @@ +@@ -351,6 +399,24 @@ { if (this.field_73263_b.contains(p_73252_1_)) { @@ -135,7 +134,7 @@ 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 @@ +@@ -358,9 +424,12 @@ p_73252_1_.field_71135_a.func_147359_a(new S21PacketChunkData(chunk, true, 0)); } @@ -148,7 +147,7 @@ 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 @@ +@@ -398,7 +467,7 @@ this.field_73260_f |= 1 << (p_151253_2_ >> 4); @@ -157,7 +156,7 @@ { short short1 = (short)(p_151253_1_ << 12 | p_151253_3_ << 8 | p_151253_2_); -@@ -423,6 +492,10 @@ +@@ -410,6 +479,10 @@ } } @@ -168,7 +167,7 @@ this.field_151254_d[this.field_73262_e++] = short1; } } -@@ -440,6 +513,7 @@ +@@ -427,6 +500,7 @@ } } @@ -176,7 +175,7 @@ public void func_73254_a() { if (this.field_73262_e != 0) -@@ -456,7 +530,7 @@ +@@ -439,18 +513,19 @@ BlockPos blockpos = new BlockPos(i, j, k); this.func_151251_a(new S23PacketBlockChange(PlayerManager.this.field_72701_a, blockpos)); @@ -185,40 +184,37 @@ { this.func_151252_a(PlayerManager.this.field_72701_a.func_175625_s(blockpos)); } -@@ -465,13 +539,14 @@ + } +- else if (this.field_73262_e == 64) ++ else if (this.field_73262_e >= net.minecraftforge.common.ForgeModContainer.clumpingThreshold) { - int i1; + 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)); -- if (this.field_73262_e == 64) -+ if (this.field_73262_e >= net.minecraftforge.common.ForgeModContainer.clumpingThreshold) +- 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) { - 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 << i2) != 0) { - if ((this.field_73260_f & 1 << k) != 0) - { -@@ -488,7 +563,10 @@ - else +@@ -467,7 +542,9 @@ + 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 (int j1 = 0; j1 < this.field_73262_e; ++j1) { - 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))); -+ } + int l1 = (this.field_151254_d[j1] >> 12 & 15) + this.field_73264_c.field_77276_a * 16; +@@ -475,7 +552,7 @@ + int l2 = (this.field_151254_d[j1] >> 8 & 15) + this.field_73264_c.field_77275_b * 16; + BlockPos blockpos1 = new BlockPos(l1, j2, l2); -+ { //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) +- 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))) { - 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)); - } + this.func_151252_a(PlayerManager.this.field_72701_a.func_175625_s(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 93c276883..000000000 --- a/patches/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.field_152665_g, Charsets.UTF_8); - list = (List)this.field_152660_b.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/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch b/patches/minecraft/net/minecraft/server/management/ServerConfigurationManager.java.patch index 25704f821..2f7ace96d 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 -@@ -103,7 +103,7 @@ +@@ -99,7 +99,7 @@ this.field_72405_c = 8; } @@ -9,7 +9,7 @@ { GameProfile gameprofile = p_72355_2_.func_146103_bH(); PlayerProfileCache playerprofilecache = this.field_72400_f.func_152358_ax(); -@@ -112,6 +112,17 @@ +@@ -108,6 +108,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)); @@ -27,7 +27,7 @@ p_72355_2_.field_71134_c.func_73080_a((WorldServer)p_72355_2_.field_70170_p); String s1 = "local"; -@@ -125,7 +136,7 @@ +@@ -121,7 +132,7 @@ WorldInfo worldinfo = worldserver.func_72912_H(); BlockPos blockpos = worldserver.func_175694_M(); this.func_72381_a(p_72355_2_, (EntityPlayerMP)null, worldserver); @@ -36,7 +36,7 @@ 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 @@ +@@ -161,6 +172,7 @@ p_72355_2_.func_71116_b(); @@ -44,7 +44,7 @@ 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 @@ +@@ -262,6 +274,7 @@ p_72380_1_.func_70020_e(nbttagcompound); nbttagcompound1 = nbttagcompound; field_148546_d.debug("loading single player"); @@ -52,7 +52,7 @@ } else { -@@ -281,8 +294,23 @@ +@@ -271,8 +284,23 @@ return nbttagcompound1; } @@ -76,7 +76,7 @@ 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 @@ +@@ -288,6 +316,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); @@ -84,7 +84,7 @@ worldserver.func_72838_d(p_72377_1_); this.func_72375_a(p_72377_1_, (WorldServer)null); -@@ -315,6 +344,7 @@ +@@ -305,6 +334,7 @@ public void func_72367_e(EntityPlayerMP p_72367_1_) { @@ -92,15 +92,15 @@ 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()); +@@ -326,6 +356,7 @@ + this.field_177454_f.remove(uuid); + this.field_148547_k.remove(uuid); + } + 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 @@ +@@ -409,13 +440,23 @@ public EntityPlayerMP func_72368_a(EntityPlayerMP p_72368_1_, int p_72368_2_, boolean p_72368_3_) { @@ -120,26 +120,26 @@ 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(); +- boolean flag = p_72368_1_.func_82245_bX(); + BlockPos blockpos = p_72368_1_.getBedLocation(p_72368_2_); -+ boolean flag1 = p_72368_1_.isSpawnForced(p_72368_2_); ++ boolean flag = p_72368_1_.isSpawnForced(p_72368_2_); p_72368_1_.field_71093_bK = p_72368_2_; - Object object; + ItemInWorldManager iteminworldmanager; -@@ -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_); +@@ -431,6 +472,7 @@ + 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); -@@ -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; +@@ -470,19 +512,25 @@ + 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 func_72356_a(EntityPlayerMP p_72356_1_, int p_72356_2_) @@ -149,24 +149,24 @@ + + public void transferPlayerToDimension(EntityPlayerMP p_72356_1_, int p_72356_2_, net.minecraft.world.Teleporter teleporter) + { - int j = p_72356_1_.field_71093_bK; + 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())); // Forge: Use new dimensions information ++ 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_, j, worldserver, worldserver1); -+ this.transferEntityToWorld(p_72356_1_, j, worldserver, worldserver1, teleporter); +- 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); -@@ -498,17 +546,27 @@ - PotionEffect potioneffect = (PotionEffect)iterator.next(); +@@ -493,17 +541,27 @@ + { 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_); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(p_72356_1_, i, p_72356_2_); } public void func_82448_a(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_) @@ -193,7 +193,7 @@ { 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 @@ +@@ -514,7 +572,7 @@ p_82448_3_.func_72866_a(p_82448_1_, false); } } @@ -202,7 +202,7 @@ { 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 @@ +@@ -525,7 +583,8 @@ p_82448_3_.func_72866_a(p_82448_1_, false); } } @@ -212,7 +212,7 @@ { BlockPos blockpos; -@@ -565,7 +624,7 @@ +@@ -560,7 +619,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); diff --git a/patches/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch b/patches/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch index 855a224f4..876f48a73 100644 --- a/patches/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch +++ b/patches/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java.patch @@ -1,11 +1,11 @@ --- ../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 func_147383_a(C00Handshake p_147383_1_) { + if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(p_147383_1_, this.field_147386_b)) return; + - switch (NetHandlerHandshakeTCP.SwitchEnumConnectionState.field_151291_a[p_147383_1_.func_149594_c().ordinal()]) + switch (p_147383_1_.func_149594_c()) { - case 1: + 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 b77bfc330..ad1cf3005 100644 --- a/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch +++ b/patches/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java.patch @@ -1,7 +1,13 @@ --- ../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(); +@@ -66,12 +66,12 @@ + if (entityplayermp == null) + { + 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.field_147336_h++ == 600) @@ -9,12 +15,12 @@ { this.func_147322_a("Took too long to log in"); } -@@ -113,7 +113,7 @@ +@@ -130,7 +130,7 @@ + } + else + { +- 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)); } - - 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/stats/StatList.java.patch b/patches/minecraft/net/minecraft/stats/StatList.java.patch index cadaf3998..08c48aaf6 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 -@@ -101,7 +101,7 @@ +@@ -119,7 +119,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 - String s = func_180204_a(item); +- func_75924_a(field_75928_D); ++ replaceAllSimilarBlocks(field_75928_D, true); + } - if (s != null) -@@ -121,11 +121,11 @@ - while (iterator.hasNext()) + private static void func_151181_c() +@@ -141,7 +141,7 @@ + } + } + +- func_75924_a(field_75934_C); ++ replaceAllSimilarBlocks(field_75934_C, false); + } + + private static void func_75925_c() +@@ -165,7 +165,7 @@ + } + } + +- func_75924_a(field_75929_E); ++ replaceAllSimilarBlocks(field_75929_E, true); + } + + private static void func_151179_e() +@@ -184,7 +184,7 @@ + } + } + +- func_75924_a(field_75930_F); ++ replaceAllSimilarBlocks(field_75930_F, 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 func_75924_a(StatBase[] p_75924_0_) ++ private static void replaceAllSimilarBlocks(StatBase[] p_75924_0_, boolean 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.func_149682_b(p_151180_1_); +- int j = Block.func_149682_b(p_151180_2_); ++ int i; ++ int j; ++ if (useItemIds) { ++ 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.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) { - 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 - - 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 - String s = func_180204_a(item); - - if (s != null && block.func_149652_G()) -@@ -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 - String s = func_180204_a(item); - - if (s != null) -@@ -177,7 +177,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 - String s = func_180204_a(item); - - if (s != null && item.func_77645_m()) diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch index ec01c7662..ac86c28d6 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 -@@ -66,6 +66,7 @@ +@@ -59,6 +59,7 @@ public void func_145839_a(NBTTagCompound p_145839_1_) { 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")); @@ -8,7 +8,7 @@ } public void func_145841_b(NBTTagCompound p_145841_1_) -@@ -82,6 +83,7 @@ +@@ -75,6 +76,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()); @@ -16,19 +16,19 @@ } } -@@ -89,9 +91,10 @@ +@@ -82,9 +84,10 @@ { TileEntity tileentity = null; -+ Class oclass = null; ++ Class oclass = null; try { -- Class oclass = (Class)field_145855_i.get(p_145827_0_.func_74779_i("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) { -@@ -109,7 +112,17 @@ +@@ -102,7 +105,17 @@ } else { @@ -46,15 +46,15 @@ } return tileentity; -@@ -141,7 +154,6 @@ +@@ -134,7 +147,6 @@ } } - @SideOnly(Side.CLIENT) public double func_145835_a(double p_145835_1_, double p_145835_3_, double p_145835_5_) { - double d3 = (double)this.field_174879_c.func_177958_n() + 0.5D - p_145835_1_; -@@ -284,4 +296,135 @@ + double d0 = (double)this.field_174879_c.func_177958_n() + 0.5D - p_145835_1_; +@@ -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/tileentity/TileEntityBeacon.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch index 4796b71dc..ad9881182 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityBeacon.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityBeacon.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityBeacon.java -@@ -178,7 +178,7 @@ +@@ -169,7 +169,7 @@ { - Block block = this.field_145850_b.func_180495_p(new BlockPos(l1, k1, j1)).func_177230_c(); + Block block = this.field_145850_b.func_180495_p(new BlockPos(j1, i2, k1)).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 @@ +@@ -368,7 +368,7 @@ public boolean func_94041_b(int p_94041_1_, ItemStack p_94041_2_) { diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch index 91343f16a..2dc57eff9 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java.patch @@ -65,7 +65,7 @@ } } -@@ -306,7 +311,9 @@ +@@ -310,7 +315,9 @@ public boolean func_94041_b(int p_94041_1_, ItemStack p_94041_2_) { diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch index 7fd469917..4966ed5e8 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 -@@ -233,8 +233,7 @@ +@@ -223,8 +223,7 @@ if (this.field_145957_n[1].field_77994_a == 0) { @@ -10,7 +10,7 @@ } } } -@@ -285,7 +284,11 @@ +@@ -279,7 +278,11 @@ else { ItemStack itemstack = FurnaceRecipes.func_77602_a().func_151395_a(this.field_145957_n[0]); @@ -23,7 +23,7 @@ } } -@@ -301,7 +304,7 @@ +@@ -295,7 +298,7 @@ } else if (this.field_145957_n[2].func_77973_b() == itemstack.func_77973_b()) { @@ -32,7 +32,7 @@ } 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 @@ +@@ -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 2ed472779..0f5f3b348 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntityHopper.java.patch @@ -1,17 +1,15 @@ --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityHopper.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityHopper.java -@@ -523,17 +523,30 @@ +@@ -515,17 +515,31 @@ - if (itemstack1 == null) + if (itemstack == 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; + p_174916_0_.func_70299_a(p_174916_2_, p_174916_1_); + p_174916_1_ = null; + } + else + { @@ -19,21 +17,18 @@ + } flag = true; } - else if (func_145894_a(itemstack1, p_174916_1_)) + else if (func_145894_a(itemstack, 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; +- 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_.func_77976_d(), p_174916_0_.func_70297_j_()); -+ if (max > itemstack1.field_77994_a) ++ if (max > itemstack.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; ++ 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 0bf432e05..e3fef4d68 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 func_145877_a() { diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntityPiston.java.patch index 4c1454b57..a1d1cc237 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 -@@ -151,7 +151,8 @@ +@@ -148,7 +148,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); @@ -10,7 +10,7 @@ } } } -@@ -169,7 +170,8 @@ +@@ -166,7 +167,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); diff --git a/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch b/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch index d1cc9e896..6b66af8ce 100644 --- a/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch +++ b/patches/minecraft/net/minecraft/tileentity/TileEntitySign.java.patch @@ -1,7 +1,7 @@ --- ../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_) {} +@@ -61,7 +61,7 @@ + } public boolean func_70003_b(int p_70003_1_, String p_70003_2_) { - return true; 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..fd4f0534d --- /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 +@@ -74,7 +74,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..55efa51da --- /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 +@@ -229,7 +229,6 @@ + return this; + } + +- @SideOnly(Side.CLIENT) + public String func_150218_j() + { + if (this.func_150229_g()) diff --git a/patches/minecraft/net/minecraft/util/EnumChatFormatting.java.patch b/patches/minecraft/net/minecraft/util/EnumChatFormatting.java.patch deleted file mode 100644 index 45fc3d1da..000000000 --- a/patches/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.field_96304_B; - } - -- @SideOnly(Side.CLIENT) - public static String func_110646_a(String p_110646_0_) - { - return p_110646_0_ == null ? null : field_96330_y.matcher(p_110646_0_).replaceAll(""); diff --git a/patches/minecraft/net/minecraft/util/EnumFacing.java.patch b/patches/minecraft/net/minecraft/util/EnumFacing.java.patch index f2a758f48..a0fbc640d 100644 --- a/patches/minecraft/net/minecraft/util/EnumFacing.java.patch +++ b/patches/minecraft/net/minecraft/util/EnumFacing.java.patch @@ -9,31 +9,31 @@ public enum EnumFacing implements IStringSerializable { -@@ -61,7 +59,6 @@ +@@ -60,7 +58,6 @@ return func_82600_a(this.field_176759_h); } - @SideOnly(Side.CLIENT) public EnumFacing func_176732_a(EnumFacing.Axis p_176732_1_) { - switch (EnumFacing.SwitchPlane.field_179515_a[p_176732_1_.ordinal()]) -@@ -109,7 +106,6 @@ + switch (p_176732_1_) +@@ -111,7 +108,6 @@ } } - @SideOnly(Side.CLIENT) private EnumFacing func_176744_n() { - switch (EnumFacing.SwitchPlane.field_179513_b[this.ordinal()]) -@@ -129,7 +125,6 @@ + switch (this) +@@ -131,7 +127,6 @@ } } - @SideOnly(Side.CLIENT) private EnumFacing func_176738_p() { - switch (EnumFacing.SwitchPlane.field_179513_b[this.ordinal()]) -@@ -190,7 +185,6 @@ + switch (this) +@@ -192,7 +187,6 @@ return this.field_176758_k; } @@ -41,7 +41,7 @@ public static EnumFacing func_176739_a(String p_176739_0_) { return p_176739_0_ == null ? null : (EnumFacing)field_176761_p.get(p_176739_0_.toLowerCase()); -@@ -216,7 +210,6 @@ +@@ -218,7 +212,6 @@ return values()[p_176741_0_.nextInt(values().length)]; } @@ -49,15 +49,15 @@ public static EnumFacing func_176737_a(float p_176737_0_, float p_176737_1_, float p_176737_2_) { EnumFacing enumfacing = NORTH; -@@ -249,7 +242,6 @@ - return this.field_176757_j; +@@ -261,7 +254,6 @@ + throw new IllegalArgumentException("No such direction: " + p_181076_0_ + " " + p_181076_1_); } - @SideOnly(Side.CLIENT) public Vec3i func_176730_m() { return this.field_176756_m; -@@ -291,7 +283,6 @@ +@@ -297,7 +289,6 @@ this.field_176723_f = p_i46015_4_; } @@ -65,12 +65,3 @@ public static EnumFacing.Axis func_176717_a(String p_176717_0_) { return p_176717_0_ == null ? null : (EnumFacing.Axis)field_176725_d.get(p_176717_0_.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/minecraft/net/minecraft/util/IChatComponent.java.patch b/patches/minecraft/net/minecraft/util/IChatComponent.java.patch new file mode 100644 index 000000000..2f0530ce4 --- /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 +@@ -31,7 +31,6 @@ + + String func_150260_c(); + +- @SideOnly(Side.CLIENT) + String func_150254_d(); + + List func_150253_a(); 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 7724ff4c7..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_.func_148840_b(packetbuffer); diff --git a/patches/minecraft/net/minecraft/util/MouseHelper.java.patch b/patches/minecraft/net/minecraft/util/MouseHelper.java.patch index 55d49a58d..9a1be0ea4 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 func_74372_a() { diff --git a/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch b/patches/minecraft/net/minecraft/util/MovingObjectPosition.java.patch index 80499add4..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 -@@ -11,6 +11,12 @@ +@@ -10,6 +10,12 @@ + public Vec3 field_72307_f; public Entity field_72308_g; - 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 ba2981731..bef0586ad 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.field_110625_b; } diff --git a/patches/minecraft/net/minecraft/util/Session.java.patch b/patches/minecraft/net/minecraft/util/Session.java.patch index 75fdc5212..19d55db7e 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 field_148257_b; private final String field_148258_c; private final Session.Type field_152429_d; - 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 @@ + { + p_i1098_1_ = "MissingName"; + p_i1098_2_ = p_i1098_3_ = "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.field_74286_b = p_i1098_1_; this.field_148257_b = p_i1098_2_; this.field_148258_c = p_i1098_3_; -@@ -50,11 +65,13 @@ +@@ -49,11 +66,13 @@ try { UUID uuid = UUIDTypeAdapter.fromString(this.func_148255_b()); @@ -34,14 +43,14 @@ + 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) + catch (IllegalArgumentException var2) { - 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()); } } -@@ -63,6 +80,19 @@ +@@ -62,6 +81,19 @@ return this.field_152429_d; } diff --git a/patches/minecraft/net/minecraft/util/StringTranslate.java.patch b/patches/minecraft/net/minecraft/util/StringTranslate.java.patch index cbdfc628a..be6f42827 100644 --- a/patches/minecraft/net/minecraft/util/StringTranslate.java.patch +++ b/patches/minecraft/net/minecraft/util/StringTranslate.java.patch @@ -1,19 +1,10 @@ --- ../src-base/minecraft/net/minecraft/util/StringTranslate.java +++ ../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 String __OBFID = "CL_00001212"; +@@ -23,9 +23,29 @@ public StringTranslate() { + InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); -+ field_74816_c = Maps.newHashMap(); + inject(this, inputstream); + } + @@ -37,11 +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()) -@@ -42,17 +64,17 @@ + for (String s : IOUtils.readLines(inputstream, Charsets.UTF_8)) + { +@@ -37,17 +57,17 @@ { String s1 = astring[0]; String s2 = field_111053_a.matcher(astring[1]).replaceAll("%$1s"); @@ -53,8 +43,8 @@ - this.field_150511_e = System.currentTimeMillis(); } -- catch (IOException ioexception) -+ catch (Exception ioexception) +- catch (IOException var7) ++ catch (Exception var7) { ; } diff --git a/patches/minecraft/net/minecraft/util/Vec3.java.patch b/patches/minecraft/net/minecraft/util/Vec3.java.patch index 0ad59ca10..2cc1ac518 100644 --- a/patches/minecraft/net/minecraft/util/Vec3.java.patch +++ b/patches/minecraft/net/minecraft/util/Vec3.java.patch @@ -9,15 +9,15 @@ public class Vec3 { public final double field_72450_a; -@@ -32,7 +29,6 @@ - this.field_72449_c = p_i1108_5_; +@@ -36,7 +33,6 @@ + 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 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 @@ +@@ -53,7 +49,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; } @@ -25,3 +25,11 @@ 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); +@@ -79,7 +74,6 @@ + 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 func_72438_d(Vec3 p_72438_1_) + { + 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 12827e52b..b8f7e3aa4 100644 --- a/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch +++ b/patches/minecraft/net/minecraft/util/WeightedRandomChestContent.java.patch @@ -1,62 +1,31 @@ --- ../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) +@@ -36,48 +36,39 @@ + for (int i = 0; i < p_177630_3_; ++i) { 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); +- 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.field_76297_b.func_77976_d() >= k) -+ for (ItemStack itemstack : stacks) +- if (weightedrandomchestcontent.field_76297_b.func_77976_d() >= j) ++ for (ItemStack itemstack1 : 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 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 l = 0; l < k; ++l) +- for (int k = 0; k < j; ++k) - { -- 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 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); - } - } } } -@@ -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_); - -- if (weightedrandomchestcontent.field_76297_b.func_77976_d() >= 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); - } -- 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); -- } -- } - } - } - -@@ -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 @@ -69,4 +38,31 @@ + { + return net.minecraftforge.common.ChestGenHooks.generateStacks(random, field_76297_b, field_76295_d, field_76296_e); + } - } ++ + 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.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.field_76297_b.func_77976_d() >= j) ++ for (ItemStack itemstack1 : stacks) + { +- 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.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 1fd5bcd2f..27f632f83 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 -@@ -64,6 +64,8 @@ +@@ -61,6 +61,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; @@ -9,7 +9,7 @@ return this.field_72817_c[i][j].func_177424_a(p_175625_1_, Chunk.EnumCreateEntityType.IMMEDIATE); } -@@ -87,6 +89,7 @@ +@@ -84,6 +86,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; @@ -17,16 +17,16 @@ if (i >= 0 && i < this.field_72817_c.length && j >= 0 && j < this.field_72817_c[i].length) { -@@ -147,6 +150,8 @@ +@@ -139,6 +142,8 @@ { - i = (p_175629_2_.func_177958_n() >> 4) - this.field_72818_a; + 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_); } } -@@ -158,7 +163,7 @@ +@@ -150,7 +155,7 @@ public boolean func_175623_d(BlockPos p_175623_1_) { @@ -35,7 +35,7 @@ } @SideOnly(Side.CLIENT) -@@ -168,6 +173,7 @@ +@@ -160,6 +165,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; @@ -43,7 +43,7 @@ return this.field_72817_c[i][j].func_177413_a(p_175628_1_, p_175628_2_); } else -@@ -187,4 +193,15 @@ +@@ -179,4 +185,15 @@ { return this.field_72815_e.func_175624_G(); } diff --git a/patches/minecraft/net/minecraft/world/Explosion.java.patch b/patches/minecraft/net/minecraft/world/Explosion.java.patch index c7d47ad51..a7cbd02cf 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 -@@ -40,6 +40,7 @@ - private final List field_77281_g; - private final Map field_77288_k; - private static final String __OBFID = "CL_00000134"; +@@ -38,6 +38,7 @@ + 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 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 @@ + 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.field_77282_d = p_i45754_7_; this.field_77286_a = p_i45754_10_; this.field_82755_b = p_i45754_11_; @@ -16,7 +16,7 @@ } public void func_77278_a() -@@ -103,7 +105,7 @@ +@@ -99,7 +101,7 @@ if (iblockstate.func_177230_c().func_149688_o() != Material.field_151579_a) { @@ -25,15 +25,15 @@ 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)); +@@ -126,6 +128,7 @@ + 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 l1 = 0; l1 < list.size(); ++l1) -@@ -223,8 +226,7 @@ + for (int k2 = 0; k2 < list.size(); ++k2) +@@ -213,8 +216,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); } @@ -43,7 +43,7 @@ } } } -@@ -264,4 +266,6 @@ +@@ -250,4 +252,6 @@ { return this.field_77281_g; } diff --git a/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch b/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch index d7dd9a4d2..12456a583 100644 --- a/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch +++ b/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch @@ -1,60 +1,51 @@ --- ../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 @@ - +@@ -69,14 +69,15 @@ + { if ((!enumcreaturetype.func_75599_d() || p_77192_3_) && (enumcreaturetype.func_75599_d() || p_77192_2_) && (!enumcreaturetype.func_82705_e() || p_77192_4_)) { -- i1 = p_77192_1_.func_72907_a(enumcreaturetype.func_75598_a()); -+ i1 = p_77192_1_.countEntities(enumcreaturetype, true); - int i4 = enumcreaturetype.func_75601_b() * i / field_180268_a; +- int j4 = p_77192_1_.func_72907_a(enumcreaturetype.func_75598_a()); ++ int j4 = p_77192_1_.countEntities(enumcreaturetype, true); + int k4 = enumcreaturetype.func_75601_b() * i / field_180268_a; - if (i1 <= i4) + if (j4 <= k4) { - Iterator iterator1 = this.field_77193_b.iterator(); -+ ArrayList tmp = new ArrayList(field_77193_b); -+ Collections.shuffle(tmp); -+ iterator1 = tmp.iterator(); - label115: ++ java.util.ArrayList shuffled = com.google.common.collect.Lists.newArrayList(this.field_77193_b); ++ java.util.Collections.shuffle(shuffled); + label374: +- +- for (ChunkCoordIntPair chunkcoordintpair1 : this.field_77193_b) ++ for (ChunkCoordIntPair chunkcoordintpair1 : shuffled) + { + 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 @@ - while (iterator1.hasNext()) -@@ -153,8 +160,10 @@ + entityliving.func_70012_b((double)f, (double)i3, (double)f1, p_77192_1_.field_73012_v.nextFloat() * 360.0F, 0.0F); - entityliving.func_70012_b((double)f, (double)l2, (double)f1, p_77192_1_.field_73012_v.nextFloat() * 360.0F, 0.0F); +- 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.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_.func_175649_E(new BlockPos(entityliving)), ientitylivingdata); -- if (entityliving.func_70601_bi() && entityliving.func_70058_J()) -+ 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 (!ForgeEventFactory.doSpecialSpawn(entityliving, p_77192_1_, f1, l2, f1)) - ientitylivingdata = entityliving.func_180482_a(p_77192_1_.func_175649_E(new BlockPos(entityliving)), ientitylivingdata); + if (entityliving.func_70058_J()) +@@ -144,7 +147,7 @@ + p_77192_1_.func_72838_d(entityliving); + } - if (entityliving.func_70058_J()) -@@ -163,7 +172,7 @@ - p_77192_1_.func_72838_d(entityliving); - } - -- if (i2 >= entityliving.func_70641_bl()) -+ if (i2 >= ForgeEventFactory.getMaxSpawnPackSize(entityliving)) - { - continue label115; - } -@@ -220,7 +229,7 @@ +- if (j2 >= entityliving.func_70641_bl()) ++ if (i2 >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(entityliving)) + { + continue label374; + } +@@ -193,7 +196,7 @@ { - BlockPos blockpos1 = p_180267_2_.func_177977_b(); + BlockPos blockpos = p_180267_2_.func_177977_b(); -- 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.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 466255637..6ad34ed00 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -1,48 +1,31 @@ --- ../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; +@@ -57,6 +57,13 @@ -+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; + + private int field_181546_a = 63; 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 @@ + public final List field_72996_f = Lists.newArrayList(); +@@ -98,6 +105,10 @@ + private final WorldBorder field_175728_M; int[] field_72994_J; - private static final String __OBFID = "CL_00000140"; + public boolean restoringBlockSnapshots = false; + public boolean captureBlockSnapshots = false; -+ public ArrayList capturedBlockSnapshots = new ArrayList(); ++ public java.util.ArrayList capturedBlockSnapshots = new java.util.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 @@ +@@ -110,6 +121,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(); @@ -50,7 +33,7 @@ } public World func_175643_b() -@@ -120,13 +147,18 @@ +@@ -119,13 +131,18 @@ public BiomeGenBase func_180494_b(final BlockPos p_180494_1_) { @@ -72,16 +55,16 @@ } catch (Throwable throwable) { -@@ -137,7 +169,7 @@ - private static final String __OBFID = "CL_00000141"; - public String call() +@@ -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); -@@ -145,7 +177,7 @@ +@@ -143,7 +160,7 @@ } else { @@ -90,7 +73,7 @@ } } -@@ -186,7 +218,7 @@ +@@ -184,7 +201,7 @@ public boolean func_175623_d(BlockPos p_175623_1_) { @@ -99,7 +82,7 @@ } public boolean func_175667_e(BlockPos p_175667_1_) -@@ -286,39 +318,58 @@ +@@ -284,39 +301,61 @@ { Chunk chunk = this.func_175726_f(p_180501_1_); Block block = p_180501_2_.func_177230_c(); @@ -112,16 +95,16 @@ + } + 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_); + IBlockState iblockstate = chunk.func_177436_a(p_180501_1_, p_180501_2_); - if (iblockstate1 == null) + if (iblockstate == null) { + if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot); return false; } else { - Block block1 = iblockstate1.func_177230_c(); + 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_) != oldLight) @@ -135,22 +118,15 @@ + 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 ++ 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) -- { -- 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) + { @@ -158,19 +134,26 @@ + { + 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()); ++ if (!this.field_72995_K && (flags & 1) != 0) + { +- this.func_175722_b(p_180501_1_, iblockstate.func_177230_c()); ++ this.func_175722_b(pos, new_.func_177230_c()); + +- if (block.func_149740_M()) ++ if (new_.func_177230_c().func_149740_M()) + { +- this.func_175666_e(p_180501_1_, block); ++ this.func_175666_e(pos, new_.func_177230_c()); + } + } +- +- return true; } } } -@@ -408,6 +459,9 @@ +@@ -404,6 +443,9 @@ public void func_175685_c(BlockPos p_175685_1_, Block p_175685_2_) { @@ -180,7 +163,7 @@ 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 @@ +@@ -414,6 +456,11 @@ public void func_175695_a(BlockPos p_175695_1_, Block p_175695_2_, EnumFacing p_175695_3_) { @@ -192,7 +175,7 @@ if (p_175695_3_ != EnumFacing.WEST) { this.func_180496_d(p_175695_1_.func_177976_e(), p_175695_2_); -@@ -782,7 +841,7 @@ +@@ -777,7 +824,7 @@ public boolean func_72935_r() { @@ -201,31 +184,33 @@ } public MovingObjectPosition func_72933_a(Vec3 p_72933_1_, Vec3 p_72933_2_) -@@ -978,6 +1037,11 @@ +@@ -972,6 +1019,12 @@ 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_); ++ 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.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 @@ +@@ -980,6 +1033,12 @@ 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_); ++ 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.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 @@ +@@ -1033,6 +1092,9 @@ public boolean func_72838_d(Entity p_72838_1_) { @@ -235,7 +220,7 @@ 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 @@ +@@ -1055,6 +1117,8 @@ this.func_72854_c(); } @@ -244,13 +229,13 @@ 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 @@ +@@ -1267,17 +1331,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); ++ float f = field_73011_w.getSunBrightnessFactor(p_72967_1_); ++ f = 1 - f; ++ return (int)(f * 11); + } + + /** @@ -262,22 +247,22 @@ + * */ + 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; + 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.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 func_72848_b(IWorldAccess p_72848_1_) { this.field_73021_x.remove(p_72848_1_); -@@ -1290,6 +1376,12 @@ +@@ -1286,6 +1362,12 @@ @SideOnly(Side.CLIENT) public float func_72971_b(float p_72971_1_) { @@ -287,10 +272,10 @@ + @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 @@ + 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 func_72833_a(Entity p_72833_1_, float p_72833_2_) { @@ -300,21 +285,21 @@ + @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 @@ + 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.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); +- float f2 = biomegenbase.func_180626_a(blockpos); +- int l = biomegenbase.func_76731_a(f2); + 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 @@ + 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 func_130001_d() { @@ -326,7 +311,7 @@ return WorldProvider.field_111203_a[this.field_73011_w.func_76559_b(this.field_72986_A.func_76073_f())]; } -@@ -1385,6 +1486,12 @@ +@@ -1379,6 +1470,12 @@ @SideOnly(Side.CLIENT) public Vec3 func_72824_f(float p_72824_1_) { @@ -336,22 +321,22 @@ + @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) + 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(p_175672_1_.func_177958_n(), chunk.func_76625_h() + 16, p_175672_1_.func_177952_p()); blockpos.func_177956_o() >= 0; blockpos = blockpos1) { - blockpos2 = blockpos1.func_177977_b(); -- Material material = chunk.func_177428_a(blockpos2).func_149688_o(); -+ Block block = chunk.func_177428_a(blockpos2); + blockpos1 = blockpos.func_177977_b(); +- Material material = chunk.func_177428_a(blockpos1).func_149688_o(); ++ Block block = chunk.func_177428_a(blockpos1); - 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)) ++ if (block.func_149688_o().func_76230_c() && !block.isLeaves(this, blockpos1) && !block.isFoliage(this, blockpos1)) { break; } -@@ -1456,6 +1563,12 @@ +@@ -1448,6 +1545,12 @@ @SideOnly(Side.CLIENT) public float func_72880_h(float p_72880_1_) { @@ -361,17 +346,17 @@ + @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 @@ + 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.func_85029_a(crashreportcategory); } - throw new ReportedException(crashreport); -+ if (ForgeModContainer.removeErroringEntities) ++ if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities) + { -+ FMLLog.severe(crashreport.func_71502_e()); ++ net.minecraftforge.fml.common.FMLLog.severe(crashreport.func_71502_e()); + func_72900_e(entity); + } + else @@ -381,43 +366,42 @@ } 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) +@@ -1554,7 +1665,15 @@ + 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) + { -+ FMLLog.severe(crashreport.func_71502_e()); -+ func_72900_e(entity); ++ net.minecraftforge.fml.common.FMLLog.severe(crashreport1.func_71502_e()); ++ func_72900_e(entity2); + } + else + { -+ throw new ReportedException(crashreport); ++ throw new ReportedException(crashreport1); + } -+ } } -@@ -1609,7 +1739,16 @@ - CrashReport crashreport1 = CrashReport.func_85055_a(throwable, "Ticking block entity"); - CrashReportCategory crashreportcategory1 = crashreport1.func_85058_a("Block entity being ticked"); +@@ -1601,7 +1720,16 @@ + 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(crashreport1); -+ if (ForgeModContainer.removeErroringTileEntities) +- throw new ReportedException(crashreport2); ++ if (net.minecraftforge.common.ForgeModContainer.removeErroringTileEntities) + { -+ FMLLog.severe(crashreport1.func_71502_e()); ++ net.minecraftforge.fml.common.FMLLog.severe(crashreport2.func_71502_e()); + tileentity.func_145843_s(); + this.func_175713_t(tileentity.func_174877_v()); + } + else + { -+ throw new ReportedException(crashreport1); ++ throw new ReportedException(crashreport2); + } } } } -@@ -1626,15 +1765,19 @@ +@@ -1618,15 +1746,20 @@ } } @@ -429,6 +413,7 @@ + { + ((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(); @@ -439,41 +424,42 @@ this.field_72984_F.func_76318_c("pendingBlockEntities"); if (!this.field_147484_a.isEmpty()) -@@ -1668,7 +1811,8 @@ +@@ -1660,7 +1793,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; ++ 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) + if (flag && p_175700_1_ instanceof ITickable) { -@@ -1710,9 +1854,12 @@ +@@ -1699,9 +1833,13 @@ { 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; +- int k = 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_); ++ int k = isForced ? 0 : 32; ++ 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.func_175663_a(i - b0, 0, j - b0, i + b0, 0, j + b0, 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_.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 @@ +@@ -1829,7 +1967,7 @@ { - Block block = this.func_180495_p(new BlockPos(k1, l1, i2)).func_177230_c(); + Block block = this.func_180495_p(blockpos$mutableblockpos.func_181079_c(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 @@ +@@ -1894,6 +2032,10 @@ { return true; } @@ -484,7 +470,7 @@ } } } -@@ -2039,6 +2190,7 @@ +@@ -2034,6 +2176,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_); @@ -492,7 +478,7 @@ explosion.func_77278_a(); explosion.func_77279_a(true); return explosion; -@@ -2185,19 +2337,28 @@ +@@ -2180,19 +2323,27 @@ else { this.func_175700_a(p_175690_2_); @@ -516,13 +502,12 @@ { 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. ++ if (!(tileentity instanceof ITickable)) //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 @@ +@@ -2205,6 +2356,7 @@ this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_); } @@ -530,7 +515,7 @@ } public void func_147457_a(TileEntity p_147457_1_) -@@ -2228,7 +2390,7 @@ +@@ -2223,7 +2375,7 @@ { IBlockState iblockstate = p_175683_0_.func_180495_p(p_175683_1_); Block block = iblockstate.func_177230_c(); @@ -539,7 +524,7 @@ } public boolean func_175677_d(BlockPos p_175677_1_, boolean p_175677_2_) -@@ -2248,7 +2410,7 @@ +@@ -2243,7 +2395,7 @@ else { Block block = this.func_180495_p(p_175677_1_).func_177230_c(); @@ -548,17 +533,15 @@ } } } -@@ -2265,8 +2427,7 @@ - - public void func_72891_a(boolean p_72891_1_, boolean p_72891_2_) +@@ -2262,6 +2414,7 @@ { -- this.field_72985_G = p_72891_1_; -- this.field_72992_H = 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 @@ +@@ -2271,6 +2424,11 @@ protected void func_72947_a() { @@ -570,7 +553,7 @@ if (this.field_72986_A.func_76059_o()) { this.field_73004_o = 1.0F; -@@ -2289,6 +2455,11 @@ +@@ -2284,6 +2442,11 @@ protected void func_72979_l() { @@ -582,26 +565,26 @@ if (!this.field_73011_w.func_177495_o()) { if (!this.field_72995_K) -@@ -2383,6 +2554,7 @@ +@@ -2378,6 +2541,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; -@@ -2444,8 +2616,9 @@ + + for (int i = 0; i < this.field_73010_i.size(); ++i) + { +@@ -2434,8 +2598,9 @@ Block block = p_147467_3_.func_177428_a(blockpos); - l += p_147467_1_; - i1 += p_147467_2_; + j = j + p_147467_1_; + k = k + p_147467_2_; + BlockPos worldpos = blockpos.func_177982_a(p_147467_1_, 0, 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, worldpos) && this.func_175699_k(worldpos) <= this.field_73012_v.nextInt(8) && this.func_175642_b(EnumSkyBlock.SKY, worldpos) <= 0) //Forge: isAir, and fix arguments to world positions instead of chunk position { - EntityPlayer entityplayer = this.func_72977_a((double)l + 0.5D, (double)j1 + 0.5D, (double)i1 + 0.5D, 8.0D); + EntityPlayer entityplayer = this.func_72977_a((double)j + 0.5D, (double)l + 0.5D, (double)k + 0.5D, 8.0D); -@@ -2485,6 +2658,11 @@ +@@ -2475,6 +2640,11 @@ public boolean func_175670_e(BlockPos p_175670_1_, boolean p_175670_2_) { @@ -613,7 +596,7 @@ BiomeGenBase biomegenbase = this.func_180494_b(p_175670_1_); float f = biomegenbase.func_180626_a(p_175670_1_); -@@ -2526,6 +2704,11 @@ +@@ -2516,6 +2686,11 @@ public boolean func_175708_f(BlockPos p_175708_1_, boolean p_175708_2_) { @@ -625,7 +608,7 @@ BiomeGenBase biomegenbase = this.func_180494_b(p_175708_1_); float f = biomegenbase.func_180626_a(p_175708_1_); -@@ -2543,7 +2726,7 @@ +@@ -2533,7 +2708,7 @@ { Block block = this.func_180495_p(p_175708_1_).func_177230_c(); @@ -634,7 +617,7 @@ { return true; } -@@ -2575,10 +2758,11 @@ +@@ -2565,10 +2740,11 @@ else { Block block = this.func_180495_p(p_175638_1_).func_177230_c(); @@ -649,10 +632,10 @@ { j = 1; } -@@ -2792,10 +2976,10 @@ - public List func_175674_a(Entity p_175674_1_, AxisAlignedBB p_175674_2_, Predicate p_175674_3_) +@@ -2768,10 +2944,10 @@ + public List func_175674_a(Entity p_175674_1_, AxisAlignedBB p_175674_2_, Predicate p_175674_3_) { - ArrayList arraylist = Lists.newArrayList(); + List list = Lists.newArrayList(); - int i = MathHelper.func_76128_c((p_175674_2_.field_72340_a - 2.0D) / 16.0D); - int j = MathHelper.func_76128_c((p_175674_2_.field_72336_d + 2.0D) / 16.0D); - int k = MathHelper.func_76128_c((p_175674_2_.field_72339_c - 2.0D) / 16.0D); @@ -664,9 +647,9 @@ for (int i1 = i; i1 <= j; ++i1) { -@@ -2854,10 +3038,10 @@ +@@ -2824,10 +3000,10 @@ - public List func_175647_a(Class p_175647_1_, AxisAlignedBB p_175647_2_, Predicate p_175647_3_) + 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); @@ -676,19 +659,17 @@ + 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(); + List list = Lists.newArrayList(); for (int i1 = i; i1 <= j; ++i1) -@@ -2938,13 +3122,16 @@ +@@ -2905,11 +3081,13 @@ - public void func_175650_b(Collection p_175650_1_) + 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()) +- + for (Entity entity : p_175650_1_) { - 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))) + { @@ -698,18 +679,18 @@ } } -@@ -2957,7 +3144,9 @@ +@@ -2922,7 +3100,9 @@ { - Block block1 = this.func_180495_p(p_175716_2_).func_177230_c(); + 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 : (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_)); +- 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 (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_); ++ 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_175627_a(BlockPos p_175627_1_, EnumFacing p_175627_2_) -@@ -3032,7 +3221,7 @@ + public int func_181545_F() +@@ -3007,7 +3187,7 @@ { IBlockState iblockstate = this.func_180495_p(p_175651_1_); Block block = iblockstate.func_177230_c(); @@ -718,7 +699,7 @@ } public boolean func_175640_z(BlockPos p_175640_1_) -@@ -3160,7 +3349,7 @@ +@@ -3134,7 +3314,7 @@ public long func_72905_C() { @@ -727,7 +708,7 @@ } public long func_82737_E() -@@ -3170,17 +3359,17 @@ +@@ -3144,17 +3324,17 @@ public long func_72820_D() { @@ -748,7 +729,7 @@ if (!this.func_175723_af().func_177746_a(blockpos)) { -@@ -3192,7 +3381,7 @@ +@@ -3166,7 +3346,7 @@ public void func_175652_B(BlockPos p_175652_1_) { @@ -757,7 +738,7 @@ } @SideOnly(Side.CLIENT) -@@ -3212,12 +3401,18 @@ +@@ -3186,12 +3366,18 @@ if (!this.field_72996_f.contains(p_72897_1_)) { @@ -776,7 +757,7 @@ return true; } -@@ -3307,8 +3502,7 @@ +@@ -3285,8 +3471,7 @@ public boolean func_180502_D(BlockPos p_180502_1_) { @@ -786,7 +767,7 @@ } public MapStorage func_175693_T() -@@ -3367,12 +3561,12 @@ +@@ -3345,12 +3530,12 @@ public int func_72800_K() { @@ -801,7 +782,7 @@ } public Random func_72843_D(int p_72843_1_, int p_72843_2_, int p_72843_3_) -@@ -3429,7 +3623,7 @@ +@@ -3405,7 +3590,7 @@ @SideOnly(Side.CLIENT) public double func_72919_O() { @@ -810,49 +791,36 @@ } public void func_175715_c(int p_175715_1_, BlockPos p_175715_2_, int p_175715_3_) -@@ -3461,29 +3655,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)) +@@ -3447,18 +3632,14 @@ { - IBlockState iblockstate = this.func_180495_p(blockpos1); -- + IBlockState iblockstate = this.func_180495_p(blockpos); + - 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().onNeighborChange(this, blockpos, p_175666_1_); ++ if (iblockstate.func_177230_c().isNormalCube(this, blockpos)) { -- iblockstate.func_177230_c().func_176204_a(this, blockpos1, iblockstate, p_175666_2_); +- iblockstate.func_177230_c().func_176204_a(this, blockpos, 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); +- blockpos = blockpos.func_177972_a(enumfacing); +- iblockstate = this.func_180495_p(blockpos); - - if (Blocks.field_150441_bU.func_149907_e(iblockstate.func_177230_c())) -+ BlockPos posOther = blockpos1.func_177972_a(enumfacing); ++ BlockPos posOther = blockpos.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_); +- iblockstate.func_177230_c().func_176204_a(this, blockpos, iblockstate, p_175666_2_); + other.onNeighborChange(this, posOther, p_175666_1_); } } } -@@ -3553,4 +3739,82 @@ - short short1 = 128; - return k >= -short1 && k <= short1 && l >= -short1 && l <= short1; +@@ -3528,4 +3709,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 @@ -891,9 +859,9 @@ + * + * @return + */ -+ public ImmutableSetMultimap getPersistentChunks() ++ public com.google.common.collect.ImmutableSetMultimap getPersistentChunks() + { -+ return ForgeChunkManager.getPersistentChunksFor(this); ++ return net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this); + } + + /** @@ -911,7 +879,7 @@ + /** + * Returns a count of entities that classify themselves as the specified creature type. + */ -+ public int countEntities(EnumCreatureType type, boolean forSpawnCount) ++ public int countEntities(net.minecraft.entity.EnumCreatureType type, boolean forSpawnCount) + { + int count = 0; + for (int x = 0; x < field_72996_f.size(); x++) diff --git a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch index 1a809089e..1bfabc7e5 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 func_76572_b() { @@ -29,7 +29,7 @@ } public boolean func_76566_a(int p_76566_1_, int p_76566_2_) -@@ -155,13 +141,13 @@ +@@ -153,13 +139,13 @@ public static WorldProvider func_76570_a(int p_76570_0_) { @@ -45,11 +45,11 @@ } @SideOnly(Side.CLIENT) -@@ -177,13 +163,13 @@ +@@ -175,13 +161,13 @@ public int func_76557_i() { -- return this.field_76577_b == WorldType.field_77138_c ? 4 : 64; +- 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); } @@ -61,7 +61,7 @@ } @SideOnly(Side.CLIENT) -@@ -225,4 +211,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 82158837d..bb280aa63 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 List field_94579_S = Lists.newArrayList(); - private static final String __OBFID = "CL_00001437"; + 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(); @@ -63,12 +63,12 @@ @@ -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 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 @@ +@@ -268,10 +289,7 @@ private void func_73051_P() { @@ -80,16 +80,16 @@ } public boolean func_73056_e() -@@ -367,7 +385,7 @@ - int i1; - BlockPos blockpos; +@@ -349,7 +367,7 @@ + chunk.func_150804_b(false); + this.field_72984_F.func_76318_c("thunder"); - 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 @@ + int i1 = this.field_73005_l >> 2; +@@ -363,7 +381,7 @@ this.field_72984_F.func_76318_c("iceandsnow"); @@ -97,18 +97,18 @@ + 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 @@ + int k2 = this.field_73005_l >> 2; +@@ -456,6 +474,9 @@ if (p_175654_2_.func_149698_L()) { - b0 = 8; + i = 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); ++ i = 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))) + 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))) { -@@ -535,7 +556,7 @@ +@@ -508,7 +529,7 @@ public void func_72939_s() { @@ -117,44 +117,44 @@ { if (this.field_80004_Q++ >= 1200) { -@@ -601,6 +622,9 @@ +@@ -573,6 +594,9 @@ { - nextticklistentry = (NextTickListEntry)iterator.next(); + 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; - byte b0 = 0; + int k = 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 @@ + 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,40 @@ { - ArrayList arraylist = Lists.newArrayList(); + List list = 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++) +- for (int i = 0; i < this.field_147482_g.size(); ++i) ++ //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(k1); +- 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) { -- arraylist.add(tileentity); -+ Chunk chunk = this.func_72964_e(x, z); -+ if (chunk != null) +- list.add(tileentity); ++ 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 (Object obj : chunk.func_177434_r().values()) ++ for (TileEntity entity : 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_) ++ pos.func_177958_n() < p_147486_4_ && pos.func_177956_o() < p_147486_5_ && pos.func_177952_p() < p_147486_6_) + { -+ arraylist.add(entity); ++ list.add(entity); + } + + } @@ -162,8 +162,9 @@ + } } } - -@@ -745,6 +784,10 @@ +- + return list; + } public boolean func_175660_a(EntityPlayer p_175660_1_, BlockPos p_175660_2_) { @@ -174,15 +175,15 @@ 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 @@ +@@ -777,6 +819,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 @@ + List list = worldchunkmanager.func_76932_a(); +@@ -822,7 +865,7 @@ protected void func_73047_i() { @@ -191,15 +192,15 @@ for (int i = 0; i < 10; ++i) { -@@ -892,6 +936,7 @@ +@@ -859,6 +902,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 @@ + for (Chunk chunk : Lists.newArrayList(this.field_73059_b.func_152380_a())) + { +@@ -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_) -@@ -984,6 +1030,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); -@@ -1074,19 +1121,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 @@ } } -@@ -1152,6 +1203,11 @@ +@@ -1104,6 +1154,11 @@ return this.field_73061_a.func_152345_ab(); } @@ -252,6 +253,6 @@ + return ((net.minecraft.world.chunk.storage.AnvilChunkLoader)field_73059_b.field_73247_e).field_75825_d; + } + - static class ServerBlockEventList extends ArrayList + 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 8295a73c4..dc61a1c4d 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 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_) { @@ -14,9 +13,9 @@ - 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 @@ + { +@@ -46,11 +47,13 @@ { WorldServerMulti.this.func_175723_af().func_177724_b(p_177695_2_); } @@ -25,14 +24,13 @@ + 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 -+ { + protected void func_73042_a() throws MinecraftException + { + this.perWorldStorage.func_75744_a(); -+ } + } public World func_175643_b() - { +@@ -58,12 +61,12 @@ 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); @@ -47,7 +45,7 @@ } else { -@@ -73,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 26290a812..1f7e26efa 100644 --- a/patches/minecraft/net/minecraft/world/WorldType.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldType.java.patch @@ -1,21 +1,6 @@ --- ../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 @@ +@@ -27,6 +27,7 @@ private WorldType(int p_i1960_1_, String p_i1960_2_, int p_i1960_3_) { @@ -23,7 +8,7 @@ this.field_77133_f = p_i1960_2_; this.field_77134_g = p_i1960_3_; this.field_77140_h = true; -@@ -114,4 +124,144 @@ +@@ -113,4 +114,144 @@ this.field_151361_l = true; return this; } @@ -84,7 +69,7 @@ + } + + int oldLen = field_77139_a.length; -+ field_77139_a = Arrays.copyOf(field_77139_a, oldLen + 16); ++ field_77139_a = java.util.Arrays.copyOf(field_77139_a, oldLen + 16); + return oldLen; + } + @@ -119,15 +104,15 @@ + * @param guiCreateWorld the createworld GUI + */ + @SideOnly(Side.CLIENT) -+ public void onCustomizeButton(Minecraft mc, GuiCreateWorld guiCreateWorld) ++ public void onCustomizeButton(net.minecraft.client.Minecraft mc, net.minecraft.client.gui.GuiCreateWorld guiCreateWorld) + { + if (this == WorldType.field_77138_c) + { -+ mc.func_147108_a(new GuiCreateFlatWorld(guiCreateWorld, guiCreateWorld.field_146334_a)); ++ mc.func_147108_a(new net.minecraft.client.gui.GuiCreateFlatWorld(guiCreateWorld, guiCreateWorld.field_146334_a)); + } + else if (this == WorldType.field_180271_f) + { -+ mc.func_147108_a(new GuiCustomizeWorldScreen(guiCreateWorld, guiCreateWorld.field_146334_a)); ++ mc.func_147108_a(new net.minecraft.client.gui.GuiCustomizeWorldScreen(guiCreateWorld, guiCreateWorld.field_146334_a)); + } + } + @@ -160,11 +145,11 @@ + * @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) ++ public net.minecraft.world.gen.layer.GenLayer getBiomeLayer(long worldSeed, net.minecraft.world.gen.layer.GenLayer parentLayer, String chunkProviderSettingsJson) + { -+ GenLayer ret = new GenLayerBiome(200L, parentLayer, this, chunkProviderSettingsJson); -+ ret = GenLayerZoom.func_75915_a(1000L, ret, 2); -+ ret = new GenLayerBiomeEdge(1000L, ret); ++ 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.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 bcd054cb7..4c72cae17 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 -@@ -30,7 +30,7 @@ - private static final String __OBFID = "CL_00002146"; +@@ -26,7 +26,7 @@ + { public int func_180283_a(BiomeGenBase p_180283_1_, BlockPos p_180283_2_) { - return p_180283_1_.field_76759_H; + 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 f1cbc0743..c18d05315 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeDecorator.java.patch @@ -1,267 +1,169 @@ --- ../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 @@ +@@ -105,8 +105,10 @@ 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)); ++ 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(); - 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) ++ 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) { - j = this.field_76813_b.nextInt(16) + 8; - k = this.field_76813_b.nextInt(16) + 8; + int j = this.field_76813_b.nextInt(16) + 8; +@@ -114,6 +116,7 @@ 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) ++ 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) { - 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))); + int l1 = this.field_76813_b.nextInt(16) + 8; +@@ -121,6 +124,7 @@ + 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))); } -- 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) ++ 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) { - j = this.field_76813_b.nextInt(16) + 8; - k = this.field_76813_b.nextInt(16) + 8; -@@ -161,7 +170,8 @@ - int l; - BlockPos blockpos; + int i2 = this.field_76813_b.nextInt(16) + 8; +@@ -135,6 +139,7 @@ + ++k1; + } -- 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) ++ 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) { - k = this.field_76813_b.nextInt(16) + 8; - l = this.field_76813_b.nextInt(16) + 8; -@@ -175,7 +185,8 @@ + int k6 = this.field_76813_b.nextInt(16) + 8; +@@ -149,6 +154,7 @@ } } -- 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) ++ 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) { - k = this.field_76813_b.nextInt(16) + 8; - l = this.field_76813_b.nextInt(16) + 8; -@@ -184,11 +195,12 @@ + int l6 = this.field_76813_b.nextInt(16) + 8; +@@ -156,6 +162,7 @@ + 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))); + } - 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) ++ 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) { - 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 @@ + int i7 = this.field_76813_b.nextInt(16) + 8; +@@ -177,6 +184,7 @@ } } -- 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) ++ 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) { - 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 @@ + int j7 = this.field_76813_b.nextInt(16) + 8; +@@ -190,6 +198,7 @@ } } -- 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(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.field_76813_b.nextInt(16) + 8; +@@ -203,6 +212,7 @@ + } + } + ++ 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.field_76813_b.nextInt(16) + 8; +@@ -229,6 +239,8 @@ + } + } + ++ 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.field_76798_D; ++l3) { 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); +@@ -279,7 +291,9 @@ + 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(field_76815_a, field_76813_b, field_180294_c, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.REED)) ++ { + for (int k4 = 0; k4 < this.field_76799_E; ++k4) + { + int i9 = this.field_76813_b.nextInt(16) + 8; +@@ -305,7 +319,8 @@ + 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(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.field_76813_b.nextInt(16) + 8; +@@ -319,6 +334,7 @@ } } -- if (this.field_76813_b.nextInt(4) == 0) -+ if (doGen && this.field_76813_b.nextInt(4) == 0) ++ 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) { - 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)); - } + int l9 = this.field_76813_b.nextInt(16) + 8; +@@ -334,6 +350,7 @@ -- if (this.field_76813_b.nextInt(8) == 0) -+ if (doGen && this.field_76813_b.nextInt(8) == 0) + if (this.field_76808_K) { - 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) ++ 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) { - 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); + int i10 = this.field_76813_b.nextInt(16) + 8; +@@ -348,6 +365,7 @@ + } } -- 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) ++ 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) { - 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); + int j10 = this.field_76813_b.nextInt(16) + 8; +@@ -357,6 +375,7 @@ + (new WorldGenLiquids(Blocks.field_150356_k)).func_180709_b(this.field_76815_a, this.field_76813_b, blockpos3); } } -+ -+ MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(field_76815_a, field_76813_b, 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 func_76795_a(int p_76795_1_, WorldGenerator p_76795_2_, int p_76795_3_, int p_76795_4_) -@@ -370,16 +393,35 @@ +@@ -397,16 +416,29 @@ 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)) ++ 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 (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76820_j, field_180294_c, GRAVEL)) ++ 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 (TerrainGen.generateOre(field_76815_a, field_76813_b, field_180297_k, field_180294_c, DIORITE)) ++ 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 (TerrainGen.generateOre(field_76815_a, field_76813_b, field_180296_j, field_180294_c, GRANITE)) ++ 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 (TerrainGen.generateOre(field_76815_a, field_76813_b, field_180295_l, field_180294_c, ANDESITE)) ++ 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 (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76821_k, field_180294_c, COAL)) ++ 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 (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76818_l, field_180294_c, IRON)) ++ 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 (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76819_m, field_180294_c, GOLD)) ++ 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 (TerrainGen.generateOre(field_76815_a, field_76813_b, field_180299_p, field_180294_c, REDSTONE)) ++ 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 (TerrainGen.generateOre(field_76815_a, field_76813_b, field_180298_q, field_180294_c, DIAMOND)) ++ 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 (TerrainGen.generateOre(field_76815_a, field_76813_b, field_76831_p, field_180294_c, LAPIS)) ++ 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); -+ MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Post(field_76815_a, field_76813_b, field_180294_c)); ++ net.minecraftforge.common.MinecraftForge.ORE_GEN_BUS.post(new net.minecraftforge.event.terraingen.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/BiomeGenBase.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch index ab745af60..032589894 100644 --- a/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/BiomeGenBase.java.patch @@ -1,16 +1,6 @@ --- ../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 field_150586_aC = LogManager.getLogger(); -@@ -139,6 +142,10 @@ +@@ -138,6 +138,10 @@ public BiomeGenBase(int p_i1971_1_) { @@ -18,10 +8,10 @@ + } + 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; -@@ -156,6 +163,7 @@ + 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.field_76758_O = new WorldGenBigTree(false); this.field_76763_Q = new WorldGenSwamp(); this.field_76756_M = p_i1971_1_; @@ -29,7 +19,7 @@ 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)); -@@ -172,11 +180,12 @@ +@@ -168,11 +173,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)); @@ -43,7 +33,7 @@ } public BiomeGenBase func_76732_a(float p_76732_1_, float p_76732_2_) -@@ -346,7 +355,7 @@ +@@ -342,7 +348,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); @@ -52,7 +42,7 @@ } @SideOnly(Side.CLIENT) -@@ -354,7 +363,7 @@ +@@ -350,7 +356,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); @@ -61,7 +51,7 @@ } public boolean func_150559_j() -@@ -500,6 +509,84 @@ +@@ -497,6 +503,84 @@ } } @@ -70,27 +60,27 @@ + + public BiomeDecorator getModdedBiomeDecorator(BiomeDecorator original) + { -+ return new DeferredBiomeDecorator(original); ++ return new net.minecraftforge.event.terraingen.DeferredBiomeDecorator(original); + } + + public int getWaterColorMultiplier() + { -+ BiomeEvent.GetWaterColor event = new BiomeEvent.GetWaterColor(this, field_76759_H); -+ MinecraftForge.EVENT_BUS.post(event); ++ 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; + } + + public int getModdedBiomeGrassColor(int original) + { -+ BiomeEvent.GetGrassColor event = new BiomeEvent.GetGrassColor(this, original); -+ MinecraftForge.EVENT_BUS.post(event); ++ 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) + { -+ BiomeEvent.GetFoliageColor event = new BiomeEvent.GetFoliageColor(this, original); -+ MinecraftForge.EVENT_BUS.post(event); ++ 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; + } + diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenForest.java.patch index baadaaa76..95b469419 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 -@@ -220,4 +220,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 951092d6d..129a16dfc 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 -@@ -58,7 +58,7 @@ - int i1 = p_180624_2_.nextInt(16); - BlockPos blockpos1 = 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.EMERALD)) ++ emeralds.func_180709_b(p_180624_1_, p_180624_2_, p_180624_3_); -- 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); - } +- 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) +- { +- 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/patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenJungle.java.patch index 52cad7625..3c559c56a 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 -@@ -61,7 +61,9 @@ +@@ -68,7 +68,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; diff --git a/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch b/patches/minecraft/net/minecraft/world/biome/BiomeGenPlains.java.patch index 307fd62fc..275d4491a 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 -@@ -109,4 +109,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 d3c19e270..2df358347 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 c23cb8256..5378a0e20 100644 --- a/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch +++ b/patches/minecraft/net/minecraft/world/biome/WorldChunkManager.java.patch @@ -1,23 +1,17 @@ --- ../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; +@@ -16,6 +16,7 @@ -+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(field_76767_f, field_76772_c, field_76768_g, field_76784_u, field_76785_t, field_76782_w, field_76792_x); ++ 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; -@@ -28,13 +33,7 @@ +@@ -27,13 +28,7 @@ this.field_76942_f = new BiomeCache(this); this.field_180301_f = ""; - this.field_76943_g = Lists.newArrayList(); + 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); @@ -29,7 +23,7 @@ } public WorldChunkManager(long p_i45744_1_, WorldType p_i45744_3_, String p_i45744_4_) -@@ -42,6 +41,7 @@ +@@ -41,6 +36,7 @@ this(); this.field_180301_f = p_i45744_4_; GenLayer[] agenlayer = GenLayer.func_180781_a(p_i45744_1_, p_i45744_3_, p_i45744_4_); @@ -37,15 +31,15 @@ this.field_76944_d = agenlayer[0]; this.field_76945_e = agenlayer[1]; } -@@ -250,4 +250,11 @@ +@@ -249,4 +245,11 @@ { this.field_76942_f.func_76838_a(); } + + public GenLayer[] getModdedBiomeGenerators(WorldType worldType, long seed, GenLayer[] original) + { -+ WorldTypeEvent.InitBiomeGens event = new WorldTypeEvent.InitBiomeGens(worldType, seed, original); -+ MinecraftForge.TERRAIN_GEN_BUS.post(event); ++ 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/border/WorldBorder.java.patch b/patches/minecraft/net/minecraft/world/border/WorldBorder.java.patch index c7f2cf0b9..6c9214f8e 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 -@@ -293,4 +293,9 @@ +@@ -277,4 +277,9 @@ iborderlistener.func_177690_b(this, p_177747_1_); } } diff --git a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch index 9ccc98432..f05c96eb7 100644 --- a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -1,25 +1,15 @@ --- ../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; +@@ -167,7 +167,7 @@ + { + Block block = this.func_150810_a(j, l - 1, k); -@@ -174,7 +177,7 @@ +- if (block.func_149717_k() != 0) ++ if (func_150808_b(j, l - 1, k) != 0) { - Block block = this.func_150810_a(j, l - 1, k); + this.field_76634_f[k << 4 | j] = l; -- if (block.func_149717_k() == 0) -+ if (func_150808_b(j, l - 1, k) == 0) - { - --l; - continue; -@@ -469,12 +472,12 @@ +@@ -440,12 +440,12 @@ public int func_177437_b(BlockPos p_177437_1_) { @@ -34,12 +24,8 @@ } private Block func_150810_a(int p_150810_1_, int p_150810_2_, int p_150810_3_) -@@ -653,16 +656,23 @@ - flag = j >= i1; - } +@@ -623,14 +623,19 @@ -+ 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) @@ -47,36 +33,37 @@ { 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); ++ if (block1 != block) //Only fire block breaks when the block changes. + 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_, iblockstate1, p_177436_2_)) this.field_76637_e.func_175713_t(p_177436_1_); ++ 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(iblockstate1)) ++ else if (block1.hasTileEntity(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_, iblockstate1, p_177436_2_)) ++ 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_); } } -@@ -679,8 +689,7 @@ +@@ -647,8 +652,8 @@ } else { - int j1 = block.func_149717_k(); - int k1 = block1.func_149717_k(); -+ int k1 = block.getLightOpacity(this.field_76637_e, p_177436_1_); ++ 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) { -@@ -702,28 +711,18 @@ - - TileEntity tileentity; +@@ -668,28 +673,18 @@ + } + } - if (block1 instanceof ITileEntityProvider) - { -- tileentity = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK); +- TileEntity tileentity = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK); - - if (tileentity != null) - { @@ -92,24 +79,24 @@ - if (block instanceof ITileEntityProvider) + if (block.hasTileEntity(p_177436_2_)) { - tileentity = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK); + TileEntity tileentity1 = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK); - if (tileentity == null) + if (tileentity1 == 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); +- 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); } -@@ -826,6 +825,7 @@ +@@ -792,6 +787,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)); ++ 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; -@@ -864,13 +864,20 @@ +@@ -830,13 +826,20 @@ private TileEntity func_177422_i(BlockPos p_177422_1_) { Block block = this.func_177428_a(p_177422_1_); @@ -131,7 +118,7 @@ if (tileentity == null) { if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE) -@@ -883,11 +890,6 @@ +@@ -849,11 +852,6 @@ this.field_177447_w.add(p_177424_1_); } } @@ -143,7 +130,7 @@ return tileentity; } -@@ -907,7 +909,7 @@ +@@ -873,7 +871,7 @@ p_177426_2_.func_145834_a(this.field_76637_e); p_177426_2_.func_174878_a(p_177426_1_); @@ -152,28 +139,36 @@ { if (this.field_150816_i.containsKey(p_177426_1_)) { -@@ -947,8 +949,9 @@ +@@ -882,6 +880,7 @@ + + p_177426_2_.func_145829_t(); + this.field_150816_i.put(p_177426_1_, p_177426_2_); ++ p_177426_2_.onLoad(); + } + } + +@@ -910,8 +909,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)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(this)); } public void func_76623_d() -@@ -966,6 +969,7 @@ +@@ -927,6 +927,7 @@ { this.field_76637_e.func_175681_c(this.field_76645_j[i]); } -+ MinecraftForge.EVENT_BUS.post(new ChunkEvent.Unload(this)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Unload(this)); } public void func_76630_e() -@@ -975,8 +979,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_) + 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); @@ -182,9 +177,9 @@ 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 @@ +@@ -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_) + 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); @@ -193,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); -@@ -1179,8 +1183,10 @@ +@@ -1137,8 +1138,10 @@ while (!this.field_177447_w.isEmpty()) { BlockPos blockpos = (BlockPos)this.field_177447_w.poll(); @@ -205,33 +200,28 @@ { TileEntity tileentity = this.func_177422_i(blockpos); this.field_76637_e.func_175690_a(blockpos, tileentity); -@@ -1242,6 +1248,15 @@ +@@ -1200,6 +1203,13 @@ @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()) ++ for(TileEntity tileEntity : field_150816_i.values()) + { -+ 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; + int i = 0; + boolean flag = !this.field_76637_e.field_73011_w.func_177495_o(); + +@@ -1267,10 +1277,16 @@ 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()) ++ List invalidList = new java.util.ArrayList(); ++ + for (TileEntity tileentity : this.field_150816_i.values()) { - 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(); @@ -241,9 +231,9 @@ } public BiomeGenBase func_177411_a(BlockPos p_177411_1_, WorldChunkManager p_177411_2_) -@@ -1644,4 +1664,20 @@ - - private static final String __OBFID = "CL_00002009"; +@@ -1583,4 +1599,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 b19f7eb70..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,15 +1,6 @@ --- ../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 @@ +@@ -42,8 +42,41 @@ this.field_75825_d = p_i2003_1_; } @@ -17,24 +8,20 @@ + { + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(x, z); + -+ synchronized (this.field_75827_c) ++ if (this.field_75826_b.contains(chunkcoordintpair)) + { -+ if (this.field_75826_b.contains(chunkcoordintpair)) ++ for(ChunkCoordIntPair pendingChunkCoord : this.field_75828_a.keySet()) + { -+ Iterator iter = this.field_75828_a.iterator(); -+ while (iter.hasNext()) ++ if (pendingChunkCoord.equals(chunkcoordintpair)) + { -+ PendingChunk pendingChunk = (PendingChunk)iter.next(); -+ if (pendingChunk.field_76548_a.equals(chunkcoordintpair)) -+ { -+ return true; -+ } ++ return true; + } + } + } + + return RegionFileCache.func_76550_a(this.field_75825_d, 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 { + Object[] data = this.loadChunk__Async(p_75815_1_, p_75815_2_, p_75815_3_); @@ -52,27 +39,10 @@ + + public Object[] loadChunk__Async(World p_75815_1_, int p_75815_2_, int p_75815_3_) throws IOException + { - NBTTagCompound nbttagcompound = null; ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_75815_2_, p_75815_3_); - Object object = this.field_75827_c; -@@ -53,11 +92,13 @@ - { - if (this.field_75826_b.contains(chunkcoordintpair)) - { -- for (int k = 0; k < this.field_75828_a.size(); ++k) -+ Iterator iter = this.field_75828_a.iterator(); -+ while (iter.hasNext()) - { -- if (((AnvilChunkLoader.PendingChunk)this.field_75828_a.get(k)).field_76548_a.equals(chunkcoordintpair)) -+ PendingChunk pendingChunk = (PendingChunk)iter.next(); -+ if (pendingChunk.field_76548_a.equals(chunkcoordintpair)) - { -- nbttagcompound = ((AnvilChunkLoader.PendingChunk)this.field_75828_a.get(k)).field_76547_b; -+ nbttagcompound = pendingChunk.field_76547_b; - break; - } - } -@@ -76,11 +117,17 @@ + NBTTagCompound nbttagcompound = (NBTTagCompound)this.field_75828_a.get(chunkcoordintpair); + +@@ -59,11 +92,17 @@ nbttagcompound = CompressedStreamTools.func_74794_a(datainputstream); } @@ -91,47 +61,48 @@ if (!p_75822_4_.func_150297_b("Level", 10)) { field_151505_a.error("Chunk file at " + p_75822_2_ + "," + p_75822_3_ + " 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_); +@@ -87,10 +126,29 @@ + 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.func_150295_c("TileEntities", 10); + -+ // 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); -+ -+ if (_tileEntities != null) -+ { -+ for (int te = 0; te < _tileEntities.func_74745_c(); te++) ++ if (_tileEntities != null) + { -+ 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)); ++ for (int te = 0; te < _tileEntities.func_74745_c(); 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)); ++ } + } -+ } - chunk = this.func_75823_a(p_75822_1_, p_75822_4_.func_74775_l("Level")); ++ + chunk = this.func_75823_a(p_75822_1_, 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; } -- -- 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 @@ +@@ -105,6 +163,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)); ++ 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) -@@ -287,11 +352,20 @@ - Entity entity = (Entity)iterator.next(); - nbttagcompound1 = new NBTTagCompound(); +@@ -281,11 +340,20 @@ + { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + try + { @@ -150,14 +121,14 @@ } } -@@ -303,8 +377,17 @@ +@@ -295,8 +363,17 @@ + for (TileEntity tileentity : p_75820_1_.func_177434_r().values()) { - TileEntity tileentity = (TileEntity)iterator.next(); - nbttagcompound1 = new NBTTagCompound(); + NBTTagCompound nbttagcompound2 = new NBTTagCompound(); + try + { - tileentity.func_145841_b(nbttagcompound1); - nbttaglist2.func_74742_a(nbttagcompound1); + tileentity.func_145841_b(nbttagcompound2); + nbttaglist2.func_74742_a(nbttagcompound2); + } + catch (Exception e) + { @@ -168,7 +139,7 @@ } p_75820_3_.func_74782_a("TileEntities", nbttaglist2); -@@ -386,6 +469,12 @@ +@@ -376,6 +453,12 @@ chunk.func_76616_a(p_75823_2_.func_74770_j("Biomes")); } @@ -181,12 +152,11 @@ NBTTagList nbttaglist1 = p_75823_2_.func_150295_c("Entities", 10); if (nbttaglist1 != null) -@@ -457,8 +546,6 @@ +@@ -447,7 +530,5 @@ } } } - - return chunk; } - - static class PendingChunk + } 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 dc0036916..9e563a70b 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java.patch @@ -1,20 +1,20 @@ --- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java +++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java -@@ -23,18 +23,12 @@ +@@ -20,18 +20,12 @@ + { File file1 = this.func_75765_b(); - File file2; - if (p_75763_1_ instanceof WorldProviderHell) + if (p_75763_1_.getSaveFolder() != null) { -- file2 = new File(file1, "DIM-1"); -+ file2 = new File(file1, p_75763_1_.getSaveFolder()); - file2.mkdirs(); - return new AnvilChunkLoader(file2); +- File file3 = new File(file1, "DIM-1"); ++ File file3 = new File(file1, p_75763_1_.getSaveFolder()); + file3.mkdirs(); + return new AnvilChunkLoader(file3); } - else if (p_75763_1_ instanceof WorldProviderEnd) - { -- file2 = new File(file1, "DIM1"); +- File file2 = new File(file1, "DIM1"); - file2.mkdirs(); - return new AnvilChunkLoader(file2); - } 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 34fba0645..945276017 100644 --- a/patches/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java.patch @@ -1,11 +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 @@ +@@ -34,6 +34,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(); + 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 af121db7f..1992d6dad 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 -@@ -105,6 +105,39 @@ +@@ -101,6 +101,39 @@ } } diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch index c3e3d7a75..f4cec46a7 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java.patch @@ -1,22 +1,22 @@ --- ../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.*; +@@ -32,6 +32,9 @@ + 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 class ChunkProviderEnd implements IChunkProvider - { -@@ -43,6 +46,14 @@ + public ChunkProviderEnd(World p_i2007_1_, long p_i2007_2_) + { +@@ -42,6 +45,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); + + 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); ++ 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]; @@ -25,50 +25,43 @@ } public void func_180520_a(int p_180520_1_, int p_180520_2_, ChunkPrimer p_180520_3_) -@@ -115,6 +126,9 @@ +@@ -114,6 +125,9 @@ 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); -+ MinecraftForge.EVENT_BUS.post(event); -+ if (event.getResult() == Result.DENY) return; ++ 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) { for (int j = 0; j < 16; ++j) -@@ -164,8 +178,10 @@ - } - } +@@ -165,6 +179,7 @@ -+ private int chunkX=0, chunkZ=0; public Chunk func_73154_d(int p_73154_1_, int p_73154_2_) { + 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.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); -@@ -185,6 +201,10 @@ +@@ -184,6 +199,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_) { -+ 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; ++ 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_]; -@@ -275,8 +295,14 @@ +@@ -273,8 +292,10 @@ 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_73200_m, field_73200_m.field_73012_v, p_73153_2_, p_73153_3_, false)); -+ ++ 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.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); -+ -+ 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)); -+ ++ 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 36e3964e9..d8d3ed7df 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java.patch @@ -1,40 +1,28 @@ --- ../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.*; +@@ -58,6 +58,15 @@ - 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(); + public ChunkProviderGenerate(World p_i45636_1_, long p_i45636_2_, boolean p_i45636_4_, String p_i45636_5_) + { + { -+ 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); ++ 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.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(); +@@ -87,6 +96,16 @@ 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, field_73214_a, field_73212_b, field_73213_c}; -+ noiseGens = TerrainGen.getModdedNoiseGenerators(p_i45636_1_, this.field_73220_k, noiseGens); ++ 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]; @@ -45,76 +33,77 @@ } public void func_180518_a(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_) -@@ -169,6 +193,10 @@ +@@ -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_) { -+ 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; ++ 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.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 @@ +@@ -366,6 +389,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)); ++ 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.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; +@@ -391,7 +416,8 @@ + this.field_177474_A.func_175794_a(this.field_73230_p, this.field_73220_k, chunkcoordintpair); + } - 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)) ++ && 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)) { - 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)); + int i1 = this.field_73220_k.nextInt(16) + 8; + int j1 = this.field_73220_k.nextInt(256); +@@ -399,7 +425,8 @@ + (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.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) ++ 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)) { - 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 @@ + 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.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) +- 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) { - l1 = this.field_73220_k.nextInt(16) + 8; - i2 = this.field_73220_k.nextInt(256); -@@ -436,10 +468,14 @@ + int i3 = this.field_73220_k.nextInt(16) + 8; + int l3 = this.field_73220_k.nextInt(256); +@@ -423,10 +451,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)) + 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.func_77191_a(this.field_73230_p, biomegenbase, k + 8, l + 8, 16, 16, this.field_73220_k); + SpawnerAnimals.func_77191_a(this.field_73230_p, biomegenbase, i + 8, j + 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 (int k2 = 0; k2 < 16; ++k2) ++ 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 (l1 = 0; l1 < 16; ++l1) + for (int j3 = 0; j3 < 16; ++j3) { -@@ -458,6 +494,8 @@ +@@ -445,6 +477,8 @@ } } -+ MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, field_73230_p, field_73220_k, 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.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 98670b6ba..216df8267 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderHell.java.patch @@ -1,27 +1,22 @@ --- ../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.*; +@@ -49,8 +49,8 @@ + 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 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); + public ChunkProviderHell(World p_i45637_1_, boolean p_i45637_2_, long p_i45637_3_) + { ++ 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.field_73181_i = new Random(p_i45637_3_); @@ -32,18 +27,17 @@ - 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) ++ 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 = TerrainGen.getModdedNoiseGenerators(p_i45637_1_, this.field_73181_i, noiseGens); ++ 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]; @@ -51,74 +45,71 @@ + 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); } - public void func_180515_a(int p_180515_1_, int p_180515_2_, ChunkPrimer p_180515_3_) -@@ -155,6 +174,10 @@ +@@ -148,6 +161,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; ++ 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; + - byte b0 = 64; + int i = this.field_73175_o.func_181545_F() + 1; 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 @@ +@@ -265,6 +282,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; ++ 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_]; -@@ -365,47 +392,58 @@ +@@ -356,50 +377,60 @@ 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)); -+ ++ 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.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) +- for (int i = 0; i < 8; ++i) ++ 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.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) +- 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.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) +- 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.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) +- for (int l = 0; l < 10; ++l) ++ for (int l = 0; doGen && l < 10; ++l) { 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)); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre(field_73175_o, field_73181_i, blockpos)); + -+ doGen = TerrainGen.decorate(field_73175_o, field_73181_i, blockpos, SHROOM); ++ 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.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)); @@ -130,16 +121,21 @@ 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) +- for (int i1 = 0; i1 < 16; ++i1) ++ 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.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) +- for (int j1 = 0; j1 < 16; ++j1) ++ 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.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_, 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 0d7b3a944..cd28c7ec7 100644 --- a/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/ChunkProviderServer.java.patch @@ -1,34 +1,23 @@ --- ../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(); +@@ -36,6 +36,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 @@ + { +@@ -57,7 +58,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.field_73011_w.func_76567_e() && net.minecraftforge.common.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 @@ +@@ -80,12 +81,64 @@ public Chunk func_73158_c(int p_73158_1_, int p_73158_2_) { @@ -40,11 +29,11 @@ + 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; ++ net.minecraft.world.chunk.storage.AnvilChunkLoader loader = null; + -+ if (this.field_73247_e instanceof AnvilChunkLoader) ++ if (this.field_73247_e instanceof net.minecraft.world.chunk.storage.AnvilChunkLoader) + { -+ loader = (AnvilChunkLoader) this.field_73247_e; ++ loader = (net.minecraft.world.chunk.storage.AnvilChunkLoader) this.field_73247_e; + } + + // We can only use the queue for already generated chunks @@ -52,12 +41,12 @@ + { + if (runnable != null) + { -+ ChunkIOExecutor.queueChunkLoad(this.field_73251_h, loader, this, par1, par2, runnable); ++ net.minecraftforge.common.chunkio.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); ++ chunk = net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(this.field_73251_h, loader, this, par1, par2); + } + } + else if (chunk == null) @@ -76,32 +65,32 @@ + + 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); + 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(k); ++ boolean added = loadingChunks.add(i); + 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()); ++ 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 = ForgeChunkManager.fetchDormantChunk(k, this.field_73251_h); ++ chunk = net.minecraftforge.common.ForgeChunkManager.fetchDormantChunk(i, 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 @@ +@@ -114,6 +167,7 @@ - this.field_73244_f.func_76163_a(k, chunk); + this.field_73244_f.func_76163_a(i, chunk); this.field_73245_g.add(chunk); -+ loadingChunks.remove(k); ++ loadingChunks.remove(i); chunk.func_76631_c(); chunk.func_76624_a(this, this, p_73158_1_, p_73158_2_); } -@@ -209,6 +267,7 @@ +@@ -205,6 +259,7 @@ if (this.field_73246_d != null) { this.field_73246_d.func_73153_a(p_73153_1_, p_73153_2_, p_73153_3_); @@ -109,30 +98,28 @@ chunk.func_76630_e(); } } -@@ -269,8 +328,13 @@ +@@ -266,6 +321,11 @@ { 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) -+ { + 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 @@ +@@ -280,6 +340,12 @@ 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()); ++ 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.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 741188f61..63fe3a7bb 100644 --- a/patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/MapGenCaves.java.patch @@ -1,58 +1,51 @@ --- ../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 @@ +@@ -138,7 +138,7 @@ { - IBlockState iblockstate = p_180702_5_.func_177856_a(k2, i3, l2); + IBlockState iblockstate = p_180702_5_.func_177856_a(j1, l1, k1); - if (iblockstate.func_177230_c() == Blocks.field_150358_i || iblockstate.func_177230_c() == Blocks.field_150355_j) -+ if (isOceanBlock(p_180702_5_, k2, i3, l2, p_180702_3_, p_180702_4_)) ++ if (isOceanBlock(p_180702_5_, j1, l1, k1, 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()); +@@ -176,33 +176,12 @@ + 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.func_177230_c() == Blocks.field_150349_c || iblockstate1.func_177230_c() == Blocks.field_150391_bh) -+ if (isTopBlock(p_180702_5_, k2, j3, j4, p_180702_3_, p_180702_4_)) ++ if (isTopBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_)) { flag1 = true; } -- + - if (this.func_175793_a(iblockstate1, iblockstate2)) - { -- if (j3 - 1 < 10) +- if (j2 - 1 < 10) - { -- p_180702_5_.func_177855_a(k2, j3, j4, Blocks.field_150353_l.func_176223_P()); +- p_180702_5_.func_177855_a(j3, j2, i2, Blocks.field_150353_l.func_176223_P()); - } - else - { -- p_180702_5_.func_177855_a(k2, j3, j4, Blocks.field_150350_a.func_176223_P()); +- p_180702_5_.func_177855_a(j3, j2, i2, Blocks.field_150350_a.func_176223_P()); - - if (iblockstate2.func_177230_c() == Blocks.field_150354_m) - { -- 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_.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_.func_177856_a(k2, j3 - 1, j4).func_177230_c() == Blocks.field_150346_d) +- if (flag1 && p_180702_5_.func_177856_a(j3, j2 - 1, i2).func_177230_c() == Blocks.field_150346_d) - { -- 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()); +- blockpos$mutableblockpos.func_181079_c(j3 + p_180702_3_ * 16, 0, i2 + p_180702_4_ * 16); +- 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()); - } - } - } -+ digBlock(p_180702_5_, k2, j3, j4, p_180702_3_, p_180702_4_, flag1, iblockstate1, iblockstate2); ++ digBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_, flag1, iblockstate1, iblockstate2); } } } -@@ -261,4 +241,71 @@ +@@ -261,4 +240,71 @@ } } } diff --git a/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch b/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch index 3e88554e1..b5fc50da7 100644 --- a/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/MapGenRavine.java.patch @@ -1,45 +1,46 @@ --- ../src-base/minecraft/net/minecraft/world/gen/MapGenRavine.java +++ ../src-work/minecraft/net/minecraft/world/gen/MapGenRavine.java -@@ -130,7 +130,7 @@ +@@ -128,7 +128,7 @@ { - IBlockState iblockstate = p_180707_5_.func_177856_a(k2, i3, l2); + IBlockState iblockstate = p_180707_5_.func_177856_a(j1, l1, k1); - if (iblockstate.func_177230_c() == Blocks.field_150358_i || iblockstate.func_177230_c() == Blocks.field_150355_j) -+ 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; } -@@ -165,27 +165,12 @@ +@@ -165,28 +165,12 @@ { - IBlockState iblockstate1 = p_180707_5_.func_177856_a(k2, j3, j4); + IBlockState iblockstate1 = p_180707_5_.func_177856_a(j3, j2, i2); - if (iblockstate1.func_177230_c() == Blocks.field_150349_c) -+ if (isTopBlock(p_180707_5_, k2, j3, j4, p_180707_3_, p_180707_4_)) ++ if (isTopBlock(p_180707_5_, j3, j2, i2, 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 (j3 - 1 < 10) +- if (j2 - 1 < 10) - { -- p_180707_5_.func_177855_a(k2, j3, j4, Blocks.field_150356_k.func_176223_P()); +- p_180707_5_.func_177855_a(j3, j2, i2, Blocks.field_150356_k.func_176223_P()); - } - else - { -- p_180707_5_.func_177855_a(k2, j3, j4, Blocks.field_150350_a.func_176223_P()); +- p_180707_5_.func_177855_a(j3, j2, i2, Blocks.field_150350_a.func_176223_P()); - -- if (flag && p_180707_5_.func_177856_a(k2, j3 - 1, j4).func_177230_c() == Blocks.field_150346_d) +- if (flag && p_180707_5_.func_177856_a(j3, j2 - 1, i2).func_177230_c() == Blocks.field_150346_d) - { -- 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); +- blockpos$mutableblockpos.func_181079_c(j3 + p_180707_3_ * 16, 0, i2 + p_180707_4_ * 16); +- p_180707_5_.func_177855_a(j3, j2 - 1, i2, this.field_75039_c.func_180494_b(blockpos$mutableblockpos).field_76752_A); - } - } - } -+ digBlock(p_180707_5_, k2, j3, j4, p_180707_3_, p_180707_4_, flag); ++ digBlock(p_180707_5_, j3, j2, i2, p_180707_3_, p_180707_4_, flag); } } } -@@ -220,4 +205,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 087efae91..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,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java -@@ -30,4 +30,10 @@ +@@ -31,4 +31,10 @@ this.func_175903_a(p_175921_1_, p_175921_2_, Blocks.field_150346_d.func_176223_P()); } } 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 74b05fae4..2a98d8c83 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java.patch @@ -1,37 +1,33 @@ --- ../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) +@@ -54,7 +54,7 @@ { -- 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); + 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 (!state.func_177230_c().isAir(p_180709_1_, pos) && !state.func_177230_c().isLeaves(p_180709_1_, pos)) ++ if (!block.isAir(p_180709_1_, blockpos$mutableblockpos) && !block.isLeaves(p_180709_1_, blockpos$mutableblockpos)) { flag = false; } -@@ -188,7 +189,7 @@ +@@ -190,7 +190,7 @@ { - BlockPos blockpos1 = new BlockPos(i2, l, j1); + BlockPos blockpos = new BlockPos(l1, l2, 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)) +- 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_175905_a(p_180709_1_, blockpos1, Block.func_149729_e(Block.func_149682_b(Blocks.field_150420_aW) + i), k1); + this.func_175903_a(p_180709_1_, blockpos, this.field_76523_a.func_176223_P().func_177226_a(BlockHugeMushroom.field_176380_a, blockhugemushroom$enumtype)); } -@@ -199,9 +200,10 @@ +@@ -201,9 +201,10 @@ - for (l = 0; l < j; ++l) + for (int i3 = 0; i3 < i; ++i3) { -- 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(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.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); + 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 4921fddef..7fb88e1b7 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java.patch @@ -1,27 +1,27 @@ --- ../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_)) +@@ -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 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); + 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.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)) ++ if (state.func_177230_c().isAir(this.field_175946_l, blockpos) || state.func_177230_c().isLeaves(this.field_175946_l, blockpos)) { - this.func_175905_a(this.field_175946_l, blockpos1, p_180712_3_, 0); + this.func_175903_a(this.field_175946_l, blockpos, p_181631_3_); } -@@ -268,7 +268,7 @@ +@@ -254,7 +254,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)); + 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.field_175946_l.func_180495_p(blockpos3).func_177230_c())) -+ if (!this.isReplaceable(field_175946_l, blockpos3)) +- 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; } -@@ -296,6 +296,7 @@ +@@ -282,6 +282,7 @@ if (!this.func_76497_e()) { @@ -29,7 +29,7 @@ return false; } else -@@ -304,15 +305,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 2b819de6b..6bc3eb814 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java.patch @@ -1,61 +1,65 @@ --- ../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 @@ +@@ -33,9 +33,10 @@ + if (k >= 1 && k + i + 1 < 256) + { + 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.field_150349_c && block != Blocks.field_150346_d) ++ if (!(isSoil && p_180709_3_.func_177956_o() < 256 - i - 1)) + { + return false; + } +@@ -45,10 +46,10 @@ } 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)); +- 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 @@ -- 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) + int k2 = k + j2; + BlockPos blockpos1 = new BlockPos(k1, k2, l1); +- 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_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) { -- 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 @@ - +- 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 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); + BlockPos blockpos = new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_); +- 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.func_149688_o() == Material.field_151579_a) -+ if (state.func_177230_c().isAir(p_150526_1_, pos)) ++ if (state.func_177230_c().isAir(p_150526_1_, blockpos)) { - this.func_175905_a(p_150526_1_, new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_), Blocks.field_150361_u, 1); + this.func_175903_a(p_150526_1_, blockpos, field_181641_b); } } + 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 fea2ba727..61253bc64 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/WorldGenDungeons.java.patch b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch index ab64b259f..dd91af336 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java.patch @@ -1,40 +1,30 @@ --- ../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; +@@ -123,12 +123,11 @@ + if (j3 == 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); - public class WorldGenDungeons extends WorldGenerator - { -@@ -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); + if (tileentity1 instanceof TileEntityChest) + { +- 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); + } - 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_)); - } - - break label197; -@@ -184,6 +186,12 @@ + break; +@@ -159,6 +158,12 @@ private String func_76543_b(Random p_76543_1_) { - return field_175916_b[p_76543_1_.nextInt(field_175916_b.length)]; -+ return DungeonHooks.getRandomDungeonMob(p_76543_1_); ++ return net.minecraftforge.common.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)); ++ 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 a08072e11..9eca24df4 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java -@@ -55,7 +55,7 @@ +@@ -58,7 +58,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))) +- 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; } -@@ -74,11 +74,13 @@ +@@ -77,11 +77,13 @@ } else { @@ -23,28 +23,28 @@ { - 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(); + 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 = p_180709_1_.func_180495_p(blockpos).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)) ++ if (block.isAir(p_180709_1_, blockpos) || block.isLeaves(p_180709_1_, blockpos)) { - this.func_175905_a(p_180709_1_, blockpos1, Blocks.field_150362_t, BlockPlanks.EnumType.BIRCH.func_176839_a()); + this.func_175903_a(p_180709_1_, blockpos, field_181630_b); } -@@ -110,9 +112,10 @@ +@@ -112,9 +114,9 @@ - for (i2 = 0; i2 < i; ++i2) + for (int j2 = 0; j2 < i; ++j2) { -- 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(); - +- Block block2 = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(j2)).func_177230_c(); +- - 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_175905_a(p_180709_1_, p_180709_3_.func_177981_b(i2), Blocks.field_150364_r, BlockPlanks.EnumType.BIRCH.func_176839_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 553097c1b..16ea524eb 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java.patch @@ -2,56 +2,56 @@ +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java @@ -59,7 +59,7 @@ { - for (int l = -b0; l <= b0 && flag; ++l) + for (int l = -j; l <= j && 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))) +- 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 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)); + 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.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_); +- 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 (k * k + l * l <= j || i1 * i1 + j1 * j1 <= j || k * k + j1 * j1 <= j || i1 * i1 + l * l <= j) + if (j * j + k * k <= i || l * l + i1 * i1 <= i || j * j + i1 * i1 <= i || l * l + k * k <= i) { - 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); + 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.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)) ++ if (state.func_177230_c().isAir(p_175925_1_, blockpos) || state.func_177230_c().isLeaves(p_175925_1_, blockpos)) { - this.func_175905_a(p_175925_1_, blockpos1, Blocks.field_150362_t, this.field_76521_c); + this.func_175903_a(p_175925_1_, blockpos, this.field_76521_c); } @@ -135,9 +136,9 @@ - if (k * k + l * l <= j) + if (j * j + k * k <= i) { - 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(); + 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.field_151579_a || material == Material.field_151584_j) -+ if (block.isAir(p_175928_1_, blockpos1) || block.isLeaves(p_175928_1_, blockpos1)) ++ if (block.isAir(p_175928_1_, blockpos) || block.isLeaves(p_175928_1_, blockpos)) { - this.func_175905_a(p_175928_1_, blockpos1, Blocks.field_150362_t, this.field_76521_c); + this.func_175903_a(p_175928_1_, blockpos, this.field_76521_c); } @@ -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 449385cd2..6856a6cfc 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java.patch @@ -1,54 +1,42 @@ --- ../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 blockpos1 = p_180709_3_.func_177981_b(i2); + BlockPos blockpos = 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)) +- if (this.func_150523_a(p_180709_1_.func_180495_p(blockpos).func_177230_c())) ++ if (this.isAirLeaves(p_180709_1_,blockpos)) { - this.func_175905_a(p_180709_1_, blockpos1, Blocks.field_150364_r, this.field_76520_b); + this.func_175903_a(p_180709_1_, blockpos, this.field_76520_b); -@@ -72,7 +72,7 @@ +@@ -70,7 +70,7 @@ { - BlockPos blockpos2 = blockpos1.func_177974_f(); + BlockPos blockpos1 = blockpos.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)) +- if (this.func_150523_a(p_180709_1_.func_180495_p(blockpos1).func_177230_c())) ++ if (this.isAirLeaves(p_180709_1_,blockpos1)) { - this.func_175905_a(p_180709_1_, blockpos2, Blocks.field_150364_r, this.field_76520_b); + this.func_175903_a(p_180709_1_, blockpos1, this.field_76520_b); -@@ -85,7 +85,7 @@ +@@ -83,7 +83,7 @@ - BlockPos blockpos3 = blockpos1.func_177968_d().func_177974_f(); + BlockPos blockpos2 = blockpos.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)) +- if (this.func_150523_a(p_180709_1_.func_180495_p(blockpos2).func_177230_c())) ++ if (this.isAirLeaves(p_180709_1_,blockpos2)) { - this.func_175905_a(p_180709_1_, blockpos3, Blocks.field_150364_r, this.field_76520_b); + this.func_175903_a(p_180709_1_, blockpos2, this.field_76520_b); -@@ -98,7 +98,7 @@ +@@ -96,7 +96,7 @@ - BlockPos blockpos4 = blockpos1.func_177968_d(); + BlockPos blockpos3 = blockpos.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)) +- if (this.func_150523_a(p_180709_1_.func_180495_p(blockpos3).func_177230_c())) ++ if (this.isAirLeaves(p_180709_1_,blockpos3)) { - this.func_175905_a(p_180709_1_, blockpos4, Blocks.field_150364_r, this.field_76520_b); + this.func_175903_a(p_180709_1_, blockpos3, 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 @@ +@@ -130,4 +130,11 @@ this.func_175925_a(p_175930_1_, p_175930_2_.func_177981_b(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 865e78c88..f658ebfe6 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java.patch @@ -1,15 +1,13 @@ --- ../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) +@@ -43,30 +43,24 @@ { -- Block block = p_180709_1_.func_180495_p(p_180709_3_.func_177981_b(j)).func_177230_c(); -- + 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))) ++ if (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); + this.func_175903_a(p_180709_1_, p_180709_3_.func_177981_b(j), this.field_76520_b); } if (j < i - 1) @@ -17,39 +15,39 @@ - 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))) ++ if (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); + this.func_175903_a(p_180709_1_, p_180709_3_.func_177982_a(1, j, 0), 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))) ++ if (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); + this.func_175903_a(p_180709_1_, p_180709_3_.func_177982_a(1, j, 1), 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))) ++ if (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); + this.func_175903_a(p_180709_1_, p_180709_3_.func_177982_a(0, j, 1), 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(); +@@ -132,16 +126,23 @@ + BlockPos blockpos = p_175934_2_.func_177981_b(i); + Block block = p_175934_1_.func_180495_p(blockpos).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))) ++ if (block.canSustainPlant(p_175934_1_, blockpos, 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()); + this.func_175903_a(p_175934_1_, blockpos, field_181635_g); break; } - if (block.func_149688_o() != Material.field_151579_a && i < 0) -+ if (!block.isAir(p_175934_1_, blockpos1) && i < 0) ++ if (!block.isAir(p_175934_1_, blockpos) && i < 0) { break; } 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 b8dbd5446..b3aef2aae 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java.patch @@ -1,11 +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 @@ +@@ -73,7 +73,7 @@ { - BlockPos blockpos1 = new BlockPos(l1, i2, j2); + BlockPos blockpos = 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(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)) { - p_180709_1_.func_180501_a(blockpos1, this.field_175920_a, 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 48c841f3b..105b15ca4 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java -@@ -48,7 +48,7 @@ +@@ -52,7 +52,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))) +- 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; } -@@ -67,11 +67,13 @@ +@@ -71,11 +71,13 @@ } else { @@ -24,33 +24,33 @@ - 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 @@ + int k2 = i - p_180709_2_.nextInt(4) - 1; + int l2 = 3 - p_180709_2_.nextInt(3); +@@ -95,9 +97,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(); + BlockPos blockpos = new BlockPos(i3, i2, j1); +- 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.field_151579_a || material == Material.field_151584_j) -+ if (block.isAir(p_180709_1_, blockpos1) || block.isLeaves(p_180709_1_, blockpos1)) ++ if (block.isAir(p_180709_1_, blockpos) || block.isLeaves(p_180709_1_, blockpos)) { - this.func_175905_a(p_180709_1_, blockpos1, Blocks.field_150363_s, BlockPlanks.EnumType.ACACIA.func_176839_a() - 4); + this.func_181642_b(p_180709_1_, blockpos); k1 = i2; -@@ -148,9 +150,9 @@ - i1 += enumfacing1.func_82601_c(); +@@ -149,9 +151,9 @@ + i3 += 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(); + BlockPos blockpos1 = new BlockPos(i3, j2, j1); +- 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.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); + this.func_181642_b(p_180709_1_, blockpos1); k1 = j2; -@@ -204,9 +206,9 @@ +@@ -209,9 +211,9 @@ private void func_175924_b(World p_175924_1_, BlockPos p_175924_2_) { @@ -60,5 +60,5 @@ - 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); + 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 0d9e1734f..70f640f5f 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java.patch @@ -19,13 +19,13 @@ + 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); + this.func_175903_a(p_180709_1_, p_180709_3_, this.field_150527_b); @@ -53,7 +55,7 @@ { - BlockPos blockpos1 = new BlockPos(l, i, j1); + BlockPos blockpos = 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)) +- 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_175905_a(p_180709_1_, blockpos1, Blocks.field_150362_t, 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 9f553475e..03b98a6c0 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java.patch @@ -1,19 +1,15 @@ --- ../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) +@@ -60,7 +60,7 @@ { -- 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(); + 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_, pos) && !block.isLeaves(p_180709_1_, pos)) ++ 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.field_150355_j && block != Blocks.field_150358_i) { -@@ -81,11 +82,13 @@ +@@ -86,11 +86,13 @@ } else { @@ -26,73 +22,73 @@ + 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); ++ block1.onPlantGrow(p_180709_1_, p_180709_3_.func_177977_b(),p_180709_3_); -- 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) + for (int l1 = p_180709_3_.func_177956_o() - 3 + i; l1 <= p_180709_3_.func_177956_o() + 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); +@@ -109,7 +111,7 @@ + { + BlockPos blockpos = new BlockPos(k3, l1, j1); + +- 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(p_180709_1_, blockpos, field_181649_b); + } +@@ -120,9 +122,10 @@ + + for (int 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 || 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); + this.func_175903_a(p_180709_1_, p_180709_3_.func_177981_b(i2), field_181648_a); } -@@ -138,29 +142,29 @@ +@@ -140,29 +143,29 @@ { - BlockPos blockpos4 = new BlockPos(i2, l1, i1); + blockpos$mutableblockpos1.func_181079_c(i4, j2, j4); -- 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)) +- 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 blockpos5 = blockpos4.func_177976_e(); - blockpos1 = blockpos4.func_177974_f(); - BlockPos blockpos2 = blockpos4.func_177978_c(); - BlockPos blockpos3 = blockpos4.func_177968_d(); + 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 && 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)) +- 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_, blockpos5, BlockVine.field_176275_S); + this.func_181647_a(p_180709_1_, blockpos3, BlockVine.field_176278_M); + } + +- 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(p_180709_1_, blockpos4, BlockVine.field_176280_O); } - 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)) ++ 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); + this.func_181647_a(p_180709_1_, blockpos1, BlockVine.field_176279_N); } - 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)) ++ 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); + 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; -- 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) +- 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_175905_a(p_175922_1_, p_175922_2_, Blocks.field_150395_bd, p_175922_3_); - p_175922_2_ = p_175922_2_.func_177977_b(); + this.func_175903_a(p_181647_1_, p_181647_2_, iblockstate); + 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 a32469775..a8ca16188 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java -@@ -50,7 +50,7 @@ +@@ -53,7 +53,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))) +- 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; } -@@ -69,11 +69,13 @@ +@@ -72,11 +72,13 @@ } else { @@ -23,28 +23,28 @@ { - this.func_175921_a(p_180709_1_, p_180709_3_.func_177977_b()); + block.onPlantGrow(p_180709_1_, down, p_180709_3_); - k2 = 0; + int k2 = 0; - for (j1 = p_180709_3_.func_177956_o() + i; j1 >= p_180709_3_.func_177956_o() + j; --j1) -@@ -90,7 +92,7 @@ + for (int l2 = p_180709_3_.func_177956_o() + i; l2 >= p_180709_3_.func_177956_o() + j; --l2) +@@ -93,7 +95,7 @@ { - BlockPos blockpos1 = new BlockPos(k1, j1, i2); + BlockPos blockpos = new BlockPos(j3, l2, 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)) +- 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_175905_a(p_180709_1_, blockpos1, Blocks.field_150362_t, BlockPlanks.EnumType.SPRUCE.func_176839_a()); + this.func_175903_a(p_180709_1_, blockpos, field_181637_b); } -@@ -110,9 +112,10 @@ +@@ -113,9 +115,10 @@ - for (j1 = 0; j1 < i - 1; ++j1) + for (int i3 = 0; i3 < i - 1; ++i3) { -- 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(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.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()); + 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 9a8619068..322b90715 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java.patch @@ -1,19 +1,15 @@ --- ../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) +@@ -55,7 +55,7 @@ { -- 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(); + Block block = p_180709_1_.func_180495_p(blockpos$mutableblockpos.func_181079_c(k1, i1, l1)).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)) ++ if (block.isAir(p_180709_1_, blockpos$mutableblockpos) && !block.isLeaves(p_180709_1_, blockpos$mutableblockpos)) { flag = false; } -@@ -70,11 +71,13 @@ +@@ -74,11 +74,13 @@ } else { @@ -27,28 +23,28 @@ { - 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 @@ + int i3 = p_180709_2_.nextInt(2); + int j3 = 1; + int k3 = 0; +@@ -99,7 +101,7 @@ { - BlockPos blockpos1 = new BlockPos(i2, l1, k2); + BlockPos blockpos = new BlockPos(i2, j4, 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)) +- 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_175905_a(p_180709_1_, blockpos1, Blocks.field_150362_t, BlockPlanks.EnumType.SPRUCE.func_176839_a()); + this.func_175903_a(p_180709_1_, blockpos, field_181646_b); } -@@ -126,9 +129,10 @@ +@@ -128,9 +130,10 @@ - for (l1 = 0; l1 < i - j3; ++l1) + for (int k4 = 0; k4 < i - i4; ++k4) { -- 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(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.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()); + 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 b8fe9ec78..40233c4b2 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 37d7c07ab..74c9c1445 100644 --- a/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java.patch @@ -1,15 +1,15 @@ --- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java +++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java -@@ -61,7 +61,7 @@ +@@ -68,7 +68,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))) +- 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; } -@@ -80,11 +80,13 @@ +@@ -87,11 +87,13 @@ } else { @@ -23,72 +23,72 @@ { - 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(); + int k2 = 3; + int l2 = 0; + +@@ -113,7 +115,7 @@ + BlockPos blockpos = new BlockPos(k1, i3, i2); + Block block = p_180709_1_.func_180495_p(blockpos).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) ++ if (block.isAir(p_180709_1_, blockpos) || block.isLeaves(p_180709_1_, blockpos) || block.func_149688_o() == Material.field_151582_l) { - this.func_175905_a(p_180709_1_, blockpos1, Blocks.field_150362_t, this.field_76530_d); + this.func_175903_a(p_180709_1_, blockpos, this.field_76530_d); } -@@ -122,9 +124,10 @@ +@@ -124,9 +126,10 @@ - for (l = 0; l < i; ++l) + for (int j3 = 0; j3 < i; ++j3) { -- 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(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.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); + this.func_175903_a(p_180709_1_, p_180709_3_.func_177981_b(j3), this.field_76532_c); -@@ -166,29 +169,29 @@ +@@ -169,29 +172,29 @@ { - BlockPos blockpos3 = new BlockPos(k1, l, l1); + blockpos$mutableblockpos1.func_181079_c(l4, k3, i5); -- 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)) +- 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 blockpos4 = blockpos3.func_177976_e(); - blockpos1 = blockpos3.func_177974_f(); - BlockPos blockpos5 = blockpos3.func_177978_c(); - BlockPos blockpos2 = blockpos3.func_177968_d(); + 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 && 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(p_180709_1_, blockpos2, BlockVine.field_176278_M); + } + +- 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(p_180709_1_, blockpos3, BlockVine.field_176280_O); + } - 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)) ++ 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); + this.func_181650_b(p_180709_1_, blockpos4, BlockVine.field_176279_N); } - 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)) ++ 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); + 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; -- 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) +- 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_175905_a(p_175923_1_, p_175923_2_, Blocks.field_150395_bd, p_175923_3_); - p_175923_2_ = p_175923_2_.func_177977_b(); + this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); + 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 fa45af1d8..79027d1db 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/layer/GenLayer.java.patch b/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch index 1fe3bb9aa..39466c0ff 100644 --- a/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch @@ -1,40 +1,31 @@ --- ../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 field_75907_b; -@@ -53,11 +56,11 @@ - j = 6; +@@ -52,12 +52,12 @@ + i = 6; } -+ j = getModdedBiomeSize(p_180781_2_, j); ++ i = getModdedBiomeSize(p_180781_2_, j); + - GenLayer genlayer = GenLayerZoom.func_75915_a(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); -- 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); - GenLayerHills genlayerhills = new GenLayerHills(1000L, genlayerbiomeedge, genlayer1); - genlayer = GenLayerZoom.func_75915_a(1000L, genlayerriverinit, 2); -@@ -194,7 +197,7 @@ + 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.func_75915_a(1000L, lvt_9_1_, 2); +- GenLayerBiomeEdge genlayerbiomeedge = new GenLayerBiomeEdge(1000L, genlayer6); + 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.func_75915_a(1000L, genlayerriverinit, 2); + genlayer5 = GenLayerZoom.func_75915_a(1000L, genlayer5, j); +@@ -191,7 +191,7 @@ protected static boolean func_151618_b(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 net.minecraftforge.common.BiomeManager.oceanBiomes.contains(BiomeGenBase.func_150568_d(p_151618_0_)); } - protected int func_151619_a(int ... p_151619_1_) -@@ -206,4 +209,27 @@ + 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.func_151619_a(new int[] {p_151617_1_, p_151617_2_, p_151617_3_, p_151617_4_})))))))))); } @@ -56,8 +47,8 @@ + + public static int getModdedBiomeSize(WorldType worldType, int original) + { -+ WorldTypeEvent.BiomeSize event = new WorldTypeEvent.BiomeSize(worldType, original); -+ MinecraftForge.TERRAIN_GEN_BUS.post(event); ++ 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 index e8a8a6350..5e2daee96 100644 --- a/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java.patch @@ -1,107 +1,94 @@ --- ../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.*; +@@ -6,10 +6,9 @@ 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 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]; + 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_) - { +@@ -17,9 +16,30 @@ 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_; -+ for (BiomeManager.BiomeType type : BiomeManager.BiomeType.values()) ++ for (net.minecraftforge.common.BiomeManager.BiomeType type : net.minecraftforge.common.BiomeManager.BiomeType.values()) + { -+ com.google.common.collect.ImmutableList biomesToAdd = BiomeManager.getBiomes(type); ++ com.google.common.collect.ImmutableList biomesToAdd = net.minecraftforge.common.BiomeManager.getBiomes(type); + int idx = type.ordinal(); + -+ if (biomes[idx] == null) biomes[idx] = new ArrayList(); ++ if (biomes[idx] == null) biomes[idx] = new java.util.ArrayList(); + if (biomesToAdd != null) biomes[idx].addAll(biomesToAdd); + } + -+ int desertIdx = DESERT.ordinal(); ++ int desertIdx = net.minecraftforge.common.BiomeManager.BiomeType.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 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.field_77136_e) { - 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 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 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.field_180271_f) -@@ -78,7 +99,7 @@ +@@ -73,7 +93,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[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 (k1 == 2) -@@ -89,7 +110,7 @@ + else if (k == 2) +@@ -84,7 +104,7 @@ } 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[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 (k1 == 3) -@@ -100,12 +121,12 @@ + else if (k == 3) +@@ -95,12 +115,12 @@ } 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[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 (k1 == 4) + else if (k == 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[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 { -@@ -116,4 +137,12 @@ +@@ -111,4 +131,12 @@ return aint1; } + -+ protected BiomeEntry getWeightedBiomeEntry(BiomeManager.BiomeType type) ++ protected net.minecraftforge.common.BiomeManager.BiomeEntry getWeightedBiomeEntry(net.minecraftforge.common.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); ++ java.util.List biomeList = biomes[type.ordinal()]; ++ int totalWeight = net.minecraft.util.WeightedRandom.func_76272_a(biomeList); ++ int weight = net.minecraftforge.common.BiomeManager.isTypeListModded(type)?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 f300249a0..a1ba80289 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java.patch @@ -1,62 +1,47 @@ --- ../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() {} +@@ -40,6 +40,12 @@ + { + } + 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)); ++ 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_) { super(p_i2062_1_, p_i2062_2_, 64, p_i2062_3_, 21, 15, 21); -@@ -267,7 +276,7 @@ +@@ -258,7 +264,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 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_)); } } -@@ -370,6 +379,13 @@ - private static ComponentScatteredFeaturePieces.JunglePyramid.Stones field_74942_n = new ComponentScatteredFeaturePieces.JunglePyramid.Stones((ComponentScatteredFeaturePieces.SwitchEnumFacing)null); - private static final String __OBFID = "CL_00000477"; +@@ -362,6 +368,13 @@ + 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 + { -+ 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)); ++ 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.field_151134_bR, 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 @@ + public JunglePyramid() + { + } +@@ -518,9 +531,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_); -+ ChestGenHooks dispenser = ChestGenHooks.getInfo(PYRAMID_JUNGLE_DISPENSER); -+ ChestGenHooks chest = ChestGenHooks.getInfo(PYRAMID_JUNGLE_CHEST); ++ 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) { @@ -65,7 +50,7 @@ } this.func_175811_a(p_74875_1_, Blocks.field_150395_bd.func_176203_a(15), 3, -2, 2, p_74875_3_); -@@ -544,7 +563,7 @@ +@@ -537,7 +553,7 @@ if (!this.field_74946_k) { @@ -74,7 +59,7 @@ } this.func_175811_a(p_74875_1_, Blocks.field_150395_bd.func_176203_a(15), 8, -1, 3, p_74875_3_); -@@ -552,7 +571,7 @@ +@@ -545,7 +561,7 @@ if (!this.field_74947_h) { @@ -83,7 +68,7 @@ } this.func_175811_a(p_74875_1_, Blocks.field_150341_Y.func_176223_P(), 9, -3, 2, p_74875_3_); -@@ -585,7 +604,7 @@ +@@ -578,7 +594,7 @@ if (!this.field_74948_i) { 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 2ac267ebb..a296c5436 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java.patch @@ -1,9 +1,9 @@ --- ../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]; +@@ -28,11 +28,18 @@ + for (BiomeGenBase biomegenbase : BiomeGenBase.func_150565_n()) + { - 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)) { @@ -19,4 +19,4 @@ + } } - public MapGenStronghold(Map p_i2068_1_) + public MapGenStronghold(Map p_i2068_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 index 9aeab1702..f97b0ccc3 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 -@@ -231,12 +231,12 @@ +@@ -217,12 +217,12 @@ { if (this.field_143029_e == null) { 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 00ba3940d..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,42 +1,33 @@ --- ../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 @@ +@@ -32,6 +32,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)); ++ 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.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_) + 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())); + int i = p_175892_1_.nextInt(100); +@@ -351,14 +357,15 @@ + 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())); -+ ChestGenHooks info = ChestGenHooks.getInfo(MINESHAFT_CORRIDOR); ++ 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(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_)); +- 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(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_)); +- 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.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 fbe1b5d05..8d9ab3d84 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java.patch @@ -9,7 +9,7 @@ } 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 @@ +@@ -225,7 +225,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; @@ -18,11 +18,11 @@ } 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 @@ +@@ -943,6 +943,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)}); + 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() {} + 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 c8db28dbb..7ff46ea18 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.func_74778_a("id", MapGenStructureIO.func_143033_a(this)); nbttagcompound.func_74768_a("ChunkX", p_143021_1_); -@@ -98,7 +102,8 @@ +@@ -97,7 +101,8 @@ for (int i = 0; i < nbttaglist.func_74745_c(); ++i) { 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 b273fdf77..0d5ebc0bb 100644 --- a/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java.patch @@ -1,55 +1,46 @@ --- ../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() {} +@@ -240,6 +240,12 @@ + { + } + 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)); ++ 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_); -@@ -304,7 +312,7 @@ +@@ -296,7 +302,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_)); ++ 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; -@@ -599,6 +607,12 @@ +@@ -592,6 +598,12 @@ + 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; - private static final String __OBFID = "CL_00000491"; + static + { -+ ChestGenHooks.init(STRONGHOLD_LIBRARY, field_75007_b, 1, 5); -+ ChestGenHooks.addItem(STRONGHOLD_LIBRARY, new WeightedRandomChestContent(new net.minecraft.item.ItemStack(Items.field_151134_bR, 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() {} - - 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_); + public Library() + { + } +@@ -736,12 +748,13 @@ + 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(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); ++ net.minecraftforge.common.ChestGenHooks info = net.minecraftforge.common.ChestGenHooks.getInfo(net.minecraftforge.common.ChestGenHooks.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) @@ -60,25 +51,25 @@ } return true; -@@ -1024,6 +1039,12 @@ +@@ -1013,6 +1026,12 @@ + 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; - 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)); ++ 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() {} - - public RoomCrossing(int p_i45575_1_, Random p_i45575_2_, StructureBoundingBox p_i45575_3_, EnumFacing p_i45575_4_) -@@ -1159,7 +1180,7 @@ + public RoomCrossing() + { + } +@@ -1151,7 +1170,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_)); ++ 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 ad1533e4e..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,67 +1,54 @@ --- ../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.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))); -+ net.minecraftforge.fml.common.registry.VillagerRegistry.addExtraVillageComponents(arraylist, p_75084_0_, p_75084_1_); -+ - Iterator iterator = arraylist.iterator(); +@@ -57,6 +57,7 @@ + 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(); while (iterator.hasNext()) -@@ -132,6 +139,10 @@ +@@ -129,6 +130,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_); + 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 + { -+ 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_); ++ 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)object; + return structurevillagepieces$village; } -@@ -842,6 +853,11 @@ - - public House2() {} +@@ -833,6 +838,11 @@ + { + } + static + { -+ ChestGenHooks.init(VILLAGE_BLACKSMITH, field_74918_a, 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_); -@@ -920,7 +936,7 @@ +@@ -911,7 +921,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)))) { 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.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_)); } - 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"; + for (int i = 6; i <= 8; ++i) +@@ -1403,6 +1413,7 @@ + public List field_74931_h; + public List field_74932_i = Lists.newArrayList(); + public List field_74930_j = Lists.newArrayList(); + public BiomeGenBase biome; - public Start() {} - -@@ -1433,6 +1450,7 @@ + public Start() + { +@@ -1416,6 +1427,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.field_74927_b = biomegenbase == BiomeGenBase.field_76769_d || biomegenbase == BiomeGenBase.field_76786_s; @@ -69,15 +56,15 @@ this.func_175846_a(this.field_74927_b); } -@@ -1540,6 +1558,7 @@ +@@ -1477,6 +1489,7 @@ + protected int field_143015_k = -1; private int field_74896_a; private boolean field_143014_b; - private static final String __OBFID = "CL_00000531"; + private StructureVillagePieces.Start startPiece; - public Village() {} - -@@ -1550,6 +1569,7 @@ + public Village() + { +@@ -1489,6 +1502,7 @@ if (p_i2107_1_ != null) { this.field_143014_b = p_i2107_1_.field_74927_b; @@ -85,13 +72,13 @@ } } -@@ -1673,6 +1693,9 @@ +@@ -1613,6 +1627,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; ++ 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_.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 60cc5db82..4bddcf6da 100644 --- a/patches/minecraft/net/minecraft/world/storage/MapData.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/MapData.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/storage/MapData.java +++ ../src-work/minecraft/net/minecraft/world/storage/MapData.java -@@ -22,7 +22,7 @@ +@@ -21,7 +21,7 @@ { public int field_76201_a; public int field_76199_b; @@ -8,8 +8,8 @@ + 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 List field_76196_g = Lists.newArrayList(); +@@ -44,7 +44,17 @@ public void func_76184_a(NBTTagCompound p_76184_1_) { @@ -28,7 +28,7 @@ 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 @@ +@@ -85,7 +95,7 @@ public void func_76187_b(NBTTagCompound p_76187_1_) { @@ -37,8 +37,8 @@ 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; +@@ -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.field_76200_c < 0) diff --git a/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch b/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch index f5341e4cd..6f920a640 100644 --- a/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/SaveHandler.java.patch @@ -1,8 +1,8 @@ --- ../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; +@@ -104,20 +104,29 @@ + { + File file1 = new File(this.field_75770_b, "level.dat"); + WorldInfo worldInfo = null; + @@ -10,11 +10,11 @@ { try { - nbttagcompound = CompressedStreamTools.func_74796_a(new FileInputStream(file1)); - nbttagcompound1 = nbttagcompound.func_74775_l("Data"); -- return new WorldInfo(nbttagcompound1); -+ worldInfo = new WorldInfo(nbttagcompound1); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound); + 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); + return worldInfo; } + catch (net.minecraftforge.fml.common.StartupQuery.AbortedException e) @@ -31,10 +31,10 @@ file1 = new File(this.field_75770_b, "level.dat_old"); if (file1.exists()) -@@ -129,7 +138,13 @@ +@@ -126,7 +135,13 @@ { - nbttagcompound = CompressedStreamTools.func_74796_a(new FileInputStream(file1)); - nbttagcompound1 = nbttagcompound.func_74775_l("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); @@ -46,16 +46,16 @@ } catch (Exception exception) { -@@ -146,6 +161,8 @@ - NBTTagCompound nbttagcompound2 = new NBTTagCompound(); - nbttagcompound2.func_74782_a("Data", nbttagcompound1); +@@ -143,6 +158,8 @@ + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.func_74782_a("Data", nbttagcompound); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, p_75755_1_, nbttagcompound2); ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, p_75755_1_, nbttagcompound1); + try { File file1 = new File(this.field_75770_b, "level.dat_new"); -@@ -184,6 +201,8 @@ +@@ -181,6 +198,8 @@ NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.func_74782_a("Data", nbttagcompound); @@ -64,15 +64,15 @@ try { File file1 = new File(this.field_75770_b, "level.dat_new"); -@@ -232,6 +251,7 @@ +@@ -229,6 +248,7 @@ } file1.renameTo(file2); + net.minecraftforge.event.ForgeEventFactory.firePlayerSavingEvent(p_75753_1_, this.field_75771_c, p_75753_1_.func_110124_au().toString()); } - catch (Exception exception) + catch (Exception var5) { -@@ -262,6 +282,7 @@ +@@ -259,6 +279,7 @@ p_75752_1_.func_70020_e(nbttagcompound); } @@ -80,7 +80,7 @@ return nbttagcompound; } -@@ -301,4 +322,22 @@ +@@ -300,4 +321,22 @@ { return this.field_75767_f; } diff --git a/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch b/patches/minecraft/net/minecraft/world/storage/WorldInfo.java.patch index b1d007002..808536451 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 @@ - private int field_176155_J; - private GameRules field_82577_x; - private static final String __OBFID = "CL_00000587"; +@@ -51,6 +51,7 @@ + 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() { -@@ -803,4 +804,24 @@ +@@ -745,4 +746,24 @@ } }); } 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/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/ClientCommandHandler.java b/src/main/java/net/minecraftforge/client/ClientCommandHandler.java index 4978616c6..87a196e48 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 @@ -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/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index ed12e6f70..7d105f2ca 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,17 +31,18 @@ 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; 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; 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; @@ -70,25 +70,25 @@ 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; 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.base.Optional; 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"); @@ -104,165 +104,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. @@ -272,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); } } @@ -295,7 +136,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) @@ -322,10 +162,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 @@ -507,18 +347,18 @@ 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)); 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(); - m.setTranslation(transform.translation); + m.setTranslation(TRSRTransformation.toVecmath(transform.translation)); t.setIdentity(); t.rotY(transform.rotation.y); m.mul(t); @@ -536,34 +376,18 @@ 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) { - Pair pair = ((IPerspectiveAwareModel)model).handlePerspective(cameraTransformType); + Pair pair = ((IPerspectiveAwareModel)model).handlePerspective(cameraTransformType); if(pair.getRight() != null) multiplyCurrentGlMatrix(pair.getRight()); return pair.getLeft(); } 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; } @@ -580,14 +404,15 @@ public class ForgeHooksClient matrixBuf.put(t); } matrixBuf.flip(); - GL11.glMultMatrix(matrixBuf); + glMultMatrix(matrixBuf); } // 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 +447,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 +477,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 +487,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); @@ -696,11 +522,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); @@ -739,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/GuiIngameForge.java b/src/main/java/net/minecraftforge/client/GuiIngameForge.java index 8025d44e0..33fb73911 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) @@ -94,7 +84,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(); @@ -113,7 +103,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 +153,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 +224,7 @@ public class GuiIngameForge extends GuiIngame { if (itemstack.getItem() == Item.getItemFromBlock(Blocks.pumpkin)) { - func_180476_e(res); + renderPumpkinOverlay(res); } else { @@ -345,28 +335,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(); @@ -607,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; @@ -748,11 +740,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 +776,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/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); -} 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/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/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/BlockStateLoader.java b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java index cd3e1d221..255985659 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()) @@ -43,7 +42,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 +73,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); @@ -195,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 59598c289..d950d6dfc 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; @@ -50,7 +51,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 +147,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 +431,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 +448,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); @@ -466,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 { @@ -521,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); @@ -534,17 +535,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--; @@ -569,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); } @@ -577,12 +590,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/client/model/IFlexibleBakedModel.java b/src/main/java/net/minecraftforge/client/model/IFlexibleBakedModel.java index e01989a56..b0cdb977d 100644 --- a/src/main/java/net/minecraftforge/client/model/IFlexibleBakedModel.java +++ b/src/main/java/net/minecraftforge/client/model/IFlexibleBakedModel.java @@ -12,11 +12,9 @@ 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 { - // non-erased versions of the IBakedModel methods - List getFaceQuads(EnumFacing side); - List getGeneralQuads(); /* * Specifies the format which BakedQuads' getVertexData will have. */ @@ -36,13 +34,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/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 be4a2ad33..de7e797bb 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.collect.ImmutableList; +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) */ -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,21 +39,53 @@ 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(); + } + + 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(); } @@ -65,12 +96,9 @@ 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 handlePerspective(this, transforms, cameraTransformType); } } } 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 1dbeb77f2..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. - */ -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(); - 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); - 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 12d863864..326d300fb 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java @@ -4,9 +4,7 @@ import java.util.Arrays; import java.util.BitSet; import java.util.Collection; import java.util.List; -import java.util.Map; -import javax.vecmath.Matrix4f; import javax.vecmath.Vector4f; import net.minecraft.client.renderer.block.model.BakedQuad; @@ -16,19 +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; -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(); @@ -194,14 +174,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(), @@ -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/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/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/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/ModelFluid.java b/src/main/java/net/minecraftforge/client/model/ModelFluid.java index 21b29f9fd..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; @@ -33,6 +36,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); @@ -56,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() @@ -90,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; @@ -98,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; @@ -236,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 9217d5bee..6dec67520 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; @@ -38,15 +39,23 @@ 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; 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; @@ -54,6 +63,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; @@ -62,6 +72,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(); @@ -85,7 +96,7 @@ public class ModelLoader extends ModelBakery } @Override - public IRegistry setupModelRegistry() + public IRegistry setupModelRegistry() { isLoading = true; loadBlocks(); @@ -173,10 +184,11 @@ public class ModelLoader extends ModelBakery registerVariantNames(); for(Item item : GameData.getItemRegistry().typeSafeIterable()) { + // default loading for(String s : (List)getVariantNames(item)) { ResourceLocation file = getItemLocation(s); - ModelResourceLocation memory = new ModelResourceLocation(s, "inventory"); + ModelResourceLocation memory = getInventoryVariant(s); IModel model = null; try { @@ -197,6 +209,88 @@ 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)) + { + ModelResourceLocation memory = getInventoryVariant(s); + 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 = getInventoryVariant(s); + 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 = getInventoryVariant(s); + IModel model = stateModels.get(ModelDynBucket.LOCATION); + if(model != null) + { + 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 @@ -221,12 +315,7 @@ public class ModelLoader extends ModelBakery try { IModel model = ModelLoaderRegistry.getModel(location); - for (ResourceLocation dep : model.getDependencies()) - { - getModel(dep); - - } - textures.addAll(model.getTextures()); + resolveDependencies(model); } finally { @@ -234,6 +323,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; @@ -330,51 +435,73 @@ 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); - ItemCameraTransforms transforms = new ItemCameraTransforms(model.getThirdPersonTransform(), model.getFirstPersonTransform(), model.getHeadTransform(), model.getInGuiTransform()); + 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) { 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 @@ -391,7 +518,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; @@ -437,6 +564,11 @@ public class ModelLoader extends ModelBakery return new VanillaModelWrapper(location, neweModel); } + + public IModelState getDefaultState() + { + return ModelRotation.X0_Y0; + } } public static class UVLock implements IModelState @@ -453,7 +585,7 @@ public class ModelLoader extends ModelBakery return parent; } - public TRSRTransformation apply(IModelPart part) + public Optional apply(Optional part) { return parent.apply(part); } @@ -497,11 +629,11 @@ 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(); - ImmutableMap.Builder builder = ImmutableMap.builder(); + ImmutableMap.Builder builder = ImmutableMap.builder(); for (Variant v : (List)variants.getVariants()) { ResourceLocation loc = v.getModelLocation(); @@ -526,19 +658,27 @@ 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. } 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()); @@ -561,11 +701,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; } @@ -600,6 +740,7 @@ public class ModelLoader extends ModelBakery private static class FlexibleWeightedBakedModel extends WeightedBakedModel implements IFlexibleBakedModel { + @SuppressWarnings("unused") private final WeightedBakedModel parent; private final VertexFormat format; @@ -616,6 +757,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; @@ -700,7 +842,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; } @@ -710,12 +859,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); @@ -726,6 +875,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); @@ -742,16 +894,37 @@ 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); } + 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/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java index 6a8f73ee0..c50082751 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java @@ -33,6 +33,8 @@ public class ModelLoaderRegistry registerLoader(OBJLoader.instance); registerLoader(ModelFluid.FluidLoader.instance); registerLoader(ItemLayerModel.Loader.instance); + registerLoader(MultiLayerModel.Loader.instance); + registerLoader(ModelDynBucket.LoaderDynBucket.instance); } /* 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/MultiLayerModel.java b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java new file mode 100644 index 000000000..d992b4ba3 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java @@ -0,0 +1,268 @@ +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., ModelResourceLocation>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 missing; + 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(); + missing = manager.getMissingModel(); + 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(); + EnumWorldBlockLayer layer = MinecraftForgeClient.getRenderLayer(); + if(!bakedModels.containsKey(layer)) + { + return missing; + } + return bakedModels.get(layer); + } + + @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/MultiModel.java b/src/main/java/net/minecraftforge/client/model/MultiModel.java index b20112c9f..9e55b6001 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; @@ -29,6 +28,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 @@ -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) { @@ -92,16 +69,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(); @@ -145,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; } @@ -171,11 +166,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()); } } @@ -260,12 +255,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. */ @@ -281,4 +270,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 54c5696f3..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. @@ -30,6 +31,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; @@ -69,7 +71,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(); } @@ -312,6 +314,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; @@ -440,7 +443,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() @@ -472,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) @@ -579,6 +586,57 @@ public class TRSRTransformation implements IModelState, ITransformation 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; + } + public static Vector3f lerp(Tuple3f from, Tuple3f to, float progress) { Vector3f res = new Vector3f(from); 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..5be50b080 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; @@ -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(); @@ -259,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) { @@ -280,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() @@ -300,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) @@ -319,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; @@ -715,7 +795,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 { @@ -759,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) @@ -913,13 +993,9 @@ public class B3DLoader implements ICustomModelLoader return this; } - public Pair handlePerspective(TransformType cameraTransformType) + public Pair handlePerspective(TransformType cameraTransformType) { - if(state instanceof IPerspectiveState) - { - return Pair.of((IBakedModel)this, TRSRTransformation.blockCornerToCenter(((IPerspectiveState)state).forPerspective(cameraTransformType).apply(PartWrapper.create(node))).getMatrix()); - } - return Pair.of((IBakedModel)this, null); + return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, state, cameraTransformType); } } } 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..06c297099 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(); @@ -637,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/main/java/net/minecraftforge/client/model/obj/OBJModel.java b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java index dc3ceb971..2d2ab24ea 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,15 +53,15 @@ 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; -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; @@ -122,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; @@ -832,6 +826,11 @@ public class OBJModel implements IRetexturableModel, IModelCustomData { return this.materialName; } + + public boolean isTriangles() + { + return isTri; + } public boolean setVertices(Vertex[] verts) { @@ -1104,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; } @@ -1165,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() @@ -1321,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; @@ -1333,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)) @@ -1370,7 +1369,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData } else { - transform = state.apply(model); + transform = state.apply(Optional.absent()); faces.addAll(g.applyTransform(transform)); } } @@ -1574,13 +1573,9 @@ public class OBJModel implements IRetexturableModel, IModelCustomData } @Override - public Pair handlePerspective(TransformType cameraTransformType) + public Pair handlePerspective(TransformType cameraTransformType) { - if (state instanceof IPerspectiveState) - { - return Pair.of((IBakedModel) this, TRSRTransformation.blockCornerToCenter(((IPerspectiveState) state).forPerspective(cameraTransformType).apply(model)).getMatrix()); - } - return Pair.of((IBakedModel) this, null); + return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, state, cameraTransformType); } @Override @@ -1601,4 +1596,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/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: + } } } 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..4a5a8036f 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); } @@ -135,11 +136,12 @@ 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()) { - 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,25 +189,26 @@ 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; 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)); 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 6ded96597..fd54adede 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; } @@ -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/main/java/net/minecraftforge/common/BiomeManager.java b/src/main/java/net/minecraftforge/common/BiomeManager.java index debdec98d..474bf1894 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..61c024423 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; @@ -231,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/DimensionManager.java b/src/main/java/net/minecraftforge/common/DimensionManager.java index a5a11566a..096457fc3 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; @@ -30,10 +29,11 @@ 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; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.FMLLog; public class DimensionManager { @@ -241,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/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 65dd5b154..ec12a1482 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -249,6 +249,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; @@ -426,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); @@ -452,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()) @@ -548,7 +669,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); } @@ -568,7 +689,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); @@ -608,6 +729,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 3805d49f7..f5ab3bfaa 100644 --- a/src/main/java/net/minecraftforge/common/ForgeModContainer.java +++ b/src/main/java/net/minecraftforge/common/ForgeModContainer.java @@ -5,10 +5,7 @@ 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_CLIENT; import static net.minecraftforge.common.config.Configuration.CATEGORY_GENERAL; import java.io.File; @@ -41,7 +38,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; @@ -73,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; @@ -89,14 +86,13 @@ 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", "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."; - meta.url = "http://MinecraftForge.net"; - meta.updateUrl = "http://MinecraftForge.net/forum/index.php/topic,5.0.html"; + meta.url = "http://minecraftforge.net"; meta.screenshots = new String[0]; meta.logoFile = "/forge_logo.png"; try { @@ -250,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(); @@ -306,7 +312,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/ForgeVersion.java b/src/main/java/net/minecraftforge/common/ForgeVersion.java index ddb62d849..a37bd3c92 100644 --- a/src/main/java/net/minecraftforge/common/ForgeVersion.java +++ b/src/main/java/net/minecraftforge/common/ForgeVersion.java @@ -33,16 +33,18 @@ 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 - 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"; + @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) { @@ -255,6 +260,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/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 508390569..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); @@ -166,9 +167,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/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..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 = "."; @@ -86,7 +87,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 +111,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 +133,7 @@ public class Configuration { this(file, null, caseSensitiveCustomCategories); } - + @Override public String toString() { @@ -148,16 +149,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 +171,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 +182,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 +206,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 +217,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 +238,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 +273,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 +287,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 +302,7 @@ public class Configuration prop.setDefaultValue(Integer.toString(defaultValue)); prop.setMinValue(minValue); prop.setMaxValue(maxValue); - + if (!prop.isIntValue()) { prop.setValue(defaultValue); @@ -311,7 +312,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 +326,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 +341,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 +355,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 +385,7 @@ public class Configuration prop.setMaxValue(maxValue); prop.setIsListLengthFixed(isListLengthFixed); prop.setMaxListLength(maxListLength); - + if (!prop.isIntList()) { prop.setValues(values); @@ -394,14 +395,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 +415,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 +426,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 +444,7 @@ public class Configuration prop.setDefaultValue(Double.toString(defaultValue)); prop.setMinValue(minValue); prop.setMaxValue(maxValue); - + if (!prop.isDoubleValue()) { prop.setValue(defaultValue); @@ -453,7 +454,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 +468,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 +480,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 +497,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 +521,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 +538,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 +555,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 +569,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 +586,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 +604,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 +617,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 +631,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 +646,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 +669,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 +712,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 +726,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 +773,11 @@ public class Configuration } /* **************************************************************************************************************** - * + * * Other methods - * + * *************************************************************************************************************** */ - + public boolean hasCategory(String category) { return categories.get(category) != null; @@ -963,17 +964,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 +995,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 +1080,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 +1106,7 @@ public class Configuration } private void save(BufferedWriter out) throws IOException - { + { for (ConfigCategory cat : categories.values()) { if (!cat.isChild()) @@ -1181,7 +1182,7 @@ public class Configuration /** * Adds a comment to the specified ConfigCategory object - * + * * @param category the config category * @param comment a String comment */ @@ -1197,10 +1198,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 +1212,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 +1221,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 +1240,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 +1254,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 +1266,7 @@ public class Configuration getCategory(category).setPropertyOrder(propOrder); return this; } - + private void setChild(String name, Configuration child) { if (!children.containsKey(name)) @@ -1291,6 +1292,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 +1364,7 @@ public class Configuration public boolean hasChanged() { if (changed) return true; - + for (ConfigCategory cat : categories.values()) { if (cat.hasChanged()) return true; @@ -1394,10 +1396,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 +1418,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 +1438,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 +1447,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 +1458,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 +1472,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 +1487,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 +1501,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 +1520,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 +1535,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 +1555,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 +1569,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 +1583,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 +1601,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 +1615,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 +1633,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 +1649,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 +1671,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 +1687,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 +1717,7 @@ public class Configuration } return defaultValue; } - + public File getConfigFile() { return file; 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/common/property/ExtendedBlockState.java b/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java index c299e3fa5..25166eec9 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(); @@ -33,6 +32,11 @@ public class ExtendedBlockState extends BlockState } this.unlistedProperties = builder.build(); } + + public Collection> getUnlistedProperties() + { + return unlistedProperties; + } private static ImmutableMap, Optional> buildUnlistedMap(IUnlistedProperty[] unlistedProperties) { @@ -45,7 +49,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 +58,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; @@ -64,7 +69,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)) { @@ -80,12 +85,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 +138,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; } 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/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/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/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; 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/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/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 faf675874..c533506fa 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; /** @@ -42,15 +35,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 +96,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); @@ -190,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); @@ -209,15 +185,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 +206,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 +252,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 +260,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 +271,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/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 f444e4e27..b1a2e6f22 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; @@ -52,20 +50,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 +83,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) { @@ -191,25 +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)); - } - - @Deprecated //Remove in 1.8.3 - public static String getFluidName(int fluidID) - { - return fluidNames.get(fluidID); + 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) @@ -241,18 +239,10 @@ 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 //Change return type to in 1.8.3 - public static Map getRegisteredFluidIDs() - { - return ImmutableMap.copyOf(fluidNames.inverse()); - } - - /** - * 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() + @Deprecated + public static Map getRegisteredFluidIDs() { return ImmutableMap.copyOf(fluidIDs); } @@ -385,6 +375,11 @@ public abstract class FluidRegistry return name; } + @Override + public ResourceLocation getResourceName() { + return new ResourceLocation(name); + } + @Override public Class type() { @@ -396,21 +391,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..616b55c49 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidStack.java +++ b/src/main/java/net/minecraftforge/fluids/FluidStack.java @@ -18,12 +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. - */ - @Deprecated - public final Fluid fluid; public int amount; public NBTTagCompound tag; private RegistryDelegate fluidDelegate; @@ -42,7 +36,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 +53,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 +95,6 @@ public class FluidStack return fluidDelegate.get(); } - public final int getFluidID() - { - return FluidRegistry.getFluidID(getFluid()); - } - public String getLocalizedName() { return this.getFluid().getLocalizedName(this); diff --git a/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java b/src/main/java/net/minecraftforge/fml/client/FMLClientHandler.java index 68758588e..993ded08c 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; @@ -89,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; @@ -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()) { @@ -330,7 +321,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()) { @@ -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) + */ } } @@ -658,7 +651,7 @@ public class FMLClientHandler implements IFMLSidedHandler // ONLY revert a non-local connection if (client != null && !client.isLocalChannel()) { - GameData.revertToFrozen(); + PersistentRegistryManager.revertToFrozen(); } } @@ -825,7 +818,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/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 618464cbf..e94680638 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; @@ -149,7 +150,6 @@ public class GuiModList extends GuiScreen } } - @SuppressWarnings("unchecked") @Override public void initGui() { @@ -475,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(); @@ -529,13 +524,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; @@ -578,7 +573,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/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/GuiScrollingList.java b/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java index d3dc65ee3..a0bdde2d2 100644 --- a/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java +++ b/src/main/java/net/minecraftforge/fml/client/GuiScrollingList.java @@ -21,6 +21,7 @@ import net.minecraft.client.gui.ScaledResolution; 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; @@ -264,7 +265,7 @@ public abstract class GuiScrollingList Tessellator tess = Tessellator.getInstance(); WorldRenderer worldr = tess.getWorldRenderer(); - ScaledResolution res = new ScaledResolution(client, client.displayWidth, client.displayHeight); + 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); @@ -282,12 +283,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(); } @@ -310,17 +310,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(); } @@ -348,26 +346,23 @@ public abstract class GuiScrollingList } GlStateManager.disableTexture2D(); - 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(); } @@ -396,13 +391,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/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 c115cfc2d..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,9 +14,9 @@ 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; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; @@ -181,15 +181,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(); } 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/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); } } } 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/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 d8ee59c93..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; @@ -49,6 +47,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; @@ -65,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; @@ -99,14 +97,13 @@ public class FMLCommonHandler */ private IFMLSidedHandler sidedDelegate; - private Class forge; private boolean noForge; private List brandings; private List brandingsNoMC; 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() @@ -133,8 +130,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; @@ -143,10 +142,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 +210,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 +217,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()); @@ -707,7 +671,7 @@ public class FMLCommonHandler return sidedDelegate.getWorldThread(net); } - public static void callFuture(FutureTask task) + public static void callFuture(FutureTask task) { try { @@ -757,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..92c225830 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,8 +23,8 @@ 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.util.ResourceLocation; import net.minecraft.world.storage.SaveHandler; import net.minecraft.world.storage.WorldInfo; import net.minecraftforge.fml.client.FMLFileResourcePack; @@ -37,14 +36,12 @@ 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; 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 +64,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=""; } @@ -115,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); @@ -190,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++) @@ -231,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); @@ -257,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)) @@ -266,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"))); } } @@ -274,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)) @@ -283,39 +252,44 @@ 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(); + 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 = VillagerRegistry.PROFESSIONS; + 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++) { 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"); @@ -324,7 +298,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/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 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/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 f2e35b869..6cbd42021 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; @@ -112,9 +109,10 @@ import com.google.gson.JsonParser; * @author cpw * */ +@SuppressWarnings("unused") 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(); /** @@ -641,7 +639,7 @@ public class Loader return "8.0.99.99"; } - public ClassLoader getModClassLoader() + public ModClassLoader getModClassLoader() { return modClassLoader; } @@ -737,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"); } @@ -833,12 +831,12 @@ public class Loader public String getMCPVersionString() { - return String.format("MCP v%s", mcpversion); + return String.format("MCP %s", mcpversion); } public void serverStopped() { - GameData.revertToFrozen(); + PersistentRegistryManager.revertToFrozen(); modController.distributeStateMessage(LoaderState.SERVER_STOPPED); modController.transition(LoaderState.SERVER_STOPPED, true); modController.transition(LoaderState.AVAILABLE, true); @@ -913,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 { @@ -924,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); @@ -974,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, 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/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/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 diff --git a/src/main/java/net/minecraftforge/fml/common/ModAPIManager.java b/src/main/java/net/minecraftforge/fml/common/ModAPIManager.java index 4d361ca64..5733190e7 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; @@ -89,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..fb7a938d5 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,16 +44,19 @@ 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); this.mainClassLoader = (LaunchClassLoader)parent; + this.sources = new ArrayList(); } public void addFile(File modFile) throws MalformedURLException { URL url = modFile.toURI().toURL(); mainClassLoader.addURL(url); + this.sources.add(modFile); } @Override @@ -112,7 +117,7 @@ public class ModClassLoader extends URLClassLoader "librarylwjglopenal-", "soundsystem-", "netty-all-", - "quava-", + "guava-", "commons-lang3-", "commons-compress-", "commons-logging-", @@ -148,4 +153,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; + } + } } 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/TracingPrintStream.java b/src/main/java/net/minecraftforge/fml/common/TracingPrintStream.java index 2187c9d3e..0451edfb6 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 + 4]; } return "[" + elem.getClassName() + ":" + elem.getMethodName() + ":" + elem.getLineNumber() + "]: "; } 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/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/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..5db8c1409 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,201 @@ 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 + */ + @SuppressWarnings("unchecked") + 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..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; @@ -17,7 +18,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 +34,7 @@ public class FMLMissingMappingsEvent extends FMLEvent { * @author cpw * */ - public static enum Action { + public enum Action { /** * Take the default action */ @@ -61,24 +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; - } - /** - * @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; + 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 d371aa0c0..5b4b9a97d 100644 --- a/src/main/java/net/minecraftforge/fml/common/event/FMLModIdMappingEvent.java +++ b/src/main/java/net/minecraftforge/fml/common/event/FMLModIdMappingEvent.java @@ -8,34 +8,52 @@ 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 + * 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; 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 final boolean isFrozen; + public FMLModIdMappingEvent(Map blocks, Map items, boolean isFrozen) { + this.isFrozen = isFrozen; 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/event/FMLPostInitializationEvent.java b/src/main/java/net/minecraftforge/fml/common/event/FMLPostInitializationEvent.java index f281b4e8e..9a28b50ab 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,27 @@ 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.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 +46,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(); 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/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..11d4715cf 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) { @@ -279,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(); } } 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..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) + 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(); @@ -77,7 +81,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/FMLHandshakeClientState.java b/src/main/java/net/minecraftforge/fml/common/network/handshake/FMLHandshakeClientState.java index 15324aa23..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 @@ -1,8 +1,8 @@ package net.minecraftforge.fml.common.network.handshake; -import java.util.HashSet; 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; @@ -10,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; @@ -95,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); @@ -115,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(); @@ -157,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 7933d901e..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; @@ -28,6 +29,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 +37,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 +51,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 { @@ -79,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; @@ -222,7 +226,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 +234,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 +262,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 +304,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) @@ -308,14 +314,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); } @@ -450,11 +456,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 +471,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 +506,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/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/network/internal/FMLNetworkHandler.java b/src/main/java/net/minecraftforge/fml/common/network/internal/FMLNetworkHandler.java index 657bb22dd..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 @@ -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) @@ -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..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) @@ -165,7 +198,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 6e4c099e7..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); @@ -235,6 +234,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 +264,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 +326,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 +357,36 @@ public class EntityRegistry } } + /** + * 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 + */ @SuppressWarnings("unchecked") - public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeGenBase... 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,30 @@ public class EntityRegistry } } + /** + * 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 + */ @SuppressWarnings("unchecked") - public static void removeSpawn(String entityName, EnumCreatureType spawnList, BiomeGenBase... biomes) + 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/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 81a3c914b..f096a2947 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; @@ -9,138 +10,186 @@ import java.util.List; import java.util.Map; import java.util.Set; +import com.google.common.base.Throwables; +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.collect.BiMap; -import com.google.common.collect.HashBiMap; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Iterators; - -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; + + 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; 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; + } + this.addCallback = callback; } - 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)); - - // 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)); - // 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)); - // 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)); - // 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)); - // 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)); - // 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 + if (name == null) { - 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)); + 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)); + } + // 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)); + } + // 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, 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)); + } + // 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)); + } +/* + // 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)); + } +*/ } } @SuppressWarnings("unchecked") - void setFrom(FMLControlledNamespacedRegistry registry) { - set((FMLControlledNamespacedRegistry) registry); - } - void set(FMLControlledNamespacedRegistry registry) + 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.persistentSubstitutions.clear(); + this.persistentSubstitutions.putAll(otherRegistry.getPersistentSubstitutions()); 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); } /** @@ -150,17 +199,19 @@ 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."); + 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."); + } - name = new ResourceLocation(name).toString(); - Object existingName = getNameForObject(thing); + ResourceLocation existingName = getNameForObject(thing); if (existingName == null) { @@ -173,30 +224,28 @@ 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); } } /** * 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. * @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; } /** * 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. @@ -209,29 +258,11 @@ 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. - * + *

* 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. * @@ -251,28 +282,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 - */ - @SuppressWarnings("unchecked") - 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); } /** @@ -281,15 +291,18 @@ 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); + if (name != null) + { + return getRaw(name); + } } return ret; @@ -297,14 +310,14 @@ 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. * @return true if a matching entry was found. */ @Override - public boolean containsKey(Object name) + public boolean containsKey(ResourceLocation name) { boolean ret = super.containsKey(name); @@ -312,7 +325,10 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul { name = aliases.get(name); - if (name != null) return containsKey(name); + if (name != null) + { + return containsKey(name); + } } return ret; @@ -320,32 +336,26 @@ 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. * * @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; + if (obj == null) + { + return -1; + } 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() @@ -357,44 +367,43 @@ 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 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 (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; } @@ -424,43 +433,57 @@ 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.field_148758_b.containsKey(thing)) + 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)); } } } @@ -468,10 +491,12 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul return ret; } - void dump() + void dump(ResourceLocation registryName) { if (!DEBUG) + { return; + } List ids = new ArrayList(); @@ -482,7 +507,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); @@ -493,14 +518,28 @@ 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?"); - 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() @@ -508,38 +547,44 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul return optionalDefaultObject; } - public RegistryDelegate getDelegate(I thing, Class clazz) { - return GameData.buildDelegate(thing, clazz); + public RegistryDelegate getDelegate(I thing, Class 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); + } + } + + I 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); + return original; } + return null; } - 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) { @@ -560,12 +605,8 @@ public class FMLControlledNamespacedRegistry extends RegistryNamespacedDefaul getPersistentSubstitutions().put(nameToReplace, replacement); } - private BiMap getPersistentSubstitutions() + BiMap getPersistentSubstitutions() { - if (persistentSubstitutions == null) - { - persistentSubstitutions = GameData.getMain().getPersistentSubstitutionMap(superType); - } return persistentSubstitutions; } @@ -573,8 +614,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() @@ -583,20 +627,118 @@ 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() { - return new FMLControlledNamespacedRegistry(optionalDefaultKey, maxId, minId, superType); + FMLControlledNamespacedRegistry makeShallowCopy() + { + 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); + } + + public void notifyCallbacks() + { + if (addCallback == null) + return; + + for (I i : this.underlyingIntegerMap) + { + 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/GameData.java b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java index 052604316..71e854602 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/GameData.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/GameData.java @@ -12,69 +12,33 @@ 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; -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 com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; +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.ItemBanner; import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; 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 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; - -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; static final int MAX_ITEM_ID = 31999; + 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(); - private static Map customOwners = Maps.newHashMap(); - private static GameData frozen; - // public api /** @@ -82,7 +46,8 @@ public class GameData { * * @return Block Registry. */ - public static FMLControlledNamespacedRegistry getBlockRegistry() { + public static FMLControlledNamespacedRegistry getBlockRegistry() + { return getMain().iBlockRegistry; } @@ -91,581 +56,54 @@ public class GameData { * * @return Item Registry. */ - public static FMLControlledNamespacedRegistry getItemRegistry() { + public static FMLControlledNamespacedRegistry getItemRegistry() + { 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! ***************************************************/ - 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(); - } - - 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 Item findItem(String modId, String name) { - return getMain().iItemRegistry.getObject(modId + ":" + name); + return getMain().iItemRegistry.getObject(new ResourceLocation(modId, name)); } static Block findBlock(String modId, String name) { - return getMain().iBlockRegistry.getObject(modId + ":" + name); + return getMain().iBlockRegistry.getObject(new ResourceLocation(modId, name)); } - static UniqueIdentifier getUniqueName(Block block) + static GameRegistry.UniqueIdentifier getUniqueName(Block block) { - if (block == null) return null; + 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) + static GameRegistry.UniqueIdentifier getUniqueName(Item item) { - if (item == null) return null; + 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); + return new GameRegistry.UniqueIdentifier(name); } protected static GameData getMain() @@ -674,227 +112,57 @@ public class GameData { } // 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, BlockStateCapture.INSTANCE); + 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 { 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) + private int registerItem(Item item, ResourceLocation 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; + 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) + private int registerBlock(Block block, ResourceLocation name, int idHint) { - // handle ItemBlock-before-Block registrations - ItemBlock itemBlock = null; - - 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())) - { - 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); + return iBlockRegistry.add(idHint, name, block); } /** * 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); @@ -910,210 +178,108 @@ public class GameData { prefix = "minecraft"; } - if (!oldPrefix.equals(prefix)) + if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0) { - name = prefix + ":" + name; + prefix = oldPrefix; } - return name; + return new ResourceLocation(prefix, name); } - private void verifyItemBlockName(ItemBlock item) + void registerSubstitutionAlias(String name, GameRegistry.Type type, Object toReplace) throws ExistingSubstitutionException { - 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())) + ResourceLocation nameToSubstitute = new ResourceLocation(name); + if (type == GameRegistry.Type.BLOCK) { - 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)) + iBlockRegistry.addSubstitutionAlias(Loader.instance().activeModContainer().getModId(), nameToSubstitute, (Block)toReplace); + Block orig = iBlockRegistry.activateSubstitution(nameToSubstitute); + if (BLOCK_TO_ITEM.containsKey(orig)) { - throw new IllegalStateException(String.format("availabilityMap references empty entries for id %d.", i)); + Item i = BLOCK_TO_ITEM.get(orig); + BLOCK_TO_ITEM.forcePut((Block)toReplace,i); } } - - for (int pass = 0; pass < 2; pass++) + else if (type == GameRegistry.Type.ITEM) { - 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(); - @SuppressWarnings("unchecked") - 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(); + iItemRegistry.addSubstitutionAlias(Loader.instance().activeModContainer().getModId(), nameToSubstitute, (Item)toReplace); + 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() { 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 ClearableObjectIntIdentityMap getBlockStateIDMap() { return BLOCKSTATE_TO_ID; } //Lets us clear the map so we can rebuild it. - private static class ClearableObjectIntIdentityMap extends ObjectIntIdentityMap + static class ClearableObjectIntIdentityMap extends ObjectIntIdentityMap { - private void clear() + 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); } - @SuppressWarnings("unchecked") - private FMLControlledNamespacedRegistry getGenericRegistry(String registryName, Class type) { - FMLControlledNamespacedRegistry fmlControlledNamespacedRegistry = genericRegistries.get(registryName); - return (FMLControlledNamespacedRegistry) fmlControlledNamespacedRegistry; - } + private static class BlockStateCapture implements FMLControlledNamespacedRegistry.AddCallback + { + static final BlockStateCapture INSTANCE = new BlockStateCapture(); - @SuppressWarnings("unchecked") - 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()) + @Override + public void onAdd(Block block, int blockId) { - String regName = e.getKey(); - FMLControlledNamespacedRegistry registry = e.getValue(); - FMLControlledNamespacedRegistry newRegistry = genericRegistries.get(regName); - if (newRegistry == null) + for (IBlockState state : block.getBlockState().getValidStates()) { - 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)); - + GameData.BLOCKSTATE_TO_ID.put(state, blockId << 4 | block.getMetaFromState(state)); } } - return result; } - public static FMLControlledNamespacedRegistry getRegistry(String registryName, Class type) { - return getMain().getGenericRegistry(registryName, type); + 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.forcePut(itemBlock.getBlock().delegate.get(), item); + } + } } + 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 352dd7990..04182af02 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; @@ -36,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; @@ -48,18 +60,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 +70,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 +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) { @@ -116,7 +116,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,10 +140,10 @@ 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 - * 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) { @@ -157,9 +158,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 @@ -169,8 +170,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) { @@ -179,22 +181,25 @@ 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") public static Block registerBlock(Block block, Class itemclass, String name, Object... itemCtorArgs) { if (Loader.instance().isInState(LoaderState.CONSTRUCTING)) @@ -211,7 +216,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 +229,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); @@ -247,7 +251,6 @@ public class GameRegistry CraftingManager.getInstance().addShapelessRecipe(output, params); } - @SuppressWarnings("unchecked") public static void addRecipe(IRecipe recipe) { CraftingManager.getInstance().getRecipeList().add(recipe); @@ -278,14 +281,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)) { @@ -298,6 +301,7 @@ public class GameRegistry { fuelHandlers.add(handler); } + public static int getFuelValue(ItemStack itemStack) { int fuelValue = 0; @@ -310,8 +314,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) @@ -321,8 +326,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) @@ -330,10 +336,15 @@ 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; public final String name; + UniqueIdentifier(String modId, String name) { this.modId = modId; @@ -358,7 +369,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 { @@ -369,9 +380,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); } @@ -388,66 +405,51 @@ public class GameRegistry } } - public static enum Type { - BLOCK - { - @Override - public FMLControlledNamespacedRegistry getRegistry() { - return GameData.getBlockRegistry(); - } - }, - ITEM - { - @Override - public FMLControlledNamespacedRegistry getRegistry() { - return GameData.getItemRegistry(); - } - }; - - public abstract FMLControlledNamespacedRegistry getRegistry(); + public enum Type + { + BLOCK, + ITEM; } + /** * 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. * * @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. * * @param item to lookup * @return a {@link UniqueIdentifier} for the item or null */ + @Deprecated public static UniqueIdentifier findUniqueIdentifierFor(Item item) { return GameData.getUniqueName(item); } - /** - * 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) @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. @@ -458,18 +460,28 @@ 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 { /** * 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; @@ -484,40 +496,48 @@ 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"); - Item item = GameData.getItemRegistry().getObject(itemName); - if (item == null) { + if (itemName == null) + { + throw new IllegalArgumentException("The itemName cannot be null"); + } + 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; } - 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 { - 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); 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/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 08a93821f..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,9 +50,9 @@ class ObjectHolderRef { } else { - 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..607198964 --- /dev/null +++ b/src/main/java/net/minecraftforge/fml/common/registry/PersistentRegistryManager.java @@ -0,0 +1,585 @@ +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; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.google.common.base.Function; +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 org.apache.logging.log4j.Level; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockAir; +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.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 + { + 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 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()) + { + 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, addCallback); + 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 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) + { + 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) + { + 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(); + + forAllRegistries(PersistentRegistry.ACTIVE, ValidateRegistryFunction.OPERATION); + forAllRegistries(PersistentRegistry.ACTIVE, DumpRegistryFunction.OPERATION); + forAllRegistries(PersistentRegistry.ACTIVE, ResetDelegatesFunction.OPERATION); + + // 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()) + { + 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 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) + { + // 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), false); + + // 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(); + } + 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()) + { + operation.apply(r); + } + } + + private static void loadRegistry(final ResourceLocation registryName, final PersistentRegistry from, final PersistentRegistry to, Class regType) + { + FMLControlledNamespacedRegistry fromRegistry = from.getRegistry(registryName, regType); + 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.notifyCallbacks(); + } + else + { + FMLControlledNamespacedRegistry toRegistry = to.getOrShallowCopyRegistry(registryName, regType, fromRegistry); + toRegistry.set(fromRegistry); + } + } + + private static void loadFrozenDataToStagingRegistry(Map> remaps, ResourceLocation registryName, Class 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); + } + + 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 \"%s\" has been encountered. This Forge instance cannot understand it.", registryName); + 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) + { + 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."); + return; + } + 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(), true); + + // the id mapping has reverted, ensure we sync up the object holders + ObjectHolderRegistry.INSTANCE.applyObjectHolders(); + FMLLog.fine("Frozen state restored."); + } + + 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 b4af63763..7eef45e0b 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/VillagerRegistry.java @@ -12,9 +12,6 @@ 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; @@ -22,40 +19,41 @@ 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.block.Block; 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; 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; +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; -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 * * @author cpw - * */ 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(); @@ -73,7 +71,6 @@ public class VillagerRegistry * creation so you can insert your own new village pieces * * @author cpw - * */ public interface IVillageCreationHandler { @@ -93,6 +90,7 @@ public class VillagerRegistry /** * Build an instance of the village component {@link net.minecraft.world.gen.structure.StructureVillagePieces} + * * @param villagePiece * @param startPiece * @param pieces @@ -103,8 +101,8 @@ public class VillagerRegistry * @param facing * @param p5 */ - Object buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, @SuppressWarnings("rawtypes") List pieces, Random random, int p1, - int p2, int p3, EnumFacing facing, int p5); + Village buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List pieces, Random random, int p1, + int p2, int p3, EnumFacing facing, int p5); } public static VillagerRegistry instance() @@ -114,6 +112,7 @@ public class VillagerRegistry /** * Register your villager id + * * @param id */ @Deprecated // Doesn't work at all. @@ -126,6 +125,7 @@ public class VillagerRegistry } newVillagerIds.add(id); } + /** * Register a new skin for a villager type * @@ -181,18 +181,17 @@ 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, - int p1, int p2, int p3, EnumFacing facing, int p5) + 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); } @@ -201,27 +200,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 = GameData.createRegistry("villagerprofessions", VillagerProfession.class, 0, 1024); + private FMLControlledNamespacedRegistry professions = PersistentRegistryManager.createRegistry(PROFESSIONS, 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"); { @@ -236,9 +238,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"); { @@ -253,13 +255,13 @@ public class VillagerRegistry private ResourceLocation name; 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); + ((RegistryDelegate.Delegate)delegate).setResourceName(this.name); } private void register(VillagerCareer career) @@ -276,6 +278,7 @@ public class VillagerRegistry private VillagerProfession profession; private String name; private int id; + public VillagerCareer(VillagerProfession parent, String name) { this.profession = parent; @@ -291,8 +294,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; } @@ -302,11 +311,11 @@ 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) { - Set entries = INSTANCE.professions.getKeys(); + Set entries = INSTANCE.professions.getKeys(); int prof = rand.nextInt(entries.size()); //TODO: Grab id range from internal registry entity.setProfession(rand.nextInt(5)); @@ -320,196 +329,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)) + } + } + } + }; } } 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/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; } 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 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/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/oredict/OreDictionary.java b/src/main/java/net/minecraftforge/oredict/OreDictionary.java index 3a7de810f..b8e880cc6 100644 --- a/src/main/java/net/minecraftforge/oredict/OreDictionary.java +++ b/src/main/java/net/minecraftforge/oredict/OreDictionary.java @@ -1,18 +1,14 @@ 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 net.minecraft.util.ResourceLocation; import org.apache.logging.log4j.Level; import net.minecraft.block.Block; @@ -55,7 +51,6 @@ public class OreDictionary initVanillaEntries(); } - @SuppressWarnings("unchecked") public static void initVanillaEntries() { if (!hasInit) @@ -331,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) { @@ -406,7 +401,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) { @@ -455,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) { @@ -512,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) { 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 163bc3469..93cadbb84 100644 --- a/src/main/java/net/minecraftforge/server/command/ForgeCommand.java +++ b/src/main/java/net/minecraftforge/server/command/ForgeCommand.java @@ -21,11 +21,11 @@ public class ForgeCommand extends CommandBase { public ForgeCommand(MinecraftServer server) { - this.server = new WeakReference(server); + this.server = new WeakReference(server); } @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) { @@ -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) { @@ -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/main/java/net/minecraftforge/server/console/ConsoleCommandCompleter.java b/src/main/java/net/minecraftforge/server/console/ConsoleCommandCompleter.java new file mode 100644 index 000000000..fd73fbc3c --- /dev/null +++ b/src/main/java/net/minecraftforge/server/console/ConsoleCommandCompleter.java @@ -0,0 +1,97 @@ +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; +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(); + + boolean prefix; + if (buffer.isEmpty() || 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(); + Collections.sort(completions); + 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 if (prefix) + { + return cursor - len + pos + 1; + } + 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..142b32bc7 --- /dev/null +++ b/src/main/java/net/minecraftforge/server/console/TerminalHandler.java @@ -0,0 +1,71 @@ +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) + { + break; + } + + 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/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/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 000000000..04faf5102 Binary files /dev/null and b/src/main/resources/assets/forge/textures/items/bucket_base.png differ diff --git a/src/main/resources/assets/forge/textures/items/bucket_cover.png b/src/main/resources/assets/forge/textures/items/bucket_cover.png new file mode 100644 index 000000000..863787ae1 Binary files /dev/null and b/src/main/resources/assets/forge/textures/items/bucket_cover.png differ diff --git a/src/main/resources/assets/forge/textures/items/bucket_fluid.png b/src/main/resources/assets/forge/textures/items/bucket_fluid.png new file mode 100644 index 000000000..d03389aab Binary files /dev/null and b/src/main/resources/assets/forge/textures/items/bucket_fluid.png differ diff --git a/src/main/resources/forge.exc b/src/main/resources/forge.exc index 8801190df..9735ddfdb 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -31,12 +31,14 @@ 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 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 diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index 8d4974c81..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 @@ -222,3 +224,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 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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": "", diff --git a/src/test/java/net/minecraftforge/debug/DynBucketTest.java b/src/test/java/net/minecraftforge/debug/DynBucketTest.java new file mode 100644 index 000000000..06e88db3c --- /dev/null +++ b/src/test/java/net/minecraftforge/debug/DynBucketTest.java @@ -0,0 +1,172 @@ +package net.minecraftforge.debug; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.ItemMeshDefinition; +import net.minecraft.client.resources.model.ModelBakery; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.ModelDynBucket; +import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.debug.ModelFluidDebug.TestFluid; +import net.minecraftforge.debug.ModelFluidDebug.TestGas; +import net.minecraftforge.event.entity.player.FillBucketEvent; +import net.minecraftforge.fluids.*; +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.eventhandler.Event.Result; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.registry.GameRegistry; + +import java.util.List; + +@Mod(modid = "DynBucketTest", version = "0.1", dependencies = "after:" + ModelFluidDebug.MODID) +public class DynBucketTest +{ + public static final Item dynBucket = new DynBucket(); + public static final Item dynBottle = new DynBottle(); + + @SidedProxy(clientSide = "net.minecraftforge.debug.DynBucketTest$ClientProxy", serverSide = "net.minecraftforge.debug.DynBucketTest$CommonProxy") + public static CommonProxy proxy; + + public static class CommonProxy + { + void setupModels() + { + } + } + + public static class ClientProxy extends CommonProxy + { + @Override + void setupModels() + { + ModelLoader.setBucketModelDefinition(dynBucket); + + final ModelResourceLocation bottle = new ModelResourceLocation(new ResourceLocation("forge", "dynbottle"), "inventory"); + ModelLoader.setCustomMeshDefinition(dynBottle, new ItemMeshDefinition() + { + @Override + public ModelResourceLocation getModelLocation(ItemStack stack) + { + return bottle; + } + }); + ModelBakery.registerItemVariants(dynBottle, bottle); + } + } + + @EventHandler + public void preInit(FMLPreInitializationEvent event) + { + GameRegistry.registerItem(dynBucket, "dynbucket"); + GameRegistry.registerItem(dynBottle, "dynbottle"); + + // register fluid containers + int i = 0; + //registerFluidContainer(FluidRegistry.WATER, i++); + //registerFluidContainer(FluidRegistry.LAVA, i++); + registerFluidContainer(FluidRegistry.getFluid(TestFluid.name), i++); + registerFluidContainer(FluidRegistry.getFluid(TestGas.name), i++); + + i = 0; + registerFluidContainer2(FluidRegistry.WATER, i++); + registerFluidContainer2(FluidRegistry.LAVA, i++); + registerFluidContainer2(FluidRegistry.getFluid(TestFluid.name), i++); + registerFluidContainer2(FluidRegistry.getFluid(TestGas.name), i++); + + // Set TestFluidBlocks blockstate to use milk instead of testfluid for the texture to be loaded + FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluid("milk"), new ItemStack(Items.milk_bucket), FluidContainerRegistry.EMPTY_BUCKET); + + proxy.setupModels(); + MinecraftForge.EVENT_BUS.register(this); + } + + private void registerFluidContainer(Fluid fluid, int meta) + { + if (fluid == null) + return; + + FluidStack fs = new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME); + ItemStack stack = new ItemStack(dynBucket, 1, meta); + FluidContainerRegistry.registerFluidContainer(fs, stack, new ItemStack(Items.bucket)); + } + + private void registerFluidContainer2(Fluid fluid, int meta) + { + if (fluid == null) + return; + + FluidStack fs = new FluidStack(fluid, 250); + ItemStack stack = new ItemStack(dynBottle, 1, meta); + FluidContainerRegistry.registerFluidContainer(fs, stack, new ItemStack(Items.glass_bottle)); + } + + @SubscribeEvent + public void onBucketFill(FillBucketEvent event) + { + IBlockState state = event.world.getBlockState(event.target.getBlockPos()); + if (state.getBlock() instanceof IFluidBlock) + { + Fluid fluid = ((IFluidBlock) state.getBlock()).getFluid(); + FluidStack fs = new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME); + + ItemStack filled = FluidContainerRegistry.fillFluidContainer(fs, event.current); + if (filled != null) + { + event.result = filled; + event.setResult(Result.ALLOW); + } + } + } + + public static class DynBucket extends Item + { + public DynBucket() + { + setUnlocalizedName("dynbucket"); + 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); + } + } + } + + 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/ForgeBlockStatesLoaderDebug.java b/src/test/java/net/minecraftforge/debug/ForgeBlockStatesLoaderDebug.java index 4dfa7b49d..19f2b775b 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; @@ -36,7 +34,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,86 +46,87 @@ public class ForgeBlockStatesLoaderDebug { return BlockWall.EnumType.byMetadata(stack.getMetadata()).getUnlocalizedName(); } }); - + + @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); 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) + 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; } }); 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 - 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(); }; - } + 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(); }; + } } } 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..52167ecac 100644 --- a/src/test/java/net/minecraftforge/debug/LayerBreakingTest.java +++ b/src/test/java/net/minecraftforge/debug/LayerBreakingTest.java @@ -147,23 +147,14 @@ public class LayerBreakingTest IFlexibleBakedModel solid; IFlexibleBakedModel translucent; - private class DefState implements IModelState - { - @Override - public TRSRTransformation apply(IModelPart part) - { - return TRSRTransformation.identity(); - } - }; - @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/ModelAnimationDebug.java b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java index 2652ed0a8..20e48161c 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; @@ -21,10 +22,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.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; @@ -60,7 +63,6 @@ public class ModelAnimationDebug { public void preInit(FMLPreInitializationEvent event) { - B3DLoader.instance.addDomain(MODID); GameRegistry.registerBlock(new Block(Material.wood) { { @@ -71,12 +73,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 +108,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); @@ -144,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")); } @@ -161,7 +166,7 @@ public class ModelAnimationDebug @EventHandler public void init(FMLInitializationEvent event) { proxy.init(event); } - private static class Chest extends TileEntity implements IUpdatePlayerListBox + private static class Chest extends TileEntity implements ITickable { private final int minFrame = 1; private final int maxFrame = 10; @@ -229,23 +234,24 @@ public class ModelAnimationDebug } } - private static class ChestRenderer extends TileEntitySpecialRenderer + private static class ChestRenderer extends TileEntitySpecialRenderer { public static ChestRenderer instance = new ChestRenderer(); private ChestRenderer() {} private final BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); - public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialTick, int breakStage) + 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; if(exState.getUnlistedNames().contains(B3DFrameProperty.instance)) { - exState = exState.withProperty(B3DFrameProperty.instance, new B3DState(null, ((Chest)te).getCurFrame(), ((Chest)te).getNextFrame(), partialTick)); + exState = exState.withProperty(B3DFrameProperty.instance, new B3DState(null, te.getCurFrame(), te.getNextFrame(), partialTick)); if(model instanceof ISmartBlockModel) { model = ((ISmartBlockModel)model).handleBlockState(exState); @@ -270,8 +276,7 @@ public class ModelAnimationDebug GlStateManager.shadeModel(GL11.GL_FLAT); } - worldrenderer.startDrawingQuads(); - worldrenderer.setVertexFormat(DefaultVertexFormats.BLOCK); + 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); 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/debug/ModelFluidDebug.java b/src/test/java/net/minecraftforge/debug/ModelFluidDebug.java index c3d285200..5eb6b27b4 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; @@ -33,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); } @@ -42,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); } } @@ -51,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) @@ -58,8 +59,11 @@ public class ModelFluidDebug super.preInit(event); Item fluid = Item.getItemFromBlock(TestFluidBlock.instance); Item gas = Item.getItemFromBlock(TestGasBlock.instance); - ModelBakery.addVariantName(fluid); - ModelBakery.addVariantName(gas); + Item milk = Item.getItemFromBlock(MilkFluidBlock.instance); + // 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) @@ -74,6 +78,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) @@ -88,6 +99,13 @@ public class ModelFluidDebug return gasLocation; } }); + ModelLoader.setCustomStateMapper(MilkFluidBlock.instance, new StateMapperBase() + { + protected ModelResourceLocation getModelResourceLocation(IBlockState state) + { + return milkLocation; + } + }); } } @@ -140,6 +158,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/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; 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..c50bbdd49 --- /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/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; + } + } +} 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();*/ + } + } +} 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.")); + } + } + } +} 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; 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 000000000..e28842b6b Binary files /dev/null and b/src/test/resources/assets/forge/textures/blocks/milk_flow.png differ 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 000000000..d83dba2a8 Binary files /dev/null and b/src/test/resources/assets/forge/textures/blocks/milk_still.png differ 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/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/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" } + } + } + ] +} 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" } } } } 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 b070d7a6f..5e5b65808 100644 Binary files a/src/test/resources/assets/forgedebugmodelloaderregistry/models/block/chest.b3d and b/src/test/resources/assets/forgedebugmodelloaderregistry/models/block/chest.b3d differ 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": [{}] + } +}