diff options
334 files changed, 19900 insertions, 14734 deletions
diff --git a/.classpath b/.classpath index aa894ce..d37a610 100644..100755 --- a/.classpath +++ b/.classpath @@ -1,72 +1,17 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="lib" path="H:/Jewelrycraft/1.7.10/libs/NotEnoughItems-1.7.10-1.0.4.95-universal.jar"/>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="src/main/resources"/>
- <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.10-10.13.3.1428-1.7.10/forgeSrc-1.7.10-10.13.3.1428-1.7.10.jar" sourcepath="C:/Users/Onyx/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.10-10.13.3.1428-1.7.10/forgeSrc-1.7.10-10.13.3.1428-1.7.10-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/net.minecraft/launchwrapper/1.11/9c0592c6e1e9ea296a70948081bd4cc84dda1289/launchwrapper-1.11.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/net.minecraft/launchwrapper/1.11/ea64c0bce5e9f465cd56566530133331568d2157/launchwrapper-1.11-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.google.code.findbugs/jsr305/1.3.9/40719ea6961c0cb6afaeb6a921eaa1f6afd4cfdf/jsr305-1.3.9.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-debug-all/5.0.3/f9e364ae2a66ce2a543012a4668856e84e5dab74/asm-debug-all-5.0.3.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-debug-all/5.0.3/f0f24f6666c1a15c7e202e91610476bd4ce59368/asm-debug-all-5.0.3-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.typesafe.akka/akka-actor_2.11/2.3.3/ed62e9fc709ca0f2ff1a3220daa8b70a2870078e/akka-actor_2.11-2.3.3.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.typesafe.akka/akka-actor_2.11/2.3.3/9dbceb71c4fd943b4eb4607847261075a989d47f/akka-actor_2.11-2.3.3-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.typesafe/config/1.2.1/f771f71fdae3df231bcd54d5ca2d57f0bf93f467/config-1.2.1.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.typesafe/config/1.2.1/bdacf4f82ce9b29cd474bfde2e91eeb0ca623d28/config-1.2.1-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-actors-migration_2.11/1.1.0/dfa8bc42b181d5b9f1a5dd147f8ae308b893eb6f/scala-actors-migration_2.11-1.1.0.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-actors-migration_2.11/1.1.0/6bccac72dae4d369537e313d12087c1ca295e84f/scala-actors-migration_2.11-1.1.0-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-compiler/2.11.1/56ea2e6c025e0821f28d73ca271218b8dd04926a/scala-compiler-2.11.1.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-compiler/2.11.1/b031d401aabbf7f5f725db500575da3dff90065f/scala-compiler-2.11.1-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.scala-lang.plugins/scala-continuations-library_2.11/1.0.2/e517c53a7e9acd6b1668c5a35eccbaa3bab9aac/scala-continuations-library_2.11-1.0.2.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.scala-lang.plugins/scala-continuations-library_2.11/1.0.2/495afc106eeaa1b3367f6be0bc3768c398e4d360/scala-continuations-library_2.11-1.0.2-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.scala-lang.plugins/scala-continuations-plugin_2.11.1/1.0.2/f361a3283452c57fa30c1ee69448995de23c60f7/scala-continuations-plugin_2.11.1-1.0.2.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.scala-lang.plugins/scala-continuations-plugin_2.11.1/1.0.2/c6f3c092ab731f3cf83fdb376ebc465a243c1f4c/scala-continuations-plugin_2.11.1-1.0.2-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-library/2.11.1/e11da23da3eabab9f4777b9220e60d44c1aab6a/scala-library-2.11.1.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-library/2.11.1/8355e4b6841f772a287167666bad6e9860ac4d3c/scala-library-2.11.1-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-parser-combinators_2.11/1.0.1/f05d7345bf5a58924f2837c6c1f4d73a938e1ff0/scala-parser-combinators_2.11-1.0.1.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-reflect/2.11.1/6580347e61cc7f8e802941e7fde40fa83b8badeb/scala-reflect-2.11.1.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-reflect/2.11.1/d4c5628e197a0d6af8e9b93a9be32190c547bc8a/scala-reflect-2.11.1-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-swing_2.11/1.0.1/b1cdd92bd47b1e1837139c1c53020e86bb9112ae/scala-swing_2.11-1.0.1.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-xml_2.11/1.0.2/7a80ec00aec122fba7cd4e0d4cdd87ff7e4cb6d0/scala-xml_2.11-1.0.2.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/net.sf.jopt-simple/jopt-simple/4.5/6065cc95c661255349c1d0756657be17c29a4fd3/jopt-simple-4.5.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/net.sf.jopt-simple/jopt-simple/4.5/3cf4c3c1a6f565419bfd53a0e564d6fb128deeea/jopt-simple-4.5-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/lzma/lzma/0.0.1/521616dc7487b42bef0e803bd2fa3faf668101d7/lzma-0.0.1.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.mojang/realms/1.3.5/807ae355ee63583becd7ea60e76aab1532bb42e/realms-1.3.5.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-compress/1.8.1/a698750c16740fd5b3871425f4cb3bbaa87f529d/commons-compress-1.8.1.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-compress/1.8.1/3caea4421428752206c7a94c3e3097f0c47f1bb8/commons-compress-1.8.1-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpclient/4.3.3/18f4247ff4572a074444572cee34647c43e7c9c7/httpclient-4.3.3.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpclient/4.3.3/65cba03c4f6207f2885f88206fcf52c53f8d111b/httpclient-4.3.3-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/commons-logging/commons-logging/1.1.3/f6f66e966c70a83ffbdb6f17a0919eaf7c8aca7f/commons-logging-1.1.3.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/commons-logging/commons-logging/1.1.3/28bb0405fddaf04f15058fbfbe01fe2780d7d3b6/commons-logging-1.1.3-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpcore/4.3.2/31fbbff1ddbf98f3aa7377c94d33b0447c646b6e/httpcore-4.3.2.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpcore/4.3.2/4809f38359edeea9487f747e09aa58ec8d3a54c5/httpcore-4.3.2-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/java3d/vecmath/1.3.1/a0ae4f51da409fa0c20fa0ca59e6bbc9413ae71d/vecmath-1.3.1.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/net.sf.trove4j/trove4j/3.0.3/42ccaf4761f0dfdfa805c9e340d99a755907e2dd/trove4j-3.0.3.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/net.sf.trove4j/trove4j/3.0.3/109c5be93362e6e651e417c51d1863477a22969c/trove4j-3.0.3-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.ibm.icu/icu4j-core-mojang/51.2/63d216a9311cca6be337c1e458e587f99d382b84/icu4j-core-mojang-51.2.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.ibm.icu/icu4j-core-mojang/51.2/814397ccbafff1132758e551c37396c528d7f2d7/icu4j-core-mojang-51.2-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.paulscode/codecjorbis/20101023/c73b5636faf089d9f00e8732a829577de25237ee/codecjorbis-20101023.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.paulscode/codecjorbis/20101023/4ca2436396bc14ebd78b7db1d4e11ca607c8705e/codecjorbis-20101023-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.paulscode/codecwav/20101023/12f031cfe88fef5c1dd36c563c0a3a69bd7261da/codecwav-20101023.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.paulscode/codecwav/20101023/71ec00b9b9c1a6a2c3a8a25f481a23ddb5b21ddb/codecwav-20101023-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.paulscode/libraryjavasound/20101123/5c5e304366f75f9eaa2e8cca546a1fb6109348b3/libraryjavasound-20101123.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.paulscode/libraryjavasound/20101123/945ff5711de27751cf699641d1ea316ba6cf7589/libraryjavasound-20101123-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.paulscode/librarylwjglopenal/20100824/73e80d0794c39665aec3f62eee88ca91676674ef/librarylwjglopenal-20100824.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.paulscode/librarylwjglopenal/20100824/ecfc8dac1d41bef748997e4edf563d486923ee1e/librarylwjglopenal-20100824-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.paulscode/soundsystem/20120107/419c05fe9be71f792b2d76cfc9b67f1ed0fec7f6/soundsystem-20120107.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.paulscode/soundsystem/20120107/1b9f4eb11ef11fede7fd76a2e5e8203c2a8adcd/soundsystem-20120107-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/io.netty/netty-all/4.0.10.Final/9e50bd52ffe257a0e2cd8d971688d6ce7d174325/netty-all-4.0.10.Final.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/io.netty/netty-all/4.0.10.Final/9a214bc1e6350ead5234e4dd5eb3a2a802d1c658/netty-all-4.0.10.Final-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/17.0/9c6ef172e8de35fd8d4d8783e4821e57cdef7445/guava-17.0.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/17.0/7ca0efbeb87ca845b5d7a0ac9c21a4b7b95f7b28/guava-17.0-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-lang3/3.3.2/90a3822c38ec8c996e84c16a3477ef632cbc87a3/commons-lang3-3.3.2.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-lang3/3.3.2/d2a489573c0ed2c4942b3660decad5d65087b406/commons-lang3-3.3.2-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/commons-io/commons-io/2.4/b1b6ea3b7e4aa4f492509a4952029cd8e48019ad/commons-io-2.4.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/commons-io/commons-io/2.4/f2d8698c46d1167ff24b06a840a87d91a02db891/commons-io-2.4-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/commons-codec/commons-codec/1.9/9ce04e34240f674bc72680f8b843b1457383161a/commons-codec-1.9.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/commons-codec/commons-codec/1.9/3f15fff45d57656685abfee9e8302bf14580044c/commons-codec-1.9-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/net.java.jinput/jinput/2.0.5/39c7796b469a600f72380316f6b1f11db6c2c7c4/jinput-2.0.5.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/net.java.jinput/jinput/2.0.5/82604cfeb87b9ab70ed70aa19a137de8ceb21504/jinput-2.0.5-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/net.java.jutils/jutils/1.0.0/e12fe1fda814bd348c1579329c86943d2cd3c6a6/jutils-1.0.0.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/net.java.jutils/jutils/1.0.0/d18678a00b216863206a1bb6190507e02a32971b/jutils-1.0.0-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.2.4/a60a5e993c98c864010053cb901b7eab25306568/gson-2.2.4.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.2.4/a6dc5db8a12928e583bd3f23e72d3ab611ecd58f/gson-2.2.4-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.mojang/authlib/1.5.16/ef1582b11fd0943d069cdcb72e99008ac209a283/authlib-1.5.16.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/com.mojang/authlib/1.5.16/f7d1af1fd1232bb4f2e7898f059b536ad5bc950/authlib-1.5.16-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-api/2.0-beta9/1dd66e68cccd907880229f9e2de1314bd13ff785/log4j-api-2.0-beta9.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-api/2.0-beta9/c6682b8a47ddd9f29108838aed0dc8e0ffdedf68/log4j-api-2.0-beta9-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-core/2.0-beta9/678861ba1b2e1fccb594bb0ca03114bb05da9695/log4j-core-2.0-beta9.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-core/2.0-beta9/c7da50fd52d6ee6991a0e16e2df1431f7656a7f4/log4j-core-2.0-beta9-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.lwjgl.lwjgl/lwjgl/2.9.1/f58c5aabcef0e41718a564be9f8e412fff8db847/lwjgl-2.9.1.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.lwjgl.lwjgl/lwjgl/2.9.1/ccedb5b6f96913c6f78bc10249e747ded90baa51/lwjgl-2.9.1-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.lwjgl.lwjgl/lwjgl_util/2.9.1/290d7ba8a1bd9566f5ddf16ad06f09af5ec9b20e/lwjgl_util-2.9.1.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.lwjgl.lwjgl/lwjgl_util/2.9.1/9f350d8a760247f2ae88e996b55f8f7121346c79/lwjgl_util-2.9.1-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/tv.twitch/twitch/5.16/1f55f009c61637c10c0acfb8b5ffc600f30044b4/twitch-5.16.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-actors/2.11.0/8ccfb6541de179bb1c4d45cf414acee069b7f78b/scala-actors-2.11.0.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-actors/2.11.0/e1dfa274766d5278166b0d660294fe96396693b2/scala-actors-2.11.0-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.scala-lang.modules/scala-xml_2.11/1.0.2/820fbca7e524b530fdadc594c39d49a21ea0337e/scala-xml_2.11-1.0.2.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.scala-lang.modules/scala-xml_2.11/1.0.2/312c3557d1ca0b34820f3b3fc5404a47936ceb26/scala-xml_2.11-1.0.2-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.scala-lang.modules/scala-parser-combinators_2.11/1.0.1/f05d7345bf5a58924f2837c6c1f4d73a938e1ff0/scala-parser-combinators_2.11-1.0.1.jar" sourcepath="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.scala-lang.modules/scala-parser-combinators_2.11/1.0.1/34d013c02d0b73794ba2911552896dd9c00f34c3/scala-parser-combinators_2.11-1.0.1-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/net.java.jinput/jinput-platform/2.0.5/7ff832a6eb9ab6a767f1ade2b548092d0fa64795/jinput-platform-2.0.5-natives-linux.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/net.java.jinput/jinput-platform/2.0.5/385ee093e01f587f30ee1c8a2ee7d408fd732e16/jinput-platform-2.0.5-natives-windows.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/net.java.jinput/jinput-platform/2.0.5/53f9c919f34d2ca9de8c51fc4e1e8282029a9232/jinput-platform-2.0.5-natives-osx.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/tv.twitch/twitch-platform/5.16/7c6affe439099806a4f552da14c42f9d643d8b23/twitch-platform-5.16-natives-windows-32.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/tv.twitch/twitch-platform/5.16/39d0c3d363735b4785598e0e7fbf8297c706a9f9/twitch-platform-5.16-natives-windows-64.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/tv.twitch/twitch-platform/5.16/62503ee712766cf77f97252e5902786fd834b8c5/twitch-platform-5.16-natives-osx.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/tv.twitch/twitch-external-platform/4.5/18215140f010c05b9f86ef6f0f8871954d2ccebf/twitch-external-platform-4.5-natives-windows-32.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/tv.twitch/twitch-external-platform/4.5/c3cde57891b935d41b6680a9c5e1502eeab76d86/twitch-external-platform-4.5-natives-windows-64.jar"/>
- <classpathentry kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/codechicken/CodeChickenLib/1.7.10-1.1.1.104/d4cc6281ce640f55aa9ef87a9a8813efd498004e/CodeChickenLib-1.7.10-1.1.1.104-dev.jar"/>
- <classpathentry kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/codechicken/CodeChickenCore/1.7.10-1.0.3.26/db470f9d656a194be24ae9aed04d0f5fa9e44e07/CodeChickenCore-1.7.10-1.0.3.26-dev.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.lwjgl.lwjgl/lwjgl-platform/2.9.1/4c517eca808522457dd95ee8fc1fbcdbb602efbe/lwjgl-platform-2.9.1-natives-windows.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.lwjgl.lwjgl/lwjgl-platform/2.9.1/aa9aae879af8eb378e22cfc64db56ec2ca9a44d1/lwjgl-platform-2.9.1-natives-linux.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/modules-2/files-2.1/org.lwjgl.lwjgl/lwjgl-platform/2.9.1/2d12c83fdfbc04ecabf02c7bc8cc54d034f0daac/lwjgl-platform-2.9.1-natives-osx.jar"/>
- <classpathentry exported="true" kind="lib" path="C:/Users/Onyx/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.10-10.13.3.1428-1.7.10/start"/>
- <classpathentry combineaccessrules="false" kind="src" path="/Minecraft"/>
- <classpathentry kind="lib" path="libs/EquivalentExchange3-1.7.10-0.3.505.jar"/>
- <classpathentry kind="lib" path="libs/Waila-1.5.10_1.7.10.jar"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src/main/java"> + <attributes> + <attribute name="FROM_GRADLE_MODEL" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="src" path="src/main/resources"> + <attributes> + <attribute name="FROM_GRADLE_MODEL" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/> + <classpathentry kind="lib" path="/Users/bjculkin/Desktop/passthrough/Jewlerycraft/NotEnoughItems-1.7.10-1.0.5.120-dev.jar"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/.gitignore b/.gitignore index 454c40e..717f97b 100644..100755 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,6 @@ ModelCreator/* bin/* eclipse/* libs/* -gradle.properties
\ No newline at end of file +gradle.properties +/.gradle/ +/build/ @@ -1,24 +1,23 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>Jewelrycraft</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
- <linkedResources>
- <link>
- <name>.link0</name>
- <type>2</type>
- <location>C:/Users/Onyx/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.10-10.13.3.1428-1.7.10/start</location>
- </link>
- </linkedResources>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>Jewlerycraft</name> + <comment>Project Jewelrycraft created by Buildship.</comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.buildship.core.gradleprojectbuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.buildship.core.gradleprojectnature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/NotEnoughItems-1.7.10-1.0.5.120-dev.jar b/NotEnoughItems-1.7.10-1.0.5.120-dev.jar Binary files differnew file mode 100644 index 0000000..0bb0483 --- /dev/null +++ b/NotEnoughItems-1.7.10-1.0.5.120-dev.jar diff --git a/README.md b/README.md index aa1951a..aa1951a 100644..100755 --- a/README.md +++ b/README.md diff --git a/build.gradle b/build.gradle index 087188c..12682ac 100644..100755 --- a/build.gradle +++ b/build.gradle @@ -16,12 +16,11 @@ buildscript { }
apply plugin: 'forge'
-apply plugin: 'curseforge'
project.ext {
massive = "1"
- major = "1" - minor = "4" + major = "1"
+ minor = "5"
mcVersion = "1.7.10"
ee3Version = "0.3.505"
alpacaVersion = "1.2"
@@ -91,28 +90,6 @@ processResources{ }
}
-task ensureCurseAPI {
- if (!project.hasProperty("curseForgeApiKey")){
- project.ext.curseForgeApiKey = null
- }
-}
-
-curse.dependsOn ensureCurseAPI
-
-curse {
- apiKey = project.curseForgeApiKey
- projectId = "229927" // my project url is http://minecraft.curseforge.com/mc-mods/229927-jewelrycraft-2
- changelog = new File('changelog.txt').text
- releaseType = "release"
- displayName = "Jewelrycraft 2 v$project.version"
-
- // the default obfuscated jar is uploaded by default
- // artifact = project.file("build/libs/to/upload.jar")
-
- // allows you to add extra compatible MC versions. The one specified in the minecraft{} block is used by default.
- // addGameversion "1.7.0", "1.7.4"
-}
-
sourceSets {
main {
output.resourcesDir = output.classesDir
diff --git a/changelog.txt b/changelog.txt index 24e2b55..24e2b55 100644..100755 --- a/changelog.txt +++ b/changelog.txt diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar Binary files differindex b761216..b761216 100644..100755 --- a/gradle/wrapper/gradle-wrapper.jar +++ b/gradle/wrapper/gradle-wrapper.jar diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 678d9d8..678d9d8 100644..100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties diff --git a/gradlew.bat b/gradlew.bat index 8a0b282..8a0b282 100644..100755 --- a/gradlew.bat +++ b/gradlew.bat diff --git a/minecraft/assets/config/CodeChickenCore.cfg b/minecraft/assets/config/CodeChickenCore.cfg new file mode 100755 index 0000000..98426c4 --- /dev/null +++ b/minecraft/assets/config/CodeChickenCore.cfg @@ -0,0 +1,3 @@ +#CodeChickenCore configuration file. + +#set to true to completely deobfuscate mcp names diff --git a/minecraft/assets/config/CodeChickenLib.cfg b/minecraft/assets/config/CodeChickenLib.cfg new file mode 100755 index 0000000..2ae9b87 --- /dev/null +++ b/minecraft/assets/config/CodeChickenLib.cfg @@ -0,0 +1,3 @@ +#CodeChickenLib development configuration file. + +#Path to directory holding packaged.srg, fields.csv and methods.csv for mcp remapping diff --git a/minecraft/assets/logs/latest.log b/minecraft/assets/logs/latest.log new file mode 100755 index 0000000..878a427 --- /dev/null +++ b/minecraft/assets/logs/latest.log @@ -0,0 +1,45 @@ +[22:26:05] [main/INFO]: Extra: [] +[22:26:05] [main/INFO]: Found and added coremod: codechicken.nei.asm.NEICorePlugin +[22:26:05] [main/INFO]: Found and added coremod: codechicken.core.launch.CodeChickenCorePlugin +[22:26:05] [main/INFO]: Running with arguments: [--userProperties, {}, --assetsDir, /Users/ben/.gradle/caches/minecraft/assets, --assetIndex, 1.7.10, --accessToken, {REDACTED}, --version, 1.7.10, --tweakClass, cpw.mods.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker] +[22:26:05] [main/INFO]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker +[22:26:05] [main/INFO]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker +[22:26:05] [main/INFO]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker +[22:26:05] [main/INFO]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker +[22:26:05] [main/INFO]: Forge Mod Loader version 7.99.9.1428 for Minecraft 1.7.10 loading +[22:26:05] [main/INFO]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_05, running on Mac OS X:x86_64:10.12, installed at /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre +[22:26:05] [main/INFO]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation +[22:26:05] [main/INFO]: Found a command line coremod : codechicken.nei.asm.NEICorePlugin +[22:26:05] [main/WARN]: The coremod codechicken.nei.asm.NEICorePlugin does not have a MCVersion annotation, it may cause issues with this version of Minecraft +[22:26:05] [main/INFO]: Found a command line coremod : codechicken.core.launch.CodeChickenCorePlugin +[22:26:05] [main/WARN]: The coremod codechicken.core.launch.CodeChickenCorePlugin does not have a MCVersion annotation, it may cause issues with this version of Minecraft +[22:26:05] [main/INFO]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker +[22:26:05] [main/INFO]: Injecting location in coremod cpw.mods.fml.relauncher.FMLCorePlugin +[22:26:05] [main/INFO]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin +[22:26:05] [main/INFO]: Injecting location in coremod codechicken.core.asm.MCPDeobfuscationTransformer.LoadPlugin +[22:26:05] [main/INFO]: Injecting location in coremod codechicken.nei.asm.NEICorePlugin +[22:26:05] [main/INFO]: Injecting location in coremod codechicken.core.launch.CodeChickenCorePlugin +[22:26:05] [main/INFO]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker +[22:26:05] [main/INFO]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker +[22:26:05] [main/INFO]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker +[22:26:05] [main/INFO]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker +[22:26:05] [main/INFO]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker +[22:26:05] [main/INFO]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper +[22:26:05] [main/ERROR]: The binary patch set is missing. Either you are in a development environment, or things are not going to work! +[22:26:06] [main/ERROR]: FML appears to be missing any signature data. This is not a good thing +[22:26:06] [main/INFO]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper +[22:26:06] [main/INFO]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper +[22:26:27] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]: java.lang.ExceptionInInitializerError +[22:26:27] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]: at codechicken.core.asm.MCPDeobfuscationTransformer.load(MCPDeobfuscationTransformer.java:118) +[22:26:27] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]: at codechicken.core.asm.MCPDeobfuscationTransformer$LoadPlugin.injectData(MCPDeobfuscationTransformer.java:57) +[22:26:27] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]: at cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper.injectIntoClassLoader(CoreModManager.java:112) +[22:26:27] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.launchwrapper.Launch.launch(Launch.java:115) +[22:26:27] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.launchwrapper.Launch.main(Launch.java:28) +[22:26:27] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) +[22:26:27] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]: at GradleStart.main(Unknown Source) +[22:26:27] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]: Caused by: java.lang.RuntimeException: Failed to select mappings directory, set it manually in the config +[22:26:27] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]: at codechicken.lib.asm.ObfMapping$MCPRemapper.getConfFiles(ObfMapping.java:107) +[22:26:27] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]: at codechicken.lib.asm.ObfMapping$MCPRemapper.<init>(ObfMapping.java:162) +[22:26:27] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]: at codechicken.lib.asm.ObfMapping.loadMCPRemapper(ObfMapping.java:205) +[22:26:27] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]: at codechicken.lib.asm.ObfMapping.<clinit>(ObfMapping.java:217) +[22:26:27] [main/INFO]: [java.lang.Throwable$WrappedPrintStream:println:748]: ... 7 more diff --git a/src/.classpath b/src/.classpath index ea2f0aa..ea2f0aa 100644..100755 --- a/src/.classpath +++ b/src/.classpath diff --git a/src/.gitignore b/src/.gitignore index ae3c172..ae3c172 100644..100755 --- a/src/.gitignore +++ b/src/.gitignore diff --git a/src/.project b/src/.project index 954353a..954353a 100644..100755 --- a/src/.project +++ b/src/.project diff --git a/src/.settings/org.eclipse.core.resources.prefs b/src/.settings/org.eclipse.core.resources.prefs index cd3347e..cd3347e 100644..100755 --- a/src/.settings/org.eclipse.core.resources.prefs +++ b/src/.settings/org.eclipse.core.resources.prefs diff --git a/src/main/java/com/pau101/util/BezierUtils.java b/src/main/java/com/pau101/util/BezierUtils.java index eb52917..bdaca5c 100644..100755 --- a/src/main/java/com/pau101/util/BezierUtils.java +++ b/src/main/java/com/pau101/util/BezierUtils.java @@ -3,96 +3,104 @@ package com.pau101.util; /** * @author Paul Fulham (pau101) */ -public final class BezierUtils -{ - private BezierUtils() - {} - - /** - * Compute the value of all nth degree Bernstein polynomials. - * - * @param curveDegree : degree of curve - * @param t : curve parameter on interval [0,1] - * @param scalars : curveDegree + 1 Bernstein values. - */ - public static void allBernstein(int curveDegree, float t, float scalars[]) - { - int j, k; - float nt = 1 - t; - float saved; - scalars[0] = 1; - for(j = 1; j <= curveDegree; j++){ - saved = 0; - for(k = 0; k < j; k++){ - float temp = scalars[k]; - scalars[k] = saved + nt * temp; - saved = t * temp; - } - scalars[j] = saved; - } - } - - /** - * Compute point of nth degree Bezier curve. - * - * @param controlPoints : curveDegree + 1 control points - * @param curveDegree : degree of curve - * @param t : curve parameter on interval [0,1] - * @param point : resulting point - */ - public static void pointOnBezierCurve(float controlPoints[][], int curveDegree, float t, float point[]) - { - float scalars[] = new float[curveDegree + 1]; - int k; - allBernstein(curveDegree, t, scalars); - point[0] = point[1] = point[2] = 0; - for(k = 0; k <= curveDegree; k++){ - point[0] += scalars[k] * controlPoints[k][0]; - point[1] += scalars[k] * controlPoints[k][1]; - point[2] += scalars[k] * controlPoints[k][2]; - } - } - - /** - * Compute an approximate length of a Bezier curve given the control points. - * - * @param controlPoints : control points of a Bezier curve - * @return the approximate length - */ - public static float approximateLength(float controlPoints[][]) - { - float length = 0; - for(int i = 0; i < controlPoints.length - 1; i++){ - float xDif = controlPoints[i + 1][0] - controlPoints[i][0]; - float yDif = controlPoints[i + 1][1] - controlPoints[i][1]; - float zDif = controlPoints[i + 1][2] - controlPoints[i][2]; - length += Math.sqrt(xDif * xDif + yDif * yDif + zDif * zDif); - } - return length; - } - - public static int tesselationSegementsForLength(float length, float scale) - { - float noLessThan = 10 * scale; - float segs = length * scale / 30F; - return (int)Math.ceil(Math.sqrt(segs * segs * 0.6 + noLessThan * noLessThan)); - } - - public static float[][] curve(float controlPoints[][]) - { - return curve(controlPoints, 1); - } - - public static float[][] curve(float controlPoints[][], float scale) - { - int count = tesselationSegementsForLength(approximateLength(controlPoints), scale); - float[][] points = new float[count][3]; - for(int i = 0; i < count; i++){ - float t = i / (float)(count - 1); - float[] point = new float[3]; - pointOnBezierCurve(controlPoints, controlPoints.length - 1, t, point); - points[i] = point; - } - return points; - } +public final class BezierUtils { + private BezierUtils() { + } + + /** + * Compute the value of all nth degree Bernstein polynomials. + * + * @param curveDegree + * : degree of curve + * @param t + * : curve parameter on interval [0,1] + * @param scalars + * : curveDegree + 1 Bernstein values. + */ + public static void allBernstein(int curveDegree, float t, + float scalars[]) { + int j, k; + float nt = 1 - t; + float saved; + scalars[0] = 1; + for (j = 1; j <= curveDegree; j++) { + saved = 0; + for (k = 0; k < j; k++) { + float temp = scalars[k]; + scalars[k] = saved + nt * temp; + saved = t * temp; + } + scalars[j] = saved; + } + } + + /** + * Compute point of nth degree Bezier curve. + * + * @param controlPoints + * : curveDegree + 1 control points + * @param curveDegree + * : degree of curve + * @param t + * : curve parameter on interval [0,1] + * @param point + * : resulting point + */ + public static void pointOnBezierCurve(float controlPoints[][], + int curveDegree, float t, float point[]) { + float scalars[] = new float[curveDegree + 1]; + int k; + allBernstein(curveDegree, t, scalars); + point[0] = point[1] = point[2] = 0; + for (k = 0; k <= curveDegree; k++) { + point[0] += scalars[k] * controlPoints[k][0]; + point[1] += scalars[k] * controlPoints[k][1]; + point[2] += scalars[k] * controlPoints[k][2]; + } + } + + /** + * Compute an approximate length of a Bezier curve given the control + * points. + * + * @param controlPoints + * : control points of a Bezier curve + * @return the approximate length + */ + public static float approximateLength(float controlPoints[][]) { + float length = 0; + for (int i = 0; i < controlPoints.length - 1; i++) { + float xDif = controlPoints[i + 1][0] - controlPoints[i][0]; + float yDif = controlPoints[i + 1][1] - controlPoints[i][1]; + float zDif = controlPoints[i + 1][2] - controlPoints[i][2]; + length += Math.sqrt(xDif * xDif + yDif * yDif + zDif * zDif); + } + return length; + } + + public static int tesselationSegementsForLength(float length, + float scale) { + float noLessThan = 10 * scale; + float segs = length * scale / 30F; + return (int) Math.ceil( + Math.sqrt(segs * segs * 0.6 + noLessThan * noLessThan)); + } + + public static float[][] curve(float controlPoints[][]) { + return curve(controlPoints, 1); + } + + public static float[][] curve(float controlPoints[][], float scale) { + int count = tesselationSegementsForLength( + approximateLength(controlPoints), scale); + float[][] points = new float[count][3]; + for (int i = 0; i < count; i++) { + float t = i / (float) (count - 1); + float[] point = new float[3]; + pointOnBezierCurve(controlPoints, controlPoints.length - 1, t, + point); + points[i] = point; + } + return points; + } }
\ No newline at end of file diff --git a/src/main/java/com/pau101/util/CubicBezier.java b/src/main/java/com/pau101/util/CubicBezier.java index aab2a98..7071994 100644..100755 --- a/src/main/java/com/pau101/util/CubicBezier.java +++ b/src/main/java/com/pau101/util/CubicBezier.java @@ -3,26 +3,23 @@ package com.pau101.util; /** * @author Paul Fulham (pau101) */ -public class CubicBezier -{ - private float[][] controlPoints; - - public CubicBezier(float a1, float b1, float a2, float b2) - { - controlPoints = new float[4][]; - controlPoints[0] = new float[]{0, 0}; - controlPoints[1] = new float[]{a1, b1}; - controlPoints[2] = new float[]{a2, b2}; - controlPoints[3] = new float[]{1, 1}; - } - - public float eval(float t) - { - float[] scalars = new float[4]; - BezierUtils.allBernstein(3, t, scalars); - float p = 0; - for(int i = 0; i < 4; i++) - p += scalars[i] * controlPoints[i][1]; - return p; - } +public class CubicBezier { + private float[][] controlPoints; + + public CubicBezier(float a1, float b1, float a2, float b2) { + controlPoints = new float[4][]; + controlPoints[0] = new float[] { 0, 0 }; + controlPoints[1] = new float[] { a1, b1 }; + controlPoints[2] = new float[] { a2, b2 }; + controlPoints[3] = new float[] { 1, 1 }; + } + + public float eval(float t) { + float[] scalars = new float[4]; + BezierUtils.allBernstein(3, t, scalars); + float p = 0; + for (int i = 0; i < 4; i++) + p += scalars[i] * controlPoints[i][1]; + return p; + } }
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/CreativeTabLiquids.java b/src/main/java/darkknight/jewelrycraft/CreativeTabLiquids.java index 45529cc..eadeb4a 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/CreativeTabLiquids.java +++ b/src/main/java/darkknight/jewelrycraft/CreativeTabLiquids.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft;
import java.util.List;
+
import darkknight.jewelrycraft.item.ItemList;
import darkknight.jewelrycraft.util.JewelrycraftUtil;
import net.minecraft.creativetab.CreativeTabs;
@@ -9,39 +10,38 @@ import net.minecraft.item.Item; /**
* The Class CreativeTabLiquids.
*/
-public class CreativeTabLiquids extends CreativeTabs
-{
- /**
- * Instantiates a new creative tab liquids.
- *
- * @param name the name
- */
- public CreativeTabLiquids(String name)
- {
- super(name);
- }
-
- public boolean hasSearchBar() {
-
- return true;
- }
-
- /**
- * @return the Item for the icon
- */
- @Override
- public Item getTabIconItem()
- {
- return ItemList.bucket;
- }
-
- /**
- * @param par1List List of items to display
- */
- @Override
- public void displayAllReleventItems(List list)
- {
- for(int i = 0; i < JewelrycraftUtil.objects.size(); i++)
- list.add(ItemList.bucket.getModifiedItemStack(JewelrycraftUtil.objects.get(i)));
- }
+public class CreativeTabLiquids extends CreativeTabs {
+ /**
+ * Instantiates a new creative tab liquids.
+ *
+ * @param name
+ * the name
+ */
+ public CreativeTabLiquids(String name) {
+ super(name);
+ }
+
+ @Override
+ public boolean hasSearchBar() {
+ return true;
+ }
+
+ /**
+ * @return the Item for the icon
+ */
+ @Override
+ public Item getTabIconItem() {
+ return ItemList.bucket;
+ }
+
+ /**
+ * @param list
+ * List of items to display
+ */
+ @Override
+ public void displayAllReleventItems(List list) {
+ for (int i = 0; i < JewelrycraftUtil.objects.size(); i++)
+ list.add(ItemList.bucket.getModifiedItemStack(
+ JewelrycraftUtil.objects.get(i)));
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java b/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java index 653918d..574d163 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java +++ b/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java @@ -1,14 +1,15 @@ /*
- * Mod made by DarkKnight during the Modjam 3
- * It's an awesome mod
- * I love me! :D
+ * Mod made by DarkKnight during the Modjam 3 It's an awesome mod I love
+ * me! :D
*/
package darkknight.jewelrycraft;
import java.io.File;
import java.io.IOException;
+
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Logger;
+
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
@@ -18,6 +19,7 @@ import cpw.mods.fml.common.event.FMLInterModComms; import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import darkknight.jewelrycraft.achievements.AchievementsList;
import darkknight.jewelrycraft.block.BlockList;
@@ -32,106 +34,151 @@ import darkknight.jewelrycraft.potions.PotionList; import darkknight.jewelrycraft.proxy.CommonProxy;
import darkknight.jewelrycraft.recipes.CraftingRecipes;
import darkknight.jewelrycraft.thirdparty.ThirdPartyManager;
+import darkknight.jewelrycraft.util.JewelrycraftUtil;
import darkknight.jewelrycraft.util.Variables;
import darkknight.jewelrycraft.worldGen.ChestGeneration;
import darkknight.jewelrycraft.worldGen.village.VillageHandler;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.crafting.FurnaceRecipes;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent;
+
+@Mod(modid = Variables.MODID, name = Variables.MODNAME,
+ version = Variables.VERSION, guiFactory = Variables.CONFIG_GUI,
+ acceptedMinecraftVersions = "[1.7.10,1.8)")
+public class JewelrycraftMod {
+ private static final class CreativeTabJewleryCraft
+ extends CreativeTabs {
+ private CreativeTabJewleryCraft(String lable) {
+ super(lable);
+ }
+
+ @Override
+ public Item getTabIconItem() {
+ return Item.getItemFromBlock(BlockList.jewelCraftingTable);
+ }
+ }
+
+ @Instance(Variables.MODID)
+ public static JewelrycraftMod instance;
+
+ @SidedProxy(clientSide = Variables.CLIENT_PROXY,
+ serverSide = Variables.SERVER_PROXY)
+ public static CommonProxy proxy;
+
+ public static Logger logger;
+
+ public static File dir;
+
+ public static CreativeTabs jewelrycraft =
+ new CreativeTabJewleryCraft(Variables.MODID);
+ public static CreativeTabs liquids =
+ new CreativeTabLiquids("Liquids")
+ .setBackgroundImageName("item_search.png");
+
+ public static SimpleNetworkWrapper netWrapper;
+
+ public static boolean fancyRender = false;
+
+ /**
+ * Pre initialization of mod stuff.
+ *
+ * @param e
+ * FMLPreInitializationEvent
+ * @throws IOException
+ * Signals that an I/O exception has occurred.
+ */
+ @EventHandler
+ public void preInit(FMLPreInitializationEvent e) throws IOException {
+ dir = e.getModConfigurationDirectory();
+ logger = e.getModLog();
+ ConfigHandler.INSTANCE.loadConfig(e);
+ ThirdPartyManager.instance().index();
+ logger.log(Level.INFO, "Registering Blocks");
+ BlockList.preInit(e);
+ logger.log(Level.INFO, "Registering Items");
+ ItemList.preInit(e);
+ logger.log(Level.INFO, "Registering Crafting Recipes");
+ CraftingRecipes.preInit(e);
+ logger.log(Level.INFO, "Registering Curses");
+ CurseList.preInit(e);
+ logger.log(Level.INFO, "Registering Packets");
+ PacketHandler.preInit(e);
+ logger.log(Level.INFO, "Registering Entities");
+ EntityList.preInit(e);
+ logger.log(Level.INFO, "Registering Village Stuff");
+ VillageHandler.preInit(e);
+ logger.log(Level.INFO, "Registering Events");
+ EventList.preInit(e);
+ logger.log(Level.INFO, "Registering Potions");
+ PotionList.preInit(e);
+ logger.log(Level.INFO, "Loading Third Party Mods");
+ ThirdPartyManager.instance().preInit();
+ logger.log(Level.INFO, "Adding Dungeons loot");
+ ChestGeneration.preInit(e);
+
+ MinecraftForge.EVENT_BUS.register(this);
+ }
+
+ @EventHandler
+ public void init(FMLInitializationEvent e) {
+ logger.log(Level.INFO, "Registering Events");
+ EventList.init(e);
+ logger.log(Level.INFO, "Registering Potions");
+ PotionList.init(e);
+ logger.log(Level.INFO, "Loading Third Party Mods");
+ ThirdPartyManager.instance().init();
+ FMLInterModComms.sendMessage("Waila", "register",
+ "darkknight.jewelrycraft.thirdparty.WailaHandler.registration");
+ }
+
+ @EventHandler
+ public void postInit(FMLPostInitializationEvent e) {
+ logger.log(Level.INFO, "Loading Third Party Mods");
+ ThirdPartyManager.instance().postInit();
+ logger.log(Level.INFO, "Registering Events");
+ EventList.postInit(e);
+ logger.log(Level.INFO, "Registering Potions");
+ PotionList.postInit(e);
+ logger.log(Level.INFO, "Registering Achievements");
+ AchievementsList.addAchievements();
+ }
+
+ @EventHandler
+ public void serverLoad(FMLServerStartingEvent event) {
+ event.registerServerCommand(new JewelrycraftCommands());
+ }
-@Mod (modid = Variables.MODID, name = Variables.MODNAME, version = Variables.VERSION, guiFactory = Variables.CONFIG_GUI, acceptedMinecraftVersions = "[1.7.10,1.8)")
-public class JewelrycraftMod
-{
- @Instance (Variables.MODID)
- public static JewelrycraftMod instance;
- @SidedProxy (clientSide = Variables.CLIENT_PROXY, serverSide = Variables.SERVER_PROXY)
- public static CommonProxy proxy;
- public static Logger logger;
- public static File dir;
- public static CreativeTabs jewelrycraft = new CreativeTabs(Variables.MODID){
- @Override
- public Item getTabIconItem()
- {
- return Item.getItemFromBlock(BlockList.jewelCraftingTable);
- }
- };
- public static CreativeTabs liquids = new CreativeTabLiquids("Liquids").setBackgroundImageName("item_search.png");
- public static SimpleNetworkWrapper netWrapper;
- public static boolean fancyRender = false;
-
- /**
- * Pre initialization of mod stuff.
- *
- * @param e FMLPreInitializationEvent
- * @throws IOException Signals that an I/O exception has occurred.
- */
- @EventHandler
- public void preInit(FMLPreInitializationEvent e) throws IOException
- {
- dir = e.getModConfigurationDirectory();
- logger = e.getModLog();
- ConfigHandler.INSTANCE.loadConfig(e);
- ThirdPartyManager.instance().index();
- logger.log(Level.INFO, "Registering Blocks");
- BlockList.preInit(e);
- logger.log(Level.INFO, "Registering Items");
- ItemList.preInit(e);
- logger.log(Level.INFO, "Registering Crafting Recipes");
- CraftingRecipes.preInit(e);
- logger.log(Level.INFO, "Registering Curses");
- CurseList.preInit(e);
- logger.log(Level.INFO, "Registering Packets");
- PacketHandler.preInit(e);
- logger.log(Level.INFO, "Registering Entities");
- EntityList.preInit(e);
- logger.log(Level.INFO, "Registering Village Stuff");
- VillageHandler.preInit(e);
- logger.log(Level.INFO, "Registering Events");
- EventList.preInit(e);
- logger.log(Level.INFO, "Registering Potions");
- PotionList.preInit(e);
- logger.log(Level.INFO, "Loading Third Party Mods");
- ThirdPartyManager.instance().preInit();
- logger.log(Level.INFO, "Adding Dungeons loot");
- ChestGeneration.preInit(e);
- }
-
- @EventHandler
- public void init(FMLInitializationEvent e)
- {
- logger.log(Level.INFO, "Registering Events");
- EventList.init(e);
- logger.log(Level.INFO, "Registering Potions");
- PotionList.init(e);
- logger.log(Level.INFO, "Loading Third Party Mods");
- ThirdPartyManager.instance().init();
- FMLInterModComms.sendMessage("Waila", "register", "darkknight.jewelrycraft.thirdparty.WailaHandler.registration");
- }
-
- @EventHandler
- public void postInit(FMLPostInitializationEvent e)
- {
- logger.log(Level.INFO, "Loading Third Party Mods");
- ThirdPartyManager.instance().postInit();
- logger.log(Level.INFO, "Registering Events");
- EventList.postInit(e);
- logger.log(Level.INFO, "Registering Potions");
- PotionList.postInit(e);
- logger.log(Level.INFO, "Registering Achievements");
- AchievementsList.addAchievements();
- }
-
- @EventHandler
- public void serverLoad(FMLServerStartingEvent event)
- {
- event.registerServerCommand(new JewelrycraftCommands());
- }
-
- @EventHandler
- public void imcCallback(FMLInterModComms.IMCEvent event)
- {
- for (final FMLInterModComms.IMCMessage imcMessage : event.getMessages())
- {
- logger.info("The mod " + imcMessage.getSender() + " has sent the following message: " + imcMessage.getStringValue());
- }
- }
+ @EventHandler
+ public void imcCallback(FMLInterModComms.IMCEvent event) {
+ for (final FMLInterModComms.IMCMessage imcMessage : event
+ .getMessages()) {
+ logger.info("The mod " + imcMessage.getSender()
+ + " has sent the following message: "
+ + imcMessage.getStringValue());
+ }
+ }
+
+ @SubscribeEvent
+ public void oredictRegistered(OreRegisterEvent orev) {
+ if(orev.Name.startsWith("ingot") || orev.Name.startsWith("alloy")) {
+ if(!JewelrycraftUtil.metal.contains(orev.Ore)) {
+ JewelrycraftUtil.metal.add(orev.Ore);
+ }
+ }
+
+ if(orev.Name.startsWith("ore")) {
+ if(!JewelrycraftUtil.ores.contains(orev.Ore)) {
+ JewelrycraftUtil.metal.add(orev.Ore);
+ }
+
+ ItemStack ingot = FurnaceRecipes.smelting().getSmeltingResult(orev.Ore);
+
+ if(ingot != null) {
+ JewelrycraftUtil.oreToIngot.put(orev.Ore, ingot);
+ }
+ }
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/achievements/AchievementsList.java b/src/main/java/darkknight/jewelrycraft/achievements/AchievementsList.java index fc474e2..b62fe1d 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/achievements/AchievementsList.java +++ b/src/main/java/darkknight/jewelrycraft/achievements/AchievementsList.java @@ -5,21 +5,28 @@ import net.minecraft.init.Items; import net.minecraft.stats.Achievement;
import net.minecraftforge.common.AchievementPage;
-public class AchievementsList
-{
- public static AchievementPage jewelrycraft;
-
- //Achievements
- public static final Achievement openGuide = new Achievement("achievement.jewelrycraft.openGuide", "jewelrycraft.openGuide", 0, 0, ItemList.guide, (Achievement)null).initIndependentStat();
-
- //Challenges
- public static final Achievement pentagram = new Achievement("achievement.jewelrycraft.pentagram", "jewelrycraft.pentagram", -3, -2, Items.ender_eye, (Achievement)null).initIndependentStat().setSpecial();
-
- public static void addAchievements()
- {
- openGuide.registerStat();
- pentagram.registerStat();
- jewelrycraft = new AchievementPage("Jewelrycraft 2", openGuide, pentagram);
+public class AchievementsList {
+ public static AchievementPage jewelrycraft;
+
+ // Achievements
+ public static final Achievement openGuide =
+ new Achievement("achievement.jewelrycraft.openGuide",
+ "jewelrycraft.openGuide", 0, 0, ItemList.guide,
+ (Achievement) null).initIndependentStat();
+
+ // Challenges
+ public static final Achievement pentagram =
+ new Achievement("achievement.jewelrycraft.pentagram",
+ "jewelrycraft.pentagram", -3, -2, Items.ender_eye,
+ (Achievement) null).initIndependentStat().setSpecial();
+
+ public static void addAchievements() {
+ openGuide.registerStat();
+ pentagram.registerStat();
+
+ jewelrycraft = new AchievementPage("Jewelrycraft 2", openGuide,
+ pentagram);
+
AchievementPage.registerAchievementPage(jewelrycraft);
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/api/Curse.java b/src/main/java/darkknight/jewelrycraft/api/Curse.java index 9d08582..1cd0288 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/api/Curse.java +++ b/src/main/java/darkknight/jewelrycraft/api/Curse.java @@ -2,6 +2,7 @@ package darkknight.jewelrycraft.api; import java.util.ArrayList;
import java.util.Random;
+
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.Entity;
@@ -12,245 +13,359 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.RenderHandEvent;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
+import net.minecraftforge.event.entity.living.LivingDeathEvent;
+import net.minecraftforge.event.entity.living.LivingHealEvent;
+import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent;
import net.minecraftforge.event.world.BlockEvent;
-public abstract class Curse
-{
- protected int textureID, ticksActive;
- protected String name, description, texturePackName;
- protected Random rand = new Random();
- private static ArrayList<Curse> curses = new ArrayList<Curse>();
- public static ArrayList<Curse> availableCurses = new ArrayList<Curse>();
-
- /**
- * @param name The name of the curse
- * @param txtID The texture ID of it
- * @param texturepack The texturepack location
- */
- protected Curse(String name, int txtID, String texturepack)
- {
- this.name = name;
- this.texturePackName = texturepack;
- this.textureID = txtID;
- this.ticksActive = 0;
- curses.add(this);
- availableCurses.add(this);
- }
-
- /**
- * @return The name of the curse
- */
- public String getName()
- {
- return name;
- }
-
- public abstract String getDisplayName();
-
- /**
- * @return The description of the curse
- */
- public String getDescription()
- {
- return description;
- }
-
- /**
- * @param The description of the curse
- * @return The class
- */
- public Curse setDescription(String desc)
- {
- description = desc;
- return this;
- }
-
- /**
- * @return the texture pack ID
- */
- public String getTexturePack()
- {
- return texturePackName;
- }
-
- /**
- * @return The texture ID
- */
- public int getTextureID()
- {
- return textureID;
- }
-
- /**
- * This runs every tick
- * @param world The worldthe player is in
- * @param player The cursed player
- */
- public void action(World world, EntityPlayer player)
- {
- ticksActive++;
- }
-
- public int getTicksActive()
- {
+public abstract class Curse {
+ protected int textureID, ticksActive;
+ protected String name, description, texturePackName;
+ protected Random rand = new Random();
+ private static ArrayList<Curse> curses = new ArrayList<>();
+ public static ArrayList<Curse> availableCurses = new ArrayList<>();
+
+ /**
+ * @param name
+ * The name of the curse
+ * @param txtID
+ * The texture ID of it
+ * @param texturepack
+ * The texturepack location
+ */
+ protected Curse(String name, int txtID, String texturepack) {
+ this.name = name;
+ this.texturePackName = texturepack;
+ this.textureID = txtID;
+ this.ticksActive = 0;
+ curses.add(this);
+ availableCurses.add(this);
+ }
+
+ /**
+ * @return The name of the curse
+ */
+ public String getName() {
+ return name;
+ }
+
+ public abstract String getDisplayName();
+
+ /**
+ * @return The description of the curse
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @param desc
+ * description of the curse
+ * @return The class
+ */
+ public Curse setDescription(String desc) {
+ description = desc;
+ return this;
+ }
+
+ /**
+ * @return the texture pack ID
+ */
+ public String getTexturePack() {
+ return texturePackName;
+ }
+
+ /**
+ * @return The texture ID
+ */
+ public int getTextureID() {
+ return textureID;
+ }
+
+ /**
+ * This runs every tick
+ *
+ * @param world
+ * The worldthe player is in
+ * @param player
+ * The cursed player
+ */
+ public void action(World world, EntityPlayer player) {
+ ticksActive++;
+ }
+
+ public int getTicksActive() {
return ticksActive;
}
- public void setTicksActive(int ticksActive)
- {
+ public void setTicksActive(int ticksActive) {
this.ticksActive = ticksActive;
}
- /**
- * This runs when the player dies
- * @param world The world the player is in
- * @param player The cursed player
- */
- public void playerDeathAction(World world, EntityPlayer player)
- {}
-
- /**
- * This runs when an entity is killed (whether by a player or other causes)
- * @param world The world the player is in
- * @param target The entity that died
- * @param player The cursed player
- */
- public void entityDeathAction(World world, EntityLivingBase target, EntityPlayer player)
- {}
-
- /**
- * This runs when the player respawns
- * @param world The world the player is in
- * @param player The cursed player
- */
- public void respawnAction(World world, EntityPlayer player)
- {}
-
- /**
- * This runs when a player gets attacked by anything but another player
- * @param world The world the player is in
- * @param player The cursed player
- */
- public void attackedAction(World world, EntityPlayer player)
- {}
-
- /**
- * This runs when an entity is attacked by a player (this includes other players)
- * @param world The world the player is in
- * @param player The player that caused the damage
- * @param target The entity damaged
- */
- public void attackedByPlayerAction(LivingAttackEvent event, World world, EntityPlayer player, Entity target)
- {}
-
- /**
- * This runs when an entity is attacked by a player (this includes other players). This can cancel the damaging event.
- * @param world The world the player is in
- * @param player The player that caused the damage
- * @param target The entity damaged
- */
- public boolean attackedByPlayerActionCancelable(LivingAttackEvent event, World world, EntityPlayer player, Entity target)
- {
- return false;
- }
-
- /**
- * This runs when an item is dropped by an entity
- * @param player The cursed player
- * @param target The entity that drops the item
- * @param drops An array list containing the dropped items
- */
- public void entityDropItems(EntityPlayer player, Entity target, ArrayList<EntityItem> drops)
- {}
-
- /**
- * This is for rendering special things on the player in 3rd person (meaning you won't see this render);
- * This will also render in the inventory.
- * @param player The cursed player
- * @param event The event used for this
- */
- @SideOnly(Side.CLIENT)
- public void playerRender(EntityPlayer player, RenderPlayerEvent.Specials.Post event)
- {}
-
- /**
- * This is for rendering special things on the player in 1st and 3rd person, but not in the player inventory.
- * @param player The cursed player
- * @param event The event used for this
- */
- @SideOnly(Side.CLIENT)
- public void playerHandRender(EntityPlayer player, RenderHandEvent event)
- {}
-
- /**
- * This runs when a block drops an item (such as breaking a block and dropping itself, or breaking like a Diamond ore and dropping diamonds)
- * @param player The cursed player
- * @param event The BlockEvent that triggers this
- */
- public void onBlockItemsDrop(EntityPlayer player, BlockEvent.HarvestDropsEvent event)
- {}
-
- /**
- * This runs when a block is destroyed
- * @param player The cursed player
- * @param event The BlockEvent that runs this
- */
- public void onBlockDestroyed(EntityPlayer player, BlockEvent.BreakEvent event)
- {}
-
- /**
- * This determines if the player can toss an item or not (with Q)
- * @return True if the player can no longer toss items; False if he can. (by default false)
- */
- public boolean itemToss()
- {
- return false;
- }
-
- /**
- * This controls whether a curse can be activated or not (makes it easy to do things like disable certain curses if in hardcore)
- * @param world The world the player is in
- * @return True for curses to be used; False otherwise (by default true)
- */
- public boolean canCurseBeActivated(World world)
- {
- return canCurseBeActivated();
- }
- /**
- * This controls whether a curse can be activated or not (makes it easy to do things like disable certain curses if in hardcore)
- * @return True for curses to be used; False otherwise (by default true)
- */
- public boolean canCurseBeActivated()
- {
- return true;
- }
-
- /**
- * This is the list of all curses
- * @return The list of registered curses
- */
- public static ArrayList<Curse> getCurseList()
- {
- return curses;
- }
-
- /**
- * This is the weight of the curse when it chooses it. The lower the value, the less it gets chosen; the higher the value, the higher the chance of it getting picked.
- * @param world The world the player is currently in
- * @param player The cursed player
- * @param random A random class
- * @return The weight of the curse (by default 10)
- */
- public int weight(World world, EntityPlayer player, Random random)
- {
- return 10;
- }
-
- /*
- * This stat is used to determine the chance of certain actions happening
- */
- public int luck()
- {
- return 0;
- }
+ /**
+ * This runs when the player dies
+ *
+ * @param world
+ * The world the player is in
+ * @param player
+ * The cursed player
+ * @param event
+ * The thing that killed the player
+ */
+ public void playerDeathAction(World world, EntityPlayer player,
+ LivingDeathEvent event) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when the player is healed
+ *
+ * @param world
+ * The world the player is in
+ * @param player
+ * The cursed player
+ * @param event
+ * The event that the player is healing from
+ */
+ public void playerHealAction(World world, EntityPlayer player,
+ LivingHealEvent event) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when an entity is killed (whether by a player or other
+ * causes)
+ *
+ * @param world
+ * The world the player is in
+ * @param target
+ * The entity that died
+ * @param player
+ * The cursed player
+ */
+ public void entityDeathAction(World world, EntityLivingBase target,
+ EntityPlayer player) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when the player respawns
+ *
+ * @param world
+ * The world the player is in
+ * @param player
+ * The cursed player
+ */
+ public void respawnAction(World world, EntityPlayer player) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when a player gets attacked by anything but another player
+ *
+ * @param world
+ * The world the player is in
+ * @param player
+ * The cursed player
+ * @param event
+ * The event that attacked the player
+ * @param attacker
+ * The entity that attacked the player
+ */
+ public void attackedAction(World world, EntityPlayer player,
+ LivingAttackEvent event, Entity attacker) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when an entity is attacked by a player (this includes
+ * other players)
+ *
+ * @param event
+ *
+ * @param world
+ * The world the player is in
+ * @param player
+ * The player that caused the damage
+ * @param target
+ * The entity damaged
+ */
+ public void attackedByPlayerAction(LivingAttackEvent event,
+ World world, EntityPlayer player, Entity target) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when an entity is attacked by a player (this includes
+ * other players). This can cancel the damaging event.
+ *
+ * @param event
+ *
+ * @param world
+ * The world the player is in
+ * @param player
+ * The player that caused the damage
+ * @param target
+ * The entity damaged
+ * @return Whether or not to cancel the event
+ */
+ public boolean attackedByPlayerActionCancelable(
+ LivingAttackEvent event, World world, EntityPlayer player,
+ Entity target) {
+ return false;
+ }
+
+ /**
+ * This runs when an item is dropped by an entity
+ *
+ * @param player
+ * The cursed player
+ * @param target
+ * The entity that drops the item
+ * @param drops
+ * An array list containing the dropped items
+ */
+ public void entityDropItems(EntityPlayer player, Entity target,
+ ArrayList<EntityItem> drops) {
+ // Do nothing
+ }
+
+ /**
+ * This is for rendering special things on the player in 3rd person
+ * (meaning you won't see this render); This will also render in the
+ * inventory.
+ *
+ * @param player
+ * The cursed player
+ * @param event
+ * The event used for this
+ */
+ @SideOnly(Side.CLIENT)
+ public void playerRender(EntityPlayer player,
+ RenderPlayerEvent.Specials.Post event) {
+ // Do nothing
+ }
+
+ /**
+ * This is for rendering special things on the player in 1st and 3rd
+ * person, but not in the player inventory.
+ *
+ * @param player
+ * The cursed player
+ * @param event
+ * The event used for this
+ */
+ @SideOnly(Side.CLIENT)
+ public void playerHandRender(EntityPlayer player,
+ RenderHandEvent event) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when a block drops an item (such as breaking a block and
+ * dropping itself, or breaking like a Diamond ore and dropping
+ * diamonds)
+ *
+ * @param player
+ * The cursed player
+ * @param event
+ * The BlockEvent that triggers this
+ */
+ public void onBlockItemsDrop(EntityPlayer player,
+ BlockEvent.HarvestDropsEvent event) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when a block is destroyed
+ *
+ * @param player
+ * The cursed player
+ * @param event
+ * The BlockEvent that runs this
+ */
+ public void onBlockDestroyed(EntityPlayer player,
+ BlockEvent.BreakEvent event) {
+ // Do nothing
+ }
+
+ /**
+ * This determines if the player can toss an item or not (with Q)
+ *
+ * @return True if the player can no longer toss items; False if he
+ * can. (by default false)
+ */
+ public boolean itemToss() {
+ return false;
+ }
+
+ /**
+ * This controls whether a curse can be activated or not (makes it easy
+ * to do things like disable certain curses if in hardcore)
+ *
+ * @param world
+ * The world the player is in
+ * @return True for curses to be used; False otherwise (by default
+ * true)
+ */
+ public boolean canCurseBeActivated(World world) {
+ return canCurseBeActivated();
+ }
+
+ /**
+ * This controls whether a curse can be activated or not (makes it easy
+ * to do things like disable certain curses if in hardcore)
+ *
+ * @return True for curses to be used; False otherwise (by default
+ * true)
+ */
+ public boolean canCurseBeActivated() {
+ return true;
+ }
+
+ /**
+ * This is the list of all curses
+ *
+ * @return The list of registered curses
+ */
+ public static ArrayList<Curse> getCurseList() {
+ return curses;
+ }
+
+ /**
+ * This is the weight of the curse when it chooses it. The lower the
+ * value, the less it gets chosen; the higher the value, the higher the
+ * chance of it getting picked.
+ *
+ * @param world
+ * The world the player is currently in
+ * @param player
+ * The cursed player
+ * @param random
+ * A random class
+ * @return The weight of the curse (by default 10)
+ */
+ public int weight(World world, EntityPlayer player, Random random) {
+ return 10;
+ }
+
+ /*
+ * This stat is used to determine the chance of certain actions
+ * happening
+ */
+ public int luck() {
+ return 0;
+ }
+
+ /**
+ * This event is called whenever the player attempts to sleep.
+ *
+ * @param worldObj the world
+ * @param player the cursed player
+ * @param event the sleeping event
+ */
+ public void playerSleepAction(World worldObj, EntityPlayer player,
+ PlayerSleepInBedEvent event) {
+
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java b/src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java index 576f12b..c4a2c7a 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java +++ b/src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java @@ -13,63 +13,101 @@ import net.minecraftforge.event.entity.player.PlayerEvent; * @author Sorin
*
*/
-public interface IJewelryItem
-{
- /**
- * @return Returns the id of the type, 0 is for ring, 1 is for bracelet, 2 is for necklace and 3 is for earrings
- */
- public int type();
-
- /**
- * This is the action performed each player tick
- * @param item The item stack of the item (allows for fine item search, like metadata and nbt)
- * @param player The player wearing the jewelry
- */
- public void onWearAction(ItemStack item, EntityPlayer player);
-
- /**
- * This performs an action whenever a player gets attacked by an entity besides another Player
- * @param item The item stack of the item (allows for fine item search, like metadata and nbt)
- * @param player The player that was attacked
- * @param source Source of the damage
- * @param amount The amount of damage taken
- */
- public void onPlayerAttackedAction(ItemStack item, EntityPlayer player, DamageSource source, float amount);
-
- /**
- * This does an action whenever an Entity gets attacked by a player, this includes other Players
- * @param item The item stack of the item (allows for fine item search, like metadata and nbt)
- * @param player The attacking player
- * @param entity The target entity
- * @param amount The amount of damage dealt
- */
- public void onEntityAttackedByPlayer(ItemStack item, EntityPlayer player, EntityLivingBase entity, float amount);
-
- /**
- * This runs whenever a player dies
- * @param item The item stack of the item (allows for fine item search, like metadata and nbt)
- * @param player The player that died
- * @param source The damage source that caused the death
- */
- public void onPlayerDeadAction(ItemStack item, EntityPlayer player, DamageSource source);
-
- /**
- * Runs whenever a player respawns (switches dimensions or actually respawns)
- * @param item The item stack of the item (allows for fine item search, like metadata and nbt)
- * @param player The player that respawns
- * @param event The clone event that runs whenever a player respawns, either because he died or switched dimensions
- */
- public void onPlayerRespawnAction(ItemStack item, PlayerEvent.Clone event);
+public interface IJewelryItem {
+ /**
+ * @return Returns the id of the type, 0 is for ring, 1 is for
+ * bracelet, 2 is for necklace and 3 is for earrings
+ */
+ public int type();
- /**
- * This runs when the item is equipped
- * @param item The item stack of the item (allows for fine item search, like metadata and nbt)
- */
- public void onJewelryEquipped(ItemStack item);
+ /**
+ * This is the action performed each player tick
+ *
+ * @param item
+ * The item stack of the item (allows for fine item search,
+ * like metadata and nbt)
+ * @param player
+ * The player wearing the jewelry
+ */
+ public void onWearAction(ItemStack item, EntityPlayer player);
- /**
- * This runs when the item is unequipped
- * @param item The item stack of the item (allows for fine item search, like metadata and nbt)
- */
- public void onJewelryUnequipped(ItemStack item);
+ /**
+ * This performs an action whenever a player gets attacked by an entity
+ * besides another Player
+ *
+ * @param item
+ * The item stack of the item (allows for fine item search,
+ * like metadata and nbt)
+ * @param player
+ * The player that was attacked
+ * @param source
+ * Source of the damage
+ * @param amount
+ * The amount of damage taken
+ */
+ public void onPlayerAttackedAction(ItemStack item, EntityPlayer player,
+ DamageSource source, float amount);
+
+ /**
+ * This does an action whenever an Entity gets attacked by a player,
+ * this includes other Players
+ *
+ * @param item
+ * The item stack of the item (allows for fine item search,
+ * like metadata and nbt)
+ * @param player
+ * The attacking player
+ * @param entity
+ * The target entity
+ * @param amount
+ * The amount of damage dealt
+ */
+ public void onEntityAttackedByPlayer(ItemStack item,
+ EntityPlayer player, EntityLivingBase entity, float amount);
+
+ /**
+ * This runs whenever a player dies
+ *
+ * @param item
+ * The item stack of the item (allows for fine item search,
+ * like metadata and nbt)
+ * @param player
+ * The player that died
+ * @param source
+ * The damage source that caused the death
+ */
+ public void onPlayerDeadAction(ItemStack item, EntityPlayer player,
+ DamageSource source);
+
+ /**
+ * Runs whenever a player respawns (switches dimensions or actually
+ * respawns)
+ *
+ * @param item
+ * The item stack of the item (allows for fine item search,
+ * like metadata and nbt)
+ * @param event
+ * The clone event that runs whenever a player respawns,
+ * either because he died or switched dimensions
+ */
+ public void onPlayerRespawnAction(ItemStack item,
+ PlayerEvent.Clone event);
+
+ /**
+ * This runs when the item is equipped
+ *
+ * @param item
+ * The item stack of the item (allows for fine item search,
+ * like metadata and nbt)
+ */
+ public void onJewelryEquipped(ItemStack item);
+
+ /**
+ * This runs when the item is unequipped
+ *
+ * @param item
+ * The item stack of the item (allows for fine item search,
+ * like metadata and nbt)
+ */
+ public void onJewelryUnequipped(ItemStack item);
}
diff --git a/src/main/java/darkknight/jewelrycraft/api/ModifierEffects.java b/src/main/java/darkknight/jewelrycraft/api/ModifierEffects.java index 22e0ca8..05fee9d 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/api/ModifierEffects.java +++ b/src/main/java/darkknight/jewelrycraft/api/ModifierEffects.java @@ -2,6 +2,7 @@ package darkknight.jewelrycraft.api; import java.util.ArrayList;
import java.util.Random;
+
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@@ -9,137 +10,204 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource;
import net.minecraftforge.event.entity.player.PlayerEvent;
-public class ModifierEffects
-{
- protected ItemStack modifier;
- protected Random rand = new Random();
- protected static ArrayList<ModifierEffects> effects = new ArrayList<ModifierEffects>();
-
- /**
- * @param modifier The item to use as modifier
- */
- public ModifierEffects(ItemStack modifier)
- {
- this.modifier = modifier;
- effects.add(this);
- }
-
- /**
- * @return The list of all effects registered
- */
- public static ArrayList<ModifierEffects> getEffects()
- {
- return effects;
- }
-
- /**
- * @return The ItemStack set as the modifier
- */
- public ItemStack getModifier()
- {
- return modifier;
- }
-
- /**
- * This runs every tick
- *
- * @param item The ItemStack representing the jewelry that runs the effect
- * @param player The player wearing the jewelry wearing a jewelry with this modifier on it
- * @param jewelry The actual jewelry item (used by me to determine the type of jewelry so I don't have to call item.getItem() blah blah blah)
- */
- public void action(ItemStack item, EntityPlayer player, Item jewelry)
- {};
-
- /**
- * This runs when an entity is attacked. This event can be canceled.
- *
- * @param item The ItemStack representing the jewelry that runs the effect
- * @param player The player wearing the jewelry wearing a jewelry with this modifier on it
- * @param target The attacked entity
- * @param jewelry The actual jewelry item (aka item.getItem(), almost)
- * @param amount The amount of damage the entity took
- * @return The state of the event (true to cancel it, false to not)
- */
- public boolean onEntityAttackedCacellable(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount)
- {
- return false;
- }
-
- /**
- * This runs when a player gets damaged. This event can be canceled.
- *
- * @param item The ItemStack representing the jewelry that runs the effect
- * @param player The attacked player wearing a jewelry with this modifier on it
- * @param source The source of the damage
- * @param jewelry The actual jewelry item (aka item.getItem(), almost)
- * @param amount The amount of damage the player took
- * @return The state of the event (true to cancel it, false to not)
- */
- public boolean onPlayerAttackedCacellable(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
- {
- return false;
- }
-
- /**
- * This is the same as onEntityAttackedCacellable, but this can not be canceled. I recommend using this over onEntityAttackedCacellable, as it is more reliable.
- *
- * @param item The ItemStack representing the jewelry that runs the effect
- * @param player The player wearing the jewelry wearing a jewelry with this modifier on it
- * @param target The attacked entity
- * @param jewelry The actual jewelry item (aka item.getItem(), almost)
- * @param amount The amount of damage the entity took
- */
- public void onEntityAttacked(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount)
- {}
-
- /**
- * This is just like onPlayerAttackedCacellable, only that this can not be canceled. I recommend using this over onPlayerAttackedCacellable, as it is more reliable.
- *
- * @param item The ItemStack representing the jewelry that runs the effect
- * @param player The attacked player wearing a jewelry with this modifier on it
- * @param source The source of the damage
- * @param jewelry The actual jewelry item (aka item.getItem(), almost)
- * @param amount The amount of damage the player took
- */
- public void onPlayerAttacked(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
- {}
-
- /**
- * This runs when the player dies
- *
- * @param item The ItemStack representing the jewelry that runs the effect
- * @param player The player that died wearing a jewelry with this modifier on it
- * @param source The source of the killing blow
- * @param jewelry The actual jewelry item (aka item.getItem(), almost)
- */
- public void onPlayerDead(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry)
- {}
-
- /**
- * This runs when the player respawns
- *
- * @param item The ItemStack representing the jewelry that runs the effect
- * @param event The PlayerEvent that runs when the player respawns (this is also called when a player moves between dimensions)
- * @param jewelry The actual jewelry item (aka item.getItem(), almost)
- */
- public void onPlayerRespawn(ItemStack item, PlayerEvent.Clone event, Item jewelry)
- {}
-
- /**
- * This runs when the item containing this modifier is equipped
- *
- * @param item The ItemStack representing the jewelry that runs the effect
- * @param jewelry The actual jewelry item (aka item.getItem(), almost)
- */
- public void onJewelryEquipped(ItemStack item, Item jewelry)
- {}
-
- /**
- * This runs when the item containing this modifier is unquipped
- *
- * @param item The ItemStack representing the jewelry that runs the effect
- * @param jewelry The actual jewelry item (aka item.getItem(), almost)
- */
- public void onJewelryUnequipped(ItemStack item, Item jewelry)
- {}
+public class ModifierEffects {
+ protected ItemStack modifier;
+ protected Random rand = new Random();
+ protected static ArrayList<ModifierEffects> effects =
+ new ArrayList<>();
+
+ /**
+ * @param modifier
+ * The item to use as modifier
+ */
+ public ModifierEffects(ItemStack modifier) {
+ this.modifier = modifier;
+ effects.add(this);
+ }
+
+ /**
+ * @return The list of all effects registered
+ */
+ public static ArrayList<ModifierEffects> getEffects() {
+ return effects;
+ }
+
+ /**
+ * @return The ItemStack set as the modifier
+ */
+ public ItemStack getModifier() {
+ return modifier;
+ }
+
+ /**
+ * This runs every tick
+ *
+ * @param item
+ * The ItemStack representing the jewelry that runs the
+ * effect
+ * @param player
+ * The player wearing the jewelry wearing a jewelry with
+ * this modifier on it
+ * @param jewelry
+ * The actual jewelry item (used by me to determine the type
+ * of jewelry so I don't have to call item.getItem() blah
+ * blah blah)
+ */
+ public void action(ItemStack item, EntityPlayer player, Item jewelry) {
+ // Do nothing
+ };
+
+ /**
+ * This runs when an entity is attacked. This event can be canceled.
+ *
+ * @param item
+ * The ItemStack representing the jewelry that runs the
+ * effect
+ * @param player
+ * The player wearing the jewelry wearing a jewelry with
+ * this modifier on it
+ * @param target
+ * The attacked entity
+ * @param jewelry
+ * The actual jewelry item (aka item.getItem(), almost)
+ * @param amount
+ * The amount of damage the entity took
+ * @return The state of the event (true to cancel it, false to not)
+ */
+ public boolean onEntityAttackedCancellable(ItemStack item,
+ EntityPlayer player, Entity target, Item jewelry,
+ float amount) {
+ return false;
+ }
+
+ /**
+ * This runs when a player gets damaged. This event can be canceled.
+ *
+ * @param item
+ * The ItemStack representing the jewelry that runs the
+ * effect
+ * @param player
+ * The attacked player wearing a jewelry with this modifier
+ * on it
+ * @param source
+ * The source of the damage
+ * @param jewelry
+ * The actual jewelry item (aka item.getItem(), almost)
+ * @param amount
+ * The amount of damage the player took
+ * @return The state of the event (true to cancel it, false to not)
+ */
+ public boolean onPlayerAttackedCancellable(ItemStack item,
+ EntityPlayer player, DamageSource source, Item jewelry,
+ float amount) {
+ return false;
+ }
+
+ /**
+ * This is the same as onEntityAttackedCacellable, but this can not be
+ * canceled. I recommend using this over onEntityAttackedCacellable, as
+ * it is more reliable.
+ *
+ * @param item
+ * The ItemStack representing the jewelry that runs the
+ * effect
+ * @param player
+ * The player wearing the jewelry wearing a jewelry with
+ * this modifier on it
+ * @param target
+ * The attacked entity
+ * @param jewelry
+ * The actual jewelry item (aka item.getItem(), almost)
+ * @param amount
+ * The amount of damage the entity took
+ */
+ public void onEntityAttacked(ItemStack item, EntityPlayer player,
+ Entity target, Item jewelry, float amount) {
+ // Do nothing
+ }
+
+ /**
+ * This is just like onPlayerAttackedCacellable, only that this can not
+ * be canceled. I recommend using this over onPlayerAttackedCacellable,
+ * as it is more reliable.
+ *
+ * @param item
+ * The ItemStack representing the jewelry that runs the
+ * effect
+ * @param player
+ * The attacked player wearing a jewelry with this modifier
+ * on it
+ * @param source
+ * The source of the damage
+ * @param jewelry
+ * The actual jewelry item (aka item.getItem(), almost)
+ * @param amount
+ * The amount of damage the player took
+ */
+ public void onPlayerAttacked(ItemStack item, EntityPlayer player,
+ DamageSource source, Item jewelry, float amount) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when the player dies
+ *
+ * @param item
+ * The ItemStack representing the jewelry that runs the
+ * effect
+ * @param player
+ * The player that died wearing a jewelry with this modifier
+ * on it
+ * @param source
+ * The source of the killing blow
+ * @param jewelry
+ * The actual jewelry item (aka item.getItem(), almost)
+ */
+ public void onPlayerDead(ItemStack item, EntityPlayer player,
+ DamageSource source, Item jewelry) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when the player respawns
+ *
+ * @param item
+ * The ItemStack representing the jewelry that runs the
+ * effect
+ * @param event
+ * The PlayerEvent that runs when the player respawns (this
+ * is also called when a player moves between dimensions)
+ * @param jewelry
+ * The actual jewelry item (aka item.getItem(), almost)
+ */
+ public void onPlayerRespawn(ItemStack item, PlayerEvent.Clone event,
+ Item jewelry) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when the item containing this modifier is equipped
+ *
+ * @param item
+ * The ItemStack representing the jewelry that runs the
+ * effect
+ * @param jewelry
+ * The actual jewelry item (aka item.getItem(), almost)
+ */
+ public void onJewelryEquipped(ItemStack item, Item jewelry) {
+ // Do nothing
+ }
+
+ /**
+ * This runs when the item containing this modifier is unquipped
+ *
+ * @param item
+ * The ItemStack representing the jewelry that runs the
+ * effect
+ * @param jewelry
+ * The actual jewelry item (aka item.getItem(), almost)
+ */
+ public void onJewelryUnequipped(ItemStack item, Item jewelry) {
+ // Do nothing
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockCrystal.java b/src/main/java/darkknight/jewelrycraft/block/BlockCrystal.java index e987c27..3ecbcd6 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockCrystal.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockCrystal.java @@ -5,6 +5,7 @@ package darkknight.jewelrycraft.block; import java.util.List;
import java.util.Random;
+
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import darkknight.jewelrycraft.config.ConfigHandler;
@@ -24,82 +25,85 @@ import net.minecraft.world.World; * @author Sorin
*
*/
-public class BlockCrystal extends Block implements ITileEntityProvider
-{
- public static int[] colors = {1973019, 11743532, 3887386, 5320730, 2437522, 8073150, 2651799, 11250603, 4408131, 14188952, 4312372, 14602026, 6719955, 12801229, 15435844, 15790320};
-
- protected BlockCrystal()
- {
- super(Material.glass);
- setBlockBounds(0.2F, 0F, 0.2F, 0.8F, 1.0F, 0.8F);
- setHarvestLevel("pickaxe", 0);
- this.setTickRandomly(true);
- }
-
- @Override
- public TileEntity createNewTileEntity(World world, int var2)
- {
- return new TileEntityCrystal();
- }
-
- @Override
- public boolean renderAsNormalBlock()
- {
- return false;
- }
-
- @Override
- public boolean isOpaqueCube()
- {
- return false;
- }
-
- @SideOnly(Side.CLIENT)
- public int getRenderBlockPass()
- {
- return 1;
- }
-
- @SideOnly(Side.CLIENT)
- public void getSubBlocks(Item item, CreativeTabs tab, List list)
- {
- for(int i = 0; i < 16; ++i) list.add(new ItemStack(item, 1, i));
- }
-
- @Override
- public int getRenderType()
- {
- return BlockRenderIDs.CRYSTAL.id();
- }
-
- @Override
- @SideOnly (Side.CLIENT)
- public int colorMultiplier(IBlockAccess world, int i, int j, int k)
- {
- return colors[world.getBlockMetadata(i, j, k)];
- }
-
- public int damageDropped(int meta)
- {
- return meta;
- }
+public class BlockCrystal extends Block implements ITileEntityProvider {
+ public static int[] colors = { 1973019, 11743532, 3887386, 5320730,
+ 2437522, 8073150, 2651799, 11250603, 4408131, 14188952,
+ 4312372, 14602026, 6719955, 12801229, 15435844, 15790320 };
+
+ protected BlockCrystal() {
+ super(Material.glass);
+ setBlockBounds(0.2F, 0F, 0.2F, 0.8F, 1.0F, 0.8F);
+ setHarvestLevel("pickaxe", 0);
+ this.setTickRandomly(true);
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World world, int var2) {
+ return new TileEntityCrystal();
+ }
+
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public int getRenderBlockPass() {
+ return 1;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubBlocks(Item item, CreativeTabs tab, List list) {
+ for (int i = 0; i < 16; ++i)
+ list.add(new ItemStack(item, 1, i));
+ }
+
+ @Override
+ public int getRenderType() {
+ return BlockRenderIDs.CRYSTAL.id();
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public int colorMultiplier(IBlockAccess world, int i, int j, int k) {
+ return colors[world.getBlockMetadata(i, j, k)];
+ }
+
+ @Override
+ public int damageDropped(int meta) {
+ return meta;
+ }
+
+ @Override
+ public void breakBlock(World world, int x, int y, int z, Block block,
+ int meta) {
+ super.breakBlock(world, x, y, z, block, meta);
+ world.removeTileEntity(x, y, z);
+ }
- public void breakBlock(World world, int x, int y, int z, Block block, int meta)
- {
- super.breakBlock(world, x, y, z, block, meta);
- world.removeTileEntity(x, y, z);
- }
+ @Override
+ public boolean onBlockEventReceived(World world, int x, int y, int z,
+ int eventNo, int arg) {
+ super.onBlockEventReceived(world, x, y, z, eventNo, arg);
+ TileEntity tileentity = world.getTileEntity(x, y, z);
+ return tileentity != null
+ ? tileentity.receiveClientEvent(eventNo, arg) : false;
+ }
- public boolean onBlockEventReceived(World world, int x, int y, int z, int eventNo, int arg)
- {
- super.onBlockEventReceived(world, x, y, z, eventNo, arg);
- TileEntity tileentity = world.getTileEntity(x, y, z);
- return tileentity != null ? tileentity.receiveClientEvent(eventNo, arg) : false;
- }
-
- @SideOnly(Side.CLIENT)
- public void randomDisplayTick(World world, int x, int y, int z, Random rand)
- {
- if(ConfigHandler.CRYSTAL_PARTICLES) world.spawnParticle("instantSpell", x + rand.nextFloat(), y + rand.nextFloat(), z + rand.nextFloat(), 0.0D, -1.0D, 0.0D);
- }
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void randomDisplayTick(World world, int x, int y, int z,
+ Random rand) {
+ if (ConfigHandler.CRYSTAL_PARTICLES)
+ world.spawnParticle("instantSpell", x + rand.nextFloat(),
+ y + rand.nextFloat(), z + rand.nextFloat(), 0.0D,
+ -1.0D, 0.0D);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockDisplayer.java b/src/main/java/darkknight/jewelrycraft/block/BlockDisplayer.java index ba8884b..eff1f6d 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockDisplayer.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockDisplayer.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.block;
import java.util.Random;
+
import darkknight.jewelrycraft.tileentity.TileEntityDisplayer;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
@@ -16,229 +17,281 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-public class BlockDisplayer extends BlockContainer
-{
- Random rand = new Random();
-
- /**
- * @param par2Material
- */
- protected BlockDisplayer(Material par2Material)
- {
- super(par2Material);
- }
-
- /**
- * @param world
- * @param var2
- * @return
- */
- @Override
- public TileEntity createNewTileEntity(World world, int var2)
- {
- return new TileEntityDisplayer();
- }
-
- /**
- * @return
- */
- @Override
- public boolean renderAsNormalBlock()
- {
- return false;
- }
-
- /**
- * @param iblockaccess
- * @param i
- * @param j
- * @param k
- * @param l
- * @return
- */
- @Override
- public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
- {
- return false;
- }
-
- /**
- * @return
- */
- @Override
- public boolean isOpaqueCube()
- {
- return false;
- }
-
- /**
- * @return
- */
- @Override
- public int getRenderType()
- {
- return -1;
- }
-
- /**
- * @param world
- * @param i
- * @param j
- * @param k
- * @param entityPlayer
- * @param par6
- * @param par7
- * @param par8
- * @param par9
- * @return
- */
- @Override
- public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
- {
- TileEntityDisplayer te = (TileEntityDisplayer)world.getTileEntity(i, j, k);
- ItemStack item = entityPlayer.inventory.getCurrentItem();
- if (te != null){
- if (item != null && item != new ItemStack(Item.getItemById(0), 0, 0) && !world.isRemote){
- if (!te.hasObject){
- te.object = item.copy();
- te.quantity += item.stackSize;
- te.object.stackSize = 1;
- te.hasObject = true;
- if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize);
- te.isDirty = true;
- }else if (te.object.getItem() == item.getItem() && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && te.object.getItemDamage() == item.getItemDamage()) if (te.object.hasTagCompound() && item.hasTagCompound() && te.object.getTagCompound().equals(item.getTagCompound())){
- te.quantity += item.stackSize;
- if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize);
- te.isDirty = true;
- }else if (!te.object.hasTagCompound() && !item.hasTagCompound()){
- te.quantity += item.stackSize;
- if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize);
- te.isDirty = true;
- }
- }else if (item == null || item == new ItemStack(Item.getItemById(0), 0, 0)) if (!entityPlayer.capabilities.isCreativeMode) for(int inv = 0; inv < entityPlayer.inventory.getSizeInventory(); inv++){
- item = entityPlayer.inventory.getStackInSlot(inv);
- if (item != null && te.object.getItem() == item.getItem() && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && te.object.getItemDamage() == item.getItemDamage()) if (te.object.hasTagCompound() && item.hasTagCompound() && te.object.getTagCompound().equals(item.getTagCompound())){
- te.quantity += item.stackSize;
- if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(inv, item.stackSize);
- te.isDirty = true;
- te.markDirty();
- }else if (!te.object.hasTagCompound() && !item.hasTagCompound()){
- te.quantity += item.stackSize;
- if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(inv, item.stackSize);
- te.isDirty = true;
- }
- }
- else if (entityPlayer.capabilities.isCreativeMode && te.hasObject && te.object.getItem() != null){
- te.quantity += 64;
- te.isDirty = true;
- }
- te.isDirty = true;
- }
- return true;
- }
-
- /**
- * @param world
- * @param i
- * @param j
- * @param k
- * @param player
- */
- @Override
- public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
- {
- TileEntityDisplayer te = (TileEntityDisplayer)world.getTileEntity(i, j, k);
- if (te != null && !world.isRemote) if (te.hasObject && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && player.inventory.addItemStackToInventory(te.object)) if (!player.isSneaking()){
- if (te.quantity > te.object.getMaxStackSize()){
- te.object.stackSize = te.object.getMaxStackSize() - 1;
- player.inventory.addItemStackToInventory(te.object);
- te.object.stackSize = 1;
- te.quantity -= te.object.getMaxStackSize();
- te.isDirty = true;
- }else{
- te.object.stackSize = te.quantity - 1;
- player.inventory.addItemStackToInventory(te.object);
- te.hasObject = false;
- te.object = new ItemStack(Item.getItemById(0), 0, 0);
- te.quantity = 0;
- te.isDirty = true;
- }
- te.isDirty = true;
- }else{
- if (te.quantity >= 2){
- player.inventory.addItemStackToInventory(te.object);
- te.object.stackSize = 1;
- te.quantity--;
- te.isDirty = true;
- }else{
- player.inventory.addItemStackToInventory(te.object);
- te.object.stackSize = 1;
- te.hasObject = false;
- te.object = new ItemStack(Item.getItemById(0), 0, 0);
- te.quantity = 0;
- te.isDirty = true;
- }
- te.isDirty = true;
- }
- }
-
- /**
- * @param world
- * @param x
- * @param y
- * @param z
- * @param stack
- */
- public void dropItem(World world, double x, double y, double z, ItemStack stack)
- {
- EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.5D, z + 0.5D, stack);
- entityitem.motionX = 0;
- entityitem.motionZ = 0;
- entityitem.motionY = 0.11000000298023224D;
- world.spawnEntityInWorld(entityitem);
- }
-
- /**
- * @param world
- * @param i
- * @param j
- * @param k
- * @param block
- * @param par6
- */
- @Override
- public void breakBlock(World world, int i, int j, int k, Block block, int par6)
- {
- TileEntityDisplayer te = (TileEntityDisplayer)world.getTileEntity(i, j, k);
- if (te != null && te.hasObject){
- te.object.stackSize = te.quantity;
- dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.object);
- world.removeTileEntity(i, j, k);
- }
- super.breakBlock(world, i, j, k, block, par6);
- }
-
- /**
- * @param world
- * @param i
- * @param j
- * @param k
- * @param entityLiving
- * @param par6ItemStack
- */
- @Override
- public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
- {
- int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
- world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
- }
-
- /**
- * @param icon
- */
- @Override
- public void registerBlockIcons(IIconRegister icon)
- {
- blockIcon = icon.registerIcon("minecraft:emerald_block");
- }
+public class BlockDisplayer extends BlockContainer {
+ Random rand = new Random();
+
+ /**
+ * @param par2Material
+ */
+ protected BlockDisplayer(Material par2Material) {
+ super(par2Material);
+ }
+
+ /**
+ * @param world
+ * @param var2
+ * @return the tile entity
+ */
+ @Override
+ public TileEntity createNewTileEntity(World world, int var2) {
+ return new TileEntityDisplayer();
+ }
+
+ /**
+ * @return whether to render as a normal block
+ */
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ /**
+ * @param iblockaccess
+ * @param i
+ * @param j
+ * @param k
+ * @param l
+ * @return whether to render the specified side
+ */
+ @Override
+ public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i,
+ int j, int k, int l) {
+ return false;
+ }
+
+ /**
+ * @return whether to render as an opaque cube
+ */
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ /**
+ * @return the render type
+ */
+ @Override
+ public int getRenderType() {
+ return -1;
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityPlayer
+ * @param par6
+ * @param par7
+ * @param par8
+ * @param par9
+ * @return whether to activate the item on the block
+ */
+ @Override
+ public boolean onBlockActivated(World world, int i, int j, int k,
+ EntityPlayer entityPlayer, int par6, float par7, float par8,
+ float par9) {
+ TileEntityDisplayer te =
+ (TileEntityDisplayer) world.getTileEntity(i, j, k);
+ ItemStack item = entityPlayer.inventory.getCurrentItem();
+ if (te != null) {
+ if (item != null
+ && item != new ItemStack(Item.getItemById(0), 0, 0)
+ && !world.isRemote) {
+ if (!te.hasObject) {
+ te.object = item.copy();
+ te.quantity += item.stackSize;
+ te.object.stackSize = 1;
+ te.hasObject = true;
+ if (!entityPlayer.capabilities.isCreativeMode)
+ entityPlayer.inventory.decrStackSize(
+ entityPlayer.inventory.currentItem,
+ item.stackSize);
+ te.isDirty = true;
+ } else if (te.object.getItem() == item.getItem()
+ && te.object != null
+ && te.object != new ItemStack(Item.getItemById(0),
+ 0, 0)
+ && te.object.getItemDamage() == item
+ .getItemDamage())
+ if (te.object.hasTagCompound() && item.hasTagCompound()
+ && te.object.getTagCompound()
+ .equals(item.getTagCompound())) {
+ te.quantity += item.stackSize;
+ if (!entityPlayer.capabilities.isCreativeMode)
+ entityPlayer.inventory.decrStackSize(
+ entityPlayer.inventory.currentItem,
+ item.stackSize);
+ te.isDirty = true;
+ } else if (!te.object.hasTagCompound()
+ && !item.hasTagCompound()) {
+ te.quantity += item.stackSize;
+ if (!entityPlayer.capabilities.isCreativeMode)
+ entityPlayer.inventory.decrStackSize(
+ entityPlayer.inventory.currentItem,
+ item.stackSize);
+ te.isDirty = true;
+ }
+ } else if (item == null
+ || item == new ItemStack(Item.getItemById(0), 0, 0))
+ if (!entityPlayer.capabilities.isCreativeMode)
+ for (int inv = 0; inv < entityPlayer.inventory
+ .getSizeInventory(); inv++) {
+ item = entityPlayer.inventory.getStackInSlot(inv);
+ if (item != null
+ && te.object.getItem() == item.getItem()
+ && te.object != null
+ && te.object != new ItemStack(
+ Item.getItemById(0), 0, 0)
+ && te.object.getItemDamage() == item
+ .getItemDamage())
+ if (te.object.hasTagCompound()
+ && item.hasTagCompound()
+ && te.object.getTagCompound().equals(
+ item.getTagCompound())) {
+ te.quantity += item.stackSize;
+ if (!entityPlayer.capabilities.isCreativeMode)
+ entityPlayer.inventory.decrStackSize(
+ inv, item.stackSize);
+ te.isDirty = true;
+ te.markDirty();
+ } else if (!te.object.hasTagCompound()
+ && !item.hasTagCompound()) {
+ te.quantity += item.stackSize;
+ if (!entityPlayer.capabilities.isCreativeMode)
+ entityPlayer.inventory.decrStackSize(
+ inv, item.stackSize);
+ te.isDirty = true;
+ }
+ }
+ else if (entityPlayer.capabilities.isCreativeMode
+ && te.hasObject && te.object.getItem() != null) {
+ te.quantity += 64;
+ te.isDirty = true;
+ }
+ te.isDirty = true;
+ }
+ return true;
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param player
+ */
+ @Override
+ public void onBlockClicked(World world, int i, int j, int k,
+ EntityPlayer player) {
+ TileEntityDisplayer te =
+ (TileEntityDisplayer) world.getTileEntity(i, j, k);
+ if (te != null && !world.isRemote)
+ if (te.hasObject && te.object != null
+ && te.object != new ItemStack(Item.getItemById(0), 0,
+ 0)
+ && player.inventory.addItemStackToInventory(te.object))
+ if (!player.isSneaking()) {
+ if (te.quantity > te.object.getMaxStackSize()) {
+ te.object.stackSize =
+ te.object.getMaxStackSize() - 1;
+ player.inventory
+ .addItemStackToInventory(te.object);
+ te.object.stackSize = 1;
+ te.quantity -= te.object.getMaxStackSize();
+ te.isDirty = true;
+ } else {
+ te.object.stackSize = te.quantity - 1;
+ player.inventory
+ .addItemStackToInventory(te.object);
+ te.hasObject = false;
+ te.object =
+ new ItemStack(Item.getItemById(0), 0, 0);
+ te.quantity = 0;
+ te.isDirty = true;
+ }
+ te.isDirty = true;
+ } else {
+ if (te.quantity >= 2) {
+ player.inventory
+ .addItemStackToInventory(te.object);
+ te.object.stackSize = 1;
+ te.quantity--;
+ te.isDirty = true;
+ } else {
+ player.inventory
+ .addItemStackToInventory(te.object);
+ te.object.stackSize = 1;
+ te.hasObject = false;
+ te.object =
+ new ItemStack(Item.getItemById(0), 0, 0);
+ te.quantity = 0;
+ te.isDirty = true;
+ }
+ te.isDirty = true;
+ }
+ }
+
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param stack
+ */
+ public void dropItem(World world, double x, double y, double z,
+ ItemStack stack) {
+ EntityItem entityitem =
+ new EntityItem(world, x + 0.5D, y + 1.5D, z + 0.5D, stack);
+ entityitem.motionX = 0;
+ entityitem.motionZ = 0;
+ entityitem.motionY = 0.11000000298023224D;
+ world.spawnEntityInWorld(entityitem);
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param block
+ * @param par6
+ */
+ @Override
+ public void breakBlock(World world, int i, int j, int k, Block block,
+ int par6) {
+ TileEntityDisplayer te =
+ (TileEntityDisplayer) world.getTileEntity(i, j, k);
+ if (te != null && te.hasObject) {
+ te.object.stackSize = te.quantity;
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord,
+ te.object);
+ world.removeTileEntity(i, j, k);
+ }
+ super.breakBlock(world, i, j, k, block, par6);
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityLiving
+ * @param par6ItemStack
+ */
+ @Override
+ public void onBlockPlacedBy(World world, int i, int j, int k,
+ EntityLivingBase entityLiving, ItemStack par6ItemStack) {
+ int rotation = MathHelper.floor_double(
+ entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
+ world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
+ }
+
+ /**
+ * @param icon
+ */
+ @Override
+ public void registerBlockIcons(IIconRegister icon) {
+ blockIcon = icon.registerIcon("minecraft:emerald_block");
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockHandPedestal.java b/src/main/java/darkknight/jewelrycraft/block/BlockHandPedestal.java index 4059101..e4b8efc 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockHandPedestal.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockHandPedestal.java @@ -14,156 +14,159 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-public class BlockHandPedestal extends BlockContainer
-{
-
- /**
- * @param material
- */
- protected BlockHandPedestal(Material material)
- {
- super(material);
- setBlockBounds(0.2F, 0F, 0.2F, 0.8F, 1.0F, 0.8F);
- }
-
- /**
- * @param world
- * @param var2
- * @return
- */
- @Override
- public TileEntity createNewTileEntity(World world, int var2)
- {
- return new TileEntityHandPedestal();
- }
-
- /**
- * @return
- */
- @Override
- public boolean renderAsNormalBlock()
- {
- return false;
- }
-
- /**
- * @param iblockaccess
- * @param i
- * @param j
- * @param k
- * @param l
- * @return
- */
- @Override
- public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
- {
- return false;
- }
-
- /**
- * @return
- */
- @Override
- public boolean isOpaqueCube()
- {
- return false;
- }
-
- /**
- * @return
- */
- @Override
- public int getRenderType()
- {
- return -1;
- }
-
- /**
- * @param world
- * @param i
- * @param j
- * @param k
- * @param entityPlayer
- * @param par6
- * @param par7
- * @param par8
- * @param par9
- * @return
- */
- @Override
- public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
- {
- TileEntityHandPedestal te = (TileEntityHandPedestal)world.getTileEntity(i, j, k);
- ItemStack item = entityPlayer.inventory.getCurrentItem();
- if (te != null){
- if (!world.isRemote && te.getHeldItemStack() == null && item != null){
- te.setHeldItemStack(item.copy());
- if (!entityPlayer.capabilities.isCreativeMode) item.stackSize--;
- te.markDirty();
- }else if (entityPlayer.isSneaking()) if (entityPlayer.inventory.addItemStackToInventory(te.getHeldItemStack())){
- te.removeHeldItemStack();
- }
- te.markDirty();
- }
- return true;
- }
-
- /**
- * @param world
- * @param x
- * @param y
- * @param z
- * @param stack
- */
- public void dropItem(World world, double x, double y, double z, ItemStack stack)
- {
- EntityItem entityitem = new EntityItem(world, x + 0.5, y + 1.5, z + 0.5, stack);
- entityitem.motionX = 0;
- entityitem.motionZ = 0;
- entityitem.motionY = 0.11000000298023224D;
- world.spawnEntityInWorld(entityitem);
- }
-
- /**
- * @param world
- * @param i
- * @param j
- * @param k
- * @param block
- * @param par6
- */
- @Override
- public void breakBlock(World world, int i, int j, int k, Block block, int par6)
- {
- TileEntityHandPedestal te = (TileEntityHandPedestal)world.getTileEntity(i, j, k);
- if (te != null && te.getHeldItemStack() != null){
- dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.getHeldItemStack());
- world.removeTileEntity(i, j, k);
- }
- super.breakBlock(world, i, j, k, block, par6);
- }
-
- /**
- * @param world
- * @param i
- * @param j
- * @param k
- * @param entityLiving
- * @param par6ItemStack
- */
- @Override
- public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
- {
- int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 8 / 360 + 0.5) & 7;
- world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
- }
-
- /**
- * @param icon
- */
- @Override
- public void registerBlockIcons(IIconRegister icon)
- {
- blockIcon = icon.registerIcon("minecraft:stonebrick");
- }
+public class BlockHandPedestal extends BlockContainer {
+
+ /**
+ * @param material
+ */
+ protected BlockHandPedestal(Material material) {
+ super(material);
+ setBlockBounds(0.2F, 0F, 0.2F, 0.8F, 1.0F, 0.8F);
+ }
+
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
+ @Override
+ public TileEntity createNewTileEntity(World world, int var2) {
+ return new TileEntityHandPedestal();
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ /**
+ * @param iblockaccess
+ * @param i
+ * @param j
+ * @param k
+ * @param l
+ * @return
+ */
+ @Override
+ public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i,
+ int j, int k, int l) {
+ return false;
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public int getRenderType() {
+ return -1;
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityPlayer
+ * @param par6
+ * @param par7
+ * @param par8
+ * @param par9
+ * @return
+ */
+ @Override
+ public boolean onBlockActivated(World world, int i, int j, int k,
+ EntityPlayer entityPlayer, int par6, float par7, float par8,
+ float par9) {
+ TileEntityHandPedestal te =
+ (TileEntityHandPedestal) world.getTileEntity(i, j, k);
+ ItemStack item = entityPlayer.inventory.getCurrentItem();
+ if (te != null) {
+ if (!world.isRemote && te.getHeldItemStack() == null
+ && item != null) {
+ te.setHeldItemStack(item.copy());
+ if (!entityPlayer.capabilities.isCreativeMode)
+ item.stackSize--;
+ te.markDirty();
+ } else if (entityPlayer.isSneaking())
+ if (entityPlayer.inventory
+ .addItemStackToInventory(te.getHeldItemStack())) {
+ te.removeHeldItemStack();
+ }
+ te.markDirty();
+ }
+ return true;
+ }
+
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param stack
+ */
+ public void dropItem(World world, double x, double y, double z,
+ ItemStack stack) {
+ EntityItem entityitem =
+ new EntityItem(world, x + 0.5, y + 1.5, z + 0.5, stack);
+ entityitem.motionX = 0;
+ entityitem.motionZ = 0;
+ entityitem.motionY = 0.11000000298023224D;
+ world.spawnEntityInWorld(entityitem);
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param block
+ * @param par6
+ */
+ @Override
+ public void breakBlock(World world, int i, int j, int k, Block block,
+ int par6) {
+ TileEntityHandPedestal te =
+ (TileEntityHandPedestal) world.getTileEntity(i, j, k);
+ if (te != null && te.getHeldItemStack() != null) {
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord,
+ te.getHeldItemStack());
+ world.removeTileEntity(i, j, k);
+ }
+ super.breakBlock(world, i, j, k, block, par6);
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityLiving
+ * @param par6ItemStack
+ */
+ @Override
+ public void onBlockPlacedBy(World world, int i, int j, int k,
+ EntityLivingBase entityLiving, ItemStack par6ItemStack) {
+ int rotation = MathHelper.floor_double(
+ entityLiving.rotationYaw * 8 / 360 + 0.5) & 7;
+ world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
+ }
+
+ /**
+ * @param icon
+ */
+ @Override
+ public void registerBlockIcons(IIconRegister icon) {
+ blockIcon = icon.registerIcon("minecraft:stonebrick");
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockItemCrystal.java b/src/main/java/darkknight/jewelrycraft/block/BlockItemCrystal.java index ca3490a..6a82701 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockItemCrystal.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockItemCrystal.java @@ -6,30 +6,27 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
-public class BlockItemCrystal extends ItemBlock
-{
+public class BlockItemCrystal extends ItemBlock {
public BlockItemCrystal(Block block) {
super(block);
setHasSubtypes(true);
}
-
+
@Override
- public int getMetadata (int damageValue)
- {
+ public int getMetadata(int damageValue) {
return damageValue;
}
-
+
@Override
- public String getUnlocalizedName(ItemStack itemstack)
- {
+ public String getUnlocalizedName(ItemStack itemstack) {
return getUnlocalizedName() + "." + itemstack.getItemDamage();
}
-
- @Override
- @SideOnly (Side.CLIENT)
- public int getColorFromItemStack(ItemStack stack, int pass)
- {
- return stack.getItemDamage() < 16 ? BlockCrystal.colors[stack.getItemDamage()] : 0;
- }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public int getColorFromItemStack(ItemStack stack, int pass) {
+ return stack.getItemDamage() < 16
+ ? BlockCrystal.colors[stack.getItemDamage()] : 0;
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockJCOre.java b/src/main/java/darkknight/jewelrycraft/block/BlockJCOre.java index 5265a6a..41b61e5 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockJCOre.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockJCOre.java @@ -2,11 +2,9 @@ package darkknight.jewelrycraft.block; import net.minecraft.block.BlockOre;
-public class BlockJCOre extends BlockOre
-{
- protected BlockJCOre()
- {
- super();
- setHarvestLevel("pickaxe", 3);
- }
+public class BlockJCOre extends BlockOre {
+ protected BlockJCOre() {
+ super();
+ setHarvestLevel("pickaxe", 3);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockJewelersCraftingTable.java b/src/main/java/darkknight/jewelrycraft/block/BlockJewelersCraftingTable.java new file mode 100755 index 0000000..e8a1431 --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/block/BlockJewelersCraftingTable.java @@ -0,0 +1,168 @@ +package darkknight.jewelrycraft.block;
+
+import java.util.Random;
+
+import darkknight.jewelrycraft.config.ConfigHandler;
+import darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable;
+import darkknight.jewelrycraft.util.JewelrycraftUtil;
+import darkknight.jewelrycraft.util.Variables;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockContainer;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+public class BlockJewelersCraftingTable extends BlockContainer {
+ Random rand = new Random();
+
+ protected BlockJewelersCraftingTable(Material par2Material) {
+ super(par2Material);
+ setBlockBounds(0.0F, 0F, 0.0F, 1.0F, 0.8F, 1.0F);
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World world, int var2) {
+ return new TileEntityJewelrsCraftingTable();
+ }
+
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ @Override
+ public boolean onBlockActivated(World world, int i, int j, int k,
+ EntityPlayer entityPlayer, int par6, float par7, float par8,
+ float par9) {
+ TileEntityJewelrsCraftingTable te =
+ (TileEntityJewelrsCraftingTable) world.getTileEntity(i, j,
+ k);
+ ItemStack item = entityPlayer.inventory.getCurrentItem();
+ if (te != null && !world.isRemote) {
+ if (te.hasEndItem && item != null)
+ entityPlayer.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal("chatmessage."
+ + Variables.MODID + ".table.hasenditem")));
+ if (!te.hasEndItem && !te.hasJewelry && item != null
+ && JewelrycraftUtil.isJewelry(item)) {
+ te.setJewelryItemStack(item);
+ if (!entityPlayer.capabilities.isCreativeMode)
+ --item.stackSize;
+ }
+ if (!te.hasEndItem && !te.hasGem && item != null
+ && JewelrycraftUtil.isGem(item)) {
+ te.setGemItemStack(item);
+ if (!entityPlayer.capabilities.isCreativeMode)
+ --item.stackSize;
+ }
+ if (!te.hasEndItem && te.hasJewelry && te.hasGem
+ && !te.crafting)
+ te.setCrafting();
+ }
+ return true;
+ }
+
+ public void dropItem(World world, double x, double y, double z,
+ ItemStack stack) {
+ EntityItem entityitem =
+ new EntityItem(world, x + 0.5D, y + 1D, z + 0.5D, stack);
+ entityitem.motionX = 0;
+ entityitem.motionZ = 0;
+ entityitem.motionY = 0.21000000298023224D;
+ world.spawnEntityInWorld(entityitem);
+ }
+
+ @Override
+ public void breakBlock(World world, int i, int j, int k, Block par5,
+ int par6) {
+ TileEntityJewelrsCraftingTable te =
+ (TileEntityJewelrsCraftingTable) world.getTileEntity(i, j,
+ k);
+ if (te != null) {
+ if (te.hasJewelry)
+ dropItem(world, te.xCoord, te.yCoord, te.zCoord,
+ te.jewelry.copy());
+ if (te.hasGem)
+ dropItem(world, te.xCoord, te.yCoord, te.zCoord,
+ te.gem.copy());
+ if (te.hasEndItem)
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord,
+ te.endItem.copy());
+ world.removeTileEntity(i, j, k);
+ }
+ super.breakBlock(world, i, j, k, par5, par6);
+ }
+
+ @Override
+ public void onBlockPlacedBy(World world, int i, int j, int k,
+ EntityLivingBase entityLiving, ItemStack par6ItemStack) {
+ int rotation = MathHelper.floor_double(
+ entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
+ world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
+ }
+
+ @Override
+ public void onBlockClicked(World world, int i, int j, int k,
+ EntityPlayer player) {
+ TileEntityJewelrsCraftingTable te =
+ (TileEntityJewelrsCraftingTable) world.getTileEntity(i, j,
+ k);
+ if (te != null && !world.isRemote)
+ if (player.isSneaking()) {
+ if (te.hasJewelry)
+ te.removeJewelry();
+ if (te.hasGem)
+ te.removeGem();
+ } else if (te.hasEndItem)
+ te.removeResult();
+ else if (te.hasJewelry && te.hasGem && te.carving > 0
+ && te.jewelry != null)
+ player.addChatMessage(new ChatComponentText(StatCollector
+ .translateToLocalFormatted(
+ "chatmessage." + Variables.MODID
+ + ".table.iscrafting",
+ te.jewelry.getDisplayName())
+ + " ("
+ + (ConfigHandler.GEM_PLACEMENT_TIME - te.carving)
+ * 100 / ConfigHandler.GEM_PLACEMENT_TIME
+ + "%)"));
+ else if (!te.hasGem)
+ player.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal("chatmessage."
+ + Variables.MODID + ".table.missinggem")));
+ else if (!te.hasJewelry)
+ player.addChatMessage(new ChatComponentText(StatCollector
+ .translateToLocal("chatmessage." + Variables.MODID
+ + ".table.missingjewelry")));
+ }
+
+ @Override
+ public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i,
+ int j, int k, int l) {
+ return false;
+ }
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @Override
+ public int getRenderType() {
+ return -1;
+ }
+
+ @Override
+ public void registerBlockIcons(IIconRegister icon) {
+ blockIcon = icon.registerIcon("minecraft:planks_spruce");
+ }
+}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java b/src/main/java/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java deleted file mode 100644 index 71b1a23..0000000 --- a/src/main/java/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java +++ /dev/null @@ -1,119 +0,0 @@ -package darkknight.jewelrycraft.block;
-
-import java.util.Random;
-import darkknight.jewelrycraft.config.ConfigHandler;
-import darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable;
-import darkknight.jewelrycraft.util.JewelrycraftUtil;
-import darkknight.jewelrycraft.util.Variables;
-import net.minecraft.block.Block;
-import net.minecraft.block.BlockContainer;
-import net.minecraft.block.material.Material;
-import net.minecraft.client.renderer.texture.IIconRegister;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.MathHelper;
-import net.minecraft.util.StatCollector;
-import net.minecraft.world.IBlockAccess;
-import net.minecraft.world.World;
-
-public class BlockJewelrsCraftingTable extends BlockContainer {
- Random rand = new Random();
-
- protected BlockJewelrsCraftingTable(Material par2Material) {
- super(par2Material);
- setBlockBounds(0.0F, 0F, 0.0F, 1.0F, 0.8F, 1.0F);
- }
-
- @Override
- public TileEntity createNewTileEntity(World world, int var2) {
- return new TileEntityJewelrsCraftingTable();
- }
-
- @Override
- public boolean renderAsNormalBlock() {
- return false;
- }
-
- @Override
- public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) {
- TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world.getTileEntity(i, j, k);
- ItemStack item = entityPlayer.inventory.getCurrentItem();
- if (te != null && !world.isRemote) {
- if (te.hasEndItem && item != null) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".table.hasenditem")));
- if (!te.hasEndItem && !te.hasJewelry && item != null && JewelrycraftUtil.isJewelry(item)) {
- te.setJewelryItemStack(item);
- if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
- }
- if (!te.hasEndItem && !te.hasGem && item != null && JewelrycraftUtil.isGem(item)) {
- te.setGemItemStack(item);
- if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
- }
- if (!te.hasEndItem && te.hasJewelry && te.hasGem && !te.crafting) te.setCrafting();
- }
- return true;
- }
-
- public void dropItem(World world, double x, double y, double z, ItemStack stack) {
- EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1D, z + 0.5D, stack);
- entityitem.motionX = 0;
- entityitem.motionZ = 0;
- entityitem.motionY = 0.21000000298023224D;
- world.spawnEntityInWorld(entityitem);
- }
-
- @Override
- public void breakBlock(World world, int i, int j, int k, Block par5, int par6) {
- TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world.getTileEntity(i, j, k);
- if (te != null) {
- if (te.hasJewelry) dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.jewelry.copy());
- if (te.hasGem) dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.gem.copy());
- if (te.hasEndItem) dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.endItem.copy());
- world.removeTileEntity(i, j, k);
- }
- super.breakBlock(world, i, j, k, par5, par6);
- }
-
- @Override
- public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack) {
- int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
- world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
- }
-
- @Override
- public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) {
- TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world.getTileEntity(i, j, k);
- if (te != null && !world.isRemote) if (player.isSneaking()) {
- if (te.hasJewelry) te.removeJewelry();
- if (te.hasGem) te.removeGem();
- }
- else if (te.hasEndItem) te.removeResult();
- else if (te.hasJewelry && te.hasGem && te.carving > 0 && te.jewelry != null) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage." + Variables.MODID + ".table.iscrafting", te.jewelry.getDisplayName()) + " (" + (ConfigHandler.GEM_PLACEMENT_TIME - te.carving) * 100 / ConfigHandler.GEM_PLACEMENT_TIME + "%)"));
- else if (!te.hasGem) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".table.missinggem")));
- else if (!te.hasJewelry) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".table.missingjewelry")));
- }
-
- @Override
- public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) {
- return false;
- }
-
- @Override
- public boolean isOpaqueCube() {
- return false;
- }
-
- @Override
- public int getRenderType() {
- return -1;
- }
-
- @Override
- public void registerBlockIcons(IIconRegister icon)
- {
- blockIcon = icon.registerIcon("minecraft:planks_spruce");
- }
-}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockList.java b/src/main/java/darkknight/jewelrycraft/block/BlockList.java index 7f59e7f..cd928b8 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockList.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockList.java @@ -22,55 +22,113 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.oredict.OreDictionary;
-public class BlockList
-{
- public static Block shadowOre, smelter, molder, displayer, jewelCraftingTable, shadowBlock, shadowEye, handPedestal, shadowHand, midasTouchBlock, crystal;
- public static BlockMoltenMetal moltenMetal;
- public static Fluid moltenMetalFluid;
-
- public static void preInit(FMLPreInitializationEvent e)
- {
- shadowOre = new BlockJCOre().setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundTypePiston).setBlockTextureName(Variables.MODID + ":oreShadow").setBlockName(Variables.MODID + ".oreShadow").setCreativeTab(JewelrycraftMod.jewelrycraft);
- smelter = new BlockSmelter().setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundTypePiston).setBlockName(Variables.MODID + ".smelter").setCreativeTab(JewelrycraftMod.jewelrycraft);
- molder = new BlockMolder(Material.rock).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundTypePiston).setBlockName(Variables.MODID + ".molder").setCreativeTab(JewelrycraftMod.jewelrycraft);
- displayer = new BlockDisplayer(Material.iron).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundTypeMetal).setBlockName(Variables.MODID + ".displayer").setCreativeTab(JewelrycraftMod.jewelrycraft);
- jewelCraftingTable = new BlockJewelrsCraftingTable(Material.rock).setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundTypePiston).setBlockName(Variables.MODID + ".jewelCraftingTable").setCreativeTab(JewelrycraftMod.jewelrycraft);
- shadowBlock = new BlockShadow().setHardness(5.0F).setResistance(7.0F).setStepSound(Block.soundTypeMetal).setBlockTextureName(Variables.MODID + ":blockShadow").setBlockName(Variables.MODID + ".blockShadow").setCreativeTab(JewelrycraftMod.jewelrycraft);
- shadowEye = new BlockShadowEye().setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundTypePiston).setBlockName(Variables.MODID + ".shadowEye").setCreativeTab(JewelrycraftMod.jewelrycraft);
- handPedestal = new BlockHandPedestal(Material.rock).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundTypePiston).setBlockName(Variables.MODID + ".handPedestal").setCreativeTab(JewelrycraftMod.jewelrycraft);
- shadowHand = new BlockShadowHand(Material.rock).setStepSound(Block.soundTypePiston).setBlockName(Variables.MODID + ".shadowHand").setCreativeTab(JewelrycraftMod.jewelrycraft).setBlockUnbreakable();
- midasTouchBlock = new BlockMidasTouch(Material.iron).setHardness(3.0F).setResistance(10.0F).setStepSound(Block.soundTypeMetal).setBlockName(Variables.MODID + ".midasTouchBlock");
- moltenMetalFluid = new Fluid("metal.molten").setLuminosity(15).setDensity(3000).setTemperature(2000).setViscosity(6000);
- if (!FluidRegistry.registerFluid(moltenMetalFluid)) moltenMetalFluid = FluidRegistry.getFluid("metal.molten");
- moltenMetal = new BlockMoltenMetal(moltenMetalFluid, Material.lava);
- moltenMetalFluid.setBlock(moltenMetal);
- crystal = new BlockCrystal().setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeGlass).setBlockTextureName(Variables.MODID + ":blockCrystal").setBlockName(Variables.MODID + ".blockCrystal").setCreativeTab(JewelrycraftMod.jewelrycraft);
-
- GameRegistry.registerBlock(shadowOre, "shadowOre");
- GameRegistry.registerBlock(shadowBlock, "shadowBlock");
- GameRegistry.registerBlock(smelter, "Smelter");
- GameRegistry.registerBlock(molder, "Molder");
- GameRegistry.registerBlock(jewelCraftingTable, "jewelCraftingTable");
- GameRegistry.registerBlock(displayer, "Displayer");
- GameRegistry.registerBlock(shadowEye, "Shadow Eye");
- GameRegistry.registerBlock(handPedestal, "Stone Bricks Pedestal");
- GameRegistry.registerBlock(shadowHand, "Shadow Hand");
- GameRegistry.registerBlock(midasTouchBlock, "Midas Touch Block");
- GameRegistry.registerBlock(moltenMetal, "moltenMetalLiquid");
- GameRegistry.registerBlock(crystal, BlockItemCrystal.class, "crystalBlock");
-
- GameRegistry.registerTileEntity(TileEntitySmelter.class, Variables.MODID + ":smelter");
- GameRegistry.registerTileEntity(TileEntityMolder.class, Variables.MODID + ":molder");
- GameRegistry.registerTileEntity(TileEntityJewelrsCraftingTable.class, Variables.MODID + ":table");
- GameRegistry.registerTileEntity(TileEntityDisplayer.class, Variables.MODID + ":displayer");
- GameRegistry.registerTileEntity(TileEntityBlockShadow.class, Variables.MODID + ":blockShadow");
- GameRegistry.registerTileEntity(TileEntityShadowEye.class, Variables.MODID + ":shadowEye");
- GameRegistry.registerTileEntity(TileEntityHandPedestal.class, Variables.MODID + ":handPedestal");
- GameRegistry.registerTileEntity(TileEntityShadowHand.class, Variables.MODID + ":shadowHand");
- GameRegistry.registerTileEntity(TileEntityMidasTouch.class, Variables.MODID + ":midsaTouch");
- GameRegistry.registerTileEntity(TileEntityCrystal.class, Variables.MODID + ":crystalBlock");
- GameRegistry.registerTileEntity(TileEntityMoltenMetal.class, Variables.MODID + ":moltenMetalTE");
-
- OreDictionary.registerOre("oreShadow", new ItemStack(BlockList.shadowOre));
- }
+public class BlockList {
+ public static Block shadowOre, smelter, molder, displayer,
+ jewelCraftingTable, shadowBlock, shadowEye, handPedestal,
+ shadowHand, midasTouchBlock, crystal;
+ public static BlockMoltenMetal moltenMetal;
+ public static Fluid moltenMetalFluid;
+
+ public static void preInit(
+ FMLPreInitializationEvent e) {
+ shadowOre = new BlockJCOre().setHardness(3.0F).setResistance(5.0F)
+ .setStepSound(Block.soundTypePiston)
+ .setBlockTextureName(Variables.MODID + ":oreShadow")
+ .setBlockName(Variables.MODID + ".oreShadow")
+ .setCreativeTab(JewelrycraftMod.jewelrycraft);
+ smelter = new BlockSmelter().setHardness(5.0F).setResistance(6.0F)
+ .setStepSound(Block.soundTypePiston)
+ .setBlockName(Variables.MODID + ".smelter")
+ .setCreativeTab(JewelrycraftMod.jewelrycraft);
+ molder = new BlockMolder(Material.rock).setHardness(5.0F)
+ .setResistance(6.0F).setStepSound(Block.soundTypePiston)
+ .setBlockName(Variables.MODID + ".molder")
+ .setCreativeTab(JewelrycraftMod.jewelrycraft);
+ displayer = new BlockDisplayer(Material.iron).setHardness(5.0F)
+ .setResistance(6.0F).setStepSound(Block.soundTypeMetal)
+ .setBlockName(Variables.MODID + ".displayer")
+ .setCreativeTab(JewelrycraftMod.jewelrycraft);
+ jewelCraftingTable = new BlockJewelersCraftingTable(Material.rock)
+ .setHardness(3.0F).setResistance(5.0F)
+ .setStepSound(Block.soundTypePiston)
+ .setBlockName(Variables.MODID + ".jewelCraftingTable")
+ .setCreativeTab(JewelrycraftMod.jewelrycraft);
+ shadowBlock = new BlockShadow().setHardness(5.0F)
+ .setResistance(7.0F).setStepSound(Block.soundTypeMetal)
+ .setBlockTextureName(Variables.MODID + ":blockShadow")
+ .setBlockName(Variables.MODID + ".blockShadow")
+ .setCreativeTab(JewelrycraftMod.jewelrycraft);
+ shadowEye = new BlockShadowEye().setHardness(5.0F)
+ .setResistance(6.0F).setStepSound(Block.soundTypePiston)
+ .setBlockName(Variables.MODID + ".shadowEye")
+ .setCreativeTab(JewelrycraftMod.jewelrycraft);
+ handPedestal = new BlockHandPedestal(Material.rock)
+ .setHardness(5.0F).setResistance(6.0F)
+ .setStepSound(Block.soundTypePiston)
+ .setBlockName(Variables.MODID + ".handPedestal")
+ .setCreativeTab(JewelrycraftMod.jewelrycraft);
+ shadowHand = new BlockShadowHand(Material.rock)
+ .setStepSound(Block.soundTypePiston)
+ .setBlockName(Variables.MODID + ".shadowHand")
+ .setCreativeTab(JewelrycraftMod.jewelrycraft)
+ .setBlockUnbreakable();
+ midasTouchBlock = new BlockMidasTouch(Material.iron)
+ .setHardness(3.0F).setResistance(10.0F)
+ .setStepSound(Block.soundTypeMetal)
+ .setBlockName(Variables.MODID + ".midasTouchBlock");
+ moltenMetalFluid = new Fluid("metal.molten").setLuminosity(15)
+ .setDensity(3000).setTemperature(2000).setViscosity(6000);
+ if (!FluidRegistry.registerFluid(moltenMetalFluid))
+ moltenMetalFluid = FluidRegistry.getFluid("metal.molten");
+ moltenMetal =
+ new BlockMoltenMetal(moltenMetalFluid, Material.lava);
+ moltenMetalFluid.setBlock(moltenMetal);
+ crystal = new BlockCrystal().setHardness(2.0F).setResistance(5.0F)
+ .setStepSound(Block.soundTypeGlass)
+ .setBlockTextureName(Variables.MODID + ":blockCrystal")
+ .setBlockName(Variables.MODID + ".blockCrystal")
+ .setCreativeTab(JewelrycraftMod.jewelrycraft);
+
+ GameRegistry.registerBlock(shadowOre, "shadowOre");
+ GameRegistry.registerBlock(shadowBlock, "shadowBlock");
+ GameRegistry.registerBlock(smelter, "Smelter");
+ GameRegistry.registerBlock(molder, "Molder");
+ GameRegistry.registerBlock(jewelCraftingTable,
+ "jewelCraftingTable");
+ GameRegistry.registerBlock(displayer, "Displayer");
+ GameRegistry.registerBlock(shadowEye, "Shadow Eye");
+ GameRegistry.registerBlock(handPedestal, "Stone Bricks Pedestal");
+ GameRegistry.registerBlock(shadowHand, "Shadow Hand");
+ GameRegistry.registerBlock(midasTouchBlock, "Midas Touch Block");
+ GameRegistry.registerBlock(moltenMetal, "moltenMetalLiquid");
+ GameRegistry.registerBlock(crystal, BlockItemCrystal.class,
+ "crystalBlock");
+
+ GameRegistry.registerTileEntity(TileEntitySmelter.class,
+ Variables.MODID + ":smelter");
+ GameRegistry.registerTileEntity(TileEntityMolder.class,
+ Variables.MODID + ":molder");
+ GameRegistry.registerTileEntity(
+ TileEntityJewelrsCraftingTable.class,
+ Variables.MODID + ":table");
+ GameRegistry.registerTileEntity(TileEntityDisplayer.class,
+ Variables.MODID + ":displayer");
+ GameRegistry.registerTileEntity(TileEntityBlockShadow.class,
+ Variables.MODID + ":blockShadow");
+ GameRegistry.registerTileEntity(TileEntityShadowEye.class,
+ Variables.MODID + ":shadowEye");
+ GameRegistry.registerTileEntity(TileEntityHandPedestal.class,
+ Variables.MODID + ":handPedestal");
+ GameRegistry.registerTileEntity(TileEntityShadowHand.class,
+ Variables.MODID + ":shadowHand");
+ GameRegistry.registerTileEntity(TileEntityMidasTouch.class,
+ Variables.MODID + ":midsaTouch");
+ GameRegistry.registerTileEntity(TileEntityCrystal.class,
+ Variables.MODID + ":crystalBlock");
+ GameRegistry.registerTileEntity(TileEntityMoltenMetal.class,
+ Variables.MODID + ":moltenMetalTE");
+
+ OreDictionary.registerOre("oreShadow",
+ new ItemStack(BlockList.shadowOre));
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockMidasTouch.java b/src/main/java/darkknight/jewelrycraft/block/BlockMidasTouch.java index 337428d..19e0190 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockMidasTouch.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockMidasTouch.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.block;
import java.util.Random;
+
import darkknight.jewelrycraft.tileentity.TileEntityMidasTouch;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -12,67 +13,70 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-public class BlockMidasTouch extends BlockContainer
-{
- protected BlockMidasTouch(Material mat)
- {
- super(mat);
- setHarvestLevel("pickaxe", 2);
- }
-
- @Override
- public TileEntity createNewTileEntity(World world, int var2)
- {
- return new TileEntityMidasTouch();
- }
-
- @Override
- public boolean renderAsNormalBlock()
- {
- return false;
- }
-
- @Override
- public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
- {
- return false;
- }
-
- @Override
- public boolean isOpaqueCube()
- {
- return false;
- }
-
- @Override
- public int getRenderType()
- {
- return -1;
- }
-
- public int quantityDropped(Random rand)
- {
- return 0;
- }
-
- public Item getItemDropped(int id, Random rand, int size)
- {
- return Items.gold_nugget;
- }
-
- public void onBlockHarvested(World world, int i, int j, int k, int meta, EntityPlayer player)
- {
- }
-
- public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z)
- {
- TileEntity tile = world.getTileEntity(x, y, z);
- if (((TileEntityMidasTouch)tile).target != null) this.setBlockBounds(0.5f - ((TileEntityMidasTouch)tile).target.width / 2, 0F, 0.5f - ((TileEntityMidasTouch)tile).target.width / 2, 0.5f + ((TileEntityMidasTouch)tile).target.width / 2, ((TileEntityMidasTouch)tile).target.height, 0.5f + ((TileEntityMidasTouch)tile).target.width / 2);
- }
-
- @Override
- public void registerBlockIcons(IIconRegister icon)
- {
- blockIcon = icon.registerIcon("minecraft:gold_block");
- }
+public class BlockMidasTouch extends BlockContainer {
+ protected BlockMidasTouch(Material mat) {
+ super(mat);
+ setHarvestLevel("pickaxe", 2);
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World world, int var2) {
+ return new TileEntityMidasTouch();
+ }
+
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ @Override
+ public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i,
+ int j, int k, int l) {
+ return false;
+ }
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @Override
+ public int getRenderType() {
+ return -1;
+ }
+
+ @Override
+ public int quantityDropped(Random rand) {
+ return 0;
+ }
+
+ @Override
+ public Item getItemDropped(int id, Random rand, int size) {
+ return Items.gold_nugget;
+ }
+
+ @Override
+ public void onBlockHarvested(World world, int i, int j, int k,
+ int meta, EntityPlayer player) {
+ // Do nothing
+ }
+
+ @Override
+ public void setBlockBoundsBasedOnState(IBlockAccess world, int x,
+ int y, int z) {
+ TileEntity tile = world.getTileEntity(x, y, z);
+ if (((TileEntityMidasTouch) tile).target != null)
+ this.setBlockBounds(
+ 0.5f - ((TileEntityMidasTouch) tile).target.width / 2,
+ 0F,
+ 0.5f - ((TileEntityMidasTouch) tile).target.width / 2,
+ 0.5f + ((TileEntityMidasTouch) tile).target.width / 2,
+ ((TileEntityMidasTouch) tile).target.height,
+ 0.5f + ((TileEntityMidasTouch) tile).target.width / 2);
+ }
+
+ @Override
+ public void registerBlockIcons(IIconRegister icon) {
+ blockIcon = icon.registerIcon("minecraft:gold_block");
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java b/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java index 0c58784..7d7b34d 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.block;
import java.util.Random;
+
import darkknight.jewelrycraft.config.ConfigHandler;
import darkknight.jewelrycraft.item.ItemList;
import darkknight.jewelrycraft.tileentity.TileEntityMolder;
@@ -21,116 +22,146 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-public class BlockMolder extends BlockContainer
-{
- Random rand = new Random();
-
- protected BlockMolder(Material par2Material)
- {
- super(par2Material);
- setBlockBounds(0.1F, 0F, 0.1F, 0.9F, 0.2F, 0.9F);
- }
-
- @Override
- public TileEntity createNewTileEntity(World world, int var2)
- {
- return new TileEntityMolder();
- }
-
- @Override
- public boolean renderAsNormalBlock()
- {
- return false;
- }
-
- @Override
- public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
- {
- TileEntityMolder te = (TileEntityMolder)world.getTileEntity(i, j, k);
- ItemStack item = entityPlayer.inventory.getCurrentItem();
- if (te != null && !world.isRemote){
- if (item != null && !te.hasMold && item.getItem() == ItemList.molds){
- te.mold = item.copy();
- te.hasMold = true;
- if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
- entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage." + Variables.MODID + ".molder.addedmold", te.mold.getDisplayName())));
- te.isDirty = true;
- }
- if (te.hasMold && entityPlayer.isSneaking() && !te.hasMoltenMetal){
- dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.mold.copy());
- te.mold = new ItemStack(Item.getItemById(0), 0, 0);
- te.hasMold = false;
- te.isDirty = true;
- }else if (te.hasMoltenMetal) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".molder.hasmoltenmetal")));
- }
- return true;
- }
-
- public void dropItem(World world, double x, double y, double z, ItemStack stack)
- {
- EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 0.5D, z + 0.5D, stack);
- entityitem.motionX = 0;
- entityitem.motionZ = 0;
- entityitem.motionY = 0.11000000298023224D;
- world.spawnEntityInWorld(entityitem);
- }
-
- @Override
- public void breakBlock(World world, int i, int j, int k, Block par5, int par6)
- {
- TileEntityMolder te = (TileEntityMolder)world.getTileEntity(i, j, k);
- if (te != null){
- if (te.hasJewelBase) dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.jewelBase.copy());
- if (te.hasMold) dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.mold.copy());
- world.removeTileEntity(i, j, k);
- }
- super.breakBlock(world, i, j, k, par5, par6);
- }
-
- @Override
- public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
- {
- int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
- world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
- }
-
- @Override
- public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
- {
- TileEntityMolder me = (TileEntityMolder)world.getTileEntity(i, j, k);
- if (me != null && !world.isRemote){
- if (me.hasJewelBase){
- dropItem(me.getWorldObj(), me.xCoord, me.yCoord, me.zCoord, me.jewelBase.copy());
- me.jewelBase = new ItemStack(Item.getItemById(0), 0, 0);
- me.hasJewelBase = false;
- }else if (me.hasMoltenMetal && me.cooling >= 0) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".molder.metaliscooling") + " (" + (ConfigHandler.INGOT_COOLING_TIME - me.cooling) * 100 / ConfigHandler.INGOT_COOLING_TIME + "%)"));
- else if (me.mold.getItem() == ItemList.molds && !me.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".molder.moldisempty")));
- else if (me.mold.getItem() != ItemList.molds) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".molder.moldismissing")));
- me.isDirty = true;
- }
- }
-
- @Override
- public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
- {
- return false;
- }
-
- @Override
- public boolean isOpaqueCube()
- {
- return false;
- }
-
- @Override
- public int getRenderType()
- {
- return -1;
- }
-
- @Override
- public void registerBlockIcons(IIconRegister icon)
- {
- blockIcon = icon.registerIcon("minecraft:cobblestone");
- }
+public class BlockMolder extends BlockContainer {
+ Random rand = new Random();
+
+ protected BlockMolder(Material par2Material) {
+ super(par2Material);
+ setBlockBounds(0.1F, 0F, 0.1F, 0.9F, 0.2F, 0.9F);
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World world, int var2) {
+ return new TileEntityMolder();
+ }
+
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ @Override
+ public boolean onBlockActivated(World world, int i, int j, int k,
+ EntityPlayer entityPlayer, int par6, float par7, float par8,
+ float par9) {
+ TileEntityMolder te =
+ (TileEntityMolder) world.getTileEntity(i, j, k);
+ ItemStack item = entityPlayer.inventory.getCurrentItem();
+ if (te != null && !world.isRemote) {
+ if (item != null && !te.hasMold
+ && item.getItem() == ItemList.molds) {
+ te.mold = item.copy();
+ te.hasMold = true;
+ if (!entityPlayer.capabilities.isCreativeMode)
+ --item.stackSize;
+ entityPlayer.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocalFormatted(
+ "chatmessage." + Variables.MODID
+ + ".molder.addedmold",
+ te.mold.getDisplayName())));
+ te.isDirty = true;
+ }
+ if (te.hasMold && entityPlayer.isSneaking()
+ && !te.hasMoltenMetal) {
+ dropItem(world, te.xCoord, te.yCoord, te.zCoord,
+ te.mold.copy());
+ te.mold = new ItemStack(Item.getItemById(0), 0, 0);
+ te.hasMold = false;
+ te.isDirty = true;
+ } else if (te.hasMoltenMetal)
+ entityPlayer.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal(
+ "chatmessage." + Variables.MODID
+ + ".molder.hasmoltenmetal")));
+ }
+ return true;
+ }
+
+ public void dropItem(World world, double x, double y, double z,
+ ItemStack stack) {
+ EntityItem entityitem =
+ new EntityItem(world, x + 0.5D, y + 0.5D, z + 0.5D, stack);
+ entityitem.motionX = 0;
+ entityitem.motionZ = 0;
+ entityitem.motionY = 0.11000000298023224D;
+ world.spawnEntityInWorld(entityitem);
+ }
+
+ @Override
+ public void breakBlock(World world, int i, int j, int k, Block par5,
+ int par6) {
+ TileEntityMolder te =
+ (TileEntityMolder) world.getTileEntity(i, j, k);
+ if (te != null) {
+ if (te.hasJewelBase)
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord,
+ te.jewelBase.copy());
+ if (te.hasMold)
+ dropItem(world, te.xCoord, te.yCoord, te.zCoord,
+ te.mold.copy());
+ world.removeTileEntity(i, j, k);
+ }
+ super.breakBlock(world, i, j, k, par5, par6);
+ }
+
+ @Override
+ public void onBlockPlacedBy(World world, int i, int j, int k,
+ EntityLivingBase entityLiving, ItemStack par6ItemStack) {
+ int rotation = MathHelper.floor_double(
+ entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
+ world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
+ }
+
+ @Override
+ public void onBlockClicked(World world, int i, int j, int k,
+ EntityPlayer player) {
+ TileEntityMolder me =
+ (TileEntityMolder) world.getTileEntity(i, j, k);
+ if (me != null && !world.isRemote) {
+ if (me.hasJewelBase) {
+ dropItem(me.getWorldObj(), me.xCoord, me.yCoord, me.zCoord,
+ me.jewelBase.copy());
+ me.jewelBase = new ItemStack(Item.getItemById(0), 0, 0);
+ me.hasJewelBase = false;
+ } else if (me.hasMoltenMetal && me.cooling >= 0)
+ player.addChatMessage(new ChatComponentText(StatCollector
+ .translateToLocal("chatmessage." + Variables.MODID
+ + ".molder.metaliscooling")
+ + " ("
+ + (ConfigHandler.INGOT_COOLING_TIME - me.cooling)
+ * 100 / ConfigHandler.INGOT_COOLING_TIME
+ + "%)"));
+ else if (me.mold.getItem() == ItemList.molds
+ && !me.hasMoltenMetal)
+ player.addChatMessage(new ChatComponentText(StatCollector
+ .translateToLocal("chatmessage." + Variables.MODID
+ + ".molder.moldisempty")));
+ else if (me.mold.getItem() != ItemList.molds)
+ player.addChatMessage(new ChatComponentText(StatCollector
+ .translateToLocal("chatmessage." + Variables.MODID
+ + ".molder.moldismissing")));
+ me.isDirty = true;
+ }
+ }
+
+ @Override
+ public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i,
+ int j, int k, int l) {
+ return false;
+ }
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @Override
+ public int getRenderType() {
+ return -1;
+ }
+
+ @Override
+ public void registerBlockIcons(IIconRegister icon) {
+ blockIcon = icon.registerIcon("minecraft:cobblestone");
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java b/src/main/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java index 0995cc3..088a5e2 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java @@ -2,6 +2,7 @@ package darkknight.jewelrycraft.block; import java.io.IOException;
import java.util.Random;
+
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import darkknight.jewelrycraft.tileentity.TileEntityMoltenMetal;
@@ -21,11 +22,12 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic;
import net.minecraftforge.fluids.Fluid;
-public class BlockMoltenMetal extends BlockFluidClassic implements ITileEntityProvider {
+public class BlockMoltenMetal extends BlockFluidClassic
+ implements ITileEntityProvider {
@SideOnly(Side.CLIENT)
- protected IIcon stillIcon;
+ protected IIcon stillIcon;
@SideOnly(Side.CLIENT)
- protected IIcon flowingIcon;
+ protected IIcon flowingIcon;
public BlockMoltenMetal(Fluid fluid, Material material) {
super(fluid, material);
@@ -43,34 +45,48 @@ public class BlockMoltenMetal extends BlockFluidClassic implements ITileEntityPr @Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister register) {
- stillIcon = register.registerIcon(Variables.MODID + ":moltenMetalStill");
- flowingIcon = register.registerIcon(Variables.MODID + ":moltenMetalFlow");
+ stillIcon = register
+ .registerIcon(Variables.MODID + ":moltenMetalStill");
+ flowingIcon = register
+ .registerIcon(Variables.MODID + ":moltenMetalFlow");
}
@Override
public boolean canDisplace(IBlockAccess world, int x, int y, int z) {
- if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false;
+ if (world.getBlock(x, y, z).getMaterial().isLiquid())
+ return false;
return super.canDisplace(world, x, y, z);
}
@Override
public boolean displaceIfPossible(World world, int x, int y, int z) {
- if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false;
+ if (world.getBlock(x, y, z).getMaterial().isLiquid())
+ return false;
return super.displaceIfPossible(world, x, y, z);
}
@Override
- protected boolean canFlowInto(IBlockAccess world, int x, int y, int z) {
- if (world.getBlock(x, y, z).isAir(world, x, y, z)) return true;
+ protected boolean canFlowInto(IBlockAccess world, int x, int y,
+ int z) {
+ if (world.getBlock(x, y, z).isAir(world, x, y, z))
+ return true;
Block block = world.getBlock(x, y, z);
- if (block == this) return false;
- if (displacements.containsKey(block)) return displacements.get(block);
+ if (block == this)
+ return false;
+ if (displacements.containsKey(block))
+ return displacements.get(block);
Material material = block.getMaterial();
- if (material.blocksMovement() || material == Material.water || material == Material.lava || material == Material.portal) return false;
- int density = getDensity(world, x, y, z);
- if (density == Integer.MAX_VALUE) return true;
- if (this.density > density) return true;
- else return false;
+ if (material.blocksMovement() || material == Material.water
+ || material == Material.lava
+ || material == Material.portal)
+ return false;
+ int densty = getDensity(world, x, y, z);
+ if (densty == Integer.MAX_VALUE)
+ return true;
+ if (this.density > densty) {
+ return true;
+ }
+ return false;
}
@Override
@@ -78,8 +94,7 @@ public class BlockMoltenMetal extends BlockFluidClassic implements ITileEntityPr public int colorMultiplier(IBlockAccess world, int i, int j, int k) {
try {
return color(world, i, j, k, false, null);
- }
- catch (IOException e) {
+ } catch (IOException e) {
e.printStackTrace();
}
return 0;
@@ -87,77 +102,164 @@ public class BlockMoltenMetal extends BlockFluidClassic implements ITileEntityPr @Override
public void updateTick(World world, int x, int y, int z, Random rand) {
- if (getTileEntity(world, x, y, z) == null || (getTileEntity(world, x, y, z).getMetal() == null)) world.setBlockToAir(x, y, z);
+ if (getTileEntity(world, x, y, z) == null
+ || (getTileEntity(world, x, y, z).getMetal() == null))
+ world.setBlockToAir(x, y, z);
else {
- int quantaRemaining = quantaPerBlock - world.getBlockMetadata(x, y, z);
+ int quantaRemaining =
+ quantaPerBlock - world.getBlockMetadata(x, y, z);
int expQuanta = -101;
// check adjacent block levels if non-source
if (quantaRemaining < quantaPerBlock) {
int y2 = y - densityDir;
- if ((world.getBlock(x, y2, z) == this && getTileEntity(world, x, y2, z) != null && getTileEntity(world, x, y, z) != null && areMetalsEqual(world, x, y2, z, x, y, z)) || (world.getBlock(x - 1, y2, z) == this && getTileEntity(world, x - 1, y2, z) != null && getTileEntity(world, x, y, z) != null && areMetalsEqual(world, x - 1, y2, z, x, y, z)) || (world.getBlock(x + 1, y2, z) == this && getTileEntity(world, x + 1, y2, z) != null && getTileEntity(world, x, y, z) != null && areMetalsEqual(world, x + 1, y2, z, x, y, z)) || (world.getBlock(x, y2, z - 1) == this && getTileEntity(world, x, y2, z - 1) != null && getTileEntity(world, x, y, z) != null && areMetalsEqual(world, x, y2, z - 1, x, y, z)) || (world.getBlock(x, y2, z + 1) == this && getTileEntity(world, x, y2, z + 1) != null && getTileEntity(world, x, y, z) != null && areMetalsEqual(world, x, y2, z + 1, x, y, z))) expQuanta = quantaPerBlock - 1;
+ if ((world.getBlock(x, y2, z) == this
+ && getTileEntity(world, x, y2, z) != null
+ && getTileEntity(world, x, y, z) != null
+ && areMetalsEqual(world, x, y2, z, x, y, z))
+ || (world.getBlock(x - 1, y2, z) == this
+ && getTileEntity(world, x - 1, y2,
+ z) != null
+ && getTileEntity(world, x, y, z) != null
+ && areMetalsEqual(world, x - 1, y2, z, x,
+ y, z))
+ || (world.getBlock(x + 1, y2, z) == this
+ && getTileEntity(world, x + 1, y2,
+ z) != null
+ && getTileEntity(world, x, y, z) != null
+ && areMetalsEqual(world, x + 1, y2, z, x,
+ y, z))
+ || (world.getBlock(x, y2, z - 1) == this
+ && getTileEntity(world, x, y2,
+ z - 1) != null
+ && getTileEntity(world, x, y, z) != null
+ && areMetalsEqual(world, x, y2, z - 1, x,
+ y, z))
+ || (world.getBlock(x, y2, z + 1) == this
+ && getTileEntity(world, x, y2,
+ z + 1) != null
+ && getTileEntity(world, x, y, z) != null
+ && areMetalsEqual(world, x, y2, z + 1, x,
+ y, z)))
+ expQuanta = quantaPerBlock - 1;
else {
int maxQuanta = -100;
- if (getTileEntity(world, x, y, z) != null && getTileEntity(world, x - 1, y, z) != null && areMetalsEqual(world, x, y, z, x - 1, y, z)) maxQuanta = getLargerQuanta(world, x - 1, y, z, maxQuanta);
- if (getTileEntity(world, x, y, z) != null && getTileEntity(world, x + 1, y, z) != null && areMetalsEqual(world, x, y, z, x + 1, y, z)) maxQuanta = getLargerQuanta(world, x + 1, y, z, maxQuanta);
- if (getTileEntity(world, x, y, z) != null && getTileEntity(world, x, y, z - 1) != null && areMetalsEqual(world, x, y, z, x, y, z - 1)) maxQuanta = getLargerQuanta(world, x, y, z - 1, maxQuanta);
- if (getTileEntity(world, x, y, z) != null && getTileEntity(world, x, y, z + 1) != null && areMetalsEqual(world, x, y, z, x, y, z + 1)) maxQuanta = getLargerQuanta(world, x, y, z + 1, maxQuanta);
+ if (getTileEntity(world, x, y, z) != null
+ && getTileEntity(world, x - 1, y, z) != null
+ && areMetalsEqual(world, x, y, z, x - 1, y, z))
+ maxQuanta = getLargerQuanta(world, x - 1, y, z,
+ maxQuanta);
+ if (getTileEntity(world, x, y, z) != null
+ && getTileEntity(world, x + 1, y, z) != null
+ && areMetalsEqual(world, x, y, z, x + 1, y, z))
+ maxQuanta = getLargerQuanta(world, x + 1, y, z,
+ maxQuanta);
+ if (getTileEntity(world, x, y, z) != null
+ && getTileEntity(world, x, y, z - 1) != null
+ && areMetalsEqual(world, x, y, z, x, y, z - 1))
+ maxQuanta = getLargerQuanta(world, x, y, z - 1,
+ maxQuanta);
+ if (getTileEntity(world, x, y, z) != null
+ && getTileEntity(world, x, y, z + 1) != null
+ && areMetalsEqual(world, x, y, z, x, y, z + 1))
+ maxQuanta = getLargerQuanta(world, x, y, z + 1,
+ maxQuanta);
expQuanta = maxQuanta - 1;
}
// decay calculation
if (expQuanta != quantaRemaining) {
quantaRemaining = expQuanta;
- if (expQuanta <= 0) world.setBlock(x, y, z, Blocks.air);
+ if (expQuanta <= 0)
+ world.setBlock(x, y, z, Blocks.air);
else {
- world.setBlockMetadataWithNotify(x, y, z, quantaPerBlock - expQuanta, 3);
+ world.setBlockMetadataWithNotify(x, y, z,
+ quantaPerBlock - expQuanta, 3);
world.scheduleBlockUpdate(x, y, z, this, tickRate);
world.notifyBlocksOfNeighborChange(x, y, z, this);
}
}
}
- // This is a "source" block, set meta to zero, and send a server only update
- else if (quantaRemaining >= quantaPerBlock) world.setBlockMetadataWithNotify(x, y, z, 0, 2);
+ // This is a "source" block, set meta to zero, and send a
+ // server only update
+ else if (quantaRemaining >= quantaPerBlock)
+ world.setBlockMetadataWithNotify(x, y, z, 0, 2);
// Flow vertically if possible
if (canDisplace(world, x, y + densityDir, z)) {
- if (getTileEntity(world, x, y + densityDir, z) != null && getTileEntity(world, x, y, z) != null) this.getTileEntity(world, x, y + densityDir, z).setMetal(getTileEntity(world, x, y, z).getMetal());
- flowIntoBlock(world, x, y + densityDir, z, 1, getTileEntity(world, x, y, z).getMetal());
+ if (getTileEntity(world, x, y + densityDir, z) != null
+ && getTileEntity(world, x, y, z) != null)
+ BlockMoltenMetal
+ .getTileEntity(world, x, y + densityDir, z)
+ .setMetal(getTileEntity(world, x, y, z)
+ .getMetal());
+ flowIntoBlock(world, x, y + densityDir, z, 1,
+ getTileEntity(world, x, y, z).getMetal());
return;
}
// Flow outward if possible
int flowMeta = quantaPerBlock - quantaRemaining + 1;
- if (flowMeta >= quantaPerBlock) return;
- if (isSourceBlock(world, x, y, z) || !isFlowingVertically(world, x, y, z)) {
- if (world.getBlock(x, y - densityDir, z) == this && getTileEntity(world, x, y, z) != null && getTileEntity(world, x, y - densityDir, z) != null && areMetalsEqual(world, x, y, z, x, y - densityDir, z)) flowMeta = 1;
- boolean flowTo[] = getOptimalFlowDirections(world, x, y, z);
- if (flowTo[0]) flowIntoBlock(world, x - 1, y, z, flowMeta, getTileEntity(world, x, y, z).getMetal());
- if (flowTo[1]) flowIntoBlock(world, x + 1, y, z, flowMeta, getTileEntity(world, x, y, z).getMetal());
- if (flowTo[2]) flowIntoBlock(world, x, y, z - 1, flowMeta, getTileEntity(world, x, y, z).getMetal());
- if (flowTo[3]) flowIntoBlock(world, x, y, z + 1, flowMeta, getTileEntity(world, x, y, z).getMetal());
+ if (flowMeta >= quantaPerBlock)
+ return;
+ if (isSourceBlock(world, x, y, z)
+ || !isFlowingVertically(world, x, y, z)) {
+ if (world.getBlock(x, y - densityDir, z) == this
+ && getTileEntity(world, x, y, z) != null
+ && getTileEntity(world, x, y - densityDir,
+ z) != null
+ && areMetalsEqual(world, x, y, z, x,
+ y - densityDir, z))
+ flowMeta = 1;
+ boolean flowTo[] =
+ getOptimalFlowDirections(world, x, y, z);
+ if (flowTo[0])
+ flowIntoBlock(world, x - 1, y, z, flowMeta,
+ getTileEntity(world, x, y, z).getMetal());
+ if (flowTo[1])
+ flowIntoBlock(world, x + 1, y, z, flowMeta,
+ getTileEntity(world, x, y, z).getMetal());
+ if (flowTo[2])
+ flowIntoBlock(world, x, y, z - 1, flowMeta,
+ getTileEntity(world, x, y, z).getMetal());
+ if (flowTo[3])
+ flowIntoBlock(world, x, y, z + 1, flowMeta,
+ getTileEntity(world, x, y, z).getMetal());
}
}
}
- public void flowIntoBlock(World world, int x, int y, int z, int meta, ItemStack metal) {
- if (meta < 0 || world.isRemote) return;
+ public void flowIntoBlock(World world, int x, int y, int z, int meta,
+ ItemStack metal) {
+ if (meta < 0 || world.isRemote)
+ return;
if (displaceIfPossible(world, x, y, z)) {
world.setBlock(x, y, z, this, meta, 3);
- if (getTileEntity(world, x, y, z) != null) getTileEntity(world, x, y, z).setMetal(metal);
+ if (getTileEntity(world, x, y, z) != null)
+ getTileEntity(world, x, y, z).setMetal(metal);
}
}
- public static TileEntityMoltenMetal getTileEntity(World world, int x, int y, int z) {
+ public static TileEntityMoltenMetal getTileEntity(World world, int x,
+ int y, int z) {
TileEntity moltenLiquid = world.getTileEntity(x, y, z);
- if (moltenLiquid != null && moltenLiquid instanceof TileEntityMoltenMetal) return (TileEntityMoltenMetal) moltenLiquid;
+ if (moltenLiquid != null
+ && moltenLiquid instanceof TileEntityMoltenMetal)
+ return (TileEntityMoltenMetal) moltenLiquid;
return null;
}
- public static boolean areMetalsEqual(World world, int x1, int y1, int z1, int x2, int y2, int z2) {
- return ItemStack.areItemStacksEqual(getTileEntity(world, x1, y1, z1).getMetal(), getTileEntity(world, x2, y2, z2).getMetal());
+ public static boolean areMetalsEqual(World world, int x1, int y1,
+ int z1, int x2, int y2, int z2) {
+ return ItemStack.areItemStacksEqual(
+ getTileEntity(world, x1, y1, z1).getMetal(),
+ getTileEntity(world, x2, y2, z2).getMetal());
}
@SideOnly(Side.CLIENT)
- public static int color(IBlockAccess world, int i, int j, int k, boolean forcecolor, Item itemC) throws IOException {
+ public static int color(IBlockAccess world, int i, int j, int k,
+ boolean forcecolor, Item itemC) throws IOException {
TileEntity te = world.getTileEntity(i, j, k);
- if (te instanceof TileEntityMoltenMetal && ((TileEntityMoltenMetal) te).getMetal() != null) return JewelrycraftUtil.getColor(((TileEntityMoltenMetal) te).getMetal().copy());
+ if (te instanceof TileEntityMoltenMetal
+ && ((TileEntityMoltenMetal) te).getMetal() != null)
+ return JewelrycraftUtil.getColor(
+ ((TileEntityMoltenMetal) te).getMetal().copy());
return 16777215;
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockShadow.java b/src/main/java/darkknight/jewelrycraft/block/BlockShadow.java index ae9ceaa..a311c1f 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockShadow.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockShadow.java @@ -14,180 +14,178 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
-public class BlockShadow extends BlockContainer
-{
- private IIcon[] iconArray;
-
- /**
- *
- */
- public BlockShadow()
- {
- super(Material.iron);
- setHarvestLevel("pickaxe", 3);
- setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
- }
-
- /**
- * @return
- */
- @Override
- public int getRenderBlockPass()
- {
- return 1;
- }
-
- /**
- * @param worldObj
- * @param x
- * @param y
- * @param z
- * @param beaconX
- * @param beaconY
- * @param beaconZ
- * @return
- */
- public boolean isBeaconBase(World worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ)
- {
- return true;
- }
-
- /**
- * @return
- */
- @Override
- public boolean isOpaqueCube()
- {
- return false;
- }
-
- /**
- * @return
- */
- @Override
- public boolean renderAsNormalBlock()
- {
- return false;
- }
-
- /**
- * @param world
- * @param x
- * @param y
- * @param z
- * @param side
- * @return
- */
- public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side)
- {
- return false;
- }
-
- /**
- * @param par0
- * @return
- */
- public static boolean isNormalCube(int par0)
- {
- return true;
- }
-
- /**
- * @param world
- * @param var2
- * @return
- */
- @Override
- public TileEntity createNewTileEntity(World world, int var2)
- {
- return new TileEntityBlockShadow();
- }
-
- /**
- * @param par1IconRegister
- */
- @Override
- public void registerBlockIcons(IIconRegister par1IconRegister)
- {
- iconArray = new IIcon[16];
- for(int i = 0; i < iconArray.length; ++i)
- iconArray[i] = par1IconRegister.registerIcon(getTextureName() + (15 - i));
- }
-
- /**
- * @param world
- * @param x
- * @param y
- * @param z
- * @return
- */
- @Override
- public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
- {
- if (world.getBlockMetadata(x, y, z) == 15) return null;
- return super.getCollisionBoundingBoxFromPool(world, x, y, z);
- }
-
- /**
- * @param par1IBlockAccess
- * @param par2
- * @param par3
- * @param par4
- */
- @Override
- public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
- {
- setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
- }
-
- /**
- * @param p_149646_1_
- * @param p_149646_2_
- * @param p_149646_3_
- * @param p_149646_4_
- * @param p_149646_5_
- * @return
- */
- @Override
- public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_)
- {
- Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
- if (this == BlockList.shadowBlock) if (block == this) return false;
- return block == this ? false : super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
- }
-
- /**
- * @return
- */
- @Override
- public boolean hasComparatorInputOverride()
- {
- return true;
- }
-
- /**
- * @param world
- * @param x
- * @param y
- * @param z
- * @param meta
- * @return
- */
- @Override
- public int getComparatorInputOverride(World world, int x, int y, int z, int meta)
- {
- return world.getBlockMetadata(x, y, z);
- }
-
- /**
- * @param side
- * @param meta
- * @return
- */
- @Override
- @SideOnly (Side.CLIENT)
- public IIcon getIcon(int side, int meta)
- {
- return (meta < 16) ? iconArray[meta] : iconArray[0];
- }
+public class BlockShadow extends BlockContainer {
+ private IIcon[] iconArray;
+
+ /**
+ *
+ */
+ public BlockShadow() {
+ super(Material.iron);
+ setHarvestLevel("pickaxe", 3);
+ setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public int getRenderBlockPass() {
+ return 1;
+ }
+
+ /**
+ * @param worldObj
+ * @param x
+ * @param y
+ * @param z
+ * @param beaconX
+ * @param beaconY
+ * @param beaconZ
+ * @return
+ */
+ public boolean isBeaconBase(World worldObj, int x, int y, int z,
+ int beaconX, int beaconY, int beaconZ) {
+ return true;
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param side
+ * @return
+ */
+ public boolean isBlockSolidOnSide(World world, int x, int y, int z,
+ ForgeDirection side) {
+ return false;
+ }
+
+ /**
+ * @param par0
+ * @return
+ */
+ public static boolean isNormalCube(int par0) {
+ return true;
+ }
+
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
+ @Override
+ public TileEntity createNewTileEntity(World world, int var2) {
+ return new TileEntityBlockShadow();
+ }
+
+ /**
+ * @param par1IconRegister
+ */
+ @Override
+ public void registerBlockIcons(IIconRegister par1IconRegister) {
+ iconArray = new IIcon[16];
+ for (int i = 0; i < iconArray.length; ++i)
+ iconArray[i] = par1IconRegister
+ .registerIcon(getTextureName() + (15 - i));
+ }
+
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @return
+ */
+ @Override
+ public AxisAlignedBB getCollisionBoundingBoxFromPool(World world,
+ int x, int y, int z) {
+ if (world.getBlockMetadata(x, y, z) == 15)
+ return null;
+ return super.getCollisionBoundingBoxFromPool(world, x, y, z);
+ }
+
+ /**
+ * @param par1IBlockAccess
+ * @param par2
+ * @param par3
+ * @param par4
+ */
+ @Override
+ public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess,
+ int par2, int par3, int par4) {
+ setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ }
+
+ /**
+ * @param p_149646_1_
+ * @param p_149646_2_
+ * @param p_149646_3_
+ * @param p_149646_4_
+ * @param p_149646_5_
+ * @return
+ */
+ @Override
+ public boolean shouldSideBeRendered(IBlockAccess p_149646_1_,
+ int p_149646_2_, int p_149646_3_, int p_149646_4_,
+ int p_149646_5_) {
+ Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_,
+ p_149646_4_);
+ if (this == BlockList.shadowBlock)
+ if (block == this)
+ return false;
+ return block == this ? false
+ : super.shouldSideBeRendered(p_149646_1_, p_149646_2_,
+ p_149646_3_, p_149646_4_, p_149646_5_);
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public boolean hasComparatorInputOverride() {
+ return true;
+ }
+
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param meta
+ * @return
+ */
+ @Override
+ public int getComparatorInputOverride(World world, int x, int y, int z,
+ int meta) {
+ return world.getBlockMetadata(x, y, z);
+ }
+
+ /**
+ * @param side
+ * @param meta
+ * @return
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(int side, int meta) {
+ return (meta < 16) ? iconArray[meta] : iconArray[0];
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockShadowEye.java b/src/main/java/darkknight/jewelrycraft/block/BlockShadowEye.java index 7a2277e..85c552d 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockShadowEye.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockShadowEye.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.block;
import java.util.Random;
+
import darkknight.jewelrycraft.tileentity.TileEntityShadowEye;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -13,123 +14,121 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-public class BlockShadowEye extends BlockContainer
-{
- Random rand = new Random();
-
- protected BlockShadowEye()
- {
- super(Material.rock);
- }
-
- /**
- * @param world
- * @param var2
- * @return
- */
- @Override
- public TileEntity createNewTileEntity(World world, int var2)
- {
- return new TileEntityShadowEye();
- }
-
- /**
- * @return
- */
- @Override
- public boolean renderAsNormalBlock()
- {
- return false;
- }
-
- /**
- * @param iblockaccess
- * @param i
- * @param j
- * @param k
- * @param l
- * @return
- */
- @Override
- public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
- {
- return false;
- }
-
- /**
- * @return
- */
- @Override
- public boolean isOpaqueCube()
- {
- return false;
- }
-
- /**
- * @return
- */
- @Override
- public int getRenderType()
- {
- return -1;
- }
-
- /**
- * @param world
- * @param i
- * @param j
- * @param k
- * @param entityPlayer
- * @param par6
- * @param par7
- * @param par8
- * @param par9
- * @return
- */
- @Override
- public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
- {
- TileEntityShadowEye tile = (TileEntityShadowEye)world.getTileEntity(i, j, k);
- if (!tile.active && tile.opening == 1){
- tile.active = true;
- tile.target = entityPlayer;
- tile.shouldAddData = true;
- }
- return true;
- }
-
- /**
- * @param world
- * @param i
- * @param j
- * @param k
- * @param player
- */
- @Override
- public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
- {}
-
- /**
- * @param world
- * @param i
- * @param j
- * @param k
- * @param entityLiving
- * @param par6ItemStack
- */
- @Override
- public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
- {
- int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
- world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
- }
-
- /**
- * @param icon
- */
- @Override
- public void registerBlockIcons(IIconRegister icon)
- {
- blockIcon = icon.registerIcon("minecraft:stonebrick");
- }
+public class BlockShadowEye extends BlockContainer {
+ Random rand = new Random();
+
+ protected BlockShadowEye() {
+ super(Material.rock);
+ }
+
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
+ @Override
+ public TileEntity createNewTileEntity(World world, int var2) {
+ return new TileEntityShadowEye();
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ /**
+ * @param iblockaccess
+ * @param i
+ * @param j
+ * @param k
+ * @param l
+ * @return
+ */
+ @Override
+ public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i,
+ int j, int k, int l) {
+ return false;
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public int getRenderType() {
+ return -1;
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityPlayer
+ * @param par6
+ * @param par7
+ * @param par8
+ * @param par9
+ * @return
+ */
+ @Override
+ public boolean onBlockActivated(World world, int i, int j, int k,
+ EntityPlayer entityPlayer, int par6, float par7, float par8,
+ float par9) {
+ TileEntityShadowEye tile =
+ (TileEntityShadowEye) world.getTileEntity(i, j, k);
+ if (!tile.active && tile.opening == 1) {
+ tile.active = true;
+ tile.target = entityPlayer;
+ tile.shouldAddData = true;
+ }
+ return true;
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param player
+ */
+ @Override
+ public void onBlockClicked(World world, int i, int j, int k,
+ EntityPlayer player) {
+ // Do nothing
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityLiving
+ * @param par6ItemStack
+ */
+ @Override
+ public void onBlockPlacedBy(World world, int i, int j, int k,
+ EntityLivingBase entityLiving, ItemStack par6ItemStack) {
+ int rotation = MathHelper.floor_double(
+ entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
+ world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
+ }
+
+ /**
+ * @param icon
+ */
+ @Override
+ public void registerBlockIcons(IIconRegister icon) {
+ blockIcon = icon.registerIcon("minecraft:stonebrick");
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockShadowHand.java b/src/main/java/darkknight/jewelrycraft/block/BlockShadowHand.java index bd33536..6d4cee1 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockShadowHand.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockShadowHand.java @@ -13,127 +13,124 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-public class BlockShadowHand extends BlockContainer
-{
- /**
- * @param material
- */
- protected BlockShadowHand(Material material)
- {
- super(material);
- setBlockBounds(0.2F, 0F, 0.2F, 0.8F, 1.0F, 0.8F);
- }
-
- /**
- * @param world
- * @param var2
- * @return
- */
- @Override
- public TileEntity createNewTileEntity(World world, int var2)
- {
- return new TileEntityShadowHand();
- }
-
- /**
- * @return
- */
- @Override
- public boolean renderAsNormalBlock()
- {
- return false;
- }
-
- /**
- * @param iblockaccess
- * @param i
- * @param j
- * @param k
- * @param l
- * @return
- */
- @Override
- public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
- {
- return false;
- }
-
- /**
- * @return
- */
- @Override
- public boolean isOpaqueCube()
- {
- return false;
- }
-
- /**
- * @return
- */
- @Override
- public int getRenderType()
- {
- return -1;
- }
-
- /**
- * @param world
- * @param x
- * @param y
- * @param z
- * @param stack
- */
- public void dropItem(World world, double x, double y, double z, ItemStack stack)
- {
- EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.5D, z + 0.5D, stack);
- entityitem.motionX = 0;
- entityitem.motionZ = 0;
- entityitem.motionY = 0.11000000298023224D;
- world.spawnEntityInWorld(entityitem);
- }
-
- /**
- * @param world
- * @param i
- * @param j
- * @param k
- * @param block
- * @param par6
- */
- @Override
- public void breakBlock(World world, int i, int j, int k, Block block, int par6)
- {
- if (world.getTileEntity(i, j, k) instanceof TileEntityShadowHand){
- TileEntityShadowHand te = (TileEntityShadowHand)world.getTileEntity(i, j, k);
- if (te != null && te.getHeldItemStack() != null){
- dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.getHeldItemStack());
- world.removeTileEntity(i, j, k);
- }
- }
- super.breakBlock(world, i, j, k, block, par6);
- }
-
- /**
- * @param world
- * @param i
- * @param j
- * @param k
- * @param entityLiving
- * @param par6ItemStack
- */
- @Override
- public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
- {
- int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 8.0F / 360.0F + 0.5D) & 7;
- world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
- }
-
- /**
- * @param icon
- */
- @Override
- public void registerBlockIcons(IIconRegister icon)
- {
- blockIcon = icon.registerIcon("minecraft:coal_block");
- }
+public class BlockShadowHand extends BlockContainer {
+ /**
+ * @param material
+ */
+ protected BlockShadowHand(Material material) {
+ super(material);
+ setBlockBounds(0.2F, 0F, 0.2F, 0.8F, 1.0F, 0.8F);
+ }
+
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
+ @Override
+ public TileEntity createNewTileEntity(World world, int var2) {
+ return new TileEntityShadowHand();
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ /**
+ * @param iblockaccess
+ * @param i
+ * @param j
+ * @param k
+ * @param l
+ * @return
+ */
+ @Override
+ public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i,
+ int j, int k, int l) {
+ return false;
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public int getRenderType() {
+ return -1;
+ }
+
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param stack
+ */
+ public void dropItem(World world, double x, double y, double z,
+ ItemStack stack) {
+ EntityItem entityitem =
+ new EntityItem(world, x + 0.5D, y + 1.5D, z + 0.5D, stack);
+ entityitem.motionX = 0;
+ entityitem.motionZ = 0;
+ entityitem.motionY = 0.11000000298023224D;
+ world.spawnEntityInWorld(entityitem);
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param block
+ * @param par6
+ */
+ @Override
+ public void breakBlock(World world, int i, int j, int k, Block block,
+ int par6) {
+ if (world.getTileEntity(i, j, k) instanceof TileEntityShadowHand) {
+ TileEntityShadowHand te =
+ (TileEntityShadowHand) world.getTileEntity(i, j, k);
+ if (te != null && te.getHeldItemStack() != null) {
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord,
+ te.getHeldItemStack());
+ world.removeTileEntity(i, j, k);
+ }
+ }
+ super.breakBlock(world, i, j, k, block, par6);
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityLiving
+ * @param par6ItemStack
+ */
+ @Override
+ public void onBlockPlacedBy(World world, int i, int j, int k,
+ EntityLivingBase entityLiving, ItemStack par6ItemStack) {
+ int rotation = MathHelper.floor_double(
+ entityLiving.rotationYaw * 8.0F / 360.0F + 0.5D) & 7;
+ world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
+ }
+
+ /**
+ * @param icon
+ */
+ @Override
+ public void registerBlockIcons(IIconRegister icon) {
+ blockIcon = icon.registerIcon("minecraft:coal_block");
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java b/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java index db8e254..ea5e991 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.block;
import java.util.Random;
+
import darkknight.jewelrycraft.config.ConfigHandler;
import darkknight.jewelrycraft.item.ItemList;
import darkknight.jewelrycraft.item.ItemMoltenMetalBucket;
@@ -44,8 +45,10 @@ public class BlockSmelter extends BlockContainer { return false;
}
- public void dropItem(World world, double x, double y, double z, ItemStack stack) {
- EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.3D, z + 0.5D, stack);
+ public void dropItem(World world, double x, double y, double z,
+ ItemStack stack) {
+ EntityItem entityitem =
+ new EntityItem(world, x + 0.5D, y + 1.3D, z + 0.5D, stack);
entityitem.motionX = 0;
entityitem.motionZ = 0;
entityitem.motionY = 0.11000000298023224D;
@@ -54,17 +57,23 @@ public class BlockSmelter extends BlockContainer { }
@Override
- public void breakBlock(World world, int i, int j, int k, Block block, int meta) {
- TileEntitySmelter te = (TileEntitySmelter) world.getTileEntity(i, j, k);
+ public void breakBlock(World world, int i, int j, int k, Block block,
+ int meta) {
+ TileEntitySmelter te =
+ (TileEntitySmelter) world.getTileEntity(i, j, k);
if (te != null) {
- if (te.hasMetal) dropItem(world, i, j, k, te.metal.copy());
- if (te.hasMoltenMetal && te.moltenMetal != null && Item.getIdFromItem(te.moltenMetal.getItem()) > 0) {
+ if (te.hasMetal)
+ dropItem(world, i, j, k, te.metal.copy());
+ if (te.hasMoltenMetal && te.moltenMetal != null
+ && Item.getIdFromItem(te.moltenMetal.getItem()) > 0) {
int quant = (int) (te.quantity * 10);
ItemStack metalBucket = new ItemStack(ItemList.bucket);
JewelryNBT.addMetal(metalBucket, te.moltenMetal.copy());
if (quant == 9) {
- dropItem(world, i, j, k, new ItemStack(Blocks.cobblestone, 6));
- dropItem(world, i, j, k, new ItemStack(Items.lava_bucket));
+ dropItem(world, i, j, k,
+ new ItemStack(Blocks.cobblestone, 6));
+ dropItem(world, i, j, k,
+ new ItemStack(Items.lava_bucket));
dropItem(world, i, j, k, metalBucket);
}
}
@@ -73,10 +82,15 @@ public class BlockSmelter extends BlockContainer { }
@Override
- public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) {
- TileEntitySmelter te = (TileEntitySmelter) world.getTileEntity(i, j, k);
+ public boolean onBlockActivated(World world, int i, int j, int k,
+ EntityPlayer entityPlayer, int par6, float par7, float par8,
+ float par9) {
+ TileEntitySmelter te =
+ (TileEntitySmelter) world.getTileEntity(i, j, k);
ItemStack item = entityPlayer.inventory.getCurrentItem();
- if (te != null && te.hasMoltenMetal && te.quantity >= .9f && !te.pouring && item != null && item.getItem() == Items.bucket) {
+ if (te != null && te.hasMoltenMetal && te.quantity >= .9f
+ && !te.pouring && item != null
+ && item.getItem() == Items.bucket) {
te.quantity = 0f;
te.hasMoltenMetal = false;
ItemStack metalBucket = new ItemStack(ItemList.bucket, 1);
@@ -89,58 +103,151 @@ public class BlockSmelter extends BlockContainer { }
if (te != null && !world.isRemote) {
if (te.hasMetal && entityPlayer.isSneaking()) {
- dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.metal.copy());
+ dropItem(world, te.xCoord, te.yCoord, te.zCoord,
+ te.metal.copy());
te.hasMetal = false;
te.melting = -1;
te.isDirty = true;
}
- if (item != null && item.getItem() != null && !(item.getItem() instanceof ItemMoltenMetalBucket)) {
+ if (item != null && item.getItem() != null && !(item
+ .getItem() instanceof ItemMoltenMetalBucket)) {
int index = -1;
- for (int a = 0; a < JewelrycraftUtil.jamcraftPlayers.size(); a++)
- if (entityPlayer.getUniqueID().toString().equals(JewelrycraftUtil.jamcraftPlayers.get(a))) index = a;
- if (entityPlayer.capabilities.isCreativeMode) index = 1;
- boolean canPlace = item != null && (JewelrycraftUtil.isMetal(item) || JewelrycraftUtil.isOre(item) || index >= 0 || JewelryNBT.ingot(item) != null);
- boolean isOre = false, oreCoincidesWithMetal = false, itemCoincidesWithMetal = false, itemCoincidesWithMoltenMetal = false, overflow = false;
+ for (int a = 0;
+ a < JewelrycraftUtil.jamcraftPlayers.size(); a++)
+ if (entityPlayer.getUniqueID().toString().equals(
+ JewelrycraftUtil.jamcraftPlayers.get(a)))
+ index = a;
+ if (entityPlayer.capabilities.isCreativeMode)
+ index = 1;
+ boolean canPlace = JewelrycraftUtil.isMetal(item)
+ || JewelrycraftUtil.isOre(item) || index >= 0
+ || JewelryNBT.ingot(item) != null;
+ boolean isOre = false, oreCoincidesWithMetal = false,
+ itemCoincidesWithMetal = false,
+ itemCoincidesWithMoltenMetal = false,
+ overflow = false;
isOre = JewelrycraftUtil.isOre(item);
if (te.metal != null && te.metal.getItem() != null) {
- if (JewelryNBT.ingot(item) == null) itemCoincidesWithMetal = item.getItem().equals(te.metal.getItem()) && item.getItemDamage() == te.metal.getItemDamage();
- else itemCoincidesWithMetal = item.getItem().equals(te.metal.getItem()) && item.getItemDamage() == te.metal.getItemDamage() && JewelryNBT.ingot(item).getItem().equals(JewelryNBT.ingot(te.metal).getItem()) && JewelryNBT.ingot(item).getItemDamage() == JewelryNBT.ingot(te.metal).getItemDamage();
+ if (JewelryNBT.ingot(item) == null)
+ itemCoincidesWithMetal =
+ item.getItem().equals(te.metal.getItem())
+ && item.getItemDamage() == te.metal
+ .getItemDamage();
+ else
+ itemCoincidesWithMetal =
+ item.getItem().equals(te.metal.getItem())
+ && item.getItemDamage() == te.metal
+ .getItemDamage()
+ && JewelryNBT.ingot(item).getItem()
+ .equals(JewelryNBT
+ .ingot(te.metal)
+ .getItem())
+ && JewelryNBT.ingot(item)
+ .getItemDamage() == JewelryNBT
+ .ingot(te.metal)
+ .getItemDamage();
}
- if (te.moltenMetal != null && te.moltenMetal.getItem() != null) {
- if (JewelryNBT.ingot(item) == null) itemCoincidesWithMoltenMetal = item.getItem().equals(te.moltenMetal.getItem()) && item.getItemDamage() == te.moltenMetal.getItemDamage();
- else itemCoincidesWithMoltenMetal = JewelryNBT.ingot(item).getItem().equals(te.moltenMetal.getItem()) && JewelryNBT.ingot(item).getItemDamage() == te.moltenMetal.getItemDamage();
- if (isOre) oreCoincidesWithMetal = te.moltenMetal.getItem().equals(JewelrycraftUtil.getIngotFromOre(item).getItem()) && te.moltenMetal.getItemDamage() == JewelrycraftUtil.getIngotFromOre(item).getItemDamage();
+ if (te.moltenMetal != null
+ && te.moltenMetal.getItem() != null) {
+ if (JewelryNBT.ingot(item) == null)
+ itemCoincidesWithMoltenMetal = item.getItem()
+ .equals(te.moltenMetal.getItem())
+ && item.getItemDamage() == te.moltenMetal
+ .getItemDamage();
+ else
+ itemCoincidesWithMoltenMetal =
+ JewelryNBT.ingot(item).getItem()
+ .equals(te.moltenMetal.getItem())
+ && JewelryNBT.ingot(item)
+ .getItemDamage() == te.moltenMetal
+ .getItemDamage();
+ if (isOre)
+ oreCoincidesWithMetal = te.moltenMetal.getItem()
+ .equals(JewelrycraftUtil
+ .getIngotFromOre(item).getItem())
+ && te.moltenMetal
+ .getItemDamage() == JewelrycraftUtil
+ .getIngotFromOre(item)
+ .getItemDamage();
}
- overflow = isOre ? te.metal.stackSize * 0.2f + te.quantity < 0.8f : te.metal.stackSize * 0.1f + te.quantity < 0.9f;
- boolean isValid = te.hasMoltenMetal ? isOre ? oreCoincidesWithMetal : itemCoincidesWithMoltenMetal : true;
- if (te.quantity < 0.9f && !te.pouring && canPlace && isValid) {
- boolean check = isOre ? oreCoincidesWithMetal && te.quantity < 0.8f : itemCoincidesWithMoltenMetal;
- boolean check2 = isOre ? oreCoincidesWithMetal : itemCoincidesWithMetal;
- if (!te.hasMetal && !te.hasMoltenMetal || !te.hasMetal && te.hasMoltenMetal && check) {
- entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage." + Variables.MODID + ".smelter.nowsmeltingingot", item.getDisplayName())));
+ overflow = isOre
+ ? te.metal.stackSize * 0.2f + te.quantity < 0.8f
+ : te.metal.stackSize * 0.1f + te.quantity < 0.9f;
+ boolean isValid =
+ te.hasMoltenMetal
+ ? isOre ? oreCoincidesWithMetal
+ : itemCoincidesWithMoltenMetal
+ : true;
+ if (te.quantity < 0.9f && !te.pouring && canPlace
+ && isValid) {
+ boolean check = isOre
+ ? oreCoincidesWithMetal && te.quantity < 0.8f
+ : itemCoincidesWithMoltenMetal;
+ boolean check2 = isOre ? oreCoincidesWithMetal
+ : itemCoincidesWithMetal;
+ if (!te.hasMetal && !te.hasMoltenMetal || !te.hasMetal
+ && te.hasMoltenMetal && check) {
+ entityPlayer.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocalFormatted(
+ "chatmessage." + Variables.MODID
+ + ".smelter.nowsmeltingingot",
+ item.getDisplayName())));
te.metal = item.copy();
te.metal.stackSize = 1;
te.hasMetal = true;
te.melting = ConfigHandler.INGOT_MELTING_TIME;
- if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
+ if (!entityPlayer.capabilities.isCreativeMode)
+ --item.stackSize;
te.isDirty = true;
- }
- else if (te.hasMetal && te.hasMoltenMetal && check2 && overflow || te.hasMetal && !te.hasMoltenMetal && itemCoincidesWithMetal && overflow) {
- entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("Smelting extra " + (isOre ? "ores" : "ingots") + " (" + (te.metal.stackSize + 1) + ")")));
+ } else if (te.hasMetal && te.hasMoltenMetal && check2
+ && overflow
+ || te.hasMetal && !te.hasMoltenMetal
+ && itemCoincidesWithMetal
+ && overflow) {
+ entityPlayer.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocalFormatted(
+ "Smelting extra "
+ + (isOre ? "ores"
+ : "ingots")
+ + " ("
+ + (te.metal.stackSize + 1)
+ + ")")));
te.metal.stackSize++;
te.hasMetal = true;
te.melting += ConfigHandler.INGOT_MELTING_TIME;
- if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
+ if (!entityPlayer.capabilities.isCreativeMode)
+ --item.stackSize;
te.isDirty = true;
}
te.isDirty = true;
- }
- else if (item != null && (te.hasMetal || te.hasMoltenMetal) && !itemCoincidesWithMoltenMetal && te.quantity < .9f) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.contentdoesnotmatch")));
- else if (item != null && !item.getUnlocalizedName().toLowerCase().contains("ingot") && item.getDisplayName().toLowerCase().contains("ingot") && te.quantity < .9f) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.itemrenamedtoingot")));
- else if (item != null && te.quantity >= .9f) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.full")));
- else entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.cannotsmelt")));
- }
- else if (item != null && item.getItem() != null && item.getItem() instanceof ItemMoltenMetalBucket && !te.hasMoltenMetal && !te.hasMetal) {
+ } else if ((te.hasMetal || te.hasMoltenMetal)
+ && !itemCoincidesWithMoltenMetal
+ && te.quantity < .9f)
+ entityPlayer.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal("chatmessage."
+ + Variables.MODID
+ + ".smelter.contentdoesnotmatch")));
+ else if (!item.getUnlocalizedName().toLowerCase()
+ .contains("ingot")
+ && item.getDisplayName().toLowerCase()
+ .contains("ingot")
+ && te.quantity < .9f)
+ entityPlayer.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal("chatmessage."
+ + Variables.MODID
+ + ".smelter.itemrenamedtoingot")));
+ else if (te.quantity >= .9f)
+ entityPlayer.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal("chatmessage."
+ + Variables.MODID + ".smelter.full")));
+ else
+ entityPlayer.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal(
+ "chatmessage." + Variables.MODID
+ + ".smelter.cannotsmelt")));
+ } else if (item != null && item.getItem() != null
+ && item.getItem() instanceof ItemMoltenMetalBucket
+ && !te.hasMoltenMetal && !te.hasMetal) {
te.hasMoltenMetal = true;
ItemStack ingot = JewelryNBT.ingot(item);
te.moltenMetal = ingot;
@@ -148,52 +255,119 @@ public class BlockSmelter extends BlockContainer { te.isDirty = true;
if (!entityPlayer.capabilities.isCreativeMode) {
--item.stackSize;
- dropItem(world, entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, new ItemStack(Items.bucket));
+ dropItem(world, entityPlayer.posX, entityPlayer.posY,
+ entityPlayer.posZ,
+ new ItemStack(Items.bucket));
}
- }
- else if (item == null && te.hasMoltenMetal && te.moltenMetal.getItem() != null) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage." + Variables.MODID + ".smelter.hasmolteningot", te.moltenMetal.getDisplayName().replace(" Ingot", ""))));
+ } else if (item == null && te.hasMoltenMetal
+ && te.moltenMetal.getItem() != null)
+ entityPlayer.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocalFormatted(
+ "chatmessage." + Variables.MODID
+ + ".smelter.hasmolteningot",
+ te.moltenMetal.getDisplayName()
+ .replace(" Ingot", ""))));
world.setTileEntity(i, j, k, te);
}
return true;
}
@Override
- public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) {
- TileEntitySmelter te = (TileEntitySmelter) world.getTileEntity(i, j, k);
+ public void onBlockClicked(World world, int i, int j, int k,
+ EntityPlayer player) {
+ TileEntitySmelter te =
+ (TileEntitySmelter) world.getTileEntity(i, j, k);
TileEntityMolder me = null;
- if (world.getBlockMetadata(i, j, k) == 0 && world.getTileEntity(i, j, k - 1) != null && world.getTileEntity(i, j, k - 1) instanceof TileEntityMolder) me = (TileEntityMolder) world.getTileEntity(i, j, k - 1);
- else if (world.getBlockMetadata(i, j, k) == 1 && world.getTileEntity(i + 1, j, k) != null && world.getTileEntity(i + 1, j, k) instanceof TileEntityMolder) me = (TileEntityMolder) world.getTileEntity(i + 1, j, k);
- else if (world.getBlockMetadata(i, j, k) == 2 && world.getTileEntity(i, j, k + 1) != null && world.getTileEntity(i, j, k + 1) instanceof TileEntityMolder) me = (TileEntityMolder) world.getTileEntity(i, j, k + 1);
- else if (world.getBlockMetadata(i, j, k) == 3 && world.getTileEntity(i - 1, j, k) != null && world.getTileEntity(i - 1, j, k) instanceof TileEntityMolder) me = (TileEntityMolder) world.getTileEntity(i - 1, j, k);
- if (te != null && me != null && !world.isRemote) if (te.hasMoltenMetal && isConnectedToMolder(world, i, j, k) && me != null && me.hasMold && !me.hasMoltenMetal && !me.hasJewelBase) {
- te.pouring = true;
- te.isDirty = true;
- }
- else if (te.hasMetal && te.melting > 0) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage." + Variables.MODID + ".smelter.metalismelting", te.metal.getDisplayName()) + " (" + (ConfigHandler.INGOT_MELTING_TIME * te.metal.stackSize - te.melting) * 100 / (ConfigHandler.INGOT_MELTING_TIME * te.metal.stackSize) + "%)"));
- else if (te.hasMoltenMetal && !isConnectedToMolder(world, i, j, k)) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.molderismissing")));
- else if (!me.hasMold && te.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.molderhasnomold")));
- else if (me.hasMoltenMetal && te.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.molderhasmoltenmetal")));
- else if (me.hasJewelBase && te.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.modlerhasitem")));
- else player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.empty")));
+ if (world.getBlockMetadata(i, j, k) == 0
+ && world.getTileEntity(i, j, k - 1) != null
+ && world.getTileEntity(i, j,
+ k - 1) instanceof TileEntityMolder)
+ me = (TileEntityMolder) world.getTileEntity(i, j, k - 1);
+ else if (world.getBlockMetadata(i, j, k) == 1
+ && world.getTileEntity(i + 1, j, k) != null
+ && world.getTileEntity(i + 1, j,
+ k) instanceof TileEntityMolder)
+ me = (TileEntityMolder) world.getTileEntity(i + 1, j, k);
+ else if (world.getBlockMetadata(i, j, k) == 2
+ && world.getTileEntity(i, j, k + 1) != null
+ && world.getTileEntity(i, j,
+ k + 1) instanceof TileEntityMolder)
+ me = (TileEntityMolder) world.getTileEntity(i, j, k + 1);
+ else if (world.getBlockMetadata(i, j, k) == 3
+ && world.getTileEntity(i - 1, j, k) != null
+ && world.getTileEntity(i - 1, j,
+ k) instanceof TileEntityMolder)
+ me = (TileEntityMolder) world.getTileEntity(i - 1, j, k);
+ if (te != null && me != null && !world.isRemote)
+ if (te.hasMoltenMetal && isConnectedToMolder(world, i, j, k)
+ && me.hasMold && !me.hasMoltenMetal
+ && !me.hasJewelBase) {
+ te.pouring = true;
+ te.isDirty = true;
+ } else if (te.hasMetal && te.melting > 0)
+ player.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocalFormatted(
+ "chatmessage." + Variables.MODID
+ + ".smelter.metalismelting",
+ te.metal.getDisplayName())
+ + " ("
+ + (ConfigHandler.INGOT_MELTING_TIME
+ * te.metal.stackSize - te.melting)
+ * 100
+ / (ConfigHandler.INGOT_MELTING_TIME
+ * te.metal.stackSize)
+ + "%)"));
+ else if (te.hasMoltenMetal
+ && !isConnectedToMolder(world, i, j, k))
+ player.addChatMessage(new ChatComponentText(StatCollector
+ .translateToLocal("chatmessage." + Variables.MODID
+ + ".smelter.molderismissing")));
+ else if (!me.hasMold && te.hasMoltenMetal)
+ player.addChatMessage(new ChatComponentText(StatCollector
+ .translateToLocal("chatmessage." + Variables.MODID
+ + ".smelter.molderhasnomold")));
+ else if (me.hasMoltenMetal && te.hasMoltenMetal)
+ player.addChatMessage(new ChatComponentText(StatCollector
+ .translateToLocal("chatmessage." + Variables.MODID
+ + ".smelter.molderhasmoltenmetal")));
+ else if (me.hasJewelBase && te.hasMoltenMetal)
+ player.addChatMessage(new ChatComponentText(StatCollector
+ .translateToLocal("chatmessage." + Variables.MODID
+ + ".smelter.modlerhasitem")));
+ else
+ player.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal("chatmessage."
+ + Variables.MODID + ".smelter.empty")));
}
public boolean isConnectedToMolder(World world, int i, int j, int k) {
int blockMeta = world.getBlockMetadata(i, j, k);
- if (blockMeta == 0 && world.getBlock(i, j, k - 1) instanceof BlockMolder) return true;
- else if (blockMeta == 1 && world.getBlock(i + 1, j, k) instanceof BlockMolder) return true;
- else if (blockMeta == 2 && world.getBlock(i, j, k + 1) instanceof BlockMolder) return true;
- else if (blockMeta == 3 && world.getBlock(i - 1, j, k) instanceof BlockMolder) return true;
+ if (blockMeta == 0
+ && world.getBlock(i, j, k - 1) instanceof BlockMolder)
+ return true;
+ else if (blockMeta == 1
+ && world.getBlock(i + 1, j, k) instanceof BlockMolder)
+ return true;
+ else if (blockMeta == 2
+ && world.getBlock(i, j, k + 1) instanceof BlockMolder)
+ return true;
+ else if (blockMeta == 3
+ && world.getBlock(i - 1, j, k) instanceof BlockMolder)
+ return true;
return false;
}
@Override
- public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack) {
- int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
+ public void onBlockPlacedBy(World world, int i, int j, int k,
+ EntityLivingBase entityLiving, ItemStack par6ItemStack) {
+ int rotation = MathHelper.floor_double(
+ entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
@Override
- public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i,
+ int j, int k, int l) {
return false;
}
@@ -206,10 +380,9 @@ public class BlockSmelter extends BlockContainer { public int getRenderType() {
return -1;
}
-
- @Override
- public void registerBlockIcons(IIconRegister icon)
- {
- blockIcon = icon.registerIcon("minecraft:iron_block");
- }
+
+ @Override
+ public void registerBlockIcons(IIconRegister icon) {
+ blockIcon = icon.registerIcon("minecraft:iron_block");
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/render/BlockCrystalRenderer.java b/src/main/java/darkknight/jewelrycraft/block/render/BlockCrystalRenderer.java index a571927..a60c8cc 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/block/render/BlockCrystalRenderer.java +++ b/src/main/java/darkknight/jewelrycraft/block/render/BlockCrystalRenderer.java @@ -4,7 +4,9 @@ package darkknight.jewelrycraft.block.render;
import java.util.Random;
+
import org.lwjgl.opengl.GL11;
+
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -24,12 +26,14 @@ import net.minecraft.world.IBlockAccess; @SideOnly(Side.CLIENT)
public class BlockCrystalRenderer implements ISimpleBlockRenderingHandler {
@Override
- public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
+ public void renderInventoryBlock(Block block, int metadata,
+ int modelID, RenderBlocks renderer) {
Tessellator tessellator = Tessellator.instance;
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
tessellator.startDrawingQuads();
- if (metadata < 16) tessellator.setColorRGBA_I(((BlockCrystal) block).colors[metadata], 100);
+ if (metadata < 16)
+ tessellator.setColorRGBA_I(BlockCrystal.colors[metadata], 100);
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
this.renderWorldBlock(null, 0, 0, 0, block, modelID, renderer);
tessellator.draw();
@@ -39,7 +43,8 @@ public class BlockCrystalRenderer implements ISimpleBlockRenderingHandler { }
@Override
- public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y,
+ int z, Block block, int modelId, RenderBlocks renderer) {
int crystals = 5;
Random rnd = new Random();
Tessellator tessellator = Tessellator.instance;
@@ -49,84 +54,149 @@ public class BlockCrystalRenderer implements ISimpleBlockRenderingHandler { double umax = icon.getMaxU();
double vmax = icon.getMaxV();
tessellator.addTranslation(x, y, z);
- if (world != null && world.getTileEntity(x, y, z) != null && ConfigHandler.CRYSTAL_GLOW) tessellator.setBrightness(((TileEntityCrystal) world.getTileEntity(x, y, z)).shine);
- else tessellator.setBrightness(230);
+ if (world != null && world.getTileEntity(x, y, z) != null
+ && ConfigHandler.CRYSTAL_GLOW)
+ tessellator.setBrightness(((TileEntityCrystal) world
+ .getTileEntity(x, y, z)).shine);
+ else
+ tessellator.setBrightness(230);
// 37435, 76464
- if (world != null) rnd.setSeed(2 * x * 3 * y * z * 5);
- else rnd.setSeed(76464);
- if (world != null && world.getBlockMetadata(x, y, z) < 16) tessellator.setColorRGBA_I(((BlockCrystal) block).colors[world.getBlockMetadata(x, y, z)], 100);
- crystal(tessellator, umin, vmin, umax, vmax, 0.8D, 0.2D, 0D, 0D, 0D, 0.0D, 0.0D);
+ if (world != null)
+ rnd.setSeed(2 * x * 3 * y * z * 5);
+ else
+ rnd.setSeed(76464);
+ if (world != null && world.getBlockMetadata(x, y, z) < 16)
+ tessellator.setColorRGBA_I(
+ BlockCrystal.colors[world.getBlockMetadata(x, y, z)],
+ 100);
+ crystal(tessellator, umin, vmin, umax, vmax, 0.8D, 0.2D, 0D, 0D,
+ 0D, 0.0D, 0.0D);
for (int i = 0; i < crystals; i++) {
- double rotation = Math.PI * 2.0f / (float) crystals * (float) i;
- double xp1 = Math.sin(rotation) * ((0.15F + rnd.nextFloat()) / 2f);
- double zp1 = Math.cos(rotation) * ((0.15F + rnd.nextFloat()) / 2f);
+ double rotation = Math.PI * 2.0f / crystals * i;
+ double xp1 =
+ Math.sin(rotation) * ((0.15F + rnd.nextFloat()) / 2f);
+ double zp1 =
+ Math.cos(rotation) * ((0.15F + rnd.nextFloat()) / 2f);
double height = 0.2f + rnd.nextFloat();
double topHeight = 0.1f + rnd.nextFloat() / 2f;
- crystal(tessellator, umin, vmin, umax, vmax, height, topHeight, -xp1, 0D, zp1, xp1, zp1);
+ crystal(tessellator, umin, vmin, umax, vmax, height, topHeight,
+ -xp1, 0D, zp1, xp1, zp1);
}
if (world != null) {
crystals = 4;
for (int i = 0; i < crystals; i++) {
- double rotation = Math.PI * 2F / (float) crystals * (float) i;
- double xp1 = Math.sin(rotation) * ((0.15F + rnd.nextFloat()) / 2f);
- double zp1 = Math.cos(rotation) * ((0.15F + rnd.nextFloat()) / 2f);
+ double rotation = Math.PI * 2F / crystals * i;
+ double xp1 = Math.sin(rotation)
+ * ((0.15F + rnd.nextFloat()) / 2f);
+ double zp1 = Math.cos(rotation)
+ * ((0.15F + rnd.nextFloat()) / 2f);
double height = 0.1f + rnd.nextFloat();
double topHeight = 0.1f + rnd.nextFloat() / 2f;
- float xOff = (rnd.nextFloat() * 1.5f - 0.5f) * (rnd.nextFloat() / 2f);
- float zOff = (rnd.nextFloat() * 1.5f - 0.5f) * (rnd.nextFloat() / 2f);
- crystal(tessellator, umin, vmin, umax, vmax, height, topHeight, xOff, 0D, zOff, xp1, zp1);
+ float xOff = (rnd.nextFloat() * 1.5f - 0.5f)
+ * (rnd.nextFloat() / 2f);
+ float zOff = (rnd.nextFloat() * 1.5f - 0.5f)
+ * (rnd.nextFloat() / 2f);
+ crystal(tessellator, umin, vmin, umax, vmax, height,
+ topHeight, xOff, 0D, zOff, xp1, zp1);
}
}
tessellator.addTranslation(-x, -y, -z);
return true;
}
- private void crystal(Tessellator tessellator, double umin, double vmin, double umax, double vmax, double height, double topHeight, double posX, double posY, double posZ, double rotX, double rotZ) {
+ private static void crystal(Tessellator tessellator, double umin,
+ double vmin, double umax, double vmax, double height,
+ double topHeight, double posX, double posY, double posZ,
+ double rotX, double rotZ) {
// Negative X
- tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umin, vmin);
- tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umin, vmax);
- tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umax, vmax);
- tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umax, vmin);
+ tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY,
+ 0.6 - rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY,
+ 0.6 + rotZ + posZ, umin, vmax);
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY,
+ 0.4 + rotZ + posZ, umax, vmax);
+ tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY,
+ 0.4 - rotZ + posZ, umax, vmin);
// Positive X
- tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umin, vmin);
- tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umin, vmax);
- tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umax, vmax);
- tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umax, vmin);
+ tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY,
+ 0.4 - rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY,
+ 0.4 + rotZ + posZ, umin, vmax);
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY,
+ 0.6 + rotZ + posZ, umax, vmax);
+ tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY,
+ 0.6 - rotZ + posZ, umax, vmin);
// Negative Z
- tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umin, vmin);
- tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umin, vmax);
- tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umax, vmax);
- tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umax, vmin);
+ tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY,
+ 0.4 - rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY,
+ 0.4 + rotZ + posZ, umin, vmax);
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY,
+ 0.4 + rotZ + posZ, umax, vmax);
+ tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY,
+ 0.4 - rotZ + posZ, umax, vmin);
// Positive Z
- tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umin, vmin);
- tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umin, vmax);
- tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umax, vmax);
- tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umax, vmin);
+ tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY,
+ 0.6 - rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY,
+ 0.6 + rotZ + posZ, umin, vmax);
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY,
+ 0.6 + rotZ + posZ, umax, vmax);
+ tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY,
+ 0.6 - rotZ + posZ, umax, vmin);
// Top -X
- tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umin, vmin);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin, vmax);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax, vmax);
- tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umax, vmin);
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY,
+ 0.6 + rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX,
+ height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin,
+ vmax);
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX,
+ height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax,
+ vmax);
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY,
+ 0.4 + rotZ + posZ, umax, vmin);
// Top +X
- tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umin, vmin);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin, vmax);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax, vmax);
- tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umax, vmin);
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY,
+ 0.4 + rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX,
+ height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin,
+ vmax);
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX,
+ height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax,
+ vmax);
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY,
+ 0.6 + rotZ + posZ, umax, vmin);
// Top +Z
- tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umin, vmin);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin, vmax);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax, vmax);
- tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.6 + rotZ + posZ, umax, vmin);
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY,
+ 0.6 + rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX,
+ height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin,
+ vmax);
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX,
+ height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax,
+ vmax);
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY,
+ 0.6 + rotZ + posZ, umax, vmin);
// Top -Z
- tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umin, vmin);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin, vmax);
- tessellator.addVertexWithUV(0.5 - rotX - rotX + posX, height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax, vmax);
- tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY, 0.4 + rotZ + posZ, umax, vmin);
+ tessellator.addVertexWithUV(0.4 - rotX + posX, height + posY,
+ 0.4 + rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX,
+ height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umin,
+ vmax);
+ tessellator.addVertexWithUV(0.5 - rotX - rotX + posX,
+ height + topHeight + posY, 0.5 + rotZ + rotZ + posZ, umax,
+ vmax);
+ tessellator.addVertexWithUV(0.6 - rotX + posX, height + posY,
+ 0.4 + rotZ + posZ, umax, vmin);
// Bottom
- tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umin, vmin);
- tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umin, vmax);
- tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.4 - rotZ + posZ, umax, vmax);
- tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY, 0.6 - rotZ + posZ, umax, vmin);
+ tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY,
+ 0.6 - rotZ + posZ, umin, vmin);
+ tessellator.addVertexWithUV(0.4 + rotX + posX, 0.0 + posY,
+ 0.4 - rotZ + posZ, umin, vmax);
+ tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY,
+ 0.4 - rotZ + posZ, umax, vmax);
+ tessellator.addVertexWithUV(0.6 + rotX + posX, 0.0 + posY,
+ 0.6 - rotZ + posZ, umax, vmin);
}
@Override
diff --git a/src/main/java/darkknight/jewelrycraft/client/AbstractTab.java b/src/main/java/darkknight/jewelrycraft/client/AbstractTab.java index cdfb394..66c3329 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/AbstractTab.java +++ b/src/main/java/darkknight/jewelrycraft/client/AbstractTab.java @@ -2,6 +2,7 @@ package darkknight.jewelrycraft.client; import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
+
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import darkknight.jewelrycraft.util.Variables;
@@ -16,54 +17,59 @@ import net.minecraft.util.ResourceLocation; * @author TinkersCOnstruct
*/
@SideOnly(Side.CLIENT)
-public abstract class AbstractTab extends GuiButton
-{
- ResourceLocation texture = new ResourceLocation(Variables.MODID, "textures/gui/hearts.png");
- ItemStack renderStack;
- RenderItem itemRenderer = new RenderItem();
+public abstract class AbstractTab extends GuiButton {
+ ResourceLocation texture = new ResourceLocation(
+ Variables.MODID, "textures/gui/hearts.png");
+ ItemStack renderStack;
+ RenderItem itemRenderer = new RenderItem();
- public AbstractTab(int id, int posX, int posY, ItemStack renderStack)
- {
- super(id, posX, posY, 18, 18, "");
- this.renderStack = renderStack;
- }
+ public AbstractTab(int id, int posX, int posY, ItemStack renderStack) {
+ super(id, posX, posY, 18, 18, "");
+ this.renderStack = renderStack;
+ }
- @Override
- public void drawButton (Minecraft mc, int mouseX, int mouseY)
- {
- if (this.visible)
- {
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- int xOffset = this.enabled ? 0 : 8;
+ @Override
+ public void drawButton(Minecraft mc, int mouseX, int mouseY) {
+ if (this.visible) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ int xOffset = this.enabled ? 0 : 8;
- mc.renderEngine.bindTexture(this.texture);
- this.drawTexturedModalRect(this.xPosition, yPosition, 144 + xOffset, 32, 18, 18);
+ mc.renderEngine.bindTexture(this.texture);
+ this.drawTexturedModalRect(this.xPosition, yPosition,
+ 144 + xOffset, 32, 18, 18);
- GL11.glPushMatrix();
- RenderHelper.enableGUIStandardItemLighting();
- this.zLevel = 100.0F;
- this.itemRenderer.zLevel = 100.0F;
- GL11.glEnable(GL11.GL_LIGHTING);
- GL11.glEnable(GL12.GL_RESCALE_NORMAL);
- this.itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, renderStack, xPosition + 1, yPosition + 1);
- this.itemRenderer.renderItemOverlayIntoGUI(mc.fontRenderer, mc.renderEngine, renderStack, xPosition + 1, yPosition + 1);
- GL11.glDisable(GL11.GL_LIGHTING);
- this.itemRenderer.zLevel = 0.0F;
- this.zLevel = 0.0F;
- RenderHelper.disableStandardItemLighting();
- GL11.glPopMatrix();
- }
- }
+ GL11.glPushMatrix();
+ RenderHelper.enableGUIStandardItemLighting();
+ this.zLevel = 100.0F;
+ this.itemRenderer.zLevel = 100.0F;
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+ this.itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer,
+ mc.renderEngine, renderStack, xPosition + 1,
+ yPosition + 1);
+ this.itemRenderer.renderItemOverlayIntoGUI(mc.fontRenderer,
+ mc.renderEngine, renderStack, xPosition + 1,
+ yPosition + 1);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ this.itemRenderer.zLevel = 0.0F;
+ this.zLevel = 0.0F;
+ RenderHelper.disableStandardItemLighting();
+ GL11.glPopMatrix();
+ }
+ }
- @Override
- public boolean mousePressed (Minecraft mc, int mouseX, int mouseY)
- {
- boolean inWindow = this.enabled && this.visible && mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
- if (inWindow) this.onTabClicked();
- return inWindow;
- }
+ @Override
+ public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
+ boolean inWindow = this.enabled && this.visible
+ && mouseX >= this.xPosition && mouseY >= this.yPosition
+ && mouseX < this.xPosition + this.width
+ && mouseY < this.yPosition + this.height;
+ if (inWindow)
+ this.onTabClicked();
+ return inWindow;
+ }
- public abstract void onTabClicked ();
+ public abstract void onTabClicked();
- public abstract boolean shouldAddToList ();
+ public abstract boolean shouldAddToList();
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/client/InventoryTabVanilla.java b/src/main/java/darkknight/jewelrycraft/client/InventoryTabVanilla.java index 4f5ae88..401d3db 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/InventoryTabVanilla.java +++ b/src/main/java/darkknight/jewelrycraft/client/InventoryTabVanilla.java @@ -3,22 +3,18 @@ package darkknight.jewelrycraft.client; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -public class InventoryTabVanilla extends AbstractTab -{ - public InventoryTabVanilla() - { - super(0, 0, 0, new ItemStack(Blocks.crafting_table)); - } +public class InventoryTabVanilla extends AbstractTab { + public InventoryTabVanilla() { + super(0, 0, 0, new ItemStack(Blocks.crafting_table)); + } - @Override - public void onTabClicked() - { - TabRegistry.openInventoryGui(); - } + @Override + public void onTabClicked() { + TabRegistry.openInventoryGui(); + } - @Override - public boolean shouldAddToList() - { - return true; - } + @Override + public boolean shouldAddToList() { + return true; + } }
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/client/JewelryInventory.java b/src/main/java/darkknight/jewelrycraft/client/JewelryInventory.java index 895b345..6baf8ad 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/JewelryInventory.java +++ b/src/main/java/darkknight/jewelrycraft/client/JewelryInventory.java @@ -11,156 +11,160 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
-public class JewelryInventory implements IInventory
-{
- public EntityPlayer player;
- public ItemStack[] inventory = new ItemStack[18];
-
- /**
- * @param player
- */
- public JewelryInventory(EntityPlayer player)
- {
- this.player = player;
- NBTTagCompound nbt = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- for(int i = 0; i < 18; i++)
- inventory[i] = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("ext" + i));
- }
-
- /**
- * @return
- */
- @Override
- public int getSizeInventory()
- {
- return inventory.length;
- }
-
- /**
- * @param slot
- * @return
- */
- @Override
- public ItemStack getStackInSlot(int slot)
- {
- return inventory[slot];
- }
-
- /**
- * @param slot
- * @param amount
- * @return
- */
- @Override
- public ItemStack decrStackSize(int slot, int amount)
- {
- ItemStack stack = getStackInSlot(slot);
- if (stack != null) if (stack.stackSize > amount){
- stack = stack.splitStack(amount);
- markDirty();
- }else setInventorySlotContents(slot, null);
- return stack;
- }
-
- /**
- * @param slot
- * @return
- */
- @Override
- public ItemStack getStackInSlotOnClosing(int slot)
- {
- ItemStack stack = getStackInSlot(slot);
- setInventorySlotContents(slot, null);
- return stack;
- }
-
- /**
- * @param slot
- * @param stack
- */
- @Override
- public void setInventorySlotContents(int slot, ItemStack stack)
- {
- inventory[slot] = stack;
- if (stack != null && stack.stackSize > getInventoryStackLimit()) stack.stackSize = getInventoryStackLimit();
- markDirty();
- }
-
- /**
- * @return
- */
- @Override
- public String getInventoryName()
- {
- return "Jewelry";
- }
-
- /**
- * @return
- */
- @Override
- public boolean hasCustomInventoryName()
- {
- return false;
- }
-
- /**
- * @return
- */
- @Override
- public int getInventoryStackLimit()
- {
- return 1;
- }
-
- /**
- *
- */
- @Override
- public void markDirty()
- {
- NBTTagCompound nbt = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- for(int i = 0; i < 18; i++)
- if (inventory[i] != null) nbt.setTag("ext" + i, inventory[i].writeToNBT(nbt.getCompoundTag("ext" + i)));
- else nbt.removeTag("ext" + i);
- }
-
- /**
- * @param player
- * @return
- */
- @Override
- public boolean isUseableByPlayer(EntityPlayer player)
- {
- return true;
- }
-
- /**
- *
- */
- @Override
- public void openInventory()
- {}
-
- /**
- *
- */
- @Override
- public void closeInventory()
- {}
-
- /**
- * @param slot
- * @param stack
- * @return
- */
- @Override
- public boolean isItemValidForSlot(int slot, ItemStack stack)
- {
- if (slot >= 0 && slot <= 9 && stack.getItem() instanceof ItemRing) return true;
- else if (slot >= 10 && slot <= 13 && stack.getItem() instanceof ItemBracelet) return true;
- else if (slot >= 14 && slot <= 16 && stack.getItem() instanceof ItemNecklace) return true;
- else if (slot == 17 && stack.getItem() instanceof ItemEarrings) return true;
- return false;
- }
+public class JewelryInventory implements IInventory {
+ public EntityPlayer player;
+ public ItemStack[] inventory = new ItemStack[18];
+
+ /**
+ * @param player
+ */
+ public JewelryInventory(EntityPlayer player) {
+ this.player = player;
+ NBTTagCompound nbt = PlayerUtils.getModPlayerPersistTag(player,
+ Variables.MODID);
+ for (int i = 0; i < 18; i++)
+ inventory[i] = ItemStack
+ .loadItemStackFromNBT(nbt.getCompoundTag("ext" + i));
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public int getSizeInventory() {
+ return inventory.length;
+ }
+
+ /**
+ * @param slot
+ * @return
+ */
+ @Override
+ public ItemStack getStackInSlot(int slot) {
+ return inventory[slot];
+ }
+
+ /**
+ * @param slot
+ * @param amount
+ * @return
+ */
+ @Override
+ public ItemStack decrStackSize(int slot, int amount) {
+ ItemStack stack = getStackInSlot(slot);
+ if (stack != null)
+ if (stack.stackSize > amount) {
+ stack = stack.splitStack(amount);
+ markDirty();
+ } else
+ setInventorySlotContents(slot, null);
+ return stack;
+ }
+
+ /**
+ * @param slot
+ * @return
+ */
+ @Override
+ public ItemStack getStackInSlotOnClosing(int slot) {
+ ItemStack stack = getStackInSlot(slot);
+ setInventorySlotContents(slot, null);
+ return stack;
+ }
+
+ /**
+ * @param slot
+ * @param stack
+ */
+ @Override
+ public void setInventorySlotContents(int slot, ItemStack stack) {
+ inventory[slot] = stack;
+ if (stack != null && stack.stackSize > getInventoryStackLimit())
+ stack.stackSize = getInventoryStackLimit();
+ markDirty();
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public String getInventoryName() {
+ return "Jewelry";
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public int getInventoryStackLimit() {
+ return 1;
+ }
+
+ /**
+ *
+ */
+ @Override
+ public void markDirty() {
+ NBTTagCompound nbt = PlayerUtils.getModPlayerPersistTag(player,
+ Variables.MODID);
+ for (int i = 0; i < 18; i++)
+ if (inventory[i] != null)
+ nbt.setTag("ext" + i, inventory[i]
+ .writeToNBT(nbt.getCompoundTag("ext" + i)));
+ else
+ nbt.removeTag("ext" + i);
+ }
+
+ /**
+ * @param playr
+ * @return
+ */
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer playr) {
+ return true;
+ }
+
+ /**
+ *
+ */
+ @Override
+ public void openInventory() {
+ // Do nothing
+ }
+
+ /**
+ *
+ */
+ @Override
+ public void closeInventory() {
+ // Do nothing
+ }
+
+ /**
+ * @param slot
+ * @param stack
+ * @return
+ */
+ @Override
+ public boolean isItemValidForSlot(int slot, ItemStack stack) {
+ if (slot >= 0 && slot <= 9 && stack.getItem() instanceof ItemRing)
+ return true;
+ else if (slot >= 10 && slot <= 13
+ && stack.getItem() instanceof ItemBracelet)
+ return true;
+ else if (slot >= 14 && slot <= 16
+ && stack.getItem() instanceof ItemNecklace)
+ return true;
+ else if (slot == 17 && stack.getItem() instanceof ItemEarrings)
+ return true;
+ return false;
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/client/Page.java b/src/main/java/darkknight/jewelrycraft/client/Page.java index 866f6f3..f3fcec9 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/Page.java +++ b/src/main/java/darkknight/jewelrycraft/client/Page.java @@ -1,8 +1,10 @@ package darkknight.jewelrycraft.client;
import java.util.ArrayList;
+
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
+
import darkknight.jewelrycraft.client.gui.GuiGuide;
import darkknight.jewelrycraft.util.Variables;
import net.minecraft.client.Minecraft;
@@ -10,155 +12,215 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
-public class Page
-{
- static ResourceLocation pageFlipped = new ResourceLocation(Variables.MODID, "textures/gui/guidePageFlip.png");
-
- public static void addCraftingRecipeTextPage(GuiGuide gui, int x, int y, boolean isSmall, String text, int mouseX, int mouseY, boolean rotate, ItemStack ... items)
- {
- y += 5;
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + items[0].getDisplayName(), x + Math.abs(70 - gui.getFont().getStringWidth(items[0].getDisplayName()) / 2) - 10, y - 2, 0);
- GL11.glColor4f(1, 1, 1, 1);
- Minecraft.getMinecraft().getTextureManager().bindTexture(pageFlipped);
- ArrayList<String> name = new ArrayList<String>();
- if (isSmall){
- gui.drawTexturedModalRect(x, y + 10, 145, 54, 111, 46);
- gui.renderItem(items[0], x + 89, y + 22 + 10, 30f, rotate, 0, 0, 0);
- for(int i = 1; i <= 4; i++)
- if (items.length > i && items[i] != null){
- int posX = x + 8 + (i - 1) % 2 * 22;
- int posY = y + 26 + (i - 1) / 2 * 22;
- gui.renderItem(items[i], posX, posY, 30f, rotate, 0, 0, 0);
- name.add(items[i].getDisplayName());
- if (mouseX >= posX - 8 && mouseX <= posX + 8 && mouseY >= posY - 16 && mouseY <= posY) gui.drawHoverString(name, posX - 20, posY - 14);
- name.removeAll(name);
- GL11.glDisable(GL11.GL_LIGHTING);
- }
- drawText(gui, text, x, y + 25);
- }else{
- gui.drawTexturedModalRect(x, y + 12, 145, 0, 111, 54);
- gui.renderItem(items[0], x + 91, y + 28 + 10, 30f, rotate, 0, 0, 0);
- for(int i = 1; i <= 9; i++)
- if (items.length > i && items[i] != null){
- int posX = x + 8 + (i - 1) % 3 * 19;
- int posY = y + 22 + (i - 1) / 3 * 17;
- gui.renderItem(items[i], posX, posY, 30f, rotate, 0, 0, 0);
- name.add(items[i].getDisplayName());
- if (mouseX >= posX - 8 && mouseX <= posX + 8 && mouseY >= posY - 10 && mouseY <= posY) gui.drawHoverString(name, posX - 20, posY - 12);
- name.removeAll(name);
- GL11.glDisable(GL11.GL_LIGHTING);
- }
- drawText(gui, text, x, y + 32);
- GL11.glColor4f(1, 1, 1, 1);
- }
- GL11.glDisable(GL11.GL_BLEND);
- }
-
- public static void addSmeltingRecipeTextPage(GuiGuide gui, int x, int y, String text, int mouseX, int mouseY, boolean rotate, ItemStack ... items)
- {
- ArrayList<String> name = new ArrayList<String>();
- gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + items[1].getDisplayName(), x + 30 - items[0].getDisplayName().length() / 2, y + 2, 0);
- GL11.glColor4f(1, 1, 1, 1);
- Minecraft.getMinecraft().getTextureManager().bindTexture(pageFlipped);
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- gui.drawTexturedModalRect(x, y + 10, 145, 100, 111, 52);
- gui.renderItem(items[0], x + 13, y + 20 + 10, 35f, rotate, 0, 0, 0);
- name.add(items[0].getDisplayName());
- if (mouseX >= x && mouseX <= x + 20 && mouseY >= y + 20 && mouseY <= y + 20 + 16) gui.drawHoverString(name, x, y + 20);
- name.removeAll(name);
- GL11.glDisable(GL11.GL_LIGHTING);
- gui.renderItem(items[1], x + 77, y + 28 + 10, 35f, rotate, 0, 0, 0);
- drawText(gui, text, x, y + 30);
- GL11.glColor4f(1, 1, 1, 1);
- GL11.glDisable(GL11.GL_BLEND);
- }
-
- public static void addImageTextPage(GuiGuide gui, int x, int y, ItemStack item, String text, float size, boolean rotate)
- {
- y += 5;
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + item.getDisplayName(), x + Math.abs(70 - gui.getFont().getStringWidth(item.getDisplayName()) / 2) - 10, y + (int)size/5, 0);
- GL11.glColor4f(1, 1, 1, 1);
- gui.renderItem(item, x + 13, y + 18, size, rotate, 0, 0, 0);
- drawText(gui, text, x - 2, y - (int)(250 / size));
- GL11.glDisable(GL11.GL_BLEND);
- }
-
- public static void addSlotItem(GuiGuide gui, int x, int y, int mouseX, int mouseY, ItemStack item, float xRot, float yRot, float zRot)
- {
- ArrayList<String> name = new ArrayList<String>();
- GL11.glColor4f(1, 1, 1, 1);
- Minecraft.getMinecraft().getTextureManager().bindTexture(pageFlipped);
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- gui.drawTexturedModalRect(x + 9, y + 19, 148, 153, 12, 12);
- if(item.getItem() != null){
- name.add(item.getDisplayName());
- if (mouseX >= x + 10 && mouseX <= x + 20 && mouseY >= y + 20 && mouseY <= y + 30) gui.drawHoverString(name, x, y + 10);
- name.removeAll(name);
- }
- GL11.glDisable(GL11.GL_LIGHTING);
- GL11.glColor4f(1, 1, 1, 1);
- if(item.getItem() != null) gui.renderItem(item, x + 15, y + 25, 40f, false, xRot, yRot, zRot);
- GL11.glDisable(GL11.GL_BLEND);
- }
-
- public static void addImageTextPage(GuiGuide gui, int x, int y, ItemStack item, String text, float size, int txtX, int txtY, boolean showName, int imgX, int imgY, boolean rotate)
- {
- y += 5;
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glEnable(GL12.GL_RESCALE_NORMAL);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- if (showName) gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + item.getDisplayName().substring(0, item.getDisplayName().length() > 23?23:item.getDisplayName().length()), x + Math.abs(70 - gui.getFont().getStringWidth(item.getDisplayName()) / 2) - 10, y + 2, 0);
- GL11.glColor4f(1, 1, 1, 1);
- gui.renderItem(item, x + 13 + imgX, y + 18 + imgY, size, rotate, 0, 0, 0);
- drawText(gui, text, x + txtX, y + txtY);
- GL11.glDisable(GL11.GL_BLEND);
- }
-
- public static void addImageTextPage(GuiGuide gui, int x, int y, ItemStack item, String text, float size, int txtX, int txtY, String title, int imgX, int imgY, boolean rotate)
- {
- y += 5;
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glEnable(GL12.GL_RESCALE_NORMAL);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + title.substring(0, item.getDisplayName().length() > 23?23:title.length()), x + Math.abs(70 - gui.getFont().getStringWidth(title) / 2) - 10, y + 2, 0);
- GL11.glColor4f(1, 1, 1, 1);
- gui.renderItem(item, x + 13 + imgX, y + 18 + imgY, size, rotate, 0, 0, 0);
- drawText(gui, text, x + txtX, y + txtY);
- GL11.glDisable(GL11.GL_BLEND);
- }
-
- public static void addTextPage(GuiGuide gui, int x, int y, String text)
- {
- y -= 25;
- drawText(gui, text, x, y);
- GL11.glColor4f(1, 1, 1, 1);
- }
-
- public static void drawText(GuiGuide gui, String text, int x, int y)
- {
- String[] s = text.split(" ");
- String displayText = "";
- float scale = 0.75F;
- ArrayList<String> textLines = new ArrayList<String>();
- for(String element: s)
- if ((displayText + element + " ").length() <= 31) displayText += element + " ";
- else{
- textLines.add(displayText.trim());
- displayText = element + " ";
- }
- textLines.add(displayText.trim());
- for(int i = 0; i < textLines.size(); i++)
- {
- GL11.glPushMatrix();
- GL11.glScalef(scale, scale, 0f);
- gui.getFont().drawString(textLines.get(i), (int)(x/scale), (int)((y + 32 + i * 9)/scale), 0);
- GL11.glPopMatrix();
- }
- }
+public class Page {
+ static ResourceLocation pageFlipped = new ResourceLocation(
+ Variables.MODID, "textures/gui/guidePageFlip.png");
+
+ public static void addCraftingRecipeTextPage(GuiGuide gui, int x,
+ int y, boolean isSmall, String text, int mouseX, int mouseY,
+ boolean rotate, ItemStack... items) {
+ y += 5;
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ gui.getFont().drawString(
+ EnumChatFormatting.DARK_BLUE + "\u00a7n"
+ + items[0].getDisplayName(),
+ x + Math.abs(70 - gui.getFont()
+ .getStringWidth(items[0].getDisplayName()) / 2)
+ - 10,
+ y - 2, 0);
+ GL11.glColor4f(1, 1, 1, 1);
+ Minecraft.getMinecraft().getTextureManager()
+ .bindTexture(pageFlipped);
+ ArrayList<String> name = new ArrayList<>();
+ if (isSmall) {
+ gui.drawTexturedModalRect(x, y + 10, 145, 54, 111, 46);
+ gui.renderItem(items[0], x + 89, y + 22 + 10, 30f, rotate, 0,
+ 0, 0);
+ for (int i = 1; i <= 4; i++)
+ if (items.length > i && items[i] != null) {
+ int posX = x + 8 + (i - 1) % 2 * 22;
+ int posY = y + 26 + (i - 1) / 2 * 22;
+ gui.renderItem(items[i], posX, posY, 30f, rotate, 0, 0,
+ 0);
+ name.add(items[i].getDisplayName());
+ if (mouseX >= posX - 8 && mouseX <= posX + 8
+ && mouseY >= posY - 16 && mouseY <= posY)
+ gui.drawHoverString(name, posX - 20, posY - 14);
+ name.removeAll(name);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ }
+ drawText(gui, text, x, y + 25);
+ } else {
+ gui.drawTexturedModalRect(x, y + 12, 145, 0, 111, 54);
+ gui.renderItem(items[0], x + 91, y + 28 + 10, 30f, rotate, 0,
+ 0, 0);
+ for (int i = 1; i <= 9; i++)
+ if (items.length > i && items[i] != null) {
+ int posX = x + 8 + (i - 1) % 3 * 19;
+ int posY = y + 22 + (i - 1) / 3 * 17;
+ gui.renderItem(items[i], posX, posY, 30f, rotate, 0, 0,
+ 0);
+ name.add(items[i].getDisplayName());
+ if (mouseX >= posX - 8 && mouseX <= posX + 8
+ && mouseY >= posY - 10 && mouseY <= posY)
+ gui.drawHoverString(name, posX - 20, posY - 12);
+ name.removeAll(name);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ }
+ drawText(gui, text, x, y + 32);
+ GL11.glColor4f(1, 1, 1, 1);
+ }
+ GL11.glDisable(GL11.GL_BLEND);
+ }
+
+ public static void addSmeltingRecipeTextPage(GuiGuide gui, int x,
+ int y, String text, int mouseX, int mouseY, boolean rotate,
+ ItemStack... items) {
+ ArrayList<String> name = new ArrayList<>();
+ gui.getFont().drawString(
+ EnumChatFormatting.DARK_BLUE + "\u00a7n"
+ + items[1].getDisplayName(),
+ x + 30 - items[0].getDisplayName().length() / 2, y + 2, 0);
+ GL11.glColor4f(1, 1, 1, 1);
+ Minecraft.getMinecraft().getTextureManager()
+ .bindTexture(pageFlipped);
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ gui.drawTexturedModalRect(x, y + 10, 145, 100, 111, 52);
+ gui.renderItem(items[0], x + 13, y + 20 + 10, 35f, rotate, 0, 0,
+ 0);
+ name.add(items[0].getDisplayName());
+ if (mouseX >= x && mouseX <= x + 20 && mouseY >= y + 20
+ && mouseY <= y + 20 + 16)
+ gui.drawHoverString(name, x, y + 20);
+ name.removeAll(name);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ gui.renderItem(items[1], x + 77, y + 28 + 10, 35f, rotate, 0, 0,
+ 0);
+ drawText(gui, text, x, y + 30);
+ GL11.glColor4f(1, 1, 1, 1);
+ GL11.glDisable(GL11.GL_BLEND);
+ }
+
+ public static void addImageTextPage(GuiGuide gui, int x, int y,
+ ItemStack item, String text, float size, boolean rotate) {
+ y += 5;
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n"
+ + item.getDisplayName(),
+ x
+ + Math.abs(70 - gui.getFont()
+ .getStringWidth(item.getDisplayName()) / 2)
+ - 10,
+ y + (int) size / 5, 0);
+ GL11.glColor4f(1, 1, 1, 1);
+ gui.renderItem(item, x + 13, y + 18, size, rotate, 0, 0, 0);
+ drawText(gui, text, x - 2, y - (int) (250 / size));
+ GL11.glDisable(GL11.GL_BLEND);
+ }
+
+ public static void addSlotItem(GuiGuide gui, int x, int y, int mouseX,
+ int mouseY, ItemStack item, float xRot, float yRot,
+ float zRot) {
+ ArrayList<String> name = new ArrayList<>();
+ GL11.glColor4f(1, 1, 1, 1);
+ Minecraft.getMinecraft().getTextureManager()
+ .bindTexture(pageFlipped);
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ gui.drawTexturedModalRect(x + 9, y + 19, 148, 153, 12, 12);
+ if (item.getItem() != null) {
+ name.add(item.getDisplayName());
+ if (mouseX >= x + 10 && mouseX <= x + 20 && mouseY >= y + 20
+ && mouseY <= y + 30)
+ gui.drawHoverString(name, x, y + 10);
+ name.removeAll(name);
+ }
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glColor4f(1, 1, 1, 1);
+ if (item.getItem() != null)
+ gui.renderItem(item, x + 15, y + 25, 40f, false, xRot, yRot,
+ zRot);
+ GL11.glDisable(GL11.GL_BLEND);
+ }
+
+ public static void addImageTextPage(GuiGuide gui, int x, int y,
+ ItemStack item, String text, float size, int txtX, int txtY,
+ boolean showName, int imgX, int imgY, boolean rotate) {
+ y += 5;
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ if (showName)
+ gui.getFont()
+ .drawString(
+ EnumChatFormatting.DARK_BLUE + "\u00a7n"
+ + item.getDisplayName().substring(0,
+ item.getDisplayName()
+ .length() > 23
+ ? 23 : item
+ .getDisplayName()
+ .length()),
+ x + Math.abs(70 - gui.getFont().getStringWidth(
+ item.getDisplayName()) / 2) - 10,
+ y + 2, 0);
+ GL11.glColor4f(1, 1, 1, 1);
+ gui.renderItem(item, x + 13 + imgX, y + 18 + imgY, size, rotate, 0,
+ 0, 0);
+ drawText(gui, text, x + txtX, y + txtY);
+ GL11.glDisable(GL11.GL_BLEND);
+ }
+
+ public static void addImageTextPage(GuiGuide gui, int x, int y,
+ ItemStack item, String text, float size, int txtX, int txtY,
+ String title, int imgX, int imgY, boolean rotate) {
+ y += 5;
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ gui.getFont().drawString(
+ EnumChatFormatting.DARK_BLUE + "\u00a7n"
+ + title.substring(0,
+ item.getDisplayName().length() > 23 ? 23
+ : title.length()),
+ x + Math.abs(70 - gui.getFont().getStringWidth(title) / 2)
+ - 10,
+ y + 2, 0);
+ GL11.glColor4f(1, 1, 1, 1);
+ gui.renderItem(item, x + 13 + imgX, y + 18 + imgY, size, rotate, 0,
+ 0, 0);
+ drawText(gui, text, x + txtX, y + txtY);
+ GL11.glDisable(GL11.GL_BLEND);
+ }
+
+ public static void addTextPage(GuiGuide gui, int x, int y,
+ String text) {
+ y -= 25;
+ drawText(gui, text, x, y);
+ GL11.glColor4f(1, 1, 1, 1);
+ }
+
+ public static void drawText(GuiGuide gui, String text, int x, int y) {
+ String[] s = text.split(" ");
+ String displayText = "";
+ float scale = 0.75F;
+ ArrayList<String> textLines = new ArrayList<>();
+ for (String element : s)
+ if ((displayText + element + " ").length() <= 31)
+ displayText += element + " ";
+ else {
+ textLines.add(displayText.trim());
+ displayText = element + " ";
+ }
+ textLines.add(displayText.trim());
+ for (int i = 0; i < textLines.size(); i++) {
+ GL11.glPushMatrix();
+ GL11.glScalef(scale, scale, 0f);
+ gui.getFont().drawString(textLines.get(i), (int) (x / scale),
+ (int) ((y + 32 + i * 9) / scale), 0);
+ GL11.glPopMatrix();
+ }
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/TabCurses.java b/src/main/java/darkknight/jewelrycraft/client/TabCurses.java index 3468324..09ccb36 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/TabCurses.java +++ b/src/main/java/darkknight/jewelrycraft/client/TabCurses.java @@ -5,22 +5,19 @@ import darkknight.jewelrycraft.item.ItemList; import darkknight.jewelrycraft.network.PacketKeyPressEvent;
import net.minecraft.item.ItemStack;
-public class TabCurses extends AbstractTab
-{
- public TabCurses()
- {
- super(0, 0, 0, new ItemStack(ItemList.testItem, 1, 4));
- }
+public class TabCurses extends AbstractTab {
+ public TabCurses() {
+ super(0, 0, 0, new ItemStack(ItemList.testItem, 1, 4));
+ }
- @Override
- public void onTabClicked ()
- {
- JewelrycraftMod.netWrapper.sendToServer(new PacketKeyPressEvent(1));
- }
+ @Override
+ public void onTabClicked() {
+ JewelrycraftMod.netWrapper
+ .sendToServer(new PacketKeyPressEvent(1));
+ }
- @Override
- public boolean shouldAddToList ()
- {
- return true;
- }
+ @Override
+ public boolean shouldAddToList() {
+ return true;
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/client/TabJewelry.java b/src/main/java/darkknight/jewelrycraft/client/TabJewelry.java index 31cd7b4..44d2118 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/TabJewelry.java +++ b/src/main/java/darkknight/jewelrycraft/client/TabJewelry.java @@ -5,22 +5,19 @@ import darkknight.jewelrycraft.item.ItemList; import darkknight.jewelrycraft.network.PacketKeyPressEvent;
import net.minecraft.item.ItemStack;
-public class TabJewelry extends AbstractTab
-{
- public TabJewelry()
- {
- super(0, 0, 0, new ItemStack(ItemList.necklace));
- }
+public class TabJewelry extends AbstractTab {
+ public TabJewelry() {
+ super(0, 0, 0, new ItemStack(ItemList.necklace));
+ }
- @Override
- public void onTabClicked ()
- {
- JewelrycraftMod.netWrapper.sendToServer(new PacketKeyPressEvent(0));
- }
+ @Override
+ public void onTabClicked() {
+ JewelrycraftMod.netWrapper
+ .sendToServer(new PacketKeyPressEvent(0));
+ }
- @Override
- public boolean shouldAddToList ()
- {
- return true;
- }
+ @Override
+ public boolean shouldAddToList() {
+ return true;
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/client/TabRegistry.java b/src/main/java/darkknight/jewelrycraft/client/TabRegistry.java index fdc579f..21d8b9c 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/TabRegistry.java +++ b/src/main/java/darkknight/jewelrycraft/client/TabRegistry.java @@ -2,6 +2,7 @@ package darkknight.jewelrycraft.client; import java.util.ArrayList;
import java.util.List;
+
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@@ -16,7 +17,7 @@ import net.minecraftforge.client.event.GuiScreenEvent; * @author TinkersConstruct
*/
public class TabRegistry {
- private static ArrayList<AbstractTab> tabList = new ArrayList<AbstractTab>();
+ private static ArrayList<AbstractTab> tabList = new ArrayList<>();
public static void registerTab(AbstractTab tab) {
tabList.add(tab);
@@ -26,6 +27,7 @@ public class TabRegistry { return tabList;
}
+ @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void guiPostInit(GuiScreenEvent.InitGuiEvent.Post event) {
@@ -34,38 +36,50 @@ public class TabRegistry { int ySize = 166;
int guiLeft = (event.gui.width - xSize) / 2;
int guiTop = (event.gui.height - ySize) / 2;
- if (!mc.thePlayer.getActivePotionEffects().isEmpty()) if (Loader.isModLoaded("NotEnoughItems")) {
- try {
- // Check whether NEI is hidden and enabled
- Class<?> c = Class.forName("codechicken.nei.NEIClientConfig");
- Object hidden = c.getMethod("isHidden").invoke(null);
- Object enabled = c.getMethod("isEnabled").invoke(null);
- if (hidden != null && hidden instanceof Boolean && enabled != null && enabled instanceof Boolean) if ((Boolean) hidden || !((Boolean) enabled)) guiLeft += 60;
- } catch (Exception e) {
- }
- } else guiLeft += 60;
+ if (!mc.thePlayer.getActivePotionEffects().isEmpty())
+ if (Loader.isModLoaded("NotEnoughItems")) {
+ try {
+ // Check whether NEI is hidden and enabled
+ Class<?> c = Class.forName(
+ "codechicken.nei.NEIClientConfig");
+ Object hidden =
+ c.getMethod("isHidden").invoke(null);
+ Object enabled =
+ c.getMethod("isEnabled").invoke(null);
+ if (hidden != null && hidden instanceof Boolean
+ && enabled != null
+ && enabled instanceof Boolean)
+ if ((Boolean) hidden || !((Boolean) enabled))
+ guiLeft += 60;
+ } catch (Exception e) {
+ // Do nothing
+ }
+ } else
+ guiLeft += 60;
updateTabValues(guiLeft, guiTop, InventoryTabVanilla.class);
addTabsToList(event.buttonList);
}
}
- private static Minecraft mc = FMLClientHandler.instance().getClient();
+ private static Minecraft mc = FMLClientHandler.instance().getClient();
public static void openInventoryGui() {
- mc.thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow(mc.thePlayer.openContainer.windowId));
+ mc.thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow(
+ mc.thePlayer.openContainer.windowId));
GuiInventory inventory = new GuiInventory(mc.thePlayer);
mc.displayGuiScreen(inventory);
}
- public static void updateTabValues(int cornerX, int cornerY, Class<?> selectedButton) {
+ public static void updateTabValues(int cornerX, int cornerY,
+ Class<?> selectedButton) {
int count = 0;
for (int i = 0; i < tabList.size(); i++) {
AbstractTab t = tabList.get(i);
if (t.shouldAddToList()) {
if (selectedButton.equals(TabCurses.class)) {
t.xPosition = cornerX + 195;
- t.yPosition = cornerY + count*20;
- }else if (selectedButton.equals(TabJewelry.class)) {
+ t.yPosition = cornerY + count * 20;
+ } else if (selectedButton.equals(TabJewelry.class)) {
t.xPosition = cornerX + 140 + count * 20;
t.yPosition = cornerY + 64;
} else {
@@ -73,13 +87,15 @@ public class TabRegistry { t.yPosition = cornerY + 64;
}
t.enabled = !t.getClass().equals(selectedButton);
- if (t.enabled) count++;
+ if (t.enabled)
+ count++;
}
}
}
- public static void addTabsToList(List buttonList) {
+ public static void addTabsToList(List<AbstractTab> buttonList) {
for (AbstractTab tab : tabList)
- if (tab.shouldAddToList() && tab.enabled) buttonList.add(tab);
+ if (tab.shouldAddToList() && tab.enabled)
+ buttonList.add(tab);
}
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiCurseInfo.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiCurseInfo.java index 16b946c..acd1a69 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiCurseInfo.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiCurseInfo.java @@ -2,7 +2,9 @@ package darkknight.jewelrycraft.client.gui; import java.util.ArrayList;
import java.util.List;
+
import org.lwjgl.opengl.GL11;
+
import darkknight.jewelrycraft.JewelrycraftMod;
import darkknight.jewelrycraft.api.Curse;
import darkknight.jewelrycraft.client.TabCurses;
@@ -23,13 +25,14 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.World;
public class GuiCurseInfo extends GuiContainer {
- World world;
- EntityPlayer player;
- ResourceLocation texture;
- int page = 0, maxPages = 1;
- String selectedCurse = "";
+ World world;
+ EntityPlayer player;
+ ResourceLocation texture;
+ int page = 0, maxPages = 1;
+ String selectedCurse = "";
- public GuiCurseInfo(Container container, World world, EntityPlayer player, ResourceLocation texture) {
+ public GuiCurseInfo(Container container, World world,
+ EntityPlayer player, ResourceLocation texture) {
super(container);
this.world = world;
this.player = player;
@@ -38,47 +41,75 @@ public class GuiCurseInfo extends GuiContainer { ySize = 166;
}
+ @Override
public void drawScreen(int x, int y, float size) {
super.drawScreen(x, y, size);
}
@Override
- public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
+ public void drawGuiContainerBackgroundLayer(float f, int mouseX,
+ int mouseY) {
GL11.glColor3f(1, 1, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
if (player != null) {
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- if (!player.capabilities.isCreativeMode) maxPages = playerInfo.getInteger("activeCurses") / 5 - (playerInfo.getInteger("activeCurses") % 5 == 0 ? 1 : 0);
- else maxPages = Curse.getCurseList().size() / 5 - (Curse.getCurseList().size() % 5 == 0 ? 1 : 0);
- if (!player.capabilities.isCreativeMode) survivalCurses(playerInfo);
- else creativeCurses(playerInfo);
- if (playerInfo.hasKey("cursePoints")) this.drawString(fontRendererObj, "Curse points: " + playerInfo.getInteger("cursePoints") + " | Active curses: " + playerInfo.getInteger("activeCurses"), guiLeft, guiTop - 10, 0xffffff);
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(player, Variables.MODID);
+ if (!player.capabilities.isCreativeMode)
+ maxPages = playerInfo.getInteger("activeCurses") / 5
+ - (playerInfo.getInteger("activeCurses") % 5 == 0
+ ? 1 : 0);
+ else
+ maxPages = Curse.getCurseList().size() / 5
+ - (Curse.getCurseList().size() % 5 == 0 ? 1 : 0);
+ if (!player.capabilities.isCreativeMode)
+ survivalCurses(playerInfo);
+ else
+ creativeCurses(playerInfo);
+ if (playerInfo.hasKey("cursePoints"))
+ this.drawString(fontRendererObj,
+ "Curse points: "
+ + playerInfo.getInteger("cursePoints")
+ + " | Active curses: "
+ + playerInfo.getInteger("activeCurses"),
+ guiLeft, guiTop - 10, 0xffffff);
}
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
- drawTexturedModalRect(guiLeft + 5, guiTop + ySize - 14, 0, ySize, 13, 11);
- drawTexturedModalRect(guiLeft + xSize - 38, guiTop + ySize - 14, 13, ySize, 13, 11);
- this.drawString(fontRendererObj, (page + 1) + "/" + (maxPages + 1), guiLeft + 90, guiTop + 153, 0xffffff);
- this.drawString(fontRendererObj, "Click on an active curse to see its description", guiLeft, guiTop + 170, 0xffffff);
+ drawTexturedModalRect(guiLeft + 5, guiTop + ySize - 14, 0, ySize,
+ 13, 11);
+ drawTexturedModalRect(guiLeft + xSize - 38, guiTop + ySize - 14,
+ 13, ySize, 13, 11);
+ this.drawString(fontRendererObj, (page + 1) + "/" + (maxPages + 1),
+ guiLeft + 90, guiTop + 153, 0xffffff);
+ this.drawString(fontRendererObj,
+ "Click on an active curse to see its description", guiLeft,
+ guiTop + 170, 0xffffff);
if (player.capabilities.isCreativeMode) {
- drawText(this, "To enable or disable a curse simply hold the CTRL key and click on one.", guiLeft - 100, guiTop, 20, 0xff0000);
- drawText(this, "If you do not have any curse points you need to type the command '/jw addCursePoints [playerUsername] [no of curse points]'. If you don't do this any curse you activate won't have any effect.", guiLeft - 100, guiTop + 50, 20, 0xff0000);
+ drawText(this,
+ "To enable or disable a curse simply hold the CTRL key and click on one.",
+ guiLeft - 100, guiTop, 20, 0xff0000);
+ drawText(this,
+ "If you do not have any curse points you need to type the command '/jw addCursePoints [playerUsername] [no of curse points]'. If you don't do this any curse you activate won't have any effect.",
+ guiLeft - 100, guiTop + 50, 20, 0xff0000);
}
}
- public static void drawText(GuiCurseInfo gui, String text, int x, int y, int characters, int color) {
+ public static void drawText(GuiCurseInfo gui, String text, int x,
+ int y, int characters, int color) {
String[] s = text.split(" ");
String displayText = "";
- ArrayList<String> textLines = new ArrayList<String>();
+ ArrayList<String> textLines = new ArrayList<>();
for (String element : s)
- if ((displayText + element + " ").length() <= characters) displayText += element + " ";
+ if ((displayText + element + " ").length() <= characters)
+ displayText += element + " ";
else {
textLines.add(displayText.trim());
displayText = element + " ";
}
textLines.add(displayText.trim());
for (int i = 0; i < textLines.size(); i++)
- gui.drawString(gui.getFont(), textLines.get(i), x, y + i * 9, color);
+ gui.drawString(gui.getFont(), textLines.get(i), x, y + i * 9,
+ color);
}
public FontRenderer getFont() {
@@ -92,41 +123,80 @@ public class GuiCurseInfo extends GuiContainer { for (Curse curse : Curse.getCurseList()) {
if (playerInfo.getInteger(curse.getName()) > 0) {
if (ind >= page * 5 && ind < (page + 1) * 5) {
- if (ind == page * 5 && selectedCurse == "") selectedCurse = curse.getName();
- mc.renderEngine.bindTexture(Variables.MISC_TEXTURE);
- drawTexturedModalRect(guiLeft + 43, guiTop + 8 + (size - 8) * (ind - page * 5), 0, 32, 112, 22);
+ if (ind == page * 5 && selectedCurse == "")
+ selectedCurse = curse.getName();
+ mc.renderEngine
+ .bindTexture(Variables.MISC_TEXTURE);
+ drawTexturedModalRect(guiLeft + 43,
+ guiTop + 8 + (size - 8) * (ind - page * 5),
+ 0, 32, 112, 22);
if (selectedCurse == curse.getName()) {
GL11.glPushMatrix();
GL11.glScalef(1.2f, 1.5f, 0f);
- drawTexturedModalRect((int) (guiLeft / (1.2)) + 126, (int) (guiTop / (1.5)) + 7 + (size - 16) * (ind - page * 5), 48, 16, 32, 16);
- drawTexturedModalRect((int) (guiLeft / (1.2)) + 5, (int) (guiTop / (1.5)) + 7 + (size - 16) * (ind - page * 5), 80, 16, 32, 16);
+ drawTexturedModalRect(
+ (int) (guiLeft / (1.2)) + 126,
+ (int) (guiTop / (1.5)) + 7
+ + (size - 16)
+ * (ind - page * 5),
+ 48, 16, 32, 16);
+ drawTexturedModalRect(
+ (int) (guiLeft / (1.2)) + 5,
+ (int) (guiTop / (1.5)) + 7
+ + (size - 16)
+ * (ind - page * 5),
+ 80, 16, 32, 16);
GL11.glPopMatrix();
GL11.glPushMatrix();
- List descr = fontRendererObj.listFormattedStringToWidth(curse.getDescription(), 238);
+ List<?> descr = fontRendererObj
+ .listFormattedStringToWidth(
+ curse.getDescription(), 238);
GL11.glScalef(0.75F, 0.75F, 0F);
for (int i = 0; i < descr.size(); i++)
- this.drawString(fontRendererObj, descr.get(i).toString(), (int) (guiLeft / 0.75F) + 12, (int) (guiTop / 0.75F) + 184 + i * 12 - (descr.size() > 1 ? 6 : 0), 0xffffff);
+ this.drawString(fontRendererObj,
+ descr.get(i).toString(),
+ (int) (guiLeft / 0.75F) + 12,
+ (int) (guiTop / 0.75F) + 184
+ + i * 12
+ - (descr.size() > 1 ? 6
+ : 0),
+ 0xffffff);
GL11.glPopMatrix();
}
if (playerInfo.getInteger(curse.getName()) == 2) {
- mc.renderEngine.bindTexture(Variables.MISC_TEXTURE);
+ mc.renderEngine
+ .bindTexture(Variables.MISC_TEXTURE);
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA,
+ GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(1f, 1f, 1f, 0.5f);
- drawTexturedModalRect(guiLeft + 134, guiTop + 11 + (size - 8) * (ind - page * 5), 3 * 16, 0, 16, 16);
+ drawTexturedModalRect(guiLeft + 134,
+ guiTop + 11
+ + (size - 8)
+ * (ind - page * 5),
+ 3 * 16, 0, 16, 16);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
- mc.renderEngine.bindTexture(new ResourceLocation(Variables.MODID, "textures/gui/" + curse.getTexturePack() + ".png"));
+ mc.renderEngine.bindTexture(
+ new ResourceLocation(Variables.MODID,
+ "textures/gui/"
+ + curse.getTexturePack()
+ + ".png"));
int tag = curse.getTextureID();
GL11.glPushMatrix();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glScalef(0.5f, 0.5f, 0.0f);
- drawTexturedModalRect(guiLeft * 2 + 100, guiTop * 2 + 22 + (ind - page * 5) * 48, tag % 8 * 32, tag / 8 * 32, 32, 32);
+ drawTexturedModalRect(guiLeft * 2 + 100,
+ guiTop * 2 + 22 + (ind - page * 5) * 48,
+ tag % 8 * 32, tag / 8 * 32, 32, 32);
GL11.glPopMatrix();
- this.drawString(fontRendererObj, curse.getDisplayName(), guiLeft + 70, guiTop + 15 + (ind - page * 5) * (size - 8), 0xffffff);
+ this.drawString(fontRendererObj,
+ curse.getDisplayName(), guiLeft + 70,
+ guiTop + 15
+ + (ind - page * 5) * (size - 8),
+ 0xffffff);
}
ind++;
}
@@ -139,39 +209,69 @@ public class GuiCurseInfo extends GuiContainer { int ind = 0;
for (Curse curse : Curse.getCurseList()) {
if (ind >= page * 5 && ind < (page + 1) * 5) {
- if (ind == page * 5 && selectedCurse == "") selectedCurse = curse.getName();
+ if (ind == page * 5 && selectedCurse == "")
+ selectedCurse = curse.getName();
if (playerInfo.getInteger(curse.getName()) <= 0) {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- if (!curse.canCurseBeActivated() || !ConfigHandler.CURSES_ENABLED) GL11.glColor4f(1f, 0f, 0f, 0.5f);
- else GL11.glColor4f(1f, 1f, 1f, 0.5f);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA,
+ GL11.GL_ONE_MINUS_SRC_ALPHA);
+ if (!curse.canCurseBeActivated()
+ || !ConfigHandler.CURSES_ENABLED)
+ GL11.glColor4f(1f, 0f, 0f, 0.5f);
+ else
+ GL11.glColor4f(1f, 1f, 1f, 0.5f);
}
mc.renderEngine.bindTexture(Variables.MISC_TEXTURE);
- drawTexturedModalRect(guiLeft + 43, guiTop + 8 + (size - 8) * (ind - page * 5), 0, 32, 112, 22);
+ drawTexturedModalRect(guiLeft + 43,
+ guiTop + 8 + (size - 8) * (ind - page * 5), 0, 32,
+ 112, 22);
if (selectedCurse == curse.getName()) {
GL11.glPushMatrix();
GL11.glScalef(1.2f, 1.5f, 0f);
- drawTexturedModalRect((int) (guiLeft / (1.2)) + 126, (int) (guiTop / (1.5)) + 7 + (size - 16) * (ind - page * 5), 48, 16, 32, 16);
- drawTexturedModalRect((int) (guiLeft / (1.2)) + 5, (int) (guiTop / (1.5)) + 7 + (size - 16) * (ind - page * 5), 80, 16, 32, 16);
+ drawTexturedModalRect((int) (guiLeft / (1.2)) + 126,
+ (int) (guiTop / (1.5)) + 7
+ + (size - 16) * (ind - page * 5),
+ 48, 16, 32, 16);
+ drawTexturedModalRect((int) (guiLeft / (1.2)) + 5,
+ (int) (guiTop / (1.5)) + 7
+ + (size - 16) * (ind - page * 5),
+ 80, 16, 32, 16);
GL11.glPopMatrix();
GL11.glPushMatrix();
- List descr = fontRendererObj.listFormattedStringToWidth(curse.getDescription(), 238);
+ List<?> descr =
+ fontRendererObj.listFormattedStringToWidth(
+ curse.getDescription(), 238);
GL11.glScalef(0.75F, 0.75F, 0F);
for (int i = 0; i < descr.size(); i++)
- this.drawString(fontRendererObj, descr.get(i).toString(), (int) (guiLeft / 0.75F) + 12, (int) (guiTop / 0.75F) + 184 + i * 12 - (descr.size() > 1 ? 6 : 0), 0xffffff);
+ this.drawString(fontRendererObj,
+ descr.get(i).toString(),
+ (int) (guiLeft / 0.75F) + 12,
+ (int) (guiTop / 0.75F) + 184 + i * 12
+ - (descr.size() > 1 ? 6 : 0),
+ 0xffffff);
GL11.glPopMatrix();
}
- mc.renderEngine.bindTexture(new ResourceLocation(Variables.MODID, "textures/gui/" + curse.getTexturePack() + ".png"));
+ mc.renderEngine.bindTexture(new ResourceLocation(
+ Variables.MODID, "textures/gui/"
+ + curse.getTexturePack() + ".png"));
int tag = curse.getTextureID();
GL11.glPushMatrix();
- if (playerInfo.getInteger(curse.getName()) <= 0) GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
- else GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ if (playerInfo.getInteger(curse.getName()) <= 0)
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
+ else
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glScalef(0.5f, 0.5f, 0.0f);
- drawTexturedModalRect(guiLeft * 2 + 100, guiTop * 2 + 22 + (ind - page * 5) * 48, tag % 8 * 32, tag / 8 * 32, 32, 32);
+ drawTexturedModalRect(guiLeft * 2 + 100,
+ guiTop * 2 + 22 + (ind - page * 5) * 48,
+ tag % 8 * 32, tag / 8 * 32, 32, 32);
GL11.glPopMatrix();
- this.drawString(fontRendererObj, curse.getDisplayName(), guiLeft + 70, guiTop + 15 + (ind - page * 5) * (size - 8), playerInfo.getInteger(curse.getName()) > 0 ? 0xffffffff : 0xaaffffff);
+ this.drawString(fontRendererObj, curse.getDisplayName(),
+ guiLeft + 70,
+ guiTop + 15 + (ind - page * 5) * (size - 8),
+ playerInfo.getInteger(curse.getName()) > 0
+ ? 0xffffffff : 0xaaffffff);
if (playerInfo.getInteger(curse.getName()) <= 0) {
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
@@ -182,12 +282,15 @@ public class GuiCurseInfo extends GuiContainer { }
@Override
- public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {}
+ public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
+ // Do nothing
+ }
@Override
protected void keyTyped(char charecter, int key) {
super.keyTyped(charecter, key);
- if (key == KeyBindings.curses.getKeyCode()) mc.thePlayer.closeScreen();
+ if (key == KeyBindings.curses.getKeyCode())
+ mc.thePlayer.closeScreen();
}
@Override
@@ -200,44 +303,78 @@ public class GuiCurseInfo extends GuiContainer { TabRegistry.addTabsToList(this.buttonList);
}
+ @Override
protected void mouseClicked(int x, int y, int id) {
super.mouseClicked(x, y, id);
int ind = 0;
int size = 32;
if (player != null) {
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(player, Variables.MODID);
for (Curse curse : Curse.getCurseList()) {
if (player.capabilities.isCreativeMode) {
- if (x > (guiLeft + 43) && y > (guiTop + 8 + (size - 8) * (ind - page * 5)) && x < (guiLeft + 43 + 112) && y < (guiTop + 40 + (size - 8) * (ind - page * 5)) && ind >= page * 5 && ind < (page + 1) * 5) {
- if (player.capabilities.isCreativeMode && isCtrlKeyDown() && playerInfo.getInteger(curse.getName()) > 0) {
+ if (x > (guiLeft + 43)
+ && y > (guiTop + 8
+ + (size - 8) * (ind - page * 5))
+ && x < (guiLeft + 43 + 112)
+ && y < (guiTop + 40
+ + (size - 8) * (ind - page * 5))
+ && ind >= page * 5 && ind < (page + 1) * 5) {
+ if (player.capabilities.isCreativeMode
+ && isCtrlKeyDown() && playerInfo
+ .getInteger(curse.getName()) > 0) {
playerInfo.setInteger(curse.getName(), 0);
- playerInfo.setInteger("activeCurses", playerInfo.getInteger("activeCurses") - 1);
+ playerInfo.setInteger("activeCurses",
+ playerInfo.getInteger("activeCurses")
+ - 1);
Curse.availableCurses.add(curse);
- JewelrycraftMod.netWrapper.sendToServer(new PacketSendServerPlayerInfo("remove", curse.getName(), playerInfo));
- JewelrycraftMod.netWrapper.sendToAll(new PacketSendServerPlayersInfo());
- }
- else if (player.capabilities.isCreativeMode && isCtrlKeyDown() && playerInfo.getInteger(curse.getName()) <= 0 && curse.canCurseBeActivated() && ConfigHandler.CURSES_ENABLED) {
+ JewelrycraftMod.netWrapper.sendToServer(
+ new PacketSendServerPlayerInfo(
+ "remove", curse.getName(),
+ playerInfo));
+ JewelrycraftMod.netWrapper.sendToAll(
+ new PacketSendServerPlayersInfo());
+ } else if (player.capabilities.isCreativeMode
+ && isCtrlKeyDown()
+ && playerInfo
+ .getInteger(curse.getName()) <= 0
+ && curse.canCurseBeActivated()
+ && ConfigHandler.CURSES_ENABLED) {
playerInfo.setInteger(curse.getName(), 1);
- playerInfo.setInteger("activeCurses", playerInfo.getInteger("activeCurses") + 1);
+ playerInfo.setInteger("activeCurses",
+ playerInfo.getInteger("activeCurses")
+ + 1);
Curse.availableCurses.remove(curse);
- JewelrycraftMod.netWrapper.sendToServer(new PacketSendServerPlayerInfo("add", curse.getName(), playerInfo));
- JewelrycraftMod.netWrapper.sendToAll(new PacketSendServerPlayersInfo());
- }
- else selectedCurse = curse.getName();
+ JewelrycraftMod.netWrapper.sendToServer(
+ new PacketSendServerPlayerInfo("add",
+ curse.getName(), playerInfo));
+ JewelrycraftMod.netWrapper.sendToAll(
+ new PacketSendServerPlayersInfo());
+ } else
+ selectedCurse = curse.getName();
}
ind++;
- }
- else if (playerInfo.getInteger(curse.getName()) > 0) {
- if (x > (guiLeft + 43) && y > (guiTop + 8 + (size - 8) * (ind - page * 5)) && x < (guiLeft + 43 + 112) && y < (guiTop + 40 + (size - 8) * (ind - page * 5)) && ind >= page * 5 && ind < (page + 1) * 5) selectedCurse = curse.getName();
+ } else if (playerInfo.getInteger(curse.getName()) > 0) {
+ if (x > (guiLeft + 43)
+ && y > (guiTop + 8
+ + (size - 8) * (ind - page * 5))
+ && x < (guiLeft + 43 + 112)
+ && y < (guiTop + 40
+ + (size - 8) * (ind - page * 5))
+ && ind >= page * 5 && ind < (page + 1) * 5)
+ selectedCurse = curse.getName();
ind++;
}
}
}
- if (page > 0 && x > guiLeft + 5 && x < guiLeft + 18 && y > guiTop + ySize - 14 && y < guiTop + ySize - 3) {
+ if (page > 0 && x > guiLeft + 5 && x < guiLeft + 18
+ && y > guiTop + ySize - 14 && y < guiTop + ySize - 3) {
page--;
selectedCurse = "";
}
- if (page < maxPages && x > guiLeft + xSize - 38 && x < guiLeft + xSize - 25 && y > guiTop + ySize - 14 && y < guiTop + ySize - 3) {
+ if (page < maxPages && x > guiLeft + xSize - 38
+ && x < guiLeft + xSize - 25 && y > guiTop + ySize - 14
+ && y < guiTop + ySize - 3) {
page++;
selectedCurse = "";
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiGuide.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiGuide.java index aa47840..a91b5a4 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiGuide.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiGuide.java @@ -2,7 +2,9 @@ package darkknight.jewelrycraft.client.gui; import java.util.ArrayList;
import java.util.List;
+
import org.lwjgl.opengl.GL11;
+
import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.block.BlockShadowEye;
import net.minecraft.block.Block;
@@ -18,200 +20,219 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
-public class GuiGuide extends GuiContainer
-{
- public int page, rot, del;
- public boolean prevHover, nextHover;
- World world;
- private final GuiTab[] tabs = new GuiTab[]{new GuiTabIntroduction(0), new GuiTabBlocks(1), new GuiTabItems(2), new GuiTabGemsAndIngots(3), new GuiTabCurses(4), new GuiTabModifiers(5), new GuiTabRitual(6)};
- private GuiTab activeTab;
- ResourceLocation pageTexture, flippedPageTexture;
- // GUIDE
- public static GuiTab prevActive = new GuiTabIntroduction(0);
- public static int prevPage = 1;
-
- public GuiGuide(Container container, World world, ResourceLocation pageTex, ResourceLocation flipPageTex)
- {
- super(container);
- page = prevPage;
- rot = 0;
- del = 0;
- this.world = world;
- activeTab = prevActive;
- pageTexture = pageTex;
- flippedPageTexture = flipPageTex;
- this.xSize = 240;
- }
-
- @Override
- protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
- {
- nextHover = false;
- prevHover = false;
- if (del == 0)
- rot++;
- del++;
- if (del >= 2)
- del = 0;
- Minecraft.getMinecraft().getTextureManager().bindTexture(pageTexture);
- drawTexturedModalRect(guiLeft + 147 / 2 + 20, guiTop - 10, 0, 0, 145, 179);
- Minecraft.getMinecraft().getTextureManager().bindTexture(flippedPageTexture);
- drawTexturedModalRect(guiLeft - 147 / 2 + 21, guiTop - 10, 0, 0, 145, 179);
- for(GuiRectangle tab: tabs){
- int srcX = 24;
- int sizeX = 19;
- if (tab == activeTab) {
- srcX += 38;
- sizeX += 3;
- }else
- if (tab.inRect(this, i, j))
- srcX += 19;
- tab.draw(this, srcX, 180, sizeX, 18);
- }
- if (i >= guiLeft + 195 + 20 && i <= guiLeft + 195 + 20 + 11 && j >= guiTop + 127 + 20 && j <= guiTop + 127 + 20 + 14 && page + 2 <= activeTab.getMaxPages()) {
- drawTexturedModalRect(guiLeft + 195 + 20, guiTop + 127 + 20, 0, 180, 11, 14);
- nextHover = true;
- }
- if (i >= guiLeft + 20 - 61 && i <= guiLeft - 61 + 20 + 11 && j >= guiTop + 127 + 20 && j <= guiTop + 127 + 20 + 14 && page - 2 > 0) {
- drawTexturedModalRect(guiLeft - 61 + 20, guiTop + 127 + 20, 11, 180, 11, 14);
- prevHover = true;
- }
- activeTab.drawBackground(this, i, j, page);
- activeTab.drawBackground(this, i, j, page + 1);
- ArrayList<String> text = new ArrayList<String>();
- text.add(page + "/" + activeTab.getMaxPages());
- drawHoveringText(text, guiLeft - 10 + 20 - text.get(0).length(), guiTop + 150 + 25, fontRendererObj);
- if (page < activeTab.getMaxPages()) {
- text.remove(0);
- text.add((page + 1) + "/" + activeTab.getMaxPages());
- drawHoveringText(text, guiLeft - 10 + 20 + 147 - text.get(0).length(), guiTop + 150 + 25, fontRendererObj);
- }
- for(int tab = 0; tab < tabs.length; tab++)
- renderItem(tabs[tab].getIcon(), guiLeft - 52, guiTop + 26 + tab * 19, activeTab.getIcon());
- }
-
- @Override
- protected void drawGuiContainerForegroundLayer(int x, int y)
- {
- activeTab.drawForeground(this, x, y, page);
- activeTab.drawForeground(this, x, y, page + 1);
- for(GuiTab tab: tabs)
- tab.drawString(this, x, y, tab.getName());
- }
-
- @Override
- protected void mouseClicked(int x, int y, int button)
- {
- if (nextHover && page + 2 <= activeTab.getMaxPages()) {
- page += 2;
- prevPage = page;
- }else
- if (prevHover && page > 1) {
- page -= 2;
- prevPage = page;
- }
- activeTab.mouseClick(this, x, y, button);
- for(GuiTab tab: tabs)
- if (activeTab != tab)
- if (tab.inRect(this, x, y)) {
- activeTab = tab;
- prevActive = tab;
- page = 1;
- prevPage = page;
- break;
- }
- }
-
- public void renderItem(ItemStack item, float x, float y, ItemStack activeIcon)
- {
- GL11.glPushMatrix();
- GL11.glDisable(GL11.GL_LIGHTING);
- EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D, 0.0D, item);
- entityitem.hoverStart = 0.0F;
- if (item.isItemEqual(new ItemStack(BlockList.smelter))) {
- y -= 3;
- x += 1;
- }
- GL11.glTranslatef(x, y, 100);
- float scale = 30F;
- GL11.glScalef(-scale, scale, scale);
- if (activeIcon != null && item.isItemEqual(activeIcon))
- GL11.glRotatef(rot, 0, 1, 0);
- if (item.isItemEqual(new ItemStack(BlockList.smelter)))
- GL11.glScalef(1.5F, 1.5F, 1.5F);
- else if (item.isItemEqual(new ItemStack(BlockList.handPedestal))) {
- GL11.glScalef(1.2F, 1.2F, 1.2F);
- GL11.glTranslatef(0F, -0.05F, 0F);
- }
- GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
- if (!(Block.getBlockFromItem(entityitem.getEntityItem().getItem()) instanceof BlockAir))
- RenderHelper.enableStandardItemLighting();
- if (RenderManager.instance.options.fancyGraphics)
- RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- else{
- GL11.glRotatef(180F, 0F, 1F, 0F);
- RenderManager.instance.options.fancyGraphics = true;
- RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- RenderManager.instance.options.fancyGraphics = false;
- }
- if (!(Block.getBlockFromItem(entityitem.getEntityItem().getItem()) instanceof BlockAir))
- RenderHelper.disableStandardItemLighting();
- GL11.glEnable(GL11.GL_LIGHTING);
- GL11.glPopMatrix();
- }
-
- public void renderItem(ItemStack item, float x, float y, float scale, boolean rotate, float xRot, float yRot, float zRot)
- {
- GL11.glPushMatrix();
- EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D, 0.0D, item);
- entityitem.hoverStart = 0.0F;
- GL11.glTranslatef(x, y, 100);
- GL11.glScalef(-scale, scale, scale);
- GL11.glRotatef(160.0F, 1.0F, 0.0F, 0.0F);
- if (rotate)
- GL11.glRotatef(rot, 0.0F, 1.0F, 0.0F);
- else{
- GL11.glRotatef(xRot, 1, 0, 0);
- GL11.glRotatef(yRot, 0, 1, 0);
- GL11.glRotatef(zRot, 0, 0, 1);
- if (xRot >= 90F || zRot >= 90F)
- GL11.glTranslatef(0F, -0.2F, 0F);
- if (Block.getBlockFromItem(entityitem.getEntityItem().getItem()) instanceof BlockShadowEye)
- GL11.glTranslatef(0F, 0F, 0.025F);
- }
- if (!(Block.getBlockFromItem(entityitem.getEntityItem().getItem()) instanceof BlockAir))
- RenderHelper.enableStandardItemLighting();
- if (RenderManager.instance.options.fancyGraphics)
- RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- else{
- RenderManager.instance.options.fancyGraphics = true;
- RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- RenderManager.instance.options.fancyGraphics = false;
- }
- if (!(Block.getBlockFromItem(entityitem.getEntityItem().getItem()) instanceof BlockAir))
- RenderHelper.disableStandardItemLighting();
- GL11.glPopMatrix();
- }
-
- public int getLeft()
- {
- return guiLeft;
- }
-
- public int getTop()
- {
- return guiTop;
- }
-
- public FontRenderer getFont()
- {
- return fontRendererObj;
- }
-
- @SuppressWarnings ("rawtypes")
- public void drawHoverString(List lst, int x, int y)
- {
- drawHoveringText(lst, x, y, fontRendererObj);
- RenderHelper.enableGUIStandardItemLighting();
- }
+public class GuiGuide extends GuiContainer {
+ public int page, rot, del;
+ public boolean prevHover, nextHover;
+ World world;
+ private final GuiTab[] tabs =
+ new GuiTab[] { new GuiTabIntroduction(0), new GuiTabBlocks(1),
+ new GuiTabItems(2), new GuiTabGemsAndIngots(3),
+ new GuiTabCurses(4), new GuiTabModifiers(5),
+ new GuiTabRitual(6) };
+ private GuiTab activeTab;
+ ResourceLocation pageTexture, flippedPageTexture;
+ // GUIDE
+ public static GuiTab prevActive = new GuiTabIntroduction(0);
+ public static int prevPage = 1;
+
+ public GuiGuide(Container container, World world,
+ ResourceLocation pageTex, ResourceLocation flipPageTex) {
+ super(container);
+ page = prevPage;
+ rot = 0;
+ del = 0;
+ this.world = world;
+ activeTab = prevActive;
+ pageTexture = pageTex;
+ flippedPageTexture = flipPageTex;
+ this.xSize = 240;
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
+ nextHover = false;
+ prevHover = false;
+ if (del == 0)
+ rot++;
+ del++;
+ if (del >= 2)
+ del = 0;
+ Minecraft.getMinecraft().getTextureManager()
+ .bindTexture(pageTexture);
+ drawTexturedModalRect(guiLeft + 147 / 2 + 20, guiTop - 10, 0, 0,
+ 145, 179);
+ Minecraft.getMinecraft().getTextureManager()
+ .bindTexture(flippedPageTexture);
+ drawTexturedModalRect(guiLeft - 147 / 2 + 21, guiTop - 10, 0, 0,
+ 145, 179);
+ for (GuiRectangle tab : tabs) {
+ int srcX = 24;
+ int sizeX = 19;
+ if (tab == activeTab) {
+ srcX += 38;
+ sizeX += 3;
+ } else if (tab.inRect(this, i, j))
+ srcX += 19;
+ tab.draw(this, srcX, 180, sizeX, 18);
+ }
+ if (i >= guiLeft + 195 + 20 && i <= guiLeft + 195 + 20 + 11
+ && j >= guiTop + 127 + 20 && j <= guiTop + 127 + 20 + 14
+ && page + 2 <= activeTab.getMaxPages()) {
+ drawTexturedModalRect(guiLeft + 195 + 20, guiTop + 127 + 20, 0,
+ 180, 11, 14);
+ nextHover = true;
+ }
+ if (i >= guiLeft + 20 - 61 && i <= guiLeft - 61 + 20 + 11
+ && j >= guiTop + 127 + 20 && j <= guiTop + 127 + 20 + 14
+ && page - 2 > 0) {
+ drawTexturedModalRect(guiLeft - 61 + 20, guiTop + 127 + 20, 11,
+ 180, 11, 14);
+ prevHover = true;
+ }
+ activeTab.drawBackground(this, i, j, page);
+ activeTab.drawBackground(this, i, j, page + 1);
+ ArrayList<String> text = new ArrayList<>();
+ text.add(page + "/" + activeTab.getMaxPages());
+ drawHoveringText(text, guiLeft - 10 + 20 - text.get(0).length(),
+ guiTop + 150 + 25, fontRendererObj);
+ if (page < activeTab.getMaxPages()) {
+ text.remove(0);
+ text.add((page + 1) + "/" + activeTab.getMaxPages());
+ drawHoveringText(text,
+ guiLeft - 10 + 20 + 147 - text.get(0).length(),
+ guiTop + 150 + 25, fontRendererObj);
+ }
+ for (int tab = 0; tab < tabs.length; tab++)
+ renderItem(tabs[tab].getIcon(), guiLeft - 52,
+ guiTop + 26 + tab * 19, activeTab.getIcon());
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int x, int y) {
+ activeTab.drawForeground(this, x, y, page);
+ activeTab.drawForeground(this, x, y, page + 1);
+ for (GuiTab tab : tabs)
+ tab.drawString(this, x, y, tab.getName());
+ }
+
+ @Override
+ protected void mouseClicked(int x, int y, int button) {
+ if (nextHover && page + 2 <= activeTab.getMaxPages()) {
+ page += 2;
+ prevPage = page;
+ } else if (prevHover && page > 1) {
+ page -= 2;
+ prevPage = page;
+ }
+ activeTab.mouseClick(this, x, y, button);
+ for (GuiTab tab : tabs)
+ if (activeTab != tab)
+ if (tab.inRect(this, x, y)) {
+ activeTab = tab;
+ prevActive = tab;
+ page = 1;
+ prevPage = page;
+ break;
+ }
+ }
+
+ public void renderItem(ItemStack item, float x, float y,
+ ItemStack activeIcon) {
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ EntityItem entityitem =
+ new EntityItem(world, 0.0D, 0.0D, 0.0D, item);
+ entityitem.hoverStart = 0.0F;
+ if (item.isItemEqual(new ItemStack(BlockList.smelter))) {
+ y -= 3;
+ x += 1;
+ }
+ GL11.glTranslatef(x, y, 100);
+ float scale = 30F;
+ GL11.glScalef(-scale, scale, scale);
+ if (activeIcon != null && item.isItemEqual(activeIcon))
+ GL11.glRotatef(rot, 0, 1, 0);
+ if (item.isItemEqual(new ItemStack(BlockList.smelter)))
+ GL11.glScalef(1.5F, 1.5F, 1.5F);
+ else if (item.isItemEqual(new ItemStack(BlockList.handPedestal))) {
+ GL11.glScalef(1.2F, 1.2F, 1.2F);
+ GL11.glTranslatef(0F, -0.05F, 0F);
+ }
+ GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
+ if (!(Block.getBlockFromItem(
+ entityitem.getEntityItem().getItem()) instanceof BlockAir))
+ RenderHelper.enableStandardItemLighting();
+ if (RenderManager.instance.options.fancyGraphics)
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D,
+ 0.0D, 0.0D, 0.0F, 0.0F);
+ else {
+ GL11.glRotatef(180F, 0F, 1F, 0F);
+ RenderManager.instance.options.fancyGraphics = true;
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D,
+ 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderManager.instance.options.fancyGraphics = false;
+ }
+ if (!(Block.getBlockFromItem(
+ entityitem.getEntityItem().getItem()) instanceof BlockAir))
+ RenderHelper.disableStandardItemLighting();
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glPopMatrix();
+ }
+
+ public void renderItem(ItemStack item, float x, float y, float scale,
+ boolean rotate, float xRot, float yRot, float zRot) {
+ GL11.glPushMatrix();
+ EntityItem entityitem =
+ new EntityItem(world, 0.0D, 0.0D, 0.0D, item);
+ entityitem.hoverStart = 0.0F;
+ GL11.glTranslatef(x, y, 100);
+ GL11.glScalef(-scale, scale, scale);
+ GL11.glRotatef(160.0F, 1.0F, 0.0F, 0.0F);
+ if (rotate)
+ GL11.glRotatef(rot, 0.0F, 1.0F, 0.0F);
+ else {
+ GL11.glRotatef(xRot, 1, 0, 0);
+ GL11.glRotatef(yRot, 0, 1, 0);
+ GL11.glRotatef(zRot, 0, 0, 1);
+ if (xRot >= 90F || zRot >= 90F)
+ GL11.glTranslatef(0F, -0.2F, 0F);
+ if (Block.getBlockFromItem(entityitem.getEntityItem()
+ .getItem()) instanceof BlockShadowEye)
+ GL11.glTranslatef(0F, 0F, 0.025F);
+ }
+ if (!(Block.getBlockFromItem(
+ entityitem.getEntityItem().getItem()) instanceof BlockAir))
+ RenderHelper.enableStandardItemLighting();
+ if (RenderManager.instance.options.fancyGraphics)
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D,
+ 0.0D, 0.0D, 0.0F, 0.0F);
+ else {
+ RenderManager.instance.options.fancyGraphics = true;
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D,
+ 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderManager.instance.options.fancyGraphics = false;
+ }
+ if (!(Block.getBlockFromItem(
+ entityitem.getEntityItem().getItem()) instanceof BlockAir))
+ RenderHelper.disableStandardItemLighting();
+ GL11.glPopMatrix();
+ }
+
+ public int getLeft() {
+ return guiLeft;
+ }
+
+ public int getTop() {
+ return guiTop;
+ }
+
+ public FontRenderer getFont() {
+ return fontRendererObj;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public void drawHoverString(List lst, int x, int y) {
+ drawHoveringText(lst, x, y, fontRendererObj);
+ RenderHelper.enableGUIStandardItemLighting();
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiHandler.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiHandler.java index 0218886..ae21f08 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiHandler.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiHandler.java @@ -16,78 +16,99 @@ import net.minecraft.tileentity.TileEntityChest; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
-public class GuiHandler implements IGuiHandler
-{
- ResourceLocation pageTexture = new ResourceLocation(Variables.MODID, "textures/gui/guidePage.png");
- ResourceLocation flippedPageTexture = new ResourceLocation(Variables.MODID, "textures/gui/guidePageFlip.png");
- ResourceLocation chestTexture = new ResourceLocation(Variables.MODID, "textures/gui/chest_ring.png");
- ResourceLocation jewelryInvTexture = new ResourceLocation(Variables.MODID, "textures/gui/jewelry_tab.png");
- ResourceLocation cursesInvTexture = new ResourceLocation(Variables.MODID, "textures/gui/curses_tab.png");
- ResourceLocation jewlryModTexture = new ResourceLocation(Variables.MODID, "textures/gui/jewelry_modifier.png");
-
- /**
- *
- */
- public GuiHandler()
- {
- NetworkRegistry.INSTANCE.registerGuiHandler(JewelrycraftMod.instance, this);
- }
-
- /**
- * @param ID
- * @param player
- * @param world
- * @param x
- * @param y
- * @param z
- * @return
- */
- @Override
- public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
- {
- switch(ID)
- {
- case 0:
- return new ContainerRingChest(player.inventory, (TileEntityChest)world.getTileEntity(x, y, z));
- case 1:
- return new ContainerGuide();
- case 2:
- return new ContainerJewelryTab(player, player.inventory, new JewelryInventory(player));
- case 3:
- return new ContainerJewelryModifier(player.inventory, new InventoryBasic("ItemModifier", false, 37));
- case 4:
- return new ContainerCurseInfo();
- default:
- return null;
- }
- }
-
- /**
- * @param ID
- * @param player
- * @param world
- * @param x
- * @param y
- * @param z
- * @return
- */
- @Override
- public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
- {
- switch(ID)
- {
- case 0:
- return new GuiRingChest((ContainerRingChest)getServerGuiElement(ID, player, world, x, y, z), chestTexture);
- case 1:
- return new GuiGuide((ContainerGuide)getServerGuiElement(ID, player, world, x, y, z), world, pageTexture, flippedPageTexture);
- case 2:
- return new GuiJewelry(new ContainerJewelryTab(player, player.inventory, new JewelryInventory(player)), jewelryInvTexture);
- case 3:
- return new GuiJewelryModifier((ContainerJewelryModifier)getServerGuiElement(ID, player, world, x, y, z), jewlryModTexture);
- case 4:
- return new GuiCurseInfo((ContainerCurseInfo)getServerGuiElement(ID, player, world, x, y, z), world, player, cursesInvTexture);
- default:
- return null;
- }
- }
+public class GuiHandler implements IGuiHandler {
+ ResourceLocation pageTexture = new ResourceLocation(
+ Variables.MODID, "textures/gui/guidePage.png");
+ ResourceLocation flippedPageTexture = new ResourceLocation(
+ Variables.MODID, "textures/gui/guidePageFlip.png");
+ ResourceLocation chestTexture = new ResourceLocation(
+ Variables.MODID, "textures/gui/chest_ring.png");
+ ResourceLocation jewelryInvTexture = new ResourceLocation(
+ Variables.MODID, "textures/gui/jewelry_tab.png");
+ ResourceLocation cursesInvTexture = new ResourceLocation(
+ Variables.MODID, "textures/gui/curses_tab.png");
+ ResourceLocation jewlryModTexture = new ResourceLocation(
+ Variables.MODID, "textures/gui/jewelry_modifier.png");
+
+ /**
+ *
+ */
+ public GuiHandler() {
+ NetworkRegistry.INSTANCE
+ .registerGuiHandler(JewelrycraftMod.instance, this);
+ }
+
+ /**
+ * @param ID
+ * @param player
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @return
+ */
+ @Override
+ public Object getServerGuiElement(int ID, EntityPlayer player,
+ World world, int x, int y, int z) {
+ switch (ID) {
+ case 0:
+ return new ContainerRingChest(player.inventory,
+ (TileEntityChest) world.getTileEntity(x, y, z));
+ case 1:
+ return new ContainerGuide();
+ case 2:
+ return new ContainerJewelryTab(player, player.inventory,
+ new JewelryInventory(player));
+ case 3:
+ return new ContainerJewelryModifier(player.inventory,
+ new InventoryBasic("ItemModifier", false, 37));
+ case 4:
+ return new ContainerCurseInfo();
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * @param ID
+ * @param player
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @return
+ */
+ @Override
+ public Object getClientGuiElement(int ID, EntityPlayer player,
+ World world, int x, int y, int z) {
+ switch (ID) {
+ case 0:
+ return new GuiRingChest(
+ (ContainerRingChest) getServerGuiElement(ID,
+ player, world, x, y, z),
+ chestTexture);
+ case 1:
+ return new GuiGuide(
+ (ContainerGuide) getServerGuiElement(ID, player,
+ world, x, y, z),
+ world, pageTexture, flippedPageTexture);
+ case 2:
+ return new GuiJewelry(
+ new ContainerJewelryTab(player, player.inventory,
+ new JewelryInventory(player)),
+ jewelryInvTexture);
+ case 3:
+ return new GuiJewelryModifier(
+ (ContainerJewelryModifier) getServerGuiElement(ID,
+ player, world, x, y, z),
+ jewlryModTexture);
+ case 4:
+ return new GuiCurseInfo(
+ (ContainerCurseInfo) getServerGuiElement(ID,
+ player, world, x, y, z),
+ world, player, cursesInvTexture);
+ default:
+ return null;
+ }
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelry.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelry.java index b08ea37..bccf2b1 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelry.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelry.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.client.gui;
import org.lwjgl.opengl.GL11;
+
import darkknight.jewelrycraft.client.TabJewelry;
import darkknight.jewelrycraft.client.TabRegistry;
import darkknight.jewelrycraft.client.gui.container.ContainerJewelryTab;
@@ -10,65 +11,66 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.util.ResourceLocation;
-public class GuiJewelry extends GuiContainer
-{
- ResourceLocation texture;
-
- /**
- * @param containerJewelryTab
- * @param texture
- */
- public GuiJewelry(ContainerJewelryTab containerJewelryTab, ResourceLocation texture)
- {
- super(containerJewelryTab);
- xSize = 194;
- ySize = 166;
- this.texture = texture;
- }
-
- /**
- * @param f
- * @param mouseX
- * @param mouseY
- */
- @Override
- public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY)
- {
- GL11.glColor3f(1, 1, 1);
- Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
- drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
- GL11.glPushMatrix();
- GuiInventory.func_147046_a(guiLeft - 24, guiTop + 124, 60, (float)(guiLeft - 24) - mouseX, (float)(guiTop + 124 - 90) - mouseY, this.mc.thePlayer);
- GL11.glPopMatrix();
- }
-
- /**
- * @param mouseX
- * @param mouseY
- */
- @Override
- public void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
- {}
-
- /**
- * @param charecter
- * @param key
- */
- @Override
- protected void keyTyped(char charecter, int key)
- {
- super.keyTyped(charecter, key);
- if (key == KeyBindings.inventory.getKeyCode()) mc.thePlayer.closeScreen();
- }
+public class GuiJewelry extends GuiContainer {
+ ResourceLocation texture;
+
+ /**
+ * @param containerJewelryTab
+ * @param texture
+ */
+ public GuiJewelry(ContainerJewelryTab containerJewelryTab,
+ ResourceLocation texture) {
+ super(containerJewelryTab);
+ xSize = 194;
+ ySize = 166;
+ this.texture = texture;
+ }
+
+ /**
+ * @param f
+ * @param mouseX
+ * @param mouseY
+ */
+ @Override
+ public void drawGuiContainerBackgroundLayer(float f, int mouseX,
+ int mouseY) {
+ GL11.glColor3f(1, 1, 1);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
+ drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
+ GL11.glPushMatrix();
+ GuiInventory.func_147046_a(guiLeft - 24, guiTop + 124, 60,
+ (float) (guiLeft - 24) - mouseX,
+ (float) (guiTop + 124 - 90) - mouseY, this.mc.thePlayer);
+ GL11.glPopMatrix();
+ }
+
+ /**
+ * @param mouseX
+ * @param mouseY
+ */
+ @Override
+ public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
+ // Do nothing
+ }
+
+ /**
+ * @param charecter
+ * @param key
+ */
+ @Override
+ protected void keyTyped(char charecter, int key) {
+ super.keyTyped(charecter, key);
+ if (key == KeyBindings.inventory.getKeyCode())
+ mc.thePlayer.closeScreen();
+ }
- @Override
- public void initGui ()
- {
- super.initGui();
- int cornerX = guiLeft;
- int cornerY = guiTop;
- this.buttonList.clear();
- TabRegistry.updateTabValues(cornerX, cornerY, TabJewelry.class);
- TabRegistry.addTabsToList(this.buttonList);
- }
+ @Override
+ public void initGui() {
+ super.initGui();
+ int cornerX = guiLeft;
+ int cornerY = guiTop;
+ this.buttonList.clear();
+ TabRegistry.updateTabValues(cornerX, cornerY, TabJewelry.class);
+ TabRegistry.addTabsToList(this.buttonList);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelryModifier.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelryModifier.java index 23f137f..df8035c 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelryModifier.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelryModifier.java @@ -4,8 +4,10 @@ import java.util.ArrayList; import java.util.HashMap;
import java.util.List;
import java.util.Map;
+
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
+
import darkknight.jewelrycraft.JewelrycraftMod;
import darkknight.jewelrycraft.client.gui.container.ContainerJewelryModifier;
import darkknight.jewelrycraft.network.PacketRequestSetSlot;
@@ -22,13 +24,21 @@ import net.minecraft.util.ResourceLocation; public class GuiJewelryModifier extends GuiContainer {
private ResourceLocation texture;
private GuiTextField searchField, pages;
- private int page = 1, maxPages = 1, selectedX = 0, selectedY = 0, selectedPage = 0, enabled = 0;
+ private int page =
+ 1, maxPages = 1, selectedX = 0, selectedY = 0,
+ selectedPage = 0, enabled = 0;
private ItemStack selectedItem;
- private ArrayList<ItemStack> selectedItems = new ArrayList<ItemStack>();
- private List<Map<Integer, Map<Integer, Integer>>> selectedItemsPos = new ArrayList<Map<Integer, Map<Integer, Integer>>>();
+ private ArrayList<
+ ItemStack> selectedItems =
+ new ArrayList<>();
+ private List<Map<Integer,
+ Map<Integer,
+ Integer>>> selectedItemsPos =
+ new ArrayList<>();
ContainerJewelryModifier jMod;
- public GuiJewelryModifier(ContainerJewelryModifier containerJewelryTab, ResourceLocation texture) {
+ public GuiJewelryModifier(ContainerJewelryModifier containerJewelryTab,
+ ResourceLocation texture) {
super(containerJewelryTab);
xSize = 211;
ySize = 247;
@@ -38,17 +48,24 @@ public class GuiJewelryModifier extends GuiContainer { }
@Override
- public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
+ public void drawGuiContainerBackgroundLayer(float f, int mouseX,
+ int mouseY) {
GL11.glColor3f(1, 1, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
- if (selectedX != 0 && selectedY != 0 && page == selectedPage) drawTexturedModalRect(k + selectedX, l + selectedY, 211, 0, 18, 18);
- for (Map<Integer, Map<Integer, Integer>> items : selectedItemsPos) {
+ if (selectedX != 0 && selectedY != 0 && page == selectedPage)
+ drawTexturedModalRect(k + selectedX, l + selectedY, 211, 0, 18,
+ 18);
+ for (Map<Integer,
+ Map<Integer, Integer>> items : selectedItemsPos) {
for (Object itemPage : items.keySet()) {
- if (page == (Integer) itemPage) for (int x : ((Map<Integer, Integer>) items.get(itemPage)).keySet())
- drawTexturedModalRect(k + x, l + (int) ((Map<Integer, Integer>) items.get(itemPage)).get(x), 211, 0, 18, 18);
+ if (page == (Integer) itemPage)
+ for (int x : items.get(itemPage).keySet())
+ drawTexturedModalRect(k + x,
+ l + items.get(itemPage).get(x), 211, 0, 18,
+ 18);
}
}
this.searchField.drawTextBox();
@@ -59,16 +76,29 @@ public class GuiJewelryModifier extends GuiContainer { public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
int i = 0;
for (ItemStack item : JewelrycraftUtil.objects) {
- if (item != null && item.getItem() != null && (this.searchField.getText() == "" || item.getDisplayName().toLowerCase().contains(this.searchField.getText().toLowerCase()))) {
+ if (item != null && item.getItem() != null
+ && (this.searchField.getText() == ""
+ || item.getDisplayName().toLowerCase()
+ .contains(this.searchField.getText()
+ .toLowerCase()))) {
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glColor3f(1F, 1F, 1F);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
- if (i >= (page - 1) * 48 && i < page * 48) try {
- itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), item, 88 + 20 * (i % 6), 7 + 17 * (i / 6) - 136 * (page - 1));
- } catch (Exception e) {
- JewelrycraftMod.logger.info("Trying to display an item but gets this error: " + e.getMessage() + "\nThe item causing the issue is: " + item);
- }
+ if (i >= (page - 1) * 48 && i < page * 48)
+ try {
+ itemRender.renderItemAndEffectIntoGUI(
+ this.fontRendererObj,
+ this.mc.getTextureManager(), item,
+ 88 + 20 * (i % 6),
+ 7 + 17 * (i / 6) - 136 * (page - 1));
+ } catch (Exception e) {
+ JewelrycraftMod.logger
+ .info("Trying to display an item but gets this error: "
+ + e.getMessage()
+ + "\nThe item causing the issue is: "
+ + item);
+ }
GL11.glDisable(GL11.GL_LIGHTING);
i++;
}
@@ -80,22 +110,35 @@ public class GuiJewelryModifier extends GuiContainer { if (this.searchField.textboxKeyTyped(character, key)) {
int items = 0;
for (ItemStack item : JewelrycraftUtil.objects)
- if (item != null && searchField != null && searchField.getText() != "" && item.getItem() != null && item.getDisplayName().toLowerCase().contains(this.searchField.getText().toLowerCase())) items++;
+ if (item != null && searchField != null
+ && searchField.getText() != ""
+ && item.getItem() != null
+ && item.getDisplayName().toLowerCase().contains(
+ this.searchField.getText().toLowerCase()))
+ items++;
maxPages = items / 48 + 1;
page = 1;
this.pages.setText(page + "/" + maxPages);
- } else super.keyTyped(character, key);
+ } else
+ super.keyTyped(character, key);
}
+ @Override
protected void mouseClicked(int x, int y, int id) {
super.mouseClicked(x, y, id);
- if (x >= this.searchField.xPosition && x <= this.searchField.xPosition + this.searchField.width && y >= this.searchField.yPosition && y <= this.searchField.yPosition + this.searchField.height) {
+ if (x >= this.searchField.xPosition
+ && x <= this.searchField.xPosition + this.searchField.width
+ && y >= this.searchField.yPosition
+ && y <= this.searchField.yPosition
+ + this.searchField.height) {
this.searchField.setText("");
this.searchField.setFocused(true);
maxPages = JewelrycraftUtil.objects.size() / 48 + 1;
- } else this.searchField.setFocused(false);
+ } else
+ this.searchField.setFocused(false);
for (Object button : this.buttonList) {
- if (((GuiButton) button).id < 4 && ((GuiButton) button).mousePressed(mc, x, y)) {
+ if (((GuiButton) button).id < 4
+ && ((GuiButton) button).mousePressed(mc, x, y)) {
if (((GuiButton) button).id != 3) {
this.selectedItems.removeAll(selectedItems);
this.selectedItemsPos.removeAll(selectedItemsPos);
@@ -114,18 +157,35 @@ public class GuiJewelryModifier extends GuiContainer { }
int i = 0;
for (ItemStack item : JewelrycraftUtil.objects) {
- if (item != null && item.getItem() != null && (this.searchField.getText() == "" || item.getDisplayName().toLowerCase().contains(this.searchField.getText().toLowerCase()))) {
- if (i >= (page - 1) * 48 && i < page * 48 && x >= this.guiLeft + 88 + 20 * (i % 6) && x < this.guiLeft + 108 + 20 * (i % 6) && y >= this.guiTop + 9 + 17 * (i / 6) - 136 * (page - 1) && y < this.guiTop + 25 + 17 * (i / 6) - 136 * (page - 1)) {
+ if (item != null && item.getItem() != null
+ && (this.searchField.getText() == ""
+ || item.getDisplayName().toLowerCase()
+ .contains(this.searchField.getText()
+ .toLowerCase()))) {
+ if (i >= (page - 1) * 48 && i < page * 48
+ && x >= this.guiLeft + 88 + 20 * (i % 6)
+ && x < this.guiLeft + 108 + 20 * (i % 6)
+ && y >= this.guiTop + 9 + 17 * (i / 6)
+ - 136 * (page - 1)
+ && y < this.guiTop + 25 + 17 * (i / 6)
+ - 136 * (page - 1)) {
try {
- if (!((GuiButton) buttonList.get(0)).enabled || !((GuiButton) buttonList.get(1)).enabled || !((GuiButton) buttonList.get(2)).enabled) {
+ if (!((GuiButton) buttonList.get(0)).enabled
+ || !((GuiButton) buttonList.get(1)).enabled
+ || !((GuiButton) buttonList
+ .get(2)).enabled) {
this.selectedItem = item;
this.selectedX = 87 + 20 * (i % 6);
- this.selectedY = 6 + 17 * (i / 6) - 136 * (page - 1);
+ this.selectedY =
+ 6 + 17 * (i / 6) - 136 * (page - 1);
this.selectedPage = page;
- } else if (!((GuiButton) buttonList.get(3)).enabled) {
- Map<Integer, Map<Integer, Integer>> itemPage = new HashMap<Integer, Map<Integer, Integer>>();
- Map<Integer, Integer> pos = new HashMap<Integer, Integer>();
- pos.put(87 + 20 * (i % 6), 6 + 17 * (i / 6) - 136 * (page - 1));
+ } else if (!((GuiButton) buttonList
+ .get(3)).enabled) {
+ Map<Integer, Map<Integer, Integer>> itemPage =
+ new HashMap<>();
+ Map<Integer, Integer> pos = new HashMap<>();
+ pos.put(87 + 20 * (i % 6),
+ 6 + 17 * (i / 6) - 136 * (page - 1));
itemPage.put(page, pos);
if (!this.selectedItems.contains(item)) {
this.selectedItems.add(item);
@@ -136,35 +196,57 @@ public class GuiJewelryModifier extends GuiContainer { }
}
} catch (Exception e) {
- JewelrycraftMod.logger.info("Trying to display an item but gets this error: " + e.getMessage() + "\nThe item causing the issue is: " + item);
+ JewelrycraftMod.logger
+ .info("Trying to display an item but gets this error: "
+ + e.getMessage()
+ + "\nThe item causing the issue is: "
+ + item);
}
}
i++;
}
}
- if (((GuiButton) buttonList.get(5)).mousePressed(mc, x, y) && page > 1) page--;
- if (((GuiButton) buttonList.get(6)).mousePressed(mc, x, y) && page < maxPages) page++;
+ if (((GuiButton) buttonList.get(5)).mousePressed(mc, x, y)
+ && page > 1)
+ page--;
+ if (((GuiButton) buttonList.get(6)).mousePressed(mc, x, y)
+ && page < maxPages)
+ page++;
if (jMod.modInv.getStackInSlot(36) != null) {
ItemStack targetItem = jMod.modInv.getStackInSlot(36).copy();
- if (((GuiButton) buttonList.get(4)).mousePressed(mc, x, y) && !((GuiButton) buttonList.get(0)).enabled) {
+ if (((GuiButton) buttonList.get(4)).mousePressed(mc, x, y)
+ && !((GuiButton) buttonList.get(0)).enabled) {
JewelryNBT.addIngotColor(targetItem, 16777215);
- JewelryNBT.addMetal(targetItem, new ItemStack(Item.getItemById(0), 0, 0));
- if (selectedItem != null) JewelryNBT.addMetal(targetItem, this.selectedItem);
- JewelrycraftMod.netWrapper.sendToServer(new PacketRequestSetSlot(targetItem));
+ JewelryNBT.addMetal(targetItem,
+ new ItemStack(Item.getItemById(0), 0, 0));
+ if (selectedItem != null)
+ JewelryNBT.addMetal(targetItem, this.selectedItem);
+ JewelrycraftMod.netWrapper.sendToServer(
+ new PacketRequestSetSlot(targetItem));
}
- if (((GuiButton) buttonList.get(4)).mousePressed(mc, x, y) && !((GuiButton) buttonList.get(1)).enabled) {
+ if (((GuiButton) buttonList.get(4)).mousePressed(mc, x, y)
+ && !((GuiButton) buttonList.get(1)).enabled) {
JewelryNBT.addGemColor(targetItem, 16777215);
- JewelryNBT.addGem(targetItem, new ItemStack(Item.getItemById(0), 0, 0));
- if (selectedItem != null) JewelryNBT.addGem(targetItem, this.selectedItem);
- JewelrycraftMod.netWrapper.sendToServer(new PacketRequestSetSlot(targetItem));
+ JewelryNBT.addGem(targetItem,
+ new ItemStack(Item.getItemById(0), 0, 0));
+ if (selectedItem != null)
+ JewelryNBT.addGem(targetItem, this.selectedItem);
+ JewelrycraftMod.netWrapper.sendToServer(
+ new PacketRequestSetSlot(targetItem));
}
- if (((GuiButton) buttonList.get(4)).mousePressed(mc, x, y) && !((GuiButton) buttonList.get(2)).enabled) {
- if (selectedItem != null) JewelryNBT.addItem(targetItem, selectedItem);
- JewelrycraftMod.netWrapper.sendToServer(new PacketRequestSetSlot(targetItem));
+ if (((GuiButton) buttonList.get(4)).mousePressed(mc, x, y)
+ && !((GuiButton) buttonList.get(2)).enabled) {
+ if (selectedItem != null)
+ JewelryNBT.addItem(targetItem, selectedItem);
+ JewelrycraftMod.netWrapper.sendToServer(
+ new PacketRequestSetSlot(targetItem));
}
- if (((GuiButton) buttonList.get(4)).mousePressed(mc, x, y) && !((GuiButton) buttonList.get(3)).enabled) {
- if (!selectedItems.isEmpty()) JewelryNBT.addModifiers(targetItem, selectedItems);
- JewelrycraftMod.netWrapper.sendToServer(new PacketRequestSetSlot(targetItem));
+ if (((GuiButton) buttonList.get(4)).mousePressed(mc, x, y)
+ && !((GuiButton) buttonList.get(3)).enabled) {
+ if (!selectedItems.isEmpty())
+ JewelryNBT.addModifiers(targetItem, selectedItems);
+ JewelrycraftMod.netWrapper.sendToServer(
+ new PacketRequestSetSlot(targetItem));
}
}
this.pages.setText(page + "/" + maxPages);
@@ -173,36 +255,62 @@ public class GuiJewelryModifier extends GuiContainer { @Override
public void initGui() {
super.initGui();
- this.searchField = new GuiTextField(this.fontRendererObj, this.guiLeft + 89, this.guiTop + 148, 115, this.fontRendererObj.FONT_HEIGHT + 3);
+ this.searchField = new GuiTextField(this.fontRendererObj,
+ this.guiLeft + 89, this.guiTop + 148, 115,
+ this.fontRendererObj.FONT_HEIGHT + 3);
this.searchField.setMaxStringLength(15);
this.searchField.setTextColor(16777215);
this.searchField.setVisible(true);
this.searchField.setCanLoseFocus(true);
- this.pages = new GuiTextField(this.fontRendererObj, this.guiLeft + 20, this.guiTop + 146, 50, this.fontRendererObj.FONT_HEIGHT + 3);
+ this.pages = new GuiTextField(this.fontRendererObj,
+ this.guiLeft + 20, this.guiTop + 146, 50,
+ this.fontRendererObj.FONT_HEIGHT + 3);
this.pages.setMaxStringLength(15);
this.pages.setTextColor(16777215);
this.pages.setVisible(true);
this.pages.setText(page + "/" + maxPages);
- this.buttonList.add(new GuiButton(0, this.guiLeft + 17, this.guiTop + 30, 52, 20, "Metal"));
- this.buttonList.add(new GuiButton(1, this.guiLeft + 17, this.guiTop + 52, 52, 20, "Gem"));
- this.buttonList.add(new GuiButton(2, this.guiLeft + 17, this.guiTop + 74, 52, 20, "Item"));
- this.buttonList.add(new GuiButton(3, this.guiLeft + 17, this.guiTop + 96, 52, 20, "Modifiers"));
- this.buttonList.add(new GuiButton(4, this.guiLeft + 17, this.guiTop + 118, 52, 20, "Add Items"));
- this.buttonList.add(new GuiButton(5, this.guiLeft + 5, this.guiTop + 142, 13, 20, "<<"));
- this.buttonList.add(new GuiButton(6, this.guiLeft + 73, this.guiTop + 142, 13, 20, ">>"));
+ this.buttonList.add(new GuiButton(0, this.guiLeft + 17,
+ this.guiTop + 30, 52, 20, "Metal"));
+ this.buttonList.add(new GuiButton(1, this.guiLeft + 17,
+ this.guiTop + 52, 52, 20, "Gem"));
+ this.buttonList.add(new GuiButton(2, this.guiLeft + 17,
+ this.guiTop + 74, 52, 20, "Item"));
+ this.buttonList.add(new GuiButton(3, this.guiLeft + 17,
+ this.guiTop + 96, 52, 20, "Modifiers"));
+ this.buttonList.add(new GuiButton(4, this.guiLeft + 17,
+ this.guiTop + 118, 52, 20, "Add Items"));
+ this.buttonList.add(new GuiButton(5, this.guiLeft + 5,
+ this.guiTop + 142, 13, 20, "<<"));
+ this.buttonList.add(new GuiButton(6, this.guiLeft + 73,
+ this.guiTop + 142, 13, 20, ">>"));
((GuiButton) buttonList.get(enabled)).enabled = false;
}
+ @Override
public void drawScreen(int x, int y, float z) {
super.drawScreen(x, y, z);
int i = 0;
- List<String> list = new ArrayList<String>();
+ List<String> list = new ArrayList<>();
for (ItemStack item : JewelrycraftUtil.objects) {
- if (item != null && item.getItem() != null && (this.searchField.getText() == "" || item.getDisplayName().toLowerCase().contains(this.searchField.getText().toLowerCase()))) {
- if (i >= (page - 1) * 48 && i < page * 48 && x >= this.guiLeft + 88 + 20 * (i % 6) && x < this.guiLeft + 108 + 20 * (i % 6) && y >= this.guiTop + 9 + 17 * (i / 6) - 136 * (page - 1) && y < this.guiTop + 25 + 17 * (i / 6) - 136 * (page - 1)) {
+ if (item != null && item.getItem() != null
+ && (this.searchField.getText() == ""
+ || item.getDisplayName().toLowerCase()
+ .contains(this.searchField.getText()
+ .toLowerCase()))) {
+ if (i >= (page - 1) * 48 && i < page * 48
+ && x >= this.guiLeft + 88 + 20 * (i % 6)
+ && x < this.guiLeft + 108 + 20 * (i % 6)
+ && y >= this.guiTop + 9 + 17 * (i / 6)
+ - 136 * (page - 1)
+ && y < this.guiTop + 25 + 17 * (i / 6)
+ - 136 * (page - 1)) {
list.add(item.getDisplayName());
- if (item.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips) != null) this.renderToolTip(item, x, y);
- else this.drawHoveringText(list, x, y, this.fontRendererObj);
+ if (item.getTooltip(mc.thePlayer,
+ mc.gameSettings.advancedItemTooltips) != null)
+ this.renderToolTip(item, x, y);
+ else
+ this.drawHoveringText(list, x, y,
+ this.fontRendererObj);
}
i++;
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiRectangle.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiRectangle.java index 7a20854..9ce5814 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiRectangle.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiRectangle.java @@ -1,96 +1,95 @@ package darkknight.jewelrycraft.client.gui;
import java.util.Arrays;
+
import net.minecraft.item.ItemStack;
-public class GuiRectangle
-{
- private int x;
- private int y;
- private int w;
- private int h;
-
- /**
- * @param x
- * @param y
- * @param w
- * @param h
- */
- public GuiRectangle(int x, int y, int w, int h)
- {
- this.x = x;
- this.y = y;
- this.w = w;
- this.h = h;
- }
-
- /**
- * @param gui
- * @param mouseX
- * @param mouseY
- * @return
- */
- public boolean inRect(GuiGuide gui, int mouseX, int mouseY)
- {
- mouseX -= gui.getLeft();
- mouseY -= gui.getTop();
- return x <= mouseX && mouseX <= x + w && y <= mouseY && mouseY <= y + h;
- }
-
- /**
- * @param x
- */
- public void setX(int x)
- {
- this.x = x;
- }
-
- /**
- * @param y
- */
- public void setY(int y)
- {
- this.y = y;
- }
-
- /**
- * @param gui
- * @param srcX
- * @param srcY
- */
- public void draw(GuiGuide gui, int srcX, int srcY)
- {
- gui.drawTexturedModalRect(gui.getLeft() + x, gui.getTop() + y, srcX, srcY, w, h);
- }
-
- /**
- * @param gui
- * @param srcX
- * @param srcY
- * @param width
- * @param height
- */
- public void draw(GuiGuide gui, int srcX, int srcY, int width, int height)
- {
- gui.drawTexturedModalRect(gui.getLeft() + x, gui.getTop() + y, srcX, srcY, width, height);
- }
-
- /**
- * @param gui
- * @param mouseX
- * @param mouseY
- * @param str
- */
- public void drawString(GuiGuide gui, int mouseX, int mouseY, String str)
- {
- if (inRect(gui, mouseX, mouseY)) gui.drawHoverString(Arrays.asList(str.split("\n")), mouseX - gui.getLeft(), mouseY - gui.getTop());
- }
-
- /**
- * @return
- */
- public ItemStack getIcon()
- {
- return null;
- }
+public class GuiRectangle {
+ private int x;
+ private int y;
+ private int w;
+ private int h;
+
+ /**
+ * @param x
+ * @param y
+ * @param w
+ * @param h
+ */
+ public GuiRectangle(int x, int y, int w, int h) {
+ this.x = x;
+ this.y = y;
+ this.w = w;
+ this.h = h;
+ }
+
+ /**
+ * @param gui
+ * @param mouseX
+ * @param mouseY
+ * @return
+ */
+ public boolean inRect(GuiGuide gui, int mouseX, int mouseY) {
+ mouseX -= gui.getLeft();
+ mouseY -= gui.getTop();
+ return x <= mouseX && mouseX <= x + w && y <= mouseY
+ && mouseY <= y + h;
+ }
+
+ /**
+ * @param x
+ */
+ public void setX(int x) {
+ this.x = x;
+ }
+
+ /**
+ * @param y
+ */
+ public void setY(int y) {
+ this.y = y;
+ }
+
+ /**
+ * @param gui
+ * @param srcX
+ * @param srcY
+ */
+ public void draw(GuiGuide gui, int srcX, int srcY) {
+ gui.drawTexturedModalRect(gui.getLeft() + x, gui.getTop() + y,
+ srcX, srcY, w, h);
+ }
+
+ /**
+ * @param gui
+ * @param srcX
+ * @param srcY
+ * @param width
+ * @param height
+ */
+ public void draw(GuiGuide gui, int srcX, int srcY, int width,
+ int height) {
+ gui.drawTexturedModalRect(gui.getLeft() + x, gui.getTop() + y,
+ srcX, srcY, width, height);
+ }
+
+ /**
+ * @param gui
+ * @param mouseX
+ * @param mouseY
+ * @param str
+ */
+ public void drawString(GuiGuide gui, int mouseX, int mouseY,
+ String str) {
+ if (inRect(gui, mouseX, mouseY))
+ gui.drawHoverString(Arrays.asList(str.split("\n")),
+ mouseX - gui.getLeft(), mouseY - gui.getTop());
+ }
+
+ /**
+ * @return
+ */
+ public ItemStack getIcon() {
+ return null;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiRingChest.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiRingChest.java index c31b311..4a71b11 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiRingChest.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiRingChest.java @@ -1,50 +1,49 @@ package darkknight.jewelrycraft.client.gui;
import org.lwjgl.opengl.GL11;
+
import darkknight.jewelrycraft.client.gui.container.ContainerRingChest;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.util.ResourceLocation;
-public class GuiRingChest extends GuiContainer
-{
- public ContainerRingChest container;
- ResourceLocation texture;
-
- /**
- * @param container
- * @param texture
- */
- public GuiRingChest(ContainerRingChest container, ResourceLocation texture)
- {
- super(container);
- this.container = container;
- xSize = 176;
- ySize = 166;
- this.texture = texture;
- }
-
- /**
- * @param f
- * @param mouseX
- * @param mouseY
- */
- @Override
- public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY)
- {
- GL11.glColor3f(1, 1, 1);
- Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
- drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
- }
-
- /**
- * @param mouseX
- * @param mouseY
- */
- @Override
- public void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
- {
- fontRendererObj.drawString("Linked Chest", 8, 6, 0x404040);
- fontRendererObj.drawString("Inventory", 8, 72, 0x404040);
- }
+public class GuiRingChest extends GuiContainer {
+ public ContainerRingChest container;
+ ResourceLocation texture;
+
+ /**
+ * @param container
+ * @param texture
+ */
+ public GuiRingChest(ContainerRingChest container,
+ ResourceLocation texture) {
+ super(container);
+ this.container = container;
+ xSize = 176;
+ ySize = 166;
+ this.texture = texture;
+ }
+
+ /**
+ * @param f
+ * @param mouseX
+ * @param mouseY
+ */
+ @Override
+ public void drawGuiContainerBackgroundLayer(float f, int mouseX,
+ int mouseY) {
+ GL11.glColor3f(1, 1, 1);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
+ drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
+ }
+
+ /**
+ * @param mouseX
+ * @param mouseY
+ */
+ @Override
+ public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
+ fontRendererObj.drawString("Linked Chest", 8, 6, 0x404040);
+ fontRendererObj.drawString("Inventory", 8, 72, 0x404040);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTab.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTab.java index 3ef224a..27ad51f 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTab.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTab.java @@ -5,8 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public abstract class GuiTab extends GuiRectangle { - protected int values; - protected int del; + protected int values; + protected int del; public GuiTab(int id) { super(-62, 10 + 19 * id, 19, 18); @@ -18,15 +18,21 @@ public abstract class GuiTab extends GuiRectangle { return ""; } - public abstract void drawBackground(GuiGuide gui, int x, int y, int page); + public abstract void drawBackground(GuiGuide gui, int x, int y, + int page); - public abstract void drawForeground(GuiGuide gui, int x, int y, int page); + public abstract void drawForeground(GuiGuide gui, int x, int y, + int page); - public void mouseClick(GuiGuide gui, int x, int y, int button) {} + public void mouseClick(GuiGuide gui, int x, int y, int button) { + } - public void mouseMoveClick(GuiGuide gui, int x, int y, int button, long timeSinceClicked) {} + public void mouseMoveClick(GuiGuide gui, int x, int y, int button, + long timeSinceClicked) { + } - public void mouseReleased(GuiGuide gui, int x, int y, int button) {} + public void mouseReleased(GuiGuide gui, int x, int y, int button) { + } public int getMaxPages() { return 1; diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabBlocks.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabBlocks.java index afbcc3e..8a48a1b 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabBlocks.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabBlocks.java @@ -9,133 +9,213 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
-public class GuiTabBlocks extends GuiTab
-{
-
- /**
- * @param id
- */
- public GuiTabBlocks(int id)
- {
- super(id);
- }
-
- public String getName()
- {
- return StatCollector.translateToLocal("guide." + Variables.MODID + ".tab.blocks");
- }
-
- /**
- * @return
- */
- @Override
- public ItemStack getIcon()
- {
- return new ItemStack(BlockList.smelter);
- }
-
- /**
- * @param gui
- * @param x
- * @param y
- * @param page
- */
- @Override
- public void drawBackground(GuiGuide gui, int x, int y, int page)
- {
- String text = "";
- int xPos = page % 2 == 0 ? 107 : -35;
- switch(page)
- {
- case 1:
- text = "This ore is extremely rare and can be found only between Y-level 5 and 8. It can only be mined using a diamond pickaxe.";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), new ItemStack(BlockList.shadowOre), text, 180f, 0, -18, true, 42, 100, true);
- break;
- case 2:
- text = "Magicians believed this block held the ability to merge with the shadows. It becomes more transparent as it gets darker. If a comparator is attached to it, the output strength will be equal to the value of darkness it is in.";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(BlockList.shadowBlock), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot));
- break;
- case 3:
- text = "The smelter is one of the first blocks needed to get started with Jewelrycraft. Requiring just some cobble and a couple buckets. It is required in order to melt ingots or even ores which can be made into rings, necklaces, bracelets or earrings. To use the block all you need to do";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(BlockList.smelter), new ItemStack(Blocks.cobblestone), new ItemStack(Items.bucket), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), null, new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Items.lava_bucket), new ItemStack(Blocks.cobblestone));
- break;
- case 4:
- text = "is right click on it with any ore or ingot. It can melt multiple ingots/ores at a time. Crouch (default: Shift) + Right Click will remove all items added. If right clicked when done smelting, it will say what the block contains.";
- Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
- break;
- case 5:
- text = "The molder is a key piece in creating jewelry. You need to pour the molten metal out of the smelter somewhere. That somewhere is the molder. But before pouring the molten metal in it, you must first add a mold. You can do that by simply right clicking the block with the mold of your";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(BlockList.molder), new ItemStack(Blocks.cobblestone), null, new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone));
- break;
- case 6:
- text = "choice. If you want to get the mold out, simply crouch and Right Click it with an empty hand. Once you have a mold inside, left click on the smelter and wait for the metal to cool down. When it's done, left click on the molder to get the jewellery. Be aware that this block must be placed directly in front of the smelter, otherwise it won't work!";
- Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
- break;
- case 7:
- text = "This table allows you to add a gem to a piece of jewelry. Right click the block while holding jewelry to add it in. Then do the same with a gem (you can find a list with all possible gems in this guide). Crouch + Right Click to retreive placed items. Left Click the block to see the";
- if (del == 0) values++;
- del++;
- if (del >= 300) del = 0;
- if (values >= 4) values = 0;
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(BlockList.jewelCraftingTable), new ItemStack(Blocks.planks, 1, values), new ItemStack(Blocks.planks, 1, values), new ItemStack(Blocks.planks, 1, values), new ItemStack(Blocks.stone), null, new ItemStack(Blocks.stone), new ItemStack(Blocks.stone), null, new ItemStack(Blocks.stone));
- break;
- case 8:
- text = "progress the crafting has made. Once the crafting is done, Left Click the block to get the item. You are able to recraft a jewellery by readding the modified version to this block and adding a different gem to it. Once the crafting is done, the current gem will be replaced by the new one. There is also a 50% chance that you will get back the old gem.";
- Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
- break;
- case 9:
- text = "The Storage Displayer, as the name suggests, can store a large amount (Up to: " + Integer.MAX_VALUE + ") of a single item/block placed in it. It will display all possible infromation about the object in it, such as the name, durability, enchantments etc. To store something in it";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(BlockList.displayer), null, new ItemStack(Items.iron_ingot), null, new ItemStack(Items.iron_ingot), new ItemStack(Items.iron_ingot), new ItemStack(Items.iron_ingot), new ItemStack(Blocks.emerald_block), new ItemStack(Blocks.emerald_block), new ItemStack(Blocks.emerald_block));
- break;
- case 10:
- text = "simply right click with that object on it and the whole amount of items or blocks you are holding will be immediately stored inside. If a displayer already contains an item and you have that in your inventory, you can simply hold right click on it with an empty hand to add all of your items of that type from your inventory. To retrieve a single item just left click the block. If you wish to get a whole stack, Crouch + Left Click on it. In creative mode you can simply hold Right";
- Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
- break;
- case 11:
- text = "Click on a displayer containing an object and it will add 64 of it with every right click, without it being in your inventory.";
- Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
- break;
- case 12:
- text = "This mysterious shaped block is used in the ritual. The acient ones claimed it had the power to travel through worlds. They would use these to offer sacrifices to 'The Dark One' in exchange for unimaginable powers.";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(BlockList.handPedestal), new ItemStack(Blocks.cobblestone_wall), new ItemStack(Blocks.cobblestone_wall), new ItemStack(Blocks.cobblestone_wall), null, new ItemStack(Blocks.stonebrick), null, new ItemStack(Blocks.stone_slab, 1, 5), new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stone_slab, 1, 5));
- break;
- case 13:
- text = "The Cursed Eye is an ancient artifact also known as 'The Dark One's Eye'. It is part of the sacrifice ritual the ancient ones talk about. Be careful though, for He sees everything. To see how to create the ritual look in the Ritual tab. One you created the ritual, simply place a";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(BlockList.shadowEye), new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Items.ender_eye), new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Blocks.stonebrick));
- break;
- case 14:
- text = "piece of jewelry in the middle pedestal and your modifiers of choice in the other ones (you don't need to put an item in every single pedestal). After you do that simply right click the eye to activate the ritual. Be careful not to leave the premise or you'll die! When the ritual is done, Shift+Right Click on the central hand pedestal to retrieve your newly modified item!";
- Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
- break;
- case 15:
- if (del == 0) values++;
- del++;
- if (del >= 50) del = 0;
- if (values >= 15) values = 0;
- text = "Crystals don't do much as of yet. They spawn naturally in caves and come in all 16 colors.";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), new ItemStack(BlockList.crystal, 1, values), text, 180f, 0, -18, true, 48, 120, true);
- break;
- default:
- ;
- }
- }
-
- /**
- * @return
- */
- @Override
- public int getMaxPages()
- {
- return 15;
- }
-
- /**
- * @param gui
- * @param x
- * @param y
- * @param page
- */
- @Override
- public void drawForeground(GuiGuide gui, int x, int y, int page)
- {}
+public class GuiTabBlocks extends GuiTab {
+
+ /**
+ * @param id
+ */
+ public GuiTabBlocks(int id) {
+ super(id);
+ }
+
+ @Override
+ public String getName() {
+ return StatCollector.translateToLocal(
+ "guide." + Variables.MODID + ".tab.blocks");
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public ItemStack getIcon() {
+ return new ItemStack(BlockList.smelter);
+ }
+
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param page
+ */
+ @Override
+ public void drawBackground(GuiGuide gui, int x, int y, int page) {
+ String text = "";
+ int xPos = page % 2 == 0 ? 107 : -35;
+ switch (page) {
+ case 1:
+ text = "This ore is extremely rare and can be found only between Y-level 5 and 8. It can only be mined using a diamond pickaxe.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop(), new ItemStack(BlockList.shadowOre),
+ text, 180f, 0, -18, true, 42, 100, true);
+ break;
+ case 2:
+ text = "Magicians believed this block held the ability to merge with the shadows. It becomes more transparent as it gets darker. If a comparator is attached to it, the output strength will be equal to the value of darkness it is in.";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop(), false, text, x, y, true,
+ new ItemStack(BlockList.shadowBlock),
+ new ItemStack(ItemList.shadowIngot),
+ new ItemStack(ItemList.shadowIngot),
+ new ItemStack(ItemList.shadowIngot),
+ new ItemStack(ItemList.shadowIngot),
+ new ItemStack(ItemList.shadowIngot),
+ new ItemStack(ItemList.shadowIngot),
+ new ItemStack(ItemList.shadowIngot),
+ new ItemStack(ItemList.shadowIngot),
+ new ItemStack(ItemList.shadowIngot));
+ break;
+ case 3:
+ text = "The smelter is one of the first blocks needed to get started with Jewelrycraft. Requiring just some cobble and a couple buckets. It is required in order to melt ingots or even ores which can be made into rings, necklaces, bracelets or earrings. To use the block all you need to do";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop(), false, text, x, y, true,
+ new ItemStack(BlockList.smelter),
+ new ItemStack(Blocks.cobblestone),
+ new ItemStack(Items.bucket),
+ new ItemStack(Blocks.cobblestone),
+ new ItemStack(Blocks.cobblestone), null,
+ new ItemStack(Blocks.cobblestone),
+ new ItemStack(Blocks.cobblestone),
+ new ItemStack(Items.lava_bucket),
+ new ItemStack(Blocks.cobblestone));
+ break;
+ case 4:
+ text = "is right click on it with any ore or ingot. It can melt multiple ingots/ores at a time. Crouch (default: Shift) + Right Click will remove all items added. If right clicked when done smelting, it will say what the block contains.";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(),
+ text);
+ break;
+ case 5:
+ text = "The molder is a key piece in creating jewelry. You need to pour the molten metal out of the smelter somewhere. That somewhere is the molder. But before pouring the molten metal in it, you must first add a mold. You can do that by simply right clicking the block with the mold of your";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop(), false, text, x, y, true,
+ new ItemStack(BlockList.molder),
+ new ItemStack(Blocks.cobblestone), null,
+ new ItemStack(Blocks.cobblestone),
+ new ItemStack(Blocks.cobblestone),
+ new ItemStack(Blocks.cobblestone),
+ new ItemStack(Blocks.cobblestone));
+ break;
+ case 6:
+ text = "choice. If you want to get the mold out, simply crouch and Right Click it with an empty hand. Once you have a mold inside, left click on the smelter and wait for the metal to cool down. When it's done, left click on the molder to get the jewellery. Be aware that this block must be placed directly in front of the smelter, otherwise it won't work!";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(),
+ text);
+ break;
+ case 7:
+ text = "This table allows you to add a gem to a piece of jewelry. Right click the block while holding jewelry to add it in. Then do the same with a gem (you can find a list with all possible gems in this guide). Crouch + Right Click to retreive placed items. Left Click the block to see the";
+ if (del == 0)
+ values++;
+ del++;
+ if (del >= 300)
+ del = 0;
+ if (values >= 4)
+ values = 0;
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop(), false, text, x, y, true,
+ new ItemStack(BlockList.jewelCraftingTable),
+ new ItemStack(Blocks.planks, 1, values),
+ new ItemStack(Blocks.planks, 1, values),
+ new ItemStack(Blocks.planks, 1, values),
+ new ItemStack(Blocks.stone), null,
+ new ItemStack(Blocks.stone),
+ new ItemStack(Blocks.stone), null,
+ new ItemStack(Blocks.stone));
+ break;
+ case 8:
+ text = "progress the crafting has made. Once the crafting is done, Left Click the block to get the item. You are able to recraft a jewellery by readding the modified version to this block and adding a different gem to it. Once the crafting is done, the current gem will be replaced by the new one. There is also a 50% chance that you will get back the old gem.";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(),
+ text);
+ break;
+ case 9:
+ text = "The Storage Displayer, as the name suggests, can store a large amount (Up to: "
+ + Integer.MAX_VALUE
+ + ") of a single item/block placed in it. It will display all possible infromation about the object in it, such as the name, durability, enchantments etc. To store something in it";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop(), false, text, x, y, true,
+ new ItemStack(BlockList.displayer), null,
+ new ItemStack(Items.iron_ingot), null,
+ new ItemStack(Items.iron_ingot),
+ new ItemStack(Items.iron_ingot),
+ new ItemStack(Items.iron_ingot),
+ new ItemStack(Blocks.emerald_block),
+ new ItemStack(Blocks.emerald_block),
+ new ItemStack(Blocks.emerald_block));
+ break;
+ case 10:
+ text = "simply right click with that object on it and the whole amount of items or blocks you are holding will be immediately stored inside. If a displayer already contains an item and you have that in your inventory, you can simply hold right click on it with an empty hand to add all of your items of that type from your inventory. To retrieve a single item just left click the block. If you wish to get a whole stack, Crouch + Left Click on it. In creative mode you can simply hold Right";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(),
+ text);
+ break;
+ case 11:
+ text = "Click on a displayer containing an object and it will add 64 of it with every right click, without it being in your inventory.";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(),
+ text);
+ break;
+ case 12:
+ text = "This mysterious shaped block is used in the ritual. The acient ones claimed it had the power to travel through worlds. They would use these to offer sacrifices to 'The Dark One' in exchange for unimaginable powers.";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop(), false, text, x, y, true,
+ new ItemStack(BlockList.handPedestal),
+ new ItemStack(Blocks.cobblestone_wall),
+ new ItemStack(Blocks.cobblestone_wall),
+ new ItemStack(Blocks.cobblestone_wall), null,
+ new ItemStack(Blocks.stonebrick), null,
+ new ItemStack(Blocks.stone_slab, 1, 5),
+ new ItemStack(Blocks.stonebrick),
+ new ItemStack(Blocks.stone_slab, 1, 5));
+ break;
+ case 13:
+ text = "The Cursed Eye is an ancient artifact also known as 'The Dark One's Eye'. It is part of the sacrifice ritual the ancient ones talk about. Be careful though, for He sees everything. To see how to create the ritual look in the Ritual tab. One you created the ritual, simply place a";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop(), false, text, x, y, true,
+ new ItemStack(BlockList.shadowEye),
+ new ItemStack(Blocks.stonebrick),
+ new ItemStack(Blocks.stained_hardened_clay, 1, 15),
+ new ItemStack(Blocks.stonebrick),
+ new ItemStack(Blocks.stained_hardened_clay, 1, 15),
+ new ItemStack(Items.ender_eye),
+ new ItemStack(Blocks.stained_hardened_clay, 1, 15),
+ new ItemStack(Blocks.stonebrick),
+ new ItemStack(Blocks.stained_hardened_clay, 1, 15),
+ new ItemStack(Blocks.stonebrick));
+ break;
+ case 14:
+ text = "piece of jewelry in the middle pedestal and your modifiers of choice in the other ones (you don't need to put an item in every single pedestal). After you do that simply right click the eye to activate the ritual. Be careful not to leave the premise or you'll die! When the ritual is done, Shift+Right Click on the central hand pedestal to retrieve your newly modified item!";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(),
+ text);
+ break;
+ case 15:
+ if (del == 0)
+ values++;
+ del++;
+ if (del >= 50)
+ del = 0;
+ if (values >= 15)
+ values = 0;
+ text = "Crystals don't do much as of yet. They spawn naturally in caves and come in all 16 colors.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop(),
+ new ItemStack(BlockList.crystal, 1, values), text,
+ 180f, 0, -18, true, 48, 120, true);
+ break;
+ default:
+ ;
+ }
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public int getMaxPages() {
+ return 15;
+ }
+
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param page
+ */
+ @Override
+ public void drawForeground(GuiGuide gui, int x, int y, int page) {
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabCurses.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabCurses.java index 9e544cb..03de3c2 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabCurses.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabCurses.java @@ -7,14 +7,15 @@ import darkknight.jewelrycraft.util.Variables; import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
-public class GuiTabCurses extends GuiTab
-{
+public class GuiTabCurses extends GuiTab {
public GuiTabCurses(int id) {
super(id);
}
+ @Override
public String getName() {
- return StatCollector.translateToLocal("guide." + Variables.MODID + ".tab.curses");
+ return StatCollector.translateToLocal(
+ "guide." + Variables.MODID + ".tab.curses");
}
@Override
@@ -27,51 +28,107 @@ public class GuiTabCurses extends GuiTab String text = "";
int xPos = page % 2 == 0 ? 107 : -35;
switch (page) {
- case 1:
- text = "You are poisoned for as long as this curse is active.";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.testItem, 1, 0), text, 40f, 0, 0, Curse.getCurseList().get(page-1).getDisplayName(), 45, 10, false);
- break;
- case 2:
- text = "Whenever you attack an entity you are set on fire.";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.testItem, 1, 1), text, 40f, 0, 0, Curse.getCurseList().get(page-1).getDisplayName(), 45, 10, false);
- break;
- case 3:
- text = "You can no longer throw any item. I mean, you might need them later, right?";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.testItem, 1, 2), text, 40f, 0, 0, Curse.getCurseList().get(page-1).getDisplayName(), 45, 10, false);
- break;
- case 4:
- text = "You are blinded. Literally. I mean, what did you expect?";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.testItem, 1, 3), text, 40f, 0, 0, Curse.getCurseList().get(page-1).getDisplayName(), 45, 10, false);
- break;
- case 5:
- text = "There is a random chance that when you attack a passive mob you will lose a full heart, but gain a black heart.";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.testItem, 1, 4), text, 40f, 0, 0, Curse.getCurseList().get(page-1).getDisplayName(), 45, 10, false);
- break;
- case 6:
- text = "Whatever you touch turns into gold. Believe me, this is no good to you, you can't even harvest this gold. At lest the items you can't. But if you touched an entity with your bear hands while the curse is active and then no longer have it, you should be able to mine it with an iron pick or higher. THe golden statue will drop gold nuggets depending on the size of the entity.";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.testItem, 1, 5), text, 40f, 0, 0, Curse.getCurseList().get(page-1).getDisplayName(), 45, 10, false);
- break;
- case 7:
- text = "Entities have a higher chance of dropping more items and hearts when killed.";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.testItem, 1, 6), text, 40f, 0, 0, Curse.getCurseList().get(page-1).getDisplayName(), 45, 10, false);
- break;
- case 8:
- text = "There is a random chance that you'll steal 1 heart from an entity that is collided with you. If you are low on health, you will heal. If you are fully healed, an extra heart will be added to you. You can steal up to 2 hearts per entity (3 if you complete the challenge). When you steal a heart, that entity will have their max health reduced by 1. Challenges are found in the Achievements menu.";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.testItem, 1, 7), text, 40f, 0, 0, Curse.getCurseList().get(page-1).getDisplayName(), 45, 10, false);
- break;
- case 9:
- text = "When you attack an entity and are low on health, there is a 50% chance that you'll heal half a heart. Also you will catch on fire if you're exposed to sun.";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.testItem, 1, 8), text, 40f, 0, 0, Curse.getCurseList().get(page-1).getDisplayName(), 45, 10, false);
- break;
- case 10:
- text = "Any mob you kill or block you destroy(eg. Diamond Ore, Redstone Ore, stuff that drops items not the block itself) drops double the amount of items it normally would.";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.testItem, 1, 9), text, 40f, 0, 0, Curse.getCurseList().get(page-1).getDisplayName(), 45, 10, false);
- break;
- case 11:
- text = "All the damage you do pierces through armor or any other type of defense, but creatures no longer drop XP.";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.testItem, 1, 10), text, 40f, 0, 0, Curse.getCurseList().get(page-1).getDisplayName(), 45, 10, false);
- break;
- default:;
+ case 1:
+ text = "You are poisoned for as long as this curse is active.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop() - 5,
+ new ItemStack(ItemList.testItem, 1, 0), text, 40f,
+ 0, 0, Curse.getCurseList().get(page - 1)
+ .getDisplayName(),
+ 45, 10, false);
+ break;
+ case 2:
+ text = "Whenever you attack an entity you are set on fire.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop() - 5,
+ new ItemStack(ItemList.testItem, 1, 1), text, 40f,
+ 0, 0, Curse.getCurseList().get(page - 1)
+ .getDisplayName(),
+ 45, 10, false);
+ break;
+ case 3:
+ text = "You can no longer throw any item. I mean, you might need them later, right?";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop() - 5,
+ new ItemStack(ItemList.testItem, 1, 2), text, 40f,
+ 0, 0, Curse.getCurseList().get(page - 1)
+ .getDisplayName(),
+ 45, 10, false);
+ break;
+ case 4:
+ text = "You are blinded. Literally. I mean, what did you expect?";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop() - 5,
+ new ItemStack(ItemList.testItem, 1, 3), text, 40f,
+ 0, 0, Curse.getCurseList().get(page - 1)
+ .getDisplayName(),
+ 45, 10, false);
+ break;
+ case 5:
+ text = "There is a random chance that when you attack a passive mob you will lose a full heart, but gain a black heart.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop() - 5,
+ new ItemStack(ItemList.testItem, 1, 4), text, 40f,
+ 0, 0, Curse.getCurseList().get(page - 1)
+ .getDisplayName(),
+ 45, 10, false);
+ break;
+ case 6:
+ text = "Whatever you touch turns into gold. Believe me, this is no good to you, you can't even harvest this gold. At lest the items you can't. But if you touched an entity with your bear hands while the curse is active and then no longer have it, you should be able to mine it with an iron pick or higher. THe golden statue will drop gold nuggets depending on the size of the entity.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop() - 5,
+ new ItemStack(ItemList.testItem, 1, 5), text, 40f,
+ 0, 0, Curse.getCurseList().get(page - 1)
+ .getDisplayName(),
+ 45, 10, false);
+ break;
+ case 7:
+ text = "Entities have a higher chance of dropping more items and hearts when killed.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop() - 5,
+ new ItemStack(ItemList.testItem, 1, 6), text, 40f,
+ 0, 0, Curse.getCurseList().get(page - 1)
+ .getDisplayName(),
+ 45, 10, false);
+ break;
+ case 8:
+ text = "There is a random chance that you'll steal 1 heart from an entity that is collided with you. If you are low on health, you will heal. If you are fully healed, an extra heart will be added to you. You can steal up to 2 hearts per entity (3 if you complete the challenge). When you steal a heart, that entity will have their max health reduced by 1. Challenges are found in the Achievements menu.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop() - 5,
+ new ItemStack(ItemList.testItem, 1, 7), text, 40f,
+ 0, 0, Curse.getCurseList().get(page - 1)
+ .getDisplayName(),
+ 45, 10, false);
+ break;
+ case 9:
+ text = "When you attack an entity and are low on health, there is a 50% chance that you'll heal half a heart. Also you will catch on fire if you're exposed to sun.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop() - 5,
+ new ItemStack(ItemList.testItem, 1, 8), text, 40f,
+ 0, 0, Curse.getCurseList().get(page - 1)
+ .getDisplayName(),
+ 45, 10, false);
+ break;
+ case 10:
+ text = "Any mob you kill or block you destroy(eg. Diamond Ore, Redstone Ore, stuff that drops items not the block itself) drops double the amount of items it normally would.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop() - 5,
+ new ItemStack(ItemList.testItem, 1, 9), text, 40f,
+ 0, 0, Curse.getCurseList().get(page - 1)
+ .getDisplayName(),
+ 45, 10, false);
+ break;
+ case 11:
+ text = "All the damage you do pierces through armor or any other type of defense, but creatures no longer drop XP.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop() - 5,
+ new ItemStack(ItemList.testItem, 1, 10), text, 40f,
+ 0, 0, Curse.getCurseList().get(page - 1)
+ .getDisplayName(),
+ 45, 10, false);
+ break;
+ default:
+ ;
}
}
@@ -81,5 +138,6 @@ public class GuiTabCurses extends GuiTab }
@Override
- public void drawForeground(GuiGuide gui, int x, int y, int page) {}
+ public void drawForeground(GuiGuide gui, int x, int y, int page) {
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabGemsAndIngots.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabGemsAndIngots.java index f72766a..086084f 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabGemsAndIngots.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabGemsAndIngots.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.client.gui;
import org.lwjgl.opengl.GL11;
+
import darkknight.jewelrycraft.util.JewelrycraftUtil;
import darkknight.jewelrycraft.util.Variables;
import net.minecraft.init.Items;
@@ -8,89 +9,129 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
-public class GuiTabGemsAndIngots extends GuiTab
-{
-
- /**
- * @param id
- */
- public GuiTabGemsAndIngots(int id)
- {
- super(id);
- }
-
- public String getName()
- {
- return StatCollector.translateToLocal("guide." + Variables.MODID + ".tab.misc");
- }
-
- /**
- * @return
- */
- @Override
- public ItemStack getIcon()
- {
- return new ItemStack(Items.emerald);
- }
-
- /**
- * @param gui
- * @param x
- * @param y
- * @param page
- */
- @Override
- public void drawBackground(GuiGuide gui, int x, int y, int page)
- {
- int xPos = page % 2 == 0 ? 107 : -35;
- float scale = 0.75F;
- for(int i = (page - 1) * 12; i < page * 12; i++)
- if (i < JewelrycraftUtil.gem.size()){
- GL11.glPushMatrix();
- if(i==(page - 1) * 12) gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Gems", gui.getLeft() + xPos + 40, gui.getTop(), 0);
- GL11.glScalef(scale, scale, 0f);
- gui.getFont().drawString(String.format("%-1.26s", JewelrycraftUtil.gem.get(i).getDisplayName()), (int)((gui.getLeft() + xPos + 12)/scale), (int)((gui.getTop() + 12 + 12 * (i - 12 * (page - 1)))/scale), 0);
- GL11.glPopMatrix();
- gui.renderItem(JewelrycraftUtil.gem.get(i), gui.getLeft() + xPos + 5, gui.getTop() + 18 + 12 * (i - 12 * (page - 1)), 24f, true, 0, 0, 0);
- }
- page -= JewelrycraftUtil.gem.size() / 13 + 1;
- for(int i = (page - 1) * 12; i < page * 12; i++)
- if (i < JewelrycraftUtil.metal.size() && page > 0){
- GL11.glPushMatrix();
- if(i==(page - 1) * 12) gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Ingots", gui.getLeft() + xPos + 40, gui.getTop(), 0);
- GL11.glScalef(scale, scale, 0f);
- gui.getFont().drawString(String.format("%-1.18s", JewelrycraftUtil.metal.get(i).copy().getDisplayName()), (int)((gui.getLeft() + xPos + 12)/scale), (int)((gui.getTop() + 12 + 12 * (i - 12 * (page - 1)))/scale), 0);
- GL11.glPopMatrix();
- gui.renderItem(JewelrycraftUtil.metal.get(i), gui.getLeft() + xPos + 5, gui.getTop() + 18 + 12 * (i - 12 * (page - 1)), 24f, true, 0, 0, 0);
- }
- page -= JewelrycraftUtil.metal.size() / 13 + 1;
- for(int i = (page - 1) * 12; i < page * 12; i++)
- if (i < JewelrycraftUtil.ores.size() && page > 0){
- GL11.glPushMatrix();
- if(i==(page - 1) * 12) gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Ores", gui.getLeft() + xPos + 40, gui.getTop(), 0);
- GL11.glScalef(scale, scale, 0f);
- gui.getFont().drawString(String.format("%-1.18s", JewelrycraftUtil.ores.get(i).copy().getDisplayName()), (int)((gui.getLeft() + xPos + 12)/scale), (int)((gui.getTop() + 12 + 12 * (i - 12 * (page - 1)))/scale), 0);
- GL11.glPopMatrix();
- gui.renderItem(JewelrycraftUtil.ores.get(i), gui.getLeft() + xPos + 5, gui.getTop() + 18 + 12 * (i - 12 * (page - 1)), 24f, true, 0, 0, 0);
- }
- }
-
- /**
- * @return
- */
- @Override
- public int getMaxPages()
- {
- return (JewelrycraftUtil.gem.size() / 13) + (JewelrycraftUtil.metal.size() / 13) + (JewelrycraftUtil.ores.size() / 13) + 3;
- }
-
- /**
- * @param gui
- * @param x
- * @param y
- * @param page
- */
- @Override
- public void drawForeground(GuiGuide gui, int x, int y, int page)
- {}
+public class GuiTabGemsAndIngots extends GuiTab {
+
+ /**
+ * @param id
+ */
+ public GuiTabGemsAndIngots(int id) {
+ super(id);
+ }
+
+ @Override
+ public String getName() {
+ return StatCollector.translateToLocal(
+ "guide." + Variables.MODID + ".tab.misc");
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public ItemStack getIcon() {
+ return new ItemStack(Items.emerald);
+ }
+
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param page
+ */
+ @Override
+ public void drawBackground(GuiGuide gui, int x, int y, int page) {
+ int xPos = page % 2 == 0 ? 107 : -35;
+ float scale = 0.75F;
+ for (int i = (page - 1) * 12; i < page * 12; i++)
+ if (i < JewelrycraftUtil.gem.size()) {
+ GL11.glPushMatrix();
+ if (i == (page - 1) * 12)
+ gui.getFont().drawString(
+ EnumChatFormatting.DARK_BLUE + "\u00a7n"
+ + "Gems",
+ gui.getLeft() + xPos + 40, gui.getTop(), 0);
+ GL11.glScalef(scale, scale, 0f);
+ gui.getFont().drawString(
+ String.format("%-1.26s",
+ JewelrycraftUtil.gem.get(i)
+ .getDisplayName()),
+ (int) ((gui.getLeft() + xPos + 12) / scale),
+ (int) ((gui.getTop() + 12
+ + 12 * (i - 12 * (page - 1))) / scale),
+ 0);
+ GL11.glPopMatrix();
+ gui.renderItem(JewelrycraftUtil.gem.get(i),
+ gui.getLeft() + xPos + 5,
+ gui.getTop() + 18 + 12 * (i - 12 * (page - 1)),
+ 24f, true, 0, 0, 0);
+ }
+ page -= JewelrycraftUtil.gem.size() / 13 + 1;
+ for (int i = (page - 1) * 12; i < page * 12; i++)
+ if (i < JewelrycraftUtil.metal.size() && page > 0) {
+ GL11.glPushMatrix();
+ if (i == (page - 1) * 12)
+ gui.getFont().drawString(
+ EnumChatFormatting.DARK_BLUE + "\u00a7n"
+ + "Ingots",
+ gui.getLeft() + xPos + 40, gui.getTop(), 0);
+ GL11.glScalef(scale, scale, 0f);
+ gui.getFont().drawString(
+ String.format("%-1.18s",
+ JewelrycraftUtil.metal.get(i).copy()
+ .getDisplayName()),
+ (int) ((gui.getLeft() + xPos + 12) / scale),
+ (int) ((gui.getTop() + 12
+ + 12 * (i - 12 * (page - 1))) / scale),
+ 0);
+ GL11.glPopMatrix();
+ gui.renderItem(JewelrycraftUtil.metal.get(i),
+ gui.getLeft() + xPos + 5,
+ gui.getTop() + 18 + 12 * (i - 12 * (page - 1)),
+ 24f, true, 0, 0, 0);
+ }
+ page -= JewelrycraftUtil.metal.size() / 13 + 1;
+ for (int i = (page - 1) * 12; i < page * 12; i++)
+ if (i < JewelrycraftUtil.ores.size() && page > 0) {
+ GL11.glPushMatrix();
+ if (i == (page - 1) * 12)
+ gui.getFont().drawString(
+ EnumChatFormatting.DARK_BLUE + "\u00a7n"
+ + "Ores",
+ gui.getLeft() + xPos + 40, gui.getTop(), 0);
+ GL11.glScalef(scale, scale, 0f);
+ gui.getFont().drawString(
+ String.format("%-1.18s",
+ JewelrycraftUtil.ores.get(i).copy()
+ .getDisplayName()),
+ (int) ((gui.getLeft() + xPos + 12) / scale),
+ (int) ((gui.getTop() + 12
+ + 12 * (i - 12 * (page - 1))) / scale),
+ 0);
+ GL11.glPopMatrix();
+ gui.renderItem(JewelrycraftUtil.ores.get(i),
+ gui.getLeft() + xPos + 5,
+ gui.getTop() + 18 + 12 * (i - 12 * (page - 1)),
+ 24f, true, 0, 0, 0);
+ }
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public int getMaxPages() {
+ return (JewelrycraftUtil.gem.size() / 13)
+ + (JewelrycraftUtil.metal.size() / 13)
+ + (JewelrycraftUtil.ores.size() / 13) + 3;
+ }
+
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param page
+ */
+ @Override
+ public void drawForeground(GuiGuide gui, int x, int y, int page) {
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabIntroduction.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabIntroduction.java index 1aac70e..b7b9a62 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabIntroduction.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabIntroduction.java @@ -6,49 +6,48 @@ import darkknight.jewelrycraft.util.Variables; import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
-public class GuiTabIntroduction extends GuiTab
-{
- public GuiTabIntroduction(int id)
- {
- super(id);
- }
-
- @Override
- public ItemStack getIcon()
- {
- return new ItemStack(ItemList.ring);
- }
-
- public String getName()
- {
- return StatCollector.translateToLocal("guide." + Variables.MODID + ".tab.introduction");
- }
-
- @Override
- public void drawBackground(GuiGuide gui, int x, int y, int page)
- {
- String text = "";
- int xPos = page % 2 == 0 ? 107 : -35;
- switch(page)
- {
- case 1:
- text = StatCollector.translateToLocal("guide." + Variables.MODID + ".tab.introduction."+page);
- Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
- break;
- case 2:
- text = StatCollector.translateToLocal("guide." + Variables.MODID + ".tab.introduction."+page);
- Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
- break;
- }
- }
-
- @Override
- public int getMaxPages()
- {
- return 2;
- }
-
- @Override
- public void drawForeground(GuiGuide gui, int x, int y, int page)
- {}
+public class GuiTabIntroduction extends GuiTab {
+ public GuiTabIntroduction(int id) {
+ super(id);
+ }
+
+ @Override
+ public ItemStack getIcon() {
+ return new ItemStack(ItemList.ring);
+ }
+
+ @Override
+ public String getName() {
+ return StatCollector.translateToLocal(
+ "guide." + Variables.MODID + ".tab.introduction");
+ }
+
+ @Override
+ public void drawBackground(GuiGuide gui, int x, int y, int page) {
+ String text = "";
+ int xPos = page % 2 == 0 ? 107 : -35;
+ switch (page) {
+ case 1:
+ text = StatCollector.translateToLocal("guide."
+ + Variables.MODID + ".tab.introduction." + page);
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(),
+ text);
+ break;
+ case 2:
+ text = StatCollector.translateToLocal("guide."
+ + Variables.MODID + ".tab.introduction." + page);
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(),
+ text);
+ break;
+ }
+ }
+
+ @Override
+ public int getMaxPages() {
+ return 2;
+ }
+
+ @Override
+ public void drawForeground(GuiGuide gui, int x, int y, int page) {
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabItems.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabItems.java index a66798b..a741af3 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabItems.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabItems.java @@ -2,6 +2,7 @@ package darkknight.jewelrycraft.client.gui; import java.awt.Desktop;
import java.net.URL;
+
import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.client.Page;
import darkknight.jewelrycraft.item.ItemList;
@@ -14,156 +15,232 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
-public class GuiTabItems extends GuiTab
-{
-
- /**
- * @param id
- */
- public GuiTabItems(int id)
- {
- super(id);
- }
-
- public String getName()
- {
- return StatCollector.translateToLocal("guide." + Variables.MODID + ".tab.items");
- }
-
- /**
- * @return
- */
- @Override
- public ItemStack getIcon()
- {
- return new ItemStack(ItemList.thiefGloves);
- }
-
- /**
- * @param gui
- * @param x
- * @param y
- * @param page
- */
- @Override
- public void drawBackground(GuiGuide gui, int x, int y, int page)
- {
- String text = "";
- int xPos = page % 2 == 0 ? 107 : -35;
- switch(page)
- {
- case 1:
- text = "Shadow ingots are obtained by smelting shadow ore. They are used in a few recipes and an important key for making some jewelry work.";
- Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, x, y, true, new ItemStack(BlockList.shadowOre), new ItemStack(ItemList.shadowIngot));
- break;
- case 2:
- text = "These gloves give you the chance to steal the trades those pesky Testificates have to offer. To use these simply open their gui at least once, then Crouch and right click on the them to hopefully steal the trades. If you traded with him before, then you have a chance of getting the traded";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(ItemList.thiefGloves), new ItemStack(ItemList.shadowIngot), null, new ItemStack(ItemList.shadowIngot), new ItemStack(Blocks.wool, 1, 15), new ItemStack(ItemList.shadowIngot), new ItemStack(Blocks.wool, 1, 15), new ItemStack(Blocks.wool, 1, 15), new ItemStack(ItemList.shadowIngot), new ItemStack(Blocks.wool, 1, 15));
- break;
- case 3:
- text = "emeralds back as well. This has a maximum of 10 uses before it breaks.";
- Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
- break;
- case 4:
- text = "In order to get the ingot back from the smelter you need a mold for it. However, this mold can't be used. It is too soft. It needs to be hardened in order for it to be used.";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, x, y, true, new ItemStack(ItemList.clayMolds, 1, 0), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball));
- break;
- case 5:
- text = "To create a ring you need a mold for it. However, this one is too soft to be used. It needs to be hardened in order for it to be used.";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(ItemList.clayMolds, 1, 1), null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null);
- break;
- case 6:
- text = "To create a necklace you need a mold for it. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used.";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(ItemList.clayMolds, 1, 2), new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null);
- break;
- case 7:
- text = "To create a bracelet you need a mold for it. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used.";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(ItemList.clayMolds, 1, 3), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball));
- break;
- case 8:
- text = "To create earrings you need a mold for them. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used.";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, true, new ItemStack(ItemList.clayMolds, 1, 4), null, null, null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null, null, null);
- break;
- case 9:
- if (del == 0) values++;
- del++;
- if (del >= 300) del = 0;
- if (values > 4) values = 0;
- text = "By smelting a clay mold you get a harder version which can be used to create jewelry. Simply right click with this on a molder to attach it and you're ready to go.";
- Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, x, y, true, new ItemStack(ItemList.clayMolds, 1, values), new ItemStack(ItemList.molds, 1, values));
- break;
- case 10:
- if (del == 0) values++;
- del++;
- if (del >= 300) del = 0;
- if (values > 4) values = 0;
- text = "It's this exact guide. I don't even know why you're reading this. I added this recipe in case you lose the original. Even if this is more helpful than NEI, I do suggest installing it so you can see all the recipes. Since you are reading this, how about making a youtube video spotlighting this mod. I'd really";
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, x, y, true, new ItemStack(ItemList.guide), new ItemStack(ItemList.molds, 1, values), new ItemStack(Items.book));
- break;
- case 11:
- String link = "HERE";
- if (x >= gui.getLeft() - 7 && x <= gui.getLeft() + 10 && y >= gui.getTop() + 20 && y <= gui.getTop() + 34) link = EnumChatFormatting.DARK_BLUE + "HERE" + EnumChatFormatting.BLACK;
- text = "appreciate it. After that you can share it in the main thread " + link + ".";
- Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
- break;
- case 12:
- ItemStack item = new ItemStack(ItemList.bucket);
- if (del == 0) values++;
- del++;
- if (del >= 50) del = 0;
- if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
- JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
- text = "These buckets contain molten metal. To obtain one simply Right Click a full Smelter to get a bucket. You can pour the metal, other than that it has no use. You can place the molten metal back in a Smelter by Right Clicking one with it.";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, item, text, 40f, 0, 0, true, 45, 10, false);
- break;
- case 13:
- text = "This item is a creative only item! Right click it while in creative mode to open a GUI. Place a piece of jewelery inside the slot, select what you want to add, then click on 'Add Items'. If you selected Modifiers, you can select multiple items at once. The 'Item' button is to add an Item to a Golden Object, which can not be obtained normally. This tool can be really useful, especially for those";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.jewelryModifier), text, 40f, 0, 0, true, 45, 10, false);
- break;
- case 14:
- text = "who want to test the mod and can't wait for the normal processes to finish (Smelter, Jeweler's Table, Ritual).";
- Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
- break;
- case 15:
- text = "This item is a creative only item! If you right click in the air while holding this item you'll increment the number of the structure to spawn. Crouch and right click to go backwards. To spawn a structure simply right click on a block with this.";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.structureGen), text, 40f, 0, 0, true, 45, 10, false);
- break;
- default:
- ;
- }
- }
-
- /**
- * @return
- */
- @Override
- public int getMaxPages()
- {
- return 15;
- }
-
- /**
- * @param gui
- * @param x
- * @param y
- * @param button
- */
- @Override
- public void mouseClick(GuiGuide gui, int x, int y, int button)
- {
- if (gui.page == 11 && x >= gui.getLeft() - 7 && x <= gui.getLeft() + 10 && y >= gui.getTop() + 20 && y <= gui.getTop() + 34) try{
- Desktop.getDesktop().browse(new URL("http://minecraft.curseforge.com/mc-mods/229927-jewelrycraft-2").toURI());
- }
- catch(Exception e){}
- }
-
- /**
- * @param gui
- * @param x
- * @param y
- * @param page
- */
- @Override
- public void drawForeground(GuiGuide gui, int x, int y, int page)
- {}
+public class GuiTabItems extends GuiTab {
+
+ /**
+ * @param id
+ */
+ public GuiTabItems(int id) {
+ super(id);
+ }
+
+ @Override
+ public String getName() {
+ return StatCollector.translateToLocal(
+ "guide." + Variables.MODID + ".tab.items");
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public ItemStack getIcon() {
+ return new ItemStack(ItemList.thiefGloves);
+ }
+
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param page
+ */
+ @Override
+ public void drawBackground(GuiGuide gui, int x, int y, int page) {
+ String text = "";
+ int xPos = page % 2 == 0 ? 107 : -35;
+ switch (page) {
+ case 1:
+ text = "Shadow ingots are obtained by smelting shadow ore. They are used in a few recipes and an important key for making some jewelry work.";
+ Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop(), text, x, y, true,
+ new ItemStack(BlockList.shadowOre),
+ new ItemStack(ItemList.shadowIngot));
+ break;
+ case 2:
+ text = "These gloves give you the chance to steal the trades those pesky Testificates have to offer. To use these simply open their gui at least once, then Crouch and right click on the them to hopefully steal the trades. If you traded with him before, then you have a chance of getting the traded";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop(), false, text, x, y, true,
+ new ItemStack(ItemList.thiefGloves),
+ new ItemStack(ItemList.shadowIngot), null,
+ new ItemStack(ItemList.shadowIngot),
+ new ItemStack(Blocks.wool, 1, 15),
+ new ItemStack(ItemList.shadowIngot),
+ new ItemStack(Blocks.wool, 1, 15),
+ new ItemStack(Blocks.wool, 1, 15),
+ new ItemStack(ItemList.shadowIngot),
+ new ItemStack(Blocks.wool, 1, 15));
+ break;
+ case 3:
+ text = "emeralds back as well. This has a maximum of 10 uses before it breaks.";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(),
+ text);
+ break;
+ case 4:
+ text = "In order to get the ingot back from the smelter you need a mold for it. However, this mold can't be used. It is too soft. It needs to be hardened in order for it to be used.";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop(), true, text, x, y, true,
+ new ItemStack(ItemList.clayMolds, 1, 0),
+ new ItemStack(Items.clay_ball),
+ new ItemStack(Items.clay_ball));
+ break;
+ case 5:
+ text = "To create a ring you need a mold for it. However, this one is too soft to be used. It needs to be hardened in order for it to be used.";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop(), false, text, x, y, true,
+ new ItemStack(ItemList.clayMolds, 1, 1), null,
+ new ItemStack(Items.clay_ball), null,
+ new ItemStack(Items.clay_ball), null,
+ new ItemStack(Items.clay_ball), null,
+ new ItemStack(Items.clay_ball), null);
+ break;
+ case 6:
+ text = "To create a necklace you need a mold for it. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used.";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop(), false, text, x, y, true,
+ new ItemStack(ItemList.clayMolds, 1, 2),
+ new ItemStack(Items.clay_ball), null,
+ new ItemStack(Items.clay_ball),
+ new ItemStack(Items.clay_ball), null,
+ new ItemStack(Items.clay_ball), null,
+ new ItemStack(Items.clay_ball), null);
+ break;
+ case 7:
+ text = "To create a bracelet you need a mold for it. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used.";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop(), false, text, x, y, true,
+ new ItemStack(ItemList.clayMolds, 1, 3),
+ new ItemStack(Items.clay_ball),
+ new ItemStack(Items.clay_ball),
+ new ItemStack(Items.clay_ball),
+ new ItemStack(Items.clay_ball), null,
+ new ItemStack(Items.clay_ball),
+ new ItemStack(Items.clay_ball),
+ new ItemStack(Items.clay_ball),
+ new ItemStack(Items.clay_ball));
+ break;
+ case 8:
+ text = "To create earrings you need a mold for them. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used.";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop(), false, text, x, y, true,
+ new ItemStack(ItemList.clayMolds, 1, 4), null,
+ null, null, new ItemStack(Items.clay_ball), null,
+ new ItemStack(Items.clay_ball), null, null, null);
+ break;
+ case 9:
+ if (del == 0)
+ values++;
+ del++;
+ if (del >= 300)
+ del = 0;
+ if (values > 4)
+ values = 0;
+ text = "By smelting a clay mold you get a harder version which can be used to create jewelry. Simply right click with this on a molder to attach it and you're ready to go.";
+ Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop(), text, x, y, true,
+ new ItemStack(ItemList.clayMolds, 1, values),
+ new ItemStack(ItemList.molds, 1, values));
+ break;
+ case 10:
+ if (del == 0)
+ values++;
+ del++;
+ if (del >= 300)
+ del = 0;
+ if (values > 4)
+ values = 0;
+ text = "It's this exact guide. I don't even know why you're reading this. I added this recipe in case you lose the original. Even if this is more helpful than NEI, I do suggest installing it so you can see all the recipes. Since you are reading this, how about making a youtube video spotlighting this mod. I'd really";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop(), true, text, x, y, true,
+ new ItemStack(ItemList.guide),
+ new ItemStack(ItemList.molds, 1, values),
+ new ItemStack(Items.book));
+ break;
+ case 11:
+ String link = "HERE";
+ if (x >= gui.getLeft() - 7 && x <= gui.getLeft() + 10
+ && y >= gui.getTop() + 20
+ && y <= gui.getTop() + 34)
+ link = EnumChatFormatting.DARK_BLUE + "HERE"
+ + EnumChatFormatting.BLACK;
+ text = "appreciate it. After that you can share it in the main thread "
+ + link + ".";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(),
+ text);
+ break;
+ case 12:
+ ItemStack item = new ItemStack(ItemList.bucket);
+ if (del == 0)
+ values++;
+ del++;
+ if (del >= 50)
+ del = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1)
+ values = 0;
+ JewelryNBT.addMetal(item,
+ JewelrycraftUtil.metal.get(values).copy());
+ text = "These buckets contain molten metal. To obtain one simply Right Click a full Smelter to get a bucket. You can pour the metal, other than that it has no use. You can place the molten metal back in a Smelter by Right Clicking one with it.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop() - 5, item, text, 40f, 0, 0, true, 45,
+ 10, false);
+ break;
+ case 13:
+ text = "This item is a creative only item! Right click it while in creative mode to open a GUI. Place a piece of jewelery inside the slot, select what you want to add, then click on 'Add Items'. If you selected Modifiers, you can select multiple items at once. The 'Item' button is to add an Item to a Golden Object, which can not be obtained normally. This tool can be really useful, especially for those";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop() - 5,
+ new ItemStack(ItemList.jewelryModifier), text, 40f,
+ 0, 0, true, 45, 10, false);
+ break;
+ case 14:
+ text = "who want to test the mod and can't wait for the normal processes to finish (Smelter, Jeweler's Table, Ritual).";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(),
+ text);
+ break;
+ case 15:
+ text = "This item is a creative only item! If you right click in the air while holding this item you'll increment the number of the structure to spawn. Crouch and right click to go backwards. To spawn a structure simply right click on a block with this.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop() - 5,
+ new ItemStack(ItemList.structureGen), text, 40f, 0,
+ 0, true, 45, 10, false);
+ break;
+ default:
+ ;
+ }
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public int getMaxPages() {
+ return 15;
+ }
+
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param button
+ */
+ @Override
+ public void mouseClick(GuiGuide gui, int x, int y, int button) {
+ if (gui.page == 11 && x >= gui.getLeft() - 7
+ && x <= gui.getLeft() + 10 && y >= gui.getTop() + 20
+ && y <= gui.getTop() + 34)
+ try {
+ Desktop.getDesktop().browse(
+ new URL("http://minecraft.curseforge.com/mc-mods/229927-jewelrycraft-2")
+ .toURI());
+ } catch (Exception e) {
+ }
+ }
+
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param page
+ */
+ @Override
+ public void drawForeground(GuiGuide gui, int x, int y, int page) {
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabModifiers.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabModifiers.java index 4f155c5..91f5873 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabModifiers.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabModifiers.java @@ -7,84 +7,92 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
-public class GuiTabModifiers extends GuiTab
-{
- int maxPages;
- public GuiTabModifiers(int id)
- {
- super(id);
- }
-
- public String getName()
- {
- return StatCollector.translateToLocal("guide." + Variables.MODID + ".tab.modifiers");
- }
-
- /**
- * @return
- */
- @Override
- public ItemStack getIcon()
- {
- return new ItemStack(Items.blaze_powder);
- }
-
- /**
- * @param gui
- * @param x
- * @param y
- * @param page
- */
- @Override
- public void drawBackground(GuiGuide gui, int x, int y, int page)
- {
- String text = "";
- int xPos = page % 2 == 0 ? 107 : -35;
- switch(page)
- {
- case 1:
- text = "Although you can add anything as a modifier, only some objects have an effect. In this tab you can find all modifiers that have a use and what they do, in the form of a story/riddle/poem. However, different jewellery have different effects for the same modifier.";
- Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
- break;
- case 2:
- text = "The ancient ones talked about a rising fire in your heart. Fret do not, for flames do not burn, but water might sting a turn. Watch your step, do not be cocky, for its protection is a bit sloppy.";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 10, new ItemStack(Items.blaze_powder), text, 40f, true);
- break;
- case 3:
- text = "Light and swift as a feather can be good all together. Enemies miss and get confused, this power can be abused. Against an arrow you can't compare, so move around, don't just stare. Fire is your enemy and weakness is the penalty.";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 10, new ItemStack(Items.feather), text, 40f, true);
- break;
- case 4:
- text = "Endermen may tolerate you, end portals are near too, you may find ore that is true. But be careful, for the power may make you dizzy, blind you if you're a sissy, worsen your vision if you're unaware and shift positions everywhere.";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 10, new ItemStack(Items.ender_eye), text, 40f, true);
- break;
- case 5:
- text = "Through the power of a pearl arrows don't know where to go. In confusion they can explode, making you a helpless toad. But if an enemy hits, they get damaged like a blitz. You may be weaker, water is bad, but you get saved if health is weak like a lilly pad.";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 10, new ItemStack(Items.ender_pearl), text, 40f, true);
- break;
- case 6:
- text = "Toughest stone made on Earth, falling damage is absurd. Deal more damage, more protection, anvils and arrows need inspection. But after long and hard abuse, the stone is starting to get loose. You are weak and heavy, sink like a ship, arrows need only one hit, deal less damage overall, don't abuse its power now.";
- Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 10, new ItemStack(Blocks.obsidian), text, 40f, true);
- break;
- }
- }
-
- /**
- * @return
- */
- @Override
- public int getMaxPages()
- {
- return 6;
- }
-
- /**
- * @param gui
- * @param x
- * @param y
- * @param page
- */
- @Override
- public void drawForeground(GuiGuide gui, int x, int y, int page)
- {}
+public class GuiTabModifiers extends GuiTab {
+ int maxPages;
+
+ public GuiTabModifiers(int id) {
+ super(id);
+ }
+
+ @Override
+ public String getName() {
+ return StatCollector.translateToLocal(
+ "guide." + Variables.MODID + ".tab.modifiers");
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public ItemStack getIcon() {
+ return new ItemStack(Items.blaze_powder);
+ }
+
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param page
+ */
+ @Override
+ public void drawBackground(GuiGuide gui, int x, int y, int page) {
+ String text = "";
+ int xPos = page % 2 == 0 ? 107 : -35;
+ switch (page) {
+ case 1:
+ text = "Although you can add anything as a modifier, only some objects have an effect. In this tab you can find all modifiers that have a use and what they do, in the form of a story/riddle/poem. However, different jewellery have different effects for the same modifier.";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(),
+ text);
+ break;
+ case 2:
+ text = "The ancient ones talked about a rising fire in your heart. Fret do not, for flames do not burn, but water might sting a turn. Watch your step, do not be cocky, for its protection is a bit sloppy.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop() - 10,
+ new ItemStack(Items.blaze_powder), text, 40f,
+ true);
+ break;
+ case 3:
+ text = "Light and swift as a feather can be good all together. Enemies miss and get confused, this power can be abused. Against an arrow you can't compare, so move around, don't just stare. Fire is your enemy and weakness is the penalty.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop() - 10, new ItemStack(Items.feather),
+ text, 40f, true);
+ break;
+ case 4:
+ text = "Endermen may tolerate you, end portals are near too, you may find ore that is true. But be careful, for the power may make you dizzy, blind you if you're a sissy, worsen your vision if you're unaware and shift positions everywhere.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop() - 10, new ItemStack(Items.ender_eye),
+ text, 40f, true);
+ break;
+ case 5:
+ text = "Through the power of a pearl arrows don't know where to go. In confusion they can explode, making you a helpless toad. But if an enemy hits, they get damaged like a blitz. You may be weaker, water is bad, but you get saved if health is weak like a lilly pad.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop() - 10,
+ new ItemStack(Items.ender_pearl), text, 40f, true);
+ break;
+ case 6:
+ text = "Toughest stone made on Earth, falling damage is absurd. Deal more damage, more protection, anvils and arrows need inspection. But after long and hard abuse, the stone is starting to get loose. You are weak and heavy, sink like a ship, arrows need only one hit, deal less damage overall, don't abuse its power now.";
+ Page.addImageTextPage(gui, gui.getLeft() + xPos,
+ gui.getTop() - 10, new ItemStack(Blocks.obsidian),
+ text, 40f, true);
+ break;
+ }
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public int getMaxPages() {
+ return 6;
+ }
+
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param page
+ */
+ @Override
+ public void drawForeground(GuiGuide gui, int x, int y, int page) {
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabOresToIngots.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabOresToIngots.java index a0b0e4b..71ad370 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabOresToIngots.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabOresToIngots.java @@ -1,78 +1,88 @@ package darkknight.jewelrycraft.client.gui;
import org.lwjgl.opengl.GL11;
+
import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.util.JewelrycraftUtil;
import darkknight.jewelrycraft.util.Variables;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
-public class GuiTabOresToIngots extends GuiTab
-{
- /**
- * @param id
- */
- public GuiTabOresToIngots(int id)
- {
- super(id);
- }
-
- public String getName()
- {
- return StatCollector.translateToLocal("guide." + Variables.MODID + ".tab.oretoingot");
- }
-
- /**
- * @return
- */
- @Override
- public ItemStack getIcon()
- {
- return new ItemStack(BlockList.shadowOre);
- }
-
- /**
- * @param gui
- * @param x
- * @param y
- * @param page
- */
- @Override
- public void drawBackground(GuiGuide gui, int x, int y, int page)
- {
- int xPos = page % 2 == 0 ? 107 : -35;
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- int i = 0;
- for(ItemStack ore: JewelrycraftUtil.oreToIngot.keySet()){
- if (i >= (page - 1) * 5 && i < page * 5){
- gui.renderItem(ore, gui.getLeft() + xPos + 10, gui.getTop() + 12 + 32 * (i - 5 * (page - 1)), 30f, true, 0, 0, 0);
- gui.renderItem(JewelrycraftUtil.oreToIngot.get(ore), gui.getLeft() + xPos + 10, gui.getTop() + 28 + 32 * (i - 5 * (page - 1)), 30f, true, 0, 0, 0);
- gui.getFont().drawString(String.format("%-1.18s", ore.getDisplayName()), gui.getLeft() + xPos + 20, gui.getTop() + 2 + 32 * (i - 5 * (page - 1)), 0);
- gui.getFont().drawString(String.format("%-1.18s", JewelrycraftUtil.oreToIngot.get(ore).getDisplayName()), gui.getLeft() + xPos + 20, gui.getTop() + 18 + 32 * (i - 5 * (page - 1)), 0);
- GL11.glDisable(GL11.GL_LIGHTING);
- }
- i++;
- }
- GL11.glDisable(GL11.GL_BLEND);
- }
-
- /**
- * @return
- */
- @Override
- public int getMaxPages()
- {
- return JewelrycraftUtil.oreToIngot.size() / 5 + 2;
- }
-
- /**
- * @param gui
- * @param x
- * @param y
- * @param page
- */
- @Override
- public void drawForeground(GuiGuide gui, int x, int y, int page)
- {}
+public class GuiTabOresToIngots extends GuiTab {
+ /**
+ * @param id
+ */
+ public GuiTabOresToIngots(int id) {
+ super(id);
+ }
+
+ @Override
+ public String getName() {
+ return StatCollector.translateToLocal(
+ "guide." + Variables.MODID + ".tab.oretoingot");
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public ItemStack getIcon() {
+ return new ItemStack(BlockList.shadowOre);
+ }
+
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param page
+ */
+ @Override
+ public void drawBackground(GuiGuide gui, int x, int y, int page) {
+ int xPos = page % 2 == 0 ? 107 : -35;
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ int i = 0;
+ for (ItemStack ore : JewelrycraftUtil.oreToIngot.keySet()) {
+ if (i >= (page - 1) * 5 && i < page * 5) {
+ gui.renderItem(ore, gui.getLeft() + xPos + 10,
+ gui.getTop() + 12 + 32 * (i - 5 * (page - 1)), 30f,
+ true, 0, 0, 0);
+ gui.renderItem(JewelrycraftUtil.oreToIngot.get(ore),
+ gui.getLeft() + xPos + 10,
+ gui.getTop() + 28 + 32 * (i - 5 * (page - 1)), 30f,
+ true, 0, 0, 0);
+ gui.getFont().drawString(
+ String.format("%-1.18s", ore.getDisplayName()),
+ gui.getLeft() + xPos + 20,
+ gui.getTop() + 2 + 32 * (i - 5 * (page - 1)), 0);
+ gui.getFont().drawString(
+ String.format("%-1.18s",
+ JewelrycraftUtil.oreToIngot.get(ore)
+ .getDisplayName()),
+ gui.getLeft() + xPos + 20,
+ gui.getTop() + 18 + 32 * (i - 5 * (page - 1)), 0);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ }
+ i++;
+ }
+ GL11.glDisable(GL11.GL_BLEND);
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public int getMaxPages() {
+ return JewelrycraftUtil.oreToIngot.size() / 5 + 2;
+ }
+
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param page
+ */
+ @Override
+ public void drawForeground(GuiGuide gui, int x, int y, int page) {
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabRitual.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabRitual.java index 30f220c..dd4df87 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabRitual.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabRitual.java @@ -8,124 +8,231 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
-public class GuiTabRitual extends GuiTab
-{
- public GuiTabRitual(int id)
- {
- super(id);
- }
-
- public String getName()
- {
- return StatCollector.translateToLocal("guide." + Variables.MODID + ".tab.ritual");
- }
-
- @Override
- public ItemStack getIcon()
- {
- return new ItemStack(BlockList.handPedestal);
- }
-
- @Override
- public void drawBackground(GuiGuide gui, int x, int y, int page)
- {
- int xPos = page % 2 == 0 ? 107 : -35;
- switch(page)
- {
- case 1:
- Page.drawText(gui, EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Layer 1", gui.getLeft() + xPos + 35, gui.getTop() - 30);
- for(int i = -1; i < 10; i++)
- for(int j = 0; j < 11; j++)
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*i, gui.getTop() + 11*j, x, y, new ItemStack(Blocks.air), 0, 0, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*8, gui.getTop() + 11*1, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*0, gui.getTop() + 11*1, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*8, gui.getTop() + 11*9, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*0, gui.getTop() + 11*9, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
-
- //Top
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*2, gui.getTop() + 11*1, x, y, new ItemStack(BlockList.handPedestal), 0, 45, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*4, gui.getTop() + 11*0, x, y, new ItemStack(BlockList.handPedestal), 0, 0, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*6, gui.getTop() + 11*1, x, y, new ItemStack(BlockList.handPedestal), 0, -45, 0);
-
- //Left
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*0, gui.getTop() + 11*3, x, y, new ItemStack(BlockList.handPedestal), 0, 45, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*-1, gui.getTop() + 11*5, x, y, new ItemStack(BlockList.handPedestal), 0, 90, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*0, gui.getTop() + 11*7, x, y, new ItemStack(BlockList.handPedestal), 0, 135, 0);
-
- //Bottom
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*2, gui.getTop() + 11*9, x, y, new ItemStack(BlockList.handPedestal), 0, 135, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*4, gui.getTop() + 11*10, x, y, new ItemStack(BlockList.handPedestal), 0, 180, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*6, gui.getTop() + 11*9, x, y, new ItemStack(BlockList.handPedestal), 0, 225, 0);
-
- //Right
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*8, gui.getTop() + 11*3, x, y, new ItemStack(BlockList.handPedestal), 0, -35, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*9, gui.getTop() + 11*5, x, y, new ItemStack(BlockList.handPedestal), 0, 270, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*8, gui.getTop() + 11*7, x, y, new ItemStack(BlockList.handPedestal), 0, 225, 0);
-
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*2, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*4, gui.getTop() + 11*5, x, y, new ItemStack(BlockList.handPedestal), 0, 0, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*6, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
- break;
-
- case 2:
- Page.drawText(gui, EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Layer 2", gui.getLeft() + xPos + 35, gui.getTop() - 30);
- for(int i = -1; i < 10; i++)
- for(int j = 0; j < 11; j++)
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*i, gui.getTop() + 11*j, x, y, new ItemStack(Blocks.air), 0, 0, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*8, gui.getTop() + 11*1, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*0, gui.getTop() + 11*1, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*8, gui.getTop() + 11*9, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*0, gui.getTop() + 11*9, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
-
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*2, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*6, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
- break;
-
- case 3:
- Page.drawText(gui, EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Layer 3", gui.getLeft() + xPos + 35, gui.getTop() - 30);
- for(int i = -1; i < 10; i++)
- for(int j = 0; j < 11; j++)
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*i, gui.getTop() + 11*j, x, y, new ItemStack(Blocks.air), 0, 0, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*8, gui.getTop() + 11*1, x, y, new ItemStack(BlockList.shadowBlock), 0, 0, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*0, gui.getTop() + 11*1, x, y, new ItemStack(BlockList.shadowBlock), 0, 0, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*8, gui.getTop() + 11*9, x, y, new ItemStack(BlockList.shadowBlock), 0, 0, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*0, gui.getTop() + 11*9, x, y, new ItemStack(BlockList.shadowBlock), 0, 0, 0);
-
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*2, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*6, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stonebrick), 0, 0, 0);
- break;
-
- case 4:
- Page.drawText(gui, EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Layer 4", gui.getLeft() + xPos + 35, gui.getTop() - 30);
- for(int i = -1; i < 10; i++)
- for(int j = 0; j < 11; j++)
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*i, gui.getTop() + 11*j, x, y, new ItemStack(Blocks.air), 0, 0, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*2, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stone_brick_stairs), 0, 90, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*3, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stone_brick_stairs), 0, -90, 180);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*4, gui.getTop() + 11*5, x, y, new ItemStack(BlockList.shadowEye), 0, 90, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*5, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stone_brick_stairs), 0, 90, 180);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*6, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stone_brick_stairs), 0, -90, 0);
- break;
-
- case 5:
- Page.drawText(gui, EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Layer 5", gui.getLeft() + xPos + 35, gui.getTop() - 30);
- for(int i = -1; i < 10; i++)
- for(int j = 0; j < 11; j++)
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*i, gui.getTop() + 11*j, x, y, new ItemStack(Blocks.air), 0, 0, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*3, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stone_slab, 1, 5), 0, 0, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*4, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stone_slab, 1, 5), 0, 0, 0);
- Page.addSlotItem(gui, gui.getLeft() + xPos + 11*5, gui.getTop() + 11*5, x, y, new ItemStack(Blocks.stone_slab, 1, 5), 0, 0, 0);
- break;
- }
- }
-
- @Override
- public int getMaxPages()
- {
- return 5;
- }
-
- @Override
- public void drawForeground(GuiGuide gui, int x, int y, int page)
- {}
+public class GuiTabRitual extends GuiTab {
+ public GuiTabRitual(int id) {
+ super(id);
+ }
+
+ @Override
+ public String getName() {
+ return StatCollector.translateToLocal(
+ "guide." + Variables.MODID + ".tab.ritual");
+ }
+
+ @Override
+ public ItemStack getIcon() {
+ return new ItemStack(BlockList.handPedestal);
+ }
+
+ @Override
+ public void drawBackground(GuiGuide gui, int x, int y, int page) {
+ int xPos = page % 2 == 0 ? 107 : -35;
+ switch (page) {
+ case 1:
+ Page.drawText(gui,
+ EnumChatFormatting.DARK_BLUE + "\u00a7n"
+ + "Layer 1",
+ gui.getLeft() + xPos + 35, gui.getTop() - 30);
+ for (int i = -1; i < 10; i++)
+ for (int j = 0; j < 11; j++)
+ Page.addSlotItem(gui,
+ gui.getLeft() + xPos + 11 * i,
+ gui.getTop() + 11 * j, x, y,
+ new ItemStack(Blocks.air), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8,
+ gui.getTop() + 11 * 1, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0,
+ gui.getTop() + 11 * 1, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8,
+ gui.getTop() + 11 * 9, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0,
+ gui.getTop() + 11 * 9, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+
+ // Top
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 2,
+ gui.getTop() + 11 * 1, x, y,
+ new ItemStack(BlockList.handPedestal), 0, 45, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 4,
+ gui.getTop() + 11 * 0, x, y,
+ new ItemStack(BlockList.handPedestal), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 6,
+ gui.getTop() + 11 * 1, x, y,
+ new ItemStack(BlockList.handPedestal), 0, -45, 0);
+
+ // Left
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0,
+ gui.getTop() + 11 * 3, x, y,
+ new ItemStack(BlockList.handPedestal), 0, 45, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * -1,
+ gui.getTop() + 11 * 5, x, y,
+ new ItemStack(BlockList.handPedestal), 0, 90, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0,
+ gui.getTop() + 11 * 7, x, y,
+ new ItemStack(BlockList.handPedestal), 0, 135, 0);
+
+ // Bottom
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 2,
+ gui.getTop() + 11 * 9, x, y,
+ new ItemStack(BlockList.handPedestal), 0, 135, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 4,
+ gui.getTop() + 11 * 10, x, y,
+ new ItemStack(BlockList.handPedestal), 0, 180, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 6,
+ gui.getTop() + 11 * 9, x, y,
+ new ItemStack(BlockList.handPedestal), 0, 225, 0);
+
+ // Right
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8,
+ gui.getTop() + 11 * 3, x, y,
+ new ItemStack(BlockList.handPedestal), 0, -35, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 9,
+ gui.getTop() + 11 * 5, x, y,
+ new ItemStack(BlockList.handPedestal), 0, 270, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8,
+ gui.getTop() + 11 * 7, x, y,
+ new ItemStack(BlockList.handPedestal), 0, 225, 0);
+
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 2,
+ gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 4,
+ gui.getTop() + 11 * 5, x, y,
+ new ItemStack(BlockList.handPedestal), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 6,
+ gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ break;
+
+ case 2:
+ Page.drawText(gui,
+ EnumChatFormatting.DARK_BLUE + "\u00a7n"
+ + "Layer 2",
+ gui.getLeft() + xPos + 35, gui.getTop() - 30);
+ for (int i = -1; i < 10; i++)
+ for (int j = 0; j < 11; j++)
+ Page.addSlotItem(gui,
+ gui.getLeft() + xPos + 11 * i,
+ gui.getTop() + 11 * j, x, y,
+ new ItemStack(Blocks.air), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8,
+ gui.getTop() + 11 * 1, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0,
+ gui.getTop() + 11 * 1, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8,
+ gui.getTop() + 11 * 9, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0,
+ gui.getTop() + 11 * 9, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 2,
+ gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 6,
+ gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ break;
+
+ case 3:
+ Page.drawText(gui,
+ EnumChatFormatting.DARK_BLUE + "\u00a7n"
+ + "Layer 3",
+ gui.getLeft() + xPos + 35, gui.getTop() - 30);
+ for (int i = -1; i < 10; i++)
+ for (int j = 0; j < 11; j++)
+ Page.addSlotItem(gui,
+ gui.getLeft() + xPos + 11 * i,
+ gui.getTop() + 11 * j, x, y,
+ new ItemStack(Blocks.air), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8,
+ gui.getTop() + 11 * 1, x, y,
+ new ItemStack(BlockList.shadowBlock), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0,
+ gui.getTop() + 11 * 1, x, y,
+ new ItemStack(BlockList.shadowBlock), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 8,
+ gui.getTop() + 11 * 9, x, y,
+ new ItemStack(BlockList.shadowBlock), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 0,
+ gui.getTop() + 11 * 9, x, y,
+ new ItemStack(BlockList.shadowBlock), 0, 0, 0);
+
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 2,
+ gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 6,
+ gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stonebrick), 0, 0, 0);
+ break;
+
+ case 4:
+ Page.drawText(gui,
+ EnumChatFormatting.DARK_BLUE + "\u00a7n"
+ + "Layer 4",
+ gui.getLeft() + xPos + 35, gui.getTop() - 30);
+ for (int i = -1; i < 10; i++)
+ for (int j = 0; j < 11; j++)
+ Page.addSlotItem(gui,
+ gui.getLeft() + xPos + 11 * i,
+ gui.getTop() + 11 * j, x, y,
+ new ItemStack(Blocks.air), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 2,
+ gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stone_brick_stairs), 0, 90,
+ 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 3,
+ gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stone_brick_stairs), 0, -90,
+ 180);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 4,
+ gui.getTop() + 11 * 5, x, y,
+ new ItemStack(BlockList.shadowEye), 0, 90, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 5,
+ gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stone_brick_stairs), 0, 90,
+ 180);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 6,
+ gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stone_brick_stairs), 0, -90,
+ 0);
+ break;
+
+ case 5:
+ Page.drawText(gui,
+ EnumChatFormatting.DARK_BLUE + "\u00a7n"
+ + "Layer 5",
+ gui.getLeft() + xPos + 35, gui.getTop() - 30);
+ for (int i = -1; i < 10; i++)
+ for (int j = 0; j < 11; j++)
+ Page.addSlotItem(gui,
+ gui.getLeft() + xPos + 11 * i,
+ gui.getTop() + 11 * j, x, y,
+ new ItemStack(Blocks.air), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 3,
+ gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stone_slab, 1, 5), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 4,
+ gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stone_slab, 1, 5), 0, 0, 0);
+ Page.addSlotItem(gui, gui.getLeft() + xPos + 11 * 5,
+ gui.getTop() + 11 * 5, x, y,
+ new ItemStack(Blocks.stone_slab, 1, 5), 0, 0, 0);
+ break;
+ }
+ }
+
+ @Override
+ public int getMaxPages() {
+ return 5;
+ }
+
+ @Override
+ public void drawForeground(GuiGuide gui, int x, int y, int page) {
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerCurseInfo.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerCurseInfo.java index 24588bd..5b92385 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerCurseInfo.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerCurseInfo.java @@ -4,20 +4,17 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ICrafting; -public class ContainerCurseInfo extends Container -{ - public ContainerCurseInfo() - {} - - @Override - public void addCraftingToCrafters(ICrafting c) - { - return; - } - - @Override - public boolean canInteractWith(EntityPlayer entityplayer) - { - return true; - } +public class ContainerCurseInfo extends Container { + public ContainerCurseInfo() { + } + + @Override + public void addCraftingToCrafters(ICrafting c) { + return; + } + + @Override + public boolean canInteractWith(EntityPlayer entityplayer) { + return true; + } }
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerGuide.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerGuide.java index ccb9ca9..fc6c5bf 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerGuide.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerGuide.java @@ -6,22 +6,20 @@ import net.minecraft.inventory.Container; /** * User: joel / Date: 16.12.13 / Time: 22:36 */ -public class ContainerGuide extends Container -{ - - /** - * - */ - public ContainerGuide() - {} - - /** - * @param entityplayer - * @return - */ - @Override - public boolean canInteractWith(EntityPlayer entityplayer) - { - return true; - } +public class ContainerGuide extends Container { + + /** + * + */ + public ContainerGuide() { + } + + /** + * @param entityplayer + * @return + */ + @Override + public boolean canInteractWith(EntityPlayer entityplayer) { + return true; + } }
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java index e749506..652d628 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java @@ -7,41 +7,45 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-public class ContainerJewelryModifier extends Container
-{
- public IInventory modInv;
- public ContainerJewelryModifier(InventoryPlayer inv, IInventory mod)
- {
- int x, y;
- modInv = mod;
- for(x = 0; x < 9; x++)
- addSlotToContainer(new Slot(inv, x, 26 + 18 * x, 225));
- for(y = 0; y < 3; y++)
- for(x = 0; x < 9; x++)
- addSlotToContainer(new Slot(inv, x + 9 + y * 9, 26 + 18 * x, 167 + y * 18));
- addSlotToContainer(new Slot(mod, 36, 37, 9));
- }
-
- @Override
- public boolean canInteractWith(EntityPlayer player)
- {
- return true;
- }
-
- @Override
- public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
- {
- ItemStack itemstack = null;
- Slot slot = (Slot)inventorySlots.get(par2);
- if (slot != null && slot.getHasStack()){
- ItemStack itemstack1 = slot.getStack();
- itemstack = itemstack1.copy();
- if (par2 < 27){
- if (!mergeItemStack(itemstack1, 27, inventorySlots.size(), true)) return null;
- }else if (!mergeItemStack(itemstack1, 0, 27, false)) return null;
- if (itemstack1.stackSize == 0) slot.putStack((ItemStack)null);
- else slot.onSlotChanged();
- }
- return itemstack;
- }
+public class ContainerJewelryModifier extends Container {
+ public IInventory modInv;
+
+ public ContainerJewelryModifier(InventoryPlayer inv, IInventory mod) {
+ int x, y;
+ modInv = mod;
+ for (x = 0; x < 9; x++)
+ addSlotToContainer(new Slot(inv, x, 26 + 18 * x, 225));
+ for (y = 0; y < 3; y++)
+ for (x = 0; x < 9; x++)
+ addSlotToContainer(new Slot(inv, x + 9 + y * 9,
+ 26 + 18 * x, 167 + y * 18));
+ addSlotToContainer(new Slot(mod, 36, 37, 9));
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer player) {
+ return true;
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer,
+ int par2) {
+ ItemStack itemstack = null;
+ Slot slot = (Slot) inventorySlots.get(par2);
+ if (slot != null && slot.getHasStack()) {
+ ItemStack itemstack1 = slot.getStack();
+ itemstack = itemstack1.copy();
+ if (par2 < 27) {
+ if (!mergeItemStack(itemstack1, 27, inventorySlots.size(),
+ true))
+ return null;
+ } else if (!mergeItemStack(itemstack1, 0, 27, false))
+ return null;
+ if (itemstack1.stackSize == 0)
+ slot.putStack((ItemStack) null);
+ else
+ slot.onSlotChanged();
+ }
+ return itemstack;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java index dd12540..3061bfd 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java @@ -17,98 +17,139 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-public class ContainerJewelryTab extends Container
-{
- public ContainerJewelryTab(EntityPlayer player, IInventory inv, IInventory extra)
- {
- int x, y;
- // Rings
- for(x = 0; x <= 9; x++)
- addSlotToContainer(new SlotRing(extra, x, 8 + x * 18, 7));
- // Bracelets
- for(x = 10; x <= 13; x++)
- addSlotToContainer(new SlotBracelet(extra, x, 8 + (x - 10) * 18, 26));
- // Necklaces
- for(x = 14; x <= 16; x++)
- addSlotToContainer(new SlotNecklace(extra, x, 8 + (x - 14) * 18, 45));
- // Earrings
- addSlotToContainer(new SlotEarrings(extra, 17, 8, 64));
- // Hotbar
- for(x = 0; x < 9; ++x)
- addSlotToContainer(new Slot(inv, x, 17 + x * 18, 142));
- // Inventory
- for(x = 0; x < 3; ++x)
- for(y = 0; y < 9; ++y)
- addSlotToContainer(new Slot(inv, 9 + y + x * 9, 17 + y * 18, 84 + x * 18));
- }
-
- @Override
- public boolean canInteractWith(EntityPlayer player)
- {
- return true;
- }
-
- public ItemStack slotClick(int slotID, int j, int k, EntityPlayer player)
- {
- if (slotID >= 0 && slotID <= 17 && !player.worldObj.isRemote) {
- try{
- if (player.inventory.getItemStack() == null && inventoryItemStacks.get(slotID) != null && ((ItemStack)inventoryItemStacks.get(slotID)).getItem() instanceof ItemBaseJewelry)
- ((ItemBaseJewelry)((ItemStack)inventoryItemStacks.get(slotID)).getItem()).onJewelryUnequipped((ItemStack)inventoryItemStacks.get(slotID));
- else if (player.inventory.getItemStack() != null && player.inventory.getItemStack().getItem() instanceof ItemBaseJewelry && inventoryItemStacks.get(slotID) == null)
- ((ItemBaseJewelry)player.inventory.getItemStack().getItem()).onJewelryEquipped(player.inventory.getItemStack());
- if (player.inventory.getItemStack() == null && inventoryItemStacks.get(slotID) != null && ((ItemStack)inventoryItemStacks.get(slotID)).getItem() instanceof IJewelryItem)
- ((IJewelryItem)((ItemStack)inventoryItemStacks.get(slotID)).getItem()).onJewelryUnequipped((ItemStack)inventoryItemStacks.get(slotID));
- else if (player.inventory.getItemStack() != null && player.inventory.getItemStack().getItem() instanceof IJewelryItem && inventoryItemStacks.get(slotID) == null)
- ((IJewelryItem)player.inventory.getItemStack().getItem()).onJewelryEquipped(player.inventory.getItemStack());
- }
- catch(Exception e){
- JewelrycraftMod.logger.error("An error has occured while equipping an item.");
- e.printStackTrace();
- }
- }
- return super.slotClick(slotID, j, k, player);
- }
-
- @Override
- public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
- {
- ItemStack itemstack = null;
- Slot slot = (Slot)inventorySlots.get(slotID);
- if (slot != null && slot.getHasStack()) {
- ItemStack itemstack1 = slot.getStack();
- itemstack = itemstack1.copy();
- if (slotID >= 18) {
- if (itemstack.getItem() instanceof ItemRing || (itemstack.getItem() instanceof IJewelryItem && ((IJewelryItem)itemstack.getItem()).type() == 0)) {
- if (!mergeItemStack(itemstack, 0, 10, false) && !slot.getHasStack())
- return null;
- }else if (itemstack.getItem() instanceof ItemBracelet || (itemstack.getItem() instanceof IJewelryItem && ((IJewelryItem)itemstack.getItem()).type() == 1)) {
- if (!mergeItemStack(itemstack, 10, 14, false) && !slot.getHasStack())
- return null;
- }else if (itemstack.getItem() instanceof ItemNecklace || (itemstack.getItem() instanceof IJewelryItem && ((IJewelryItem)itemstack.getItem()).type() == 2)) {
- if (!mergeItemStack(itemstack, 14, 17, false) && !slot.getHasStack())
- return null;
- }else if (itemstack.getItem() instanceof ItemEarrings || (itemstack.getItem() instanceof IJewelryItem && ((IJewelryItem)itemstack.getItem()).type() == 3)) {
- if (!mergeItemStack(itemstack, 17, 18, false) && !slot.getHasStack())
- return null;
- }else{
- if (slotID < 27) {
- if (!mergeItemStack(itemstack, 27, 36 + 18, false))
- return null;
- }else{
- if (!mergeItemStack(itemstack, 18, 27, false))
- return null;
- }
- }
- }else
- if (!mergeItemStack(itemstack, 18, inventorySlots.size(), false))
- return null;
- if (itemstack.stackSize == 0)
- slot.putStack(null);
- else slot.onSlotChanged();
- if (itemstack.stackSize != itemstack.stackSize)
- slot.onPickupFromSlot(player, itemstack);
- else return null;
- }
- return itemstack;
- }
+public class ContainerJewelryTab extends Container {
+ public ContainerJewelryTab(EntityPlayer player, IInventory inv,
+ IInventory extra) {
+ int x, y;
+ // Rings
+ for (x = 0; x <= 9; x++)
+ addSlotToContainer(new SlotRing(extra, x, 8 + x * 18, 7));
+ // Bracelets
+ for (x = 10; x <= 13; x++)
+ addSlotToContainer(
+ new SlotBracelet(extra, x, 8 + (x - 10) * 18, 26));
+ // Necklaces
+ for (x = 14; x <= 16; x++)
+ addSlotToContainer(
+ new SlotNecklace(extra, x, 8 + (x - 14) * 18, 45));
+ // Earrings
+ addSlotToContainer(new SlotEarrings(extra, 17, 8, 64));
+ // Hotbar
+ for (x = 0; x < 9; ++x)
+ addSlotToContainer(new Slot(inv, x, 17 + x * 18, 142));
+ // Inventory
+ for (x = 0; x < 3; ++x)
+ for (y = 0; y < 9; ++y)
+ addSlotToContainer(new Slot(inv, 9 + y + x * 9,
+ 17 + y * 18, 84 + x * 18));
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer player) {
+ return true;
+ }
+
+ @Override
+ public ItemStack slotClick(int slotID, int j, int k,
+ EntityPlayer player) {
+ if (slotID >= 0 && slotID <= 17 && !player.worldObj.isRemote) {
+ try {
+ if (player.inventory.getItemStack() == null
+ && inventoryItemStacks.get(slotID) != null
+ && ((ItemStack) inventoryItemStacks.get(slotID))
+ .getItem() instanceof ItemBaseJewelry)
+ ((ItemBaseJewelry) ((ItemStack) inventoryItemStacks
+ .get(slotID)).getItem()).onJewelryUnequipped(
+ (ItemStack) inventoryItemStacks
+ .get(slotID));
+ else if (player.inventory.getItemStack() != null
+ && player.inventory.getItemStack()
+ .getItem() instanceof ItemBaseJewelry
+ && inventoryItemStacks.get(slotID) == null)
+ ((ItemBaseJewelry) player.inventory.getItemStack()
+ .getItem()).onJewelryEquipped(
+ player.inventory.getItemStack());
+ if (player.inventory.getItemStack() == null
+ && inventoryItemStacks.get(slotID) != null
+ && ((ItemStack) inventoryItemStacks.get(slotID))
+ .getItem() instanceof IJewelryItem)
+ ((IJewelryItem) ((ItemStack) inventoryItemStacks
+ .get(slotID)).getItem()).onJewelryUnequipped(
+ (ItemStack) inventoryItemStacks
+ .get(slotID));
+ else if (player.inventory.getItemStack() != null
+ && player.inventory.getItemStack()
+ .getItem() instanceof IJewelryItem
+ && inventoryItemStacks.get(slotID) == null)
+ ((IJewelryItem) player.inventory.getItemStack()
+ .getItem()).onJewelryEquipped(
+ player.inventory.getItemStack());
+ } catch (Exception e) {
+ JewelrycraftMod.logger.error(
+ "An error has occured while equipping an item.");
+ e.printStackTrace();
+ }
+ }
+ return super.slotClick(slotID, j, k, player);
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer player, int slotID) {
+ ItemStack itemstack = null;
+ Slot slot = (Slot) inventorySlots.get(slotID);
+ if (slot != null && slot.getHasStack()) {
+ ItemStack itemstack1 = slot.getStack();
+ itemstack = itemstack1.copy();
+ if (slotID >= 18) {
+ if (itemstack.getItem() instanceof ItemRing
+ || (itemstack.getItem() instanceof IJewelryItem
+ && ((IJewelryItem) itemstack.getItem())
+ .type() == 0)) {
+ if (!mergeItemStack(itemstack, 0, 10, false)
+ && !slot.getHasStack())
+ return null;
+ } else if (itemstack.getItem() instanceof ItemBracelet
+ || (itemstack.getItem() instanceof IJewelryItem
+ && ((IJewelryItem) itemstack.getItem())
+ .type() == 1)) {
+ if (!mergeItemStack(itemstack, 10, 14, false)
+ && !slot.getHasStack())
+ return null;
+ } else if (itemstack.getItem() instanceof ItemNecklace
+ || (itemstack.getItem() instanceof IJewelryItem
+ && ((IJewelryItem) itemstack.getItem())
+ .type() == 2)) {
+ if (!mergeItemStack(itemstack, 14, 17, false)
+ && !slot.getHasStack())
+ return null;
+ } else if (itemstack.getItem() instanceof ItemEarrings
+ || (itemstack.getItem() instanceof IJewelryItem
+ && ((IJewelryItem) itemstack.getItem())
+ .type() == 3)) {
+ if (!mergeItemStack(itemstack, 17, 18, false)
+ && !slot.getHasStack())
+ return null;
+ } else {
+ if (slotID < 27) {
+ if (!mergeItemStack(itemstack, 27, 36 + 18, false))
+ return null;
+ } else {
+ if (!mergeItemStack(itemstack, 18, 27, false))
+ return null;
+ }
+ }
+ } else if (!mergeItemStack(itemstack, 18,
+ inventorySlots.size(), false))
+ return null;
+ if (itemstack.stackSize == 0)
+ slot.putStack(null);
+ else
+ slot.onSlotChanged();
+ if (itemstack.stackSize != itemstack.stackSize)
+ slot.onPickupFromSlot(player, itemstack);
+ else
+ return null;
+ }
+ return itemstack;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerRingChest.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerRingChest.java index 3d7beb6..e848b38 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerRingChest.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerRingChest.java @@ -8,57 +8,63 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntityChest; -public class ContainerRingChest extends Container -{ - public TileEntityChest theChest; - - /** - * @param inv - * @param chest - */ - public ContainerRingChest(InventoryPlayer inv, TileEntityChest chest) - { - theChest = chest; - int x, y; - for(x = 0; x < 9; x++) - addSlotToContainer(new SlotRingChest(inv, x, 8 + 18 * x, 142, x == inv.currentItem)); - for(y = 0; y < 3; y++) - for(x = 0; x < 9; x++) - addSlotToContainer(new Slot(inv, x + 9 + y * 9, 8 + 18 * x, 84 + y * 18)); - for(y = 0; y < 3; y++) - for(x = 0; x < 9; x++) - addSlotToContainer(new SlotRingChest(chest, 26 - (x + y * 9), 8 + 18 * (8 - x), 17 + (2 - y) * 18, false)); - } - - /** - * @param player - * @return - */ - @Override - public boolean canInteractWith(EntityPlayer player) - { - return true; - } - - /** - * @param par1EntityPlayer - * @param par2 - * @return - */ - @Override - public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) - { - ItemStack itemstack = null; - Slot slot = (Slot)inventorySlots.get(par2); - if (slot != null && slot.getHasStack()){ - ItemStack itemstack1 = slot.getStack(); - itemstack = itemstack1.copy(); - if (par2 < 27){ - if (!mergeItemStack(itemstack1, 27, inventorySlots.size(), true)) return null; - }else if (!mergeItemStack(itemstack1, 0, 27, false)) return null; - if (itemstack1.stackSize == 0) slot.putStack((ItemStack)null); - else slot.onSlotChanged(); - } - return itemstack; - } +public class ContainerRingChest extends Container { + public TileEntityChest theChest; + + /** + * @param inv + * @param chest + */ + public ContainerRingChest(InventoryPlayer inv, TileEntityChest chest) { + theChest = chest; + int x, y; + for (x = 0; x < 9; x++) + addSlotToContainer(new SlotRingChest(inv, x, 8 + 18 * x, 142, + x == inv.currentItem)); + for (y = 0; y < 3; y++) + for (x = 0; x < 9; x++) + addSlotToContainer(new Slot(inv, x + 9 + y * 9, 8 + 18 * x, + 84 + y * 18)); + for (y = 0; y < 3; y++) + for (x = 0; x < 9; x++) + addSlotToContainer(new SlotRingChest(chest, + 26 - (x + y * 9), 8 + 18 * (8 - x), + 17 + (2 - y) * 18, false)); + } + + /** + * @param player + * @return + */ + @Override + public boolean canInteractWith(EntityPlayer player) { + return true; + } + + /** + * @param par1EntityPlayer + * @param par2 + * @return + */ + @Override + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, + int par2) { + ItemStack itemstack = null; + Slot slot = (Slot) inventorySlots.get(par2); + if (slot != null && slot.getHasStack()) { + ItemStack itemstack1 = slot.getStack(); + itemstack = itemstack1.copy(); + if (par2 < 27) { + if (!mergeItemStack(itemstack1, 27, inventorySlots.size(), + true)) + return null; + } else if (!mergeItemStack(itemstack1, 0, 27, false)) + return null; + if (itemstack1.stackSize == 0) + slot.putStack((ItemStack) null); + else + slot.onSlotChanged(); + } + return itemstack; + } } diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java index cfd2e20..2f3a9cc 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java @@ -7,47 +7,44 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-public class SlotBracelet extends Slot
-{
-
- /**
- * @param tile
- * @param slotID
- * @param x
- * @param y
- */
- public SlotBracelet(IInventory tile, int slotID, int x, int y)
- {
- super(tile, slotID, x, y);
- }
-
- /**
- * @param stack
- * @return
- */
- @Override
- public boolean isItemValid(ItemStack stack)
- {
- return stack.getItem() instanceof ItemBracelet || (stack.getItem() instanceof IJewelryItem && ((IJewelryItem)stack.getItem()).type() == 1);
- }
-
- /**
- * @param amount
- * @return
- */
- @Override
- public ItemStack decrStackSize(int amount)
- {
- return super.decrStackSize(amount);
- }
-
- /**
- * @param player
- * @return
- */
- @Override
- public boolean canTakeStack(EntityPlayer player)
- {
- return true;
- }
+public class SlotBracelet extends Slot {
+
+ /**
+ * @param tile
+ * @param slotID
+ * @param x
+ * @param y
+ */
+ public SlotBracelet(IInventory tile, int slotID, int x, int y) {
+ super(tile, slotID, x, y);
+ }
+
+ /**
+ * @param stack
+ * @return
+ */
+ @Override
+ public boolean isItemValid(ItemStack stack) {
+ return stack.getItem() instanceof ItemBracelet
+ || (stack.getItem() instanceof IJewelryItem
+ && ((IJewelryItem) stack.getItem()).type() == 1);
+ }
+
+ /**
+ * @param amount
+ * @return
+ */
+ @Override
+ public ItemStack decrStackSize(int amount) {
+ return super.decrStackSize(amount);
+ }
+
+ /**
+ * @param player
+ * @return
+ */
+ @Override
+ public boolean canTakeStack(EntityPlayer player) {
+ return true;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java index e0603a3..c563f4d 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java @@ -7,47 +7,44 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-public class SlotEarrings extends Slot
-{
-
- /**
- * @param tile
- * @param slotID
- * @param x
- * @param y
- */
- public SlotEarrings(IInventory tile, int slotID, int x, int y)
- {
- super(tile, slotID, x, y);
- }
-
- /**
- * @param stack
- * @return
- */
- @Override
- public boolean isItemValid(ItemStack stack)
- {
- return stack.getItem() instanceof ItemEarrings || (stack.getItem() instanceof IJewelryItem && ((IJewelryItem)stack.getItem()).type() == 3);
- }
-
- /**
- * @param amount
- * @return
- */
- @Override
- public ItemStack decrStackSize(int amount)
- {
- return super.decrStackSize(amount);
- }
-
- /**
- * @param player
- * @return
- */
- @Override
- public boolean canTakeStack(EntityPlayer player)
- {
- return true;
- }
+public class SlotEarrings extends Slot {
+
+ /**
+ * @param tile
+ * @param slotID
+ * @param x
+ * @param y
+ */
+ public SlotEarrings(IInventory tile, int slotID, int x, int y) {
+ super(tile, slotID, x, y);
+ }
+
+ /**
+ * @param stack
+ * @return
+ */
+ @Override
+ public boolean isItemValid(ItemStack stack) {
+ return stack.getItem() instanceof ItemEarrings
+ || (stack.getItem() instanceof IJewelryItem
+ && ((IJewelryItem) stack.getItem()).type() == 3);
+ }
+
+ /**
+ * @param amount
+ * @return
+ */
+ @Override
+ public ItemStack decrStackSize(int amount) {
+ return super.decrStackSize(amount);
+ }
+
+ /**
+ * @param player
+ * @return
+ */
+ @Override
+ public boolean canTakeStack(EntityPlayer player) {
+ return true;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java index 4b810be..ab2d04e 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java @@ -7,47 +7,44 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-public class SlotNecklace extends Slot
-{
-
- /**
- * @param tile
- * @param slotID
- * @param x
- * @param y
- */
- public SlotNecklace(IInventory tile, int slotID, int x, int y)
- {
- super(tile, slotID, x, y);
- }
-
- /**
- * @param stack
- * @return
- */
- @Override
- public boolean isItemValid(ItemStack stack)
- {
- return stack.getItem() instanceof ItemNecklace || (stack.getItem() instanceof IJewelryItem && ((IJewelryItem)stack.getItem()).type() == 2);
- }
-
- /**
- * @param amount
- * @return
- */
- @Override
- public ItemStack decrStackSize(int amount)
- {
- return super.decrStackSize(amount);
- }
-
- /**
- * @param player
- * @return
- */
- @Override
- public boolean canTakeStack(EntityPlayer player)
- {
- return true;
- }
+public class SlotNecklace extends Slot {
+
+ /**
+ * @param tile
+ * @param slotID
+ * @param x
+ * @param y
+ */
+ public SlotNecklace(IInventory tile, int slotID, int x, int y) {
+ super(tile, slotID, x, y);
+ }
+
+ /**
+ * @param stack
+ * @return
+ */
+ @Override
+ public boolean isItemValid(ItemStack stack) {
+ return stack.getItem() instanceof ItemNecklace
+ || (stack.getItem() instanceof IJewelryItem
+ && ((IJewelryItem) stack.getItem()).type() == 2);
+ }
+
+ /**
+ * @param amount
+ * @return
+ */
+ @Override
+ public ItemStack decrStackSize(int amount) {
+ return super.decrStackSize(amount);
+ }
+
+ /**
+ * @param player
+ * @return
+ */
+ @Override
+ public boolean canTakeStack(EntityPlayer player) {
+ return true;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java index 4fb9265..6c16509 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java @@ -7,47 +7,44 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-public class SlotRing extends Slot
-{
-
- /**
- * @param tile
- * @param slotID
- * @param x
- * @param y
- */
- public SlotRing(IInventory tile, int slotID, int x, int y)
- {
- super(tile, slotID, x, y);
- }
-
- /**
- * @param stack
- * @return
- */
- @Override
- public boolean isItemValid(ItemStack stack)
- {
- return stack.getItem() instanceof ItemRing || (stack.getItem() instanceof IJewelryItem && ((IJewelryItem)stack.getItem()).type() == 0);
- }
-
- /**
- * @param amount
- * @return
- */
- @Override
- public ItemStack decrStackSize(int amount)
- {
- return super.decrStackSize(amount);
- }
-
- /**
- * @param player
- * @return
- */
- @Override
- public boolean canTakeStack(EntityPlayer player)
- {
- return true;
- }
+public class SlotRing extends Slot {
+
+ /**
+ * @param tile
+ * @param slotID
+ * @param x
+ * @param y
+ */
+ public SlotRing(IInventory tile, int slotID, int x, int y) {
+ super(tile, slotID, x, y);
+ }
+
+ /**
+ * @param stack
+ * @return
+ */
+ @Override
+ public boolean isItemValid(ItemStack stack) {
+ return stack.getItem() instanceof ItemRing
+ || (stack.getItem() instanceof IJewelryItem
+ && ((IJewelryItem) stack.getItem()).type() == 0);
+ }
+
+ /**
+ * @param amount
+ * @return
+ */
+ @Override
+ public ItemStack decrStackSize(int amount) {
+ return super.decrStackSize(amount);
+ }
+
+ /**
+ * @param player
+ * @return
+ */
+ @Override
+ public boolean canTakeStack(EntityPlayer player) {
+ return true;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRingChest.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRingChest.java index 8cc5431..72c149d 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRingChest.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRingChest.java @@ -5,51 +5,48 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class SlotRingChest extends Slot -{ - public boolean locked = false; - - /** - * @param tile - * @param slotID - * @param x - * @param y - * @param locked - */ - public SlotRingChest(IInventory tile, int slotID, int x, int y, boolean locked) - { - super(tile, slotID, x, y); - this.locked = locked; - } - - /** - * @param stack - * @return - */ - @Override - public boolean isItemValid(ItemStack stack) - { - return !locked; - } - - /** - * @param amount - * @return - */ - @Override - public ItemStack decrStackSize(int amount) - { - if (!locked) return super.decrStackSize(amount); - return null; - } - - /** - * @param player - * @return - */ - @Override - public boolean canTakeStack(EntityPlayer player) - { - return !locked; - } +public class SlotRingChest extends Slot { + public boolean locked = false; + + /** + * @param tile + * @param slotID + * @param x + * @param y + * @param locked + */ + public SlotRingChest(IInventory tile, int slotID, int x, int y, + boolean locked) { + super(tile, slotID, x, y); + this.locked = locked; + } + + /** + * @param stack + * @return + */ + @Override + public boolean isItemValid(ItemStack stack) { + return !locked; + } + + /** + * @param amount + * @return + */ + @Override + public ItemStack decrStackSize(int amount) { + if (!locked) + return super.decrStackSize(amount); + return null; + } + + /** + * @param player + * @return + */ + @Override + public boolean canTakeStack(EntityPlayer player) { + return !locked; + } } diff --git a/src/main/java/darkknight/jewelrycraft/commands/JewelrycraftCommands.java b/src/main/java/darkknight/jewelrycraft/commands/JewelrycraftCommands.java index cc5f216..2bafd5f 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/commands/JewelrycraftCommands.java +++ b/src/main/java/darkknight/jewelrycraft/commands/JewelrycraftCommands.java @@ -10,6 +10,7 @@ package darkknight.jewelrycraft.commands; import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
+
import darkknight.jewelrycraft.util.JewelrycraftUtil;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
@@ -18,66 +19,74 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ChatComponentTranslation;
-public class JewelrycraftCommands extends CommandBase
-{
- private List aliases;
-
- public JewelrycraftCommands()
- {
- this.aliases = new ArrayList();
- this.aliases.add("jw");
- this.aliases.add("jewelry");
- }
-
- @Override
- public String getCommandName()
- {
- return "jewelrycraft";
- }
-
- @Override
- public String getCommandUsage(ICommandSender var1)
- {
- return "/jewelrycraft <addCursePoints:getCursePoints:setCursePoints> <user> [points]";
- }
-
- @Override
- public List getCommandAliases()
- {
- return aliases;
- }
-
- @Override
- public void processCommand(ICommandSender commandSender, String[] astring)
- {
- if (astring.length == 0 || astring[0].equals("help")) throw new WrongUsageException(getCommandUsage(commandSender));
- if (astring[0].equals("getCursePoints")){
- EntityPlayerMP entityplayermp = getPlayer(commandSender, astring[1]);
- commandSender.addChatMessage(new ChatComponentTranslation(Integer.toString(JewelrycraftUtil.getCursePoints(entityplayermp))));
- }else if (astring[0].equals("addCursePoints")){
- int points = CommandBase.parseIntWithMin(commandSender, astring[2], 0);
- EntityPlayerMP entityplayermp = getPlayer(commandSender, astring[1]);
- JewelrycraftUtil.addCursePoints(entityplayermp, points);
- }else if (astring[0].equals("setCursePoints")){
- int points = CommandBase.parseIntWithMin(commandSender, astring[2], 0);
- EntityPlayerMP entityplayermp = getPlayer(commandSender, astring[1]);
- JewelrycraftUtil.addCursePoints(entityplayermp, points - JewelrycraftUtil.getCursePoints(entityplayermp));
- }
- }
-
- @Override
- public List addTabCompletionOptions(ICommandSender icommandsender, String[] astring)
- {
- final List<String> MATCHES = new LinkedList<String>();
- final String ARG_LC = astring[astring.length - 1].toLowerCase();
- if (astring.length == 1){
- if ("addCursePoints".toLowerCase().startsWith(ARG_LC)) MATCHES.add("addCursePoints");
- if ("getCursePoints".toLowerCase().startsWith(ARG_LC)) MATCHES.add("getCursePoints");
- if ("setCursePoints".toLowerCase().startsWith(ARG_LC)) MATCHES.add("setCursePoints");
- }else if (astring.length == 2){
- for(String un: MinecraftServer.getServer().getAllUsernames())
- if (un.toLowerCase().startsWith(ARG_LC)) MATCHES.add(un);
- }
- return MATCHES.isEmpty() ? null : MATCHES;
- }
+public class JewelrycraftCommands extends CommandBase {
+ private List<String> aliases;
+
+ public JewelrycraftCommands() {
+ this.aliases = new ArrayList<String>();
+ this.aliases.add("jw");
+ this.aliases.add("jewelry");
+ }
+
+ @Override
+ public String getCommandName() {
+ return "jewelrycraft";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender var1) {
+ return "/jewelrycraft <addCursePoints:getCursePoints:setCursePoints> <user> [points]";
+ }
+
+ @Override
+ public List getCommandAliases() {
+ return aliases;
+ }
+
+ @Override
+ public void processCommand(ICommandSender commandSender,
+ String[] astring) {
+ if (astring.length == 0 || astring[0].equals("help"))
+ throw new WrongUsageException(getCommandUsage(commandSender));
+ if (astring[0].equals("getCursePoints")) {
+ EntityPlayerMP entityplayermp =
+ getPlayer(commandSender, astring[1]);
+ commandSender.addChatMessage(new ChatComponentTranslation(
+ Integer.toString(JewelrycraftUtil
+ .getCursePoints(entityplayermp))));
+ } else if (astring[0].equals("addCursePoints")) {
+ int points = CommandBase.parseIntWithMin(commandSender,
+ astring[2], 0);
+ EntityPlayerMP entityplayermp =
+ getPlayer(commandSender, astring[1]);
+ JewelrycraftUtil.addCursePoints(entityplayermp, points);
+ } else if (astring[0].equals("setCursePoints")) {
+ int points = CommandBase.parseIntWithMin(commandSender,
+ astring[2], 0);
+ EntityPlayerMP entityplayermp =
+ getPlayer(commandSender, astring[1]);
+ JewelrycraftUtil.addCursePoints(entityplayermp, points
+ - JewelrycraftUtil.getCursePoints(entityplayermp));
+ }
+ }
+
+ @Override
+ public List addTabCompletionOptions(ICommandSender icommandsender,
+ String[] astring) {
+ final List<String> MATCHES = new LinkedList<String>();
+ final String ARG_LC = astring[astring.length - 1].toLowerCase();
+ if (astring.length == 1) {
+ if ("addCursePoints".toLowerCase().startsWith(ARG_LC))
+ MATCHES.add("addCursePoints");
+ if ("getCursePoints".toLowerCase().startsWith(ARG_LC))
+ MATCHES.add("getCursePoints");
+ if ("setCursePoints".toLowerCase().startsWith(ARG_LC))
+ MATCHES.add("setCursePoints");
+ } else if (astring.length == 2) {
+ for (String un : MinecraftServer.getServer().getAllUsernames())
+ if (un.toLowerCase().startsWith(ARG_LC))
+ MATCHES.add(un);
+ }
+ return MATCHES.isEmpty() ? null : MATCHES;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/config/ConfigGui.java b/src/main/java/darkknight/jewelrycraft/config/ConfigGui.java index b337f06..c8e69de 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/config/ConfigGui.java +++ b/src/main/java/darkknight/jewelrycraft/config/ConfigGui.java @@ -2,25 +2,26 @@ package darkknight.jewelrycraft.config; import java.util.ArrayList;
import java.util.List;
+
import cpw.mods.fml.client.config.GuiConfig;
import cpw.mods.fml.client.config.IConfigElement;
import darkknight.jewelrycraft.util.Variables;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.common.config.ConfigElement;
-public class ConfigGui extends GuiConfig
-{
- public ConfigGui(GuiScreen parent)
- {
- super(parent, getElements(), Variables.MODID, Variables.MODID, false, false, Variables.MODNAME + " Config");
- }
-
- @SuppressWarnings ({"rawtypes"})
- private static List<IConfigElement> getElements()
- {
- List<IConfigElement> list = new ArrayList<IConfigElement>(ConfigHandler.categories.length);
- for(String category: ConfigHandler.categories)
- list.add(new ConfigElement(ConfigHandler.INSTANCE.config.getCategory(category)));
- return list;
- }
+public class ConfigGui extends GuiConfig {
+ public ConfigGui(GuiScreen parent) {
+ super(parent, getElements(), Variables.MODID, Variables.MODID,
+ false, false, Variables.MODNAME + " Config");
+ }
+
+ @SuppressWarnings({ "rawtypes" })
+ private static List<IConfigElement> getElements() {
+ List<IConfigElement> list = new ArrayList<IConfigElement>(
+ ConfigHandler.categories.length);
+ for (String category : ConfigHandler.categories)
+ list.add(new ConfigElement(
+ ConfigHandler.config.getCategory(category)));
+ return list;
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/config/ConfigGuiFactory.java b/src/main/java/darkknight/jewelrycraft/config/ConfigGuiFactory.java index 31d85a3..2e8f86f 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/config/ConfigGuiFactory.java +++ b/src/main/java/darkknight/jewelrycraft/config/ConfigGuiFactory.java @@ -1,31 +1,29 @@ package darkknight.jewelrycraft.config;
import java.util.Set;
+
import cpw.mods.fml.client.IModGuiFactory;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
-public class ConfigGuiFactory implements IModGuiFactory
-{
- @Override
- public void initialize(Minecraft minecraftInstance)
- {}
-
- @Override
- public Class<? extends GuiScreen> mainConfigGuiClass()
- {
- return ConfigGui.class;
- }
-
- @Override
- public Set<RuntimeOptionCategoryElement> runtimeGuiCategories()
- {
- return null;
- }
-
- @Override
- public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element)
- {
- return null;
- }
+public class ConfigGuiFactory implements IModGuiFactory {
+ @Override
+ public void initialize(Minecraft minecraftInstance) {
+ }
+
+ @Override
+ public Class<? extends GuiScreen> mainConfigGuiClass() {
+ return ConfigGui.class;
+ }
+
+ @Override
+ public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
+ return null;
+ }
+
+ @Override
+ public RuntimeOptionGuiHandler
+ getHandlerFor(RuntimeOptionCategoryElement element) {
+ return null;
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/config/ConfigHandler.java b/src/main/java/darkknight/jewelrycraft/config/ConfigHandler.java index d5431bc..45feab0 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/config/ConfigHandler.java +++ b/src/main/java/darkknight/jewelrycraft/config/ConfigHandler.java @@ -6,126 +6,230 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent; import darkknight.jewelrycraft.util.Variables;
import net.minecraftforge.common.config.Configuration;
-public class ConfigHandler
-{
- public static Configuration config;
- public static final ConfigHandler INSTANCE = new ConfigHandler();
- public static final String[] categories = {"Timers", "Village Generation", "Misc", "World Generation", "Curses"};
-
- public static int INGOT_COOLING_TIME;
- public static int INGOT_MELTING_TIME;
- public static int GEM_PLACEMENT_TIME;
- public static int RITUAL_TIME;
- public static int HEART_DESPAWN_TIME;
-
- public static boolean GENERATE_VILLAGE_NETHERSTAR;
- public static boolean CAN_FURNACE_GENERATE_INGOTS;
- public static int MAX_VILLAGE_JEWELERS;
- public static int JEWELER_WEIGHT;
- public static int INGOT_CHEST_MIN;
- public static int INGOT_CHEST_MAX;
- public static int INGOT_CHEST_MAX_STACK;
- public static int GEM_CHEST_MIN;
- public static int GEM_CHEST_MAX;
- public static int FURNACE_MIN_INGOT_STACK;
- public static int FURNACE_MAX_INGOT_STACK;
-
- public static int MAX_BLACK_HEARTS_PICKUP;
- public static int MAX_BLUE_HEARTS_PICKUP;
- public static boolean CAN_BLUE_HEARTS_SPAWN;
- public static boolean CAN_BLACK_HEARTS_SPAWN;
- public static boolean CAN_HOLY_HEARTS_SPAWN;
- public static boolean CAN_RED_HEARTS_SPAWN;
-
- public static boolean CRYSTAL_GLOW;
- public static boolean CRYSTAL_PARTICLES;
- public static boolean HEARTS_DESPAWN;
- public static boolean JEWELRY_INFO;
-
- public static boolean CURSES_ENABLED = true;
- public static boolean CURSE_ROTTEN_HEART = true;
- public static boolean CURSE_FLAMING_SOUL = true;
- public static boolean CURSE_GREED = true;
- public static boolean CURSE_BLIND = true;
- public static boolean CURSE_INFAMY = true;
- public static boolean CURSE_MIDAS_TOUCH = true;
- public static boolean CURSE_RABBIT_PAW = true;
- public static boolean CURSE_PENTAGRAM = true;
- public static boolean CURSE_VAMPIRE_HUNGER = true;
- public static boolean CURSE_HUMBLE_BUNDLE = true;
- public static boolean CURSE_DEATHS_TOUCH = true;
-
- public static boolean ENABLE_WORLD_GEN = true;
- public static boolean ORE_GEN = true;
- public static boolean CRYSTAL_GEN = true;
- public static boolean STRUCTURES[] = {true, true, true, true, true, true};
- public static int STRUCTURES_SPAWN_CHANCE[] = {6, 5, 7, 10, 6, 10};
-
- public void loadConfig(FMLPreInitializationEvent event)
- {
- config = new Configuration(event.getSuggestedConfigurationFile(),true);
- config.load();
- syncConfigs();
- }
-
- private void syncConfigs()
- {
- INGOT_COOLING_TIME = config.getInt("Molder Ingot Cooling Time", categories[0], 100, 5, Integer.MAX_VALUE, "This sets the number of ticks you need to wait before the mold is cooled.");
- INGOT_MELTING_TIME = config.getInt("Ingot Melting Time", categories[0], 1500, 5, Integer.MAX_VALUE, "This sets the number of ticks you need to wait before an ingot is completely smelted.");
- GEM_PLACEMENT_TIME = config.getInt( "Jewelry Crafting Time", categories[0], 200, 5, Integer.MAX_VALUE, "This sets the number of ticks it takes for a jewel to be modified.");
- RITUAL_TIME = config.getInt( "Ritual Time", categories[0], 500, 5, Integer.MAX_VALUE, "This sets the number of ticks it takes for the ritual to end.");
- HEART_DESPAWN_TIME = config.getInt( "Hearts Despawn Time", categories[0], 900, 20, Integer.MAX_VALUE, "This sets the number of ticks it takes for hearts to despawn, 20=1 second");
-
- GENERATE_VILLAGE_NETHERSTAR = config.getBoolean("Netherstar Generation", categories[1], false, "If set to true Nether Stars will be able to generate in Jewelers chests.");
- CAN_FURNACE_GENERATE_INGOTS = config.getBoolean("Furnace Ingots Generation", categories[1], true, "If set to true jewelers will generate ingots in furnaces.");
-
- MAX_VILLAGE_JEWELERS = config.getInt("Maximum Jewelers", categories[1], 1, 0, Integer.MAX_VALUE, "Sets how many jewelers can be in a village.");
- JEWELER_WEIGHT = config.getInt("Jewelers Weight", categories[1], 30, 0, Integer.MAX_VALUE, "Chance of getting a jeweler in a village. The higher the value, the higher the chance.");
- INGOT_CHEST_MIN = config.getInt("Ingot Chest Min", categories[1], 1, 0, Integer.MAX_VALUE, "Minimum number of ingots that can be found in a chest from the Jeweler. (It's the chest from the back part)");
- INGOT_CHEST_MAX = config.getInt("Ingot Chest Max", categories[1], 4, 0, Integer.MAX_VALUE, "Maximum number of ingots that can be found in a chest from the Jeweler. (It's the chest from the back part)");
- INGOT_CHEST_MAX_STACK = config.getInt("Ingot Chest Max Stack", categories[1], 2, 0, Integer.MAX_VALUE, "Maximum number of the stack the ingots can be. For example: if set to 2 and ingots have a chance of generating, you have a chance of getting a stack of max 2 ingots in a chest.");
- GEM_CHEST_MIN = config.getInt("Jewelers Chest Min", categories[1], 2, 0, Integer.MAX_VALUE, "Determines the minimum nuber of jewels/modifiers that can be generated in the front chests of a Jeweler.");
- GEM_CHEST_MAX = config.getInt("Jewelers Chest Max", categories[1], 5, 0, Integer.MAX_VALUE, "Determines the maximum nuber of jewels/modifiers that can be generated in the front chests of a Jeweler.");
- FURNACE_MIN_INGOT_STACK = config.getInt("Ingot Furnace Min", categories[1], 2, 0, Integer.MAX_VALUE, "Determines the minimum number of ingots that can generate in a furnace.");
- FURNACE_MAX_INGOT_STACK = config.getInt("Ingot Furnace Max", categories[1], 5, 0, Integer.MAX_VALUE, "Determines the maximum number of ingots that can generate in a furnace.");
-
- CRYSTAL_GLOW = config.getBoolean("Crystal Glow", categories[2], false, "If true, then crystal will slowly glow (can cause lag)");
- CRYSTAL_PARTICLES = config.getBoolean("Crystal Particles", categories[2], true, "If false, then crystal will no longer spawn particles");
- HEARTS_DESPAWN = config.getBoolean("Hearts Despawn", categories[2], true, "If false, then Hearts and Half-hearts will no longer despawn");
- JEWELRY_INFO = config.getBoolean("Jewelry Info", categories[2], true, "If false, then extra info won't be show when hovering over a jewelery.");
- MAX_BLACK_HEARTS_PICKUP = config.getInt("Max Black Hearts Pickup", categories[2], Integer.MAX_VALUE, 0, Integer.MAX_VALUE, "Determines how many black hearts can a player pick up.");
- MAX_BLUE_HEARTS_PICKUP = config.getInt("Max Blue Hearts Pickup", categories[2], Integer.MAX_VALUE, 0, Integer.MAX_VALUE, "Determines how many blue hearts can a player pick up.");
- CAN_BLUE_HEARTS_SPAWN = config.getBoolean("Can Blue Hearts Spawn", categories[2], true, "Determines if blue hearts can spawn.");
- CAN_BLACK_HEARTS_SPAWN = config.getBoolean("Can Black Hearts Spawn", categories[2], true, "Determines if black hearts can spawn.");
- CAN_HOLY_HEARTS_SPAWN = config.getBoolean("Can Holy Hearts Spawn", categories[2], true, "Determines if holy hearts can spawn.");
- CAN_RED_HEARTS_SPAWN = config.getBoolean("Can Red Hearts Spawn", categories[2], true, "Determines if red hearts can spawn.");
-
- ENABLE_WORLD_GEN = config.getBoolean("World Generation", categories[3], true, "If false, nothing will generate (this includes ore)");
- ORE_GEN = config.getBoolean("Ore Generation", categories[3], true, "If false, ores won't generate");
- CRYSTAL_GEN = config.getBoolean("Crystal Generation", categories[3], true, "If false, crystals won't generate");
- for(int i = 0; i < STRUCTURES.length; i++)
- STRUCTURES[i] = config.getBoolean("Structure "+(i+1)+" Generation", categories[3], true, "If false, structure no."+(i+1)+" won't generate");
- for(int i = 0; i < STRUCTURES.length; i++)
- STRUCTURES_SPAWN_CHANCE[i] = config.getInt("Structure "+(i+1)+" Spawn Chance", categories[3], STRUCTURES_SPAWN_CHANCE[i], 1, Integer.MAX_VALUE, "Determines the chance for structure no."+(i+1)+" to generate. Lower = higher chance and vice versa.");
-
- CURSES_ENABLED = config.getBoolean("Curses", categories[4], true, "If set to false curses will be deactivated.");
- CURSE_ROTTEN_HEART = config.getBoolean("Rotten Heart", categories[4], true, "If set to false this curse will be deactivated.");
- CURSE_FLAMING_SOUL = config.getBoolean("Flaming Soul", categories[4], true, "If set to false this curse will be deactivated.");
- CURSE_GREED = config.getBoolean("Greed", categories[4], true, "If set to false this curse will be deactivated.");
- CURSE_BLIND = config.getBoolean("Blind", categories[4], true, "If set to false this curse will be deactivated.");
- CURSE_INFAMY = config.getBoolean("Infamy", categories[4], true, "If set to false this curse will be deactivated.");
- CURSE_MIDAS_TOUCH = config.getBoolean("Midas Touch", categories[4], true, "If set to false this curse will be deactivated.");
- CURSE_RABBIT_PAW = config.getBoolean("Rabbit's Paw", categories[4], true, "If set to false this curse will be deactivated.");
- CURSE_PENTAGRAM = config.getBoolean("Pentagram", categories[4], true, "If set to false this curse will be deactivated.");
- CURSE_VAMPIRE_HUNGER = config.getBoolean("Vampire Hunger", categories[4], true, "If set to false this curse will be deactivated.");
- CURSE_HUMBLE_BUNDLE = config.getBoolean("Humble Bundle", categories[4], true, "If set to false this curse will be deactivated.");
- CURSE_DEATHS_TOUCH = config.getBoolean("Deaths Touch", categories[4], true, "If set to false this curse will be deactivated.");
- if (config.hasChanged()) config.save();
- }
-
- @SubscribeEvent
- public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event)
- {
- if (event.modID.equals(Variables.MODID)) syncConfigs();
- }
+public class ConfigHandler {
+ public static Configuration config;
+ public static final ConfigHandler INSTANCE = new ConfigHandler();
+ public static final String[] categories = {
+ "Timers", "Village Generation", "Misc", "World Generation",
+ "Curses" };
+
+ public static int INGOT_COOLING_TIME;
+ public static int INGOT_MELTING_TIME;
+ public static int GEM_PLACEMENT_TIME;
+ public static int RITUAL_TIME;
+ public static int HEART_DESPAWN_TIME;
+
+ public static boolean GENERATE_VILLAGE_NETHERSTAR;
+ public static boolean CAN_FURNACE_GENERATE_INGOTS;
+ public static int MAX_VILLAGE_JEWELERS;
+ public static int JEWELER_WEIGHT;
+ public static int INGOT_CHEST_MIN;
+ public static int INGOT_CHEST_MAX;
+ public static int INGOT_CHEST_MAX_STACK;
+ public static int GEM_CHEST_MIN;
+ public static int GEM_CHEST_MAX;
+ public static int FURNACE_MIN_INGOT_STACK;
+ public static int FURNACE_MAX_INGOT_STACK;
+
+ public static int MAX_BLACK_HEARTS_PICKUP;
+ public static int MAX_BLUE_HEARTS_PICKUP;
+ public static boolean CAN_BLUE_HEARTS_SPAWN;
+ public static boolean CAN_BLACK_HEARTS_SPAWN;
+ public static boolean CAN_HOLY_HEARTS_SPAWN;
+ public static boolean CAN_RED_HEARTS_SPAWN;
+
+ public static boolean CRYSTAL_GLOW;
+ public static boolean CRYSTAL_PARTICLES;
+ public static boolean HEARTS_DESPAWN;
+ public static boolean JEWELRY_INFO;
+
+ public static boolean CURSES_ENABLED = true;
+ public static boolean CURSE_ROTTEN_HEART = true;
+ public static boolean CURSE_FLAMING_SOUL = true;
+ public static boolean CURSE_GREED = true;
+ public static boolean CURSE_BLIND = true;
+ public static boolean CURSE_INFAMY = true;
+ public static boolean CURSE_MIDAS_TOUCH = true;
+ public static boolean CURSE_RABBIT_PAW = true;
+ public static boolean CURSE_PENTAGRAM = true;
+ public static boolean CURSE_VAMPIRE_HUNGER = true;
+ public static boolean CURSE_HUMBLE_BUNDLE = true;
+ public static boolean CURSE_DEATHS_TOUCH = true;
+ public static boolean CURSE_DOUBLE_DOWN = true;
+ public static boolean CURSE_INCREDIBLE_DEVOTION = true;
+ public static float DEVOTION_FACTOR = 10.0f;
+ public static boolean CURSE_MONEY_EQUALS_POWER = true;
+ public static boolean CURSE_SCION_OF_HELL = true;
+
+ public static boolean ENABLE_WORLD_GEN = true;
+ public static boolean ORE_GEN = true;
+ public static boolean CRYSTAL_GEN = true;
+ public static boolean STRUCTURES[] = {
+ true, true, true, true, true, true };
+ public static int STRUCTURES_SPAWN_CHANCE[] = { 6,
+ 5, 7, 10, 6, 10 };
+
+ public void loadConfig(FMLPreInitializationEvent event) {
+ config = new Configuration(event.getSuggestedConfigurationFile(),
+ true);
+ config.load();
+ syncConfigs();
+ }
+
+ private void syncConfigs() {
+ INGOT_COOLING_TIME = config.getInt("Molder Ingot Cooling Time",
+ categories[0], 100, 5, Integer.MAX_VALUE,
+ "This sets the number of ticks you need to wait before the mold is cooled.");
+ INGOT_MELTING_TIME = config.getInt("Ingot Melting Time",
+ categories[0], 1500, 5, Integer.MAX_VALUE,
+ "This sets the number of ticks you need to wait before an ingot is completely smelted.");
+ GEM_PLACEMENT_TIME = config.getInt("Jewelry Crafting Time",
+ categories[0], 200, 5, Integer.MAX_VALUE,
+ "This sets the number of ticks it takes for a jewel to be modified.");
+ RITUAL_TIME = config.getInt("Ritual Time", categories[0], 500, 5,
+ Integer.MAX_VALUE,
+ "This sets the number of ticks it takes for the ritual to end.");
+ HEART_DESPAWN_TIME = config.getInt("Hearts Despawn Time",
+ categories[0], 900, 20, Integer.MAX_VALUE,
+ "This sets the number of ticks it takes for hearts to despawn, 20=1 second");
+
+ GENERATE_VILLAGE_NETHERSTAR = config.getBoolean(
+ "Netherstar Generation", categories[1], false,
+ "If set to true Nether Stars will be able to generate in Jewelers chests.");
+ CAN_FURNACE_GENERATE_INGOTS = config.getBoolean(
+ "Furnace Ingots Generation", categories[1], true,
+ "If set to true jewelers will generate ingots in furnaces.");
+
+ MAX_VILLAGE_JEWELERS = config.getInt("Maximum Jewelers",
+ categories[1], 1, 0, Integer.MAX_VALUE,
+ "Sets how many jewelers can be in a village.");
+ JEWELER_WEIGHT = config.getInt("Jewelers Weight", categories[1],
+ 30, 0, Integer.MAX_VALUE,
+ "Chance of getting a jeweler in a village. The higher the value, the higher the chance.");
+ INGOT_CHEST_MIN = config.getInt("Ingot Chest Min", categories[1],
+ 1, 0, Integer.MAX_VALUE,
+ "Minimum number of ingots that can be found in a chest from the Jeweler. (It's the chest from the back part)");
+ INGOT_CHEST_MAX = config.getInt("Ingot Chest Max", categories[1],
+ 4, 0, Integer.MAX_VALUE,
+ "Maximum number of ingots that can be found in a chest from the Jeweler. (It's the chest from the back part)");
+ INGOT_CHEST_MAX_STACK = config.getInt("Ingot Chest Max Stack",
+ categories[1], 2, 0, Integer.MAX_VALUE,
+ "Maximum number of the stack the ingots can be. For example: if set to 2 and ingots have a chance of generating, you have a chance of getting a stack of max 2 ingots in a chest.");
+ GEM_CHEST_MIN = config.getInt("Jewelers Chest Min", categories[1],
+ 2, 0, Integer.MAX_VALUE,
+ "Determines the minimum nuber of jewels/modifiers that can be generated in the front chests of a Jeweler.");
+ GEM_CHEST_MAX = config.getInt("Jewelers Chest Max", categories[1],
+ 5, 0, Integer.MAX_VALUE,
+ "Determines the maximum nuber of jewels/modifiers that can be generated in the front chests of a Jeweler.");
+ FURNACE_MIN_INGOT_STACK = config.getInt("Ingot Furnace Min",
+ categories[1], 2, 0, Integer.MAX_VALUE,
+ "Determines the minimum number of ingots that can generate in a furnace.");
+ FURNACE_MAX_INGOT_STACK = config.getInt("Ingot Furnace Max",
+ categories[1], 5, 0, Integer.MAX_VALUE,
+ "Determines the maximum number of ingots that can generate in a furnace.");
+
+ CRYSTAL_GLOW = config.getBoolean("Crystal Glow", categories[2],
+ false,
+ "If true, then crystal will slowly glow (can cause lag)");
+ CRYSTAL_PARTICLES = config.getBoolean("Crystal Particles",
+ categories[2], true,
+ "If false, then crystal will no longer spawn particles");
+ HEARTS_DESPAWN = config.getBoolean("Hearts Despawn", categories[2],
+ true,
+ "If false, then Hearts and Half-hearts will no longer despawn");
+ JEWELRY_INFO = config.getBoolean("Jewelry Info", categories[2],
+ true,
+ "If false, then extra info won't be show when hovering over a jewelery.");
+ MAX_BLACK_HEARTS_PICKUP = config.getInt("Max Black Hearts Pickup",
+ categories[2], Integer.MAX_VALUE, 0, Integer.MAX_VALUE,
+ "Determines how many black hearts can a player pick up.");
+ MAX_BLUE_HEARTS_PICKUP = config.getInt("Max Blue Hearts Pickup",
+ categories[2], Integer.MAX_VALUE, 0, Integer.MAX_VALUE,
+ "Determines how many blue hearts can a player pick up.");
+ CAN_BLUE_HEARTS_SPAWN = config.getBoolean("Can Blue Hearts Spawn",
+ categories[2], true,
+ "Determines if blue hearts can spawn.");
+ CAN_BLACK_HEARTS_SPAWN = config.getBoolean(
+ "Can Black Hearts Spawn", categories[2], true,
+ "Determines if black hearts can spawn.");
+ CAN_HOLY_HEARTS_SPAWN = config.getBoolean("Can Holy Hearts Spawn",
+ categories[2], true,
+ "Determines if holy hearts can spawn.");
+ CAN_RED_HEARTS_SPAWN = config.getBoolean("Can Red Hearts Spawn",
+ categories[2], true,
+ "Determines if red hearts can spawn.");
+
+ ENABLE_WORLD_GEN = config.getBoolean("World Generation",
+ categories[3], true,
+ "If false, nothing will generate (this includes ore)");
+ ORE_GEN = config.getBoolean("Ore Generation", categories[3], true,
+ "If false, ores won't generate");
+ CRYSTAL_GEN = config.getBoolean("Crystal Generation",
+ categories[3], true, "If false, crystals won't generate");
+ for (int i = 0; i < STRUCTURES.length; i++)
+ STRUCTURES[i] = config.getBoolean(
+ "Structure " + (i + 1) + " Generation", categories[3],
+ true, "If false, structure no." + (i + 1)
+ + " won't generate");
+ for (int i = 0; i < STRUCTURES.length; i++)
+ STRUCTURES_SPAWN_CHANCE[i] = config.getInt(
+ "Structure " + (i + 1) + " Spawn Chance",
+ categories[3], STRUCTURES_SPAWN_CHANCE[i], 1,
+ Integer.MAX_VALUE,
+ "Determines the chance for structure no." + (i + 1)
+ + " to generate. Lower = higher chance and vice versa.");
+
+ CURSES_ENABLED = config.getBoolean("Curses", categories[4], true,
+ "If set to false curses will be deactivated.");
+ CURSE_ROTTEN_HEART = config.getBoolean("Rotten Heart",
+ categories[4], true,
+ "If set to false this curse will be deactivated.");
+ CURSE_FLAMING_SOUL = config.getBoolean("Flaming Soul",
+ categories[4], true,
+ "If set to false this curse will be deactivated.");
+ CURSE_GREED = config.getBoolean("Greed", categories[4], true,
+ "If set to false this curse will be deactivated.");
+ CURSE_BLIND = config.getBoolean("Blind", categories[4], true,
+ "If set to false this curse will be deactivated.");
+ CURSE_INFAMY = config.getBoolean("Infamy", categories[4], true,
+ "If set to false this curse will be deactivated.");
+ CURSE_MIDAS_TOUCH = config.getBoolean("Midas Touch", categories[4],
+ true, "If set to false this curse will be deactivated.");
+ CURSE_RABBIT_PAW = config.getBoolean("Rabbit's Paw", categories[4],
+ true, "If set to false this curse will be deactivated.");
+ CURSE_PENTAGRAM = config.getBoolean("Pentagram", categories[4],
+ true, "If set to false this curse will be deactivated.");
+ CURSE_VAMPIRE_HUNGER = config.getBoolean("Vampire Hunger",
+ categories[4], true,
+ "If set to false this curse will be deactivated.");
+ CURSE_HUMBLE_BUNDLE = config.getBoolean("Humble Bundle",
+ categories[4], true,
+ "If set to false this curse will be deactivated.");
+ CURSE_DEATHS_TOUCH = config.getBoolean("Death's Touch",
+ categories[4], true,
+ "If set to false this curse will be deactivated.");
+ CURSE_DOUBLE_DOWN = config.getBoolean("Double Down", categories[4],
+ true, "If set to false this curse will be deactivated.");
+ CURSE_INCREDIBLE_DEVOTION = config.getBoolean(
+ "Incredible Devotion", categories[4], true,
+ "If set to false this curse will be deactivated.");
+ DEVOTION_FACTOR = config.getFloat("Devotion Factor", categories[4],
+ 10.0f, 0.0f, Float.MAX_VALUE, "How devoted are mobs?");
+ CURSE_MONEY_EQUALS_POWER = config.getBoolean("Money = Power",
+ categories[4], true,
+ "If set to false this curse will be deactivated.");
+ CURSE_SCION_OF_HELL = config.getBoolean("Scion of Hell",
+ categories[4], true,
+ "If set to false this curse will be deactivated.");
+
+ if (config.hasChanged())
+ config.save();
+ }
+
+ @SubscribeEvent
+ public void onConfigChanged(
+ ConfigChangedEvent.OnConfigChangedEvent event) {
+ if (event.modID.equals(Variables.MODID))
+ syncConfigs();
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseBlind.java b/src/main/java/darkknight/jewelrycraft/curses/CurseBlind.java index 800718c..8996605 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseBlind.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseBlind.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.curses;
import java.util.Random;
+
import darkknight.jewelrycraft.api.Curse;
import darkknight.jewelrycraft.config.ConfigHandler;
import darkknight.jewelrycraft.util.Variables;
@@ -10,45 +11,48 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
-public class CurseBlind extends Curse
-{
- public CurseBlind(String name, int txtID, String pack)
- {
- super(name, txtID, pack);
- }
-
- @Override
- public void action(World world, EntityPlayer player)
- {
- if (!player.isPotionActive(Potion.blindness) || player.getActivePotionEffect(Potion.blindness).getDuration() < 30) player.addPotionEffect(new PotionEffect(Potion.blindness.id, 60));
- }
-
- public String getDescription()
- {
- return StatCollector.translateToLocal("curse." + Variables.MODID + ".blind.description");
- }
-
- @Override
- public boolean canCurseBeActivated(World world)
- {
- return world.getWorldInfo().isHardcoreModeEnabled() ? false : ConfigHandler.CURSE_BLIND;
- }
-
- @Override
- public boolean canCurseBeActivated()
- {
- return ConfigHandler.CURSE_BLIND;
- }
-
- @Override
- public int weight(World world, EntityPlayer player, Random random)
- {
- return 7;
- }
+public class CurseBlind extends Curse {
+ public CurseBlind(String name, int txtID, String pack) {
+ super(name, txtID, pack);
+ }
+
+ @Override
+ public void action(World world, EntityPlayer player) {
+ if (!player.isPotionActive(Potion.blindness)
+ || player.getActivePotionEffect(Potion.blindness)
+ .getDuration() < 30)
+ player.addPotionEffect(
+ new PotionEffect(Potion.blindness.id, 60));
+ }
+
+ @Override
+ public String getDescription() {
+ return StatCollector.translateToLocal(
+ "curse." + Variables.MODID + ".blind.description");
+ }
+
+ @Override
+ public boolean canCurseBeActivated(World world) {
+ if (world.getWorldInfo().isHardcoreModeEnabled()) {
+ return false;
+ }
+
+ return ConfigHandler.CURSE_BLIND;
+ }
+
+ @Override
+ public boolean canCurseBeActivated() {
+ return ConfigHandler.CURSE_BLIND;
+ }
+
+ @Override
+ public int weight(World world, EntityPlayer player, Random random) {
+ return 7;
+ }
@Override
- public String getDisplayName()
- {
- return StatCollector.translateToLocal("curse." + Variables.MODID + ".blind");
+ public String getDisplayName() {
+ return StatCollector
+ .translateToLocal("curse." + Variables.MODID + ".blind");
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseDeathsTouch.java b/src/main/java/darkknight/jewelrycraft/curses/CurseDeathsTouch.java index 92e2dfa..aeb3e22 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseDeathsTouch.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseDeathsTouch.java @@ -10,35 +10,37 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
-public class CurseDeathsTouch extends Curse
-{
- public CurseDeathsTouch(String name, int txtID, String pack)
- {
- super(name, txtID, pack);
- }
-
- @Override
- public boolean attackedByPlayerActionCancelable(LivingAttackEvent event, World world, EntityPlayer player, Entity target)
- {
- if (!world.isRemote) target.attackEntityFrom(DamageSource.wither, event.ammount);
- return true;
- }
-
- public String getDescription()
- {
- return StatCollector.translateToLocal("curse." + Variables.MODID + ".deathsTouch.description");
- }
-
+public class CurseDeathsTouch extends Curse {
+ public CurseDeathsTouch(String name, int txtID, String pack) {
+ super(name, txtID, pack);
+ }
+
+ @Override
+ public boolean attackedByPlayerActionCancelable(
+ LivingAttackEvent event, World world, EntityPlayer player,
+ Entity target) {
+ if (!world.isRemote) {
+ target.attackEntityFrom(DamageSource.wither, event.ammount);
+ }
+
+ return true;
+ }
+
+ @Override
+ public String getDescription() {
+ return StatCollector.translateToLocal(
+ "curse." + Variables.MODID + ".deathsTouch.description");
+ }
+
+ @Override
+ public String getDisplayName() {
+ return StatCollector.translateToLocal(
+ "curse." + Variables.MODID + ".deathsTouch");
+ }
+
@Override
- public String getDisplayName()
- {
- return StatCollector.translateToLocal("curse." + Variables.MODID + ".deathsTouch");
+ public boolean canCurseBeActivated() {
+ return ConfigHandler.CURSE_DEATHS_TOUCH;
}
- @Override
- public boolean canCurseBeActivated()
- {
- return ConfigHandler.CURSE_DEATHS_TOUCH;
- }
-
}
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseDoubleDown.java b/src/main/java/darkknight/jewelrycraft/curses/CurseDoubleDown.java new file mode 100755 index 0000000..d1d872b --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseDoubleDown.java @@ -0,0 +1,61 @@ +package darkknight.jewelrycraft.curses; + +import darkknight.jewelrycraft.api.Curse; +import darkknight.jewelrycraft.config.ConfigHandler; +import darkknight.jewelrycraft.damage.DamageSourceList; +import darkknight.jewelrycraft.util.Variables; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import net.minecraftforge.event.entity.living.LivingAttackEvent; + +public class CurseDoubleDown extends Curse { + public CurseDoubleDown(String name, int txtID, String pack) { + super(name, txtID, pack); + } + + @Override + public void attackedAction(World world, EntityPlayer player, + LivingAttackEvent event, Entity attacker) { + if (event.source.damageType.equals("doubleDown")) { + return; // Don't stack double down + } + + player.attackEntityFrom(DamageSourceList.doubleDown, + event.ammount); + } + + @Override + public void attackedByPlayerAction(LivingAttackEvent event, + World world, EntityPlayer player, Entity target) { + if (event.source.damageType.equals("doubleDown")) { + return; // Don't stack double down + } + + target.attackEntityFrom(DamageSourceList.doubleDown, + event.ammount); + } + + @Override + public boolean canCurseBeActivated() { + return ConfigHandler.CURSE_DOUBLE_DOWN; + } + + @Override + public String getDescription() { + return StatCollector.translateToLocal( + "curse." + Variables.MODID + ".doubledown.description"); + } + + @Override + public String getDisplayName() { + return StatCollector.translateToLocal( + "curse." + Variables.MODID + ".doubledown"); + } + + @Override + public int luck() { + return 5; + } +} diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java b/src/main/java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java index 6772d92..e808c84 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java @@ -8,32 +8,30 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
-public class CurseFlamingSoul extends Curse
-{
- public CurseFlamingSoul(String name, int txtID, String pack)
- {
- super(name, txtID, pack);
- }
-
- public void attackedByPlayerAction(World world, EntityPlayer player, Entity target)
- {
- player.setFire(5);
- }
-
- public String getDescription()
- {
- return StatCollector.translateToLocal("curse." + Variables.MODID + ".flamingsoul.description");
- }
+public class CurseFlamingSoul extends Curse {
+ public CurseFlamingSoul(String name, int txtID, String pack) {
+ super(name, txtID, pack);
+ }
+
+ public void attackedByPlayerAction(World world, EntityPlayer player,
+ Entity target) {
+ player.setFire(5);
+ }
+
+ @Override
+ public String getDescription() {
+ return StatCollector.translateToLocal(
+ "curse." + Variables.MODID + ".flamingsoul.description");
+ }
- @Override
- public boolean canCurseBeActivated()
- {
- return ConfigHandler.CURSE_FLAMING_SOUL;
- }
+ @Override
+ public boolean canCurseBeActivated() {
+ return ConfigHandler.CURSE_FLAMING_SOUL;
+ }
@Override
- public String getDisplayName()
- {
- return StatCollector.translateToLocal("curse." + Variables.MODID + ".flamingsoul");
+ public String getDisplayName() {
+ return StatCollector.translateToLocal(
+ "curse." + Variables.MODID + ".flamingsoul");
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseGreed.java b/src/main/java/darkknight/jewelrycraft/curses/CurseGreed.java index 5e535b8..5d8d29c 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseGreed.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseGreed.java @@ -7,38 +7,35 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
-public class CurseGreed extends Curse
-{
- public CurseGreed(String name, int txtID, String pack)
- {
- super(name, txtID, pack);
- }
-
- @Override
- public void action(World world, EntityPlayer player)
- {
- }
-
- @Override
- public boolean itemToss()
- {
- return true;
- }
-
- public String getDescription()
- {
- return StatCollector.translateToLocal("curse." + Variables.MODID + ".greed.description");
- }
+public class CurseGreed extends Curse {
+ public CurseGreed(String name, int txtID, String pack) {
+ super(name, txtID, pack);
+ }
+
+ @Override
+ public void action(World world, EntityPlayer player) {
+ // Do nothing
+ }
+
+ @Override
+ public boolean itemToss() {
+ return true;
+ }
+
+ @Override
+ public String getDescription() {
+ return StatCollector.translateToLocal(
+ "curse." + Variables.MODID + ".greed.description");
+ }
- @Override
- public boolean canCurseBeActivated()
- {
- return ConfigHandler.CURSE_GREED;
- }
+ @Override
+ public boolean canCurseBeActivated() {
+ return ConfigHandler.CURSE_GREED;
+ }
@Override
- public String getDisplayName()
- {
- return StatCollector.translateToLocal("curse." + Variables.MODID + ".greed");
+ public String getDisplayName() {
+ return StatCollector
+ .translateToLocal("curse." + Variables.MODID + ".greed");
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseHumbleBundle.java b/src/main/java/darkknight/jewelrycraft/curses/CurseHumbleBundle.java index 3d0f582..3ad73f2 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseHumbleBundle.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseHumbleBundle.java @@ -4,6 +4,7 @@ package darkknight.jewelrycraft.curses;
import java.util.ArrayList;
+
import darkknight.jewelrycraft.api.Curse;
import darkknight.jewelrycraft.config.ConfigHandler;
import darkknight.jewelrycraft.util.Variables;
@@ -20,53 +21,56 @@ import net.minecraftforge.event.world.BlockEvent; * @author Sorin
*
*/
-public class CurseHumbleBundle extends Curse
-{
- protected CurseHumbleBundle(String name, int txtID, String texturepack)
- {
- super(name, txtID, texturepack);
- }
-
- @Override
- public void entityDropItems(EntityPlayer player, Entity target, ArrayList<EntityItem> drops)
- {
- for(EntityItem item: drops){
- ItemStack drop = item.getEntityItem().copy();
- target.entityDropItem(drop, 0.5F);
- }
- }
-
- public void onBlockItemsDrop(EntityPlayer player, BlockEvent.HarvestDropsEvent event)
- {
- for(ItemStack item: event.drops){
- ItemStack drop = item.copy();
- if(drop.getItem() != Item.getItemFromBlock(event.block)) dropItem(event.world, event.x, event.y, event.z, drop);
- }
- }
-
- public void dropItem(World world, double x, double y, double z, ItemStack stack)
- {
- EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 0.5D, z + 0.5D, stack);
- entityitem.motionX = 0;
- entityitem.motionZ = 0;
- entityitem.motionY = 0.11000000298023224D;
- world.spawnEntityInWorld(entityitem);
- }
-
- public String getDescription()
- {
- return StatCollector.translateToLocal("curse." + Variables.MODID + ".humblebundle.description");
- }
+public class CurseHumbleBundle extends Curse {
+ protected CurseHumbleBundle(String name, int txtID,
+ String texturepack) {
+ super(name, txtID, texturepack);
+ }
+
+ @Override
+ public void entityDropItems(EntityPlayer player, Entity target,
+ ArrayList<EntityItem> drops) {
+ for (EntityItem item : drops) {
+ ItemStack drop = item.getEntityItem().copy();
+ target.entityDropItem(drop, 0.5F);
+ }
+ }
+
+ @Override
+ public void onBlockItemsDrop(EntityPlayer player,
+ BlockEvent.HarvestDropsEvent event) {
+ for (ItemStack item : event.drops) {
+ ItemStack drop = item.copy();
+
+ if (drop.getItem() != Item.getItemFromBlock(event.block))
+ dropItem(event.world, event.x, event.y, event.z, drop);
+ }
+ }
+
+ public void dropItem(World world, double x, double y, double z,
+ ItemStack stack) {
+ EntityItem entityitem =
+ new EntityItem(world, x + 0.5D, y + 0.5D, z + 0.5D, stack);
+ entityitem.motionX = 0;
+ entityitem.motionZ = 0;
+ entityitem.motionY = 0.11000000298023224D;
+ world.spawnEntityInWorld(entityitem);
+ }
+
+ @Override
+ public String getDescription() {
+ return StatCollector.translateToLocal(
+ "curse." + Variables.MODID + ".humblebundle.description");
+ }
@Override
- public String getDisplayName()
- {
- return StatCollector.translateToLocal("curse." + Variables.MODID + ".humblebundle");
+ public String getDisplayName() {
+ return StatCollector.translateToLocal(
+ "curse." + Variables.MODID + ".humblebundle");
}
- @Override
- public boolean canCurseBeActivated()
- {
- return ConfigHandler.CURSE_HUMBLE_BUNDLE;
- }
+ @Override
+ public boolean canCurseBeActivated() {
+ return ConfigHandler.CURSE_HUMBLE_BUNDLE;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseIncredibleDevotion.java b/src/main/java/darkknight/jewelrycraft/curses/CurseIncredibleDevotion.java new file mode 100755 index 0000000..43fa756 --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseIncredibleDevotion.java @@ -0,0 +1,39 @@ +package darkknight.jewelrycraft.curses; + +import darkknight.jewelrycraft.api.Curse; +import darkknight.jewelrycraft.config.ConfigHandler; +import darkknight.jewelrycraft.util.Variables; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +public class CurseIncredibleDevotion extends Curse { + protected CurseIncredibleDevotion(String name, int txtID, + String texturepack) { + super(name, txtID, texturepack); + } + + @Override + public void entityDeathAction(World world, EntityLivingBase target, + EntityPlayer player) { + if (rand.nextInt(10) == 0) { + world.createExplosion(target, target.posX, target.posY, + target.posZ, target.getMaxHealth() / (10.0f + * (1 / ConfigHandler.DEVOTION_FACTOR)), + true); + } + } + + @Override + public String getDisplayName() { + return StatCollector.translateToLocal( + "curse." + Variables.MODID + ".incredibledevotion"); + } + + @Override + public String getDescription() { + return StatCollector.translateToLocal("curse." + Variables.MODID + + ".incredibledevotion.description"); + } +} diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseInfamy.java b/src/main/java/darkknight/jewelrycraft/curses/CurseInfamy.java index 4f91244..8d99006 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseInfamy.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseInfamy.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.curses;
import org.lwjgl.opengl.GL11;
+
import darkknight.jewelrycraft.JewelrycraftMod;
import darkknight.jewelrycraft.api.Curse;
import darkknight.jewelrycraft.config.ConfigHandler;
@@ -25,63 +26,88 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
-public class CurseInfamy extends Curse
-{
- public CurseInfamy(String name, int txtID, String pack)
- {
- super(name, txtID, pack);
- }
-
- @Override
- public void attackedByPlayerAction(LivingAttackEvent event, World world, EntityPlayer player, Entity target)
- {
- if (rand.nextInt(5) == 0 && !world.isRemote && !(target instanceof EntityMob) && target instanceof EntityLiving && !(target instanceof EntityHeart) && !(target instanceof EntityHalfHeart) && target.canAttackWithItem()){
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- playerInfo.setFloat("BlackHeart", playerInfo.getFloat("BlackHeart") + 1.0F);
- if (player.getMaxHealth() >= 3F){
- player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(player.getMaxHealth() - 1.0F);
- player.setHealth(player.getHealth() - 1.0F);
- }
- JewelrycraftUtil.addCursePoints(player, 10);
- JewelrycraftMod.netWrapper.sendToAll(new PacketSendServerPlayersInfo());
- JewelrycraftMod.netWrapper.sendTo(new PacketSendClientPlayerInfo(playerInfo), (EntityPlayerMP)player);
- }
- }
-
- @Override
- public void playerRender(EntityPlayer player, RenderPlayerEvent.Specials.Post event)
- {
- MaskRender mask = new MaskRender();
- float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * event.partialRenderTick;
- float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * event.partialRenderTick;
- float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * event.partialRenderTick;
- GL11.glPushMatrix();
- GL11.glColor4f(1, 1, 1, 1);
- GL11.glRotatef(yawOffset, 0, -1, 0);
- GL11.glRotatef(yaw - 90, 0, 1, 0);
- GL11.glRotatef(pitch, 0, 0, -1);
- GL11.glRotatef(90F, 0, 1F, 0F);
- RenderHelper.translateToHeadLevel(player);
- GL11.glScalef(1.6f, 1.6f, 1.6f);
- GL11.glTranslatef(-0.25F, -0.25F, -0.25F);
- mask.doRender(event.entityPlayer, 0F, 0F, 0F, 0F, 0F);
- GL11.glPopMatrix();
- }
-
- public String getDescription()
- {
- return StatCollector.translateToLocal("curse." + Variables.MODID + ".infamy.description");
- }
-
+public class CurseInfamy extends Curse {
+ public CurseInfamy(String name, int txtID, String pack) {
+ super(name, txtID, pack);
+ }
+
@Override
- public String getDisplayName()
- {
- return StatCollector.translateToLocal("curse." + Variables.MODID + ".infamy");
+ public void attackedByPlayerAction(LivingAttackEvent event,
+ World world, EntityPlayer player, Entity target) {
+ if (rand.nextInt(5) == 0 && !world.isRemote
+ && !(target instanceof EntityMob)
+ && target instanceof EntityLiving
+ && !(target instanceof EntityHeart)
+ && !(target instanceof EntityHalfHeart)
+ && target.canAttackWithItem()) {
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(player, Variables.MODID);
+
+ playerInfo.setFloat("BlackHeart",
+ playerInfo.getFloat("BlackHeart") + 1.0F);
+
+ if (player.getMaxHealth() >= 3F) {
+ player.getEntityAttribute(
+ SharedMonsterAttributes.maxHealth)
+ .setBaseValue(player.getMaxHealth() - 1.0F);
+
+ player.setHealth(player.getHealth() - 1.0F);
+ }
+
+ JewelrycraftUtil.addCursePoints(player, 10);
+
+ JewelrycraftMod.netWrapper
+ .sendToAll(new PacketSendServerPlayersInfo());
+
+ JewelrycraftMod.netWrapper.sendTo(
+ new PacketSendClientPlayerInfo(playerInfo),
+ (EntityPlayerMP) player);
+ }
}
- @Override
- public boolean canCurseBeActivated()
- {
- return ConfigHandler.CURSE_INFAMY;
- }
+ @Override
+ public void playerRender(EntityPlayer player,
+ RenderPlayerEvent.Specials.Post event) {
+ MaskRender mask = new MaskRender();
+
+ float yaw = player.prevRotationYawHead
+ + (player.rotationYawHead - player.prevRotationYawHead)
+ * event.partialRenderTick;
+
+ float yawOffset = player.prevRenderYawOffset
+ + (player.renderYawOffset - player.prevRenderYawOffset)
+ * event.partialRenderTick;
+
+ float pitch = player.prevRotationPitch
+ + (player.rotationPitch - player.prevRotationPitch)
+ * event.partialRenderTick;
+ GL11.glPushMatrix();
+ GL11.glColor4f(1, 1, 1, 1);
+ GL11.glRotatef(yawOffset, 0, -1, 0);
+ GL11.glRotatef(yaw - 90, 0, 1, 0);
+ GL11.glRotatef(pitch, 0, 0, -1);
+ GL11.glRotatef(90F, 0, 1F, 0F);
+ RenderHelper.translateToHeadLevel(player);
+ GL11.glScalef(1.6f, 1.6f, 1.6f);
+ GL11.glTranslatef(-0.25F, -0.25F, -0.25F);
+ mask.doRender(event.entityPlayer, 0F, 0F, 0F, 0F, 0F);
+ GL11.glPopMatrix();
+ }
+
+ @Override
+ public String getDescription() {
+ return StatCollector.translateToLocal(
+ "curse." + Variables.MODID + ".infamy.description");
+ }
+
+ @Override
+ public String getDisplayName() {
+ return StatCollector
+ .translateToLocal("curse." + Variables.MODID + ".infamy");
+ }
+
+ @Override
+ public boolean canCurseBeActivated() {
+ return ConfigHandler.CURSE_INFAMY;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseList.java b/src/main/java/darkknight/jewelrycraft/curses/CurseList.java index 4a33f67..2c11364 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseList.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseList.java @@ -5,33 +5,93 @@ import darkknight.jewelrycraft.api.Curse; import darkknight.jewelrycraft.util.Variables;
public class CurseList {
- public static Curse rotten;
- public static Curse flaming;
- public static Curse blind;
- public static Curse greed;
- public static Curse infamy;
- public static Curse midasTouch;
- public static Curse rabbitsPaw;
- public static Curse pentagram;
- public static Curse vampireHunger;
- public static Curse humbleBundle;
- public static Curse deathsTouch;
- public static Curse antichrist;
- public static Curse moneyEqualsPower;
+ private static final String CURSE_TEXPACK = Variables.MODID
+ + "_curses_0";
+
+ public static Curse rotten;
+ public static Curse flaming;
+ public static Curse blind;
+ public static Curse greed;
+ public static Curse incredibleDevotion;
+
+ public static Curse infamy;
+ public static Curse midasTouch;
+ public static Curse rabbitsPaw;
+ public static Curse pentagram;
+ public static Curse vampireHunger;
+ public static Curse humbleBundle;
+ public static Curse deathsTouch;
+ public static Curse scionOfHell;
+ public static Curse moneyEqualsPower;
+ public static Curse doubleDown;
+ public static Curse sacredOath;
+
+ // Not yet implemented
+ // None at the moment :)
public static void preInit(FMLPreInitializationEvent e) {
- rotten = new CurseRottenHeart(Variables.MODNAME + ":" + "Rotten Heart", 0, Variables.MODID + "_curses_0");
- flaming = new CurseFlamingSoul(Variables.MODNAME + ":" + "Flaming Soul", 1, Variables.MODID + "_curses_0");
- greed = new CurseGreed(Variables.MODNAME + ":" + "Greed", 2, Variables.MODID + "_curses_0");
- blind = new CurseBlind(Variables.MODNAME + ":" + "Blind", 3, Variables.MODID + "_curses_0");
- infamy = new CurseInfamy(Variables.MODNAME + ":" + "Infamy", 4, Variables.MODID + "_curses_0");
- midasTouch = new CurseMidasTouch(Variables.MODNAME + ":" + "Midas Touch", 5, Variables.MODID + "_curses_0");
- rabbitsPaw = new CurseRabbitsPaw(Variables.MODNAME + ":" + "Rabbit's Paw", 6, Variables.MODID + "_curses_0");
- pentagram = new CursePentagram(Variables.MODNAME + ":" + "Pentagram", 7, Variables.MODID + "_curses_0");
- vampireHunger = new CurseVampireHunger(Variables.MODNAME + ":" + "Vampire Hunger", 8, Variables.MODID + "_curses_0");
- humbleBundle = new CurseHumbleBundle(Variables.MODNAME + ":" + "Humble Bundle", 9, Variables.MODID + "_curses_0");
- deathsTouch = new CurseDeathsTouch(Variables.MODNAME + ":" + "Deaths Touch", 10, Variables.MODID + "_curses_0");
- // antichrist = new CurseMidasTouch(Variables.MODNAME + ":" + "Antichrist", 11, Variables.MODID + "_curses_0");
- // moneyEqualsPower = new CurseMidasTouch(Variables.MODNAME + ":" + "Money Equals Power", 12, Variables.MODID + "_curses_0");
+ rotten = new CurseRottenHeart(
+ Variables.MODNAME + ":" + "Rotten Heart",
+ 0, CURSE_TEXPACK);
+
+ flaming = new CurseFlamingSoul(
+ Variables.MODNAME + ":" + "Flaming Soul",
+ 1, CURSE_TEXPACK);
+
+ greed = new CurseGreed(Variables.MODNAME + ":" + "Greed",
+ 2, CURSE_TEXPACK);
+
+ blind = new CurseBlind(Variables.MODNAME + ":" + "Blind",
+ 3, CURSE_TEXPACK);
+
+ infamy = new CurseInfamy(
+ Variables.MODNAME + ":" + "Infamy", 4,
+ CURSE_TEXPACK);
+
+ midasTouch = new CurseMidasTouch(
+ Variables.MODNAME + ":" + "Midas Touch", 5,
+ CURSE_TEXPACK);
+
+ rabbitsPaw = new CurseRabbitsPaw(
+ Variables.MODNAME + ":" + "Rabbit's Paw",
+ 6, CURSE_TEXPACK);
+
+ pentagram = new CursePentagram(
+ Variables.MODNAME + ":" + "Pentagram", 7,
+ CURSE_TEXPACK);
+
+ vampireHunger = new CurseVampireHunger(
+ Variables.MODNAME + ":" + "Vampire Hunger",
+ 8, CURSE_TEXPACK);
+
+ humbleBundle = new CurseHumbleBundle(
+ Variables.MODNAME + ":" + "Humble Bundle",
+ 9, CURSE_TEXPACK);
+
+ deathsTouch = new CurseDeathsTouch(
+ Variables.MODNAME + ":" + "Deaths Touch",
+ 10, CURSE_TEXPACK);
+
+ scionOfHell = new CurseScionOfHell(
+ Variables.MODNAME + ":" + "Scion of Hell",
+ 11, CURSE_TEXPACK);
+
+ moneyEqualsPower = new CurseMoneyEqualsPower(
+ Variables.MODNAME + ":"
+ + "Money Equals Power",
+ 12, CURSE_TEXPACK);
+
+ doubleDown = new CurseDoubleDown(
+ Variables.MODNAME + ":" + "Double Down",
+ 19, CURSE_TEXPACK);
+
+ incredibleDevotion = new CurseIncredibleDevotion(
+ Variables.MODNAME + ":"
+ + "Incredible Devotion",
+ 20, CURSE_TEXPACK);
+
+ sacredOath = new CurseSacredOath(
+ Variables.MODNAME + ":" + "Sacred Oath",
+ 21, CURSE_TEXPACK);
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseMidasTouch.java b/src/main/java/darkknight/jewelrycraft/curses/CurseMidasTouch.java index 86d9622..ef78b12 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseMidasTouch.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseMidasTouch.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.curses;
import java.util.Random;
+
import darkknight.jewelrycraft.api.Curse;
import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.config.ConfigHandler;
@@ -32,92 +33,169 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
-public class CurseMidasTouch extends Curse
-{
- public CurseMidasTouch(String name, int txtID, String pack)
- {
- super(name, txtID, pack);
- }
-
- @Override
- public void attackedByPlayerAction(LivingAttackEvent event, World world, EntityPlayer player, Entity target)
- {
- if (!world.isRemote && target instanceof EntityLivingBase && !(target instanceof EntityHeart) && !(target instanceof EntityHalfHeart) && player.inventory.getCurrentItem() == null){
- world.setBlock(MathHelper.floor_double(target.posX), MathHelper.floor_double(target.posY), MathHelper.floor_double(target.posZ), BlockList.midasTouchBlock, 0, 2);
- TileEntityMidasTouch midasTouchVictim = new TileEntityMidasTouch();
- midasTouchVictim.setEntity(target);
- world.setTileEntity(MathHelper.floor_double(target.posX), MathHelper.floor_double(target.posY), MathHelper.floor_double(target.posZ), midasTouchVictim);
- target.setDead();
- }
- }
-
- @Override
- public void action(World world, EntityPlayer player)
- {
- ItemStack curItem = player.inventory.getCurrentItem();
- if(curItem != null && curItem.getItem() != ItemList.goldObj && !isGoldenObject(curItem.getItem())){
- int index = player.inventory.currentItem;
- ItemStack item = curItem;
- ItemStack result = new ItemStack(ItemList.goldObj, item.stackSize, item.getItemDamage());
- JewelryNBT.addItem(result, item);
- if(changeItem(curItem) != null) result = changeItem(curItem);
- player.inventory.setInventorySlotContents(index, result);
- }
- }
-
- public ItemStack changeItem(ItemStack currItem)
- {
- if(currItem.getItem() instanceof ItemSword) return new ItemStack(Items.golden_sword, currItem.stackSize, currItem.getItemDamage());
- else if(currItem.getItem() instanceof ItemSpade) return new ItemStack(Items.golden_shovel, currItem.stackSize, currItem.getItemDamage());
- else if(currItem.getItem() instanceof ItemPickaxe) return new ItemStack(Items.golden_pickaxe, currItem.stackSize, currItem.getItemDamage());
- else if(currItem.getItem() instanceof ItemAxe) return new ItemStack(Items.golden_axe, currItem.stackSize, currItem.getItemDamage());
- else if(currItem.getItem() instanceof ItemHoe) return new ItemStack(Items.golden_hoe, currItem.stackSize, currItem.getItemDamage());
- else if(currItem.getItem() instanceof ItemArmor && ((ItemArmor)currItem.getItem()).armorType == 0) return new ItemStack(Items.golden_helmet, currItem.stackSize, currItem.getItemDamage());
- else if(currItem.getItem() instanceof ItemArmor && ((ItemArmor)currItem.getItem()).armorType == 1) return new ItemStack(Items.golden_chestplate, currItem.stackSize, currItem.getItemDamage());
- else if(currItem.getItem() instanceof ItemArmor && ((ItemArmor)currItem.getItem()).armorType == 2) return new ItemStack(Items.golden_leggings, currItem.stackSize, currItem.getItemDamage());
- else if(currItem.getItem() instanceof ItemArmor && ((ItemArmor)currItem.getItem()).armorType == 3) return new ItemStack(Items.golden_boots, currItem.stackSize, currItem.getItemDamage());
- else if(currItem.getItem().getUnlocalizedName().toLowerCase().contains("horsearmor")) return new ItemStack(Items.golden_horse_armor, currItem.stackSize, 0);
- else if(currItem.getItem().getUnlocalizedName().toLowerCase().contains("nugget") || currItem.getItem().getItemStackDisplayName(currItem).toLowerCase().contains(" nugget") || currItem.getItem().getItemStackDisplayName(currItem).toLowerCase().contains("nugget ")) return new ItemStack(Items.gold_nugget, currItem.stackSize, 0);
- else if(currItem.getItem().getUnlocalizedName().toLowerCase().contains("ingot") || currItem.getItem().getItemStackDisplayName(currItem).toLowerCase().contains(" ingot") || currItem.getItem().getItemStackDisplayName(currItem).toLowerCase().contains("ingot ")) return new ItemStack(Items.gold_ingot, currItem.stackSize, 0);
- else if(Block.getBlockFromItem(currItem.getItem()) instanceof BlockPressurePlate || Block.getBlockFromItem(currItem.getItem()) instanceof BlockPressurePlateWeighted) return new ItemStack(Blocks.light_weighted_pressure_plate, currItem.stackSize, 0);
- else if(Block.getBlockFromItem(currItem.getItem()) instanceof BlockCompressed) return new ItemStack(Blocks.gold_block, currItem.stackSize, 0);
- return null;
- }
-
- public boolean isGoldenObject(Item item)
- {
- return item.equals(Items.gold_ingot) || item.equals(Items.gold_nugget) || item.equals(Items.golden_helmet) || item.equals(Items.golden_chestplate) ||
- item.equals(Items.golden_leggings) || item.equals(Items.golden_boots) || item.equals(Items.golden_sword) || item.equals(Items.golden_shovel) ||
- item.equals(Items.golden_pickaxe) || item.equals(Items.golden_axe) || item.equals(Items.golden_apple) || item.equals(Items.golden_hoe) ||
- item.equals(Items.golden_horse_armor) || Block.getBlockFromItem(item).equals(Blocks.gold_block) || Block.getBlockFromItem(item).equals(Blocks.light_weighted_pressure_plate);
- }
-
- public String getDescription()
- {
- return StatCollector.translateToLocal("curse." + Variables.MODID + ".midastouch.description");
- }
-
+public class CurseMidasTouch extends Curse {
+ public CurseMidasTouch(String name, int txtID, String pack) {
+ super(name, txtID, pack);
+ }
+
+ @Override
+ public void attackedByPlayerAction(LivingAttackEvent event,
+ World world, EntityPlayer player, Entity target) {
+ if (!world.isRemote && target instanceof EntityLivingBase
+ && !(target instanceof EntityHeart)
+ && !(target instanceof EntityHalfHeart)
+ && player.inventory.getCurrentItem() == null) {
+ world.setBlock(MathHelper.floor_double(target.posX),
+ MathHelper.floor_double(target.posY),
+ MathHelper.floor_double(target.posZ),
+ BlockList.midasTouchBlock, 0, 2);
+
+ TileEntityMidasTouch midasTouchVictim =
+ new TileEntityMidasTouch();
+ midasTouchVictim.setEntity(target);
+
+ world.setTileEntity(MathHelper.floor_double(target.posX),
+ MathHelper.floor_double(target.posY),
+ MathHelper.floor_double(target.posZ),
+ midasTouchVictim);
+
+ target.setDead();
+ }
+ }
+
+ @Override
+ public void action(World world, EntityPlayer player) {
+ ItemStack curItem = player.inventory.getCurrentItem();
+
+ if (curItem != null && curItem.getItem() != ItemList.goldObj
+ && !isGoldenObject(curItem.getItem())) {
+ int index = player.inventory.currentItem;
+
+ ItemStack item = curItem;
+ ItemStack result = new ItemStack(ItemList.goldObj,
+ item.stackSize, item.getItemDamage());
+
+ JewelryNBT.addItem(result, item);
+
+ if (changeItem(curItem) != null) {
+ result = changeItem(curItem);
+ }
+
+ player.inventory.setInventorySlotContents(index, result);
+ }
+ }
+
+ public ItemStack changeItem(ItemStack currItem) {
+ if (currItem.getItem() instanceof ItemSword) {
+ return new ItemStack(Items.golden_sword, currItem.stackSize,
+ currItem.getItemDamage());
+ } else if (currItem.getItem() instanceof ItemSpade) {
+ return new ItemStack(Items.golden_shovel, currItem.stackSize,
+ currItem.getItemDamage());
+ } else if (currItem.getItem() instanceof ItemPickaxe) {
+ return new ItemStack(Items.golden_pickaxe, currItem.stackSize,
+ currItem.getItemDamage());
+ } else if (currItem.getItem() instanceof ItemAxe) {
+ return new ItemStack(Items.golden_axe, currItem.stackSize,
+ currItem.getItemDamage());
+ } else if (currItem.getItem() instanceof ItemHoe) {
+ return new ItemStack(Items.golden_hoe, currItem.stackSize,
+ currItem.getItemDamage());
+ } else if (currItem.getItem() instanceof ItemArmor
+ && ((ItemArmor) currItem.getItem()).armorType == 0) {
+ return new ItemStack(Items.golden_helmet, currItem.stackSize,
+ currItem.getItemDamage());
+ } else if (currItem.getItem() instanceof ItemArmor
+ && ((ItemArmor) currItem.getItem()).armorType == 1) {
+ return new ItemStack(Items.golden_chestplate,
+ currItem.stackSize, currItem.getItemDamage());
+ } else if (currItem.getItem() instanceof ItemArmor
+ && ((ItemArmor) currItem.getItem()).armorType == 2) {
+ return new ItemStack(Items.golden_leggings, currItem.stackSize,
+ currItem.getItemDamage());
+ } else if (currItem.getItem() instanceof ItemArmor
+ && ((ItemArmor) currItem.getItem()).armorType == 3) {
+ return new ItemStack(Items.golden_boots, currItem.stackSize,
+ currItem.getItemDamage());
+ } else if (currItem.getItem().getUnlocalizedName().toLowerCase()
+ .contains("horsearmor")) {
+ return new ItemStack(Items.golden_horse_armor,
+ currItem.stackSize, 0);
+ } else if (currItem.getItem().getUnlocalizedName().toLowerCase()
+ .contains("nugget")
+ || currItem.getItem().getItemStackDisplayName(currItem)
+ .toLowerCase().contains(" nugget")
+ || currItem.getItem().getItemStackDisplayName(currItem)
+ .toLowerCase().contains("nugget ")) {
+ return new ItemStack(Items.gold_nugget, currItem.stackSize, 0);
+ } else if (currItem.getItem().getUnlocalizedName().toLowerCase()
+ .contains("ingot")
+ || currItem.getItem().getItemStackDisplayName(currItem)
+ .toLowerCase().contains(" ingot")
+ || currItem.getItem().getItemStackDisplayName(currItem)
+ .toLowerCase().contains("ingot ")) {
+ return new ItemStack(Items.gold_ingot, currItem.stackSize, 0);
+ } else if (Block.getBlockFromItem(
+ currItem.getItem()) instanceof BlockPressurePlate
+ || Block.getBlockFromItem(currItem
+ .getItem()) instanceof BlockPressurePlateWeighted) {
+ return new ItemStack(Blocks.light_weighted_pressure_plate,
+ currItem.stackSize, 0);
+ } else if (Block.getBlockFromItem(
+ currItem.getItem()) instanceof BlockCompressed) {
+ return new ItemStack(Blocks.gold_block, currItem.stackSize, 0);
+ }
+
+ return null;
+ }
+
+ public boolean isGoldenObject(Item item) {
+ return item.equals(Items.gold_ingot)
+ || item.equals(Items.gold_nugget)
+ || item.equals(Items.golden_helmet)
+ || item.equals(Items.golden_chestplate)
+ || item.equals(Items.golden_leggings)
+ || item.equals(Items.golden_boots)
+ || item.equals(Items.golden_sword)
+ || item.equals(Items.golden_shovel)
+ || item.equals(Items.golden_pickaxe)
+ || item.equals(Items.golden_axe)
+ || item.equals(Items.golden_apple)
+ || item.equals(Items.golden_hoe)
+ || item.equals(Items.golden_horse_armor)
+ || Block.getBlockFromItem(item).equals(Blocks.gold_block)
+ || Block.getBlockFromItem(item)
+ .equals(Blocks.light_weighted_pressure_plate);
+ }
+
@Override
- public String getDisplayName()
- {
- return StatCollector.translateToLocal("curse." + Variables.MODID + ".midastouch");
+ public String getDescription() {
+ return StatCollector.translateToLocal(
+ "curse." + Variables.MODID + ".midastouch.description");
}
- @Override
- public boolean canCurseBeActivated(World world)
- {
- return world.getWorldInfo().isHardcoreModeEnabled() ? false : ConfigHandler.CURSE_MIDAS_TOUCH;
- }
-
- @Override
- public boolean canCurseBeActivated()
- {
- return ConfigHandler.CURSE_MIDAS_TOUCH;
- }
-
- @Override
- public int weight(World world, EntityPlayer player, Random random)
- {
- return 2;
- }
+ @Override
+ public String getDisplayName() {
+ return StatCollector.translateToLocal(
+ "curse." + Variables.MODID + ".midastouch");
+ }
+
+ @Override
+ public boolean canCurseBeActivated(World world) {
+ if (world.getWorldInfo().isHardcoreModeEnabled()) {
+ return false;
+ }
+
+ return ConfigHandler.CURSE_MIDAS_TOUCH;
+ }
+
+ @Override
+ public boolean canCurseBeActivated() {
+ return ConfigHandler.CURSE_MIDAS_TOUCH;
+ }
+
+ @Override
+ public int weight(World world, EntityPlayer player, Random random) {
+ return 2;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseMoneyEqualsPower.java b/src/main/java/darkknight/jewelrycraft/curses/CurseMoneyEqualsPower.java new file mode 100755 index 0000000..741a857 --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseMoneyEqualsPower.java @@ -0,0 +1,108 @@ +package darkknight.jewelrycraft.curses; + +import java.util.ArrayList; + +import darkknight.jewelrycraft.api.Curse; +import darkknight.jewelrycraft.config.ConfigHandler; +import darkknight.jewelrycraft.util.Variables; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; + +public class CurseMoneyEqualsPower extends Curse { + public CurseMoneyEqualsPower(String name, int txtID, + String texturepack) { + super(name, txtID, texturepack); + } + + @Override + public void entityDropItems(EntityPlayer player, Entity target, + ArrayList<EntityItem> drops) { + int dropsTaken = 0; + + for (EntityItem item : drops) { + if (rand.nextBoolean()) { + int stackSize = item + .getEntityItem().stackSize; + int takenItems = rand.nextInt(stackSize); + item.getEntityItem().stackSize -= takenItems; + + if (item.getEntityItem().stackSize <= 0) { + item.setDead(); + } + + dropsTaken += takenItems; + } + } + + if (dropsTaken > 0) { + if (dropsTaken > 3) { + player.addPotionEffect(new PotionEffect( + Potion.digSpeed.id, + dropsTaken * 30, 1)); + player.addPotionEffect(new PotionEffect( + Potion.moveSpeed.id, + dropsTaken * 30, 1)); + + player.addChatComponentMessage( + new ChatComponentText( + StatCollector.translateToLocal( + EnumChatFormatting.RED + + "curse.jewlrycraft2.moneyEqualsPower.bless1"))); + } + + if (dropsTaken > 6) { + player.addPotionEffect(new PotionEffect( + Potion.resistance.id, + dropsTaken * 20, 1)); + player.addPotionEffect(new PotionEffect( + Potion.damageBoost.id, + dropsTaken * 20, 1)); + + player.addChatComponentMessage( + new ChatComponentText( + StatCollector.translateToLocal( + EnumChatFormatting.RED + + "curse.jewlrycraft2.moneyEqualsPower.bless2"))); + } + + if (dropsTaken > 9) { + player.addPotionEffect(new PotionEffect( + Potion.regeneration.id, + dropsTaken * 10, 1)); + player.addPotionEffect(new PotionEffect( + Potion.heal.id, + dropsTaken * 10, 1)); + + player.addChatComponentMessage( + new ChatComponentText( + StatCollector.translateToLocal( + EnumChatFormatting.RED + + "curse.jewlrycraft2.moneyEqualsPower.bless3"))); + } + } + } + + @Override + public boolean canCurseBeActivated() { + return ConfigHandler.CURSE_MONEY_EQUALS_POWER; + } + + @Override + public String getDescription() { + return StatCollector.translateToLocal("curse." + + Variables.MODID + + ".moneyEqualsPower.description"); + } + + @Override + public String getDisplayName() { + return StatCollector.translateToLocal("curse." + + Variables.MODID + ".moneyEqualsPower"); + } +} diff --git a/src/main/java/darkknight/jewelrycraft/curses/CursePentagram.java b/src/main/java/darkknight/jewelrycraft/curses/CursePentagram.java index c15e25a..a65517d 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CursePentagram.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CursePentagram.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.curses;
import org.lwjgl.opengl.GL11;
+
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import darkknight.jewelrycraft.achievements.AchievementsList;
@@ -36,44 +37,101 @@ public class CursePentagram extends Curse { public void action(World world, EntityPlayer player) {
super.action(world, player);
if (!world.isRemote) {
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- for (Object entity : world.getEntitiesWithinAABBExcludingEntity(player, AxisAlignedBB.getBoundingBox(player.boundingBox.minX - 0.5F, player.boundingBox.minY, player.boundingBox.minZ - 0.5F, player.boundingBox.maxX + 0.5F, player.boundingBox.maxY, player.boundingBox.maxZ + 0.5F))) {
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(player, Variables.MODID);
+
+ for (Object entity : world
+ .getEntitiesWithinAABBExcludingEntity(player,
+ AxisAlignedBB.getBoundingBox(
+ player.boundingBox.minX - 0.5F,
+ player.boundingBox.minY,
+ player.boundingBox.minZ - 0.5F,
+ player.boundingBox.maxX + 0.5F,
+ player.boundingBox.maxY,
+ player.boundingBox.maxZ + 0.5F))) {
if (entity instanceof EntityLivingBase) {
- NBTTagCompound target = ((EntityLivingBase) entity).getEntityData();
- if (target.getInteger("stolenHealth") < (JewelrycraftUtil.AchievemtUnlocked(player, AchievementsList.pentagram) ? 3 : 2) && rand.nextInt(40) == 0) {
- ((EntityLivingBase) entity).getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(((EntityLivingBase) entity).getMaxHealth() - 2f);
- target.setInteger("stolenHealth", target.hasKey("stolenHealth") ? target.getInteger("stolenHealth") + 1 : 1);
- playerInfo.setInteger("heartsStolen", playerInfo.hasKey("heartsStolen") ? playerInfo.getInteger("heartsStolen") + 1 : 1);
- if (player.shouldHeal()) player.heal(2F);
- else player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(player.getMaxHealth() + 2f);
+ NBTTagCompound target =
+ ((EntityLivingBase) entity).getEntityData();
+
+ if (target
+ .getInteger("stolenHealth") < (JewelrycraftUtil
+ .AchievemtUnlocked(player,
+ AchievementsList.pentagram) ? 3
+ : 2)
+ && rand.nextInt(40) == 0) {
+ ((EntityLivingBase) entity)
+ .getEntityAttribute(
+ SharedMonsterAttributes.maxHealth)
+ .setBaseValue(((EntityLivingBase) entity)
+ .getMaxHealth() - 2f);
+
+ target.setInteger("stolenHealth",
+ target.hasKey("stolenHealth")
+ ? target.getInteger("stolenHealth")
+ + 1
+ : 1);
+
+ playerInfo
+ .setInteger("heartsStolen",
+ playerInfo.hasKey("heartsStolen")
+ ? playerInfo.getInteger(
+ "heartsStolen") + 1
+ : 1);
+
+ if (player.shouldHeal()) {
+ player.heal(2F);
+ } else {
+ player.getEntityAttribute(
+ SharedMonsterAttributes.maxHealth)
+ .setBaseValue(
+ player.getMaxHealth() + 2f);
+ }
}
}
}
- if (!playerInfo.getBoolean(AchievementsList.pentagram.statId)) {
- if (ticksActive > 24000 && playerInfo.getInteger("heartsStolen") <= 0) player.addStat(AchievementsList.pentagram, 1);
+
+ if (!playerInfo
+ .getBoolean(AchievementsList.pentagram.statId)) {
+ if (ticksActive > 24000
+ && playerInfo.getInteger("heartsStolen") <= 0)
+ player.addStat(AchievementsList.pentagram, 1);
else {
- player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + StatCollector.translateToLocal("challenge.failed") + " " + EnumChatFormatting.GOLD + StatCollector.translateToLocal(AchievementsList.pentagram.statId)));
- playerInfo.setBoolean(AchievementsList.pentagram.statId, true);
+ player.addChatComponentMessage(
+ new ChatComponentText(EnumChatFormatting.RED
+ + StatCollector.translateToLocal(
+ "challenge.failed")
+ + " " + EnumChatFormatting.GOLD
+ + StatCollector.translateToLocal(
+ AchievementsList.pentagram.statId)));
+ playerInfo.setBoolean(
+ AchievementsList.pentagram.statId, true);
}
}
}
}
+ @SuppressWarnings("cast")
@Override
- public void playerRender(EntityPlayer player, RenderPlayerEvent.Specials.Post event) {
- ResourceLocation PENTAGRAM_TEXTURE = new ResourceLocation(Variables.MODID, "textures/gui/" + getTexturePack() + ".png");
+ public void playerRender(EntityPlayer player,
+ RenderPlayerEvent.Specials.Post event) {
+ ResourceLocation PENTAGRAM_TEXTURE =
+ new ResourceLocation(Variables.MODID,
+ "textures/gui/" + getTexturePack() + ".png");
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_SRC_COLOR);
Tessellator tessellator = Tessellator.instance;
- TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
+ TextureManager texturemanager =
+ Minecraft.getMinecraft().getTextureManager();
texturemanager.bindTexture(PENTAGRAM_TEXTURE);
GL11.glRotatef(rot, 0F, 1F, 0F);
- GL11.glTranslatef(-0.8F, (player.isSneaking() ? 0.1625F : 0F) + 1.5F, -0.8F);
+ GL11.glTranslatef(-0.8F,
+ (player.isSneaking() ? 0.1625F : 0F) + 1.5F, -0.8F);
GL11.glRotatef(90F, 1F, 0F, 0F);
GL11.glScalef(0.05F, 0.05F, 0.05F);
rot += 3F;
- if (rot > 360F) rot = 0F;
+ if (rot > 360F)
+ rot = 0F;
float f = 0.00390625F;
float f1 = 0.00390625F;
int x = 0;
@@ -83,31 +141,49 @@ public class CursePentagram extends Curse { int width = 32;
int height = 32;
tessellator.startDrawingQuads();
- tessellator.addVertexWithUV((double) (x + 0), (double) (y + height), (double) 0, (double) ((float) (u + 0) * f), (double) ((float) (v + height) * f1));
- tessellator.addVertexWithUV((double) (x + width), (double) (y + height), (double) 0, (double) ((float) (u + width) * f), (double) ((float) (v + height) * f1));
- tessellator.addVertexWithUV((double) (x + width), (double) (y + 0), (double) 0, (double) ((float) (u + width) * f), (double) ((float) (v + 0) * f1));
- tessellator.addVertexWithUV((double) (x + 0), (double) (y + 0), (double) 0, (double) ((float) (u + 0) * f), (double) ((float) (v + 0) * f1));
+ tessellator.addVertexWithUV((double) (x + 0),
+ (double) (y + height), (double) 0,
+ (double) ((float) (u + 0) * f),
+ (double) ((float) (v + height) * f1));
+ tessellator.addVertexWithUV((double) (x + width),
+ (double) (y + height), (double) 0,
+ (double) ((float) (u + width) * f),
+ (double) ((float) (v + height) * f1));
+ tessellator.addVertexWithUV((double) (x + width), (double) (y + 0),
+ (double) 0, (double) ((float) (u + width) * f),
+ (double) ((float) (v + 0) * f1));
+ tessellator.addVertexWithUV((double) (x + 0), (double) (y + 0),
+ (double) 0, (double) ((float) (u + 0) * f),
+ (double) ((float) (v + 0) * f1));
tessellator.draw();
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
+ @SuppressWarnings("cast")
+ @Override
@SideOnly(Side.CLIENT)
- public void playerHandRender(EntityPlayer player, RenderHandEvent event) {
+ public void playerHandRender(EntityPlayer player,
+ RenderHandEvent event) {
if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 0) {
- ResourceLocation PENTAGRAM_TEXTURE = new ResourceLocation(Variables.MODID, "textures/gui/" + getTexturePack() + ".png");
+ ResourceLocation PENTAGRAM_TEXTURE =
+ new ResourceLocation(Variables.MODID,
+ "textures/gui/" + getTexturePack() + ".png");
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_SRC_COLOR);
Tessellator tessellator = Tessellator.instance;
- TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
+ TextureManager texturemanager =
+ Minecraft.getMinecraft().getTextureManager();
texturemanager.bindTexture(PENTAGRAM_TEXTURE);
GL11.glRotatef(rot, 0F, 1F, 0F);
- GL11.glTranslatef(-0.8F, (player.isSneaking() ? 0.1625F : 0F) - 1.6F, -0.8F);
+ GL11.glTranslatef(-0.8F,
+ (player.isSneaking() ? 0.1625F : 0F) - 1.6F, -0.8F);
GL11.glRotatef(90F, 1F, 0F, 0F);
GL11.glScalef(0.05F, 0.05F, 0.05F);
rot += 3F;
- if (rot > 360F) rot = 0F;
+ if (rot > 360F)
+ rot = 0F;
float f = 0.00390625F;
float f1 = 0.00390625F;
int x = 0;
@@ -117,23 +193,37 @@ public class CursePentagram extends Curse { int width = 32;
int height = 32;
tessellator.startDrawingQuads();
- tessellator.addVertexWithUV((double) (x + 0), (double) (y + height), (double) 0, (double) ((float) (u + 0) * f), (double) ((float) (v + height) * f1));
- tessellator.addVertexWithUV((double) (x + width), (double) (y + height), (double) 0, (double) ((float) (u + width) * f), (double) ((float) (v + height) * f1));
- tessellator.addVertexWithUV((double) (x + width), (double) (y + 0), (double) 0, (double) ((float) (u + width) * f), (double) ((float) (v + 0) * f1));
- tessellator.addVertexWithUV((double) (x + 0), (double) (y + 0), (double) 0, (double) ((float) (u + 0) * f), (double) ((float) (v + 0) * f1));
+ tessellator.addVertexWithUV((double) (x + 0),
+ (double) (y + height), (double) 0,
+ (double) ((float) (u + 0) * f),
+ (double) ((float) (v + height) * f1));
+ tessellator.addVertexWithUV((double) (x + width),
+ (double) (y + height), (double) 0,
+ (double) ((float) (u + width) * f),
+ (double) ((float) (v + height) * f1));
+ tessellator.addVertexWithUV((double) (x + width),
+ (double) (y + 0), (double) 0,
+ (double) ((float) (u + width) * f),
+ (double) ((float) (v + 0) * f1));
+ tessellator.addVertexWithUV((double) (x + 0), (double) (y + 0),
+ (double) 0, (double) ((float) (u + 0) * f),
+ (double) ((float) (v + 0) * f1));
tessellator.draw();
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
}
+ @Override
public String getDescription() {
- return StatCollector.translateToLocal("curse." + Variables.MODID + ".pentagram.description");
+ return StatCollector.translateToLocal(
+ "curse." + Variables.MODID + ".pentagram.description");
}
@Override
public String getDisplayName() {
- return StatCollector.translateToLocal("curse." + Variables.MODID + ".pentagram");
+ return StatCollector.translateToLocal(
+ "curse." + Variables.MODID + ".pentagram");
}
@Override
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseRabbitsPaw.java b/src/main/java/darkknight/jewelrycraft/curses/CurseRabbitsPaw.java index 831f5c5..c185df3 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseRabbitsPaw.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseRabbitsPaw.java @@ -17,47 +17,51 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
-public class CurseRabbitsPaw extends Curse
-{
- public CurseRabbitsPaw(String name, int txtID, String pack)
- {
- super(name, txtID, pack);
- }
-
- @Override
- public void entityDropItems(EntityPlayer player, Entity target, ArrayList<EntityItem> drops)
- {
- for(EntityItem item: drops){
- ItemStack drop = item.getEntityItem().copy();
- drop.stackSize = this.rand.nextInt(4);
- if (drop.stackSize > 0) target.entityDropItem(drop, 0.5F);
- }
- }
-
- public void entityDeathAction(World world, EntityLivingBase target, EntityPlayer player)
- {
- if (rand.nextInt(3) == 0) world.spawnEntityInWorld(new EntityXPOrb(world, target.posX, target.posY, target.posZ, 1 + rand.nextInt(40)));
- }
-
- public int luck()
- {
- return 10;
- }
-
- public String getDescription()
- {
- return StatCollector.translateToLocal("curse." + Variables.MODID + ".rabbitspaw.description");
- }
-
+public class CurseRabbitsPaw extends Curse {
+ public CurseRabbitsPaw(String name, int txtID, String pack) {
+ super(name, txtID, pack);
+ }
+
+ @Override
+ public void entityDropItems(EntityPlayer player, Entity target,
+ ArrayList<EntityItem> drops) {
+ for (EntityItem item : drops) {
+ ItemStack drop = item.getEntityItem().copy();
+
+ drop.stackSize = this.rand.nextInt(4);
+
+ if (drop.stackSize > 0)
+ target.entityDropItem(drop, 0.5F);
+ }
+ }
+
+ @Override
+ public void entityDeathAction(World world, EntityLivingBase target,
+ EntityPlayer player) {
+ if (rand.nextInt(3) == 0)
+ world.spawnEntityInWorld(new EntityXPOrb(world, target.posX,
+ target.posY, target.posZ, 1 + rand.nextInt(40)));
+ }
+
@Override
- public String getDisplayName()
- {
- return StatCollector.translateToLocal("curse." + Variables.MODID + ".rabbitspaw");
+ public int luck() {
+ return 10;
}
- @Override
- public boolean canCurseBeActivated()
- {
- return ConfigHandler.CURSE_RABBIT_PAW;
- }
+ @Override
+ public String getDescription() {
+ return StatCollector.translateToLocal(
+ "curse." + Variables.MODID + ".rabbitspaw.description");
+ }
+
+ @Override
+ public String getDisplayName() {
+ return StatCollector.translateToLocal(
+ "curse." + Variables.MODID + ".rabbitspaw");
+ }
+
+ @Override
+ public boolean canCurseBeActivated() {
+ return ConfigHandler.CURSE_RABBIT_PAW;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseRottenHeart.java b/src/main/java/darkknight/jewelrycraft/curses/CurseRottenHeart.java index 95f1a2c..050605d 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseRottenHeart.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseRottenHeart.java @@ -9,39 +9,41 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
-public class CurseRottenHeart extends Curse
-{
- public CurseRottenHeart(String name, int txtID, String pack)
- {
- super(name, txtID, pack);
- }
-
- @Override
- public void action(World world, EntityPlayer player)
- {
- if (!player.isPotionActive(Potion.poison) || player.getActivePotionEffect(Potion.poison).getDuration() < 30) player.addPotionEffect(new PotionEffect(Potion.poison.id, 80));
- }
-
- public String getDescription()
- {
- return StatCollector.translateToLocal("curse." + Variables.MODID + ".rottenheart.description");
- }
-
+public class CurseRottenHeart extends Curse {
+ public CurseRottenHeart(String name, int txtID, String pack) {
+ super(name, txtID, pack);
+ }
+
+ @Override
+ public void action(World world, EntityPlayer player) {
+ if (!player.isPotionActive(Potion.poison) || player
+ .getActivePotionEffect(Potion.poison).getDuration() < 30)
+ player.addPotionEffect(new PotionEffect(Potion.poison.id, 80));
+ }
+
+ @Override
+ public String getDescription() {
+ return StatCollector.translateToLocal(
+ "curse." + Variables.MODID + ".rottenheart.description");
+ }
+
+ @Override
+ public String getDisplayName() {
+ return StatCollector.translateToLocal(
+ "curse." + Variables.MODID + ".rottenheart");
+ }
+
+ @Override
+ public boolean canCurseBeActivated(World world) {
+ if (world.getWorldInfo().isHardcoreModeEnabled()) {
+ return false;
+ }
+
+ return ConfigHandler.CURSE_ROTTEN_HEART;
+ }
+
@Override
- public String getDisplayName()
- {
- return StatCollector.translateToLocal("curse." + Variables.MODID + ".rottenheart");
+ public boolean canCurseBeActivated() {
+ return ConfigHandler.CURSE_ROTTEN_HEART;
}
-
- @Override
- public boolean canCurseBeActivated(World world)
- {
- return world.getWorldInfo().isHardcoreModeEnabled() ? false : ConfigHandler.CURSE_ROTTEN_HEART;
- }
-
- @Override
- public boolean canCurseBeActivated()
- {
- return ConfigHandler.CURSE_ROTTEN_HEART;
- }
}
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseSacredOath.java b/src/main/java/darkknight/jewelrycraft/curses/CurseSacredOath.java new file mode 100644 index 0000000..8faf314 --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseSacredOath.java @@ -0,0 +1,26 @@ +package darkknight.jewelrycraft.curses; + +import darkknight.jewelrycraft.api.Curse; +import darkknight.jewelrycraft.util.Variables; +import net.minecraft.util.StatCollector; + +public class CurseSacredOath extends Curse { + public CurseSacredOath(String name, int txtID, + String texturepack) { + super(name, txtID, texturepack); + } + + @Override + public String getDescription() { + return StatCollector.translateToLocal( + "curse." + Variables.MODID + ".sacredoath.description"); + } + + @Override + public String getDisplayName() { + return StatCollector.translateToLocal( + "curse." + Variables.MODID + ".sacredoath"); + } + + // TODO implement sacred oath to do something +} diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseScionOfHell.java b/src/main/java/darkknight/jewelrycraft/curses/CurseScionOfHell.java new file mode 100755 index 0000000..4162001 --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseScionOfHell.java @@ -0,0 +1,46 @@ +package darkknight.jewelrycraft.curses; + +import darkknight.jewelrycraft.api.Curse; +import darkknight.jewelrycraft.config.ConfigHandler; +import darkknight.jewelrycraft.util.Variables; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import net.minecraftforge.event.entity.living.LivingHealEvent; + +public class CurseScionOfHell extends Curse { + public CurseScionOfHell(String name, int txtID, String texturepack) { + super(name, txtID, texturepack); + } + + @Override + public void entityDeathAction(World world, EntityLivingBase target, + EntityPlayer player) { + player.setHealth(Math.max(player.getMaxHealth(), + player.getHealth() + target.getMaxHealth() / 5.0f)); + } + + @Override + public void playerHealAction(World world, EntityPlayer player, + LivingHealEvent event) { + event.amount = 0; + } + + @Override + public boolean canCurseBeActivated() { + return ConfigHandler.CURSE_SCION_OF_HELL; + } + + @Override + public String getDescription() { + return StatCollector.translateToLocal( + "curse." + Variables.MODID + ".scionofhell.description"); + } + + @Override + public String getDisplayName() { + return StatCollector.translateToLocal( + "curse." + Variables.MODID + ".scionofhell"); + } +} diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseVampireHunger.java b/src/main/java/darkknight/jewelrycraft/curses/CurseVampireHunger.java index b00552e..6707bc0 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseVampireHunger.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseVampireHunger.java @@ -16,38 +16,43 @@ import net.minecraft.world.World; * @author Sorin
*
*/
-public class CurseVampireHunger extends Curse
-{
- protected CurseVampireHunger(String name, int txtID, String texturepack)
- {
- super(name, txtID, texturepack);
- }
-
- public void attackedByPlayerAction(World world, EntityPlayer player, Entity target)
- {
- if(player.shouldHeal() && rand.nextBoolean()) player.heal(1F);
- }
-
- public void action(World world, EntityPlayer player)
- {
- if(!player.capabilities.isCreativeMode && world.isDaytime() && !world.isRaining() && world.canBlockSeeTheSky(MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY + 1F), MathHelper.floor_double(player.posZ)))
- player.setFire(8);
- }
-
- public String getDescription()
- {
- return StatCollector.translateToLocal("curse." + Variables.MODID + ".vampirehunger.description");
- }
-
+public class CurseVampireHunger extends Curse {
+ protected CurseVampireHunger(String name, int txtID,
+ String texturepack) {
+ super(name, txtID, texturepack);
+ }
+
+ public void attackedByPlayerAction(World world, EntityPlayer player,
+ Entity target) {
+ if (player.shouldHeal() && rand.nextBoolean())
+ player.heal(1F);
+ }
+
+ @Override
+ public void action(World world, EntityPlayer player) {
+ if (!player.capabilities.isCreativeMode && world.isDaytime()
+ && !world.isRaining()
+ && world.canBlockSeeTheSky(
+ MathHelper.floor_double(player.posX),
+ MathHelper.floor_double(player.posY + 1F),
+ MathHelper.floor_double(player.posZ)))
+ player.setFire(8);
+ }
+
+ @Override
+ public String getDescription() {
+ return StatCollector.translateToLocal(
+ "curse." + Variables.MODID + ".vampirehunger.description");
+ }
+
@Override
- public String getDisplayName()
- {
- return StatCollector.translateToLocal("curse." + Variables.MODID + ".vampirehunger");
+ public String getDisplayName() {
+ return StatCollector.translateToLocal(
+ "curse." + Variables.MODID + ".vampirehunger");
}
- @Override
- public boolean canCurseBeActivated()
- {
- return ConfigHandler.CURSE_VAMPIRE_HUNGER;
- }
+ @Override
+ public boolean canCurseBeActivated() {
+ return ConfigHandler.CURSE_VAMPIRE_HUNGER;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/damage/DamageSourceList.java b/src/main/java/darkknight/jewelrycraft/damage/DamageSourceList.java index 57735f1..64f696c 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/damage/DamageSourceList.java +++ b/src/main/java/darkknight/jewelrycraft/damage/DamageSourceList.java @@ -6,21 +6,22 @@ import net.minecraft.util.DamageSource; /**
* @author Sorin
*/
-public class DamageSourceList
-{
- public static DamageSource shadows, weak, blackHeart;
- private static boolean isInitialized = false;
-
- /**
- * @param e
- */
- public static void postInit(FMLPostInitializationEvent e)
- {
- if (!isInitialized){
- shadows = new DamageSource("shadows").setDamageBypassesArmor().setDamageIsAbsolute();
- blackHeart = new DamageSource("blackHeart").setDamageBypassesArmor().setDamageIsAbsolute();
- weak = new DamageSource("weak").setDamageBypassesArmor();
- isInitialized = true;
- }
- }
+public class DamageSourceList {
+ public static DamageSource shadows, weak, blackHeart, doubleDown;
+ private static boolean isInitialized = false;
+
+ /**
+ * @param e
+ */
+ public static void postInit(FMLPostInitializationEvent e) {
+ if (!isInitialized) {
+ shadows = new DamageSource("shadows").setDamageBypassesArmor()
+ .setDamageIsAbsolute();
+ blackHeart = new DamageSource("blackHeart")
+ .setDamageBypassesArmor().setDamageIsAbsolute();
+ weak = new DamageSource("weak").setDamageBypassesArmor();
+ doubleDown = new DamageSource("doubleDown");
+ isInitialized = true;
+ }
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java b/src/main/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java index 678aa51..c735b2c 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java +++ b/src/main/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java @@ -24,42 +24,89 @@ public class EffectBlazePowder extends ModifierEffects { public void action(ItemStack item, EntityPlayer player, Item jewelry) {
if (jewelry instanceof ItemNecklace) {
// Positive for necklace
- if (player.isBurning() && rand.nextInt(JewelryNBT.numberOfModifiers(item)) == 0) player.extinguish();
+ if (player.isBurning() && rand
+ .nextInt(JewelryNBT.numberOfModifiers(item)) == 0)
+ player.extinguish();
// Negative for necklace
- if (player.isInWater()) player.attackEntityFrom(DamageSource.drown, 1f + (JewelryNBT.numberOfModifiers(item) - 1) * 0.1F);
+ if (player.isInWater())
+ player.attackEntityFrom(DamageSource.drown, 1f
+ + (JewelryNBT.numberOfModifiers(item) - 1) * 0.1F);
}
// Negative for bracelet
if (jewelry instanceof ItemBracelet && player.isInWater()) {
- double slowAmount = 0.6D + (JewelryNBT.numberOfModifiers(item) - 1) * 0.05D;
+ double slowAmount = 0.6D
+ + (JewelryNBT.numberOfModifiers(item) - 1) * 0.05D;
player.motionX *= slowAmount;
player.motionY *= slowAmount;
player.motionZ *= slowAmount;
- player.motionY -= (0.02D + (JewelryNBT.numberOfModifiers(item) - 1) * 0.005D);
- if (player.isCollidedHorizontally) player.motionY = 0.30000001192092896D;
+ player.motionY -= (0.02D
+ + (JewelryNBT.numberOfModifiers(item) - 1) * 0.005D);
+ if (player.isCollidedHorizontally)
+ player.motionY = 0.30000001192092896D;
}
// Negative for earrings
if (jewelry instanceof ItemEarrings) {
- if (player.getAir() >= 300) player.setAir(player.getAir() / 2);
- else player.setAir(player.getAir() - JewelryNBT.numberOfModifiers(item));
+ if (player.getAir() >= 300)
+ player.setAir(player.getAir() / 2);
+ else
+ player.setAir(player.getAir()
+ - JewelryNBT.numberOfModifiers(item));
}
}
@Override
- public boolean onEntityAttackedCacellable(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount) {
+ public boolean onEntityAttackedCancellable(ItemStack item,
+ EntityPlayer player, Entity target, Item jewelry,
+ float amount) {
// Balanced for ring
- if (jewelry instanceof ItemRing && !player.isInWater() && rand.nextInt(JewelryNBT.numberOfModifiers(item)) == 0) target.setFire(2);
+ if (jewelry instanceof ItemRing && !player.isInWater()
+ && rand.nextInt(JewelryNBT.numberOfModifiers(item)) == 0)
+ target.setFire(2);
return false;
}
- public boolean onPlayerAttackedCacellable(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount) {
- if (jewelry instanceof ItemEarrings && rand.nextInt(4) == 0 && source == DamageSource.lava || source == DamageSource.inFire || source == DamageSource.onFire) {
+ @Override
+ public boolean onPlayerAttackedCancellable(ItemStack item,
+ EntityPlayer player, DamageSource source, Item jewelry,
+ float amount) {
+ if (jewelry instanceof ItemEarrings && rand.nextInt(4) == 0
+ && source == DamageSource.lava
+ || source == DamageSource.inFire
+ || source == DamageSource.onFire) {
// Positive for earrings
int stackSize = JewelryNBT.modifierSize(item, modifier);
- player.heal(stackSize * 0.05F - (JewelryNBT.numberOfModifiers(item) - 1) * 0.01F);
+
+ player.heal(stackSize * 0.05F
+ - (JewelryNBT.numberOfModifiers(item) - 1) * 0.01F);
+
return true;
}
// Positive for bracelet
- if (jewelry instanceof ItemBracelet) if (source == DamageSource.inFire || source == DamageSource.onFire || source == DamageSource.lava && player.worldObj.isMaterialInBB(AxisAlignedBB.getBoundingBox(player.boundingBox.minX, player.boundingBox.minY, player.boundingBox.minZ, player.boundingBox.maxX, player.boundingBox.maxY - 0.7, player.boundingBox.maxZ), Material.lava) && !player.worldObj.isMaterialInBB(AxisAlignedBB.getBoundingBox(player.boundingBox.minX, player.boundingBox.minY + 0.9, player.boundingBox.minZ, player.boundingBox.maxX, player.boundingBox.maxY, player.boundingBox.maxZ), Material.lava)) return true;
+ if (jewelry instanceof ItemBracelet)
+ if (source == DamageSource.inFire
+ || source == DamageSource.onFire
+ || source == DamageSource.lava
+ && player.worldObj.isMaterialInBB(
+ AxisAlignedBB.getBoundingBox(
+ player.boundingBox.minX,
+ player.boundingBox.minY,
+ player.boundingBox.minZ,
+ player.boundingBox.maxX,
+ player.boundingBox.maxY - 0.7,
+ player.boundingBox.maxZ),
+ Material.lava)
+ && !player.worldObj.isMaterialInBB(
+ AxisAlignedBB.getBoundingBox(
+ player.boundingBox.minX,
+ player.boundingBox.minY + 0.9,
+ player.boundingBox.minZ,
+ player.boundingBox.maxX,
+ player.boundingBox.maxY,
+ player.boundingBox.maxZ),
+ Material.lava)) {
+ return true;
+ }
+
return false;
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/effects/EffectEnderEye.java b/src/main/java/darkknight/jewelrycraft/effects/EffectEnderEye.java index 4ae0951..6fcfac6 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/effects/EffectEnderEye.java +++ b/src/main/java/darkknight/jewelrycraft/effects/EffectEnderEye.java @@ -27,104 +27,184 @@ import net.minecraft.util.Vec3; import net.minecraft.world.ChunkPosition;
import net.minecraft.world.biome.BiomeGenBase;
-public class EffectEnderEye extends ModifierEffects
-{
- public EffectEnderEye()
- {
- super(new ItemStack(Items.ender_eye));
- }
-
- public void onJewelryEquipped(ItemStack item, Item jewelry)
- {
- if (jewelry instanceof ItemRing)
- setViewDistance(item, Minecraft.getMinecraft().gameSettings.renderDistanceChunks <= 2 ? 10 : Minecraft.getMinecraft().gameSettings.renderDistanceChunks);
- }
-
- public void onJewelryUnequipped(ItemStack item, Item jewelry)
- {
- if (jewelry instanceof ItemRing)
- Minecraft.getMinecraft().gameSettings.setOptionFloatValue(Options.RENDER_DISTANCE, getViewDistance(item));
- }
-
- @Override
- public void action(ItemStack item, EntityPlayer player, Item jewelry)
- {
- if (jewelry instanceof ItemEarrings && !player.worldObj.isRemote) {
- for(Object e: player.worldObj.getEntitiesWithinAABB(EntityEnderman.class, player.boundingBox.expand(100D, 0D, 100D))){
- EntityEnderman enderman = (EntityEnderman)e;
- ReflectionHelper.setPrivateValue(EntityEnderman.class, enderman, -1, "stareTimer", "field_70826_g");
- Vec3 vec3 = player.getLook(1.0F).normalize();
- Vec3 vec31 = Vec3.createVectorHelper(enderman.posX - player.posX, enderman.boundingBox.minY + (double)(enderman.height / 2.0F) - (player.posY + (double)player.getEyeHeight()), enderman.posZ - player.posZ);
- double d0 = vec31.lengthVector();
- vec31 = vec31.normalize();
- double d1 = vec3.dotProduct(vec31);
- if (d1 > 1.0D - 0.025D / d0 && player.canEntityBeSeen(enderman)) {
- // Positive earrings
- if (rand.nextInt(JewelryNBT.numberOfModifiers(item)) == 0)
- enderman.setTarget(null);
- // Negative earrings
- if (!player.isPotionActive(Potion.confusion) || player.getActivePotionEffect(Potion.confusion).getDuration() <= 80)
- player.addPotionEffect(new PotionEffect(Potion.confusion.id, 300, 2 + JewelryNBT.numberOfModifiers(item) / 4));
- }
- }
- }
- // Positive necklace
- if (jewelry instanceof ItemNecklace && !player.worldObj.isRemote) {
- ChunkPosition chunkposition = player.worldObj.findClosestStructure("Stronghold", (int)player.posX, (int)player.posY, (int)player.posZ);
- if (chunkposition != null) {
- Minecraft.getMinecraft().thePlayer.motionX += 0.01D * Math.signum((double)chunkposition.chunkPosX - player.posX) * (rand.nextInt(JewelryNBT.numberOfModifiers(item)) == 0 ? 1 : -1);
- Minecraft.getMinecraft().thePlayer.motionZ += 0.01D * Math.signum((double)chunkposition.chunkPosZ - player.posZ) * (rand.nextInt(JewelryNBT.numberOfModifiers(item)) == 0 ? 1 : -1);
- }
- }
- // Positive bracelet
- if (jewelry instanceof ItemBracelet && !player.worldObj.isRemote && player.worldObj.getBiomeGenForCoords((int)player.posX, (int)player.posZ) == BiomeGenBase.sky && (!player.isPotionActive(Potion.moveSpeed) || player.getActivePotionEffect(Potion.moveSpeed).getDuration() < 30))
- player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 150 - JewelryNBT.numberOfModifiers(item) * 10, 2 - JewelryNBT.numberOfModifiers(item) / 5));
- // Negative bracelet
- if (jewelry instanceof ItemBracelet && !player.worldObj.isRemote && rand.nextInt(520 - JewelryNBT.numberOfModifiers(item) * 20) == 15)
- player.setPositionAndUpdate(player.posX + rand.nextInt(30) * (rand.nextBoolean() ? -1 : 1), player.posY, player.posZ + rand.nextInt(30) * (rand.nextBoolean() ? -1 : 1));
- // Negative ring
- if (jewelry instanceof ItemRing && Minecraft.getMinecraft().gameSettings.renderDistanceChunks != 2.2F - JewelryNBT.numberOfModifiers(item) * 0.1F)
- Minecraft.getMinecraft().gameSettings.setOptionFloatValue(Options.RENDER_DISTANCE, 2.2F - JewelryNBT.numberOfModifiers(item) * 0.1F);
- // Positive ring
- if (jewelry instanceof ItemRing && rand.nextInt(180 + JewelryNBT.numberOfModifiers(item) * 20) == 12) {
- for(int i = (int)player.posX - 2; i <= (int)player.posX + 2; i++)
- for(int j = (int)player.posY - 2; j <= (int)player.posY + 2; j++)
- for(int k = (int)player.posZ - 2; k <= (int)player.posZ + 2; k++)
- if (player.worldObj.getBlock(i, j, k) instanceof BlockOre)
- player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GRAY + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".effect.endereye.1") + " " + player.worldObj.getBlock(i, j, k).getLocalizedName() + " " + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".effect.endereye.2")));
- }
- }
-
- @Override
- public void onPlayerAttacked(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
- {
- // Negative necklace
- if (jewelry instanceof ItemNecklace && !player.worldObj.isRemote)
- player.addPotionEffect(new PotionEffect(Potion.blindness.id, 100 + JewelryNBT.numberOfModifiers(item) * 30, 1));
- }
-
- public static void setViewDistance(ItemStack item, int viewDistance)
- {
- NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
- else{
- itemStackData = new NBTTagCompound();
- item.setTagCompound(itemStackData);
- }
- itemStackData.setInteger("viewDistance", viewDistance);
- }
-
- public static int getViewDistance(ItemStack item)
- {
- NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
- else{
- itemStackData = new NBTTagCompound();
- item.setTagCompound(itemStackData);
- }
- int i = itemStackData.getInteger("viewDistance");
- return i;
- }
+public class EffectEnderEye extends ModifierEffects {
+ public EffectEnderEye() {
+ super(new ItemStack(Items.ender_eye));
+ }
+
+ @Override
+ public void onJewelryEquipped(ItemStack item, Item jewelry) {
+ if (jewelry instanceof ItemRing) {
+ int viewDistance;
+
+ if (Minecraft
+ .getMinecraft().gameSettings.renderDistanceChunks <= 2) {
+ viewDistance = 10;
+ } else {
+ viewDistance = Minecraft
+ .getMinecraft().gameSettings.renderDistanceChunks;
+ }
+
+ setViewDistance(item, viewDistance);
+ }
+ }
+
+ @Override
+ public void onJewelryUnequipped(ItemStack item, Item jewelry) {
+ if (jewelry instanceof ItemRing)
+ Minecraft.getMinecraft().gameSettings.setOptionFloatValue(
+ Options.RENDER_DISTANCE, getViewDistance(item));
+ }
+
+ @SuppressWarnings("cast")
+ @Override
+ public void action(ItemStack item, EntityPlayer player, Item jewelry) {
+ if (jewelry instanceof ItemEarrings && !player.worldObj.isRemote) {
+ for (Object e : player.worldObj.getEntitiesWithinAABB(
+ EntityEnderman.class,
+ player.boundingBox.expand(100D, 0D, 100D))) {
+ EntityEnderman enderman = (EntityEnderman) e;
+
+ ReflectionHelper.setPrivateValue(EntityEnderman.class,
+ enderman, -1, "stareTimer", "field_70826_g");
+
+ Vec3 vec3 = player.getLook(1.0F).normalize();
+ Vec3 vec31 = Vec3.createVectorHelper(
+ enderman.posX - player.posX,
+ enderman.boundingBox.minY
+ + (double) (enderman.height / 2.0F)
+ - (player.posY
+ + (double) player.getEyeHeight()),
+ enderman.posZ - player.posZ);
+ double d0 = vec31.lengthVector();
+ vec31 = vec31.normalize();
+ double d1 = vec3.dotProduct(vec31);
+ if (d1 > 1.0D - 0.025D / d0
+ && player.canEntityBeSeen(enderman)) {
+ // Positive earrings
+ if (rand.nextInt(
+ JewelryNBT.numberOfModifiers(item)) == 0)
+ enderman.setTarget(null);
+ // Negative earrings
+ if (!player.isPotionActive(Potion.confusion) || player
+ .getActivePotionEffect(Potion.confusion)
+ .getDuration() <= 80)
+ player.addPotionEffect(new PotionEffect(
+ Potion.confusion.id, 300,
+ 2 + JewelryNBT.numberOfModifiers(item)
+ / 4));
+ }
+ }
+ }
+
+ // Positive necklace
+ if (jewelry instanceof ItemNecklace && !player.worldObj.isRemote) {
+ ChunkPosition chunkposition = player.worldObj
+ .findClosestStructure("Stronghold", (int) player.posX,
+ (int) player.posY, (int) player.posZ);
+ if (chunkposition != null) {
+ Minecraft.getMinecraft().thePlayer.motionX += 0.01D
+ * Math.signum((double) chunkposition.chunkPosX
+ - player.posX)
+ * (rand.nextInt(
+ JewelryNBT.numberOfModifiers(item)) == 0
+ ? 1 : -1);
+ Minecraft.getMinecraft().thePlayer.motionZ += 0.01D
+ * Math.signum((double) chunkposition.chunkPosZ
+ - player.posZ)
+ * (rand.nextInt(
+ JewelryNBT.numberOfModifiers(item)) == 0
+ ? 1 : -1);
+ }
+ }
+ // Positive bracelet
+ if (jewelry instanceof ItemBracelet && !player.worldObj.isRemote
+ && player.worldObj.getBiomeGenForCoords((int) player.posX,
+ (int) player.posZ) == BiomeGenBase.sky
+ && (!player.isPotionActive(Potion.moveSpeed)
+ || player.getActivePotionEffect(Potion.moveSpeed)
+ .getDuration() < 30))
+ player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id,
+ 150 - JewelryNBT.numberOfModifiers(item) * 10,
+ 2 - JewelryNBT.numberOfModifiers(item) / 5));
+ // Negative bracelet
+ if (jewelry instanceof ItemBracelet && !player.worldObj.isRemote
+ && rand.nextInt(520
+ - JewelryNBT.numberOfModifiers(item) * 20) == 15)
+ player.setPositionAndUpdate(
+ player.posX + rand.nextInt(30)
+ * (rand.nextBoolean() ? -1 : 1),
+ player.posY, player.posZ + rand.nextInt(30)
+ * (rand.nextBoolean() ? -1 : 1));
+ // Negative ring
+ if (jewelry instanceof ItemRing && Minecraft
+ .getMinecraft().gameSettings.renderDistanceChunks != 2.2F
+ - JewelryNBT.numberOfModifiers(item) * 0.1F)
+ Minecraft.getMinecraft().gameSettings.setOptionFloatValue(
+ Options.RENDER_DISTANCE,
+ 2.2F - JewelryNBT.numberOfModifiers(item) * 0.1F);
+ // Positive ring
+ if (jewelry instanceof ItemRing && rand.nextInt(
+ 180 + JewelryNBT.numberOfModifiers(item) * 20) == 12) {
+ for (int i = (int) player.posX - 2; i <= (int) player.posX + 2;
+ i++)
+ for (int j = (int) player.posY - 2;
+ j <= (int) player.posY + 2; j++)
+ for (int k = (int) player.posZ - 2;
+ k <= (int) player.posZ + 2; k++)
+ if (player.worldObj.getBlock(i, j,
+ k) instanceof BlockOre)
+ player.addChatComponentMessage(
+ new ChatComponentText(
+ EnumChatFormatting.GRAY
+ + StatCollector
+ .translateToLocal(
+ "chatmessage."
+ + Variables.MODID
+ + ".effect.endereye.1")
+ + " "
+ + player.worldObj
+ .getBlock(i, j,
+ k)
+ .getLocalizedName()
+ + " "
+ + StatCollector
+ .translateToLocal(
+ "chatmessage."
+ + Variables.MODID
+ + ".effect.endereye.2")));
+ }
+ }
+
+ @Override
+ public void onPlayerAttacked(ItemStack item, EntityPlayer player,
+ DamageSource source, Item jewelry, float amount) {
+ // Negative necklace
+ if (jewelry instanceof ItemNecklace && !player.worldObj.isRemote)
+ player.addPotionEffect(new PotionEffect(Potion.blindness.id,
+ 100 + JewelryNBT.numberOfModifiers(item) * 30, 1));
+ }
+
+ public static void setViewDistance(ItemStack item, int viewDistance) {
+ NBTTagCompound itemStackData;
+ if (item.hasTagCompound())
+ itemStackData = item.getTagCompound();
+ else {
+ itemStackData = new NBTTagCompound();
+ item.setTagCompound(itemStackData);
+ }
+ itemStackData.setInteger("viewDistance", viewDistance);
+ }
+
+ public static int getViewDistance(ItemStack item) {
+ NBTTagCompound itemStackData;
+ if (item.hasTagCompound())
+ itemStackData = item.getTagCompound();
+ else {
+ itemStackData = new NBTTagCompound();
+ item.setTagCompound(itemStackData);
+ }
+ int i = itemStackData.getInteger("viewDistance");
+ return i;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/effects/EffectEnderPearl.java b/src/main/java/darkknight/jewelrycraft/effects/EffectEnderPearl.java index 33a765b..0b48ba2 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/effects/EffectEnderPearl.java +++ b/src/main/java/darkknight/jewelrycraft/effects/EffectEnderPearl.java @@ -2,6 +2,7 @@ package darkknight.jewelrycraft.effects; import java.util.Iterator;
import java.util.List;
+
import darkknight.jewelrycraft.api.ModifierEffects;
import darkknight.jewelrycraft.item.ItemBracelet;
import darkknight.jewelrycraft.item.ItemEarrings;
@@ -20,65 +21,92 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
-public class EffectEnderPearl extends ModifierEffects
-{
- public EffectEnderPearl()
- {
- super(new ItemStack(Items.ender_pearl));
- }
-
- @Override
- public void action(ItemStack item, EntityPlayer player, Item jewelry)
- {
- if (jewelry instanceof ItemEarrings){
- AxisAlignedBB axisalignedbb = player.boundingBox.expand(2.0D, 2.0D, 2.0D);
- List list = player.worldObj.getEntitiesWithinAABB(EntityArrow.class, axisalignedbb);
- if (!player.worldObj.isRemote && list != null && !list.isEmpty()){
- Iterator iterator = list.iterator();
- while (iterator.hasNext()){
- EntityArrow arrow = (EntityArrow)iterator.next();
- if (arrow.shootingEntity == null || !(arrow.shootingEntity.equals(player)))
- // Negative earrings
- if (rand.nextInt(30) == 0){
- arrow.worldObj.createExplosion(new EntityTNTPrimed(arrow.worldObj), arrow.posX, arrow.posY, arrow.posZ, 2F, true);
- arrow.setDead();
- }
- // Positive earrings
- else arrow.setPosition(arrow.posX + rand.nextInt(16) - rand.nextInt(16), arrow.posY + rand.nextInt(16), arrow.posZ + rand.nextInt(16) - rand.nextInt(16));
- }
- }
- }
- // Negative Necklace
- if (jewelry instanceof ItemNecklace) player.addPotionEffect(new PotionEffect(Potion.resistance.id, 60, -10, true));
- // Negative bracelet
- if (jewelry instanceof ItemBracelet && player.isInWater()) player.setPositionAndUpdate(player.posX + rand.nextInt(16) - rand.nextInt(16), player.posY + rand.nextInt(4), player.posZ + rand.nextInt(16) - rand.nextInt(16));
- }
-
- @Override
- public void onPlayerAttacked(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
- {
- // Positive Necklace
- if (jewelry instanceof ItemNecklace && source.getEntity() != null) source.getEntity().attackEntityFrom(source, amount);
- // Positive bracelet
- if (jewelry instanceof ItemBracelet && !player.worldObj.isRemote){
- int id = player.worldObj.provider.dimensionId;
- if (player.getHealth() <= 6F) if (player.getBedLocation(id) != null) player.setPositionAndUpdate(player.getBedLocation(id).posX, player.getBedLocation(id).posY, player.getBedLocation(id).posZ);
- else player.setPositionAndUpdate(player.worldObj.getSpawnPoint().posX, player.worldObj.getSpawnPoint().posY, player.worldObj.getSpawnPoint().posZ);
- }
- }
-
- public void onEntityAttacked(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount)
- {
- if (jewelry instanceof ItemRing){
- // Negative ring
- if (target instanceof EntityEnderman) player.addPotionEffect(new PotionEffect(Potion.weakness.id, 400, 2, true));
- // Positive ring
- else target.setPosition(target.posX + rand.nextInt(16) - rand.nextInt(16), target.posY + rand.nextInt(4), target.posZ + rand.nextInt(16) - rand.nextInt(16));
- }
- }
-
- public boolean onEntityAttackedCacellable(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount)
- {
- return false;
- }
+public class EffectEnderPearl extends ModifierEffects {
+ public EffectEnderPearl() {
+ super(new ItemStack(Items.ender_pearl));
+ }
+
+ @Override
+ public void action(ItemStack item, EntityPlayer player, Item jewelry) {
+ if (jewelry instanceof ItemEarrings) {
+ AxisAlignedBB axisalignedbb =
+ player.boundingBox.expand(2.0D, 2.0D, 2.0D);
+ List<?> list = player.worldObj.getEntitiesWithinAABB(
+ EntityArrow.class, axisalignedbb);
+ if (!player.worldObj.isRemote && list != null
+ && !list.isEmpty()) {
+ Iterator<?> iterator = list.iterator();
+ while (iterator.hasNext()) {
+ EntityArrow arrow = (EntityArrow) iterator.next();
+ if (arrow.shootingEntity == null
+ || !(arrow.shootingEntity.equals(player)))
+ // Negative earrings
+ if (rand.nextInt(30) == 0) {
+ arrow.worldObj.createExplosion(new EntityTNTPrimed(arrow.worldObj), arrow.posX, arrow.posY, arrow.posZ, 2F, true);
+ arrow.setDead();
+ }
+ // Positive earrings
+ else
+ arrow.setPosition(arrow.posX + rand.nextInt(16) - rand.nextInt(16), arrow.posY + rand.nextInt(16), arrow.posZ + rand.nextInt(16) - rand.nextInt(16));
+ }
+ }
+ }
+ // Negative Necklace
+ if (jewelry instanceof ItemNecklace)
+ player.addPotionEffect(
+ new PotionEffect(Potion.resistance.id, 60, -10, true));
+ // Negative bracelet
+ if (jewelry instanceof ItemBracelet && player.isInWater())
+ player.setPositionAndUpdate(
+ player.posX + rand.nextInt(16) - rand.nextInt(16),
+ player.posY + rand.nextInt(4),
+ player.posZ + rand.nextInt(16) - rand.nextInt(16));
+ }
+
+ @Override
+ public void onPlayerAttacked(ItemStack item, EntityPlayer player,
+ DamageSource source, Item jewelry, float amount) {
+ // Positive Necklace
+ if (jewelry instanceof ItemNecklace && source.getEntity() != null)
+ source.getEntity().attackEntityFrom(source, amount);
+ // Positive bracelet
+ if (jewelry instanceof ItemBracelet && !player.worldObj.isRemote) {
+ int id = player.worldObj.provider.dimensionId;
+ if (player.getHealth() <= 6F)
+ if (player.getBedLocation(id) != null)
+ player.setPositionAndUpdate(
+ player.getBedLocation(id).posX,
+ player.getBedLocation(id).posY,
+ player.getBedLocation(id).posZ);
+ else
+ player.setPositionAndUpdate(
+ player.worldObj.getSpawnPoint().posX,
+ player.worldObj.getSpawnPoint().posY,
+ player.worldObj.getSpawnPoint().posZ);
+ }
+ }
+
+ @Override
+ public void onEntityAttacked(ItemStack item, EntityPlayer player,
+ Entity target, Item jewelry, float amount) {
+ if (jewelry instanceof ItemRing) {
+ // Negative ring
+ if (target instanceof EntityEnderman)
+ player.addPotionEffect(new PotionEffect(Potion.weakness.id,
+ 400, 2, true));
+ // Positive ring
+ else
+ target.setPosition(
+ target.posX + rand.nextInt(16) - rand.nextInt(16),
+ target.posY + rand.nextInt(4),
+ target.posZ + rand.nextInt(16) - rand.nextInt(16));
+ }
+ }
+
+ @Override
+ public boolean onEntityAttackedCancellable(ItemStack item,
+ EntityPlayer player, Entity target, Item jewelry,
+ float amount) {
+ return false;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/effects/EffectFeather.java b/src/main/java/darkknight/jewelrycraft/effects/EffectFeather.java index 2ffaa11..a7f2c8e 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/effects/EffectFeather.java +++ b/src/main/java/darkknight/jewelrycraft/effects/EffectFeather.java @@ -2,6 +2,7 @@ package darkknight.jewelrycraft.effects; import java.util.Iterator;
import java.util.List;
+
import darkknight.jewelrycraft.api.ModifierEffects;
import darkknight.jewelrycraft.damage.DamageSourceList;
import darkknight.jewelrycraft.item.ItemBracelet;
@@ -27,67 +28,114 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
-public class EffectFeather extends ModifierEffects
-{
- public EffectFeather()
- {
- super(new ItemStack(Items.feather));
- }
-
- @Override
- public void action(ItemStack item, EntityPlayer player, Item jewelry)
- {
- // Positive earrings
- if (jewelry instanceof ItemEarrings){
- AxisAlignedBB axisalignedbb = player.boundingBox.expand(1.0D, 1.0D, 1.0D);
- List list = player.worldObj.getEntitiesWithinAABB(EntityArrow.class, axisalignedbb);
- if (!player.worldObj.isRemote && list != null && !list.isEmpty()){
- Iterator iterator = list.iterator();
- while (iterator.hasNext()){
- EntityArrow arrow = (EntityArrow)iterator.next();
- if ((arrow.shootingEntity == null || !(arrow.shootingEntity.equals(player)) || arrow.canBePickedUp == 0) && rand.nextInt(2 + JewelryNBT.numberOfModifiers(item)) == 0) arrow.setDead();
- }
- }
- }
- if (jewelry instanceof ItemBracelet){
- // Positive bracelet
- if (player.motionY < 0) player.motionY *= (0.6D + (JewelryNBT.numberOfModifiers(item) - 1) * 0.03D);
- if (rand.nextInt(JewelryNBT.numberOfModifiers(item)) == 0) player.fallDistance = 0F;
- // Negative bracelet
- if (!player.isPotionActive(Potion.moveSlowdown) || player.getActivePotionEffect(Potion.moveSlowdown).getDuration() < 30) player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 80 + JewelryNBT.numberOfModifiers(item) * 10, 1 + JewelryNBT.numberOfModifiers(item) / 4));
- }
- }
-
- @Override
- public boolean onEntityAttackedCacellable(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount)
- {
- NBTTagCompound enemyData = target.getEntityData();
- if (jewelry instanceof ItemRing && !player.worldObj.isRemote){
- if (enemyData.getInteger("reAttacked") == 0){
- // Negative ring
- enemyData.setInteger("reAttacked", enemyData.getInteger("reAttacked") + 1);
- target.attackEntityFrom(DamageSource.causePlayerDamage(player), amount / (2F + (JewelryNBT.numberOfModifiers(item) - 1) * 0.3F));
- // Positive ring
- if (rand.nextInt(2) == 0 && target instanceof EntityLivingBase) ((EntityLivingBase)target).addPotionEffect(new PotionEffect(PotionList.stun.id, (51 - JewelryNBT.numberOfModifiers(item))*2, 0, false));
- return true;
- }
- else enemyData.setInteger("reAttacked", 0);
- }
- return false;
- }
-
- @Override
- public boolean onPlayerAttackedCacellable(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
- {
- // Positive necklace
- if (jewelry instanceof ItemNecklace && rand.nextInt(3 + JewelryNBT.numberOfModifiers(item)) == 0 && source != DamageSourceList.weak && source != DamageSource.inFire && source != DamageSource.onFire && source != DamageSource.lava){
- player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GRAY + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".effect.feather")));
- return true;
- }
- // Negative necklace
- if (jewelry instanceof ItemNecklace && (source == DamageSource.inFire || source == DamageSource.onFire || source == DamageSource.lava) && source != DamageSourceList.weak) player.attackEntityFrom(DamageSourceList.weak, amount * (3F + (JewelryNBT.numberOfModifiers(item) - 1) * 0.1F));
- // Negative earrings
- if (jewelry instanceof ItemEarrings && source.damageType.equals("arrow")) player.attackEntityFrom(DamageSourceList.weak, amount * (2F + (JewelryNBT.numberOfModifiers(item) - 1) * 0.1F));
- return false;
- }
+public class EffectFeather extends ModifierEffects {
+ public EffectFeather() {
+ super(new ItemStack(Items.feather));
+ }
+
+ @Override
+ public void action(ItemStack item, EntityPlayer player, Item jewelry) {
+ // Positive earrings
+ if (jewelry instanceof ItemEarrings) {
+ AxisAlignedBB axisalignedbb =
+ player.boundingBox.expand(1.0D, 1.0D, 1.0D);
+ List<?> list = player.worldObj.getEntitiesWithinAABB(
+ EntityArrow.class, axisalignedbb);
+ if (!player.worldObj.isRemote && list != null
+ && !list.isEmpty()) {
+ Iterator<?> iterator = list.iterator();
+ while (iterator.hasNext()) {
+ EntityArrow arrow = (EntityArrow) iterator.next();
+ if ((arrow.shootingEntity == null
+ || !(arrow.shootingEntity.equals(player))
+ || arrow.canBePickedUp == 0)
+ && rand.nextInt(2 + JewelryNBT
+ .numberOfModifiers(item)) == 0)
+ arrow.setDead();
+ }
+ }
+ }
+ if (jewelry instanceof ItemBracelet) {
+ // Positive bracelet
+ if (player.motionY < 0)
+ player.motionY *=
+ (0.6D + (JewelryNBT.numberOfModifiers(item) - 1)
+ * 0.03D);
+ if (rand.nextInt(JewelryNBT.numberOfModifiers(item)) == 0)
+ player.fallDistance = 0F;
+ // Negative bracelet
+ if (!player.isPotionActive(Potion.moveSlowdown)
+ || player.getActivePotionEffect(Potion.moveSlowdown)
+ .getDuration() < 30)
+ player.addPotionEffect(new PotionEffect(
+ Potion.moveSlowdown.id,
+ 80 + JewelryNBT.numberOfModifiers(item) * 10,
+ 1 + JewelryNBT.numberOfModifiers(item) / 4));
+ }
+ }
+
+ @Override
+ public boolean onEntityAttackedCancellable(ItemStack item,
+ EntityPlayer player, Entity target, Item jewelry,
+ float amount) {
+ NBTTagCompound enemyData = target.getEntityData();
+ if (jewelry instanceof ItemRing && !player.worldObj.isRemote) {
+ if (enemyData.getInteger("reAttacked") == 0) {
+ // Negative ring
+ enemyData.setInteger("reAttacked",
+ enemyData.getInteger("reAttacked") + 1);
+ target.attackEntityFrom(
+ DamageSource.causePlayerDamage(player),
+ amount / (2F
+ + (JewelryNBT.numberOfModifiers(item) - 1)
+ * 0.3F));
+ // Positive ring
+ if (rand.nextInt(2) == 0
+ && target instanceof EntityLivingBase)
+ ((EntityLivingBase) target).addPotionEffect(
+ new PotionEffect(PotionList.stun.id,
+ (51 - JewelryNBT
+ .numberOfModifiers(item)) * 2,
+ 0, false));
+ return true;
+ }
+ enemyData.setInteger("reAttacked", 0);
+ }
+ return false;
+ }
+
+ @Override
+ public boolean onPlayerAttackedCancellable(ItemStack item,
+ EntityPlayer player, DamageSource source, Item jewelry,
+ float amount) {
+ // Positive necklace
+ if (jewelry instanceof ItemNecklace
+ && rand.nextInt(
+ 3 + JewelryNBT.numberOfModifiers(item)) == 0
+ && source != DamageSourceList.weak
+ && source != DamageSource.inFire
+ && source != DamageSource.onFire
+ && source != DamageSource.lava) {
+ player.addChatComponentMessage(
+ new ChatComponentText(EnumChatFormatting.GRAY
+ + StatCollector.translateToLocal(
+ "chatmessage." + Variables.MODID
+ + ".effect.feather")));
+ return true;
+ }
+ // Negative necklace
+ if (jewelry instanceof ItemNecklace
+ && (source == DamageSource.inFire
+ || source == DamageSource.onFire
+ || source == DamageSource.lava)
+ && source != DamageSourceList.weak)
+ player.attackEntityFrom(DamageSourceList.weak, amount * (3F
+ + (JewelryNBT.numberOfModifiers(item) - 1) * 0.1F));
+ // Negative earrings
+ if (jewelry instanceof ItemEarrings
+ && source.damageType.equals("arrow"))
+ player.attackEntityFrom(DamageSourceList.weak, amount * (2F
+ + (JewelryNBT.numberOfModifiers(item) - 1) * 0.1F));
+ return false;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/effects/EffectObsidian.java b/src/main/java/darkknight/jewelrycraft/effects/EffectObsidian.java index f13b272..be1d233 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/effects/EffectObsidian.java +++ b/src/main/java/darkknight/jewelrycraft/effects/EffectObsidian.java @@ -19,83 +19,122 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
-public class EffectObsidian extends ModifierEffects
-{
- public EffectObsidian()
- {
- super(new ItemStack(Blocks.obsidian));
- }
-
- @Override
- public void action(ItemStack item, EntityPlayer player, Item jewelry)
- {
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- if (jewelry instanceof ItemNecklace){
- // Positive necklace
- player.addPotionEffect(new PotionEffect(Potion.resistance.id, 60, 2, true));
- // Negative necklace
- if (player.isInWater() && !player.capabilities.isCreativeMode){
- double slowAmount = 0.2D + (JewelryNBT.numberOfModifiers(item) - 1) * 0.05D;
- player.motionX *= slowAmount;
- player.motionY *= slowAmount;
- player.motionZ *= slowAmount;
- player.motionY = -0.5D;
- if (rand.nextInt(50) == 0) player.attackEntityFrom(DamageSourceList.weak, 2F);
- }
- }
- // Negative bracelet
- if (jewelry instanceof ItemBracelet && playerInfo.hasKey("falls") && playerInfo.getInteger("falls") >= 300) player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 60, 1, true));
- // Negative ring
- if (jewelry instanceof ItemRing && playerInfo.hasKey("strikes") && playerInfo.getInteger("strikes") >= 200){
- player.addPotionEffect(new PotionEffect(Potion.weakness.id, 60, 0, true));
- player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 60, 1, true));
- }
- }
-
- @Override
- public boolean onPlayerAttackedCacellable(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
- {
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- if (jewelry instanceof ItemEarrings && (source == DamageSource.anvil || source.damageType.equals("arrow"))){
- if (playerInfo.hasKey("protected")) playerInfo.setInteger("protected", playerInfo.getInteger("protected") + 1);
- else playerInfo.setInteger("protected", 1);
- // Positive && Negative earrings
- if (playerInfo.getInteger("protected") < 2000) return true;
- else player.attackEntityFrom(DamageSourceList.weak, player.getHealth() * 3F);
- }
- if (jewelry instanceof ItemBracelet && source == DamageSource.fall){
- if (playerInfo.hasKey("falls")) playerInfo.setInteger("falls", playerInfo.getInteger("falls") + 1);
- else playerInfo.setInteger("falls", 1);
- // Positive bracelet
- if (playerInfo.getInteger("falls") < 3000) return true;
- }
- return false;
- }
-
- public void onPlayerDead(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry)
- {
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- playerInfo.setInteger("falls", 0);
- playerInfo.setInteger("strikes", 0);
- playerInfo.setInteger("protected", 0);
- }
-
- public boolean onEntityAttackedCacellable(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount)
- {
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- NBTTagCompound enemyData = target.getEntityData();
- // Positive ring
- if (jewelry instanceof ItemRing && playerInfo.getInteger("strikes") < 2000 && !player.worldObj.isRemote){
- if (enemyData.getInteger("reAttacked") == 0){
- if (playerInfo.hasKey("strikes")) playerInfo.setInteger("strikes", playerInfo.getInteger("strikes") + 1);
- else playerInfo.setInteger("strikes", 1);
- // Negative ring
- enemyData.setInteger("reAttacked", enemyData.getInteger("reAttacked") + 1);
- target.attackEntityFrom(DamageSource.causePlayerDamage(player), amount * 1.5F);
- return true;
- }
- if (enemyData.getInteger("reAttacked") == 1) enemyData.setInteger("reAttacked", 0);
- }
- return false;
- }
+public class EffectObsidian extends ModifierEffects {
+ public EffectObsidian() {
+ super(new ItemStack(Blocks.obsidian));
+ }
+
+ @Override
+ public void action(ItemStack item, EntityPlayer player, Item jewelry) {
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(player, Variables.MODID);
+ if (jewelry instanceof ItemNecklace) {
+ // Positive necklace
+ player.addPotionEffect(
+ new PotionEffect(Potion.resistance.id, 60, 2, true));
+ // Negative necklace
+ if (player.isInWater()
+ && !player.capabilities.isCreativeMode) {
+ double slowAmount = 0.2D
+ + (JewelryNBT.numberOfModifiers(item) - 1) * 0.05D;
+ player.motionX *= slowAmount;
+ player.motionY *= slowAmount;
+ player.motionZ *= slowAmount;
+ player.motionY = -0.5D;
+ if (rand.nextInt(50) == 0)
+ player.attackEntityFrom(DamageSourceList.weak, 2F);
+ }
+ }
+ // Negative bracelet
+ if (jewelry instanceof ItemBracelet && playerInfo.hasKey("falls")
+ && playerInfo.getInteger("falls") >= 300)
+ player.addPotionEffect(
+ new PotionEffect(Potion.moveSlowdown.id, 60, 1, true));
+ // Negative ring
+ if (jewelry instanceof ItemRing && playerInfo.hasKey("strikes")
+ && playerInfo.getInteger("strikes") >= 200) {
+ player.addPotionEffect(
+ new PotionEffect(Potion.weakness.id, 60, 0, true));
+ player.addPotionEffect(
+ new PotionEffect(Potion.digSlowdown.id, 60, 1, true));
+ }
+ }
+
+ @Override
+ public boolean onPlayerAttackedCancellable(ItemStack item,
+ EntityPlayer player, DamageSource source, Item jewelry,
+ float amount) {
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(player, Variables.MODID);
+ if (jewelry instanceof ItemEarrings
+ && (source == DamageSource.anvil
+ || source.damageType.equals("arrow"))) {
+ if (playerInfo.hasKey("protected")) {
+ playerInfo.setInteger("protected",
+ playerInfo.getInteger("protected") + 1);
+ } else {
+ playerInfo.setInteger("protected", 1);
+ }
+ // Positive && Negative earrings
+ if (playerInfo.getInteger("protected") < 2000) {
+ return true;
+ }
+ player.attackEntityFrom(DamageSourceList.weak,
+ player.getHealth() * 3F);
+ }
+ if (jewelry instanceof ItemBracelet
+ && source == DamageSource.fall) {
+ if (playerInfo.hasKey("falls")) {
+ playerInfo.setInteger("falls",
+ playerInfo.getInteger("falls") + 1);
+ } else {
+ playerInfo.setInteger("falls", 1);
+ }
+ // Positive bracelet
+ if (playerInfo.getInteger("falls") < 3000)
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void onPlayerDead(ItemStack item, EntityPlayer player,
+ DamageSource source, Item jewelry) {
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(player, Variables.MODID);
+ playerInfo.setInteger("falls", 0);
+ playerInfo.setInteger("strikes", 0);
+ playerInfo.setInteger("protected", 0);
+ }
+
+ @Override
+ public boolean onEntityAttackedCancellable(ItemStack item,
+ EntityPlayer player, Entity target, Item jewelry,
+ float amount) {
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(player, Variables.MODID);
+ NBTTagCompound enemyData = target.getEntityData();
+ // Positive ring
+ if (jewelry instanceof ItemRing
+ && playerInfo.getInteger("strikes") < 2000
+ && !player.worldObj.isRemote) {
+ if (enemyData.getInteger("reAttacked") == 0) {
+ if (playerInfo.hasKey("strikes"))
+ playerInfo.setInteger("strikes",
+ playerInfo.getInteger("strikes") + 1);
+ else
+ playerInfo.setInteger("strikes", 1);
+ // Negative ring
+ enemyData.setInteger("reAttacked",
+ enemyData.getInteger("reAttacked") + 1);
+ target.attackEntityFrom(
+ DamageSource.causePlayerDamage(player),
+ amount * 1.5F);
+ return true;
+ }
+ if (enemyData.getInteger("reAttacked") == 1)
+ enemyData.setInteger("reAttacked", 0);
+ }
+ return false;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/effects/EffectsList.java b/src/main/java/darkknight/jewelrycraft/effects/EffectsList.java index 3df8169..ee5f64c 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/effects/EffectsList.java +++ b/src/main/java/darkknight/jewelrycraft/effects/EffectsList.java @@ -3,16 +3,15 @@ package darkknight.jewelrycraft.effects; import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import darkknight.jewelrycraft.api.ModifierEffects;
-public class EffectsList
-{
- public static ModifierEffects blazePowder, enderEye, feather, enderPearl, obsidian;
-
- public static void postInit(FMLPostInitializationEvent e)
- {
- blazePowder = new EffectBlazePowder();
- enderEye = new EffectEnderEye();
- feather = new EffectFeather();
- enderPearl = new EffectEnderPearl();
- obsidian = new EffectObsidian();
- }
+public class EffectsList {
+ public static ModifierEffects blazePowder, enderEye, feather,
+ enderPearl, obsidian;
+
+ public static void postInit(FMLPostInitializationEvent e) {
+ blazePowder = new EffectBlazePowder();
+ enderEye = new EffectEnderEye();
+ feather = new EffectFeather();
+ enderPearl = new EffectEnderPearl();
+ obsidian = new EffectObsidian();
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/entities/EntityHalfHeart.java b/src/main/java/darkknight/jewelrycraft/entities/EntityHalfHeart.java index 06bf7b7..259bf13 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/entities/EntityHalfHeart.java +++ b/src/main/java/darkknight/jewelrycraft/entities/EntityHalfHeart.java @@ -6,22 +6,19 @@ import net.minecraft.world.World; /**
* @author Sorin
*/
-public class EntityHalfHeart extends EntityHeart
-{
- public EntityHalfHeart(World world)
- {
- super(world);
- }
-
- protected void entityInit()
- {
- super.entityInit();
- this.dataWatcher.updateObject(17, 1f);
- }
-
- @Override
- public void onCollideWithPlayer(EntityPlayer player)
- {
- super.onCollideWithPlayer(player);
- }
+public class EntityHalfHeart extends EntityHeart {
+ public EntityHalfHeart(World world) {
+ super(world);
+ }
+
+ @Override
+ protected void entityInit() {
+ super.entityInit();
+ this.dataWatcher.updateObject(17, 1f);
+ }
+
+ @Override
+ public void onCollideWithPlayer(EntityPlayer player) {
+ super.onCollideWithPlayer(player);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/entities/EntityHeart.java b/src/main/java/darkknight/jewelrycraft/entities/EntityHeart.java index f84a23a..cbfc21a 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/entities/EntityHeart.java +++ b/src/main/java/darkknight/jewelrycraft/entities/EntityHeart.java @@ -26,149 +26,169 @@ import net.minecraft.world.World; /**
* @author Sorin
*/
-public class EntityHeart extends EntityLiving
-{
- public EntityHeart(World world)
- {
- super(world);
- this.setSize(0.4F, 0.4F);
- }
-
- protected void applyEntityAttributes()
- {
- super.applyEntityAttributes();
- this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(getQuantity());
- }
-
- @Override
- public void updateEntityActionState()
- {
- if (ConfigHandler.HEARTS_DESPAWN)
- ++this.entityAge;
- this.setCanPickUpLoot(true);
- }
-
- public void onLivingUpdate()
- {
- super.onLivingUpdate();
- if (ConfigHandler.HEARTS_DESPAWN && this.entityAge > ConfigHandler.HEART_DESPAWN_TIME)
- this.setDead();
- }
-
- protected void collideWithEntity(Entity entity)
- {
- super.collideWithEntity(entity);
- if (!this.worldObj.isRemote && entity instanceof EntityHeart && getType().equals(((EntityHeart)entity).getType())) {
- setQuantity(getQuantity() + ((EntityHeart)entity).getQuantity());
- entity.setDead();
- }
- }
-
- @Override
- public void onCollideWithPlayer(EntityPlayer player)
- {
- if (!this.worldObj.isRemote) {
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- if (playerInfo != null) {
- if (getType().equals("Red") && player.getHealth() < player.getMaxHealth()) {
- float healAmount = player.getMaxHealth() - player.getHealth();
- if (getQuantity() > healAmount) {
- player.heal(healAmount);
- this.setQuantity(getQuantity() - healAmount);
- }else{
- player.heal(getQuantity());
- this.setDead();
- }
- }else
- if (getType().equals("White") && playerInfo.getFloat("WhiteHeart") > 0.1F) {
- playerInfo.setFloat(getType() + "Heart", 0F);
- if (player.getMaxHealth() < 40F) {
- player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(player.getMaxHealth() + 2f);
- player.setHealth(player.getHealth() + 2f);
- }
- JewelrycraftMod.netWrapper.sendTo(new PacketSendClientPlayerInfo(playerInfo), (EntityPlayerMP)player);
- this.setDead();
- }else
- if (!getType().equals("Red") && ((getType().equals("Black") && playerInfo.getFloat("BlackHeart") <= ConfigHandler.MAX_BLACK_HEARTS_PICKUP) || (getType().equals("Blue") && playerInfo.getFloat("BlueHeart") <= ConfigHandler.MAX_BLUE_HEARTS_PICKUP) || getType().equals("White"))) {
- if (playerInfo.hasKey(getType() + "Heart"))
- playerInfo.setFloat(getType() + "Heart", playerInfo.getFloat(getType() + "Heart") + getQuantity());
- else playerInfo.setFloat(getType() + "Heart", getQuantity());
- JewelrycraftMod.netWrapper.sendTo(new PacketSendClientPlayerInfo(playerInfo), (EntityPlayerMP)player);
- this.setDead();
- }
- }
- }
- }
-
- public void onDeath(DamageSource source)
- {
- super.onDeath(source);
- if (source.getEntity() != null && source.getEntity() instanceof EntityPlayer)
- ((EntityPlayer)source.getEntity()).addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".heartKilled." + this.getType())));
- }
-
- @SideOnly (Side.CLIENT)
- public boolean canRenderOnFire()
- {
- return false;
- }
-
- protected void entityInit()
- {
- super.entityInit();
- this.dataWatcher.addObject(16, "Red");
- this.dataWatcher.addObject(17, 2f);
- }
-
- public void writeEntityToNBT(NBTTagCompound nbt)
- {
- super.writeEntityToNBT(nbt);
- nbt.setString("Type", getType());
- nbt.setFloat("Quantity", getQuantity());
- }
-
- /**
- * (abstract) Protected helper method to read subclass entity data from NBT.
- */
- public void readEntityFromNBT(NBTTagCompound nbt)
- {
- super.readEntityFromNBT(nbt);
- setType(nbt.getString("Type"));
- setQuantity(nbt.getFloat("Quantity"));
- }
-
- public String getType()
- {
- return this.dataWatcher.getWatchableObjectString(16);
- }
-
- public void setType(String type)
- {
- this.dataWatcher.updateObject(16, type);
- }
-
- public Float getQuantity()
- {
- return this.dataWatcher.getWatchableObjectFloat(17);
- }
-
- public void setQuantity(Float qty)
- {
- this.dataWatcher.updateObject(17, qty);
- }
-
- public EnumCreatureAttribute getCreatureAttribute()
- {
- return JewelrycraftUtil.HEART;
- }
-
- public boolean isEntityInvulnerable()
- {
- return false;
- }
-
- public boolean canPickUpLoot()
- {
- return false;
- }
+public class EntityHeart extends EntityLiving {
+ public EntityHeart(World world) {
+ super(world);
+ this.setSize(0.4F, 0.4F);
+ }
+
+ @Override
+ protected void applyEntityAttributes() {
+ super.applyEntityAttributes();
+ this.getEntityAttribute(SharedMonsterAttributes.maxHealth)
+ .setBaseValue(getQuantity());
+ }
+
+ @Override
+ public void updateEntityActionState() {
+ if (ConfigHandler.HEARTS_DESPAWN)
+ ++this.entityAge;
+ this.setCanPickUpLoot(true);
+ }
+
+ @Override
+ public void onLivingUpdate() {
+ super.onLivingUpdate();
+ if (ConfigHandler.HEARTS_DESPAWN
+ && this.entityAge > ConfigHandler.HEART_DESPAWN_TIME)
+ this.setDead();
+ }
+
+ @Override
+ protected void collideWithEntity(Entity entity) {
+ super.collideWithEntity(entity);
+ if (!this.worldObj.isRemote && entity instanceof EntityHeart
+ && getType().equals(((EntityHeart) entity).getType())) {
+ setQuantity(
+ getQuantity() + ((EntityHeart) entity).getQuantity());
+ entity.setDead();
+ }
+ }
+
+ @Override
+ public void onCollideWithPlayer(EntityPlayer player) {
+ if (!this.worldObj.isRemote) {
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(player, Variables.MODID);
+ if (playerInfo != null) {
+ if (getType().equals("Red")
+ && player.getHealth() < player.getMaxHealth()) {
+ float healAmount =
+ player.getMaxHealth() - player.getHealth();
+ if (getQuantity() > healAmount) {
+ player.heal(healAmount);
+ this.setQuantity(getQuantity() - healAmount);
+ } else {
+ player.heal(getQuantity());
+ this.setDead();
+ }
+ } else if (getType().equals("White")
+ && playerInfo.getFloat("WhiteHeart") > 0.1F) {
+ playerInfo.setFloat(getType() + "Heart", 0F);
+ if (player.getMaxHealth() < 40F) {
+ player.getEntityAttribute(
+ SharedMonsterAttributes.maxHealth)
+ .setBaseValue(player.getMaxHealth() + 2f);
+ player.setHealth(player.getHealth() + 2f);
+ }
+ JewelrycraftMod.netWrapper.sendTo(
+ new PacketSendClientPlayerInfo(playerInfo),
+ (EntityPlayerMP) player);
+ this.setDead();
+ } else if (!getType().equals("Red")
+ && ((getType().equals("Black")
+ && playerInfo.getFloat(
+ "BlackHeart") <= ConfigHandler.MAX_BLACK_HEARTS_PICKUP)
+ || (getType().equals("Blue")
+ && playerInfo.getFloat(
+ "BlueHeart") <= ConfigHandler.MAX_BLUE_HEARTS_PICKUP)
+ || getType().equals("White"))) {
+ if (playerInfo.hasKey(getType() + "Heart"))
+ playerInfo.setFloat(getType() + "Heart",
+ playerInfo.getFloat(getType() + "Heart")
+ + getQuantity());
+ else
+ playerInfo.setFloat(getType() + "Heart",
+ getQuantity());
+ JewelrycraftMod.netWrapper.sendTo(
+ new PacketSendClientPlayerInfo(playerInfo),
+ (EntityPlayerMP) player);
+ this.setDead();
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onDeath(DamageSource source) {
+ super.onDeath(source);
+ if (source.getEntity() != null
+ && source.getEntity() instanceof EntityPlayer)
+ ((EntityPlayer) source.getEntity()).addChatMessage(
+ new ChatComponentText(StatCollector.translateToLocal(
+ "chatmessage." + Variables.MODID
+ + ".heartKilled." + this.getType())));
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean canRenderOnFire() {
+ return false;
+ }
+
+ @Override
+ protected void entityInit() {
+ super.entityInit();
+ this.dataWatcher.addObject(16, "Red");
+ this.dataWatcher.addObject(17, 2f);
+ }
+
+ @Override
+ public void writeEntityToNBT(NBTTagCompound nbt) {
+ super.writeEntityToNBT(nbt);
+ nbt.setString("Type", getType());
+ nbt.setFloat("Quantity", getQuantity());
+ }
+
+ /**
+ * (abstract) Protected helper method to read subclass entity data from
+ * NBT.
+ */
+ @Override
+ public void readEntityFromNBT(NBTTagCompound nbt) {
+ super.readEntityFromNBT(nbt);
+ setType(nbt.getString("Type"));
+ setQuantity(nbt.getFloat("Quantity"));
+ }
+
+ public String getType() {
+ return this.dataWatcher.getWatchableObjectString(16);
+ }
+
+ public void setType(String type) {
+ this.dataWatcher.updateObject(16, type);
+ }
+
+ public Float getQuantity() {
+ return this.dataWatcher.getWatchableObjectFloat(17);
+ }
+
+ public void setQuantity(Float qty) {
+ this.dataWatcher.updateObject(17, qty);
+ }
+
+ @Override
+ public EnumCreatureAttribute getCreatureAttribute() {
+ return JewelrycraftUtil.HEARTS;
+ }
+
+ @Override
+ public boolean isEntityInvulnerable() {
+ return false;
+ }
+
+ @Override
+ public boolean canPickUpLoot() {
+ return false;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/entities/EntityList.java b/src/main/java/darkknight/jewelrycraft/entities/EntityList.java index ceb2625..8a23598 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/entities/EntityList.java +++ b/src/main/java/darkknight/jewelrycraft/entities/EntityList.java @@ -7,27 +7,38 @@ import darkknight.jewelrycraft.item.ItemSpawnEgg; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
-public class EntityList
-{
- public static void preInit(FMLPreInitializationEvent e)
- {
- registerEntity(1, EntityHeart.class, "Heart", 0x000000, 0xFF0000); //Red
- ItemSpawnEgg.registerSpawnEgg(EntityHeart.class, "Heart", 2, 0x000000, 0xFFFFFF); // White
- ItemSpawnEgg.registerSpawnEgg(EntityHeart.class, "Heart", 3, 0x000000, 0x006BBD); // Blue
- ItemSpawnEgg.registerSpawnEgg(EntityHeart.class, "Heart", 4, 0x000000, 0x404040); // Black
-
- registerEntity(5, EntityHalfHeart.class, "HalfHeart", 0x000000, 0xFF0000); // Red
- ItemSpawnEgg.registerSpawnEgg(EntityHalfHeart.class, "HalfHeart", 6, 0x000000, 0xFFFFFF); // White
- ItemSpawnEgg.registerSpawnEgg(EntityHalfHeart.class, "HalfHeart", 7, 0x000000, 0x006BBD); // Blue
- ItemSpawnEgg.registerSpawnEgg(EntityHalfHeart.class, "HalfHeart", 8, 0x000000, 0x404040); // Black
-
- }
- private static final void registerEntity(int id, Class<? extends Entity> entityClass, String name) {
- EntityRegistry.registerModEntity(entityClass, name, id, JewelrycraftMod.instance, 256, 1, true);
+public class EntityList {
+ public static void preInit(FMLPreInitializationEvent e) {
+ registerEntity(1, EntityHeart.class, "Heart", 0x000000, 0xFF0000); // Red
+ ItemSpawnEgg.registerSpawnEgg(EntityHeart.class, "Heart", 2,
+ 0x000000, 0xFFFFFF); // White
+ ItemSpawnEgg.registerSpawnEgg(EntityHeart.class, "Heart", 3,
+ 0x000000, 0x006BBD); // Blue
+ ItemSpawnEgg.registerSpawnEgg(EntityHeart.class, "Heart", 4,
+ 0x000000, 0x404040); // Black
+
+ registerEntity(5, EntityHalfHeart.class, "HalfHeart", 0x000000,
+ 0xFF0000); // Red
+ ItemSpawnEgg.registerSpawnEgg(EntityHalfHeart.class, "HalfHeart",
+ 6, 0x000000, 0xFFFFFF); // White
+ ItemSpawnEgg.registerSpawnEgg(EntityHalfHeart.class, "HalfHeart",
+ 7, 0x000000, 0x006BBD); // Blue
+ ItemSpawnEgg.registerSpawnEgg(EntityHalfHeart.class, "HalfHeart",
+ 8, 0x000000, 0x404040); // Black
+
}
-
- private static final void registerEntity(int id, Class<? extends EntityLiving> entityClass, String name, int eggBackgroundColor, int eggForegroundColor) {
+
+ private static final void registerEntity(int id,
+ Class<? extends Entity> entityClass, String name) {
+ EntityRegistry.registerModEntity(entityClass, name, id,
+ JewelrycraftMod.instance, 256, 1, true);
+ }
+
+ private static final void registerEntity(int id,
+ Class<? extends EntityLiving> entityClass, String name,
+ int eggBackgroundColor, int eggForegroundColor) {
registerEntity(id, entityClass, name);
- ItemSpawnEgg.registerSpawnEgg(entityClass, name, id, eggBackgroundColor, eggForegroundColor);
+ ItemSpawnEgg.registerSpawnEgg(entityClass, name, id,
+ eggBackgroundColor, eggForegroundColor);
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/entities/renders/HeartRender.java b/src/main/java/darkknight/jewelrycraft/entities/renders/HeartRender.java index d25ecbe..41f7a85 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/entities/renders/HeartRender.java +++ b/src/main/java/darkknight/jewelrycraft/entities/renders/HeartRender.java @@ -1,7 +1,9 @@ package darkknight.jewelrycraft.entities.renders;
import java.util.Random;
+
import org.lwjgl.opengl.GL11;
+
import darkknight.jewelrycraft.entities.EntityHeart;
import darkknight.jewelrycraft.util.Variables;
import net.minecraft.client.model.ModelBase;
@@ -13,55 +15,58 @@ import net.minecraft.util.ResourceLocation; /**
* @author Sorin
*/
-public class HeartRender extends RenderLiving
-{
- protected ResourceLocation texture;
- Random rnd = new Random();
-
- public HeartRender(ModelBase modelBase, float shadowSize)
- {
- super(modelBase, shadowSize);
- }
-
- protected void renderModel(EntityLivingBase entity, float x, float y, float z, float rot1, float rot2, float rot3)
- {
- super.renderModel(entity, x, y, z, rot1, rot2, rot3);
- rnd.setSeed(1542372345);
- if (((EntityHeart)entity).getQuantity() > 2f){
- for(int i = 0; i < ((EntityHeart)entity).getQuantity() / 10f; i++){
- float posX = rnd.nextFloat() * 0.2f * (rnd.nextBoolean()?1:-1);
- float posY = rnd.nextFloat() * 0.2f * (rnd.nextBoolean()?1:-1);
- float rotY = rnd.nextFloat() * 35f * (rnd.nextBoolean()?1:-1);
- float rotZ = rnd.nextFloat() * 35f * (rnd.nextBoolean()?1:-1);
- GL11.glTranslatef(-0.15F, 0.0F, 0.0F);
- GL11.glTranslatef(posX, posY, 0F);
- GL11.glRotatef(rotY, 0F, 1F, 0F);
- GL11.glRotatef(rotZ, 0F, 0F, 1F);
- GL11.glPushMatrix();
- this.mainModel.render(entity, x, y, z, rot1, rot2, rot3);
- GL11.glPopMatrix();
- }
- }
- }
-
- @Override
- protected void preRenderCallback(EntityLivingBase entity, float f)
- {
- preRenderCallbackHeart((EntityHeart)entity, f);
- }
-
- protected void preRenderCallbackHeart(EntityHeart entity, float f)
- {
- GL11.glScalef(0.4F, 0.4F, 0.4F);
- GL11.glRotatef(55F, 1F, 0F, 0F);
- String type = entity.getType();
- if (type == "" || type == null) type = "Red";
- texture = new ResourceLocation(Variables.MODID, "textures/entities/" + type + "Heart.png");
- }
-
- @Override
- protected ResourceLocation getEntityTexture(Entity par1Entity)
- {
- return texture;
- }
+public class HeartRender extends RenderLiving {
+ protected ResourceLocation texture;
+ Random rnd = new Random();
+
+ public HeartRender(ModelBase modelBase, float shadowSize) {
+ super(modelBase, shadowSize);
+ }
+
+ @Override
+ protected void renderModel(EntityLivingBase entity, float x, float y,
+ float z, float rot1, float rot2, float rot3) {
+ super.renderModel(entity, x, y, z, rot1, rot2, rot3);
+ rnd.setSeed(1542372345);
+ if (((EntityHeart) entity).getQuantity() > 2f) {
+ for (int i = 0; i < ((EntityHeart) entity).getQuantity() / 10f;
+ i++) {
+ float posX = rnd.nextFloat() * 0.2f
+ * (rnd.nextBoolean() ? 1 : -1);
+ float posY = rnd.nextFloat() * 0.2f
+ * (rnd.nextBoolean() ? 1 : -1);
+ float rotY = rnd.nextFloat() * 35f
+ * (rnd.nextBoolean() ? 1 : -1);
+ float rotZ = rnd.nextFloat() * 35f
+ * (rnd.nextBoolean() ? 1 : -1);
+ GL11.glTranslatef(-0.15F, 0.0F, 0.0F);
+ GL11.glTranslatef(posX, posY, 0F);
+ GL11.glRotatef(rotY, 0F, 1F, 0F);
+ GL11.glRotatef(rotZ, 0F, 0F, 1F);
+ GL11.glPushMatrix();
+ this.mainModel.render(entity, x, y, z, rot1, rot2, rot3);
+ GL11.glPopMatrix();
+ }
+ }
+ }
+
+ @Override
+ protected void preRenderCallback(EntityLivingBase entity, float f) {
+ preRenderCallbackHeart((EntityHeart) entity, f);
+ }
+
+ protected void preRenderCallbackHeart(EntityHeart entity, float f) {
+ GL11.glScalef(0.4F, 0.4F, 0.4F);
+ GL11.glRotatef(55F, 1F, 0F, 0F);
+ String type = entity.getType();
+ if (type == "" || type == null)
+ type = "Red";
+ texture = new ResourceLocation(Variables.MODID,
+ "textures/entities/" + type + "Heart.png");
+ }
+
+ @Override
+ protected ResourceLocation getEntityTexture(Entity par1Entity) {
+ return texture;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/entities/renders/RenderHelper.java b/src/main/java/darkknight/jewelrycraft/entities/renders/RenderHelper.java index 9fd3c62..8080251 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/entities/renders/RenderHelper.java +++ b/src/main/java/darkknight/jewelrycraft/entities/renders/RenderHelper.java @@ -1,23 +1,25 @@ package darkknight.jewelrycraft.entities.renders;
import org.lwjgl.opengl.GL11;
+
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
-public class RenderHelper
-{
- public static void rotateIfSneaking(EntityPlayer player)
- {
- if (player.isSneaking()) applySneakingRotation();
- }
-
- public static void applySneakingRotation()
- {
- GL11.glRotatef(28.64789F, 1.0F, 0.0F, 0.0F);
- }
-
- public static void translateToHeadLevel(EntityPlayer player)
- {
- GL11.glTranslated(0, (player != Minecraft.getMinecraft().thePlayer ? 1.62F : 0F) - player.getDefaultEyeHeight() + (player.isSneaking() ? 0.0625 : 0), 0);
- }
+public class RenderHelper {
+ public static void rotateIfSneaking(EntityPlayer player) {
+ if (player.isSneaking())
+ applySneakingRotation();
+ }
+
+ public static void applySneakingRotation() {
+ GL11.glRotatef(28.64789F, 1.0F, 0.0F, 0.0F);
+ }
+
+ public static void translateToHeadLevel(EntityPlayer player) {
+ GL11.glTranslated(0,
+ (player != Minecraft.getMinecraft().thePlayer ? 1.62F : 0F)
+ - player.getDefaultEyeHeight()
+ + (player.isSneaking() ? 0.0625 : 0),
+ 0);
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/events/BlockEventHandler.java b/src/main/java/darkknight/jewelrycraft/events/BlockEventHandler.java index 82af0de..fc4cacc 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/events/BlockEventHandler.java +++ b/src/main/java/darkknight/jewelrycraft/events/BlockEventHandler.java @@ -20,40 +20,53 @@ import net.minecraftforge.event.world.BlockEvent; /**
* @author Sorin
*/
-public class BlockEventHandler
-{
- @SubscribeEvent
- public void onBlockDestroyed(BlockEvent.BreakEvent event)
- {
- if (event.getPlayer() != null){
- ItemStack item = event.getPlayer().inventory.getCurrentItem();
- if (event.block instanceof BlockMidasTouch && item != null && item.getItem().getHarvestLevel(item, "pickaxe") >= event.block.getHarvestLevel(event.blockMetadata)){
- TileEntityMidasTouch te = (TileEntityMidasTouch)event.world.getTileEntity(event.x, event.y, event.z);
- if (te.target != null) dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, new ItemStack(Items.gold_nugget, (int)(te.target.width * te.target.height * 100), 0));
- }
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(event.getPlayer(), Variables.MODID);
- for(Curse curse: Curse.getCurseList())
- if (playerInfo.getInteger(curse.getName()) > 0) curse.onBlockDestroyed(event.getPlayer(), event);
- }
- }
-
- @SubscribeEvent
- public void onBlockItemsDrop(BlockEvent.HarvestDropsEvent event)
- {
- EntityPlayer player = event.harvester;
- if (player != null){
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- for(Curse curse: Curse.getCurseList())
- if (playerInfo.getInteger(curse.getName()) > 0) curse.onBlockItemsDrop(player, event);
- }
- }
-
- public void dropItem(World world, double x, double y, double z, ItemStack stack)
- {
- EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 0.5D, z + 0.5D, stack);
- entityitem.motionX = 0;
- entityitem.motionZ = 0;
- entityitem.motionY = 0.11000000298023224D;
- world.spawnEntityInWorld(entityitem);
- }
+public class BlockEventHandler {
+ @SubscribeEvent
+ public void onBlockDestroyed(BlockEvent.BreakEvent event) {
+ if (event.getPlayer() != null) {
+ ItemStack item = event.getPlayer().inventory.getCurrentItem();
+ if (event.block instanceof BlockMidasTouch && item != null
+ && item.getItem().getHarvestLevel(item,
+ "pickaxe") >= event.block.getHarvestLevel(
+ event.blockMetadata)) {
+ TileEntityMidasTouch te =
+ (TileEntityMidasTouch) event.world
+ .getTileEntity(event.x, event.y, event.z);
+ if (te.target != null)
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord,
+ te.zCoord,
+ new ItemStack(Items.gold_nugget,
+ (int) (te.target.width
+ * te.target.height * 100),
+ 0));
+ }
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(
+ event.getPlayer(), Variables.MODID);
+ for (Curse curse : Curse.getCurseList())
+ if (playerInfo.getInteger(curse.getName()) > 0)
+ curse.onBlockDestroyed(event.getPlayer(), event);
+ }
+ }
+
+ @SubscribeEvent
+ public void onBlockItemsDrop(BlockEvent.HarvestDropsEvent event) {
+ EntityPlayer player = event.harvester;
+ if (player != null) {
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(player, Variables.MODID);
+ for (Curse curse : Curse.getCurseList())
+ if (playerInfo.getInteger(curse.getName()) > 0)
+ curse.onBlockItemsDrop(player, event);
+ }
+ }
+
+ public void dropItem(World world, double x, double y, double z,
+ ItemStack stack) {
+ EntityItem entityitem =
+ new EntityItem(world, x + 0.5D, y + 0.5D, z + 0.5D, stack);
+ entityitem.motionX = 0;
+ entityitem.motionZ = 0;
+ entityitem.motionY = 0.11000000298023224D;
+ world.spawnEntityInWorld(entityitem);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/events/BucketHandler.java b/src/main/java/darkknight/jewelrycraft/events/BucketHandler.java index 9aae0d7..1b79a0b 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/events/BucketHandler.java +++ b/src/main/java/darkknight/jewelrycraft/events/BucketHandler.java @@ -1,14 +1,15 @@ /**
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
*
- * BuildCraft is distributed under the terms of the Minecraft Mod Public License
- * 1.0, or MMPL. Please check the contents of the license located in
- * http://www.mod-buildcraft.com/MMPL-1.0.txt
+ * BuildCraft is distributed under the terms of the Minecraft Mod Public
+ * License 1.0, or MMPL. Please check the contents of the license located
+ * in http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package darkknight.jewelrycraft.events;
import java.util.HashMap;
import java.util.Map;
+
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import darkknight.jewelrycraft.block.BlockMoltenMetal;
@@ -21,32 +22,42 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.FillBucketEvent;
-public class BucketHandler
-{
- public static BucketHandler INSTANCE = new BucketHandler();
- public Map<Block, Item> buckets = new HashMap<Block, Item>();
-
- private BucketHandler()
- {}
-
- @SubscribeEvent
- public void onBucketFill(FillBucketEvent event)
- {
- ItemStack result = fillCustomBucket(event.world, event.target);
- if (result == null) return;
- event.result = result;
- event.setResult(Result.ALLOW);
- }
-
- private ItemStack fillCustomBucket(World world, MovingObjectPosition pos)
- {
- Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ);
- Item bucket = buckets.get(block);
- if (bucket != null && world.getBlock(pos.blockX, pos.blockY, pos.blockZ) != Blocks.air && world.getBlock(pos.blockX, pos.blockY, pos.blockZ) instanceof BlockMoltenMetal){
- ItemStack item = new ItemStack(bucket);
- if(BlockMoltenMetal.getTileEntity(world, pos.blockX, pos.blockY, pos.blockZ) != null) JewelryNBT.addMetal(item, BlockMoltenMetal.getTileEntity(world, pos.blockX, pos.blockY, pos.blockZ).getMetal());
- world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ);
- return item;
- }else return null;
- }
+public class BucketHandler {
+ public static BucketHandler INSTANCE = new BucketHandler();
+ public Map<Block, Item> buckets = new HashMap<Block, Item>();
+
+ private BucketHandler() {
+ }
+
+ @SubscribeEvent
+ public void onBucketFill(FillBucketEvent event) {
+ ItemStack result = fillCustomBucket(event.world, event.target);
+ if (result == null)
+ return;
+ event.result = result;
+ event.setResult(Result.ALLOW);
+ }
+
+ private ItemStack fillCustomBucket(World world,
+ MovingObjectPosition pos) {
+ Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ);
+ Item bucket = buckets.get(block);
+ if (bucket != null
+ && world.getBlock(pos.blockX, pos.blockY,
+ pos.blockZ) != Blocks.air
+ && world.getBlock(pos.blockX, pos.blockY,
+ pos.blockZ) instanceof BlockMoltenMetal) {
+ ItemStack item = new ItemStack(bucket);
+ if (BlockMoltenMetal.getTileEntity(world, pos.blockX,
+ pos.blockY, pos.blockZ) != null)
+ JewelryNBT.addMetal(item,
+ BlockMoltenMetal
+ .getTileEntity(world, pos.blockX,
+ pos.blockY, pos.blockZ)
+ .getMetal());
+ world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ);
+ return item;
+ } else
+ return null;
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java b/src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java index 9d9a3bd..6806f65 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java +++ b/src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java @@ -46,345 +46,723 @@ import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
+import net.minecraftforge.event.entity.living.LivingHealEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
+import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent;
-public class EntityEventHandler{
-
- int updateTime = 0, totalUnavailableCurses = 0, luck = 0;
- boolean addedCurses = false;
- public static Random rand = new Random();
- public static ArrayList<String> types = new ArrayList<String>();
-
- @SubscribeEvent
- public void onEntityJoinWorld(EntityJoinWorldEvent event) {
- if (event.entity instanceof EntityPlayer && !(event.entity instanceof EntityPlayerMP)) JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
- final Entity entity = event.entity;
- if (!event.world.isRemote && entity instanceof EntityPlayer) {
- EntityPlayer player = (EntityPlayer)entity;
- NBTTagCompound persistTag = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- boolean shouldGiveManual = ItemList.guide != null && !persistTag.getBoolean("givenGuide");
- if (shouldGiveManual) {
- ItemStack manual = new ItemStack(ItemList.guide);
- if (!player.inventory.addItemStackToInventory(manual)) BlockUtils.dropItemStackInWorld(player.worldObj, player.posX, player.posY, player.posZ, manual);
- persistTag.setBoolean("givenGuide", true);
- }
- boolean render = persistTag.getBoolean("fancyRender");
- JewelrycraftMod.fancyRender = render;
- if (ConfigHandler.CURSES_ENABLED) for(Curse curse: Curse.getCurseList())
- if (curse.canCurseBeActivated(event.world) && !persistTag.hasKey(curse.getName())) persistTag.setInteger(curse.getName(), 0);
- for(Curse curse: Curse.getCurseList())
- if (!curse.canCurseBeActivated(event.world)) {
- Curse.availableCurses.remove(curse);
- persistTag.setInteger(curse.getName(), 0);
- totalUnavailableCurses++;
- }else if (!Curse.availableCurses.contains(curse)) Curse.availableCurses.add(curse);
- persistTag.setBoolean("sendInfo", true);
- luck = calculateLuck((EntityPlayer)entity);
- }
- if (ConfigHandler.CAN_RED_HEARTS_SPAWN) types.add("Red");
- if (ConfigHandler.CAN_BLUE_HEARTS_SPAWN) types.add("Blue");
- if (ConfigHandler.CAN_HOLY_HEARTS_SPAWN) types.add("White");
- if (ConfigHandler.CAN_BLACK_HEARTS_SPAWN) types.add("Black");
- }
-
- /**
- * @param event
- */
- @SubscribeEvent
- public void onEntityUpdate(LivingUpdateEvent event) {
- Entity entity = event.entity;
- EntityLivingBase entityLiving = event.entityLiving;
- for(PotionBase potion: PotionBase.getPotionList())
- if (entityLiving.isPotionActive(potion)) potion.action(entityLiving);
- if (entity instanceof EntityPlayer) {
- EntityPlayer player = (EntityPlayer)entity;
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- playerInfo.setBoolean("fancyRender", JewelrycraftMod.fancyRender);
- if (updateTime > 0) updateTime--;
- for(int i = 0; i < 18; i++)
- if (getJewelryItems(playerInfo, i) != null) {
- if (getJewelryItems(playerInfo, i).getItem() instanceof ItemBaseJewelry) ((ItemBaseJewelry)getJewelryItems(playerInfo, i).getItem()).action(getJewelryItems(playerInfo, i), player);
- if (getJewelryItems(playerInfo, i).getItem() instanceof IJewelryItem) ((IJewelryItem)getJewelryItems(playerInfo, i).getItem()).onWearAction(getJewelryItems(playerInfo, i), player);
- }
- if (!player.worldObj.isRemote) {
- timeUntilYouCanResetCurses(playerInfo);
- updateCurses(playerInfo, player);
- if (updateTime == 0) {
- JewelrycraftMod.netWrapper.sendToAll(new PacketSendServerPlayersInfo());
- updateTime = 200;
- }
- if (ConfigHandler.CURSES_ENABLED) for(Curse curse: Curse.getCurseList())
- if (curse.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(curse.getName()) > 0) curse.action(player.worldObj, player);
- }
- }
- }
-
- public void updateCurses(NBTTagCompound playerInfo, EntityPlayer player) {
- if (playerInfo.hasKey("playerCursePointsChanged") && playerInfo.getBoolean("playerCursePointsChanged")) {
- int points = playerInfo.getInteger("cursePoints");
- int maxCurses = playerInfo.getInteger("cursePoints") / Variables.CURSE_POINTS_PER_LEVEL + 1;
- if (points > 0 && playerInfo.getInteger("activeCurses") < maxCurses) while (playerInfo.getInteger("activeCurses") < maxCurses && Curse.availableCurses.size() > 0 && playerInfo.getInteger("activeCurses") < Curse.getCurseList().size())
- addCurse(player, playerInfo);
- if (!playerInfo.hasKey("curseTime") || !playerInfo.hasKey("reselectCurses") || playerInfo.getBoolean("reselectCurses")) {
- playerInfo.setInteger("curseTime", 23000);
- playerInfo.setBoolean("reselectCurses", false);
- }
- JewelrycraftMod.netWrapper.sendTo(new PacketSendClientPlayerInfo(playerInfo), (EntityPlayerMP)player);
- if (addedCurses) {
- JewelrycraftMod.netWrapper.sendToAll(new PacketSendServerPlayersInfo());
- player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("curse." + Variables.MODID + ".activated")));
- addedCurses = false;
- }
- }
- if (playerInfo.getBoolean("playerCursePointsChanged")) playerInfo.setBoolean("playerCursePointsChanged", false);
- luck = calculateLuck(player);
- }
-
- public void timeUntilYouCanResetCurses(NBTTagCompound playerInfo) {
- if (playerInfo.hasKey("reselectCurses") && !playerInfo.getBoolean("reselectCurses")) {
- playerInfo.setInteger("curseTime", playerInfo.getInteger("curseTime") - 10000);
- if (playerInfo.getInteger("curseTime") <= 0) playerInfo.setBoolean("reselectCurses", true);
- }
- }
-
- public ItemStack getJewelryItems(NBTTagCompound playerInfo, int i) {
- if (playerInfo.hasKey("ext" + i)) {
- NBTTagCompound nbt = (NBTTagCompound)playerInfo.getTag("ext" + i);
- ItemStack item = ItemStack.loadItemStackFromNBT(nbt);
- if (item != null) return item;
- }
- return null;
- }
-
- @SubscribeEvent
- public void onEntityLivingDropItems(LivingDropsEvent event) {
- if (event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) {
- EntityPlayer player = (EntityPlayer)event.source.getEntity();
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- if (ConfigHandler.CURSES_ENABLED) for(Curse curse: Curse.getCurseList())
- if (curse.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(curse.getName()) > 0) curse.entityDropItems(player, event.entityLiving, event.drops);
- }
- }
-
- @SubscribeEvent
- public void onEntityAttacked(LivingAttackEvent event) {
- EntityLivingBase entity = event.entityLiving;
- if (event.source.getEntity() != null && event.source.getEntity() instanceof EntityLivingBase && ((EntityLivingBase)event.source.getEntity()).isPotionActive(PotionList.stun)) event.setCanceled(true);
- if (entity instanceof EntityPlayer) {
- EntityPlayer player = (EntityPlayer)entity;
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- if (!(event.source.getEntity() instanceof EntityPlayer) && !player.capabilities.isCreativeMode) {
- if (!player.worldObj.isRemote) for(int i = 0; i < 18; i++)
- if (getJewelryItems(playerInfo, i) != null) {
- if (getJewelryItems(playerInfo, i).getItem() instanceof ItemBaseJewelry) {
- ((ItemBaseJewelry)getJewelryItems(playerInfo, i).getItem()).onPlayerAttacked(getJewelryItems(playerInfo, i), player, event.source, event.ammount);
- if (((ItemBaseJewelry)getJewelryItems(playerInfo, i).getItem()).onPlayerAttackedCacellable(getJewelryItems(playerInfo, i), player, event.source, event.ammount)) event.setCanceled(true);
- }
- if (getJewelryItems(playerInfo, i).getItem() instanceof IJewelryItem) ((IJewelryItem)getJewelryItems(playerInfo, i).getItem()).onPlayerAttackedAction(getJewelryItems(playerInfo, i), player, event.source, event.ammount);
- }
- if (ConfigHandler.CURSES_ENABLED) for(Curse curse: Curse.getCurseList())
- if (curse.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(curse.getName()) > 0) curse.attackedAction(player.worldObj, player);
- }
- removeHearts(event, player, playerInfo);
- JewelrycraftMod.netWrapper.sendToAll(new PacketSendServerPlayersInfo());
- JewelrycraftMod.netWrapper.sendTo(new PacketSendClientPlayerInfo(playerInfo), (EntityPlayerMP)player);
- }
- if (event.source.getEntity() instanceof EntityPlayer) {
- EntityPlayer player = (EntityPlayer)event.source.getEntity();
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- for(int i = 0; i < 18; i++)
- if (getJewelryItems(playerInfo, i) != null) {
- if (getJewelryItems(playerInfo, i).getItem() instanceof ItemBaseJewelry) {
- ((ItemBaseJewelry)getJewelryItems(playerInfo, i).getItem()).onEntityAttacked(getJewelryItems(playerInfo, i), player, entity, event.ammount);
- if (((ItemBaseJewelry)getJewelryItems(playerInfo, i).getItem()).onEntityAttackedCacellable(getJewelryItems(playerInfo, i), player, entity, event.ammount)) event.setCanceled(true);
- }
- if (getJewelryItems(playerInfo, i).getItem() instanceof IJewelryItem) ((IJewelryItem)getJewelryItems(playerInfo, i).getItem()).onEntityAttackedByPlayer(getJewelryItems(playerInfo, i), player, entity, event.ammount);
- }
- if (ConfigHandler.CURSES_ENABLED) for(Curse curse: Curse.getCurseList())
- if (curse.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(curse.getName()) > 0) {
- curse.attackedByPlayerAction(event, entity.worldObj, player, entity);
- if (curse.attackedByPlayerActionCancelable(event, player.worldObj, player, entity)) event.setCanceled(true);
- }
- if (entity instanceof EntityHeart && entity.getAge() < 30) event.setCanceled(true);
- if (event.source.getEntity() instanceof EntityPlayerMP) {
- JewelrycraftMod.netWrapper.sendToAll(new PacketSendServerPlayersInfo());
- JewelrycraftMod.netWrapper.sendTo(new PacketSendClientPlayerInfo(playerInfo), (EntityPlayerMP)player);
- }
- }
- }
-
- public void removeHearts(LivingAttackEvent event, EntityPlayer player, NBTTagCompound playerInfo) {
- if (!player.worldObj.isRemote && !player.capabilities.isCreativeMode && (float)player.hurtResistantTime <= (float)player.maxHurtResistantTime / 2.0F) {
- if (playerInfo.getFloat("WhiteHeart") > 0) {
- playerInfo.setFloat("WhiteHeart", 0f);
- }
- if (playerInfo.getFloat("BlueHeart") > 0) {
- float damage = playerInfo.getFloat("BlueHeart") - event.ammount;
- if (damage >= 0) playerInfo.setFloat("BlueHeart", damage);
- else playerInfo.setFloat("BlueHeart", 0f);
- if (damage < 0) {
- System.out.println(damage);
- player.attackEntityFrom(event.source, Math.abs(damage));
- }
- player.hurtResistantTime = player.maxHurtResistantTime;
- player.hurtTime = player.maxHurtTime = 10;
- player.worldObj.playSoundAtEntity(player, "game.player.hurt", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
- event.setCanceled(true);
- }else if (playerInfo.getFloat("BlackHeart") > 0) {
- AxisAlignedBB axisalignedbb = player.boundingBox.expand(6.0D, 6.0D, 6.0D);
- List enemies = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, axisalignedbb, EntitySelector.selectMonsters);
- if (enemies != null && !enemies.isEmpty() && event.source != DamageSourceList.blackHeart) {
- Iterator iterator = enemies.iterator();
- while (iterator.hasNext()){
- Entity enemy = (Entity)iterator.next();
- enemy.attackEntityFrom(DamageSourceList.blackHeart, 6f);
- }
- }
- float damage = playerInfo.getFloat("BlackHeart") - event.ammount;
- if (damage >= 0) playerInfo.setFloat("BlackHeart", damage);
- else playerInfo.setFloat("BlackHeart", 0f);
- if (damage < 0) player.attackEntityFrom(event.source, Math.abs(damage));
- player.hurtResistantTime = player.maxHurtResistantTime;
- player.hurtTime = player.maxHurtTime = 10;
- player.worldObj.playSoundAtEntity(player, "game.player.hurt", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
- event.setCanceled(true);
- }
- }
- }
-
- @SubscribeEvent
- public void onPlayerRespawn(PlayerEvent.Clone event) {
- EntityPlayer player = event.entityPlayer;
- if (!player.worldObj.isRemote) {
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- if (playerInfo.hasKey("cursePoints")) {
- int points = playerInfo.getInteger("cursePoints");
- int maxCurses = playerInfo.getInteger("cursePoints") / Variables.CURSE_POINTS_PER_LEVEL + 1;
- if (points > 0 && playerInfo.getInteger("activeCurses") < maxCurses) while (playerInfo.getInteger("activeCurses") < maxCurses && Curse.availableCurses.size() > 0 && playerInfo.getInteger("activeCurses") < Curse.getCurseList().size())
- addCurse(player, playerInfo);
- if (!playerInfo.hasKey("curseTime") || !playerInfo.hasKey("reselectCurses") || playerInfo.getBoolean("reselectCurses")) {
- playerInfo.setInteger("curseTime", 23000);
- playerInfo.setBoolean("reselectCurses", false);
- }
- }
- playerInfo.setFloat("BlueHeart", 0f);
- playerInfo.setFloat("BlackHeart", 0f);
- playerInfo.setFloat("WhiteHeart", 0f);
- if (ConfigHandler.CURSES_ENABLED) for(Curse curse: Curse.getCurseList())
- if (curse.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(curse.getName()) > 0) curse.respawnAction(player.worldObj, player);
- for(int i = 0; i < 18; i++)
- if (getJewelryItems(playerInfo, i) != null) {
- if (getJewelryItems(playerInfo, i).getItem() instanceof ItemBaseJewelry) ((ItemBaseJewelry)getJewelryItems(playerInfo, i).getItem()).onPlayerRespawn(getJewelryItems(playerInfo, i), event);
- if (getJewelryItems(playerInfo, i).getItem() instanceof IJewelryItem) ((IJewelryItem)getJewelryItems(playerInfo, i).getItem()).onPlayerRespawnAction(getJewelryItems(playerInfo, i), event);
- }
- JewelrycraftMod.netWrapper.sendTo(new PacketSendClientPlayerInfo(playerInfo), (EntityPlayerMP)player);
- if (addedCurses) {
- JewelrycraftMod.netWrapper.sendToAll(new PacketSendServerPlayersInfo());
- addedCurses = false;
- }
- }
- }
-
- public void addCurse(EntityPlayer player, NBTTagCompound playerInfo) {
- if (ConfigHandler.CURSES_ENABLED && Curse.availableCurses.size() > 0) {
- Curse cur = ((WeightedRandomCurse)WeightedRandom.getRandomItem(rand, JewelrycraftUtil.getCurses(player.worldObj, player, rand))).getCurse(rand);
- playerInfo.setInteger(cur.getName(), 1);
- Curse.availableCurses.remove(cur);
- addedCurses = true;
- if (playerInfo.getInteger("activeCurses") == 0) playerInfo.setInteger("activeCurses", 1);
- else playerInfo.setInteger("activeCurses", playerInfo.getInteger("activeCurses") + 1);
- JewelrycraftMod.netWrapper.sendToAll(new PacketSendServerPlayersInfo());
- JewelrycraftMod.netWrapper.sendTo(new PacketSendClientPlayerInfo(playerInfo), (EntityPlayerMP)player);
- }
- }
-
- @SubscribeEvent
- public void itemToss(ItemTossEvent event) {
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(event.player, Variables.MODID);
- if (ConfigHandler.CURSES_ENABLED) for(Curse curse: Curse.getCurseList())
- if (event.player != null && curse.canCurseBeActivated(event.player.worldObj) && playerInfo.getInteger(curse.getName()) > 0 && curse.itemToss()) {
- EntityItem entityitem = new EntityItem(event.player.worldObj, event.player.posX + 0.5D, event.player.posY + 0.5D, event.player.posZ + 0.5D, event.entityItem.getEntityItem());
- if (entityitem != null) {
- entityitem.motionX = 0;
- entityitem.motionZ = 0;
- entityitem.motionY = 0.11000000298023224D;
- event.player.worldObj.spawnEntityInWorld(entityitem);
- MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("<" + event.player.getDisplayName() + "> I shouldn't drop this. I might need it later."));
- event.setCanceled(true);
- }
- }
- }
-
- @SubscribeEvent
- public void playerFileSave(PlayerEvent.SaveToFile event) {
- if (event.entity instanceof EntityPlayer && !(event.entity instanceof EntityPlayerMP)) JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
- }
-
- public int calculateLuck(EntityPlayer player) {
- int luck = 0;
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- if (ConfigHandler.CURSES_ENABLED) for(Curse curse: Curse.getCurseList())
- if (curse.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(curse.getName()) > 0) luck += curse.luck();
- return luck;
- }
-
- public static void spawnHearts(Entity entity, int chance) {
- EntityLiving live = (EntityLiving)entity;
- String type = types.get(rand.nextInt(types.size()));
- if (rand.nextInt(chance) == 0 && live.getCreatureAttribute() != JewelrycraftUtil.HEART) {
- if (type == "White") {
- EntityHeart h = new EntityHalfHeart(live.worldObj);
- h.setType(type);
- h.setLocationAndAngles(live.posX, live.posY, live.posZ, MathHelper.wrapAngleTo180_float(rand.nextFloat() * 360.0F), 0.0F);
- live.worldObj.spawnEntityInWorld(h);
- }else{
- for(int i = 1; i <= 1 + rand.nextInt(1 + (int)(live.getMaxHealth() / 2)); i++){
- EntityHeart[] hearts = {new EntityHeart(live.worldObj), new EntityHalfHeart(entity.worldObj)};
- EntityHeart h = hearts[rand.nextInt(2)];
- h.setType(type);
- h.setLocationAndAngles(live.posX, live.posY, live.posZ, MathHelper.wrapAngleTo180_float(rand.nextFloat() * 360.0F), 0.0F);
- live.worldObj.spawnEntityInWorld(h);
- }
- }
- }
- }
-
- @SubscribeEvent
- public void onEntityDead(LivingDeathEvent event) {
- final Entity entity = event.entity;
- if (!entity.worldObj.isRemote && !(entity instanceof EntityPlayer) && entity instanceof EntityLiving && event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) {
- System.out.println(luck);
- spawnHearts(entity, Math.max(2, 20 - luck));
- EntityPlayer player = (EntityPlayer)event.source.getEntity();
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- if (ConfigHandler.CURSES_ENABLED) for(Curse curse: Curse.getCurseList())
- if (curse.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(curse.getName()) > 0) curse.entityDeathAction(player.worldObj, event.entityLiving, player);
- }
- if (entity instanceof EntityPlayer) {
- EntityPlayer player = (EntityPlayer)entity;
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- playerInfo.setFloat("BlueHeart", 0f);
- playerInfo.setFloat("BlackHeart", 0f);
- playerInfo.setFloat("WhiteHeart", 0f);
- if (playerInfo.hasKey("reselectCurses") && playerInfo.getBoolean("reselectCurses")) {
- playerInfo.setInteger("activeCurses", 0);
- if (ConfigHandler.CURSES_ENABLED) for(Curse l: Curse.getCurseList()){
- if (l.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(l.getName()) == 1) {
- playerInfo.setInteger(l.getName(), 0);
- l.setTicksActive(0);
- if (!Curse.availableCurses.contains(l)) Curse.availableCurses.add(l);
- }else if (l.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(l.getName()) >= 2) playerInfo.setInteger(l.getName(), 1);
- }
- if (entity.worldObj.isRemote) JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
- }
- if (ConfigHandler.CURSES_ENABLED) for(Curse curse: Curse.getCurseList())
- if (curse.canCurseBeActivated(player.worldObj) && playerInfo.getInteger(curse.getName()) > 0) curse.playerDeathAction(player.worldObj, player);
- for(int i = 0; i < 18; i++)
- if (getJewelryItems(playerInfo, i) != null) {
- if (getJewelryItems(playerInfo, i).getItem() instanceof ItemBaseJewelry) ((ItemBaseJewelry)getJewelryItems(playerInfo, i).getItem()).onPlayerDead(getJewelryItems(playerInfo, i), player, event.source);
- if (getJewelryItems(playerInfo, i).getItem() instanceof IJewelryItem) ((IJewelryItem)getJewelryItems(playerInfo, i).getItem()).onPlayerDeadAction(getJewelryItems(playerInfo, i), player, event.source);
- }
- }
- if (event.entity instanceof EntityPlayer && !(event.entity instanceof EntityPlayerMP)) JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
- }
-}
+public class EntityEventHandler {
+ int updateTime = 0,
+ totalUnavailableCurses = 0, luck = 0;
+
+ boolean addedCurses = false;
+
+ public static Random rand = new Random();
+
+ public static ArrayList<String> types = new ArrayList<String>();
+
+ @SubscribeEvent
+ public void onEntityJoinWorld(EntityJoinWorldEvent event) {
+ if (event.entity instanceof EntityPlayer
+ && !(event.entity instanceof EntityPlayerMP)) {
+ JewelrycraftMod.netWrapper
+ .sendToServer(new PacketRequestPlayerInfo());
+ }
+
+ final Entity entity = event.entity;
+
+ if (!event.world.isRemote && entity instanceof EntityPlayer) {
+ EntityPlayer player = (EntityPlayer) entity;
+
+ NBTTagCompound persistTag = PlayerUtils
+ .getModPlayerPersistTag(player, Variables.MODID);
+
+ boolean shouldGiveManual = ItemList.guide != null
+ && !persistTag.getBoolean("givenGuide");
+
+ if (shouldGiveManual) {
+ ItemStack manual = new ItemStack(ItemList.guide);
+
+ if (!player.inventory.addItemStackToInventory(manual)) {
+ BlockUtils.dropItemStackInWorld(player.worldObj,
+ player.posX, player.posY, player.posZ, manual);
+ }
+
+ persistTag.setBoolean("givenGuide", true);
+ }
+
+ boolean render = persistTag.getBoolean("fancyRender");
+
+ JewelrycraftMod.fancyRender = render;
+
+ if (ConfigHandler.CURSES_ENABLED) {
+ for (Curse curse : Curse.getCurseList()) {
+ if (curse.canCurseBeActivated(event.world)
+ && !persistTag.hasKey(curse.getName())) {
+ persistTag.setInteger(curse.getName(), 0);
+ }
+ }
+ }
+
+ for (Curse curse : Curse.getCurseList()) {
+ if (!curse.canCurseBeActivated(event.world)) {
+ Curse.availableCurses.remove(curse);
+ persistTag.setInteger(curse.getName(), 0);
+ totalUnavailableCurses++;
+ } else if (!Curse.availableCurses.contains(curse))
+ Curse.availableCurses.add(curse);
+ }
+
+ persistTag.setBoolean("sendInfo", true);
+ luck = calculateLuck((EntityPlayer) entity);
+ }
+
+ if (ConfigHandler.CAN_RED_HEARTS_SPAWN) {
+ types.add("Red");
+ }
+
+ if (ConfigHandler.CAN_BLUE_HEARTS_SPAWN) {
+ types.add("Blue");
+ }
+
+ if (ConfigHandler.CAN_HOLY_HEARTS_SPAWN) {
+ types.add("White");
+ }
+
+ if (ConfigHandler.CAN_BLACK_HEARTS_SPAWN) {
+ types.add("Black");
+ }
+ }
+
+ /**
+ * @param event
+ */
+ @SubscribeEvent
+ public void onEntityUpdate(LivingUpdateEvent event) {
+ Entity entity = event.entity;
+ EntityLivingBase entityLiving = event.entityLiving;
+
+ for (PotionBase potion : PotionBase.getPotionList()) {
+ if (entityLiving.isPotionActive(potion)) {
+ potion.action(entityLiving);
+ }
+ }
+
+ if (entity instanceof EntityPlayer) {
+ EntityPlayer player = (EntityPlayer) entity;
+
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(player, Variables.MODID);
+
+ playerInfo.setBoolean("fancyRender",
+ JewelrycraftMod.fancyRender);
+
+ if (updateTime > 0) {
+ updateTime--;
+ }
+
+ for (int i = 0; i < 18; i++) {
+ if (getJewelryItems(playerInfo, i) != null) {
+ if (getJewelryItems(playerInfo, i)
+ .getItem() instanceof ItemBaseJewelry) {
+ ((ItemBaseJewelry) getJewelryItems(playerInfo, i)
+ .getItem()).action(
+ getJewelryItems(playerInfo, i),
+ player);
+ }
+
+ if (getJewelryItems(playerInfo, i)
+ .getItem() instanceof IJewelryItem) {
+ ((IJewelryItem) getJewelryItems(playerInfo, i)
+ .getItem()).onWearAction(
+ getJewelryItems(playerInfo, i),
+ player);
+ }
+ }
+ }
+
+ if (!player.worldObj.isRemote) {
+ timeUntilYouCanResetCurses(playerInfo);
+ updateCurses(playerInfo, player);
+
+ if (updateTime == 0) {
+ JewelrycraftMod.netWrapper
+ .sendToAll(new PacketSendServerPlayersInfo());
+ updateTime = 200;
+ }
+
+ if (ConfigHandler.CURSES_ENABLED) {
+ for (Curse curse : Curse.getCurseList()) {
+ if (curse.canCurseBeActivated(player.worldObj)
+ && playerInfo
+ .getInteger(curse.getName()) > 0) {
+ curse.action(player.worldObj, player);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public void updateCurses(NBTTagCompound playerInfo,
+ EntityPlayer player) {
+ if (playerInfo.hasKey("playerCursePointsChanged")
+ && playerInfo.getBoolean("playerCursePointsChanged")) {
+ int points = playerInfo.getInteger("cursePoints");
+ int maxCurses = playerInfo.getInteger("cursePoints")
+ / Variables.CURSE_POINTS_PER_LEVEL + 1;
+
+ if (points > 0
+ && playerInfo.getInteger("activeCurses") < maxCurses) {
+ while (playerInfo.getInteger("activeCurses") < maxCurses
+ && Curse.availableCurses.size() > 0
+ && playerInfo.getInteger("activeCurses") < Curse
+ .getCurseList().size()) {
+ addCurse(player, playerInfo);
+ }
+ }
+
+ if (!playerInfo.hasKey("curseTime")
+ || !playerInfo.hasKey("reselectCurses")
+ || playerInfo.getBoolean("reselectCurses")) {
+ playerInfo.setInteger("curseTime", 23000);
+ playerInfo.setBoolean("reselectCurses", false);
+ }
+
+ JewelrycraftMod.netWrapper.sendTo(
+ new PacketSendClientPlayerInfo(playerInfo),
+ (EntityPlayerMP) player);
+
+ if (addedCurses) {
+ JewelrycraftMod.netWrapper
+ .sendToAll(new PacketSendServerPlayersInfo());
+ player.addChatMessage(new ChatComponentText(
+ StatCollector.translateToLocal("curse."
+ + Variables.MODID + ".activated")));
+ addedCurses = false;
+ }
+ }
+
+ if (playerInfo.getBoolean("playerCursePointsChanged")) {
+ playerInfo.setBoolean("playerCursePointsChanged", false);
+ }
+
+ luck = calculateLuck(player);
+ }
+
+ public void timeUntilYouCanResetCurses(NBTTagCompound playerInfo) {
+ if (playerInfo.hasKey("reselectCurses")
+ && !playerInfo.getBoolean("reselectCurses")) {
+ playerInfo.setInteger("curseTime",
+ playerInfo.getInteger("curseTime") - 10000);
+
+ if (playerInfo.getInteger("curseTime") <= 0)
+ playerInfo.setBoolean("reselectCurses", true);
+ }
+ }
+
+ public ItemStack getJewelryItems(NBTTagCompound playerInfo, int i) {
+ if (playerInfo.hasKey("ext" + i)) {
+ NBTTagCompound nbt = (NBTTagCompound) playerInfo
+ .getTag("ext" + i);
+
+ ItemStack item = ItemStack.loadItemStackFromNBT(nbt);
+
+ if (item != null) {
+ return item;
+ }
+ }
+
+ return null;
+ }
+
+ @SubscribeEvent
+ public void onEntityLivingDropItems(LivingDropsEvent event) {
+ if (event.source.getEntity() != null
+ && event.source.getEntity() instanceof EntityPlayer) {
+ EntityPlayer player = (EntityPlayer) event.source.getEntity();
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(player, Variables.MODID);
+ if (ConfigHandler.CURSES_ENABLED)
+ for (Curse curse : Curse.getCurseList())
+ if (curse.canCurseBeActivated(player.worldObj)
+ && playerInfo.getInteger(curse.getName()) > 0)
+ curse.entityDropItems(player, event.entityLiving,
+ event.drops);
+ }
+ }
+
+ @SubscribeEvent
+ public void onEntityAttacked(LivingAttackEvent event) {
+ EntityLivingBase entity = event.entityLiving;
+
+ if (event.source.getEntity() != null
+ && event.source.getEntity() instanceof EntityLivingBase
+ && ((EntityLivingBase) event.source.getEntity())
+ .isPotionActive(PotionList.stun))
+ event.setCanceled(true);
+ if (entity instanceof EntityPlayer) {
+ EntityPlayer player = (EntityPlayer) entity;
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(player, Variables.MODID);
+
+ if (!(event.source.getEntity() instanceof EntityPlayer)
+ && !player.capabilities.isCreativeMode) {
+ if (!player.worldObj.isRemote)
+ for (int i = 0; i < 18; i++)
+ if (getJewelryItems(playerInfo, i) != null) {
+ if (getJewelryItems(playerInfo, i)
+ .getItem() instanceof ItemBaseJewelry) {
+ ((ItemBaseJewelry) getJewelryItems(
+ playerInfo, i).getItem())
+ .onPlayerAttacked(
+ getJewelryItems(
+ playerInfo,
+ i),
+ player,
+ event.source,
+ event.ammount);
+
+ if (((ItemBaseJewelry) getJewelryItems(
+ playerInfo, i).getItem())
+ .onPlayerAttackedCacellable(
+ getJewelryItems(
+ playerInfo,
+ i),
+ player,
+ event.source,
+ event.ammount)) {
+ event.setCanceled(true);
+ }
+ }
+
+ if (getJewelryItems(playerInfo, i)
+ .getItem() instanceof IJewelryItem) {
+ ((IJewelryItem) getJewelryItems(playerInfo,
+ i).getItem())
+ .onPlayerAttackedAction(
+ getJewelryItems(
+ playerInfo,
+ i),
+ player,
+ event.source,
+ event.ammount);
+ }
+ }
+
+ if (ConfigHandler.CURSES_ENABLED) {
+ for (Curse curse : Curse.getCurseList()) {
+ if (curse.canCurseBeActivated(player.worldObj)
+ && playerInfo
+ .getInteger(curse.getName()) > 0) {
+ curse.attackedAction(player.worldObj, player,
+ event, event.source.getEntity());
+ }
+ }
+ }
+ }
+
+ removeHearts(event, player, playerInfo);
+ JewelrycraftMod.netWrapper
+ .sendToAll(new PacketSendServerPlayersInfo());
+ JewelrycraftMod.netWrapper.sendTo(
+ new PacketSendClientPlayerInfo(playerInfo),
+ (EntityPlayerMP) player);
+ }
+
+ if (event.source.getEntity() instanceof EntityPlayer) {
+ EntityPlayer player = (EntityPlayer) event.source.getEntity();
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(player, Variables.MODID);
+ for (int i = 0; i < 18; i++)
+ if (getJewelryItems(playerInfo, i) != null) {
+ if (getJewelryItems(playerInfo, i)
+ .getItem() instanceof ItemBaseJewelry) {
+ ((ItemBaseJewelry) getJewelryItems(playerInfo, i)
+ .getItem()).onEntityAttacked(
+ getJewelryItems(playerInfo, i),
+ player, entity, event.ammount);
+ if (((ItemBaseJewelry) getJewelryItems(playerInfo,
+ i).getItem()).onEntityAttackedCacellable(
+ getJewelryItems(playerInfo, i),
+ player, entity, event.ammount))
+ event.setCanceled(true);
+ }
+ if (getJewelryItems(playerInfo, i)
+ .getItem() instanceof IJewelryItem)
+ ((IJewelryItem) getJewelryItems(playerInfo, i)
+ .getItem()).onEntityAttackedByPlayer(
+ getJewelryItems(playerInfo, i),
+ player, entity, event.ammount);
+ }
+ if (ConfigHandler.CURSES_ENABLED)
+ for (Curse curse : Curse.getCurseList())
+ if (curse.canCurseBeActivated(player.worldObj)
+ && playerInfo
+ .getInteger(curse.getName()) > 0) {
+ curse.attackedByPlayerAction(event,
+ entity.worldObj, player, entity);
+ if (curse.attackedByPlayerActionCancelable(event,
+ player.worldObj, player, entity))
+ event.setCanceled(true);
+ }
+ if (entity instanceof EntityHeart && entity.getAge() < 30)
+ event.setCanceled(true);
+ if (event.source.getEntity() instanceof EntityPlayerMP) {
+ JewelrycraftMod.netWrapper
+ .sendToAll(new PacketSendServerPlayersInfo());
+ JewelrycraftMod.netWrapper.sendTo(
+ new PacketSendClientPlayerInfo(playerInfo),
+ (EntityPlayerMP) player);
+ }
+ }
+ }
+
+ public void removeHearts(LivingAttackEvent event, EntityPlayer player,
+ NBTTagCompound playerInfo) {
+ if (!player.worldObj.isRemote
+ && !player.capabilities.isCreativeMode
+ && (float) player.hurtResistantTime <= (float) player.maxHurtResistantTime
+ / 2.0F) {
+ if (playerInfo.getFloat("WhiteHeart") > 0) {
+ playerInfo.setFloat("WhiteHeart", 0f);
+ }
+
+ if (playerInfo.getFloat("BlueHeart") > 0) {
+ float damage = playerInfo.getFloat("BlueHeart")
+ - event.ammount;
+ if (damage >= 0) {
+ playerInfo.setFloat("BlueHeart", damage);
+ } else {
+ playerInfo.setFloat("BlueHeart", 0f);
+ }
+
+ if (damage < 0) {
+ System.out.println(damage);
+ player.attackEntityFrom(event.source,
+ Math.abs(damage));
+ }
+
+ player.hurtResistantTime = player.maxHurtResistantTime;
+ player.hurtTime = player.maxHurtTime = 10;
+ player.worldObj.playSoundAtEntity(player,
+ "game.player.hurt", 1.0F,
+ (EntityEventHandler.rand.nextFloat()
+ - EntityEventHandler.rand.nextFloat())
+ * 0.2F + 1.0F);
+ event.setCanceled(true);
+ } else if (playerInfo.getFloat("BlackHeart") > 0) {
+ AxisAlignedBB axisalignedbb = player.boundingBox
+ .expand(6.0D, 6.0D, 6.0D);
+ List<?> enemies = player.worldObj
+ .getEntitiesWithinAABBExcludingEntity(player,
+ axisalignedbb,
+ EntitySelector.selectMonsters);
+ if (enemies != null && !enemies.isEmpty()
+ && event.source != DamageSourceList.blackHeart) {
+ Iterator<?> iterator = enemies.iterator();
+ while (iterator.hasNext()) {
+ Entity enemy = (Entity) iterator.next();
+ enemy.attackEntityFrom(DamageSourceList.blackHeart,
+ 6f);
+ }
+ }
+ float damage = playerInfo.getFloat("BlackHeart")
+ - event.ammount;
+ if (damage >= 0)
+ playerInfo.setFloat("BlackHeart", damage);
+ else
+ playerInfo.setFloat("BlackHeart", 0f);
+ if (damage < 0)
+ player.attackEntityFrom(event.source,
+ Math.abs(damage));
+ player.hurtResistantTime = player.maxHurtResistantTime;
+ player.hurtTime = player.maxHurtTime = 10;
+ player.worldObj.playSoundAtEntity(player,
+ "game.player.hurt", 1.0F,
+ (EntityEventHandler.rand.nextFloat()
+ - EntityEventHandler.rand.nextFloat())
+ * 0.2F + 1.0F);
+ event.setCanceled(true);
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void onPlayerRespawn(PlayerEvent.Clone event) {
+ EntityPlayer player = event.entityPlayer;
+ if (!player.worldObj.isRemote) {
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(player, Variables.MODID);
+ if (playerInfo.hasKey("cursePoints")) {
+ int points = playerInfo.getInteger("cursePoints");
+ int maxCurses = playerInfo.getInteger("cursePoints")
+ / Variables.CURSE_POINTS_PER_LEVEL + 1;
+ if (points > 0 && playerInfo
+ .getInteger("activeCurses") < maxCurses)
+ while (playerInfo
+ .getInteger("activeCurses") < maxCurses
+ && Curse.availableCurses.size() > 0
+ && playerInfo
+ .getInteger("activeCurses") < Curse
+ .getCurseList().size())
+ addCurse(player, playerInfo);
+ if (!playerInfo.hasKey("curseTime")
+ || !playerInfo.hasKey("reselectCurses")
+ || playerInfo.getBoolean("reselectCurses")) {
+ playerInfo.setInteger("curseTime", 23000);
+ playerInfo.setBoolean("reselectCurses", false);
+ }
+ }
+ playerInfo.setFloat("BlueHeart", 0f);
+ playerInfo.setFloat("BlackHeart", 0f);
+ playerInfo.setFloat("WhiteHeart", 0f);
+ if (ConfigHandler.CURSES_ENABLED)
+ for (Curse curse : Curse.getCurseList())
+ if (curse.canCurseBeActivated(player.worldObj)
+ && playerInfo.getInteger(curse.getName()) > 0)
+ curse.respawnAction(player.worldObj, player);
+ for (int i = 0; i < 18; i++)
+ if (getJewelryItems(playerInfo, i) != null) {
+ if (getJewelryItems(playerInfo, i)
+ .getItem() instanceof ItemBaseJewelry)
+ ((ItemBaseJewelry) getJewelryItems(playerInfo, i)
+ .getItem()).onPlayerRespawn(
+ getJewelryItems(playerInfo, i),
+ event);
+ if (getJewelryItems(playerInfo, i)
+ .getItem() instanceof IJewelryItem)
+ ((IJewelryItem) getJewelryItems(playerInfo, i)
+ .getItem()).onPlayerRespawnAction(
+ getJewelryItems(playerInfo, i),
+ event);
+ }
+ JewelrycraftMod.netWrapper.sendTo(
+ new PacketSendClientPlayerInfo(playerInfo),
+ (EntityPlayerMP) player);
+ if (addedCurses) {
+ JewelrycraftMod.netWrapper
+ .sendToAll(new PacketSendServerPlayersInfo());
+ addedCurses = false;
+ }
+ }
+ }
+
+ public void addCurse(EntityPlayer player, NBTTagCompound playerInfo) {
+ if (ConfigHandler.CURSES_ENABLED
+ && Curse.availableCurses.size() > 0) {
+ Curse cur = ((WeightedRandomCurse) WeightedRandom
+ .getRandomItem(rand, JewelrycraftUtil
+ .getCurses(player.worldObj, player, rand)))
+ .getCurse(rand);
+ playerInfo.setInteger(cur.getName(), 1);
+ Curse.availableCurses.remove(cur);
+ addedCurses = true;
+ if (playerInfo.getInteger("activeCurses") == 0)
+ playerInfo.setInteger("activeCurses", 1);
+ else
+ playerInfo.setInteger("activeCurses",
+ playerInfo.getInteger("activeCurses") + 1);
+ JewelrycraftMod.netWrapper
+ .sendToAll(new PacketSendServerPlayersInfo());
+ JewelrycraftMod.netWrapper.sendTo(
+ new PacketSendClientPlayerInfo(playerInfo),
+ (EntityPlayerMP) player);
+ }
+ }
+
+ @SubscribeEvent
+ public void itemToss(ItemTossEvent event) {
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(event.player, Variables.MODID);
+ if (ConfigHandler.CURSES_ENABLED)
+ for (Curse curse : Curse.getCurseList())
+ if (event.player != null
+ && curse.canCurseBeActivated(event.player.worldObj)
+ && playerInfo.getInteger(curse.getName()) > 0
+ && curse.itemToss()) {
+ EntityItem entityitem = new EntityItem(
+ event.player.worldObj,
+ event.player.posX + 0.5D,
+ event.player.posY + 0.5D,
+ event.player.posZ + 0.5D,
+ event.entityItem.getEntityItem());
+ if (entityitem != null) {
+ entityitem.motionX = 0;
+ entityitem.motionZ = 0;
+ entityitem.motionY = 0.11000000298023224D;
+ event.player.worldObj
+ .spawnEntityInWorld(entityitem);
+ MinecraftServer.getServer()
+ .getConfigurationManager()
+ .sendChatMsg(new ChatComponentText("<"
+ + event.player.getDisplayName()
+ + "> I shouldn't drop this. I might need it later."));
+ event.setCanceled(true);
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void playerFileSave(PlayerEvent.SaveToFile event) {
+ if (event.entity instanceof EntityPlayer
+ && !(event.entity instanceof EntityPlayerMP))
+ JewelrycraftMod.netWrapper
+ .sendToServer(new PacketRequestPlayerInfo());
+ }
+
+ public int calculateLuck(EntityPlayer player) {
+ int luck = 0;
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(player, Variables.MODID);
+ if (ConfigHandler.CURSES_ENABLED)
+ for (Curse curse : Curse.getCurseList())
+ if (curse.canCurseBeActivated(player.worldObj)
+ && playerInfo.getInteger(curse.getName()) > 0)
+ luck += curse.luck();
+ return luck;
+ }
+
+ public static void spawnHearts(Entity entity, int chance) {
+ EntityLiving live = (EntityLiving) entity;
+ String type = types.get(rand.nextInt(types.size()));
+ if (rand.nextInt(chance) == 0 && live
+ .getCreatureAttribute() != JewelrycraftUtil.HEARTS) {
+ if (type == "White") {
+ EntityHeart h = new EntityHalfHeart(live.worldObj);
+ h.setType(type);
+ h.setLocationAndAngles(live.posX, live.posY, live.posZ,
+ MathHelper.wrapAngleTo180_float(
+ rand.nextFloat() * 360.0F),
+ 0.0F);
+ live.worldObj.spawnEntityInWorld(h);
+ } else {
+ for (int i = 1;
+ i <= 1 + rand.nextInt(
+ 1 + (int) (live.getMaxHealth() / 2));
+ i++) {
+ EntityHeart[] hearts = {
+ new EntityHeart(live.worldObj),
+ new EntityHalfHeart(entity.worldObj) };
+ EntityHeart h = hearts[rand.nextInt(2)];
+ h.setType(type);
+ h.setLocationAndAngles(live.posX, live.posY, live.posZ,
+ MathHelper.wrapAngleTo180_float(
+ rand.nextFloat() * 360.0F),
+ 0.0F);
+ live.worldObj.spawnEntityInWorld(h);
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void onEntityDead(LivingDeathEvent event) {
+ final Entity entity = event.entity;
+ if (!entity.worldObj.isRemote && !(entity instanceof EntityPlayer)
+ && entity instanceof EntityLiving
+ && event.source.getEntity() != null
+ && event.source.getEntity() instanceof EntityPlayer) {
+ System.out.println(luck);
+ spawnHearts(entity, Math.max(2, 20 - luck));
+ EntityPlayer player = (EntityPlayer) event.source.getEntity();
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(player, Variables.MODID);
+ if (ConfigHandler.CURSES_ENABLED)
+ for (Curse curse : Curse.getCurseList())
+ if (curse.canCurseBeActivated(player.worldObj)
+ && playerInfo.getInteger(curse.getName()) > 0)
+ curse.entityDeathAction(player.worldObj,
+ event.entityLiving, player);
+ }
+ if (entity instanceof EntityPlayer) {
+ EntityPlayer player = (EntityPlayer) entity;
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(player, Variables.MODID);
+ playerInfo.setFloat("BlueHeart", 0f);
+ playerInfo.setFloat("BlackHeart", 0f);
+ playerInfo.setFloat("WhiteHeart", 0f);
+ if (playerInfo.hasKey("reselectCurses")
+ && playerInfo.getBoolean("reselectCurses")) {
+ playerInfo.setInteger("activeCurses", 0);
+ if (ConfigHandler.CURSES_ENABLED)
+ for (Curse l : Curse.getCurseList()) {
+ if (l.canCurseBeActivated(player.worldObj)
+ && playerInfo
+ .getInteger(l.getName()) == 1) {
+ playerInfo.setInteger(l.getName(), 0);
+ l.setTicksActive(0);
+ if (!Curse.availableCurses.contains(l))
+ Curse.availableCurses.add(l);
+ } else if (l.canCurseBeActivated(player.worldObj)
+ && playerInfo.getInteger(l.getName()) >= 2)
+ playerInfo.setInteger(l.getName(), 1);
+ }
+ if (entity.worldObj.isRemote)
+ JewelrycraftMod.netWrapper
+ .sendToServer(new PacketRequestPlayerInfo());
+ }
+
+ if (ConfigHandler.CURSES_ENABLED) {
+ for (Curse curse : Curse.getCurseList())
+ if (curse.canCurseBeActivated(player.worldObj)
+ && playerInfo.getInteger(curse.getName()) > 0)
+ curse.playerDeathAction(player.worldObj, player,
+ event);
+ }
+
+ for (int i = 0; i < 18; i++)
+ if (getJewelryItems(playerInfo, i) != null) {
+ if (getJewelryItems(playerInfo, i)
+ .getItem() instanceof ItemBaseJewelry)
+ ((ItemBaseJewelry) getJewelryItems(playerInfo, i)
+ .getItem()).onPlayerDead(
+ getJewelryItems(playerInfo, i),
+ player, event.source);
+ if (getJewelryItems(playerInfo, i)
+ .getItem() instanceof IJewelryItem)
+ ((IJewelryItem) getJewelryItems(playerInfo, i)
+ .getItem()).onPlayerDeadAction(
+ getJewelryItems(playerInfo, i),
+ player, event.source);
+ }
+ }
+ if (event.entity instanceof EntityPlayer
+ && !(event.entity instanceof EntityPlayerMP))
+ JewelrycraftMod.netWrapper
+ .sendToServer(new PacketRequestPlayerInfo());
+ }
+
+ @SubscribeEvent
+ public void onEntityHeal(LivingHealEvent event) {
+ if (event.entity instanceof EntityPlayer) {
+ EntityPlayer player = (EntityPlayer) event.entity;
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(player, Variables.MODID);
+
+ if (ConfigHandler.CURSES_ENABLED) {
+ for (Curse curse : Curse.getCurseList())
+ if (curse.canCurseBeActivated(player.worldObj)
+ && playerInfo.getInteger(curse.getName()) > 0)
+ curse.playerHealAction(player.worldObj, player,
+ event);
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void onPlayerSleep(PlayerSleepInBedEvent event) {
+ if (event.entity instanceof EntityPlayer) {
+ EntityPlayer player = (EntityPlayer) event.entity;
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(player, Variables.MODID);
+
+ if (ConfigHandler.CURSES_ENABLED) {
+ for (Curse curse : Curse.getCurseList())
+ if (curse.canCurseBeActivated(player.worldObj)
+ && playerInfo.getInteger(curse.getName()) > 0)
+ curse.playerSleepAction(player.worldObj, player,
+ event);
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/events/EventCommonHandler.java b/src/main/java/darkknight/jewelrycraft/events/EventCommonHandler.java index 4430f5f..1aa45e1 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/events/EventCommonHandler.java +++ b/src/main/java/darkknight/jewelrycraft/events/EventCommonHandler.java @@ -8,15 +8,12 @@ import cpw.mods.fml.common.gameevent.TickEvent; * @author Sorin
*
*/
-public class EventCommonHandler
-{
- @SubscribeEvent
- public void onItemCrafted(PlayerEvent.ItemCraftedEvent event)
- {
- }
-
- @SubscribeEvent
- public void onPlayerTick(TickEvent.PlayerTickEvent event)
- {
- }
+public class EventCommonHandler {
+ @SubscribeEvent
+ public void onItemCrafted(PlayerEvent.ItemCraftedEvent event) {
+ }
+
+ @SubscribeEvent
+ public void onPlayerTick(TickEvent.PlayerTickEvent event) {
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/events/EventList.java b/src/main/java/darkknight/jewelrycraft/events/EventList.java index 4955cbb..2098345 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/events/EventList.java +++ b/src/main/java/darkknight/jewelrycraft/events/EventList.java @@ -19,33 +19,32 @@ import darkknight.jewelrycraft.util.JewelrycraftUtil; import darkknight.jewelrycraft.worldGen.Generation;
import net.minecraftforge.common.MinecraftForge;
-public class EventList
-{
- public static void preInit(FMLPreInitializationEvent e)
- {
- MinecraftForge.EVENT_BUS.register(new EntityEventHandler());
- MinecraftForge.EVENT_BUS.register(new BlockEventHandler());
- MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE);
- FMLCommonHandler.instance().bus().register(new EventCommonHandler());
- BucketHandler.INSTANCE.buckets.put(BlockList.moltenMetal, ItemList.bucket);
- JewelrycraftMod.proxy.preInit();
- }
-
- public static void init(FMLInitializationEvent e)
- {
- GameRegistry.registerWorldGenerator(new Generation(), 0);
- JewelrycraftMod.proxy.init();
- new GuiHandler();
- FMLCommonHandler.instance().bus().register(ConfigHandler.INSTANCE);
- }
-
- public static void postInit(FMLPostInitializationEvent e)
- {
- JewelrycraftUtil.addMetals();
- JewelrycraftUtil.jamcrafters();
- EffectsList.postInit(e);
- DamageSourceList.postInit(e);
- JewelrycraftMod.proxy.postInit();
- JewelrycraftUtil.addStuff();
- }
+public class EventList {
+ public static void preInit(FMLPreInitializationEvent e) {
+ MinecraftForge.EVENT_BUS.register(new EntityEventHandler());
+ MinecraftForge.EVENT_BUS.register(new BlockEventHandler());
+ MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE);
+
+ FMLCommonHandler.instance().bus()
+ .register(new EventCommonHandler());
+ BucketHandler.INSTANCE.buckets.put(BlockList.moltenMetal,
+ ItemList.bucket);
+ JewelrycraftMod.proxy.preInit();
+ }
+
+ public static void init(FMLInitializationEvent e) {
+ GameRegistry.registerWorldGenerator(new Generation(), 0);
+ JewelrycraftMod.proxy.init();
+ new GuiHandler();
+ FMLCommonHandler.instance().bus().register(ConfigHandler.INSTANCE);
+ }
+
+ public static void postInit(FMLPostInitializationEvent e) {
+ JewelrycraftUtil.addMetals();
+ JewelrycraftUtil.jamcrafters();
+ EffectsList.postInit(e);
+ DamageSourceList.postInit(e);
+ JewelrycraftMod.proxy.postInit();
+ JewelrycraftUtil.addStuff();
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/events/KeyBindings.java b/src/main/java/darkknight/jewelrycraft/events/KeyBindings.java index 3e4a2c3..c7f5bef 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/events/KeyBindings.java +++ b/src/main/java/darkknight/jewelrycraft/events/KeyBindings.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.events;
import org.lwjgl.input.Keyboard;
+
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent;
@@ -9,30 +10,35 @@ import darkknight.jewelrycraft.network.PacketKeyPressEvent; import darkknight.jewelrycraft.util.Variables;
import net.minecraft.client.settings.KeyBinding;
-public class KeyBindings
-{
- public static KeyBinding render = new KeyBinding("Pretty Render", Keyboard.KEY_Z, Variables.MODNAME);
- public static KeyBinding inventory = new KeyBinding("Jewelry Inventory", Keyboard.KEY_J, Variables.MODNAME);
- public static KeyBinding curses = new KeyBinding("Curses Tab", Keyboard.KEY_C, Variables.MODNAME);
-
- /**
- *
- */
- public KeyBindings()
- {
- ClientRegistry.registerKeyBinding(render);
- ClientRegistry.registerKeyBinding(inventory);
- ClientRegistry.registerKeyBinding(curses);
- }
-
- /**
- * @param event
- */
- @SubscribeEvent
- public void onKeyInput(InputEvent.KeyInputEvent event)
- {
- if (render.isPressed()) JewelrycraftMod.fancyRender = !JewelrycraftMod.fancyRender;
- if (inventory.isPressed()) JewelrycraftMod.netWrapper.sendToServer(new PacketKeyPressEvent(0));
- if (curses.isPressed()) JewelrycraftMod.netWrapper.sendToServer(new PacketKeyPressEvent(1));
- }
+public class KeyBindings {
+ public static KeyBinding render = new KeyBinding(
+ "Pretty Render", Keyboard.KEY_Z, Variables.MODNAME);
+ public static KeyBinding inventory = new KeyBinding(
+ "Jewelry Inventory", Keyboard.KEY_J, Variables.MODNAME);
+ public static KeyBinding curses = new KeyBinding("Curses Tab",
+ Keyboard.KEY_C, Variables.MODNAME);
+
+ /**
+ *
+ */
+ public KeyBindings() {
+ ClientRegistry.registerKeyBinding(render);
+ ClientRegistry.registerKeyBinding(inventory);
+ ClientRegistry.registerKeyBinding(curses);
+ }
+
+ /**
+ * @param event
+ */
+ @SubscribeEvent
+ public void onKeyInput(InputEvent.KeyInputEvent event) {
+ if (render.isPressed())
+ JewelrycraftMod.fancyRender = !JewelrycraftMod.fancyRender;
+ if (inventory.isPressed())
+ JewelrycraftMod.netWrapper
+ .sendToServer(new PacketKeyPressEvent(0));
+ if (curses.isPressed())
+ JewelrycraftMod.netWrapper
+ .sendToServer(new PacketKeyPressEvent(1));
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/events/PlayerRenderHandler.java b/src/main/java/darkknight/jewelrycraft/events/PlayerRenderHandler.java index f0fd1c2..4bbb2c5 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/events/PlayerRenderHandler.java +++ b/src/main/java/darkknight/jewelrycraft/events/PlayerRenderHandler.java @@ -1,7 +1,9 @@ package darkknight.jewelrycraft.events;
import java.util.Iterator;
+
import org.lwjgl.opengl.GL11;
+
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import darkknight.jewelrycraft.api.Curse;
@@ -31,11 +33,13 @@ public class PlayerRenderHandler { @SubscribeEvent
public void renderScreen(RenderPlayerEvent.Specials.Post event) {
GL11.glPushMatrix();
- ModelRenderer rightArm = event.renderer.modelBipedMain.bipedRightArm;
+ ModelRenderer rightArm =
+ event.renderer.modelBipedMain.bipedRightArm;
ModelRenderer leftArm = event.renderer.modelBipedMain.bipedLeftArm;
ModelRenderer head = event.renderer.modelBipedMain.bipedHead;
ModelRenderer body = event.renderer.modelBipedMain.bipedBody;
- Iterator<EntityPlayer> players = event.entityPlayer.worldObj.playerEntities.iterator();
+ Iterator<EntityPlayer> players =
+ event.entityPlayer.worldObj.playerEntities.iterator();
float rotAngleX = 0F, rotAngleY = 0F, rotAngleZ = 0F;
if (playersInfo != null) {
while (players.hasNext()) {
@@ -44,147 +48,435 @@ public class PlayerRenderHandler { int gem = -1;
int ingot = -1;
EntityPlayer player = players.next();
- NBTTagCompound playerInfo = (NBTTagCompound) playersInfo.getTag(player.getDisplayName());
- if (ConfigHandler.CURSES_ENABLED) for (Curse curse : Curse.getCurseList())
- if (curse != null && curse.canCurseBeActivated(player.worldObj) && playerInfo != null && curse.getName() != null && playerInfo.getInteger(curse.getName()) > 0 && event.entityPlayer != null && player != null && event.entityPlayer.getDisplayName().equals(player.getDisplayName()) && playerInfo.getInteger("cursePoints") > 0) curse.playerRender(player, event);
+ NBTTagCompound playerInfo = (NBTTagCompound) playersInfo
+ .getTag(player.getDisplayName());
+ if (ConfigHandler.CURSES_ENABLED)
+ for (Curse curse : Curse.getCurseList())
+ if (curse != null
+ && curse.canCurseBeActivated(
+ player.worldObj)
+ && playerInfo != null
+ && curse.getName() != null
+ && playerInfo
+ .getInteger(curse.getName()) > 0
+ && event.entityPlayer != null
+ && player != null
+ && event.entityPlayer.getDisplayName()
+ .equals(player.getDisplayName())
+ && playerInfo
+ .getInteger("cursePoints") > 0)
+ curse.playerRender(player, event);
int no = 0;
ModelRenderer arm = rightArm;
for (int i = 0; i <= 9; i++)
- if (playerInfo != null && event.entityPlayer != null && player != null && playerInfo.hasKey("ext" + i) && event.entityPlayer.getDisplayName().equals(player.getDisplayName())) {
+ if (playerInfo != null && event.entityPlayer != null
+ && player != null
+ && playerInfo.hasKey("ext" + i)
+ && event.entityPlayer.getDisplayName()
+ .equals(player.getDisplayName())) {
gem = -1;
ingot = -1;
- if (i > 4) arm = leftArm;
+ if (i > 4)
+ arm = leftArm;
float s = 0.055F;
- NBTTagCompound nbt = (NBTTagCompound) playerInfo.getTag("ext" + i);
- ItemStack item = ItemStack.loadItemStackFromNBT(nbt);
- if (Loader.isModLoaded("alpaca") /*&& fiskfille.alpaca.AlpacaAPI.isAlpacaClient(event.entityPlayer)*/) arm = body;
+ NBTTagCompound nbt = (NBTTagCompound) playerInfo
+ .getTag("ext" + i);
+ ItemStack item =
+ ItemStack.loadItemStackFromNBT(nbt);
+ if (Loader.isModLoaded(
+ "alpaca") /*
+ * &&
+ * fiskfille.alpaca.AlpacaAPI.
+ * isAlpacaClient(event.
+ * entityPlayer)
+ */)
+ arm = body;
GL11.glPushMatrix();
- if (arm.rotateAngleX == 0.0F && arm.rotateAngleY == 0.0F && arm.rotateAngleZ == 0.0F) {
- if ((arm.rotationPointX + rotAngleX) != 0.0F || (arm.rotationPointY + rotAngleY) != 0.0F || (arm.rotationPointZ + rotAngleZ) != 0.0F) GL11.glTranslatef((arm.rotationPointX + rotAngleX) * s, (arm.rotationPointY + rotAngleY) * s, (arm.rotationPointZ + rotAngleZ) * s);
- } else if (!Loader.isModLoaded("alpaca") /*|| (Loader.isModLoaded("alpaca") && !fiskfille.alpaca.AlpacaAPI.isAlpacaClient(event.entityPlayer))*/) {
- GL11.glTranslatef((arm.rotationPointX + rotAngleX) * s, (arm.rotationPointY + rotAngleY) * s, (arm.rotationPointZ + rotAngleZ) * s);
- if (arm.rotateAngleZ != 0.0F) GL11.glRotatef(arm.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F);
- if (arm.rotateAngleY != 0.0F) GL11.glRotatef(arm.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
- if (arm.rotateAngleX != 0.0F) GL11.glRotatef(arm.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
+ if (arm.rotateAngleX == 0.0F
+ && arm.rotateAngleY == 0.0F
+ && arm.rotateAngleZ == 0.0F) {
+ if ((arm.rotationPointX + rotAngleX) != 0.0F
+ || (arm.rotationPointY
+ + rotAngleY) != 0.0F
+ || (arm.rotationPointZ
+ + rotAngleZ) != 0.0F)
+ GL11.glTranslatef(
+ (arm.rotationPointX + rotAngleX)
+ * s,
+ (arm.rotationPointY + rotAngleY)
+ * s,
+ (arm.rotationPointZ + rotAngleZ)
+ * s);
+ } else if (!Loader.isModLoaded(
+ "alpaca") /*
+ * || (Loader.isModLoaded(
+ * "alpaca") &&
+ * !fiskfille.alpaca.AlpacaAPI.
+ * isAlpacaClient(event.
+ * entityPlayer))
+ */) {
+ GL11.glTranslatef(
+ (arm.rotationPointX + rotAngleX) * s,
+ (arm.rotationPointY + rotAngleY) * s,
+ (arm.rotationPointZ + rotAngleZ) * s);
+ if (arm.rotateAngleZ != 0.0F)
+ GL11.glRotatef(
+ arm.rotateAngleZ
+ * (180F / (float) Math.PI),
+ 0.0F, 0.0F, 1.0F);
+ if (arm.rotateAngleY != 0.0F)
+ GL11.glRotatef(
+ arm.rotateAngleY
+ * (180F / (float) Math.PI),
+ 0.0F, 1.0F, 0.0F);
+ if (arm.rotateAngleX != 0.0F)
+ GL11.glRotatef(
+ arm.rotateAngleX
+ * (180F / (float) Math.PI),
+ 1.0F, 0.0F, 0.0F);
}
- if (JewelryNBT.ingot(item) != null) ingot = JewelrycraftUtil.getColor(JewelryNBT.ingot(item));
- if (JewelryNBT.gem(item) != null) gem = JewelrycraftUtil.getColor(JewelryNBT.gem(item));
+ if (JewelryNBT.ingot(item) != null)
+ ingot = JewelrycraftUtil
+ .getColor(JewelryNBT.ingot(item));
+ if (JewelryNBT.gem(item) != null)
+ gem = JewelrycraftUtil
+ .getColor(JewelryNBT.gem(item));
float scale = 0.1f;
- if (Loader.isModLoaded("alpaca") /*&& fiskfille.alpaca.AlpacaAPI.isAlpacaClient(event.entityPlayer)*/) {
+ if (Loader.isModLoaded(
+ "alpaca") /*
+ * &&
+ * fiskfille.alpaca.AlpacaAPI.
+ * isAlpacaClient(event.
+ * entityPlayer)
+ */) {
if (i <= 4) {
- GL11.glTranslatef(0.35F, -4.35F, -2.8F + 0.15F * i);
+ GL11.glTranslatef(0.35F, -4.35F,
+ -2.8F + 0.15F * i);
GL11.glRotatef(90f, 0F, 1F, 0F);
} else {
- GL11.glTranslatef(-0.35F, -4.35F, 1.48F + 0.15F * i);
+ GL11.glTranslatef(-0.35F, -4.35F,
+ 1.48F + 0.15F * i);
GL11.glRotatef(-90f, 0F, 1F, 0F);
}
scale = 0.3F;
} else {
- if (i <= 4) GL11.glTranslatef(0.64F + 0.05F * i, -1.15F, 0.07F);
- else GL11.glTranslatef(0.59F + 0.05F * i, -1.15F, 0.07F);
+ if (i <= 4)
+ GL11.glTranslatef(0.64F + 0.05F * i,
+ -1.15F, 0.07F);
+ else
+ GL11.glTranslatef(0.59F + 0.05F * i,
+ -1.15F, 0.07F);
}
GL11.glScalef(scale, scale + scale / 2, scale);
- ring.doRender(event.entityPlayer, 0F, 0F, (float) ingot, (float) gem, 0F);
+ ring.doRender(event.entityPlayer, 0F, 0F,
+ (float) ingot, (float) gem, 0F);
GL11.glPopMatrix();
-// no++;
+ // no++;
}
for (int i = 10; i <= 13; i++)
- if (playerInfo != null && event.entityPlayer != null && player != null && playerInfo.hasKey("ext" + i) && event.entityPlayer.getDisplayName().equals(player.getDisplayName())) {
- NBTTagCompound nbt = (NBTTagCompound) playerInfo.getTag("ext" + i);
- ItemStack item = ItemStack.loadItemStackFromNBT(nbt);
- if (JewelryNBT.ingot(item) != null) ingotColor[i - 10] = JewelrycraftUtil.getColor(JewelryNBT.ingot(item));
- if (JewelryNBT.gem(item) != null) gemColor[i - 10] = JewelrycraftUtil.getColor(JewelryNBT.gem(item));
+ if (playerInfo != null && event.entityPlayer != null
+ && player != null
+ && playerInfo.hasKey("ext" + i)
+ && event.entityPlayer.getDisplayName()
+ .equals(player.getDisplayName())) {
+ NBTTagCompound nbt = (NBTTagCompound) playerInfo
+ .getTag("ext" + i);
+ ItemStack item =
+ ItemStack.loadItemStackFromNBT(nbt);
+ if (JewelryNBT.ingot(item) != null)
+ ingotColor[i - 10] = JewelrycraftUtil
+ .getColor(JewelryNBT.ingot(item));
+ if (JewelryNBT.gem(item) != null)
+ gemColor[i - 10] = JewelrycraftUtil
+ .getColor(JewelryNBT.gem(item));
}
- if (playerInfo != null && event.entityPlayer != null && player != null && (playerInfo.hasKey("ext10") || playerInfo.hasKey("ext11")) && event.entityPlayer.getDisplayName().equals(player.getDisplayName())) {
+ if (playerInfo != null && event.entityPlayer != null
+ && player != null
+ && (playerInfo.hasKey("ext10")
+ || playerInfo.hasKey("ext11"))
+ && event.entityPlayer.getDisplayName()
+ .equals(player.getDisplayName())) {
GL11.glPushMatrix();
GL11.glColor4f(1, 1, 1, 1);
- if (Loader.isModLoaded("alpaca") /*&& fiskfille.alpaca.AlpacaAPI.isAlpacaClient(event.entityPlayer)*/) {
+ if (Loader.isModLoaded(
+ "alpaca") /*
+ * && fiskfille.alpaca.AlpacaAPI.
+ * isAlpacaClient(event.
+ * entityPlayer)
+ */) {
rightArm = body;
GL11.glTranslatef(0.0F, 0.05F, 0.0F);
GL11.glRotatef(-30F, 0.0F, 1.0F, 0.0F);
}
- if (rightArm.rotateAngleX == 0.0F && rightArm.rotateAngleY == 0.0F && rightArm.rotateAngleZ == 0.0F) {
- if ((rightArm.rotationPointX + rotAngleX) != 0.0F || (rightArm.rotationPointY + rotAngleY) != 0.0F || (rightArm.rotationPointZ + rotAngleZ) != 0.0F) GL11.glTranslatef((rightArm.rotationPointX + rotAngleX) * size, (rightArm.rotationPointY + rotAngleY) * size, (rightArm.rotationPointZ + rotAngleZ) * size);
- } else if (!Loader.isModLoaded("alpaca") /*|| (Loader.isModLoaded("alpaca") && fiskfille.alpaca.AlpacaAPI.isAlpacaClient(event.entityPlayer))*/) {
- GL11.glTranslatef((rightArm.rotationPointX + rotAngleX) * size, (rightArm.rotationPointY + rotAngleY) * size, (rightArm.rotationPointZ + rotAngleZ) * size);
- if (rightArm.rotateAngleZ != 0.0F) GL11.glRotatef(rightArm.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F);
- if (rightArm.rotateAngleY != 0.0F) GL11.glRotatef(rightArm.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
- if (rightArm.rotateAngleX != 0.0F) GL11.glRotatef(rightArm.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
+ if (rightArm.rotateAngleX == 0.0F
+ && rightArm.rotateAngleY == 0.0F
+ && rightArm.rotateAngleZ == 0.0F) {
+ if ((rightArm.rotationPointX + rotAngleX) != 0.0F
+ || (rightArm.rotationPointY
+ + rotAngleY) != 0.0F
+ || (rightArm.rotationPointZ
+ + rotAngleZ) != 0.0F)
+ GL11.glTranslatef(
+ (rightArm.rotationPointX + rotAngleX)
+ * size,
+ (rightArm.rotationPointY + rotAngleY)
+ * size,
+ (rightArm.rotationPointZ + rotAngleZ)
+ * size);
+ } else if (!Loader.isModLoaded(
+ "alpaca") /*
+ * || (Loader.isModLoaded("alpaca")
+ * && fiskfille.alpaca.AlpacaAPI.
+ * isAlpacaClient(event.
+ * entityPlayer))
+ */) {
+ GL11.glTranslatef(
+ (rightArm.rotationPointX + rotAngleX)
+ * size,
+ (rightArm.rotationPointY + rotAngleY)
+ * size,
+ (rightArm.rotationPointZ + rotAngleZ)
+ * size);
+ if (rightArm.rotateAngleZ != 0.0F)
+ GL11.glRotatef(
+ rightArm.rotateAngleZ
+ * (180F / (float) Math.PI),
+ 0.0F, 0.0F, 1.0F);
+ if (rightArm.rotateAngleY != 0.0F)
+ GL11.glRotatef(
+ rightArm.rotateAngleY
+ * (180F / (float) Math.PI),
+ 0.0F, 1.0F, 0.0F);
+ if (rightArm.rotateAngleX != 0.0F)
+ GL11.glRotatef(
+ rightArm.rotateAngleX
+ * (180F / (float) Math.PI),
+ 1.0F, 0.0F, 0.0F);
}
GL11.glScalef(0.05f, 0.03f, 0.05f);
- bracelet.doRender(event.entityPlayer, (float) ingotColor[0], (float) gemColor[0], (float) ingotColor[1], (float) gemColor[1], 0.0F);
+ bracelet.doRender(event.entityPlayer,
+ (float) ingotColor[0], (float) gemColor[0],
+ (float) ingotColor[1], (float) gemColor[1],
+ 0.0F);
GL11.glPopMatrix();
}
- if (playerInfo != null && event.entityPlayer != null && player != null && (playerInfo.hasKey("ext12") || playerInfo.hasKey("ext13")) && event.entityPlayer.getDisplayName().equals(player.getDisplayName())) {
+ if (playerInfo != null && event.entityPlayer != null
+ && player != null
+ && (playerInfo.hasKey("ext12")
+ || playerInfo.hasKey("ext13"))
+ && event.entityPlayer.getDisplayName()
+ .equals(player.getDisplayName())) {
GL11.glPushMatrix();
GL11.glColor4f(1, 1, 1, 1);
- if (Loader.isModLoaded("alpaca") /*&& fiskfille.alpaca.AlpacaAPI.isAlpacaClient(event.entityPlayer)*/) {
+ if (Loader.isModLoaded(
+ "alpaca") /*
+ * && fiskfille.alpaca.AlpacaAPI.
+ * isAlpacaClient(event.
+ * entityPlayer)
+ */) {
leftArm = body;
GL11.glTranslatef(-0.1F, 0.0F, 0.1F);
GL11.glRotatef(-140F, 0.0F, 1.0F, 0.0F);
}
- if (leftArm.rotateAngleX == 0.0F && leftArm.rotateAngleY == 0.0F && leftArm.rotateAngleZ == 0.0F) {
- if ((leftArm.rotationPointX + rotAngleX) != 0.0F || (leftArm.rotationPointY + rotAngleY) != 0.0F || (leftArm.rotationPointZ + rotAngleZ) != 0.0F) GL11.glTranslatef((leftArm.rotationPointX + rotAngleX) * size, (leftArm.rotationPointY + rotAngleY) * size, (leftArm.rotationPointZ + rotAngleZ) * size);
- } else if (!Loader.isModLoaded("alpaca") /*|| (Loader.isModLoaded("alpaca") && !fiskfille.alpaca.AlpacaAPI.isAlpacaClient(event.entityPlayer))*/) {
- GL11.glTranslatef((leftArm.rotationPointX + rotAngleX) * size + 0.2F, (leftArm.rotationPointY + rotAngleY) * size, (leftArm.rotationPointZ + rotAngleZ) * size);
- if (leftArm.rotateAngleZ != 0.0F) GL11.glRotatef(leftArm.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F);
- if (leftArm.rotateAngleY != 0.0F) GL11.glRotatef(leftArm.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
- if (leftArm.rotateAngleX != 0.0F) GL11.glRotatef(leftArm.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
+ if (leftArm.rotateAngleX == 0.0F
+ && leftArm.rotateAngleY == 0.0F
+ && leftArm.rotateAngleZ == 0.0F) {
+ if ((leftArm.rotationPointX + rotAngleX) != 0.0F
+ || (leftArm.rotationPointY
+ + rotAngleY) != 0.0F
+ || (leftArm.rotationPointZ
+ + rotAngleZ) != 0.0F)
+ GL11.glTranslatef(
+ (leftArm.rotationPointX + rotAngleX)
+ * size,
+ (leftArm.rotationPointY + rotAngleY)
+ * size,
+ (leftArm.rotationPointZ + rotAngleZ)
+ * size);
+ } else if (!Loader.isModLoaded(
+ "alpaca") /*
+ * || (Loader.isModLoaded("alpaca")
+ * && !fiskfille.alpaca.AlpacaAPI.
+ * isAlpacaClient(event.
+ * entityPlayer))
+ */) {
+ GL11.glTranslatef(
+ (leftArm.rotationPointX + rotAngleX) * size
+ + 0.2F,
+ (leftArm.rotationPointY + rotAngleY)
+ * size,
+ (leftArm.rotationPointZ + rotAngleZ)
+ * size);
+ if (leftArm.rotateAngleZ != 0.0F)
+ GL11.glRotatef(
+ leftArm.rotateAngleZ
+ * (180F / (float) Math.PI),
+ 0.0F, 0.0F, 1.0F);
+ if (leftArm.rotateAngleY != 0.0F)
+ GL11.glRotatef(
+ leftArm.rotateAngleY
+ * (180F / (float) Math.PI),
+ 0.0F, 1.0F, 0.0F);
+ if (leftArm.rotateAngleX != 0.0F)
+ GL11.glRotatef(
+ leftArm.rotateAngleX
+ * (180F / (float) Math.PI),
+ 1.0F, 0.0F, 0.0F);
}
GL11.glScalef(0.05f, 0.03f, 0.05f);
- bracelet.doRender(event.entityPlayer, (float) ingotColor[2], (float) gemColor[2], (float) ingotColor[3], (float) gemColor[3], 0F);
+ bracelet.doRender(event.entityPlayer,
+ (float) ingotColor[2], (float) gemColor[2],
+ (float) ingotColor[3], (float) gemColor[3],
+ 0F);
GL11.glPopMatrix();
}
no = 0;
for (int i = 14; i <= 16; i++)
- if (playerInfo != null && event.entityPlayer != null && player != null && playerInfo.hasKey("ext" + i) && event.entityPlayer.getDisplayName().equals(player.getDisplayName())) {
+ if (playerInfo != null && event.entityPlayer != null
+ && player != null
+ && playerInfo.hasKey("ext" + i)
+ && event.entityPlayer.getDisplayName()
+ .equals(player.getDisplayName())) {
gem = -1;
ingot = -1;
- NBTTagCompound nbt = (NBTTagCompound) playerInfo.getTag("ext" + i);
- ItemStack item = ItemStack.loadItemStackFromNBT(nbt);
+ NBTTagCompound nbt = (NBTTagCompound) playerInfo
+ .getTag("ext" + i);
+ ItemStack item =
+ ItemStack.loadItemStackFromNBT(nbt);
GL11.glPushMatrix();
- if (body.rotateAngleX == 0.0F && body.rotateAngleY == 0.0F && body.rotateAngleZ == 0.0F) {
- if (body.rotationPointX != 0.0F || body.rotationPointY != 0.0F || body.rotationPointZ != 0.0F) GL11.glTranslatef(body.rotationPointX * size, body.rotationPointY * size, body.rotationPointZ * size);
- } else if (!Loader.isModLoaded("alpaca") /*|| (Loader.isModLoaded("alpaca") && !fiskfille.alpaca.AlpacaAPI.isAlpacaClient(event.entityPlayer))*/) {
- GL11.glTranslatef(body.rotationPointX * size, body.rotationPointY * size, body.rotationPointZ * size);
- if (body.rotateAngleZ != 0.0F) GL11.glRotatef(body.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F);
- if (body.rotateAngleY != 0.0F) GL11.glRotatef(body.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
- if (body.rotateAngleX != 0.0F) GL11.glRotatef(body.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
+ if (body.rotateAngleX == 0.0F
+ && body.rotateAngleY == 0.0F
+ && body.rotateAngleZ == 0.0F) {
+ if (body.rotationPointX != 0.0F
+ || body.rotationPointY != 0.0F
+ || body.rotationPointZ != 0.0F)
+ GL11.glTranslatef(
+ body.rotationPointX * size,
+ body.rotationPointY * size,
+ body.rotationPointZ * size);
+ } else if (!Loader.isModLoaded(
+ "alpaca") /*
+ * || (Loader.isModLoaded(
+ * "alpaca") &&
+ * !fiskfille.alpaca.AlpacaAPI.
+ * isAlpacaClient(event.
+ * entityPlayer))
+ */) {
+ GL11.glTranslatef(body.rotationPointX * size,
+ body.rotationPointY * size,
+ body.rotationPointZ * size);
+ if (body.rotateAngleZ != 0.0F)
+ GL11.glRotatef(
+ body.rotateAngleZ
+ * (180F / (float) Math.PI),
+ 0.0F, 0.0F, 1.0F);
+ if (body.rotateAngleY != 0.0F)
+ GL11.glRotatef(
+ body.rotateAngleY
+ * (180F / (float) Math.PI),
+ 0.0F, 1.0F, 0.0F);
+ if (body.rotateAngleX != 0.0F)
+ GL11.glRotatef(
+ body.rotateAngleX
+ * (180F / (float) Math.PI),
+ 1.0F, 0.0F, 0.0F);
}
- if (Loader.isModLoaded("alpaca") /*&& fiskfille.alpaca.AlpacaAPI.isAlpacaClient(event.entityPlayer)*/) GL11.glTranslatef(0.0F, 0.55F, -0.28F);
+ if (Loader.isModLoaded(
+ "alpaca") /*
+ * &&
+ * fiskfille.alpaca.AlpacaAPI.
+ * isAlpacaClient(event.
+ * entityPlayer)
+ */)
+ GL11.glTranslatef(0.0F, 0.55F, -0.28F);
GL11.glScalef(0.0625f, 0.0625f, 0.0625f);
- if (JewelryNBT.ingot(item) != null) ingot = JewelrycraftUtil.getColor(JewelryNBT.ingot(item));
- if (JewelryNBT.gem(item) != null) gem = JewelrycraftUtil.getColor(JewelryNBT.gem(item));
+ if (JewelryNBT.ingot(item) != null)
+ ingot = JewelrycraftUtil
+ .getColor(JewelryNBT.ingot(item));
+ if (JewelryNBT.gem(item) != null)
+ gem = JewelrycraftUtil
+ .getColor(JewelryNBT.gem(item));
if (no > 0) {
- GL11.glRotatef(no == 1 ? 25f : -25f, 0F, 0f, 1f);
- GL11.glRotatef(no == 1 ? -5f : -10f, 1F, 0f, 0f);
+ GL11.glRotatef(no == 1 ? 25f : -25f, 0F, 0f,
+ 1f);
+ GL11.glRotatef(no == 1 ? -5f : -10f, 1F, 0f,
+ 0f);
}
- necklace.doRender(event.entityPlayer, 0F, 0F, (float) ingot, (float) gem, 0F);
+ necklace.doRender(event.entityPlayer, 0F, 0F,
+ (float) ingot, (float) gem, 0F);
GL11.glPopMatrix();
no++;
}
- if (playerInfo != null && event.entityPlayer != null && player != null && playerInfo.hasKey("ext17") && event.entityPlayer.getDisplayName().equals(player.getDisplayName())) {
+ if (playerInfo != null && event.entityPlayer != null
+ && player != null && playerInfo.hasKey("ext17")
+ && event.entityPlayer.getDisplayName()
+ .equals(player.getDisplayName())) {
gem = -1;
ingot = -1;
- NBTTagCompound nbt = (NBTTagCompound) playerInfo.getTag("ext17");
+ NBTTagCompound nbt =
+ (NBTTagCompound) playerInfo.getTag("ext17");
ItemStack item = ItemStack.loadItemStackFromNBT(nbt);
GL11.glPushMatrix();
float s = 0.0625F;
- if (Loader.isModLoaded("alpaca") /*&& fiskfille.alpaca.AlpacaAPI.isAlpacaClient(event.entityPlayer)*/) head = body;
- if (head.rotateAngleX == 0.0F && head.rotateAngleY == 0.0F && head.rotateAngleZ == 0.0F) {
- if (head.rotationPointX != 0.0F || head.rotationPointY != 0.0F || head.rotationPointZ != 0.0F) GL11.glTranslatef(head.rotationPointX * size, head.rotationPointY * size, head.rotationPointZ * size);
- } else if (!Loader.isModLoaded("alpaca") /*|| (Loader.isModLoaded("alpaca") && !fiskfille.alpaca.AlpacaAPI.isAlpacaClient(event.entityPlayer))*/) {
- GL11.glTranslatef(head.rotationPointX * size, head.rotationPointY * size, head.rotationPointZ * size);
- if (head.rotateAngleZ != 0.0F) GL11.glRotatef(head.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F);
- if (head.rotateAngleY != 0.0F) GL11.glRotatef(head.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
- if (head.rotateAngleX != 0.0F) GL11.glRotatef(head.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
+ if (Loader.isModLoaded(
+ "alpaca") /*
+ * && fiskfille.alpaca.AlpacaAPI.
+ * isAlpacaClient(event.
+ * entityPlayer)
+ */)
+ head = body;
+ if (head.rotateAngleX == 0.0F
+ && head.rotateAngleY == 0.0F
+ && head.rotateAngleZ == 0.0F) {
+ if (head.rotationPointX != 0.0F
+ || head.rotationPointY != 0.0F
+ || head.rotationPointZ != 0.0F)
+ GL11.glTranslatef(head.rotationPointX * size,
+ head.rotationPointY * size,
+ head.rotationPointZ * size);
+ } else if (!Loader.isModLoaded(
+ "alpaca") /*
+ * || (Loader.isModLoaded("alpaca")
+ * && !fiskfille.alpaca.AlpacaAPI.
+ * isAlpacaClient(event.
+ * entityPlayer))
+ */) {
+ GL11.glTranslatef(head.rotationPointX * size,
+ head.rotationPointY * size,
+ head.rotationPointZ * size);
+ if (head.rotateAngleZ != 0.0F)
+ GL11.glRotatef(
+ head.rotateAngleZ
+ * (180F / (float) Math.PI),
+ 0.0F, 0.0F, 1.0F);
+ if (head.rotateAngleY != 0.0F)
+ GL11.glRotatef(
+ head.rotateAngleY
+ * (180F / (float) Math.PI),
+ 0.0F, 1.0F, 0.0F);
+ if (head.rotateAngleX != 0.0F)
+ GL11.glRotatef(
+ head.rotateAngleX
+ * (180F / (float) Math.PI),
+ 1.0F, 0.0F, 0.0F);
}
- if (Loader.isModLoaded("alpaca") /*&& fiskfille.alpaca.AlpacaAPI.isAlpacaClient(event.entityPlayer)*/) GL11.glTranslatef(0.0F, 0.7F, -0.2F);
+ if (Loader.isModLoaded(
+ "alpaca") /*
+ * && fiskfille.alpaca.AlpacaAPI.
+ * isAlpacaClient(event.
+ * entityPlayer)
+ */)
+ GL11.glTranslatef(0.0F, 0.7F, -0.2F);
GL11.glScalef(s, s, s);
GL11.glTranslatef(0.0F, 1.0F, -2.0F);
- if (JewelryNBT.ingot(item) != null) ingot = JewelrycraftUtil.getColor(JewelryNBT.ingot(item));
- if (JewelryNBT.gem(item) != null) gem = JewelrycraftUtil.getColor(JewelryNBT.gem(item));
- earrings.doRender(event.entityPlayer, 0F, 0F, (float) ingot, (float) gem, 0F);
+ if (JewelryNBT.ingot(item) != null)
+ ingot = JewelrycraftUtil
+ .getColor(JewelryNBT.ingot(item));
+ if (JewelryNBT.gem(item) != null)
+ gem = JewelrycraftUtil
+ .getColor(JewelryNBT.gem(item));
+ earrings.doRender(event.entityPlayer, 0F, 0F,
+ (float) ingot, (float) gem, 0F);
GL11.glPopMatrix();
}
}
@@ -192,16 +484,26 @@ public class PlayerRenderHandler { GL11.glPopMatrix();
}
- float rot = 0F;
+ float rot = 0F;
@SubscribeEvent
public void renderHand(RenderHandEvent event) {
if (playersInfo != null) {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (player != null) {
- NBTTagCompound playerInfo = (NBTTagCompound) playersInfo.getTag(player.getDisplayName());
- if (ConfigHandler.CURSES_ENABLED) for (Curse curse : Curse.getCurseList())
- if (curse.canCurseBeActivated(player.worldObj) && curse != null && playerInfo != null && playerInfo.hasKey(curse.getName()) && playerInfo.getInteger(curse.getName()) > 0 && playerInfo.hasKey("cursePoints") && playerInfo.getInteger("cursePoints") > 0) curse.playerHandRender(player, event);
+ NBTTagCompound playerInfo = (NBTTagCompound) playersInfo
+ .getTag(player.getDisplayName());
+ if (ConfigHandler.CURSES_ENABLED)
+ for (Curse curse : Curse.getCurseList())
+ if (curse.canCurseBeActivated(player.worldObj)
+ && curse != null && playerInfo != null
+ && playerInfo.hasKey(curse.getName())
+ && playerInfo
+ .getInteger(curse.getName()) > 0
+ && playerInfo.hasKey("cursePoints")
+ && playerInfo
+ .getInteger("cursePoints") > 0)
+ curse.playerHandRender(player, event);
}
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/events/ScreenHandler.java b/src/main/java/darkknight/jewelrycraft/events/ScreenHandler.java index 4b7553e..cf02d9e 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/events/ScreenHandler.java +++ b/src/main/java/darkknight/jewelrycraft/events/ScreenHandler.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.events;
import org.lwjgl.opengl.GL11;
+
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import darkknight.jewelrycraft.util.Variables;
import net.minecraft.client.Minecraft;
@@ -23,28 +24,73 @@ public class ScreenHandler extends Gui { @SubscribeEvent
public void renderScreen(RenderGameOverlayEvent event) {
- if (event.isCancelable() || event.type != ElementType.ALL || tagCache == null) return;
+ if (event.isCancelable() || event.type != ElementType.ALL
+ || tagCache == null)
+ return;
int count = 0;
int size = 32;
- ScaledResolution resolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
+ ScaledResolution resolution = new ScaledResolution(mc,
+ mc.displayWidth, mc.displayHeight);
GL11.glPushMatrix();
GL11.glColor4f(1f, 1f, 1f, 1.0f);
mc.renderEngine.bindTexture(Variables.MISC_TEXTURE);
count = 0;
size = 16;
if (tagCache.getFloat("BlueHeart") > 0) {
- drawTexturedModalRect(resolution.getScaledWidth() / 2 + 90 + 35 * count, resolution.getScaledHeight() - 40, 0 * size, 0 * size, size, size);
- mc.fontRenderer.drawStringWithShadow("x" + (MathHelper.ceiling_float_int(tagCache.getFloat("BlueHeart")) / 2.0F), resolution.getScaledWidth() / 2 + 105 + 35 * count, resolution.getScaledHeight() - 36, 16777215);
+ drawTexturedModalRect(
+ resolution.getScaledWidth() / 2 + 90 + 35 * count,
+ resolution.getScaledHeight() - 40, 0 * size, 0 * size,
+ size, size);
+ mc.fontRenderer.drawStringWithShadow(
+ "x" + (MathHelper.ceiling_float_int(
+ tagCache.getFloat("BlueHeart")) / 2.0F),
+ resolution.getScaledWidth() / 2 + 105 + 35 * count,
+ resolution.getScaledHeight() - 36, 16777215);
}
count++;
mc.renderEngine.bindTexture(Variables.MISC_TEXTURE);
if (tagCache.getFloat("BlackHeart") > 0) {
- drawTexturedModalRect(resolution.getScaledWidth() / 2 + 90 + (mc.fontRenderer.getStringWidth(String.valueOf((MathHelper.ceiling_float_int(tagCache.getFloat("BlueHeart")) / 2.0F))) - 14) + 35 * count, resolution.getScaledHeight() - 40, 1 * size, 0 * size, size, size);
- mc.fontRenderer.drawStringWithShadow("x" + (MathHelper.ceiling_float_int(tagCache.getFloat("BlackHeart")) / 2.0F), resolution.getScaledWidth() / 2 + 105 + (mc.fontRenderer.getStringWidth(String.valueOf((MathHelper.ceiling_float_int(tagCache.getFloat("BlueHeart")) / 2.0F))) - 14) + 35 * count, resolution.getScaledHeight() - 36, 16777215);
+ drawTexturedModalRect(
+ resolution.getScaledWidth() / 2 + 90
+ + (mc.fontRenderer.getStringWidth(String
+ .valueOf((MathHelper.ceiling_float_int(
+ tagCache.getFloat("BlueHeart"))
+ / 2.0F)))
+ - 14)
+ + 35 * count,
+ resolution.getScaledHeight() - 40, 1 * size, 0 * size,
+ size, size);
+ mc.fontRenderer.drawStringWithShadow(
+ "x" + (MathHelper.ceiling_float_int(
+ tagCache.getFloat("BlackHeart")) / 2.0F),
+ resolution.getScaledWidth() / 2 + 105
+ + (mc.fontRenderer.getStringWidth(String
+ .valueOf((MathHelper.ceiling_float_int(
+ tagCache.getFloat("BlueHeart"))
+ / 2.0F)))
+ - 14)
+ + 35 * count,
+ resolution.getScaledHeight() - 36, 16777215);
}
count++;
mc.renderEngine.bindTexture(Variables.MISC_TEXTURE);
- if (tagCache.getFloat("WhiteHeart") > 0) drawTexturedModalRect(resolution.getScaledWidth() / 2 + 90 + (mc.fontRenderer.getStringWidth(String.valueOf((MathHelper.ceiling_float_int(tagCache.getFloat("BlueHeart")) / 2.0F))) - 14) + (mc.fontRenderer.getStringWidth(String.valueOf((MathHelper.ceiling_float_int(tagCache.getFloat("BlackHeart")) / 2.0F))) - 14) + 35 * count, resolution.getScaledHeight() - 40, 2 * size, 1 * size, size, size);
+ if (tagCache.getFloat("WhiteHeart") > 0)
+ drawTexturedModalRect(
+ resolution.getScaledWidth() / 2 + 90
+ + (mc.fontRenderer.getStringWidth(String
+ .valueOf((MathHelper.ceiling_float_int(
+ tagCache.getFloat("BlueHeart"))
+ / 2.0F)))
+ - 14)
+ + (mc.fontRenderer.getStringWidth(String
+ .valueOf((MathHelper.ceiling_float_int(
+ tagCache.getFloat(
+ "BlackHeart"))
+ / 2.0F)))
+ - 14)
+ + 35 * count,
+ resolution.getScaledHeight() - 40, 2 * size, 1 * size,
+ size, size);
GL11.glPopMatrix();
}
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/events/TextureEvent.java b/src/main/java/darkknight/jewelrycraft/events/TextureEvent.java index e570da6..9ab9958 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/events/TextureEvent.java +++ b/src/main/java/darkknight/jewelrycraft/events/TextureEvent.java @@ -1,19 +1,17 @@ package darkknight.jewelrycraft.events; - import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import darkknight.jewelrycraft.block.BlockList; import net.minecraftforge.client.event.TextureStitchEvent; -public class TextureEvent -{ - @SubscribeEvent - @SideOnly(Side.CLIENT) - public void textureFix(TextureStitchEvent.Post e) - { - if (e.map.getTextureType() == 0) - BlockList.moltenMetalFluid.setIcons(BlockList.moltenMetal.getBlockTextureFromSide(0)); - } +public class TextureEvent { + @SubscribeEvent + @SideOnly(Side.CLIENT) + public void textureFix(TextureStitchEvent.Post e) { + if (e.map.getTextureType() == 0) + BlockList.moltenMetalFluid.setIcons( + BlockList.moltenMetal.getBlockTextureFromSide(0)); + } }
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java b/src/main/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java index 6df3b1b..93328c8 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java @@ -2,6 +2,7 @@ package darkknight.jewelrycraft.item; import java.util.ArrayList;
import java.util.List;
+
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import darkknight.jewelrycraft.JewelrycraftMod;
@@ -19,142 +20,185 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector;
import net.minecraftforge.event.entity.player.PlayerEvent;
-public abstract class ItemBaseJewelry extends Item
-{
- public ItemBaseJewelry()
- {
- super();
- setMaxStackSize(1);
- setCreativeTab(JewelrycraftMod.jewelrycraft);
- }
-
- public boolean requiresMultipleRenderPasses()
- {
- return true;
- }
-
- @SideOnly (Side.CLIENT)
- public int getColorFromItemStack(ItemStack stack, int pass)
- {
- if (pass == 0 && JewelryNBT.ingot(stack) != null) return JewelrycraftUtil.getColor(JewelryNBT.ingot(stack));
- if (pass == 1 && JewelryNBT.gem(stack) != null) return JewelrycraftUtil.getColor(JewelryNBT.gem(stack));
- else if (JewelryNBT.ingot(stack) != null) return JewelrycraftUtil.getColor(JewelryNBT.ingot(stack));
- return 16777215;
- }
-
- /**
- * @param stack
- * @return
- */
- public String getItemStackDisplayName(ItemStack stack)
- {
- if (JewelryNBT.ingot(stack) != null && Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) > 0) return JewelryNBT.ingot(stack).getDisplayName().replace("Ingot", " ").trim() + " " + ("" + StatCollector.translateToLocal(getUnlocalizedNameInefficiently(stack) + ".name")).trim();
- return ("" + StatCollector.translateToLocal(getUnlocalizedNameInefficiently(stack) + ".name")).trim();
- }
-
- /**
- * allows items to add custom lines of information to the mouseover description.
- *
- * @param stack
- * @param player
- * @param list
- * @param par4
- */
- public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
- {
- if (stack.hasTagCompound() && ConfigHandler.JEWELRY_INFO){
- ItemStack ingot = JewelryNBT.ingot(stack);
- if (ingot != null && Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) > 0) list.add(StatCollector.translateToLocal("info." + Variables.MODID + ".metal") + ": " + EnumChatFormatting.YELLOW + ingot.getDisplayName().replace(StatCollector.translateToLocal("info." + Variables.MODID + ".ingot"), " "));
- ItemStack gem = JewelryNBT.gem(stack);
- if (gem != null) list.add(StatCollector.translateToLocal("info." + Variables.MODID + ".gem") + ": " + EnumChatFormatting.BLUE + gem.getDisplayName());
- ArrayList<ItemStack> modifier = JewelryNBT.modifier(stack);
- if (!modifier.isEmpty()) list.add(StatCollector.translateToLocal("info." + Variables.MODID + ".modifiers") + ": ");
- for(int i = 0; i < modifier.size(); i++)
- list.add(EnumChatFormatting.DARK_PURPLE + modifier.get(i).getDisplayName() + " x" + modifier.get(i).stackSize);
- }
- }
-
- /**
- * @param stack
- * @param player
- */
- public void action(ItemStack item, EntityPlayer player)
- {
- for(ModifierEffects mod: ModifierEffects.getEffects())
- if (JewelryNBT.doesModifierExist(item, mod.getModifier())) mod.action(item, player, this);
- }
-
- /**
- * @param item
- * @param player
- * @param source
- * @return
- */
- public boolean onPlayerAttackedCacellable(ItemStack item, EntityPlayer player, DamageSource source, float amount)
- {
- for(ModifierEffects mod: ModifierEffects.getEffects())
- if(JewelryNBT.doesModifierExist(item, mod.getModifier())) return mod.onPlayerAttackedCacellable(item, player, source, this, amount);
- return false;
- }
-
- /**
- * @param item
- * @param player
- * @param target
- * @return
- */
- public boolean onEntityAttackedCacellable(ItemStack item, EntityPlayer player, Entity target, float amount)
- {
- for(ModifierEffects mod: ModifierEffects.getEffects())
- if(JewelryNBT.doesModifierExist(item, mod.getModifier())) return mod.onEntityAttackedCacellable(item, player, target, this, amount);
- return false;
- }
-
- /**
- * @param item
- * @param player
- * @param source
- * @return
- */
- public void onPlayerAttacked(ItemStack item, EntityPlayer player, DamageSource source, float amount)
- {
- for(ModifierEffects mod: ModifierEffects.getEffects())
- if (JewelryNBT.doesModifierExist(item, mod.getModifier())) mod.onPlayerAttacked(item, player, source, this, amount);
- }
-
- /**
- * @param item
- * @param player
- * @param target
- * @return
- */
- public void onEntityAttacked(ItemStack item, EntityPlayer player, Entity target, float amount)
- {
- for(ModifierEffects mod: ModifierEffects.getEffects())
- if (JewelryNBT.doesModifierExist(item, mod.getModifier())) mod.onEntityAttacked(item, player, target, this, amount);
- }
-
- public void onPlayerDead(ItemStack item, EntityPlayer player, DamageSource source)
- {
- for(ModifierEffects mod: ModifierEffects.getEffects())
- if (JewelryNBT.doesModifierExist(item, mod.getModifier())) mod.onPlayerDead(item, player, source, this);
- }
-
- public void onPlayerRespawn(ItemStack item, PlayerEvent.Clone event)
- {
- for(ModifierEffects mod: ModifierEffects.getEffects())
- if (JewelryNBT.doesModifierExist(item, mod.getModifier())) mod.onPlayerRespawn(item, event, this);
- }
-
- public void onJewelryEquipped(ItemStack item)
- {
- for(ModifierEffects mod: ModifierEffects.getEffects())
- if (JewelryNBT.doesModifierExist(item, mod.getModifier())) mod.onJewelryEquipped(item, this);
- }
-
- public void onJewelryUnequipped(ItemStack item)
- {
- for(ModifierEffects mod: ModifierEffects.getEffects())
- if (JewelryNBT.doesModifierExist(item, mod.getModifier())) mod.onJewelryUnequipped(item, this);
- }
+public abstract class ItemBaseJewelry extends Item {
+ public ItemBaseJewelry() {
+ super();
+ setMaxStackSize(1);
+ setCreativeTab(JewelrycraftMod.jewelrycraft);
+ }
+
+ @Override
+ public boolean requiresMultipleRenderPasses() {
+ return true;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public int getColorFromItemStack(ItemStack stack, int pass) {
+ if (pass == 0 && JewelryNBT.ingot(stack) != null) {
+ return JewelrycraftUtil.getColor(JewelryNBT.ingot(stack));
+ }
+
+ if (pass == 1 && JewelryNBT.gem(stack) != null) {
+ return JewelrycraftUtil.getColor(JewelryNBT.gem(stack));
+ } else if (JewelryNBT.ingot(stack) != null) {
+ return JewelrycraftUtil.getColor(JewelryNBT.ingot(stack));
+ }
+
+ return 16777215;
+ }
+
+ /**
+ * @param stack
+ * @return
+ */
+ @Override
+ public String getItemStackDisplayName(ItemStack stack) {
+ if (JewelryNBT.ingot(stack) != null && Item
+ .getIdFromItem(JewelryNBT.ingot(stack).getItem()) > 0)
+ return JewelryNBT.ingot(stack).getDisplayName()
+ .replace("Ingot", " ").trim()
+ + " "
+ + ("" + StatCollector.translateToLocal(
+ getUnlocalizedNameInefficiently(stack)
+ + ".name")).trim();
+ return ("" + StatCollector.translateToLocal(
+ getUnlocalizedNameInefficiently(stack) + ".name")).trim();
+ }
+
+ /**
+ * allows items to add custom lines of information to the mouseover
+ * description.
+ *
+ * @param stack
+ * @param player
+ * @param list
+ * @param par4
+ */
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer player,
+ List list, boolean par4) {
+ if (stack.hasTagCompound() && ConfigHandler.JEWELRY_INFO) {
+ ItemStack ingot = JewelryNBT.ingot(stack);
+ if (ingot != null && Item.getIdFromItem(
+ JewelryNBT.ingot(stack).getItem()) > 0) {
+ list.add(StatCollector.translateToLocal(
+ "info." + Variables.MODID + ".metal") + ": "
+ + EnumChatFormatting.YELLOW
+ + ingot.getDisplayName().replace(
+ StatCollector.translateToLocal("info."
+ + Variables.MODID + ".ingot"),
+ " "));
+ }
+
+ ItemStack gem = JewelryNBT.gem(stack);
+
+ if (gem != null) {
+ list.add(StatCollector.translateToLocal(
+ "info." + Variables.MODID + ".gem") + ": "
+ + EnumChatFormatting.BLUE + gem.getDisplayName());
+ }
+
+ ArrayList<ItemStack> modifier = JewelryNBT.modifier(stack);
+
+ if (!modifier.isEmpty())
+ list.add(StatCollector.translateToLocal(
+ "info." + Variables.MODID + ".modifiers") + ": ");
+ for (int i = 0; i < modifier.size(); i++)
+ list.add(EnumChatFormatting.DARK_PURPLE
+ + modifier.get(i).getDisplayName() + " x"
+ + modifier.get(i).stackSize);
+ }
+ }
+
+ /**
+ * @param stack
+ * @param player
+ */
+ public void action(ItemStack item, EntityPlayer player) {
+ for (ModifierEffects mod : ModifierEffects.getEffects())
+ if (JewelryNBT.doesModifierExist(item, mod.getModifier()))
+ mod.action(item, player, this);
+ }
+
+ /**
+ * @param item
+ * @param player
+ * @param source
+ * @return
+ */
+ public boolean onPlayerAttackedCacellable(ItemStack item,
+ EntityPlayer player, DamageSource source, float amount) {
+ for (ModifierEffects mod : ModifierEffects.getEffects())
+ if (JewelryNBT.doesModifierExist(item, mod.getModifier()))
+ return mod.onPlayerAttackedCancellable(item, player,
+ source, this, amount);
+ return false;
+ }
+
+ /**
+ * @param item
+ * @param player
+ * @param target
+ * @return
+ */
+ public boolean onEntityAttackedCacellable(ItemStack item,
+ EntityPlayer player, Entity target, float amount) {
+ for (ModifierEffects mod : ModifierEffects.getEffects())
+ if (JewelryNBT.doesModifierExist(item, mod.getModifier()))
+ return mod.onEntityAttackedCancellable(item, player,
+ target, this, amount);
+ return false;
+ }
+
+ /**
+ * @param item
+ * @param player
+ * @param source
+ * @return
+ */
+ public void onPlayerAttacked(ItemStack item, EntityPlayer player,
+ DamageSource source, float amount) {
+ for (ModifierEffects mod : ModifierEffects.getEffects())
+ if (JewelryNBT.doesModifierExist(item, mod.getModifier()))
+ mod.onPlayerAttacked(item, player, source, this, amount);
+ }
+
+ /**
+ * @param item
+ * @param player
+ * @param target
+ * @return
+ */
+ public void onEntityAttacked(ItemStack item, EntityPlayer player,
+ Entity target, float amount) {
+ for (ModifierEffects mod : ModifierEffects.getEffects())
+ if (JewelryNBT.doesModifierExist(item, mod.getModifier()))
+ mod.onEntityAttacked(item, player, target, this, amount);
+ }
+
+ public void onPlayerDead(ItemStack item, EntityPlayer player,
+ DamageSource source) {
+ for (ModifierEffects mod : ModifierEffects.getEffects())
+ if (JewelryNBT.doesModifierExist(item, mod.getModifier()))
+ mod.onPlayerDead(item, player, source, this);
+ }
+
+ public void onPlayerRespawn(ItemStack item, PlayerEvent.Clone event) {
+ for (ModifierEffects mod : ModifierEffects.getEffects())
+ if (JewelryNBT.doesModifierExist(item, mod.getModifier()))
+ mod.onPlayerRespawn(item, event, this);
+ }
+
+ public void onJewelryEquipped(ItemStack item) {
+ for (ModifierEffects mod : ModifierEffects.getEffects())
+ if (JewelryNBT.doesModifierExist(item, mod.getModifier()))
+ mod.onJewelryEquipped(item, this);
+ }
+
+ public void onJewelryUnequipped(ItemStack item) {
+ for (ModifierEffects mod : ModifierEffects.getEffects())
+ if (JewelryNBT.doesModifierExist(item, mod.getModifier()))
+ mod.onJewelryUnequipped(item, this);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemBracelet.java b/src/main/java/darkknight/jewelrycraft/item/ItemBracelet.java index 08b9dd8..5508b9c 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemBracelet.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemBracelet.java @@ -6,36 +6,37 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
-public class ItemBracelet extends ItemBaseJewelry
-{
- public IIcon gem;
-
- /**
- *
- */
- public ItemBracelet()
- {}
-
- /**
- * @param iconRegister
- */
- @Override
- public void registerIcons(IIconRegister iconRegister)
- {
- itemIcon = iconRegister.registerIcon(Variables.MODID + ":bracelet");
- gem = iconRegister.registerIcon(Variables.MODID + ":jewelBracelet");
- }
-
- /**
- * @param stack
- * @param pass
- * @return
- */
- @Override
- public IIcon getIcon(ItemStack stack, int pass)
- {
- if (pass == 0) return itemIcon;
- if (pass == 1 && JewelryNBT.gem(stack) != null) return gem;
- return itemIcon;
- }
+public class ItemBracelet extends ItemBaseJewelry {
+ public IIcon gem;
+
+ /**
+ *
+ */
+ public ItemBracelet() {
+ }
+
+ /**
+ * @param iconRegister
+ */
+ @Override
+ public void registerIcons(IIconRegister iconRegister) {
+ itemIcon =
+ iconRegister.registerIcon(Variables.MODID + ":bracelet");
+ gem = iconRegister
+ .registerIcon(Variables.MODID + ":jewelBracelet");
+ }
+
+ /**
+ * @param stack
+ * @param pass
+ * @return
+ */
+ @Override
+ public IIcon getIcon(ItemStack stack, int pass) {
+ if (pass == 0)
+ return itemIcon;
+ if (pass == 1 && JewelryNBT.gem(stack) != null)
+ return gem;
+ return itemIcon;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemClayMolds.java b/src/main/java/darkknight/jewelrycraft/item/ItemClayMolds.java index 0ed9202..9bc630a 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemClayMolds.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemClayMolds.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.item;
import java.util.List;
+
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import darkknight.jewelrycraft.util.Variables;
@@ -11,78 +12,79 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
-public class ItemClayMolds extends Item
-{
- /** List of molds color names */
- public static final String[] moldsItemNames = new String[]{"clayIngot", "clayRing", "clayNecklace", "clayBracelet", "clayEarrings"};
- @SideOnly (Side.CLIENT)
- private IIcon[] moldsIcons;
-
- /**
- *
- */
- public ItemClayMolds()
- {
- super();
- setHasSubtypes(true);
- setMaxDamage(0);
- setMaxStackSize(1);
- }
-
- /**
- * @param par1
- * @return
- */
- @Override
- @SideOnly (Side.CLIENT)
- /**
- * Gets an icon index based on an item's damage value
- */
- public IIcon getIconFromDamage(int par1)
- {
- int j = MathHelper.clamp_int(par1, 0, moldsItemNames.length - 1);
- return moldsIcons[j];
- }
-
- /**
- * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have different names based on their damage or NBT.
- *
- * @param par1ItemStack
- * @return
- */
- @Override
- public String getUnlocalizedName(ItemStack par1ItemStack)
- {
- int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, moldsItemNames.length - 1);
- return super.getUnlocalizedName() + "." + moldsItemNames[i];
- }
-
- /**
- * @param par1
- * @param par2CreativeTabs
- * @param par3List
- */
- @Override
- @SuppressWarnings ({"unchecked", "rawtypes"})
- @SideOnly (Side.CLIENT)
- /**
- * returns a list of items with the same ID, but different meta (eg: molds returns 16 items)
- */
- public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List)
- {
- for(int j = 0; j < moldsItemNames.length; ++j)
- par3List.add(new ItemStack(par1, 1, j));
- }
-
- /**
- * @param par1IconRegister
- */
- @Override
- @SideOnly (Side.CLIENT)
- public void registerIcons(IIconRegister par1IconRegister)
- {
- moldsIcons = new IIcon[moldsItemNames.length];
- for(int i = 0; i < moldsItemNames.length; ++i)
- moldsIcons[i] = par1IconRegister.registerIcon(Variables.MODID + ":" + moldsItemNames[i] + getIconString());
- }
+public class ItemClayMolds extends Item {
+ /** List of molds color names */
+ public static final String[] moldsItemNames =
+ new String[] { "clayIngot", "clayRing", "clayNecklace",
+ "clayBracelet", "clayEarrings" };
+ @SideOnly(Side.CLIENT)
+ private IIcon[] moldsIcons;
+
+ /**
+ *
+ */
+ public ItemClayMolds() {
+ super();
+ setHasSubtypes(true);
+ setMaxDamage(0);
+ setMaxStackSize(1);
+ }
+
+ /**
+ * @param par1
+ * @return
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ /**
+ * Gets an icon index based on an item's damage value
+ */
+ public IIcon getIconFromDamage(int par1) {
+ int j = MathHelper.clamp_int(par1, 0, moldsItemNames.length - 1);
+ return moldsIcons[j];
+ }
+
+ /**
+ * Returns the unlocalized name of this item. This version accepts an
+ * ItemStack so different stacks can have different names based on
+ * their damage or NBT.
+ *
+ * @param par1ItemStack
+ * @return
+ */
+ @Override
+ public String getUnlocalizedName(ItemStack par1ItemStack) {
+ int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0,
+ moldsItemNames.length - 1);
+ return super.getUnlocalizedName() + "." + moldsItemNames[i];
+ }
+
+ /**
+ * @param par1
+ * @param par2CreativeTabs
+ * @param par3List
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ /**
+ * returns a list of items with the same ID, but different meta (eg:
+ * molds returns 16 items)
+ */
+ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs,
+ List par3List) {
+ for (int j = 0; j < moldsItemNames.length; ++j)
+ par3List.add(new ItemStack(par1, 1, j));
+ }
+
+ /**
+ * @param par1IconRegister
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister par1IconRegister) {
+ moldsIcons = new IIcon[moldsItemNames.length];
+ for (int i = 0; i < moldsItemNames.length; ++i)
+ moldsIcons[i] = par1IconRegister.registerIcon(Variables.MODID
+ + ":" + moldsItemNames[i] + getIconString());
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemEarrings.java b/src/main/java/darkknight/jewelrycraft/item/ItemEarrings.java index fe39d18..0081342 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemEarrings.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemEarrings.java @@ -6,36 +6,37 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
-public class ItemEarrings extends ItemBaseJewelry
-{
- public IIcon gem;
-
- /**
- *
- */
- public ItemEarrings()
- {}
-
- /**
- * @param iconRegister
- */
- @Override
- public void registerIcons(IIconRegister iconRegister)
- {
- itemIcon = iconRegister.registerIcon(Variables.MODID + ":earrings");
- gem = iconRegister.registerIcon(Variables.MODID + ":jewelEarrings");
- }
-
- /**
- * @param stack
- * @param pass
- * @return
- */
- @Override
- public IIcon getIcon(ItemStack stack, int pass)
- {
- if (pass == 0) return itemIcon;
- if (pass == 1 && JewelryNBT.gem(stack) != null) return gem;
- return itemIcon;
- }
+public class ItemEarrings extends ItemBaseJewelry {
+ public IIcon gem;
+
+ /**
+ *
+ */
+ public ItemEarrings() {
+ }
+
+ /**
+ * @param iconRegister
+ */
+ @Override
+ public void registerIcons(IIconRegister iconRegister) {
+ itemIcon =
+ iconRegister.registerIcon(Variables.MODID + ":earrings");
+ gem = iconRegister
+ .registerIcon(Variables.MODID + ":jewelEarrings");
+ }
+
+ /**
+ * @param stack
+ * @param pass
+ * @return
+ */
+ @Override
+ public IIcon getIcon(ItemStack stack, int pass) {
+ if (pass == 0)
+ return itemIcon;
+ if (pass == 1 && JewelryNBT.gem(stack) != null)
+ return gem;
+ return itemIcon;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemGoldObj.java b/src/main/java/darkknight/jewelrycraft/item/ItemGoldObj.java index b3553b1..86f864d 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemGoldObj.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemGoldObj.java @@ -4,6 +4,7 @@ package darkknight.jewelrycraft.item;
import java.util.List;
+
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import darkknight.jewelrycraft.config.ConfigHandler;
@@ -19,51 +20,68 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
-public class ItemGoldObj extends Item
-{
- public ItemGoldObj()
- {}
-
- public boolean requiresMultipleRenderPasses()
- {
- return true;
- }
-
- @SideOnly (Side.CLIENT)
- public boolean hasEffect(ItemStack item)
- {
- return true;
- }
-
- @SideOnly (Side.CLIENT)
- public int getColorFromItemStack(ItemStack stack, int pass)
- {
- return 0xffff00;
- }
-
- @Override
- public void registerIcons(IIconRegister iconRegister)
- {
- itemIcon = iconRegister.registerIcon("apple_golden");
- }
-
- @Override
- public IIcon getIcon(ItemStack stack, int pass)
- {
- ItemStack item = JewelryNBT.item(stack);
- if (item != null) return item.getIconIndex();
- return new ItemStack(Items.golden_apple).getIconIndex();
- }
-
- public String getItemStackDisplayName(ItemStack stack)
- {
- if (stack != null && stack.hasTagCompound() && stack.getTagCompound().hasKey("target") && Item.getItemById(Integer.valueOf(stack.getTagCompound().getTag("target").toString().split(",")[0].substring(4).replace("s", ""))) != null && JewelryNBT.item(stack) != null) return StatCollector.translateToLocal("info." + Variables.MODID + ".golden") + " " + JewelryNBT.item(stack).getDisplayName();
- return StatCollector.translateToLocal("item." + Variables.MODID + ".goldObject.name");
- }
-
- public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean displayInfo)
- {
- if (ConfigHandler.JEWELRY_INFO) if (stack != null && JewelryNBT.item(stack) != null && JewelryNBT.item(stack).getItem() instanceof ItemFood) list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("item." + Variables.MODID + ".goldObject.info.food"));
- else list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("item." + Variables.MODID + ".goldObject.info.standard"));
- }
+public class ItemGoldObj extends Item {
+ public ItemGoldObj() {
+ }
+
+ @Override
+ public boolean requiresMultipleRenderPasses() {
+ return true;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean hasEffect(ItemStack item) {
+ return true;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public int getColorFromItemStack(ItemStack stack, int pass) {
+ return 0xffff00;
+ }
+
+ @Override
+ public void registerIcons(IIconRegister iconRegister) {
+ itemIcon = iconRegister.registerIcon("apple_golden");
+ }
+
+ @Override
+ public IIcon getIcon(ItemStack stack, int pass) {
+ ItemStack item = JewelryNBT.item(stack);
+ if (item != null)
+ return item.getIconIndex();
+ return new ItemStack(Items.golden_apple).getIconIndex();
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack stack) {
+ if (stack != null && stack.hasTagCompound()
+ && stack.getTagCompound().hasKey("target")
+ && Item.getItemById(Integer.valueOf(stack.getTagCompound()
+ .getTag("target").toString().split(",")[0]
+ .substring(4).replace("s", ""))) != null
+ && JewelryNBT.item(stack) != null)
+ return StatCollector.translateToLocal(
+ "info." + Variables.MODID + ".golden") + " "
+ + JewelryNBT.item(stack).getDisplayName();
+ return StatCollector.translateToLocal(
+ "item." + Variables.MODID + ".goldObject.name");
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer player,
+ List list, boolean displayInfo) {
+ if (ConfigHandler.JEWELRY_INFO)
+ if (stack != null && JewelryNBT.item(stack) != null
+ && JewelryNBT.item(stack)
+ .getItem() instanceof ItemFood)
+ list.add(EnumChatFormatting.DARK_PURPLE + StatCollector
+ .translateToLocal("item." + Variables.MODID
+ + ".goldObject.info.food"));
+ else
+ list.add(EnumChatFormatting.DARK_PURPLE + StatCollector
+ .translateToLocal("item." + Variables.MODID
+ + ".goldObject.info.standard"));
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemGuide.java b/src/main/java/darkknight/jewelrycraft/item/ItemGuide.java index ad496f2..6780714 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemGuide.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemGuide.java @@ -7,18 +7,18 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
-public class ItemGuide extends Item
-{
- public ItemGuide()
- {
- super();
- }
-
- @Override
- public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
- {
- if (world.isRemote) player.openGui(JewelrycraftMod.instance, 1, player.worldObj, 0, 0, 0);
- player.addStat(AchievementsList.openGuide, 1);
- return stack;
- }
+public class ItemGuide extends Item {
+ public ItemGuide() {
+ super();
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack stack, World world,
+ EntityPlayer player) {
+ if (world.isRemote)
+ player.openGui(JewelrycraftMod.instance, 1, player.worldObj, 0,
+ 0, 0);
+ player.addStat(AchievementsList.openGuide, 1);
+ return stack;
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemJewelryModifier.java b/src/main/java/darkknight/jewelrycraft/item/ItemJewelryModifier.java index ed04ca6..b295ebe 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemJewelryModifier.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemJewelryModifier.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.item;
import java.util.List;
+
import darkknight.jewelrycraft.JewelrycraftMod;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@@ -8,22 +9,22 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
-public class ItemJewelryModifier extends Item
-{
- public ItemJewelryModifier()
- {
- super();
- }
-
- @Override
- public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
- {
- if (!world.isRemote && player.capabilities.isCreativeMode) player.openGui(JewelrycraftMod.instance, 3, world, 0, 0, 0);
- return stack;
- }
-
- public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
- {
- list.add(EnumChatFormatting.GRAY + "Creative Only");
- }
+public class ItemJewelryModifier extends Item {
+ public ItemJewelryModifier() {
+ super();
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack stack, World world,
+ EntityPlayer player) {
+ if (!world.isRemote && player.capabilities.isCreativeMode)
+ player.openGui(JewelrycraftMod.instance, 3, world, 0, 0, 0);
+ return stack;
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer player,
+ List list, boolean par4) {
+ list.add(EnumChatFormatting.GRAY + "Creative Only");
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemList.java b/src/main/java/darkknight/jewelrycraft/item/ItemList.java index 5a1c016..f83983e 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemList.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemList.java @@ -8,64 +8,102 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
-public class ItemList
-{
- public static Item thiefGloves;
- public static Item shadowIngot;
- public static Item molds;
- public static Item clayMolds;
- public static ItemRing ring;
- public static ItemNecklace necklace;
- public static ItemBracelet bracelet;
- public static ItemEarrings earrings;
- public static Item guide;
- public static Item jewelryModifier;
- public static ItemMoltenMetalBucket bucket;
- public static ItemMoltenMetal metal;
- public static Item goldObj;
- public static Item structureGen;
- public static Item spawnEgg;
- public static Item testItem;
-
- /**
- * @param e
- */
- public static void preInit(FMLPreInitializationEvent e)
- {
- thiefGloves = new ItemThiefGloves().setUnlocalizedName(Variables.MODID + ".thiefGloves").setTextureName(Variables.MODID + ":thiefGloves").setCreativeTab(JewelrycraftMod.jewelrycraft);
- shadowIngot = new Item().setUnlocalizedName(Variables.MODID + ".ingotShadow").setTextureName(Variables.MODID + ":ingotShadow").setCreativeTab(JewelrycraftMod.jewelrycraft);
- molds = new ItemMolds().setUnlocalizedName(Variables.MODID + ".mold").setTextureName("Mold").setCreativeTab(JewelrycraftMod.jewelrycraft);
- clayMolds = new ItemClayMolds().setUnlocalizedName(Variables.MODID + ".mold").setTextureName("Mold").setCreativeTab(JewelrycraftMod.jewelrycraft);
- ring = (ItemRing)new ItemRing().setUnlocalizedName(Variables.MODID + ".ring").setTextureName(Variables.MODID + ":ring").setCreativeTab(JewelrycraftMod.jewelrycraft);
- necklace = (ItemNecklace)new ItemNecklace().setUnlocalizedName(Variables.MODID + ".necklace").setTextureName(Variables.MODID + ":necklace").setCreativeTab(JewelrycraftMod.jewelrycraft);
- bracelet = (ItemBracelet)new ItemBracelet().setUnlocalizedName(Variables.MODID + ".bracelet").setTextureName(Variables.MODID + ":bracelet").setCreativeTab(JewelrycraftMod.jewelrycraft);
- earrings = (ItemEarrings)new ItemEarrings().setUnlocalizedName(Variables.MODID + ".earrings").setTextureName(Variables.MODID + ":earrings").setCreativeTab(JewelrycraftMod.jewelrycraft);
- guide = new ItemGuide().setUnlocalizedName(Variables.MODID + ".guide").setTextureName(Variables.MODID + ":guide").setCreativeTab(JewelrycraftMod.jewelrycraft);
- bucket = (ItemMoltenMetalBucket)new ItemMoltenMetalBucket().setUnlocalizedName(Variables.MODID + ".bucket");
- metal = (ItemMoltenMetal)new ItemMoltenMetal().setUnlocalizedName(Variables.MODID + ".bucket");
- jewelryModifier = new ItemJewelryModifier().setUnlocalizedName(Variables.MODID + ".jewelryModifier").setTextureName(Variables.MODID + ":jewelryModifier").setCreativeTab(JewelrycraftMod.jewelrycraft);
- goldObj = new ItemGoldObj().setUnlocalizedName(Variables.MODID + ".goldObject");
- structureGen = new ItemStructureGen().setUnlocalizedName(Variables.MODID + ".structureGen").setTextureName(Variables.MODID + ":structureGen").setCreativeTab(JewelrycraftMod.jewelrycraft);
- spawnEgg = new ItemSpawnEgg().setUnlocalizedName(Variables.MODID + ".monsterPlacer").setTextureName("spawn_egg");
- testItem = new ItemTest().setUnlocalizedName(Variables.MODID + ".test");
-
- GameRegistry.registerItem(thiefGloves, "thiefGloves");
- GameRegistry.registerItem(shadowIngot, "shadowIngot");
- GameRegistry.registerItem(molds, "molds");
- GameRegistry.registerItem(clayMolds, "clayMolds");
- GameRegistry.registerItem(ring, "ring");
- GameRegistry.registerItem(necklace, "necklace");
- GameRegistry.registerItem(bracelet, "bracelet");
- GameRegistry.registerItem(earrings, "earrings");
- GameRegistry.registerItem(guide, "guide");
- GameRegistry.registerItem(bucket, "moltenMetalBucket");
- GameRegistry.registerItem(metal, "moltenMetal");
- GameRegistry.registerItem(jewelryModifier, "jewelryModifier");
- GameRegistry.registerItem(goldObj, "goldObject");
- GameRegistry.registerItem(structureGen, "structureGen");
- GameRegistry.registerItem(spawnEgg, "spawnEgg");
- GameRegistry.registerItem(testItem, "testItem");
-
- OreDictionary.registerOre("ingotShadow", new ItemStack(ItemList.shadowIngot));
- }
+public class ItemList {
+ public static Item thiefGloves;
+ public static Item shadowIngot;
+ public static Item molds;
+ public static Item clayMolds;
+ public static ItemRing ring;
+ public static ItemNecklace necklace;
+ public static ItemBracelet bracelet;
+ public static ItemEarrings earrings;
+ public static Item guide;
+ public static Item jewelryModifier;
+ public static ItemMoltenMetalBucket bucket;
+ public static ItemMoltenMetal metal;
+ public static Item goldObj;
+ public static Item structureGen;
+ public static Item spawnEgg;
+ public static Item testItem;
+
+ /**
+ * @param e
+ */
+ public static void preInit(FMLPreInitializationEvent e) {
+ thiefGloves = new ItemThiefGloves()
+ .setUnlocalizedName(Variables.MODID + ".thiefGloves")
+ .setTextureName(Variables.MODID + ":thiefGloves")
+ .setCreativeTab(JewelrycraftMod.jewelrycraft);
+ shadowIngot = new Item()
+ .setUnlocalizedName(Variables.MODID + ".ingotShadow")
+ .setTextureName(Variables.MODID + ":ingotShadow")
+ .setCreativeTab(JewelrycraftMod.jewelrycraft);
+ molds = new ItemMolds()
+ .setUnlocalizedName(Variables.MODID + ".mold")
+ .setTextureName("Mold")
+ .setCreativeTab(JewelrycraftMod.jewelrycraft);
+ clayMolds = new ItemClayMolds()
+ .setUnlocalizedName(Variables.MODID + ".mold")
+ .setTextureName("Mold")
+ .setCreativeTab(JewelrycraftMod.jewelrycraft);
+ ring = (ItemRing) new ItemRing()
+ .setUnlocalizedName(Variables.MODID + ".ring")
+ .setTextureName(Variables.MODID + ":ring")
+ .setCreativeTab(JewelrycraftMod.jewelrycraft);
+ necklace = (ItemNecklace) new ItemNecklace()
+ .setUnlocalizedName(Variables.MODID + ".necklace")
+ .setTextureName(Variables.MODID + ":necklace")
+ .setCreativeTab(JewelrycraftMod.jewelrycraft);
+ bracelet = (ItemBracelet) new ItemBracelet()
+ .setUnlocalizedName(Variables.MODID + ".bracelet")
+ .setTextureName(Variables.MODID + ":bracelet")
+ .setCreativeTab(JewelrycraftMod.jewelrycraft);
+ earrings = (ItemEarrings) new ItemEarrings()
+ .setUnlocalizedName(Variables.MODID + ".earrings")
+ .setTextureName(Variables.MODID + ":earrings")
+ .setCreativeTab(JewelrycraftMod.jewelrycraft);
+ guide = new ItemGuide()
+ .setUnlocalizedName(Variables.MODID + ".guide")
+ .setTextureName(Variables.MODID + ":guide")
+ .setCreativeTab(JewelrycraftMod.jewelrycraft);
+ bucket = (ItemMoltenMetalBucket) new ItemMoltenMetalBucket()
+ .setUnlocalizedName(Variables.MODID + ".bucket");
+ metal = (ItemMoltenMetal) new ItemMoltenMetal()
+ .setUnlocalizedName(Variables.MODID + ".bucket");
+ jewelryModifier = new ItemJewelryModifier()
+ .setUnlocalizedName(Variables.MODID + ".jewelryModifier")
+ .setTextureName(Variables.MODID + ":jewelryModifier")
+ .setCreativeTab(JewelrycraftMod.jewelrycraft);
+ goldObj = new ItemGoldObj()
+ .setUnlocalizedName(Variables.MODID + ".goldObject");
+ structureGen = new ItemStructureGen()
+ .setUnlocalizedName(Variables.MODID + ".structureGen")
+ .setTextureName(Variables.MODID + ":structureGen")
+ .setCreativeTab(JewelrycraftMod.jewelrycraft);
+ spawnEgg = new ItemSpawnEgg()
+ .setUnlocalizedName(Variables.MODID + ".monsterPlacer")
+ .setTextureName("spawn_egg");
+ testItem = new ItemTest()
+ .setUnlocalizedName(Variables.MODID + ".test");
+
+ GameRegistry.registerItem(thiefGloves, "thiefGloves");
+ GameRegistry.registerItem(shadowIngot, "shadowIngot");
+ GameRegistry.registerItem(molds, "molds");
+ GameRegistry.registerItem(clayMolds, "clayMolds");
+ GameRegistry.registerItem(ring, "ring");
+ GameRegistry.registerItem(necklace, "necklace");
+ GameRegistry.registerItem(bracelet, "bracelet");
+ GameRegistry.registerItem(earrings, "earrings");
+ GameRegistry.registerItem(guide, "guide");
+ GameRegistry.registerItem(bucket, "moltenMetalBucket");
+ GameRegistry.registerItem(metal, "moltenMetal");
+ GameRegistry.registerItem(jewelryModifier, "jewelryModifier");
+ GameRegistry.registerItem(goldObj, "goldObject");
+ GameRegistry.registerItem(structureGen, "structureGen");
+ GameRegistry.registerItem(spawnEgg, "spawnEgg");
+ GameRegistry.registerItem(testItem, "testItem");
+
+ OreDictionary.registerOre("ingotShadow",
+ new ItemStack(ItemList.shadowIngot));
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemMolds.java b/src/main/java/darkknight/jewelrycraft/item/ItemMolds.java index a19c7fa..cc817de 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemMolds.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemMolds.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.item;
import java.util.List;
+
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import darkknight.jewelrycraft.util.Variables;
@@ -11,78 +12,78 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
-public class ItemMolds extends Item
-{
- /** List of molds color names */
- public static final String[] moldsItemNames = new String[]{"ingot", "ring", "necklace", "bracelet", "earrings"};
- @SideOnly (Side.CLIENT)
- private IIcon[] moldsIcons;
-
- /**
- *
- */
- public ItemMolds()
- {
- super();
- setHasSubtypes(true);
- setMaxDamage(0);
- setMaxStackSize(1);
- }
-
- /**
- * @param par1
- * @return
- */
- @Override
- @SideOnly (Side.CLIENT)
- /**
- * Gets an icon index based on an item's damage value
- */
- public IIcon getIconFromDamage(int par1)
- {
- int j = MathHelper.clamp_int(par1, 0, moldsItemNames.length - 1);
- return moldsIcons[j];
- }
-
- /**
- * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have different names based on their damage or NBT.
- *
- * @param par1ItemStack
- * @return
- */
- @Override
- public String getUnlocalizedName(ItemStack par1ItemStack)
- {
- int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, moldsItemNames.length - 1);
- return super.getUnlocalizedName() + "." + moldsItemNames[i];
- }
-
- /**
- * @param par1
- * @param par2CreativeTabs
- * @param par3List
- */
- @Override
- @SuppressWarnings ({"unchecked", "rawtypes"})
- @SideOnly (Side.CLIENT)
- /**
- * returns a list of items with the same ID, but different meta (eg: molds returns 16 items)
- */
- public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List)
- {
- for(int j = 0; j < moldsItemNames.length; ++j)
- par3List.add(new ItemStack(par1, 1, j));
- }
-
- /**
- * @param par1IconRegister
- */
- @Override
- @SideOnly (Side.CLIENT)
- public void registerIcons(IIconRegister par1IconRegister)
- {
- moldsIcons = new IIcon[moldsItemNames.length];
- for(int i = 0; i < moldsItemNames.length; ++i)
- moldsIcons[i] = par1IconRegister.registerIcon(Variables.MODID + ":" + moldsItemNames[i] + getIconString());
- }
+public class ItemMolds extends Item {
+ /** List of molds color names */
+ public static final String[] moldsItemNames = new String[] {
+ "ingot", "ring", "necklace", "bracelet", "earrings" };
+ @SideOnly(Side.CLIENT)
+ private IIcon[] moldsIcons;
+
+ /**
+ *
+ */
+ public ItemMolds() {
+ super();
+ setHasSubtypes(true);
+ setMaxDamage(0);
+ setMaxStackSize(1);
+ }
+
+ /**
+ * @param par1
+ * @return
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ /**
+ * Gets an icon index based on an item's damage value
+ */
+ public IIcon getIconFromDamage(int par1) {
+ int j = MathHelper.clamp_int(par1, 0, moldsItemNames.length - 1);
+ return moldsIcons[j];
+ }
+
+ /**
+ * Returns the unlocalized name of this item. This version accepts an
+ * ItemStack so different stacks can have different names based on
+ * their damage or NBT.
+ *
+ * @param par1ItemStack
+ * @return
+ */
+ @Override
+ public String getUnlocalizedName(ItemStack par1ItemStack) {
+ int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0,
+ moldsItemNames.length - 1);
+ return super.getUnlocalizedName() + "." + moldsItemNames[i];
+ }
+
+ /**
+ * @param par1
+ * @param par2CreativeTabs
+ * @param par3List
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ /**
+ * returns a list of items with the same ID, but different meta (eg:
+ * molds returns 16 items)
+ */
+ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs,
+ List par3List) {
+ for (int j = 0; j < moldsItemNames.length; ++j)
+ par3List.add(new ItemStack(par1, 1, j));
+ }
+
+ /**
+ * @param par1IconRegister
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister par1IconRegister) {
+ moldsIcons = new IIcon[moldsItemNames.length];
+ for (int i = 0; i < moldsItemNames.length; ++i)
+ moldsIcons[i] = par1IconRegister.registerIcon(Variables.MODID
+ + ":" + moldsItemNames[i] + getIconString());
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java b/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java index a33e9f7..dc5fbae 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java @@ -9,36 +9,35 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-public class ItemMoltenMetal extends Item
-{
- /**
- *
- */
- public ItemMoltenMetal()
- {
- super();
- setMaxStackSize(1);
- }
-
- /**
- * @param iconRegister
- */
- @Override
- public void registerIcons(IIconRegister iconRegister)
- {
- itemIcon = iconRegister.registerIcon(Variables.MODID + ":moltenMetalStill");
- }
-
- /**
- * @param stack
- * @param pass
- * @return
- */
- @Override
- @SideOnly (Side.CLIENT)
- public int getColorFromItemStack(ItemStack stack, int pass)
- {
- if(JewelryNBT.ingot(stack) != null) return JewelrycraftUtil.getColor(JewelryNBT.ingot(stack));
- else return 0xFFFFFF;
- }
+public class ItemMoltenMetal extends Item {
+ /**
+ *
+ */
+ public ItemMoltenMetal() {
+ super();
+ setMaxStackSize(1);
+ }
+
+ /**
+ * @param iconRegister
+ */
+ @Override
+ public void registerIcons(IIconRegister iconRegister) {
+ itemIcon = iconRegister
+ .registerIcon(Variables.MODID + ":moltenMetalStill");
+ }
+
+ /**
+ * @param stack
+ * @param pass
+ * @return
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public int getColorFromItemStack(ItemStack stack, int pass) {
+ if (JewelryNBT.ingot(stack) != null)
+ return JewelrycraftUtil.getColor(JewelryNBT.ingot(stack));
+ else
+ return 0xFFFFFF;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java b/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java index 09e5adc..6e36412 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java @@ -31,81 +31,122 @@ public class ItemMoltenMetalBucket extends Item { }
@Override
- public ItemStack onItemRightClick(ItemStack stack, World par2World, EntityPlayer par3EntityPlayer) {
+ public ItemStack onItemRightClick(ItemStack stack, World par2World,
+ EntityPlayer par3EntityPlayer) {
boolean flag = BlockList.moltenMetal == Blocks.air;
- MovingObjectPosition movingobjectposition = getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, flag);
- if (movingobjectposition == null) return stack;
+ MovingObjectPosition movingobjectposition =
+ getMovingObjectPositionFromPlayer(par2World,
+ par3EntityPlayer, flag);
+ if (movingobjectposition == null)
+ return stack;
else {
- FillBucketEvent event = new FillBucketEvent(par3EntityPlayer, stack, par2World, movingobjectposition);
- if (MinecraftForge.EVENT_BUS.post(event)) return stack;
+ FillBucketEvent event = new FillBucketEvent(par3EntityPlayer,
+ stack, par2World, movingobjectposition);
+ if (MinecraftForge.EVENT_BUS.post(event))
+ return stack;
if (event.getResult() == Event.Result.ALLOW) {
- if (par3EntityPlayer.capabilities.isCreativeMode) return stack;
- if (--stack.stackSize <= 0) return event.result;
- if (!par3EntityPlayer.inventory.addItemStackToInventory(event.result)) par3EntityPlayer.dropPlayerItemWithRandomChoice(event.result, false);
+ if (par3EntityPlayer.capabilities.isCreativeMode)
+ return stack;
+ if (--stack.stackSize <= 0)
+ return event.result;
+ if (!par3EntityPlayer.inventory
+ .addItemStackToInventory(event.result))
+ par3EntityPlayer.dropPlayerItemWithRandomChoice(
+ event.result, false);
return stack;
}
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
- if (!par2World.canMineBlock(par3EntityPlayer, i, j, k)) return stack;
+ if (!par2World.canMineBlock(par3EntityPlayer, i, j, k))
+ return stack;
if (flag) {
- if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, stack)) return stack;
+ if (!par3EntityPlayer.canPlayerEdit(i, j, k,
+ movingobjectposition.sideHit, stack))
+ return stack;
par2World.getBlock(i, j, k).getMaterial();
par2World.getBlockMetadata(i, j, k);
par2World.setBlockToAir(i, j, k);
- return func_150910_a(stack, par3EntityPlayer, ItemList.bucket);
+ return func_150910_a(stack, par3EntityPlayer,
+ ItemList.bucket);
} else {
- if (BlockList.moltenMetal == Blocks.air) return new ItemStack(Items.bucket);
- if (movingobjectposition.sideHit == 0) --j;
- else if (movingobjectposition.sideHit == 1) ++j;
- else if (movingobjectposition.sideHit == 2) --k;
- else if (movingobjectposition.sideHit == 3) ++k;
- else if (movingobjectposition.sideHit == 4) --i;
- else if (movingobjectposition.sideHit == 5) ++i;
- if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, stack)) return stack;
- if (tryPlaceContainedLiquid(par2World, i, j, k, stack) && !par3EntityPlayer.capabilities.isCreativeMode) return new ItemStack(Items.bucket);
+ if (BlockList.moltenMetal == Blocks.air)
+ return new ItemStack(Items.bucket);
+ if (movingobjectposition.sideHit == 0)
+ --j;
+ else if (movingobjectposition.sideHit == 1)
+ ++j;
+ else if (movingobjectposition.sideHit == 2)
+ --k;
+ else if (movingobjectposition.sideHit == 3)
+ ++k;
+ else if (movingobjectposition.sideHit == 4)
+ --i;
+ else if (movingobjectposition.sideHit == 5)
+ ++i;
+ if (!par3EntityPlayer.canPlayerEdit(i, j, k,
+ movingobjectposition.sideHit, stack))
+ return stack;
+ if (tryPlaceContainedLiquid(par2World, i, j, k, stack)
+ && !par3EntityPlayer.capabilities.isCreativeMode)
+ return new ItemStack(Items.bucket);
}
}
return stack;
}
}
- private ItemStack func_150910_a(ItemStack p_150910_1_, EntityPlayer p_150910_2_, Item p_150910_3_) {
- if (p_150910_2_.capabilities.isCreativeMode) return p_150910_1_;
- else if (--p_150910_1_.stackSize <= 0) return new ItemStack(p_150910_3_);
+ private ItemStack func_150910_a(ItemStack p_150910_1_,
+ EntityPlayer p_150910_2_, Item p_150910_3_) {
+ if (p_150910_2_.capabilities.isCreativeMode)
+ return p_150910_1_;
+ else if (--p_150910_1_.stackSize <= 0)
+ return new ItemStack(p_150910_3_);
else {
- if (!p_150910_2_.inventory.addItemStackToInventory(new ItemStack(p_150910_3_))) p_150910_2_.dropPlayerItemWithRandomChoice(new ItemStack(p_150910_3_, 1, 0), false);
+ if (!p_150910_2_.inventory
+ .addItemStackToInventory(new ItemStack(p_150910_3_)))
+ p_150910_2_.dropPlayerItemWithRandomChoice(
+ new ItemStack(p_150910_3_, 1, 0), false);
return p_150910_1_;
}
}
- public static boolean tryPlaceContainedLiquid(World world, int x, int y, int z, ItemStack stack) {
- if (BlockList.moltenMetal == Blocks.air) return false;
+ public static boolean tryPlaceContainedLiquid(World world, int x,
+ int y, int z, ItemStack stack) {
+ if (BlockList.moltenMetal == Blocks.air)
+ return false;
else {
Material material = world.getBlock(x, y, z).getMaterial();
boolean flag = !material.isSolid();
- if (!world.isAirBlock(x, y, z) && !flag) return false;
+ if (!world.isAirBlock(x, y, z) && !flag)
+ return false;
else if (stack != null && JewelryNBT.ingot(stack) != null) {
- if (!world.isRemote && flag && !material.isLiquid()) world.func_147480_a(x, y, z, true);
+ if (!world.isRemote && flag && !material.isLiquid())
+ world.func_147480_a(x, y, z, true);
world.setBlock(x, y, z, BlockList.moltenMetal, 0, 3);
- TileEntity moltenLiquid = world.getTileEntity(x, y, z);
- if(moltenLiquid instanceof TileEntityMoltenMetal) ((TileEntityMoltenMetal) moltenLiquid).setMetal(JewelryNBT.ingot(stack));
+ TileEntity moltenLiquid = world.getTileEntity(x, y, z);
+ if (moltenLiquid instanceof TileEntityMoltenMetal)
+ ((TileEntityMoltenMetal) moltenLiquid)
+ .setMetal(JewelryNBT.ingot(stack));
return true;
- } else return false;
+ } else
+ return false;
}
}
@Override
public void registerIcons(IIconRegister iconRegister) {
itemIcon = iconRegister.registerIcon("bucket_empty");
- liquid = iconRegister.registerIcon(Variables.MODID + ":bucketOverlay");
+ liquid = iconRegister
+ .registerIcon(Variables.MODID + ":bucketOverlay");
}
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass) {
- if (pass == 1 && JewelryNBT.ingot(stack) != null) return JewelrycraftUtil.getColor(JewelryNBT.ingot(stack));
+ if (pass == 1 && JewelryNBT.ingot(stack) != null)
+ return JewelrycraftUtil.getColor(JewelryNBT.ingot(stack));
return 16777215;
}
@@ -116,8 +157,10 @@ public class ItemMoltenMetalBucket extends Item { @Override
public IIcon getIcon(ItemStack stack, int pass) {
- if (pass == 0) return itemIcon;
- if (pass == 1) return liquid;
+ if (pass == 0)
+ return itemIcon;
+ if (pass == 1)
+ return liquid;
return itemIcon;
}
@@ -133,12 +176,23 @@ public class ItemMoltenMetalBucket extends Item { if (JewelryNBT.ingot(stack) != null) {
ItemStack ingot = JewelryNBT.ingot(stack);
if (ingot != null) {
- return StatCollector.translateToLocal(getUnlocalizedNameInefficiently(stack) + ".name").trim() + " " + ingot.getDisplayName().replace("Ingot", " ").trim();
- } else return StatCollector.translateToLocal("bucket.unknown");
+ return StatCollector
+ .translateToLocal(
+ getUnlocalizedNameInefficiently(stack)
+ + ".name")
+ .trim() + " "
+ + ingot.getDisplayName().replace("Ingot", " ")
+ .trim();
+ } else
+ return StatCollector
+ .translateToLocal("bucket.unknown");
}
} catch (Exception e) {
System.out.println("Error: " + e);
}
- return ("" + StatCollector.translateToLocal(getUnlocalizedNameInefficiently(stack) + ".name")).trim() + " " + StatCollector.translateToLocal("info.jewelrycraft2.metal");
+ return ("" + StatCollector.translateToLocal(
+ getUnlocalizedNameInefficiently(stack) + ".name")).trim()
+ + " " + StatCollector
+ .translateToLocal("info.jewelrycraft2.metal");
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemNecklace.java b/src/main/java/darkknight/jewelrycraft/item/ItemNecklace.java index dc5dafa..d14230a 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemNecklace.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemNecklace.java @@ -6,36 +6,37 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
-public class ItemNecklace extends ItemBaseJewelry
-{
- public IIcon gem;
-
- /**
- *
- */
- public ItemNecklace()
- {}
-
- /**
- * @param iconRegister
- */
- @Override
- public void registerIcons(IIconRegister iconRegister)
- {
- itemIcon = iconRegister.registerIcon(Variables.MODID + ":necklace");
- gem = iconRegister.registerIcon(Variables.MODID + ":jewelNecklace");
- }
-
- /**
- * @param stack
- * @param pass
- * @return
- */
- @Override
- public IIcon getIcon(ItemStack stack, int pass)
- {
- if (pass == 0) return itemIcon;
- if (pass == 1 && JewelryNBT.gem(stack) != null) return gem;
- return itemIcon;
- }
+public class ItemNecklace extends ItemBaseJewelry {
+ public IIcon gem;
+
+ /**
+ *
+ */
+ public ItemNecklace() {
+ }
+
+ /**
+ * @param iconRegister
+ */
+ @Override
+ public void registerIcons(IIconRegister iconRegister) {
+ itemIcon =
+ iconRegister.registerIcon(Variables.MODID + ":necklace");
+ gem = iconRegister
+ .registerIcon(Variables.MODID + ":jewelNecklace");
+ }
+
+ /**
+ * @param stack
+ * @param pass
+ * @return
+ */
+ @Override
+ public IIcon getIcon(ItemStack stack, int pass) {
+ if (pass == 0)
+ return itemIcon;
+ if (pass == 1 && JewelryNBT.gem(stack) != null)
+ return gem;
+ return itemIcon;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemRing.java b/src/main/java/darkknight/jewelrycraft/item/ItemRing.java index d199979..87ca8d8 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemRing.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemRing.java @@ -6,36 +6,35 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
-public class ItemRing extends ItemBaseJewelry
-{
- public IIcon gem;
-
- /**
- *
- */
- public ItemRing()
- {}
-
- /**
- * @param iconRegister
- */
- @Override
- public void registerIcons(IIconRegister iconRegister)
- {
- itemIcon = iconRegister.registerIcon(Variables.MODID + ":ring");
- gem = iconRegister.registerIcon(Variables.MODID + ":jewelRing");
- }
-
- /**
- * @param stack
- * @param pass
- * @return
- */
- @Override
- public IIcon getIcon(ItemStack stack, int pass)
- {
- if (pass == 0) return itemIcon;
- if (pass == 1 && JewelryNBT.gem(stack) != null) return gem;
- return itemIcon;
- }
+public class ItemRing extends ItemBaseJewelry {
+ public IIcon gem;
+
+ /**
+ *
+ */
+ public ItemRing() {
+ }
+
+ /**
+ * @param iconRegister
+ */
+ @Override
+ public void registerIcons(IIconRegister iconRegister) {
+ itemIcon = iconRegister.registerIcon(Variables.MODID + ":ring");
+ gem = iconRegister.registerIcon(Variables.MODID + ":jewelRing");
+ }
+
+ /**
+ * @param stack
+ * @param pass
+ * @return
+ */
+ @Override
+ public IIcon getIcon(ItemStack stack, int pass) {
+ if (pass == 0)
+ return itemIcon;
+ if (pass == 1 && JewelryNBT.gem(stack) != null)
+ return gem;
+ return itemIcon;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemSpawnEgg.java b/src/main/java/darkknight/jewelrycraft/item/ItemSpawnEgg.java index 474c778..cceab12 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemSpawnEgg.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemSpawnEgg.java @@ -3,6 +3,7 @@ package darkknight.jewelrycraft.item; import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import darkknight.jewelrycraft.entities.EntityHeart;
@@ -27,10 +28,14 @@ import net.minecraft.world.World; * @author Betweenlands
*/
public class ItemSpawnEgg extends ItemMonsterPlacer {
- private static final Map<Short, EggData> eggTypes = new LinkedHashMap<Short, EggData>();
-
- public static void registerSpawnEgg(Class<? extends EntityLiving> entity, String entityName, int id, int eggBackgroundColor, int eggForegroundColor) {
- eggTypes.put((short) id, new EggData(id, entityName, entity, eggBackgroundColor, eggForegroundColor));
+ private static final Map<Short, EggData> eggTypes =
+ new LinkedHashMap<Short, EggData>();
+
+ public static void registerSpawnEgg(
+ Class<? extends EntityLiving> entity, String entityName,
+ int id, int eggBackgroundColor, int eggForegroundColor) {
+ eggTypes.put((short) id, new EggData(id, entityName, entity,
+ eggBackgroundColor, eggForegroundColor));
}
private static EggData getEggData(ItemStack is) {
@@ -44,18 +49,24 @@ public class ItemSpawnEgg extends ItemMonsterPlacer { @Override
public String getItemStackDisplayName(ItemStack is) {
- String s = StatCollector.translateToLocal(getUnlocalizedName() + ".name").trim();
+ String s = StatCollector
+ .translateToLocal(getUnlocalizedName() + ".name").trim();
String mob = "";
EggData egg = getEggData(is);
- if (egg != null) mob = StatCollector.translateToLocal("entity." + Variables.MODID + "." + egg.entityName + ".name");
+ if (egg != null)
+ mob = StatCollector.translateToLocal("entity."
+ + Variables.MODID + "." + egg.entityName + ".name");
return String.format(s, mob);
}
@Override
- public boolean onItemUse(ItemStack is, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
- if (world.isRemote) return true;
+ public boolean onItemUse(ItemStack is, EntityPlayer player,
+ World world, int x, int y, int z, int side, float hitX,
+ float hitY, float hitZ) {
+ if (world.isRemote)
+ return true;
Block block = world.getBlock(x, y, z);
x += Facing.offsetsXForSide[side];
@@ -64,31 +75,41 @@ public class ItemSpawnEgg extends ItemMonsterPlacer { EggData egg = getEggData(is);
if (egg != null) {
- egg.spawnMob(world, x + 0.5D, y + (side == 1 && block != null && block.getRenderType() == 11 ? 0.5D : 0D), z + 0.5D, is);
+ egg.spawnMob(world, x + 0.5D,
+ y + (side == 1 && block != null
+ && block.getRenderType() == 11 ? 0.5D : 0D),
+ z + 0.5D, is);
- if (!player.capabilities.isCreativeMode) --is.stackSize;
+ if (!player.capabilities.isCreativeMode)
+ --is.stackSize;
}
return true;
}
@Override
- public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer player) {
- if (world.isRemote) return is;
+ public ItemStack onItemRightClick(ItemStack is, World world,
+ EntityPlayer player) {
+ if (world.isRemote)
+ return is;
- MovingObjectPosition mop = getMovingObjectPositionFromPlayer(world, player, true);
+ MovingObjectPosition mop =
+ getMovingObjectPositionFromPlayer(world, player, true);
if (mop != null && mop.typeOfHit == MovingObjectType.BLOCK) {
int x = mop.blockX, y = mop.blockY, z = mop.blockZ;
- if (!world.canMineBlock(player, x, y, z) || !player.canPlayerEdit(x, y, z, mop.sideHit, is)) return is;
+ if (!world.canMineBlock(player, x, y, z)
+ || !player.canPlayerEdit(x, y, z, mop.sideHit, is))
+ return is;
if (world.getBlock(x, y, z).getMaterial() == Material.water) {
EggData egg = getEggData(is);
if (egg != null) {
egg.spawnMob(world, x, y, z, is);
- if (!player.capabilities.isCreativeMode) --is.stackSize;
+ if (!player.capabilities.isCreativeMode)
+ --is.stackSize;
}
}
}
@@ -96,7 +117,8 @@ public class ItemSpawnEgg extends ItemMonsterPlacer { return is;
}
- public static EntityLiving getEntity(World world, double x, double y, double z, ItemStack is) {
+ public static EntityLiving getEntity(World world, double x, double y,
+ double z, ItemStack is) {
EggData egg = getEggData(is);
return egg.spawnMob(world, x, y, z, is);
}
@@ -105,10 +127,11 @@ public class ItemSpawnEgg extends ItemMonsterPlacer { @SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack is, int pass) {
EggData egg = getEggData(is);
- return egg != null ? pass == 0 ? egg.primaryColor : egg.secondaryColor : 16777215;
+ return egg != null
+ ? pass == 0 ? egg.primaryColor : egg.secondaryColor
+ : 16777215;
}
- @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item id, CreativeTabs tab, List list) {
@@ -123,11 +146,19 @@ public class ItemSpawnEgg extends ItemMonsterPlacer { int primaryColor;
int secondaryColor;
- EggData(int id, String entityName, Class<? extends EntityLiving> entityClass, int[] rgbPrimaryColor, int[] rgbSecondaryColor) {
- this(id, entityName, entityClass, rgbPrimaryColor[0] << 16 | rgbPrimaryColor[1] << 8 | rgbPrimaryColor[2], rgbSecondaryColor[0] << 16 | rgbSecondaryColor[1] << 8 | rgbSecondaryColor[2]);
+ EggData(int id, String entityName,
+ Class<? extends EntityLiving> entityClass,
+ int[] rgbPrimaryColor, int[] rgbSecondaryColor) {
+ this(id, entityName, entityClass,
+ rgbPrimaryColor[0] << 16 | rgbPrimaryColor[1] << 8
+ | rgbPrimaryColor[2],
+ rgbSecondaryColor[0] << 16 | rgbSecondaryColor[1] << 8
+ | rgbSecondaryColor[2]);
}
- EggData(int id, String entityName, Class<? extends EntityLiving> entityClass, int primaryColor, int secondaryColor) {
+ EggData(int id, String entityName,
+ Class<? extends EntityLiving> entityClass,
+ int primaryColor, int secondaryColor) {
this.id = (short) id;
this.entityName = entityName;
this.entityClass = entityClass;
@@ -135,35 +166,48 @@ public class ItemSpawnEgg extends ItemMonsterPlacer { this.secondaryColor = secondaryColor;
}
- public EntityLiving spawnMob(World world, double x, double y, double z, ItemStack is) {
+ public EntityLiving spawnMob(World world, double x, double y,
+ double z, ItemStack is) {
EntityLiving e = null;
try {
- e = entityClass.getConstructor(World.class).newInstance(world);
+ e = entityClass.getConstructor(World.class)
+ .newInstance(world);
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
- if (e == null) return null;
+ if (e == null)
+ return null;
if (e instanceof EntityHeart) {
- if (id == 2) ((EntityHeart) e).setType("White");
- else if (id == 3) ((EntityHeart) e).setType("Blue");
- else if (id == 4) ((EntityHeart) e).setType("Black");
- else if (id == 6) ((EntityHeart) e).setType("White");
- else if (id == 7) ((EntityHeart) e).setType("Blue");
- else if (id == 8) ((EntityHeart) e).setType("Black");
- else ((EntityHeart) e).setType("Red");
+ if (id == 2)
+ ((EntityHeart) e).setType("White");
+ else if (id == 3)
+ ((EntityHeart) e).setType("Blue");
+ else if (id == 4)
+ ((EntityHeart) e).setType("Black");
+ else if (id == 6)
+ ((EntityHeart) e).setType("White");
+ else if (id == 7)
+ ((EntityHeart) e).setType("Blue");
+ else if (id == 8)
+ ((EntityHeart) e).setType("Black");
+ else
+ ((EntityHeart) e).setType("Red");
}
- e.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360F), 0F);
+ e.setLocationAndAngles(x, y, z, MathHelper
+ .wrapAngleTo180_float(world.rand.nextFloat() * 360F),
+ 0F);
e.rotationYawHead = e.rotationYaw;
e.renderYawOffset = e.rotationYaw;
e.onSpawnWithEgg((IEntityLivingData) null);
world.spawnEntityInWorld(e);
e.playLivingSound();
- if (is.hasDisplayName()) e.setCustomNameTag(is.getDisplayName());
+ if (is.hasDisplayName())
+ e.setCustomNameTag(is.getDisplayName());
return e;
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemStructureGen.java b/src/main/java/darkknight/jewelrycraft/item/ItemStructureGen.java index 9c0b03f..4ff91df 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemStructureGen.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemStructureGen.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.item;
import java.util.List;
+
import darkknight.jewelrycraft.util.JewelrycraftUtil;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@@ -9,41 +10,48 @@ import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
-public class ItemStructureGen extends Item
-{
- int no = 0;
-
- public ItemStructureGen()
- {
- super();
- }
-
- @Override
- public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
- {
- if (!world.isRemote && player.capabilities.isCreativeMode){
- if (!player.isSneaking()){
- if (no < JewelrycraftUtil.structures.size() - 1) no++;
- else no = 0;
- }else
- {
- if (no > 0) no--;
- else no = JewelrycraftUtil.structures.size() - 1;
- }
- player.addChatMessage(new ChatComponentText("Structure no. " + (no + 1)));
- }
- return stack;
- }
-
- @Override
- public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par1, float par2, float par3, float par4)
- {
- if(player.capabilities.isCreativeMode) JewelrycraftUtil.structures.get(no).generate(world, world.getBiomeGenForCoords(x, z), itemRand, x, y + 1, z);
- return true;
- }
-
- public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
- {
- list.add(EnumChatFormatting.GRAY + "Creative Only");
- }
+public class ItemStructureGen extends Item {
+ int no = 0;
+
+ public ItemStructureGen() {
+ super();
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack stack, World world,
+ EntityPlayer player) {
+ if (!world.isRemote && player.capabilities.isCreativeMode) {
+ if (!player.isSneaking()) {
+ if (no < JewelrycraftUtil.structures.size() - 1)
+ no++;
+ else
+ no = 0;
+ } else {
+ if (no > 0)
+ no--;
+ else
+ no = JewelrycraftUtil.structures.size() - 1;
+ }
+ player.addChatMessage(
+ new ChatComponentText("Structure no. " + (no + 1)));
+ }
+ return stack;
+ }
+
+ @Override
+ public boolean onItemUse(ItemStack stack, EntityPlayer player,
+ World world, int x, int y, int z, int par1, float par2,
+ float par3, float par4) {
+ if (player.capabilities.isCreativeMode)
+ JewelrycraftUtil.structures.get(no).generate(world,
+ world.getBiomeGenForCoords(x, z), itemRand, x, y + 1,
+ z);
+ return true;
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer player,
+ List list, boolean par4) {
+ list.add(EnumChatFormatting.GRAY + "Creative Only");
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemTest.java b/src/main/java/darkknight/jewelrycraft/item/ItemTest.java index 250ec1b..4b16a86 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemTest.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemTest.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.item;
import java.util.List;
+
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import darkknight.jewelrycraft.api.Curse;
@@ -18,59 +19,61 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition.MovingObjectType;
import net.minecraft.world.World;
-public class ItemTest extends Item
-{
- @SideOnly (Side.CLIENT)
- private IIcon[] icons;
- private NBTTagCompound nbt = new NBTTagCompound();
-
- public ItemTest()
- {
- super();
- setHasSubtypes(true);
- }
-
- @Override
- @SideOnly (Side.CLIENT)
- public IIcon getIconFromDamage(int damage)
- {
- int j = MathHelper.clamp_int(damage, 0, Curse.getCurseList().size() - 1);
- return icons[j];
- }
-
- public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List)
- {
- for(int j = 0; j < Curse.getCurseList().size(); ++j)
- par3List.add(new ItemStack(par1, 1, j));
- }
-
- public void registerIcons(IIconRegister par1IconRegister)
- {
- icons = new IIcon[Curse.getCurseList().size()];
- for(int i = 0; i < Curse.getCurseList().size(); ++i)
- icons[i] = par1IconRegister.registerIcon(Variables.MODID + ":" + "testItem_" + i);
- }
-
- @Override
- public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
- {
- MovingObjectPosition mop = getMovingObjectPositionFromPlayer(world, player, true);
+public class ItemTest extends Item {
+ @SideOnly(Side.CLIENT)
+ private IIcon[] icons;
+ private NBTTagCompound nbt = new NBTTagCompound();
+
+ public ItemTest() {
+ super();
+ setHasSubtypes(true);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(int damage) {
+ int j = MathHelper.clamp_int(damage, 0,
+ Curse.getCurseList().size() - 1);
+ return icons[j];
+ }
+
+ @Override
+ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs,
+ List par3List) {
+ for (int j = 0; j < Curse.getCurseList().size(); ++j)
+ par3List.add(new ItemStack(par1, 1, j));
+ }
+
+ @Override
+ public void registerIcons(IIconRegister par1IconRegister) {
+ icons = new IIcon[Curse.getCurseList().size()];
+ for (int i = 0; i < Curse.getCurseList().size(); ++i)
+ icons[i] = par1IconRegister
+ .registerIcon(Variables.MODID + ":" + "testItem_" + i);
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack stack, World world,
+ EntityPlayer player) {
+ MovingObjectPosition mop =
+ getMovingObjectPositionFromPlayer(world, player, true);
if (mop != null && mop.typeOfHit == MovingObjectType.BLOCK) {
int x = mop.blockX, y = mop.blockY, z = mop.blockZ;
TileEntity tile = world.getTileEntity(x, y, z);
- if(tile != null)
- if(!player.isSneaking()) tile.writeToNBT(nbt);
- else{
- NBTTagCompound block = new NBTTagCompound();
- tile.writeToNBT(block);
- nbt.setString("id", block.getString("id"));
- nbt.setInteger("x", tile.xCoord);
- nbt.setInteger("y", tile.yCoord);
- nbt.setInteger("z", tile.zCoord);
- tile.readFromNBT(nbt);
- world.func_147479_m(x, y, z);
- }
+ if (tile != null)
+ if (!player.isSneaking())
+ tile.writeToNBT(nbt);
+ else {
+ NBTTagCompound block = new NBTTagCompound();
+ tile.writeToNBT(block);
+ nbt.setString("id", block.getString("id"));
+ nbt.setInteger("x", tile.xCoord);
+ nbt.setInteger("y", tile.yCoord);
+ nbt.setInteger("z", tile.zCoord);
+ tile.readFromNBT(nbt);
+ world.func_147479_m(x, y, z);
+ }
}
- return stack;
- }
+ return stack;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemThiefGloves.java b/src/main/java/darkknight/jewelrycraft/item/ItemThiefGloves.java index 1d664be..4ca3c0f 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/item/ItemThiefGloves.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemThiefGloves.java @@ -3,7 +3,9 @@ package darkknight.jewelrycraft.item; import java.util.Iterator;
import java.util.List;
import java.util.Random;
+
import org.lwjgl.input.Keyboard;
+
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.ReflectionHelper;
import cpw.mods.fml.relauncher.Side;
@@ -41,85 +43,197 @@ public class ItemThiefGloves extends Item { * @return
*/
@Override
- public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity) {
- String villagerString = StatCollector.translateToLocal("info." + Variables.MODID + ".villager");
+ public boolean itemInteractionForEntity(ItemStack stack,
+ EntityPlayer player, EntityLivingBase entity) {
+ String villagerString = StatCollector
+ .translateToLocal("info." + Variables.MODID + ".villager");
if (entity instanceof EntityVillager) {
EntityVillager villager = (EntityVillager) entity;
- int wealth = (Integer) ReflectionHelper.getPrivateValue(EntityVillager.class, villager, "wealth", "field_70956_bz");
- MerchantRecipeList buyingList = (MerchantRecipeList) ReflectionHelper.getPrivateValue(EntityVillager.class, villager, "buyingList", "field_70963_i");
+ int wealth = (Integer) ReflectionHelper.getPrivateValue(
+ EntityVillager.class, villager, "wealth",
+ "field_70956_bz");
+ MerchantRecipeList buyingList =
+ (MerchantRecipeList) ReflectionHelper.getPrivateValue(
+ EntityVillager.class, villager, "buyingList",
+ "field_70963_i");
int chance = 1;
boolean areOtherVillagersAround = false, canTheySeeYou = false;
- AxisAlignedBB axisalignedbb = villager.boundingBox.expand(2.0D, 0.0D, 2.0D);
- List entities = villager.worldObj.getEntitiesWithinAABBExcludingEntity(villager, axisalignedbb);
+ AxisAlignedBB axisalignedbb =
+ villager.boundingBox.expand(2.0D, 0.0D, 2.0D);
+ List<?> entities =
+ villager.worldObj.getEntitiesWithinAABBExcludingEntity(
+ villager, axisalignedbb);
for (Object s : entities)
- if (s instanceof EntityVillager && ((EntityVillager) s).canEntityBeSeen(player)) {
+ if (s instanceof EntityVillager
+ && ((EntityVillager) s).canEntityBeSeen(player)) {
chance += 1;
canTheySeeYou = true;
areOtherVillagersAround = true;
}
- if (villager.canEntityBeSeen(player)) chance += 2;
- if (player.isPotionActive(Potion.invisibility)) chance -= (0.8 * chance);
- if (player.capabilities.isCreativeMode) chance = 1;
+ if (villager.canEntityBeSeen(player))
+ chance += 2;
+ if (player.isPotionActive(Potion.invisibility))
+ chance -= (0.8 * chance);
+ if (player.capabilities.isCreativeMode)
+ chance = 1;
int steal = rand.nextInt(chance);
if (steal == 0) {
villager.dropItem(Items.emerald, wealth);
- ReflectionHelper.setPrivateValue(EntityVillager.class, villager, 0, "wealth", "field_70956_bz");
+ ReflectionHelper.setPrivateValue(EntityVillager.class,
+ villager, 0, "wealth", "field_70956_bz");
}
if (buyingList != null) {
Iterator<?> iterator = buyingList.iterator();
if (steal == 0) {
while (iterator.hasNext()) {
- MerchantRecipe recipe = (MerchantRecipe) iterator.next();
- int toolUses = (Integer) ReflectionHelper.getPrivateValue(MerchantRecipe.class, recipe, "toolUses", "field_77400_d");
+ MerchantRecipe recipe =
+ (MerchantRecipe) iterator.next();
+ int toolUses =
+ (Integer) ReflectionHelper.getPrivateValue(
+ MerchantRecipe.class, recipe,
+ "toolUses", "field_77400_d");
int quantity;
- if (recipe.getItemToSell().isStackable()) quantity = recipe.getItemToSell().stackSize * (7 - toolUses);
- else quantity = recipe.getItemToSell().stackSize;
- ItemStack s = new ItemStack(recipe.getItemToSell().getItem(), quantity, recipe.getItemToSell().getItemDamage());
- s.setTagCompound(recipe.getItemToSell().getTagCompound());
- if (player.inventory.addItemStackToInventory(s)) ;
- else villager.entityDropItem(s, 0);
- if (!player.capabilities.isCreativeMode) JewelrycraftUtil.addCursePoints(player, 5);
- player.addChatMessage(new ChatComponentText(villagerString + " #" + villager.getProfession() + ": " + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".villager.confusion") + " " + s.getDisplayName() + "!"));
+ if (recipe.getItemToSell().isStackable())
+ quantity = recipe.getItemToSell().stackSize
+ * (7 - toolUses);
+ else
+ quantity = recipe.getItemToSell().stackSize;
+ ItemStack s = new ItemStack(
+ recipe.getItemToSell().getItem(), quantity,
+ recipe.getItemToSell().getItemDamage());
+ s.setTagCompound(
+ recipe.getItemToSell().getTagCompound());
+ if (player.inventory.addItemStackToInventory(s))
+ ;
+ else
+ villager.entityDropItem(s, 0);
+ if (!player.capabilities.isCreativeMode)
+ JewelrycraftUtil.addCursePoints(player, 5);
+ player.addChatMessage(
+ new ChatComponentText(villagerString + " #"
+ + villager.getProfession() + ": "
+ + StatCollector.translateToLocal(
+ "chatmessage."
+ + Variables.MODID
+ + ".villager.confusion")
+ + " " + s.getDisplayName() + "!"));
stack.damageItem(1, player);
}
buyingList.clear();
- ReflectionHelper.setPrivateValue(EntityVillager.class, villager, 300, "timeUntilReset", "field_70961_j");
- ReflectionHelper.setPrivateValue(EntityVillager.class, villager, true, "needsInitilization", "field_70959_by");
- player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".whisper") + ": "));
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".stealSuccess1")));
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".stealSuccess2")));
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".stealSuccess3")));
- }
- else {
+ ReflectionHelper.setPrivateValue(EntityVillager.class,
+ villager, 300, "timeUntilReset",
+ "field_70961_j");
+ ReflectionHelper.setPrivateValue(EntityVillager.class,
+ villager, true, "needsInitilization",
+ "field_70959_by");
+ player.addChatMessage(
+ new ChatComponentText(StatCollector
+ .translateToLocal("chatmessage."
+ + Variables.MODID + ".whisper")
+ + ": "));
+ player.addChatMessage(new ChatComponentText(
+ EnumChatFormatting.DARK_PURPLE + StatCollector
+ .translateToLocal("chatmessage."
+ + Variables.MODID
+ + ".stealSuccess1")));
+ player.addChatMessage(new ChatComponentText(
+ EnumChatFormatting.DARK_PURPLE + StatCollector
+ .translateToLocal("chatmessage."
+ + Variables.MODID
+ + ".stealSuccess2")));
+ player.addChatMessage(new ChatComponentText(
+ EnumChatFormatting.DARK_PURPLE + StatCollector
+ .translateToLocal("chatmessage."
+ + Variables.MODID
+ + ".stealSuccess3")));
+ } else {
stack.damageItem(1, player);
- if (!player.capabilities.isCreativeMode) JewelrycraftUtil.addCursePoints(player, 25);
+ if (!player.capabilities.isCreativeMode)
+ JewelrycraftUtil.addCursePoints(player, 25);
if (player.isPotionActive(Potion.invisibility)) {
- player.addChatMessage(new ChatComponentText(villagerString + " #" + villager.getProfession() + " " + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".steal.fail")));
- }
- else {
+ player.addChatMessage(
+ new ChatComponentText(villagerString + " #"
+ + villager.getProfession() + " "
+ + StatCollector.translateToLocal(
+ "chatmessage."
+ + Variables.MODID
+ + ".steal.fail")));
+ } else {
if (areOtherVillagersAround) {
if (!canTheySeeYou) {
- player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".steal.caught1") + " " + villagerString + " #" + villager.getProfession() + "."));
- player.addChatMessage(new ChatComponentText(villagerString + " #" + villager.getProfession() + " " + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".steal2")));
+ player.addChatMessage(
+ new ChatComponentText(StatCollector
+ .translateToLocal(
+ "chatmessage."
+ + Variables.MODID
+ + ".steal.caught1")
+ + " " + villagerString
+ + " #"
+ + villager.getProfession()
+ + "."));
+ player.addChatMessage(
+ new ChatComponentText(
+ villagerString + " #"
+ + villager
+ .getProfession()
+ + " "
+ + StatCollector
+ .translateToLocal(
+ "chatmessage."
+ + Variables.MODID
+ + ".steal2")));
return true;
- }
- else {
- player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".steal.caught2") + " " + villagerString + " #" + villager.getProfession() + "."));
- player.addChatMessage(new ChatComponentText(villagerString + " #" + villager.getProfession() + " " + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".steal2")));
+ } else {
+ player.addChatMessage(
+ new ChatComponentText(StatCollector
+ .translateToLocal(
+ "chatmessage."
+ + Variables.MODID
+ + ".steal.caught2")
+ + " " + villagerString
+ + " #"
+ + villager.getProfession()
+ + "."));
+ player.addChatMessage(
+ new ChatComponentText(
+ villagerString + " #"
+ + villager
+ .getProfession()
+ + " "
+ + StatCollector
+ .translateToLocal(
+ "chatmessage."
+ + Variables.MODID
+ + ".steal2")));
return true;
}
- }
- else {
- player.addChatMessage(new ChatComponentText(villagerString + " #" + villager.getProfession() + " " + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".steal1")));
- player.addChatMessage(new ChatComponentText(villagerString + " #" + villager.getProfession() + " " + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".steal2")));
+ } else {
+ player.addChatMessage(new ChatComponentText(
+ villagerString + " #"
+ + villager.getProfession()
+ + " "
+ + StatCollector
+ .translateToLocal(
+ "chatmessage."
+ + Variables.MODID
+ + ".steal1")));
+ player.addChatMessage(new ChatComponentText(
+ villagerString + " #"
+ + villager.getProfession()
+ + " "
+ + StatCollector
+ .translateToLocal(
+ "chatmessage."
+ + Variables.MODID
+ + ".steal2")));
return true;
}
}
}
}
return true;
- }
- else return super.itemInteractionForEntity(stack, player, entity);
+ } else
+ return super.itemInteractionForEntity(stack, player, entity);
}
/**
@@ -129,13 +243,21 @@ public class ItemThiefGloves extends Item { * @param par4
*/
@Override
- @SuppressWarnings("unchecked")
- public void addInformation(ItemStack stack, EntityPlayer player, @SuppressWarnings("rawtypes") List list, boolean par4) {
- if (!shouldAddAdditionalInfo()) list.add(EnumChatFormatting.GRAY + additionalInfoInstructions());
+ public void addInformation(ItemStack stack, EntityPlayer player,
+ List list, boolean par4) {
+ if (!shouldAddAdditionalInfo())
+ list.add(EnumChatFormatting.GRAY
+ + additionalInfoInstructions());
else {
- list.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("item." + Variables.MODID + ".thievingGloves.info.1"));
- list.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("item." + Variables.MODID + ".thievingGloves.info.2"));
- list.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("item." + Variables.MODID + ".thievingGloves.info.3"));
+ list.add(EnumChatFormatting.GRAY
+ + StatCollector.translateToLocal("item."
+ + Variables.MODID + ".thievingGloves.info.1"));
+ list.add(EnumChatFormatting.GRAY
+ + StatCollector.translateToLocal("item."
+ + Variables.MODID + ".thievingGloves.info.2"));
+ list.add(EnumChatFormatting.GRAY
+ + StatCollector.translateToLocal("item."
+ + Variables.MODID + ".thievingGloves.info.3"));
}
}
@@ -143,7 +265,9 @@ public class ItemThiefGloves extends Item { * @return
*/
public static boolean shouldAddAdditionalInfo() {
- if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) return true;
+ if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
+ if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
+ return true;
return false;
}
@@ -151,7 +275,8 @@ public class ItemThiefGloves extends Item { * @return
*/
public static String additionalInfoInstructions() {
- String message = StatCollector.translateToLocal("item." + Variables.MODID + ".thievingGloves.info.extra");
+ String message = StatCollector.translateToLocal(
+ "item." + Variables.MODID + ".thievingGloves.info.extra");
return message;
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/render/BraceletRender.java b/src/main/java/darkknight/jewelrycraft/item/render/BraceletRender.java index c1edec2..3d7bcbe 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/item/render/BraceletRender.java +++ b/src/main/java/darkknight/jewelrycraft/item/render/BraceletRender.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.item.render;
import org.lwjgl.opengl.GL11;
+
import cpw.mods.fml.common.Loader;
import darkknight.jewelrycraft.model.ModelBracelet;
import darkknight.jewelrycraft.util.Variables;
@@ -10,28 +11,36 @@ import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
-public class BraceletRender extends TileEntitySpecialRenderer
-{
- public ModelBracelet bracelet = new ModelBracelet();
- ResourceLocation texture = new ResourceLocation(Variables.MODID, "textures/entities/Bracelet.png");
-
- @Override
- public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
- {
- }
-
- public void doRender(Entity entity, double x, double y, double z, float f, float g)
- {
- GL11.glPushMatrix();
- Minecraft.getMinecraft().renderEngine.bindTexture(texture);
- if ((float)z != -1) bracelet.render(entity, 0F, 0F, 0F, (float)z, f, 1.0F);
- if (Loader.isModLoaded("alpaca") /*&& fiskfille.alpaca.AlpacaAPI.isAlpacaClient((EntityPlayer)entity)*/){
- GL11.glTranslatef(1F, 0F, -9F);
- GL11.glRotatef(25F, 1F, 0F, 0F);
- GL11.glRotatef(-25F, 0F, 1F, 0F);
- }
- else GL11.glTranslatef(0F, 3F, 0F);
- if ((float)x != -1) bracelet.render(entity, 0F, 0F, 0F, (float)x, (float)y, 1.0F);
- GL11.glPopMatrix();
- }
+public class BraceletRender extends TileEntitySpecialRenderer {
+ public ModelBracelet bracelet = new ModelBracelet();
+ ResourceLocation texture = new ResourceLocation(
+ Variables.MODID, "textures/entities/Bracelet.png");
+
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y,
+ double z, float scale) {
+ }
+
+ public void doRender(Entity entity, double x, double y, double z,
+ float f, float g) {
+ GL11.glPushMatrix();
+ Minecraft.getMinecraft().renderEngine.bindTexture(texture);
+ if ((float) z != -1)
+ bracelet.render(entity, 0F, 0F, 0F, (float) z, f, 1.0F);
+ if (Loader
+ .isModLoaded("alpaca") /*
+ * && fiskfille.alpaca.AlpacaAPI.
+ * isAlpacaClient((
+ * EntityPlayer)entity)
+ */) {
+ GL11.glTranslatef(1F, 0F, -9F);
+ GL11.glRotatef(25F, 1F, 0F, 0F);
+ GL11.glRotatef(-25F, 0F, 1F, 0F);
+ } else
+ GL11.glTranslatef(0F, 3F, 0F);
+ if ((float) x != -1)
+ bracelet.render(entity, 0F, 0F, 0F, (float) x, (float) y,
+ 1.0F);
+ GL11.glPopMatrix();
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/item/render/EarringsRender.java b/src/main/java/darkknight/jewelrycraft/item/render/EarringsRender.java index 41a2220..958aceb 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/item/render/EarringsRender.java +++ b/src/main/java/darkknight/jewelrycraft/item/render/EarringsRender.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.item.render;
import org.lwjgl.opengl.GL11;
+
import darkknight.jewelrycraft.model.ModelEarrings;
import darkknight.jewelrycraft.util.Variables;
import net.minecraft.client.Minecraft;
@@ -9,21 +10,21 @@ import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
-public class EarringsRender extends TileEntitySpecialRenderer
-{
- ModelEarrings earrings = new ModelEarrings();
- ResourceLocation texture = new ResourceLocation(Variables.MODID, "textures/entities/Earrings.png");
-
- @Override
- public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
- {
- }
-
- public void doRender(Entity entity, double x, double y, double z, float f, float g)
- {
- GL11.glPushMatrix();
- Minecraft.getMinecraft().renderEngine.bindTexture(texture);
- earrings.render(entity, 0F, 0F, 0F, (float)z, f, 1.0F);
- GL11.glPopMatrix();
- }
+public class EarringsRender extends TileEntitySpecialRenderer {
+ ModelEarrings earrings = new ModelEarrings();
+ ResourceLocation texture = new ResourceLocation(Variables.MODID,
+ "textures/entities/Earrings.png");
+
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y,
+ double z, float scale) {
+ }
+
+ public void doRender(Entity entity, double x, double y, double z,
+ float f, float g) {
+ GL11.glPushMatrix();
+ Minecraft.getMinecraft().renderEngine.bindTexture(texture);
+ earrings.render(entity, 0F, 0F, 0F, (float) z, f, 1.0F);
+ GL11.glPopMatrix();
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/item/render/ItemRender.java b/src/main/java/darkknight/jewelrycraft/item/render/ItemRender.java index fceb2d8..9b665ec 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/item/render/ItemRender.java +++ b/src/main/java/darkknight/jewelrycraft/item/render/ItemRender.java @@ -2,6 +2,7 @@ package darkknight.jewelrycraft.item.render; import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
+
import darkknight.jewelrycraft.JewelrycraftMod;
import darkknight.jewelrycraft.util.JewelryNBT;
import net.minecraft.block.Block;
@@ -29,641 +30,781 @@ import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.MinecraftForgeClient;
-public class ItemRender implements IItemRenderer
-{
- TileEntitySpecialRenderer render;
- public TileEntity entity;
- ModelBase model;
- private RenderBlocks renderBlocksIr = new RenderBlocks();
- private Minecraft mc = Minecraft.getMinecraft();
- private static final ResourceLocation RES_ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png");
- private float tran = 0F;
-
- /**
- * @param render
- * @param entity
- * @param model
- */
- public ItemRender(TileEntitySpecialRenderer render, TileEntity entity, ModelBase model)
- {
- this.entity = entity;
- this.render = render;
- this.model = model;
- }
-
- public ItemRender()
- {}
-
- /**
- * @param item
- * @param type
- * @return
- */
- @Override
- public boolean handleRenderType(ItemStack item, ItemRenderType type)
- {
- return true;
- }
-
- /**
- * @param type
- * @param item
- * @param helper
- * @return
- */
- @Override
- public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
- {
- return true;
- }
-
- /**
- * @param type
- * @param item
- * @param data
- */
- @Override
- public void renderItem(ItemRenderType type, ItemStack item, Object ... data)
- {
- if (item != null) {
- if (render != null && entity != null && JewelryNBT.item(item) == null) {
- if (type == IItemRenderer.ItemRenderType.ENTITY) {
- GL11.glRotatef(180f, 0f, 1f, 0f);
- GL11.glTranslatef(-0.5f, -0.5f, -0.4f);
- }
- render.renderTileEntityAt(entity, 0.0D, 0.0D, 0.0D, 0.0F);
- }else
- if (JewelryNBT.item(item) != null) {
- GL11.glPushMatrix();
- GL11.glColor3f(1F, 1F, 0F);
- if (Item.getItemById(Integer.valueOf(item.getTagCompound().getTag("target").toString().split(",")[0].substring(4).replace("s", ""))) != null)
- renderItem(Minecraft.getMinecraft().thePlayer, JewelryNBT.item(item), 0, type);
- else renderItem(Minecraft.getMinecraft().thePlayer, new ItemStack(Blocks.end_portal), 0, type);
- GL11.glPopMatrix();
- }else{
- GL11.glPushMatrix();
- GL11.glColor3f(1F, 1F, 0F);
- renderItem(Minecraft.getMinecraft().thePlayer, new ItemStack(Blocks.end_portal), 0, type);
- GL11.glPopMatrix();
- }
- }
- }
-
- public void renderItem(EntityLivingBase entity, ItemStack itemStack, int meta, ItemRenderType type)
- {
- GL11.glPushMatrix();
- TextureManager texturemanager = this.mc.getTextureManager();
- if (itemStack != null) {
- Item item = itemStack.getItem();
- Block block = Block.getBlockFromItem(item);
- IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemStack, type);
- if (customRenderer != null) {
- texturemanager.bindTexture(texturemanager.getResourceLocation(itemStack.getItemSpriteNumber()));
- if (type.equals(type.EQUIPPED))
- GL11.glTranslatef(0.7F, 0.55F, 0.55F);
- ForgeHooksClient.renderEquippedItem(type, customRenderer, renderBlocksIr, entity, itemStack);
- }else
- if (itemStack.getItemSpriteNumber() == 0 && item instanceof ItemBlock && RenderBlocks.renderItemIn3d(block.getRenderType())) {
- texturemanager.bindTexture(texturemanager.getResourceLocation(0));
- if (type.equals(type.EQUIPPED))
- GL11.glTranslatef(0.5F, 0.5F, 0.5F);
- if (itemStack != null && block != null && block.getRenderBlockPass() != 0) {
- GL11.glDepthMask(false);
- renderBlockAsItem(block, itemStack.getItemDamage(), 1.0F);
- GL11.glDepthMask(true);
- }else{
- renderBlockAsItem(block, itemStack.getItemDamage(), 1.0F);
- }
- }else{
- IIcon iicon = itemStack.getIconIndex();
- if (iicon == null) {
- GL11.glPopMatrix();
- return;
- }
- texturemanager.bindTexture(texturemanager.getResourceLocation(itemStack.getItemSpriteNumber()));
- TextureUtil.func_152777_a(false, false, 1.0F);
- Tessellator tessellator = Tessellator.instance;
- float f = iicon.getMinU();
- float f1 = iicon.getMaxU();
- float f2 = iicon.getMinV();
- float f3 = iicon.getMaxV();
- GL11.glEnable(GL12.GL_RESCALE_NORMAL);
- float f6 = 1.6F;
- GL11.glScalef(f6, f6, f6);
- if (type.equals(type.ENTITY)) {
- GL11.glTranslatef(0.0F, 0.0265F, 0.0F);
- GL11.glRotatef(-30F, 0.0F, 0.0F, 1.0F);
- GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F);
- GL11.glScalef(0.625F, 0.625F, 0.625F);
- }
- if (!type.equals(type.EQUIPPED_FIRST_PERSON)) {
- GL11.glRotatef(45f, 0f, 1f, 0f);
- GL11.glRotatef(180f, 0f, 1f, 0f);
- GL11.glRotatef(30f, 1f, 0f, 0f);
- if (type.equals(type.EQUIPPED)) {
- GL11.glRotatef(35f, 1f, 0f, 0f);
- GL11.glTranslatef(0F, -0.15F, -0.6F);
- }
- GL11.glTranslatef(-0.5F, -0.5F, 0.0F);
- }else
- if (type.equals(type.EQUIPPED_FIRST_PERSON)) {
- GL11.glTranslatef(-0.35F, 0.4F, 0.93F);
- GL11.glRotatef(45f, 0f, 1f, 0f);
- GL11.glRotatef(-25f, 0f, 0f, 1f);
- }
- if (itemStack.getItem().requiresMultipleRenderPasses()) {
- for(int x = 0; x < itemStack.getItem().getRenderPasses(itemStack.getItemDamage()); x++){
- iicon = itemStack.getItem().getIcon(itemStack, x);
- f = iicon.getMinU();
- f1 = iicon.getMaxU();
- f2 = iicon.getMinV();
- f3 = iicon.getMaxV();
- ItemRenderer.renderItemIn2D(tessellator, f1, f2, f, f3, iicon.getIconWidth(), iicon.getIconHeight(), 0.0625F);
- }
- }else{
- ItemRenderer.renderItemIn2D(tessellator, f1, f2, f, f3, iicon.getIconWidth(), iicon.getIconHeight(), 0.0625F);
- }
- GL11.glDepthFunc(GL11.GL_EQUAL);
- renderShine(tessellator, true);
- GL11.glPushMatrix();
- float f8 = 0.325F;
- GL11.glScalef(f8, f8, f8);
- float f9 = (float)(Minecraft.getSystemTime() % 30000L) / 30000.0F * 8.0F;
- GL11.glTranslatef(-f9, 0.0F, 0.0F);
- GL11.glRotatef(30.0F, 0.0F, 0.0F, 1.0F);
- ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
- GL11.glPopMatrix();
- GL11.glMatrixMode(GL11.GL_MODELVIEW);
- GL11.glDisable(GL11.GL_BLEND);
- GL11.glDepthFunc(GL11.GL_LEQUAL);
- GL11.glDisable(GL12.GL_RESCALE_NORMAL);
- texturemanager.bindTexture(texturemanager.getResourceLocation(itemStack.getItemSpriteNumber()));
- TextureUtil.func_147945_b();
- }
- }
- GL11.glPopMatrix();
- }
-
- public void renderBlockAsItem(Block block, int damage, float luminacy)
- {
- Tessellator tessellator = Tessellator.instance;
- if (block == Blocks.dispenser || block == Blocks.dropper || block == Blocks.furnace)
- damage = 3;
- int j;
- float f1;
- float f2;
- GL11.glColor4f(1F, 1F, 0F, 1.0F);
- j = block.getRenderType();
- renderBlocksIr.setRenderBoundsFromBlock(block);
- int k;
- if (j != 0 && j != 31 && j != 39 && j != 16 && j != 26) {
- GL11.glColor4f(1F, 1F, 0F, 1.0F);
- if (j == 13) {
- // Cactus
- block.setBlockBoundsForItemRender();
- GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
- f1 = 0.0625F;
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, -1.0F, 0.0F);
- renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 0));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 1.0F, 0.0F);
- renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 1));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F, -1.0F);
- tessellator.addTranslation(0.0F, 0.0F, f1);
- renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 2));
- tessellator.addTranslation(0.0F, 0.0F, -f1);
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F, 1.0F);
- tessellator.addTranslation(0.0F, 0.0F, -f1);
- renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 3));
- tessellator.addTranslation(0.0F, 0.0F, f1);
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(-1.0F, 0.0F, 0.0F);
- tessellator.addTranslation(f1, 0.0F, 0.0F);
- renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 4));
- tessellator.addTranslation(-f1, 0.0F, 0.0F);
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(1.0F, 0.0F, 0.0F);
- tessellator.addTranslation(-f1, 0.0F, 0.0F);
- renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 5));
- tessellator.addTranslation(f1, 0.0F, 0.0F);
- tessellator.draw();
- GL11.glTranslatef(0.0625F, 0.0F, 0.0625F);
- GL11.glScalef(0.9375F - 0.0625F, 1F, 0.9375F - 0.0625F);
- shinyBlock(tessellator, false);
- }else
- if (j == 22) {
- // Chest
- GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
- GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
- TileEntityRendererChestHelper.instance.renderChest(block, damage, luminacy);
- GL11.glEnable(GL12.GL_RESCALE_NORMAL);
- GL11.glTranslatef(0.0625F, 0.0F, 0.0625F);
- GL11.glScalef(0.9375F - 0.0625F, 0.875F, 0.9375F - 0.0625F);
- shinyBlock(tessellator, false);
- }else
- if (j == 10) {
- // Stairs
- for(k = 0; k < 2; ++k){
- if (k == 0) {
- renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.5D);
- }
- if (k == 1) {
- renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.5D, 1.0D, 0.5D, 1.0D);
- }
- GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, -1.0F, 0.0F);
- renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 0));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 1.0F, 0.0F);
- renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 1));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F, -1.0F);
- renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 2));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F, 1.0F);
- renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 3));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(-1.0F, 0.0F, 0.0F);
- renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 4));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(1.0F, 0.0F, 0.0F);
- renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 5));
- tessellator.draw();
- GL11.glTranslatef(0.5F, 0.5F, 0.5F);
- }
- }else
- if (j == 27) {
- // Dragon Egg
- k = 0;
- GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
- tessellator.startDrawingQuads();
- for(int l = 0; l < 8; ++l){
- byte b0 = 0;
- byte b1 = 1;
- if (l == 0) {
- b0 = 2;
- }
- if (l == 1) {
- b0 = 3;
- }
- if (l == 2) {
- b0 = 4;
- }
- if (l == 3) {
- b0 = 5;
- b1 = 2;
- }
- if (l == 4) {
- b0 = 6;
- b1 = 3;
- }
- if (l == 5) {
- b0 = 7;
- b1 = 5;
- }
- if (l == 6) {
- b0 = 6;
- b1 = 2;
- }
- if (l == 7) {
- b0 = 3;
- }
- float f5 = (float)b0 / 16.0F;
- float f6 = 1.0F - (float)k / 16.0F;
- float f7 = 1.0F - (float)(k + b1) / 16.0F;
- k += b1;
- renderBlocksIr.setRenderBounds((double)(0.5F - f5), (double)f7, (double)(0.5F - f5), (double)(0.5F + f5), (double)f6, (double)(0.5F + f5));
- tessellator.setNormal(0.0F, -1.0F, 0.0F);
- renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 0));
- tessellator.setNormal(0.0F, 1.0F, 0.0F);
- renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 1));
- tessellator.setNormal(0.0F, 0.0F, -1.0F);
- renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 2));
- tessellator.setNormal(0.0F, 0.0F, 1.0F);
- renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 3));
- tessellator.setNormal(-1.0F, 0.0F, 0.0F);
- renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 4));
- tessellator.setNormal(1.0F, 0.0F, 0.0F);
- renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 5));
- }
- tessellator.draw();
- GL11.glTranslatef(0.5F, 0.5F, 0.5F);
- renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
- }else
- if (j == 11) {
- // Fence
- for(k = 0; k < 4; ++k){
- f2 = 0.125F;
- if (k == 0) {
- renderBlocksIr.setRenderBounds((double)(0.5F - f2), 0.0D, 0.0D, (double)(0.5F + f2), 1.0D, (double)(f2 * 2.0F));
- }
- if (k == 1) {
- renderBlocksIr.setRenderBounds((double)(0.5F - f2), 0.0D, (double)(1.0F - f2 * 2.0F), (double)(0.5F + f2), 1.0D, 1.0D);
- }
- f2 = 0.0625F;
- if (k == 2) {
- renderBlocksIr.setRenderBounds((double)(0.5F - f2), (double)(1.0F - f2 * 3.0F), (double)(-f2 * 2.0F), (double)(0.5F + f2), (double)(1.0F - f2), (double)(1.0F + f2 * 2.0F));
- }
- if (k == 3) {
- renderBlocksIr.setRenderBounds((double)(0.5F - f2), (double)(0.5F - f2 * 3.0F), (double)(-f2 * 2.0F), (double)(0.5F + f2), (double)(0.5F - f2), (double)(1.0F + f2 * 2.0F));
- }
- GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, -1.0F, 0.0F);
- renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 0));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 1.0F, 0.0F);
- renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 1));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F, -1.0F);
- renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 2));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F, 1.0F);
- renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 3));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(-1.0F, 0.0F, 0.0F);
- renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 4));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(1.0F, 0.0F, 0.0F);
- renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 5));
- tessellator.draw();
- GL11.glTranslatef(0.5F, 0.5F, 0.5F);
- }
- renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
- }else
- if (j == 21) {
- // Fence Gate
- for(k = 0; k < 3; ++k){
- f2 = 0.0625F;
- if (k == 0) {
- renderBlocksIr.setRenderBounds((double)(0.5F - f2), 0.30000001192092896D, 0.0D, (double)(0.5F + f2), 1.0D, (double)(f2 * 2.0F));
- }
- if (k == 1) {
- renderBlocksIr.setRenderBounds((double)(0.5F - f2), 0.30000001192092896D, (double)(1.0F - f2 * 2.0F), (double)(0.5F + f2), 1.0D, 1.0D);
- }
- f2 = 0.0625F;
- if (k == 2) {
- renderBlocksIr.setRenderBounds((double)(0.5F - f2), 0.5D, 0.0D, (double)(0.5F + f2), (double)(1.0F - f2), 1.0D);
- }
- GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, -1.0F, 0.0F);
- renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 0));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 1.0F, 0.0F);
- renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 1));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F, -1.0F);
- renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 2));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F, 1.0F);
- renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 3));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(-1.0F, 0.0F, 0.0F);
- renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 4));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(1.0F, 0.0F, 0.0F);
- renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSide(block, 5));
- tessellator.draw();
- GL11.glTranslatef(0.5F, 0.5F, 0.5F);
- }
- }else
- if (j == 32) {
- // Wall
- for(k = 0; k < 2; ++k){
- if (k == 0) {
- renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.3125D, 1.0D, 0.8125D, 0.6875D);
- }
- if (k == 1) {
- renderBlocksIr.setRenderBounds(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D);
- }
- GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, -1.0F, 0.0F);
- renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSideAndMetadata(block, 0, damage));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 1.0F, 0.0F);
- renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSideAndMetadata(block, 1, damage));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F, -1.0F);
- renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSideAndMetadata(block, 2, damage));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F, 1.0F);
- renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSideAndMetadata(block, 3, damage));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(-1.0F, 0.0F, 0.0F);
- renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSideAndMetadata(block, 4, damage));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(1.0F, 0.0F, 0.0F);
- renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSideAndMetadata(block, 5, damage));
- tessellator.draw();
- GL11.glTranslatef(0.5F, 0.5F, 0.5F);
- }
- renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
- }else
- if (j == 35) {
- // Anvil
- GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
- renderBlocksIr.renderBlockAnvilOrient((BlockAnvil)block, 0, 0, 0, damage << 2, true);
- GL11.glTranslatef(0.5F, 0.5F, 0.5F);
- }else
- if (j == 34) {
- // Beacon
- for(k = 0; k < 3; ++k){
- if (k == 0) {
- renderBlocksIr.setRenderBounds(0.125D, 0.0D, 0.125D, 0.875D, 0.1875D, 0.875D);
- renderBlocksIr.setOverrideBlockTexture(renderBlocksIr.getBlockIcon(Blocks.obsidian));
- }else
- if (k == 1) {
- renderBlocksIr.setRenderBounds(0.1875D, 0.1875D, 0.1875D, 0.8125D, 0.875D, 0.8125D);
- renderBlocksIr.setOverrideBlockTexture(renderBlocksIr.getBlockIcon(Blocks.beacon));
- }else
- if (k == 2) {
- renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
- renderBlocksIr.setOverrideBlockTexture(renderBlocksIr.getBlockIcon(Blocks.glass));
- }
- GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, -1.0F, 0.0F);
- renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSideAndMetadata(block, 0, damage));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 1.0F, 0.0F);
- renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSideAndMetadata(block, 1, damage));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F, -1.0F);
- renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSideAndMetadata(block, 2, damage));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F, 1.0F);
- renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSideAndMetadata(block, 3, damage));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(-1.0F, 0.0F, 0.0F);
- renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSideAndMetadata(block, 4, damage));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(1.0F, 0.0F, 0.0F);
- renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSideAndMetadata(block, 5, damage));
- tessellator.draw();
- GL11.glTranslatef(0.5F, 0.5F, 0.5F);
- }
- renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
- renderBlocksIr.clearOverrideBlockTexture();
- GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
- shinyBlock(tessellator, false);
- }else{
- try{
- FMLRenderAccessLibrary.renderInventoryBlock(renderBlocksIr, block, damage, j);
- }
- catch(Exception e){
- JewelrycraftMod.logger.error("Something went wrong with rendering the item");
- e.printStackTrace();
- }
- }
- }else{
- if (j == 16) {
- damage = 1;
- }
- block.setBlockBoundsForItemRender();
- renderBlocksIr.setRenderBoundsFromBlock(block);
- GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
- GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, -1.0F, 0.0F);
- renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSideAndMetadata(block, 0, damage));
- tessellator.draw();
- GL11.glColor4f(1F, 1F, 0F, 1.0F);
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 1.0F, 0.0F);
- renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSideAndMetadata(block, 1, damage));
- tessellator.draw();
- GL11.glColor4f(1F, 1F, 0F, 1.0F);
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F, -1.0F);
- renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSideAndMetadata(block, 2, damage));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(0.0F, 0.0F, 1.0F);
- renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSideAndMetadata(block, 3, damage));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(-1.0F, 0.0F, 0.0F);
- renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSideAndMetadata(block, 4, damage));
- tessellator.draw();
- tessellator.startDrawingQuads();
- tessellator.setNormal(1.0F, 0.0F, 0.0F);
- renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderBlocksIr.getBlockIconFromSideAndMetadata(block, 5, damage));
- tessellator.draw();
- GL11.glTranslatef((float)block.getBlockBoundsMinX(), (float)block.getBlockBoundsMinY(), (float)block.getBlockBoundsMinZ());
- GL11.glScalef((float)block.getBlockBoundsMaxX() - (float)block.getBlockBoundsMinX(), (float)block.getBlockBoundsMaxY() - (float)block.getBlockBoundsMinY(), (float)block.getBlockBoundsMaxZ() - (float)block.getBlockBoundsMinZ());
- shinyBlock(tessellator, false);
- GL11.glTranslatef(0.5F, 0.5F, 0.5F);
- }
- }
-
- public void renderShine(Tessellator tessellator, boolean autoAnimate)
- {
- TextureManager texturemanager = this.mc.getTextureManager();
- texturemanager.bindTexture(RES_ITEM_GLINT);
- GL11.glEnable(GL11.GL_BLEND);
- OpenGlHelper.glBlendFunc(768, 1, 1, 0);
- GL11.glMatrixMode(GL11.GL_TEXTURE);
- GL11.glPushMatrix();
- float f8 = 0.325F;
- GL11.glScalef(f8, f8, f8);
- if (autoAnimate)
- GL11.glTranslatef(17F, 0.0F, 0.0F);
- else{
- GL11.glTranslatef(tran, 0.0F, 0.0F);
- tran += 0.0004F;
- if (tran >= 360F)
- tran = 0F;
- }
- GL11.glRotatef(-30.0F, 0.0F, 0.0F, 1.0F);
- GL11.glColor3f(1F, 1F, 0F);
- ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.001F);
- GL11.glPopMatrix();
- }
-
- public void shinyBlock(Tessellator tessellator, boolean autoAnimate)
- {
- GL11.glPushMatrix();
- GL11.glTranslatef(0F, 0.0F, -0.001F);
- renderShine(tessellator, autoAnimate);
- GL11.glMatrixMode(GL11.GL_MODELVIEW);
- GL11.glDisable(GL11.GL_BLEND);
- GL11.glDepthFunc(GL11.GL_LEQUAL);
- GL11.glPopMatrix();
- GL11.glPushMatrix();
- GL11.glTranslatef(1.0F, 0.0F, 1.0001F);
- GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
- renderShine(tessellator, autoAnimate);
- GL11.glMatrixMode(GL11.GL_MODELVIEW);
- GL11.glDisable(GL11.GL_BLEND);
- GL11.glDepthFunc(GL11.GL_LEQUAL);
- GL11.glPopMatrix();
- GL11.glPushMatrix();
- GL11.glTranslatef(-0.001F, 0.0F, 0.0F);
- GL11.glRotatef(90.0F, 0.0F, -1.0F, 0.0F);
- renderShine(tessellator, autoAnimate);
- GL11.glMatrixMode(GL11.GL_MODELVIEW);
- GL11.glDisable(GL11.GL_BLEND);
- GL11.glDepthFunc(GL11.GL_LEQUAL);
- GL11.glPopMatrix();
- GL11.glPushMatrix();
- GL11.glTranslatef(1.001F, 0.0F, 1.0F);
- GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
- renderShine(tessellator, autoAnimate);
- GL11.glMatrixMode(GL11.GL_MODELVIEW);
- GL11.glDisable(GL11.GL_BLEND);
- GL11.glDepthFunc(GL11.GL_LEQUAL);
- GL11.glPopMatrix();
- GL11.glPushMatrix();
- GL11.glTranslatef(0.0F, -0.001F, 0.0F);
- GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
- renderShine(tessellator, autoAnimate);
- GL11.glMatrixMode(GL11.GL_MODELVIEW);
- GL11.glDisable(GL11.GL_BLEND);
- GL11.glDepthFunc(GL11.GL_LEQUAL);
- GL11.glPopMatrix();
- GL11.glPushMatrix();
- GL11.glTranslatef(0.0F, 1.0F, 0.0F);
- GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
- renderShine(tessellator, autoAnimate);
- GL11.glMatrixMode(GL11.GL_MODELVIEW);
- GL11.glDisable(GL11.GL_BLEND);
- GL11.glDepthFunc(GL11.GL_LEQUAL);
- GL11.glPopMatrix();
- }
+public class ItemRender implements IItemRenderer {
+ TileEntitySpecialRenderer render;
+ public TileEntity entity;
+ ModelBase model;
+ private RenderBlocks renderBlocksIr =
+ new RenderBlocks();
+ private Minecraft mc =
+ Minecraft.getMinecraft();
+ private static final ResourceLocation RES_ITEM_GLINT =
+ new ResourceLocation("textures/misc/enchanted_item_glint.png");
+ private float tran = 0F;
+
+ /**
+ * @param render
+ * @param entity
+ * @param model
+ */
+ public ItemRender(TileEntitySpecialRenderer render, TileEntity entity,
+ ModelBase model) {
+ this.entity = entity;
+ this.render = render;
+ this.model = model;
+ }
+
+ public ItemRender() {
+ }
+
+ /**
+ * @param item
+ * @param type
+ * @return
+ */
+ @Override
+ public boolean handleRenderType(ItemStack item, ItemRenderType type) {
+ return true;
+ }
+
+ /**
+ * @param type
+ * @param item
+ * @param helper
+ * @return
+ */
+ @Override
+ public boolean shouldUseRenderHelper(ItemRenderType type,
+ ItemStack item, ItemRendererHelper helper) {
+ return true;
+ }
+
+ /**
+ * @param type
+ * @param item
+ * @param data
+ */
+ @Override
+ public void renderItem(ItemRenderType type, ItemStack item,
+ Object... data) {
+ if (item != null) {
+ if (render != null && entity != null
+ && JewelryNBT.item(item) == null) {
+ if (type == IItemRenderer.ItemRenderType.ENTITY) {
+ GL11.glRotatef(180f, 0f, 1f, 0f);
+ GL11.glTranslatef(-0.5f, -0.5f, -0.4f);
+ }
+ render.renderTileEntityAt(entity, 0.0D, 0.0D, 0.0D, 0.0F);
+ } else if (JewelryNBT.item(item) != null) {
+ GL11.glPushMatrix();
+ GL11.glColor3f(1F, 1F, 0F);
+ if (Item.getItemById(Integer.valueOf(item.getTagCompound()
+ .getTag("target").toString().split(",")[0]
+ .substring(4).replace("s", ""))) != null)
+ renderItem(Minecraft.getMinecraft().thePlayer,
+ JewelryNBT.item(item), 0, type);
+ else
+ renderItem(Minecraft.getMinecraft().thePlayer,
+ new ItemStack(Blocks.end_portal), 0, type);
+ GL11.glPopMatrix();
+ } else {
+ GL11.glPushMatrix();
+ GL11.glColor3f(1F, 1F, 0F);
+ renderItem(Minecraft.getMinecraft().thePlayer,
+ new ItemStack(Blocks.end_portal), 0, type);
+ GL11.glPopMatrix();
+ }
+ }
+ }
+
+ public void renderItem(EntityLivingBase entity, ItemStack itemStack,
+ int meta, ItemRenderType type) {
+ GL11.glPushMatrix();
+ TextureManager texturemanager = this.mc.getTextureManager();
+ if (itemStack != null) {
+ Item item = itemStack.getItem();
+ Block block = Block.getBlockFromItem(item);
+ IItemRenderer customRenderer =
+ MinecraftForgeClient.getItemRenderer(itemStack, type);
+ if (customRenderer != null) {
+ texturemanager
+ .bindTexture(texturemanager.getResourceLocation(
+ itemStack.getItemSpriteNumber()));
+ if (type.equals(ItemRenderType.EQUIPPED))
+ GL11.glTranslatef(0.7F, 0.55F, 0.55F);
+ ForgeHooksClient.renderEquippedItem(type, customRenderer,
+ renderBlocksIr, entity, itemStack);
+ } else if (itemStack.getItemSpriteNumber() == 0
+ && item instanceof ItemBlock && RenderBlocks
+ .renderItemIn3d(block.getRenderType())) {
+ texturemanager.bindTexture(
+ texturemanager.getResourceLocation(0));
+ if (type.equals(ItemRenderType.EQUIPPED))
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
+ if (itemStack != null && block != null
+ && block.getRenderBlockPass() != 0) {
+ GL11.glDepthMask(false);
+ renderBlockAsItem(block, itemStack.getItemDamage(),
+ 1.0F);
+ GL11.glDepthMask(true);
+ } else {
+ renderBlockAsItem(block, itemStack.getItemDamage(),
+ 1.0F);
+ }
+ } else {
+ IIcon iicon = itemStack.getIconIndex();
+ if (iicon == null) {
+ GL11.glPopMatrix();
+ return;
+ }
+ texturemanager
+ .bindTexture(texturemanager.getResourceLocation(
+ itemStack.getItemSpriteNumber()));
+ TextureUtil.func_152777_a(false, false, 1.0F);
+ Tessellator tessellator = Tessellator.instance;
+ float f = iicon.getMinU();
+ float f1 = iicon.getMaxU();
+ float f2 = iicon.getMinV();
+ float f3 = iicon.getMaxV();
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+ float f6 = 1.6F;
+ GL11.glScalef(f6, f6, f6);
+ if (type.equals(ItemRenderType.ENTITY)) {
+ GL11.glTranslatef(0.0F, 0.0265F, 0.0F);
+ GL11.glRotatef(-30F, 0.0F, 0.0F, 1.0F);
+ GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F);
+ GL11.glScalef(0.625F, 0.625F, 0.625F);
+ }
+ if (!type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
+ GL11.glRotatef(45f, 0f, 1f, 0f);
+ GL11.glRotatef(180f, 0f, 1f, 0f);
+ GL11.glRotatef(30f, 1f, 0f, 0f);
+ if (type.equals(ItemRenderType.EQUIPPED)) {
+ GL11.glRotatef(35f, 1f, 0f, 0f);
+ GL11.glTranslatef(0F, -0.15F, -0.6F);
+ }
+ GL11.glTranslatef(-0.5F, -0.5F, 0.0F);
+ } else if (type
+ .equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
+ GL11.glTranslatef(-0.35F, 0.4F, 0.93F);
+ GL11.glRotatef(45f, 0f, 1f, 0f);
+ GL11.glRotatef(-25f, 0f, 0f, 1f);
+ }
+ if (itemStack.getItem().requiresMultipleRenderPasses()) {
+ for (int x = 0; x < itemStack.getItem()
+ .getRenderPasses(itemStack.getItemDamage());
+ x++) {
+ iicon = itemStack.getItem().getIcon(itemStack, x);
+ f = iicon.getMinU();
+ f1 = iicon.getMaxU();
+ f2 = iicon.getMinV();
+ f3 = iicon.getMaxV();
+ ItemRenderer.renderItemIn2D(tessellator, f1, f2, f,
+ f3, iicon.getIconWidth(),
+ iicon.getIconHeight(), 0.0625F);
+ }
+ } else {
+ ItemRenderer.renderItemIn2D(tessellator, f1, f2, f, f3,
+ iicon.getIconWidth(), iicon.getIconHeight(),
+ 0.0625F);
+ }
+ GL11.glDepthFunc(GL11.GL_EQUAL);
+ renderShine(tessellator, true);
+ GL11.glPushMatrix();
+ float f8 = 0.325F;
+ GL11.glScalef(f8, f8, f8);
+ float f9 = (float) (Minecraft.getSystemTime() % 30000L)
+ / 30000.0F * 8.0F;
+ GL11.glTranslatef(-f9, 0.0F, 0.0F);
+ GL11.glRotatef(30.0F, 0.0F, 0.0F, 1.0F);
+ ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F,
+ 1.0F, 256, 256, 0.0625F);
+ GL11.glPopMatrix();
+ GL11.glMatrixMode(GL11.GL_MODELVIEW);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glDepthFunc(GL11.GL_LEQUAL);
+ GL11.glDisable(GL12.GL_RESCALE_NORMAL);
+ texturemanager
+ .bindTexture(texturemanager.getResourceLocation(
+ itemStack.getItemSpriteNumber()));
+ TextureUtil.func_147945_b();
+ }
+ }
+ GL11.glPopMatrix();
+ }
+
+ public void renderBlockAsItem(Block block, int damage,
+ float luminacy) {
+ Tessellator tessellator = Tessellator.instance;
+ if (block == Blocks.dispenser || block == Blocks.dropper
+ || block == Blocks.furnace)
+ damage = 3;
+ int j;
+ float f1;
+ float f2;
+ GL11.glColor4f(1F, 1F, 0F, 1.0F);
+ j = block.getRenderType();
+ renderBlocksIr.setRenderBoundsFromBlock(block);
+ int k;
+ if (j != 0 && j != 31 && j != 39 && j != 16 && j != 26) {
+ GL11.glColor4f(1F, 1F, 0F, 1.0F);
+ if (j == 13) {
+ // Cactus
+ block.setBlockBoundsForItemRender();
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
+ f1 = 0.0625F;
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, -1.0F, 0.0F);
+ renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 0));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 1));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, -1.0F);
+ tessellator.addTranslation(0.0F, 0.0F, f1);
+ renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 2));
+ tessellator.addTranslation(0.0F, 0.0F, -f1);
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, 1.0F);
+ tessellator.addTranslation(0.0F, 0.0F, -f1);
+ renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 3));
+ tessellator.addTranslation(0.0F, 0.0F, f1);
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(-1.0F, 0.0F, 0.0F);
+ tessellator.addTranslation(f1, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 4));
+ tessellator.addTranslation(-f1, 0.0F, 0.0F);
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(1.0F, 0.0F, 0.0F);
+ tessellator.addTranslation(-f1, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 5));
+ tessellator.addTranslation(f1, 0.0F, 0.0F);
+ tessellator.draw();
+ GL11.glTranslatef(0.0625F, 0.0F, 0.0625F);
+ GL11.glScalef(0.9375F - 0.0625F, 1F, 0.9375F - 0.0625F);
+ shinyBlock(tessellator, false);
+ } else if (j == 22) {
+ // Chest
+ GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
+ TileEntityRendererChestHelper.instance.renderChest(block,
+ damage, luminacy);
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+ GL11.glTranslatef(0.0625F, 0.0F, 0.0625F);
+ GL11.glScalef(0.9375F - 0.0625F, 0.875F,
+ 0.9375F - 0.0625F);
+ shinyBlock(tessellator, false);
+ } else if (j == 10) {
+ // Stairs
+ for (k = 0; k < 2; ++k) {
+ if (k == 0) {
+ renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.0D,
+ 1.0D, 1.0D, 0.5D);
+ }
+ if (k == 1) {
+ renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.5D,
+ 1.0D, 0.5D, 1.0D);
+ }
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, -1.0F, 0.0F);
+ renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 0));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 1));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, -1.0F);
+ renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 2));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, 1.0F);
+ renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 3));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(-1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 4));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 5));
+ tessellator.draw();
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
+ }
+ } else if (j == 27) {
+ // Dragon Egg
+ k = 0;
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
+ tessellator.startDrawingQuads();
+ for (int l = 0; l < 8; ++l) {
+ byte b0 = 0;
+ byte b1 = 1;
+ if (l == 0) {
+ b0 = 2;
+ }
+ if (l == 1) {
+ b0 = 3;
+ }
+ if (l == 2) {
+ b0 = 4;
+ }
+ if (l == 3) {
+ b0 = 5;
+ b1 = 2;
+ }
+ if (l == 4) {
+ b0 = 6;
+ b1 = 3;
+ }
+ if (l == 5) {
+ b0 = 7;
+ b1 = 5;
+ }
+ if (l == 6) {
+ b0 = 6;
+ b1 = 2;
+ }
+ if (l == 7) {
+ b0 = 3;
+ }
+ float f5 = (float) b0 / 16.0F;
+ float f6 = 1.0F - (float) k / 16.0F;
+ float f7 = 1.0F - (float) (k + b1) / 16.0F;
+ k += b1;
+ renderBlocksIr.setRenderBounds((double) (0.5F - f5),
+ (double) f7, (double) (0.5F - f5),
+ (double) (0.5F + f5), (double) f6,
+ (double) (0.5F + f5));
+ tessellator.setNormal(0.0F, -1.0F, 0.0F);
+ renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 0));
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 1));
+ tessellator.setNormal(0.0F, 0.0F, -1.0F);
+ renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 2));
+ tessellator.setNormal(0.0F, 0.0F, 1.0F);
+ renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 3));
+ tessellator.setNormal(-1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 4));
+ tessellator.setNormal(1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 5));
+ }
+ tessellator.draw();
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
+ renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D,
+ 1.0D, 1.0D);
+ } else if (j == 11) {
+ // Fence
+ for (k = 0; k < 4; ++k) {
+ f2 = 0.125F;
+ if (k == 0) {
+ renderBlocksIr.setRenderBounds(
+ (double) (0.5F - f2), 0.0D, 0.0D,
+ (double) (0.5F + f2), 1.0D,
+ (double) (f2 * 2.0F));
+ }
+ if (k == 1) {
+ renderBlocksIr.setRenderBounds(
+ (double) (0.5F - f2), 0.0D,
+ (double) (1.0F - f2 * 2.0F),
+ (double) (0.5F + f2), 1.0D, 1.0D);
+ }
+ f2 = 0.0625F;
+ if (k == 2) {
+ renderBlocksIr.setRenderBounds(
+ (double) (0.5F - f2),
+ (double) (1.0F - f2 * 3.0F),
+ (double) (-f2 * 2.0F),
+ (double) (0.5F + f2), (double) (1.0F - f2),
+ (double) (1.0F + f2 * 2.0F));
+ }
+ if (k == 3) {
+ renderBlocksIr.setRenderBounds(
+ (double) (0.5F - f2),
+ (double) (0.5F - f2 * 3.0F),
+ (double) (-f2 * 2.0F),
+ (double) (0.5F + f2), (double) (0.5F - f2),
+ (double) (1.0F + f2 * 2.0F));
+ }
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, -1.0F, 0.0F);
+ renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 0));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 1));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, -1.0F);
+ renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 2));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, 1.0F);
+ renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 3));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(-1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 4));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 5));
+ tessellator.draw();
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
+ }
+ renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D,
+ 1.0D, 1.0D);
+ } else if (j == 21) {
+ // Fence Gate
+ for (k = 0; k < 3; ++k) {
+ f2 = 0.0625F;
+ if (k == 0) {
+ renderBlocksIr.setRenderBounds(
+ (double) (0.5F - f2), 0.30000001192092896D,
+ 0.0D, (double) (0.5F + f2), 1.0D,
+ (double) (f2 * 2.0F));
+ }
+ if (k == 1) {
+ renderBlocksIr.setRenderBounds(
+ (double) (0.5F - f2), 0.30000001192092896D,
+ (double) (1.0F - f2 * 2.0F),
+ (double) (0.5F + f2), 1.0D, 1.0D);
+ }
+ f2 = 0.0625F;
+ if (k == 2) {
+ renderBlocksIr.setRenderBounds(
+ (double) (0.5F - f2), 0.5D, 0.0D,
+ (double) (0.5F + f2), (double) (1.0F - f2),
+ 1.0D);
+ }
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, -1.0F, 0.0F);
+ renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 0));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 1));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, -1.0F);
+ renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 2));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, 1.0F);
+ renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 3));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(-1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 4));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSide(block, 5));
+ tessellator.draw();
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
+ }
+ } else if (j == 32) {
+ // Wall
+ for (k = 0; k < 2; ++k) {
+ if (k == 0) {
+ renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.3125D,
+ 1.0D, 0.8125D, 0.6875D);
+ }
+ if (k == 1) {
+ renderBlocksIr.setRenderBounds(0.25D, 0.0D, 0.25D,
+ 0.75D, 1.0D, 0.75D);
+ }
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, -1.0F, 0.0F);
+ renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(
+ block, 0, damage));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(
+ block, 1, damage));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, -1.0F);
+ renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(
+ block, 2, damage));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, 1.0F);
+ renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(
+ block, 3, damage));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(-1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(
+ block, 4, damage));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(
+ block, 5, damage));
+ tessellator.draw();
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
+ }
+ renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D,
+ 1.0D, 1.0D);
+ } else if (j == 35) {
+ // Anvil
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
+ renderBlocksIr.renderBlockAnvilOrient((BlockAnvil) block,
+ 0, 0, 0, damage << 2, true);
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
+ } else if (j == 34) {
+ // Beacon
+ for (k = 0; k < 3; ++k) {
+ if (k == 0) {
+ renderBlocksIr.setRenderBounds(0.125D, 0.0D,
+ 0.125D, 0.875D, 0.1875D, 0.875D);
+ renderBlocksIr
+ .setOverrideBlockTexture(renderBlocksIr
+ .getBlockIcon(Blocks.obsidian));
+ } else if (k == 1) {
+ renderBlocksIr.setRenderBounds(0.1875D, 0.1875D,
+ 0.1875D, 0.8125D, 0.875D, 0.8125D);
+ renderBlocksIr
+ .setOverrideBlockTexture(renderBlocksIr
+ .getBlockIcon(Blocks.beacon));
+ } else if (k == 2) {
+ renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.0D,
+ 1.0D, 1.0D, 1.0D);
+ renderBlocksIr.setOverrideBlockTexture(
+ renderBlocksIr.getBlockIcon(Blocks.glass));
+ }
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, -1.0F, 0.0F);
+ renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(
+ block, 0, damage));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(
+ block, 1, damage));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, -1.0F);
+ renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(
+ block, 2, damage));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, 1.0F);
+ renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(
+ block, 3, damage));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(-1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(
+ block, 4, damage));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(
+ block, 5, damage));
+ tessellator.draw();
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
+ }
+ renderBlocksIr.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D,
+ 1.0D, 1.0D);
+ renderBlocksIr.clearOverrideBlockTexture();
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
+ shinyBlock(tessellator, false);
+ } else {
+ try {
+ FMLRenderAccessLibrary.renderInventoryBlock(
+ renderBlocksIr, block, damage, j);
+ } catch (Exception e) {
+ JewelrycraftMod.logger.error(
+ "Something went wrong with rendering the item");
+ e.printStackTrace();
+ }
+ }
+ } else {
+ if (j == 16) {
+ damage = 1;
+ }
+ block.setBlockBoundsForItemRender();
+ renderBlocksIr.setRenderBoundsFromBlock(block);
+ GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, -1.0F, 0.0F);
+ renderBlocksIr.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block,
+ 0, damage));
+ tessellator.draw();
+ GL11.glColor4f(1F, 1F, 0F, 1.0F);
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ renderBlocksIr.renderFaceYPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block,
+ 1, damage));
+ tessellator.draw();
+ GL11.glColor4f(1F, 1F, 0F, 1.0F);
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, -1.0F);
+ renderBlocksIr.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block,
+ 2, damage));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, 1.0F);
+ renderBlocksIr.renderFaceZPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block,
+ 3, damage));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(-1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block,
+ 4, damage));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(1.0F, 0.0F, 0.0F);
+ renderBlocksIr.renderFaceXPos(block, 0.0D, 0.0D, 0.0D,
+ renderBlocksIr.getBlockIconFromSideAndMetadata(block,
+ 5, damage));
+ tessellator.draw();
+ GL11.glTranslatef((float) block.getBlockBoundsMinX(),
+ (float) block.getBlockBoundsMinY(),
+ (float) block.getBlockBoundsMinZ());
+ GL11.glScalef(
+ (float) block.getBlockBoundsMaxX()
+ - (float) block.getBlockBoundsMinX(),
+ (float) block.getBlockBoundsMaxY()
+ - (float) block.getBlockBoundsMinY(),
+ (float) block.getBlockBoundsMaxZ()
+ - (float) block.getBlockBoundsMinZ());
+ shinyBlock(tessellator, false);
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
+ }
+ }
+
+ public void renderShine(Tessellator tessellator, boolean autoAnimate) {
+ TextureManager texturemanager = this.mc.getTextureManager();
+ texturemanager.bindTexture(RES_ITEM_GLINT);
+ GL11.glEnable(GL11.GL_BLEND);
+ OpenGlHelper.glBlendFunc(768, 1, 1, 0);
+ GL11.glMatrixMode(GL11.GL_TEXTURE);
+ GL11.glPushMatrix();
+ float f8 = 0.325F;
+ GL11.glScalef(f8, f8, f8);
+ if (autoAnimate)
+ GL11.glTranslatef(17F, 0.0F, 0.0F);
+ else {
+ GL11.glTranslatef(tran, 0.0F, 0.0F);
+ tran += 0.0004F;
+ if (tran >= 360F)
+ tran = 0F;
+ }
+ GL11.glRotatef(-30.0F, 0.0F, 0.0F, 1.0F);
+ GL11.glColor3f(1F, 1F, 0F);
+ ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F,
+ 256, 256, 0.001F);
+ GL11.glPopMatrix();
+ }
+
+ public void shinyBlock(Tessellator tessellator, boolean autoAnimate) {
+ GL11.glPushMatrix();
+ GL11.glTranslatef(0F, 0.0F, -0.001F);
+ renderShine(tessellator, autoAnimate);
+ GL11.glMatrixMode(GL11.GL_MODELVIEW);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glDepthFunc(GL11.GL_LEQUAL);
+ GL11.glPopMatrix();
+ GL11.glPushMatrix();
+ GL11.glTranslatef(1.0F, 0.0F, 1.0001F);
+ GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
+ renderShine(tessellator, autoAnimate);
+ GL11.glMatrixMode(GL11.GL_MODELVIEW);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glDepthFunc(GL11.GL_LEQUAL);
+ GL11.glPopMatrix();
+ GL11.glPushMatrix();
+ GL11.glTranslatef(-0.001F, 0.0F, 0.0F);
+ GL11.glRotatef(90.0F, 0.0F, -1.0F, 0.0F);
+ renderShine(tessellator, autoAnimate);
+ GL11.glMatrixMode(GL11.GL_MODELVIEW);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glDepthFunc(GL11.GL_LEQUAL);
+ GL11.glPopMatrix();
+ GL11.glPushMatrix();
+ GL11.glTranslatef(1.001F, 0.0F, 1.0F);
+ GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
+ renderShine(tessellator, autoAnimate);
+ GL11.glMatrixMode(GL11.GL_MODELVIEW);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glDepthFunc(GL11.GL_LEQUAL);
+ GL11.glPopMatrix();
+ GL11.glPushMatrix();
+ GL11.glTranslatef(0.0F, -0.001F, 0.0F);
+ GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
+ renderShine(tessellator, autoAnimate);
+ GL11.glMatrixMode(GL11.GL_MODELVIEW);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glDepthFunc(GL11.GL_LEQUAL);
+ GL11.glPopMatrix();
+ GL11.glPushMatrix();
+ GL11.glTranslatef(0.0F, 1.0F, 0.0F);
+ GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
+ renderShine(tessellator, autoAnimate);
+ GL11.glMatrixMode(GL11.GL_MODELVIEW);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glDepthFunc(GL11.GL_LEQUAL);
+ GL11.glPopMatrix();
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/render/MaskRender.java b/src/main/java/darkknight/jewelrycraft/item/render/MaskRender.java index 8228619..d967cef 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/item/render/MaskRender.java +++ b/src/main/java/darkknight/jewelrycraft/item/render/MaskRender.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.item.render;
import org.lwjgl.opengl.GL11;
+
import darkknight.jewelrycraft.model.ModelMask;
import darkknight.jewelrycraft.util.Variables;
import net.minecraft.client.Minecraft;
@@ -9,23 +10,23 @@ import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
-public class MaskRender extends TileEntitySpecialRenderer
-{
- ModelMask mask = new ModelMask();
- ResourceLocation texture = new ResourceLocation(Variables.MODID, "textures/entities/Mask.png");
-
- @Override
- public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
- {
- }
-
- public void doRender(Entity entity, double x, double y, double z, float f, float g)
- {
- GL11.glPushMatrix();
- Minecraft.getMinecraft().renderEngine.bindTexture(texture);
- GL11.glTranslatef(0.1615F, 0F, 0.03F);
- GL11.glScalef(1.0F, 1.0F, 0.5F);
- mask.render(entity, 0F, 0F, 0F, 0F, 0F, 0.02F);
- GL11.glPopMatrix();
- }
+public class MaskRender extends TileEntitySpecialRenderer {
+ ModelMask mask = new ModelMask();
+ ResourceLocation texture = new ResourceLocation(Variables.MODID,
+ "textures/entities/Mask.png");
+
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y,
+ double z, float scale) {
+ }
+
+ public void doRender(Entity entity, double x, double y, double z,
+ float f, float g) {
+ GL11.glPushMatrix();
+ Minecraft.getMinecraft().renderEngine.bindTexture(texture);
+ GL11.glTranslatef(0.1615F, 0F, 0.03F);
+ GL11.glScalef(1.0F, 1.0F, 0.5F);
+ mask.render(entity, 0F, 0F, 0F, 0F, 0F, 0.02F);
+ GL11.glPopMatrix();
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/item/render/NecklaceRender.java b/src/main/java/darkknight/jewelrycraft/item/render/NecklaceRender.java index 0799bab..5134559 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/item/render/NecklaceRender.java +++ b/src/main/java/darkknight/jewelrycraft/item/render/NecklaceRender.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.item.render;
import org.lwjgl.opengl.GL11;
+
import darkknight.jewelrycraft.model.ModelNeckalce;
import darkknight.jewelrycraft.util.Variables;
import net.minecraft.client.Minecraft;
@@ -9,21 +10,22 @@ import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
-public class NecklaceRender extends TileEntitySpecialRenderer
-{
- public ModelNeckalce neckalce = new ModelNeckalce();
- ResourceLocation texture = new ResourceLocation(Variables.MODID, "textures/entities/Necklace.png");
-
- @Override
- public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
- {
- }
-
- public void doRender(Entity entity, double x, double y, double z, float f, float g)
- {
- GL11.glPushMatrix();
- Minecraft.getMinecraft().renderEngine.bindTexture(texture);
- if ((float)z != -1) neckalce.render(entity, 0F, 0F, 0F, (float)z, f, 1.0F);
- GL11.glPopMatrix();
- }
+public class NecklaceRender extends TileEntitySpecialRenderer {
+ public ModelNeckalce neckalce = new ModelNeckalce();
+ ResourceLocation texture = new ResourceLocation(
+ Variables.MODID, "textures/entities/Necklace.png");
+
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y,
+ double z, float scale) {
+ }
+
+ public void doRender(Entity entity, double x, double y, double z,
+ float f, float g) {
+ GL11.glPushMatrix();
+ Minecraft.getMinecraft().renderEngine.bindTexture(texture);
+ if ((float) z != -1)
+ neckalce.render(entity, 0F, 0F, 0F, (float) z, f, 1.0F);
+ GL11.glPopMatrix();
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/item/render/RingRender.java b/src/main/java/darkknight/jewelrycraft/item/render/RingRender.java index b48af10..88083ab 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/item/render/RingRender.java +++ b/src/main/java/darkknight/jewelrycraft/item/render/RingRender.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.item.render;
import org.lwjgl.opengl.GL11;
+
import darkknight.jewelrycraft.model.ModelRing;
import darkknight.jewelrycraft.util.Variables;
import net.minecraft.client.Minecraft;
@@ -9,21 +10,22 @@ import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
-public class RingRender extends TileEntitySpecialRenderer
-{
- public ModelRing ring = new ModelRing();
- ResourceLocation texture = new ResourceLocation(Variables.MODID, "textures/entities/Ring.png");
-
- @Override
- public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
- {
- }
-
- public void doRender(Entity entity, double x, double y, double z, float f, float g)
- {
- GL11.glPushMatrix();
- Minecraft.getMinecraft().renderEngine.bindTexture(texture);
- if ((float)z != -1) ring.render(entity, 0F, 0F, 0F, (float)z, f, 1.0F);
- GL11.glPopMatrix();
- }
+public class RingRender extends TileEntitySpecialRenderer {
+ public ModelRing ring = new ModelRing();
+ ResourceLocation texture = new ResourceLocation(Variables.MODID,
+ "textures/entities/Ring.png");
+
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y,
+ double z, float scale) {
+ }
+
+ public void doRender(Entity entity, double x, double y, double z,
+ float f, float g) {
+ GL11.glPushMatrix();
+ Minecraft.getMinecraft().renderEngine.bindTexture(texture);
+ if ((float) z != -1)
+ ring.render(entity, 0F, 0F, 0F, (float) z, f, 1.0F);
+ GL11.glPopMatrix();
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/model/ItemStackModelRenderer.java b/src/main/java/darkknight/jewelrycraft/model/ItemStackModelRenderer.java index fa56a5b..9a5539b 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/model/ItemStackModelRenderer.java +++ b/src/main/java/darkknight/jewelrycraft/model/ItemStackModelRenderer.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.model;
import org.lwjgl.opengl.GL11;
+
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
@@ -14,58 +15,63 @@ import net.minecraft.util.ResourceLocation; /**
* @author Paul Fulham (pau101)
*/
-public class ItemStackModelRenderer extends ModelRenderer
-{
- private RenderItem renderItem;
- private TextureManager textureManager;
- private ResourceLocation resetResourceLocation;
- private EntityItem entityItem;
- private Minecraft mc;
-
- /**
- * @param modelBase
- * @param resetResourceLocation
- */
- public ItemStackModelRenderer(ModelBase modelBase, ResourceLocation resetResourceLocation)
- {
- super(modelBase);
- renderItem = (RenderItem)RenderManager.instance.entityRenderMap.get(EntityItem.class);
- textureManager = (mc = Minecraft.getMinecraft()).getTextureManager();
- this.resetResourceLocation = resetResourceLocation;
- }
-
- /**
- * @param itemStack
- */
- public void setItemStack(ItemStack itemStack)
- {
- if (itemStack == null || itemStack.getItem() == null) entityItem = null;
- else{
- entityItem = new EntityItem(null, 0, 0, 0, itemStack);
- entityItem.hoverStart = 0;
- }
- }
-
- /**
- * @param scale
- */
- @Override
- public void render(float scale)
- {
- if (!isHidden && showModel && entityItem != null){
- if (textureManager == null) textureManager = mc.getTextureManager();
- GL11.glPushMatrix();
- GL11.glTranslatef(offsetX, offsetY, offsetZ);
- GL11.glTranslatef(rotationPointX * scale, rotationPointY * scale, rotationPointZ * scale);
- GL11.glRotatef(rotateAngleZ * (180 / (float)Math.PI), 0, 0, 1);
- GL11.glRotatef(rotateAngleY * (180 / (float)Math.PI), 0, 1, 0);
- GL11.glRotatef(rotateAngleX * (180 / (float)Math.PI), 1, 0, 0);
- boolean fancyGraphics = mc.gameSettings.fancyGraphics;
- mc.gameSettings.fancyGraphics = true;
- renderItem.doRender(entityItem, 0, 0, 0, 0, 0);
- mc.gameSettings.fancyGraphics = fancyGraphics;
- GL11.glPopMatrix();
- textureManager.bindTexture(resetResourceLocation);
- }
- }
+public class ItemStackModelRenderer extends ModelRenderer {
+ private RenderItem renderItem;
+ private TextureManager textureManager;
+ private ResourceLocation resetResourceLocation;
+ private EntityItem entityItem;
+ private Minecraft mc;
+
+ /**
+ * @param modelBase
+ * @param resetResourceLocation
+ */
+ public ItemStackModelRenderer(ModelBase modelBase,
+ ResourceLocation resetResourceLocation) {
+ super(modelBase);
+ renderItem = (RenderItem) RenderManager.instance.entityRenderMap
+ .get(EntityItem.class);
+ textureManager =
+ (mc = Minecraft.getMinecraft()).getTextureManager();
+ this.resetResourceLocation = resetResourceLocation;
+ }
+
+ /**
+ * @param itemStack
+ */
+ public void setItemStack(ItemStack itemStack) {
+ if (itemStack == null || itemStack.getItem() == null)
+ entityItem = null;
+ else {
+ entityItem = new EntityItem(null, 0, 0, 0, itemStack);
+ entityItem.hoverStart = 0;
+ }
+ }
+
+ /**
+ * @param scale
+ */
+ @Override
+ public void render(float scale) {
+ if (!isHidden && showModel && entityItem != null) {
+ if (textureManager == null)
+ textureManager = mc.getTextureManager();
+ GL11.glPushMatrix();
+ GL11.glTranslatef(offsetX, offsetY, offsetZ);
+ GL11.glTranslatef(rotationPointX * scale,
+ rotationPointY * scale, rotationPointZ * scale);
+ GL11.glRotatef(rotateAngleZ * (180 / (float) Math.PI), 0, 0,
+ 1);
+ GL11.glRotatef(rotateAngleY * (180 / (float) Math.PI), 0, 1,
+ 0);
+ GL11.glRotatef(rotateAngleX * (180 / (float) Math.PI), 1, 0,
+ 0);
+ boolean fancyGraphics = mc.gameSettings.fancyGraphics;
+ mc.gameSettings.fancyGraphics = true;
+ renderItem.doRender(entityItem, 0, 0, 0, 0, 0);
+ mc.gameSettings.fancyGraphics = fancyGraphics;
+ GL11.glPopMatrix();
+ textureManager.bindTexture(resetResourceLocation);
+ }
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelBracelet.java b/src/main/java/darkknight/jewelrycraft/model/ModelBracelet.java index 6326569..08a092a 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelBracelet.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelBracelet.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.model; import org.lwjgl.opengl.GL11; + import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; @@ -8,175 +9,231 @@ import net.minecraft.entity.Entity; /** * ModelBiped - Either Mojang or a mod author Created using Tabula 4.1.1 */ -public class ModelBracelet extends ModelBase -{ - public ModelRenderer metal1; - public ModelRenderer metal2; - public ModelRenderer metal3; - public ModelRenderer metal4; - public ModelRenderer gem1; - public ModelRenderer gem2; - public ModelRenderer gem3; - public ModelRenderer gem4; - public ModelRenderer gem5; - public ModelRenderer gem6; - public ModelRenderer gem7; - public ModelRenderer gem8; - public ModelRenderer gem9; - - public ModelBracelet() - { - this.textureWidth = 16; - this.textureHeight = 16; - this.metal4 = new ModelRenderer(this, 0, 8); - this.metal4.setRotationPoint(-5.0F, 12.0F, -2.0F); - this.metal4.addBox(0.0F, 0.0F, 0.0F, 1, 2, 4, 0.0F); - this.gem4 = new ModelRenderer(this, 0, 0); - this.gem4.setRotationPoint(-3.0F, 12.8F, -3.5F); - this.gem4.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); - this.setRotateAngle(gem4, 0.0F, 0.008901179185171082F, 0.0F); - this.gem3 = new ModelRenderer(this, 0, 0); - this.gem3.setRotationPoint(-4.8F, 12.2F, -3.5F); - this.gem3.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); - this.gem2 = new ModelRenderer(this, 0, 0); - this.gem2.setRotationPoint(-1.5F, 12.8F, -3.5F); - this.gem2.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); - this.gem1 = new ModelRenderer(this, 0, 0); - this.gem1.setRotationPoint(0.3F, 12.2F, -3.5F); - this.gem1.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); - this.metal1 = new ModelRenderer(this, 0, 8); - this.metal1.setRotationPoint(-5.0F, 12.0F, -3.0F); - this.metal1.addBox(0.0F, 0.0F, 0.0F, 6, 2, 1, 0.0F); - this.gem6 = new ModelRenderer(this, 0, 0); - this.gem6.setRotationPoint(-4.3F, 12.7F, -3.5F); - this.gem6.addBox(0.0F, 0.0F, 0.0F, 1, 2, 1, 0.0F); - this.gem7 = new ModelRenderer(this, 0, 0); - this.gem7.setRotationPoint(-3.8F, 12.7F, -3.5F); - this.gem7.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); - this.gem8 = new ModelRenderer(this, 0, 0); - this.gem8.setRotationPoint(-0.2F, 12.7F, -3.5F); - this.gem8.addBox(0.0F, 0.0F, 0.0F, 1, 2, 1, 0.0F); - this.metal2 = new ModelRenderer(this, 0, 8); - this.metal2.setRotationPoint(-5.0F, 12.0F, 2.0F); - this.metal2.addBox(0.0F, 0.0F, 0.0F, 6, 2, 1, 0.0F); - this.gem5 = new ModelRenderer(this, 0, 0); - this.gem5.setRotationPoint(-2.5F, 12.3F, -3.5F); - this.gem5.addBox(0.0F, 0.0F, 0.0F, 2, 3, 1, 0.0F); - this.metal3 = new ModelRenderer(this, 0, 8); - this.metal3.setRotationPoint(0.0F, 12.0F, -2.0F); - this.metal3.addBox(0.0F, 0.0F, 0.0F, 1, 2, 4, 0.0F); - this.gem9 = new ModelRenderer(this, 0, 0); - this.gem9.setRotationPoint(-0.7F, 12.7F, -3.5F); - this.gem9.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); - } - - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { -// GL11.glDisable(GL11.GL_LIGHTING); - if ((int)f3 != -1){ - int ingotColor = (int)f3; - int red = (ingotColor >> 16) & 0xff; - int green = (ingotColor >> 8) & 0xff; - int blue = ingotColor & 0xff; - GL11.glColor3f((float)red / 255, (float)green / 255, (float)blue / 255); - this.metal1.render(f5); - this.metal2.render(f5); - this.metal3.render(f5); - this.metal4.render(f5); - } - if ((int)f4 != -1){ - int gemColor = (int)f4; - int red = gemColor >> 16 & 0xff; - int green = gemColor >> 8 & 0xff; - int blue = gemColor & 0xff; - GL11.glColor3f((float)red / 255, (float)green / 255, (float)blue / 255); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE_MINUS_DST_COLOR); - GL11.glPushMatrix(); - GL11.glTranslatef(this.gem4.offsetX, this.gem4.offsetY, this.gem4.offsetZ); - GL11.glTranslatef(this.gem4.rotationPointX * f5, this.gem4.rotationPointY * f5, this.gem4.rotationPointZ * f5); - GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.gem4.offsetX, -this.gem4.offsetY, -this.gem4.offsetZ); - GL11.glTranslatef(-this.gem4.rotationPointX * f5, -this.gem4.rotationPointY * f5, -this.gem4.rotationPointZ * f5); - this.gem4.render(f5); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glTranslatef(this.gem3.offsetX, this.gem3.offsetY, this.gem3.offsetZ); - GL11.glTranslatef(this.gem3.rotationPointX * f5, this.gem3.rotationPointY * f5, this.gem3.rotationPointZ * f5); - GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.gem3.offsetX, -this.gem3.offsetY, -this.gem3.offsetZ); - GL11.glTranslatef(-this.gem3.rotationPointX * f5, -this.gem3.rotationPointY * f5, -this.gem3.rotationPointZ * f5); - this.gem3.render(f5); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glTranslatef(this.gem2.offsetX, this.gem2.offsetY, this.gem2.offsetZ); - GL11.glTranslatef(this.gem2.rotationPointX * f5, this.gem2.rotationPointY * f5, this.gem2.rotationPointZ * f5); - GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.gem2.offsetX, -this.gem2.offsetY, -this.gem2.offsetZ); - GL11.glTranslatef(-this.gem2.rotationPointX * f5, -this.gem2.rotationPointY * f5, -this.gem2.rotationPointZ * f5); - this.gem2.render(f5); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glTranslatef(this.gem1.offsetX, this.gem1.offsetY, this.gem1.offsetZ); - GL11.glTranslatef(this.gem1.rotationPointX * f5, this.gem1.rotationPointY * f5, this.gem1.rotationPointZ * f5); - GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.gem1.offsetX, -this.gem1.offsetY, -this.gem1.offsetZ); - GL11.glTranslatef(-this.gem1.rotationPointX * f5, -this.gem1.rotationPointY * f5, -this.gem1.rotationPointZ * f5); - this.gem1.render(f5); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glTranslatef(this.gem6.offsetX, this.gem6.offsetY, this.gem6.offsetZ); - GL11.glTranslatef(this.gem6.rotationPointX * f5, this.gem6.rotationPointY * f5, this.gem6.rotationPointZ * f5); - GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.gem6.offsetX, -this.gem6.offsetY, -this.gem6.offsetZ); - GL11.glTranslatef(-this.gem6.rotationPointX * f5, -this.gem6.rotationPointY * f5, -this.gem6.rotationPointZ * f5); - this.gem6.render(f5); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glTranslatef(this.gem7.offsetX, this.gem7.offsetY, this.gem7.offsetZ); - GL11.glTranslatef(this.gem7.rotationPointX * f5, this.gem7.rotationPointY * f5, this.gem7.rotationPointZ * f5); - GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.gem7.offsetX, -this.gem7.offsetY, -this.gem7.offsetZ); - GL11.glTranslatef(-this.gem7.rotationPointX * f5, -this.gem7.rotationPointY * f5, -this.gem7.rotationPointZ * f5); - this.gem7.render(f5); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glTranslatef(this.gem8.offsetX, this.gem8.offsetY, this.gem8.offsetZ); - GL11.glTranslatef(this.gem8.rotationPointX * f5, this.gem8.rotationPointY * f5, this.gem8.rotationPointZ * f5); - GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.gem8.offsetX, -this.gem8.offsetY, -this.gem8.offsetZ); - GL11.glTranslatef(-this.gem8.rotationPointX * f5, -this.gem8.rotationPointY * f5, -this.gem8.rotationPointZ * f5); - this.gem8.render(f5); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glTranslatef(this.gem5.offsetX, this.gem5.offsetY, this.gem5.offsetZ); - GL11.glTranslatef(this.gem5.rotationPointX * f5, this.gem5.rotationPointY * f5, this.gem5.rotationPointZ * f5); - GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.gem5.offsetX, -this.gem5.offsetY, -this.gem5.offsetZ); - GL11.glTranslatef(-this.gem5.rotationPointX * f5, -this.gem5.rotationPointY * f5, -this.gem5.rotationPointZ * f5); - this.gem5.render(f5); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glTranslatef(this.gem9.offsetX, this.gem9.offsetY, this.gem9.offsetZ); - GL11.glTranslatef(this.gem9.rotationPointX * f5, this.gem9.rotationPointY * f5, this.gem9.rotationPointZ * f5); - GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.gem9.offsetX, -this.gem9.offsetY, -this.gem9.offsetZ); - GL11.glTranslatef(-this.gem9.rotationPointX * f5, -this.gem9.rotationPointY * f5, -this.gem9.rotationPointZ * f5); - this.gem9.render(f5); - GL11.glPopMatrix(); - GL11.glDisable(GL11.GL_BLEND); - } -// GL11.glEnable(GL11.GL_LIGHTING); - } - - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) - { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } +public class ModelBracelet extends ModelBase { + public ModelRenderer metal1; + public ModelRenderer metal2; + public ModelRenderer metal3; + public ModelRenderer metal4; + public ModelRenderer gem1; + public ModelRenderer gem2; + public ModelRenderer gem3; + public ModelRenderer gem4; + public ModelRenderer gem5; + public ModelRenderer gem6; + public ModelRenderer gem7; + public ModelRenderer gem8; + public ModelRenderer gem9; + + public ModelBracelet() { + this.textureWidth = 16; + this.textureHeight = 16; + this.metal4 = new ModelRenderer(this, 0, 8); + this.metal4.setRotationPoint(-5.0F, 12.0F, -2.0F); + this.metal4.addBox(0.0F, 0.0F, 0.0F, 1, 2, 4, 0.0F); + this.gem4 = new ModelRenderer(this, 0, 0); + this.gem4.setRotationPoint(-3.0F, 12.8F, -3.5F); + this.gem4.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); + this.setRotateAngle(gem4, 0.0F, 0.008901179185171082F, 0.0F); + this.gem3 = new ModelRenderer(this, 0, 0); + this.gem3.setRotationPoint(-4.8F, 12.2F, -3.5F); + this.gem3.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); + this.gem2 = new ModelRenderer(this, 0, 0); + this.gem2.setRotationPoint(-1.5F, 12.8F, -3.5F); + this.gem2.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); + this.gem1 = new ModelRenderer(this, 0, 0); + this.gem1.setRotationPoint(0.3F, 12.2F, -3.5F); + this.gem1.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); + this.metal1 = new ModelRenderer(this, 0, 8); + this.metal1.setRotationPoint(-5.0F, 12.0F, -3.0F); + this.metal1.addBox(0.0F, 0.0F, 0.0F, 6, 2, 1, 0.0F); + this.gem6 = new ModelRenderer(this, 0, 0); + this.gem6.setRotationPoint(-4.3F, 12.7F, -3.5F); + this.gem6.addBox(0.0F, 0.0F, 0.0F, 1, 2, 1, 0.0F); + this.gem7 = new ModelRenderer(this, 0, 0); + this.gem7.setRotationPoint(-3.8F, 12.7F, -3.5F); + this.gem7.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); + this.gem8 = new ModelRenderer(this, 0, 0); + this.gem8.setRotationPoint(-0.2F, 12.7F, -3.5F); + this.gem8.addBox(0.0F, 0.0F, 0.0F, 1, 2, 1, 0.0F); + this.metal2 = new ModelRenderer(this, 0, 8); + this.metal2.setRotationPoint(-5.0F, 12.0F, 2.0F); + this.metal2.addBox(0.0F, 0.0F, 0.0F, 6, 2, 1, 0.0F); + this.gem5 = new ModelRenderer(this, 0, 0); + this.gem5.setRotationPoint(-2.5F, 12.3F, -3.5F); + this.gem5.addBox(0.0F, 0.0F, 0.0F, 2, 3, 1, 0.0F); + this.metal3 = new ModelRenderer(this, 0, 8); + this.metal3.setRotationPoint(0.0F, 12.0F, -2.0F); + this.metal3.addBox(0.0F, 0.0F, 0.0F, 1, 2, 4, 0.0F); + this.gem9 = new ModelRenderer(this, 0, 0); + this.gem9.setRotationPoint(-0.7F, 12.7F, -3.5F); + this.gem9.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, + float f3, float f4, float f5) { + // GL11.glDisable(GL11.GL_LIGHTING); + if ((int) f3 != -1) { + int ingotColor = (int) f3; + int red = (ingotColor >> 16) & 0xff; + int green = (ingotColor >> 8) & 0xff; + int blue = ingotColor & 0xff; + GL11.glColor3f((float) red / 255, (float) green / 255, + (float) blue / 255); + this.metal1.render(f5); + this.metal2.render(f5); + this.metal3.render(f5); + this.metal4.render(f5); + } + if ((int) f4 != -1) { + int gemColor = (int) f4; + int red = gemColor >> 16 & 0xff; + int green = gemColor >> 8 & 0xff; + int blue = gemColor & 0xff; + GL11.glColor3f((float) red / 255, (float) green / 255, + (float) blue / 255); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_COLOR, + GL11.GL_ONE_MINUS_DST_COLOR); + GL11.glPushMatrix(); + GL11.glTranslatef(this.gem4.offsetX, this.gem4.offsetY, + this.gem4.offsetZ); + GL11.glTranslatef(this.gem4.rotationPointX * f5, + this.gem4.rotationPointY * f5, + this.gem4.rotationPointZ * f5); + GL11.glScaled(0.5D, 0.5D, 0.5D); + GL11.glTranslatef(-this.gem4.offsetX, -this.gem4.offsetY, + -this.gem4.offsetZ); + GL11.glTranslatef(-this.gem4.rotationPointX * f5, + -this.gem4.rotationPointY * f5, + -this.gem4.rotationPointZ * f5); + this.gem4.render(f5); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glTranslatef(this.gem3.offsetX, this.gem3.offsetY, + this.gem3.offsetZ); + GL11.glTranslatef(this.gem3.rotationPointX * f5, + this.gem3.rotationPointY * f5, + this.gem3.rotationPointZ * f5); + GL11.glScaled(0.5D, 0.5D, 0.5D); + GL11.glTranslatef(-this.gem3.offsetX, -this.gem3.offsetY, + -this.gem3.offsetZ); + GL11.glTranslatef(-this.gem3.rotationPointX * f5, + -this.gem3.rotationPointY * f5, + -this.gem3.rotationPointZ * f5); + this.gem3.render(f5); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glTranslatef(this.gem2.offsetX, this.gem2.offsetY, + this.gem2.offsetZ); + GL11.glTranslatef(this.gem2.rotationPointX * f5, + this.gem2.rotationPointY * f5, + this.gem2.rotationPointZ * f5); + GL11.glScaled(0.5D, 0.5D, 0.5D); + GL11.glTranslatef(-this.gem2.offsetX, -this.gem2.offsetY, + -this.gem2.offsetZ); + GL11.glTranslatef(-this.gem2.rotationPointX * f5, + -this.gem2.rotationPointY * f5, + -this.gem2.rotationPointZ * f5); + this.gem2.render(f5); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glTranslatef(this.gem1.offsetX, this.gem1.offsetY, + this.gem1.offsetZ); + GL11.glTranslatef(this.gem1.rotationPointX * f5, + this.gem1.rotationPointY * f5, + this.gem1.rotationPointZ * f5); + GL11.glScaled(0.5D, 0.5D, 0.5D); + GL11.glTranslatef(-this.gem1.offsetX, -this.gem1.offsetY, + -this.gem1.offsetZ); + GL11.glTranslatef(-this.gem1.rotationPointX * f5, + -this.gem1.rotationPointY * f5, + -this.gem1.rotationPointZ * f5); + this.gem1.render(f5); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glTranslatef(this.gem6.offsetX, this.gem6.offsetY, + this.gem6.offsetZ); + GL11.glTranslatef(this.gem6.rotationPointX * f5, + this.gem6.rotationPointY * f5, + this.gem6.rotationPointZ * f5); + GL11.glScaled(0.5D, 0.5D, 0.5D); + GL11.glTranslatef(-this.gem6.offsetX, -this.gem6.offsetY, + -this.gem6.offsetZ); + GL11.glTranslatef(-this.gem6.rotationPointX * f5, + -this.gem6.rotationPointY * f5, + -this.gem6.rotationPointZ * f5); + this.gem6.render(f5); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glTranslatef(this.gem7.offsetX, this.gem7.offsetY, + this.gem7.offsetZ); + GL11.glTranslatef(this.gem7.rotationPointX * f5, + this.gem7.rotationPointY * f5, + this.gem7.rotationPointZ * f5); + GL11.glScaled(0.5D, 0.5D, 0.5D); + GL11.glTranslatef(-this.gem7.offsetX, -this.gem7.offsetY, + -this.gem7.offsetZ); + GL11.glTranslatef(-this.gem7.rotationPointX * f5, + -this.gem7.rotationPointY * f5, + -this.gem7.rotationPointZ * f5); + this.gem7.render(f5); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glTranslatef(this.gem8.offsetX, this.gem8.offsetY, + this.gem8.offsetZ); + GL11.glTranslatef(this.gem8.rotationPointX * f5, + this.gem8.rotationPointY * f5, + this.gem8.rotationPointZ * f5); + GL11.glScaled(0.5D, 0.5D, 0.5D); + GL11.glTranslatef(-this.gem8.offsetX, -this.gem8.offsetY, + -this.gem8.offsetZ); + GL11.glTranslatef(-this.gem8.rotationPointX * f5, + -this.gem8.rotationPointY * f5, + -this.gem8.rotationPointZ * f5); + this.gem8.render(f5); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glTranslatef(this.gem5.offsetX, this.gem5.offsetY, + this.gem5.offsetZ); + GL11.glTranslatef(this.gem5.rotationPointX * f5, + this.gem5.rotationPointY * f5, + this.gem5.rotationPointZ * f5); + GL11.glScaled(0.5D, 0.5D, 0.5D); + GL11.glTranslatef(-this.gem5.offsetX, -this.gem5.offsetY, + -this.gem5.offsetZ); + GL11.glTranslatef(-this.gem5.rotationPointX * f5, + -this.gem5.rotationPointY * f5, + -this.gem5.rotationPointZ * f5); + this.gem5.render(f5); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glTranslatef(this.gem9.offsetX, this.gem9.offsetY, + this.gem9.offsetZ); + GL11.glTranslatef(this.gem9.rotationPointX * f5, + this.gem9.rotationPointY * f5, + this.gem9.rotationPointZ * f5); + GL11.glScaled(0.5D, 0.5D, 0.5D); + GL11.glTranslatef(-this.gem9.offsetX, -this.gem9.offsetY, + -this.gem9.offsetZ); + GL11.glTranslatef(-this.gem9.rotationPointX * f5, + -this.gem9.rotationPointY * f5, + -this.gem9.rotationPointZ * f5); + this.gem9.render(f5); + GL11.glPopMatrix(); + GL11.glDisable(GL11.GL_BLEND); + } + // GL11.glEnable(GL11.GL_LIGHTING); + } + + /** + * This is a helper function from Tabula to set the rotation of model + * parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, + float y, float z) { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelDisplayer.java b/src/main/java/darkknight/jewelrycraft/model/ModelDisplayer.java index c26d76e..2d7d986 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelDisplayer.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelDisplayer.java @@ -1,265 +1,264 @@ package darkknight.jewelrycraft.model; import org.lwjgl.opengl.GL11; + import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class ModelDisplayer extends ModelBase -{ - // fields - ModelRenderer Base; - ModelRenderer Ring11; - ModelRenderer Ring12; - ModelRenderer Ring13; - ModelRenderer Ring14; - ModelRenderer Ring31; - ModelRenderer Ring21; - ModelRenderer Ring32; - ModelRenderer Ring22; - ModelRenderer Ring33; - ModelRenderer Ring23; - ModelRenderer Ring34; - ModelRenderer Ring24; - ModelRenderer Ring25; - ModelRenderer Ring26; - ModelRenderer Ring27; - ModelRenderer Ring28; - ModelRenderer Ring35; - ModelRenderer Ring36; - ModelRenderer Ring37; - ModelRenderer Ring38; - ModelRenderer Ring39; - ModelRenderer Ring310; - ModelRenderer Ring311; - ModelRenderer Ring312; - - /** - * - */ - public ModelDisplayer() - { - textureWidth = 64; - textureHeight = 32; - Base = new ModelRenderer(this, 0, 0); - Base.addBox(0F, 0F, 0F, 16, 3, 16); - Base.setRotationPoint(-8F, 21F, -8F); - Base.setTextureSize(64, 32); - Base.mirror = true; - setRotation(Base, 0F, 0F, 0F); - Ring11 = new ModelRenderer(this, 0, 26); - Ring11.addBox(-2F, 0F, 2F, 4, 1, 1); - Ring11.setRotationPoint(0F, 19F, 0F); - Ring11.setTextureSize(64, 32); - Ring11.mirror = true; - setRotation(Ring11, 0F, 0F, 0F); - Ring12 = new ModelRenderer(this, 0, 20); - Ring12.addBox(-3F, 0F, -2F, 1, 1, 4); - Ring12.setRotationPoint(0F, 19F, 0F); - Ring12.setTextureSize(64, 32); - Ring12.mirror = true; - setRotation(Ring12, 0F, 0F, 0F); - Ring13 = new ModelRenderer(this, 0, 20); - Ring13.addBox(2F, 0F, -2F, 1, 1, 4); - Ring13.setRotationPoint(0F, 19F, 0F); - Ring13.setTextureSize(64, 32); - Ring13.mirror = true; - setRotation(Ring13, 0F, 0F, 0F); - Ring14 = new ModelRenderer(this, 0, 26); - Ring14.addBox(-2F, 0F, -3F, 4, 1, 1); - Ring14.setRotationPoint(0F, 19F, 0F); - Ring14.setTextureSize(64, 32); - Ring14.mirror = true; - setRotation(Ring14, 0F, 0F, 0F); - Ring21 = new ModelRenderer(this, 0, 29); - Ring21.addBox(-4F, 0F, 3F, 1, 1, 1); - Ring21.setRotationPoint(0F, 19F, 0F); - Ring21.setTextureSize(64, 32); - Ring21.mirror = true; - setRotation(Ring21, 0F, 0F, 0F); - Ring22 = new ModelRenderer(this, 0, 29); - Ring22.addBox(-4F, 0F, -4F, 1, 1, 1); - Ring22.setRotationPoint(0F, 19F, 0F); - Ring22.setTextureSize(64, 32); - Ring22.mirror = true; - setRotation(Ring22, 0F, 0F, 0F); - Ring23 = new ModelRenderer(this, 0, 29); - Ring23.addBox(3F, 0F, -4F, 1, 1, 1); - Ring23.setRotationPoint(0F, 19F, 0F); - Ring23.setTextureSize(64, 32); - Ring23.mirror = true; - setRotation(Ring23, 0F, 0F, 0F); - Ring34 = new ModelRenderer(this, 26, 20); - Ring34.addBox(6F, 0F, -4F, 1, 1, 8); - Ring34.setRotationPoint(0F, 19F, 0F); - Ring34.setTextureSize(64, 32); - Ring34.mirror = true; - setRotation(Ring34, 0F, 0F, 0F); - Ring24 = new ModelRenderer(this, 0, 29); - Ring24.addBox(3F, 0F, 3F, 1, 1, 1); - Ring24.setRotationPoint(0F, 19F, 0F); - Ring24.setTextureSize(64, 32); - Ring24.mirror = true; - setRotation(Ring24, 0F, 0F, 0F); - Ring25 = new ModelRenderer(this, 11, 20); - Ring25.addBox(4F, 0F, -3F, 1, 1, 6); - Ring25.setRotationPoint(0F, 19F, 0F); - Ring25.setTextureSize(64, 32); - Ring25.mirror = true; - setRotation(Ring25, 0F, 0F, 0F); - Ring26 = new ModelRenderer(this, 11, 28); - Ring26.addBox(-3F, 0F, -5F, 6, 1, 1); - Ring26.setRotationPoint(0F, 19F, 0F); - Ring26.setTextureSize(64, 32); - Ring26.mirror = true; - setRotation(Ring26, 0F, 0F, 0F); - Ring27 = new ModelRenderer(this, 11, 20); - Ring27.addBox(-5F, 0F, -3F, 1, 1, 6); - Ring27.setRotationPoint(0F, 19F, 0F); - Ring27.setTextureSize(64, 32); - Ring27.mirror = true; - setRotation(Ring27, 0F, 0F, 0F); - Ring28 = new ModelRenderer(this, 11, 28); - Ring28.addBox(-3F, 0F, 4F, 6, 1, 1); - Ring28.setRotationPoint(0F, 19F, 0F); - Ring28.setTextureSize(64, 32); - Ring28.mirror = true; - setRotation(Ring28, 0F, 0F, 0F); - Ring31 = new ModelRenderer(this, 0, 29); - Ring31.addBox(-6F, 0F, 4F, 1, 1, 1); - Ring31.setRotationPoint(0F, 19F, 0F); - Ring31.setTextureSize(64, 32); - Ring31.mirror = true; - setRotation(Ring31, 0F, 0F, 0F); - Ring32 = new ModelRenderer(this, 26, 20); - Ring32.addBox(-7F, 0F, -4F, 1, 1, 8); - Ring32.setRotationPoint(0F, 19F, 0F); - Ring32.setTextureSize(64, 32); - Ring32.mirror = true; - setRotation(Ring32, 0F, 0F, 0F); - Ring33 = new ModelRenderer(this, 26, 30); - Ring33.addBox(-4F, 0F, -7F, 8, 1, 1); - Ring33.setRotationPoint(0F, 19F, 0F); - Ring33.setTextureSize(64, 32); - Ring33.mirror = true; - setRotation(Ring33, 0F, 0F, 0F); - Ring35 = new ModelRenderer(this, 26, 30); - Ring35.addBox(-4F, 0F, 6F, 8, 1, 1); - Ring35.setRotationPoint(0F, 19F, 0F); - Ring35.setTextureSize(64, 32); - Ring35.mirror = true; - setRotation(Ring35, 0F, 0F, 0F); - Ring36 = new ModelRenderer(this, 0, 29); - Ring36.addBox(-5F, 0F, 5F, 1, 1, 1); - Ring36.setRotationPoint(0F, 19F, 0F); - Ring36.setTextureSize(64, 32); - Ring36.mirror = true; - setRotation(Ring36, 0F, 0F, 0F); - Ring37 = new ModelRenderer(this, 0, 29); - Ring37.addBox(5F, 0F, 4F, 1, 1, 1); - Ring37.setRotationPoint(0F, 19F, 0F); - Ring37.setTextureSize(64, 32); - Ring37.mirror = true; - setRotation(Ring37, 0F, 0F, 0F); - Ring38 = new ModelRenderer(this, 0, 29); - Ring38.addBox(4F, 0F, 5F, 1, 1, 1); - Ring38.setRotationPoint(0F, 19F, 0F); - Ring38.setTextureSize(64, 32); - Ring38.mirror = true; - setRotation(Ring38, 0F, 0F, 0F); - Ring39 = new ModelRenderer(this, 0, 29); - Ring39.addBox(4F, 0F, -6F, 1, 1, 1); - Ring39.setRotationPoint(0F, 19F, 0F); - Ring39.setTextureSize(64, 32); - Ring39.mirror = true; - setRotation(Ring39, 0F, 0F, 0F); - Ring310 = new ModelRenderer(this, 0, 29); - Ring310.addBox(5F, 0F, -5F, 1, 1, 1); - Ring310.setRotationPoint(0F, 19F, 0F); - Ring310.setTextureSize(64, 32); - Ring310.mirror = true; - setRotation(Ring310, 0F, 0F, 0F); - Ring311 = new ModelRenderer(this, 0, 29); - Ring311.addBox(-6F, 0F, -5F, 1, 1, 1); - Ring311.setRotationPoint(0F, 19F, 0F); - Ring311.setTextureSize(64, 32); - Ring311.mirror = true; - setRotation(Ring311, 0F, 0F, 0F); - Ring312 = new ModelRenderer(this, 0, 29); - Ring312.addBox(-5F, 0F, -6F, 1, 1, 1); - Ring312.setRotationPoint(0F, 19F, 0F); - Ring312.setTextureSize(64, 32); - Ring312.mirror = true; - setRotation(Ring312, 0F, 0F, 0F); - } - - /** - * @param entity - * @param f - * @param f1 - * @param f2 - * @param f3 - * @param f4 - * @param f5 - */ - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - GL11.glPushMatrix(); - Base.render(f5); - GL11.glTranslatef(0.0F, 0F - f, 0.0F); - Ring11.render(f5); - Ring12.render(f5); - Ring13.render(f5); - Ring14.render(f5); - GL11.glTranslatef(0.0F, 0F + f - f1, 0.0F); - Ring21.render(f5); - Ring22.render(f5); - Ring23.render(f5); - Ring24.render(f5); - Ring25.render(f5); - Ring26.render(f5); - Ring27.render(f5); - Ring28.render(f5); - GL11.glTranslatef(0.0F, 0F + f1 - f2, 0.0F); - Ring31.render(f5); - Ring32.render(f5); - Ring33.render(f5); - Ring34.render(f5); - Ring35.render(f5); - Ring36.render(f5); - Ring37.render(f5); - Ring38.render(f5); - Ring39.render(f5); - Ring310.render(f5); - Ring311.render(f5); - Ring312.render(f5); - GL11.glPopMatrix(); - } - - /** - * @param model - * @param x - * @param y - * @param z - */ - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - - /** - * @param f - * @param f1 - * @param f2 - * @param f3 - * @param f4 - * @param f5 - */ - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) - { - super.setRotationAngles(f, f1, f2, f3, f4, f5, null); - } +public class ModelDisplayer extends ModelBase { + // fields + ModelRenderer Base; + ModelRenderer Ring11; + ModelRenderer Ring12; + ModelRenderer Ring13; + ModelRenderer Ring14; + ModelRenderer Ring31; + ModelRenderer Ring21; + ModelRenderer Ring32; + ModelRenderer Ring22; + ModelRenderer Ring33; + ModelRenderer Ring23; + ModelRenderer Ring34; + ModelRenderer Ring24; + ModelRenderer Ring25; + ModelRenderer Ring26; + ModelRenderer Ring27; + ModelRenderer Ring28; + ModelRenderer Ring35; + ModelRenderer Ring36; + ModelRenderer Ring37; + ModelRenderer Ring38; + ModelRenderer Ring39; + ModelRenderer Ring310; + ModelRenderer Ring311; + ModelRenderer Ring312; + + /** + * + */ + public ModelDisplayer() { + textureWidth = 64; + textureHeight = 32; + Base = new ModelRenderer(this, 0, 0); + Base.addBox(0F, 0F, 0F, 16, 3, 16); + Base.setRotationPoint(-8F, 21F, -8F); + Base.setTextureSize(64, 32); + Base.mirror = true; + setRotation(Base, 0F, 0F, 0F); + Ring11 = new ModelRenderer(this, 0, 26); + Ring11.addBox(-2F, 0F, 2F, 4, 1, 1); + Ring11.setRotationPoint(0F, 19F, 0F); + Ring11.setTextureSize(64, 32); + Ring11.mirror = true; + setRotation(Ring11, 0F, 0F, 0F); + Ring12 = new ModelRenderer(this, 0, 20); + Ring12.addBox(-3F, 0F, -2F, 1, 1, 4); + Ring12.setRotationPoint(0F, 19F, 0F); + Ring12.setTextureSize(64, 32); + Ring12.mirror = true; + setRotation(Ring12, 0F, 0F, 0F); + Ring13 = new ModelRenderer(this, 0, 20); + Ring13.addBox(2F, 0F, -2F, 1, 1, 4); + Ring13.setRotationPoint(0F, 19F, 0F); + Ring13.setTextureSize(64, 32); + Ring13.mirror = true; + setRotation(Ring13, 0F, 0F, 0F); + Ring14 = new ModelRenderer(this, 0, 26); + Ring14.addBox(-2F, 0F, -3F, 4, 1, 1); + Ring14.setRotationPoint(0F, 19F, 0F); + Ring14.setTextureSize(64, 32); + Ring14.mirror = true; + setRotation(Ring14, 0F, 0F, 0F); + Ring21 = new ModelRenderer(this, 0, 29); + Ring21.addBox(-4F, 0F, 3F, 1, 1, 1); + Ring21.setRotationPoint(0F, 19F, 0F); + Ring21.setTextureSize(64, 32); + Ring21.mirror = true; + setRotation(Ring21, 0F, 0F, 0F); + Ring22 = new ModelRenderer(this, 0, 29); + Ring22.addBox(-4F, 0F, -4F, 1, 1, 1); + Ring22.setRotationPoint(0F, 19F, 0F); + Ring22.setTextureSize(64, 32); + Ring22.mirror = true; + setRotation(Ring22, 0F, 0F, 0F); + Ring23 = new ModelRenderer(this, 0, 29); + Ring23.addBox(3F, 0F, -4F, 1, 1, 1); + Ring23.setRotationPoint(0F, 19F, 0F); + Ring23.setTextureSize(64, 32); + Ring23.mirror = true; + setRotation(Ring23, 0F, 0F, 0F); + Ring34 = new ModelRenderer(this, 26, 20); + Ring34.addBox(6F, 0F, -4F, 1, 1, 8); + Ring34.setRotationPoint(0F, 19F, 0F); + Ring34.setTextureSize(64, 32); + Ring34.mirror = true; + setRotation(Ring34, 0F, 0F, 0F); + Ring24 = new ModelRenderer(this, 0, 29); + Ring24.addBox(3F, 0F, 3F, 1, 1, 1); + Ring24.setRotationPoint(0F, 19F, 0F); + Ring24.setTextureSize(64, 32); + Ring24.mirror = true; + setRotation(Ring24, 0F, 0F, 0F); + Ring25 = new ModelRenderer(this, 11, 20); + Ring25.addBox(4F, 0F, -3F, 1, 1, 6); + Ring25.setRotationPoint(0F, 19F, 0F); + Ring25.setTextureSize(64, 32); + Ring25.mirror = true; + setRotation(Ring25, 0F, 0F, 0F); + Ring26 = new ModelRenderer(this, 11, 28); + Ring26.addBox(-3F, 0F, -5F, 6, 1, 1); + Ring26.setRotationPoint(0F, 19F, 0F); + Ring26.setTextureSize(64, 32); + Ring26.mirror = true; + setRotation(Ring26, 0F, 0F, 0F); + Ring27 = new ModelRenderer(this, 11, 20); + Ring27.addBox(-5F, 0F, -3F, 1, 1, 6); + Ring27.setRotationPoint(0F, 19F, 0F); + Ring27.setTextureSize(64, 32); + Ring27.mirror = true; + setRotation(Ring27, 0F, 0F, 0F); + Ring28 = new ModelRenderer(this, 11, 28); + Ring28.addBox(-3F, 0F, 4F, 6, 1, 1); + Ring28.setRotationPoint(0F, 19F, 0F); + Ring28.setTextureSize(64, 32); + Ring28.mirror = true; + setRotation(Ring28, 0F, 0F, 0F); + Ring31 = new ModelRenderer(this, 0, 29); + Ring31.addBox(-6F, 0F, 4F, 1, 1, 1); + Ring31.setRotationPoint(0F, 19F, 0F); + Ring31.setTextureSize(64, 32); + Ring31.mirror = true; + setRotation(Ring31, 0F, 0F, 0F); + Ring32 = new ModelRenderer(this, 26, 20); + Ring32.addBox(-7F, 0F, -4F, 1, 1, 8); + Ring32.setRotationPoint(0F, 19F, 0F); + Ring32.setTextureSize(64, 32); + Ring32.mirror = true; + setRotation(Ring32, 0F, 0F, 0F); + Ring33 = new ModelRenderer(this, 26, 30); + Ring33.addBox(-4F, 0F, -7F, 8, 1, 1); + Ring33.setRotationPoint(0F, 19F, 0F); + Ring33.setTextureSize(64, 32); + Ring33.mirror = true; + setRotation(Ring33, 0F, 0F, 0F); + Ring35 = new ModelRenderer(this, 26, 30); + Ring35.addBox(-4F, 0F, 6F, 8, 1, 1); + Ring35.setRotationPoint(0F, 19F, 0F); + Ring35.setTextureSize(64, 32); + Ring35.mirror = true; + setRotation(Ring35, 0F, 0F, 0F); + Ring36 = new ModelRenderer(this, 0, 29); + Ring36.addBox(-5F, 0F, 5F, 1, 1, 1); + Ring36.setRotationPoint(0F, 19F, 0F); + Ring36.setTextureSize(64, 32); + Ring36.mirror = true; + setRotation(Ring36, 0F, 0F, 0F); + Ring37 = new ModelRenderer(this, 0, 29); + Ring37.addBox(5F, 0F, 4F, 1, 1, 1); + Ring37.setRotationPoint(0F, 19F, 0F); + Ring37.setTextureSize(64, 32); + Ring37.mirror = true; + setRotation(Ring37, 0F, 0F, 0F); + Ring38 = new ModelRenderer(this, 0, 29); + Ring38.addBox(4F, 0F, 5F, 1, 1, 1); + Ring38.setRotationPoint(0F, 19F, 0F); + Ring38.setTextureSize(64, 32); + Ring38.mirror = true; + setRotation(Ring38, 0F, 0F, 0F); + Ring39 = new ModelRenderer(this, 0, 29); + Ring39.addBox(4F, 0F, -6F, 1, 1, 1); + Ring39.setRotationPoint(0F, 19F, 0F); + Ring39.setTextureSize(64, 32); + Ring39.mirror = true; + setRotation(Ring39, 0F, 0F, 0F); + Ring310 = new ModelRenderer(this, 0, 29); + Ring310.addBox(5F, 0F, -5F, 1, 1, 1); + Ring310.setRotationPoint(0F, 19F, 0F); + Ring310.setTextureSize(64, 32); + Ring310.mirror = true; + setRotation(Ring310, 0F, 0F, 0F); + Ring311 = new ModelRenderer(this, 0, 29); + Ring311.addBox(-6F, 0F, -5F, 1, 1, 1); + Ring311.setRotationPoint(0F, 19F, 0F); + Ring311.setTextureSize(64, 32); + Ring311.mirror = true; + setRotation(Ring311, 0F, 0F, 0F); + Ring312 = new ModelRenderer(this, 0, 29); + Ring312.addBox(-5F, 0F, -6F, 1, 1, 1); + Ring312.setRotationPoint(0F, 19F, 0F); + Ring312.setTextureSize(64, 32); + Ring312.mirror = true; + setRotation(Ring312, 0F, 0F, 0F); + } + + /** + * @param entity + * @param f + * @param f1 + * @param f2 + * @param f3 + * @param f4 + * @param f5 + */ + @Override + public void render(Entity entity, float f, float f1, float f2, + float f3, float f4, float f5) { + GL11.glPushMatrix(); + Base.render(f5); + GL11.glTranslatef(0.0F, 0F - f, 0.0F); + Ring11.render(f5); + Ring12.render(f5); + Ring13.render(f5); + Ring14.render(f5); + GL11.glTranslatef(0.0F, 0F + f - f1, 0.0F); + Ring21.render(f5); + Ring22.render(f5); + Ring23.render(f5); + Ring24.render(f5); + Ring25.render(f5); + Ring26.render(f5); + Ring27.render(f5); + Ring28.render(f5); + GL11.glTranslatef(0.0F, 0F + f1 - f2, 0.0F); + Ring31.render(f5); + Ring32.render(f5); + Ring33.render(f5); + Ring34.render(f5); + Ring35.render(f5); + Ring36.render(f5); + Ring37.render(f5); + Ring38.render(f5); + Ring39.render(f5); + Ring310.render(f5); + Ring311.render(f5); + Ring312.render(f5); + GL11.glPopMatrix(); + } + + /** + * @param model + * @param x + * @param y + * @param z + */ + private void setRotation(ModelRenderer model, float x, float y, + float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + /** + * @param f + * @param f1 + * @param f2 + * @param f3 + * @param f4 + * @param f5 + */ + public void setRotationAngles(float f, float f1, float f2, float f3, + float f4, float f5) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, null); + } } diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelEarrings.java b/src/main/java/darkknight/jewelrycraft/model/ModelEarrings.java index 747117a..c6a067f 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelEarrings.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelEarrings.java @@ -1,120 +1,123 @@ package darkknight.jewelrycraft.model; import org.lwjgl.opengl.GL11; + import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class ModelEarrings extends ModelBase -{ - // fields - ModelRenderer MetalPart00; - ModelRenderer MetalPart10; - ModelRenderer MetalPart20; - ModelRenderer Gem0; - ModelRenderer Gem1; - ModelRenderer MetalPart01; - ModelRenderer MetalPart11; - ModelRenderer MetalPart21; - - public ModelEarrings() - { - textureWidth = 32; - textureHeight = 32; - MetalPart00 = new ModelRenderer(this, 0, 0); - MetalPart00.addBox(0F, 0F, 0F, 1, 3, 1); - MetalPart00.setRotationPoint(4F, -4F, 0F); - MetalPart00.setTextureSize(32, 32); - MetalPart00.mirror = true; - setRotation(MetalPart00, 0F, 0F, 0F); - MetalPart10 = new ModelRenderer(this, 0, 0); - MetalPart10.addBox(0F, 0F, 0F, 1, 1, 1); - MetalPart10.setRotationPoint(4F, -3F, -1F); - MetalPart10.setTextureSize(32, 32); - MetalPart10.mirror = true; - setRotation(MetalPart10, 0F, 0F, 0F); - MetalPart20 = new ModelRenderer(this, 0, 0); - MetalPart20.addBox(0F, 0F, 0F, 1, 1, 1); - MetalPart20.setRotationPoint(4F, -3F, 1F); - MetalPart20.setTextureSize(32, 32); - MetalPart20.mirror = true; - setRotation(MetalPart20, 0F, 0F, 0F); - Gem0 = new ModelRenderer(this, 5, 0); - Gem0.addBox(0F, 0F, 0F, 1, 1, 1); - Gem0.setRotationPoint(4.5F, -3F, 0F); - Gem0.setTextureSize(32, 32); - Gem0.mirror = true; - setRotation(Gem0, 0F, 0F, 0F); - Gem1 = new ModelRenderer(this, 5, 0); - Gem1.addBox(0F, 0F, 0F, 1, 1, 1); - Gem1.setRotationPoint(-5.5F, -3F, 0F); - Gem1.setTextureSize(32, 32); - Gem1.mirror = true; - setRotation(Gem1, 0F, 0F, 0F); - MetalPart01 = new ModelRenderer(this, 0, 0); - MetalPart01.addBox(0F, 0F, 0F, 1, 3, 1); - MetalPart01.setRotationPoint(-5F, -4F, 0F); - MetalPart01.setTextureSize(32, 32); - MetalPart01.mirror = true; - setRotation(MetalPart01, 0F, 0F, 0F); - MetalPart11 = new ModelRenderer(this, 0, 0); - MetalPart11.addBox(0F, 0F, 0F, 1, 1, 1); - MetalPart11.setRotationPoint(-5F, -3F, -1F); - MetalPart11.setTextureSize(32, 32); - MetalPart11.mirror = true; - setRotation(MetalPart11, 0F, 0F, 0F); - MetalPart21 = new ModelRenderer(this, 0, 0); - MetalPart21.addBox(0F, 0F, 0F, 1, 1, 1); - MetalPart21.setRotationPoint(-5F, -3F, 1F); - MetalPart21.setTextureSize(32, 32); - MetalPart21.mirror = true; - setRotation(MetalPart21, 0F, 0F, 0F); - } - - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5); - GL11.glPushMatrix(); -// GL11.glDisable(GL11.GL_LIGHTING); - if ((int)f3 != -1){ - int ingotColor = (int)f3; - int red = ingotColor >> 16 & 0xff; - int green = ingotColor >> 8 & 0xff; - int blue = ingotColor & 0xff; - GL11.glColor3f((float)red / 255, (float)green / 255, (float)blue / 255); - MetalPart00.render(f5); - MetalPart10.render(f5); - MetalPart20.render(f5); - MetalPart01.render(f5); - MetalPart11.render(f5); - MetalPart21.render(f5); - } - if ((int)f4 != -1){ - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE_MINUS_DST_COLOR); - int gemColor = (int)f4; - int red = gemColor >> 16 & 0xff; - int green = gemColor >> 8 & 0xff; - int blue = gemColor & 0xff; - GL11.glColor3f((float)red / 255, (float)green / 255, (float)blue / 255); - Gem0.render(f5); - Gem1.render(f5); - GL11.glDisable(GL11.GL_BLEND); - } -// GL11.glEnable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) - { - super.setRotationAngles(f, f1, f2, f3, f4, f5, null); - } +public class ModelEarrings extends ModelBase { + // fields + ModelRenderer MetalPart00; + ModelRenderer MetalPart10; + ModelRenderer MetalPart20; + ModelRenderer Gem0; + ModelRenderer Gem1; + ModelRenderer MetalPart01; + ModelRenderer MetalPart11; + ModelRenderer MetalPart21; + + public ModelEarrings() { + textureWidth = 32; + textureHeight = 32; + MetalPart00 = new ModelRenderer(this, 0, 0); + MetalPart00.addBox(0F, 0F, 0F, 1, 3, 1); + MetalPart00.setRotationPoint(4F, -4F, 0F); + MetalPart00.setTextureSize(32, 32); + MetalPart00.mirror = true; + setRotation(MetalPart00, 0F, 0F, 0F); + MetalPart10 = new ModelRenderer(this, 0, 0); + MetalPart10.addBox(0F, 0F, 0F, 1, 1, 1); + MetalPart10.setRotationPoint(4F, -3F, -1F); + MetalPart10.setTextureSize(32, 32); + MetalPart10.mirror = true; + setRotation(MetalPart10, 0F, 0F, 0F); + MetalPart20 = new ModelRenderer(this, 0, 0); + MetalPart20.addBox(0F, 0F, 0F, 1, 1, 1); + MetalPart20.setRotationPoint(4F, -3F, 1F); + MetalPart20.setTextureSize(32, 32); + MetalPart20.mirror = true; + setRotation(MetalPart20, 0F, 0F, 0F); + Gem0 = new ModelRenderer(this, 5, 0); + Gem0.addBox(0F, 0F, 0F, 1, 1, 1); + Gem0.setRotationPoint(4.5F, -3F, 0F); + Gem0.setTextureSize(32, 32); + Gem0.mirror = true; + setRotation(Gem0, 0F, 0F, 0F); + Gem1 = new ModelRenderer(this, 5, 0); + Gem1.addBox(0F, 0F, 0F, 1, 1, 1); + Gem1.setRotationPoint(-5.5F, -3F, 0F); + Gem1.setTextureSize(32, 32); + Gem1.mirror = true; + setRotation(Gem1, 0F, 0F, 0F); + MetalPart01 = new ModelRenderer(this, 0, 0); + MetalPart01.addBox(0F, 0F, 0F, 1, 3, 1); + MetalPart01.setRotationPoint(-5F, -4F, 0F); + MetalPart01.setTextureSize(32, 32); + MetalPart01.mirror = true; + setRotation(MetalPart01, 0F, 0F, 0F); + MetalPart11 = new ModelRenderer(this, 0, 0); + MetalPart11.addBox(0F, 0F, 0F, 1, 1, 1); + MetalPart11.setRotationPoint(-5F, -3F, -1F); + MetalPart11.setTextureSize(32, 32); + MetalPart11.mirror = true; + setRotation(MetalPart11, 0F, 0F, 0F); + MetalPart21 = new ModelRenderer(this, 0, 0); + MetalPart21.addBox(0F, 0F, 0F, 1, 1, 1); + MetalPart21.setRotationPoint(-5F, -3F, 1F); + MetalPart21.setTextureSize(32, 32); + MetalPart21.mirror = true; + setRotation(MetalPart21, 0F, 0F, 0F); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, + float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5); + GL11.glPushMatrix(); + // GL11.glDisable(GL11.GL_LIGHTING); + if ((int) f3 != -1) { + int ingotColor = (int) f3; + int red = ingotColor >> 16 & 0xff; + int green = ingotColor >> 8 & 0xff; + int blue = ingotColor & 0xff; + GL11.glColor3f((float) red / 255, (float) green / 255, + (float) blue / 255); + MetalPart00.render(f5); + MetalPart10.render(f5); + MetalPart20.render(f5); + MetalPart01.render(f5); + MetalPart11.render(f5); + MetalPart21.render(f5); + } + if ((int) f4 != -1) { + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_COLOR, + GL11.GL_ONE_MINUS_DST_COLOR); + int gemColor = (int) f4; + int red = gemColor >> 16 & 0xff; + int green = gemColor >> 8 & 0xff; + int blue = gemColor & 0xff; + GL11.glColor3f((float) red / 255, (float) green / 255, + (float) blue / 255); + Gem0.render(f5); + Gem1.render(f5); + GL11.glDisable(GL11.GL_BLEND); + } + // GL11.glEnable(GL11.GL_LIGHTING); + GL11.glPopMatrix(); + } + + private void setRotation(ModelRenderer model, float x, float y, + float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, + float f4, float f5) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, null); + } } diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelHalfHeart.java b/src/main/java/darkknight/jewelrycraft/model/ModelHalfHeart.java index 1c0bb97..ece8a2f 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelHalfHeart.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelHalfHeart.java @@ -9,489 +9,492 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class ModelHalfHeart extends ModelBase -{ - // fields - ModelRenderer s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17, s18, s19, s20, s21, s22; - ModelRenderer f1, f3, f4, f5, f6, f7, f8, f9, f13, f14, f16, f17, f19, f20, f21, f22, f23, f24, f25, f26; - ModelRenderer b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b19, b20, b21, b23, b24, b25, b26; - - public ModelHalfHeart() - { - textureWidth = 64; - textureHeight = 32; - s1 = new ModelRenderer(this, 0, 16); - s1.addBox(0F, 0F, 0F, 1, 1, 1); - s1.setRotationPoint(1F, 13F, 0F); - s1.setTextureSize(64, 32); - s1.mirror = true; - setRotation(s1, 0F, 0F, 0F); - s2 = new ModelRenderer(this, 0, 16); - s2.addBox(0F, 0F, 0F, 2, 1, 1); - s2.setRotationPoint(-1F, 23F, 0F); - s2.setTextureSize(64, 32); - s2.mirror = true; - setRotation(s2, 0F, 0F, 0F); - s3 = new ModelRenderer(this, 0, 16); - s3.addBox(0F, 0F, 0F, 2, 1, 1); - s3.setRotationPoint(2F, 12F, 0F); - s3.setTextureSize(64, 32); - s3.mirror = true; - setRotation(s3, 0F, 0F, 0F); - s4 = new ModelRenderer(this, 0, 16); - s4.addBox(0F, 0F, 0F, 1, 1, 1); - s4.setRotationPoint(1F, 22F, 0F); - s4.setTextureSize(64, 32); - s4.mirror = true; - setRotation(s4, 0F, 0F, 0F); - s5 = new ModelRenderer(this, 0, 16); - s5.addBox(0F, 0F, 0F, 1, 1, 1); - s5.setRotationPoint(4F, 13F, 0F); - s5.setTextureSize(64, 32); - s5.mirror = true; - setRotation(s5, 0F, 0F, 0F); - s6 = new ModelRenderer(this, 0, 16); - s6.addBox(0F, 0F, 0F, 1, 1, 1); - s6.setRotationPoint(5F, 18F, 0F); - s6.setTextureSize(64, 32); - s6.mirror = true; - setRotation(s6, 0F, 0F, 0F); - s7 = new ModelRenderer(this, 0, 16); - s7.addBox(0F, 0F, 0F, 1, 1, 1); - s7.setRotationPoint(5F, 14F, 0F); - s7.setTextureSize(64, 32); - s7.mirror = true; - setRotation(s7, 0F, 0F, 0F); - s8 = new ModelRenderer(this, 0, 16); - s8.addBox(0F, 0F, 0F, 1, 1, 1); - s8.setRotationPoint(-2F, 22F, 0F); - s8.setTextureSize(64, 32); - s8.mirror = true; - setRotation(s8, 0F, 0F, 0F); - s9 = new ModelRenderer(this, 0, 16); - s9.addBox(0F, 0F, 0F, 1, 1, 1); - s9.setRotationPoint(-2F, 13F, 0F); - s9.setTextureSize(64, 32); - s9.mirror = true; - setRotation(s9, 0F, 0F, 0F); - s10 = new ModelRenderer(this, 0, 16); - s10.addBox(0F, 0F, 0F, 1, 1, 1); - s10.setRotationPoint(-6F, 18F, 0F); - s10.setTextureSize(64, 32); - s10.mirror = true; - setRotation(s10, 0F, 0F, 0F); - s11 = new ModelRenderer(this, 0, 16); - s11.addBox(0F, 0F, 0F, 2, 1, 1); - s11.setRotationPoint(-4F, 12F, 0F); - s11.setTextureSize(64, 32); - s11.mirror = true; - setRotation(s11, 0F, 0F, 0F); - s12 = new ModelRenderer(this, 0, 16); - s12.addBox(0F, 0F, 0F, 1, 1, 1); - s12.setRotationPoint(-3F, 21F, 0F); - s12.setTextureSize(64, 32); - s12.mirror = true; - setRotation(s12, 0F, 0F, 0F); - s13 = new ModelRenderer(this, 0, 16); - s13.addBox(0F, 0F, 0F, 1, 1, 1); - s13.setRotationPoint(-5F, 13F, 0F); - s13.setTextureSize(64, 32); - s13.mirror = true; - setRotation(s13, 0F, 0F, 0F); - s14 = new ModelRenderer(this, 0, 16); - s14.addBox(0F, 0F, 0F, 1, 1, 1); - s14.setRotationPoint(-4F, 20F, 0F); - s14.setTextureSize(64, 32); - s14.mirror = true; - setRotation(s14, 0F, 0F, 0F); - s15 = new ModelRenderer(this, 0, 16); - s15.addBox(0F, 0F, 0F, 1, 1, 1); - s15.setRotationPoint(-6F, 14F, 0F); - s15.setTextureSize(64, 32); - s15.mirror = true; - setRotation(s15, 0F, 0F, 0F); - s16 = new ModelRenderer(this, 0, 16); - s16.addBox(0F, 0F, 0F, 1, 1, 1); - s16.setRotationPoint(-5F, 19F, 0F); - s16.setTextureSize(64, 32); - s16.mirror = true; - setRotation(s16, 0F, 0F, 0F); - s17 = new ModelRenderer(this, 0, 16); - s17.addBox(0F, 0F, 0F, 2, 1, 1); - s17.setRotationPoint(-1F, 14F, 0F); - s17.setTextureSize(64, 32); - s17.mirror = true; - setRotation(s17, 0F, 0F, 0F); - s18 = new ModelRenderer(this, 0, 16); - s18.addBox(0F, 0F, 0F, 1, 1, 1); - s18.setRotationPoint(2F, 21F, 0F); - s18.setTextureSize(64, 32); - s18.mirror = true; - setRotation(s18, 0F, 0F, 0F); - s19 = new ModelRenderer(this, 0, 16); - s19.addBox(0F, 0F, 0F, 1, 3, 1); - s19.setRotationPoint(6F, 15F, 0F); - s19.setTextureSize(64, 32); - s19.mirror = true; - setRotation(s19, 0F, 0F, 0F); - s20 = new ModelRenderer(this, 0, 16); - s20.addBox(0F, 0F, 0F, 1, 1, 1); - s20.setRotationPoint(3F, 20F, 0F); - s20.setTextureSize(64, 32); - s20.mirror = true; - setRotation(s20, 0F, 0F, 0F); - s21 = new ModelRenderer(this, 0, 16); - s21.addBox(0F, 0F, 0F, 1, 3, 1); - s21.setRotationPoint(-7F, 15F, 0F); - s21.setTextureSize(64, 32); - s21.mirror = true; - setRotation(s21, 0F, 0F, 0F); - s22 = new ModelRenderer(this, 0, 16); - s22.addBox(0F, 0F, 0F, 1, 1, 1); - s22.setRotationPoint(4F, 19F, 0F); - s22.setTextureSize(64, 32); - s22.mirror = true; - setRotation(s22, 0F, 0F, 0F); - f1 = new ModelRenderer(this, 0, 0); - f1.addBox(0F, 0F, 0F, 1, 1, 1); - f1.setRotationPoint(-1F, 22F, 1F); - f1.setTextureSize(64, 32); - f1.mirror = true; - setRotation(f1, 0F, 0F, 0F); - f3 = new ModelRenderer(this, 0, 0); - f3.addBox(0F, 0F, 0F, 6, 3, 1); - f3.setRotationPoint(-6F, 15F, 1F); - f3.setTextureSize(64, 32); - f3.mirror = true; - setRotation(f3, 0F, 0F, 0F); - f4 = new ModelRenderer(this, 0, 0); - f4.addBox(0F, 0F, 0F, 7, 1, 1); - f4.setRotationPoint(-5F, 18F, 1F); - f4.setTextureSize(64, 32); - f4.mirror = true; - setRotation(f4, 0F, 0F, 0F); - f5 = new ModelRenderer(this, 0, 0); - f5.addBox(0F, 0F, 0F, 5, 1, 1); - f5.setRotationPoint(-4F, 19F, 1F); - f5.setTextureSize(64, 32); - f5.mirror = true; - setRotation(f5, 0F, 0F, 0F); - f6 = new ModelRenderer(this, 0, 0); - f6.addBox(0F, 0F, 0F, 3, 1, 1); - f6.setRotationPoint(-3F, 20F, 1F); - f6.setTextureSize(64, 32); - f6.mirror = true; - setRotation(f6, 0F, 0F, 0F); - f7 = new ModelRenderer(this, 0, 0); - f7.addBox(0F, 0F, 0F, 3, 1, 1); - f7.setRotationPoint(-2F, 21F, 1F); - f7.setTextureSize(64, 32); - f7.mirror = true; - setRotation(f7, 0F, 0F, 0F); - f8 = new ModelRenderer(this, 0, 0); - f8.addBox(0F, 0F, 0F, 4, 1, 1); - f8.setRotationPoint(-5F, 14F, 1F); - f8.setTextureSize(64, 32); - f8.mirror = true; - setRotation(f8, 0F, 0F, 0F); - f9 = new ModelRenderer(this, 0, 0); - f9.addBox(0F, 0F, 0F, 2, 1, 1); - f9.setRotationPoint(-4F, 13F, 1F); - f9.setTextureSize(64, 32); - f9.mirror = true; - setRotation(f9, 0F, 0F, 0F); - f13 = new ModelRenderer(this, 0, 0); - f13.addBox(0F, 0F, 0F, 5, 1, 1); - f13.setRotationPoint(-5F, 16F, 2F); - f13.setTextureSize(64, 32); - f13.mirror = true; - setRotation(f13, 0F, 0F, 0F); - f14 = new ModelRenderer(this, 0, 0); - f14.addBox(0F, 0F, 0F, 6, 1, 1); - f14.setRotationPoint(-5F, 17F, 2F); - f14.setTextureSize(64, 32); - f14.mirror = true; - setRotation(f14, 0F, 0F, 0F); - f16 = new ModelRenderer(this, 0, 0); - f16.addBox(0F, 0F, 0F, 3, 1, 1); - f16.setRotationPoint(-4F, 15F, 2F); - f16.setTextureSize(64, 32); - f16.mirror = true; - setRotation(f16, 0F, 0F, 0F); - f17 = new ModelRenderer(this, 0, 0); - f17.addBox(0F, 0F, 0F, 1, 1, 1); - f17.setRotationPoint(-3F, 14F, 2F); - f17.setTextureSize(64, 32); - f17.mirror = true; - setRotation(f17, 0F, 0F, 0F); - f19 = new ModelRenderer(this, 0, 0); - f19.addBox(0F, 0F, 0F, 1, 1, 1); - f19.setRotationPoint(-3F, 15F, 3F); - f19.setTextureSize(64, 32); - f19.mirror = true; - setRotation(f19, 0F, 0F, 0F); - f20 = new ModelRenderer(this, 0, 0); - f20.addBox(0F, 0F, 0F, 3, 1, 1); - f20.setRotationPoint(-4F, 16F, 3F); - f20.setTextureSize(64, 32); - f20.mirror = true; - setRotation(f20, 0F, 0F, 0F); - f21 = new ModelRenderer(this, 0, 0); - f21.addBox(0F, 0F, 0F, 2, 1, 1); - f21.setRotationPoint(-2F, 20F, 2F); - f21.setTextureSize(64, 32); - f21.mirror = true; - setRotation(f21, 0F, 0F, 0F); - f22 = new ModelRenderer(this, 0, 0); - f22.addBox(0F, 0F, 0F, 4, 1, 1); - f22.setRotationPoint(-3F, 19F, 2F); - f22.setTextureSize(64, 32); - f22.mirror = true; - setRotation(f22, 0F, 0F, 0F); - f23 = new ModelRenderer(this, 0, 0); - f23.addBox(0F, 0F, 0F, 6, 1, 1); - f23.setRotationPoint(-4F, 18F, 2F); - f23.setTextureSize(64, 32); - f23.mirror = true; - setRotation(f23, 0F, 0F, 0F); - f24 = new ModelRenderer(this, 0, 0); - f24.addBox(0F, 0F, 0F, 3, 1, 1); - f24.setRotationPoint(-3F, 17F, 3F); - f24.setTextureSize(64, 32); - f24.mirror = true; - setRotation(f24, 0F, 0F, 0F); - f25 = new ModelRenderer(this, 0, 0); - f25.addBox(0F, 0F, 0F, 2, 1, 1); - f25.setRotationPoint(-2F, 18F, 3F); - f25.setTextureSize(64, 32); - f25.mirror = true; - setRotation(f25, 0F, 0F, 0F); - f26 = new ModelRenderer(this, 0, 0); - f26.addBox(0F, 0F, 0F, 1, 1, 1); - f26.setRotationPoint(-1F, 19F, 3F); - f26.setTextureSize(64, 32); - f26.mirror = true; - setRotation(f26, 0F, 0F, 0F); - b1 = new ModelRenderer(this, 0, 0); - b1.addBox(0F, 0F, 0F, 2, 1, 1); - b1.setRotationPoint(-2F, 20F, -2F); - b1.setTextureSize(64, 32); - b1.mirror = true; - setRotation(b1, 0F, 0F, 0F); - b2 = new ModelRenderer(this, 0, 0); - b2.addBox(0F, 0F, 0F, 1, 1, 1); - b2.setRotationPoint(-3F, 14F, -2F); - b2.setTextureSize(64, 32); - b2.mirror = true; - setRotation(b2, 0F, 0F, 0F); - b3 = new ModelRenderer(this, 0, 0); - b3.addBox(0F, 0F, 0F, 7, 1, 1); - b3.setRotationPoint(-6F, 15F, -1F); - b3.setTextureSize(64, 32); - b3.mirror = true; - setRotation(b3, 0F, 0F, 0F); - b4 = new ModelRenderer(this, 0, 0); - b4.addBox(0F, 0F, 0F, 6, 1, 1); - b4.setRotationPoint(-4F, 18F, -2F); - b4.setTextureSize(64, 32); - b4.mirror = true; - setRotation(b4, 0F, 0F, 0F); - b5 = new ModelRenderer(this, 0, 0); - b5.addBox(0F, 0F, 0F, 4, 1, 1); - b5.setRotationPoint(-3F, 19F, -2F); - b5.setTextureSize(64, 32); - b5.mirror = true; - setRotation(b5, 0F, 0F, 0F); - b6 = new ModelRenderer(this, 0, 0); - b6.addBox(0F, 0F, 0F, 3, 1, 1); - b6.setRotationPoint(-4F, 15F, -2F); - b6.setTextureSize(64, 32); - b6.mirror = true; - setRotation(b6, 0F, 0F, 0F); - b7 = new ModelRenderer(this, 0, 0); - b7.addBox(0F, 0F, 0F, 6, 2, 1); - b7.setRotationPoint(-6F, 16F, -1F); - b7.setTextureSize(64, 32); - b7.mirror = true; - setRotation(b7, 0F, 0F, 0F); - b8 = new ModelRenderer(this, 0, 0); - b8.addBox(0F, 0F, 0F, 1, 1, 1); - b8.setRotationPoint(-1F, 22F, -1F); - b8.setTextureSize(64, 32); - b8.mirror = true; - setRotation(b8, 0F, 0F, 0F); - b9 = new ModelRenderer(this, 0, 0); - b9.addBox(0F, 0F, 0F, 1, 1, 1); - b9.setRotationPoint(-3F, 15F, -3F); - b9.setTextureSize(64, 32); - b9.mirror = true; - setRotation(b9, 0F, 0F, 0F); - b10 = new ModelRenderer(this, 0, 0); - b10.addBox(0F, 0F, 0F, 2, 1, 1); - b10.setRotationPoint(-2F, 18F, -3F); - b10.setTextureSize(64, 32); - b10.mirror = true; - setRotation(b10, 0F, 0F, 0F); - b11 = new ModelRenderer(this, 0, 0); - b11.addBox(0F, 0F, 0F, 5, 2, 1); - b11.setRotationPoint(-5F, 16F, -2F); - b11.setTextureSize(64, 32); - b11.mirror = true; - setRotation(b11, 0F, 0F, 0F); - b12 = new ModelRenderer(this, 0, 0); - b12.addBox(0F, 0F, 0F, 3, 1, 1); - b12.setRotationPoint(-4F, 16F, -3F); - b12.setTextureSize(64, 32); - b12.mirror = true; - setRotation(b12, 0F, 0F, 0F); - b13 = new ModelRenderer(this, 0, 0); - b13.addBox(0F, 0F, 0F, 1, 1, 1); - b13.setRotationPoint(0F, 19F, 0F); - b13.setTextureSize(64, 32); - b13.mirror = true; - setRotation(b13, 0F, 0F, 0F); - b15 = new ModelRenderer(this, 0, 0); - b15.addBox(0F, 0F, 0F, 2, 1, 1); - b15.setRotationPoint(-3F, 17F, -3F); - b15.setTextureSize(64, 32); - b15.mirror = true; - setRotation(b15, 0F, 0F, 0F); - b16 = new ModelRenderer(this, 0, 0); - b16.addBox(0F, 0F, 0F, 2, 1, 1); - b16.setRotationPoint(-1F, 19F, -3F); - b16.setTextureSize(64, 32); - b16.mirror = true; - setRotation(b16, 0F, 0F, 0F); - b19 = new ModelRenderer(this, 0, 0); - b19.addBox(0F, 0F, 0F, 2, 1, 1); - b19.setRotationPoint(-4F, 13F, -1F); - b19.setTextureSize(64, 32); - b19.mirror = true; - setRotation(b19, 0F, 0F, 0F); - b20 = new ModelRenderer(this, 0, 0); - b20.addBox(0F, 0F, 0F, 1, 8, 1); - b20.setRotationPoint(-1F, 15F, 0F); - b20.setTextureSize(64, 32); - b20.mirror = true; - setRotation(b20, 0F, 0F, 0F); - b21 = new ModelRenderer(this, 0, 0); - b21.addBox(0F, 0F, 0F, 4, 1, 1); - b21.setRotationPoint(-5F, 14F, -1F); - b21.setTextureSize(64, 32); - b21.mirror = true; - setRotation(b21, 0F, 0F, 0F); - b23 = new ModelRenderer(this, 0, 0); - b23.addBox(0F, 0F, 0F, 6, 1, 1); - b23.setRotationPoint(-5F, 18F, -1F); - b23.setTextureSize(64, 32); - b23.mirror = true; - setRotation(b23, 0F, 0F, 0F); - b24 = new ModelRenderer(this, 0, 0); - b24.addBox(0F, 0F, 0F, 4, 1, 1); - b24.setRotationPoint(-4F, 19F, -1F); - b24.setTextureSize(64, 32); - b24.mirror = true; - setRotation(b24, 0F, 0F, 0F); - b25 = new ModelRenderer(this, 0, 0); - b25.addBox(0F, 0F, 0F, 3, 1, 1); - b25.setRotationPoint(-3F, 20F, -1F); - b25.setTextureSize(64, 32); - b25.mirror = true; - setRotation(b25, 0F, 0F, 0F); - b26 = new ModelRenderer(this, 0, 0); - b26.addBox(0F, 0F, 0F, 3, 1, 1); - b26.setRotationPoint(-2F, 21F, -1F); - b26.setTextureSize(64, 32); - b26.mirror = true; - setRotation(b26, 0F, 0F, 0F); - b14 = new ModelRenderer(this, 0, 0); - b14.addBox(0F, 0F, 0F, 1, 1, 1); - b14.setRotationPoint(0F, 16F, 0F); - b14.setTextureSize(64, 32); - b14.mirror = true; - setRotation(b14, 0F, 0F, 0F); - } - - public void render(Entity entity, float angle1, float angle2, float angle3, float angle4, float angle5, float angle6) - { - super.render(entity, angle1, angle2, angle3, angle4, angle5, angle6); - setRotationAngles(angle1, angle2, angle3, angle4, angle5, angle6); - s1.render(angle6); - s2.render(angle6); - s3.render(angle6); - s4.render(angle6); - s5.render(angle6); - s6.render(angle6); - s7.render(angle6); - s8.render(angle6); - s9.render(angle6); - s10.render(angle6); - s11.render(angle6); - s12.render(angle6); - s13.render(angle6); - s14.render(angle6); - s15.render(angle6); - s16.render(angle6); - s17.render(angle6); - s18.render(angle6); - s19.render(angle6); - s20.render(angle6); - s21.render(angle6); - s22.render(angle6); - f1.render(angle6); - f3.render(angle6); - f4.render(angle6); - f5.render(angle6); - f6.render(angle6); - f7.render(angle6); - f8.render(angle6); - f9.render(angle6); - f13.render(angle6); - f14.render(angle6); - f16.render(angle6); - f17.render(angle6); - f19.render(angle6); - f20.render(angle6); - f21.render(angle6); - f22.render(angle6); - f23.render(angle6); - f24.render(angle6); - f25.render(angle6); - f26.render(angle6); - b1.render(angle6); - b2.render(angle6); - b3.render(angle6); - b4.render(angle6); - b5.render(angle6); - b6.render(angle6); - b7.render(angle6); - b8.render(angle6); - b9.render(angle6); - b10.render(angle6); - b11.render(angle6); - b12.render(angle6); - b13.render(angle6); - b15.render(angle6); - b16.render(angle6); - b19.render(angle6); - b20.render(angle6); - b21.render(angle6); - b23.render(angle6); - b24.render(angle6); - b25.render(angle6); - b26.render(angle6); - b14.render(angle6); - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) - { - super.setRotationAngles(f, f1, f2, f3, f4, f5, null); - } +public class ModelHalfHeart extends ModelBase { + // fields + ModelRenderer s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, + s14, s15, s16, s17, s18, s19, s20, s21, s22; + ModelRenderer f1, f3, f4, f5, f6, f7, f8, f9, f13, f14, f16, f17, + f19, f20, f21, f22, f23, f24, f25, f26; + ModelRenderer b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, + b14, b15, b16, b19, b20, b21, b23, b24, b25, b26; + + public ModelHalfHeart() { + textureWidth = 64; + textureHeight = 32; + s1 = new ModelRenderer(this, 0, 16); + s1.addBox(0F, 0F, 0F, 1, 1, 1); + s1.setRotationPoint(1F, 13F, 0F); + s1.setTextureSize(64, 32); + s1.mirror = true; + setRotation(s1, 0F, 0F, 0F); + s2 = new ModelRenderer(this, 0, 16); + s2.addBox(0F, 0F, 0F, 2, 1, 1); + s2.setRotationPoint(-1F, 23F, 0F); + s2.setTextureSize(64, 32); + s2.mirror = true; + setRotation(s2, 0F, 0F, 0F); + s3 = new ModelRenderer(this, 0, 16); + s3.addBox(0F, 0F, 0F, 2, 1, 1); + s3.setRotationPoint(2F, 12F, 0F); + s3.setTextureSize(64, 32); + s3.mirror = true; + setRotation(s3, 0F, 0F, 0F); + s4 = new ModelRenderer(this, 0, 16); + s4.addBox(0F, 0F, 0F, 1, 1, 1); + s4.setRotationPoint(1F, 22F, 0F); + s4.setTextureSize(64, 32); + s4.mirror = true; + setRotation(s4, 0F, 0F, 0F); + s5 = new ModelRenderer(this, 0, 16); + s5.addBox(0F, 0F, 0F, 1, 1, 1); + s5.setRotationPoint(4F, 13F, 0F); + s5.setTextureSize(64, 32); + s5.mirror = true; + setRotation(s5, 0F, 0F, 0F); + s6 = new ModelRenderer(this, 0, 16); + s6.addBox(0F, 0F, 0F, 1, 1, 1); + s6.setRotationPoint(5F, 18F, 0F); + s6.setTextureSize(64, 32); + s6.mirror = true; + setRotation(s6, 0F, 0F, 0F); + s7 = new ModelRenderer(this, 0, 16); + s7.addBox(0F, 0F, 0F, 1, 1, 1); + s7.setRotationPoint(5F, 14F, 0F); + s7.setTextureSize(64, 32); + s7.mirror = true; + setRotation(s7, 0F, 0F, 0F); + s8 = new ModelRenderer(this, 0, 16); + s8.addBox(0F, 0F, 0F, 1, 1, 1); + s8.setRotationPoint(-2F, 22F, 0F); + s8.setTextureSize(64, 32); + s8.mirror = true; + setRotation(s8, 0F, 0F, 0F); + s9 = new ModelRenderer(this, 0, 16); + s9.addBox(0F, 0F, 0F, 1, 1, 1); + s9.setRotationPoint(-2F, 13F, 0F); + s9.setTextureSize(64, 32); + s9.mirror = true; + setRotation(s9, 0F, 0F, 0F); + s10 = new ModelRenderer(this, 0, 16); + s10.addBox(0F, 0F, 0F, 1, 1, 1); + s10.setRotationPoint(-6F, 18F, 0F); + s10.setTextureSize(64, 32); + s10.mirror = true; + setRotation(s10, 0F, 0F, 0F); + s11 = new ModelRenderer(this, 0, 16); + s11.addBox(0F, 0F, 0F, 2, 1, 1); + s11.setRotationPoint(-4F, 12F, 0F); + s11.setTextureSize(64, 32); + s11.mirror = true; + setRotation(s11, 0F, 0F, 0F); + s12 = new ModelRenderer(this, 0, 16); + s12.addBox(0F, 0F, 0F, 1, 1, 1); + s12.setRotationPoint(-3F, 21F, 0F); + s12.setTextureSize(64, 32); + s12.mirror = true; + setRotation(s12, 0F, 0F, 0F); + s13 = new ModelRenderer(this, 0, 16); + s13.addBox(0F, 0F, 0F, 1, 1, 1); + s13.setRotationPoint(-5F, 13F, 0F); + s13.setTextureSize(64, 32); + s13.mirror = true; + setRotation(s13, 0F, 0F, 0F); + s14 = new ModelRenderer(this, 0, 16); + s14.addBox(0F, 0F, 0F, 1, 1, 1); + s14.setRotationPoint(-4F, 20F, 0F); + s14.setTextureSize(64, 32); + s14.mirror = true; + setRotation(s14, 0F, 0F, 0F); + s15 = new ModelRenderer(this, 0, 16); + s15.addBox(0F, 0F, 0F, 1, 1, 1); + s15.setRotationPoint(-6F, 14F, 0F); + s15.setTextureSize(64, 32); + s15.mirror = true; + setRotation(s15, 0F, 0F, 0F); + s16 = new ModelRenderer(this, 0, 16); + s16.addBox(0F, 0F, 0F, 1, 1, 1); + s16.setRotationPoint(-5F, 19F, 0F); + s16.setTextureSize(64, 32); + s16.mirror = true; + setRotation(s16, 0F, 0F, 0F); + s17 = new ModelRenderer(this, 0, 16); + s17.addBox(0F, 0F, 0F, 2, 1, 1); + s17.setRotationPoint(-1F, 14F, 0F); + s17.setTextureSize(64, 32); + s17.mirror = true; + setRotation(s17, 0F, 0F, 0F); + s18 = new ModelRenderer(this, 0, 16); + s18.addBox(0F, 0F, 0F, 1, 1, 1); + s18.setRotationPoint(2F, 21F, 0F); + s18.setTextureSize(64, 32); + s18.mirror = true; + setRotation(s18, 0F, 0F, 0F); + s19 = new ModelRenderer(this, 0, 16); + s19.addBox(0F, 0F, 0F, 1, 3, 1); + s19.setRotationPoint(6F, 15F, 0F); + s19.setTextureSize(64, 32); + s19.mirror = true; + setRotation(s19, 0F, 0F, 0F); + s20 = new ModelRenderer(this, 0, 16); + s20.addBox(0F, 0F, 0F, 1, 1, 1); + s20.setRotationPoint(3F, 20F, 0F); + s20.setTextureSize(64, 32); + s20.mirror = true; + setRotation(s20, 0F, 0F, 0F); + s21 = new ModelRenderer(this, 0, 16); + s21.addBox(0F, 0F, 0F, 1, 3, 1); + s21.setRotationPoint(-7F, 15F, 0F); + s21.setTextureSize(64, 32); + s21.mirror = true; + setRotation(s21, 0F, 0F, 0F); + s22 = new ModelRenderer(this, 0, 16); + s22.addBox(0F, 0F, 0F, 1, 1, 1); + s22.setRotationPoint(4F, 19F, 0F); + s22.setTextureSize(64, 32); + s22.mirror = true; + setRotation(s22, 0F, 0F, 0F); + f1 = new ModelRenderer(this, 0, 0); + f1.addBox(0F, 0F, 0F, 1, 1, 1); + f1.setRotationPoint(-1F, 22F, 1F); + f1.setTextureSize(64, 32); + f1.mirror = true; + setRotation(f1, 0F, 0F, 0F); + f3 = new ModelRenderer(this, 0, 0); + f3.addBox(0F, 0F, 0F, 6, 3, 1); + f3.setRotationPoint(-6F, 15F, 1F); + f3.setTextureSize(64, 32); + f3.mirror = true; + setRotation(f3, 0F, 0F, 0F); + f4 = new ModelRenderer(this, 0, 0); + f4.addBox(0F, 0F, 0F, 7, 1, 1); + f4.setRotationPoint(-5F, 18F, 1F); + f4.setTextureSize(64, 32); + f4.mirror = true; + setRotation(f4, 0F, 0F, 0F); + f5 = new ModelRenderer(this, 0, 0); + f5.addBox(0F, 0F, 0F, 5, 1, 1); + f5.setRotationPoint(-4F, 19F, 1F); + f5.setTextureSize(64, 32); + f5.mirror = true; + setRotation(f5, 0F, 0F, 0F); + f6 = new ModelRenderer(this, 0, 0); + f6.addBox(0F, 0F, 0F, 3, 1, 1); + f6.setRotationPoint(-3F, 20F, 1F); + f6.setTextureSize(64, 32); + f6.mirror = true; + setRotation(f6, 0F, 0F, 0F); + f7 = new ModelRenderer(this, 0, 0); + f7.addBox(0F, 0F, 0F, 3, 1, 1); + f7.setRotationPoint(-2F, 21F, 1F); + f7.setTextureSize(64, 32); + f7.mirror = true; + setRotation(f7, 0F, 0F, 0F); + f8 = new ModelRenderer(this, 0, 0); + f8.addBox(0F, 0F, 0F, 4, 1, 1); + f8.setRotationPoint(-5F, 14F, 1F); + f8.setTextureSize(64, 32); + f8.mirror = true; + setRotation(f8, 0F, 0F, 0F); + f9 = new ModelRenderer(this, 0, 0); + f9.addBox(0F, 0F, 0F, 2, 1, 1); + f9.setRotationPoint(-4F, 13F, 1F); + f9.setTextureSize(64, 32); + f9.mirror = true; + setRotation(f9, 0F, 0F, 0F); + f13 = new ModelRenderer(this, 0, 0); + f13.addBox(0F, 0F, 0F, 5, 1, 1); + f13.setRotationPoint(-5F, 16F, 2F); + f13.setTextureSize(64, 32); + f13.mirror = true; + setRotation(f13, 0F, 0F, 0F); + f14 = new ModelRenderer(this, 0, 0); + f14.addBox(0F, 0F, 0F, 6, 1, 1); + f14.setRotationPoint(-5F, 17F, 2F); + f14.setTextureSize(64, 32); + f14.mirror = true; + setRotation(f14, 0F, 0F, 0F); + f16 = new ModelRenderer(this, 0, 0); + f16.addBox(0F, 0F, 0F, 3, 1, 1); + f16.setRotationPoint(-4F, 15F, 2F); + f16.setTextureSize(64, 32); + f16.mirror = true; + setRotation(f16, 0F, 0F, 0F); + f17 = new ModelRenderer(this, 0, 0); + f17.addBox(0F, 0F, 0F, 1, 1, 1); + f17.setRotationPoint(-3F, 14F, 2F); + f17.setTextureSize(64, 32); + f17.mirror = true; + setRotation(f17, 0F, 0F, 0F); + f19 = new ModelRenderer(this, 0, 0); + f19.addBox(0F, 0F, 0F, 1, 1, 1); + f19.setRotationPoint(-3F, 15F, 3F); + f19.setTextureSize(64, 32); + f19.mirror = true; + setRotation(f19, 0F, 0F, 0F); + f20 = new ModelRenderer(this, 0, 0); + f20.addBox(0F, 0F, 0F, 3, 1, 1); + f20.setRotationPoint(-4F, 16F, 3F); + f20.setTextureSize(64, 32); + f20.mirror = true; + setRotation(f20, 0F, 0F, 0F); + f21 = new ModelRenderer(this, 0, 0); + f21.addBox(0F, 0F, 0F, 2, 1, 1); + f21.setRotationPoint(-2F, 20F, 2F); + f21.setTextureSize(64, 32); + f21.mirror = true; + setRotation(f21, 0F, 0F, 0F); + f22 = new ModelRenderer(this, 0, 0); + f22.addBox(0F, 0F, 0F, 4, 1, 1); + f22.setRotationPoint(-3F, 19F, 2F); + f22.setTextureSize(64, 32); + f22.mirror = true; + setRotation(f22, 0F, 0F, 0F); + f23 = new ModelRenderer(this, 0, 0); + f23.addBox(0F, 0F, 0F, 6, 1, 1); + f23.setRotationPoint(-4F, 18F, 2F); + f23.setTextureSize(64, 32); + f23.mirror = true; + setRotation(f23, 0F, 0F, 0F); + f24 = new ModelRenderer(this, 0, 0); + f24.addBox(0F, 0F, 0F, 3, 1, 1); + f24.setRotationPoint(-3F, 17F, 3F); + f24.setTextureSize(64, 32); + f24.mirror = true; + setRotation(f24, 0F, 0F, 0F); + f25 = new ModelRenderer(this, 0, 0); + f25.addBox(0F, 0F, 0F, 2, 1, 1); + f25.setRotationPoint(-2F, 18F, 3F); + f25.setTextureSize(64, 32); + f25.mirror = true; + setRotation(f25, 0F, 0F, 0F); + f26 = new ModelRenderer(this, 0, 0); + f26.addBox(0F, 0F, 0F, 1, 1, 1); + f26.setRotationPoint(-1F, 19F, 3F); + f26.setTextureSize(64, 32); + f26.mirror = true; + setRotation(f26, 0F, 0F, 0F); + b1 = new ModelRenderer(this, 0, 0); + b1.addBox(0F, 0F, 0F, 2, 1, 1); + b1.setRotationPoint(-2F, 20F, -2F); + b1.setTextureSize(64, 32); + b1.mirror = true; + setRotation(b1, 0F, 0F, 0F); + b2 = new ModelRenderer(this, 0, 0); + b2.addBox(0F, 0F, 0F, 1, 1, 1); + b2.setRotationPoint(-3F, 14F, -2F); + b2.setTextureSize(64, 32); + b2.mirror = true; + setRotation(b2, 0F, 0F, 0F); + b3 = new ModelRenderer(this, 0, 0); + b3.addBox(0F, 0F, 0F, 7, 1, 1); + b3.setRotationPoint(-6F, 15F, -1F); + b3.setTextureSize(64, 32); + b3.mirror = true; + setRotation(b3, 0F, 0F, 0F); + b4 = new ModelRenderer(this, 0, 0); + b4.addBox(0F, 0F, 0F, 6, 1, 1); + b4.setRotationPoint(-4F, 18F, -2F); + b4.setTextureSize(64, 32); + b4.mirror = true; + setRotation(b4, 0F, 0F, 0F); + b5 = new ModelRenderer(this, 0, 0); + b5.addBox(0F, 0F, 0F, 4, 1, 1); + b5.setRotationPoint(-3F, 19F, -2F); + b5.setTextureSize(64, 32); + b5.mirror = true; + setRotation(b5, 0F, 0F, 0F); + b6 = new ModelRenderer(this, 0, 0); + b6.addBox(0F, 0F, 0F, 3, 1, 1); + b6.setRotationPoint(-4F, 15F, -2F); + b6.setTextureSize(64, 32); + b6.mirror = true; + setRotation(b6, 0F, 0F, 0F); + b7 = new ModelRenderer(this, 0, 0); + b7.addBox(0F, 0F, 0F, 6, 2, 1); + b7.setRotationPoint(-6F, 16F, -1F); + b7.setTextureSize(64, 32); + b7.mirror = true; + setRotation(b7, 0F, 0F, 0F); + b8 = new ModelRenderer(this, 0, 0); + b8.addBox(0F, 0F, 0F, 1, 1, 1); + b8.setRotationPoint(-1F, 22F, -1F); + b8.setTextureSize(64, 32); + b8.mirror = true; + setRotation(b8, 0F, 0F, 0F); + b9 = new ModelRenderer(this, 0, 0); + b9.addBox(0F, 0F, 0F, 1, 1, 1); + b9.setRotationPoint(-3F, 15F, -3F); + b9.setTextureSize(64, 32); + b9.mirror = true; + setRotation(b9, 0F, 0F, 0F); + b10 = new ModelRenderer(this, 0, 0); + b10.addBox(0F, 0F, 0F, 2, 1, 1); + b10.setRotationPoint(-2F, 18F, -3F); + b10.setTextureSize(64, 32); + b10.mirror = true; + setRotation(b10, 0F, 0F, 0F); + b11 = new ModelRenderer(this, 0, 0); + b11.addBox(0F, 0F, 0F, 5, 2, 1); + b11.setRotationPoint(-5F, 16F, -2F); + b11.setTextureSize(64, 32); + b11.mirror = true; + setRotation(b11, 0F, 0F, 0F); + b12 = new ModelRenderer(this, 0, 0); + b12.addBox(0F, 0F, 0F, 3, 1, 1); + b12.setRotationPoint(-4F, 16F, -3F); + b12.setTextureSize(64, 32); + b12.mirror = true; + setRotation(b12, 0F, 0F, 0F); + b13 = new ModelRenderer(this, 0, 0); + b13.addBox(0F, 0F, 0F, 1, 1, 1); + b13.setRotationPoint(0F, 19F, 0F); + b13.setTextureSize(64, 32); + b13.mirror = true; + setRotation(b13, 0F, 0F, 0F); + b15 = new ModelRenderer(this, 0, 0); + b15.addBox(0F, 0F, 0F, 2, 1, 1); + b15.setRotationPoint(-3F, 17F, -3F); + b15.setTextureSize(64, 32); + b15.mirror = true; + setRotation(b15, 0F, 0F, 0F); + b16 = new ModelRenderer(this, 0, 0); + b16.addBox(0F, 0F, 0F, 2, 1, 1); + b16.setRotationPoint(-1F, 19F, -3F); + b16.setTextureSize(64, 32); + b16.mirror = true; + setRotation(b16, 0F, 0F, 0F); + b19 = new ModelRenderer(this, 0, 0); + b19.addBox(0F, 0F, 0F, 2, 1, 1); + b19.setRotationPoint(-4F, 13F, -1F); + b19.setTextureSize(64, 32); + b19.mirror = true; + setRotation(b19, 0F, 0F, 0F); + b20 = new ModelRenderer(this, 0, 0); + b20.addBox(0F, 0F, 0F, 1, 8, 1); + b20.setRotationPoint(-1F, 15F, 0F); + b20.setTextureSize(64, 32); + b20.mirror = true; + setRotation(b20, 0F, 0F, 0F); + b21 = new ModelRenderer(this, 0, 0); + b21.addBox(0F, 0F, 0F, 4, 1, 1); + b21.setRotationPoint(-5F, 14F, -1F); + b21.setTextureSize(64, 32); + b21.mirror = true; + setRotation(b21, 0F, 0F, 0F); + b23 = new ModelRenderer(this, 0, 0); + b23.addBox(0F, 0F, 0F, 6, 1, 1); + b23.setRotationPoint(-5F, 18F, -1F); + b23.setTextureSize(64, 32); + b23.mirror = true; + setRotation(b23, 0F, 0F, 0F); + b24 = new ModelRenderer(this, 0, 0); + b24.addBox(0F, 0F, 0F, 4, 1, 1); + b24.setRotationPoint(-4F, 19F, -1F); + b24.setTextureSize(64, 32); + b24.mirror = true; + setRotation(b24, 0F, 0F, 0F); + b25 = new ModelRenderer(this, 0, 0); + b25.addBox(0F, 0F, 0F, 3, 1, 1); + b25.setRotationPoint(-3F, 20F, -1F); + b25.setTextureSize(64, 32); + b25.mirror = true; + setRotation(b25, 0F, 0F, 0F); + b26 = new ModelRenderer(this, 0, 0); + b26.addBox(0F, 0F, 0F, 3, 1, 1); + b26.setRotationPoint(-2F, 21F, -1F); + b26.setTextureSize(64, 32); + b26.mirror = true; + setRotation(b26, 0F, 0F, 0F); + b14 = new ModelRenderer(this, 0, 0); + b14.addBox(0F, 0F, 0F, 1, 1, 1); + b14.setRotationPoint(0F, 16F, 0F); + b14.setTextureSize(64, 32); + b14.mirror = true; + setRotation(b14, 0F, 0F, 0F); + } + + @Override + public void render(Entity entity, float angle1, float angle2, + float angle3, float angle4, float angle5, float angle6) { + super.render(entity, angle1, angle2, angle3, angle4, angle5, + angle6); + setRotationAngles(angle1, angle2, angle3, angle4, angle5, angle6); + s1.render(angle6); + s2.render(angle6); + s3.render(angle6); + s4.render(angle6); + s5.render(angle6); + s6.render(angle6); + s7.render(angle6); + s8.render(angle6); + s9.render(angle6); + s10.render(angle6); + s11.render(angle6); + s12.render(angle6); + s13.render(angle6); + s14.render(angle6); + s15.render(angle6); + s16.render(angle6); + s17.render(angle6); + s18.render(angle6); + s19.render(angle6); + s20.render(angle6); + s21.render(angle6); + s22.render(angle6); + f1.render(angle6); + f3.render(angle6); + f4.render(angle6); + f5.render(angle6); + f6.render(angle6); + f7.render(angle6); + f8.render(angle6); + f9.render(angle6); + f13.render(angle6); + f14.render(angle6); + f16.render(angle6); + f17.render(angle6); + f19.render(angle6); + f20.render(angle6); + f21.render(angle6); + f22.render(angle6); + f23.render(angle6); + f24.render(angle6); + f25.render(angle6); + f26.render(angle6); + b1.render(angle6); + b2.render(angle6); + b3.render(angle6); + b4.render(angle6); + b5.render(angle6); + b6.render(angle6); + b7.render(angle6); + b8.render(angle6); + b9.render(angle6); + b10.render(angle6); + b11.render(angle6); + b12.render(angle6); + b13.render(angle6); + b15.render(angle6); + b16.render(angle6); + b19.render(angle6); + b20.render(angle6); + b21.render(angle6); + b23.render(angle6); + b24.render(angle6); + b25.render(angle6); + b26.render(angle6); + b14.render(angle6); + } + + private void setRotation(ModelRenderer model, float x, float y, + float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, + float f4, float f5) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, null); + } } diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelHandPedestal.java b/src/main/java/darkknight/jewelrycraft/model/ModelHandPedestal.java index 0fc16b0..5163ad1 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelHandPedestal.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelHandPedestal.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.model; import com.pau101.util.CubicBezier; + import darkknight.jewelrycraft.tileentity.TileEntityHandPedestal; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; @@ -13,134 +14,138 @@ import net.minecraft.util.ResourceLocation; /** * @author Paul Fulham (pau101) */ -public class ModelHandPedestal extends ModelBase -{ - protected ModelRenderer plinth; - protected ModelRenderer base; - protected ModelRenderer shaft; - private ModelRenderer palm; - private ModelRenderer[] fingers; - private ModelRenderer thumb; - private ItemStackModelRenderer heldItemStack; - private CubicBezier easeInOut; - - /** - * @param resetResourceLocation - */ - public ModelHandPedestal(ResourceLocation resetResourceLocation) - { - initPedestalRenderers(); - plinth.setRotationPoint(0, 16, 0); - plinth.addChild(base); - base.addChild(shaft); - initHandModelRenderers(resetResourceLocation); - initCubicBeziers(); - } - - /** - * - */ - protected void initPedestalRenderers() - { - plinth = createModelRenderer(0, 0).addBox(-6, 4, -6, 12, 4, 12); - base = createModelRenderer(0, 0).addBox(-4, 0, -4, 8, 4, 8); - shaft = createModelRenderer(0, 0).addBox(-3, -4, -3, 6, 4, 6); - } - - /** - * - */ - private void initCubicBeziers() - { - easeInOut = new CubicBezier(0.4F, 0, 0.6F, 1); - } - - /** - * @param textureOffsetX - * @param textureOffsetY - * @return - */ - protected final ModelRenderer createModelRenderer(int textureOffsetX, int textureOffsetY) - { - ModelRenderer modelRenderer = new ModelRenderer(this, textureOffsetX, textureOffsetY); - modelRenderer.setTextureSize(textureWidth, textureHeight); - return modelRenderer; - } - - /** - * @return - */ - private ModelRenderer createPhalanges() - { - return createModelRenderer(0, 0).addBox(-1, -1.5F, 0, 2, 3, 5).addBox(-1, -5.5F, 2, 2, 4, 3); - } - - /** - * @param resetResourceLocation - */ - private void initHandModelRenderers(ResourceLocation resetResourceLocation) - { - palm = createModelRenderer(0, 0).addBox(-4, -8, -4, 8, 4, 8); - shaft.addChild(palm); - int fingerCount = 4; - fingers = new ModelRenderer[fingerCount]; - for(int i = 0; i < fingerCount; i++){ - ModelRenderer phalanges = createPhalanges(); - float theta = (i / (float)fingerCount - 0.5F + 1F / fingerCount / 2) * ((float)Math.PI * 0.6F); - phalanges.rotateAngleY = theta; - phalanges.setRotationPoint(MathHelper.sin(theta) * 5, -5.75F, MathHelper.cos(theta) * 5 - 1); - fingers[i] = phalanges; - palm.addChild(phalanges); - } - thumb = createPhalanges(); - thumb.rotateAngleY = (float)Math.PI; - thumb.rotationPointY = -5.75F; - thumb.rotationPointZ = -3; - palm.addChild(thumb); - heldItemStack = new ItemStackModelRenderer(this, resetResourceLocation); - heldItemStack.rotateAngleZ = (float)Math.PI; - heldItemStack.rotateAngleX = (float)(Math.PI / 2); - heldItemStack.setRotationPoint(0, -8.5F, -3.5F); - palm.addChild(heldItemStack); - } - - /** - * @param pedestal - * @param partialRenderTicks - * @param scale - */ - public void render(TileEntityHandPedestal pedestal, float partialRenderTicks, float scale) - { - handleHeldItemStack(pedestal.getHeldItemStack()); - float gripScale = pedestal.getGripScale(); - float grip = easeInOut.eval(pedestal.getGrip(partialRenderTicks)) * gripScale; - float rotateAngleX = (float)(grip * 75 * Math.PI / 180 + (1 - grip) * 10 * Math.PI / 180); - float rotateAngleZ = (float)(grip * 20 * Math.PI / 180); - for(int i = 0; i < fingers.length; i++){ - ModelRenderer phalanges = fingers[i]; - phalanges.rotateAngleX = rotateAngleX; - phalanges.rotateAngleZ = rotateAngleZ * (2F / (fingers.length - 1) * i - 1); - } - thumb.rotateAngleX = (float)(grip * 60 * Math.PI / 180 + (1 - grip) * 10 * Math.PI / 180); - thumb.rotateAngleZ = rotateAngleZ; - plinth.render(scale); - } - - /** - * @param itemStack - */ - private void handleHeldItemStack(ItemStack itemStack) - { - heldItemStack.setItemStack(itemStack); - if (itemStack != null){ - Item item = itemStack.getItem(); - if (item instanceof ItemBlock){ - heldItemStack.rotateAngleX = 0; - heldItemStack.rotationPointZ = 0; - }else{ - heldItemStack.rotateAngleX = (float)(Math.PI / 2); - heldItemStack.rotationPointZ = -3.5F; - } - } - } +public class ModelHandPedestal extends ModelBase { + protected ModelRenderer plinth; + protected ModelRenderer base; + protected ModelRenderer shaft; + private ModelRenderer palm; + private ModelRenderer[] fingers; + private ModelRenderer thumb; + private ItemStackModelRenderer heldItemStack; + private CubicBezier easeInOut; + + /** + * @param resetResourceLocation + */ + public ModelHandPedestal(ResourceLocation resetResourceLocation) { + initPedestalRenderers(); + plinth.setRotationPoint(0, 16, 0); + plinth.addChild(base); + base.addChild(shaft); + initHandModelRenderers(resetResourceLocation); + initCubicBeziers(); + } + + /** + * + */ + protected void initPedestalRenderers() { + plinth = createModelRenderer(0, 0).addBox(-6, 4, -6, 12, 4, 12); + base = createModelRenderer(0, 0).addBox(-4, 0, -4, 8, 4, 8); + shaft = createModelRenderer(0, 0).addBox(-3, -4, -3, 6, 4, 6); + } + + /** + * + */ + private void initCubicBeziers() { + easeInOut = new CubicBezier(0.4F, 0, 0.6F, 1); + } + + /** + * @param textureOffsetX + * @param textureOffsetY + * @return + */ + protected final ModelRenderer createModelRenderer(int textureOffsetX, + int textureOffsetY) { + ModelRenderer modelRenderer = + new ModelRenderer(this, textureOffsetX, textureOffsetY); + modelRenderer.setTextureSize(textureWidth, textureHeight); + return modelRenderer; + } + + /** + * @return + */ + private ModelRenderer createPhalanges() { + return createModelRenderer(0, 0).addBox(-1, -1.5F, 0, 2, 3, 5) + .addBox(-1, -5.5F, 2, 2, 4, 3); + } + + /** + * @param resetResourceLocation + */ + private void initHandModelRenderers( + ResourceLocation resetResourceLocation) { + palm = createModelRenderer(0, 0).addBox(-4, -8, -4, 8, 4, 8); + shaft.addChild(palm); + int fingerCount = 4; + fingers = new ModelRenderer[fingerCount]; + for (int i = 0; i < fingerCount; i++) { + ModelRenderer phalanges = createPhalanges(); + float theta = + (i / (float) fingerCount - 0.5F + 1F / fingerCount / 2) + * ((float) Math.PI * 0.6F); + phalanges.rotateAngleY = theta; + phalanges.setRotationPoint(MathHelper.sin(theta) * 5, -5.75F, + MathHelper.cos(theta) * 5 - 1); + fingers[i] = phalanges; + palm.addChild(phalanges); + } + thumb = createPhalanges(); + thumb.rotateAngleY = (float) Math.PI; + thumb.rotationPointY = -5.75F; + thumb.rotationPointZ = -3; + palm.addChild(thumb); + heldItemStack = + new ItemStackModelRenderer(this, resetResourceLocation); + heldItemStack.rotateAngleZ = (float) Math.PI; + heldItemStack.rotateAngleX = (float) (Math.PI / 2); + heldItemStack.setRotationPoint(0, -8.5F, -3.5F); + palm.addChild(heldItemStack); + } + + /** + * @param pedestal + * @param partialRenderTicks + * @param scale + */ + public void render(TileEntityHandPedestal pedestal, + float partialRenderTicks, float scale) { + handleHeldItemStack(pedestal.getHeldItemStack()); + float gripScale = pedestal.getGripScale(); + float grip = easeInOut.eval(pedestal.getGrip(partialRenderTicks)) + * gripScale; + float rotateAngleX = (float) (grip * 75 * Math.PI / 180 + + (1 - grip) * 10 * Math.PI / 180); + float rotateAngleZ = (float) (grip * 20 * Math.PI / 180); + for (int i = 0; i < fingers.length; i++) { + ModelRenderer phalanges = fingers[i]; + phalanges.rotateAngleX = rotateAngleX; + phalanges.rotateAngleZ = + rotateAngleZ * (2F / (fingers.length - 1) * i - 1); + } + thumb.rotateAngleX = (float) (grip * 60 * Math.PI / 180 + + (1 - grip) * 10 * Math.PI / 180); + thumb.rotateAngleZ = rotateAngleZ; + plinth.render(scale); + } + + /** + * @param itemStack + */ + private void handleHeldItemStack(ItemStack itemStack) { + heldItemStack.setItemStack(itemStack); + if (itemStack != null) { + Item item = itemStack.getItem(); + if (item instanceof ItemBlock) { + heldItemStack.rotateAngleX = 0; + heldItemStack.rotationPointZ = 0; + } else { + heldItemStack.rotateAngleX = (float) (Math.PI / 2); + heldItemStack.rotationPointZ = -3.5F; + } + } + } }
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelHeart.java b/src/main/java/darkknight/jewelrycraft/model/ModelHeart.java index 0c6a438..f9a29e0 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelHeart.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelHeart.java @@ -9,531 +9,557 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class ModelHeart extends ModelBase -{ - // fields - ModelRenderer s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17, s18, s19, s20, s21, s22; - ModelRenderer f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26; - ModelRenderer b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26; +public class ModelHeart extends ModelBase { + // fields + ModelRenderer s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, + s14, s15, s16, s17, s18, s19, s20, s21, s22; + ModelRenderer f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, + f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, + f26; + ModelRenderer b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, + b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, + b26; - public ModelHeart() - { - textureWidth = 64; - textureHeight = 32; - s1 = new ModelRenderer(this, 0, 16); - s1.addBox(0F, 0F, 0F, 1, 1, 1); - s1.setRotationPoint(1F, 13F, 0F); - s1.setTextureSize(64, 32); - s1.mirror = true; - setRotation(s1, 0F, 0F, 0F); - s2 = new ModelRenderer(this, 0, 16); - s2.addBox(0F, 0F, 0F, 2, 1, 1); - s2.setRotationPoint(-1F, 23F, 0F); - s2.setTextureSize(64, 32); - s2.mirror = true; - setRotation(s2, 0F, 0F, 0F); - s3 = new ModelRenderer(this, 0, 16); - s3.addBox(0F, 0F, 0F, 2, 1, 1); - s3.setRotationPoint(2F, 12F, 0F); - s3.setTextureSize(64, 32); - s3.mirror = true; - setRotation(s3, 0F, 0F, 0F); - s4 = new ModelRenderer(this, 0, 16); - s4.addBox(0F, 0F, 0F, 1, 1, 1); - s4.setRotationPoint(1F, 22F, 0F); - s4.setTextureSize(64, 32); - s4.mirror = true; - setRotation(s4, 0F, 0F, 0F); - s5 = new ModelRenderer(this, 0, 16); - s5.addBox(0F, 0F, 0F, 1, 1, 1); - s5.setRotationPoint(4F, 13F, 0F); - s5.setTextureSize(64, 32); - s5.mirror = true; - setRotation(s5, 0F, 0F, 0F); - s6 = new ModelRenderer(this, 0, 16); - s6.addBox(0F, 0F, 0F, 1, 1, 1); - s6.setRotationPoint(5F, 18F, 0F); - s6.setTextureSize(64, 32); - s6.mirror = true; - setRotation(s6, 0F, 0F, 0F); - s7 = new ModelRenderer(this, 0, 16); - s7.addBox(0F, 0F, 0F, 1, 1, 1); - s7.setRotationPoint(5F, 14F, 0F); - s7.setTextureSize(64, 32); - s7.mirror = true; - setRotation(s7, 0F, 0F, 0F); - s8 = new ModelRenderer(this, 0, 16); - s8.addBox(0F, 0F, 0F, 1, 1, 1); - s8.setRotationPoint(-2F, 22F, 0F); - s8.setTextureSize(64, 32); - s8.mirror = true; - setRotation(s8, 0F, 0F, 0F); - s9 = new ModelRenderer(this, 0, 16); - s9.addBox(0F, 0F, 0F, 1, 1, 1); - s9.setRotationPoint(-2F, 13F, 0F); - s9.setTextureSize(64, 32); - s9.mirror = true; - setRotation(s9, 0F, 0F, 0F); - s10 = new ModelRenderer(this, 0, 16); - s10.addBox(0F, 0F, 0F, 1, 1, 1); - s10.setRotationPoint(-6F, 18F, 0F); - s10.setTextureSize(64, 32); - s10.mirror = true; - setRotation(s10, 0F, 0F, 0F); - s11 = new ModelRenderer(this, 0, 16); - s11.addBox(0F, 0F, 0F, 2, 1, 1); - s11.setRotationPoint(-4F, 12F, 0F); - s11.setTextureSize(64, 32); - s11.mirror = true; - setRotation(s11, 0F, 0F, 0F); - s12 = new ModelRenderer(this, 0, 16); - s12.addBox(0F, 0F, 0F, 1, 1, 1); - s12.setRotationPoint(-3F, 21F, 0F); - s12.setTextureSize(64, 32); - s12.mirror = true; - setRotation(s12, 0F, 0F, 0F); - s13 = new ModelRenderer(this, 0, 16); - s13.addBox(0F, 0F, 0F, 1, 1, 1); - s13.setRotationPoint(-5F, 13F, 0F); - s13.setTextureSize(64, 32); - s13.mirror = true; - setRotation(s13, 0F, 0F, 0F); - s14 = new ModelRenderer(this, 0, 16); - s14.addBox(0F, 0F, 0F, 1, 1, 1); - s14.setRotationPoint(-4F, 20F, 0F); - s14.setTextureSize(64, 32); - s14.mirror = true; - setRotation(s14, 0F, 0F, 0F); - s15 = new ModelRenderer(this, 0, 16); - s15.addBox(0F, 0F, 0F, 1, 1, 1); - s15.setRotationPoint(-6F, 14F, 0F); - s15.setTextureSize(64, 32); - s15.mirror = true; - setRotation(s15, 0F, 0F, 0F); - s16 = new ModelRenderer(this, 0, 16); - s16.addBox(0F, 0F, 0F, 1, 1, 1); - s16.setRotationPoint(-5F, 19F, 0F); - s16.setTextureSize(64, 32); - s16.mirror = true; - setRotation(s16, 0F, 0F, 0F); - s17 = new ModelRenderer(this, 0, 16); - s17.addBox(0F, 0F, 0F, 2, 1, 1); - s17.setRotationPoint(-1F, 14F, 0F); - s17.setTextureSize(64, 32); - s17.mirror = true; - setRotation(s17, 0F, 0F, 0F); - s18 = new ModelRenderer(this, 0, 16); - s18.addBox(0F, 0F, 0F, 1, 1, 1); - s18.setRotationPoint(2F, 21F, 0F); - s18.setTextureSize(64, 32); - s18.mirror = true; - setRotation(s18, 0F, 0F, 0F); - s19 = new ModelRenderer(this, 0, 16); - s19.addBox(0F, 0F, 0F, 1, 3, 1); - s19.setRotationPoint(6F, 15F, 0F); - s19.setTextureSize(64, 32); - s19.mirror = true; - setRotation(s19, 0F, 0F, 0F); - s20 = new ModelRenderer(this, 0, 16); - s20.addBox(0F, 0F, 0F, 1, 1, 1); - s20.setRotationPoint(3F, 20F, 0F); - s20.setTextureSize(64, 32); - s20.mirror = true; - setRotation(s20, 0F, 0F, 0F); - s21 = new ModelRenderer(this, 0, 16); - s21.addBox(0F, 0F, 0F, 1, 3, 1); - s21.setRotationPoint(-7F, 15F, 0F); - s21.setTextureSize(64, 32); - s21.mirror = true; - setRotation(s21, 0F, 0F, 0F); - s22 = new ModelRenderer(this, 0, 16); - s22.addBox(0F, 0F, 0F, 1, 1, 1); - s22.setRotationPoint(4F, 19F, 0F); - s22.setTextureSize(64, 32); - s22.mirror = true; - setRotation(s22, 0F, 0F, 0F); - f1 = new ModelRenderer(this, 0, 0); - f1.addBox(0F, 0F, 0F, 2, 1, 1); - f1.setRotationPoint(-1F, 22F, 1F); - f1.setTextureSize(64, 32); - f1.mirror = true; - setRotation(f1, 0F, 0F, 0F); - f2 = new ModelRenderer(this, 0, 0); - f2.addBox(0F, 0F, 0F, 2, 1, 1); - f2.setRotationPoint(2F, 13F, 1F); - f2.setTextureSize(64, 32); - f2.mirror = true; - setRotation(f2, 0F, 0F, 0F); - f3 = new ModelRenderer(this, 0, 0); - f3.addBox(0F, 0F, 0F, 12, 3, 1); - f3.setRotationPoint(-6F, 15F, 1F); - f3.setTextureSize(64, 32); - f3.mirror = true; - setRotation(f3, 0F, 0F, 0F); - f4 = new ModelRenderer(this, 0, 0); - f4.addBox(0F, 0F, 0F, 10, 1, 1); - f4.setRotationPoint(-5F, 18F, 1F); - f4.setTextureSize(64, 32); - f4.mirror = true; - setRotation(f4, 0F, 0F, 0F); - f5 = new ModelRenderer(this, 0, 0); - f5.addBox(0F, 0F, 0F, 8, 1, 1); - f5.setRotationPoint(-4F, 19F, 1F); - f5.setTextureSize(64, 32); - f5.mirror = true; - setRotation(f5, 0F, 0F, 0F); - f6 = new ModelRenderer(this, 0, 0); - f6.addBox(0F, 0F, 0F, 6, 1, 1); - f6.setRotationPoint(-3F, 20F, 1F); - f6.setTextureSize(64, 32); - f6.mirror = true; - setRotation(f6, 0F, 0F, 0F); - f7 = new ModelRenderer(this, 0, 0); - f7.addBox(0F, 0F, 0F, 4, 1, 1); - f7.setRotationPoint(-2F, 21F, 1F); - f7.setTextureSize(64, 32); - f7.mirror = true; - setRotation(f7, 0F, 0F, 0F); - f8 = new ModelRenderer(this, 0, 0); - f8.addBox(0F, 0F, 0F, 4, 1, 1); - f8.setRotationPoint(-5F, 14F, 1F); - f8.setTextureSize(64, 32); - f8.mirror = true; - setRotation(f8, 0F, 0F, 0F); - f9 = new ModelRenderer(this, 0, 0); - f9.addBox(0F, 0F, 0F, 2, 1, 1); - f9.setRotationPoint(-4F, 13F, 1F); - f9.setTextureSize(64, 32); - f9.mirror = true; - setRotation(f9, 0F, 0F, 0F); - f10 = new ModelRenderer(this, 0, 0); - f10.addBox(0F, 0F, 0F, 4, 1, 1); - f10.setRotationPoint(1F, 14F, 1F); - f10.setTextureSize(64, 32); - f10.mirror = true; - setRotation(f10, 0F, 0F, 0F); - f11 = new ModelRenderer(this, 0, 0); - f11.addBox(0F, 0F, 0F, 1, 1, 1); - f11.setRotationPoint(2F, 15F, 3F); - f11.setTextureSize(64, 32); - f11.mirror = true; - setRotation(f11, 0F, 0F, 0F); - f12 = new ModelRenderer(this, 0, 0); - f12.addBox(0F, 0F, 0F, 1, 1, 1); - f12.setRotationPoint(2F, 14F, 2F); - f12.setTextureSize(64, 32); - f12.mirror = true; - setRotation(f12, 0F, 0F, 0F); - f13 = new ModelRenderer(this, 0, 0); - f13.addBox(0F, 0F, 0F, 3, 1, 1); - f13.setRotationPoint(1F, 15F, 2F); - f13.setTextureSize(64, 32); - f13.mirror = true; - setRotation(f13, 0F, 0F, 0F); - f14 = new ModelRenderer(this, 0, 0); - f14.addBox(0F, 0F, 0F, 10, 1, 1); - f14.setRotationPoint(-5F, 16F, 2F); - f14.setTextureSize(64, 32); - f14.mirror = true; - setRotation(f14, 0F, 0F, 0F); - f15 = new ModelRenderer(this, 0, 0); - f15.addBox(0F, 0F, 0F, 10, 1, 1); - f15.setRotationPoint(-5F, 17F, 2F); - f15.setTextureSize(64, 32); - f15.mirror = true; - setRotation(f15, 0F, 0F, 0F); - f16 = new ModelRenderer(this, 0, 0); - f16.addBox(0F, 0F, 0F, 3, 1, 1); - f16.setRotationPoint(-4F, 15F, 2F); - f16.setTextureSize(64, 32); - f16.mirror = true; - setRotation(f16, 0F, 0F, 0F); - f17 = new ModelRenderer(this, 0, 0); - f17.addBox(0F, 0F, 0F, 1, 1, 1); - f17.setRotationPoint(-3F, 14F, 2F); - f17.setTextureSize(64, 32); - f17.mirror = true; - setRotation(f17, 0F, 0F, 0F); - f18 = new ModelRenderer(this, 0, 0); - f18.addBox(0F, 0F, 0F, 3, 1, 1); - f18.setRotationPoint(1F, 16F, 3F); - f18.setTextureSize(64, 32); - f18.mirror = true; - setRotation(f18, 0F, 0F, 0F); - f19 = new ModelRenderer(this, 0, 0); - f19.addBox(0F, 0F, 0F, 1, 1, 1); - f19.setRotationPoint(-3F, 15F, 3F); - f19.setTextureSize(64, 32); - f19.mirror = true; - setRotation(f19, 0F, 0F, 0F); - f20 = new ModelRenderer(this, 0, 0); - f20.addBox(0F, 0F, 0F, 3, 1, 1); - f20.setRotationPoint(-4F, 16F, 3F); - f20.setTextureSize(64, 32); - f20.mirror = true; - setRotation(f20, 0F, 0F, 0F); - f21 = new ModelRenderer(this, 0, 0); - f21.addBox(0F, 0F, 0F, 4, 1, 1); - f21.setRotationPoint(-2F, 20F, 2F); - f21.setTextureSize(64, 32); - f21.mirror = true; - setRotation(f21, 0F, 0F, 0F); - f22 = new ModelRenderer(this, 0, 0); - f22.addBox(0F, 0F, 0F, 6, 1, 1); - f22.setRotationPoint(-3F, 19F, 2F); - f22.setTextureSize(64, 32); - f22.mirror = true; - setRotation(f22, 0F, 0F, 0F); - f23 = new ModelRenderer(this, 0, 0); - f23.addBox(0F, 0F, 0F, 8, 1, 1); - f23.setRotationPoint(-4F, 18F, 2F); - f23.setTextureSize(64, 32); - f23.mirror = true; - setRotation(f23, 0F, 0F, 0F); - f24 = new ModelRenderer(this, 0, 0); - f24.addBox(0F, 0F, 0F, 6, 1, 1); - f24.setRotationPoint(-3F, 17F, 3F); - f24.setTextureSize(64, 32); - f24.mirror = true; - setRotation(f24, 0F, 0F, 0F); - f25 = new ModelRenderer(this, 0, 0); - f25.addBox(0F, 0F, 0F, 4, 1, 1); - f25.setRotationPoint(-2F, 18F, 3F); - f25.setTextureSize(64, 32); - f25.mirror = true; - setRotation(f25, 0F, 0F, 0F); - f26 = new ModelRenderer(this, 0, 0); - f26.addBox(0F, 0F, 0F, 2, 1, 1); - f26.setRotationPoint(-1F, 19F, 3F); - f26.setTextureSize(64, 32); - f26.mirror = true; - setRotation(f26, 0F, 0F, 0F); - b1 = new ModelRenderer(this, 0, 0); - b1.addBox(0F, 0F, 0F, 4, 1, 1); - b1.setRotationPoint(-2F, 20F, -2F); - b1.setTextureSize(64, 32); - b1.mirror = true; - setRotation(b1, 0F, 0F, 0F); - b2 = new ModelRenderer(this, 0, 0); - b2.addBox(0F, 0F, 0F, 1, 1, 1); - b2.setRotationPoint(-3F, 14F, -2F); - b2.setTextureSize(64, 32); - b2.mirror = true; - setRotation(b2, 0F, 0F, 0F); - b3 = new ModelRenderer(this, 0, 0); - b3.addBox(0F, 0F, 0F, 10, 1, 1); - b3.setRotationPoint(-5F, 17F, -2F); - b3.setTextureSize(64, 32); - b3.mirror = true; - setRotation(b3, 0F, 0F, 0F); - b4 = new ModelRenderer(this, 0, 0); - b4.addBox(0F, 0F, 0F, 8, 1, 1); - b4.setRotationPoint(-4F, 18F, -2F); - b4.setTextureSize(64, 32); - b4.mirror = true; - setRotation(b4, 0F, 0F, 0F); - b5 = new ModelRenderer(this, 0, 0); - b5.addBox(0F, 0F, 0F, 6, 1, 1); - b5.setRotationPoint(-3F, 19F, -2F); - b5.setTextureSize(64, 32); - b5.mirror = true; - setRotation(b5, 0F, 0F, 0F); - b6 = new ModelRenderer(this, 0, 0); - b6.addBox(0F, 0F, 0F, 3, 1, 1); - b6.setRotationPoint(-4F, 15F, -2F); - b6.setTextureSize(64, 32); - b6.mirror = true; - setRotation(b6, 0F, 0F, 0F); - b7 = new ModelRenderer(this, 0, 0); - b7.addBox(0F, 0F, 0F, 3, 1, 1); - b7.setRotationPoint(1F, 15F, -2F); - b7.setTextureSize(64, 32); - b7.mirror = true; - setRotation(b7, 0F, 0F, 0F); - b8 = new ModelRenderer(this, 0, 0); - b8.addBox(0F, 0F, 0F, 1, 1, 1); - b8.setRotationPoint(2F, 14F, -2F); - b8.setTextureSize(64, 32); - b8.mirror = true; - setRotation(b8, 0F, 0F, 0F); - b9 = new ModelRenderer(this, 0, 0); - b9.addBox(0F, 0F, 0F, 1, 1, 1); - b9.setRotationPoint(-3F, 15F, -3F); - b9.setTextureSize(64, 32); - b9.mirror = true; - setRotation(b9, 0F, 0F, 0F); - b10 = new ModelRenderer(this, 0, 0); - b10.addBox(0F, 0F, 0F, 4, 1, 1); - b10.setRotationPoint(-2F, 18F, -3F); - b10.setTextureSize(64, 32); - b10.mirror = true; - setRotation(b10, 0F, 0F, 0F); - b11 = new ModelRenderer(this, 0, 0); - b11.addBox(0F, 0F, 0F, 10, 1, 1); - b11.setRotationPoint(-5F, 16F, -2F); - b11.setTextureSize(64, 32); - b11.mirror = true; - setRotation(b11, 0F, 0F, 0F); - b12 = new ModelRenderer(this, 0, 0); - b12.addBox(0F, 0F, 0F, 3, 1, 1); - b12.setRotationPoint(-4F, 16F, -3F); - b12.setTextureSize(64, 32); - b12.mirror = true; - setRotation(b12, 0F, 0F, 0F); - b13 = new ModelRenderer(this, 0, 0); - b13.addBox(0F, 0F, 0F, 3, 1, 1); - b13.setRotationPoint(1F, 16F, -3F); - b13.setTextureSize(64, 32); - b13.mirror = true; - setRotation(b13, 0F, 0F, 0F); - b14 = new ModelRenderer(this, 0, 0); - b14.addBox(0F, 0F, 0F, 1, 1, 1); - b14.setRotationPoint(2F, 15F, -3F); - b14.setTextureSize(64, 32); - b14.mirror = true; - setRotation(b14, 0F, 0F, 0F); - b15 = new ModelRenderer(this, 0, 0); - b15.addBox(0F, 0F, 0F, 6, 1, 1); - b15.setRotationPoint(-3F, 17F, -3F); - b15.setTextureSize(64, 32); - b15.mirror = true; - setRotation(b15, 0F, 0F, 0F); - b16 = new ModelRenderer(this, 0, 0); - b16.addBox(0F, 0F, 0F, 2, 1, 1); - b16.setRotationPoint(-1F, 19F, -3F); - b16.setTextureSize(64, 32); - b16.mirror = true; - setRotation(b16, 0F, 0F, 0F); - b17 = new ModelRenderer(this, 0, 0); - b17.addBox(0F, 0F, 0F, 2, 1, 1); - b17.setRotationPoint(2F, 13F, -1F); - b17.setTextureSize(64, 32); - b17.mirror = true; - setRotation(b17, 0F, 0F, 0F); - b18 = new ModelRenderer(this, 0, 0); - b18.addBox(0F, 0F, 0F, 4, 1, 1); - b18.setRotationPoint(1F, 14F, -1F); - b18.setTextureSize(64, 32); - b18.mirror = true; - setRotation(b18, 0F, 0F, 0F); - b19 = new ModelRenderer(this, 0, 0); - b19.addBox(0F, 0F, 0F, 2, 1, 1); - b19.setRotationPoint(-4F, 13F, -1F); - b19.setTextureSize(64, 32); - b19.mirror = true; - setRotation(b19, 0F, 0F, 0F); - b20 = new ModelRenderer(this, 0, 0); - b20.addBox(0F, 0F, 0F, 2, 1, 1); - b20.setRotationPoint(-1F, 22F, -1F); - b20.setTextureSize(64, 32); - b20.mirror = true; - setRotation(b20, 0F, 0F, 0F); - b21 = new ModelRenderer(this, 0, 0); - b21.addBox(0F, 0F, 0F, 4, 1, 1); - b21.setRotationPoint(-5F, 14F, -1F); - b21.setTextureSize(64, 32); - b21.mirror = true; - setRotation(b21, 0F, 0F, 0F); - b22 = new ModelRenderer(this, 0, 0); - b22.addBox(0F, 0F, 0F, 12, 3, 1); - b22.setRotationPoint(-6F, 15F, -1F); - b22.setTextureSize(64, 32); - b22.mirror = true; - setRotation(b22, 0F, 0F, 0F); - b23 = new ModelRenderer(this, 0, 0); - b23.addBox(0F, 0F, 0F, 10, 1, 1); - b23.setRotationPoint(-5F, 18F, -1F); - b23.setTextureSize(64, 32); - b23.mirror = true; - setRotation(b23, 0F, 0F, 0F); - b24 = new ModelRenderer(this, 0, 0); - b24.addBox(0F, 0F, 0F, 8, 1, 1); - b24.setRotationPoint(-4F, 19F, -1F); - b24.setTextureSize(64, 32); - b24.mirror = true; - setRotation(b24, 0F, 0F, 0F); - b25 = new ModelRenderer(this, 0, 0); - b25.addBox(0F, 0F, 0F, 6, 1, 1); - b25.setRotationPoint(-3F, 20F, -1F); - b25.setTextureSize(64, 32); - b25.mirror = true; - setRotation(b25, 0F, 0F, 0F); - b26 = new ModelRenderer(this, 0, 0); - b26.addBox(0F, 0F, 0F, 4, 1, 1); - b26.setRotationPoint(-2F, 21F, -1F); - b26.setTextureSize(64, 32); - b26.mirror = true; - setRotation(b26, 0F, 0F, 0F); - } + public ModelHeart() { + textureWidth = 64; + textureHeight = 32; + s1 = new ModelRenderer(this, 0, 16); + s1.addBox(0F, 0F, 0F, 1, 1, 1); + s1.setRotationPoint(1F, 13F, 0F); + s1.setTextureSize(64, 32); + s1.mirror = true; + setRotation(s1, 0F, 0F, 0F); + s2 = new ModelRenderer(this, 0, 16); + s2.addBox(0F, 0F, 0F, 2, 1, 1); + s2.setRotationPoint(-1F, 23F, 0F); + s2.setTextureSize(64, 32); + s2.mirror = true; + setRotation(s2, 0F, 0F, 0F); + s3 = new ModelRenderer(this, 0, 16); + s3.addBox(0F, 0F, 0F, 2, 1, 1); + s3.setRotationPoint(2F, 12F, 0F); + s3.setTextureSize(64, 32); + s3.mirror = true; + setRotation(s3, 0F, 0F, 0F); + s4 = new ModelRenderer(this, 0, 16); + s4.addBox(0F, 0F, 0F, 1, 1, 1); + s4.setRotationPoint(1F, 22F, 0F); + s4.setTextureSize(64, 32); + s4.mirror = true; + setRotation(s4, 0F, 0F, 0F); + s5 = new ModelRenderer(this, 0, 16); + s5.addBox(0F, 0F, 0F, 1, 1, 1); + s5.setRotationPoint(4F, 13F, 0F); + s5.setTextureSize(64, 32); + s5.mirror = true; + setRotation(s5, 0F, 0F, 0F); + s6 = new ModelRenderer(this, 0, 16); + s6.addBox(0F, 0F, 0F, 1, 1, 1); + s6.setRotationPoint(5F, 18F, 0F); + s6.setTextureSize(64, 32); + s6.mirror = true; + setRotation(s6, 0F, 0F, 0F); + s7 = new ModelRenderer(this, 0, 16); + s7.addBox(0F, 0F, 0F, 1, 1, 1); + s7.setRotationPoint(5F, 14F, 0F); + s7.setTextureSize(64, 32); + s7.mirror = true; + setRotation(s7, 0F, 0F, 0F); + s8 = new ModelRenderer(this, 0, 16); + s8.addBox(0F, 0F, 0F, 1, 1, 1); + s8.setRotationPoint(-2F, 22F, 0F); + s8.setTextureSize(64, 32); + s8.mirror = true; + setRotation(s8, 0F, 0F, 0F); + s9 = new ModelRenderer(this, 0, 16); + s9.addBox(0F, 0F, 0F, 1, 1, 1); + s9.setRotationPoint(-2F, 13F, 0F); + s9.setTextureSize(64, 32); + s9.mirror = true; + setRotation(s9, 0F, 0F, 0F); + s10 = new ModelRenderer(this, 0, 16); + s10.addBox(0F, 0F, 0F, 1, 1, 1); + s10.setRotationPoint(-6F, 18F, 0F); + s10.setTextureSize(64, 32); + s10.mirror = true; + setRotation(s10, 0F, 0F, 0F); + s11 = new ModelRenderer(this, 0, 16); + s11.addBox(0F, 0F, 0F, 2, 1, 1); + s11.setRotationPoint(-4F, 12F, 0F); + s11.setTextureSize(64, 32); + s11.mirror = true; + setRotation(s11, 0F, 0F, 0F); + s12 = new ModelRenderer(this, 0, 16); + s12.addBox(0F, 0F, 0F, 1, 1, 1); + s12.setRotationPoint(-3F, 21F, 0F); + s12.setTextureSize(64, 32); + s12.mirror = true; + setRotation(s12, 0F, 0F, 0F); + s13 = new ModelRenderer(this, 0, 16); + s13.addBox(0F, 0F, 0F, 1, 1, 1); + s13.setRotationPoint(-5F, 13F, 0F); + s13.setTextureSize(64, 32); + s13.mirror = true; + setRotation(s13, 0F, 0F, 0F); + s14 = new ModelRenderer(this, 0, 16); + s14.addBox(0F, 0F, 0F, 1, 1, 1); + s14.setRotationPoint(-4F, 20F, 0F); + s14.setTextureSize(64, 32); + s14.mirror = true; + setRotation(s14, 0F, 0F, 0F); + s15 = new ModelRenderer(this, 0, 16); + s15.addBox(0F, 0F, 0F, 1, 1, 1); + s15.setRotationPoint(-6F, 14F, 0F); + s15.setTextureSize(64, 32); + s15.mirror = true; + setRotation(s15, 0F, 0F, 0F); + s16 = new ModelRenderer(this, 0, 16); + s16.addBox(0F, 0F, 0F, 1, 1, 1); + s16.setRotationPoint(-5F, 19F, 0F); + s16.setTextureSize(64, 32); + s16.mirror = true; + setRotation(s16, 0F, 0F, 0F); + s17 = new ModelRenderer(this, 0, 16); + s17.addBox(0F, 0F, 0F, 2, 1, 1); + s17.setRotationPoint(-1F, 14F, 0F); + s17.setTextureSize(64, 32); + s17.mirror = true; + setRotation(s17, 0F, 0F, 0F); + s18 = new ModelRenderer(this, 0, 16); + s18.addBox(0F, 0F, 0F, 1, 1, 1); + s18.setRotationPoint(2F, 21F, 0F); + s18.setTextureSize(64, 32); + s18.mirror = true; + setRotation(s18, 0F, 0F, 0F); + s19 = new ModelRenderer(this, 0, 16); + s19.addBox(0F, 0F, 0F, 1, 3, 1); + s19.setRotationPoint(6F, 15F, 0F); + s19.setTextureSize(64, 32); + s19.mirror = true; + setRotation(s19, 0F, 0F, 0F); + s20 = new ModelRenderer(this, 0, 16); + s20.addBox(0F, 0F, 0F, 1, 1, 1); + s20.setRotationPoint(3F, 20F, 0F); + s20.setTextureSize(64, 32); + s20.mirror = true; + setRotation(s20, 0F, 0F, 0F); + s21 = new ModelRenderer(this, 0, 16); + s21.addBox(0F, 0F, 0F, 1, 3, 1); + s21.setRotationPoint(-7F, 15F, 0F); + s21.setTextureSize(64, 32); + s21.mirror = true; + setRotation(s21, 0F, 0F, 0F); + s22 = new ModelRenderer(this, 0, 16); + s22.addBox(0F, 0F, 0F, 1, 1, 1); + s22.setRotationPoint(4F, 19F, 0F); + s22.setTextureSize(64, 32); + s22.mirror = true; + setRotation(s22, 0F, 0F, 0F); + f1 = new ModelRenderer(this, 0, 0); + f1.addBox(0F, 0F, 0F, 2, 1, 1); + f1.setRotationPoint(-1F, 22F, 1F); + f1.setTextureSize(64, 32); + f1.mirror = true; + setRotation(f1, 0F, 0F, 0F); + f2 = new ModelRenderer(this, 0, 0); + f2.addBox(0F, 0F, 0F, 2, 1, 1); + f2.setRotationPoint(2F, 13F, 1F); + f2.setTextureSize(64, 32); + f2.mirror = true; + setRotation(f2, 0F, 0F, 0F); + f3 = new ModelRenderer(this, 0, 0); + f3.addBox(0F, 0F, 0F, 12, 3, 1); + f3.setRotationPoint(-6F, 15F, 1F); + f3.setTextureSize(64, 32); + f3.mirror = true; + setRotation(f3, 0F, 0F, 0F); + f4 = new ModelRenderer(this, 0, 0); + f4.addBox(0F, 0F, 0F, 10, 1, 1); + f4.setRotationPoint(-5F, 18F, 1F); + f4.setTextureSize(64, 32); + f4.mirror = true; + setRotation(f4, 0F, 0F, 0F); + f5 = new ModelRenderer(this, 0, 0); + f5.addBox(0F, 0F, 0F, 8, 1, 1); + f5.setRotationPoint(-4F, 19F, 1F); + f5.setTextureSize(64, 32); + f5.mirror = true; + setRotation(f5, 0F, 0F, 0F); + f6 = new ModelRenderer(this, 0, 0); + f6.addBox(0F, 0F, 0F, 6, 1, 1); + f6.setRotationPoint(-3F, 20F, 1F); + f6.setTextureSize(64, 32); + f6.mirror = true; + setRotation(f6, 0F, 0F, 0F); + f7 = new ModelRenderer(this, 0, 0); + f7.addBox(0F, 0F, 0F, 4, 1, 1); + f7.setRotationPoint(-2F, 21F, 1F); + f7.setTextureSize(64, 32); + f7.mirror = true; + setRotation(f7, 0F, 0F, 0F); + f8 = new ModelRenderer(this, 0, 0); + f8.addBox(0F, 0F, 0F, 4, 1, 1); + f8.setRotationPoint(-5F, 14F, 1F); + f8.setTextureSize(64, 32); + f8.mirror = true; + setRotation(f8, 0F, 0F, 0F); + f9 = new ModelRenderer(this, 0, 0); + f9.addBox(0F, 0F, 0F, 2, 1, 1); + f9.setRotationPoint(-4F, 13F, 1F); + f9.setTextureSize(64, 32); + f9.mirror = true; + setRotation(f9, 0F, 0F, 0F); + f10 = new ModelRenderer(this, 0, 0); + f10.addBox(0F, 0F, 0F, 4, 1, 1); + f10.setRotationPoint(1F, 14F, 1F); + f10.setTextureSize(64, 32); + f10.mirror = true; + setRotation(f10, 0F, 0F, 0F); + f11 = new ModelRenderer(this, 0, 0); + f11.addBox(0F, 0F, 0F, 1, 1, 1); + f11.setRotationPoint(2F, 15F, 3F); + f11.setTextureSize(64, 32); + f11.mirror = true; + setRotation(f11, 0F, 0F, 0F); + f12 = new ModelRenderer(this, 0, 0); + f12.addBox(0F, 0F, 0F, 1, 1, 1); + f12.setRotationPoint(2F, 14F, 2F); + f12.setTextureSize(64, 32); + f12.mirror = true; + setRotation(f12, 0F, 0F, 0F); + f13 = new ModelRenderer(this, 0, 0); + f13.addBox(0F, 0F, 0F, 3, 1, 1); + f13.setRotationPoint(1F, 15F, 2F); + f13.setTextureSize(64, 32); + f13.mirror = true; + setRotation(f13, 0F, 0F, 0F); + f14 = new ModelRenderer(this, 0, 0); + f14.addBox(0F, 0F, 0F, 10, 1, 1); + f14.setRotationPoint(-5F, 16F, 2F); + f14.setTextureSize(64, 32); + f14.mirror = true; + setRotation(f14, 0F, 0F, 0F); + f15 = new ModelRenderer(this, 0, 0); + f15.addBox(0F, 0F, 0F, 10, 1, 1); + f15.setRotationPoint(-5F, 17F, 2F); + f15.setTextureSize(64, 32); + f15.mirror = true; + setRotation(f15, 0F, 0F, 0F); + f16 = new ModelRenderer(this, 0, 0); + f16.addBox(0F, 0F, 0F, 3, 1, 1); + f16.setRotationPoint(-4F, 15F, 2F); + f16.setTextureSize(64, 32); + f16.mirror = true; + setRotation(f16, 0F, 0F, 0F); + f17 = new ModelRenderer(this, 0, 0); + f17.addBox(0F, 0F, 0F, 1, 1, 1); + f17.setRotationPoint(-3F, 14F, 2F); + f17.setTextureSize(64, 32); + f17.mirror = true; + setRotation(f17, 0F, 0F, 0F); + f18 = new ModelRenderer(this, 0, 0); + f18.addBox(0F, 0F, 0F, 3, 1, 1); + f18.setRotationPoint(1F, 16F, 3F); + f18.setTextureSize(64, 32); + f18.mirror = true; + setRotation(f18, 0F, 0F, 0F); + f19 = new ModelRenderer(this, 0, 0); + f19.addBox(0F, 0F, 0F, 1, 1, 1); + f19.setRotationPoint(-3F, 15F, 3F); + f19.setTextureSize(64, 32); + f19.mirror = true; + setRotation(f19, 0F, 0F, 0F); + f20 = new ModelRenderer(this, 0, 0); + f20.addBox(0F, 0F, 0F, 3, 1, 1); + f20.setRotationPoint(-4F, 16F, 3F); + f20.setTextureSize(64, 32); + f20.mirror = true; + setRotation(f20, 0F, 0F, 0F); + f21 = new ModelRenderer(this, 0, 0); + f21.addBox(0F, 0F, 0F, 4, 1, 1); + f21.setRotationPoint(-2F, 20F, 2F); + f21.setTextureSize(64, 32); + f21.mirror = true; + setRotation(f21, 0F, 0F, 0F); + f22 = new ModelRenderer(this, 0, 0); + f22.addBox(0F, 0F, 0F, 6, 1, 1); + f22.setRotationPoint(-3F, 19F, 2F); + f22.setTextureSize(64, 32); + f22.mirror = true; + setRotation(f22, 0F, 0F, 0F); + f23 = new ModelRenderer(this, 0, 0); + f23.addBox(0F, 0F, 0F, 8, 1, 1); + f23.setRotationPoint(-4F, 18F, 2F); + f23.setTextureSize(64, 32); + f23.mirror = true; + setRotation(f23, 0F, 0F, 0F); + f24 = new ModelRenderer(this, 0, 0); + f24.addBox(0F, 0F, 0F, 6, 1, 1); + f24.setRotationPoint(-3F, 17F, 3F); + f24.setTextureSize(64, 32); + f24.mirror = true; + setRotation(f24, 0F, 0F, 0F); + f25 = new ModelRenderer(this, 0, 0); + f25.addBox(0F, 0F, 0F, 4, 1, 1); + f25.setRotationPoint(-2F, 18F, 3F); + f25.setTextureSize(64, 32); + f25.mirror = true; + setRotation(f25, 0F, 0F, 0F); + f26 = new ModelRenderer(this, 0, 0); + f26.addBox(0F, 0F, 0F, 2, 1, 1); + f26.setRotationPoint(-1F, 19F, 3F); + f26.setTextureSize(64, 32); + f26.mirror = true; + setRotation(f26, 0F, 0F, 0F); + b1 = new ModelRenderer(this, 0, 0); + b1.addBox(0F, 0F, 0F, 4, 1, 1); + b1.setRotationPoint(-2F, 20F, -2F); + b1.setTextureSize(64, 32); + b1.mirror = true; + setRotation(b1, 0F, 0F, 0F); + b2 = new ModelRenderer(this, 0, 0); + b2.addBox(0F, 0F, 0F, 1, 1, 1); + b2.setRotationPoint(-3F, 14F, -2F); + b2.setTextureSize(64, 32); + b2.mirror = true; + setRotation(b2, 0F, 0F, 0F); + b3 = new ModelRenderer(this, 0, 0); + b3.addBox(0F, 0F, 0F, 10, 1, 1); + b3.setRotationPoint(-5F, 17F, -2F); + b3.setTextureSize(64, 32); + b3.mirror = true; + setRotation(b3, 0F, 0F, 0F); + b4 = new ModelRenderer(this, 0, 0); + b4.addBox(0F, 0F, 0F, 8, 1, 1); + b4.setRotationPoint(-4F, 18F, -2F); + b4.setTextureSize(64, 32); + b4.mirror = true; + setRotation(b4, 0F, 0F, 0F); + b5 = new ModelRenderer(this, 0, 0); + b5.addBox(0F, 0F, 0F, 6, 1, 1); + b5.setRotationPoint(-3F, 19F, -2F); + b5.setTextureSize(64, 32); + b5.mirror = true; + setRotation(b5, 0F, 0F, 0F); + b6 = new ModelRenderer(this, 0, 0); + b6.addBox(0F, 0F, 0F, 3, 1, 1); + b6.setRotationPoint(-4F, 15F, -2F); + b6.setTextureSize(64, 32); + b6.mirror = true; + setRotation(b6, 0F, 0F, 0F); + b7 = new ModelRenderer(this, 0, 0); + b7.addBox(0F, 0F, 0F, 3, 1, 1); + b7.setRotationPoint(1F, 15F, -2F); + b7.setTextureSize(64, 32); + b7.mirror = true; + setRotation(b7, 0F, 0F, 0F); + b8 = new ModelRenderer(this, 0, 0); + b8.addBox(0F, 0F, 0F, 1, 1, 1); + b8.setRotationPoint(2F, 14F, -2F); + b8.setTextureSize(64, 32); + b8.mirror = true; + setRotation(b8, 0F, 0F, 0F); + b9 = new ModelRenderer(this, 0, 0); + b9.addBox(0F, 0F, 0F, 1, 1, 1); + b9.setRotationPoint(-3F, 15F, -3F); + b9.setTextureSize(64, 32); + b9.mirror = true; + setRotation(b9, 0F, 0F, 0F); + b10 = new ModelRenderer(this, 0, 0); + b10.addBox(0F, 0F, 0F, 4, 1, 1); + b10.setRotationPoint(-2F, 18F, -3F); + b10.setTextureSize(64, 32); + b10.mirror = true; + setRotation(b10, 0F, 0F, 0F); + b11 = new ModelRenderer(this, 0, 0); + b11.addBox(0F, 0F, 0F, 10, 1, 1); + b11.setRotationPoint(-5F, 16F, -2F); + b11.setTextureSize(64, 32); + b11.mirror = true; + setRotation(b11, 0F, 0F, 0F); + b12 = new ModelRenderer(this, 0, 0); + b12.addBox(0F, 0F, 0F, 3, 1, 1); + b12.setRotationPoint(-4F, 16F, -3F); + b12.setTextureSize(64, 32); + b12.mirror = true; + setRotation(b12, 0F, 0F, 0F); + b13 = new ModelRenderer(this, 0, 0); + b13.addBox(0F, 0F, 0F, 3, 1, 1); + b13.setRotationPoint(1F, 16F, -3F); + b13.setTextureSize(64, 32); + b13.mirror = true; + setRotation(b13, 0F, 0F, 0F); + b14 = new ModelRenderer(this, 0, 0); + b14.addBox(0F, 0F, 0F, 1, 1, 1); + b14.setRotationPoint(2F, 15F, -3F); + b14.setTextureSize(64, 32); + b14.mirror = true; + setRotation(b14, 0F, 0F, 0F); + b15 = new ModelRenderer(this, 0, 0); + b15.addBox(0F, 0F, 0F, 6, 1, 1); + b15.setRotationPoint(-3F, 17F, -3F); + b15.setTextureSize(64, 32); + b15.mirror = true; + setRotation(b15, 0F, 0F, 0F); + b16 = new ModelRenderer(this, 0, 0); + b16.addBox(0F, 0F, 0F, 2, 1, 1); + b16.setRotationPoint(-1F, 19F, -3F); + b16.setTextureSize(64, 32); + b16.mirror = true; + setRotation(b16, 0F, 0F, 0F); + b17 = new ModelRenderer(this, 0, 0); + b17.addBox(0F, 0F, 0F, 2, 1, 1); + b17.setRotationPoint(2F, 13F, -1F); + b17.setTextureSize(64, 32); + b17.mirror = true; + setRotation(b17, 0F, 0F, 0F); + b18 = new ModelRenderer(this, 0, 0); + b18.addBox(0F, 0F, 0F, 4, 1, 1); + b18.setRotationPoint(1F, 14F, -1F); + b18.setTextureSize(64, 32); + b18.mirror = true; + setRotation(b18, 0F, 0F, 0F); + b19 = new ModelRenderer(this, 0, 0); + b19.addBox(0F, 0F, 0F, 2, 1, 1); + b19.setRotationPoint(-4F, 13F, -1F); + b19.setTextureSize(64, 32); + b19.mirror = true; + setRotation(b19, 0F, 0F, 0F); + b20 = new ModelRenderer(this, 0, 0); + b20.addBox(0F, 0F, 0F, 2, 1, 1); + b20.setRotationPoint(-1F, 22F, -1F); + b20.setTextureSize(64, 32); + b20.mirror = true; + setRotation(b20, 0F, 0F, 0F); + b21 = new ModelRenderer(this, 0, 0); + b21.addBox(0F, 0F, 0F, 4, 1, 1); + b21.setRotationPoint(-5F, 14F, -1F); + b21.setTextureSize(64, 32); + b21.mirror = true; + setRotation(b21, 0F, 0F, 0F); + b22 = new ModelRenderer(this, 0, 0); + b22.addBox(0F, 0F, 0F, 12, 3, 1); + b22.setRotationPoint(-6F, 15F, -1F); + b22.setTextureSize(64, 32); + b22.mirror = true; + setRotation(b22, 0F, 0F, 0F); + b23 = new ModelRenderer(this, 0, 0); + b23.addBox(0F, 0F, 0F, 10, 1, 1); + b23.setRotationPoint(-5F, 18F, -1F); + b23.setTextureSize(64, 32); + b23.mirror = true; + setRotation(b23, 0F, 0F, 0F); + b24 = new ModelRenderer(this, 0, 0); + b24.addBox(0F, 0F, 0F, 8, 1, 1); + b24.setRotationPoint(-4F, 19F, -1F); + b24.setTextureSize(64, 32); + b24.mirror = true; + setRotation(b24, 0F, 0F, 0F); + b25 = new ModelRenderer(this, 0, 0); + b25.addBox(0F, 0F, 0F, 6, 1, 1); + b25.setRotationPoint(-3F, 20F, -1F); + b25.setTextureSize(64, 32); + b25.mirror = true; + setRotation(b25, 0F, 0F, 0F); + b26 = new ModelRenderer(this, 0, 0); + b26.addBox(0F, 0F, 0F, 4, 1, 1); + b26.setRotationPoint(-2F, 21F, -1F); + b26.setTextureSize(64, 32); + b26.mirror = true; + setRotation(b26, 0F, 0F, 0F); + } - public void render(Entity entity, float angle1, float angle2, float angle3, float angle4, float angle5, float angle6) - { - super.render(entity, angle1, angle2, angle3, angle4, angle5, angle6); - setRotationAngles(angle1, angle2, angle3, angle4, angle5, angle6); - s1.render(angle6); s2.render(angle6); s3.render(angle6); s4.render(angle6); s5.render(angle6); s6.render(angle6); s7.render(angle6); s8.render(angle6); s9.render(angle6); s10.render(angle6); s11.render(angle6); s12.render(angle6); s13.render(angle6); s14.render(angle6); s15.render(angle6); s16.render(angle6); s17.render(angle6); s18.render(angle6); s19.render(angle6); s20.render(angle6); s21.render(angle6); s22.render(angle6); - f1.render(angle6); - f2.render(angle6); - f3.render(angle6); - f4.render(angle6); - f5.render(angle6); - f6.render(angle6); - f7.render(angle6); - f8.render(angle6); - f9.render(angle6); - f10.render(angle6); - f11.render(angle6); - f12.render(angle6); - f13.render(angle6); - f14.render(angle6); - f15.render(angle6); - f16.render(angle6); - f17.render(angle6); - f18.render(angle6); - f19.render(angle6); - f20.render(angle6); - f21.render(angle6); - f22.render(angle6); - f23.render(angle6); - f24.render(angle6); - f25.render(angle6); - f26.render(angle6); - b1.render(angle6); - b2.render(angle6); - b3.render(angle6); - b4.render(angle6); - b5.render(angle6); - b6.render(angle6); - b7.render(angle6); - b8.render(angle6); - b9.render(angle6); - b10.render(angle6); - b11.render(angle6); - b12.render(angle6); - b13.render(angle6); - b14.render(angle6); - b15.render(angle6); - b16.render(angle6); - b17.render(angle6); - b18.render(angle6); - b19.render(angle6); - b20.render(angle6); - b21.render(angle6); - b22.render(angle6); - b23.render(angle6); - b24.render(angle6); - b25.render(angle6); - b26.render(angle6); - } + @Override + public void render(Entity entity, float angle1, float angle2, + float angle3, float angle4, float angle5, float angle6) { + super.render(entity, angle1, angle2, angle3, angle4, angle5, + angle6); + setRotationAngles(angle1, angle2, angle3, angle4, angle5, angle6); + s1.render(angle6); + s2.render(angle6); + s3.render(angle6); + s4.render(angle6); + s5.render(angle6); + s6.render(angle6); + s7.render(angle6); + s8.render(angle6); + s9.render(angle6); + s10.render(angle6); + s11.render(angle6); + s12.render(angle6); + s13.render(angle6); + s14.render(angle6); + s15.render(angle6); + s16.render(angle6); + s17.render(angle6); + s18.render(angle6); + s19.render(angle6); + s20.render(angle6); + s21.render(angle6); + s22.render(angle6); + f1.render(angle6); + f2.render(angle6); + f3.render(angle6); + f4.render(angle6); + f5.render(angle6); + f6.render(angle6); + f7.render(angle6); + f8.render(angle6); + f9.render(angle6); + f10.render(angle6); + f11.render(angle6); + f12.render(angle6); + f13.render(angle6); + f14.render(angle6); + f15.render(angle6); + f16.render(angle6); + f17.render(angle6); + f18.render(angle6); + f19.render(angle6); + f20.render(angle6); + f21.render(angle6); + f22.render(angle6); + f23.render(angle6); + f24.render(angle6); + f25.render(angle6); + f26.render(angle6); + b1.render(angle6); + b2.render(angle6); + b3.render(angle6); + b4.render(angle6); + b5.render(angle6); + b6.render(angle6); + b7.render(angle6); + b8.render(angle6); + b9.render(angle6); + b10.render(angle6); + b11.render(angle6); + b12.render(angle6); + b13.render(angle6); + b14.render(angle6); + b15.render(angle6); + b16.render(angle6); + b17.render(angle6); + b18.render(angle6); + b19.render(angle6); + b20.render(angle6); + b21.render(angle6); + b22.render(angle6); + b23.render(angle6); + b24.render(angle6); + b25.render(angle6); + b26.render(angle6); + } - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } + private void setRotation(ModelRenderer model, float x, float y, + float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) - { - super.setRotationAngles(f, f1, f2, f3, f4, f5, null); - } + public void setRotationAngles(float f, float f1, float f2, float f3, + float f4, float f5) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, null); + } } diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java b/src/main/java/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java index 66be543..adf976d 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java @@ -4,162 +4,160 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class ModelJewlersCraftingBench extends ModelBase -{ - // fields - ModelRenderer Leg1; - ModelRenderer Leg2; - ModelRenderer Leg3; - ModelRenderer Leg4; - ModelRenderer Top; - ModelRenderer Support1; - ModelRenderer Support2; - ModelRenderer Support3; - ModelRenderer Support4; - ModelRenderer Support5; - ModelRenderer Support6; - ModelRenderer Support7; - ModelRenderer Support8; - - /** - * - */ - public ModelJewlersCraftingBench() - { - textureWidth = 64; - textureHeight = 32; - Leg1 = new ModelRenderer(this, 0, 0); - Leg1.addBox(0F, 0F, 0F, 2, 10, 2); - Leg1.setRotationPoint(-6F, 14F, 4F); - Leg1.setTextureSize(64, 32); - Leg1.mirror = true; - setRotation(Leg1, 0F, 0F, 0F); - Leg2 = new ModelRenderer(this, 0, 0); - Leg2.addBox(0F, 0F, 0F, 2, 10, 2); - Leg2.setRotationPoint(-6F, 14F, -6F); - Leg2.setTextureSize(64, 32); - Leg2.mirror = true; - setRotation(Leg2, 0F, 0F, 0F); - Leg3 = new ModelRenderer(this, 0, 0); - Leg3.addBox(0F, 0F, 0F, 2, 10, 2); - Leg3.setRotationPoint(4F, 14F, -6F); - Leg3.setTextureSize(64, 32); - Leg3.mirror = true; - setRotation(Leg3, 0F, 0F, 0F); - Leg4 = new ModelRenderer(this, 0, 0); - Leg4.addBox(0F, 0F, 0F, 2, 10, 2); - Leg4.setRotationPoint(4F, 14F, 4F); - Leg4.setTextureSize(64, 32); - Leg4.mirror = true; - setRotation(Leg4, 0F, 0F, 0F); - Top = new ModelRenderer(this, 0, 13); - Top.addBox(0F, 0F, 0F, 16, 1, 16); - Top.setRotationPoint(-8F, 13F, -8F); - Top.setTextureSize(64, 32); - Top.mirror = true; - setRotation(Top, 0F, 0F, 0F); - Support1 = new ModelRenderer(this, 0, 0); - Support1.addBox(0F, 0F, 0F, 3, 1, 1); - Support1.setRotationPoint(3F, 12F, 5F); - Support1.setTextureSize(64, 32); - Support1.mirror = true; - setRotation(Support1, 0F, 0F, 0F); - Support2 = new ModelRenderer(this, 0, 0); - Support2.addBox(0F, 0F, 0F, 1, 1, 3); - Support2.setRotationPoint(2F, 12F, 2F); - Support2.setTextureSize(64, 32); - Support2.mirror = true; - setRotation(Support2, 0F, 0F, 0F); - Support3 = new ModelRenderer(this, 0, 0); - Support3.addBox(0F, 0F, 0F, 1, 1, 3); - Support3.setRotationPoint(6F, 12F, 2F); - Support3.setTextureSize(64, 32); - Support3.mirror = true; - setRotation(Support3, 0F, 0F, 0F); - Support4 = new ModelRenderer(this, 0, 0); - Support4.addBox(0F, 0F, 0F, 3, 1, 1); - Support4.setRotationPoint(3F, 12F, 1F); - Support4.setTextureSize(64, 32); - Support4.mirror = true; - setRotation(Support4, 0F, 0F, 0F); - Support5 = new ModelRenderer(this, 0, 0); - Support5.addBox(0F, 0F, 0F, 1, 1, 3); - Support5.setRotationPoint(-3F, 12F, 2F); - Support5.setTextureSize(64, 32); - Support5.mirror = true; - setRotation(Support5, 0F, 0F, 0F); - Support6 = new ModelRenderer(this, 0, 0); - Support6.addBox(0F, 0F, 0F, 3, 1, 1); - Support6.setRotationPoint(-6F, 12F, 5F); - Support6.setTextureSize(64, 32); - Support6.mirror = true; - setRotation(Support6, 0F, 0F, 0F); - Support7 = new ModelRenderer(this, 0, 0); - Support7.addBox(0F, 0F, 0F, 1, 1, 3); - Support7.setRotationPoint(-7F, 12F, 2F); - Support7.setTextureSize(64, 32); - Support7.mirror = true; - setRotation(Support7, 0F, 0F, 0F); - Support8 = new ModelRenderer(this, 0, 0); - Support8.addBox(0F, 0F, 0F, 3, 1, 1); - Support8.setRotationPoint(-6F, 12F, 1F); - Support8.setTextureSize(64, 32); - Support8.mirror = true; - setRotation(Support8, 0F, 0F, 0F); - } - - /** - * @param entity - * @param f - * @param f1 - * @param f2 - * @param f3 - * @param f4 - * @param f5 - */ - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5); - Leg1.render(f5); - Leg2.render(f5); - Leg3.render(f5); - Leg4.render(f5); - Top.render(f5); - Support1.render(f5); - Support2.render(f5); - Support3.render(f5); - Support4.render(f5); - Support5.render(f5); - Support6.render(f5); - Support7.render(f5); - Support8.render(f5); - } - - /** - * @param model - * @param x - * @param y - * @param z - */ - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - - /** - * @param f - * @param f1 - * @param f2 - * @param f3 - * @param f4 - * @param f5 - */ - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) - { - super.setRotationAngles(f, f1, f2, f3, f4, f5, null); - } +public class ModelJewlersCraftingBench extends ModelBase { + // fields + ModelRenderer Leg1; + ModelRenderer Leg2; + ModelRenderer Leg3; + ModelRenderer Leg4; + ModelRenderer Top; + ModelRenderer Support1; + ModelRenderer Support2; + ModelRenderer Support3; + ModelRenderer Support4; + ModelRenderer Support5; + ModelRenderer Support6; + ModelRenderer Support7; + ModelRenderer Support8; + + /** + * + */ + public ModelJewlersCraftingBench() { + textureWidth = 64; + textureHeight = 32; + Leg1 = new ModelRenderer(this, 0, 0); + Leg1.addBox(0F, 0F, 0F, 2, 10, 2); + Leg1.setRotationPoint(-6F, 14F, 4F); + Leg1.setTextureSize(64, 32); + Leg1.mirror = true; + setRotation(Leg1, 0F, 0F, 0F); + Leg2 = new ModelRenderer(this, 0, 0); + Leg2.addBox(0F, 0F, 0F, 2, 10, 2); + Leg2.setRotationPoint(-6F, 14F, -6F); + Leg2.setTextureSize(64, 32); + Leg2.mirror = true; + setRotation(Leg2, 0F, 0F, 0F); + Leg3 = new ModelRenderer(this, 0, 0); + Leg3.addBox(0F, 0F, 0F, 2, 10, 2); + Leg3.setRotationPoint(4F, 14F, -6F); + Leg3.setTextureSize(64, 32); + Leg3.mirror = true; + setRotation(Leg3, 0F, 0F, 0F); + Leg4 = new ModelRenderer(this, 0, 0); + Leg4.addBox(0F, 0F, 0F, 2, 10, 2); + Leg4.setRotationPoint(4F, 14F, 4F); + Leg4.setTextureSize(64, 32); + Leg4.mirror = true; + setRotation(Leg4, 0F, 0F, 0F); + Top = new ModelRenderer(this, 0, 13); + Top.addBox(0F, 0F, 0F, 16, 1, 16); + Top.setRotationPoint(-8F, 13F, -8F); + Top.setTextureSize(64, 32); + Top.mirror = true; + setRotation(Top, 0F, 0F, 0F); + Support1 = new ModelRenderer(this, 0, 0); + Support1.addBox(0F, 0F, 0F, 3, 1, 1); + Support1.setRotationPoint(3F, 12F, 5F); + Support1.setTextureSize(64, 32); + Support1.mirror = true; + setRotation(Support1, 0F, 0F, 0F); + Support2 = new ModelRenderer(this, 0, 0); + Support2.addBox(0F, 0F, 0F, 1, 1, 3); + Support2.setRotationPoint(2F, 12F, 2F); + Support2.setTextureSize(64, 32); + Support2.mirror = true; + setRotation(Support2, 0F, 0F, 0F); + Support3 = new ModelRenderer(this, 0, 0); + Support3.addBox(0F, 0F, 0F, 1, 1, 3); + Support3.setRotationPoint(6F, 12F, 2F); + Support3.setTextureSize(64, 32); + Support3.mirror = true; + setRotation(Support3, 0F, 0F, 0F); + Support4 = new ModelRenderer(this, 0, 0); + Support4.addBox(0F, 0F, 0F, 3, 1, 1); + Support4.setRotationPoint(3F, 12F, 1F); + Support4.setTextureSize(64, 32); + Support4.mirror = true; + setRotation(Support4, 0F, 0F, 0F); + Support5 = new ModelRenderer(this, 0, 0); + Support5.addBox(0F, 0F, 0F, 1, 1, 3); + Support5.setRotationPoint(-3F, 12F, 2F); + Support5.setTextureSize(64, 32); + Support5.mirror = true; + setRotation(Support5, 0F, 0F, 0F); + Support6 = new ModelRenderer(this, 0, 0); + Support6.addBox(0F, 0F, 0F, 3, 1, 1); + Support6.setRotationPoint(-6F, 12F, 5F); + Support6.setTextureSize(64, 32); + Support6.mirror = true; + setRotation(Support6, 0F, 0F, 0F); + Support7 = new ModelRenderer(this, 0, 0); + Support7.addBox(0F, 0F, 0F, 1, 1, 3); + Support7.setRotationPoint(-7F, 12F, 2F); + Support7.setTextureSize(64, 32); + Support7.mirror = true; + setRotation(Support7, 0F, 0F, 0F); + Support8 = new ModelRenderer(this, 0, 0); + Support8.addBox(0F, 0F, 0F, 3, 1, 1); + Support8.setRotationPoint(-6F, 12F, 1F); + Support8.setTextureSize(64, 32); + Support8.mirror = true; + setRotation(Support8, 0F, 0F, 0F); + } + + /** + * @param entity + * @param f + * @param f1 + * @param f2 + * @param f3 + * @param f4 + * @param f5 + */ + @Override + public void render(Entity entity, float f, float f1, float f2, + float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5); + Leg1.render(f5); + Leg2.render(f5); + Leg3.render(f5); + Leg4.render(f5); + Top.render(f5); + Support1.render(f5); + Support2.render(f5); + Support3.render(f5); + Support4.render(f5); + Support5.render(f5); + Support6.render(f5); + Support7.render(f5); + Support8.render(f5); + } + + /** + * @param model + * @param x + * @param y + * @param z + */ + private void setRotation(ModelRenderer model, float x, float y, + float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + /** + * @param f + * @param f1 + * @param f2 + * @param f3 + * @param f4 + * @param f5 + */ + public void setRotationAngles(float f, float f1, float f2, float f3, + float f4, float f5) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, null); + } } diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelMask.java b/src/main/java/darkknight/jewelrycraft/model/ModelMask.java index 1cf6a7c..8d24ed7 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelMask.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelMask.java @@ -5,71 +5,73 @@ import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; /** - * ModelMask - OnyxDarkKnight - * Created using Tabula 4.1.1 + * ModelMask - OnyxDarkKnight Created using Tabula 4.1.1 */ public class ModelMask extends ModelBase { - public ModelRenderer shape1; - public ModelRenderer shape2; - public ModelRenderer shape3; - public ModelRenderer shape4; - public ModelRenderer shape5; - public ModelRenderer shape6; - public ModelRenderer shape7; - public ModelRenderer shape8; - public ModelRenderer shape9; + public ModelRenderer shape1; + public ModelRenderer shape2; + public ModelRenderer shape3; + public ModelRenderer shape4; + public ModelRenderer shape5; + public ModelRenderer shape6; + public ModelRenderer shape7; + public ModelRenderer shape8; + public ModelRenderer shape9; - public ModelMask() { - this.textureWidth = 64; - this.textureHeight = 64; - this.shape6 = new ModelRenderer(this, 41, 4); - this.shape6.setRotationPoint(11.0F, 0.0F, 3.0F); - this.shape6.addBox(0.0F, 0.0F, 0.0F, 1, 15, 1, 0.0F); - this.shape7 = new ModelRenderer(this, 41, 4); - this.shape7.setRotationPoint(-3.0F, 0.0F, 3.0F); - this.shape7.addBox(0.0F, 0.0F, 0.0F, 1, 15, 1, 0.0F); - this.shape4 = new ModelRenderer(this, 31, 2); - this.shape4.setRotationPoint(-2.0F, 0.0F, 2.0F); - this.shape4.addBox(0.0F, 0.0F, 0.0F, 1, 17, 1, 0.0F); - this.shape1 = new ModelRenderer(this, 0, 0); - this.shape1.setRotationPoint(0.0F, 0.0F, 0.0F); - this.shape1.addBox(0.0F, 0.0F, 0.0F, 9, 19, 1, 0.0F); - this.shape9 = new ModelRenderer(this, 46, 8); - this.shape9.setRotationPoint(12.0F, 1.0F, 4.0F); - this.shape9.addBox(0.0F, 0.0F, 0.0F, 1, 11, 1, 0.0F); - this.shape5 = new ModelRenderer(this, 36, 2); - this.shape5.setRotationPoint(10.0F, 0.0F, 2.0F); - this.shape5.addBox(0.0F, 0.0F, 0.0F, 1, 17, 1, 0.0F); - this.shape8 = new ModelRenderer(this, 46, 8); - this.shape8.setRotationPoint(-4.0F, 1.0F, 4.0F); - this.shape8.addBox(0.0F, 0.0F, 0.0F, 1, 11, 1, 0.0F); - this.shape3 = new ModelRenderer(this, 26, 1); - this.shape3.setRotationPoint(9.0F, 0.0F, 1.0F); - this.shape3.addBox(0.0F, 0.0F, 0.0F, 1, 18, 1, 0.0F); - this.shape2 = new ModelRenderer(this, 21, 1); - this.shape2.setRotationPoint(-1.0F, 0.0F, 1.0F); - this.shape2.addBox(0.0F, 0.0F, 0.0F, 1, 18, 1, 0.0F); - } + public ModelMask() { + this.textureWidth = 64; + this.textureHeight = 64; + this.shape6 = new ModelRenderer(this, 41, 4); + this.shape6.setRotationPoint(11.0F, 0.0F, 3.0F); + this.shape6.addBox(0.0F, 0.0F, 0.0F, 1, 15, 1, 0.0F); + this.shape7 = new ModelRenderer(this, 41, 4); + this.shape7.setRotationPoint(-3.0F, 0.0F, 3.0F); + this.shape7.addBox(0.0F, 0.0F, 0.0F, 1, 15, 1, 0.0F); + this.shape4 = new ModelRenderer(this, 31, 2); + this.shape4.setRotationPoint(-2.0F, 0.0F, 2.0F); + this.shape4.addBox(0.0F, 0.0F, 0.0F, 1, 17, 1, 0.0F); + this.shape1 = new ModelRenderer(this, 0, 0); + this.shape1.setRotationPoint(0.0F, 0.0F, 0.0F); + this.shape1.addBox(0.0F, 0.0F, 0.0F, 9, 19, 1, 0.0F); + this.shape9 = new ModelRenderer(this, 46, 8); + this.shape9.setRotationPoint(12.0F, 1.0F, 4.0F); + this.shape9.addBox(0.0F, 0.0F, 0.0F, 1, 11, 1, 0.0F); + this.shape5 = new ModelRenderer(this, 36, 2); + this.shape5.setRotationPoint(10.0F, 0.0F, 2.0F); + this.shape5.addBox(0.0F, 0.0F, 0.0F, 1, 17, 1, 0.0F); + this.shape8 = new ModelRenderer(this, 46, 8); + this.shape8.setRotationPoint(-4.0F, 1.0F, 4.0F); + this.shape8.addBox(0.0F, 0.0F, 0.0F, 1, 11, 1, 0.0F); + this.shape3 = new ModelRenderer(this, 26, 1); + this.shape3.setRotationPoint(9.0F, 0.0F, 1.0F); + this.shape3.addBox(0.0F, 0.0F, 0.0F, 1, 18, 1, 0.0F); + this.shape2 = new ModelRenderer(this, 21, 1); + this.shape2.setRotationPoint(-1.0F, 0.0F, 1.0F); + this.shape2.addBox(0.0F, 0.0F, 0.0F, 1, 18, 1, 0.0F); + } - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { - this.shape6.render(f5); - this.shape7.render(f5); - this.shape4.render(f5); - this.shape1.render(f5); - this.shape9.render(f5); - this.shape5.render(f5); - this.shape8.render(f5); - this.shape3.render(f5); - this.shape2.render(f5); - } + @Override + public void render(Entity entity, float f, float f1, float f2, + float f3, float f4, float f5) { + this.shape6.render(f5); + this.shape7.render(f5); + this.shape4.render(f5); + this.shape1.render(f5); + this.shape9.render(f5); + this.shape5.render(f5); + this.shape8.render(f5); + this.shape3.render(f5); + this.shape2.render(f5); + } - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } + /** + * This is a helper function from Tabula to set the rotation of model + * parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, + float y, float z) { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelMolder.java b/src/main/java/darkknight/jewelrycraft/model/ModelMolder.java index f2bc335..7fdd195 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelMolder.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelMolder.java @@ -4,98 +4,96 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class ModelMolder extends ModelBase -{ - // fields - ModelRenderer Base; - ModelRenderer Side; - ModelRenderer Side1; - ModelRenderer Side2; - ModelRenderer Side3; - - /** - * - */ - public ModelMolder() - { - textureWidth = 64; - textureHeight = 32; - Base = new ModelRenderer(this, 0, 0); - Base.addBox(0F, 0F, 0F, 10, 1, 10); - Base.setRotationPoint(-5F, 23F, -5F); - Base.setTextureSize(64, 32); - Base.mirror = true; - setRotation(Base, 0F, 0F, 0F); - Side = new ModelRenderer(this, 0, 13); - Side.addBox(0F, 0F, 0F, 10, 2, 1); - Side.setRotationPoint(-5F, 21F, 5F); - Side.setTextureSize(64, 32); - Side.mirror = true; - setRotation(Side, 0F, 0F, 0F); - Side1 = new ModelRenderer(this, 0, 13); - Side1.addBox(0F, 0F, 0F, 10, 2, 1); - Side1.setRotationPoint(-5F, 21F, -6F); - Side1.setTextureSize(64, 32); - Side1.mirror = true; - setRotation(Side1, 0F, 0F, 0F); - Side2 = new ModelRenderer(this, 41, 0); - Side2.addBox(0F, 0F, 0F, 1, 2, 10); - Side2.setRotationPoint(-6F, 21F, -5F); - Side2.setTextureSize(64, 32); - Side2.mirror = true; - setRotation(Side2, 0F, 0F, 0F); - Side3 = new ModelRenderer(this, 41, 0); - Side3.addBox(0F, 0F, 0F, 1, 2, 10); - Side3.setRotationPoint(5F, 21F, -5F); - Side3.setTextureSize(64, 32); - Side3.mirror = true; - setRotation(Side3, 0F, 0F, 0F); - } - - /** - * @param entity - * @param f - * @param f1 - * @param f2 - * @param f3 - * @param f4 - * @param f5 - */ - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5); - Base.render(f5); - Side.render(f5); - Side1.render(f5); - Side2.render(f5); - Side3.render(f5); - } - - /** - * @param model - * @param x - * @param y - * @param z - */ - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - - /** - * @param f - * @param f1 - * @param f2 - * @param f3 - * @param f4 - * @param f5 - */ - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) - { - super.setRotationAngles(f, f1, f2, f3, f4, f5, null); - } +public class ModelMolder extends ModelBase { + // fields + ModelRenderer Base; + ModelRenderer Side; + ModelRenderer Side1; + ModelRenderer Side2; + ModelRenderer Side3; + + /** + * + */ + public ModelMolder() { + textureWidth = 64; + textureHeight = 32; + Base = new ModelRenderer(this, 0, 0); + Base.addBox(0F, 0F, 0F, 10, 1, 10); + Base.setRotationPoint(-5F, 23F, -5F); + Base.setTextureSize(64, 32); + Base.mirror = true; + setRotation(Base, 0F, 0F, 0F); + Side = new ModelRenderer(this, 0, 13); + Side.addBox(0F, 0F, 0F, 10, 2, 1); + Side.setRotationPoint(-5F, 21F, 5F); + Side.setTextureSize(64, 32); + Side.mirror = true; + setRotation(Side, 0F, 0F, 0F); + Side1 = new ModelRenderer(this, 0, 13); + Side1.addBox(0F, 0F, 0F, 10, 2, 1); + Side1.setRotationPoint(-5F, 21F, -6F); + Side1.setTextureSize(64, 32); + Side1.mirror = true; + setRotation(Side1, 0F, 0F, 0F); + Side2 = new ModelRenderer(this, 41, 0); + Side2.addBox(0F, 0F, 0F, 1, 2, 10); + Side2.setRotationPoint(-6F, 21F, -5F); + Side2.setTextureSize(64, 32); + Side2.mirror = true; + setRotation(Side2, 0F, 0F, 0F); + Side3 = new ModelRenderer(this, 41, 0); + Side3.addBox(0F, 0F, 0F, 1, 2, 10); + Side3.setRotationPoint(5F, 21F, -5F); + Side3.setTextureSize(64, 32); + Side3.mirror = true; + setRotation(Side3, 0F, 0F, 0F); + } + + /** + * @param entity + * @param f + * @param f1 + * @param f2 + * @param f3 + * @param f4 + * @param f5 + */ + @Override + public void render(Entity entity, float f, float f1, float f2, + float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5); + Base.render(f5); + Side.render(f5); + Side1.render(f5); + Side2.render(f5); + Side3.render(f5); + } + + /** + * @param model + * @param x + * @param y + * @param z + */ + private void setRotation(ModelRenderer model, float x, float y, + float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + /** + * @param f + * @param f1 + * @param f2 + * @param f3 + * @param f4 + * @param f5 + */ + public void setRotationAngles(float f, float f1, float f2, float f3, + float f4, float f5) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, null); + } } diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelNeckalce.java b/src/main/java/darkknight/jewelrycraft/model/ModelNeckalce.java index 7fec995..f6db653 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelNeckalce.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelNeckalce.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.model; import org.lwjgl.opengl.GL11; + import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; @@ -8,166 +9,228 @@ import net.minecraft.entity.Entity; /** * ModelNeckalce - OnyxDarkKnight Created using Tabula 4.1.1 */ -public class ModelNeckalce extends ModelBase -{ - public ModelRenderer neck1; - public ModelRenderer neck2; - public ModelRenderer neck3; - public ModelRenderer neck4; - public ModelRenderer neck5; - public ModelRenderer neck6; - public ModelRenderer neck7; - public ModelRenderer neck8; - public ModelRenderer neck9; - public ModelRenderer gem; - - public ModelNeckalce() - { - this.textureWidth = 32; - this.textureHeight = 32; - this.neck1 = new ModelRenderer(this, 0, 0); - this.neck1.setRotationPoint(2.0F, 0.0F, -2.5F); - this.neck1.addBox(0.0F, 0.0F, 0.0F, 1, 4, 1, 0.0F); - this.neck7 = new ModelRenderer(this, 0, 0); - this.neck7.setRotationPoint(-1.0F, 3.5F, -2.5F); - this.neck7.addBox(0.0F, 0.0F, 0.0F, 1, 2, 1, 0.0F); - this.neck8 = new ModelRenderer(this, 0, 0); - this.neck8.setRotationPoint(0.7F, 3.5F, -2.5F); - this.neck8.addBox(0.0F, 0.0F, 0.0F, 1, 2, 1, 0.0F); - this.neck3 = new ModelRenderer(this, 0, 0); - this.neck3.setRotationPoint(-2.0F, 1.5F, -2.5F); - this.neck3.addBox(0.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); - this.neck6 = new ModelRenderer(this, 0, 0); - this.neck6.setRotationPoint(-1.5F, 2.5F, -2.5F); - this.neck6.addBox(0.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); - this.neck9 = new ModelRenderer(this, 0, 0); - this.neck9.setRotationPoint(-0.75F, 4.0F, -2.5F); - this.neck9.addBox(0.0F, 0.0F, 0.0F, 3, 3, 1, 0.0F); - this.neck4 = new ModelRenderer(this, 0, 0); - this.neck4.setRotationPoint(1.5F, 1.5F, -2.5F); - this.neck4.addBox(0.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); - this.neck2 = new ModelRenderer(this, 0, 0); - this.neck2.setRotationPoint(-2.5F, 0.0F, -2.5F); - this.neck2.addBox(0.0F, 0.0F, 0.0F, 1, 4, 1, 0.0F); - this.gem = new ModelRenderer(this, 9, 0); - this.gem.setRotationPoint(-0.5F, 4.25F, -2.75F); - this.gem.addBox(0.0F, 0.0F, 0.0F, 4, 4, 1, 0.0F); - this.neck5 = new ModelRenderer(this, 0, 0); - this.neck5.setRotationPoint(1.0F, 2.5F, -2.5F); - this.neck5.addBox(0.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); - } - - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { -// GL11.glDisable(GL11.GL_LIGHTING); - if ((int)f3 != -1){ - int ingotColor = (int)f3; - int red = (ingotColor >> 16) & 0xff; - int green = (ingotColor >> 8) & 0xff; - int blue = ingotColor & 0xff; - GL11.glColor3f((float)red / 255, (float)green / 255, (float)blue / 255); - GL11.glPushMatrix(); - GL11.glTranslatef(this.neck1.offsetX, this.neck1.offsetY, this.neck1.offsetZ); - GL11.glTranslatef(this.neck1.rotationPointX * f5, this.neck1.rotationPointY * f5, this.neck1.rotationPointZ * f5); - GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.neck1.offsetX, -this.neck1.offsetY, -this.neck1.offsetZ); - GL11.glTranslatef(-this.neck1.rotationPointX * f5, -this.neck1.rotationPointY * f5, -this.neck1.rotationPointZ * f5); - this.neck1.render(f5); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glTranslatef(this.neck7.offsetX, this.neck7.offsetY, this.neck7.offsetZ); - GL11.glTranslatef(this.neck7.rotationPointX * f5, this.neck7.rotationPointY * f5, this.neck7.rotationPointZ * f5); - GL11.glScaled(0.3D, 0.5D, 0.5D); - GL11.glTranslatef(-this.neck7.offsetX, -this.neck7.offsetY, -this.neck7.offsetZ); - GL11.glTranslatef(-this.neck7.rotationPointX * f5, -this.neck7.rotationPointY * f5, -this.neck7.rotationPointZ * f5); - this.neck7.render(f5); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glTranslatef(this.neck8.offsetX, this.neck8.offsetY, this.neck8.offsetZ); - GL11.glTranslatef(this.neck8.rotationPointX * f5, this.neck8.rotationPointY * f5, this.neck8.rotationPointZ * f5); - GL11.glScaled(0.3D, 0.5D, 0.5D); - GL11.glTranslatef(-this.neck8.offsetX, -this.neck8.offsetY, -this.neck8.offsetZ); - GL11.glTranslatef(-this.neck8.rotationPointX * f5, -this.neck8.rotationPointY * f5, -this.neck8.rotationPointZ * f5); - this.neck8.render(f5); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glTranslatef(this.neck3.offsetX, this.neck3.offsetY, this.neck3.offsetZ); - GL11.glTranslatef(this.neck3.rotationPointX * f5, this.neck3.rotationPointY * f5, this.neck3.rotationPointZ * f5); - GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.neck3.offsetX, -this.neck3.offsetY, -this.neck3.offsetZ); - GL11.glTranslatef(-this.neck3.rotationPointX * f5, -this.neck3.rotationPointY * f5, -this.neck3.rotationPointZ * f5); - this.neck3.render(f5); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glTranslatef(this.neck6.offsetX, this.neck6.offsetY, this.neck6.offsetZ); - GL11.glTranslatef(this.neck6.rotationPointX * f5, this.neck6.rotationPointY * f5, this.neck6.rotationPointZ * f5); - GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.neck6.offsetX, -this.neck6.offsetY, -this.neck6.offsetZ); - GL11.glTranslatef(-this.neck6.rotationPointX * f5, -this.neck6.rotationPointY * f5, -this.neck6.rotationPointZ * f5); - this.neck6.render(f5); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glTranslatef(this.neck9.offsetX, this.neck9.offsetY, this.neck9.offsetZ); - GL11.glTranslatef(this.neck9.rotationPointX * f5, this.neck9.rotationPointY * f5, this.neck9.rotationPointZ * f5); - GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.neck9.offsetX, -this.neck9.offsetY, -this.neck9.offsetZ); - GL11.glTranslatef(-this.neck9.rotationPointX * f5, -this.neck9.rotationPointY * f5, -this.neck9.rotationPointZ * f5); - this.neck9.render(f5); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glTranslatef(this.neck4.offsetX, this.neck4.offsetY, this.neck4.offsetZ); - GL11.glTranslatef(this.neck4.rotationPointX * f5, this.neck4.rotationPointY * f5, this.neck4.rotationPointZ * f5); - GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.neck4.offsetX, -this.neck4.offsetY, -this.neck4.offsetZ); - GL11.glTranslatef(-this.neck4.rotationPointX * f5, -this.neck4.rotationPointY * f5, -this.neck4.rotationPointZ * f5); - this.neck4.render(f5); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glTranslatef(this.neck2.offsetX, this.neck2.offsetY, this.neck2.offsetZ); - GL11.glTranslatef(this.neck2.rotationPointX * f5, this.neck2.rotationPointY * f5, this.neck2.rotationPointZ * f5); - GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.neck2.offsetX, -this.neck2.offsetY, -this.neck2.offsetZ); - GL11.glTranslatef(-this.neck2.rotationPointX * f5, -this.neck2.rotationPointY * f5, -this.neck2.rotationPointZ * f5); - this.neck2.render(f5); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glTranslatef(this.neck5.offsetX, this.neck5.offsetY, this.neck5.offsetZ); - GL11.glTranslatef(this.neck5.rotationPointX * f5, this.neck5.rotationPointY * f5, this.neck5.rotationPointZ * f5); - GL11.glScaled(0.5D, 0.5D, 0.5D); - GL11.glTranslatef(-this.neck5.offsetX, -this.neck5.offsetY, -this.neck5.offsetZ); - GL11.glTranslatef(-this.neck5.rotationPointX * f5, -this.neck5.rotationPointY * f5, -this.neck5.rotationPointZ * f5); - this.neck5.render(f5); - GL11.glPopMatrix(); - } - if ((int)f4 != -1){ - int gemColor = (int)f4; - int red = gemColor >> 16 & 0xff; - int green = gemColor >> 8 & 0xff; - int blue = gemColor & 0xff; - GL11.glColor3f((float)red / 255, (float)green / 255, (float)blue / 255); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE_MINUS_DST_COLOR); - GL11.glPushMatrix(); - GL11.glTranslatef(this.gem.offsetX, this.gem.offsetY, this.gem.offsetZ); - GL11.glTranslatef(this.gem.rotationPointX * f5, this.gem.rotationPointY * f5, this.gem.rotationPointZ * f5); - GL11.glScaled(0.25D, 0.25D, 0.25D); - GL11.glTranslatef(-this.gem.offsetX, -this.gem.offsetY, -this.gem.offsetZ); - GL11.glTranslatef(-this.gem.rotationPointX * f5, -this.gem.rotationPointY * f5, -this.gem.rotationPointZ * f5); - this.gem.render(f5); - GL11.glPopMatrix(); - GL11.glDisable(GL11.GL_BLEND); - } -// GL11.glEnable(GL11.GL_LIGHTING); - } - - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) - { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } +public class ModelNeckalce extends ModelBase { + public ModelRenderer neck1; + public ModelRenderer neck2; + public ModelRenderer neck3; + public ModelRenderer neck4; + public ModelRenderer neck5; + public ModelRenderer neck6; + public ModelRenderer neck7; + public ModelRenderer neck8; + public ModelRenderer neck9; + public ModelRenderer gem; + + public ModelNeckalce() { + this.textureWidth = 32; + this.textureHeight = 32; + this.neck1 = new ModelRenderer(this, 0, 0); + this.neck1.setRotationPoint(2.0F, 0.0F, -2.5F); + this.neck1.addBox(0.0F, 0.0F, 0.0F, 1, 4, 1, 0.0F); + this.neck7 = new ModelRenderer(this, 0, 0); + this.neck7.setRotationPoint(-1.0F, 3.5F, -2.5F); + this.neck7.addBox(0.0F, 0.0F, 0.0F, 1, 2, 1, 0.0F); + this.neck8 = new ModelRenderer(this, 0, 0); + this.neck8.setRotationPoint(0.7F, 3.5F, -2.5F); + this.neck8.addBox(0.0F, 0.0F, 0.0F, 1, 2, 1, 0.0F); + this.neck3 = new ModelRenderer(this, 0, 0); + this.neck3.setRotationPoint(-2.0F, 1.5F, -2.5F); + this.neck3.addBox(0.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); + this.neck6 = new ModelRenderer(this, 0, 0); + this.neck6.setRotationPoint(-1.5F, 2.5F, -2.5F); + this.neck6.addBox(0.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); + this.neck9 = new ModelRenderer(this, 0, 0); + this.neck9.setRotationPoint(-0.75F, 4.0F, -2.5F); + this.neck9.addBox(0.0F, 0.0F, 0.0F, 3, 3, 1, 0.0F); + this.neck4 = new ModelRenderer(this, 0, 0); + this.neck4.setRotationPoint(1.5F, 1.5F, -2.5F); + this.neck4.addBox(0.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); + this.neck2 = new ModelRenderer(this, 0, 0); + this.neck2.setRotationPoint(-2.5F, 0.0F, -2.5F); + this.neck2.addBox(0.0F, 0.0F, 0.0F, 1, 4, 1, 0.0F); + this.gem = new ModelRenderer(this, 9, 0); + this.gem.setRotationPoint(-0.5F, 4.25F, -2.75F); + this.gem.addBox(0.0F, 0.0F, 0.0F, 4, 4, 1, 0.0F); + this.neck5 = new ModelRenderer(this, 0, 0); + this.neck5.setRotationPoint(1.0F, 2.5F, -2.5F); + this.neck5.addBox(0.0F, 0.0F, 0.0F, 1, 3, 1, 0.0F); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, + float f3, float f4, float f5) { + // GL11.glDisable(GL11.GL_LIGHTING); + if ((int) f3 != -1) { + int ingotColor = (int) f3; + int red = (ingotColor >> 16) & 0xff; + int green = (ingotColor >> 8) & 0xff; + int blue = ingotColor & 0xff; + GL11.glColor3f((float) red / 255, (float) green / 255, + (float) blue / 255); + GL11.glPushMatrix(); + GL11.glTranslatef(this.neck1.offsetX, this.neck1.offsetY, + this.neck1.offsetZ); + GL11.glTranslatef(this.neck1.rotationPointX * f5, + this.neck1.rotationPointY * f5, + this.neck1.rotationPointZ * f5); + GL11.glScaled(0.5D, 0.5D, 0.5D); + GL11.glTranslatef(-this.neck1.offsetX, -this.neck1.offsetY, + -this.neck1.offsetZ); + GL11.glTranslatef(-this.neck1.rotationPointX * f5, + -this.neck1.rotationPointY * f5, + -this.neck1.rotationPointZ * f5); + this.neck1.render(f5); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glTranslatef(this.neck7.offsetX, this.neck7.offsetY, + this.neck7.offsetZ); + GL11.glTranslatef(this.neck7.rotationPointX * f5, + this.neck7.rotationPointY * f5, + this.neck7.rotationPointZ * f5); + GL11.glScaled(0.3D, 0.5D, 0.5D); + GL11.glTranslatef(-this.neck7.offsetX, -this.neck7.offsetY, + -this.neck7.offsetZ); + GL11.glTranslatef(-this.neck7.rotationPointX * f5, + -this.neck7.rotationPointY * f5, + -this.neck7.rotationPointZ * f5); + this.neck7.render(f5); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glTranslatef(this.neck8.offsetX, this.neck8.offsetY, + this.neck8.offsetZ); + GL11.glTranslatef(this.neck8.rotationPointX * f5, + this.neck8.rotationPointY * f5, + this.neck8.rotationPointZ * f5); + GL11.glScaled(0.3D, 0.5D, 0.5D); + GL11.glTranslatef(-this.neck8.offsetX, -this.neck8.offsetY, + -this.neck8.offsetZ); + GL11.glTranslatef(-this.neck8.rotationPointX * f5, + -this.neck8.rotationPointY * f5, + -this.neck8.rotationPointZ * f5); + this.neck8.render(f5); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glTranslatef(this.neck3.offsetX, this.neck3.offsetY, + this.neck3.offsetZ); + GL11.glTranslatef(this.neck3.rotationPointX * f5, + this.neck3.rotationPointY * f5, + this.neck3.rotationPointZ * f5); + GL11.glScaled(0.5D, 0.5D, 0.5D); + GL11.glTranslatef(-this.neck3.offsetX, -this.neck3.offsetY, + -this.neck3.offsetZ); + GL11.glTranslatef(-this.neck3.rotationPointX * f5, + -this.neck3.rotationPointY * f5, + -this.neck3.rotationPointZ * f5); + this.neck3.render(f5); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glTranslatef(this.neck6.offsetX, this.neck6.offsetY, + this.neck6.offsetZ); + GL11.glTranslatef(this.neck6.rotationPointX * f5, + this.neck6.rotationPointY * f5, + this.neck6.rotationPointZ * f5); + GL11.glScaled(0.5D, 0.5D, 0.5D); + GL11.glTranslatef(-this.neck6.offsetX, -this.neck6.offsetY, + -this.neck6.offsetZ); + GL11.glTranslatef(-this.neck6.rotationPointX * f5, + -this.neck6.rotationPointY * f5, + -this.neck6.rotationPointZ * f5); + this.neck6.render(f5); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glTranslatef(this.neck9.offsetX, this.neck9.offsetY, + this.neck9.offsetZ); + GL11.glTranslatef(this.neck9.rotationPointX * f5, + this.neck9.rotationPointY * f5, + this.neck9.rotationPointZ * f5); + GL11.glScaled(0.5D, 0.5D, 0.5D); + GL11.glTranslatef(-this.neck9.offsetX, -this.neck9.offsetY, + -this.neck9.offsetZ); + GL11.glTranslatef(-this.neck9.rotationPointX * f5, + -this.neck9.rotationPointY * f5, + -this.neck9.rotationPointZ * f5); + this.neck9.render(f5); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glTranslatef(this.neck4.offsetX, this.neck4.offsetY, + this.neck4.offsetZ); + GL11.glTranslatef(this.neck4.rotationPointX * f5, + this.neck4.rotationPointY * f5, + this.neck4.rotationPointZ * f5); + GL11.glScaled(0.5D, 0.5D, 0.5D); + GL11.glTranslatef(-this.neck4.offsetX, -this.neck4.offsetY, + -this.neck4.offsetZ); + GL11.glTranslatef(-this.neck4.rotationPointX * f5, + -this.neck4.rotationPointY * f5, + -this.neck4.rotationPointZ * f5); + this.neck4.render(f5); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glTranslatef(this.neck2.offsetX, this.neck2.offsetY, + this.neck2.offsetZ); + GL11.glTranslatef(this.neck2.rotationPointX * f5, + this.neck2.rotationPointY * f5, + this.neck2.rotationPointZ * f5); + GL11.glScaled(0.5D, 0.5D, 0.5D); + GL11.glTranslatef(-this.neck2.offsetX, -this.neck2.offsetY, + -this.neck2.offsetZ); + GL11.glTranslatef(-this.neck2.rotationPointX * f5, + -this.neck2.rotationPointY * f5, + -this.neck2.rotationPointZ * f5); + this.neck2.render(f5); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glTranslatef(this.neck5.offsetX, this.neck5.offsetY, + this.neck5.offsetZ); + GL11.glTranslatef(this.neck5.rotationPointX * f5, + this.neck5.rotationPointY * f5, + this.neck5.rotationPointZ * f5); + GL11.glScaled(0.5D, 0.5D, 0.5D); + GL11.glTranslatef(-this.neck5.offsetX, -this.neck5.offsetY, + -this.neck5.offsetZ); + GL11.glTranslatef(-this.neck5.rotationPointX * f5, + -this.neck5.rotationPointY * f5, + -this.neck5.rotationPointZ * f5); + this.neck5.render(f5); + GL11.glPopMatrix(); + } + if ((int) f4 != -1) { + int gemColor = (int) f4; + int red = gemColor >> 16 & 0xff; + int green = gemColor >> 8 & 0xff; + int blue = gemColor & 0xff; + GL11.glColor3f((float) red / 255, (float) green / 255, + (float) blue / 255); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_COLOR, + GL11.GL_ONE_MINUS_DST_COLOR); + GL11.glPushMatrix(); + GL11.glTranslatef(this.gem.offsetX, this.gem.offsetY, + this.gem.offsetZ); + GL11.glTranslatef(this.gem.rotationPointX * f5, + this.gem.rotationPointY * f5, + this.gem.rotationPointZ * f5); + GL11.glScaled(0.25D, 0.25D, 0.25D); + GL11.glTranslatef(-this.gem.offsetX, -this.gem.offsetY, + -this.gem.offsetZ); + GL11.glTranslatef(-this.gem.rotationPointX * f5, + -this.gem.rotationPointY * f5, + -this.gem.rotationPointZ * f5); + this.gem.render(f5); + GL11.glPopMatrix(); + GL11.glDisable(GL11.GL_BLEND); + } + // GL11.glEnable(GL11.GL_LIGHTING); + } + + /** + * This is a helper function from Tabula to set the rotation of model + * parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, + float y, float z) { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelRing.java b/src/main/java/darkknight/jewelrycraft/model/ModelRing.java index d15c095..d2f11c9 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelRing.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelRing.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.model; import org.lwjgl.opengl.GL11; + import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; @@ -8,117 +9,155 @@ import net.minecraft.entity.Entity; /** * ModelRing - OnyxDarkKnight Created using Tabula 4.1.1 */ -public class ModelRing extends ModelBase -{ - public ModelRenderer ring1; - public ModelRenderer ring2; - public ModelRenderer ring3; - public ModelRenderer gem; - public ModelRenderer gem1; - public ModelRenderer gem2; - - public ModelRing() - { - this.textureWidth = 32; - this.textureHeight = 32; - this.ring1 = new ModelRenderer(this, 0, 0); - this.ring1.setRotationPoint(-8.6F, 11.4F, -2.15F); - this.ring1.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); - this.ring3 = new ModelRenderer(this, 0, 0); - this.ring3.setRotationPoint(-8.5F, 11.4F, -2.15F); - this.ring3.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); - this.gem = new ModelRenderer(this, 5, 0); - this.gem.setRotationPoint(-8.5F, 11.5F, -2.25F); - this.gem.addBox(0.0F, 0.0F, 0.0F, 2, 1, 1, 0.0F); - this.gem1 = new ModelRenderer(this, 6, 0); - this.gem1.setRotationPoint(-8.45F, 11.45F, -2.25F); - this.gem1.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); - this.ring2 = new ModelRenderer(this, 0, 0); - this.ring2.setRotationPoint(-8.3F, 11.4F, -2.15F); - this.ring2.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); - this.gem2 = new ModelRenderer(this, 6, 0); - this.gem2.setRotationPoint(-8.45F, 11.6F, -2.25F); - this.gem2.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); - } - - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { -// GL11.glEnable(GL11.GL_LIGHTING); - if ((int)f3 != -1){ - int ingotColor = (int)f3; - int red = (ingotColor >> 16) & 0xff; - int green = (ingotColor >> 8) & 0xff; - int blue = ingotColor & 0xff; - GL11.glColor3f((float)red / 255, (float)green / 255, (float)blue / 255); - GL11.glPushMatrix(); - GL11.glTranslatef(this.ring1.offsetX, this.ring1.offsetY, this.ring1.offsetZ); - GL11.glTranslatef(this.ring1.rotationPointX * f5, this.ring1.rotationPointY * f5, this.ring1.rotationPointZ * f5); - GL11.glScaled(0.1D, 0.3D, 0.3D); - GL11.glTranslatef(-this.ring1.offsetX, -this.ring1.offsetY, -this.ring1.offsetZ); - GL11.glTranslatef(-this.ring1.rotationPointX * f5, -this.ring1.rotationPointY * f5, -this.ring1.rotationPointZ * f5); - this.ring1.render(f5); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glTranslatef(this.ring2.offsetX, this.ring2.offsetY, this.ring2.offsetZ); - GL11.glTranslatef(this.ring2.rotationPointX * f5, this.ring2.rotationPointY * f5, this.ring2.rotationPointZ * f5); - GL11.glScaled(0.1D, 0.3D, 0.3D); - GL11.glTranslatef(-this.ring2.offsetX, -this.ring2.offsetY, -this.ring2.offsetZ); - GL11.glTranslatef(-this.ring2.rotationPointX * f5, -this.ring2.rotationPointY * f5, -this.ring2.rotationPointZ * f5); - this.ring2.render(f5); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glTranslatef(this.ring3.offsetX, this.ring3.offsetY, this.ring3.offsetZ); - GL11.glTranslatef(this.ring3.rotationPointX * f5, this.ring3.rotationPointY * f5, this.ring3.rotationPointZ * f5); - GL11.glScaled(0.2D, 0.3D, 0.1D); - GL11.glTranslatef(-this.ring3.offsetX, -this.ring3.offsetY, -this.ring3.offsetZ); - GL11.glTranslatef(-this.ring3.rotationPointX * f5, -this.ring3.rotationPointY * f5, -this.ring3.rotationPointZ * f5); - this.ring3.render(f5); - GL11.glPopMatrix(); - } - if ((int)f4 != -1){ - int gemColor = (int)f4; - int red = gemColor >> 16 & 0xff; - int green = gemColor >> 8 & 0xff; - int blue = gemColor & 0xff; - GL11.glColor3f((float)red / 255, (float)green / 255, (float)blue / 255); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE_MINUS_DST_COLOR); - GL11.glPushMatrix(); - GL11.glTranslatef(this.gem.offsetX, this.gem.offsetY, this.gem.offsetZ); - GL11.glTranslatef(this.gem.rotationPointX * f5, this.gem.rotationPointY * f5, this.gem.rotationPointZ * f5); - GL11.glScaled(0.1D, 0.1D, 0.1D); - GL11.glTranslatef(-this.gem.offsetX, -this.gem.offsetY, -this.gem.offsetZ); - GL11.glTranslatef(-this.gem.rotationPointX * f5, -this.gem.rotationPointY * f5, -this.gem.rotationPointZ * f5); - this.gem.render(f5); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glTranslatef(this.gem1.offsetX, this.gem1.offsetY, this.gem1.offsetZ); - GL11.glTranslatef(this.gem1.rotationPointX * f5, this.gem1.rotationPointY * f5, this.gem1.rotationPointZ * f5); - GL11.glScaled(0.1D, 0.05D, 0.1D); - GL11.glTranslatef(-this.gem1.offsetX, -this.gem1.offsetY, -this.gem1.offsetZ); - GL11.glTranslatef(-this.gem1.rotationPointX * f5, -this.gem1.rotationPointY * f5, -this.gem1.rotationPointZ * f5); - this.gem1.render(f5); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - GL11.glTranslatef(this.gem2.offsetX, this.gem2.offsetY, this.gem2.offsetZ); - GL11.glTranslatef(this.gem2.rotationPointX * f5, this.gem2.rotationPointY * f5, this.gem2.rotationPointZ * f5); - GL11.glScaled(0.1D, 0.05D, 0.1D); - GL11.glTranslatef(-this.gem2.offsetX, -this.gem2.offsetY, -this.gem2.offsetZ); - GL11.glTranslatef(-this.gem2.rotationPointX * f5, -this.gem2.rotationPointY * f5, -this.gem2.rotationPointZ * f5); - this.gem2.render(f5); - GL11.glPopMatrix(); - GL11.glDisable(GL11.GL_BLEND); - } - } - - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) - { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } +public class ModelRing extends ModelBase { + public ModelRenderer ring1; + public ModelRenderer ring2; + public ModelRenderer ring3; + public ModelRenderer gem; + public ModelRenderer gem1; + public ModelRenderer gem2; + + public ModelRing() { + this.textureWidth = 32; + this.textureHeight = 32; + this.ring1 = new ModelRenderer(this, 0, 0); + this.ring1.setRotationPoint(-8.6F, 11.4F, -2.15F); + this.ring1.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); + this.ring3 = new ModelRenderer(this, 0, 0); + this.ring3.setRotationPoint(-8.5F, 11.4F, -2.15F); + this.ring3.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); + this.gem = new ModelRenderer(this, 5, 0); + this.gem.setRotationPoint(-8.5F, 11.5F, -2.25F); + this.gem.addBox(0.0F, 0.0F, 0.0F, 2, 1, 1, 0.0F); + this.gem1 = new ModelRenderer(this, 6, 0); + this.gem1.setRotationPoint(-8.45F, 11.45F, -2.25F); + this.gem1.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); + this.ring2 = new ModelRenderer(this, 0, 0); + this.ring2.setRotationPoint(-8.3F, 11.4F, -2.15F); + this.ring2.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); + this.gem2 = new ModelRenderer(this, 6, 0); + this.gem2.setRotationPoint(-8.45F, 11.6F, -2.25F); + this.gem2.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, + float f3, float f4, float f5) { + // GL11.glEnable(GL11.GL_LIGHTING); + if ((int) f3 != -1) { + int ingotColor = (int) f3; + int red = (ingotColor >> 16) & 0xff; + int green = (ingotColor >> 8) & 0xff; + int blue = ingotColor & 0xff; + GL11.glColor3f((float) red / 255, (float) green / 255, + (float) blue / 255); + GL11.glPushMatrix(); + GL11.glTranslatef(this.ring1.offsetX, this.ring1.offsetY, + this.ring1.offsetZ); + GL11.glTranslatef(this.ring1.rotationPointX * f5, + this.ring1.rotationPointY * f5, + this.ring1.rotationPointZ * f5); + GL11.glScaled(0.1D, 0.3D, 0.3D); + GL11.glTranslatef(-this.ring1.offsetX, -this.ring1.offsetY, + -this.ring1.offsetZ); + GL11.glTranslatef(-this.ring1.rotationPointX * f5, + -this.ring1.rotationPointY * f5, + -this.ring1.rotationPointZ * f5); + this.ring1.render(f5); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glTranslatef(this.ring2.offsetX, this.ring2.offsetY, + this.ring2.offsetZ); + GL11.glTranslatef(this.ring2.rotationPointX * f5, + this.ring2.rotationPointY * f5, + this.ring2.rotationPointZ * f5); + GL11.glScaled(0.1D, 0.3D, 0.3D); + GL11.glTranslatef(-this.ring2.offsetX, -this.ring2.offsetY, + -this.ring2.offsetZ); + GL11.glTranslatef(-this.ring2.rotationPointX * f5, + -this.ring2.rotationPointY * f5, + -this.ring2.rotationPointZ * f5); + this.ring2.render(f5); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glTranslatef(this.ring3.offsetX, this.ring3.offsetY, + this.ring3.offsetZ); + GL11.glTranslatef(this.ring3.rotationPointX * f5, + this.ring3.rotationPointY * f5, + this.ring3.rotationPointZ * f5); + GL11.glScaled(0.2D, 0.3D, 0.1D); + GL11.glTranslatef(-this.ring3.offsetX, -this.ring3.offsetY, + -this.ring3.offsetZ); + GL11.glTranslatef(-this.ring3.rotationPointX * f5, + -this.ring3.rotationPointY * f5, + -this.ring3.rotationPointZ * f5); + this.ring3.render(f5); + GL11.glPopMatrix(); + } + if ((int) f4 != -1) { + int gemColor = (int) f4; + int red = gemColor >> 16 & 0xff; + int green = gemColor >> 8 & 0xff; + int blue = gemColor & 0xff; + GL11.glColor3f((float) red / 255, (float) green / 255, + (float) blue / 255); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_COLOR, + GL11.GL_ONE_MINUS_DST_COLOR); + GL11.glPushMatrix(); + GL11.glTranslatef(this.gem.offsetX, this.gem.offsetY, + this.gem.offsetZ); + GL11.glTranslatef(this.gem.rotationPointX * f5, + this.gem.rotationPointY * f5, + this.gem.rotationPointZ * f5); + GL11.glScaled(0.1D, 0.1D, 0.1D); + GL11.glTranslatef(-this.gem.offsetX, -this.gem.offsetY, + -this.gem.offsetZ); + GL11.glTranslatef(-this.gem.rotationPointX * f5, + -this.gem.rotationPointY * f5, + -this.gem.rotationPointZ * f5); + this.gem.render(f5); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glTranslatef(this.gem1.offsetX, this.gem1.offsetY, + this.gem1.offsetZ); + GL11.glTranslatef(this.gem1.rotationPointX * f5, + this.gem1.rotationPointY * f5, + this.gem1.rotationPointZ * f5); + GL11.glScaled(0.1D, 0.05D, 0.1D); + GL11.glTranslatef(-this.gem1.offsetX, -this.gem1.offsetY, + -this.gem1.offsetZ); + GL11.glTranslatef(-this.gem1.rotationPointX * f5, + -this.gem1.rotationPointY * f5, + -this.gem1.rotationPointZ * f5); + this.gem1.render(f5); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glTranslatef(this.gem2.offsetX, this.gem2.offsetY, + this.gem2.offsetZ); + GL11.glTranslatef(this.gem2.rotationPointX * f5, + this.gem2.rotationPointY * f5, + this.gem2.rotationPointZ * f5); + GL11.glScaled(0.1D, 0.05D, 0.1D); + GL11.glTranslatef(-this.gem2.offsetX, -this.gem2.offsetY, + -this.gem2.offsetZ); + GL11.glTranslatef(-this.gem2.rotationPointX * f5, + -this.gem2.rotationPointY * f5, + -this.gem2.rotationPointZ * f5); + this.gem2.render(f5); + GL11.glPopMatrix(); + GL11.glDisable(GL11.GL_BLEND); + } + } + + /** + * This is a helper function from Tabula to set the rotation of model + * parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, + float y, float z) { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelShadowEye.java b/src/main/java/darkknight/jewelrycraft/model/ModelShadowEye.java index e0067cd..ba3426c 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelShadowEye.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelShadowEye.java @@ -6,26 +6,27 @@ package darkknight.jewelrycraft.model; import org.lwjgl.opengl.GL11; + import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelShadowEye extends ModelBase { // fields - ModelRenderer Eye; - ModelRenderer Platform1; - ModelRenderer Platform2; - ModelRenderer Atachement1; - ModelRenderer Atachement2; - ModelRenderer Cable1; - ModelRenderer Cable2; - ModelRenderer Cable3; - ModelRenderer Cable4; - float field_82221_e, field_82220_d; + ModelRenderer Eye; + ModelRenderer Platform1; + ModelRenderer Platform2; + ModelRenderer Atachement1; + ModelRenderer Atachement2; + ModelRenderer Cable1; + ModelRenderer Cable2; + ModelRenderer Cable3; + ModelRenderer Cable4; + float field_82221_e, field_82220_d; /** - * - */ + * + */ public ModelShadowEye() { textureWidth = 64; textureHeight = 32; @@ -95,7 +96,8 @@ public class ModelShadowEye extends ModelBase { * @param f5 */ @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + public void render(Entity entity, float f, float f1, float f2, + float f3, float f4, float f5) { Platform1.render(f5); Platform2.render(f5); Atachement1.render(f5); @@ -104,29 +106,33 @@ public class ModelShadowEye extends ModelBase { Cable2.render(f5); Cable3.render(f5); Cable4.render(f5); - if(f3 == 0) GL11.glRotatef(90F, 0F, -1F, 0F); - else if(f3 == 1) GL11.glRotatef(180F, 0F, 1F, 0F); - else if(f3 == 2) GL11.glRotatef(90F, 0F, 1F, 0F); + if (f3 == 0) + GL11.glRotatef(90F, 0F, -1F, 0F); + else if (f3 == 1) + GL11.glRotatef(180F, 0F, 1F, 0F); + else if (f3 == 2) + GL11.glRotatef(90F, 0F, 1F, 0F); Eye.render(f5); - if (f4 == 4) - { + if (f4 == 4) { Eye.rotateAngleX = f; Eye.rotateAngleY = f1; - Eye.rotateAngleZ = f2; - } - else - { + Eye.rotateAngleZ = f2; + } else { Eye.rotateAngleX = 0F; Eye.rotateAngleZ = 0F; - if (f3 == 0) Eye.rotateAngleY = (float) (0.5F*Math.PI); - else if (f3 == 1) Eye.rotateAngleY = (float) (Math.PI); - else if (f3 == 2) Eye.rotateAngleY = (float) (1.5F*Math.PI); - else if (f3 == 3) Eye.rotateAngleY = (float) (0F*Math.PI); + if (f3 == 0) + Eye.rotateAngleY = (float) (0.5F * Math.PI); + else if (f3 == 1) + Eye.rotateAngleY = (float) (Math.PI); + else if (f3 == 2) + Eye.rotateAngleY = (float) (1.5F * Math.PI); + else if (f3 == 3) + Eye.rotateAngleY = (float) (0F * Math.PI); } } - public static float[] getRotation(double posX1, double posY1, double posZ1, double posX2, double posY2, double posZ2) - { + public static float[] getRotation(double posX1, double posY1, + double posZ1, double posX2, double posY2, double posZ2) { float[] rotation = new float[2]; double diffX = posX2 - posX1; double diffZ = posZ2 - posZ1; @@ -154,7 +160,8 @@ public class ModelShadowEye extends ModelBase { * @param y * @param z */ - private void setRotation(ModelRenderer model, float x, float y, float z) { + private void setRotation(ModelRenderer model, float x, float y, + float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelShadowHand.java b/src/main/java/darkknight/jewelrycraft/model/ModelShadowHand.java index 02d7eea..116ba21 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelShadowHand.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelShadowHand.java @@ -5,25 +5,22 @@ import net.minecraft.util.ResourceLocation; /** * @author Paul Fulham (pau101) */ -public class ModelShadowHand extends ModelHandPedestal -{ - - /** - * @param resetResourceLocation - */ - public ModelShadowHand(ResourceLocation resetResourceLocation) - { - super(resetResourceLocation); - } - - /** - * - */ - @Override - protected void initPedestalRenderers() - { - plinth = createModelRenderer(0, 0).addBox(-3, 6, -3, 6, 2, 6); - base = createModelRenderer(0, 15).addBox(-2, 0, -2, 4, 6, 4); - shaft = createModelRenderer(28, 0).addBox(-3, -4, -3, 6, 4, 6); - } +public class ModelShadowHand extends ModelHandPedestal { + + /** + * @param resetResourceLocation + */ + public ModelShadowHand(ResourceLocation resetResourceLocation) { + super(resetResourceLocation); + } + + /** + * + */ + @Override + protected void initPedestalRenderers() { + plinth = createModelRenderer(0, 0).addBox(-3, 6, -3, 6, 2, 6); + base = createModelRenderer(0, 15).addBox(-2, 0, -2, 4, 6, 4); + shaft = createModelRenderer(28, 0).addBox(-3, -4, -3, 6, 4, 6); + } }
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelSmelter.java b/src/main/java/darkknight/jewelrycraft/model/ModelSmelter.java index d662a71..d34d938 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/model/ModelSmelter.java +++ b/src/main/java/darkknight/jewelrycraft/model/ModelSmelter.java @@ -4,298 +4,296 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; -public class ModelSmelter extends ModelBase -{ - // fields - ModelRenderer Support1; - ModelRenderer Support2; - ModelRenderer Hold1; - ModelRenderer Hold2; - ModelRenderer SmelterBase; - ModelRenderer SmelterSide1; - ModelRenderer SmelterSide2; - ModelRenderer SmelterSide3; - ModelRenderer SmelterSide4; - ModelRenderer SmelterSide5; - ModelRenderer SmelterSide6; - ModelRenderer SmelterSide7; - ModelRenderer SmelterSide8; - ModelRenderer SmelterSide9; - ModelRenderer SmelterSide10; - ModelRenderer SmelterSide11; - ModelRenderer SmelterSide12; - ModelRenderer HeatSourceSide1; - ModelRenderer HeatSourceSide2; - ModelRenderer HeatSourceSide3; - ModelRenderer HeatSourceSide4; - ModelRenderer HeatSourceSide5; - ModelRenderer HeatSourceBase; - ModelRenderer HeatSourceSide6; - ModelRenderer HeatSourceSide7; - ModelRenderer HeatSourceSide8; - ModelRenderer HeatSourceSide9; - ModelRenderer HeatSourceSide10; - ModelRenderer HeatSourceSide11; - ModelRenderer HeatSourceSide12; - - /** - * - */ - public ModelSmelter() - { - textureWidth = 64; - textureHeight = 32; - Support1 = new ModelRenderer(this, 0, 14); - Support1.addBox(0F, 0F, 0F, 2, 15, 3); - Support1.setRotationPoint(6F, 9F, -1F); - Support1.setTextureSize(64, 32); - Support1.mirror = true; - setRotation(Support1, 0F, 0F, 0F); - Support2 = new ModelRenderer(this, 0, 14); - Support2.addBox(0F, 0F, 0F, 2, 15, 3); - Support2.setRotationPoint(-8F, 9F, -1F); - Support2.setTextureSize(64, 32); - Support2.mirror = true; - setRotation(Support2, 0F, 0F, 0F); - Hold1 = new ModelRenderer(this, 0, 14); - Hold1.addBox(0F, 0F, 0F, 2, 1, 1); - Hold1.setRotationPoint(4F, 11F, 0F); - Hold1.setTextureSize(64, 32); - Hold1.mirror = true; - setRotation(Hold1, 0F, 0F, 0F); - Hold2 = new ModelRenderer(this, 0, 14); - Hold2.addBox(0F, 0F, 0F, 2, 1, 1); - Hold2.setRotationPoint(-6F, 11F, 0F); - Hold2.setTextureSize(64, 32); - Hold2.mirror = true; - setRotation(Hold2, 0F, 0F, 0F); - SmelterBase = new ModelRenderer(this, 0, 0); - SmelterBase.addBox(0F, 0F, 0F, 4, 1, 5); - SmelterBase.setRotationPoint(-2F, 18F, -2F); - SmelterBase.setTextureSize(64, 32); - SmelterBase.mirror = true; - setRotation(SmelterBase, 0F, 0F, 0F); - SmelterSide1 = new ModelRenderer(this, 0, 0); - SmelterSide1.addBox(0F, 0F, 0F, 4, 2, 1); - SmelterSide1.setRotationPoint(-2F, 16F, -3F); - SmelterSide1.setTextureSize(64, 32); - SmelterSide1.mirror = true; - setRotation(SmelterSide1, 0F, 0F, 0F); - SmelterSide2 = new ModelRenderer(this, 0, 0); - SmelterSide2.addBox(0F, 0F, 0F, 4, 2, 1); - SmelterSide2.setRotationPoint(-2F, 16F, 3F); - SmelterSide2.setTextureSize(64, 32); - SmelterSide2.mirror = true; - setRotation(SmelterSide2, 0F, 0F, 0F); - SmelterSide3 = new ModelRenderer(this, 0, 0); - SmelterSide3.addBox(0F, 0F, 0F, 1, 2, 5); - SmelterSide3.setRotationPoint(2F, 16F, -2F); - SmelterSide3.setTextureSize(64, 32); - SmelterSide3.mirror = true; - setRotation(SmelterSide3, 0F, 0F, 0F); - SmelterSide4 = new ModelRenderer(this, 0, 0); - SmelterSide4.addBox(0F, 0F, 0F, 1, 2, 5); - SmelterSide4.setRotationPoint(-3F, 16F, -2F); - SmelterSide4.setTextureSize(64, 32); - SmelterSide4.mirror = true; - setRotation(SmelterSide4, 0F, 0F, 0F); - SmelterSide5 = new ModelRenderer(this, 0, 0); - SmelterSide5.addBox(0F, 0F, 0F, 1, 7, 5); - SmelterSide5.setRotationPoint(3F, 9F, -2F); - SmelterSide5.setTextureSize(64, 32); - SmelterSide5.mirror = true; - setRotation(SmelterSide5, 0F, 0F, 0F); - SmelterSide6 = new ModelRenderer(this, 0, 0); - SmelterSide6.addBox(0F, 0F, 0F, 1, 7, 5); - SmelterSide6.setRotationPoint(-4F, 9F, -2F); - SmelterSide6.setTextureSize(64, 32); - SmelterSide6.mirror = true; - setRotation(SmelterSide6, 0F, 0F, 0F); - SmelterSide7 = new ModelRenderer(this, 0, 0); - SmelterSide7.addBox(0F, 0F, 0F, 1, 7, 1); - SmelterSide7.setRotationPoint(2F, 9F, 3F); - SmelterSide7.setTextureSize(64, 32); - SmelterSide7.mirror = true; - setRotation(SmelterSide7, 0F, 0F, 0F); - SmelterSide8 = new ModelRenderer(this, 0, 0); - SmelterSide8.addBox(0F, 0F, 0F, 1, 7, 1); - SmelterSide8.setRotationPoint(-3F, 9F, 3F); - SmelterSide8.setTextureSize(64, 32); - SmelterSide8.mirror = true; - setRotation(SmelterSide8, 0F, 0F, 0F); - SmelterSide9 = new ModelRenderer(this, 0, 0); - SmelterSide9.addBox(0F, 0F, 0F, 4, 7, 1); - SmelterSide9.setRotationPoint(-2F, 9F, 4F); - SmelterSide9.setTextureSize(64, 32); - SmelterSide9.mirror = true; - setRotation(SmelterSide9, 0F, 0F, 0F); - SmelterSide10 = new ModelRenderer(this, 0, 0); - SmelterSide10.addBox(0F, 0F, 0F, 4, 7, 1); - SmelterSide10.setRotationPoint(-2F, 9F, -4F); - SmelterSide10.setTextureSize(64, 32); - SmelterSide10.mirror = true; - setRotation(SmelterSide10, 0F, 0F, 0F); - SmelterSide11 = new ModelRenderer(this, 0, 0); - SmelterSide11.addBox(0F, 0F, 0F, 1, 7, 1); - SmelterSide11.setRotationPoint(2F, 9F, -3F); - SmelterSide11.setTextureSize(64, 32); - SmelterSide11.mirror = true; - setRotation(SmelterSide11, 0F, 0F, 0F); - SmelterSide12 = new ModelRenderer(this, 0, 0); - SmelterSide12.addBox(0F, 0F, 0F, 1, 7, 1); - SmelterSide12.setRotationPoint(-3F, 9F, -3F); - SmelterSide12.setTextureSize(64, 32); - SmelterSide12.mirror = true; - setRotation(SmelterSide12, 0F, 0F, 0F); - HeatSourceSide1 = new ModelRenderer(this, 0, 0); - HeatSourceSide1.addBox(0F, 0F, 0F, 8, 2, 1); - HeatSourceSide1.setRotationPoint(-4F, 19F, 7F); - HeatSourceSide1.setTextureSize(64, 32); - HeatSourceSide1.mirror = true; - setRotation(HeatSourceSide1, 0F, 0F, 0F); - HeatSourceSide2 = new ModelRenderer(this, 0, 0); - HeatSourceSide2.addBox(0F, 0F, 0F, 1, 2, 12); - HeatSourceSide2.setRotationPoint(-6F, 19F, -6F); - HeatSourceSide2.setTextureSize(64, 32); - HeatSourceSide2.mirror = true; - setRotation(HeatSourceSide2, 0F, 0F, 0F); - HeatSourceSide3 = new ModelRenderer(this, 0, 0); - HeatSourceSide3.addBox(0F, 0F, 0F, 1, 2, 12); - HeatSourceSide3.setRotationPoint(5F, 19F, -6F); - HeatSourceSide3.setTextureSize(64, 32); - HeatSourceSide3.mirror = true; - setRotation(HeatSourceSide3, 0F, 0F, 0F); - HeatSourceSide4 = new ModelRenderer(this, 0, 0); - HeatSourceSide4.addBox(0F, 0F, 0F, 1, 2, 12); - HeatSourceSide4.setRotationPoint(4F, 21F, -6F); - HeatSourceSide4.setTextureSize(64, 32); - HeatSourceSide4.mirror = true; - setRotation(HeatSourceSide4, 0F, 0F, 0F); - HeatSourceSide5 = new ModelRenderer(this, 0, 0); - HeatSourceSide5.addBox(0F, 0F, 0F, 1, 2, 12); - HeatSourceSide5.setRotationPoint(-5F, 21F, -6F); - HeatSourceSide5.setTextureSize(64, 32); - HeatSourceSide5.mirror = true; - setRotation(HeatSourceSide5, 0F, 0F, 0F); - HeatSourceBase = new ModelRenderer(this, 0, 0); - HeatSourceBase.addBox(0F, 0F, 0F, 8, 1, 12); - HeatSourceBase.setRotationPoint(-4F, 23F, -6F); - HeatSourceBase.setTextureSize(64, 32); - HeatSourceBase.mirror = true; - setRotation(HeatSourceBase, 0F, 0F, 0F); - HeatSourceSide6 = new ModelRenderer(this, 0, 0); - HeatSourceSide6.addBox(0F, 0F, 0F, 8, 2, 1); - HeatSourceSide6.setRotationPoint(-4F, 21F, -7F); - HeatSourceSide6.setTextureSize(64, 32); - HeatSourceSide6.mirror = true; - setRotation(HeatSourceSide6, 0F, 0F, 0F); - HeatSourceSide7 = new ModelRenderer(this, 0, 0); - HeatSourceSide7.addBox(0F, 0F, 0F, 8, 2, 1); - HeatSourceSide7.setRotationPoint(-4F, 21F, 6F); - HeatSourceSide7.setTextureSize(64, 32); - HeatSourceSide7.mirror = true; - setRotation(HeatSourceSide7, 0F, 0F, 0F); - HeatSourceSide8 = new ModelRenderer(this, 0, 0); - HeatSourceSide8.addBox(0F, 0F, 0F, 1, 2, 1); - HeatSourceSide8.setRotationPoint(-5F, 19F, 6F); - HeatSourceSide8.setTextureSize(64, 32); - HeatSourceSide8.mirror = true; - setRotation(HeatSourceSide8, 0F, 0F, 0F); - HeatSourceSide9 = new ModelRenderer(this, 0, 0); - HeatSourceSide9.addBox(0F, 0F, 0F, 1, 2, 1); - HeatSourceSide9.setRotationPoint(4F, 19F, 6F); - HeatSourceSide9.setTextureSize(64, 32); - HeatSourceSide9.mirror = true; - setRotation(HeatSourceSide9, 0F, 0F, 0F); - HeatSourceSide10 = new ModelRenderer(this, 0, 0); - HeatSourceSide10.addBox(0F, 0F, 0F, 1, 2, 1); - HeatSourceSide10.setRotationPoint(4F, 19F, -7F); - HeatSourceSide10.setTextureSize(64, 32); - HeatSourceSide10.mirror = true; - setRotation(HeatSourceSide10, 0F, 0F, 0F); - HeatSourceSide11 = new ModelRenderer(this, 0, 0); - HeatSourceSide11.addBox(0F, 0F, 0F, 1, 2, 1); - HeatSourceSide11.setRotationPoint(-5F, 19F, -7F); - HeatSourceSide11.setTextureSize(64, 32); - HeatSourceSide11.mirror = true; - setRotation(HeatSourceSide11, 0F, 0F, 0F); - HeatSourceSide12 = new ModelRenderer(this, 0, 0); - HeatSourceSide12.addBox(0F, 0F, 0F, 8, 2, 1); - HeatSourceSide12.setRotationPoint(-4F, 19F, -8F); - HeatSourceSide12.setTextureSize(64, 32); - HeatSourceSide12.mirror = true; - setRotation(HeatSourceSide12, 0F, 0F, 0F); - } - - /** - * @param entity - * @param f - * @param f1 - * @param f2 - * @param f3 - * @param f4 - * @param f5 - */ - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5); - Support1.render(f5); - Support2.render(f5); - Hold1.render(f5); - Hold2.render(f5); - SmelterBase.render(f5); - SmelterSide1.render(f5); - SmelterSide2.render(f5); - SmelterSide3.render(f5); - SmelterSide4.render(f5); - SmelterSide5.render(f5); - SmelterSide6.render(f5); - SmelterSide7.render(f5); - SmelterSide8.render(f5); - SmelterSide9.render(f5); - SmelterSide10.render(f5); - SmelterSide11.render(f5); - SmelterSide12.render(f5); - HeatSourceSide1.render(f5); - HeatSourceSide2.render(f5); - HeatSourceSide3.render(f5); - HeatSourceSide4.render(f5); - HeatSourceSide5.render(f5); - HeatSourceBase.render(f5); - HeatSourceSide6.render(f5); - HeatSourceSide7.render(f5); - HeatSourceSide8.render(f5); - HeatSourceSide9.render(f5); - HeatSourceSide10.render(f5); - HeatSourceSide11.render(f5); - HeatSourceSide12.render(f5); - } - - /** - * @param model - * @param x - * @param y - * @param z - */ - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - - /** - * @param f - * @param f1 - * @param f2 - * @param f3 - * @param f4 - * @param f5 - */ - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) - { - super.setRotationAngles(f, f1, f2, f3, f4, f5, null); - } +public class ModelSmelter extends ModelBase { + // fields + ModelRenderer Support1; + ModelRenderer Support2; + ModelRenderer Hold1; + ModelRenderer Hold2; + ModelRenderer SmelterBase; + ModelRenderer SmelterSide1; + ModelRenderer SmelterSide2; + ModelRenderer SmelterSide3; + ModelRenderer SmelterSide4; + ModelRenderer SmelterSide5; + ModelRenderer SmelterSide6; + ModelRenderer SmelterSide7; + ModelRenderer SmelterSide8; + ModelRenderer SmelterSide9; + ModelRenderer SmelterSide10; + ModelRenderer SmelterSide11; + ModelRenderer SmelterSide12; + ModelRenderer HeatSourceSide1; + ModelRenderer HeatSourceSide2; + ModelRenderer HeatSourceSide3; + ModelRenderer HeatSourceSide4; + ModelRenderer HeatSourceSide5; + ModelRenderer HeatSourceBase; + ModelRenderer HeatSourceSide6; + ModelRenderer HeatSourceSide7; + ModelRenderer HeatSourceSide8; + ModelRenderer HeatSourceSide9; + ModelRenderer HeatSourceSide10; + ModelRenderer HeatSourceSide11; + ModelRenderer HeatSourceSide12; + + /** + * + */ + public ModelSmelter() { + textureWidth = 64; + textureHeight = 32; + Support1 = new ModelRenderer(this, 0, 14); + Support1.addBox(0F, 0F, 0F, 2, 15, 3); + Support1.setRotationPoint(6F, 9F, -1F); + Support1.setTextureSize(64, 32); + Support1.mirror = true; + setRotation(Support1, 0F, 0F, 0F); + Support2 = new ModelRenderer(this, 0, 14); + Support2.addBox(0F, 0F, 0F, 2, 15, 3); + Support2.setRotationPoint(-8F, 9F, -1F); + Support2.setTextureSize(64, 32); + Support2.mirror = true; + setRotation(Support2, 0F, 0F, 0F); + Hold1 = new ModelRenderer(this, 0, 14); + Hold1.addBox(0F, 0F, 0F, 2, 1, 1); + Hold1.setRotationPoint(4F, 11F, 0F); + Hold1.setTextureSize(64, 32); + Hold1.mirror = true; + setRotation(Hold1, 0F, 0F, 0F); + Hold2 = new ModelRenderer(this, 0, 14); + Hold2.addBox(0F, 0F, 0F, 2, 1, 1); + Hold2.setRotationPoint(-6F, 11F, 0F); + Hold2.setTextureSize(64, 32); + Hold2.mirror = true; + setRotation(Hold2, 0F, 0F, 0F); + SmelterBase = new ModelRenderer(this, 0, 0); + SmelterBase.addBox(0F, 0F, 0F, 4, 1, 5); + SmelterBase.setRotationPoint(-2F, 18F, -2F); + SmelterBase.setTextureSize(64, 32); + SmelterBase.mirror = true; + setRotation(SmelterBase, 0F, 0F, 0F); + SmelterSide1 = new ModelRenderer(this, 0, 0); + SmelterSide1.addBox(0F, 0F, 0F, 4, 2, 1); + SmelterSide1.setRotationPoint(-2F, 16F, -3F); + SmelterSide1.setTextureSize(64, 32); + SmelterSide1.mirror = true; + setRotation(SmelterSide1, 0F, 0F, 0F); + SmelterSide2 = new ModelRenderer(this, 0, 0); + SmelterSide2.addBox(0F, 0F, 0F, 4, 2, 1); + SmelterSide2.setRotationPoint(-2F, 16F, 3F); + SmelterSide2.setTextureSize(64, 32); + SmelterSide2.mirror = true; + setRotation(SmelterSide2, 0F, 0F, 0F); + SmelterSide3 = new ModelRenderer(this, 0, 0); + SmelterSide3.addBox(0F, 0F, 0F, 1, 2, 5); + SmelterSide3.setRotationPoint(2F, 16F, -2F); + SmelterSide3.setTextureSize(64, 32); + SmelterSide3.mirror = true; + setRotation(SmelterSide3, 0F, 0F, 0F); + SmelterSide4 = new ModelRenderer(this, 0, 0); + SmelterSide4.addBox(0F, 0F, 0F, 1, 2, 5); + SmelterSide4.setRotationPoint(-3F, 16F, -2F); + SmelterSide4.setTextureSize(64, 32); + SmelterSide4.mirror = true; + setRotation(SmelterSide4, 0F, 0F, 0F); + SmelterSide5 = new ModelRenderer(this, 0, 0); + SmelterSide5.addBox(0F, 0F, 0F, 1, 7, 5); + SmelterSide5.setRotationPoint(3F, 9F, -2F); + SmelterSide5.setTextureSize(64, 32); + SmelterSide5.mirror = true; + setRotation(SmelterSide5, 0F, 0F, 0F); + SmelterSide6 = new ModelRenderer(this, 0, 0); + SmelterSide6.addBox(0F, 0F, 0F, 1, 7, 5); + SmelterSide6.setRotationPoint(-4F, 9F, -2F); + SmelterSide6.setTextureSize(64, 32); + SmelterSide6.mirror = true; + setRotation(SmelterSide6, 0F, 0F, 0F); + SmelterSide7 = new ModelRenderer(this, 0, 0); + SmelterSide7.addBox(0F, 0F, 0F, 1, 7, 1); + SmelterSide7.setRotationPoint(2F, 9F, 3F); + SmelterSide7.setTextureSize(64, 32); + SmelterSide7.mirror = true; + setRotation(SmelterSide7, 0F, 0F, 0F); + SmelterSide8 = new ModelRenderer(this, 0, 0); + SmelterSide8.addBox(0F, 0F, 0F, 1, 7, 1); + SmelterSide8.setRotationPoint(-3F, 9F, 3F); + SmelterSide8.setTextureSize(64, 32); + SmelterSide8.mirror = true; + setRotation(SmelterSide8, 0F, 0F, 0F); + SmelterSide9 = new ModelRenderer(this, 0, 0); + SmelterSide9.addBox(0F, 0F, 0F, 4, 7, 1); + SmelterSide9.setRotationPoint(-2F, 9F, 4F); + SmelterSide9.setTextureSize(64, 32); + SmelterSide9.mirror = true; + setRotation(SmelterSide9, 0F, 0F, 0F); + SmelterSide10 = new ModelRenderer(this, 0, 0); + SmelterSide10.addBox(0F, 0F, 0F, 4, 7, 1); + SmelterSide10.setRotationPoint(-2F, 9F, -4F); + SmelterSide10.setTextureSize(64, 32); + SmelterSide10.mirror = true; + setRotation(SmelterSide10, 0F, 0F, 0F); + SmelterSide11 = new ModelRenderer(this, 0, 0); + SmelterSide11.addBox(0F, 0F, 0F, 1, 7, 1); + SmelterSide11.setRotationPoint(2F, 9F, -3F); + SmelterSide11.setTextureSize(64, 32); + SmelterSide11.mirror = true; + setRotation(SmelterSide11, 0F, 0F, 0F); + SmelterSide12 = new ModelRenderer(this, 0, 0); + SmelterSide12.addBox(0F, 0F, 0F, 1, 7, 1); + SmelterSide12.setRotationPoint(-3F, 9F, -3F); + SmelterSide12.setTextureSize(64, 32); + SmelterSide12.mirror = true; + setRotation(SmelterSide12, 0F, 0F, 0F); + HeatSourceSide1 = new ModelRenderer(this, 0, 0); + HeatSourceSide1.addBox(0F, 0F, 0F, 8, 2, 1); + HeatSourceSide1.setRotationPoint(-4F, 19F, 7F); + HeatSourceSide1.setTextureSize(64, 32); + HeatSourceSide1.mirror = true; + setRotation(HeatSourceSide1, 0F, 0F, 0F); + HeatSourceSide2 = new ModelRenderer(this, 0, 0); + HeatSourceSide2.addBox(0F, 0F, 0F, 1, 2, 12); + HeatSourceSide2.setRotationPoint(-6F, 19F, -6F); + HeatSourceSide2.setTextureSize(64, 32); + HeatSourceSide2.mirror = true; + setRotation(HeatSourceSide2, 0F, 0F, 0F); + HeatSourceSide3 = new ModelRenderer(this, 0, 0); + HeatSourceSide3.addBox(0F, 0F, 0F, 1, 2, 12); + HeatSourceSide3.setRotationPoint(5F, 19F, -6F); + HeatSourceSide3.setTextureSize(64, 32); + HeatSourceSide3.mirror = true; + setRotation(HeatSourceSide3, 0F, 0F, 0F); + HeatSourceSide4 = new ModelRenderer(this, 0, 0); + HeatSourceSide4.addBox(0F, 0F, 0F, 1, 2, 12); + HeatSourceSide4.setRotationPoint(4F, 21F, -6F); + HeatSourceSide4.setTextureSize(64, 32); + HeatSourceSide4.mirror = true; + setRotation(HeatSourceSide4, 0F, 0F, 0F); + HeatSourceSide5 = new ModelRenderer(this, 0, 0); + HeatSourceSide5.addBox(0F, 0F, 0F, 1, 2, 12); + HeatSourceSide5.setRotationPoint(-5F, 21F, -6F); + HeatSourceSide5.setTextureSize(64, 32); + HeatSourceSide5.mirror = true; + setRotation(HeatSourceSide5, 0F, 0F, 0F); + HeatSourceBase = new ModelRenderer(this, 0, 0); + HeatSourceBase.addBox(0F, 0F, 0F, 8, 1, 12); + HeatSourceBase.setRotationPoint(-4F, 23F, -6F); + HeatSourceBase.setTextureSize(64, 32); + HeatSourceBase.mirror = true; + setRotation(HeatSourceBase, 0F, 0F, 0F); + HeatSourceSide6 = new ModelRenderer(this, 0, 0); + HeatSourceSide6.addBox(0F, 0F, 0F, 8, 2, 1); + HeatSourceSide6.setRotationPoint(-4F, 21F, -7F); + HeatSourceSide6.setTextureSize(64, 32); + HeatSourceSide6.mirror = true; + setRotation(HeatSourceSide6, 0F, 0F, 0F); + HeatSourceSide7 = new ModelRenderer(this, 0, 0); + HeatSourceSide7.addBox(0F, 0F, 0F, 8, 2, 1); + HeatSourceSide7.setRotationPoint(-4F, 21F, 6F); + HeatSourceSide7.setTextureSize(64, 32); + HeatSourceSide7.mirror = true; + setRotation(HeatSourceSide7, 0F, 0F, 0F); + HeatSourceSide8 = new ModelRenderer(this, 0, 0); + HeatSourceSide8.addBox(0F, 0F, 0F, 1, 2, 1); + HeatSourceSide8.setRotationPoint(-5F, 19F, 6F); + HeatSourceSide8.setTextureSize(64, 32); + HeatSourceSide8.mirror = true; + setRotation(HeatSourceSide8, 0F, 0F, 0F); + HeatSourceSide9 = new ModelRenderer(this, 0, 0); + HeatSourceSide9.addBox(0F, 0F, 0F, 1, 2, 1); + HeatSourceSide9.setRotationPoint(4F, 19F, 6F); + HeatSourceSide9.setTextureSize(64, 32); + HeatSourceSide9.mirror = true; + setRotation(HeatSourceSide9, 0F, 0F, 0F); + HeatSourceSide10 = new ModelRenderer(this, 0, 0); + HeatSourceSide10.addBox(0F, 0F, 0F, 1, 2, 1); + HeatSourceSide10.setRotationPoint(4F, 19F, -7F); + HeatSourceSide10.setTextureSize(64, 32); + HeatSourceSide10.mirror = true; + setRotation(HeatSourceSide10, 0F, 0F, 0F); + HeatSourceSide11 = new ModelRenderer(this, 0, 0); + HeatSourceSide11.addBox(0F, 0F, 0F, 1, 2, 1); + HeatSourceSide11.setRotationPoint(-5F, 19F, -7F); + HeatSourceSide11.setTextureSize(64, 32); + HeatSourceSide11.mirror = true; + setRotation(HeatSourceSide11, 0F, 0F, 0F); + HeatSourceSide12 = new ModelRenderer(this, 0, 0); + HeatSourceSide12.addBox(0F, 0F, 0F, 8, 2, 1); + HeatSourceSide12.setRotationPoint(-4F, 19F, -8F); + HeatSourceSide12.setTextureSize(64, 32); + HeatSourceSide12.mirror = true; + setRotation(HeatSourceSide12, 0F, 0F, 0F); + } + + /** + * @param entity + * @param f + * @param f1 + * @param f2 + * @param f3 + * @param f4 + * @param f5 + */ + @Override + public void render(Entity entity, float f, float f1, float f2, + float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5); + Support1.render(f5); + Support2.render(f5); + Hold1.render(f5); + Hold2.render(f5); + SmelterBase.render(f5); + SmelterSide1.render(f5); + SmelterSide2.render(f5); + SmelterSide3.render(f5); + SmelterSide4.render(f5); + SmelterSide5.render(f5); + SmelterSide6.render(f5); + SmelterSide7.render(f5); + SmelterSide8.render(f5); + SmelterSide9.render(f5); + SmelterSide10.render(f5); + SmelterSide11.render(f5); + SmelterSide12.render(f5); + HeatSourceSide1.render(f5); + HeatSourceSide2.render(f5); + HeatSourceSide3.render(f5); + HeatSourceSide4.render(f5); + HeatSourceSide5.render(f5); + HeatSourceBase.render(f5); + HeatSourceSide6.render(f5); + HeatSourceSide7.render(f5); + HeatSourceSide8.render(f5); + HeatSourceSide9.render(f5); + HeatSourceSide10.render(f5); + HeatSourceSide11.render(f5); + HeatSourceSide12.render(f5); + } + + /** + * @param model + * @param x + * @param y + * @param z + */ + private void setRotation(ModelRenderer model, float x, float y, + float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + /** + * @param f + * @param f1 + * @param f2 + * @param f3 + * @param f4 + * @param f5 + */ + public void setRotationAngles(float f, float f1, float f2, float f3, + float f4, float f5) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, null); + } } diff --git a/src/main/java/darkknight/jewelrycraft/network/PacketHandler.java b/src/main/java/darkknight/jewelrycraft/network/PacketHandler.java index db24ead..f98c14a 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/network/PacketHandler.java +++ b/src/main/java/darkknight/jewelrycraft/network/PacketHandler.java @@ -6,17 +6,28 @@ import cpw.mods.fml.relauncher.Side; import darkknight.jewelrycraft.JewelrycraftMod;
import darkknight.jewelrycraft.util.Variables;
-public class PacketHandler
-{
+public class PacketHandler {
- public static void preInit(FMLPreInitializationEvent e)
- {
- JewelrycraftMod.netWrapper = NetworkRegistry.INSTANCE.newSimpleChannel(Variables.MODID);
- JewelrycraftMod.netWrapper.registerMessage(PacketKeyPressEvent.class, PacketKeyPressEvent.class, 3, Side.SERVER);
- JewelrycraftMod.netWrapper.registerMessage(PacketRequestPlayerInfo.class, PacketRequestPlayerInfo.class, 4, Side.SERVER);
- JewelrycraftMod.netWrapper.registerMessage(PacketSendClientPlayerInfo.class, PacketSendClientPlayerInfo.class, 5, Side.CLIENT);
- JewelrycraftMod.netWrapper.registerMessage(PacketSendServerPlayersInfo.class, PacketSendServerPlayersInfo.class, 6, Side.CLIENT);
- JewelrycraftMod.netWrapper.registerMessage(PacketRequestSetSlot.class, PacketRequestSetSlot.class, 7, Side.SERVER);
- JewelrycraftMod.netWrapper.registerMessage(PacketSendServerPlayerInfo.class, PacketSendServerPlayerInfo.class, 8, Side.SERVER);
- }
+ public static void preInit(FMLPreInitializationEvent e) {
+ JewelrycraftMod.netWrapper =
+ NetworkRegistry.INSTANCE.newSimpleChannel(Variables.MODID);
+ JewelrycraftMod.netWrapper.registerMessage(
+ PacketKeyPressEvent.class, PacketKeyPressEvent.class, 3,
+ Side.SERVER);
+ JewelrycraftMod.netWrapper.registerMessage(
+ PacketRequestPlayerInfo.class,
+ PacketRequestPlayerInfo.class, 4, Side.SERVER);
+ JewelrycraftMod.netWrapper.registerMessage(
+ PacketSendClientPlayerInfo.class,
+ PacketSendClientPlayerInfo.class, 5, Side.CLIENT);
+ JewelrycraftMod.netWrapper.registerMessage(
+ PacketSendServerPlayersInfo.class,
+ PacketSendServerPlayersInfo.class, 6, Side.CLIENT);
+ JewelrycraftMod.netWrapper.registerMessage(
+ PacketRequestSetSlot.class, PacketRequestSetSlot.class, 7,
+ Side.SERVER);
+ JewelrycraftMod.netWrapper.registerMessage(
+ PacketSendServerPlayerInfo.class,
+ PacketSendServerPlayerInfo.class, 8, Side.SERVER);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/network/PacketKeyPressEvent.java b/src/main/java/darkknight/jewelrycraft/network/PacketKeyPressEvent.java index b7ab07d..107ffd8 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/network/PacketKeyPressEvent.java +++ b/src/main/java/darkknight/jewelrycraft/network/PacketKeyPressEvent.java @@ -7,54 +7,57 @@ import darkknight.jewelrycraft.JewelrycraftMod; import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
-public class PacketKeyPressEvent implements IMessage, IMessageHandler<PacketKeyPressEvent, IMessage>
-{
- public int actionID;
-
- /**
- * @param id
- */
- public PacketKeyPressEvent(int id)
- {
- actionID = id;
- }
-
- /**
- *
- */
- public PacketKeyPressEvent()
- {}
-
- /**
- * @param message
- * @param ctx
- * @return
- */
- @Override
- public IMessage onMessage(PacketKeyPressEvent message, MessageContext ctx)
- {
- EntityPlayer sender = ctx.getServerHandler().playerEntity;
- // Jewelry inventory
- if (message.actionID == 0) sender.openGui(JewelrycraftMod.instance, 2, sender.worldObj, (int)sender.posX, (int)sender.posY, (int)sender.posZ);
- if (message.actionID == 1) sender.openGui(JewelrycraftMod.instance, 4, sender.worldObj, (int)sender.posX, (int)sender.posY, (int)sender.posZ);
- return null;
- }
-
- /**
- * @param buf
- */
- @Override
- public void fromBytes(ByteBuf buf)
- {
- actionID = buf.readInt();
- }
-
- /**
- * @param buf
- */
- @Override
- public void toBytes(ByteBuf buf)
- {
- buf.writeInt(actionID);
- }
+public class PacketKeyPressEvent implements IMessage,
+ IMessageHandler<PacketKeyPressEvent, IMessage> {
+ public int actionID;
+
+ /**
+ * @param id
+ */
+ public PacketKeyPressEvent(int id) {
+ actionID = id;
+ }
+
+ /**
+ *
+ */
+ public PacketKeyPressEvent() {
+ }
+
+ /**
+ * @param message
+ * @param ctx
+ * @return
+ */
+ @Override
+ public IMessage onMessage(PacketKeyPressEvent message,
+ MessageContext ctx) {
+ EntityPlayer sender = ctx.getServerHandler().playerEntity;
+ // Jewelry inventory
+ if (message.actionID == 0)
+ sender.openGui(JewelrycraftMod.instance, 2, sender.worldObj,
+ (int) sender.posX, (int) sender.posY,
+ (int) sender.posZ);
+ if (message.actionID == 1)
+ sender.openGui(JewelrycraftMod.instance, 4, sender.worldObj,
+ (int) sender.posX, (int) sender.posY,
+ (int) sender.posZ);
+ return null;
+ }
+
+ /**
+ * @param buf
+ */
+ @Override
+ public void fromBytes(ByteBuf buf) {
+ actionID = buf.readInt();
+ }
+
+ /**
+ * @param buf
+ */
+ @Override
+ public void toBytes(ByteBuf buf) {
+ buf.writeInt(actionID);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/network/PacketRequestPlayerInfo.java b/src/main/java/darkknight/jewelrycraft/network/PacketRequestPlayerInfo.java index f8df419..e3c3564 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/network/PacketRequestPlayerInfo.java +++ b/src/main/java/darkknight/jewelrycraft/network/PacketRequestPlayerInfo.java @@ -7,37 +7,40 @@ import darkknight.jewelrycraft.util.PlayerUtils; import darkknight.jewelrycraft.util.Variables;
import io.netty.buffer.ByteBuf;
-public class PacketRequestPlayerInfo implements IMessage, IMessageHandler<PacketRequestPlayerInfo, IMessage>
-{
-
- /**
- *
- */
- public PacketRequestPlayerInfo()
- {}
-
- /**
- * @param message
- * @param ctx
- * @return
- */
- @Override
- public IMessage onMessage(PacketRequestPlayerInfo message, MessageContext ctx)
- {
- return new PacketSendClientPlayerInfo(PlayerUtils.getModPlayerPersistTag(ctx.getServerHandler().playerEntity, Variables.MODID));
- }
-
- /**
- * @param buf
- */
- @Override
- public void fromBytes(ByteBuf buf)
- {}
-
- /**
- * @param buf
- */
- @Override
- public void toBytes(ByteBuf buf)
- {}
+public class PacketRequestPlayerInfo implements IMessage,
+ IMessageHandler<PacketRequestPlayerInfo, IMessage> {
+
+ /**
+ *
+ */
+ public PacketRequestPlayerInfo() {
+ }
+
+ /**
+ * @param message
+ * @param ctx
+ * @return
+ */
+ @Override
+ public IMessage onMessage(PacketRequestPlayerInfo message,
+ MessageContext ctx) {
+ return new PacketSendClientPlayerInfo(
+ PlayerUtils.getModPlayerPersistTag(
+ ctx.getServerHandler().playerEntity,
+ Variables.MODID));
+ }
+
+ /**
+ * @param buf
+ */
+ @Override
+ public void fromBytes(ByteBuf buf) {
+ }
+
+ /**
+ * @param buf
+ */
+ @Override
+ public void toBytes(ByteBuf buf) {
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/network/PacketRequestSetSlot.java b/src/main/java/darkknight/jewelrycraft/network/PacketRequestSetSlot.java index d06bfc0..bf6c1aa 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/network/PacketRequestSetSlot.java +++ b/src/main/java/darkknight/jewelrycraft/network/PacketRequestSetSlot.java @@ -15,48 +15,46 @@ import net.minecraft.item.ItemStack; * @author Sorin
*
*/
-public class PacketRequestSetSlot implements IMessage, IMessageHandler<PacketRequestSetSlot, IMessage>
-{
- ItemStack stack;
-
- public PacketRequestSetSlot()
- {}
-
- public PacketRequestSetSlot(ItemStack stack)
- {
- this.stack = stack;
- }
+public class PacketRequestSetSlot implements IMessage,
+ IMessageHandler<PacketRequestSetSlot, IMessage> {
+ ItemStack stack;
- /**
- * @param message
- * @param ctx
- * @return
- */
- @Override
- public IMessage onMessage(PacketRequestSetSlot message, MessageContext ctx)
- {
- if (ctx.getServerHandler().playerEntity.openContainer instanceof ContainerJewelryModifier)
- {
- ((ContainerJewelryModifier)ctx.getServerHandler().playerEntity.openContainer).modInv.setInventorySlotContents(36, message.stack);
- }
- return null;
- }
+ public PacketRequestSetSlot() {
+ }
- /**
- * @param buf
- */
- @Override
- public void fromBytes(ByteBuf buf)
- {
- stack = ByteBufUtils.readItemStack(buf);
- }
+ public PacketRequestSetSlot(ItemStack stack) {
+ this.stack = stack;
+ }
- /**
- * @param buf
- */
- @Override
- public void toBytes(ByteBuf buf)
- {
- ByteBufUtils.writeItemStack(buf, stack);
- }
+ /**
+ * @param message
+ * @param ctx
+ * @return
+ */
+ @Override
+ public IMessage onMessage(PacketRequestSetSlot message,
+ MessageContext ctx) {
+ if (ctx.getServerHandler().playerEntity.openContainer instanceof ContainerJewelryModifier) {
+ ((ContainerJewelryModifier) ctx
+ .getServerHandler().playerEntity.openContainer).modInv
+ .setInventorySlotContents(36, message.stack);
+ }
+ return null;
+ }
+
+ /**
+ * @param buf
+ */
+ @Override
+ public void fromBytes(ByteBuf buf) {
+ stack = ByteBufUtils.readItemStack(buf);
+ }
+
+ /**
+ * @param buf
+ */
+ @Override
+ public void toBytes(ByteBuf buf) {
+ ByteBufUtils.writeItemStack(buf, stack);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/network/PacketSendClientPlayerInfo.java b/src/main/java/darkknight/jewelrycraft/network/PacketSendClientPlayerInfo.java index c8bf0aa..21000de 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/network/PacketSendClientPlayerInfo.java +++ b/src/main/java/darkknight/jewelrycraft/network/PacketSendClientPlayerInfo.java @@ -8,51 +8,48 @@ import darkknight.jewelrycraft.events.ScreenHandler; import io.netty.buffer.ByteBuf;
import net.minecraft.nbt.NBTTagCompound;
-public class PacketSendClientPlayerInfo implements IMessage, IMessageHandler<PacketSendClientPlayerInfo, IMessage>
-{
- public NBTTagCompound tagCompound;
-
- /**
- * @param tagCompound
- */
- public PacketSendClientPlayerInfo(NBTTagCompound tagCompound)
- {
- this.tagCompound = tagCompound;
- }
-
- /**
- *
- */
- public PacketSendClientPlayerInfo()
- {}
-
- /**
- * @param message
- * @param ctx
- * @return
- */
- @Override
- public IMessage onMessage(PacketSendClientPlayerInfo message, MessageContext ctx)
- {
- ScreenHandler.tagCache = message.tagCompound;
- return null;
- }
-
- /**
- * @param buf
- */
- @Override
- public void fromBytes(ByteBuf buf)
- {
- tagCompound = ByteBufUtils.readTag(buf);
- }
-
- /**
- * @param buf
- */
- @Override
- public void toBytes(ByteBuf buf)
- {
- ByteBufUtils.writeTag(buf, tagCompound);
- }
+public class PacketSendClientPlayerInfo implements IMessage,
+ IMessageHandler<PacketSendClientPlayerInfo, IMessage> {
+ public NBTTagCompound tagCompound;
+
+ /**
+ * @param tagCompound
+ */
+ public PacketSendClientPlayerInfo(NBTTagCompound tagCompound) {
+ this.tagCompound = tagCompound;
+ }
+
+ /**
+ *
+ */
+ public PacketSendClientPlayerInfo() {
+ }
+
+ /**
+ * @param message
+ * @param ctx
+ * @return
+ */
+ @Override
+ public IMessage onMessage(PacketSendClientPlayerInfo message,
+ MessageContext ctx) {
+ ScreenHandler.tagCache = message.tagCompound;
+ return null;
+ }
+
+ /**
+ * @param buf
+ */
+ @Override
+ public void fromBytes(ByteBuf buf) {
+ tagCompound = ByteBufUtils.readTag(buf);
+ }
+
+ /**
+ * @param buf
+ */
+ @Override
+ public void toBytes(ByteBuf buf) {
+ ByteBufUtils.writeTag(buf, tagCompound);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/network/PacketSendServerPlayerInfo.java b/src/main/java/darkknight/jewelrycraft/network/PacketSendServerPlayerInfo.java index afefb65..da18c17 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/network/PacketSendServerPlayerInfo.java +++ b/src/main/java/darkknight/jewelrycraft/network/PacketSendServerPlayerInfo.java @@ -10,62 +10,65 @@ import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
-public class PacketSendServerPlayerInfo implements IMessage, IMessageHandler<PacketSendServerPlayerInfo, IMessage>
-{
- public NBTTagCompound tagCompound;
- public String curse, action;
-
- /**
- * @param tagCompound
- */
- public PacketSendServerPlayerInfo(String action, String curse, NBTTagCompound tagCompound)
- {
- this.tagCompound = tagCompound;
- this.curse = curse;
- this.action = action;
- }
-
- /**
- *
- */
- public PacketSendServerPlayerInfo()
- {}
-
- /**
- * @param message
- * @param ctx
- * @return
- */
- @Override
- public IMessage onMessage(PacketSendServerPlayerInfo message, MessageContext ctx)
- {
- EntityPlayerMP serverPlayer = ctx.getServerHandler().playerEntity;
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(serverPlayer, Variables.MODID);
- playerInfo.setInteger(message.curse, message.action.equals("remove") ? 0 : 1);
- playerInfo.setInteger("activeCurses", message.tagCompound.getInteger("activeCurses"));
- System.out.println(message.action + " " + message.curse + " " + message.tagCompound.getInteger(curse) + " " + message.tagCompound.getInteger("activeCurses"));
- return null;
- }
-
- /**
- * @param buf
- */
- @Override
- public void fromBytes(ByteBuf buf)
- {
- tagCompound = ByteBufUtils.readTag(buf);
- curse = ByteBufUtils.readUTF8String(buf);
- action = ByteBufUtils.readUTF8String(buf);
- }
-
- /**
- * @param buf
- */
- @Override
- public void toBytes(ByteBuf buf)
- {
- ByteBufUtils.writeTag(buf, tagCompound);
- ByteBufUtils.writeUTF8String(buf, curse);
- ByteBufUtils.writeUTF8String(buf, action);
- }
+public class PacketSendServerPlayerInfo implements IMessage,
+ IMessageHandler<PacketSendServerPlayerInfo, IMessage> {
+ public NBTTagCompound tagCompound;
+ public String curse, action;
+
+ /**
+ * @param tagCompound
+ */
+ public PacketSendServerPlayerInfo(String action, String curse,
+ NBTTagCompound tagCompound) {
+ this.tagCompound = tagCompound;
+ this.curse = curse;
+ this.action = action;
+ }
+
+ /**
+ *
+ */
+ public PacketSendServerPlayerInfo() {
+ }
+
+ /**
+ * @param message
+ * @param ctx
+ * @return
+ */
+ @Override
+ public IMessage onMessage(PacketSendServerPlayerInfo message,
+ MessageContext ctx) {
+ EntityPlayerMP serverPlayer = ctx.getServerHandler().playerEntity;
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(serverPlayer, Variables.MODID);
+ playerInfo.setInteger(message.curse,
+ message.action.equals("remove") ? 0 : 1);
+ playerInfo.setInteger("activeCurses",
+ message.tagCompound.getInteger("activeCurses"));
+ System.out.println(message.action + " " + message.curse + " "
+ + message.tagCompound.getInteger(curse) + " "
+ + message.tagCompound.getInteger("activeCurses"));
+ return null;
+ }
+
+ /**
+ * @param buf
+ */
+ @Override
+ public void fromBytes(ByteBuf buf) {
+ tagCompound = ByteBufUtils.readTag(buf);
+ curse = ByteBufUtils.readUTF8String(buf);
+ action = ByteBufUtils.readUTF8String(buf);
+ }
+
+ /**
+ * @param buf
+ */
+ @Override
+ public void toBytes(ByteBuf buf) {
+ ByteBufUtils.writeTag(buf, tagCompound);
+ ByteBufUtils.writeUTF8String(buf, curse);
+ ByteBufUtils.writeUTF8String(buf, action);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/network/PacketSendServerPlayersInfo.java b/src/main/java/darkknight/jewelrycraft/network/PacketSendServerPlayersInfo.java index bcf58ea..1785741 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/network/PacketSendServerPlayersInfo.java +++ b/src/main/java/darkknight/jewelrycraft/network/PacketSendServerPlayersInfo.java @@ -4,6 +4,7 @@ package darkknight.jewelrycraft.network;
import java.util.Iterator;
+
import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
@@ -20,50 +21,48 @@ import net.minecraft.server.MinecraftServer; * @author Sorin
*
*/
-public class PacketSendServerPlayersInfo implements IMessage, IMessageHandler<PacketSendServerPlayersInfo, IMessage>
-{
- public PacketSendServerPlayersInfo()
- {
-
- }
-
- /**
- * @param message
- * @param ctx
- * @return
- */
- @Override
- public IMessage onMessage(PacketSendServerPlayersInfo message, MessageContext ctx)
- {
- return null;
- }
+public class PacketSendServerPlayersInfo implements IMessage,
+ IMessageHandler<PacketSendServerPlayersInfo, IMessage> {
+ public PacketSendServerPlayersInfo() {
+
+ }
+
+ /**
+ * @param message
+ * @param ctx
+ * @return
+ */
+ @Override
+ public IMessage onMessage(PacketSendServerPlayersInfo message,
+ MessageContext ctx) {
+ return null;
+ }
- /**
- * @param buf
- */
- @Override
- public void fromBytes(ByteBuf buf)
- {
- NBTTagCompound temp = ByteBufUtils.readTag(buf);
- if (temp != null)
- PlayerRenderHandler.playersInfo = temp;
- else
- PlayerRenderHandler.playersInfo = new NBTTagCompound();
- }
+ /**
+ * @param buf
+ */
+ @Override
+ public void fromBytes(ByteBuf buf) {
+ NBTTagCompound temp = ByteBufUtils.readTag(buf);
+ if (temp != null)
+ PlayerRenderHandler.playersInfo = temp;
+ else
+ PlayerRenderHandler.playersInfo = new NBTTagCompound();
+ }
- /**
- * @param buf
- */
- @Override
- public void toBytes(ByteBuf buf)
- {
- Iterator<EntityPlayer> players = MinecraftServer.getServer().getConfigurationManager().playerEntityList.iterator();
- NBTTagCompound nbt = new NBTTagCompound();
- while (players.hasNext())
- {
- EntityPlayer current = players.next();
- nbt.setTag(current.getDisplayName(), PlayerUtils.getModPlayerPersistTag(current, Variables.MODID));
- }
- ByteBufUtils.writeTag(buf, nbt);
- }
+ /**
+ * @param buf
+ */
+ @Override
+ public void toBytes(ByteBuf buf) {
+ Iterator<EntityPlayer> players = MinecraftServer.getServer()
+ .getConfigurationManager().playerEntityList.iterator();
+ NBTTagCompound nbt = new NBTTagCompound();
+ while (players.hasNext()) {
+ EntityPlayer current = players.next();
+ nbt.setTag(current.getDisplayName(), PlayerUtils
+ .getModPlayerPersistTag(current, Variables.MODID));
+ }
+ ByteBufUtils.writeTag(buf, nbt);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/particles/EntityFlatShadowFX.java b/src/main/java/darkknight/jewelrycraft/particles/EntityFlatShadowFX.java index 0948f56..fd788f6 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/particles/EntityFlatShadowFX.java +++ b/src/main/java/darkknight/jewelrycraft/particles/EntityFlatShadowFX.java @@ -1,91 +1,95 @@ package darkknight.jewelrycraft.particles;
import org.lwjgl.opengl.GL11;
+
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
-public class EntityFlatShadowFX extends EntityFX
-{
- float moteParticleScale;
- ResourceLocation texture;
-
- /**
- * @param world
- * @param x
- * @param y
- * @param z
- * @param size
- * @param maxAge
- * @param texture
- */
- public EntityFlatShadowFX(World world, double x, double y, double z, float size, float maxAge, ResourceLocation texture)
- {
- super(world, x, y, z, 0D, 0D, 0D);
- particleMaxAge = (int)(28D / (Math.random() * 0.3D + 0.7D) * maxAge);
- particleGravity = 0F;
- motionX = motionY = motionZ = 0;
- particleScale = size;
- noClip = true;
- this.texture = texture;
- setSize(0.1F, 0.1F);
- }
-
- /**
- * @param tessellator
- * @param partialTicks
- * @param minX
- * @param minY
- * @param minZ
- * @param maxX
- * @param maxZ
- */
- @Override
- public void renderParticle(Tessellator tessellator, float partialTicks, float minX, float minY, float minZ, float maxX, float maxZ)
- {
- tessellator.draw();
- Minecraft.getMinecraft().renderEngine.bindTexture(texture);
- tessellator.startDrawingQuads();
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- GL11.glDepthMask(false);
- float scale = 1F * particleScale;
- float x = (float)(posX - interpPosX);
- float y = (float)(posX - interpPosY);
- float z = (float)(posZ - interpPosZ);
- tessellator.setColorRGBA_F(0F, 0F, 0F, 1F);
- tessellator.addVertexWithUV(x - minX * scale - maxX * scale, y + minY * scale, z - minZ * scale - maxZ * scale, 0, 0);
- tessellator.addVertexWithUV(x - minX * scale + maxX * scale, y + minY * scale, z - minZ * scale + maxZ * scale, 1, 0);
- tessellator.addVertexWithUV(x + minX * scale + maxX * scale, y + minY * scale, z + minZ * scale + maxZ * scale, 1, 1);
- tessellator.addVertexWithUV(x + minX * scale - maxX * scale, y + minY * scale, z + minZ * scale - maxZ * scale, 0, 1);
- tessellator.draw();
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- GL11.glDisable(GL11.GL_BLEND);
- GL11.glDepthMask(true);
- tessellator.startDrawingQuads();
- }
-
- /**
- *
- */
- @Override
- public void onUpdate()
- {
- prevPosX = posX;
- prevPosY = posY;
- prevPosZ = posZ;
- motionX = motionY = motionZ = 0;
- if (particleAge++ >= particleMaxAge) setDead();
- }
-
- /**
- * @return
- */
- @Override
- public int getFXLayer()
- {
- return 0;
- }
+public class EntityFlatShadowFX extends EntityFX {
+ float moteParticleScale;
+ ResourceLocation texture;
+
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param size
+ * @param maxAge
+ * @param texture
+ */
+ public EntityFlatShadowFX(World world, double x, double y, double z,
+ float size, float maxAge, ResourceLocation texture) {
+ super(world, x, y, z, 0D, 0D, 0D);
+ particleMaxAge =
+ (int) (28D / (Math.random() * 0.3D + 0.7D) * maxAge);
+ particleGravity = 0F;
+ motionX = motionY = motionZ = 0;
+ particleScale = size;
+ noClip = true;
+ this.texture = texture;
+ setSize(0.1F, 0.1F);
+ }
+
+ /**
+ * @param tessellator
+ * @param partialTicks
+ * @param minX
+ * @param minY
+ * @param minZ
+ * @param maxX
+ * @param maxZ
+ */
+ @Override
+ public void renderParticle(Tessellator tessellator, float partialTicks,
+ float minX, float minY, float minZ, float maxX, float maxZ) {
+ tessellator.draw();
+ Minecraft.getMinecraft().renderEngine.bindTexture(texture);
+ tessellator.startDrawingQuads();
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glDepthMask(false);
+ float scale = 1F * particleScale;
+ float x = (float) (posX - interpPosX);
+ float y = (float) (posX - interpPosY);
+ float z = (float) (posZ - interpPosZ);
+ tessellator.setColorRGBA_F(0F, 0F, 0F, 1F);
+ tessellator.addVertexWithUV(x - minX * scale - maxX * scale,
+ y + minY * scale, z - minZ * scale - maxZ * scale, 0, 0);
+ tessellator.addVertexWithUV(x - minX * scale + maxX * scale,
+ y + minY * scale, z - minZ * scale + maxZ * scale, 1, 0);
+ tessellator.addVertexWithUV(x + minX * scale + maxX * scale,
+ y + minY * scale, z + minZ * scale + maxZ * scale, 1, 1);
+ tessellator.addVertexWithUV(x + minX * scale - maxX * scale,
+ y + minY * scale, z + minZ * scale - maxZ * scale, 0, 1);
+ tessellator.draw();
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glDepthMask(true);
+ tessellator.startDrawingQuads();
+ }
+
+ /**
+ *
+ */
+ @Override
+ public void onUpdate() {
+ prevPosX = posX;
+ prevPosY = posY;
+ prevPosZ = posZ;
+ motionX = motionY = motionZ = 0;
+ if (particleAge++ >= particleMaxAge)
+ setDead();
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public int getFXLayer() {
+ return 0;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/particles/EntityShadowsFX.java b/src/main/java/darkknight/jewelrycraft/particles/EntityShadowsFX.java index 6cfcbaa..7e492bc 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/particles/EntityShadowsFX.java +++ b/src/main/java/darkknight/jewelrycraft/particles/EntityShadowsFX.java @@ -2,7 +2,9 @@ package darkknight.jewelrycraft.particles; import java.util.Iterator;
import java.util.List;
+
import org.lwjgl.opengl.GL11;
+
import darkknight.jewelrycraft.damage.DamageSourceList;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
@@ -13,92 +15,103 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
-public class EntityShadowsFX extends EntityFX
-{
- float moteParticleScale;
- ResourceLocation texture;
-
- /**
- * @param world
- * @param x
- * @param y
- * @param z
- * @param size
- * @param maxAge
- * @param texture
- */
- public EntityShadowsFX(World world, double x, double y, double z, float size, float maxAge, ResourceLocation texture)
- {
- super(world, x, y, z, 0D, 0D, 0D);
- particleMaxAge = (int)(28D / (Math.random() * 0.3D + 0.7D) * maxAge);
- particleGravity = 0F;
- motionX = motionY = motionZ = 0;
- particleScale *= size;
- moteParticleScale = particleScale;
- noClip = true;
- this.texture = texture;
- setSize(0.01F, 0.01F);
- }
-
- /**
- * @param tessellator
- * @param partialTicks
- * @param minX
- * @param minY
- * @param minZ
- * @param maxX
- * @param maxZ
- */
- @Override
- public void renderParticle(Tessellator tessellator, float partialTicks, float minX, float minY, float minZ, float maxX, float maxZ)
- {
- tessellator.draw();
- Minecraft.getMinecraft().renderEngine.bindTexture(texture);
- GL11.glColor4f(1, 1, 1, 1);
- tessellator.startDrawingQuads();
- tessellator.setBrightness(getBrightnessForRender(0));
- float scale = 0.1F * particleScale;
- float x = (float)(posX - interpPosX);
- float y = (float)(posY - interpPosY);
- float z = (float)(posZ - interpPosZ);
- tessellator.setColorRGBA_F(0F, 0F, 0F, 0.5F);
- tessellator.addVertexWithUV(x - minX * scale - maxX * scale, y - minY * scale, z - minZ * scale - maxZ * scale, 0, 0);
- tessellator.addVertexWithUV(x - minX * scale + maxX * scale, y + minY * scale, z - minZ * scale + maxZ * scale, 1, 0);
- tessellator.addVertexWithUV(x + minX * scale + maxX * scale, y + minY * scale, z + minZ * scale + maxZ * scale, 1, 1);
- tessellator.addVertexWithUV(x + minX * scale - maxX * scale, y - minY * scale, z + minZ * scale - maxZ * scale, 0, 1);
- tessellator.draw();
- tessellator.startDrawingQuads();
- }
-
- /**
- *
- */
- @Override
- public void onUpdate()
- {
- prevPosX = posX;
- prevPosY = posY;
- prevPosZ = posZ;
- motionX = motionY = motionZ = 0;
- if (particleAge++ >= particleMaxAge) setDead();
- AxisAlignedBB axisalignedbb = boundingBox.expand(16.0D, 16.0D, 16.0D);
- List list1 = worldObj.getEntitiesWithinAABB(Entity.class, axisalignedbb);
- if (!worldObj.isRemote && list1 != null && !list1.isEmpty()){
- Iterator iterator = list1.iterator();
- while (iterator.hasNext()){
- Entity entity = (Entity)iterator.next();
- if (entity != null && posX <= entity.posX + 0.5F && posX >= entity.posX - 0.5F && posZ <= entity.posZ + 0.5F && posZ >= entity.posZ - 0.5F) entity.attackEntityFrom(DamageSourceList.shadows, 100F);
- if (entity instanceof EntityThrowable) ((EntityThrowable)entity).setDead();
- }
- }
- }
-
- /**
- * @return
- */
- @Override
- public int getFXLayer()
- {
- return 2;
- }
+public class EntityShadowsFX extends EntityFX {
+ float moteParticleScale;
+ ResourceLocation texture;
+
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param size
+ * @param maxAge
+ * @param texture
+ */
+ public EntityShadowsFX(World world, double x, double y, double z,
+ float size, float maxAge, ResourceLocation texture) {
+ super(world, x, y, z, 0D, 0D, 0D);
+ particleMaxAge =
+ (int) (28D / (Math.random() * 0.3D + 0.7D) * maxAge);
+ particleGravity = 0F;
+ motionX = motionY = motionZ = 0;
+ particleScale *= size;
+ moteParticleScale = particleScale;
+ noClip = true;
+ this.texture = texture;
+ setSize(0.01F, 0.01F);
+ }
+
+ /**
+ * @param tessellator
+ * @param partialTicks
+ * @param minX
+ * @param minY
+ * @param minZ
+ * @param maxX
+ * @param maxZ
+ */
+ @Override
+ public void renderParticle(Tessellator tessellator, float partialTicks,
+ float minX, float minY, float minZ, float maxX, float maxZ) {
+ tessellator.draw();
+ Minecraft.getMinecraft().renderEngine.bindTexture(texture);
+ GL11.glColor4f(1, 1, 1, 1);
+ tessellator.startDrawingQuads();
+ tessellator.setBrightness(getBrightnessForRender(0));
+ float scale = 0.1F * particleScale;
+ float x = (float) (posX - interpPosX);
+ float y = (float) (posY - interpPosY);
+ float z = (float) (posZ - interpPosZ);
+ tessellator.setColorRGBA_F(0F, 0F, 0F, 0.5F);
+ tessellator.addVertexWithUV(x - minX * scale - maxX * scale,
+ y - minY * scale, z - minZ * scale - maxZ * scale, 0, 0);
+ tessellator.addVertexWithUV(x - minX * scale + maxX * scale,
+ y + minY * scale, z - minZ * scale + maxZ * scale, 1, 0);
+ tessellator.addVertexWithUV(x + minX * scale + maxX * scale,
+ y + minY * scale, z + minZ * scale + maxZ * scale, 1, 1);
+ tessellator.addVertexWithUV(x + minX * scale - maxX * scale,
+ y - minY * scale, z + minZ * scale - maxZ * scale, 0, 1);
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ }
+
+ /**
+ *
+ */
+ @Override
+ public void onUpdate() {
+ prevPosX = posX;
+ prevPosY = posY;
+ prevPosZ = posZ;
+ motionX = motionY = motionZ = 0;
+ if (particleAge++ >= particleMaxAge)
+ setDead();
+ AxisAlignedBB axisalignedbb =
+ boundingBox.expand(16.0D, 16.0D, 16.0D);
+ List<?> list1 = worldObj.getEntitiesWithinAABB(Entity.class,
+ axisalignedbb);
+ if (!worldObj.isRemote && list1 != null && !list1.isEmpty()) {
+ Iterator<?> iterator = list1.iterator();
+ while (iterator.hasNext()) {
+ Entity entity = (Entity) iterator.next();
+ if (entity != null && posX <= entity.posX + 0.5F
+ && posX >= entity.posX - 0.5F
+ && posZ <= entity.posZ + 0.5F
+ && posZ >= entity.posZ - 0.5F)
+ entity.attackEntityFrom(DamageSourceList.shadows,
+ 100F);
+ if (entity instanceof EntityThrowable)
+ ((EntityThrowable) entity).setDead();
+ }
+ }
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public int getFXLayer() {
+ return 2;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/potions/PotionBase.java b/src/main/java/darkknight/jewelrycraft/potions/PotionBase.java index 3160e91..0c170e5 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/potions/PotionBase.java +++ b/src/main/java/darkknight/jewelrycraft/potions/PotionBase.java @@ -1,11 +1,12 @@ package darkknight.jewelrycraft.potions;
import java.util.ArrayList;
+
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
public class PotionBase extends Potion {
- private static ArrayList<PotionBase> potions = new ArrayList<PotionBase>();
+ private static ArrayList<PotionBase> potions = new ArrayList<>();
public PotionBase(int id, boolean isBad, int color) {
super(id, isBad, color);
@@ -16,5 +17,7 @@ public class PotionBase extends Potion { return potions;
}
- public void action(EntityLivingBase entity) {}
+ public void action(EntityLivingBase entity) {
+ // Do nothing
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/potions/PotionList.java b/src/main/java/darkknight/jewelrycraft/potions/PotionList.java index 6749c37..632e92a 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/potions/PotionList.java +++ b/src/main/java/darkknight/jewelrycraft/potions/PotionList.java @@ -3,76 +3,32 @@ */
package darkknight.jewelrycraft.potions;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
-import darkknight.jewelrycraft.JewelrycraftMod;
import net.minecraft.potion.Potion;
/**
- * @author Sorin
- * Code for extending Potion list from Mithion
- * SOurce: https://github.com/Mithion/ArsMagica2/blob/master/src/main/java/am2/buffs/BuffList.java
+ * @author Sorin Code for extending Potion list from Mithion SOurce:
+ * https://github.com/Mithion/ArsMagica2/blob/master/src/main/java/am2/buffs/BuffList.java
*/
-public class PotionList
-{
- public static Potion stun;
- private static int potionDefaultOffset = 0;
-
- public static void preInit(FMLPreInitializationEvent e)
- {
- }
-
- private static void setFinalStatic(Field field, Object newValue) throws Exception
- {
- field.setAccessible(true);
- Field modifiersField = Field.class.getDeclaredField("modifiers");
- modifiersField.setAccessible(true);
- modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
- field.set(null, newValue);
- }
-
- private static void extendPotionsArray() throws Exception
- {
- JewelrycraftMod.logger.info("Extending potions array");
- JewelrycraftMod.logger.info("Injecting potions starting from index " + Potion.potionTypes.length);
- potionDefaultOffset = Potion.potionTypes.length;
- setPotionArrayLength(255);
- }
-
- private static void setPotionArrayLength(int length) throws Exception
- {
- if (length <= Potion.potionTypes.length)
- return;
- Potion[] potions = new Potion[length];
- for(int i = 0; i < Potion.potionTypes.length; ++i){
- potions[i] = Potion.potionTypes[i];
- }
- Field field = null;
- Field[] fields = Potion.class.getDeclaredFields();
- for(Field f: fields){
- if (f.getType().equals(Potion[].class)) {
- field = f;
- break;
- }
- }
- setFinalStatic(field, potions);
- }
-
- public static void init(FMLInitializationEvent e)
- {
- try{
- extendPotionsArray();
- }
- catch(Throwable t){
- JewelrycraftMod.logger.error("Failed to extend potion ids!");
- t.printStackTrace();
- }
- stun = new PotionStun(potionDefaultOffset + 0, true, 0x000000);
- }
-
- public static void postInit(FMLPostInitializationEvent e)
- {}
+public class PotionList {
+ public static Potion stun;
+
+ public static void preInit(FMLPreInitializationEvent e) {
+ // Do nothing
+ }
+
+ public static void init(FMLInitializationEvent e) {
+ if (Potion.potionTypes.length > 231) {
+ stun = new PotionStun(230, true, 0x000000);
+ } else {
+ stun = new PotionStun(Potion.potionTypes.length - 2, true,
+ 0x000000);
+ }
+ }
+
+ public static void postInit(FMLPostInitializationEvent e) {
+ // Do nothing
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/potions/PotionStun.java b/src/main/java/darkknight/jewelrycraft/potions/PotionStun.java index e1f43e6..a361e9f 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/potions/PotionStun.java +++ b/src/main/java/darkknight/jewelrycraft/potions/PotionStun.java @@ -15,20 +15,33 @@ public class PotionStun extends PotionBase { this.setPotionName(Variables.MODID + ".potion.stun");
}
+ @Override
public void action(EntityLivingBase entity) {
entity.motionX *= 0D;
entity.motionZ *= 0D;
entity.motionY *= 0D;
+
entity.isSwingInProgress = false;
+
entity.moveForward = 0F;
entity.moveStrafing = 0F;
+
entity.setAIMoveSpeed(0F);
+
entity.limbSwing = 0F;
entity.limbSwingAmount = 0F;
entity.swingProgressInt = 0;
+
entity.rotationPitch = entity.prevRotationPitch;
entity.rotationYaw = entity.prevRotationYaw;
- entity.worldObj.spawnParticle("spell", entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ, 0.0D, 0.3D, 0.0D);
- if (entity.getActivePotionEffect(PotionList.stun).getDuration() == 0) entity.removePotionEffect(PotionList.stun.id);
+
+ entity.worldObj.spawnParticle("spell", entity.posX,
+ entity.posY + entity.getEyeHeight(), entity.posZ, 0.0D,
+ 0.3D, 0.0D);
+
+ if (entity.getActivePotionEffect(PotionList.stun)
+ .getDuration() == 0) {
+ entity.removePotionEffect(PotionList.stun.id);
+ }
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/proxy/ClientProxy.java b/src/main/java/darkknight/jewelrycraft/proxy/ClientProxy.java index 88807a7..5faa43f 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/proxy/ClientProxy.java +++ b/src/main/java/darkknight/jewelrycraft/proxy/ClientProxy.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.proxy;
import org.apache.logging.log4j.Level;
+
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
@@ -53,77 +54,124 @@ import net.minecraft.item.Item; import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.MinecraftForge;
-public class ClientProxy extends CommonProxy
-{
- public enum BlockRenderIDs {
- CRYSTAL;
-
- private final int ID;
-
- BlockRenderIDs()
- {
- ID = RenderingRegistry.getNextAvailableRenderId();
- }
+public class ClientProxy extends CommonProxy {
+ public enum BlockRenderIDs {
+ CRYSTAL;
+
+ private final int ID;
+
+ BlockRenderIDs() {
+ ID = RenderingRegistry.getNextAvailableRenderId();
+ }
+
+ public int id() {
+ return ID;
+ }
+ }
+
+ @Override
+ public void preInit() {
+ TileEntityHandPedestalRender pedestalRender =
+ new TileEntityHandPedestalRender(
+ new ModelHandPedestal(Variables.PEDESTAL_TEXTURE),
+ Variables.PEDESTAL_TEXTURE);
+ TileEntityShadowHandRender shadowHandRender =
+ new TileEntityShadowHandRender(
+ new ModelShadowHand(Variables.SHADOW_HAND_TEXTURE),
+ Variables.SHADOW_HAND_TEXTURE);
+
+ JewelrycraftMod.logger.log(Level.INFO,
+ "Binding Tileentities to their Special Rendered");
+ ClientRegistry.bindTileEntitySpecialRenderer(
+ TileEntitySmelter.class, new TileEntitySmelterRender());
+ ClientRegistry.bindTileEntitySpecialRenderer(
+ TileEntityMolder.class, new TileEntityMolderRender());
+ ClientRegistry.bindTileEntitySpecialRenderer(
+ TileEntityJewelrsCraftingTable.class,
+ new TileEntityJewelrsCraftingTableRender());
+ ClientRegistry.bindTileEntitySpecialRenderer(
+ TileEntityDisplayer.class,
+ new TileEntityDisplayerRender());
+ ClientRegistry.bindTileEntitySpecialRenderer(
+ TileEntityShadowEye.class,
+ new TileEntityShadowEyeRender());
+ ClientRegistry.bindTileEntitySpecialRenderer(
+ TileEntityMidasTouch.class,
+ new TileEntityMidasTouchRender());
+ ClientRegistry.bindTileEntitySpecialRenderer(
+ TileEntityHandPedestal.class, pedestalRender);
+ ClientRegistry.bindTileEntitySpecialRenderer(
+ TileEntityShadowHand.class, shadowHandRender);
+
+ JewelrycraftMod.logger.log(Level.INFO,
+ "Registering Item Renderes");
+ MinecraftForgeClient.registerItemRenderer(
+ Item.getItemFromBlock(BlockList.displayer),
+ new ItemRender(new TileEntityDisplayerRender(),
+ new TileEntityDisplayer(), new ModelDisplayer()));
+ MinecraftForgeClient.registerItemRenderer(
+ Item.getItemFromBlock(BlockList.jewelCraftingTable),
+ new ItemRender(new TileEntityJewelrsCraftingTableRender(),
+ new TileEntityJewelrsCraftingTable(),
+ new ModelJewlersCraftingBench()));
+ MinecraftForgeClient.registerItemRenderer(
+ Item.getItemFromBlock(BlockList.smelter),
+ new ItemRender(new TileEntitySmelterRender(),
+ new TileEntitySmelter(), new ModelSmelter()));
+ MinecraftForgeClient.registerItemRenderer(
+ Item.getItemFromBlock(BlockList.molder),
+ new ItemRender(new TileEntityMolderRender(),
+ new TileEntityMolder(), new ModelMolder()));
+ MinecraftForgeClient.registerItemRenderer(
+ Item.getItemFromBlock(BlockList.shadowEye),
+ new ItemRender(new TileEntityShadowEyeRender(),
+ new TileEntityShadowEye(), new ModelShadowEye()));
+ MinecraftForgeClient.registerItemRenderer(
+ Item.getItemFromBlock(BlockList.handPedestal),
+ new ItemRender(pedestalRender,
+ new TileEntityHandPedestal(),
+ new ModelHandPedestal(
+ Variables.PEDESTAL_TEXTURE)));
+ MinecraftForgeClient.registerItemRenderer(
+ Item.getItemFromBlock(BlockList.shadowHand),
+ new ItemRender(shadowHandRender,
+ new TileEntityShadowHand(), new ModelShadowHand(
+ Variables.SHADOW_HAND_TEXTURE)));
+ MinecraftForgeClient.registerItemRenderer(ItemList.goldObj,
+ new ItemRender());
+
+ VillagerRegistry.instance().registerVillagerSkin(3000,
+ Variables.VILLAGER_TEXTURE);
+
+ JewelrycraftMod.logger.log(Level.INFO,
+ "Registering Entity Renders");
+ RenderingRegistry.registerEntityRenderingHandler(EntityHeart.class,
+ new HeartRender(new ModelHeart(), 0.25F));
+ RenderingRegistry.registerEntityRenderingHandler(
+ EntityHalfHeart.class,
+ new HeartRender(new ModelHalfHeart(), 0.25F));
- public int id()
- {
- return ID;
- }
- }
-
- @Override
- public void preInit()
- {
- TileEntityHandPedestalRender pedestalRender = new TileEntityHandPedestalRender(new ModelHandPedestal(Variables.PEDESTAL_TEXTURE), Variables.PEDESTAL_TEXTURE);
- TileEntityShadowHandRender shadowHandRender = new TileEntityShadowHandRender(new ModelShadowHand(Variables.SHADOW_HAND_TEXTURE), Variables.SHADOW_HAND_TEXTURE);
+ RenderingRegistry.registerBlockHandler(new BlockCrystalRenderer());
- JewelrycraftMod.logger.log(Level.INFO, "Binding Tileentities to their Special Rendered");
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySmelter.class, new TileEntitySmelterRender());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMolder.class, new TileEntityMolderRender());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityJewelrsCraftingTable.class, new TileEntityJewelrsCraftingTableRender());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDisplayer.class, new TileEntityDisplayerRender());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityShadowEye.class, new TileEntityShadowEyeRender());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMidasTouch.class, new TileEntityMidasTouchRender());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityHandPedestal.class, pedestalRender);
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityShadowHand.class, shadowHandRender);
-
- JewelrycraftMod.logger.log(Level.INFO, "Registering Item Renderes");
- MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.displayer), new ItemRender(new TileEntityDisplayerRender(), new TileEntityDisplayer(), new ModelDisplayer()));
- MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.jewelCraftingTable), new ItemRender(new TileEntityJewelrsCraftingTableRender(), new TileEntityJewelrsCraftingTable(), new ModelJewlersCraftingBench()));
- MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.smelter), new ItemRender(new TileEntitySmelterRender(), new TileEntitySmelter(), new ModelSmelter()));
- MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.molder), new ItemRender(new TileEntityMolderRender(), new TileEntityMolder(), new ModelMolder()));
- MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.shadowEye), new ItemRender(new TileEntityShadowEyeRender(), new TileEntityShadowEye(), new ModelShadowEye()));
- MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.handPedestal), new ItemRender(pedestalRender, new TileEntityHandPedestal(), new ModelHandPedestal(Variables.PEDESTAL_TEXTURE)));
- MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.shadowHand), new ItemRender(shadowHandRender, new TileEntityShadowHand(), new ModelShadowHand(Variables.SHADOW_HAND_TEXTURE)));
- MinecraftForgeClient.registerItemRenderer(ItemList.goldObj, new ItemRender());
-
- VillagerRegistry.instance().registerVillagerSkin(3000, Variables.VILLAGER_TEXTURE);
+ TabRegistry.registerTab(new InventoryTabVanilla());
+ TabRegistry.registerTab(new TabJewelry());
+ TabRegistry.registerTab(new TabCurses());
+ MinecraftForge.EVENT_BUS.register(new TabRegistry());
+ MinecraftForge.EVENT_BUS.register(new PlayerRenderHandler());
+ MinecraftForge.EVENT_BUS
+ .register(new ScreenHandler(Minecraft.getMinecraft()));
+ }
- JewelrycraftMod.logger.log(Level.INFO, "Registering Entity Renders");
- RenderingRegistry.registerEntityRenderingHandler(EntityHeart.class, new HeartRender(new ModelHeart(), 0.25F));
- RenderingRegistry.registerEntityRenderingHandler(EntityHalfHeart.class, new HeartRender(new ModelHalfHeart(), 0.25F));
-
- RenderingRegistry.registerBlockHandler(new BlockCrystalRenderer());
+ @Override
+ public void init() {
+ FMLCommonHandler.instance().bus().register(new KeyBindings());
+ MinecraftForge.EVENT_BUS.register(new TextureEvent());
+ }
- TabRegistry.registerTab(new InventoryTabVanilla());
- TabRegistry.registerTab(new TabJewelry());
- TabRegistry.registerTab(new TabCurses());
- MinecraftForge.EVENT_BUS.register(new TabRegistry());
- MinecraftForge.EVENT_BUS.register(new PlayerRenderHandler());
- MinecraftForge.EVENT_BUS.register(new ScreenHandler(Minecraft.getMinecraft()));
- }
-
- @Override
- public void init()
- {
- FMLCommonHandler.instance().bus().register(new KeyBindings());
- MinecraftForge.EVENT_BUS.register(new TextureEvent());
- }
-
- @Override
- public void postInit()
- {
- JewelrycraftMod.logger.log(Level.INFO, "Generating colors for each item");
- JewelrycraftUtil.generateColors();
- }
+ @Override
+ public void postInit() {
+ JewelrycraftMod.logger.log(Level.INFO,
+ "Generating colors for each item");
+ JewelrycraftUtil.generateColors();
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/proxy/CommonProxy.java b/src/main/java/darkknight/jewelrycraft/proxy/CommonProxy.java index 358858d..ba9273f 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/proxy/CommonProxy.java +++ b/src/main/java/darkknight/jewelrycraft/proxy/CommonProxy.java @@ -3,14 +3,13 @@ package darkknight.jewelrycraft.proxy; /** * The Class CommonProxy. */ -public class CommonProxy -{ - public void preInit() - {} - - public void init() - {} - - public void postInit() - {} +public class CommonProxy { + public void preInit() { + } + + public void init() { + } + + public void postInit() { + } }
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/random/WeightedRandomCurse.java b/src/main/java/darkknight/jewelrycraft/random/WeightedRandomCurse.java index 7e75d93..2a3b19a 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/random/WeightedRandomCurse.java +++ b/src/main/java/darkknight/jewelrycraft/random/WeightedRandomCurse.java @@ -1,21 +1,19 @@ package darkknight.jewelrycraft.random;
import java.util.Random;
+
import darkknight.jewelrycraft.api.Curse;
import net.minecraft.util.WeightedRandom;
-public class WeightedRandomCurse extends WeightedRandom.Item
-{
- private final Curse curse;
+public class WeightedRandomCurse extends WeightedRandom.Item {
+ private final Curse curse;
- public WeightedRandomCurse(Curse curse, int weight)
- {
- super(weight);
- this.curse = curse;
- }
+ public WeightedRandomCurse(Curse curse, int weight) {
+ super(weight);
+ this.curse = curse;
+ }
- public Curse getCurse(Random random)
- {
- return curse;
- }
+ public Curse getCurse(Random random) {
+ return curse;
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/random/WeightedRandomItem.java b/src/main/java/darkknight/jewelrycraft/random/WeightedRandomItem.java index 8db6e82..c522009 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/random/WeightedRandomItem.java +++ b/src/main/java/darkknight/jewelrycraft/random/WeightedRandomItem.java @@ -1,66 +1,64 @@ package darkknight.jewelrycraft.random;
import java.util.Random;
+
import net.minecraft.item.ItemStack;
import net.minecraft.util.WeightedRandom;
-public class WeightedRandomItem extends WeightedRandom.Item
-{
- private final ItemStack item;
- private int maxMeta, minMeta, minItem, maxItem;
+public class WeightedRandomItem extends WeightedRandom.Item {
+ private final ItemStack item;
+ private int maxMeta, minMeta, minItem, maxItem;
+
+ public WeightedRandomItem(ItemStack item, int weight) {
+ super(weight);
+ this.item = item;
+ this.minItem = 1;
+ this.maxItem = 1;
+ this.maxMeta = 0;
+ this.minMeta = 0;
+ }
+
+ public WeightedRandomItem(ItemStack item, int maxMetadata,
+ int weight) {
+ this(item, weight);
+ this.maxMeta = maxMetadata;
+ }
+
+ public WeightedRandomItem(ItemStack item, int weight, int minItem,
+ int maxItem) {
+ this(item, weight);
+ this.minItem = minItem;
+ this.maxItem = maxItem;
+ }
+
+ public WeightedRandomItem setMaxMetadata(int meta) {
+ this.maxMeta = meta;
+ return this;
+ }
- public WeightedRandomItem(ItemStack item, int weight)
- {
- super(weight);
- this.item = item;
- this.minItem = 1;
- this.maxItem = 1;
- this.maxMeta = 0;
- this.minMeta = 0;
- }
+ public WeightedRandomItem setMinMetadata(int meta) {
+ this.minMeta = meta;
+ return this;
+ }
- public WeightedRandomItem(ItemStack item, int maxMetadata, int weight)
- {
- this(item, weight);
- this.maxMeta = maxMetadata;
- }
+ public WeightedRandomItem setMinItem(int min) {
+ this.minItem = min;
+ return this;
+ }
- public WeightedRandomItem(ItemStack item, int weight, int minItem, int maxItem)
- {
- this(item, weight);
- this.minItem = minItem;
- this.maxItem = maxItem;
- }
-
- public WeightedRandomItem setMaxMetadata(int meta)
- {
- this.maxMeta = meta;
- return this;
- }
-
- public WeightedRandomItem setMinMetadata(int meta)
- {
- this.minMeta = meta;
- return this;
- }
-
- public WeightedRandomItem setMinItem(int min)
- {
- this.minItem = min;
- return this;
- }
-
- public WeightedRandomItem setMaxItem(int max)
- {
- this.maxItem = max;
- return this;
- }
+ public WeightedRandomItem setMaxItem(int max) {
+ this.maxItem = max;
+ return this;
+ }
- public ItemStack getItem(Random random)
- {
- ItemStack itemstack = this.item.copy();
- if(maxMeta > 0) itemstack.setItemDamage(minMeta + random.nextInt(maxMeta - minMeta));
- if(maxItem > 1) itemstack.stackSize = this.minItem + random.nextInt(this.maxItem - this.minItem + 1);
- return itemstack;
- }
+ public ItemStack getItem(Random random) {
+ ItemStack itemstack = this.item.copy();
+ if (maxMeta > 0)
+ itemstack.setItemDamage(
+ minMeta + random.nextInt(maxMeta - minMeta));
+ if (maxItem > 1)
+ itemstack.stackSize = this.minItem
+ + random.nextInt(this.maxItem - this.minItem + 1);
+ return itemstack;
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/recipes/CraftingRecipes.java b/src/main/java/darkknight/jewelrycraft/recipes/CraftingRecipes.java index eb18ea7..34374d1 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/recipes/CraftingRecipes.java +++ b/src/main/java/darkknight/jewelrycraft/recipes/CraftingRecipes.java @@ -9,45 +9,92 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.ShapedOreRecipe;
-public class CraftingRecipes
-{
- private static boolean isInitialized = false;
-
- /**
- * @param e
- */
- public static void preInit(FMLPreInitializationEvent e)
- {
- if (!isInitialized){
- // Items
- GameRegistry.addRecipe(new ItemStack(ItemList.thiefGloves), "x x", "yxy", "yxy", 'x', ItemList.shadowIngot, 'y', new ItemStack(Blocks.wool, 1, 15));
- GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 0), "xx", 'x', Items.clay_ball);
- GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 1), " x ", "x x", " x ", 'x', Items.clay_ball);
- GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 2), "x x", "x x", " x ", 'x', Items.clay_ball);
- GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 3), "xxx", "x x", "xxx", 'x', Items.clay_ball);
- GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 4), "x x", 'x', Items.clay_ball);
- GameRegistry.addRecipe(new ItemStack(BlockList.handPedestal), "bbb", " x ", "yxy", 'x', Blocks.stonebrick, 'y', new ItemStack(Blocks.stone_slab, 1, 5), 'b', Blocks.cobblestone_wall);
- GameRegistry.addRecipe(new ItemStack(BlockList.shadowEye), "bcb", "cec", "bcb", 'b', Blocks.stonebrick, 'c', new ItemStack(Blocks.stained_hardened_clay, 1, 15), 'e', Items.ender_eye);
- GameRegistry.addShapelessRecipe(new ItemStack(ItemList.shadowIngot, 9), new Object[]{new ItemStack(BlockList.shadowBlock)});
- GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide), new Object[]{new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 0)});
- GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide), new Object[]{new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 1)});
- GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide), new Object[]{new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 2)});
- GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide), new Object[]{new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 3)});
- GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide), new Object[]{new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 4)});
- // Blocks
- GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockList.molder), "x x", "xxx", 'x', Blocks.cobblestone));
- GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockList.smelter), "xyx", "x x", "xzx", 'x', Blocks.cobblestone, 'y', Items.bucket, 'z', Items.lava_bucket));
- GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockList.jewelCraftingTable), "xxx", "y y", "y y", 'x', Blocks.planks, 'y', Blocks.stone));
- GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockList.displayer, 2), " x ", "xxx", "yyy", 'x', Items.iron_ingot, 'y', Blocks.emerald_block));
- GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockList.shadowBlock, 1), "xxx", "xxx", "xxx", 'x', ItemList.shadowIngot));
- // Smelting
- GameRegistry.addSmelting(BlockList.shadowOre, new ItemStack(ItemList.shadowIngot), 1.5f);
- GameRegistry.addSmelting(new ItemStack(ItemList.clayMolds, 1, 0), new ItemStack(ItemList.molds, 1, 0), 0.2F);
- GameRegistry.addSmelting(new ItemStack(ItemList.clayMolds, 1, 1), new ItemStack(ItemList.molds, 1, 1), 0.2F);
- GameRegistry.addSmelting(new ItemStack(ItemList.clayMolds, 1, 2), new ItemStack(ItemList.molds, 1, 2), 0.2F);
- GameRegistry.addSmelting(new ItemStack(ItemList.clayMolds, 1, 3), new ItemStack(ItemList.molds, 1, 3), 0.2F);
- GameRegistry.addSmelting(new ItemStack(ItemList.clayMolds, 1, 4), new ItemStack(ItemList.molds, 1, 4), 0.2F);
- isInitialized = true;
- }
- }
+public class CraftingRecipes {
+ private static boolean isInitialized = false;
+
+ /**
+ * @param e
+ */
+ public static void preInit(FMLPreInitializationEvent e) {
+ if (!isInitialized) {
+ // Items
+ GameRegistry.addRecipe(new ItemStack(ItemList.thiefGloves),
+ "x x", "yxy", "yxy", 'x', ItemList.shadowIngot, 'y',
+ new ItemStack(Blocks.wool, 1, 15));
+ // Disable ingot molds for balance reasons
+ //GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 0),
+ // "xx", 'x', Items.clay_ball);
+ GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 1),
+ " x ", "x x", " x ", 'x', Items.clay_ball);
+ GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 2),
+ "x x", "x x", " x ", 'x', Items.clay_ball);
+ GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 3),
+ "xxx", "x x", "xxx", 'x', Items.clay_ball);
+ GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 4),
+ "x x", 'x', Items.clay_ball);
+ GameRegistry.addRecipe(new ItemStack(BlockList.handPedestal),
+ "bbb", " x ", "yxy", 'x', Blocks.stonebrick, 'y',
+ new ItemStack(Blocks.stone_slab, 1, 5), 'b',
+ Blocks.cobblestone_wall);
+ GameRegistry.addRecipe(new ItemStack(BlockList.shadowEye),
+ "bcb", "cec", "bcb", 'b', Blocks.stonebrick, 'c',
+ new ItemStack(Blocks.stained_hardened_clay, 1, 15),
+ 'e', Items.ender_eye);
+ GameRegistry.addShapelessRecipe(
+ new ItemStack(ItemList.shadowIngot, 9),
+ new Object[] { new ItemStack(BlockList.shadowBlock) });
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide),
+ new Object[] { new ItemStack(Items.book),
+ new ItemStack(ItemList.molds, 1, 0) });
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide),
+ new Object[] { new ItemStack(Items.book),
+ new ItemStack(ItemList.molds, 1, 1) });
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide),
+ new Object[] { new ItemStack(Items.book),
+ new ItemStack(ItemList.molds, 1, 2) });
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide),
+ new Object[] { new ItemStack(Items.book),
+ new ItemStack(ItemList.molds, 1, 3) });
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide),
+ new Object[] { new ItemStack(Items.book),
+ new ItemStack(ItemList.molds, 1, 4) });
+ // Blocks
+ GameRegistry.addRecipe(
+ new ShapedOreRecipe(new ItemStack(BlockList.molder),
+ "x x", "xxx", 'x', Blocks.cobblestone));
+ GameRegistry.addRecipe(
+ new ShapedOreRecipe(new ItemStack(BlockList.smelter),
+ "xyx", "x x", "xzx", 'x', Blocks.cobblestone,
+ 'y', Items.bucket, 'z', Items.lava_bucket));
+ GameRegistry.addRecipe(new ShapedOreRecipe(
+ new ItemStack(BlockList.jewelCraftingTable), "xxx",
+ "y y", "y y", 'x', Blocks.planks, 'y', Blocks.stone));
+ GameRegistry.addRecipe(new ShapedOreRecipe(
+ new ItemStack(BlockList.displayer, 2), " x ", "xxx",
+ "yyy", 'x', Items.iron_ingot, 'y',
+ Blocks.emerald_block));
+ GameRegistry.addRecipe(new ShapedOreRecipe(
+ new ItemStack(BlockList.shadowBlock, 1), "xxx", "xxx",
+ "xxx", 'x', ItemList.shadowIngot));
+ // Smelting
+ GameRegistry.addSmelting(BlockList.shadowOre,
+ new ItemStack(ItemList.shadowIngot), 1.5f);
+ GameRegistry.addSmelting(
+ new ItemStack(ItemList.clayMolds, 1, 0),
+ new ItemStack(ItemList.molds, 1, 0), 0.2F);
+ GameRegistry.addSmelting(
+ new ItemStack(ItemList.clayMolds, 1, 1),
+ new ItemStack(ItemList.molds, 1, 1), 0.2F);
+ GameRegistry.addSmelting(
+ new ItemStack(ItemList.clayMolds, 1, 2),
+ new ItemStack(ItemList.molds, 1, 2), 0.2F);
+ GameRegistry.addSmelting(
+ new ItemStack(ItemList.clayMolds, 1, 3),
+ new ItemStack(ItemList.molds, 1, 3), 0.2F);
+ GameRegistry.addSmelting(
+ new ItemStack(ItemList.clayMolds, 1, 4),
+ new ItemStack(ItemList.molds, 1, 4), 0.2F);
+ isInitialized = true;
+ }
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/thirdparty/Alpaca.java b/src/main/java/darkknight/jewelrycraft/thirdparty/Alpaca.java deleted file mode 100644 index aee56dd..0000000 --- a/src/main/java/darkknight/jewelrycraft/thirdparty/Alpaca.java +++ /dev/null @@ -1,28 +0,0 @@ -package darkknight.jewelrycraft.thirdparty;
-
-/**
- * @author Sorin
- */
-public class Alpaca implements IThirdParty
-{
- @Override
- public void preInit()
- {}
-
- @Override
- public void init()
- {}
-
- @Override
- public void postInit()
- {
- }
-
- @Override
- public void clientSide()
- {}
-
- @Override
- public void clientInit()
- {}
-}
diff --git a/src/main/java/darkknight/jewelrycraft/thirdparty/EE3.java b/src/main/java/darkknight/jewelrycraft/thirdparty/EE3.java index af764ff..e9bb21f 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/thirdparty/EE3.java +++ b/src/main/java/darkknight/jewelrycraft/thirdparty/EE3.java @@ -3,6 +3,7 @@ package darkknight.jewelrycraft.thirdparty; import com.pahimar.ee3.api.exchange.EnergyValueRegistryProxy;
import com.pahimar.ee3.init.ModItems;
import com.pahimar.ee3.reference.Names;
+
import darkknight.jewelrycraft.block.BlockCrystal;
import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.item.ItemClayMolds;
@@ -11,35 +12,61 @@ import darkknight.jewelrycraft.item.ItemMolds; import darkknight.jewelrycraft.util.JewelrycraftUtil;
import net.minecraft.item.ItemStack;
-public class EE3 implements IThirdParty
-{
- @Override
- public void preInit()
- {}
-
- @Override
- public void init()
- {}
-
- @Override
- public void postInit()
- {
- EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(BlockList.shadowOre), 4096);
- EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(BlockList.shadowBlock), 36864);
- EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(ItemList.shadowIngot), 4096);
- EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(BlockList.jewelCraftingTable), 16640);
- EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(ItemList.guide), 288);
- for(int i = 0; i < ItemClayMolds.moldsItemNames.length; i++) EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(ItemList.clayMolds, 1, i), 128);
- for(int i = 0; i < ItemMolds.moldsItemNames.length; i++) EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(ItemList.molds, 1, i), 128);
- for(int i = 0; i < BlockCrystal.colors.length; i++) EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(BlockList.crystal, 1, i), 64);
- for(int i = 0; i < Names.Items.GEM_SUBTYPES.length; i++) JewelrycraftUtil.gem.add(new ItemStack(ModItems.gem, 1, i));
- }
-
- @Override
- public void clientSide()
- {}
-
- @Override
- public void clientInit()
- {}
+public class EE3 implements IThirdParty {
+ @Override
+ public void preInit() {
+ // Do nothing
+ }
+
+ @Override
+ public void init() {
+ // Do nothing
+ }
+
+ @Override
+ public void postInit() {
+ EnergyValueRegistryProxy.addPostAssignedEnergyValue(
+ new ItemStack(BlockList.shadowOre), 4096);
+
+ EnergyValueRegistryProxy.addPostAssignedEnergyValue(
+ new ItemStack(BlockList.shadowBlock), 36864);
+
+ EnergyValueRegistryProxy.addPostAssignedEnergyValue(
+ new ItemStack(ItemList.shadowIngot), 4096);
+
+ EnergyValueRegistryProxy.addPostAssignedEnergyValue(
+ new ItemStack(BlockList.jewelCraftingTable), 16640);
+
+ EnergyValueRegistryProxy.addPostAssignedEnergyValue(
+ new ItemStack(ItemList.guide), 288);
+
+ for (int i = 0; i < ItemClayMolds.moldsItemNames.length; i++) {
+ EnergyValueRegistryProxy.addPostAssignedEnergyValue(
+ new ItemStack(ItemList.clayMolds, 1, i), 128);
+ }
+
+ for (int i = 0; i < ItemMolds.moldsItemNames.length; i++) {
+ EnergyValueRegistryProxy.addPostAssignedEnergyValue(
+ new ItemStack(ItemList.molds, 1, i), 128);
+ }
+
+ for (int i = 0; i < BlockCrystal.colors.length; i++) {
+ EnergyValueRegistryProxy.addPostAssignedEnergyValue(
+ new ItemStack(BlockList.crystal, 1, i), 64);
+ }
+
+ for (int i = 0; i < Names.Items.GEM_SUBTYPES.length; i++) {
+ JewelrycraftUtil.gem.add(new ItemStack(ModItems.gem, 1, i));
+ }
+ }
+
+ @Override
+ public void clientSide() {
+ // Do nothing
+ }
+
+ @Override
+ public void clientInit() {
+ // Do nothing
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/thirdparty/IRegistryListener.java b/src/main/java/darkknight/jewelrycraft/thirdparty/IRegistryListener.java index 703a226..850fc35 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/thirdparty/IRegistryListener.java +++ b/src/main/java/darkknight/jewelrycraft/thirdparty/IRegistryListener.java @@ -2,11 +2,12 @@ package darkknight.jewelrycraft.thirdparty; import net.minecraft.block.Block; import net.minecraft.item.Item; -/** + +/** * @author MineMarteen from Pneumaticraft */ -public interface IRegistryListener{ - public void onItemRegistry(Item item); +public interface IRegistryListener { + public void onItemRegistry(Item item); - public void onBlockRegistry(Block block); + public void onBlockRegistry(Block block); }
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/thirdparty/IThirdParty.java b/src/main/java/darkknight/jewelrycraft/thirdparty/IThirdParty.java index 8aaba72..fe555ca 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/thirdparty/IThirdParty.java +++ b/src/main/java/darkknight/jewelrycraft/thirdparty/IThirdParty.java @@ -1,23 +1,23 @@ package darkknight.jewelrycraft.thirdparty; -/** +/** * @author MineMarteen from Pneumaticraft */ -public interface IThirdParty{ +public interface IThirdParty { - public void preInit(); + public void preInit(); - public void init(); + public void init(); - public void postInit(); + public void postInit(); - /** - * Gets called from the ClientProxy in the preInit. - */ - public void clientSide(); + /** + * Gets called from the ClientProxy in the preInit. + */ + public void clientSide(); - /** - * Gets called from the ClientProxy in the Init. - */ - public void clientInit(); + /** + * Gets called from the ClientProxy in the Init. + */ + public void clientInit(); }
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/thirdparty/ModIds.java b/src/main/java/darkknight/jewelrycraft/thirdparty/ModIds.java index b4a64c9..7bda520 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/thirdparty/ModIds.java +++ b/src/main/java/darkknight/jewelrycraft/thirdparty/ModIds.java @@ -1,29 +1,29 @@ package darkknight.jewelrycraft.thirdparty;
-/**
+/**
* @author MineMarteen from Pneumaticraft
*/
-public class ModIds{
- public static final String BUILDCRAFT = "BuildCraft|Core";
- public static final String COMPUTERCRAFT = "ComputerCraft";
- public static final String INDUSTRIALCRAFT = "IC2";
- public static final String IGWMOD = "IGWMod";
- public static final String FMP = "ForgeMultipart";
- public static final String WAILA = "Waila";
- public static final String TE = "ThermalExpansion";
- public static final String HC = "HydCraft";
- public static final String NEI = "NotEnoughItems";
- public static final String THAUMCRAFT = "Thaumcraft";
- public static final String BLOOD_MAGIC = "AWWayofTime";
- public static final String AE2 = "appliedenergistics2";
- public static final String CHISEL = "chisel";
- public static final String FORESTRY = "Forestry";
- public static final String MFR = "MineFactoryReloaded";
- public static final String OPEN_BLOCKS = "OpenBlocks";
- public static final String COFH_CORE = "CoFHCore";
- public static final String NOT_ENOUGH_KEYS = "notenoughkeys";
- public static final String OPEN_COMPUTERS = "OpenComputers|Core";
- public static final String EE3 = "EE3";
- public static final String PENUMATICRAFT = "PneumaticCraft";
- public static final String ALPACA = "alpaca";
+public class ModIds {
+ public static final String BUILDCRAFT = "BuildCraft|Core";
+ public static final String COMPUTERCRAFT = "ComputerCraft";
+ public static final String INDUSTRIALCRAFT = "IC2";
+ public static final String IGWMOD = "IGWMod";
+ public static final String FMP = "ForgeMultipart";
+ public static final String WAILA = "Waila";
+ public static final String TE = "ThermalExpansion";
+ public static final String HC = "HydCraft";
+ public static final String NEI = "NotEnoughItems";
+ public static final String THAUMCRAFT = "Thaumcraft";
+ public static final String BLOOD_MAGIC = "AWWayofTime";
+ public static final String AE2 = "appliedenergistics2";
+ public static final String CHISEL = "chisel";
+ public static final String FORESTRY = "Forestry";
+ public static final String MFR = "MineFactoryReloaded";
+ public static final String OPEN_BLOCKS = "OpenBlocks";
+ public static final String COFH_CORE = "CoFHCore";
+ public static final String NOT_ENOUGH_KEYS = "notenoughkeys";
+ public static final String OPEN_COMPUTERS = "OpenComputers|Core";
+ public static final String EE3 = "EE3";
+ public static final String PENUMATICRAFT = "PneumaticCraft";
+ public static final String ALPACA = "alpaca";
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/thirdparty/NEI.java b/src/main/java/darkknight/jewelrycraft/thirdparty/NEI.java index 2371137..feb6e6f 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/thirdparty/NEI.java +++ b/src/main/java/darkknight/jewelrycraft/thirdparty/NEI.java @@ -7,23 +7,33 @@ import net.minecraft.item.ItemStack; public class NEI implements IThirdParty {
@Override
- public void preInit() {}
+ public void preInit() {
+ // Do nothing
+ }
@Override
- public void init() {}
+ public void init() {
+ // Do nothing
+ }
@Override
public void postInit() {
for (int i = 0; i < Curse.getCurseList().size(); i++)
- codechicken.nei.api.API.hideItem(new ItemStack(ItemList.testItem, 1, i));
+ codechicken.nei.api.API
+ .hideItem(new ItemStack(ItemList.testItem, 1, i));
codechicken.nei.api.API.hideItem(new ItemStack(ItemList.goldObj));
- codechicken.nei.api.API.hideItem(new ItemStack(BlockList.midasTouchBlock));
+ codechicken.nei.api.API
+ .hideItem(new ItemStack(BlockList.midasTouchBlock));
codechicken.nei.api.API.hideItem(new ItemStack(ItemList.metal));
}
@Override
- public void clientSide() {}
+ public void clientSide() {
+ // Do nothing
+ }
@Override
- public void clientInit() {}
+ public void clientInit() {
+ // Do nothing
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/thirdparty/ThirdPartyManager.java b/src/main/java/darkknight/jewelrycraft/thirdparty/ThirdPartyManager.java index c45bd12..612d23d 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/thirdparty/ThirdPartyManager.java +++ b/src/main/java/darkknight/jewelrycraft/thirdparty/ThirdPartyManager.java @@ -4,7 +4,9 @@ import java.util.ArrayList; import java.util.HashMap;
import java.util.List;
import java.util.Map;
+
import org.apache.logging.log4j.Level;
+
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.network.IGuiHandler;
import darkknight.jewelrycraft.JewelrycraftMod;
@@ -14,132 +16,169 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item;
import net.minecraft.world.World;
-/**
+/**
* @author MineMarteen from Pneumaticraft
*/
-public class ThirdPartyManager implements IGuiHandler{
-
- private static ThirdPartyManager INSTANCE = new ThirdPartyManager();
- private final List<IThirdParty> thirdPartyMods = new ArrayList<IThirdParty>();
-
- public static ThirdPartyManager instance(){
- return INSTANCE;
- }
-
- public void index(){
- Map<String, Class<? extends IThirdParty>> thirdPartyClasses = new HashMap<String, Class<? extends IThirdParty>>();
- thirdPartyClasses.put(ModIds.EE3, EE3.class);
- thirdPartyClasses.put(ModIds.NEI, NEI.class);
- thirdPartyClasses.put(ModIds.ALPACA, Alpaca.class);
-
- List<String> enabledThirdParty = new ArrayList<String>();
- ConfigHandler.config.addCustomCategoryComment("third_party_enabling", "With these options you can disable third party content by mod. Useful if something in the mod changes and causes crashes.");
- for(String modid : thirdPartyClasses.keySet()) {
- if(ConfigHandler.config.get("Third_Party_Enabling", modid, true).getBoolean()) {
- enabledThirdParty.add(modid);
- }
- }
- ConfigHandler.config.save();
-
- for(Map.Entry<String, Class<? extends IThirdParty>> entry : thirdPartyClasses.entrySet()) {
- if(enabledThirdParty.contains(entry.getKey()) && Loader.isModLoaded(entry.getKey())) {
- try {
- thirdPartyMods.add(entry.getValue().newInstance());
- } catch(Exception e) {
- JewelrycraftMod.logger.log(Level.ERROR, "Failed to instantiate third party handler!");
- e.printStackTrace();
- }
- }
- }
- }
-
- public void onItemRegistry(Item item){
- for(IThirdParty thirdParty : thirdPartyMods) {
- if(thirdParty instanceof IRegistryListener) ((IRegistryListener)thirdParty).onItemRegistry(item);
- }
- }
-
- public void onBlockRegistry(Block block){
- for(IThirdParty thirdParty : thirdPartyMods) {
- if(thirdParty instanceof IRegistryListener) ((IRegistryListener)thirdParty).onBlockRegistry(block);
- }
- }
-
- public void preInit(){
- for(IThirdParty thirdParty : thirdPartyMods) {
- try {
- thirdParty.preInit();
- } catch(Throwable e) {
- JewelrycraftMod.logger.log(Level.ERROR, "Jewelrycraft wasn't able to load third party content from the third party class " + thirdParty.getClass() + " in the PreInit phase!");
- e.printStackTrace();
- }
- }
- }
-
- public void init(){
- for(IThirdParty thirdParty : thirdPartyMods) {
- try {
- thirdParty.init();
- } catch(Throwable e) {
- JewelrycraftMod.logger.log(Level.ERROR, "Jewelrycraft wasn't able to load third party content from the third party class " + thirdParty.getClass() + " in the Init phase!");
- e.printStackTrace();
- }
- }
- }
-
- public void postInit(){
- for(IThirdParty thirdParty : thirdPartyMods) {
- try {
- thirdParty.postInit();
- } catch(Throwable e) {
- JewelrycraftMod.logger.log(Level.ERROR, "Jewelrycraft wasn't able to load third party content from the third party class " + thirdParty.getClass() + " in the PostInit phase!");
- e.printStackTrace();
- }
- }
- }
-
- public void clientSide(){
- for(IThirdParty thirdParty : thirdPartyMods) {
- try {
- thirdParty.clientSide();
- } catch(Throwable e) {
- JewelrycraftMod.logger.log(Level.ERROR, "Jewelrycraft wasn't able to load third party content from the third party class " + thirdParty.getClass() + " client side!");
- e.printStackTrace();
- }
- }
- }
-
- public void clientInit(){
- for(IThirdParty thirdParty : thirdPartyMods) {
- try {
- thirdParty.clientInit();
- } catch(Throwable e) {
- JewelrycraftMod.logger.log(Level.ERROR, "Jewelrycraft wasn't able to load third party content from the third party class " + thirdParty.getClass() + " client side on the init!");
- e.printStackTrace();
- }
- }
- }
-
- @Override
- public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z){
- for(IThirdParty thirdParty : thirdPartyMods) {
- if(thirdParty instanceof IGuiHandler) {
- Object obj = ((IGuiHandler)thirdParty).getServerGuiElement(ID, player, world, x, y, z);
- if(obj != null) return obj;
- }
- }
- return null;
- }
-
- @Override
- public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z){
- for(IThirdParty thirdParty : thirdPartyMods) {
- if(thirdParty instanceof IGuiHandler) {
- Object obj = ((IGuiHandler)thirdParty).getClientGuiElement(ID, player, world, x, y, z);
- if(obj != null) return obj;
- }
- }
- return null;
- }
+public class ThirdPartyManager implements IGuiHandler {
+
+ private static ThirdPartyManager INSTANCE =
+ new ThirdPartyManager();
+ private final List<IThirdParty> thirdPartyMods =
+ new ArrayList<>();
+
+ public static ThirdPartyManager instance() {
+ return INSTANCE;
+ }
+
+ public void index() {
+ Map<String, Class<? extends IThirdParty>> thirdPartyClasses =
+ new HashMap<>();
+
+ thirdPartyClasses.put(ModIds.EE3, EE3.class);
+ thirdPartyClasses.put(ModIds.NEI, NEI.class);
+
+ List<String> enabledThirdParty = new ArrayList<>();
+
+ ConfigHandler.config.addCustomCategoryComment(
+ "third_party_enabling",
+ "With these options you can disable third party content by mod."
+ + " Useful if something in the mod changes and causes crashes.");
+
+ for (String modid : thirdPartyClasses.keySet()) {
+ if (ConfigHandler.config
+ .get("Third_Party_Enabling", modid, true)
+ .getBoolean()) {
+ enabledThirdParty.add(modid);
+ }
+ }
+
+ ConfigHandler.config.save();
+
+ for (Map.Entry<String,
+ Class<? extends IThirdParty>> entry : thirdPartyClasses
+ .entrySet()) {
+ if (enabledThirdParty.contains(entry.getKey())
+ && Loader.isModLoaded(entry.getKey())) {
+ try {
+ thirdPartyMods.add(entry.getValue().newInstance());
+ } catch (Exception e) {
+ JewelrycraftMod.logger.log(Level.ERROR,
+ "Failed to instantiate third party handler!");
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ public void onItemRegistry(Item item) {
+ for (IThirdParty thirdParty : thirdPartyMods) {
+ if (thirdParty instanceof IRegistryListener)
+ ((IRegistryListener) thirdParty).onItemRegistry(item);
+ }
+ }
+
+ public void onBlockRegistry(Block block) {
+ for (IThirdParty thirdParty : thirdPartyMods) {
+ if (thirdParty instanceof IRegistryListener)
+ ((IRegistryListener) thirdParty).onBlockRegistry(block);
+ }
+ }
+
+ public void preInit() {
+ for (IThirdParty thirdParty : thirdPartyMods) {
+ try {
+ thirdParty.preInit();
+ } catch (Throwable e) {
+ JewelrycraftMod.logger.log(Level.ERROR,
+ "Jewelrycraft wasn't able to load third party content from the third party class "
+ + thirdParty.getClass()
+ + " in the PreInit phase!");
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void init() {
+ for (IThirdParty thirdParty : thirdPartyMods) {
+ try {
+ thirdParty.init();
+ } catch (Throwable e) {
+ JewelrycraftMod.logger.log(Level.ERROR,
+ "Jewelrycraft wasn't able to load third party content from the third party class "
+ + thirdParty.getClass()
+ + " in the Init phase!");
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void postInit() {
+ for (IThirdParty thirdParty : thirdPartyMods) {
+ try {
+ thirdParty.postInit();
+ } catch (Throwable e) {
+ JewelrycraftMod.logger.log(Level.ERROR,
+ "Jewelrycraft wasn't able to load third party content from the third party class "
+ + thirdParty.getClass()
+ + " in the PostInit phase!");
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void clientSide() {
+ for (IThirdParty thirdParty : thirdPartyMods) {
+ try {
+ thirdParty.clientSide();
+ } catch (Throwable e) {
+ JewelrycraftMod.logger.log(Level.ERROR,
+ "Jewelrycraft wasn't able to load third party content from the third party class "
+ + thirdParty.getClass() + " client side!");
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void clientInit() {
+ for (IThirdParty thirdParty : thirdPartyMods) {
+ try {
+ thirdParty.clientInit();
+ } catch (Throwable e) {
+ JewelrycraftMod.logger.log(Level.ERROR,
+ "Jewelrycraft wasn't able to load third party content from the third party class "
+ + thirdParty.getClass()
+ + " client side on the init!");
+ e.printStackTrace();
+ }
+ }
+ }
+
+ @Override
+ public Object getServerGuiElement(int ID, EntityPlayer player,
+ World world, int x, int y, int z) {
+ for (IThirdParty thirdParty : thirdPartyMods) {
+ if (thirdParty instanceof IGuiHandler) {
+ Object obj = ((IGuiHandler) thirdParty)
+ .getServerGuiElement(ID, player, world, x, y, z);
+ if (obj != null)
+ return obj;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public Object getClientGuiElement(int ID, EntityPlayer player,
+ World world, int x, int y, int z) {
+ for (IThirdParty thirdParty : thirdPartyMods) {
+ if (thirdParty instanceof IGuiHandler) {
+ Object obj = ((IGuiHandler) thirdParty)
+ .getClientGuiElement(ID, player, world, x, y, z);
+ if (obj != null)
+ return obj;
+ }
+ }
+ return null;
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/thirdparty/WailaHandler.java b/src/main/java/darkknight/jewelrycraft/thirdparty/WailaHandler.java deleted file mode 100644 index 4352867..0000000 --- a/src/main/java/darkknight/jewelrycraft/thirdparty/WailaHandler.java +++ /dev/null @@ -1,59 +0,0 @@ -package darkknight.jewelrycraft.thirdparty; - -import java.util.List; -import darkknight.jewelrycraft.item.ItemList; -import darkknight.jewelrycraft.tileentity.TileEntityMoltenMetal; -import darkknight.jewelrycraft.util.JewelryNBT; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaDataProvider; -import mcp.mobius.waila.api.IWailaRegistrar; -import mcp.mobius.waila.api.SpecialChars; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; - -public class WailaHandler implements IWailaDataProvider{ - - @Override - public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) { - TileEntityMoltenMetal te = (TileEntityMoltenMetal)accessor.getTileEntity(); - ItemStack is = new ItemStack(ItemList.metal); - JewelryNBT.addMetal(is, te.getMetal()); - return is; - } - - @Override - public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - TileEntityMoltenMetal te = (TileEntityMoltenMetal)accessor.getTileEntity(); - String metalName = SpecialChars.WHITE + StatCollector.translateToLocal("tile.jewelrycraft2.moltenMetal.name") + " " + te.getMetal().getDisplayName(); - currenttip.remove(0); - currenttip.add(0, metalName); - return currenttip; - } - - @Override - public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - return currenttip; - } - - @Override - public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - return currenttip; - } - - public static void registration(IWailaRegistrar registrar){ - registrar.registerStackProvider(new WailaHandler(), TileEntityMoltenMetal.class); - registrar.registerHeadProvider(new WailaHandler(), TileEntityMoltenMetal.class); - } - - @Override - public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound nbt, World world, int x, int y, int z) - { - return null; - } - -} diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java index b16ce31..b17047e 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java @@ -8,81 +8,91 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; import net.minecraft.world.EnumSkyBlock; -public class TileEntityBlockShadow extends TileEntity -{ - public int metadata; - - /** - * - */ - public TileEntityBlockShadow() - { - metadata = -1; - } - - /** - * @param nbt - */ - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - nbt.setInteger("metadata", metadata); - } - - /** - * @param nbt - */ - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - metadata = nbt.getInteger("metadata"); - } - - /** - * - */ - @Override - public void updateEntity() - { - super.updateEntity(); - int blockLight, realLight; - int lightValue = worldObj.getSavedLightValue(EnumSkyBlock.Sky, xCoord, yCoord, zCoord) - worldObj.skylightSubtracted; - float sunPosAngle = worldObj.getCelestialAngleRadians(1.0F); - if (sunPosAngle < (float)Math.PI) sunPosAngle += (0.0F - sunPosAngle) * 0.2F; - else sunPosAngle += ((float)Math.PI * 2F - sunPosAngle) * 0.2F; - lightValue = Math.round(lightValue * MathHelper.cos(sunPosAngle)); - if (lightValue < 0) lightValue = 0; - if (lightValue > 15) lightValue = 15; - blockLight = worldObj.getChunkFromBlockCoords(xCoord, zCoord).getSavedLightValue(EnumSkyBlock.Block, xCoord & 15, yCoord, zCoord & 15); - realLight = worldObj.getChunkFromBlockCoords(xCoord, zCoord).getBlockLightValue(xCoord & 15, yCoord, zCoord & 15, 0); - if (blockLight == 0 && worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord) || lightValue >= blockLight) metadata = 15 - lightValue; - else if (!worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord)) metadata = 15 - realLight; - else if (lightValue < blockLight) metadata = 15 - blockLight; - worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, metadata, 2); - worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); - } - - /** - * @return - */ - @Override - public Packet getDescriptionPacket() - { - NBTTagCompound nbttagcompound = new NBTTagCompound(); - writeToNBT(nbttagcompound); - return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound); - } - - /** - * @param net - * @param packet - */ - @Override - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) - { - readFromNBT(packet.func_148857_g()); - worldObj.func_147479_m(xCoord, yCoord, zCoord); - } +public class TileEntityBlockShadow extends TileEntity { + public int metadata; + + /** + * + */ + public TileEntityBlockShadow() { + metadata = -1; + } + + /** + * @param nbt + */ + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setInteger("metadata", metadata); + } + + /** + * @param nbt + */ + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + metadata = nbt.getInteger("metadata"); + } + + /** + * + */ + @Override + public void updateEntity() { + super.updateEntity(); + int blockLight, realLight; + int lightValue = worldObj.getSavedLightValue(EnumSkyBlock.Sky, + xCoord, yCoord, zCoord) - worldObj.skylightSubtracted; + float sunPosAngle = worldObj.getCelestialAngleRadians(1.0F); + if (sunPosAngle < (float) Math.PI) + sunPosAngle += (0.0F - sunPosAngle) * 0.2F; + else + sunPosAngle += ((float) Math.PI * 2F - sunPosAngle) * 0.2F; + lightValue = Math.round(lightValue * MathHelper.cos(sunPosAngle)); + if (lightValue < 0) + lightValue = 0; + if (lightValue > 15) + lightValue = 15; + blockLight = worldObj.getChunkFromBlockCoords(xCoord, zCoord) + .getSavedLightValue(EnumSkyBlock.Block, xCoord & 15, + yCoord, zCoord & 15); + realLight = worldObj.getChunkFromBlockCoords(xCoord, zCoord) + .getBlockLightValue(xCoord & 15, yCoord, zCoord & 15, 0); + if (blockLight == 0 + && worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord) + || lightValue >= blockLight) + metadata = 15 - lightValue; + else if (!worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord)) + metadata = 15 - realLight; + else if (lightValue < blockLight) + metadata = 15 - blockLight; + worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, + metadata, 2); + worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, + worldObj.getBlock(xCoord, yCoord, zCoord)); + } + + /** + * @return + */ + @Override + public Packet getDescriptionPacket() { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + writeToNBT(nbttagcompound); + return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, + nbttagcompound); + } + + /** + * @param net + * @param packet + */ + @Override + public void onDataPacket(NetworkManager net, + S35PacketUpdateTileEntity packet) { + readFromNBT(packet.func_148857_g()); + worldObj.func_147479_m(xCoord, yCoord, zCoord); + } } diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityCrystal.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityCrystal.java index c7ca018..46288b4 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityCrystal.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityCrystal.java @@ -9,34 +9,35 @@ import net.minecraft.tileentity.TileEntity; /**
* @author Sorin
*/
-public class TileEntityCrystal extends TileEntity
-{
- public int shine = 120;
- boolean descent = false;
- int timer = 0;
-
- @Override
- public void updateEntity()
- {
- if (ConfigHandler.CRYSTAL_GLOW){
- timer++;
- if (timer > 20){
- if (shine < 230 && !descent){
- shine += 2;
- if (shine >= 230) descent = true;
- }else if (shine > 100 && descent){
- shine -= 2;
- if (shine <= 100) descent = false;
- }
- this.worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
- timer = 0;
- }
- }
- }
-
- public boolean canUpdate()
- {
- return ConfigHandler.CRYSTAL_GLOW;
- }
+public class TileEntityCrystal extends TileEntity {
+ public int shine = 120;
+ boolean descent = false;
+ int timer = 0;
+
+ @Override
+ public void updateEntity() {
+ if (ConfigHandler.CRYSTAL_GLOW) {
+ timer++;
+ if (timer > 20) {
+ if (shine < 230 && !descent) {
+ shine += 2;
+ if (shine >= 230)
+ descent = true;
+ } else if (shine > 100 && descent) {
+ shine -= 2;
+ if (shine <= 100)
+ descent = false;
+ }
+ this.worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord,
+ zCoord, xCoord, yCoord, zCoord);
+ timer = 0;
+ }
+ }
+ }
+
+ @Override
+ public boolean canUpdate() {
+ return ConfigHandler.CRYSTAL_GLOW;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java index c23ee15..a0c2600 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java @@ -8,126 +8,137 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
-public class TileEntityDisplayer extends TileEntity
-{
- public float ringTranslation1, ringTranslation2, ringTranslation3, rotAngle;
- public boolean isDescending1, isDescending2, isDescending3, isDirty, hasObject;
- public ItemStack object;
- public int quantity, infoIndex, timer = 0;
-
- /**
- *
- */
- public TileEntityDisplayer()
- {
- ringTranslation1 = 0.6f;
- ringTranslation2 = 0.3f;
- ringTranslation3 = 0.0f;
- rotAngle = 0;
- quantity = 0;
- infoIndex = 1;
- isDescending1 = false;
- isDescending2 = false;
- isDescending3 = false;
- isDirty = false;
- hasObject = false;
- object = new ItemStack(Item.getItemById(0), 0, 0);
- }
-
- /**
- * @param nbt
- */
- @Override
- public void writeToNBT(NBTTagCompound nbt)
- {
- super.writeToNBT(nbt);
- nbt.setFloat("translation1", ringTranslation1);
- nbt.setFloat("translation2", ringTranslation2);
- nbt.setFloat("translation3", ringTranslation3);
- nbt.setFloat("angle", rotAngle);
- nbt.setInteger("quantity", quantity);
- nbt.setInteger("infoIndex", infoIndex);
- nbt.setBoolean("descending1", isDescending1);
- nbt.setBoolean("descending2", isDescending2);
- nbt.setBoolean("descending3", isDescending3);
- nbt.setBoolean("hasObject", hasObject);
- NBTTagCompound tag = new NBTTagCompound();
- object.writeToNBT(tag);
- nbt.setTag("object", tag);
- }
-
- /**
- * @param nbt
- */
- @Override
- public void readFromNBT(NBTTagCompound nbt)
- {
- super.readFromNBT(nbt);
- ringTranslation1 = nbt.getFloat("translation1");
- ringTranslation2 = nbt.getFloat("translation2");
- ringTranslation3 = nbt.getFloat("translation3");
- rotAngle = nbt.getFloat("angle");
- quantity = nbt.getInteger("quantity");
- infoIndex = nbt.getInteger("infoIndex");
- isDescending1 = nbt.getBoolean("descending1");
- isDescending2 = nbt.getBoolean("descending2");
- isDescending3 = nbt.getBoolean("descending3");
- hasObject = nbt.getBoolean("hasObject");
- object = new ItemStack(Item.getItemById(0), 0, 0);
- object.readFromNBT(nbt.getCompoundTag("object"));
- }
-
- /**
- *
- */
- @Override
- public void updateEntity()
- {
- super.updateEntity();
- if (isDirty){
- worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
- isDirty = false;
- }
- if (ringTranslation1 >= 0.6) isDescending1 = true;
- if (ringTranslation1 <= 0) isDescending1 = false;
- if (!isDescending1) ringTranslation1 += 0.03;
- if (isDescending1) ringTranslation1 -= 0.03;
- if (ringTranslation2 >= 0.6) isDescending2 = true;
- if (ringTranslation2 <= 0) isDescending2 = false;
- if (!isDescending2) ringTranslation2 += 0.02;
- if (isDescending2) ringTranslation2 -= 0.02;
- if (ringTranslation3 >= 0.6) isDescending3 = true;
- if (ringTranslation3 <= 0) isDescending3 = false;
- if (!isDescending3) ringTranslation3 += 0.01;
- if (isDescending3) ringTranslation3 -= 0.01;
- if (rotAngle < 360F) rotAngle += 3F;
- if (rotAngle >= 360F) rotAngle = 0F;
- timer++;
- if (timer >= 40){
- infoIndex++;
- timer = 0;
- }
- }
-
- /**
- * @return
- */
- @Override
- public Packet getDescriptionPacket()
- {
- NBTTagCompound nbttagcompound = new NBTTagCompound();
- writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
- }
-
- /**
- * @param net
- * @param packet
- */
- @Override
- public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
- {
- readFromNBT(packet.func_148857_g());
- worldObj.func_147479_m(xCoord, yCoord, zCoord);
- }
+public class TileEntityDisplayer extends TileEntity {
+ public float ringTranslation1, ringTranslation2,
+ ringTranslation3, rotAngle;
+ public boolean isDescending1, isDescending2, isDescending3,
+ isDirty, hasObject;
+ public ItemStack object;
+ public int quantity, infoIndex, timer = 0;
+
+ /**
+ *
+ */
+ public TileEntityDisplayer() {
+ ringTranslation1 = 0.6f;
+ ringTranslation2 = 0.3f;
+ ringTranslation3 = 0.0f;
+ rotAngle = 0;
+ quantity = 0;
+ infoIndex = 1;
+ isDescending1 = false;
+ isDescending2 = false;
+ isDescending3 = false;
+ isDirty = false;
+ hasObject = false;
+ object = new ItemStack(Item.getItemById(0), 0, 0);
+ }
+
+ /**
+ * @param nbt
+ */
+ @Override
+ public void writeToNBT(NBTTagCompound nbt) {
+ super.writeToNBT(nbt);
+ nbt.setFloat("translation1", ringTranslation1);
+ nbt.setFloat("translation2", ringTranslation2);
+ nbt.setFloat("translation3", ringTranslation3);
+ nbt.setFloat("angle", rotAngle);
+ nbt.setInteger("quantity", quantity);
+ nbt.setInteger("infoIndex", infoIndex);
+ nbt.setBoolean("descending1", isDescending1);
+ nbt.setBoolean("descending2", isDescending2);
+ nbt.setBoolean("descending3", isDescending3);
+ nbt.setBoolean("hasObject", hasObject);
+ NBTTagCompound tag = new NBTTagCompound();
+ object.writeToNBT(tag);
+ nbt.setTag("object", tag);
+ }
+
+ /**
+ * @param nbt
+ */
+ @Override
+ public void readFromNBT(NBTTagCompound nbt) {
+ super.readFromNBT(nbt);
+ ringTranslation1 = nbt.getFloat("translation1");
+ ringTranslation2 = nbt.getFloat("translation2");
+ ringTranslation3 = nbt.getFloat("translation3");
+ rotAngle = nbt.getFloat("angle");
+ quantity = nbt.getInteger("quantity");
+ infoIndex = nbt.getInteger("infoIndex");
+ isDescending1 = nbt.getBoolean("descending1");
+ isDescending2 = nbt.getBoolean("descending2");
+ isDescending3 = nbt.getBoolean("descending3");
+ hasObject = nbt.getBoolean("hasObject");
+ object = new ItemStack(Item.getItemById(0), 0, 0);
+ object.readFromNBT(nbt.getCompoundTag("object"));
+ }
+
+ /**
+ *
+ */
+ @Override
+ public void updateEntity() {
+ super.updateEntity();
+ if (isDirty) {
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ isDirty = false;
+ }
+ if (ringTranslation1 >= 0.6)
+ isDescending1 = true;
+ if (ringTranslation1 <= 0)
+ isDescending1 = false;
+ if (!isDescending1)
+ ringTranslation1 += 0.03;
+ if (isDescending1)
+ ringTranslation1 -= 0.03;
+ if (ringTranslation2 >= 0.6)
+ isDescending2 = true;
+ if (ringTranslation2 <= 0)
+ isDescending2 = false;
+ if (!isDescending2)
+ ringTranslation2 += 0.02;
+ if (isDescending2)
+ ringTranslation2 -= 0.02;
+ if (ringTranslation3 >= 0.6)
+ isDescending3 = true;
+ if (ringTranslation3 <= 0)
+ isDescending3 = false;
+ if (!isDescending3)
+ ringTranslation3 += 0.01;
+ if (isDescending3)
+ ringTranslation3 -= 0.01;
+ if (rotAngle < 360F)
+ rotAngle += 3F;
+ if (rotAngle >= 360F)
+ rotAngle = 0F;
+ timer++;
+ if (timer >= 40) {
+ infoIndex++;
+ timer = 0;
+ }
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public Packet getDescriptionPacket() {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+ writeToNBT(nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1,
+ nbttagcompound);
+ }
+
+ /**
+ * @param net
+ * @param packet
+ */
+ @Override
+ public void onDataPacket(NetworkManager net,
+ S35PacketUpdateTileEntity packet) {
+ readFromNBT(packet.func_148857_g());
+ worldObj.func_147479_m(xCoord, yCoord, zCoord);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityHandPedestal.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityHandPedestal.java index e4a8602..c44cd88 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityHandPedestal.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityHandPedestal.java @@ -24,8 +24,8 @@ public class TileEntityHandPedestal extends TileEntity { private boolean isHandOpen;
/**
- *
- */
+ *
+ */
public TileEntityHandPedestal() {
isDirty = false;
heldItemStack = null;
@@ -55,14 +55,17 @@ public class TileEntityHandPedestal extends TileEntity { @Override
public void readFromNBT(NBTTagCompound tagCompound) {
super.readFromNBT(tagCompound);
- if (tagCompound.hasKey("object", 10)) setHeldItemStack(ItemStack.loadItemStackFromNBT(tagCompound.getCompoundTag("object")));
- else removeHeldItemStack();
+ if (tagCompound.hasKey("object", 10))
+ setHeldItemStack(ItemStack.loadItemStackFromNBT(
+ tagCompound.getCompoundTag("object")));
+ else
+ removeHeldItemStack();
isHandOpen = tagCompound.getBoolean("isHandOpen");
}
/**
- *
- */
+ *
+ */
@Override
public void updateEntity() {
super.updateEntity();
@@ -74,12 +77,14 @@ public class TileEntityHandPedestal extends TileEntity { }
/**
- *
- */
+ *
+ */
private void updateGrip() {
prevGrip = grip;
- if (grip > 0 && isHandOpen) grip -= 1 / gripScale;
- else if (grip < gripMax && !isHandOpen) grip += 1 / gripScale;
+ if (grip > 0 && isHandOpen)
+ grip -= 1 / gripScale;
+ else if (grip < gripMax && !isHandOpen)
+ grip += 1 / gripScale;
}
/**
@@ -89,7 +94,8 @@ public class TileEntityHandPedestal extends TileEntity { public Packet getDescriptionPacket() {
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0,
+ nbttagcompound);
}
/**
@@ -97,14 +103,15 @@ public class TileEntityHandPedestal extends TileEntity { * @param packet
*/
@Override
- public void onDataPacket(NetworkManager networkManager, S35PacketUpdateTileEntity packet) {
+ public void onDataPacket(NetworkManager networkManager,
+ S35PacketUpdateTileEntity packet) {
readFromNBT(packet.func_148857_g());
worldObj.func_147479_m(xCoord, yCoord, zCoord);
}
/**
- *
- */
+ *
+ */
@Override
public void markDirty() {
super.markDirty();
@@ -125,28 +132,30 @@ public class TileEntityHandPedestal extends TileEntity { if (heldItemStack != null && heldItemStack.getItem() != null) {
heldItemStack.stackSize = 1;
this.heldItemStack = heldItemStack;
- if (heldItemStack.getItem() instanceof ItemBlock) gripScale = 0.5f;
- else gripScale = 1;
+ if (heldItemStack.getItem() instanceof ItemBlock)
+ gripScale = 0.5f;
+ else
+ gripScale = 1;
}
}
/**
- *
- */
+ *
+ */
public void removeHeldItemStack() {
heldItemStack = null;
}
/**
- *
- */
+ *
+ */
public void openHand() {
isHandOpen = true;
}
/**
- *
- */
+ *
+ */
public void closeHand() {
isHandOpen = false;
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java index 830da74..1b0ec8a 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java @@ -13,127 +13,143 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
-public class TileEntityJewelrsCraftingTable extends TileEntity
-{
- public boolean hasJewelry, hasEndItem, isDirty, hasGem, crafting;
- public ItemStack jewelry, endItem, gem;
- public int carving, effect;
- public float angle;
-
- /**
- *
- */
- public TileEntityJewelrsCraftingTable()
- {
- jewelry = new ItemStack(Item.getItemById(0), 0, 0);
- endItem = new ItemStack(Item.getItemById(0), 0, 0);
- gem = new ItemStack(Item.getItemById(0), 0, 0);
- hasJewelry = false;
- hasEndItem = false;
- hasGem = false;
- crafting = false;
- carving = 0;
- effect = 0;
- angle = 0;
- isDirty = false;
- }
-
- /**
- * @param nbt
- */
- @Override
- public void writeToNBT(NBTTagCompound nbt)
- {
- super.writeToNBT(nbt);
- nbt.setBoolean("hasJewelry", hasJewelry);
- nbt.setBoolean("hasEndItem", hasEndItem);
- nbt.setBoolean("hasJewel", hasGem);
- nbt.setBoolean("crafting", crafting);
- nbt.setInteger("timer", carving);
- nbt.setInteger("effect", effect);
- nbt.setFloat("angle", angle);
- NBTTagCompound tag1 = new NBTTagCompound();
- NBTTagCompound tag2 = new NBTTagCompound();
- NBTTagCompound tag3 = new NBTTagCompound();
- jewelry.writeToNBT(tag1);
- nbt.setTag("jewelry", tag1);
- endItem.writeToNBT(tag2);
- nbt.setTag("endItem", tag2);
- gem.writeToNBT(tag3);
- nbt.setTag("jewel", tag3);
- }
-
- /**
- * @param nbt
- */
- @Override
- public void readFromNBT(NBTTagCompound nbt)
- {
- super.readFromNBT(nbt);
- hasJewelry = nbt.getBoolean("hasJewelry");
- hasEndItem = nbt.getBoolean("hasEndItem");
- hasGem = nbt.getBoolean("hasJewel");
- crafting = nbt.getBoolean("crafting");
- carving = nbt.getInteger("timer");
- effect = nbt.getInteger("effect");
- angle = nbt.getFloat("angle");
- jewelry = new ItemStack(Item.getItemById(0), 0, 0);
- jewelry.readFromNBT(nbt.getCompoundTag("jewelry"));
- endItem = new ItemStack(Item.getItemById(0), 0, 0);
- endItem.readFromNBT(nbt.getCompoundTag("endItem"));
- gem = new ItemStack(Item.getItemById(0), 0, 0);
- gem.readFromNBT(nbt.getCompoundTag("jewel"));
- }
-
- /**
- *
- */
- @Override
- public void updateEntity()
- {
- super.updateEntity();
- if (isDirty){
- worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
- isDirty = false;
- }
- if (angle < 360F) angle += 3F;
- else angle = 0F;
- if (hasJewelry && hasGem && !hasEndItem && crafting){
- if (carving > 0) carving--;
- if (crafting) for(int l = 0; l < ConfigHandler.GEM_PLACEMENT_TIME / (carving + 2); ++l){
- if (worldObj.rand.nextInt(10) == 0) worldObj.playSoundEffect(xCoord, yCoord + 0.5F, zCoord, "random.orb", 0.05F, 1F);
- if (getBlockMetadata() == 0) worldObj.spawnParticle("instantSpell", xCoord + 0.5F, (double)yCoord + 0.8F, zCoord + 0.2F, 0.0D, 0.0D, 0.0D);
- if (getBlockMetadata() == 1) worldObj.spawnParticle("instantSpell", xCoord + 0.8F, (double)yCoord + 0.8F, zCoord + 0.5F, 0.0D, 0.0D, 0.0D);
- if (getBlockMetadata() == 2) worldObj.spawnParticle("instantSpell", xCoord + 0.5F, (double)yCoord + 0.8F, zCoord + 0.8F, 0.0D, 0.0D, 0.0D);
- if (getBlockMetadata() == 3) worldObj.spawnParticle("instantSpell", xCoord + 0.2F, (double)yCoord + 0.8F, zCoord + 0.5F, 0.0D, 0.0D, 0.0D);
- }
- if (carving == 0){
- hasEndItem = true;
- endItem = jewelry.copy();
- if (hasGem && gem != new ItemStack(Item.getItemById(0), 0, 0)) if (!JewelryNBT.hasTag(jewelry, "gem")){
- JewelryNBT.addGem(endItem, gem);
- hasGem = false;
- gem = new ItemStack(Item.getItemById(0), 0, 0);
- }else{
- ItemStack aux = JewelryNBT.gem(jewelry);
- JewelryNBT.addGem(endItem, gem);
- if (JewelrycraftUtil.rand.nextBoolean()) gem = aux.copy();
- else{
- hasGem = false;
- gem = new ItemStack(Item.getItemById(0), 0, 0);
- }
- }
- hasJewelry = false;
- jewelry = new ItemStack(Item.getItemById(0), 0, 0);
- carving = -1;
- crafting = false;
- isDirty = true;
- }
- }
- }
-
- public void setGemItemStack(ItemStack itemStack)
- {
+public class TileEntityJewelrsCraftingTable extends TileEntity {
+ public boolean hasJewelry, hasEndItem, isDirty, hasGem, crafting;
+ public ItemStack jewelry, endItem, gem;
+ public int carving, effect;
+ public float angle;
+
+ /**
+ *
+ */
+ public TileEntityJewelrsCraftingTable() {
+ jewelry = new ItemStack(Item.getItemById(0), 0, 0);
+ endItem = new ItemStack(Item.getItemById(0), 0, 0);
+ gem = new ItemStack(Item.getItemById(0), 0, 0);
+ hasJewelry = false;
+ hasEndItem = false;
+ hasGem = false;
+ crafting = false;
+ carving = 0;
+ effect = 0;
+ angle = 0;
+ isDirty = false;
+ }
+
+ /**
+ * @param nbt
+ */
+ @Override
+ public void writeToNBT(NBTTagCompound nbt) {
+ super.writeToNBT(nbt);
+ nbt.setBoolean("hasJewelry", hasJewelry);
+ nbt.setBoolean("hasEndItem", hasEndItem);
+ nbt.setBoolean("hasJewel", hasGem);
+ nbt.setBoolean("crafting", crafting);
+ nbt.setInteger("timer", carving);
+ nbt.setInteger("effect", effect);
+ nbt.setFloat("angle", angle);
+ NBTTagCompound tag1 = new NBTTagCompound();
+ NBTTagCompound tag2 = new NBTTagCompound();
+ NBTTagCompound tag3 = new NBTTagCompound();
+ jewelry.writeToNBT(tag1);
+ nbt.setTag("jewelry", tag1);
+ endItem.writeToNBT(tag2);
+ nbt.setTag("endItem", tag2);
+ gem.writeToNBT(tag3);
+ nbt.setTag("jewel", tag3);
+ }
+
+ /**
+ * @param nbt
+ */
+ @Override
+ public void readFromNBT(NBTTagCompound nbt) {
+ super.readFromNBT(nbt);
+ hasJewelry = nbt.getBoolean("hasJewelry");
+ hasEndItem = nbt.getBoolean("hasEndItem");
+ hasGem = nbt.getBoolean("hasJewel");
+ crafting = nbt.getBoolean("crafting");
+ carving = nbt.getInteger("timer");
+ effect = nbt.getInteger("effect");
+ angle = nbt.getFloat("angle");
+ jewelry = new ItemStack(Item.getItemById(0), 0, 0);
+ jewelry.readFromNBT(nbt.getCompoundTag("jewelry"));
+ endItem = new ItemStack(Item.getItemById(0), 0, 0);
+ endItem.readFromNBT(nbt.getCompoundTag("endItem"));
+ gem = new ItemStack(Item.getItemById(0), 0, 0);
+ gem.readFromNBT(nbt.getCompoundTag("jewel"));
+ }
+
+ /**
+ *
+ */
+ @Override
+ public void updateEntity() {
+ super.updateEntity();
+ if (isDirty) {
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ isDirty = false;
+ }
+ if (angle < 360F)
+ angle += 3F;
+ else
+ angle = 0F;
+ if (hasJewelry && hasGem && !hasEndItem && crafting) {
+ if (carving > 0)
+ carving--;
+ if (crafting)
+ for (int l = 0; l < ConfigHandler.GEM_PLACEMENT_TIME
+ / (carving + 2); ++l) {
+ if (worldObj.rand.nextInt(10) == 0)
+ worldObj.playSoundEffect(xCoord, yCoord + 0.5F,
+ zCoord, "random.orb", 0.05F, 1F);
+ if (getBlockMetadata() == 0)
+ worldObj.spawnParticle("instantSpell",
+ xCoord + 0.5F, (double) yCoord + 0.8F,
+ zCoord + 0.2F, 0.0D, 0.0D, 0.0D);
+ if (getBlockMetadata() == 1)
+ worldObj.spawnParticle("instantSpell",
+ xCoord + 0.8F, (double) yCoord + 0.8F,
+ zCoord + 0.5F, 0.0D, 0.0D, 0.0D);
+ if (getBlockMetadata() == 2)
+ worldObj.spawnParticle("instantSpell",
+ xCoord + 0.5F, (double) yCoord + 0.8F,
+ zCoord + 0.8F, 0.0D, 0.0D, 0.0D);
+ if (getBlockMetadata() == 3)
+ worldObj.spawnParticle("instantSpell",
+ xCoord + 0.2F, (double) yCoord + 0.8F,
+ zCoord + 0.5F, 0.0D, 0.0D, 0.0D);
+ }
+ if (carving == 0) {
+ hasEndItem = true;
+ endItem = jewelry.copy();
+ if (hasGem
+ && gem != new ItemStack(Item.getItemById(0), 0, 0))
+ if (!JewelryNBT.hasTag(jewelry, "gem")) {
+ JewelryNBT.addGem(endItem, gem);
+ hasGem = false;
+ gem = new ItemStack(Item.getItemById(0), 0, 0);
+ } else {
+ ItemStack aux = JewelryNBT.gem(jewelry);
+ JewelryNBT.addGem(endItem, gem);
+ if (JewelrycraftUtil.rand.nextBoolean())
+ gem = aux.copy();
+ else {
+ hasGem = false;
+ gem = new ItemStack(Item.getItemById(0), 0, 0);
+ }
+ }
+ hasJewelry = false;
+ jewelry = new ItemStack(Item.getItemById(0), 0, 0);
+ carving = -1;
+ crafting = false;
+ isDirty = true;
+ }
+ }
+ }
+
+ public void setGemItemStack(ItemStack itemStack) {
if (itemStack != null && itemStack.getItem() != null) {
this.gem = itemStack.copy();
this.gem.stackSize = 1;
@@ -141,9 +157,8 @@ public class TileEntityJewelrsCraftingTable extends TileEntity this.isDirty = true;
}
}
-
- public void setJewelryItemStack(ItemStack itemStack)
- {
+
+ public void setJewelryItemStack(ItemStack itemStack) {
if (itemStack != null && itemStack.getItem() != null) {
this.jewelry = itemStack.copy();
this.jewelry.stackSize = 1;
@@ -151,73 +166,70 @@ public class TileEntityJewelrsCraftingTable extends TileEntity this.isDirty = true;
}
}
-
- public void setCrafting()
- {
+
+ public void setCrafting() {
carving = ConfigHandler.GEM_PLACEMENT_TIME;
angle = 0;
crafting = true;
isDirty = true;
}
-
- public void removeGem()
- {
- dropItem(worldObj, xCoord, yCoord, zCoord, gem.copy());
- gem = new ItemStack(Item.getItemById(0), 0, 0);
- hasGem = false;
- carving = -1;
- crafting = false;
- angle = 0F;
- isDirty = true;
+
+ public void removeGem() {
+ dropItem(worldObj, xCoord, yCoord, zCoord, gem.copy());
+ gem = new ItemStack(Item.getItemById(0), 0, 0);
+ hasGem = false;
+ carving = -1;
+ crafting = false;
+ angle = 0F;
+ isDirty = true;
}
-
- public void removeJewelry()
- {
- dropItem(worldObj, xCoord, yCoord, zCoord, jewelry.copy());
- jewelry = new ItemStack(Item.getItemById(0), 0, 0);
- hasJewelry = false;
- carving = -1;
- crafting = false;
- angle = 0F;
- isDirty = true;
+
+ public void removeJewelry() {
+ dropItem(worldObj, xCoord, yCoord, zCoord, jewelry.copy());
+ jewelry = new ItemStack(Item.getItemById(0), 0, 0);
+ hasJewelry = false;
+ carving = -1;
+ crafting = false;
+ angle = 0F;
+ isDirty = true;
}
-
- public void removeResult()
- {
- dropItem(worldObj, xCoord, yCoord, zCoord, endItem.copy());
- endItem = new ItemStack(Item.getItemById(0), 0, 0);
- hasEndItem = false;
- isDirty = true;
+
+ public void removeResult() {
+ dropItem(worldObj, xCoord, yCoord, zCoord, endItem.copy());
+ endItem = new ItemStack(Item.getItemById(0), 0, 0);
+ hasEndItem = false;
+ isDirty = true;
+ }
+
+ public void dropItem(World world, double x, double y, double z,
+ ItemStack stack) {
+ EntityItem entityitem =
+ new EntityItem(world, x + 0.5D, y + 1D, z + 0.5D, stack);
+ entityitem.motionX = 0;
+ entityitem.motionZ = 0;
+ entityitem.motionY = 0.21000000298023224D;
+ world.spawnEntityInWorld(entityitem);
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public Packet getDescriptionPacket() {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+ writeToNBT(nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1,
+ nbttagcompound);
+ }
+
+ /**
+ * @param net
+ * @param packet
+ */
+ @Override
+ public void onDataPacket(NetworkManager net,
+ S35PacketUpdateTileEntity packet) {
+ readFromNBT(packet.func_148857_g());
+ worldObj.func_147479_m(xCoord, yCoord, zCoord);
}
-
- public void dropItem(World world, double x, double y, double z, ItemStack stack)
- {
- EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1D, z + 0.5D, stack);
- entityitem.motionX = 0;
- entityitem.motionZ = 0;
- entityitem.motionY = 0.21000000298023224D;
- world.spawnEntityInWorld(entityitem);
- }
-
- /**
- * @return
- */
- @Override
- public Packet getDescriptionPacket()
- {
- NBTTagCompound nbttagcompound = new NBTTagCompound();
- writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
- }
-
- /**
- * @param net
- * @param packet
- */
- @Override
- public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
- {
- readFromNBT(packet.func_148857_g());
- worldObj.func_147479_m(xCoord, yCoord, zCoord);
- }
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMidasTouch.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMidasTouch.java index 1cee6d0..5d37f65 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMidasTouch.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMidasTouch.java @@ -9,75 +9,71 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; -public class TileEntityMidasTouch extends TileEntity -{ - public Entity target; - - public TileEntityMidasTouch() - {} - - public void setEntity(Entity ent) - { - target = ent; - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - if (target != null){ - int id = EntityList.getEntityID(target); - NBTTagCompound tag = new NBTTagCompound(); - target.writeToNBT(tag); - nbt.setInteger("entityID", id); - nbt.setTag("entity", tag); - } - } - - /** - * @param nbt - */ - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - NBTTagCompound en = (NBTTagCompound)nbt.getTag("entity"); - int entityID = nbt.getInteger("entityID"); - EntityLivingBase entity = (EntityLivingBase)EntityList.createEntityByID(entityID, worldObj); - if (entity != null){ - entity.readFromNBT(en); - target = entity; - } - } - - /** - * - */ - @Override - public boolean canUpdate() - { - return false; - } - - /** - * @return - */ - @Override - public Packet getDescriptionPacket() - { - NBTTagCompound nbttagcompound = new NBTTagCompound(); - writeToNBT(nbttagcompound); - return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound); - } - - /** - * @param net - * @param packet - */ - @Override - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) - { - readFromNBT(packet.func_148857_g()); - worldObj.func_147479_m(xCoord, yCoord, zCoord); - } +public class TileEntityMidasTouch extends TileEntity { + public Entity target; + + public TileEntityMidasTouch() { + } + + public void setEntity(Entity ent) { + target = ent; + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + if (target != null) { + int id = EntityList.getEntityID(target); + NBTTagCompound tag = new NBTTagCompound(); + target.writeToNBT(tag); + nbt.setInteger("entityID", id); + nbt.setTag("entity", tag); + } + } + + /** + * @param nbt + */ + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + NBTTagCompound en = (NBTTagCompound) nbt.getTag("entity"); + int entityID = nbt.getInteger("entityID"); + EntityLivingBase entity = (EntityLivingBase) EntityList + .createEntityByID(entityID, worldObj); + if (entity != null) { + entity.readFromNBT(en); + target = entity; + } + } + + /** + * + */ + @Override + public boolean canUpdate() { + return false; + } + + /** + * @return + */ + @Override + public Packet getDescriptionPacket() { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + writeToNBT(nbttagcompound); + return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, + nbttagcompound); + } + + /** + * @param net + * @param packet + */ + @Override + public void onDataPacket(NetworkManager net, + S35PacketUpdateTileEntity packet) { + readFromNBT(packet.func_148857_g()); + worldObj.func_147479_m(xCoord, yCoord, zCoord); + } } diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java index b2fe655..9fca5fc 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java @@ -10,135 +10,144 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
-public class TileEntityMolder extends TileEntity
-{
- public int cooling;
- public boolean hasMoltenMetal, hasJewelBase, hasMold, isDirty;
- public ItemStack mold, jewelBase, moltenMetal, ringMetal;
- public float quantity;
-
- /**
- *
- */
- public TileEntityMolder()
- {
- moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
- jewelBase = new ItemStack(Item.getItemById(0), 0, 0);
- mold = new ItemStack(Item.getItemById(0), 0, 0);
- ringMetal = new ItemStack(Item.getItemById(0), 0, 0);
- cooling = -1;
- quantity = 0f;
- hasJewelBase = false;
- hasMoltenMetal = false;
- hasMold = false;
- isDirty = false;
- }
-
- /**
- * @param nbt
- */
- @Override
- public void writeToNBT(NBTTagCompound nbt)
- {
- super.writeToNBT(nbt);
- nbt.setInteger("cooling", cooling);
- nbt.setFloat("quantity", quantity);
- nbt.setBoolean("hasJewelBase", hasJewelBase);
- nbt.setBoolean("hasMoltenMetal", hasMoltenMetal);
- nbt.setBoolean("hasMold", hasMold);
- NBTTagCompound tag = new NBTTagCompound();
- NBTTagCompound tag1 = new NBTTagCompound();
- NBTTagCompound tag2 = new NBTTagCompound();
- NBTTagCompound tag3 = new NBTTagCompound();
- mold.writeToNBT(tag);
- nbt.setTag("mold", tag);
- jewelBase.writeToNBT(tag1);
- nbt.setTag("jewelBase", tag1);
- moltenMetal.writeToNBT(tag2);
- nbt.setTag("moltenMetal", tag2);
- ringMetal.writeToNBT(tag3);
- nbt.setTag("ringMetal", tag3);
- }
-
- /**
- * @param nbt
- */
- @Override
- public void readFromNBT(NBTTagCompound nbt)
- {
- super.readFromNBT(nbt);
- cooling = nbt.getInteger("cooling");
- quantity = nbt.getFloat("quantity");
- hasJewelBase = nbt.getBoolean("hasJewelBase");
- hasMoltenMetal = nbt.getBoolean("hasMoltenMetal");
- hasMold = nbt.getBoolean("hasMold");
- mold = new ItemStack(Item.getItemById(0), 0, 0);
- mold.readFromNBT(nbt.getCompoundTag("mold"));
- jewelBase = new ItemStack(Item.getItemById(0), 0, 0);
- jewelBase.readFromNBT(nbt.getCompoundTag("jewelBase"));
- moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
- moltenMetal.readFromNBT(nbt.getCompoundTag("moltenMetal"));
- ringMetal = new ItemStack(Item.getItemById(0), 0, 0);
- ringMetal.readFromNBT(nbt.getCompoundTag("ringMetal"));
- }
-
- /**
- *
- */
- @Override
- public void updateEntity()
- {
- super.updateEntity();
- if (isDirty){
- worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
- isDirty = false;
- }
- if (hasMoltenMetal && moltenMetal.getItem() != Item.getItemById(0) && quantity > 0f){
- if (worldObj.rand.nextInt(20) == 0) worldObj.playSoundEffect(xCoord, yCoord + 0.5F, zCoord, "random.fizz", 0.5F, 1F);
- for(int l = 0; l < 2; ++l)
- worldObj.spawnParticle("reddust", xCoord + Math.random(), (double)yCoord + 0.2F, zCoord + Math.random(), 0.0D, 1.0D, 1.0D);
- }
- if (hasMoltenMetal && !hasJewelBase && quantity >= 0.1f){
- ringMetal = moltenMetal.copy();
- if (cooling > 0) cooling--;
- if (cooling <= 0f){
- if (mold.getItemDamage() == 0) jewelBase = moltenMetal;
- else if (mold.getItemDamage() == 1) jewelBase = new ItemStack(ItemList.ring);
- else if (mold.getItemDamage() == 2) jewelBase = new ItemStack(ItemList.necklace);
- else if (mold.getItemDamage() == 3) jewelBase = new ItemStack(ItemList.bracelet);
- else if (mold.getItemDamage() == 4) jewelBase = new ItemStack(ItemList.earrings);
- ringMetal.stackSize = 1;
- jewelBase.stackSize = 1;
- if (mold.getItemDamage() != 0 && jewelBase != new ItemStack(Item.getItemById(0), 0, 0)) JewelryNBT.addMetal(jewelBase, ringMetal);
- hasMoltenMetal = false;
- moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
- hasJewelBase = true;
- cooling = -1;
- quantity = 0f;
- isDirty = true;
- }
- }
- }
-
- /**
- * @return
- */
- @Override
- public Packet getDescriptionPacket()
- {
- NBTTagCompound nbttagcompound = new NBTTagCompound();
- writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
- }
-
- /**
- * @param net
- * @param packet
- */
- @Override
- public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
- {
- readFromNBT(packet.func_148857_g());
- worldObj.func_147479_m(xCoord, yCoord, zCoord);
- }
+public class TileEntityMolder extends TileEntity {
+ public int cooling;
+ public boolean hasMoltenMetal, hasJewelBase, hasMold, isDirty;
+ public ItemStack mold, jewelBase, moltenMetal, ringMetal;
+ public float quantity;
+
+ /**
+ *
+ */
+ public TileEntityMolder() {
+ moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
+ jewelBase = new ItemStack(Item.getItemById(0), 0, 0);
+ mold = new ItemStack(Item.getItemById(0), 0, 0);
+ ringMetal = new ItemStack(Item.getItemById(0), 0, 0);
+ cooling = -1;
+ quantity = 0f;
+ hasJewelBase = false;
+ hasMoltenMetal = false;
+ hasMold = false;
+ isDirty = false;
+ }
+
+ /**
+ * @param nbt
+ */
+ @Override
+ public void writeToNBT(NBTTagCompound nbt) {
+ super.writeToNBT(nbt);
+ nbt.setInteger("cooling", cooling);
+ nbt.setFloat("quantity", quantity);
+ nbt.setBoolean("hasJewelBase", hasJewelBase);
+ nbt.setBoolean("hasMoltenMetal", hasMoltenMetal);
+ nbt.setBoolean("hasMold", hasMold);
+ NBTTagCompound tag = new NBTTagCompound();
+ NBTTagCompound tag1 = new NBTTagCompound();
+ NBTTagCompound tag2 = new NBTTagCompound();
+ NBTTagCompound tag3 = new NBTTagCompound();
+ mold.writeToNBT(tag);
+ nbt.setTag("mold", tag);
+ jewelBase.writeToNBT(tag1);
+ nbt.setTag("jewelBase", tag1);
+ moltenMetal.writeToNBT(tag2);
+ nbt.setTag("moltenMetal", tag2);
+ ringMetal.writeToNBT(tag3);
+ nbt.setTag("ringMetal", tag3);
+ }
+
+ /**
+ * @param nbt
+ */
+ @Override
+ public void readFromNBT(NBTTagCompound nbt) {
+ super.readFromNBT(nbt);
+ cooling = nbt.getInteger("cooling");
+ quantity = nbt.getFloat("quantity");
+ hasJewelBase = nbt.getBoolean("hasJewelBase");
+ hasMoltenMetal = nbt.getBoolean("hasMoltenMetal");
+ hasMold = nbt.getBoolean("hasMold");
+ mold = new ItemStack(Item.getItemById(0), 0, 0);
+ mold.readFromNBT(nbt.getCompoundTag("mold"));
+ jewelBase = new ItemStack(Item.getItemById(0), 0, 0);
+ jewelBase.readFromNBT(nbt.getCompoundTag("jewelBase"));
+ moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
+ moltenMetal.readFromNBT(nbt.getCompoundTag("moltenMetal"));
+ ringMetal = new ItemStack(Item.getItemById(0), 0, 0);
+ ringMetal.readFromNBT(nbt.getCompoundTag("ringMetal"));
+ }
+
+ /**
+ *
+ */
+ @Override
+ public void updateEntity() {
+ super.updateEntity();
+ if (isDirty) {
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ isDirty = false;
+ }
+ if (hasMoltenMetal && moltenMetal.getItem() != Item.getItemById(0)
+ && quantity > 0f) {
+ if (worldObj.rand.nextInt(20) == 0)
+ worldObj.playSoundEffect(xCoord, yCoord + 0.5F, zCoord,
+ "random.fizz", 0.5F, 1F);
+ for (int l = 0; l < 2; ++l)
+ worldObj.spawnParticle("reddust", xCoord + Math.random(),
+ (double) yCoord + 0.2F, zCoord + Math.random(),
+ 0.0D, 1.0D, 1.0D);
+ }
+ if (hasMoltenMetal && !hasJewelBase && quantity >= 0.1f) {
+ ringMetal = moltenMetal.copy();
+ if (cooling > 0)
+ cooling--;
+ if (cooling <= 0f) {
+ if (mold.getItemDamage() == 0)
+ jewelBase = moltenMetal;
+ else if (mold.getItemDamage() == 1)
+ jewelBase = new ItemStack(ItemList.ring);
+ else if (mold.getItemDamage() == 2)
+ jewelBase = new ItemStack(ItemList.necklace);
+ else if (mold.getItemDamage() == 3)
+ jewelBase = new ItemStack(ItemList.bracelet);
+ else if (mold.getItemDamage() == 4)
+ jewelBase = new ItemStack(ItemList.earrings);
+ ringMetal.stackSize = 1;
+ jewelBase.stackSize = 1;
+ if (mold.getItemDamage() != 0
+ && jewelBase != new ItemStack(Item.getItemById(0),
+ 0, 0))
+ JewelryNBT.addMetal(jewelBase, ringMetal);
+ hasMoltenMetal = false;
+ moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
+ hasJewelBase = true;
+ cooling = -1;
+ quantity = 0f;
+ isDirty = true;
+ }
+ }
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public Packet getDescriptionPacket() {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+ writeToNBT(nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1,
+ nbttagcompound);
+ }
+
+ /**
+ * @param net
+ * @param packet
+ */
+ @Override
+ public void onDataPacket(NetworkManager net,
+ S35PacketUpdateTileEntity packet) {
+ readFromNBT(packet.func_148857_g());
+ worldObj.func_147479_m(xCoord, yCoord, zCoord);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMoltenMetal.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMoltenMetal.java index f8efb14..405011a 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMoltenMetal.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMoltenMetal.java @@ -20,13 +20,16 @@ public class TileEntityMoltenMetal extends TileEntity { metal = null;
}
+ @Override
public boolean canUpdate() {
return false;
}
public void setMetal(ItemStack metal) {
- if(metal != null) this.metal = metal.copy();
- else this.metal = null;
+ if (metal != null)
+ this.metal = metal.copy();
+ else
+ this.metal = null;
}
public ItemStack getMetal() {
@@ -46,19 +49,24 @@ public class TileEntityMoltenMetal extends TileEntity { @Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
- if (nbt.hasKey("metal")) setMetal(ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("metal")));
- else metal = null;
+ if (nbt.hasKey("metal"))
+ setMetal(ItemStack
+ .loadItemStackFromNBT(nbt.getCompoundTag("metal")));
+ else
+ metal = null;
}
@Override
public Packet getDescriptionPacket() {
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0,
+ nbttagcompound);
}
@Override
- public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
+ public void onDataPacket(NetworkManager net,
+ S35PacketUpdateTileEntity packet) {
readFromNBT(packet.func_148857_g());
worldObj.func_147479_m(xCoord, yCoord, zCoord);
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java index cdc3ac5..234417d 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.tileentity;
import java.util.ArrayList;
+
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import darkknight.jewelrycraft.block.BlockHandPedestal;
@@ -25,335 +26,511 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
-public class TileEntityShadowEye extends TileEntity
-{
- public int opening, timer, t = 20, soundTimer;
- public boolean active, shouldAddData;
- public ArrayList<ItemStack> pedestalItems = new ArrayList<ItemStack>();
- ResourceLocation particleTexture = new ResourceLocation(Variables.MODID, "textures/particle/shadows.png");
- public EntityPlayer target;
- public ModelShadowEye model = new ModelShadowEye();
-
- public TileEntityShadowEye()
- {
- opening = 1;
- timer = 20;
- active = false;
- }
-
- @Override
- public void writeToNBT(NBTTagCompound nbt)
- {
- super.writeToNBT(nbt);
- nbt.setInteger("opening", opening);
- nbt.setInteger("timer", timer);
- nbt.setBoolean("active", active);
- nbt.setBoolean("shouldAddData", shouldAddData);
- }
-
- @Override
- public void readFromNBT(NBTTagCompound nbt)
- {
- super.readFromNBT(nbt);
- opening = nbt.getInteger("opening");
- timer = nbt.getInteger("timer");
- active = nbt.getBoolean("active");
- shouldAddData = nbt.getBoolean("shouldAddData");
- }
-
- @Override
- public void updateEntity()
- {
- super.updateEntity();
- boolean valid = isValidStructure(worldObj, xCoord, yCoord, zCoord, blockMetadata);
- boolean canStartRitual = valid && ((TileEntityHandPedestal)worldObj.getTileEntity(xCoord, yCoord - 3, zCoord)).heldItemStack != null && getNumberOfItems(worldObj, xCoord, yCoord, zCoord) > 0;
- if (active){
- timer--;
- if (canStartRitual && canChangePedestals(worldObj, xCoord, yCoord, zCoord) && opening == 4) changePedestals(worldObj, xCoord, yCoord, zCoord);
- }
- if (active && target != null && this.getDistanceFrom(target.posX, target.posY, target.posZ) > 27D){
- active = false;
- timer = -1;
- shouldAddData = false;
- revertPedestals(worldObj, xCoord, yCoord, zCoord);
- }
- if (opening == 4 && timer <= 0) active = false;
- if (!active && timer <= 0 && opening != 1){
- if (t > 0) t--;
- if (t <= 0){
- opening--;
- t = 20;
- }
- }
- if (opening == 2 && timer <= 0 && t == 10 && shouldAddData){
- addData(worldObj, xCoord, yCoord, zCoord);
- TileEntityHandPedestal target = (TileEntityHandPedestal)worldObj.getTileEntity(xCoord, yCoord - 3, zCoord);
- if (target != null && target.getHeldItemStack() != null) JewelryNBT.addModifiers(target.getHeldItemStack(), pedestalItems);
- revertPedestals(worldObj, xCoord, yCoord, zCoord);
- }
- if (active && timer <= 0){
- if (opening < 4){
- opening++;
- timer = 20;
- soundTimer = 0;
- }
- if (canStartRitual && opening == 4) timer = ConfigHandler.RITUAL_TIME;
- else if (!canStartRitual){
- shouldAddData = false;
- active = false;
- timer = -1;
- if (!worldObj.isRemote){
- JewelrycraftUtil.addCursePoints(target, 50);
- target.addChatMessage(new ChatComponentText(EnumChatFormatting.BLACK + "The Shadows don't like to be disturbed for no reason!"));
- target.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE + "You feel a strange aura encumbering you."));
- }
- }
- }
- if (active && opening == 4){
- for(int l = 0; l <= 100; l++)
- worldObj.spawnParticle("depthsuspend", xCoord + 6.5F - worldObj.rand.nextInt(12) - worldObj.rand.nextFloat(), yCoord - 2F + worldObj.rand.nextInt(9) - worldObj.rand.nextFloat(), zCoord + 6.5F - worldObj.rand.nextInt(12) - worldObj.rand.nextFloat(), 0, 0, 0);
- if(soundTimer == 0) worldObj.playSound(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "jewelrycraft2:Ritual", 1.0F, 1.0F, false);
- if(soundTimer < 20*14) soundTimer++;
- else soundTimer = 0;
- }
- }
-
- public boolean isValidStructure(World world, int x, int y, int z, int metadata)
- {
- if (world.getBlockMetadata(x, y, z) == 0 || world.getBlockMetadata(x, y, z) == 2){
- // Layers from top to bottom
- // 1st Layer
- if (world.getBlock(x, y + 1, z) != Blocks.stone_slab || world.getBlockMetadata(x, y + 1, z) != 5) return false;
- if (world.getBlock(x + 1, y + 1, z) != Blocks.stone_slab || world.getBlockMetadata(x + 1, y + 1, z) != 5) return false;
- if (world.getBlock(x - 1, y + 1, z) != Blocks.stone_slab || world.getBlockMetadata(x - 1, y + 1, z) != 5) return false;
- // 2nd Layer
- if (world.getBlock(x + 2, y, z) != Blocks.stone_brick_stairs || world.getBlockMetadata(x + 2, y, z) != 1) return false;
- if (world.getBlock(x + 1, y, z) != Blocks.stone_brick_stairs || world.getBlockMetadata(x + 1, y, z) != 4) return false;
- if (world.getBlock(x - 1, y, z) != Blocks.stone_brick_stairs || world.getBlockMetadata(x - 1, y, z) != 5) return false;
- if (world.getBlock(x - 2, y, z) != Blocks.stone_brick_stairs || world.getBlockMetadata(x - 2, y, z) != 0) return false;
- // 3rd Layer
- if (world.getBlock(x + 2, y - 1, z) != Blocks.stonebrick) return false;
- if (world.getBlock(x - 2, y - 1, z) != Blocks.stonebrick) return false;
- // 4th Layer
- if (world.getBlock(x + 2, y - 2, z) != Blocks.stonebrick) return false;
- if (world.getBlock(x - 2, y - 2, z) != Blocks.stonebrick) return false;
- // 5th Layer
- if (world.getBlock(x + 2, y - 3, z) != Blocks.stonebrick) return false;
- if (world.getBlock(x - 2, y - 3, z) != Blocks.stonebrick) return false;
- }else if (world.getBlockMetadata(x, y, z) == 1 || world.getBlockMetadata(x, y, z) == 3){
- // Layers from top to bottom
- // 1st Layer
- if (world.getBlock(x, y + 1, z) != Blocks.stone_slab || world.getBlockMetadata(x, y + 1, z) != 5) return false;
- if (world.getBlock(x, y + 1, z + 1) != Blocks.stone_slab || world.getBlockMetadata(x, y + 1, z + 1) != 5) return false;
- if (world.getBlock(x, y + 1, z - 1) != Blocks.stone_slab || world.getBlockMetadata(x, y + 1, z - 1) != 5) return false;
- // 2nd Layer
- if (world.getBlock(x, y, z + 2) != Blocks.stone_brick_stairs || world.getBlockMetadata(x, y, z + 2) != 3) return false;
- if (world.getBlock(x, y, z + 1) != Blocks.stone_brick_stairs || world.getBlockMetadata(x, y, z + 1) != 6) return false;
- if (world.getBlock(x, y, z - 1) != Blocks.stone_brick_stairs || world.getBlockMetadata(x, y, z - 1) != 7) return false;
- if (world.getBlock(x, y, z - 2) != Blocks.stone_brick_stairs || world.getBlockMetadata(x, y, z - 2) != 2) return false;
- // 3rd Layer
- if (world.getBlock(x, y - 1, z + 2) != Blocks.stonebrick) return false;
- if (world.getBlock(x, y - 1, z - 2) != Blocks.stonebrick) return false;
- // 4th Layer
- if (world.getBlock(x, y - 2, z + 2) != Blocks.stonebrick) return false;
- if (world.getBlock(x, y - 2, z - 2) != Blocks.stonebrick) return false;
- // 5th Layer
- if (world.getBlock(x, y - 3, z + 2) != Blocks.stonebrick) return false;
- if (world.getBlock(x, y - 3, z - 2) != Blocks.stonebrick) return false;
- }
- // 3rd Layer
- if (world.getBlock(x - 4, y - 1, z - 4) != BlockList.shadowBlock) return false;
- if (world.getBlock(x - 4, y - 1, z + 4) != BlockList.shadowBlock) return false;
- if (world.getBlock(x + 4, y - 1, z - 4) != BlockList.shadowBlock) return false;
- if (world.getBlock(x + 4, y - 1, z + 4) != BlockList.shadowBlock) return false;
- // 4th Layer
- if (world.getBlock(x - 4, y - 2, z - 4) != Blocks.stonebrick) return false;
- if (world.getBlock(x - 4, y - 2, z + 4) != Blocks.stonebrick) return false;
- if (world.getBlock(x + 4, y - 2, z - 4) != Blocks.stonebrick) return false;
- if (world.getBlock(x + 4, y - 2, z + 4) != Blocks.stonebrick) return false;
- // 5th Layer
- // Pillars
- if (world.getBlock(x - 4, y - 3, z - 4) != Blocks.stonebrick) return false;
- if (world.getBlock(x - 4, y - 3, z + 4) != Blocks.stonebrick) return false;
- if (world.getBlock(x + 4, y - 3, z - 4) != Blocks.stonebrick) return false;
- if (world.getBlock(x + 4, y - 3, z + 4) != Blocks.stonebrick) return false;
- // Pedestals
- if (!(world.getBlock(x, y - 3, z) instanceof BlockHandPedestal)) return false;
- if (world.getBlock(x - 4, y - 3, z + 2) != BlockList.handPedestal || world.getBlockMetadata(x - 4, y - 3, z + 2) != 1) return false;
- if (world.getBlock(x - 5, y - 3, z) != BlockList.handPedestal || world.getBlockMetadata(x - 5, y - 3, z) != 2) return false;
- if (world.getBlock(x - 4, y - 3, z - 2) != BlockList.handPedestal || world.getBlockMetadata(x - 4, y - 3, z - 2) != 3) return false;
- if (world.getBlock(x - 2, y - 3, z - 4) != BlockList.handPedestal || world.getBlockMetadata(x - 2, y - 3, z - 4) != 3) return false;
- if (world.getBlock(x, y - 3, z - 5) != BlockList.handPedestal || world.getBlockMetadata(x, y - 3, z - 5) != 4) return false;
- if (world.getBlock(x + 2, y - 3, z - 4) != BlockList.handPedestal || world.getBlockMetadata(x + 2, y - 3, z - 4) != 5) return false;
- if (world.getBlock(x + 4, y - 3, z - 2) != BlockList.handPedestal || world.getBlockMetadata(x + 4, y - 3, z - 2) != 5) return false;
- if (world.getBlock(x + 5, y - 3, z) != BlockList.handPedestal || world.getBlockMetadata(x + 5, y - 3, z) != 6) return false;
- if (world.getBlock(x + 4, y - 3, z + 2) != BlockList.handPedestal || world.getBlockMetadata(x + 4, y - 3, z + 2) != 7) return false;
- if (world.getBlock(x + 2, y - 3, z + 4) != BlockList.handPedestal || world.getBlockMetadata(x + 2, y - 3, z + 4) != 7) return false;
- if (world.getBlock(x, y - 3, z + 5) != BlockList.handPedestal || world.getBlockMetadata(x, y - 3, z + 5) != 0) return false;
- if (world.getBlock(x - 2, y - 3, z + 4) != BlockList.handPedestal || world.getBlockMetadata(x - 2, y - 3, z + 4) != 1) return false;
- return true;
- }
-
- public void addData(World world, int x, int y, int z)
- {
- pedestalItems.clear();
- addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x + 2, y - 3, z - 4));
- addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x - 4, y - 3, z + 2));
- addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x, y - 3, z - 5));
- addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x - 2, y - 3, z - 4));
- addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x - 4, y - 3, z - 2));
- addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x - 5, y - 3, z));
- addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x + 4, y - 3, z - 2));
- addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x + 5, y - 3, z));
- addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x + 4, y - 3, z + 2));
- addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x + 2, y - 3, z + 4));
- addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x, y - 3, z + 5));
- addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x - 2, y - 3, z + 4));
- }
-
- public int getNumberOfItems(World world, int x, int y, int z)
- {
- int items = 0;
- if (((TileEntityHandPedestal)world.getTileEntity(x + 2, y - 3, z - 4)).heldItemStack != null) items++;
- if (((TileEntityHandPedestal)world.getTileEntity(x - 4, y - 3, z + 2)).heldItemStack != null) items++;
- if (((TileEntityHandPedestal)world.getTileEntity(x, y - 3, z - 5)).heldItemStack != null) items++;
- if (((TileEntityHandPedestal)world.getTileEntity(x - 2, y - 3, z - 4)).heldItemStack != null) items++;
- if (((TileEntityHandPedestal)world.getTileEntity(x - 4, y - 3, z - 2)).heldItemStack != null) items++;
- if (((TileEntityHandPedestal)world.getTileEntity(x - 5, y - 3, z)).heldItemStack != null) items++;
- if (((TileEntityHandPedestal)world.getTileEntity(x + 4, y - 3, z - 2)).heldItemStack != null) items++;
- if (((TileEntityHandPedestal)world.getTileEntity(x + 5, y - 3, z)).heldItemStack != null) items++;
- if (((TileEntityHandPedestal)world.getTileEntity(x + 4, y - 3, z + 2)).heldItemStack != null) items++;
- if (((TileEntityHandPedestal)world.getTileEntity(x + 2, y - 3, z + 4)).heldItemStack != null) items++;
- if (((TileEntityHandPedestal)world.getTileEntity(x, y - 3, z + 5)).heldItemStack != null) items++;
- if (((TileEntityHandPedestal)world.getTileEntity(x - 2, y - 3, z + 4)).heldItemStack != null) items++;
- return items;
- }
-
- public boolean canChangePedestals(World world, int x, int y, int z)
- {
- if (world.getBlock(x, y - 3, z) != BlockList.handPedestal) return false;
- if (world.getBlock(x + 2, y - 3, z - 4) != BlockList.handPedestal) return false;
- if (world.getBlock(x - 4, y - 3, z + 2) != BlockList.handPedestal) return false;
- if (world.getBlock(x, y - 3, z - 5) != BlockList.handPedestal) return false;
- if (world.getBlock(x - 2, y - 3, z - 4) != BlockList.handPedestal) return false;
- if (world.getBlock(x - 4, y - 3, z - 2) != BlockList.handPedestal) return false;
- if (world.getBlock(x - 5, y - 3, z) != BlockList.handPedestal) return false;
- if (world.getBlock(x + 4, y - 3, z - 2) != BlockList.handPedestal) return false;
- if (world.getBlock(x + 5, y - 3, z) != BlockList.handPedestal) return false;
- if (world.getBlock(x + 4, y - 3, z + 2) != BlockList.handPedestal) return false;
- if (world.getBlock(x + 2, y - 3, z + 4) != BlockList.handPedestal) return false;
- if (world.getBlock(x, y - 3, z + 5) != BlockList.handPedestal) return false;
- if (world.getBlock(x - 2, y - 3, z + 4) != BlockList.handPedestal) return false;
- return true;
- }
-
- public void changePedestals(World world, int x, int y, int z)
- {
- changeHand(world, x, y - 3, z);
- changeHand(world, x + 2, y - 3, z - 4);
- changeHand(world, x - 4, y - 3, z + 2);
- changeHand(world, x, y - 3, z - 5);
- changeHand(world, x - 2, y - 3, z - 4);
- changeHand(world, x - 4, y - 3, z - 2);
- changeHand(world, x - 5, y - 3, z);
- changeHand(world, x + 4, y - 3, z - 2);
- changeHand(world, x + 5, y - 3, z);
- changeHand(world, x + 4, y - 3, z + 2);
- changeHand(world, x + 2, y - 3, z + 4);
- changeHand(world, x, y - 3, z + 5);
- changeHand(world, x - 2, y - 3, z + 4);
- }
-
- public void changeHand(World world, int x, int y, int z)
- {
- int l = world.getBlockMetadata(x, y, z);
- world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(world.getBlock(x, y, z)));
- TileEntityShadowHand tile = new TileEntityShadowHand();
- if (world.getTileEntity(x, y, z) instanceof TileEntityHandPedestal){
- if (((TileEntityHandPedestal)world.getTileEntity(x, y, z)).heldItemStack != null) tile.setHeldItemStack(((TileEntityHandPedestal)world.getTileEntity(x, y, z)).heldItemStack.copy());
- if (tile.heldItemStack != null) tile.closeHand();
- ((TileEntityHandPedestal)world.getTileEntity(x, y, z)).removeHeldItemStack();
- world.setBlock(x, y, z, BlockList.shadowHand, l, 2);
- world.setTileEntity(x, y, z, tile);
- }
- }
-
- public void revertPedestals(World world, int x, int y, int z)
- {
- revertHand(world, x, y - 3, z);
- revertHand(world, x + 2, y - 3, z - 4);
- revertHand(world, x - 4, y - 3, z + 2);
- revertHand(world, x, y - 3, z - 5);
- revertHand(world, x - 2, y - 3, z - 4);
- revertHand(world, x - 4, y - 3, z - 2);
- revertHand(world, x - 5, y - 3, z);
- revertHand(world, x + 4, y - 3, z - 2);
- revertHand(world, x + 5, y - 3, z);
- revertHand(world, x + 4, y - 3, z + 2);
- revertHand(world, x + 2, y - 3, z + 4);
- revertHand(world, x, y - 3, z + 5);
- revertHand(world, x - 2, y - 3, z + 4);
- }
-
- public void revertHand(World world, int x, int y, int z)
- {
- int l = world.getBlockMetadata(x, y, z);
- world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(BlockList.handPedestal));
- world.playSoundEffect(x, y + 0.5F, z, "step.wood", 1F, 1F);
- TileEntityHandPedestal tile = new TileEntityHandPedestal();
- if (world.getTileEntity(x, y, z) instanceof TileEntityShadowHand){
- if (((TileEntityShadowHand)world.getTileEntity(x, y, z)).heldItemStack != null) tile.setHeldItemStack(((TileEntityShadowHand)world.getTileEntity(x, y, z)).heldItemStack.copy());
- ((TileEntityShadowHand)world.getTileEntity(x, y, z)).removeHeldItemStack();
- world.setBlock(x, y, z, BlockList.handPedestal, l, 2);
- world.setTileEntity(x, y, z, tile);
- }
- }
-
- public void addPedestalInfo(TileEntityHandPedestal pedestal)
- {
- ItemStack heldItemStack;
- if (pedestal != null && (heldItemStack = pedestal.getHeldItemStack()) != null){
- if (pedestalItems.isEmpty()) pedestalItems.add(heldItemStack.copy());
- else{
- boolean hasItem = false;
- int index = 0;
- for(int ind = 0; ind < pedestalItems.size() && !hasItem; ind++)
- if (heldItemStack.getItem().equals(pedestalItems.get(ind).getItem()) && heldItemStack.getItemDamage() == pedestalItems.get(ind).getItemDamage()){
- index = ind;
- hasItem = true;
- if (heldItemStack.hasTagCompound() && pedestalItems.get(ind).hasTagCompound() && !heldItemStack.getTagCompound().equals(pedestalItems.get(ind).getTagCompound())) hasItem = false;
- }
- if (!hasItem) pedestalItems.add(heldItemStack.copy());
- else{
- ItemStack object = pedestalItems.get(index).copy();
- object.stackSize++;
- pedestalItems.set(index, object);
- }
- }
- pedestal.removeHeldItemStack();
- pedestal.openHand();
- }else if (pedestal != null && target != null) JewelrycraftUtil.addCursePoints(target, 20);
- }
-
- @SideOnly(Side.CLIENT)
- public AxisAlignedBB getRenderBoundingBox()
- {
- AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(xCoord - 5.5D, yCoord - 5.5D, zCoord - 5.5D, xCoord + 5.5D, yCoord + 5.5D, zCoord + 5.5D);
- return bb;
- }
-
- @Override
- public Packet getDescriptionPacket()
- {
- NBTTagCompound nbttagcompound = new NBTTagCompound();
- writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
- }
-
- @Override
- public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
- {
- readFromNBT(packet.func_148857_g());
- worldObj.func_147479_m(xCoord, yCoord, zCoord);
- }
+public class TileEntityShadowEye extends TileEntity {
+ public int opening, timer, t = 20, soundTimer;
+ public boolean active, shouldAddData;
+ public ArrayList<ItemStack> pedestalItems =
+ new ArrayList<ItemStack>();
+ ResourceLocation particleTexture = new ResourceLocation(
+ Variables.MODID, "textures/particle/shadows.png");
+ public EntityPlayer target;
+ public ModelShadowEye model = new ModelShadowEye();
+
+ public TileEntityShadowEye() {
+ opening = 1;
+ timer = 20;
+ active = false;
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbt) {
+ super.writeToNBT(nbt);
+ nbt.setInteger("opening", opening);
+ nbt.setInteger("timer", timer);
+ nbt.setBoolean("active", active);
+ nbt.setBoolean("shouldAddData", shouldAddData);
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbt) {
+ super.readFromNBT(nbt);
+ opening = nbt.getInteger("opening");
+ timer = nbt.getInteger("timer");
+ active = nbt.getBoolean("active");
+ shouldAddData = nbt.getBoolean("shouldAddData");
+ }
+
+ @Override
+ public void updateEntity() {
+ super.updateEntity();
+ boolean valid = isValidStructure(worldObj, xCoord, yCoord, zCoord,
+ blockMetadata);
+ boolean canStartRitual = valid
+ && ((TileEntityHandPedestal) worldObj.getTileEntity(xCoord,
+ yCoord - 3, zCoord)).heldItemStack != null
+ && getNumberOfItems(worldObj, xCoord, yCoord, zCoord) > 0;
+ if (active) {
+ timer--;
+ if (canStartRitual
+ && canChangePedestals(worldObj, xCoord, yCoord, zCoord)
+ && opening == 4)
+ changePedestals(worldObj, xCoord, yCoord, zCoord);
+ }
+ if (active && target != null && this.getDistanceFrom(target.posX,
+ target.posY, target.posZ) > 27D) {
+ active = false;
+ timer = -1;
+ shouldAddData = false;
+ revertPedestals(worldObj, xCoord, yCoord, zCoord);
+ }
+ if (opening == 4 && timer <= 0)
+ active = false;
+ if (!active && timer <= 0 && opening != 1) {
+ if (t > 0)
+ t--;
+ if (t <= 0) {
+ opening--;
+ t = 20;
+ }
+ }
+ if (opening == 2 && timer <= 0 && t == 10 && shouldAddData) {
+ addData(worldObj, xCoord, yCoord, zCoord);
+ TileEntityHandPedestal target =
+ (TileEntityHandPedestal) worldObj.getTileEntity(xCoord,
+ yCoord - 3, zCoord);
+ if (target != null && target.getHeldItemStack() != null)
+ JewelryNBT.addModifiers(target.getHeldItemStack(),
+ pedestalItems);
+ revertPedestals(worldObj, xCoord, yCoord, zCoord);
+ }
+ if (active && timer <= 0) {
+ if (opening < 4) {
+ opening++;
+ timer = 20;
+ soundTimer = 0;
+ }
+ if (canStartRitual && opening == 4)
+ timer = ConfigHandler.RITUAL_TIME;
+ else if (!canStartRitual) {
+ shouldAddData = false;
+ active = false;
+ timer = -1;
+ if (!worldObj.isRemote) {
+ JewelrycraftUtil.addCursePoints(target, 50);
+ target.addChatMessage(
+ new ChatComponentText(EnumChatFormatting.BLACK
+ + "The Shadows don't like to be disturbed for no reason!"));
+ target.addChatMessage(new ChatComponentText(
+ EnumChatFormatting.DARK_PURPLE
+ + "You feel a strange aura encumbering you."));
+ }
+ }
+ }
+ if (active && opening == 4) {
+ for (int l = 0; l <= 100; l++)
+ worldObj.spawnParticle("depthsuspend",
+ xCoord + 6.5F - worldObj.rand.nextInt(12)
+ - worldObj.rand.nextFloat(),
+ yCoord - 2F + worldObj.rand.nextInt(9)
+ - worldObj.rand.nextFloat(),
+ zCoord + 6.5F - worldObj.rand.nextInt(12)
+ - worldObj.rand.nextFloat(),
+ 0, 0, 0);
+ if (soundTimer == 0)
+ worldObj.playSound(xCoord + 0.5D, yCoord + 0.5D,
+ zCoord + 0.5D, "jewelrycraft2:Ritual", 1.0F, 1.0F,
+ false);
+ if (soundTimer < 20 * 14)
+ soundTimer++;
+ else
+ soundTimer = 0;
+ }
+ }
+
+ public boolean isValidStructure(World world, int x, int y, int z,
+ int metadata) {
+ if (world.getBlockMetadata(x, y, z) == 0
+ || world.getBlockMetadata(x, y, z) == 2) {
+ // Layers from top to bottom
+ // 1st Layer
+ if (world.getBlock(x, y + 1, z) != Blocks.stone_slab
+ || world.getBlockMetadata(x, y + 1, z) != 5)
+ return false;
+ if (world.getBlock(x + 1, y + 1, z) != Blocks.stone_slab
+ || world.getBlockMetadata(x + 1, y + 1, z) != 5)
+ return false;
+ if (world.getBlock(x - 1, y + 1, z) != Blocks.stone_slab
+ || world.getBlockMetadata(x - 1, y + 1, z) != 5)
+ return false;
+ // 2nd Layer
+ if (world.getBlock(x + 2, y, z) != Blocks.stone_brick_stairs
+ || world.getBlockMetadata(x + 2, y, z) != 1)
+ return false;
+ if (world.getBlock(x + 1, y, z) != Blocks.stone_brick_stairs
+ || world.getBlockMetadata(x + 1, y, z) != 4)
+ return false;
+ if (world.getBlock(x - 1, y, z) != Blocks.stone_brick_stairs
+ || world.getBlockMetadata(x - 1, y, z) != 5)
+ return false;
+ if (world.getBlock(x - 2, y, z) != Blocks.stone_brick_stairs
+ || world.getBlockMetadata(x - 2, y, z) != 0)
+ return false;
+ // 3rd Layer
+ if (world.getBlock(x + 2, y - 1, z) != Blocks.stonebrick)
+ return false;
+ if (world.getBlock(x - 2, y - 1, z) != Blocks.stonebrick)
+ return false;
+ // 4th Layer
+ if (world.getBlock(x + 2, y - 2, z) != Blocks.stonebrick)
+ return false;
+ if (world.getBlock(x - 2, y - 2, z) != Blocks.stonebrick)
+ return false;
+ // 5th Layer
+ if (world.getBlock(x + 2, y - 3, z) != Blocks.stonebrick)
+ return false;
+ if (world.getBlock(x - 2, y - 3, z) != Blocks.stonebrick)
+ return false;
+ } else if (world.getBlockMetadata(x, y, z) == 1
+ || world.getBlockMetadata(x, y, z) == 3) {
+ // Layers from top to bottom
+ // 1st Layer
+ if (world.getBlock(x, y + 1, z) != Blocks.stone_slab
+ || world.getBlockMetadata(x, y + 1, z) != 5)
+ return false;
+ if (world.getBlock(x, y + 1, z + 1) != Blocks.stone_slab
+ || world.getBlockMetadata(x, y + 1, z + 1) != 5)
+ return false;
+ if (world.getBlock(x, y + 1, z - 1) != Blocks.stone_slab
+ || world.getBlockMetadata(x, y + 1, z - 1) != 5)
+ return false;
+ // 2nd Layer
+ if (world.getBlock(x, y, z + 2) != Blocks.stone_brick_stairs
+ || world.getBlockMetadata(x, y, z + 2) != 3)
+ return false;
+ if (world.getBlock(x, y, z + 1) != Blocks.stone_brick_stairs
+ || world.getBlockMetadata(x, y, z + 1) != 6)
+ return false;
+ if (world.getBlock(x, y, z - 1) != Blocks.stone_brick_stairs
+ || world.getBlockMetadata(x, y, z - 1) != 7)
+ return false;
+ if (world.getBlock(x, y, z - 2) != Blocks.stone_brick_stairs
+ || world.getBlockMetadata(x, y, z - 2) != 2)
+ return false;
+ // 3rd Layer
+ if (world.getBlock(x, y - 1, z + 2) != Blocks.stonebrick)
+ return false;
+ if (world.getBlock(x, y - 1, z - 2) != Blocks.stonebrick)
+ return false;
+ // 4th Layer
+ if (world.getBlock(x, y - 2, z + 2) != Blocks.stonebrick)
+ return false;
+ if (world.getBlock(x, y - 2, z - 2) != Blocks.stonebrick)
+ return false;
+ // 5th Layer
+ if (world.getBlock(x, y - 3, z + 2) != Blocks.stonebrick)
+ return false;
+ if (world.getBlock(x, y - 3, z - 2) != Blocks.stonebrick)
+ return false;
+ }
+ // 3rd Layer
+ if (world.getBlock(x - 4, y - 1, z - 4) != BlockList.shadowBlock)
+ return false;
+ if (world.getBlock(x - 4, y - 1, z + 4) != BlockList.shadowBlock)
+ return false;
+ if (world.getBlock(x + 4, y - 1, z - 4) != BlockList.shadowBlock)
+ return false;
+ if (world.getBlock(x + 4, y - 1, z + 4) != BlockList.shadowBlock)
+ return false;
+ // 4th Layer
+ if (world.getBlock(x - 4, y - 2, z - 4) != Blocks.stonebrick)
+ return false;
+ if (world.getBlock(x - 4, y - 2, z + 4) != Blocks.stonebrick)
+ return false;
+ if (world.getBlock(x + 4, y - 2, z - 4) != Blocks.stonebrick)
+ return false;
+ if (world.getBlock(x + 4, y - 2, z + 4) != Blocks.stonebrick)
+ return false;
+ // 5th Layer
+ // Pillars
+ if (world.getBlock(x - 4, y - 3, z - 4) != Blocks.stonebrick)
+ return false;
+ if (world.getBlock(x - 4, y - 3, z + 4) != Blocks.stonebrick)
+ return false;
+ if (world.getBlock(x + 4, y - 3, z - 4) != Blocks.stonebrick)
+ return false;
+ if (world.getBlock(x + 4, y - 3, z + 4) != Blocks.stonebrick)
+ return false;
+ // Pedestals
+ if (!(world.getBlock(x, y - 3, z) instanceof BlockHandPedestal))
+ return false;
+ if (world.getBlock(x - 4, y - 3, z + 2) != BlockList.handPedestal
+ || world.getBlockMetadata(x - 4, y - 3, z + 2) != 1)
+ return false;
+ if (world.getBlock(x - 5, y - 3, z) != BlockList.handPedestal
+ || world.getBlockMetadata(x - 5, y - 3, z) != 2)
+ return false;
+ if (world.getBlock(x - 4, y - 3, z - 2) != BlockList.handPedestal
+ || world.getBlockMetadata(x - 4, y - 3, z - 2) != 3)
+ return false;
+ if (world.getBlock(x - 2, y - 3, z - 4) != BlockList.handPedestal
+ || world.getBlockMetadata(x - 2, y - 3, z - 4) != 3)
+ return false;
+ if (world.getBlock(x, y - 3, z - 5) != BlockList.handPedestal
+ || world.getBlockMetadata(x, y - 3, z - 5) != 4)
+ return false;
+ if (world.getBlock(x + 2, y - 3, z - 4) != BlockList.handPedestal
+ || world.getBlockMetadata(x + 2, y - 3, z - 4) != 5)
+ return false;
+ if (world.getBlock(x + 4, y - 3, z - 2) != BlockList.handPedestal
+ || world.getBlockMetadata(x + 4, y - 3, z - 2) != 5)
+ return false;
+ if (world.getBlock(x + 5, y - 3, z) != BlockList.handPedestal
+ || world.getBlockMetadata(x + 5, y - 3, z) != 6)
+ return false;
+ if (world.getBlock(x + 4, y - 3, z + 2) != BlockList.handPedestal
+ || world.getBlockMetadata(x + 4, y - 3, z + 2) != 7)
+ return false;
+ if (world.getBlock(x + 2, y - 3, z + 4) != BlockList.handPedestal
+ || world.getBlockMetadata(x + 2, y - 3, z + 4) != 7)
+ return false;
+ if (world.getBlock(x, y - 3, z + 5) != BlockList.handPedestal
+ || world.getBlockMetadata(x, y - 3, z + 5) != 0)
+ return false;
+ if (world.getBlock(x - 2, y - 3, z + 4) != BlockList.handPedestal
+ || world.getBlockMetadata(x - 2, y - 3, z + 4) != 1)
+ return false;
+ return true;
+ }
+
+ public void addData(World world, int x, int y, int z) {
+ pedestalItems.clear();
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x + 2,
+ y - 3, z - 4));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x - 4,
+ y - 3, z + 2));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x,
+ y - 3, z - 5));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x - 2,
+ y - 3, z - 4));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x - 4,
+ y - 3, z - 2));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x - 5,
+ y - 3, z));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x + 4,
+ y - 3, z - 2));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x + 5,
+ y - 3, z));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x + 4,
+ y - 3, z + 2));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x + 2,
+ y - 3, z + 4));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x,
+ y - 3, z + 5));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x - 2,
+ y - 3, z + 4));
+ }
+
+ public int getNumberOfItems(World world, int x, int y, int z) {
+ int items = 0;
+ if (((TileEntityHandPedestal) world.getTileEntity(x + 2, y - 3,
+ z - 4)).heldItemStack != null)
+ items++;
+ if (((TileEntityHandPedestal) world.getTileEntity(x - 4, y - 3,
+ z + 2)).heldItemStack != null)
+ items++;
+ if (((TileEntityHandPedestal) world.getTileEntity(x, y - 3,
+ z - 5)).heldItemStack != null)
+ items++;
+ if (((TileEntityHandPedestal) world.getTileEntity(x - 2, y - 3,
+ z - 4)).heldItemStack != null)
+ items++;
+ if (((TileEntityHandPedestal) world.getTileEntity(x - 4, y - 3,
+ z - 2)).heldItemStack != null)
+ items++;
+ if (((TileEntityHandPedestal) world.getTileEntity(x - 5, y - 3,
+ z)).heldItemStack != null)
+ items++;
+ if (((TileEntityHandPedestal) world.getTileEntity(x + 4, y - 3,
+ z - 2)).heldItemStack != null)
+ items++;
+ if (((TileEntityHandPedestal) world.getTileEntity(x + 5, y - 3,
+ z)).heldItemStack != null)
+ items++;
+ if (((TileEntityHandPedestal) world.getTileEntity(x + 4, y - 3,
+ z + 2)).heldItemStack != null)
+ items++;
+ if (((TileEntityHandPedestal) world.getTileEntity(x + 2, y - 3,
+ z + 4)).heldItemStack != null)
+ items++;
+ if (((TileEntityHandPedestal) world.getTileEntity(x, y - 3,
+ z + 5)).heldItemStack != null)
+ items++;
+ if (((TileEntityHandPedestal) world.getTileEntity(x - 2, y - 3,
+ z + 4)).heldItemStack != null)
+ items++;
+ return items;
+ }
+
+ public boolean canChangePedestals(World world, int x, int y, int z) {
+ if (world.getBlock(x, y - 3, z) != BlockList.handPedestal)
+ return false;
+ if (world.getBlock(x + 2, y - 3, z - 4) != BlockList.handPedestal)
+ return false;
+ if (world.getBlock(x - 4, y - 3, z + 2) != BlockList.handPedestal)
+ return false;
+ if (world.getBlock(x, y - 3, z - 5) != BlockList.handPedestal)
+ return false;
+ if (world.getBlock(x - 2, y - 3, z - 4) != BlockList.handPedestal)
+ return false;
+ if (world.getBlock(x - 4, y - 3, z - 2) != BlockList.handPedestal)
+ return false;
+ if (world.getBlock(x - 5, y - 3, z) != BlockList.handPedestal)
+ return false;
+ if (world.getBlock(x + 4, y - 3, z - 2) != BlockList.handPedestal)
+ return false;
+ if (world.getBlock(x + 5, y - 3, z) != BlockList.handPedestal)
+ return false;
+ if (world.getBlock(x + 4, y - 3, z + 2) != BlockList.handPedestal)
+ return false;
+ if (world.getBlock(x + 2, y - 3, z + 4) != BlockList.handPedestal)
+ return false;
+ if (world.getBlock(x, y - 3, z + 5) != BlockList.handPedestal)
+ return false;
+ if (world.getBlock(x - 2, y - 3, z + 4) != BlockList.handPedestal)
+ return false;
+ return true;
+ }
+
+ public void changePedestals(World world, int x, int y, int z) {
+ changeHand(world, x, y - 3, z);
+ changeHand(world, x + 2, y - 3, z - 4);
+ changeHand(world, x - 4, y - 3, z + 2);
+ changeHand(world, x, y - 3, z - 5);
+ changeHand(world, x - 2, y - 3, z - 4);
+ changeHand(world, x - 4, y - 3, z - 2);
+ changeHand(world, x - 5, y - 3, z);
+ changeHand(world, x + 4, y - 3, z - 2);
+ changeHand(world, x + 5, y - 3, z);
+ changeHand(world, x + 4, y - 3, z + 2);
+ changeHand(world, x + 2, y - 3, z + 4);
+ changeHand(world, x, y - 3, z + 5);
+ changeHand(world, x - 2, y - 3, z + 4);
+ }
+
+ public void changeHand(World world, int x, int y, int z) {
+ int l = world.getBlockMetadata(x, y, z);
+ world.playAuxSFX(2001, x, y, z,
+ Block.getIdFromBlock(world.getBlock(x, y, z)));
+ TileEntityShadowHand tile = new TileEntityShadowHand();
+ if (world.getTileEntity(x, y,
+ z) instanceof TileEntityHandPedestal) {
+ if (((TileEntityHandPedestal) world.getTileEntity(x, y,
+ z)).heldItemStack != null)
+ tile.setHeldItemStack(((TileEntityHandPedestal) world
+ .getTileEntity(x, y, z)).heldItemStack.copy());
+ if (tile.heldItemStack != null)
+ tile.closeHand();
+ ((TileEntityHandPedestal) world.getTileEntity(x, y, z))
+ .removeHeldItemStack();
+ world.setBlock(x, y, z, BlockList.shadowHand, l, 2);
+ world.setTileEntity(x, y, z, tile);
+ }
+ }
+
+ public void revertPedestals(World world, int x, int y, int z) {
+ revertHand(world, x, y - 3, z);
+ revertHand(world, x + 2, y - 3, z - 4);
+ revertHand(world, x - 4, y - 3, z + 2);
+ revertHand(world, x, y - 3, z - 5);
+ revertHand(world, x - 2, y - 3, z - 4);
+ revertHand(world, x - 4, y - 3, z - 2);
+ revertHand(world, x - 5, y - 3, z);
+ revertHand(world, x + 4, y - 3, z - 2);
+ revertHand(world, x + 5, y - 3, z);
+ revertHand(world, x + 4, y - 3, z + 2);
+ revertHand(world, x + 2, y - 3, z + 4);
+ revertHand(world, x, y - 3, z + 5);
+ revertHand(world, x - 2, y - 3, z + 4);
+ }
+
+ public void revertHand(World world, int x, int y, int z) {
+ int l = world.getBlockMetadata(x, y, z);
+ world.playAuxSFX(2001, x, y, z,
+ Block.getIdFromBlock(BlockList.handPedestal));
+ world.playSoundEffect(x, y + 0.5F, z, "step.wood", 1F, 1F);
+ TileEntityHandPedestal tile = new TileEntityHandPedestal();
+ if (world.getTileEntity(x, y, z) instanceof TileEntityShadowHand) {
+ if (((TileEntityShadowHand) world.getTileEntity(x, y,
+ z)).heldItemStack != null)
+ tile.setHeldItemStack(((TileEntityShadowHand) world
+ .getTileEntity(x, y, z)).heldItemStack.copy());
+ ((TileEntityShadowHand) world.getTileEntity(x, y, z))
+ .removeHeldItemStack();
+ world.setBlock(x, y, z, BlockList.handPedestal, l, 2);
+ world.setTileEntity(x, y, z, tile);
+ }
+ }
+
+ public void addPedestalInfo(TileEntityHandPedestal pedestal) {
+ ItemStack heldItemStack;
+ if (pedestal != null
+ && (heldItemStack = pedestal.getHeldItemStack()) != null) {
+ if (pedestalItems.isEmpty())
+ pedestalItems.add(heldItemStack.copy());
+ else {
+ boolean hasItem = false;
+ int index = 0;
+ for (int ind = 0; ind < pedestalItems.size() && !hasItem;
+ ind++)
+ if (heldItemStack.getItem()
+ .equals(pedestalItems.get(ind).getItem())
+ && heldItemStack
+ .getItemDamage() == pedestalItems
+ .get(ind).getItemDamage()) {
+ index = ind;
+ hasItem = true;
+ if (heldItemStack.hasTagCompound()
+ && pedestalItems.get(ind).hasTagCompound()
+ && !heldItemStack.getTagCompound()
+ .equals(pedestalItems.get(ind)
+ .getTagCompound()))
+ hasItem = false;
+ }
+ if (!hasItem)
+ pedestalItems.add(heldItemStack.copy());
+ else {
+ ItemStack object = pedestalItems.get(index).copy();
+ object.stackSize++;
+ pedestalItems.set(index, object);
+ }
+ }
+ pedestal.removeHeldItemStack();
+ pedestal.openHand();
+ } else if (pedestal != null && target != null)
+ JewelrycraftUtil.addCursePoints(target, 20);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public AxisAlignedBB getRenderBoundingBox() {
+ AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(xCoord - 5.5D,
+ yCoord - 5.5D, zCoord - 5.5D, xCoord + 5.5D, yCoord + 5.5D,
+ zCoord + 5.5D);
+ return bb;
+ }
+
+ @Override
+ public Packet getDescriptionPacket() {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+ writeToNBT(nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1,
+ nbttagcompound);
+ }
+
+ @Override
+ public void onDataPacket(NetworkManager net,
+ S35PacketUpdateTileEntity packet) {
+ readFromNBT(packet.func_148857_g());
+ worldObj.func_147479_m(xCoord, yCoord, zCoord);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowHand.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowHand.java index b22602e..1b86d07 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowHand.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowHand.java @@ -3,5 +3,5 @@ package darkknight.jewelrycraft.tileentity; /** * @author Paul Fulham (pau101) */ -public class TileEntityShadowHand extends TileEntityHandPedestal -{}
\ No newline at end of file +public class TileEntityShadowHand extends TileEntityHandPedestal { +}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java index c75d8f0..2f170f9 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.tileentity;
import java.util.Random;
+
import darkknight.jewelrycraft.config.ConfigHandler;
import darkknight.jewelrycraft.util.JewelryNBT;
import darkknight.jewelrycraft.util.JewelrycraftUtil;
@@ -12,178 +13,215 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
-public class TileEntitySmelter extends TileEntity
-{
- public int melting, flow, n = 0, p = 0;
- public boolean hasMetal, hasMoltenMetal, isDirty, pouring;
- public ItemStack metal, moltenMetal;
- public float quantity, pouredQuantity = 0.1f;
-
- /**
- *
- */
- public TileEntitySmelter()
- {
- melting = 0;
- pouring = false;
- flow = 0;
- quantity = 0f;
- hasMetal = false;
- hasMoltenMetal = false;
- metal = new ItemStack(Item.getItemById(0), 0, 0);
- moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
- isDirty = false;
- }
-
- /**
- * @param nbt
- */
- @Override
- public void writeToNBT(NBTTagCompound nbt)
- {
- super.writeToNBT(nbt);
- nbt.setInteger("melting", melting);
- nbt.setFloat("quantity", quantity);
- nbt.setBoolean("hasMetal", hasMetal);
- nbt.setBoolean("hasMoltenMetal", hasMoltenMetal);
- nbt.setBoolean("pouring", pouring);
- NBTTagCompound tag = new NBTTagCompound();
- NBTTagCompound tag1 = new NBTTagCompound();
- metal.writeToNBT(tag);
- nbt.setTag("metal", tag);
- moltenMetal.writeToNBT(tag1);
- nbt.setTag("moltenMetal", tag1);
- }
-
- /**
- * @param nbt
- */
- @Override
- public void readFromNBT(NBTTagCompound nbt)
- {
- super.readFromNBT(nbt);
- melting = nbt.getInteger("melting");
- quantity = nbt.getFloat("quantity");
- hasMetal = nbt.getBoolean("hasMetal");
- hasMoltenMetal = nbt.getBoolean("hasMoltenMetal");
- pouring = nbt.getBoolean("pouring");
- metal = new ItemStack(Item.getItemById(0), 0, 0);
- metal.readFromNBT(nbt.getCompoundTag("metal"));
- moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
- moltenMetal.readFromNBT(nbt.getCompoundTag("moltenMetal"));
- }
-
- /**
- *
- */
- @Override
- public void updateEntity()
- {
- super.updateEntity();
- Random rand = new Random();
- if (isDirty){
- worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
- isDirty = false;
- }
- if (p > 0) --p;
- else p = 5;
- if (n == 0 && p == 0){
- flow += 16;
- if (flow >= 16 * 20) n = 1;
- }
- if (n == 1 && p == 0){
- flow -= 16;
- if (flow <= 0) n = 0;
- }
- if (hasMetal) for(int l = 0; l < 2; ++l)
- worldObj.spawnParticle("flame", xCoord + rand.nextFloat(), (double)yCoord + 0.3F, zCoord + rand.nextFloat(), 0.0D, 0.0D, 0.0D);
- if (rand.nextInt(65) == 0){
- double d5 = xCoord + rand.nextFloat();
- double d7 = yCoord;
- double d6 = zCoord + rand.nextFloat();
- worldObj.playSound(d5, d7, d6, "liquid.lavapop", 0.2F + rand.nextFloat() * 0.2F, 0.9F + rand.nextFloat() * 0.15F, false);
- }
- if (hasMetal && !hasMoltenMetal){
- boolean isOre = JewelrycraftUtil.isOre(metal);
- if (melting > 0) melting--;
- if (melting == 0){
- hasMetal = false;
- if (!isOre){
- if(JewelryNBT.ingot(metal) == null) moltenMetal = metal;
- else moltenMetal = JewelryNBT.ingot(metal);
- }
- else{
- moltenMetal = JewelrycraftUtil.getIngotFromOre(metal);
- moltenMetal.stackSize *= 2;
- }
- hasMoltenMetal = true;
- if (!isOre) quantity = 0.1f * metal.stackSize;
- else quantity = 0.2f * metal.stackSize;
- metal = new ItemStack(Item.getItemById(0), 0, 0);
- melting = -1;
- isDirty = true;
- }
- }else if (hasMoltenMetal){
- boolean isOre = JewelrycraftUtil.isOre(metal);
- if (melting > 0) melting--;
- if (melting == 0){
- hasMetal = false;
- if (!isOre) moltenMetal.stackSize += metal.stackSize;
- else moltenMetal.stackSize += metal.stackSize * 2;
- if (!isOre) quantity += 0.1f * metal.stackSize;
- else quantity += 0.2f * metal.stackSize;
- metal = new ItemStack(Item.getItemById(0), 0, 0);
- melting = -1;
- isDirty = true;
- }
- }
- TileEntityMolder me = null;
- if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 0 && worldObj.getTileEntity(xCoord, yCoord, zCoord - 1) != null && worldObj.getTileEntity(xCoord, yCoord, zCoord - 1) instanceof TileEntityMolder) me = (TileEntityMolder)worldObj.getTileEntity(xCoord, yCoord, zCoord - 1);
- else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 1 && worldObj.getTileEntity(xCoord + 1, yCoord, zCoord) != null && worldObj.getTileEntity(xCoord + 1, yCoord, zCoord) instanceof TileEntityMolder) me = (TileEntityMolder)worldObj.getTileEntity(xCoord + 1, yCoord, zCoord);
- else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 2 && worldObj.getTileEntity(xCoord, yCoord, zCoord + 1) != null && worldObj.getTileEntity(xCoord, yCoord, zCoord + 1) instanceof TileEntityMolder) me = (TileEntityMolder)worldObj.getTileEntity(xCoord, yCoord, zCoord + 1);
- else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 3 && worldObj.getTileEntity(xCoord - 1, yCoord, zCoord) != null && worldObj.getTileEntity(xCoord - 1, yCoord, zCoord) instanceof TileEntityMolder) me = (TileEntityMolder)worldObj.getTileEntity(xCoord - 1, yCoord, zCoord);
- if (pouring && pouredQuantity > 0f){
- quantity -= 0.01f;
- pouredQuantity -= 0.01f;
- me.quantity += 0.01f;
- if (!me.hasMoltenMetal){
- me.moltenMetal = moltenMetal;
- me.hasMoltenMetal = true;
- }
- if (pouredQuantity <= 0f){
- pouring = false;
- pouredQuantity = 0.1f;
- me.cooling = ConfigHandler.INGOT_COOLING_TIME;
- }
- if (quantity <= 0f){
- quantity = 0f;
- hasMoltenMetal = false;
- moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
- me.cooling = ConfigHandler.INGOT_COOLING_TIME;
- }
- me.isDirty = true;
- }
- }
-
- /**
- * @return
- */
- @Override
- public Packet getDescriptionPacket()
- {
- NBTTagCompound nbttagcompound = new NBTTagCompound();
- writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
- }
-
- /**
- * @param net
- * @param packet
- */
- @Override
- public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
- {
- readFromNBT(packet.func_148857_g());
- worldObj.func_147479_m(xCoord, yCoord, zCoord);
- }
+public class TileEntitySmelter extends TileEntity {
+ public int melting, flow, n = 0, p = 0;
+ public boolean hasMetal, hasMoltenMetal, isDirty, pouring;
+ public ItemStack metal, moltenMetal;
+ public float quantity, pouredQuantity = 0.1f;
+
+ /**
+ *
+ */
+ public TileEntitySmelter() {
+ melting = 0;
+ pouring = false;
+ flow = 0;
+ quantity = 0f;
+ hasMetal = false;
+ hasMoltenMetal = false;
+ metal = new ItemStack(Item.getItemById(0), 0, 0);
+ moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
+ isDirty = false;
+ }
+
+ /**
+ * @param nbt
+ */
+ @Override
+ public void writeToNBT(NBTTagCompound nbt) {
+ super.writeToNBT(nbt);
+ nbt.setInteger("melting", melting);
+ nbt.setFloat("quantity", quantity);
+ nbt.setBoolean("hasMetal", hasMetal);
+ nbt.setBoolean("hasMoltenMetal", hasMoltenMetal);
+ nbt.setBoolean("pouring", pouring);
+ NBTTagCompound tag = new NBTTagCompound();
+ NBTTagCompound tag1 = new NBTTagCompound();
+ metal.writeToNBT(tag);
+ nbt.setTag("metal", tag);
+ moltenMetal.writeToNBT(tag1);
+ nbt.setTag("moltenMetal", tag1);
+ }
+
+ /**
+ * @param nbt
+ */
+ @Override
+ public void readFromNBT(NBTTagCompound nbt) {
+ super.readFromNBT(nbt);
+ melting = nbt.getInteger("melting");
+ quantity = nbt.getFloat("quantity");
+ hasMetal = nbt.getBoolean("hasMetal");
+ hasMoltenMetal = nbt.getBoolean("hasMoltenMetal");
+ pouring = nbt.getBoolean("pouring");
+ metal = new ItemStack(Item.getItemById(0), 0, 0);
+ metal.readFromNBT(nbt.getCompoundTag("metal"));
+ moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
+ moltenMetal.readFromNBT(nbt.getCompoundTag("moltenMetal"));
+ }
+
+ /**
+ *
+ */
+ @Override
+ public void updateEntity() {
+ super.updateEntity();
+ Random rand = new Random();
+ if (isDirty) {
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ isDirty = false;
+ }
+ if (p > 0)
+ --p;
+ else
+ p = 5;
+ if (n == 0 && p == 0) {
+ flow += 16;
+ if (flow >= 16 * 20)
+ n = 1;
+ }
+ if (n == 1 && p == 0) {
+ flow -= 16;
+ if (flow <= 0)
+ n = 0;
+ }
+ if (hasMetal)
+ for (int l = 0; l < 2; ++l)
+ worldObj.spawnParticle("flame", xCoord + rand.nextFloat(),
+ (double) yCoord + 0.3F, zCoord + rand.nextFloat(),
+ 0.0D, 0.0D, 0.0D);
+ if (rand.nextInt(65) == 0) {
+ double d5 = xCoord + rand.nextFloat();
+ double d7 = yCoord;
+ double d6 = zCoord + rand.nextFloat();
+ worldObj.playSound(d5, d7, d6, "liquid.lavapop",
+ 0.2F + rand.nextFloat() * 0.2F,
+ 0.9F + rand.nextFloat() * 0.15F, false);
+ }
+ if (hasMetal && !hasMoltenMetal) {
+ boolean isOre = JewelrycraftUtil.isOre(metal);
+ if (melting > 0)
+ melting--;
+ if (melting == 0) {
+ hasMetal = false;
+ if (!isOre) {
+ if (JewelryNBT.ingot(metal) == null)
+ moltenMetal = metal;
+ else
+ moltenMetal = JewelryNBT.ingot(metal);
+ } else {
+ moltenMetal = JewelrycraftUtil.getIngotFromOre(metal);
+ moltenMetal.stackSize *= 2;
+ }
+ hasMoltenMetal = true;
+ if (!isOre)
+ quantity = 0.1f * metal.stackSize;
+ else
+ quantity = 0.2f * metal.stackSize;
+ metal = new ItemStack(Item.getItemById(0), 0, 0);
+ melting = -1;
+ isDirty = true;
+ }
+ } else if (hasMoltenMetal) {
+ boolean isOre = JewelrycraftUtil.isOre(metal);
+ if (melting > 0)
+ melting--;
+ if (melting == 0) {
+ hasMetal = false;
+ if (!isOre)
+ moltenMetal.stackSize += metal.stackSize;
+ else
+ moltenMetal.stackSize += metal.stackSize * 2;
+ if (!isOre)
+ quantity += 0.1f * metal.stackSize;
+ else
+ quantity += 0.2f * metal.stackSize;
+ metal = new ItemStack(Item.getItemById(0), 0, 0);
+ melting = -1;
+ isDirty = true;
+ }
+ }
+ TileEntityMolder me = null;
+ if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 0
+ && worldObj.getTileEntity(xCoord, yCoord,
+ zCoord - 1) != null
+ && worldObj.getTileEntity(xCoord, yCoord,
+ zCoord - 1) instanceof TileEntityMolder)
+ me = (TileEntityMolder) worldObj.getTileEntity(xCoord, yCoord,
+ zCoord - 1);
+ else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 1
+ && worldObj.getTileEntity(xCoord + 1, yCoord,
+ zCoord) != null
+ && worldObj.getTileEntity(xCoord + 1, yCoord,
+ zCoord) instanceof TileEntityMolder)
+ me = (TileEntityMolder) worldObj.getTileEntity(xCoord + 1,
+ yCoord, zCoord);
+ else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 2
+ && worldObj.getTileEntity(xCoord, yCoord,
+ zCoord + 1) != null
+ && worldObj.getTileEntity(xCoord, yCoord,
+ zCoord + 1) instanceof TileEntityMolder)
+ me = (TileEntityMolder) worldObj.getTileEntity(xCoord, yCoord,
+ zCoord + 1);
+ else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 3
+ && worldObj.getTileEntity(xCoord - 1, yCoord,
+ zCoord) != null
+ && worldObj.getTileEntity(xCoord - 1, yCoord,
+ zCoord) instanceof TileEntityMolder)
+ me = (TileEntityMolder) worldObj.getTileEntity(xCoord - 1,
+ yCoord, zCoord);
+ if (pouring && pouredQuantity > 0f) {
+ quantity -= 0.01f;
+ pouredQuantity -= 0.01f;
+ me.quantity += 0.01f;
+ if (!me.hasMoltenMetal) {
+ me.moltenMetal = moltenMetal;
+ me.hasMoltenMetal = true;
+ }
+ if (pouredQuantity <= 0f) {
+ pouring = false;
+ pouredQuantity = 0.1f;
+ me.cooling = ConfigHandler.INGOT_COOLING_TIME;
+ }
+ if (quantity <= 0f) {
+ quantity = 0f;
+ hasMoltenMetal = false;
+ moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
+ me.cooling = ConfigHandler.INGOT_COOLING_TIME;
+ }
+ me.isDirty = true;
+ }
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public Packet getDescriptionPacket() {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+ writeToNBT(nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1,
+ nbttagcompound);
+ }
+
+ /**
+ * @param net
+ * @param packet
+ */
+ @Override
+ public void onDataPacket(NetworkManager net,
+ S35PacketUpdateTileEntity packet) {
+ readFromNBT(packet.func_148857_g());
+ worldObj.func_147479_m(xCoord, yCoord, zCoord);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityDisplayerRender.java b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityDisplayerRender.java index 18f83b9..f20c853 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityDisplayerRender.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityDisplayerRender.java @@ -3,7 +3,9 @@ package darkknight.jewelrycraft.tileentity.renders; import java.awt.Color;
import java.util.HashMap;
import java.util.List;
+
import org.lwjgl.opengl.GL11;
+
import darkknight.jewelrycraft.model.ModelDisplayer;
import darkknight.jewelrycraft.tileentity.TileEntityDisplayer;
import darkknight.jewelrycraft.util.Variables;
@@ -23,142 +25,187 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
-public class TileEntityDisplayerRender extends TileEntitySpecialRenderer
-{
- ModelDisplayer displayer = new ModelDisplayer();
- String texture = "textures/tileentities/Displayer.png";
- HashMap<EnumChatFormatting, Integer> colors = new HashMap<EnumChatFormatting, Integer>(){
- {
- put(EnumChatFormatting.AQUA, 5636095);
- put(EnumChatFormatting.BLACK, 0);
- put(EnumChatFormatting.BLUE, 5592575);
- put(EnumChatFormatting.DARK_AQUA, 43690);
- put(EnumChatFormatting.DARK_BLUE, 170);
- put(EnumChatFormatting.DARK_GRAY, 5592405);
- put(EnumChatFormatting.DARK_GREEN, 43520);
- put(EnumChatFormatting.DARK_PURPLE, 11141290);
- put(EnumChatFormatting.DARK_RED, 11141120);
- put(EnumChatFormatting.GOLD, 16755200);
- put(EnumChatFormatting.GRAY, 11184810);
- put(EnumChatFormatting.GREEN, 5635925);
- put(EnumChatFormatting.LIGHT_PURPLE, 16733695);
- put(EnumChatFormatting.RED, 16733525);
- put(EnumChatFormatting.WHITE, 16777215);
- put(EnumChatFormatting.YELLOW, 16777045);
- }
- };
-
- @Override
- public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
- {
- GL11.glPushMatrix();
- GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
- TileEntityDisplayer disp = (TileEntityDisplayer)te;
- ResourceLocation blockTexture = new ResourceLocation(Variables.MODID, texture);
- Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
- GL11.glPushMatrix();
- GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
- displayer.render((Entity)null, disp.ringTranslation1, disp.ringTranslation2, disp.ringTranslation3, 0.0F, 0.0F, 0.0625F);
- try{
- int block = disp.getBlockMetadata();
- if (disp != null && disp.hasObject && disp.object != null && disp.object.getItem() != null && disp.object != new ItemStack(Item.getItemById(0), 0, 0)){
- int ind = -3;
- GL11.glPushMatrix();
- EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, disp.object);
- entityitem.hoverStart = 0.0F;
- disp.object.stackSize = 1;
- GL11.glRotatef(180F, 1F, 0F, 0F);
- GL11.glTranslatef(0.0F, -0.6F + disp.ringTranslation1 / 5, 0F);
- GL11.glRotatef(disp.rotAngle, 0F, 1F, 0F);
- GL11.glColor4f(1F, 1F, 1F, 1F);
- if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- else{
- GL11.glRotatef(180F, 0F, 1F, 0F);
- RenderManager.instance.options.fancyGraphics = true;
- int i = 15728880;
- int j = i % 65536;
- int k = i / 65536;
- OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F);
- RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- RenderManager.instance.options.fancyGraphics = false;
- }
- EntityPlayer player = te.getWorldObj().getClosestPlayer(te.xCoord, te.yCoord, te.zCoord, 5D);
- GL11.glPopMatrix();
- GL11.glPushMatrix();
- if (player != null) renderLabel(disp.object.getDisplayName(), 0F, -0.171F * ind, 0F, block, disp, colors.get(disp.object.getRarity().rarityColor));
- GL11.glPopMatrix();
- ind++;
- if (player != null && disp.quantity > 1){
- GL11.glPushMatrix();
- renderLabel("x" + Integer.toString(disp.quantity), 0F, -0.171F * ind, 0F, block, disp, Color.GRAY.getRGB());
- GL11.glPopMatrix();
- ind++;
- }
- if (disp.object.getItem() != Items.map && player != null && disp.object.getTooltip(player, true) != null){
- List tooltips = disp.object.getTooltip(player, true);
- if (disp.infoIndex + 5 > tooltips.size()) disp.infoIndex = 1;
- if (tooltips.size() < 5) for(int i = 1; i < tooltips.size(); i++){
- String tooltip = tooltips.get(i).toString();
- RenderManager.instance.getFontRenderer();
- if (tooltip != ""){
- GL11.glPushMatrix();
- renderLabel(tooltip, 0F, -0.171F * ind, 0F, block, disp, Color.GRAY.getRGB());
- GL11.glPopMatrix();
- ind++;
- }
- }
- else for(int i = disp.infoIndex; i < disp.infoIndex + 5; i++){
- String tooltip = tooltips.get(i).toString();
- RenderManager.instance.getFontRenderer();
- if (tooltip != ""){
- GL11.glPushMatrix();
- renderLabel(tooltip, 0F, -0.171F * ind, 0F, block, disp, Color.GRAY.getRGB());
- GL11.glPopMatrix();
- ind++;
- }
- }
- }
- }
- }
- catch(Exception e){}
- GL11.glPopMatrix();
- GL11.glPopMatrix();
- }
-
- protected void renderLabel(String text, double x, double y, double z, int metadata, TileEntity te, int color)
- {
- FontRenderer fontrenderer = RenderManager.instance.getFontRenderer();
- float width = 0.015F, height = 1F;
- GL11.glRotatef(180F, 0F, 0F, 1F);
- GL11.glRotatef(360 - metadata * 90F, 0F, 1F, 0F);
- GL11.glTranslatef((float)x, (float)y, (float)z + 0.45F);
- GL11.glScalef(-0.015F, -0.019F, 0.015F);
- GL11.glPushMatrix();
- GL11.glDisable(GL11.GL_LIGHTING);
- Tessellator tessellator = Tessellator.instance;
- GL11.glDisable(GL11.GL_TEXTURE_2D);
- int j = fontrenderer.getStringWidth(text) / 2;
- tessellator.startDrawingQuads();
- tessellator.setColorRGBA_F(0.275F, 0.145F, 0.431F, 0.5F);
- tessellator.addVertex(-33.333 - 0, 0D, 0.1D);
- tessellator.addVertex(-33.333 - 0, 9D, 0.1D);
- tessellator.addVertex(33.333 + 0, 9D, 0.1D);
- tessellator.addVertex(33.333 + 0, 0D, 0.1D);
- tessellator.draw();
- if (fontrenderer.getStringWidth(text) / 2 > 20){
- width = 0.9F / fontrenderer.getStringWidth(text);
- height = 1F - fontrenderer.getStringWidth(text)/20*0.06F;
- }
- GL11.glTranslatef((float)x + 1f, (float)y + 1f, (float)z);
- GL11.glPushMatrix();
- GL11.glEnable(GL11.GL_TEXTURE_2D);
- GL11.glScalef(width * 70F, height, 0F);
- fontrenderer.drawString(text.replaceFirst("§0", "§r").replaceFirst("§1", "§r").replaceFirst("§2", "§r").replaceFirst("§3", "§r").replaceFirst("§4", "§r").replaceFirst("§5", "§r").replaceFirst("§6", "§r").replaceFirst("§7", "§r").replaceFirst("§8", "§r").replaceFirst("§9", "§r").replaceFirst("§a", "§r").replaceFirst("§b", "§r").replaceFirst("§c", "§r").replaceFirst("§d", "§r").replaceFirst("§e", "§r").replaceFirst("§f", "§r"), -j, 0, 1973790);
- GL11.glPopMatrix();
- GL11.glTranslatef((float)x - 0.5f, (float)y - 0.5f, (float)z - 0.5F);
- GL11.glScalef(width * 70F, height, 0F);
- fontrenderer.drawString(text, -j, 0, color);
- GL11.glEnable(GL11.GL_LIGHTING);
- GL11.glPopMatrix();
- }
+public class TileEntityDisplayerRender extends TileEntitySpecialRenderer {
+ private final class ChatColorMap
+ extends HashMap<EnumChatFormatting, Integer> {
+ private static final long serialVersionUID = -6532830760345687407L;
+ {
+ put(EnumChatFormatting.AQUA, 5636095);
+ put(EnumChatFormatting.BLACK, 0);
+ put(EnumChatFormatting.BLUE, 5592575);
+ put(EnumChatFormatting.DARK_AQUA, 43690);
+ put(EnumChatFormatting.DARK_BLUE, 170);
+ put(EnumChatFormatting.DARK_GRAY, 5592405);
+ put(EnumChatFormatting.DARK_GREEN, 43520);
+ put(EnumChatFormatting.DARK_PURPLE, 11141290);
+ put(EnumChatFormatting.DARK_RED, 11141120);
+ put(EnumChatFormatting.GOLD, 16755200);
+ put(EnumChatFormatting.GRAY, 11184810);
+ put(EnumChatFormatting.GREEN, 5635925);
+ put(EnumChatFormatting.LIGHT_PURPLE, 16733695);
+ put(EnumChatFormatting.RED, 16733525);
+ put(EnumChatFormatting.WHITE, 16777215);
+ put(EnumChatFormatting.YELLOW, 16777045);
+ }
+ }
+
+ ModelDisplayer displayer =
+ new ModelDisplayer();
+ String texture =
+ "textures/tileentities/Displayer.png";
+ HashMap<EnumChatFormatting, Integer> colors =
+ new ChatColorMap();
+
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y,
+ double z, float scale) {
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F,
+ (float) z + 0.5F);
+ TileEntityDisplayer disp = (TileEntityDisplayer) te;
+ ResourceLocation blockTexture =
+ new ResourceLocation(Variables.MODID, texture);
+ Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
+ GL11.glPushMatrix();
+ GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ displayer.render((Entity) null, disp.ringTranslation1,
+ disp.ringTranslation2, disp.ringTranslation3, 0.0F, 0.0F,
+ 0.0625F);
+ try {
+ int block = disp.getBlockMetadata();
+ if (disp != null && disp.hasObject && disp.object != null
+ && disp.object.getItem() != null
+ && disp.object != new ItemStack(Item.getItemById(0), 0,
+ 0)) {
+ int ind = -3;
+ GL11.glPushMatrix();
+ EntityItem entityitem = new EntityItem(te.getWorldObj(),
+ 0.0D, 0.0D, 0.0D, disp.object);
+ entityitem.hoverStart = 0.0F;
+ disp.object.stackSize = 1;
+ GL11.glRotatef(180F, 1F, 0F, 0F);
+ GL11.glTranslatef(0.0F, -0.6F + disp.ringTranslation1 / 5,
+ 0F);
+ GL11.glRotatef(disp.rotAngle, 0F, 1F, 0F);
+ GL11.glColor4f(1F, 1F, 1F, 1F);
+ if (RenderManager.instance.options.fancyGraphics)
+ RenderManager.instance.renderEntityWithPosYaw(
+ entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ else {
+ GL11.glRotatef(180F, 0F, 1F, 0F);
+ RenderManager.instance.options.fancyGraphics = true;
+ int i = 15728880;
+ int j = i % 65536;
+ int k = i / 65536;
+ OpenGlHelper.setLightmapTextureCoords(
+ OpenGlHelper.lightmapTexUnit, j / 1.0F,
+ k / 1.0F);
+ RenderManager.instance.renderEntityWithPosYaw(
+ entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderManager.instance.options.fancyGraphics = false;
+ }
+ EntityPlayer player = te.getWorldObj().getClosestPlayer(
+ te.xCoord, te.yCoord, te.zCoord, 5D);
+ GL11.glPopMatrix();
+ GL11.glPushMatrix();
+ if (player != null)
+ renderLabel(disp.object.getDisplayName(), 0F,
+ -0.171F * ind, 0F, block, disp, colors.get(
+ disp.object.getRarity().rarityColor));
+ GL11.glPopMatrix();
+ ind++;
+ if (player != null && disp.quantity > 1) {
+ GL11.glPushMatrix();
+ renderLabel("x" + Integer.toString(disp.quantity), 0F,
+ -0.171F * ind, 0F, block, disp,
+ Color.GRAY.getRGB());
+ GL11.glPopMatrix();
+ ind++;
+ }
+ if (disp.object.getItem() != Items.map && player != null
+ && disp.object.getTooltip(player, true) != null) {
+ List<?> tooltips =
+ disp.object.getTooltip(player, true);
+ if (disp.infoIndex + 5 > tooltips.size())
+ disp.infoIndex = 1;
+ if (tooltips.size() < 5)
+ for (int i = 1; i < tooltips.size(); i++) {
+ String tooltip = tooltips.get(i).toString();
+ RenderManager.instance.getFontRenderer();
+ if (tooltip != "") {
+ GL11.glPushMatrix();
+ renderLabel(tooltip, 0F, -0.171F * ind, 0F,
+ block, disp, Color.GRAY.getRGB());
+ GL11.glPopMatrix();
+ ind++;
+ }
+ }
+ else
+ for (int i = disp.infoIndex;
+ i < disp.infoIndex + 5; i++) {
+ String tooltip = tooltips.get(i).toString();
+ RenderManager.instance.getFontRenderer();
+ if (tooltip != "") {
+ GL11.glPushMatrix();
+ renderLabel(tooltip, 0F, -0.171F * ind, 0F,
+ block, disp, Color.GRAY.getRGB());
+ GL11.glPopMatrix();
+ ind++;
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ }
+ GL11.glPopMatrix();
+ GL11.glPopMatrix();
+ }
+
+ protected void renderLabel(String text, double x, double y, double z,
+ int metadata, TileEntity te, int color) {
+ FontRenderer fontrenderer =
+ RenderManager.instance.getFontRenderer();
+ float width = 0.015F, height = 1F;
+ GL11.glRotatef(180F, 0F, 0F, 1F);
+ GL11.glRotatef(360 - metadata * 90F, 0F, 1F, 0F);
+ GL11.glTranslatef((float) x, (float) y, (float) z + 0.45F);
+ GL11.glScalef(-0.015F, -0.019F, 0.015F);
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ Tessellator tessellator = Tessellator.instance;
+ GL11.glDisable(GL11.GL_TEXTURE_2D);
+ int j = fontrenderer.getStringWidth(text) / 2;
+ tessellator.startDrawingQuads();
+ tessellator.setColorRGBA_F(0.275F, 0.145F, 0.431F, 0.5F);
+ tessellator.addVertex(-33.333 - 0, 0D, 0.1D);
+ tessellator.addVertex(-33.333 - 0, 9D, 0.1D);
+ tessellator.addVertex(33.333 + 0, 9D, 0.1D);
+ tessellator.addVertex(33.333 + 0, 0D, 0.1D);
+ tessellator.draw();
+ if (fontrenderer.getStringWidth(text) / 2 > 20) {
+ width = 0.9F / fontrenderer.getStringWidth(text);
+ height = 1F - fontrenderer.getStringWidth(text) / 20 * 0.06F;
+ }
+ GL11.glTranslatef((float) x + 1f, (float) y + 1f, (float) z);
+ GL11.glPushMatrix();
+ GL11.glEnable(GL11.GL_TEXTURE_2D);
+ GL11.glScalef(width * 70F, height, 0F);
+ fontrenderer.drawString(
+ text.replaceFirst("�0", "�r").replaceFirst("�1", "�r")
+ .replaceFirst("�2", "�r").replaceFirst("�3", "�r")
+ .replaceFirst("�4", "�r").replaceFirst("�5", "�r")
+ .replaceFirst("�6", "�r").replaceFirst("�7", "�r")
+ .replaceFirst("�8", "�r").replaceFirst("�9", "�r")
+ .replaceFirst("�a", "�r").replaceFirst("�b", "�r")
+ .replaceFirst("�c", "�r").replaceFirst("�d", "�r")
+ .replaceFirst("�e", "�r").replaceFirst("�f", "�r"),
+ -j, 0, 1973790);
+ GL11.glPopMatrix();
+ GL11.glTranslatef((float) x - 0.5f, (float) y - 0.5f,
+ (float) z - 0.5F);
+ GL11.glScalef(width * 70F, height, 0F);
+ fontrenderer.drawString(text, -j, 0, color);
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glPopMatrix();
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityHandPedestalRender.java b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityHandPedestalRender.java index d639d93..4dcdb1e 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityHandPedestalRender.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityHandPedestalRender.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.tileentity.renders;
import org.lwjgl.opengl.GL11;
+
import darkknight.jewelrycraft.model.ModelHandPedestal;
import darkknight.jewelrycraft.tileentity.TileEntityHandPedestal;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
@@ -10,38 +11,42 @@ import net.minecraft.util.ResourceLocation; /**
* @author Paul Fulham (pau101)
*/
-public class TileEntityHandPedestalRender extends TileEntitySpecialRenderer
-{
- private ModelHandPedestal model;
- private ResourceLocation texture;
-
- /**
- * @param model
- * @param texture
- */
- public TileEntityHandPedestalRender(ModelHandPedestal model, ResourceLocation texture)
- {
- this.model = model;
- this.texture = texture;
- }
-
- /**
- * @param te
- * @param x
- * @param y
- * @param z
- * @param partialRenderTicks
- */
- @Override
- public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialRenderTicks)
- {
- GL11.glPushMatrix();
- GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
- TileEntityHandPedestal pedestal = (TileEntityHandPedestal)te;
- bindTexture(texture);
- GL11.glRotatef(180, 0, 0, 1);
- GL11.glRotatef(pedestal.getWorldObj() == null ? 180 : pedestal.getBlockMetadata() % 8 / 8F * 360, 0, 1, 0);
- model.render(pedestal, partialRenderTicks, 0.0625F);
- GL11.glPopMatrix();
- }
+public class TileEntityHandPedestalRender
+ extends TileEntitySpecialRenderer {
+ private ModelHandPedestal model;
+ private ResourceLocation texture;
+
+ /**
+ * @param model
+ * @param texture
+ */
+ public TileEntityHandPedestalRender(ModelHandPedestal model,
+ ResourceLocation texture) {
+ this.model = model;
+ this.texture = texture;
+ }
+
+ /**
+ * @param te
+ * @param x
+ * @param y
+ * @param z
+ * @param partialRenderTicks
+ */
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y,
+ double z, float partialRenderTicks) {
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F,
+ (float) z + 0.5F);
+ TileEntityHandPedestal pedestal = (TileEntityHandPedestal) te;
+ bindTexture(texture);
+ GL11.glRotatef(180, 0, 0, 1);
+ GL11.glRotatef(
+ pedestal.getWorldObj() == null ? 180
+ : pedestal.getBlockMetadata() % 8 / 8F * 360,
+ 0, 1, 0);
+ model.render(pedestal, partialRenderTicks, 0.0625F);
+ GL11.glPopMatrix();
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityJewelrsCraftingTableRender.java b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityJewelrsCraftingTableRender.java index 02b12aa..a62d21d 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityJewelrsCraftingTableRender.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityJewelrsCraftingTableRender.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.tileentity.renders;
import org.lwjgl.opengl.GL11;
+
import darkknight.jewelrycraft.model.ModelJewlersCraftingBench;
import darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable;
import darkknight.jewelrycraft.util.Variables;
@@ -16,122 +17,144 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
-public class TileEntityJewelrsCraftingTableRender extends TileEntitySpecialRenderer
-{
- ModelJewlersCraftingBench modelTable = new ModelJewlersCraftingBench();
- String texture = "textures/tileentities/JewelrsCraftingBench.png";
-
- /**
- * @param te
- * @param x
- * @param y
- * @param z
- * @param scale
- */
- @Override
- public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
- {
- GL11.glPushMatrix();
- GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
- ResourceLocation blockTexture = new ResourceLocation(Variables.MODID, texture);
- Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
- TileEntityJewelrsCraftingTable jt = (TileEntityJewelrsCraftingTable)te;
- GL11.glPushMatrix();
- GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
- try{
- int block = te.getBlockMetadata();
- if (block == 1) GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
- else if (block == 2){
- GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
- GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
- }else if (block == 3){
- GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
- GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F);
- }
- }
- catch(Exception e){}
- modelTable.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
- if (jt != null){
- if (jt.hasJewelry && jt.jewelry.getIconIndex() != null && jt.jewelry.getIconIndex().getIconName() != ""){
- GL11.glPushMatrix();
- GL11.glDisable(GL11.GL_LIGHTING);
- EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, jt.jewelry);
- entityitem.getEntityItem().stackSize = 1;
- entityitem.hoverStart = 0.0F;
- GL11.glRotatef(180F, 1F, 0F, 0F);
- GL11.glScalef(0.5F, 0.5F, 0.5F);
- GL11.glTranslatef(0.55F, -1.5F, -0.45F);
- GL11.glRotatef(jt.angle, 0F, 1F, 0F);
- if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- else{
- GL11.glRotatef(180F, 0F, 1F, 0F);
- RenderManager.instance.options.fancyGraphics = true;
- RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- RenderManager.instance.options.fancyGraphics = false;
- }
- GL11.glEnable(GL11.GL_LIGHTING);
- GL11.glPopMatrix();
- }
- if (jt.hasEndItem && jt.endItem.getIconIndex().getIconName() != ""){
- GL11.glPushMatrix();
- GL11.glDisable(GL11.GL_LIGHTING);
- EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, jt.endItem);
- entityitem.getEntityItem().stackSize = 1;
- entityitem.hoverStart = 0.0F;
- GL11.glRotatef(180F, 1F, 0F, 0F);
- GL11.glScalef(0.5F, 0.5F, 0.5F);
- GL11.glTranslatef(0.0F, -1.6F, 0.6F);
- GL11.glRotatef(jt.angle, 0F, 1F, 0F);
- if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- else{
- GL11.glRotatef(180F, 0F, 1F, 0F);
- RenderManager.instance.options.fancyGraphics = true;
- RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- RenderManager.instance.options.fancyGraphics = false;
- }
- GL11.glEnable(GL11.GL_LIGHTING);
- GL11.glPopMatrix();
- }
- if (jt.hasGem && jt.gem.getIconIndex().getIconName() != ""){
- GL11.glPushMatrix();
- GL11.glDisable(GL11.GL_LIGHTING);
- EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, jt.gem);
- entityitem.getEntityItem().stackSize = 1;
- entityitem.hoverStart = 0.0F;
- GL11.glRotatef(180F, 1F, 0F, 0F);
- GL11.glScalef(0.5F, 0.5F, 0.5F);
- GL11.glTranslatef(-0.55F, -1.5F, -0.45F);
- GL11.glRotatef(jt.angle, 0F, 1F, 0F);
- if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- else{
- GL11.glRotatef(180F, 0F, 1F, 0F);
- RenderManager.instance.options.fancyGraphics = true;
- RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- RenderManager.instance.options.fancyGraphics = false;
- }
- GL11.glEnable(GL11.GL_LIGHTING);
- GL11.glPopMatrix();
- }
- }
- GL11.glPopMatrix();
- GL11.glPopMatrix();
- }
-
- /**
- * @param world
- * @param i
- * @param j
- * @param k
- * @param block
- */
- public void adjustLightFixture(World world, int i, int j, int k, Block block)
- {
- Tessellator tess = Tessellator.instance;
- float brightness = block.getLightOpacity(world, i, j, k);
- int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
- int modulousModifier = skyLight % 65536;
- int divModifier = skyLight / 65536;
- tess.setColorOpaque_F(brightness, brightness, brightness);
- OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, modulousModifier, divModifier);
- }
+public class TileEntityJewelrsCraftingTableRender
+ extends TileEntitySpecialRenderer {
+ ModelJewlersCraftingBench modelTable =
+ new ModelJewlersCraftingBench();
+ String texture =
+ "textures/tileentities/JewelrsCraftingBench.png";
+
+ /**
+ * @param te
+ * @param x
+ * @param y
+ * @param z
+ * @param scale
+ */
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y,
+ double z, float scale) {
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F,
+ (float) z + 0.5F);
+ ResourceLocation blockTexture =
+ new ResourceLocation(Variables.MODID, texture);
+ Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
+ TileEntityJewelrsCraftingTable jt =
+ (TileEntityJewelrsCraftingTable) te;
+ GL11.glPushMatrix();
+ GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ try {
+ int block = te.getBlockMetadata();
+ if (block == 1)
+ GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
+ else if (block == 2) {
+ GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
+ } else if (block == 3) {
+ GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F);
+ }
+ } catch (Exception e) {
+ }
+ modelTable.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F,
+ 0.0625F);
+ if (jt != null) {
+ if (jt.hasJewelry && jt.jewelry.getIconIndex() != null
+ && jt.jewelry.getIconIndex().getIconName() != "") {
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ EntityItem entityitem = new EntityItem(te.getWorldObj(),
+ 0.0D, 0.0D, 0.0D, jt.jewelry);
+ entityitem.getEntityItem().stackSize = 1;
+ entityitem.hoverStart = 0.0F;
+ GL11.glRotatef(180F, 1F, 0F, 0F);
+ GL11.glScalef(0.5F, 0.5F, 0.5F);
+ GL11.glTranslatef(0.55F, -1.5F, -0.45F);
+ GL11.glRotatef(jt.angle, 0F, 1F, 0F);
+ if (RenderManager.instance.options.fancyGraphics)
+ RenderManager.instance.renderEntityWithPosYaw(
+ entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ else {
+ GL11.glRotatef(180F, 0F, 1F, 0F);
+ RenderManager.instance.options.fancyGraphics = true;
+ RenderManager.instance.renderEntityWithPosYaw(
+ entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderManager.instance.options.fancyGraphics = false;
+ }
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glPopMatrix();
+ }
+ if (jt.hasEndItem
+ && jt.endItem.getIconIndex().getIconName() != "") {
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ EntityItem entityitem = new EntityItem(te.getWorldObj(),
+ 0.0D, 0.0D, 0.0D, jt.endItem);
+ entityitem.getEntityItem().stackSize = 1;
+ entityitem.hoverStart = 0.0F;
+ GL11.glRotatef(180F, 1F, 0F, 0F);
+ GL11.glScalef(0.5F, 0.5F, 0.5F);
+ GL11.glTranslatef(0.0F, -1.6F, 0.6F);
+ GL11.glRotatef(jt.angle, 0F, 1F, 0F);
+ if (RenderManager.instance.options.fancyGraphics)
+ RenderManager.instance.renderEntityWithPosYaw(
+ entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ else {
+ GL11.glRotatef(180F, 0F, 1F, 0F);
+ RenderManager.instance.options.fancyGraphics = true;
+ RenderManager.instance.renderEntityWithPosYaw(
+ entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderManager.instance.options.fancyGraphics = false;
+ }
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glPopMatrix();
+ }
+ if (jt.hasGem && jt.gem.getIconIndex().getIconName() != "") {
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ EntityItem entityitem = new EntityItem(te.getWorldObj(),
+ 0.0D, 0.0D, 0.0D, jt.gem);
+ entityitem.getEntityItem().stackSize = 1;
+ entityitem.hoverStart = 0.0F;
+ GL11.glRotatef(180F, 1F, 0F, 0F);
+ GL11.glScalef(0.5F, 0.5F, 0.5F);
+ GL11.glTranslatef(-0.55F, -1.5F, -0.45F);
+ GL11.glRotatef(jt.angle, 0F, 1F, 0F);
+ if (RenderManager.instance.options.fancyGraphics)
+ RenderManager.instance.renderEntityWithPosYaw(
+ entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ else {
+ GL11.glRotatef(180F, 0F, 1F, 0F);
+ RenderManager.instance.options.fancyGraphics = true;
+ RenderManager.instance.renderEntityWithPosYaw(
+ entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderManager.instance.options.fancyGraphics = false;
+ }
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glPopMatrix();
+ }
+ }
+ GL11.glPopMatrix();
+ GL11.glPopMatrix();
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param block
+ */
+ public void adjustLightFixture(World world, int i, int j, int k,
+ Block block) {
+ Tessellator tess = Tessellator.instance;
+ float brightness = block.getLightOpacity(world, i, j, k);
+ int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
+ int modulousModifier = skyLight % 65536;
+ int divModifier = skyLight / 65536;
+ tess.setColorOpaque_F(brightness, brightness, brightness);
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit,
+ modulousModifier, divModifier);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityMidasTouchRender.java b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityMidasTouchRender.java index 786568a..bf0a385 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityMidasTouchRender.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityMidasTouchRender.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.tileentity.renders;
import org.lwjgl.opengl.GL11;
+
import darkknight.jewelrycraft.tileentity.TileEntityMidasTouch;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
@@ -8,25 +9,32 @@ import net.minecraft.entity.EntityLiving; import net.minecraft.entity.passive.EntityPig;
import net.minecraft.tileentity.TileEntity;
-public class TileEntityMidasTouchRender extends TileEntitySpecialRenderer
-{
- @Override
- public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
- {
- GL11.glPushMatrix();
- TileEntityMidasTouch midas = (TileEntityMidasTouch)te;
- if (midas.target != null){
- EntityLiving target = ((EntityLiving)midas.target);
- target.hurtTime = 0;
- GL11.glTranslatef(0.5F, 0.0F, 0.5F);
- GL11.glColor3f(1.0F, 1.0F, 0.0F);
- RenderManager.instance.renderEntityWithPosYaw(target, midas.xCoord - RenderManager.instance.renderPosX, midas.yCoord - RenderManager.instance.renderPosY, midas.zCoord - RenderManager.instance.renderPosZ, 0F, 1F);
- }
- else{
- GL11.glTranslatef(0.5F, 0.0F, 0.5F);
- GL11.glColor3f(1.0F, 1.0F, 0.0F);
- RenderManager.instance.renderEntityWithPosYaw(new EntityPig(te.getWorldObj()), midas.xCoord - RenderManager.instance.renderPosX, midas.yCoord - RenderManager.instance.renderPosY, midas.zCoord - RenderManager.instance.renderPosZ, 0F, 1F);
- }
- GL11.glPopMatrix();
- }
+public class TileEntityMidasTouchRender extends TileEntitySpecialRenderer {
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y,
+ double z, float scale) {
+ GL11.glPushMatrix();
+ TileEntityMidasTouch midas = (TileEntityMidasTouch) te;
+ if (midas.target != null) {
+ EntityLiving target = ((EntityLiving) midas.target);
+ target.hurtTime = 0;
+ GL11.glTranslatef(0.5F, 0.0F, 0.5F);
+ GL11.glColor3f(1.0F, 1.0F, 0.0F);
+ RenderManager.instance.renderEntityWithPosYaw(target,
+ midas.xCoord - RenderManager.renderPosX,
+ midas.yCoord - RenderManager.renderPosY,
+ midas.zCoord - RenderManager.renderPosZ, 0F,
+ 1F);
+ } else {
+ GL11.glTranslatef(0.5F, 0.0F, 0.5F);
+ GL11.glColor3f(1.0F, 1.0F, 0.0F);
+ RenderManager.instance.renderEntityWithPosYaw(
+ new EntityPig(te.getWorldObj()),
+ midas.xCoord - RenderManager.renderPosX,
+ midas.yCoord - RenderManager.renderPosY,
+ midas.zCoord - RenderManager.renderPosZ, 0F,
+ 1F);
+ }
+ GL11.glPopMatrix();
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityMolderRender.java b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityMolderRender.java index 51e0677..6f55e1c 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityMolderRender.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityMolderRender.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.tileentity.renders;
import org.lwjgl.opengl.GL11;
+
import darkknight.jewelrycraft.JewelrycraftMod;
import darkknight.jewelrycraft.item.ItemList;
import darkknight.jewelrycraft.model.ModelMolder;
@@ -23,116 +24,139 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
-public class TileEntityMolderRender extends TileEntitySpecialRenderer
-{
- ModelMolder modelMolder = new ModelMolder();
-
- /**
- * @param te
- * @param x
- * @param y
- * @param z
- * @param scale
- */
- @Override
- public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
- {
- GL11.glPushMatrix();
- GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
- TileEntityMolder me = (TileEntityMolder)te;
- String texture = "textures/tileentities/Molder.png";
- ResourceLocation blockTexture = new ResourceLocation(Variables.MODID, texture);
- Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
- GL11.glPushMatrix();
- GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
- try{
- int block = me.getBlockMetadata();
- if (block == 1) GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
- else if (block == 2){
- GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
- GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
- }else if (block == 3){
- GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
- GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F);
- }
- }
- catch(Exception e){}
- modelMolder.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
- boolean fancyGraphics = Minecraft.getMinecraft().gameSettings.fancyGraphics;
- if (me != null){
- if (me.hasMold){
- GL11.glPushMatrix();
- EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, me.mold);
- entityitem.getEntityItem().stackSize = 1;
- entityitem.hoverStart = 0.0F;
- GL11.glTranslatef(0F, 1.43F, -0.28F);
- GL11.glScalef(1.25F, 1.0F, 1.25F);
- GL11.glRotatef(90F, 1F, 0F, 0f);
- Minecraft.getMinecraft().gameSettings.fancyGraphics = true;
- if (entityitem != null){
- RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.03D, 0.0F, 0.0F);
- }
- Minecraft.getMinecraft().gameSettings.fancyGraphics = fancyGraphics;
- GL11.glPopMatrix();
- }
- if (me.hasJewelBase && me.jewelBase != null && me.jewelBase.getItem() != Item.getItemFromBlock(Blocks.air) && me.jewelBase.getIconIndex() != null && me.jewelBase.getIconIndex().getIconName() != ""){
- GL11.glPushMatrix();
- EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, me.jewelBase);
- entityitem.getEntityItem().stackSize = 1;
- entityitem.hoverStart = 0.0F;
- GL11.glTranslatef(0F, 1.4F, -0.28F);
- GL11.glScalef(1.25F, 1.0F, 1.25F);
- GL11.glRotatef(90F, 1F, 0F, 0f);
- Minecraft.getMinecraft().gameSettings.fancyGraphics = true;
- if (entityitem != null) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.01D, 0.0F, 0.0F);
- Minecraft.getMinecraft().gameSettings.fancyGraphics = fancyGraphics;
- GL11.glColor4f(1, 1F, 1F, 1.0F);
- GL11.glPopMatrix();
- }
- if (me.hasMoltenMetal && me.moltenMetal != null && me.moltenMetal != new ItemStack(Item.getItemById(0), 0, 0)){
- GL11.glPushMatrix();
- GL11.glDisable(GL11.GL_LIGHTING);
- if (JewelrycraftMod.fancyRender){
- GL11.glEnable(GL11.GL_BLEND);
- OpenGlHelper.glBlendFunc(1, 1, 0, 0);
- }
- ItemStack metal = new ItemStack(ItemList.metal);
- ItemStack ingot = me.moltenMetal.copy();
- JewelryNBT.addMetal(metal, ingot);
- EntityItem moltenMetal = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, metal);
- moltenMetal.getEntityItem().stackSize = 1;
- moltenMetal.hoverStart = 0.0F;
- GL11.glTranslatef(-0F, 1.4f - 0.005f * me.quantity, -0.29F);
- GL11.glScalef(1.2F, 1.0F, 1.4F);
- GL11.glRotatef(90F, 1F, 0F, 0f);
- RenderItem.renderInFrame = true;
- RenderManager.instance.renderEntityWithPosYaw(moltenMetal, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- RenderItem.renderInFrame = false;
- if (JewelrycraftMod.fancyRender) GL11.glDisable(GL11.GL_BLEND);
- GL11.glEnable(GL11.GL_LIGHTING);
- GL11.glPopMatrix();
- }
- }
- GL11.glPopMatrix();
- GL11.glPopMatrix();
- }
-
- /**
- * @param world
- * @param i
- * @param j
- * @param k
- * @param block
- */
- public void adjustLightFixture(World world, int i, int j, int k, Block block)
- {
- Tessellator tess = Tessellator.instance;
- float brightness = block.getLightOpacity(world, i, j, k);
- int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
- int modulousModifier = skyLight % 65536;
- int divModifier = skyLight / 65536;
- tess.setColorOpaque_F(brightness, brightness, brightness);
- OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, modulousModifier, divModifier);
- }
+public class TileEntityMolderRender extends TileEntitySpecialRenderer {
+ ModelMolder modelMolder = new ModelMolder();
+
+ /**
+ * @param te
+ * @param x
+ * @param y
+ * @param z
+ * @param scale
+ */
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y,
+ double z, float scale) {
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F,
+ (float) z + 0.5F);
+ TileEntityMolder me = (TileEntityMolder) te;
+ String texture = "textures/tileentities/Molder.png";
+ ResourceLocation blockTexture =
+ new ResourceLocation(Variables.MODID, texture);
+ Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
+ GL11.glPushMatrix();
+ GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ try {
+ int block = me.getBlockMetadata();
+ if (block == 1)
+ GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
+ else if (block == 2) {
+ GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
+ } else if (block == 3) {
+ GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F);
+ }
+ } catch (Exception e) {
+ }
+ modelMolder.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F,
+ 0.0625F);
+ boolean fancyGraphics =
+ Minecraft.getMinecraft().gameSettings.fancyGraphics;
+ if (me != null) {
+ if (me.hasMold) {
+ GL11.glPushMatrix();
+ EntityItem entityitem = new EntityItem(te.getWorldObj(),
+ 0.0D, 0.0D, 0.0D, me.mold);
+ entityitem.getEntityItem().stackSize = 1;
+ entityitem.hoverStart = 0.0F;
+ GL11.glTranslatef(0F, 1.43F, -0.28F);
+ GL11.glScalef(1.25F, 1.0F, 1.25F);
+ GL11.glRotatef(90F, 1F, 0F, 0f);
+ Minecraft.getMinecraft().gameSettings.fancyGraphics = true;
+ if (entityitem != null) {
+ RenderManager.instance.renderEntityWithPosYaw(
+ entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderManager.instance.renderEntityWithPosYaw(
+ entityitem, 0.0D, 0.0D, 0.03D, 0.0F, 0.0F);
+ }
+ Minecraft.getMinecraft().gameSettings.fancyGraphics =
+ fancyGraphics;
+ GL11.glPopMatrix();
+ }
+ if (me.hasJewelBase && me.jewelBase != null
+ && me.jewelBase.getItem() != Item
+ .getItemFromBlock(Blocks.air)
+ && me.jewelBase.getIconIndex() != null
+ && me.jewelBase.getIconIndex().getIconName() != "") {
+ GL11.glPushMatrix();
+ EntityItem entityitem = new EntityItem(te.getWorldObj(),
+ 0.0D, 0.0D, 0.0D, me.jewelBase);
+ entityitem.getEntityItem().stackSize = 1;
+ entityitem.hoverStart = 0.0F;
+ GL11.glTranslatef(0F, 1.4F, -0.28F);
+ GL11.glScalef(1.25F, 1.0F, 1.25F);
+ GL11.glRotatef(90F, 1F, 0F, 0f);
+ Minecraft.getMinecraft().gameSettings.fancyGraphics = true;
+ if (entityitem != null)
+ RenderManager.instance.renderEntityWithPosYaw(
+ entityitem, 0.0D, 0.0D, 0.01D, 0.0F, 0.0F);
+ Minecraft.getMinecraft().gameSettings.fancyGraphics =
+ fancyGraphics;
+ GL11.glColor4f(1, 1F, 1F, 1.0F);
+ GL11.glPopMatrix();
+ }
+ if (me.hasMoltenMetal && me.moltenMetal != null
+ && me.moltenMetal != new ItemStack(Item.getItemById(0),
+ 0, 0)) {
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ if (JewelrycraftMod.fancyRender) {
+ GL11.glEnable(GL11.GL_BLEND);
+ OpenGlHelper.glBlendFunc(1, 1, 0, 0);
+ }
+ ItemStack metal = new ItemStack(ItemList.metal);
+ ItemStack ingot = me.moltenMetal.copy();
+ JewelryNBT.addMetal(metal, ingot);
+ EntityItem moltenMetal = new EntityItem(te.getWorldObj(),
+ 0.0D, 0.0D, 0.0D, metal);
+ moltenMetal.getEntityItem().stackSize = 1;
+ moltenMetal.hoverStart = 0.0F;
+ GL11.glTranslatef(-0F, 1.4f - 0.005f * me.quantity,
+ -0.29F);
+ GL11.glScalef(1.2F, 1.0F, 1.4F);
+ GL11.glRotatef(90F, 1F, 0F, 0f);
+ RenderItem.renderInFrame = true;
+ RenderManager.instance.renderEntityWithPosYaw(moltenMetal,
+ 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderItem.renderInFrame = false;
+ if (JewelrycraftMod.fancyRender)
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glPopMatrix();
+ }
+ }
+ GL11.glPopMatrix();
+ GL11.glPopMatrix();
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param block
+ */
+ public void adjustLightFixture(World world, int i, int j, int k,
+ Block block) {
+ Tessellator tess = Tessellator.instance;
+ float brightness = block.getLightOpacity(world, i, j, k);
+ int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
+ int modulousModifier = skyLight % 65536;
+ int divModifier = skyLight / 65536;
+ tess.setColorOpaque_F(brightness, brightness, brightness);
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit,
+ modulousModifier, divModifier);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityShadowEyeRender.java b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityShadowEyeRender.java index e347901..60277a2 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityShadowEyeRender.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityShadowEyeRender.java @@ -3,6 +3,7 @@ package darkknight.jewelrycraft.tileentity.renders; import org.lwjgl.opengl.GL11;
import org.lwjgl.util.glu.GLU;
import org.lwjgl.util.glu.Sphere;
+
import darkknight.jewelrycraft.model.ModelShadowEye;
import darkknight.jewelrycraft.tileentity.TileEntityShadowEye;
import darkknight.jewelrycraft.util.Variables;
@@ -17,85 +18,97 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
-public class TileEntityShadowEyeRender extends TileEntitySpecialRenderer
-{
- ModelShadowEye eye = new ModelShadowEye();
- Sphere shadow = new Sphere();
-
- /**
- * @param te
- * @param x
- * @param y
- * @param z
- * @param scale
- */
- @Override
- public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
- {
- GL11.glPushMatrix();
- GL11.glTranslatef((float)x + 0.5F, (float)y + 1.6F, (float)z + 0.5F);
- TileEntityShadowEye eyeS = (TileEntityShadowEye)te;
- String texture = "textures/tileentities/ShadowEye" + eyeS.opening + ".png";
- ResourceLocation blockTexture = new ResourceLocation(Variables.MODID, texture);
- Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
- GL11.glPushMatrix();
- GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
- try{
- int block = te.getBlockMetadata();
- if (block == 0) GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
- else if (block == 1) GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F);
- else if (block == 2) GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F);
- }
- catch(Exception e){}
- if (te != null && te.getWorldObj() != null)
- {
- EntityPlayer player = te.getWorldObj().getClosestPlayer(te.xCoord, te.yCoord, te.zCoord, 16D);
- if(player != null)
- {
- float x1 = (float) (te.xCoord - player.posX) + 0.5F;
- float y1 = (float) (te.yCoord - player.posY) + 0.5F;
- float z1 = (float) (te.zCoord - player.posZ) + 0.5F;
- eyeS.model.render(player, 0, (float)(x1 >= 0 ? Math.atan(z1 / x1) : Math.PI + Math.atan(z1 / x1)), (float)(y1 >= 0 ? Math.atan(y1 / x1) : Math.atan(y1 / x1)), te.blockMetadata, eyeS.opening, 0.0625F);
- }
+public class TileEntityShadowEyeRender extends TileEntitySpecialRenderer {
+ ModelShadowEye eye = new ModelShadowEye();
+ Sphere shadow = new Sphere();
+
+ /**
+ * @param te
+ * @param x
+ * @param y
+ * @param z
+ * @param scale
+ */
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y,
+ double z, float scale) {
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float) x + 0.5F, (float) y + 1.6F,
+ (float) z + 0.5F);
+ TileEntityShadowEye eyeS = (TileEntityShadowEye) te;
+ String texture =
+ "textures/tileentities/ShadowEye" + eyeS.opening + ".png";
+ ResourceLocation blockTexture =
+ new ResourceLocation(Variables.MODID, texture);
+ Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
+ GL11.glPushMatrix();
+ GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ try {
+ int block = te.getBlockMetadata();
+ if (block == 0)
+ GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
+ else if (block == 1)
+ GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F);
+ else if (block == 2)
+ GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F);
+ } catch (Exception e) {
+ }
+ if (te != null && te.getWorldObj() != null) {
+ EntityPlayer player = te.getWorldObj().getClosestPlayer(
+ te.xCoord, te.yCoord, te.zCoord, 16D);
+ if (player != null) {
+ float x1 = (float) (te.xCoord - player.posX) + 0.5F;
+ float y1 = (float) (te.yCoord - player.posY) + 0.5F;
+ float z1 = (float) (te.zCoord - player.posZ) + 0.5F;
+ eyeS.model.render(player, 0,
+ (float) (x1 >= 0 ? Math.atan(z1 / x1)
+ : Math.PI + Math.atan(z1 / x1)),
+ (float) (y1 >= 0 ? Math.atan(y1 / x1)
+ : Math.atan(y1 / x1)),
+ te.blockMetadata, eyeS.opening, 0.0625F);
+ }
+
+ } else
+ eyeS.model.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F,
+ 0.0625F);
+
+ if (eyeS.opening == 4) {
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_TEXTURE_2D);
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_ONE_MINUS_SRC_ALPHA,
+ GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glColor4f(0.0F, 0.0F, 0.0F, 1F);
+ GL11.glRotatef(eyeS.timer * 10F, 0, 1, 0);
+ GL11.glRotatef(90.0F, 1, 0, 0);
+ shadow.setNormals(GLU.GLU_NONE);
+ shadow.draw(7.5F, 6, 6);
+ GL11.glScalef(-1, -1, -1);
+ shadow.draw(7.5F, 6, 6);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glEnable(GL11.GL_TEXTURE_2D);
+ GL11.glPopMatrix();
+ }
+ GL11.glPopMatrix();
+ GL11.glPopMatrix();
+ }
- }
- else eyeS.model.render((Entity)null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
-
- if (eyeS.opening == 4){
- GL11.glPushMatrix();
- GL11.glDisable(GL11.GL_TEXTURE_2D);
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- GL11.glColor4f(0.0F, 0.0F, 0.0F, 1F);
- GL11.glRotatef(eyeS.timer*10F, 0, 1, 0);
- GL11.glRotatef(90.0F, 1, 0, 0);
- shadow.setNormals(GLU.GLU_NONE);
- shadow.draw(7.5F, 6, 6);
- GL11.glScalef(-1,-1,-1);
- shadow.draw(7.5F, 6, 6);
- GL11.glDisable(GL11.GL_BLEND);
- GL11.glEnable(GL11.GL_TEXTURE_2D);
- GL11.glPopMatrix();
- }
- GL11.glPopMatrix();
- GL11.glPopMatrix();
- }
-
- /**
- * @param world
- * @param i
- * @param j
- * @param k
- * @param block
- */
- public void adjustLightFixture(World world, int i, int j, int k, Block block)
- {
- Tessellator tess = Tessellator.instance;
- float brightness = block.getLightOpacity(world, i, j, k);
- int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
- int modulousModifier = skyLight % 65536;
- int divModifier = skyLight / 65536;
- tess.setColorOpaque_F(brightness, brightness, brightness);
- OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, modulousModifier, divModifier);
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param block
+ */
+ public void adjustLightFixture(World world, int i, int j, int k,
+ Block block) {
+ Tessellator tess = Tessellator.instance;
+ float brightness = block.getLightOpacity(world, i, j, k);
+ int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
+ int modulousModifier = skyLight % 65536;
+ int divModifier = skyLight / 65536;
+ tess.setColorOpaque_F(brightness, brightness, brightness);
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit,
+ modulousModifier, divModifier);
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityShadowHandRender.java b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityShadowHandRender.java index 85a90d2..dd960d0 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityShadowHandRender.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityShadowHandRender.java @@ -6,15 +6,15 @@ import net.minecraft.util.ResourceLocation; /**
* @author Paul Fulham (pau101)
*/
-public class TileEntityShadowHandRender extends TileEntityHandPedestalRender
-{
-
- /**
- * @param model
- * @param texture
- */
- public TileEntityShadowHandRender(ModelHandPedestal model, ResourceLocation texture)
- {
- super(model, texture);
- }
+public class TileEntityShadowHandRender
+ extends TileEntityHandPedestalRender {
+
+ /**
+ * @param model
+ * @param texture
+ */
+ public TileEntityShadowHandRender(ModelHandPedestal model,
+ ResourceLocation texture) {
+ super(model, texture);
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntitySmelterRender.java b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntitySmelterRender.java index fa98f2c..1cbd32c 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntitySmelterRender.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntitySmelterRender.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.tileentity.renders;
import org.lwjgl.opengl.GL11;
+
import darkknight.jewelrycraft.JewelrycraftMod;
import darkknight.jewelrycraft.item.ItemList;
import darkknight.jewelrycraft.model.ModelSmelter;
@@ -19,105 +20,122 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
-public class TileEntitySmelterRender extends TileEntitySpecialRenderer
-{
- ModelSmelter modelSmelter = new ModelSmelter();
- public static final float p = 1 / 16, p3 = 3 * p, p13 = 13 * p, p15 = 15 * p;
-
- /**
- * @param te
- * @param x
- * @param y
- * @param z
- * @param scale
- */
- @Override
- public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
- {
- GL11.glPushMatrix();
- GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
- String texture = "textures/tileentities/Smelter.png";
- ResourceLocation blockTexture = new ResourceLocation(Variables.MODID, texture);
- Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
- TileEntitySmelter st = (TileEntitySmelter)te;
- GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
- try{
- int block = te.getBlockMetadata();
- if (block == 1) GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
- else if (block == 2){
- GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
- GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
- }else if (block == 3){
- GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
- GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F);
- }
- }
- catch(Exception e){}
- boolean fancyGraphics = Minecraft.getMinecraft().gameSettings.fancyGraphics;
- modelSmelter.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
- if (scale != 0){
- GL11.glPushMatrix();
- GL11.glDisable(GL11.GL_LIGHTING);
- if (JewelrycraftMod.fancyRender){
- GL11.glEnable(GL11.GL_BLEND);
- OpenGlHelper.glBlendFunc(1, 1, 0, 0);
- }
- EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, new ItemStack(Blocks.lava, 1, 1));
- entityitem.hoverStart = 0.0F;
- GL11.glTranslatef(-0F, 1.25F, -0.345F);
- GL11.glScalef(1.2F, 1.0F, 1.7F);
- GL11.glRotatef(90F, 1F, 0F, 0f);
- RenderItem.renderInFrame = true;
- int i = 15728880;
- int j = i % 65536;
- int k = i / 65536;
- OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F);
- RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- RenderItem.renderInFrame = false;
- if (JewelrycraftMod.fancyRender) GL11.glDisable(GL11.GL_BLEND);
- GL11.glEnable(GL11.GL_LIGHTING);
- GL11.glPopMatrix();
- }
- if (st != null){
- if (st.hasMetal && st.metal != null && st.metal.getItem() != null){
- GL11.glPushMatrix();
- EntityItem metal = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, st.metal);
- metal.getEntityItem().stackSize = 1;
- metal.hoverStart = 0.0F;
- GL11.glRotatef(-50F, 1F, 0F, 0F);
- GL11.glRotatef(-50F, 0F, 0F, 1F);
- GL11.glRotatef(180F, 1F, 0F, 0F);
- GL11.glScalef(0.5F, 0.5F, 0.5F);
- GL11.glTranslatef(-0.9F, -0.9F, -1.6F);
- Minecraft.getMinecraft().gameSettings.fancyGraphics = true;
- RenderManager.instance.renderEntityWithPosYaw(metal, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- Minecraft.getMinecraft().gameSettings.fancyGraphics = fancyGraphics;
- GL11.glPopMatrix();
- }
- if (st.hasMoltenMetal && st.moltenMetal != null && st.moltenMetal.getItem() != null){
- GL11.glPushMatrix();
- GL11.glDisable(GL11.GL_LIGHTING);
- if (JewelrycraftMod.fancyRender){
- GL11.glEnable(GL11.GL_BLEND);
- OpenGlHelper.glBlendFunc(1, 1, 0, 0);
- }
- ItemStack metal = new ItemStack(ItemList.metal);
- ItemStack ingot = st.moltenMetal.copy();
- JewelryNBT.addMetal(metal, ingot);
- EntityItem moltenMetal = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, metal);
- moltenMetal.getEntityItem().stackSize = 1;
- moltenMetal.hoverStart = 0.0F;
- GL11.glTranslatef(-0F, 1.00f - .4F * st.quantity, -0.14F);
- GL11.glScalef(0.71F, 1F, 0.84F);
- GL11.glRotatef(90F, 1F, 0F, 0f);
- RenderItem.renderInFrame = true;
- RenderManager.instance.renderEntityWithPosYaw(moltenMetal, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- RenderItem.renderInFrame = false;
- if (JewelrycraftMod.fancyRender) GL11.glDisable(GL11.GL_BLEND);
- GL11.glEnable(GL11.GL_LIGHTING);
- GL11.glPopMatrix();
- }
- }
- GL11.glPopMatrix();
- }
+public class TileEntitySmelterRender extends TileEntitySpecialRenderer {
+ ModelSmelter modelSmelter = new ModelSmelter();
+ public static final float p = 1 / 16, p3 = 3 * p,
+ p13 = 13 * p, p15 = 15 * p;
+
+ /**
+ * @param te
+ * @param x
+ * @param y
+ * @param z
+ * @param scale
+ */
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y,
+ double z, float scale) {
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F,
+ (float) z + 0.5F);
+ String texture = "textures/tileentities/Smelter.png";
+ ResourceLocation blockTexture =
+ new ResourceLocation(Variables.MODID, texture);
+ Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
+ TileEntitySmelter st = (TileEntitySmelter) te;
+ GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ try {
+ int block = te.getBlockMetadata();
+ if (block == 1)
+ GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
+ else if (block == 2) {
+ GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
+ } else if (block == 3) {
+ GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F);
+ }
+ } catch (Exception e) {
+ }
+ boolean fancyGraphics =
+ Minecraft.getMinecraft().gameSettings.fancyGraphics;
+ modelSmelter.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F,
+ 0.0625F);
+ if (scale != 0) {
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ if (JewelrycraftMod.fancyRender) {
+ GL11.glEnable(GL11.GL_BLEND);
+ OpenGlHelper.glBlendFunc(1, 1, 0, 0);
+ }
+ EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D,
+ 0.0D, 0.0D, new ItemStack(Blocks.lava, 1, 1));
+ entityitem.hoverStart = 0.0F;
+ GL11.glTranslatef(-0F, 1.25F, -0.345F);
+ GL11.glScalef(1.2F, 1.0F, 1.7F);
+ GL11.glRotatef(90F, 1F, 0F, 0f);
+ RenderItem.renderInFrame = true;
+ int i = 15728880;
+ int j = i % 65536;
+ int k = i / 65536;
+ OpenGlHelper.setLightmapTextureCoords(
+ OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F);
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D,
+ 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderItem.renderInFrame = false;
+ if (JewelrycraftMod.fancyRender)
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glPopMatrix();
+ }
+ if (st != null) {
+ if (st.hasMetal && st.metal != null
+ && st.metal.getItem() != null) {
+ GL11.glPushMatrix();
+ EntityItem metal = new EntityItem(te.getWorldObj(), 0.0D,
+ 0.0D, 0.0D, st.metal);
+ metal.getEntityItem().stackSize = 1;
+ metal.hoverStart = 0.0F;
+ GL11.glRotatef(-50F, 1F, 0F, 0F);
+ GL11.glRotatef(-50F, 0F, 0F, 1F);
+ GL11.glRotatef(180F, 1F, 0F, 0F);
+ GL11.glScalef(0.5F, 0.5F, 0.5F);
+ GL11.glTranslatef(-0.9F, -0.9F, -1.6F);
+ Minecraft.getMinecraft().gameSettings.fancyGraphics = true;
+ RenderManager.instance.renderEntityWithPosYaw(metal, 0.0D,
+ 0.0D, 0.0D, 0.0F, 0.0F);
+ Minecraft.getMinecraft().gameSettings.fancyGraphics =
+ fancyGraphics;
+ GL11.glPopMatrix();
+ }
+ if (st.hasMoltenMetal && st.moltenMetal != null
+ && st.moltenMetal.getItem() != null) {
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ if (JewelrycraftMod.fancyRender) {
+ GL11.glEnable(GL11.GL_BLEND);
+ OpenGlHelper.glBlendFunc(1, 1, 0, 0);
+ }
+ ItemStack metal = new ItemStack(ItemList.metal);
+ ItemStack ingot = st.moltenMetal.copy();
+ JewelryNBT.addMetal(metal, ingot);
+ EntityItem moltenMetal = new EntityItem(te.getWorldObj(),
+ 0.0D, 0.0D, 0.0D, metal);
+ moltenMetal.getEntityItem().stackSize = 1;
+ moltenMetal.hoverStart = 0.0F;
+ GL11.glTranslatef(-0F, 1.00f - .4F * st.quantity, -0.14F);
+ GL11.glScalef(0.71F, 1F, 0.84F);
+ GL11.glRotatef(90F, 1F, 0F, 0f);
+ RenderItem.renderInFrame = true;
+ RenderManager.instance.renderEntityWithPosYaw(moltenMetal,
+ 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderItem.renderInFrame = false;
+ if (JewelrycraftMod.fancyRender)
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glPopMatrix();
+ }
+ }
+ GL11.glPopMatrix();
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/util/BlockUtils.java b/src/main/java/darkknight/jewelrycraft/util/BlockUtils.java index a33fd5e..18dc191 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/util/BlockUtils.java +++ b/src/main/java/darkknight/jewelrycraft/util/BlockUtils.java @@ -9,145 +9,181 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
-public class BlockUtils
-{
- public static final ForgeDirection DEFAULT_BLOCK_DIRECTION = ForgeDirection.WEST;
-
- /**
- * This method is used to get the direction an entity is facing (NORTH, SOUTH, EAST or WEST) based on the entity's rotationYaw.
- *
- * @param entity the living entity
- * @return a direction
- */
- public static ForgeDirection get2dOrientation(EntityLivingBase entity)
- {
- int l = MathHelper.floor_double(entity.rotationYaw * 4.0F / 360.0F + 0.5D) & 0x3;
- switch(l)
- {
- case 0:
- return ForgeDirection.SOUTH;
- case 1:
- return ForgeDirection.WEST;
- case 2:
- return ForgeDirection.NORTH;
- case 3:
- return ForgeDirection.EAST;
- }
- return ForgeDirection.SOUTH;
- }
-
- /**
- * This gets a float value depending on a direction
- *
- * @param direction the forge direction
- * @return value depending on direction
- */
- public static float getRotationFromDirection(ForgeDirection direction)
- {
- switch(direction)
- {
- case NORTH:
- return 0F;
- case SOUTH:
- return 180F;
- case WEST:
- return 90F;
- case EAST:
- return -90F;
- case DOWN:
- return -90f;
- case UP:
- return 90f;
- default:
- return 0f;
- }
- }
-
- /**
- * This method is used to get the direction an entity is looking at (UP or DOWN) based on the entitiy's rotationPitch
- *
- * @param entity the living entity
- * @return a forge direction
- */
- public static ForgeDirection get3dOrientation(EntityLivingBase entity)
- {
- if (entity.rotationPitch > 45.5F) return ForgeDirection.DOWN;
- else if (entity.rotationPitch < -45.5F) return ForgeDirection.UP;
- return get2dOrientation(entity);
- }
-
- /**
- * This spawns the item specified and returns the EntityItem it created
- *
- * @param worldObj the world
- * @param x position of the item to drop on the X axis
- * @param y position of the item to drop on the Y axis
- * @param z position of the item to drop on the Z axis
- * @param stack the item to spawn
- * @return the EntityItem of the stack
- */
- public static EntityItem dropItemStackInWorld(World worldObj, double x, double y, double z, ItemStack stack)
- {
- float f = 0.7F;
- float d0 = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5F;
- float d1 = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5F;
- float d2 = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5F;
- EntityItem entityitem = new EntityItem(worldObj, x + d0, y + d1, z + d2, stack);
- entityitem.delayBeforeCanPickup = 10;
- if (stack.hasTagCompound()) entityitem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy());
- worldObj.spawnEntityInWorld(entityitem);
- return entityitem;
- }
-
- /**
- * It spawns the item with momentum in a certain direction
- *
- * @param world the world to spawn the item
- * @param x the X coordinate to spawn it in
- * @param y the Y coordinate to spawn it in
- * @param z the Z coordinate to spawn it in
- * @param direction the direction towards which it should eject
- * @param stack the item to spawn
- * @return the spawned EntityItem
- */
- public static EntityItem ejectItemInDirection(World world, double x, double y, double z, ForgeDirection direction, ItemStack stack)
- {
- EntityItem item = BlockUtils.dropItemStackInWorld(world, x, y, z, stack);
- item.motionX = direction.offsetX / 5F;
- item.motionY = direction.offsetY / 5F;
- item.motionZ = direction.offsetZ / 5F;
- return item;
- }
-
- /**
- * Drops the content of an inventory with doubles as coordinates
- *
- * @param inventory the inventory the items are contained in
- * @param world the world in which to spawn
- * @param x the X coordinate to spawn it in
- * @param y the Y coordinate to spawn it in
- * @param z the Z coordinate to spawn it in
- */
- public static void dropInventory(IInventory inventory, World world, double x, double y, double z)
- {
- if (inventory == null) return;
- for(int i = 0; i < inventory.getSizeInventory(); ++i){
- ItemStack itemStack = inventory.getStackInSlot(i);
- if (itemStack != null) dropItemStackInWorld(world, x, y, z, itemStack);
- }
- }
-
- /**
- * Drops the content of an inventory with integer as coordinates
- *
- * @param inventory the inventory the items are contained in
- * @param world the world in which to spawn
- * @param x the X coordinate to spawn it in
- * @param y the Y coordinate to spawn it in
- * @param z the Z coordinate to spawn it in
- */
- public static void dropInventory(IInventory inventory, World world, int x, int y, int z)
- {
- dropInventory(inventory, world, x + 0.5, y + 0.5, z + 0.5);
- }
+public class BlockUtils {
+ public static final ForgeDirection DEFAULT_BLOCK_DIRECTION =
+ ForgeDirection.WEST;
+
+ /**
+ * This method is used to get the direction an entity is facing (NORTH,
+ * SOUTH, EAST or WEST) based on the entity's rotationYaw.
+ *
+ * @param entity
+ * the living entity
+ * @return a direction
+ */
+ public static ForgeDirection
+ get2dOrientation(EntityLivingBase entity) {
+ int l = MathHelper.floor_double(
+ entity.rotationYaw * 4.0F / 360.0F + 0.5D) & 0x3;
+ switch (l) {
+ case 0:
+ return ForgeDirection.SOUTH;
+ case 1:
+ return ForgeDirection.WEST;
+ case 2:
+ return ForgeDirection.NORTH;
+ case 3:
+ return ForgeDirection.EAST;
+ default:
+ return ForgeDirection.SOUTH;
+ }
+ }
+
+ /**
+ * This gets a float value depending on a direction
+ *
+ * @param direction
+ * the forge direction
+ * @return value depending on direction
+ */
+ public static float
+ getRotationFromDirection(ForgeDirection direction) {
+ switch (direction) {
+ case NORTH:
+ return 0F;
+ case SOUTH:
+ return 180F;
+ case WEST:
+ return 90F;
+ case EAST:
+ return -90F;
+ case DOWN:
+ return -90f;
+ case UP:
+ return 90f;
+ case UNKNOWN:
+ default:
+ return 0f;
+ }
+ }
+
+ /**
+ * This method is used to get the direction an entity is looking at (UP
+ * or DOWN) based on the entitiy's rotationPitch
+ *
+ * @param entity
+ * the living entity
+ * @return a forge direction
+ */
+ public static ForgeDirection
+ get3dOrientation(EntityLivingBase entity) {
+ if (entity.rotationPitch > 45.5F)
+ return ForgeDirection.DOWN;
+ else if (entity.rotationPitch < -45.5F)
+ return ForgeDirection.UP;
+ return get2dOrientation(entity);
+ }
+
+ /**
+ * This spawns the item specified and returns the EntityItem it created
+ *
+ * @param worldObj
+ * the world
+ * @param x
+ * position of the item to drop on the X axis
+ * @param y
+ * position of the item to drop on the Y axis
+ * @param z
+ * position of the item to drop on the Z axis
+ * @param stack
+ * the item to spawn
+ * @return the EntityItem of the stack
+ */
+ public static EntityItem dropItemStackInWorld(World worldObj, double x,
+ double y, double z, ItemStack stack) {
+ float f = 0.7F;
+ float d0 = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5F;
+ float d1 = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5F;
+ float d2 = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5F;
+ EntityItem entityitem =
+ new EntityItem(worldObj, x + d0, y + d1, z + d2, stack);
+ entityitem.delayBeforeCanPickup = 10;
+ if (stack.hasTagCompound())
+ entityitem.getEntityItem().setTagCompound(
+ (NBTTagCompound) stack.getTagCompound().copy());
+ worldObj.spawnEntityInWorld(entityitem);
+ return entityitem;
+ }
+
+ /**
+ * It spawns the item with momentum in a certain direction
+ *
+ * @param world
+ * the world to spawn the item
+ * @param x
+ * the X coordinate to spawn it in
+ * @param y
+ * the Y coordinate to spawn it in
+ * @param z
+ * the Z coordinate to spawn it in
+ * @param direction
+ * the direction towards which it should eject
+ * @param stack
+ * the item to spawn
+ * @return the spawned EntityItem
+ */
+ public static EntityItem ejectItemInDirection(World world, double x,
+ double y, double z, ForgeDirection direction,
+ ItemStack stack) {
+ EntityItem item =
+ BlockUtils.dropItemStackInWorld(world, x, y, z, stack);
+ item.motionX = direction.offsetX / 5F;
+ item.motionY = direction.offsetY / 5F;
+ item.motionZ = direction.offsetZ / 5F;
+ return item;
+ }
+
+ /**
+ * Drops the content of an inventory with doubles as coordinates
+ *
+ * @param inventory
+ * the inventory the items are contained in
+ * @param world
+ * the world in which to spawn
+ * @param x
+ * the X coordinate to spawn it in
+ * @param y
+ * the Y coordinate to spawn it in
+ * @param z
+ * the Z coordinate to spawn it in
+ */
+ public static void dropInventory(IInventory inventory, World world,
+ double x, double y, double z) {
+ if (inventory == null)
+ return;
+ for (int i = 0; i < inventory.getSizeInventory(); ++i) {
+ ItemStack itemStack = inventory.getStackInSlot(i);
+ if (itemStack != null)
+ dropItemStackInWorld(world, x, y, z, itemStack);
+ }
+ }
+
+ /**
+ * Drops the content of an inventory with integer as coordinates
+ *
+ * @param inventory
+ * the inventory the items are contained in
+ * @param world
+ * the world in which to spawn
+ * @param x
+ * the X coordinate to spawn it in
+ * @param y
+ * the Y coordinate to spawn it in
+ * @param z
+ * the Z coordinate to spawn it in
+ */
+ public static void dropInventory(IInventory inventory, World world,
+ int x, int y, int z) {
+ dropInventory(inventory, world, x + 0.5, y + 0.5, z + 0.5);
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/util/EntitySelector.java b/src/main/java/darkknight/jewelrycraft/util/EntitySelector.java new file mode 100755 index 0000000..572e2e9 --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/util/EntitySelector.java @@ -0,0 +1,24 @@ +package darkknight.jewelrycraft.util; + +import net.minecraft.command.IEntitySelector; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EnumCreatureType; + +public class EntitySelector { + + public static IEntitySelector selectMonsters; + + static { + selectMonsters = new IEntitySelector() { + + @Override + public boolean isEntityApplicable(Entity arg0) { + if (arg0.isCreatureType(EnumCreatureType.monster, false)) { + return true; + } + + return false; + } + }; + } +} diff --git a/src/main/java/darkknight/jewelrycraft/util/JewelryNBT.java b/src/main/java/darkknight/jewelrycraft/util/JewelryNBT.java index 52d965c..7b74403 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/util/JewelryNBT.java +++ b/src/main/java/darkknight/jewelrycraft/util/JewelryNBT.java @@ -6,269 +6,300 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
-public class JewelryNBT
-{
- // TODO NBT Tag Adding
- public static void addItem(ItemStack item, ItemStack target)
- {
- if (target != null){
- NBTTagCompound itemStackData;
- if (item.hasTagCompound()) itemStackData = item.getTagCompound();
- else{
- itemStackData = new NBTTagCompound();
- item.setTagCompound(itemStackData);
- }
- NBTTagCompound targetNBT = new NBTTagCompound();
- target.writeToNBT(targetNBT);
- itemStackData.setTag("target", targetNBT);
- }
- }
-
- /**
- * @param item The item you want to add the NBT data on
- * @param metal The metal you want to add on the item
- */
- public static void addMetal(ItemStack item, ItemStack metal)
- {
- NBTTagCompound itemStackData;
- if (item.hasTagCompound()) itemStackData = item.getTagCompound();
- else{
- itemStackData = new NBTTagCompound();
- item.setTagCompound(itemStackData);
- }
- if(metal != null){
- NBTTagCompound ingotNBT = new NBTTagCompound();
- metal.writeToNBT(ingotNBT);
- itemStackData.setTag("ingot", ingotNBT);
- }
- }
-
- /**
- * @param item The item you want to add the NBT data on
- * @param gem The gem you want to add on the item
- */
- public static void addGem(ItemStack item, ItemStack gem)
- {
- if (gem != null){
- NBTTagCompound itemStackData;
- if (item.hasTagCompound()) itemStackData = item.getTagCompound();
- else{
- itemStackData = new NBTTagCompound();
- item.setTagCompound(itemStackData);
- }
- NBTTagCompound gemNBT = new NBTTagCompound();
- gem.writeToNBT(gemNBT);
- itemStackData.setTag("gem", gemNBT);
- }
- }
-
- /**
- * @param item The item you want to add the NBT data on
- * @param modifier The modifier you want to add on the item
- */
- public static void addModifiers(ItemStack item, ArrayList<ItemStack> modifier)
- {
- if (modifier != null){
- NBTTagCompound itemStackData;
- if (item.hasTagCompound()) itemStackData = item.getTagCompound();
- else{
- itemStackData = new NBTTagCompound();
- item.setTagCompound(itemStackData);
- }
- for(int i = 0; i < modifier.size(); i++){
- NBTTagCompound modifierNBT = new NBTTagCompound();
- modifier.get(i).writeToNBT(modifierNBT);
- itemStackData.setTag("modifier" + i, modifierNBT);
- }
- itemStackData.setInteger("modifierSize", modifier.size());
- }
- }
-
- /**
- * @param item
- * @param color
- */
- public static void addIngotColor(ItemStack item, int color)
- {
- NBTTagCompound itemStackData;
- if (item.hasTagCompound()) itemStackData = item.getTagCompound();
- else{
- itemStackData = new NBTTagCompound();
- item.setTagCompound(itemStackData);
- }
- itemStackData.setInteger("ingotColor", color);
- }
-
- // TODO
- /**
- * @param item
- * @param color
- */
- public static void addGemColor(ItemStack item, int color)
- {
- NBTTagCompound itemStackData;
- if (item.hasTagCompound()) itemStackData = item.getTagCompound();
- else{
- itemStackData = new NBTTagCompound();
- item.setTagCompound(itemStackData);
- }
- itemStackData.setInteger("gemColor", color);
- }
-
- // TODO NTB Tag Checking
- /**
- * @param item
- * @param tag
- * @return
- */
- public static boolean hasTag(ItemStack item, String tag)
- {
- NBTTagCompound itemStackData;
- if (item.hasTagCompound()) itemStackData = item.getTagCompound();
- else{
- itemStackData = new NBTTagCompound();
- item.setTagCompound(itemStackData);
- }
- if (itemStackData.hasKey(tag)) return true;
- return false;
- }
-
- /**
- * @param stack
- * @param gem
- * @return
- */
- public static boolean isGemX(ItemStack stack, ItemStack gem)
- {
- if (gem(stack) != null && gem(stack).getItem() == gem.getItem() && gem(stack).getItemDamage() == gem.getItemDamage()) return true;
- return false;
- }
-
- /**
- * @param stack
- * @param modifier
- * @return
- */
- public static boolean doesModifierExist(ItemStack stack, ItemStack modifier)
- {
- if (modifier(stack) != null){
- ArrayList<ItemStack> list = modifier(stack);
- for(int i = 0; i < list.size(); i++)
- if (list.get(i).getItem() == modifier.getItem() && list.get(i).getItemDamage() == modifier.getItemDamage()) return true;
- }
- return false;
- }
-
- public static int modifierSize(ItemStack stack, ItemStack modifier)
- {
- if (modifier(stack) != null){
- ArrayList<ItemStack> list = modifier(stack);
- for(int i = 0; i < list.size(); i++)
- if (list.get(i).getItem() == modifier.getItem() && list.get(i).getItemDamage() == modifier.getItemDamage()) return list.get(i).stackSize;
- }
- return -1;
- }
-
- public static int numberOfModifiers(ItemStack stack)
- {
- if (modifier(stack) != null) return modifier(stack).size();
- return -1;
- }
-
- /**
- * @param stack
- * @param ingot
- * @return
- */
- public static boolean isIngotX(ItemStack stack, ItemStack ingot)
- {
- if (ingot(stack) != null && ingot(stack).getItem() == ingot.getItem() && ingot(stack).getItemDamage() == ingot.getItemDamage()) return true;
- return false;
- }
-
- // TODO Return components based on NBT
- public static ItemStack item(ItemStack stack)
- {
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("target")){
- NBTTagCompound itemNBT = (NBTTagCompound)stack.getTagCompound().getTag("target");
- ItemStack target = new ItemStack(Item.getItemById(0), 0, 0);
- target.readFromNBT(itemNBT);
- return target;
- }
- return null;
- }
-
- /**
- * @param stack
- * @return
- */
- public static ItemStack gem(ItemStack stack)
- {
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("gem")){
- NBTTagCompound jewelNBT = (NBTTagCompound)stack.getTagCompound().getTag("gem");
- ItemStack gem = new ItemStack(Item.getItemById(0), 0, 0);
- gem.readFromNBT(jewelNBT);
- return gem;
- }
- return null;
- }
-
- /**
- * @param stack
- * @return
- */
- public static ArrayList<ItemStack> modifier(ItemStack stack)
- {
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound()){
- int size = stack.getTagCompound().getInteger("modifierSize");
- ArrayList<ItemStack> list = new ArrayList<ItemStack>();
- for(int i = 0; i < size; i++){
- ItemStack modifier = new ItemStack(Item.getItemById(0), 0, 0);
- NBTTagCompound modifierNBT = (NBTTagCompound)stack.getTagCompound().getTag("modifier" + i);
- modifier.readFromNBT(modifierNBT);
- list.add(modifier);
- }
- return list;
- }
- return null;
- }
-
- /**
- * @param stack
- * @return
- */
- public static ItemStack ingot(ItemStack stack)
- {
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("ingot")){
- NBTTagCompound ingotNBT = (NBTTagCompound)stack.getTagCompound().getTag("ingot");
- ItemStack ingot = new ItemStack(Item.getItemById(0), 0, 0);
- ingot.readFromNBT(ingotNBT);
- return ingot;
- }
- return null;
- }
-
- /**
- * @param stack
- * @return
- */
- public static int ingotColor(ItemStack stack)
- {
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("ingotColor"))
- return stack.getTagCompound().getInteger("ingotColor");
- return 16777215;
- }
-
- // TODO
- /**
- * @param stack
- * @return
- */
- public static int gemColor(ItemStack stack)
- {
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("gemColor"))
- return stack.getTagCompound().getInteger("gemColor");
- return 16777215;
- }
-
+public class JewelryNBT {
+ // TODO NBT Tag Adding
+ public static void addItem(ItemStack item, ItemStack target) {
+ if (target != null) {
+ NBTTagCompound itemStackData;
+ if (item.hasTagCompound())
+ itemStackData = item.getTagCompound();
+ else {
+ itemStackData = new NBTTagCompound();
+ item.setTagCompound(itemStackData);
+ }
+ NBTTagCompound targetNBT = new NBTTagCompound();
+ target.writeToNBT(targetNBT);
+ itemStackData.setTag("target", targetNBT);
+ }
+ }
+
+ /**
+ * @param item
+ * The item you want to add the NBT data on
+ * @param metal
+ * The metal you want to add on the item
+ */
+ public static void addMetal(ItemStack item, ItemStack metal) {
+ NBTTagCompound itemStackData;
+ if (item.hasTagCompound())
+ itemStackData = item.getTagCompound();
+ else {
+ itemStackData = new NBTTagCompound();
+ item.setTagCompound(itemStackData);
+ }
+ if (metal != null) {
+ NBTTagCompound ingotNBT = new NBTTagCompound();
+ metal.writeToNBT(ingotNBT);
+ itemStackData.setTag("ingot", ingotNBT);
+ }
+ }
+
+ /**
+ * @param item
+ * The item you want to add the NBT data on
+ * @param gem
+ * The gem you want to add on the item
+ */
+ public static void addGem(ItemStack item, ItemStack gem) {
+ if (gem != null) {
+ NBTTagCompound itemStackData;
+ if (item.hasTagCompound())
+ itemStackData = item.getTagCompound();
+ else {
+ itemStackData = new NBTTagCompound();
+ item.setTagCompound(itemStackData);
+ }
+ NBTTagCompound gemNBT = new NBTTagCompound();
+ gem.writeToNBT(gemNBT);
+ itemStackData.setTag("gem", gemNBT);
+ }
+ }
+
+ /**
+ * @param item
+ * The item you want to add the NBT data on
+ * @param modifier
+ * The modifier you want to add on the item
+ */
+ public static void addModifiers(ItemStack item,
+ ArrayList<ItemStack> modifier) {
+ if (modifier != null) {
+ NBTTagCompound itemStackData;
+ if (item.hasTagCompound())
+ itemStackData = item.getTagCompound();
+ else {
+ itemStackData = new NBTTagCompound();
+ item.setTagCompound(itemStackData);
+ }
+ for (int i = 0; i < modifier.size(); i++) {
+ NBTTagCompound modifierNBT = new NBTTagCompound();
+ modifier.get(i).writeToNBT(modifierNBT);
+ itemStackData.setTag("modifier" + i, modifierNBT);
+ }
+ itemStackData.setInteger("modifierSize", modifier.size());
+ }
+ }
+
+ /**
+ * @param item
+ * @param color
+ */
+ public static void addIngotColor(ItemStack item, int color) {
+ NBTTagCompound itemStackData;
+ if (item.hasTagCompound())
+ itemStackData = item.getTagCompound();
+ else {
+ itemStackData = new NBTTagCompound();
+ item.setTagCompound(itemStackData);
+ }
+ itemStackData.setInteger("ingotColor", color);
+ }
+
+ // TODO
+ /**
+ * @param item
+ * @param color
+ */
+ public static void addGemColor(ItemStack item, int color) {
+ NBTTagCompound itemStackData;
+ if (item.hasTagCompound())
+ itemStackData = item.getTagCompound();
+ else {
+ itemStackData = new NBTTagCompound();
+ item.setTagCompound(itemStackData);
+ }
+ itemStackData.setInteger("gemColor", color);
+ }
+
+ // TODO NTB Tag Checking
+ /**
+ * @param item
+ * @param tag
+ * @return
+ */
+ public static boolean hasTag(ItemStack item, String tag) {
+ NBTTagCompound itemStackData;
+ if (item.hasTagCompound())
+ itemStackData = item.getTagCompound();
+ else {
+ itemStackData = new NBTTagCompound();
+ item.setTagCompound(itemStackData);
+ }
+ if (itemStackData.hasKey(tag))
+ return true;
+ return false;
+ }
+
+ /**
+ * @param stack
+ * @param gem
+ * @return
+ */
+ public static boolean isGemX(ItemStack stack, ItemStack gem) {
+ if (gem(stack) != null && gem(stack).getItem() == gem.getItem()
+ && gem(stack).getItemDamage() == gem.getItemDamage())
+ return true;
+ return false;
+ }
+
+ /**
+ * @param stack
+ * @param modifier
+ * @return
+ */
+ public static boolean doesModifierExist(ItemStack stack,
+ ItemStack modifier) {
+ if (modifier(stack) != null) {
+ ArrayList<ItemStack> list = modifier(stack);
+ for (int i = 0; i < list.size(); i++)
+ if (list.get(i).getItem() == modifier.getItem()
+ && list.get(i).getItemDamage() == modifier
+ .getItemDamage())
+ return true;
+ }
+ return false;
+ }
+
+ public static int modifierSize(ItemStack stack, ItemStack modifier) {
+ if (modifier(stack) != null) {
+ ArrayList<ItemStack> list = modifier(stack);
+ for (int i = 0; i < list.size(); i++)
+ if (list.get(i).getItem() == modifier.getItem()
+ && list.get(i).getItemDamage() == modifier
+ .getItemDamage())
+ return list.get(i).stackSize;
+ }
+ return -1;
+ }
+
+ public static int numberOfModifiers(ItemStack stack) {
+ if (modifier(stack) != null)
+ return modifier(stack).size();
+ return -1;
+ }
+
+ /**
+ * @param stack
+ * @param ingot
+ * @return
+ */
+ public static boolean isIngotX(ItemStack stack, ItemStack ingot) {
+ if (ingot(stack) != null
+ && ingot(stack).getItem() == ingot.getItem()
+ && ingot(stack).getItemDamage() == ingot.getItemDamage())
+ return true;
+ return false;
+ }
+
+ // TODO Return components based on NBT
+ public static ItemStack item(ItemStack stack) {
+ if (stack != null
+ && stack != new ItemStack(Item.getItemById(0), 0, 0)
+ && stack.hasTagCompound()
+ && stack.getTagCompound().hasKey("target")) {
+ NBTTagCompound itemNBT = (NBTTagCompound) stack
+ .getTagCompound().getTag("target");
+ ItemStack target = new ItemStack(Item.getItemById(0), 0, 0);
+ target.readFromNBT(itemNBT);
+ return target;
+ }
+ return null;
+ }
+
+ /**
+ * @param stack
+ * @return
+ */
+ public static ItemStack gem(ItemStack stack) {
+ if (stack != null
+ && stack != new ItemStack(Item.getItemById(0), 0, 0)
+ && stack.hasTagCompound()
+ && stack.getTagCompound().hasKey("gem")) {
+ NBTTagCompound jewelNBT =
+ (NBTTagCompound) stack.getTagCompound().getTag("gem");
+ ItemStack gem = new ItemStack(Item.getItemById(0), 0, 0);
+ gem.readFromNBT(jewelNBT);
+ return gem;
+ }
+ return null;
+ }
+
+ /**
+ * @param stack
+ * @return
+ */
+ public static ArrayList<ItemStack> modifier(ItemStack stack) {
+ if (stack != null
+ && stack != new ItemStack(Item.getItemById(0), 0, 0)
+ && stack.hasTagCompound()) {
+ int size = stack.getTagCompound().getInteger("modifierSize");
+ ArrayList<ItemStack> list = new ArrayList<>();
+ for (int i = 0; i < size; i++) {
+ ItemStack modifier =
+ new ItemStack(Item.getItemById(0), 0, 0);
+ NBTTagCompound modifierNBT = (NBTTagCompound) stack
+ .getTagCompound().getTag("modifier" + i);
+ modifier.readFromNBT(modifierNBT);
+ list.add(modifier);
+ }
+ return list;
+ }
+ return null;
+ }
+
+ /**
+ * @param stack
+ * @return
+ */
+ public static ItemStack ingot(ItemStack stack) {
+ if (stack != null
+ && stack != new ItemStack(Item.getItemById(0), 0, 0)
+ && stack.hasTagCompound()
+ && stack.getTagCompound().hasKey("ingot")) {
+ NBTTagCompound ingotNBT = (NBTTagCompound) stack
+ .getTagCompound().getTag("ingot");
+ ItemStack ingot = new ItemStack(Item.getItemById(0), 0, 0);
+ ingot.readFromNBT(ingotNBT);
+ return ingot;
+ }
+ return null;
+ }
+
+ /**
+ * @param stack
+ * @return
+ */
+ public static int ingotColor(ItemStack stack) {
+ if (stack != null
+ && stack != new ItemStack(Item.getItemById(0), 0, 0)
+ && stack.hasTagCompound()
+ && stack.getTagCompound().hasKey("ingotColor"))
+ return stack.getTagCompound().getInteger("ingotColor");
+ return 16777215;
+ }
+
+ // TODO
+ /**
+ * @param stack
+ * @return
+ */
+ public static int gemColor(ItemStack stack) {
+ if (stack != null
+ && stack != new ItemStack(Item.getItemById(0), 0, 0)
+ && stack.hasTagCompound()
+ && stack.getTagCompound().hasKey("gemColor"))
+ return stack.getTagCompound().getInteger("gemColor");
+ return 16777215;
+ }
+
}
diff --git a/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java b/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java index 4c9669e..c61e82b 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java +++ b/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java @@ -1,18 +1,11 @@ package darkknight.jewelrycraft.util;
-import java.awt.image.BufferedImage;
-import java.io.IOException;
import java.lang.reflect.Field;
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
import java.util.Random;
-import javax.imageio.ImageIO;
+
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameData;
@@ -29,7 +22,6 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockAir;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureManager;
-import net.minecraft.client.resources.IResourceManager;
import net.minecraft.entity.EnumCreatureAttribute;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -45,376 +37,509 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
-public class JewelrycraftUtil
-{
- public static ArrayList<ItemStack> objects = new ArrayList<ItemStack>();
- public static ArrayList<ItemStack> gem = new ArrayList<ItemStack>();
- public static ArrayList<ItemStack> jewelry = new ArrayList<ItemStack>();
- public static ArrayList<ItemStack> metal = new ArrayList<ItemStack>();
- public static ArrayList<ItemStack> ores = new ArrayList<ItemStack>();
- public static HashMap<ItemStack, ItemStack> oreToIngot = new HashMap<ItemStack, ItemStack>();
- public static HashMap<ItemStack, Integer> colors = new HashMap<ItemStack, Integer>();
- public static ArrayList<String> jamcraftPlayers = new ArrayList<String>();
- private static ArrayList<ItemStack> items = new ArrayList<ItemStack>();
- public static ArrayList<WorldGenStructure> structures = new ArrayList<WorldGenStructure>();
- public static Random rand = new Random();
- public static EnumCreatureAttribute HEART;
-
- /**
- * Adds gems and jewelry to their appropriate list
- */
- public static void addStuff()
- {
- // Jewels
- for(int i = 0; i < 16; i++)
- gem.add(new ItemStack(BlockList.crystal, 1, i));
- gem.add(new ItemStack(Blocks.redstone_block));
- gem.add(new ItemStack(Blocks.lapis_block));
- gem.add(new ItemStack(Blocks.obsidian));
- gem.add(new ItemStack(Items.diamond));
- gem.add(new ItemStack(Items.emerald));
- gem.add(new ItemStack(Items.ender_pearl));
- gem.add(new ItemStack(Items.nether_star));
- // Jewelry
- jewelry.add(new ItemStack(ItemList.ring));
- jewelry.add(new ItemStack(ItemList.necklace));
- jewelry.add(new ItemStack(ItemList.bracelet));
- jewelry.add(new ItemStack(ItemList.earrings));
- for(Object item: GameData.getItemRegistry()){
- if (item != null) {
- if (Loader.isModLoaded("Mantle") && ((Item)item).getUnlocalizedName().equals("Mantle:item.mantle.manual"))
- continue;
- try{
- if (((Item)item).getHasSubtypes() && FMLCommonHandler.instance().getSide() == Side.CLIENT) {
- ((Item)item).getSubItems((Item)item, null, items);
- }else
- objects.add(new ItemStack((Item)item));
- if (!items.isEmpty())
- objects.addAll(items);
- items.removeAll(items);
- }
- catch(Exception e){
- JewelrycraftMod.logger.info("Error, tried to add subtypes of item " + ((Item)item).getUnlocalizedName() + "\nItem is not added in the list.");
- }
- }
- }
- // Structures
- try{
- for(Field f: Generation.class.getDeclaredFields()){
- Object obj = f.get(null);
- if (obj instanceof WorldGenStructure)
- structures.add((WorldGenStructure)obj);
- }
- }
- catch(IllegalAccessException e){
- throw new RuntimeException(e);
- }
- }
-
- @SideOnly (Side.CLIENT)
- public static void generateColors()
- {
- for(Object item: GameData.getItemRegistry()){
- if (item != null) {
- if (Loader.isModLoaded("Mantle") && ((Item)item).getUnlocalizedName().equals("Mantle:item.mantle.manual"))
- continue;
- try{
- if (((Item)item).getHasSubtypes() && FMLCommonHandler.instance().getSide() == Side.CLIENT) {
- ((Item)item).getSubItems((Item)item, null, items);
- }else{
- ItemStack it = new ItemStack((Item)item);
- colors.put(it, color(it, 0));
- }
- if (!items.isEmpty())
- for(ItemStack it: items)
- colors.put(it, color(it, 0));
- items.removeAll(items);
- }
- catch(Exception e){
- JewelrycraftMod.logger.info("Error, tried to add the color of the item " + ((Item)item).getUnlocalizedName() + " but something went wrong.");
- }
- }
- }
- }
-
- @SideOnly (Side.CLIENT)
- public static int getColor(ItemStack item)
- {
- for(ItemStack stack: colors.keySet())
- if (item != null && item.getItem() != null && stack.getItem() != null && item.getItem().equals(stack.getItem()) && item.getItemDamage() == stack.getItemDamage())
- return colors.get(stack);
- return 0xFFFFFF;
- }
-
- @SideOnly (Side.CLIENT)
- public static int color(ItemStack stack, int pass) throws IOException
- {
- IResourceManager rm = Minecraft.getMinecraft().getResourceManager();
- ResourceLocation ingot;
- BufferedImage icon;
- if (stack != null && Item.getIdFromItem(stack.getItem()) > 0 && stack.getItem().getColorFromItemStack(stack, pass) == 16777215) {
- try{
- ingot = getLocation(stack);
- }
- catch(Exception e){
- ingot = new ResourceLocation("textures/items/apple.png");
- }
- icon = ImageIO.read(rm.getResource(ingot).getInputStream());
- int height = icon.getHeight();
- int width = icon.getWidth();
- Map m = new HashMap();
- for(int i = 0; i < width; i++)
- for(int j = 0; j < height; j++){
- int rgb = icon.getRGB(i, j);
- int red = rgb >> 16 & 0xff;
- int green = rgb >> 8 & 0xff;
- int blue = rgb & 0xff;
- int[] rgbArr = {red, green, blue};
- int Cmax = Math.max(red, Math.max(green, blue));
- int Cmin = Math.min(red, Math.min(green, blue));
- if (!isGray(rgbArr))
- m.put(rgb, (Cmax + Cmin) / 2);
- }
- return getMostCommonColour(m);
- }else
- return stack.getItem().getColorFromItemStack(stack, pass);
- }
-
- public static ResourceLocation getLocation(ItemStack item)
- {
- String domain = "";
- String texture;
- IIcon itemIcon = item.getItem().getIcon(item, 0);
- if (!(Block.getBlockFromItem(item.getItem()) instanceof BlockAir) && !Block.getBlockFromItem(item.getItem()).getIcon(0, item.getItemDamage()).getIconName().equals("soul_sand"))
- itemIcon = Block.getBlockFromItem(item.getItem()).getIcon(0, item.getItemDamage());
- String iconName = itemIcon.getIconName();
- if (iconName.substring(0, iconName.indexOf(":") + 1) != "")
- domain = iconName.substring(0, iconName.indexOf(":") + 1).replace(":", " ").trim();
- else domain = "minecraft";
- texture = iconName.substring(iconName.lastIndexOf(":") + 1) + ".png";
- ResourceLocation textureLocation = null;
- TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
- if (texturemanager.getResourceLocation(item.getItemSpriteNumber()).toString().contains("items"))
- textureLocation = new ResourceLocation(domain.toLowerCase(), "textures/items/" + texture);
- else textureLocation = new ResourceLocation(domain.toLowerCase(), "textures/blocks/" + texture);
- return textureLocation;
- }
-
- @SideOnly (Side.CLIENT)
- public static int getMostCommonColour(Map map)
- {
- List list = new LinkedList(map.entrySet());
- Collections.sort(list, new Comparator(){
- public int compare(Object o1, Object o2)
- {
- return ((Comparable)((Map.Entry)o1).getValue()).compareTo(((Map.Entry)o2).getValue());
- }
- });
- Map.Entry me = (Map.Entry)list.get(list.size() - 1);
- for(int i = 0; i < list.size(); i++){
- float alpha = Float.valueOf(list.get(i).toString().split("=")[1]);
- if (alpha < 180)
- me = (Map.Entry)list.get(i);
- }
- int rgb = (Integer)me.getKey();
- return rgb;
- }
-
- @SideOnly (Side.CLIENT)
- public static boolean isGray(int[] rgbArr)
- {
- int rgbSum = rgbArr[0] + rgbArr[1] + rgbArr[2];
- if (rgbSum > 0 && rgbSum < 256 * 3)
- return false;
- return true;
- }
-
- public static WeightedRandomCurse[] getCurses(World world, EntityPlayer player, Random random)
- {
- WeightedRandomCurse[] curses = new WeightedRandomCurse[Curse.availableCurses.size()];
- for(int c = 0; c < Curse.availableCurses.size(); c++)
- curses[c] = new WeightedRandomCurse(Curse.availableCurses.get(c), Curse.availableCurses.get(c).weight(world, player, random));
- return curses;
- }
-
- /**
- * Adds curse points to a player
- *
- * @param player the player to add the points to
- * @param points amount of curse points
- */
- public static void addCursePoints(EntityPlayer player, int points)
- {
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- playerInfo.setInteger("cursePoints", playerInfo.hasKey("cursePoints") ? (playerInfo.getInteger("cursePoints") + points) : points);
- playerInfo.setBoolean("playerCursePointsChanged", true);
- }
-
- public static int getCursePoints(EntityPlayer player)
- {
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
- return playerInfo.getInteger("cursePoints");
- }
-
- /**
- * Adds the UUID's of the jamcrafters in a list (+ special people)
- */
- public static void jamcrafters()
- {
- jamcraftPlayers.add("d3214311-7550-4c9c-a372-d9292c10b8a6"); // allout58
- jamcraftPlayers.add("a690119f-c4a2-4bd6-a99d-d63679abb328"); // ChewBaker
- jamcraftPlayers.add("de7c9903-51fa-4a24-88cd-48faf122ca36"); // domi1819
- jamcraftPlayers.add("70aeb298-3a7b-46da-a393-ab10df9359f2"); // founderio
- jamcraftPlayers.add("6fbe603c-14bf-4085-afdd-abe592c26e7c"); // GerbShert
- jamcraftPlayers.add("b0d21306-36bf-4d85-84df-a956d183c45a"); // isomgirls6
- jamcraftPlayers.add("1733a31f-01f9-4f4d-82aa-7de30ca810d3"); // TH3N00B
- jamcraftPlayers.add("4833eacf-1d94-49a7-9f89-4cf88d69dcf9"); // Joban
- jamcraftPlayers.add("718cf671-9084-4e78-b91f-033e80aa11bf"); // KJ4IPS
- jamcraftPlayers.add("bea5e0c4-85c4-454d-a081-e1eaae6895ee"); // Mitchellbrine
- jamcraftPlayers.add("7ecf3e2f-fedf-4f7e-8d24-6731d078db4f"); // MrComputerGhost
- jamcraftPlayers.add("1b11ad3a-f0ca-4695-a019-2d7e5d83a5fd"); // Resinresin
- jamcraftPlayers.add("3ec9ac58-2f1b-4d3f-b4eb-3b875da877ae"); // sci4me
- jamcraftPlayers.add("cf9fa23f-205e-4eed-aba3-9f2848cd6a4d"); // OnyxDarkKnight
- jamcraftPlayers.add("91880caa-b032-48e3-bfe8-c2c7ed31824e"); // theminecoder
- jamcraftPlayers.add("8d0b3804-f71c-4219-897b-8c315448ea7c"); // YSPilot
- jamcraftPlayers.add("bbb87dbe-690f-4205-bdc5-72ffb8ebc29d"); // direwolf20
- }
-
- /**
- * Adds a random amount of modifiers to a list
- *
- * @param randValue maximum number of modifiers
- * @return a list containing the random modifiers
- */
- public static ArrayList<ItemStack> addRandomModifiers(int randValue)
- {
- ArrayList<ItemStack> list = new ArrayList<ItemStack>();
- for(int i = 0; i < 2 + randValue; i++){
- ItemStack item = objects.get(new Random().nextInt(objects.size()));
- item.stackSize = 1 + new Random().nextInt(2);
- list.add(item);
- }
- return list;
- }
-
- /**
- * Links ores with their appropriate ingot
- */
- public static void addMetals()
- {
- int index = 0;
- while (index < OreDictionary.getOreNames().length){
- Iterator<ItemStack> i = OreDictionary.getOres(OreDictionary.getOreNames()[index]).iterator();
- while (i.hasNext()){
- ItemStack nextStack = i.next();
- String stackName = nextStack.getItem().getUnlocalizedName().toLowerCase();
- if ((stackName.contains("ingot") || stackName.contains("alloy")) && !metal.contains(nextStack))
- metal.add(nextStack);
- if (nextStack.getItem().getUnlocalizedName().toLowerCase().contains("ore") && !ores.contains(nextStack)) {
- ItemStack ingot = FurnaceRecipes.smelting().getSmeltingResult(nextStack);
- if (ingot != null && (ingot.getItem().getUnlocalizedName().toLowerCase().contains("ingot") || ingot.getItem().getUnlocalizedName().toLowerCase().contains("alloy"))) {
- ores.add(nextStack);
- oreToIngot.put(nextStack, ingot);
- JewelrycraftMod.logger.info(nextStack + " Adding " + nextStack.getDisplayName() + " with damage value " + nextStack.getItemDamage() + " and with " + nextStack.stackSize + " in stack");
- JewelrycraftMod.logger.info(ingot + " Adding ingot " + ingot.getDisplayName() + " with damage value " + ingot.getItemDamage() + " and with " + ingot.stackSize + " in stack");
- }
- }
- }
- index++;
- }
- }
-
- /**
- * Checks to see if the specified item is a gem
- *
- * @param item ItemStack containing the item
- * @return is the item a gem
- */
- public static boolean isGem(ItemStack item)
- {
- Iterator<ItemStack> i = gem.iterator();
- while (i.hasNext()){
- ItemStack temp = i.next();
- if (temp.getItem() == item.getItem() && temp.getItemDamage() == item.getItemDamage())
- return true;
- }
- return false;
- }
-
- /**
- * Checks to see if the specified item is a metal
- *
- * @param item ItemStack containing the item
- * @return is the item a metal
- */
- public static boolean isMetal(ItemStack item)
- {
- Iterator<ItemStack> i = metal.iterator();
- while (i.hasNext()){
- ItemStack temp = i.next();
- if (temp.getItem() == item.getItem() && temp.getItemDamage() == item.getItemDamage())
- return true;
- }
- return false;
- }
-
- /**
- * Checks to see if the specified item is a piece of jewelry
- *
- * @param item ItemStack containing the item
- * @return is the item a piece of jewelry
- */
- public static boolean isJewelry(ItemStack item)
- {
- Iterator<ItemStack> i = jewelry.iterator();
- while (i.hasNext()){
- ItemStack temp = i.next();
- if (temp.getItem() == item.getItem() && temp.getItemDamage() == item.getItemDamage())
- return true;
- }
- return false;
- }
-
- /**
- * Checks to see if the specified item is an ore
- *
- * @param item ItemStack containing the item
- * @return is the item an ore
- */
- public static boolean isOre(ItemStack item)
- {
- Iterator<ItemStack> i = ores.iterator();
- while (i.hasNext()){
- ItemStack temp = i.next();
- if (temp.getItem().equals(item.getItem()) && temp.getItemDamage() == item.getItemDamage())
- return true;
- }
- return false;
- }
-
- /**
- * Gets the ingot from the ore
- *
- * @param ore the ore
- * @return the ingot
- */
- public static ItemStack getIngotFromOre(ItemStack ore)
- {
- for(ItemStack ores: JewelrycraftUtil.oreToIngot.keySet())
- if (ores.getItem().equals(ore.getItem()) && ores.getItemDamage() == ore.getItemDamage())
- return oreToIngot.get(ores);
- return null;
- }
-
- /**
- * This determines whether the player unlocked an achievement or not.
- *
- * @param player The player to unlock the achievement
- * @param achievement The achievement to be unlocked
- * @return True or False depending if the player did unlock the achievement or not
- */
- public static boolean AchievemtUnlocked(EntityPlayer player, Achievement achievement)
- {
- return ((EntityPlayerMP)player).func_147099_x().hasAchievementUnlocked(achievement);
- }
+public class JewelrycraftUtil {
+ public static ArrayList<ItemStack> objects =
+ new ArrayList<>();
+
+ public static ArrayList<ItemStack> gem =
+ new ArrayList<>();
+
+ public static ArrayList<ItemStack> jewelry =
+ new ArrayList<>();
+
+ public static ArrayList<ItemStack> metal =
+ new ArrayList<>();
+
+ public static ArrayList<ItemStack> ores =
+ new ArrayList<>();
+
+ public static HashMap<ItemStack, ItemStack> oreToIngot =
+ new HashMap<>();
+ public static HashMap<ItemStack, Integer> colors =
+ new HashMap<>();
+
+ public static ArrayList<String> jamcraftPlayers =
+ new ArrayList<>();
+
+ private static ArrayList<ItemStack> items =
+ new ArrayList<>();
+
+ public static ArrayList<WorldGenStructure> structures =
+ new ArrayList<>();
+
+ public static Random rand =
+ new Random();
+
+ public static EnumCreatureAttribute HEARTS;
+
+ /**
+ * Adds gems and jewelry to their appropriate lists
+ */
+ public static void addStuff() {
+ // Jewels
+ for (int i = 0; i < 16; i++) {
+ gem.add(new ItemStack(BlockList.crystal, 1, i));
+ }
+
+ gem.add(new ItemStack(Blocks.redstone_block));
+ gem.add(new ItemStack(Blocks.lapis_block));
+ gem.add(new ItemStack(Blocks.obsidian));
+ gem.add(new ItemStack(Items.diamond));
+ gem.add(new ItemStack(Items.emerald));
+ gem.add(new ItemStack(Items.ender_pearl));
+ gem.add(new ItemStack(Items.nether_star));
+
+ // Jewelry
+ jewelry.add(new ItemStack(ItemList.ring));
+ jewelry.add(new ItemStack(ItemList.necklace));
+ jewelry.add(new ItemStack(ItemList.bracelet));
+ jewelry.add(new ItemStack(ItemList.earrings));
+
+ // Add random modifiers
+ for (Object item : GameData.getItemRegistry()) {
+ if (item != null) {
+ if (Loader.isModLoaded("Mantle")
+ && ((Item) item).getUnlocalizedName()
+ .equals("Mantle:item.mantle.manual")) {
+ continue;
+ }
+
+ try {
+ if (itemHasSubtypes(item)) {
+ ((Item) item).getSubItems((Item) item, null,
+ items);
+ } else {
+ objects.add(new ItemStack((Item) item));
+ }
+
+ if (!items.isEmpty()) {
+ objects.addAll(items);
+ }
+
+ items.removeAll(items);
+ } catch (Exception e) {
+ JewelrycraftMod.logger
+ .info("Error, tried to add subtypes of item "
+ + ((Item) item).getUnlocalizedName()
+ + "\nItem is not added in the list.");
+ }
+ }
+ }
+
+ // Structures
+ try {
+ for (Field f : Generation.class.getDeclaredFields()) {
+ Object obj = f.get(null);
+ if (obj instanceof WorldGenStructure) {
+ structures.add((WorldGenStructure) obj);
+ }
+ }
+ } catch (IllegalAccessException iaex) {
+ throw new RuntimeException(iaex);
+ }
+ }
+
+ private static boolean itemHasSubtypes(Object item) {
+ return ((Item) item).getHasSubtypes()
+ && FMLCommonHandler.instance().getSide() == Side.CLIENT;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public static void generateColors() {
+ for (Object item : GameData.getItemRegistry()) {
+ if (item != null) {
+ if (Loader.isModLoaded("Mantle")
+ && ((Item) item).getUnlocalizedName()
+ .equals("Mantle:item.mantle.manual")) {
+ continue;
+ }
+
+ try {
+ if (itemHasSubtypes(item)) {
+ ((Item) item).getSubItems((Item) item, null,
+ items);
+ } else {
+ ItemStack it = new ItemStack((Item) item);
+ colors.put(it, color(it, 0));
+ }
+
+ if (!items.isEmpty()) {
+ for (ItemStack it : items) {
+ colors.put(it, color(it, 0));
+ }
+ }
+
+ items.removeAll(items);
+ } catch (Exception e) {
+ JewelrycraftMod.logger
+ .info("Error, tried to add the color of the item "
+ + ((Item) item).getUnlocalizedName()
+ + " but something went wrong.");
+ }
+ }
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ public static int getColor(ItemStack item) {
+ for (ItemStack stack : colors.keySet()) {
+ if (item != null && item.getItem() != null
+ && stack.getItem() != null
+ && item.getItem().equals(stack.getItem())
+ && item.getItemDamage() == stack.getItemDamage()) {
+ return colors.get(stack);
+ }
+ }
+
+ return 0xFFFFFF;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public static int color(ItemStack stack, int pass) {
+ if (stack != null) {
+ if (Item.getIdFromItem(stack.getItem()) > 0 && stack.getItem()
+ .getColorFromItemStack(stack, pass) == 16777215) {
+ return (int) Math.random() * 16777215;
+ }
+
+ // This takes too long for me
+ // IResourceManager rm =
+ // Minecraft.getMinecraft().getResourceManager();
+ // ResourceLocation ingot;
+ // BufferedImage icon;
+ // try {
+ // ingot = getLocation(stack);
+ // } catch (Exception e) {
+ // ingot = new ResourceLocation("textures/items/apple.png");
+ // }
+ // icon = ImageIO.read(rm.getResource(ingot).getInputStream());
+ // int height = icon.getHeight();
+ // int width = icon.getWidth();
+ // Map m = new HashMap();
+ // for (int i = 0; i < width; i++)
+ // for (int j = 0; j < height; j++) {
+ // int rgb = icon.getRGB(i, j);
+ // int red = rgb >> 16 & 0xff;
+ // int green = rgb >> 8 & 0xff;
+ // int blue = rgb & 0xff;
+ // int[] rgbArr = { red, green, blue };
+ // int Cmax = Math.max(red, Math.max(green, blue));
+ // int Cmin = Math.min(red, Math.min(green, blue));
+ // if (!isGray(rgbArr))
+ // m.put(rgb, (Cmax + Cmin) / 2);
+ // }
+ // return getMostCommonColour(m);
+
+ return stack.getItem().getColorFromItemStack(stack, pass);
+ }
+
+ return (int) Math.random() * 16777215;
+ }
+
+ public static ResourceLocation getLocation(ItemStack item) {
+ String domain = "";
+
+ String texture;
+
+ IIcon itemIcon = item.getItem().getIcon(item, 0);
+
+ if (isValidBlockFromItem(item)) {
+ itemIcon = Block.getBlockFromItem(item.getItem()).getIcon(0,
+ item.getItemDamage());
+ }
+
+ String iconName = itemIcon.getIconName();
+
+ if (iconName.substring(0, iconName.indexOf(":") + 1) != "") {
+ domain = iconName.substring(0, iconName.indexOf(":") + 1)
+ .replace(":", " ").trim();
+ } else {
+ domain = "minecraft";
+ }
+
+ texture =
+ iconName.substring(iconName.lastIndexOf(":") + 1) + ".png";
+
+ ResourceLocation textureLocation = null;
+
+ TextureManager texturemanager =
+ Minecraft.getMinecraft().getTextureManager();
+
+ if (texturemanager.getResourceLocation(item.getItemSpriteNumber())
+ .toString().contains("items")) {
+ textureLocation = new ResourceLocation(domain.toLowerCase(),
+ "textures/items/" + texture);
+ } else {
+ textureLocation = new ResourceLocation(domain.toLowerCase(),
+ "textures/blocks/" + texture);
+ }
+
+ return textureLocation;
+ }
+
+ private static boolean isValidBlockFromItem(ItemStack item) {
+ return !(Block
+ .getBlockFromItem(item.getItem()) instanceof BlockAir)
+ && !Block.getBlockFromItem(item.getItem())
+ .getIcon(0, item.getItemDamage()).getIconName()
+ .equals("soul_sand");
+ }
+
+ /*
+ * @SideOnly(Side.CLIENT) public static int getMostCommonColour(Map
+ * map) { List list = new LinkedList(map.entrySet());
+ * Collections.sort(list, new Comparator() { public int compare(Object
+ * o1, Object o2) { return ((Comparable) ((Map.Entry) o1).getValue())
+ * .compareTo(((Map.Entry) o2).getValue()); } }); Map.Entry me =
+ * (Map.Entry) list.get(list.size() - 1); for (int i = 0; i <
+ * list.size(); i++) { float alpha = Float
+ * .valueOf(list.get(i).toString().split("=")[1]); if (alpha < 180) me
+ * = (Map.Entry) list.get(i); } int rgb = (Integer) me.getKey(); return
+ * rgb; }
+ */
+
+ @SideOnly(Side.CLIENT)
+ public static boolean isGray(int[] rgbArr) {
+ int rgbSum = rgbArr[0] + rgbArr[1] + rgbArr[2];
+
+ if (rgbSum > 0 && rgbSum < 256 * 3) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static WeightedRandomCurse[] getCurses(World world,
+ EntityPlayer player, Random random) {
+ WeightedRandomCurse[] curses =
+ new WeightedRandomCurse[Curse.availableCurses.size()];
+
+ for (int c = 0; c < Curse.availableCurses.size(); c++) {
+ curses[c] = new WeightedRandomCurse(
+ Curse.availableCurses.get(c), Curse.availableCurses
+ .get(c).weight(world, player, random));
+ }
+
+ return curses;
+ }
+
+ /**
+ * Adds curse points to a player
+ *
+ * @param player
+ * the player to add the points to
+ * @param points
+ * amount of curse points
+ */
+ public static void addCursePoints(EntityPlayer player, int points) {
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(player, Variables.MODID);
+
+ playerInfo.setInteger("cursePoints",
+ playerInfo.hasKey("cursePoints")
+ ? (playerInfo.getInteger("cursePoints") + points)
+ : points);
+
+ playerInfo.setBoolean("playerCursePointsChanged", true);
+ }
+
+ public static int getCursePoints(EntityPlayer player) {
+ NBTTagCompound playerInfo = PlayerUtils
+ .getModPlayerPersistTag(player, Variables.MODID);
+
+ return playerInfo.getInteger("cursePoints");
+ }
+
+ /**
+ * Adds the UUID's of the jamcrafters in a list (+ special people)
+ */
+ public static void jamcrafters() {
+ jamcraftPlayers.add("d3214311-7550-4c9c-a372-d9292c10b8a6"); // allout58
+ jamcraftPlayers.add("a690119f-c4a2-4bd6-a99d-d63679abb328"); // ChewBaker
+ jamcraftPlayers.add("de7c9903-51fa-4a24-88cd-48faf122ca36"); // domi1819
+ jamcraftPlayers.add("70aeb298-3a7b-46da-a393-ab10df9359f2"); // founderio
+ jamcraftPlayers.add("6fbe603c-14bf-4085-afdd-abe592c26e7c"); // GerbShert
+ jamcraftPlayers.add("b0d21306-36bf-4d85-84df-a956d183c45a"); // isomgirls6
+ jamcraftPlayers.add("1733a31f-01f9-4f4d-82aa-7de30ca810d3"); // TH3N00B
+ jamcraftPlayers.add("4833eacf-1d94-49a7-9f89-4cf88d69dcf9"); // Joban
+ jamcraftPlayers.add("718cf671-9084-4e78-b91f-033e80aa11bf"); // KJ4IPS
+ jamcraftPlayers.add("bea5e0c4-85c4-454d-a081-e1eaae6895ee"); // Mitchellbrine
+ jamcraftPlayers.add("7ecf3e2f-fedf-4f7e-8d24-6731d078db4f"); // MrComputerGhost
+ jamcraftPlayers.add("1b11ad3a-f0ca-4695-a019-2d7e5d83a5fd"); // Resinresin
+ jamcraftPlayers.add("3ec9ac58-2f1b-4d3f-b4eb-3b875da877ae"); // sci4me
+ jamcraftPlayers.add("cf9fa23f-205e-4eed-aba3-9f2848cd6a4d"); // OnyxDarkKnight
+ jamcraftPlayers.add("91880caa-b032-48e3-bfe8-c2c7ed31824e"); // theminecoder
+ jamcraftPlayers.add("8d0b3804-f71c-4219-897b-8c315448ea7c"); // YSPilot
+ jamcraftPlayers.add("bbb87dbe-690f-4205-bdc5-72ffb8ebc29d"); // direwolf20
+ }
+
+ /**
+ * Adds a random amount of modifiers to a list
+ *
+ * @param randValue
+ * maximum number of modifiers
+ * @return a list containing the random modifiers
+ */
+ public static ArrayList<ItemStack> addRandomModifiers(int randValue) {
+ ArrayList<ItemStack> list = new ArrayList<>();
+
+ for (int i = 0; i < 2 + randValue; i++) {
+ ItemStack item =
+ objects.get(new Random().nextInt(objects.size()));
+
+ item.stackSize = 1 + new Random().nextInt(2);
+
+ list.add(item);
+ }
+
+ return list;
+ }
+
+ /**
+ * Links ores with their appropriate ingot
+ */
+ public static void addMetals() {
+ /*
+ int index = 0;
+
+ while (index < OreDictionary.getOreNames().length) {
+ Iterator<ItemStack> i = OreDictionary
+ .getOres(OreDictionary.getOreNames()[index])
+ .iterator();
+
+ while (i.hasNext()) {
+ ItemStack nextStack = i.next();
+
+ String stackName = nextStack.getItem().getUnlocalizedName()
+ .toLowerCase();
+
+ if ((stackName.contains("ingot")
+ || stackName.contains("alloy"))
+ && !metal.contains(nextStack)) {
+ metal.add(nextStack);
+ }
+
+ if (nextStack.getItem().getUnlocalizedName().toLowerCase()
+ .contains("ore") && !ores.contains(nextStack)) {
+ ItemStack ingot = FurnaceRecipes.smelting()
+ .getSmeltingResult(nextStack);
+
+ if (ingot != null && (ingot.getItem()
+ .getUnlocalizedName().toLowerCase()
+ .contains("ingot")
+ || ingot.getItem().getUnlocalizedName()
+ .toLowerCase().contains("alloy"))) {
+ ores.add(nextStack);
+
+ oreToIngot.put(nextStack, ingot);
+
+ JewelrycraftMod.logger.info(nextStack + " Adding "
+ + nextStack.getDisplayName()
+ + " with damage value "
+ + nextStack.getItemDamage() + " and with "
+ + nextStack.stackSize + " in stack");
+
+ JewelrycraftMod.logger.info(ingot
+ + " Adding ingot " + ingot.getDisplayName()
+ + " with damage value "
+ + ingot.getItemDamage() + " and with "
+ + ingot.stackSize + " in stack");
+ }
+ }
+ }
+
+ index++;
+ }
+ */
+ }
+
+ /**
+ * Checks to see if the specified item is a gem
+ *
+ * @param item
+ * ItemStack containing the item
+ * @return is the item a gem
+ */
+ public static boolean isGem(ItemStack item) {
+ return isItemStackIn(item, gem.iterator());
+ }
+
+ /**
+ * Checks to see if the specified item is a metal
+ *
+ * @param item
+ * ItemStack containing the item
+ * @return is the item a metal
+ */
+ public static boolean isMetal(ItemStack item) {
+ return isItemStackIn(item, metal.iterator());
+ }
+
+ /**
+ * Checks to see if the specified item is a piece of jewelry
+ *
+ * @param item
+ * ItemStack containing the item
+ * @return is the item a piece of jewelry
+ */
+ public static boolean isJewelry(ItemStack item) {
+ return isItemStackIn(item, jewelry.iterator());
+ }
+
+ private static boolean isItemStackIn(ItemStack item,
+ Iterator<ItemStack> i) {
+ while (i.hasNext()) {
+ ItemStack temp = i.next();
+ if (temp.getItem() == item.getItem()
+ && temp.getItemDamage() == item.getItemDamage()) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks to see if the specified item is an ore
+ *
+ * @param item
+ * ItemStack containing the item
+ * @return is the item an ore
+ */
+ public static boolean isOre(ItemStack item) {
+ return isItemStackIn(item, ores.iterator());
+ }
+
+ /**
+ * Gets the ingot from the ore
+ *
+ * @param ore
+ * the ore
+ * @return the ingot
+ */
+ public static ItemStack getIngotFromOre(ItemStack ore) {
+ for (ItemStack ors : JewelrycraftUtil.oreToIngot.keySet())
+ if (ors.getItem().equals(ore.getItem())
+ && ors.getItemDamage() == ore.getItemDamage()) {
+ return oreToIngot.get(ors);
+ }
+
+ return null;
+ }
+
+ /**
+ * This determines whether the player unlocked an achievement or not.
+ *
+ * @param player
+ * The player to unlock the achievement
+ * @param achievement
+ * The achievement to be unlocked
+ * @return True or False depending if the player did unlock the
+ * achievement or not
+ */
+ public static boolean AchievemtUnlocked(EntityPlayer player,
+ Achievement achievement) {
+ return ((EntityPlayerMP) player).func_147099_x()
+ .hasAchievementUnlocked(achievement);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/util/PlayerUtils.java b/src/main/java/darkknight/jewelrycraft/util/PlayerUtils.java index f1655c0..c981555 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/util/PlayerUtils.java +++ b/src/main/java/darkknight/jewelrycraft/util/PlayerUtils.java @@ -7,32 +7,37 @@ import net.minecraft.nbt.NBTTagCompound; /** * Code taken from OpenBlocks */ -public class PlayerUtils -{ - /** - * Returns the NBTTag of the player - * - * @param player the player - * @param modName the mod name - * @return appropriate NBTTag - */ - public static NBTTagCompound getModPlayerPersistTag(EntityPlayer player, String modName) - { - if (player.worldObj.isRemote && ScreenHandler.tagCache != null) return ScreenHandler.tagCache; - - NBTTagCompound tag = player.getEntityData(); - NBTTagCompound persistTag = null; - if (tag.hasKey(EntityPlayer.PERSISTED_NBT_TAG)) persistTag = tag.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG); - else{ - persistTag = new NBTTagCompound(); - tag.setTag(EntityPlayer.PERSISTED_NBT_TAG, persistTag); - } - NBTTagCompound modTag = null; - if (persistTag.hasKey(modName)) modTag = persistTag.getCompoundTag(modName); - else{ - modTag = new NBTTagCompound(); - persistTag.setTag(modName, modTag); - } - return modTag; - } +public class PlayerUtils { + /** + * Returns the NBTTag of the player + * + * @param player + * the player + * @param modName + * the mod name + * @return appropriate NBTTag + */ + public static NBTTagCompound + getModPlayerPersistTag(EntityPlayer player, String modName) { + if (player.worldObj.isRemote && ScreenHandler.tagCache != null) + return ScreenHandler.tagCache; + + NBTTagCompound tag = player.getEntityData(); + NBTTagCompound persistTag = null; + if (tag.hasKey(EntityPlayer.PERSISTED_NBT_TAG)) + persistTag = + tag.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG); + else { + persistTag = new NBTTagCompound(); + tag.setTag(EntityPlayer.PERSISTED_NBT_TAG, persistTag); + } + NBTTagCompound modTag = null; + if (persistTag.hasKey(modName)) + modTag = persistTag.getCompoundTag(modName); + else { + modTag = new NBTTagCompound(); + persistTag.setTag(modName, modTag); + } + return modTag; + } }
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/util/Variables.java b/src/main/java/darkknight/jewelrycraft/util/Variables.java index 4ced1ea..53ec9fd 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/util/Variables.java +++ b/src/main/java/darkknight/jewelrycraft/util/Variables.java @@ -2,21 +2,35 @@ package darkknight.jewelrycraft.util; import net.minecraft.util.ResourceLocation;
-public class Variables
-{
- public static final int CURSE_POINTS_PER_LEVEL = 7000;
-
- public static final String MODID = "jewelrycraft2";
- public static final String MODNAME = "Jewelrycraft 2";
- public static final String VERSION = "1.1.4";
- public static final String PACKET_CHANNEL = "jewelrycraft2";
-
- public static final String CONFIG_GUI = "darkknight.jewelrycraft.config.ConfigGuiFactory";
- public static final String CLIENT_PROXY = "darkknight.jewelrycraft.proxy.ClientProxy";
- public static final String SERVER_PROXY = "darkknight.jewelrycraft.proxy.CommonProxy";
-
- public static final ResourceLocation PEDESTAL_TEXTURE = new ResourceLocation(Variables.MODID, "textures/tileentities/BricksPedestal.png");
- public static final ResourceLocation SHADOW_HAND_TEXTURE = new ResourceLocation(Variables.MODID, "textures/tileentities/ShadowHand.png");
- public static final ResourceLocation VILLAGER_TEXTURE = new ResourceLocation(Variables.MODID, "textures/entities/jeweler.png");
- public static final ResourceLocation MISC_TEXTURE = new ResourceLocation(Variables.MODID, "textures/gui/hearts.png");
+public class Variables {
+ public static final int CURSE_POINTS_PER_LEVEL = 7000;
+
+ public static final String MODID =
+ "jewelrycraft2";
+ public static final String MODNAME =
+ "Jewelrycraft 2";
+ public static final String VERSION =
+ "1.1.4";
+ public static final String PACKET_CHANNEL =
+ "jewelrycraft2";
+
+ public static final String CONFIG_GUI =
+ "darkknight.jewelrycraft.config.ConfigGuiFactory";
+ public static final String CLIENT_PROXY =
+ "darkknight.jewelrycraft.proxy.ClientProxy";
+ public static final String SERVER_PROXY =
+ "darkknight.jewelrycraft.proxy.CommonProxy";
+
+ public static final ResourceLocation PEDESTAL_TEXTURE =
+ new ResourceLocation(Variables.MODID,
+ "textures/tileentities/BricksPedestal.png");
+ public static final ResourceLocation SHADOW_HAND_TEXTURE =
+ new ResourceLocation(Variables.MODID,
+ "textures/tileentities/ShadowHand.png");
+ public static final ResourceLocation VILLAGER_TEXTURE =
+ new ResourceLocation(Variables.MODID,
+ "textures/entities/jeweler.png");
+ public static final ResourceLocation MISC_TEXTURE =
+ new ResourceLocation(Variables.MODID,
+ "textures/gui/hearts.png");
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/ChestGeneration.java b/src/main/java/darkknight/jewelrycraft/worldGen/ChestGeneration.java index d697472..9e6e667 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/ChestGeneration.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/ChestGeneration.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.worldGen;
import java.util.Random;
+
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.item.ItemList;
@@ -15,89 +16,126 @@ import net.minecraftforge.common.ChestGenHooks; * @author Sorin
*
*/
-public class ChestGeneration
-{
- static Item[] jewelry = new Item[]{ItemList.ring, ItemList.necklace, ItemList.bracelet, ItemList.earrings};
- static Random random = new Random();
- public static void preInit(FMLPreInitializationEvent e)
- {
- addItemToDifferentPlaces(new WeightedRandomChestContent(new ItemStack(ItemList.thiefGloves), 1, 1, 2), true, true, false, false, true);
- addItemToDifferentPlaces(new WeightedRandomChestContent(new ItemStack(ItemList.guide), 1, 1, 7), true, true, true, true, true, false, true, true);
- addVillageBlacksmithLoot(new WeightedRandomChestContent(new ItemStack(ItemList.shadowIngot), 1, 4, 5));
- for(int i = 0; i < 16 && i%3==0; i++) addItemToDifferentPlaces(new WeightedRandomChestContent(new ItemStack(BlockList.crystal, 1, i), 1, 3, 3), true, true, true, true);
-
- ItemStack special = new ItemStack(jewelry[random.nextInt(4)]);
- int randValue = random.nextInt(4);
- if(JewelrycraftUtil.metal.size() > 0) JewelryNBT.addMetal(special, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())));
- if(JewelrycraftUtil.objects.size() > 0) JewelryNBT.addModifiers(special, JewelrycraftUtil.addRandomModifiers(randValue));
- if(JewelrycraftUtil.gem.size() > 0) JewelryNBT.addGem(special, JewelrycraftUtil.gem.get(random.nextInt(JewelrycraftUtil.gem.size())));
- addItemToDifferentPlaces(new WeightedRandomChestContent(special, 1, 1, 1), true, true, true, true);
- }
-
- /**
- * The booleans determine in which places should the items be added. The order is like so:
- * <p><ul>
- * <li> Dungeon
- * <li> Stronhold
- * <li> Pyramid
- * <li> Mineshaft
- * <li> Village Blacksmith
- * <li> Dispenser
- * <li> Bonus Chest
- * <li> Stronghold Library
- * </ul><p>
- */
- public static void addItemToDifferentPlaces(WeightedRandomChestContent item, Boolean ... options)
- {
- if(options.length > 0 && options[0]) addDungeonLoot(item);
- if(options.length > 1 && options[1]) addStrongholdLoot(item);
- if(options.length > 2 && options[2]) addPyramidLoot(item);
- if(options.length > 3 && options[3]) addMineshaftLoot(item);
- if(options.length > 4 && options[4]) addVillageBlacksmithLoot(item);
- if(options.length > 5 && options[5]) addDispenserLoot(item);
- if(options.length > 6 && options[6]) addBonusChestLoot(item);
- if(options.length > 7 && options[7]) addStrongholdLibraryLoot(item);
- }
-
- public static void addDungeonLoot(WeightedRandomChestContent item)
- {
- ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, item);
- }
-
- public static void addStrongholdLoot(WeightedRandomChestContent item)
- {
- ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, item);
- ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CROSSING, item);
- }
-
- public static void addPyramidLoot(WeightedRandomChestContent item)
- {
- ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, item);
- ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, item);
- }
-
- public static void addMineshaftLoot(WeightedRandomChestContent item)
- {
- ChestGenHooks.addItem(ChestGenHooks.MINESHAFT_CORRIDOR, item);
- }
-
- public static void addVillageBlacksmithLoot(WeightedRandomChestContent item)
- {
- ChestGenHooks.addItem(ChestGenHooks.VILLAGE_BLACKSMITH, item);
- }
-
- public static void addDispenserLoot(WeightedRandomChestContent item)
- {
- ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_DISPENSER, item);
- }
-
- public static void addBonusChestLoot(WeightedRandomChestContent item)
- {
- ChestGenHooks.addItem(ChestGenHooks.BONUS_CHEST, item);
- }
-
- public static void addStrongholdLibraryLoot(WeightedRandomChestContent item)
- {
- ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, item);
- }
+public class ChestGeneration {
+ static Item[] jewelry = new Item[] { ItemList.ring,
+ ItemList.necklace, ItemList.bracelet, ItemList.earrings };
+
+ static Random random = new Random();
+
+ public static void preInit(
+ FMLPreInitializationEvent e) {
+ addItemToDifferentPlaces(
+ new WeightedRandomChestContent(
+ new ItemStack(ItemList.thiefGloves), 1, 1, 2),
+ true, true, false, false, true);
+
+ addItemToDifferentPlaces(
+ new WeightedRandomChestContent(
+ new ItemStack(ItemList.guide), 1, 1, 7),
+ true, true, true, true, true, false, true, true);
+
+ addVillageBlacksmithLoot(new WeightedRandomChestContent(
+ new ItemStack(ItemList.shadowIngot), 1, 4, 5));
+
+ for (int i = 0; i < 16 && i % 3 == 0; i++)
+ addItemToDifferentPlaces(new WeightedRandomChestContent(
+ new ItemStack(BlockList.crystal, 1, i), 1, 3, 3), true,
+ true, true, true);
+
+ ItemStack special = new ItemStack(jewelry[random.nextInt(4)]);
+
+ int randValue = random.nextInt(4);
+
+ if (JewelrycraftUtil.metal.size() > 0) {
+ JewelryNBT.addMetal(special, JewelrycraftUtil.metal
+ .get(random.nextInt(JewelrycraftUtil.metal.size())));
+ }
+
+ if (JewelrycraftUtil.objects.size() > 0) {
+ JewelryNBT.addModifiers(special,
+ JewelrycraftUtil.addRandomModifiers(randValue));
+ }
+
+ if (JewelrycraftUtil.gem.size() > 0) {
+ JewelryNBT.addGem(special, JewelrycraftUtil.gem
+ .get(random.nextInt(JewelrycraftUtil.gem.size())));
+ }
+
+ addItemToDifferentPlaces(
+ new WeightedRandomChestContent(special, 1, 1, 1), true,
+ true, true, true);
+ }
+
+ /**
+ * The booleans determine in which places should the items be added.
+ * The order is like so:
+ * <p>
+ * <ul>
+ * <li>Dungeon
+ * <li>Stronhold
+ * <li>Pyramid
+ * <li>Mineshaft
+ * <li>Village Blacksmith
+ * <li>Dispenser
+ * <li>Bonus Chest
+ * <li>Stronghold Library
+ * </ul>
+ * <p>
+ */
+ public static void addItemToDifferentPlaces(
+ WeightedRandomChestContent item, Boolean... options) {
+ if (options.length > 0 && options[0])
+ addDungeonLoot(item);
+ if (options.length > 1 && options[1])
+ addStrongholdLoot(item);
+ if (options.length > 2 && options[2])
+ addPyramidLoot(item);
+ if (options.length > 3 && options[3])
+ addMineshaftLoot(item);
+ if (options.length > 4 && options[4])
+ addVillageBlacksmithLoot(item);
+ if (options.length > 5 && options[5])
+ addDispenserLoot(item);
+ if (options.length > 6 && options[6])
+ addBonusChestLoot(item);
+ if (options.length > 7 && options[7])
+ addStrongholdLibraryLoot(item);
+ }
+
+ public static void addDungeonLoot(WeightedRandomChestContent item) {
+ ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, item);
+ }
+
+ public static void addStrongholdLoot(WeightedRandomChestContent item) {
+ ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, item);
+ ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CROSSING, item);
+ }
+
+ public static void addPyramidLoot(WeightedRandomChestContent item) {
+ ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, item);
+ ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, item);
+ }
+
+ public static void addMineshaftLoot(WeightedRandomChestContent item) {
+ ChestGenHooks.addItem(ChestGenHooks.MINESHAFT_CORRIDOR, item);
+ }
+
+ public static void
+ addVillageBlacksmithLoot(WeightedRandomChestContent item) {
+ ChestGenHooks.addItem(ChestGenHooks.VILLAGE_BLACKSMITH, item);
+ }
+
+ public static void addDispenserLoot(WeightedRandomChestContent item) {
+ ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_DISPENSER,
+ item);
+ }
+
+ public static void addBonusChestLoot(WeightedRandomChestContent item) {
+ ChestGenHooks.addItem(ChestGenHooks.BONUS_CHEST, item);
+ }
+
+ public static void
+ addStrongholdLibraryLoot(WeightedRandomChestContent item) {
+ ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, item);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/Generation.java b/src/main/java/darkknight/jewelrycraft/worldGen/Generation.java index 93310df..8419533 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/Generation.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/Generation.java @@ -2,6 +2,7 @@ package darkknight.jewelrycraft.worldGen; import java.lang.reflect.Field;
import java.util.Random;
+
import cpw.mods.fml.common.IWorldGenerator;
import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.config.ConfigHandler;
@@ -12,67 +13,95 @@ import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.IChunkProvider;
public class Generation implements IWorldGenerator {
- public static WorldGenStructure STRUCTURE_1 = new WorldGenStructure1();
- public static WorldGenStructure STRUCTURE_2 = new WorldGenStructure2();
- public static WorldGenStructure STRUCTURE_3 = new WorldGenStructure3();
- public static WorldGenStructure STRUCTURE_4 = new WorldGenStructure4();
- public static WorldGenStructure STRUCTURE_5 = new WorldGenStructure5();
- public static WorldGenStructure STRUCTURE_6 = new WorldGenStructure6();
+ public static WorldGenStructure STRUCTURE_1 = new WorldGenStructure1();
+ public static WorldGenStructure STRUCTURE_2 = new WorldGenStructure2();
+ public static WorldGenStructure STRUCTURE_3 = new WorldGenStructure3();
+ public static WorldGenStructure STRUCTURE_4 = new WorldGenStructure4();
+ public static WorldGenStructure STRUCTURE_5 = new WorldGenStructure5();
+ public static WorldGenStructure STRUCTURE_6 = new WorldGenStructure6();
@Override
- public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
+ public void generate(Random random, int chunkX, int chunkZ,
+ World world, IChunkProvider chunkGenerator,
+ IChunkProvider chunkProvider) {
switch (world.provider.dimensionId) {
- case -1:
- generateNether(world, random, chunkX << 4, chunkZ << 4);
- break;
- case 0:
- generateSurface(world, random, chunkX << 4, chunkZ << 4);
- break;
- case 1:
- generateEnd(world, random, chunkX << 4, chunkZ << 4);
- break;
- default:
- generateSurface(world, random, chunkX << 4, chunkZ << 4);
- break;
+ case -1:
+ generateNether(world, random, chunkX << 4, chunkZ << 4);
+ break;
+ case 0:
+ generateSurface(world, random, chunkX << 4, chunkZ << 4);
+ break;
+ case 1:
+ generateEnd(world, random, chunkX << 4, chunkZ << 4);
+ break;
+ default:
+ generateSurface(world, random, chunkX << 4, chunkZ << 4);
+ break;
}
}
- private void generateEnd(World world, Random random, int i, int j) {}
+ private void generateEnd(World world, Random random, int i, int j) {
+ }
- private void generateSurface(World world, Random random, int i, int j) {
+ private void generateSurface(World world, Random random, int i,
+ int j) {
if (ConfigHandler.ENABLE_WORLD_GEN) {
- if (!world.getWorldInfo().getTerrainType().equals(WorldType.FLAT)) {
- if (ConfigHandler.ORE_GEN) generateShadowOre(world, random, i, j);
- if (ConfigHandler.CRYSTAL_GEN) generateCrystals(world, random, i, j);
- try{
- for(Field f: this.getClass().getDeclaredFields()){
- Object obj = f.get(null);
- if (obj instanceof WorldGenStructure && ConfigHandler.STRUCTURES[((WorldGenStructure)obj).structureNo() - 1])
- if(((WorldGenStructure)obj).isUnderground()) generateStructureUnderground((WorldGenStructure)obj, world, random, i, j, ConfigHandler.STRUCTURES_SPAWN_CHANCE[((WorldGenStructure)obj).structureNo()-1], false, true);
- else generateStructureOverground((WorldGenStructure)obj, world, random, i, j, ConfigHandler.STRUCTURES_SPAWN_CHANCE[((WorldGenStructure)obj).structureNo()-1], false, true);
- }
- }
- catch(IllegalAccessException e){
- throw new RuntimeException(e);
- }
+ if (!world.getWorldInfo().getTerrainType()
+ .equals(WorldType.FLAT)) {
+ if (ConfigHandler.ORE_GEN)
+ generateShadowOre(world, random, i, j);
+ if (ConfigHandler.CRYSTAL_GEN)
+ generateCrystals(world, random, i, j);
+ try {
+ for (Field f : this.getClass().getDeclaredFields()) {
+ Object obj = f.get(null);
+ if (obj instanceof WorldGenStructure
+ && ConfigHandler.STRUCTURES[((WorldGenStructure) obj)
+ .structureNo() - 1])
+ if (((WorldGenStructure) obj).isUnderground())
+ generateStructureUnderground(
+ (WorldGenStructure) obj, world,
+ random, i, j,
+ ConfigHandler.STRUCTURES_SPAWN_CHANCE[((WorldGenStructure) obj)
+ .structureNo() - 1],
+ false, true);
+ else
+ generateStructureOverground(
+ (WorldGenStructure) obj, world,
+ random, i, j,
+ ConfigHandler.STRUCTURES_SPAWN_CHANCE[((WorldGenStructure) obj)
+ .structureNo() - 1],
+ false, true);
+ }
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
}
}
}
- private void generateNether(World world, Random random, int i, int j) {}
+ private void generateNether(World world, Random random, int i, int j) {
+ }
- private void generateShadowOre(World world, Random random, int i, int j) {
+ private void generateShadowOre(World world, Random random, int i,
+ int j) {
for (int k = 0; k < 1; k++) {
int x = i + random.nextInt(16);
int y = 5 + random.nextInt(4);
int z = j + random.nextInt(16);
- if (world.getBlock(x, y, z) == Blocks.stone) world.setBlock(x, y, z, BlockList.shadowOre);
- int randX = random.nextInt(2), randY = random.nextInt(1), randZ = random.nextInt(2);
- if (random.nextInt(3) == 0 && world.getBlock(x + randX, y + randY, z + randZ) == Blocks.stone) world.setBlock(x + randX, y + randY, z + randZ, BlockList.shadowOre);
+ if (world.getBlock(x, y, z) == Blocks.stone)
+ world.setBlock(x, y, z, BlockList.shadowOre);
+ int randX = random.nextInt(2), randY = random.nextInt(1),
+ randZ = random.nextInt(2);
+ if (random.nextInt(3) == 0 && world.getBlock(x + randX,
+ y + randY, z + randZ) == Blocks.stone)
+ world.setBlock(x + randX, y + randY, z + randZ,
+ BlockList.shadowOre);
}
}
- private void generateCrystals(World world, Random random, int i, int j) {
+ private void generateCrystals(World world, Random random, int i,
+ int j) {
for (int k = 0; k < 16; k++) {
int x = i + random.nextInt(12);
int y = 5 + random.nextInt(64);
@@ -81,47 +110,75 @@ public class Generation implements IWorldGenerator { int randX = random.nextInt(4);
int randY = random.nextInt(2);
int randZ = random.nextInt(4);
- if (world.getBlock(x + randX, y + randY - 1, z + randZ) == Blocks.stone && world.getBlock(x + randX, y + randY, z + randZ) == Blocks.air) world.setBlock(x + randX, y + randY, z + randZ, BlockList.crystal, random.nextInt(16), 2);
+ if (world.getBlock(x + randX, y + randY - 1,
+ z + randZ) == Blocks.stone
+ && world.getBlock(x + randX, y + randY,
+ z + randZ) == Blocks.air)
+ world.setBlock(x + randX, y + randY, z + randZ,
+ BlockList.crystal, random.nextInt(16), 2);
}
}
}
- private void generateStructureUnderground(WorldGenStructure structure, World world, Random random, int i, int j, int maxAttempts, boolean noOfAttempts, boolean chanceOfSpawning) {
+ private void generateStructureUnderground(WorldGenStructure structure,
+ World world, Random random, int i, int j, int maxAttempts,
+ boolean noOfAttempts, boolean chanceOfSpawning) {
BiomeGenBase biomeBase = world.getBiomeGenForCoords(i, j);
if (noOfAttempts) {
for (int k = 0; k < maxAttempts; k++) {
int x = i + random.nextInt(16);
int y = random.nextInt(64);
int z = j + random.nextInt(16);
- if (world.getBlock(x, y, z) == Blocks.stone) structure.generate(world, biomeBase, random, x, y, z);
+ if (world.getBlock(x, y, z) == Blocks.stone)
+ structure.generate(world, biomeBase, random, x, y, z);
}
- }
- else if (chanceOfSpawning) {
+ } else if (chanceOfSpawning) {
if (random.nextInt(maxAttempts) == 0) {
int x = i + random.nextInt(16);
int y = random.nextInt(64);
int z = j + random.nextInt(16);
- if (world.getBlock(x, y, z) == Blocks.stone) structure.generate(world, biomeBase, random, x, y, z);
+ if (world.getBlock(x, y, z) == Blocks.stone)
+ structure.generate(world, biomeBase, random, x, y, z);
}
}
}
- private void generateStructureOverground(WorldGenStructure structure, World world, Random random, int i, int j, int maxAttempts, boolean noOfAttempts, boolean chanceOfSpawning) {
+ private void generateStructureOverground(WorldGenStructure structure,
+ World world, Random random, int i, int j, int maxAttempts,
+ boolean noOfAttempts, boolean chanceOfSpawning) {
BiomeGenBase biomeBase = world.getBiomeGenForCoords(i, j);
if (noOfAttempts) {
for (int k = 0; k < maxAttempts; k++) {
int x = i + random.nextInt(16);
- int y = (world.getChunkHeightMapMinimum(i, j) > 0 ? world.getChunkHeightMapMinimum(i, j) : world.getChunkFromChunkCoords(i, j).heightMapMinimum - 16) + random.nextInt(4);
+ int y = (world.getChunkHeightMapMinimum(i, j) > 0
+ ? world.getChunkHeightMapMinimum(i, j)
+ : world.getChunkFromChunkCoords(i,
+ j).heightMapMinimum - 16)
+ + random.nextInt(4);
int z = j + random.nextInt(16);
- if (world.getBlock(x, y, z) == Blocks.air && (world.getBlock(x, y - 1, z) == Blocks.stone || world.getBlock(x, y - 1, z) == Blocks.sand || world.getBlock(x, y - 1, z) == Blocks.grass)) structure.generate(world, biomeBase, random, x, y, z);
+ if (world.getBlock(x, y, z) == Blocks.air
+ && (world.getBlock(x, y - 1, z) == Blocks.stone
+ || world.getBlock(x, y - 1,
+ z) == Blocks.sand
+ || world.getBlock(x, y - 1,
+ z) == Blocks.grass))
+ structure.generate(world, biomeBase, random, x, y, z);
}
- }
- else if (chanceOfSpawning) {
+ } else if (chanceOfSpawning) {
if (random.nextInt(maxAttempts) == 0) {
int x = i + random.nextInt(16);
- int y = (world.getChunkHeightMapMinimum(i, j) > 0 ? world.getChunkHeightMapMinimum(i, j) : world.getChunkFromChunkCoords(i, j).heightMapMinimum - 16) + random.nextInt(4);
+ int y = (world.getChunkHeightMapMinimum(i, j) > 0
+ ? world.getChunkHeightMapMinimum(i, j)
+ : world.getChunkFromChunkCoords(i,
+ j).heightMapMinimum - 16)
+ + random.nextInt(4);
int z = j + random.nextInt(16);
- if (world.getBlock(x, y, z) == Blocks.air && (world.getBlock(x, y - 1, z) == Blocks.stone || world.getBlock(x, y - 1, z) == Blocks.sand || world.getBlock(x, y - 1, z) == Blocks.grass)) {
+ if (world.getBlock(x, y, z) == Blocks.air
+ && (world.getBlock(x, y - 1, z) == Blocks.stone
+ || world.getBlock(x, y - 1,
+ z) == Blocks.sand
+ || world.getBlock(x, y - 1,
+ z) == Blocks.grass)) {
structure.generate(world, biomeBase, random, x, y, z);
System.out.println(x + " " + z);
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure.java index f233d3e..9b99e5a 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure.java @@ -4,6 +4,7 @@ package darkknight.jewelrycraft.worldGen;
import java.util.Random;
+
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.gen.feature.WorldGenerator;
@@ -11,25 +12,23 @@ import net.minecraft.world.gen.feature.WorldGenerator; /**
* @author Sorin
*/
-public class WorldGenStructure extends WorldGenerator
-{
- public boolean generate(World world, BiomeGenBase biome, Random rand, int x, int y, int z)
- {
+public class WorldGenStructure extends WorldGenerator {
+ public boolean generate(World world, BiomeGenBase biome, Random rand,
+ int x, int y, int z) {
return false;
}
@Override
- public boolean generate(World world, Random rand, int x, int y, int z) {
+ public boolean generate(World world, Random rand, int x, int y,
+ int z) {
return false;
}
-
- public boolean isUnderground()
- {
- return false;
+
+ public boolean isUnderground() {
+ return false;
}
-
- public int structureNo()
- {
- return -1;
+
+ public int structureNo() {
+ return -1;
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure1.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure1.java index 898ece2..6ec6b81 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure1.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure1.java @@ -4,6 +4,7 @@ package darkknight.jewelrycraft.worldGen;
import java.util.Random;
+
import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.item.ItemList;
import darkknight.jewelrycraft.random.WeightedRandomItem;
@@ -19,46 +20,70 @@ import net.minecraft.world.biome.BiomeGenBase; /**
* @author Sorin
*/
-public class WorldGenStructure1 extends WorldGenStructure
-{
- public static final WeightedRandomItem[] items = new WeightedRandomItem[]{new WeightedRandomItem(new ItemStack(ItemList.thiefGloves), 10), new WeightedRandomItem(new ItemStack(Items.golden_apple), 8), new WeightedRandomItem(new ItemStack(Items.golden_apple, 1, 1), 1), new WeightedRandomItem(new ItemStack(ItemList.guide), 20), new WeightedRandomItem(new ItemStack(ItemList.shadowIngot), 25), new WeightedRandomItem(new ItemStack(BlockList.shadowEye), 2), new WeightedRandomItem(new ItemStack(Items.nether_star), 1), new WeightedRandomItem(new ItemStack(BlockList.shadowBlock), 2), new WeightedRandomItem(new ItemStack(BlockList.crystal), 16, 20)};
-
- public boolean generate(World world, BiomeGenBase biome, Random rand, int x, int y, int z)
- {
- Block block = Blocks.stonebrick;
- int metadata = 0, slabMeta = 5;
- if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills){
- block = Blocks.sandstone;
- metadata = 2;
- slabMeta = 1;
- }
- for(int i = -2; i <= 2; i++)
- for(int j = -1; j <= 4; j++)
- for(int k = -2; k <= 2; k++)
- world.setBlock(x + i, y + j, z + k, Blocks.air);
- for(int i = -2; i <= 2; i++)
- for(int k = -2; k <= 2; k++){
- world.setBlock(x + i, y - 1, z + k, block, metadata, 2);
- if (i % 2 == 0 && k % 2 == 0 && i != 0 && k != 0) world.setBlock(x + i, y, z + k, BlockList.crystal);
- }
- for(int i = -1; i <= 1; i++)
- for(int k = -1; k <= 1; k++)
- world.setBlock(x + i, y, z + k, Blocks.stone_slab, slabMeta, 2);
- world.setBlock(x, y, z, block, metadata, 2);
- world.setBlock(x, y + 1, z, BlockList.handPedestal, 6, 2);
- TileEntityHandPedestal pedestal = (TileEntityHandPedestal)world.getTileEntity(x, y + 1, z);
- pedestal.setHeldItemStack(((WeightedRandomItem)WeightedRandom.getRandomItem(rand, items)).getItem(rand));
- return true;
- }
-
- @Override
- public boolean generate(World world, Random rand, int x, int y, int z)
- {
- return generate(world, BiomeGenBase.plains, rand, x, y, z);
- }
-
- public int structureNo()
- {
- return 1;
- }
+public class WorldGenStructure1 extends WorldGenStructure {
+ public static final WeightedRandomItem[] items =
+ new WeightedRandomItem[] {
+ new WeightedRandomItem(
+ new ItemStack(ItemList.thiefGloves), 10),
+ new WeightedRandomItem(
+ new ItemStack(Items.golden_apple), 8),
+ new WeightedRandomItem(
+ new ItemStack(Items.golden_apple, 1, 1), 1),
+ new WeightedRandomItem(new ItemStack(ItemList.guide),
+ 20),
+ new WeightedRandomItem(
+ new ItemStack(ItemList.shadowIngot), 25),
+ new WeightedRandomItem(
+ new ItemStack(BlockList.shadowEye), 2),
+ new WeightedRandomItem(
+ new ItemStack(Items.nether_star), 1),
+ new WeightedRandomItem(
+ new ItemStack(BlockList.shadowBlock), 2),
+ new WeightedRandomItem(
+ new ItemStack(BlockList.crystal), 16, 20) };
+
+ @Override
+ public boolean generate(World world, BiomeGenBase biome, Random rand,
+ int x, int y, int z) {
+ Block block = Blocks.stonebrick;
+ int metadata = 0, slabMeta = 5;
+ if (biome == BiomeGenBase.desert
+ || biome == BiomeGenBase.desertHills) {
+ block = Blocks.sandstone;
+ metadata = 2;
+ slabMeta = 1;
+ }
+ for (int i = -2; i <= 2; i++)
+ for (int j = -1; j <= 4; j++)
+ for (int k = -2; k <= 2; k++)
+ world.setBlock(x + i, y + j, z + k, Blocks.air);
+ for (int i = -2; i <= 2; i++)
+ for (int k = -2; k <= 2; k++) {
+ world.setBlock(x + i, y - 1, z + k, block, metadata, 2);
+ if (i % 2 == 0 && k % 2 == 0 && i != 0 && k != 0)
+ world.setBlock(x + i, y, z + k, BlockList.crystal);
+ }
+ for (int i = -1; i <= 1; i++)
+ for (int k = -1; k <= 1; k++)
+ world.setBlock(x + i, y, z + k, Blocks.stone_slab,
+ slabMeta, 2);
+ world.setBlock(x, y, z, block, metadata, 2);
+ world.setBlock(x, y + 1, z, BlockList.handPedestal, 6, 2);
+ TileEntityHandPedestal pedestal =
+ (TileEntityHandPedestal) world.getTileEntity(x, y + 1, z);
+ pedestal.setHeldItemStack(((WeightedRandomItem) WeightedRandom
+ .getRandomItem(rand, items)).getItem(rand));
+ return true;
+ }
+
+ @Override
+ public boolean generate(World world, Random rand, int x, int y,
+ int z) {
+ return generate(world, BiomeGenBase.plains, rand, x, y, z);
+ }
+
+ @Override
+ public int structureNo() {
+ return 1;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure2.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure2.java index 4e4461c..0f285b3 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure2.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure2.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.worldGen;
import java.util.Random;
+
import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.block.BlockMoltenMetal;
import darkknight.jewelrycraft.item.ItemList;
@@ -16,11 +17,14 @@ import net.minecraft.world.biome.BiomeGenBase; * @author Sorin
*/
public class WorldGenStructure2 extends WorldGenStructure {
- public boolean generate(World world, BiomeGenBase biome, Random rand, int x, int y, int z) {
+ @Override
+ public boolean generate(World world, BiomeGenBase biome, Random rand,
+ int x, int y, int z) {
Block block = Blocks.stonebrick;
Block stair = Blocks.stone_brick_stairs;
int metadata = 0;
- if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills) {
+ if (biome == BiomeGenBase.desert
+ || biome == BiomeGenBase.desertHills) {
block = Blocks.sandstone;
stair = Blocks.sandstone_stairs;
metadata = 2;
@@ -36,30 +40,37 @@ public class WorldGenStructure2 extends WorldGenStructure { world.setBlock(x + i, y, z + k, stair);
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
- world.setBlockMetadataWithNotify(x + i, y, z + k, (k == -1) ? 3 : (k == 0) ? (i == 1) ? 0 : 1 : 2, 2);
+ world.setBlockMetadataWithNotify(x + i, y, z + k,
+ (k == -1) ? 3 : (k == 0) ? (i == 1) ? 0 : 1 : 2,
+ 2);
world.setBlock(x, y, z, Blocks.air);
ItemStack stack = new ItemStack(ItemList.bucket);
- JewelryNBT.addMetal(stack, JewelrycraftUtil.metal.get(rand.nextInt(JewelrycraftUtil.metal.size())));
+ JewelryNBT.addMetal(stack, JewelrycraftUtil.metal
+ .get(rand.nextInt(JewelrycraftUtil.metal.size())));
if (stack != null && JewelryNBT.ingot(stack) != null) {
- if (!world.isRemote) world.func_147480_a(x, y, z, true);
+ if (!world.isRemote)
+ world.func_147480_a(x, y, z, true);
world.setBlock(x, y, z, BlockList.moltenMetal, 0, 3);
- if(BlockMoltenMetal.getTileEntity(world, x, y, z) != null) BlockMoltenMetal.getTileEntity(world, x, y, z).setMetal(JewelryNBT.ingot(stack));
+ if (BlockMoltenMetal.getTileEntity(world, x, y, z) != null)
+ BlockMoltenMetal.getTileEntity(world, x, y, z)
+ .setMetal(JewelryNBT.ingot(stack));
}
return true;
}
@Override
- public boolean generate(World world, Random rand, int x, int y, int z) {
+ public boolean generate(World world, Random rand, int x, int y,
+ int z) {
return generate(world, BiomeGenBase.plains, rand, x, y, z);
}
-
- public boolean isUnderground()
- {
- return true;
- }
-
- public int structureNo()
- {
- return 2;
- }
+
+ @Override
+ public boolean isUnderground() {
+ return true;
+ }
+
+ @Override
+ public int structureNo() {
+ return 2;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure3.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure3.java index f0e8cfa..f5347ea 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure3.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure3.java @@ -4,6 +4,7 @@ package darkknight.jewelrycraft.worldGen;
import java.util.Random;
+
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntityMobSpawner;
@@ -14,64 +15,78 @@ import net.minecraftforge.common.DungeonHooks; /**
* @author Sorin
*/
-public class WorldGenStructure3 extends WorldGenStructure
-{
- public boolean generate(World world, BiomeGenBase biome, Random rand, int x, int y, int z)
- {
- Block slab = Blocks.stone_slab;
- Block stair = Blocks.stone_brick_stairs;
- int slabMeta = 13;
- if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills){
- stair = Blocks.sandstone_stairs;
- slabMeta = 9;
- }
- for(int i = -1; i <= 1; i++)
- for(int j = -1; j <= 2; j++)
- for(int k = -1; k <= 1; k++)
- world.setBlock(x + i, y + j, z + k, Blocks.air);
- for(int i = -1; i <= 1; i++)
- for(int k = -1; k <= 1; k++)
- world.setBlock(x + i, y - 1, z + k, slab, slabMeta, 1);
- for(int i = -1; i <= 1; i++)
- for(int k = -1; k <= 1; k++)
- world.setBlock(x + i, y, z + k, stair);
- for(int i = -1; i <= 1; i++)
- for(int k = -1; k <= 1; k++)
- world.setBlockMetadataWithNotify(x + i, y, z + k, (k == -1) ? 3 : (k == 0) ? (i == 1) ? 0 : 1 : 2, 2);
- for(int i = -1; i <= 1; i++)
- for(int k = -1; k <= 1; k++)
- world.setBlock(x + i, y + 1, z + k, stair);
- for(int i = -1; i <= 1; i++)
- for(int k = -1; k <= 1; k++)
- world.setBlockMetadataWithNotify(x + i, y + 1, z + k, (k == -1) ? 7 : (k == 0) ? (i == 1) ? 4 : 5 : 6, 2);
- slabMeta = 5;
- if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills) slabMeta = 1;
- for(int i = -1; i <= 1; i++)
- for(int k = -1; k <= 1; k++)
- world.setBlock(x + i, y + 2, z + k, slab, slabMeta, 2);
- world.setBlock(x, y, z, Blocks.mob_spawner);
- world.setBlock(x, y + 1, z, Blocks.mob_spawner);
- for(int l = 0; l < 2; l++){
- TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner)world.getTileEntity(x, y + l, z);
- if (tileentitymobspawner != null) tileentitymobspawner.func_145881_a().setEntityName(DungeonHooks.getRandomDungeonMob(rand));
- else System.err.println("Failed to fetch mob spawner entity at (" + x + ", " + (y + l) + ", " + z + ")");
- }
- return true;
- }
-
- @Override
- public boolean generate(World world, Random rand, int x, int y, int z)
- {
- return generate(world, BiomeGenBase.plains, rand, x, y, z);
- }
-
- public boolean isUnderground()
- {
- return true;
- }
-
- public int structureNo()
- {
- return 3;
- }
+public class WorldGenStructure3 extends WorldGenStructure {
+ @Override
+ public boolean generate(World world, BiomeGenBase biome, Random rand,
+ int x, int y, int z) {
+ Block slab = Blocks.stone_slab;
+ Block stair = Blocks.stone_brick_stairs;
+ int slabMeta = 13;
+ if (biome == BiomeGenBase.desert
+ || biome == BiomeGenBase.desertHills) {
+ stair = Blocks.sandstone_stairs;
+ slabMeta = 9;
+ }
+ for (int i = -1; i <= 1; i++)
+ for (int j = -1; j <= 2; j++)
+ for (int k = -1; k <= 1; k++)
+ world.setBlock(x + i, y + j, z + k, Blocks.air);
+ for (int i = -1; i <= 1; i++)
+ for (int k = -1; k <= 1; k++)
+ world.setBlock(x + i, y - 1, z + k, slab, slabMeta, 1);
+ for (int i = -1; i <= 1; i++)
+ for (int k = -1; k <= 1; k++)
+ world.setBlock(x + i, y, z + k, stair);
+ for (int i = -1; i <= 1; i++)
+ for (int k = -1; k <= 1; k++)
+ world.setBlockMetadataWithNotify(x + i, y, z + k,
+ (k == -1) ? 3 : (k == 0) ? (i == 1) ? 0 : 1 : 2,
+ 2);
+ for (int i = -1; i <= 1; i++)
+ for (int k = -1; k <= 1; k++)
+ world.setBlock(x + i, y + 1, z + k, stair);
+ for (int i = -1; i <= 1; i++)
+ for (int k = -1; k <= 1; k++)
+ world.setBlockMetadataWithNotify(x + i, y + 1, z + k,
+ (k == -1) ? 7 : (k == 0) ? (i == 1) ? 4 : 5 : 6,
+ 2);
+ slabMeta = 5;
+ if (biome == BiomeGenBase.desert
+ || biome == BiomeGenBase.desertHills)
+ slabMeta = 1;
+ for (int i = -1; i <= 1; i++)
+ for (int k = -1; k <= 1; k++)
+ world.setBlock(x + i, y + 2, z + k, slab, slabMeta, 2);
+ world.setBlock(x, y, z, Blocks.mob_spawner);
+ world.setBlock(x, y + 1, z, Blocks.mob_spawner);
+ for (int l = 0; l < 2; l++) {
+ TileEntityMobSpawner tileentitymobspawner =
+ (TileEntityMobSpawner) world.getTileEntity(x, y + l,
+ z);
+ if (tileentitymobspawner != null)
+ tileentitymobspawner.func_145881_a().setEntityName(
+ DungeonHooks.getRandomDungeonMob(rand));
+ else
+ System.err
+ .println("Failed to fetch mob spawner entity at ("
+ + x + ", " + (y + l) + ", " + z + ")");
+ }
+ return true;
+ }
+
+ @Override
+ public boolean generate(World world, Random rand, int x, int y,
+ int z) {
+ return generate(world, BiomeGenBase.plains, rand, x, y, z);
+ }
+
+ @Override
+ public boolean isUnderground() {
+ return true;
+ }
+
+ @Override
+ public int structureNo() {
+ return 3;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure4.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure4.java index b0be600..a791914 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure4.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure4.java @@ -4,6 +4,7 @@ package darkknight.jewelrycraft.worldGen;
import java.util.Random;
+
import darkknight.jewelrycraft.block.BlockList;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
@@ -13,54 +14,60 @@ import net.minecraft.world.biome.BiomeGenBase; /**
* @author Sorin
*/
-public class WorldGenStructure4 extends WorldGenStructure
-{
- public boolean generate(World world, BiomeGenBase biome, Random rand, int x, int y, int z)
- {
- Block stair = Blocks.stone_brick_stairs;
- Block block = Blocks.stonebrick;
- int metadata = 0, slabMeta = 5;
- if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills){
- stair = Blocks.sandstone_stairs;
- block = Blocks.sandstone;
- metadata = 2;
- slabMeta = 1;
- }
- for(int i = -1; i <= 1; i++)
- for(int j = 0; j <= 3; j++)
- for(int k = -1; k <= 1; k++)
- world.setBlock(x + i, y + j, z + k, Blocks.air);
- for(int i = -1; i <= 1; i++)
- for(int k = -1; k <= 1; k++)
- world.setBlock(x + i, y, z + k, Blocks.stone_slab, slabMeta, 2);
- world.setBlock(x, y, z, block, metadata, 2);
- world.setBlock(x, y, z - 1, stair, 3, 1);
- world.setBlock(x, y, z + 1, stair, 2, 1);
- world.setBlock(x - 1, y, z, stair, 1, 1);
- world.setBlock(x + 1, y, z, stair, 0, 1);
- world.setBlock(x, y + 1, z - 1, stair, 7, 1);
- world.setBlock(x, y + 1, z + 1, stair, 6, 1);
- world.setBlock(x - 1, y + 1, z, stair, 5, 1);
- world.setBlock(x + 1, y + 1, z, stair, 4, 1);
- world.setBlock(x, y + 1, z, BlockList.shadowBlock);
- slabMeta = 5;
- if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills) slabMeta = 1;
- for(int i = -1; i <= 1; i++)
- for(int k = -1; k <= 1; k++)
- if (i == 0 || k == 0) world.setBlock(x + i, y + 2, z + k, Blocks.stone_slab, slabMeta, 2);
- world.setBlock(x, y + 2, z, block, metadata, 2);
- world.setBlock(x, y + 3, z, BlockList.crystal);
- return true;
- }
-
- @Override
- public boolean generate(World world, Random rand, int x, int y, int z)
- {
- return generate(world, BiomeGenBase.plains, rand, x, y, z);
- }
-
- public int structureNo()
- {
- return 4;
- }
+public class WorldGenStructure4 extends WorldGenStructure {
+ @Override
+ public boolean generate(World world, BiomeGenBase biome, Random rand,
+ int x, int y, int z) {
+ Block stair = Blocks.stone_brick_stairs;
+ Block block = Blocks.stonebrick;
+ int metadata = 0, slabMeta = 5;
+ if (biome == BiomeGenBase.desert
+ || biome == BiomeGenBase.desertHills) {
+ stair = Blocks.sandstone_stairs;
+ block = Blocks.sandstone;
+ metadata = 2;
+ slabMeta = 1;
+ }
+ for (int i = -1; i <= 1; i++)
+ for (int j = 0; j <= 3; j++)
+ for (int k = -1; k <= 1; k++)
+ world.setBlock(x + i, y + j, z + k, Blocks.air);
+ for (int i = -1; i <= 1; i++)
+ for (int k = -1; k <= 1; k++)
+ world.setBlock(x + i, y, z + k, Blocks.stone_slab,
+ slabMeta, 2);
+ world.setBlock(x, y, z, block, metadata, 2);
+ world.setBlock(x, y, z - 1, stair, 3, 1);
+ world.setBlock(x, y, z + 1, stair, 2, 1);
+ world.setBlock(x - 1, y, z, stair, 1, 1);
+ world.setBlock(x + 1, y, z, stair, 0, 1);
+ world.setBlock(x, y + 1, z - 1, stair, 7, 1);
+ world.setBlock(x, y + 1, z + 1, stair, 6, 1);
+ world.setBlock(x - 1, y + 1, z, stair, 5, 1);
+ world.setBlock(x + 1, y + 1, z, stair, 4, 1);
+ world.setBlock(x, y + 1, z, BlockList.shadowBlock);
+ slabMeta = 5;
+ if (biome == BiomeGenBase.desert
+ || biome == BiomeGenBase.desertHills)
+ slabMeta = 1;
+ for (int i = -1; i <= 1; i++)
+ for (int k = -1; k <= 1; k++)
+ if (i == 0 || k == 0)
+ world.setBlock(x + i, y + 2, z + k, Blocks.stone_slab,
+ slabMeta, 2);
+ world.setBlock(x, y + 2, z, block, metadata, 2);
+ world.setBlock(x, y + 3, z, BlockList.crystal);
+ return true;
+ }
+
+ @Override
+ public boolean generate(World world, Random rand, int x, int y,
+ int z) {
+ return generate(world, BiomeGenBase.plains, rand, x, y, z);
+ }
+
+ @Override
+ public int structureNo() {
+ return 4;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure5.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure5.java index e67fdb1..ee74bdb 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure5.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure5.java @@ -4,6 +4,7 @@ package darkknight.jewelrycraft.worldGen;
import java.util.Random;
+
import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.block.BlockMoltenMetal;
import darkknight.jewelrycraft.item.ItemList;
@@ -19,12 +20,15 @@ import net.minecraft.world.biome.BiomeGenBase; * @author Sorin
*/
public class WorldGenStructure5 extends WorldGenStructure {
- public boolean generate(World world, BiomeGenBase biome, Random rand, int x, int y, int z) {
+ @Override
+ public boolean generate(World world, BiomeGenBase biome, Random rand,
+ int x, int y, int z) {
Block slab = Blocks.stone_slab;
Block stair = Blocks.stone_brick_stairs;
Block block = Blocks.stonebrick;
int metadata = 0, slabMeta = 5;
- if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills) {
+ if (biome == BiomeGenBase.desert
+ || biome == BiomeGenBase.desertHills) {
stair = Blocks.sandstone_stairs;
block = Blocks.sandstone;
metadata = 2;
@@ -48,7 +52,9 @@ public class WorldGenStructure5 extends WorldGenStructure { world.setBlock(x + i, y - 1, z + k, block, metadata, 2);
for (int i = -5; i <= -3; i++)
for (int k = -3; k <= 2; k++)
- if ((i != -4 || k <= -3 || k >= 2) && !(i == -3 && k == -2)) world.setBlock(x + i, y, z + k, slab, slabMeta, 2);
+ if ((i != -4 || k <= -3 || k >= 2)
+ && !(i == -3 && k == -2))
+ world.setBlock(x + i, y, z + k, slab, slabMeta, 2);
world.setBlock(x - 3, y, z - 1, stair, 0, 2);
world.setBlock(x - 3, y, z - 3, stair, 0, 2);
world.setBlock(x - 2, y + 1, z - 3, slab, slabMeta, 2);
@@ -65,27 +71,34 @@ public class WorldGenStructure5 extends WorldGenStructure { ItemStack stack = new ItemStack(ItemList.bucket);
JewelryNBT.addMetal(stack, new ItemStack(Items.gold_ingot));
if (stack != null && JewelryNBT.ingot(stack) != null) {
- if (!world.isRemote) world.func_147480_a(x, y, z, true);
- world.setBlock(x + 1, y + 2, z - 2, BlockList.moltenMetal, 0, 3);
- if(BlockMoltenMetal.getTileEntity(world, x + 1, y + 2, z - 2) != null) BlockMoltenMetal.getTileEntity(world, x + 1, y + 2, z - 2).setMetal(JewelryNBT.ingot(stack));
+ if (!world.isRemote)
+ world.func_147480_a(x, y, z, true);
+ world.setBlock(x + 1, y + 2, z - 2, BlockList.moltenMetal,
+ 0, 3);
+ if (BlockMoltenMetal.getTileEntity(world, x + 1, y + 2,
+ z - 2) != null)
+ BlockMoltenMetal
+ .getTileEntity(world, x + 1, y + 2, z - 2)
+ .setMetal(JewelryNBT.ingot(stack));
}
- }
- else world.setBlock(x + 1, y + 2, z - 2, Blocks.water, 0, 3);
+ } else
+ world.setBlock(x + 1, y + 2, z - 2, Blocks.water, 0, 3);
return true;
}
@Override
- public boolean generate(World world, Random rand, int x, int y, int z) {
+ public boolean generate(World world, Random rand, int x, int y,
+ int z) {
return generate(world, BiomeGenBase.plains, rand, x, y, z);
}
-
- public boolean isUnderground()
- {
- return true;
- }
-
- public int structureNo()
- {
- return 5;
- }
+
+ @Override
+ public boolean isUnderground() {
+ return true;
+ }
+
+ @Override
+ public int structureNo() {
+ return 5;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure6.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure6.java index d68402a..40fca43 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure6.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure6.java @@ -4,6 +4,7 @@ package darkknight.jewelrycraft.worldGen;
import java.util.Random;
+
import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.item.ItemList;
import darkknight.jewelrycraft.random.WeightedRandomItem;
@@ -27,7 +28,9 @@ import net.minecraft.world.biome.BiomeGenBase; * @author Sorin
*/
public class WorldGenStructure6 extends WorldGenStructure {
- public boolean generate(World world, BiomeGenBase biome, Random rand, int x, int y, int z) {
+ @Override
+ public boolean generate(World world, BiomeGenBase biome, Random rand,
+ int x, int y, int z) {
int randBlock, randBlockMeta;
Block block;
for (int i = -2; i <= 1; i++)
@@ -38,62 +41,86 @@ public class WorldGenStructure6 extends WorldGenStructure { for (int k = -2; k <= 1; k++) {
randBlock = rand.nextInt(4);
switch (randBlock) {
- case 0:
- block = Blocks.cobblestone;
- randBlockMeta = 0;
- break;
- case 1:
- block = Blocks.stonebrick;
- randBlockMeta = 2;
- break;
- case 2:
- block = Blocks.stonebrick;
- randBlockMeta = 0;
- break;
- default:
- block = Blocks.cobblestone;
- randBlockMeta = 0;
- break;
+ case 0:
+ block = Blocks.cobblestone;
+ randBlockMeta = 0;
+ break;
+ case 1:
+ block = Blocks.stonebrick;
+ randBlockMeta = 2;
+ break;
+ case 2:
+ block = Blocks.stonebrick;
+ randBlockMeta = 0;
+ break;
+ default:
+ block = Blocks.cobblestone;
+ randBlockMeta = 0;
+ break;
}
- world.setBlock(x + i, y - 1, z + k, block, randBlockMeta, 2);
+ world.setBlock(x + i, y - 1, z + k, block, randBlockMeta,
+ 2);
}
int crystalCol = rand.nextInt(15);
world.setBlock(x - 2, y, z - 2, BlockList.crystal, 0, 2);
- world.setBlock(x - 2, y, z + 1, BlockList.crystal, 1 + crystalCol, 2);
- world.setBlock(x + 1, y, z - 2, BlockList.crystal, 1 + crystalCol, 2);
+ world.setBlock(x - 2, y, z + 1, BlockList.crystal, 1 + crystalCol,
+ 2);
+ world.setBlock(x + 1, y, z - 2, BlockList.crystal, 1 + crystalCol,
+ 2);
world.setBlock(x + 1, y, z + 1, BlockList.crystal, 0, 2);
world.setBlock(x - 1, y, z - 1, Blocks.skull, 1, 2);
TileEntity tileentity = world.getTileEntity(x - 1, y, z - 1);
if (tileentity != null && tileentity instanceof TileEntitySkull) {
- ((TileEntitySkull) tileentity).func_152107_a(rand.nextInt(50) == 0 ? 1 : 0);
- ((TileEntitySkull) tileentity).func_145903_a(MathHelper.floor_double((double) (rand.nextInt(361) * 16.0F / 360.0F) + 0.5D) & 15);
- ((BlockSkull) Blocks.skull).func_149965_a(world, x - 1, y, z - 1, (TileEntitySkull) tileentity);
+ ((TileEntitySkull) tileentity)
+ .func_152107_a(rand.nextInt(50) == 0 ? 1 : 0);
+ ((TileEntitySkull) tileentity)
+ .func_145903_a(MathHelper.floor_double(
+ (double) (rand.nextInt(361) * 16.0F / 360.0F)
+ + 0.5D)
+ & 15);
+ ((BlockSkull) Blocks.skull).func_149965_a(world, x - 1, y,
+ z - 1, (TileEntitySkull) tileentity);
}
- world.setBlock(x + 1, y, z - 1, BlockList.jewelCraftingTable, 3, 2);
+ world.setBlock(x + 1, y, z - 1, BlockList.jewelCraftingTable, 3,
+ 2);
TileEntity jewelersTable = world.getTileEntity(x + 1, y, z - 1);
- Item[] jewelry = new Item[] { ItemList.ring, ItemList.necklace, ItemList.bracelet, ItemList.earrings };
- if (jewelersTable != null && jewelersTable instanceof TileEntityJewelrsCraftingTable) {
- if (rand.nextBoolean()) ((TileEntityJewelrsCraftingTable) jewelersTable).setGemItemStack(JewelrycraftUtil.gem.get(rand.nextInt(JewelrycraftUtil.gem.size())));
+ Item[] jewelry = new Item[] { ItemList.ring, ItemList.necklace,
+ ItemList.bracelet, ItemList.earrings };
+ if (jewelersTable != null
+ && jewelersTable instanceof TileEntityJewelrsCraftingTable) {
+ if (rand.nextBoolean())
+ ((TileEntityJewelrsCraftingTable) jewelersTable)
+ .setGemItemStack(JewelrycraftUtil.gem.get(rand
+ .nextInt(JewelrycraftUtil.gem.size())));
else if (rand.nextBoolean()) {
- ItemStack result = new ItemStack(jewelry[rand.nextInt(4)], 1, 0);
- if (JewelrycraftUtil.metal.size() > 0) JewelryNBT.addMetal(result, JewelrycraftUtil.metal.get(rand.nextInt(JewelrycraftUtil.metal.size())));
- ((TileEntityJewelrsCraftingTable) jewelersTable).setJewelryItemStack(result);
+ ItemStack result =
+ new ItemStack(jewelry[rand.nextInt(4)], 1, 0);
+ if (JewelrycraftUtil.metal.size() > 0)
+ JewelryNBT.addMetal(result, JewelrycraftUtil.metal.get(
+ rand.nextInt(JewelrycraftUtil.metal.size())));
+ ((TileEntityJewelrsCraftingTable) jewelersTable)
+ .setJewelryItemStack(result);
}
}
world.setBlock(x - 1, y, z + 1, BlockList.handPedestal, 0, 2);
TileEntity pedestal = world.getTileEntity(x - 1, y, z + 1);
- if (pedestal != null && pedestal instanceof TileEntityHandPedestal) ((TileEntityHandPedestal) pedestal).setHeldItemStack(((WeightedRandomItem) WeightedRandom.getRandomItem(rand, WorldGenStructure1.items)).getItem(rand));
+ if (pedestal != null && pedestal instanceof TileEntityHandPedestal)
+ ((TileEntityHandPedestal) pedestal)
+ .setHeldItemStack(((WeightedRandomItem) WeightedRandom
+ .getRandomItem(rand, WorldGenStructure1.items))
+ .getItem(rand));
world.setBlock(x - 1, y + 1, z + 1, BlockList.shadowEye, 0, 2);
return true;
}
@Override
- public boolean generate(World world, Random rand, int x, int y, int z) {
+ public boolean generate(World world, Random rand, int x, int y,
+ int z) {
return generate(world, BiomeGenBase.plains, rand, x, y, z);
}
-
- public int structureNo()
- {
- return 6;
- }
+
+ @Override
+ public int structureNo() {
+ return 6;
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java b/src/main/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java index cefd063..00e074c 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java @@ -2,6 +2,7 @@ package darkknight.jewelrycraft.worldGen.village; import java.util.List;
import java.util.Random;
+
import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.config.ConfigHandler;
import darkknight.jewelrycraft.item.ItemList;
@@ -27,97 +28,154 @@ import net.minecraft.world.gen.structure.StructureVillagePieces; import net.minecraft.world.gen.structure.StructureVillagePieces.Start;
public class ComponentJewelry extends StructureVillagePieces.House1 {
- private int averageGroundLevel = -1;
+ private int averageGroundLevel = -1;
public ComponentJewelry() {
}
- public ComponentJewelry(Start par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5) {
+ public ComponentJewelry(Start par1ComponentVillageStartPiece, int par2,
+ Random par3Random,
+ StructureBoundingBox par4StructureBoundingBox, int par5) {
super();
coordBaseMode = par5;
boundingBox = par4StructureBoundingBox;
}
@SuppressWarnings("rawtypes")
- public static ComponentJewelry buildComponent(Start villagePiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5) {
- StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, 11, 5, 12, p4);
- return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(pieces, structureboundingbox) == null ? new ComponentJewelry(villagePiece, p5, random, structureboundingbox, p4) : null;
+ public static ComponentJewelry buildComponent(Start villagePiece,
+ List pieces, Random random, int p1, int p2, int p3, int p4,
+ int p5) {
+ StructureBoundingBox structureboundingbox =
+ StructureBoundingBox.getComponentToAddBoundingBox(p1, p2,
+ p3, 0, 0, 0, 11, 5, 12, p4);
+ return canVillageGoDeeper(structureboundingbox)
+ && StructureComponent.findIntersecting(pieces,
+ structureboundingbox) == null
+ ? new ComponentJewelry(villagePiece, p5,
+ random, structureboundingbox, p4)
+ : null;
}
@Override
- public boolean addComponentParts(World world, Random random, StructureBoundingBox sbb) {
+ public boolean addComponentParts(World world, Random random,
+ StructureBoundingBox sbb) {
if (averageGroundLevel < 0) {
averageGroundLevel = getAverageGroundLevel(world, sbb);
- if (averageGroundLevel < 0) return true;
- boundingBox.offset(0, averageGroundLevel - boundingBox.maxY + 3, 0);
+ if (averageGroundLevel < 0)
+ return true;
+ boundingBox.offset(0,
+ averageGroundLevel - boundingBox.maxY + 3, 0);
}
- fillWithBlocks(world, sbb, 0, 0, 6, 10, 5, 11, Block.getBlockById(0), Block.getBlockById(0), false);
- fillWithBlocks(world, sbb, 2, 0, 0, 8, 5, 5, Block.getBlockById(0), Block.getBlockById(0), false);
+ fillWithBlocks(world, sbb, 0, 0, 6, 10, 5, 11,
+ Block.getBlockById(0), Block.getBlockById(0), false);
+ fillWithBlocks(world, sbb, 2, 0, 0, 8, 5, 5, Block.getBlockById(0),
+ Block.getBlockById(0), false);
// Pillars
- fillWithBlocks(world, sbb, 2, 0, 0, 2, 3, 0, Blocks.log, Blocks.log, false);
- fillWithBlocks(world, sbb, 2, 0, 3, 2, 3, 3, Blocks.log, Blocks.log, false);
- fillWithBlocks(world, sbb, 8, 0, 0, 8, 3, 0, Blocks.log, Blocks.log, false);
- fillWithBlocks(world, sbb, 8, 0, 3, 8, 3, 3, Blocks.log, Blocks.log, false);
+ fillWithBlocks(world, sbb, 2, 0, 0, 2, 3, 0, Blocks.log,
+ Blocks.log, false);
+ fillWithBlocks(world, sbb, 2, 0, 3, 2, 3, 3, Blocks.log,
+ Blocks.log, false);
+ fillWithBlocks(world, sbb, 8, 0, 0, 8, 3, 0, Blocks.log,
+ Blocks.log, false);
+ fillWithBlocks(world, sbb, 8, 0, 3, 8, 3, 3, Blocks.log,
+ Blocks.log, false);
// Walls
- fillWithBlocks(world, sbb, 2, 0, 1, 2, 3, 2, Blocks.planks, Blocks.planks, false);
- fillWithBlocks(world, sbb, 2, 0, 4, 2, 3, 5, Blocks.planks, Blocks.planks, false);
- fillWithBlocks(world, sbb, 8, 0, 1, 8, 3, 2, Blocks.planks, Blocks.planks, false);
- fillWithBlocks(world, sbb, 8, 0, 4, 8, 3, 5, Blocks.planks, Blocks.planks, false);
- fillWithBlocks(world, sbb, 3, 0, 0, 7, 3, 0, Blocks.planks, Blocks.planks, false);
- fillWithBlocks(world, sbb, 0, 0, 6, 10, 3, 6, Blocks.cobblestone, Blocks.cobblestone, false);
- fillWithBlocks(world, sbb, 0, 0, 11, 10, 3, 11, Blocks.cobblestone, Blocks.cobblestone, false);
- fillWithBlocks(world, sbb, 0, 0, 6, 0, 3, 11, Blocks.cobblestone, Blocks.cobblestone, false);
- fillWithBlocks(world, sbb, 10, 0, 6, 10, 3, 11, Blocks.cobblestone, Blocks.cobblestone, false);
+ fillWithBlocks(world, sbb, 2, 0, 1, 2, 3, 2, Blocks.planks,
+ Blocks.planks, false);
+ fillWithBlocks(world, sbb, 2, 0, 4, 2, 3, 5, Blocks.planks,
+ Blocks.planks, false);
+ fillWithBlocks(world, sbb, 8, 0, 1, 8, 3, 2, Blocks.planks,
+ Blocks.planks, false);
+ fillWithBlocks(world, sbb, 8, 0, 4, 8, 3, 5, Blocks.planks,
+ Blocks.planks, false);
+ fillWithBlocks(world, sbb, 3, 0, 0, 7, 3, 0, Blocks.planks,
+ Blocks.planks, false);
+ fillWithBlocks(world, sbb, 0, 0, 6, 10, 3, 6, Blocks.cobblestone,
+ Blocks.cobblestone, false);
+ fillWithBlocks(world, sbb, 0, 0, 11, 10, 3, 11, Blocks.cobblestone,
+ Blocks.cobblestone, false);
+ fillWithBlocks(world, sbb, 0, 0, 6, 0, 3, 11, Blocks.cobblestone,
+ Blocks.cobblestone, false);
+ fillWithBlocks(world, sbb, 10, 0, 6, 10, 3, 11, Blocks.cobblestone,
+ Blocks.cobblestone, false);
// Roof
for (int i = 3; i <= 7; i++)
for (int j = 1; j <= 5; j++)
- placeBlockAtCurrentPosition(world, Blocks.wooden_slab, 2, i, 4, j, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.wooden_slab, 2,
+ i, 4, j, sbb);
for (int i = 3; i <= 7; i++)
for (int j = 6; j <= 6; j++)
- placeBlockAtCurrentPosition(world, Blocks.stone_slab, 0, i, 4, j, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.stone_slab, 0, i,
+ 4, j, sbb);
for (int i = 1; i <= 9; i++)
for (int j = 7; j <= 10; j++)
- placeBlockAtCurrentPosition(world, Blocks.stone_slab, 3, i, 4, j, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.stone_slab, 3, i,
+ 4, j, sbb);
for (int i = 2; i <= 8; i++)
- placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab, 2, i, 4, 0, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab,
+ 2, i, 4, 0, sbb);
for (int i = 1; i <= 5; i++) {
- placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab, 2, 2, 4, i, sbb);
- placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab, 2, 8, 4, i, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab,
+ 2, 2, 4, i, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab,
+ 2, 8, 4, i, sbb);
}
for (int i = 0; i <= 2; i++) {
- placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, i, 4, 6, sbb);
- placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, i + 8, 4, 6, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0,
+ i, 4, 6, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0,
+ i + 8, 4, 6, sbb);
}
for (int i = 7; i <= 11; i++) {
- placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, 0, 4, i, sbb);
- placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, 10, 4, i, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0,
+ 0, 4, i, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0,
+ 10, 4, i, sbb);
}
for (int i = 0; i <= 10; i++)
- placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, i, 4, 11, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0,
+ i, 4, 11, sbb);
// Base
for (int i = 2; i <= 8; i++)
for (int j = 0; j <= 5; j++)
- placeBlockAtCurrentPosition(world, Blocks.planks, 1, i, 0, j, sbb);
- fillWithBlocks(world, sbb, 0, 0, 6, 10, 0, 11, Blocks.stonebrick, Blocks.stonebrick, false);
+ placeBlockAtCurrentPosition(world, Blocks.planks, 1, i, 0,
+ j, sbb);
+ fillWithBlocks(world, sbb, 0, 0, 6, 10, 0, 11, Blocks.stonebrick,
+ Blocks.stonebrick, false);
for (int i = 6; i <= 10; i++)
- placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, 5, 0, i, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0,
+ 5, 0, i, sbb);
for (int i = 7; i <= 10; i++) {
- placeBlockAtCurrentPosition(world, Blocks.stonebrick, 3, 1, 0, i, sbb);
- placeBlockAtCurrentPosition(world, Blocks.stonebrick, 3, 9, 0, i, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.stonebrick, 3, 1, 0,
+ i, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.stonebrick, 3, 9, 0,
+ i, sbb);
}
// Decorations
- placeDoorAtCurrentPosition(world, sbb, random, 6, 1, 0, getMetadataWithOffset(Blocks.wooden_door, 1));
- placeDoorAtCurrentPosition(world, sbb, random, 5, 1, 6, getMetadataWithOffset(Blocks.wooden_door, 1));
- placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 3, 2, 0, sbb);
- placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 4, 2, 0, sbb);
- placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 1, sbb);
- placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 2, sbb);
- placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 4, sbb);
- placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 5, sbb);
- placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 1, sbb);
- placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 2, sbb);
- placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 4, sbb);
- placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 5, sbb);
+ placeDoorAtCurrentPosition(world, sbb, random, 6, 1, 0,
+ getMetadataWithOffset(Blocks.wooden_door, 1));
+ placeDoorAtCurrentPosition(world, sbb, random, 5, 1, 6,
+ getMetadataWithOffset(Blocks.wooden_door, 1));
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 3, 2, 0,
+ sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 4, 2, 0,
+ sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 1,
+ sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 2,
+ sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 4,
+ sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 5,
+ sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 1,
+ sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 2,
+ sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 4,
+ sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 5,
+ sbb);
placeBlockAtCurrentPosition(world, Blocks.torch, 0, 6, 3, 1, sbb);
placeBlockAtCurrentPosition(world, Blocks.torch, 0, 3, 3, 3, sbb);
placeBlockAtCurrentPosition(world, Blocks.torch, 0, 7, 3, 3, sbb);
@@ -131,119 +189,237 @@ public class ComponentJewelry extends StructureVillagePieces.House1 { int bgCarpetColor = random.nextInt(16);
for (int i = 4; i <= 7; i++)
for (int j = 1; j <= 5; j++)
- placeBlockAtCurrentPosition(world, Blocks.carpet, bgCarpetColor, i, 1, j, sbb);
- generateChest(world, 3, 1, 1, 0, random, sbb, ConfigHandler.GEM_CHEST_MIN, ConfigHandler.GEM_CHEST_MAX);
- generateDisplayer(world, 3, 1, 2, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random, sbb);
- placeBlockAtCurrentPosition(world, BlockList.jewelCraftingTable, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, 3, 1, 3, sbb);
- generateDisplayer(world, 3, 1, 4, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random, sbb);
- generateChest(world, 3, 1, 5, 0, random, sbb, ConfigHandler.GEM_CHEST_MIN, ConfigHandler.GEM_CHEST_MAX);
- generateFurnace(world, 1, 1, 7, 0, random, sbb, ConfigHandler.FURNACE_MIN_INGOT_STACK, ConfigHandler.FURNACE_MAX_INGOT_STACK, ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
- generateFurnace(world, 1, 2, 7, 0, random, sbb, ConfigHandler.FURNACE_MIN_INGOT_STACK, ConfigHandler.FURNACE_MAX_INGOT_STACK, ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
- generateFurnace(world, 1, 3, 7, 0, random, sbb, ConfigHandler.FURNACE_MIN_INGOT_STACK, ConfigHandler.FURNACE_MAX_INGOT_STACK, ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
- generateFurnace(world, 1, 1, 10, 0, random, sbb, ConfigHandler.FURNACE_MIN_INGOT_STACK, ConfigHandler.FURNACE_MAX_INGOT_STACK, ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
- generateFurnace(world, 1, 2, 10, 0, random, sbb, ConfigHandler.FURNACE_MIN_INGOT_STACK, ConfigHandler.FURNACE_MAX_INGOT_STACK, ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
- generateFurnace(world, 1, 3, 10, 0, random, sbb, ConfigHandler.FURNACE_MIN_INGOT_STACK, ConfigHandler.FURNACE_MAX_INGOT_STACK, ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
- generateSmelter(world, 1, 1, 8, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random, sbb, random.nextBoolean());
- generateSmelter(world, 1, 1, 9, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random, sbb, random.nextBoolean());
- generateMolder(world, 2, 1, 8, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random, sbb, random.nextBoolean(), random.nextBoolean());
- generateMolder(world, 2, 1, 9, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random, sbb, random.nextBoolean(), random.nextBoolean());
- if (random.nextBoolean()) generateIngotChest(world, 9, 1, 7, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN, ConfigHandler.INGOT_CHEST_MAX, Blocks.chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
- else generateOresChest(world, 9, 1, 7, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN, ConfigHandler.INGOT_CHEST_MAX, Blocks.chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
- if (random.nextBoolean()) generateIngotChest(world, 9, 1, 8, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN, ConfigHandler.INGOT_CHEST_MAX, Blocks.chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
- else generateOresChest(world, 9, 1, 8, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN, ConfigHandler.INGOT_CHEST_MAX, Blocks.chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
- if (random.nextBoolean()) generateIngotChest(world, 9, 1, 9, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN, ConfigHandler.INGOT_CHEST_MAX, Blocks.trapped_chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
- else generateOresChest(world, 9, 1, 9, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN, ConfigHandler.INGOT_CHEST_MAX, Blocks.trapped_chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
- if (random.nextBoolean()) generateIngotChest(world, 9, 1, 10, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN, ConfigHandler.INGOT_CHEST_MAX, Blocks.trapped_chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
- else generateOresChest(world, 9, 1, 10, 0, random, sbb, ConfigHandler.INGOT_CHEST_MIN, ConfigHandler.INGOT_CHEST_MAX, Blocks.trapped_chest, ConfigHandler.INGOT_CHEST_MAX_STACK);
+ placeBlockAtCurrentPosition(world, Blocks.carpet,
+ bgCarpetColor, i, 1, j, sbb);
+ generateChest(world, 3, 1, 1, 0, random, sbb,
+ ConfigHandler.GEM_CHEST_MIN, ConfigHandler.GEM_CHEST_MAX);
+ generateDisplayer(world, 3, 1, 2,
+ coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random,
+ sbb);
+ placeBlockAtCurrentPosition(world, BlockList.jewelCraftingTable,
+ coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, 3, 1, 3,
+ sbb);
+ generateDisplayer(world, 3, 1, 4,
+ coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random,
+ sbb);
+ generateChest(world, 3, 1, 5, 0, random, sbb,
+ ConfigHandler.GEM_CHEST_MIN, ConfigHandler.GEM_CHEST_MAX);
+ generateFurnace(world, 1, 1, 7, 0, random, sbb,
+ ConfigHandler.FURNACE_MIN_INGOT_STACK,
+ ConfigHandler.FURNACE_MAX_INGOT_STACK,
+ ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
+ generateFurnace(world, 1, 2, 7, 0, random, sbb,
+ ConfigHandler.FURNACE_MIN_INGOT_STACK,
+ ConfigHandler.FURNACE_MAX_INGOT_STACK,
+ ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
+ generateFurnace(world, 1, 3, 7, 0, random, sbb,
+ ConfigHandler.FURNACE_MIN_INGOT_STACK,
+ ConfigHandler.FURNACE_MAX_INGOT_STACK,
+ ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
+ generateFurnace(world, 1, 1, 10, 0, random, sbb,
+ ConfigHandler.FURNACE_MIN_INGOT_STACK,
+ ConfigHandler.FURNACE_MAX_INGOT_STACK,
+ ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
+ generateFurnace(world, 1, 2, 10, 0, random, sbb,
+ ConfigHandler.FURNACE_MIN_INGOT_STACK,
+ ConfigHandler.FURNACE_MAX_INGOT_STACK,
+ ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
+ generateFurnace(world, 1, 3, 10, 0, random, sbb,
+ ConfigHandler.FURNACE_MIN_INGOT_STACK,
+ ConfigHandler.FURNACE_MAX_INGOT_STACK,
+ ConfigHandler.CAN_FURNACE_GENERATE_INGOTS);
+ generateSmelter(world, 1, 1, 8,
+ coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random,
+ sbb, random.nextBoolean());
+ generateSmelter(world, 1, 1, 9,
+ coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random,
+ sbb, random.nextBoolean());
+ generateMolder(world, 2, 1, 8,
+ coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random,
+ sbb, random.nextBoolean(), random.nextBoolean());
+ generateMolder(world, 2, 1, 9,
+ coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random,
+ sbb, random.nextBoolean(), random.nextBoolean());
+ if (random.nextBoolean())
+ generateIngotChest(world, 9, 1, 7, 0, random, sbb,
+ ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.chest,
+ ConfigHandler.INGOT_CHEST_MAX_STACK);
+ else
+ generateOresChest(world, 9, 1, 7, 0, random, sbb,
+ ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.chest,
+ ConfigHandler.INGOT_CHEST_MAX_STACK);
+ if (random.nextBoolean())
+ generateIngotChest(world, 9, 1, 8, 0, random, sbb,
+ ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.chest,
+ ConfigHandler.INGOT_CHEST_MAX_STACK);
+ else
+ generateOresChest(world, 9, 1, 8, 0, random, sbb,
+ ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.chest,
+ ConfigHandler.INGOT_CHEST_MAX_STACK);
+ if (random.nextBoolean())
+ generateIngotChest(world, 9, 1, 9, 0, random, sbb,
+ ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.trapped_chest,
+ ConfigHandler.INGOT_CHEST_MAX_STACK);
+ else
+ generateOresChest(world, 9, 1, 9, 0, random, sbb,
+ ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.trapped_chest,
+ ConfigHandler.INGOT_CHEST_MAX_STACK);
+ if (random.nextBoolean())
+ generateIngotChest(world, 9, 1, 10, 0, random, sbb,
+ ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.trapped_chest,
+ ConfigHandler.INGOT_CHEST_MAX_STACK);
+ else
+ generateOresChest(world, 9, 1, 10, 0, random, sbb,
+ ConfigHandler.INGOT_CHEST_MIN,
+ ConfigHandler.INGOT_CHEST_MAX, Blocks.trapped_chest,
+ ConfigHandler.INGOT_CHEST_MAX_STACK);
for (int l = 0; l < 6; ++l)
for (int i1 = 2; i1 < 9; ++i1) {
clearCurrentPositionBlocksUpwards(world, i1, 9, l, sbb);
- func_151554_b(world, Blocks.cobblestone, 0, i1, -1, l, sbb);
+ func_151554_b(world, Blocks.cobblestone, 0, i1, -1, l,
+ sbb);
}
for (int l = 6; l < 12; ++l)
for (int i1 = 0; i1 < 11; ++i1) {
clearCurrentPositionBlocksUpwards(world, i1, 9, l, sbb);
- func_151554_b(world, Blocks.cobblestone, 0, i1, -1, l, sbb);
+ func_151554_b(world, Blocks.cobblestone, 0, i1, -1, l,
+ sbb);
}
spawnVillagers(world, sbb, 3, 1, 3, 1);
return true;
}
- public void generateChest(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, int min, int max) {
+ public void generateChest(World world, int i, int j, int k,
+ int metadata, Random random, StructureBoundingBox sbb, int min,
+ int max) {
int i1 = getXWithOffset(i, k);
int j1 = getYWithOffset(j);
int k1 = getZWithOffset(i, k);
if (max >= min) {
int t = random.nextInt(max - min + 1) + min;
- placeBlockAtCurrentPosition(world, Blocks.chest, metadata, i, j, k, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.chest, metadata, i,
+ j, k, sbb);
if (world.getTileEntity(i1, j1, k1) != null) {
- TileEntityChest chest = (TileEntityChest) world.getTileEntity(i1, j1, k1);
- while (chest != null && t > 0 && JewelrycraftUtil.gem.size() > 0) {
- ItemStack jewels = JewelrycraftUtil.gem.get(random.nextInt(JewelrycraftUtil.gem.size()));
- chest.func_145976_a(StatCollector.translateToLocal("jeweler." + Variables.MODID + ".jewelerchest"));
- if (jewels.getItem() == Items.nether_star && ConfigHandler.GENERATE_VILLAGE_NETHERSTAR) chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), jewels);
- else if (random.nextBoolean() && jewels.getItem() != Items.nether_star) chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), jewels);
+ TileEntityChest chest =
+ (TileEntityChest) world.getTileEntity(i1, j1, k1);
+ while (chest != null && t > 0
+ && JewelrycraftUtil.gem.size() > 0) {
+ ItemStack jewels = JewelrycraftUtil.gem.get(
+ random.nextInt(JewelrycraftUtil.gem.size()));
+ chest.func_145976_a(
+ StatCollector.translateToLocal("jeweler."
+ + Variables.MODID + ".jewelerchest"));
+ if (jewels.getItem() == Items.nether_star
+ && ConfigHandler.GENERATE_VILLAGE_NETHERSTAR)
+ chest.setInventorySlotContents(
+ random.nextInt(chest.getSizeInventory()),
+ jewels);
+ else if (random.nextBoolean()
+ && jewels.getItem() != Items.nether_star)
+ chest.setInventorySlotContents(
+ random.nextInt(chest.getSizeInventory()),
+ jewels);
t--;
}
}
}
}
- public void generateIngotChest(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, int min, int max, Block chestB, int randomAmount) {
+ public void generateIngotChest(World world, int i, int j, int k,
+ int metadata, Random random, StructureBoundingBox sbb, int min,
+ int max, Block chestB, int randomAmount) {
int i1 = getXWithOffset(i, k);
int j1 = getYWithOffset(j);
int k1 = getZWithOffset(i, k);
if (max >= min) {
int t = random.nextInt(max - min + 1) + min;
- placeBlockAtCurrentPosition(world, chestB, metadata, i, j, k, sbb);
+ placeBlockAtCurrentPosition(world, chestB, metadata, i, j, k,
+ sbb);
if (world.getTileEntity(i1, j1, k1) != null) {
- TileEntityChest chest = (TileEntityChest) world.getTileEntity(i1, j1, k1);
- while (chest != null && t > 0 && JewelrycraftUtil.metal.size() > 0) {
- chest.func_145976_a(StatCollector.translateToLocal("jeweler." + Variables.MODID + ".ingotchest"));
- int metalID = random.nextInt(JewelrycraftUtil.metal.size());
- ItemStack metal = JewelrycraftUtil.metal.get(metalID).copy();
+ TileEntityChest chest =
+ (TileEntityChest) world.getTileEntity(i1, j1, k1);
+ while (chest != null && t > 0
+ && JewelrycraftUtil.metal.size() > 0) {
+ chest.func_145976_a(StatCollector.translateToLocal(
+ "jeweler." + Variables.MODID + ".ingotchest"));
+ int metalID =
+ random.nextInt(JewelrycraftUtil.metal.size());
+ ItemStack metal =
+ JewelrycraftUtil.metal.get(metalID).copy();
metal.stackSize = 2 + random.nextInt(randomAmount);
- if (random.nextBoolean()) chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), metal);
+ if (random.nextBoolean())
+ chest.setInventorySlotContents(
+ random.nextInt(chest.getSizeInventory()),
+ metal);
t--;
}
}
}
}
- public void generateOresChest(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, int min, int max, Block chestB, int randomAmount) {
+ public void generateOresChest(World world, int i, int j, int k,
+ int metadata, Random random, StructureBoundingBox sbb, int min,
+ int max, Block chestB, int randomAmount) {
int i1 = getXWithOffset(i, k);
int j1 = getYWithOffset(j);
int k1 = getZWithOffset(i, k);
if (max >= min) {
int t = random.nextInt(max - min + 1) + min;
- placeBlockAtCurrentPosition(world, chestB, metadata, i, j, k, sbb);
+ placeBlockAtCurrentPosition(world, chestB, metadata, i, j, k,
+ sbb);
if (world.getTileEntity(i1, j1, k1) != null) {
- TileEntityChest chest = (TileEntityChest) world.getTileEntity(i1, j1, k1);
- while (chest != null && t > 0 && JewelrycraftUtil.ores.size() > 0) {
- chest.func_145976_a(StatCollector.translateToLocal("jeweler." + Variables.MODID + ".orechest"));
- int oreID = random.nextInt(JewelrycraftUtil.ores.size());
- ItemStack ores = JewelrycraftUtil.ores.get(oreID).copy();
+ TileEntityChest chest =
+ (TileEntityChest) world.getTileEntity(i1, j1, k1);
+ while (chest != null && t > 0
+ && JewelrycraftUtil.ores.size() > 0) {
+ chest.func_145976_a(StatCollector.translateToLocal(
+ "jeweler." + Variables.MODID + ".orechest"));
+ int oreID =
+ random.nextInt(JewelrycraftUtil.ores.size());
+ ItemStack ores =
+ JewelrycraftUtil.ores.get(oreID).copy();
ores.stackSize = 2 + random.nextInt(randomAmount);
- if (random.nextBoolean()) chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), ores);
+ if (random.nextBoolean())
+ chest.setInventorySlotContents(
+ random.nextInt(chest.getSizeInventory()),
+ ores);
t--;
}
}
}
}
- public void generateDisplayer(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb) {
+ public void generateDisplayer(World world, int i, int j, int k,
+ int metadata, Random random, StructureBoundingBox sbb) {
int i1 = getXWithOffset(i, k);
int j1 = getYWithOffset(j);
int k1 = getZWithOffset(i, k);
- placeBlockAtCurrentPosition(world, BlockList.displayer, metadata, i, j, k, sbb);
+ placeBlockAtCurrentPosition(world, BlockList.displayer, metadata,
+ i, j, k, sbb);
if (world.getTileEntity(i1, j1, k1) != null) {
- TileEntityDisplayer displayer = (TileEntityDisplayer) world.getTileEntity(i1, j1, k1);
+ TileEntityDisplayer displayer =
+ (TileEntityDisplayer) world.getTileEntity(i1, j1, k1);
if (displayer != null) {
Item[] jewels = { ItemList.ring, ItemList.necklace };
- ItemStack jewel = new ItemStack(jewels[random.nextInt(jewels.length)]);
- if (JewelrycraftUtil.metal.size() > 0) JewelryNBT.addMetal(jewel, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())));
- if (JewelrycraftUtil.objects.size() > 0) JewelryNBT.addModifiers(jewel, JewelrycraftUtil.addRandomModifiers(random.nextInt(4)));
- if (JewelrycraftUtil.gem.size() > 0) JewelryNBT.addGem(jewel, JewelrycraftUtil.gem.get(random.nextInt(JewelrycraftUtil.gem.size())));
+ ItemStack jewel = new ItemStack(
+ jewels[random.nextInt(jewels.length)]);
+ if (JewelrycraftUtil.metal.size() > 0)
+ JewelryNBT.addMetal(jewel,
+ JewelrycraftUtil.metal.get(random.nextInt(
+ JewelrycraftUtil.metal.size())));
+ if (JewelrycraftUtil.objects.size() > 0)
+ JewelryNBT.addModifiers(jewel, JewelrycraftUtil
+ .addRandomModifiers(random.nextInt(4)));
+ if (JewelrycraftUtil.gem.size() > 0)
+ JewelryNBT.addGem(jewel, JewelrycraftUtil.gem.get(
+ random.nextInt(JewelrycraftUtil.gem.size())));
displayer.object = jewel;
displayer.quantity = 1;
displayer.hasObject = true;
@@ -251,66 +427,111 @@ public class ComponentJewelry extends StructureVillagePieces.House1 { }
}
- public void generateSmelter(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, boolean isEmpty) {
+ public void generateSmelter(World world, int i, int j, int k,
+ int metadata, Random random, StructureBoundingBox sbb,
+ boolean isEmpty) {
int i1 = getXWithOffset(i, k);
int j1 = getYWithOffset(j);
int k1 = getZWithOffset(i, k);
- placeBlockAtCurrentPosition(world, BlockList.smelter, metadata, i, j, k, sbb);
+ placeBlockAtCurrentPosition(world, BlockList.smelter, metadata, i,
+ j, k, sbb);
if (world.getTileEntity(i1, j1, k1) != null) {
- TileEntitySmelter smelter = (TileEntitySmelter) world.getTileEntity(i1, j1, k1);
- if (smelter != null && !isEmpty && JewelrycraftUtil.metal.size() > 0) {
+ TileEntitySmelter smelter =
+ (TileEntitySmelter) world.getTileEntity(i1, j1, k1);
+ if (smelter != null && !isEmpty
+ && JewelrycraftUtil.metal.size() > 0) {
int metal = random.nextInt(JewelrycraftUtil.metal.size());
- smelter.moltenMetal = JewelrycraftUtil.metal.get(metal).copy();
+ smelter.moltenMetal =
+ JewelrycraftUtil.metal.get(metal).copy();
smelter.hasMoltenMetal = random.nextBoolean();
float quantity = random.nextFloat();
- if (smelter.hasMoltenMetal) smelter.quantity = quantity < 0.9F ? 0.1F + Math.round(quantity * 10) / 10 : Math.round(quantity * 10) / 10;
+ if (smelter.hasMoltenMetal)
+ smelter.quantity = quantity < 0.9F
+ ? 0.1F + Math.round(quantity * 10) / 10
+ : Math.round(quantity * 10) / 10;
}
}
}
- public void generateMolder(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, boolean hasMold, boolean hasStuff) {
+ public void generateMolder(World world, int i, int j, int k,
+ int metadata, Random random, StructureBoundingBox sbb,
+ boolean hasMold, boolean hasStuff) {
int i1 = getXWithOffset(i, k);
int j1 = getYWithOffset(j);
int k1 = getZWithOffset(i, k);
- placeBlockAtCurrentPosition(world, BlockList.molder, metadata, i, j, k, sbb);
+ placeBlockAtCurrentPosition(world, BlockList.molder, metadata, i,
+ j, k, sbb);
if (world.getTileEntity(i1, j1, k1) != null) {
- TileEntityMolder molder = (TileEntityMolder) world.getTileEntity(i1, j1, k1);
- if (molder != null && !molder.hasMold) if (hasMold) {
- int meta = random.nextInt(ItemMolds.moldsItemNames.length);
- molder.mold = new ItemStack(ItemList.molds, 1, meta);
- molder.hasMold = true;
- if (hasStuff && JewelrycraftUtil.metal.size() > 0) {
- ItemStack ring = new ItemStack(ItemList.ring);
- JewelryNBT.addMetal(ring, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).copy());
- ItemStack necklace = new ItemStack(ItemList.necklace);
- JewelryNBT.addMetal(necklace, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).copy());
- ItemStack bracelet = new ItemStack(ItemList.bracelet);
- JewelryNBT.addMetal(bracelet, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).copy());
- ItemStack earrings = new ItemStack(ItemList.earrings);
- JewelryNBT.addMetal(earrings, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).copy());
- if (meta == 0) molder.jewelBase = JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size()));
- else if (meta == 1) molder.jewelBase = ring;
- else if (meta == 2) molder.jewelBase = necklace;
- else if (meta == 3) molder.jewelBase = bracelet;
- else if (meta == 4) molder.jewelBase = earrings;
- molder.hasJewelBase = true;
+ TileEntityMolder molder =
+ (TileEntityMolder) world.getTileEntity(i1, j1, k1);
+ if (molder != null && !molder.hasMold)
+ if (hasMold) {
+ int meta = random
+ .nextInt(ItemMolds.moldsItemNames.length - 1);
+ molder.mold = new ItemStack(ItemList.molds, 1, meta + 1);
+ molder.hasMold = true;
+ if (hasStuff && JewelrycraftUtil.metal.size() > 0) {
+ ItemStack ring = new ItemStack(ItemList.ring);
+ JewelryNBT.addMetal(ring,
+ JewelrycraftUtil.metal.get(random.nextInt(
+ JewelrycraftUtil.metal.size()))
+ .copy());
+ ItemStack necklace =
+ new ItemStack(ItemList.necklace);
+ JewelryNBT.addMetal(necklace,
+ JewelrycraftUtil.metal.get(random.nextInt(
+ JewelrycraftUtil.metal.size()))
+ .copy());
+ ItemStack bracelet =
+ new ItemStack(ItemList.bracelet);
+ JewelryNBT.addMetal(bracelet,
+ JewelrycraftUtil.metal.get(random.nextInt(
+ JewelrycraftUtil.metal.size()))
+ .copy());
+ ItemStack earrings =
+ new ItemStack(ItemList.earrings);
+ JewelryNBT.addMetal(earrings,
+ JewelrycraftUtil.metal.get(random.nextInt(
+ JewelrycraftUtil.metal.size()))
+ .copy());
+ if (meta == 0)
+ molder.jewelBase = JewelrycraftUtil.metal.get(
+ random.nextInt(JewelrycraftUtil.metal
+ .size()));
+ else if (meta == 1)
+ molder.jewelBase = ring;
+ else if (meta == 2)
+ molder.jewelBase = necklace;
+ else if (meta == 3)
+ molder.jewelBase = bracelet;
+ else if (meta == 4)
+ molder.jewelBase = earrings;
+ molder.hasJewelBase = true;
+ }
}
- }
}
}
- public void generateFurnace(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, int min, int max, boolean hasMetal) {
+ public void generateFurnace(World world, int i, int j, int k,
+ int metadata, Random random, StructureBoundingBox sbb, int min,
+ int max, boolean hasMetal) {
int i1 = getXWithOffset(i, k);
int j1 = getYWithOffset(j);
int k1 = getZWithOffset(i, k);
- placeBlockAtCurrentPosition(world, Blocks.furnace, metadata, i, j, k, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.furnace, metadata, i, j,
+ k, sbb);
if (world.getTileEntity(i1, j1, k1) != null) {
- TileEntityFurnace furnace = (TileEntityFurnace) world.getTileEntity(i1, j1, k1);
+ TileEntityFurnace furnace =
+ (TileEntityFurnace) world.getTileEntity(i1, j1, k1);
if (furnace != null) {
- if (random.nextBoolean()) furnace.setInventorySlotContents(1, new ItemStack(Items.coal, 1 + random.nextInt(16)));
+ if (random.nextBoolean())
+ furnace.setInventorySlotContents(1, new ItemStack(
+ Items.coal, 1 + random.nextInt(16)));
if (hasMetal && JewelrycraftUtil.metal.size() > 0) {
- int metalID = random.nextInt(JewelrycraftUtil.metal.size());
- ItemStack metal = JewelrycraftUtil.metal.get(metalID).copy();
+ int metalID =
+ random.nextInt(JewelrycraftUtil.metal.size());
+ ItemStack metal =
+ JewelrycraftUtil.metal.get(metalID).copy();
metal.stackSize = random.nextInt(max - min + 1) + min;
furnace.setInventorySlotContents(2, metal);
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java b/src/main/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java index f9b5930..68e0651 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java @@ -1,6 +1,7 @@ package darkknight.jewelrycraft.worldGen.village;
import java.util.Random;
+
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler;
import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.item.ItemList;
@@ -15,111 +16,162 @@ import net.minecraft.item.ItemStack; import net.minecraft.village.MerchantRecipe;
import net.minecraft.village.MerchantRecipeList;
-public class JCTrades implements IVillageTradeHandler
-{
- Item[] jewelry = new Item[]{ItemList.ring, ItemList.necklace, ItemList.bracelet, ItemList.earrings};
- public JCTrades()
- {
- super();
- }
-
- /**
- * @param villager
- * @param recipeList
- * @param random
- */
- @Override
- public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random)
- {
- if (villager.getProfession() == 3000){
- ItemStack ingredient = null;
- ItemStack ingredient2 = null;
- ItemStack result;
- int type = random.nextInt(12);
- switch(type)
- {
- case 0:if(JewelrycraftUtil.metal.size() > 0){
- result = JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size()));
- result.stackSize = 5 + random.nextInt(5);
- ingredient = new ItemStack(Items.emerald, 2 + random.nextInt(7));
- if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 2 + random.nextInt(2));
- break;
- }
- case 1:{
- result = new ItemStack(ItemList.molds, 5 + random.nextInt(7), random.nextInt(ItemMolds.moldsItemNames.length));
- ingredient = new ItemStack(Items.emerald, 1);
- if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 1 + random.nextInt(2));
- break;
- }
- case 2:{
- int number = random.nextInt(3);
- result = new ItemStack(BlockList.displayer, 1 + number);
- ingredient = new ItemStack(Blocks.emerald_block, 2 + number * 3 + random.nextInt(2));
- ingredient2 = new ItemStack(Items.emerald, 3 + number + random.nextInt(8));
- break;
- }
- case 3:{
- result = new ItemStack(BlockList.jewelCraftingTable);
- ingredient = new ItemStack(Items.emerald, 1 + random.nextInt(2));
- if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 1 + random.nextInt(2));
- break;
- }
- case 4:{
- result = new ItemStack(BlockList.shadowOre, 1 + random.nextInt(6));
- ingredient = new ItemStack(Items.emerald, 3 + random.nextInt(4));
- if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 3 + random.nextInt(4));
- break;
- }
- case 5:{
- result = new ItemStack(BlockList.molder, 5 + random.nextInt(5));
- ingredient = new ItemStack(Items.emerald, 1);
- if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 1);
- break;
- }
- case 6:{
- result = new ItemStack(BlockList.smelter);
- ingredient = new ItemStack(Items.emerald, 1 + random.nextInt(2));
- if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 1 + random.nextInt(2));
- break;
- }
- case 7:if(JewelrycraftUtil.gem.size() > 0){
- int end = random.nextInt(JewelrycraftUtil.gem.size());
- result = JewelrycraftUtil.gem.get(end);
- result.stackSize = 1 + random.nextInt(JewelrycraftUtil.gem.size() - end);
- if (JewelrycraftUtil.gem.size() - 1 - end >= 1){
- int value = 1 + end;
- if (value > 64) value = 64;
- ingredient = new ItemStack(Items.emerald, 2 + random.nextInt(value));
- if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 2 + random.nextInt(value));
- }else{
- ingredient = new ItemStack(Blocks.emerald_block, 16 + random.nextInt(32));
- ingredient2 = new ItemStack(Blocks.emerald_block, 8 + random.nextInt(48));
- }
- break;
- }
- case 8:if(JewelrycraftUtil.ores.size() > 0){
- result = JewelrycraftUtil.ores.get(random.nextInt(JewelrycraftUtil.ores.size()));
- result.stackSize = 3 + random.nextInt(3);
- ingredient = new ItemStack(Items.emerald, 2 + random.nextInt(5));
- if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 2 + random.nextInt(6));
- break;
- }
- case 9:{
- result = new ItemStack(ItemList.guide, 1);
- ingredient = new ItemStack(Items.emerald, 1);
- break;
- }
- default:{
- result = new ItemStack(jewelry[random.nextInt(4)], 1, 0);
- int randValue = random.nextInt(4);
- if(JewelrycraftUtil.metal.size() > 0) JewelryNBT.addMetal(result, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())));
- if(JewelrycraftUtil.objects.size() > 0) JewelryNBT.addModifiers(result, JewelrycraftUtil.addRandomModifiers(randValue));
- if(JewelrycraftUtil.gem.size() > 0) JewelryNBT.addGem(result, JewelrycraftUtil.gem.get(random.nextInt(JewelrycraftUtil.gem.size())));
- ingredient = new ItemStack(Items.emerald, 16 + random.nextInt(20));
- ingredient2 = new ItemStack(Blocks.emerald_block, 2 + randValue);
- }
- }
- recipeList.addToListWithCheck(new MerchantRecipe(ingredient, ingredient2, result));
- }
- }
+public class JCTrades implements IVillageTradeHandler {
+ Item[] jewelry = new Item[] { ItemList.ring, ItemList.necklace,
+ ItemList.bracelet, ItemList.earrings };
+
+ public JCTrades() {
+ super();
+ }
+
+ /**
+ * @param villager
+ * @param recipeList
+ * @param random
+ */
+ @Override
+ public void manipulateTradesForVillager(EntityVillager villager,
+ MerchantRecipeList recipeList, Random random) {
+ if (villager.getProfession() == 3000) {
+ ItemStack ingredient = null;
+ ItemStack ingredient2 = null;
+ ItemStack result;
+ int type = random.nextInt(12);
+ switch (type) {
+ case 0:
+ if (JewelrycraftUtil.metal.size() > 0) {
+ result = JewelrycraftUtil.metal.get(random
+ .nextInt(JewelrycraftUtil.metal.size()));
+ result.stackSize = 5 + random.nextInt(5);
+ ingredient = new ItemStack(Items.emerald,
+ 2 + random.nextInt(7));
+ if (random.nextBoolean())
+ ingredient2 = new ItemStack(Items.emerald,
+ 2 + random.nextInt(2));
+ break;
+ }
+ case 1: {
+ result = new ItemStack(ItemList.molds,
+ 5 + random.nextInt(7), random.nextInt(
+ ItemMolds.moldsItemNames.length));
+ ingredient = new ItemStack(Items.emerald, 1);
+ if (random.nextBoolean())
+ ingredient2 = new ItemStack(Items.emerald,
+ 1 + random.nextInt(2));
+ break;
+ }
+ case 2: {
+ int number = random.nextInt(3);
+ result = new ItemStack(BlockList.displayer,
+ 1 + number);
+ ingredient = new ItemStack(Blocks.emerald_block,
+ 2 + number * 3 + random.nextInt(2));
+ ingredient2 = new ItemStack(Items.emerald,
+ 3 + number + random.nextInt(8));
+ break;
+ }
+ case 3: {
+ result = new ItemStack(BlockList.jewelCraftingTable);
+ ingredient = new ItemStack(Items.emerald,
+ 1 + random.nextInt(2));
+ if (random.nextBoolean())
+ ingredient2 = new ItemStack(Items.emerald,
+ 1 + random.nextInt(2));
+ break;
+ }
+ case 4: {
+ result = new ItemStack(BlockList.shadowOre,
+ 1 + random.nextInt(6));
+ ingredient = new ItemStack(Items.emerald,
+ 3 + random.nextInt(4));
+ if (random.nextBoolean())
+ ingredient2 = new ItemStack(Items.emerald,
+ 3 + random.nextInt(4));
+ break;
+ }
+ case 5: {
+ result = new ItemStack(BlockList.molder,
+ 5 + random.nextInt(5));
+ ingredient = new ItemStack(Items.emerald, 1);
+ if (random.nextBoolean())
+ ingredient2 = new ItemStack(Items.emerald, 1);
+ break;
+ }
+ case 6: {
+ result = new ItemStack(BlockList.smelter);
+ ingredient = new ItemStack(Items.emerald,
+ 1 + random.nextInt(2));
+ if (random.nextBoolean())
+ ingredient2 = new ItemStack(Items.emerald,
+ 1 + random.nextInt(2));
+ break;
+ }
+ case 7:
+ if (JewelrycraftUtil.gem.size() > 0) {
+ int end = random
+ .nextInt(JewelrycraftUtil.gem.size());
+ result = JewelrycraftUtil.gem.get(end);
+ result.stackSize = 1 + random.nextInt(
+ JewelrycraftUtil.gem.size() - end);
+ if (JewelrycraftUtil.gem.size() - 1 - end >= 1) {
+ int value = 1 + end;
+ if (value > 64)
+ value = 64;
+ ingredient = new ItemStack(Items.emerald,
+ 2 + random.nextInt(value));
+ if (random.nextBoolean())
+ ingredient2 = new ItemStack(Items.emerald,
+ 2 + random.nextInt(value));
+ } else {
+ ingredient =
+ new ItemStack(Blocks.emerald_block,
+ 16 + random.nextInt(32));
+ ingredient2 =
+ new ItemStack(Blocks.emerald_block,
+ 8 + random.nextInt(48));
+ }
+ break;
+ }
+ case 8:
+ if (JewelrycraftUtil.ores.size() > 0) {
+ result = JewelrycraftUtil.ores.get(random
+ .nextInt(JewelrycraftUtil.ores.size()));
+ result.stackSize = 3 + random.nextInt(3);
+ ingredient = new ItemStack(Items.emerald,
+ 2 + random.nextInt(5));
+ if (random.nextBoolean())
+ ingredient2 = new ItemStack(Items.emerald,
+ 2 + random.nextInt(6));
+ break;
+ }
+ case 9: {
+ result = new ItemStack(ItemList.guide, 1);
+ ingredient = new ItemStack(Items.emerald, 1);
+ break;
+ }
+ default: {
+ result = new ItemStack(jewelry[random.nextInt(4)], 1,
+ 0);
+ int randValue = random.nextInt(4);
+ if (JewelrycraftUtil.metal.size() > 0)
+ JewelryNBT.addMetal(result,
+ JewelrycraftUtil.metal.get(random.nextInt(
+ JewelrycraftUtil.metal.size())));
+ if (JewelrycraftUtil.objects.size() > 0)
+ JewelryNBT.addModifiers(result, JewelrycraftUtil
+ .addRandomModifiers(randValue));
+ if (JewelrycraftUtil.gem.size() > 0)
+ JewelryNBT.addGem(result,
+ JewelrycraftUtil.gem.get(random.nextInt(
+ JewelrycraftUtil.gem.size())));
+ ingredient = new ItemStack(Items.emerald,
+ 16 + random.nextInt(20));
+ ingredient2 = new ItemStack(Blocks.emerald_block,
+ 2 + randValue);
+ }
+ }
+ recipeList.addToListWithCheck(
+ new MerchantRecipe(ingredient, ingredient2, result));
+ }
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageHandler.java b/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageHandler.java index 68b892e..757f9e3 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageHandler.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageHandler.java @@ -3,25 +3,25 @@ */
package darkknight.jewelrycraft.worldGen.village;
-import java.io.IOException;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.VillagerRegistry;
import darkknight.jewelrycraft.JewelrycraftMod;
import darkknight.jewelrycraft.util.Variables;
import net.minecraft.world.gen.structure.MapGenStructureIO;
-public class VillageHandler
-{
- public static void preInit(FMLPreInitializationEvent e) throws IOException
- {
- VillagerRegistry.instance().registerVillagerId(3000);
- VillagerRegistry.instance().registerVillageTradeHandler(3000, new JCTrades());
- VillagerRegistry.instance().registerVillageCreationHandler(new VillageJewelryHandler());
- try{
- MapGenStructureIO.func_143031_a(ComponentJewelry.class, Variables.MODID + ":Jewelry");
- }
- catch(Throwable e2){
- JewelrycraftMod.logger.error("Error registering Jewelrycraft Structures with Vanilla Minecraft: this is expected in versions earlier than 1.7.10");
- }
- }
+public class VillageHandler {
+ public static void preInit(FMLPreInitializationEvent e) {
+ VillagerRegistry.instance().registerVillagerId(3000);
+ VillagerRegistry.instance().registerVillageTradeHandler(3000,
+ new JCTrades());
+ VillagerRegistry.instance().registerVillageCreationHandler(
+ new VillageJewelryHandler());
+ try {
+ MapGenStructureIO.func_143031_a(ComponentJewelry.class,
+ Variables.MODID + ":Jewelry");
+ } catch (Throwable thrw) {
+ JewelrycraftMod.logger.error(
+ "Error registering Jewelrycraft Structures with Vanilla Minecraft: this is expected in versions earlier than 1.7.10");
+ }
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java b/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java index dca3b6e..3bd72a0 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java @@ -2,49 +2,51 @@ package darkknight.jewelrycraft.worldGen.village; import java.util.List;
import java.util.Random;
+
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageCreationHandler;
import darkknight.jewelrycraft.config.ConfigHandler;
import net.minecraft.world.gen.structure.StructureVillagePieces.PieceWeight;
import net.minecraft.world.gen.structure.StructureVillagePieces.Start;
-public class VillageJewelryHandler implements IVillageCreationHandler
-{
-
- /**
- * @param random
- * @param i
- * @return
- */
- @Override
- public PieceWeight getVillagePieceWeight(Random random, int i)
- {
- return new PieceWeight(ComponentJewelry.class, ConfigHandler.JEWELER_WEIGHT, ConfigHandler.MAX_VILLAGE_JEWELERS);
- }
-
- /**
- * @return
- */
- @Override
- public Class<?> getComponentClass()
- {
- return ComponentJewelry.class;
- }
-
- /**
- * @param villagePiece
- * @param startPiece
- * @param pieces
- * @param random
- * @param p1
- * @param p2
- * @param p3
- * @param p4
- * @param p5
- * @return
- */
- @Override
- public Object buildComponent(PieceWeight villagePiece, Start startPiece, @SuppressWarnings ("rawtypes") List pieces, Random random, int p1, int p2, int p3, int p4, int p5)
- {
- return ComponentJewelry.buildComponent(startPiece, pieces, random, p1, p2, p3, p4, p5);
- }
+public class VillageJewelryHandler implements IVillageCreationHandler {
+
+ /**
+ * @param random
+ * @param i
+ * @return
+ */
+ @Override
+ public PieceWeight getVillagePieceWeight(Random random, int i) {
+ return new PieceWeight(ComponentJewelry.class,
+ ConfigHandler.JEWELER_WEIGHT,
+ ConfigHandler.MAX_VILLAGE_JEWELERS);
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public Class<?> getComponentClass() {
+ return ComponentJewelry.class;
+ }
+
+ /**
+ * @param villagePiece
+ * @param startPiece
+ * @param pieces
+ * @param random
+ * @param p1
+ * @param p2
+ * @param p3
+ * @param p4
+ * @param p5
+ * @return
+ */
+ @Override
+ public Object buildComponent(PieceWeight villagePiece,
+ Start startPiece, List pieces, Random random, int p1, int p2,
+ int p3, int p4, int p5) {
+ return ComponentJewelry.buildComponent(startPiece, pieces, random,
+ p1, p2, p3, p4, p5);
+ }
}
\ No newline at end of file diff --git a/src/main/resources/assets/jewelrycraft2/lang/en_US.lang b/src/main/resources/assets/jewelrycraft2/lang/en_US.lang index 39aefe8..35c6fda 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/lang/en_US.lang +++ b/src/main/resources/assets/jewelrycraft2/lang/en_US.lang @@ -113,6 +113,10 @@ chatmessage.jewelrycraft2.heartKilled.White=GG! You just killed something that w chatmessage.jewelrycraft2.heartKilled.Blue=GG! You just killed something that was beneficial to you! MURDERER! Blue hearts protect your red hearts, just collide with them, not kill them >:c
chatmessage.jewelrycraft2.heartKilled.Black=GG! You just killed something that was beneficial to you! MURDERER! Black hearts are just like blue ones, but they also deal damage to the attacker >:c
+curse.jewlrycraft2.moneyEqualsPower.bless1=Your movements hasten
+curse.jewlrycraft2.moneyEqualsPower.bless2=Your body strengthens
+curse.jewlrycraft2.moneyEqualsPower.bless3=Your wounds heal
+
curse.jewelrycraft2.blind.description=You see the light slowly fading in front of you
curse.jewelrycraft2.flamingsoul.description=Is it me or is it getting hot in here?
curse.jewelrycraft2.greed.description=You might need that later
@@ -124,6 +128,11 @@ curse.jewelrycraft2.rabbitspaw.description=The Dark Lord is giving you a gift. D curse.jewelrycraft2.rottenheart.description=Your heart slowly rots inside
curse.jewelrycraft2.vampirehunger.description=You feel the need for blood
curse.jewelrycraft2.deathsTouch.description=Death does not wait to see if things are done or not done
+curse.jewelrycraft2.moneyEqualsPower.description=Everything has its price
+curse.jewelrycraft2.scionofhell.description=The infernal lord sends his regards
+curse.jewelrycraft2.doubledown.description=All or nothing
+curse.jewelrycraft2.incredibledevotion.description=How far are you willing to go? +curse.jewelrycraft2.sacredoath.description=Swear upon it (NYI)
curse.jewelrycraft2.blind=Blind
curse.jewelrycraft2.flamingsoul=Flaming Soul
@@ -135,13 +144,19 @@ curse.jewelrycraft2.pentagram=Pentagram curse.jewelrycraft2.rabbitspaw=Rabbit's Paw
curse.jewelrycraft2.rottenheart=Rotten Heart
curse.jewelrycraft2.vampirehunger=Vampire Hunger
-curse.jewelrycraft2.deathsTouch=Deaths Touch
+curse.jewelrycraft2.deathsTouch=Death's Touch
+curse.jewelrycraft2.moneyEqualsPower=Money = Power
+curse.jewelrycraft2.scionofhell=Scion of Hell
+curse.jewelrycraft2.doubledown=Double Down
+curse.jewelrycraft2.incredibledevotion=Incredible Devotion
+Curse.jewelrycraft2.sacredoath=Sacred Oath curse.jewelrycraft2.activated=You got cursed, press C to open the tab to see the active curses.
death.attack.weak=%1$s was weakened by a piece of jewelry and died
death.attack.shadows=%1$s was consumed by the shadows
death.attack.blackHeart=%1$s was killed by a nearby player's curse
+death.attack.doubleDown=%1$s ran out of luck
entity.jewelrycraft2.Heart.name=Heart
entity.jewelrycraft2.HalfHeart.name=Half-Heart
@@ -178,4 +193,4 @@ achievement.jewelrycraft.openGuide.desc=Open the Jewelrycraft 2 Guide achievement.jewelrycraft.pentagram=Resist Temptation
achievement.jewelrycraft.pentagram.desc=§4Challenge:§7 Do not steal health from entities for a day when Pentagram curse is active. §aReward:§7 You permanently steal 1 extra heart from all entities when the curse is active.
-challenge.failed=You failed the challenge:
\ No newline at end of file +challenge.failed=You failed the challenge:
diff --git a/src/main/resources/assets/jewelrycraft2/lang/zh_CN.lang b/src/main/resources/assets/jewelrycraft2/lang/zh_CN.lang index ae56c16..ae56c16 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/lang/zh_CN.lang +++ b/src/main/resources/assets/jewelrycraft2/lang/zh_CN.lang diff --git a/src/main/resources/assets/jewelrycraft2/pack.mcmeta b/src/main/resources/assets/jewelrycraft2/pack.mcmeta index 0b04ef8..0b04ef8 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/pack.mcmeta +++ b/src/main/resources/assets/jewelrycraft2/pack.mcmeta diff --git a/src/main/resources/assets/jewelrycraft2/sounds.json b/src/main/resources/assets/jewelrycraft2/sounds.json index ec9ff11..ec9ff11 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/sounds.json +++ b/src/main/resources/assets/jewelrycraft2/sounds.json diff --git a/src/main/resources/assets/jewelrycraft2/sounds/Ritual.ogg b/src/main/resources/assets/jewelrycraft2/sounds/Ritual.ogg Binary files differindex 3912236..3912236 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/sounds/Ritual.ogg +++ b/src/main/resources/assets/jewelrycraft2/sounds/Ritual.ogg diff --git a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockCrystal.png b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockCrystal.png Binary files differindex 50bf5ec..50bf5ec 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockCrystal.png +++ b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockCrystal.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow0.png b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow0.png Binary files differindex 0b5323d..0b5323d 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow0.png +++ b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow0.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow1.png b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow1.png Binary files differindex 16f9908..16f9908 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow1.png +++ b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow1.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow10.png b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow10.png Binary files differindex be70eb5..be70eb5 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow10.png +++ b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow10.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow11.png b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow11.png Binary files differindex 1684d9a..1684d9a 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow11.png +++ b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow11.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow12.png b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow12.png Binary files differindex ed4ea49..ed4ea49 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow12.png +++ b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow12.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow13.png b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow13.png Binary files differindex 9b2100a..9b2100a 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow13.png +++ b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow13.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow14.png b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow14.png Binary files differindex ea00725..ea00725 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow14.png +++ b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow14.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow15.png b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow15.png Binary files differindex 2140624..2140624 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow15.png +++ b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow15.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow2.png b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow2.png Binary files differindex f95b111..f95b111 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow2.png +++ b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow2.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow3.png b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow3.png Binary files differindex 0dd5633..0dd5633 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow3.png +++ b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow3.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow4.png b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow4.png Binary files differindex a4e926c..a4e926c 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow4.png +++ b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow4.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow5.png b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow5.png Binary files differindex 8461ac4..8461ac4 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow5.png +++ b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow5.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow6.png b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow6.png Binary files differindex 352d3e4..352d3e4 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow6.png +++ b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow6.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow7.png b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow7.png Binary files differindex 9aa0e03..9aa0e03 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow7.png +++ b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow7.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow8.png b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow8.png Binary files differindex ad21447..ad21447 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow8.png +++ b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow8.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow9.png b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow9.png Binary files differindex 01c0fa4..01c0fa4 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow9.png +++ b/src/main/resources/assets/jewelrycraft2/textures/blocks/blockShadow9.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/blocks/molder.png b/src/main/resources/assets/jewelrycraft2/textures/blocks/molder.png Binary files differindex 5a08164..5a08164 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/blocks/molder.png +++ b/src/main/resources/assets/jewelrycraft2/textures/blocks/molder.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/blocks/moltenMetalFlow.png b/src/main/resources/assets/jewelrycraft2/textures/blocks/moltenMetalFlow.png Binary files differindex 8e9a452..8e9a452 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/blocks/moltenMetalFlow.png +++ b/src/main/resources/assets/jewelrycraft2/textures/blocks/moltenMetalFlow.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/blocks/moltenMetalFlow.png.mcmeta b/src/main/resources/assets/jewelrycraft2/textures/blocks/moltenMetalFlow.png.mcmeta index 8e55e43..8e55e43 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/blocks/moltenMetalFlow.png.mcmeta +++ b/src/main/resources/assets/jewelrycraft2/textures/blocks/moltenMetalFlow.png.mcmeta diff --git a/src/main/resources/assets/jewelrycraft2/textures/blocks/moltenMetalStill.png b/src/main/resources/assets/jewelrycraft2/textures/blocks/moltenMetalStill.png Binary files differindex 1eff844..1eff844 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/blocks/moltenMetalStill.png +++ b/src/main/resources/assets/jewelrycraft2/textures/blocks/moltenMetalStill.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/blocks/moltenMetalStill.png.mcmeta b/src/main/resources/assets/jewelrycraft2/textures/blocks/moltenMetalStill.png.mcmeta index 7ceb363..7ceb363 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/blocks/moltenMetalStill.png.mcmeta +++ b/src/main/resources/assets/jewelrycraft2/textures/blocks/moltenMetalStill.png.mcmeta diff --git a/src/main/resources/assets/jewelrycraft2/textures/blocks/oreShadow.png b/src/main/resources/assets/jewelrycraft2/textures/blocks/oreShadow.png Binary files differindex ffc48dc..ffc48dc 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/blocks/oreShadow.png +++ b/src/main/resources/assets/jewelrycraft2/textures/blocks/oreShadow.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/entities/BlackHeart.png b/src/main/resources/assets/jewelrycraft2/textures/entities/BlackHeart.png Binary files differindex 3fd03f2..3fd03f2 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/entities/BlackHeart.png +++ b/src/main/resources/assets/jewelrycraft2/textures/entities/BlackHeart.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/entities/BlueHeart.png b/src/main/resources/assets/jewelrycraft2/textures/entities/BlueHeart.png Binary files differindex f664372..f664372 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/entities/BlueHeart.png +++ b/src/main/resources/assets/jewelrycraft2/textures/entities/BlueHeart.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/entities/Bracelet.png b/src/main/resources/assets/jewelrycraft2/textures/entities/Bracelet.png Binary files differindex 6f936e4..6f936e4 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/entities/Bracelet.png +++ b/src/main/resources/assets/jewelrycraft2/textures/entities/Bracelet.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/entities/Earrings.png b/src/main/resources/assets/jewelrycraft2/textures/entities/Earrings.png Binary files differindex 9b716ef..9b716ef 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/entities/Earrings.png +++ b/src/main/resources/assets/jewelrycraft2/textures/entities/Earrings.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/entities/Mask.png b/src/main/resources/assets/jewelrycraft2/textures/entities/Mask.png Binary files differindex 0ebdf14..0ebdf14 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/entities/Mask.png +++ b/src/main/resources/assets/jewelrycraft2/textures/entities/Mask.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/entities/Necklace.png b/src/main/resources/assets/jewelrycraft2/textures/entities/Necklace.png Binary files differindex fae7bcf..fae7bcf 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/entities/Necklace.png +++ b/src/main/resources/assets/jewelrycraft2/textures/entities/Necklace.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/entities/RedHeart.png b/src/main/resources/assets/jewelrycraft2/textures/entities/RedHeart.png Binary files differindex 8f8623c..8f8623c 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/entities/RedHeart.png +++ b/src/main/resources/assets/jewelrycraft2/textures/entities/RedHeart.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/entities/Ring.png b/src/main/resources/assets/jewelrycraft2/textures/entities/Ring.png Binary files differindex 48233a7..48233a7 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/entities/Ring.png +++ b/src/main/resources/assets/jewelrycraft2/textures/entities/Ring.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/entities/WhiteHeart.png b/src/main/resources/assets/jewelrycraft2/textures/entities/WhiteHeart.png Binary files differindex 1f8d528..1f8d528 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/entities/WhiteHeart.png +++ b/src/main/resources/assets/jewelrycraft2/textures/entities/WhiteHeart.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/entities/jeweler.png b/src/main/resources/assets/jewelrycraft2/textures/entities/jeweler.png Binary files differindex fbd01cb..fbd01cb 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/entities/jeweler.png +++ b/src/main/resources/assets/jewelrycraft2/textures/entities/jeweler.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/gui/chest_ring.png b/src/main/resources/assets/jewelrycraft2/textures/gui/chest_ring.png Binary files differindex 66f00cc..66f00cc 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/gui/chest_ring.png +++ b/src/main/resources/assets/jewelrycraft2/textures/gui/chest_ring.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/gui/curses_tab.png b/src/main/resources/assets/jewelrycraft2/textures/gui/curses_tab.png Binary files differindex 5c5ef83..5c5ef83 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/gui/curses_tab.png +++ b/src/main/resources/assets/jewelrycraft2/textures/gui/curses_tab.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/gui/guidePage.png b/src/main/resources/assets/jewelrycraft2/textures/gui/guidePage.png Binary files differindex f715b17..f715b17 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/gui/guidePage.png +++ b/src/main/resources/assets/jewelrycraft2/textures/gui/guidePage.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/gui/guidePageFlip.png b/src/main/resources/assets/jewelrycraft2/textures/gui/guidePageFlip.png Binary files differindex 7d7845d..7d7845d 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/gui/guidePageFlip.png +++ b/src/main/resources/assets/jewelrycraft2/textures/gui/guidePageFlip.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/gui/hearts.png b/src/main/resources/assets/jewelrycraft2/textures/gui/hearts.png Binary files differindex e9dc99d..e9dc99d 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/gui/hearts.png +++ b/src/main/resources/assets/jewelrycraft2/textures/gui/hearts.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/gui/jewelry_modifier.png b/src/main/resources/assets/jewelrycraft2/textures/gui/jewelry_modifier.png Binary files differindex 2aad1f5..2aad1f5 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/gui/jewelry_modifier.png +++ b/src/main/resources/assets/jewelrycraft2/textures/gui/jewelry_modifier.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/gui/jewelry_tab.png b/src/main/resources/assets/jewelrycraft2/textures/gui/jewelry_tab.png Binary files differindex 376249b..376249b 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/gui/jewelry_tab.png +++ b/src/main/resources/assets/jewelrycraft2/textures/gui/jewelry_tab.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/gui/jewelrycraft2_curses_0.png b/src/main/resources/assets/jewelrycraft2/textures/gui/jewelrycraft2_curses_0.png Binary files differindex ad4f35a..6e5b606 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/gui/jewelrycraft2_curses_0.png +++ b/src/main/resources/assets/jewelrycraft2/textures/gui/jewelrycraft2_curses_0.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/gui/potions.png b/src/main/resources/assets/jewelrycraft2/textures/gui/potions.png Binary files differindex 21a4b11..21a4b11 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/gui/potions.png +++ b/src/main/resources/assets/jewelrycraft2/textures/gui/potions.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/bracelet.png b/src/main/resources/assets/jewelrycraft2/textures/items/bracelet.png Binary files differindex 8dde1d3..8dde1d3 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/bracelet.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/bracelet.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/braceletMold.png b/src/main/resources/assets/jewelrycraft2/textures/items/braceletMold.png Binary files differindex 03f56ac..03f56ac 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/braceletMold.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/braceletMold.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/bucketOverlay.png b/src/main/resources/assets/jewelrycraft2/textures/items/bucketOverlay.png Binary files differindex fc2e2a9..fc2e2a9 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/bucketOverlay.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/bucketOverlay.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/clayBraceletMold.png b/src/main/resources/assets/jewelrycraft2/textures/items/clayBraceletMold.png Binary files differindex e3d929a..e3d929a 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/clayBraceletMold.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/clayBraceletMold.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/clayEarringsMold.png b/src/main/resources/assets/jewelrycraft2/textures/items/clayEarringsMold.png Binary files differindex f6e60a9..f6e60a9 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/clayEarringsMold.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/clayEarringsMold.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/clayIngotMold.png b/src/main/resources/assets/jewelrycraft2/textures/items/clayIngotMold.png Binary files differindex 0fecb22..0fecb22 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/clayIngotMold.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/clayIngotMold.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/clayNecklaceMold.png b/src/main/resources/assets/jewelrycraft2/textures/items/clayNecklaceMold.png Binary files differindex 455f094..455f094 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/clayNecklaceMold.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/clayNecklaceMold.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/clayRingMold.png b/src/main/resources/assets/jewelrycraft2/textures/items/clayRingMold.png Binary files differindex 49d2ab1..49d2ab1 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/clayRingMold.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/clayRingMold.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/crystal.png b/src/main/resources/assets/jewelrycraft2/textures/items/crystal.png Binary files differindex 563a41f..563a41f 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/crystal.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/crystal.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/crystalOverlay.png b/src/main/resources/assets/jewelrycraft2/textures/items/crystalOverlay.png Binary files differindex d17e909..d17e909 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/crystalOverlay.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/crystalOverlay.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/earrings.png b/src/main/resources/assets/jewelrycraft2/textures/items/earrings.png Binary files differindex 7bf3a63..7bf3a63 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/earrings.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/earrings.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/earringsMold.png b/src/main/resources/assets/jewelrycraft2/textures/items/earringsMold.png Binary files differindex e59ca7d..e59ca7d 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/earringsMold.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/earringsMold.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/guide.png b/src/main/resources/assets/jewelrycraft2/textures/items/guide.png Binary files differindex 8d6eb02..8d6eb02 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/guide.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/guide.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/ingotMold.png b/src/main/resources/assets/jewelrycraft2/textures/items/ingotMold.png Binary files differindex 0575de5..0575de5 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/ingotMold.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/ingotMold.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/ingotShadow.png b/src/main/resources/assets/jewelrycraft2/textures/items/ingotShadow.png Binary files differindex e3b3aed..e3b3aed 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/ingotShadow.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/ingotShadow.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/jewelBracelet.png b/src/main/resources/assets/jewelrycraft2/textures/items/jewelBracelet.png Binary files differindex f6fc3c8..f6fc3c8 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/jewelBracelet.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/jewelBracelet.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/jewelEarrings.png b/src/main/resources/assets/jewelrycraft2/textures/items/jewelEarrings.png Binary files differindex 713e5c7..713e5c7 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/jewelEarrings.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/jewelEarrings.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/jewelNecklace.png b/src/main/resources/assets/jewelrycraft2/textures/items/jewelNecklace.png Binary files differindex 41244d4..41244d4 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/jewelNecklace.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/jewelNecklace.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/jewelRing.png b/src/main/resources/assets/jewelrycraft2/textures/items/jewelRing.png Binary files differindex 4875772..4875772 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/jewelRing.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/jewelRing.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/jewelryModifier.png b/src/main/resources/assets/jewelrycraft2/textures/items/jewelryModifier.png Binary files differindex 5deb768..5deb768 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/jewelryModifier.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/jewelryModifier.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/moltenMetalStill.png b/src/main/resources/assets/jewelrycraft2/textures/items/moltenMetalStill.png Binary files differindex 1eff844..1eff844 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/moltenMetalStill.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/moltenMetalStill.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/moltenMetalStill.png.mcmeta b/src/main/resources/assets/jewelrycraft2/textures/items/moltenMetalStill.png.mcmeta index 7ceb363..7ceb363 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/moltenMetalStill.png.mcmeta +++ b/src/main/resources/assets/jewelrycraft2/textures/items/moltenMetalStill.png.mcmeta diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/necklace.png b/src/main/resources/assets/jewelrycraft2/textures/items/necklace.png Binary files differindex 054744d..054744d 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/necklace.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/necklace.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/necklaceMold.png b/src/main/resources/assets/jewelrycraft2/textures/items/necklaceMold.png Binary files differindex 0df4b65..0df4b65 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/necklaceMold.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/necklaceMold.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/ring.png b/src/main/resources/assets/jewelrycraft2/textures/items/ring.png Binary files differindex ae59f5a..ae59f5a 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/ring.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/ring.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/ringMold.png b/src/main/resources/assets/jewelrycraft2/textures/items/ringMold.png Binary files differindex 7bab639..7bab639 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/ringMold.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/ringMold.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/structureGen.png b/src/main/resources/assets/jewelrycraft2/textures/items/structureGen.png Binary files differindex 83fbcbc..83fbcbc 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/structureGen.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/structureGen.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_0.png b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_0.png Binary files differindex b697488..b697488 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_0.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_0.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_1.png b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_1.png Binary files differindex e685e40..e685e40 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_1.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_1.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_10.png b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_10.png Binary files differindex 8a2cc52..8a2cc52 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_10.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_10.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_11.png b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_11.png Binary files differindex 91a2869..91a2869 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_11.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_11.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_12.png b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_12.png Binary files differindex 6e2360c..6e2360c 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_12.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_12.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_2.png b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_2.png Binary files differindex 32a0cfb..32a0cfb 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_2.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_2.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_3.png b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_3.png Binary files differindex 75141a5..75141a5 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_3.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_3.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_4.png b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_4.png Binary files differindex ee2a582..ee2a582 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_4.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_4.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_5.png b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_5.png Binary files differindex c011c21..c011c21 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_5.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_5.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_6.png b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_6.png Binary files differindex 5c145ff..5c145ff 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_6.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_6.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_7.png b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_7.png Binary files differindex 833e7d6..833e7d6 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_7.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_7.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_8.png b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_8.png Binary files differindex d3bc0af..d3bc0af 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_8.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_8.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_9.png b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_9.png Binary files differindex 1b3193f..1b3193f 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/testItem_9.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/testItem_9.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/thiefGloves.png b/src/main/resources/assets/jewelrycraft2/textures/items/thiefGloves.png Binary files differindex b56e925..b56e925 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/thiefGloves.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/thiefGloves.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/unused/blockMold.png b/src/main/resources/assets/jewelrycraft2/textures/items/unused/blockMold.png Binary files differindex e1c2d7b..e1c2d7b 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/unused/blockMold.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/unused/blockMold.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/unused/clayBlockMold.png b/src/main/resources/assets/jewelrycraft2/textures/items/unused/clayBlockMold.png Binary files differindex 0dd9029..0dd9029 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/unused/clayBlockMold.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/unused/clayBlockMold.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot2.png b/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot2.png Binary files differindex 8bd47da..8bd47da 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot2.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot2.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot3.png b/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot3.png Binary files differindex 47c9cb8..47c9cb8 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot3.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot3.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot4.png b/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot4.png Binary files differindex 78894d0..78894d0 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot4.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot4.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot5.png b/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot5.png Binary files differindex 968b53d..968b53d 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot5.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot5.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot6.png b/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot6.png Binary files differindex e025782..e025782 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot6.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot6.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot7.png b/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot7.png Binary files differindex b378e29..b378e29 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot7.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/unused/ingot7.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_axe.png b/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_axe.png Binary files differindex d17f67a..d17f67a 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_axe.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_axe.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_boots.png b/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_boots.png Binary files differindex 9c88a3b..9c88a3b 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_boots.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_boots.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_chestplate.png b/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_chestplate.png Binary files differindex 9d4a336..9d4a336 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_chestplate.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_chestplate.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_helmet.png b/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_helmet.png Binary files differindex 97e1541..97e1541 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_helmet.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_helmet.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_hoe.png b/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_hoe.png Binary files differindex 5e0df11..5e0df11 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_hoe.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_hoe.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_leggings.png b/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_leggings.png Binary files differindex 65f5117..65f5117 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_leggings.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_leggings.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_pickaxe.png b/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_pickaxe.png Binary files differindex 95c5394..95c5394 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_pickaxe.png +++ b/src/main/resources/assets/jewelrycraft2/textures/items/unused/shadow_pickaxe.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/particle/shadows.png b/src/main/resources/assets/jewelrycraft2/textures/particle/shadows.png Binary files differindex 8853fb2..8853fb2 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/particle/shadows.png +++ b/src/main/resources/assets/jewelrycraft2/textures/particle/shadows.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/tileentities/BricksPedestal.png b/src/main/resources/assets/jewelrycraft2/textures/tileentities/BricksPedestal.png Binary files differindex 08ca87b..08ca87b 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/tileentities/BricksPedestal.png +++ b/src/main/resources/assets/jewelrycraft2/textures/tileentities/BricksPedestal.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/tileentities/Displayer.png b/src/main/resources/assets/jewelrycraft2/textures/tileentities/Displayer.png Binary files differindex 200637b..200637b 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/tileentities/Displayer.png +++ b/src/main/resources/assets/jewelrycraft2/textures/tileentities/Displayer.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/tileentities/JewelrsCraftingBench.png b/src/main/resources/assets/jewelrycraft2/textures/tileentities/JewelrsCraftingBench.png Binary files differindex 86f0ece..86f0ece 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/tileentities/JewelrsCraftingBench.png +++ b/src/main/resources/assets/jewelrycraft2/textures/tileentities/JewelrsCraftingBench.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/tileentities/Molder.png b/src/main/resources/assets/jewelrycraft2/textures/tileentities/Molder.png Binary files differindex c5acc88..c5acc88 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/tileentities/Molder.png +++ b/src/main/resources/assets/jewelrycraft2/textures/tileentities/Molder.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/tileentities/ShadowEye1.png b/src/main/resources/assets/jewelrycraft2/textures/tileentities/ShadowEye1.png Binary files differindex 8916dc4..8916dc4 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/tileentities/ShadowEye1.png +++ b/src/main/resources/assets/jewelrycraft2/textures/tileentities/ShadowEye1.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/tileentities/ShadowEye2.png b/src/main/resources/assets/jewelrycraft2/textures/tileentities/ShadowEye2.png Binary files differindex 3c53104..3c53104 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/tileentities/ShadowEye2.png +++ b/src/main/resources/assets/jewelrycraft2/textures/tileentities/ShadowEye2.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/tileentities/ShadowEye3.png b/src/main/resources/assets/jewelrycraft2/textures/tileentities/ShadowEye3.png Binary files differindex a6340fb..a6340fb 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/tileentities/ShadowEye3.png +++ b/src/main/resources/assets/jewelrycraft2/textures/tileentities/ShadowEye3.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/tileentities/ShadowEye4.png b/src/main/resources/assets/jewelrycraft2/textures/tileentities/ShadowEye4.png Binary files differindex 0ba066e..0ba066e 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/tileentities/ShadowEye4.png +++ b/src/main/resources/assets/jewelrycraft2/textures/tileentities/ShadowEye4.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/tileentities/ShadowHand.png b/src/main/resources/assets/jewelrycraft2/textures/tileentities/ShadowHand.png Binary files differindex e2b82c7..e2b82c7 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/tileentities/ShadowHand.png +++ b/src/main/resources/assets/jewelrycraft2/textures/tileentities/ShadowHand.png diff --git a/src/main/resources/assets/jewelrycraft2/textures/tileentities/Smelter.png b/src/main/resources/assets/jewelrycraft2/textures/tileentities/Smelter.png Binary files differindex 975c577..975c577 100644..100755 --- a/src/main/resources/assets/jewelrycraft2/textures/tileentities/Smelter.png +++ b/src/main/resources/assets/jewelrycraft2/textures/tileentities/Smelter.png diff --git a/src/main/resources/logo.png b/src/main/resources/logo.png Binary files differindex d5d68c2..d5d68c2 100644..100755 --- a/src/main/resources/logo.png +++ b/src/main/resources/logo.png diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 61d26c9..61d26c9 100644..100755 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info |
